Skip to content

dash-spv: our own parse failures ban peers for 24 hours #1239

In progress

Description

@xdustinface

All paths are under dash-spv/src/ at 8dde9d0c (dev after #902).

Any decode error that is not I/O bans the sender for 24 hours (network/peer.rs:473-479). A failed headers2 decompression also bans and disconnects (network/peer.rs:509-520), and since headers2 is chosen once per connection (network/peer.rs:365) there is no fallback to plain headers. Before #902, dev skipped the bad frame and resynced, and turned headers2 off for that peer with a small reputation penalty. Dash Core itself only logs a message it cannot parse. So a format change in a known message, or a bug in our decoder, bans every peer that sends it.

Evidence. Throwaway tests with a fake peer sending one bad frame through the real DisconnectedPeer::connect:

  • headers with a non-zero tx count (ParseFailed): banned
  • ping with a bad checksum: banned
  • headers2 whose first header is compressed: banned
  • a transaction truncated to 3 bytes (Io UnexpectedEof): not banned
  • a transaction with an unknown special type: not banned (it decodes as TransactionType::Unknown)

Bans::dialed (network/bans.rs:54-56) also removes the whole entry, so a Misbehaved ban that the reader sets after connect has spawned it (network/peer.rs:407) is erased when repair_round reaches dialed (network/manager.rs:846). A test confirmed dialed wipes a Misbehaved entry. The race window is narrow (0 hits in 20 timing runs).

Fix. Ban only on proven misbehaviour rather than on our own decode failures, fall back to plain headers on a headers2 failure, and make dialed reset only the dial-failure backoff.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions