Skip to content

dash-spv: the rewritten network module has almost no tests #1243

Open

Description

@xdustinface

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

network/costs.rs, network/bans.rs and network/peer.rs contain no tests, and the network module has 12 tests in total (in broker.rs, manager.rs and two DNS tests in discovery.rs). None of the fix commits that went into #902 added one. Nothing covers:

  • Bans, including the configured-peer exemption
  • Ledger charge and settle, including cfilter streaming and notfound
  • the keepalive ping and dropping peers that stop answering
  • the dial deadline and backoff
  • the block re-request after a failed validation
  • the attempt 2+ path in Broker::expire (the_timeout_monitor_requeues_stalled_requests uses attempts: 1, so it only runs the kick branch)
  • PeerDiscoverer::learn and probed
  • the replaced-connection guard in the pump (deleting if !reconnected passes every existing test)
  • the owner and voting elements in the filter rescan (the test_rescan_batch_* tests use the default empty element list)
  • peer swap, last resort, ByteLimiter and hedging

Supervisor fill is only exercised end to end by the dashd disconnect tests (tests/dashd_sync/tests_disconnect.rs).

Evidence. During the #902 review, small throwaway unit tests against the existing helpers reproduced several defects that are now filed separately: the mempool relay loss on reconnect (#1231), the Ledger leak (#1232), the stalled-peer re-pick in route (#1237), the reader blocked on a pong write (#1238), the parse-failure bans (#1239) and the discovery loop (#1240). Each would have been caught by a test of this kind.

Fix. Add unit tests for each item above, starting with the ones that reproduce the filed defects.

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