Repository navigation
fix(dash-spv): skip peers lacking required services - #1480
Conversation
A node that completed the handshake without a service the client needs was dropped and backed off like a failed dial, so it was redialed within a minute, round after round. Gossiped addresses were learned whenever they advertised `NETWORK`, though the client also needs compact filters and bloom. Such a node is now banned for the day with the new `Ban::MissingServices`, since its services do not change within a session. Gossiped addresses are learned only if they advertise every required service.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 57 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1480 +/- ##
==========================================
+ Coverage 86.57% 86.70% +0.13%
==========================================
Files 270 271 +1
Lines 71306 71583 +277
==========================================
+ Hits 61730 62067 +337
+ Misses 9576 9516 -60
|
|
✅ Review complete in 7m 5s Planner (6s) Review (behavior · full): 6 findings Judge: 3 kept · 3 dropped (1m 21s) Review metadataConfig:
Account limits:
Judge decisions:
Timing:
|
There was a problem hiding this comment.
✅ Approved. 3 suggestions, none of which block.
What this does: Peers that lack a needed service, such as compact filters or bloom filters, were only backed off briefly after their handshake, so the client redialed them. They are now banned for 24 hours, and gossiped addresses that advertise too few services are no longer learned.
1 suggestion is not listed.
Related work: open PRs and issues this PR may duplicate or fix. None of them blocks.
- This PR may fix #1241 dash-spv: a configured peer rejected for missing services fails silently and is redialed forever. Add
Closes #1241to the description if it does.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: Run the SPV client on testnet with filters enabled, cargo run -p dash-spv --features cli --bin dash-spv -- --network testnet --data-dir <dir>, with debug logging for dash_spv::network.
- Let the client run for several minutes. Expect each
dropping <addr>: lacks required servicesline to appear at most once per address. - Watch
learned N new peer address(es)lines. Expect learned peers to connect without being dropped for missing services. - Enable mempool tracking and restart. Expect nodes without
BLOOMto be dropped once and not redialed. - Configure a peer that lacks compact filters as a configured peer. Expect it to be redialed after a short backoff, not banned for 24 hours.
- Stop and start the network manager in one process. Expect a node banned for missing services to stay out of the dial set.
About this review
- Reviewed
70b1d3d, round 1 - 92 changed lines read in 7m 5s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 2.8M in (2.2M from cache) · 46k out · about $3.82 at API prices
- Runner: self-hosted · started after 14m 9s · peak memory 2.4 GiB of 30.0 GiB
- How Manki reviews
d6968cc
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
✅ Review complete in 8m 28s Planner (6s) Review (behavior · full): 7 findings Judge: 2 kept · 5 dropped (3m 37s) Review metadataConfig:
Account limits:
Judge decisions:
Timing:
|
There was a problem hiding this comment.
✅ Approved.
What this does: Peers that cannot serve what the client needs, such as compact filters, used to be dialed again and again. They are now banned after the handshake shows it, and gossiped addresses that advertise too few services are never added to the candidate pool.
Related work: open PRs and issues this PR may duplicate or fix. None of them blocks.
- This PR may fix #1241 dash-spv: a configured peer rejected for missing services fails silently and is redialed forever. Add
Closes #1241to the description if it does.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: Run the SPV client on testnet with filters enabled and peer_speed and dash_spv::network debug logs turned on.
- Let the client connect for several minutes. Expect each
dropping ...: lacks required serviceslog line to appear at most once per address. - Watch the discovery logs. Expect
learned N new peer address(es)counts to include only peers that advertise compact filters, plus bloom when mempool tracking is on. - Add a configured peer that lacks compact filters and enable
restrict_to_configured_peers. Expect the client to keep redialing it with backoff and never ban it. - Disable filters and mempool tracking. Expect peers that advertise only
NETWORKto be accepted and learned from gossip. - Stop and start the network manager. Expect a peer banned for missing services to stay out of the dial set.
About this review
- Reviewed
d6968cc, round 2 - 102 changed lines read in 8m 28s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 3.2M in (2.3M from cache) · 54k out · about $4.46 at API prices
- Runner: self-hosted · started after 53s · peak memory 2.4 GiB of 30.0 GiB
- How Manki reviews
| let config = ClientConfig::regtest().with_transport_preference(TransportPreference::V1Only); | ||
| let net = PeerNetworkManager::new(&config).await; | ||
|
|
||
| let dialed = DisconnectedPeer::new(node.addr, Network::Regtest) |
There was a problem hiding this comment.
Both tests poke internals: DisconnectedPeer::connect + state.bans here, and a fabricated conn(1, 0) event + state.discoverer in the gossip one. Could you take a look at whether they can go through the public manager instead? It would be cleaner.
There was a problem hiding this comment.
These follow how the rest of this module tests. The handshake test dials a real loopback node through the same connect the supervisor uses, and the gossip test pushes a real addr/addrv2 message into the pump's channel. Nothing is set by hand, the asserts only read the result.
A run through start() would need discovery to hand the supervisor a non-configured peer, because configured peers are never banned. The supervisor's follow-up DialFailed can't shorten the 24h ban either, since Bans::ban keeps the later expiry.
| .inbound | ||
| .send(PeerEvent::Message(conn(1, 0), addr.into())) | ||
| .expect("the pump is running"); | ||
| tokio::time::sleep(Duration::from_millis(100)).await; |
There was a problem hiding this comment.
This waits 100ms of real time for the pump, which can flake on a loaded CI runner. Could it wait on the event, or use paused time?
There was a problem hiding this comment.
Good catch, it now runs on paused time and waits with settle() like the other tests in the module (c9d4234).
The gossip test slept 100ms of real time for the pump, the only real-time wait in the module. It now runs on paused time and yields with `settle()` like its neighbours.
|
✅ Review complete in 5m 32s Planner (5s) Review (behavior · full): 6 findings Judge: 3 kept · 3 dropped (2m 29s) Review metadataConfig:
Account limits:
Judge decisions:
Timing:
Last reviewed
|
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
There was a problem hiding this comment.
Create an issue for this to track it for later. Manki approves once every warning is handled.
Related work: open PRs and issues this PR may duplicate or fix. None of them blocks.
- This PR may fix #1241 dash-spv: a configured peer rejected for missing services fails silently and is redialed forever. Add
Closes #1241to the description if it does.
About this review
- Reviewed
c9d4234, round 3 - 102 changed lines read in 5m 32s
- Found by
claude-opus-5-5andgpt-6.2-sol, judged byclaude-opus-5-5 - Tokens: 2.3M in (1.7M from cache) · 43k out · about $3.34 at API prices
- Runner: self-hosted · started after 8s · peak memory 2.7 GiB of 30.0 GiB
- How Manki reviews
|
Bots are done — your move: address ZocoLini left a review thread unresolved, then post |
There was a problem hiding this comment.
✅ Approved. All blocking threads are resolved, and no warning thread holds the approval.
What this does: Peers that cannot serve what the client needs were dialed again and again, and gossip kept adding more of them. Such a node is now banned for a day after its handshake, and gossip skips addresses that do not advertise the required services.
What to test
The review model wrote these steps. Check what a step runs before you follow it.
Setup: Run the SPV client on testnet with filters enabled, with debug logging for dash_spv::network.
- Let the client connect while some candidate nodes lack compact filter support. Expect a
lacks required serviceswarning for each such node once, and no redial of that address in later rounds. - Watch the
learned N new peer address(es)logs. Expect only addresses that advertise every required service to be added. - Disable filters and mempool tracking, then restart. Expect nodes that only advertise
NETWORKto be accepted again. - Configure a peer with
peersthat lacks compact filters. Expect it to be retried with dial backoff and never banned.
…run 45056597953)
A node that completed the handshake without a service the client needs was dropped and backed off like a failed dial, so the supervisor redialed it within a minute, round after round. Addresses gossiped by peers were learned whenever they advertised
NETWORK, although the client also needs compact filters and bloom, so the pool kept filling with nodes that would only be dropped after their handshake.Such a node is now banned for the day with the new
Ban::MissingServices, since its services do not change within a session. Gossipedaddrandaddrv2entries are learned only if they advertise every required service.PR Hygiene ·
c9d4234/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit