Skip to content

fix(dash-spv): skip peers lacking required services - #1480

Merged
ZocoLini merged 4 commits into
devfrom
fix/skip-peers-lacking-services
Nov 22, 2026
Merged

ZocoLini merged 4 commits into
devfrom
fix/skip-peers-lacking-services

Conversation

@xdustinface

@xdustinface xdustinface commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

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. Gossiped addr and addrv2 entries are learned only if they advertise every required service.

PR Hygiene · c9d4234

  • Bots — coderabbitai skipped after its own rate limit
  • Self-review — address ZocoLini left a review thread unresolved, then post /self-reviewed
  • Build green
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • Bug Fixes
    • Peers that lack services required by the client are now rejected and banned for 24 hours.
    • Addresses advertised by peers without the required services are no longer added to the address list.

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.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 70b1d3d and c9d4234.

Files selected for processing: 1

  • dash-spv/src/network/manager.rs

No actionable comments were generated in the recent review.

Walkthrough

The network manager now filters peer-address gossip using all required service flags. Connections to peers that lack required services receive a MissingServices ban with a 24-hour duration.

Changes: Required-service peer handling

Layer / File(s) Summary
Missing-services ban policy
dash-spv/src/network/bans.rs
Adds Ban::MissingServices and assigns it the misbehaviour-ban duration. A paused-time test checks that the ban remains active after ten times the maximum dial backoff.
Required-service filtering and connection handling
dash-spv/src/network/manager.rs, dash-spv/src/network/peer.rs
The manager filters legacy and addrv2 gossip addresses against all required service flags. The connection path bans peers that lack required services. Tests cover configurable handshake services, rejected connections, and filtered address discovery.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related issues

  • dashpay/rust-dashcore#1243 — Adds a Bans test, covering part of the issue’s requested test coverage.
  • dashpay/rust-dashcore#1241 — Changes the handling of peers that lack required services by assigning them Ban::MissingServices.

Possibly related PRs

  • dashpay/rust-dashcore#902 — Changes peer address learning and handling in the network manager, which this PR also modifies.

Suggested reviewers: zocolini, quantumexplorer

Merge Risk: Minimal · previous review 70b1d

Peers that finish the handshake but lack required services are now banned for a day instead of being redialed within a minute. Learned peer addresses are also filtered by all required services. No concrete merge-blocking risk was identified, and tests cover the new behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(dash-spv): skip peers lacking required services" matches the main change. The PR adds Ban::MissingServices so peers that lack required services are banned, and it filters addr/addrv2 go…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(dash-spv): skip peers lacking required services" matches the main change. The PR adds Ban::MissingServices so peers that lack required services are banned, and it filters addr/addrv2 gossip by all required service flags. The title names the component (dash-spv), the fix type, and the core behavior. It is concise and specific, and it does not use vague terms.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 022b25f and 70b1d3d.

Files selected for processing: 3

  • dash-spv/src/network/bans.rs
  • dash-spv/src/network/manager.rs
  • dash-spv/src/network/peer.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 22, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (022b25f) to head (c9d4234).
⚠️ Report is 2 commits behind head on dev.

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     
Flag Coverage Δ
core 82.14% <ø> (ø)
rpc 82.14% <ø> (ø)
spv 94.96% <100.00%> (+0.29%) ⬆️
wallet 82.14% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/network/bans.rs 95.23% <100.00%> (+1.12%) ⬆️
dash-spv/src/network/manager.rs 95.41% <100.00%> (+1.49%) ⬆️
dash-spv/src/network/peer.rs 92.60% <100.00%> (+1.30%) ⬆️

... and 13 files with indirect coverage changes

@manki-review

manki-review Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

✅ Review complete in 7m 5s

Planner (6s)
    feat · 92 lines · 2 agents
    judge effort: medium

Review (behavior · full): 6 findings
    ✅ Claude Opus 5.5 · high: 0 findings (3m 8s)
    ✅ GPT 6.2 Sol · high: 6 findings (2m 31s)
    ✅ Claim checks and fix checks: 7 of 7 done (1m 19s)
    ✅ Second reads: 1 of 1 done (43s)

Judge: 3 kept · 3 dropped (1m 21s)
    kept: 3 suggestions
    dropped: 1 blocker · 1 warning · 1 suggestion

Review metadata

Config:

  • Models: reviewer=claude-opus-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner)
  • Team: Claude Opus 5.5 · high, GPT 6.2 Sol · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 4% (resets 2026-11-27 01:00 UTC)
  • ChatGPT subscription: weekly 7% (resets 2026-11-25 01:21 UTC)

Judge decisions:

  • Kept: "Configured peers that lack required services are still redialed every minute" (suggestion): "note. The mechanics are right. bans.rs:36 drops every non-DialFailed ban for a configured peer, and manager.rs:840 then applies DialFailed, so a configured peer without filters is redialed within 60 s. The exemption is a stated design, though: bans.rs:22-23 says configured peers are only backed off on a failed dial, because banning one can leave a restricted client with nothing to dial. This is intended but surprising behaviour, so it is a question about the choice. Should a configured endpoint that can never serve filters keep being redialed?"
  • Not listed, over the review.notes limit: "Stale address gossip can hide the only usable replacement peer" (suggestion): "note. The comment at manager.rs:1338-1339 and the PR description show that filtering gossip on the full required mask is a deliberate trade-off. A node whose gossiped bits are stale is dropped, but the seed and DNS pool at discovery.rs:115 still supplies candidates. Spending the once-per-connection gossip slot on a message that leaves nothing after filtering already happened before this PR with the NETWORK filter. The scenario where a stale-bit node is the only reachable replacement is not shown in the code. This is a question about whether to keep a lower-priority pool of addresses with incomplete masks."
  • Dropped: "Day-long bans take slots away from eligible dial candidates" (ignore): "ignore. The sampling at discovery.rs:123, which picks candidates before manager.rs:773 removes banned ones, is unchanged by this PR. The chance of drawing the one eligible address in a round is the same as before. Before the PR, those incompatible nodes were dialed and handshaked after each 60 s backoff, which cost a full connect each time. Now a round of banned draws ends at manager.rs:811 without dialing. The longer ban makes these rounds cheaper and does not slow discovery of a compatible peer."
  • Dropped: "Expired bans accumulate without a memory bound" (ignore): "ignore. The insert at bans.rs:41 and the non-reclaiming filter at bans.rs:67 are untouched by this PR. Before the PR, DialFailed, Kicked and Misbehaved already created one entry per failed endpoint. MissingServices adds no new insertion path and no faster one. Growth is limited to the supervisor's own dial rate of a few candidates per round, and the PR does not affect it."
  • Kept: "The regression tests bypass the public peer lifecycle" (suggestion): "note. The new tests drive DisconnectedPeer::connect directly and assert on net.state.bans and net.state.discoverer. The gossip test also injects a PeerEvent with a made-up connection id instead of going through PeerNetworkManager's public API. AGENTS.md asks for tests through the public API. Both tests still fail when the code they cover is reverted, so this is a test-quality point, not a test that cannot fail."
  • Kept: "The gossip regression test only covers legacy addresses" (suggestion): "note. gossip_without_required_services_is_not_learned sends only NetworkMessage::Addr. The changed AddrV2 predicate at manager.rs:1345 has no test that fails if it is reverted, which AGENTS.md requires for every fix. The AddrV2 arm works today, so this is a missing test."

Timing:

  • Parse: 6.6s
  • Review agents: 336.9s
  • Judge: 81.1s
  • Total: 424.6s

manki-review[bot]
manki-review Bot previously approved these changes Nov 22, 2026

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.


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.

  1. Let the client run for several minutes. Expect each dropping <addr>: lacks required services line to appear at most once per address.
  2. Watch learned N new peer address(es) lines. Expect learned peers to connect without being dropped for missing services.
  3. Enable mempool tracking and restart. Expect nodes without BLOOM to be dropped once and not redialed.
  4. 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.
  5. 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-5 and gpt-6.2-sol, judged by claude-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

Comment thread dash-spv/src/network/manager.rs Resolved
Comment thread dash-spv/src/network/manager.rs Resolved
Comment thread dash-spv/src/network/peer.rs Resolved
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026
@manki-review

manki-review Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

✅ Review complete in 8m 28s

Planner (6s)
    feat · 102 lines · 2 agents
    judge effort: medium

Review (behavior · full): 7 findings
    ✅ Claude Opus 5.5 · high: 0 findings (2m 13s)
    ✅ GPT 6.2 Sol · high: 7 findings (3m 1s)
    ✅ Claim checks and fix checks: 7 of 7 done (1m 11s)

Judge: 2 kept · 5 dropped (3m 37s)
    kept: 2 suggestions
    dropped: 2 warnings · 3 suggestions

Review metadata

Config:

  • Models: reviewer=claude-opus-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner)
  • Team: Claude Opus 5.5 · high, GPT 6.2 Sol · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 5% (resets 2026-11-27 01:00 UTC)
  • ChatGPT subscription: weekly 8% (resets 2026-11-25 01:21 UTC)

Judge decisions:

  • Not listed, on code an earlier round reviewed: "Gossip filtering drops usable peers whose service flags are incomplete" (suggestion): "note. The PR description and the comment at manager.rs:1338 show this is a chosen trade-off: only gossip that advertises every required service is learned. Dash Core does store DNS seed records with only NODE_NETWORK (dashpay/dash:src/protocol.h:355, net.cpp:2823), so some usable endpoints are skipped. The client still gets DNS seeds and fixed seeds, so the result stays correct. This is a question about the choice, not a defect."
  • Kept: "Configured peers still get redialed after a confirmed service mismatch" (suggestion): "note. This is the same defect as P3, and the code at that spot is unchanged. bans.rs:36 still returns before MissingServices is recorded for a configured address, and manager.rs:840 then applies DialFailed, which is capped at 60 s. The cell from the prior round is kept."
  • Not listed, on code this PR did not change: "Day-banned peers still take slots in the dial sample" (warning): "warning. This PR makes service-mismatch bans last 24 hours (bans.rs:48). next_candidates samples want addresses from the pool without regard to bans (discovery.rs:123) and only then removes the banned ones (manager.rs:773). An all-banned sample returns early at manager.rs:811. When the set is full and waiting to replace a slow peer, no FILL_TICK retry runs (manager.rs:761), so that replacement probe is lost. When the set is short, filling is delayed. Whether the pool is mostly incompatible depends on the network, which the code shown does not settle.
    Refutation unsettled: PeerDiscoverer::get picks count addresses from the pool without checking bans (discovery.rs:123). next_candidates only removes banned addresses afterwards (manager.rs:773). An all-banned batch makes repair_round return early (manager.rs:811). When the set is full, FILL_TICK does not retry (manager.rs:761), and the pump wakes the supervisor only when the underserving peer changes (manager.rs:707-717), so a lost replacement probe is not retried for the same slow peer. Rule checked: Taking a fixed-size sample from a pool before filtering it can leave nothing, even when the pool holds eligible entries outside the sample.
  • Premise "Most addresses in the discovery pool built by PeerDiscoverer::get lack COMPACT_FILTERS or BLOOM, so a sample of deficit + DIAL_MARGIN addresses is often entirely banned" unsettled. Gossiped addresses are now filtered by required services (manager.rs:1345). Seed and DNS addresses are not (discovery.rs:111-119), and the seed fetcher's probe never records service bits (probe.rs:57-108). So the share of incompatible nodes is a fact about the live network that the code does not settle.
  • Premise "This trigger happens in realistic use: when most discovered nodes lack compact filters and the peer set needs a new peer" unsettled. Whether most discovered nodes lack compact filters depends on how the deployed nodes are configured, which no code here shows.
    Pair refutation confirmed: A service-mismatch ban leaves the address in the discovery pool for sampling but excludes it from dialing for 24 hours. An all-banned sample ends the round without a dial: a short set retries on the fill timer, but a full set that woke to replace a slow peer has no periodic retry. Rule checked: Filtering after a bounded random sample does not refill the sample, so the result can be empty even when eligible entries remain in the pool.
  • Premise "Most addresses in the discovery pool built by PeerDiscoverer::get lack COMPACT_FILTERS or BLOOM, so a sample of deficit + DIAL_MARGIN addresses is often entirely banned" confirmed. The code permits an all-banned sample because embedded and DNS seeds enter without a service check and bans are applied only after sampling; gossip is screened by advertised flags, and the actual majority and sample frequency are not established.
  • Premise "This trigger happens in realistic use: when most discovered nodes lack compact filters and the peer set needs a new peer" confirmed. Normal startup invokes the supervisor, which dials discovered peers, bans those that fail the required-service check, and resamples the same pool while short, so the trigger needs no special timing if the stated network conditions hold."
  • Not listed, on code an earlier round reviewed: "An address message with no usable entries suppresses later gossip" (suggestion): "note. Some(empty) does reach addr_answered.insert at manager.rs:1359. Before this PR, an early addr message also used up the one slot per connection, so the later getaddr reply was already lost in that case. A connected peer's own self-announcement carries services that passed the handshake check, so it is not filtered out. The only change is that an early relay now contributes zero addresses instead of a few. Several peers feed the pool, so the cost is small."
  • Not listed, on code this PR did not change: "Untrusted address gossip can cause connections to private endpoints" (warning): "warning, pre-existing. manager.rs:1346 and manager.rs:1354 convert gossiped entries with no routability check. discovery.rs:66 stores them and discovery.rs:116 adds them to the dial pool. This PR only narrows the service filter and does not cause or expose this path. The result is dials from the client's network to endpoints the operator never configured. That is not one of the listed security classes, so it is graded as a cost.
    Refutation confirmed: The gossip pump filters entries only by service bits and size, and learn filters only by timestamp. The learned addresses then go straight into the dial pool, so a loopback or 10/8 address gossiped with the required bits gets stored and dialed. Rule checked: Gossiped addresses are untrusted input, so a client must check that they are routable before dialing them; nothing in this path does that check.
  • Premise "This trigger happens in realistic use: when a peer gossips addresses in 127.0.0.0/8 or 10.0.0.0/8 with the required service bits" confirmed. On the code side, any connected peer's addr or addrv2 reply is fed to learn with checks only on service bits, message size, one reply per peer and the timestamp, never on routability. So a private or loopback entry with the required bits is learned whenever a peer sends one (if no fixed peers are configured), though no code read can show how often peers do.
    Pair refutation confirmed: With automatic discovery enabled, both gossip formats can place fresh private or loopback addresses in the dial pool. If the supervisor selects one, it attempts the TCP connection before checking the destination's handshake services. Rule checked: Converting a peer-supplied address to a socket address and checking its advertised service bits does not establish that the destination is public or authorized.
  • Premise "This trigger happens in realistic use: when a peer gossips addresses in 127.0.0.0/8 or 10.0.0.0/8 with the required service bits" confirmed. In default discovery mode the client asks admitted peers for addresses, and the receive path accepts a peer's first size-compliant gossip message with fresh entries in either IPv4 range when the advertised service bits match."
  • Not listed, on code this PR did not change: "Peer churn grows address-keyed state without a bound" (suggestion): "note, pre-existing. bans.rs:41 inserts an entry per address, and bans.rs:67 only filters expired entries out of the returned set instead of removing them. The base branch already did this for DialFailed. Growth is limited by the dial rate of a few addresses per round, so the memory cost over a session is small."
  • Kept: "The network regression tests bypass the public peer lifecycle" (suggestion): "note. This is the same issue as P2. The gossip test pushes a made-up PeerEvent into net.state.inbound (manager.rs:1825) and reads the private net.state.discoverer (manager.rs:1829). The ban test calls DisconnectedPeer::connect directly (manager.rs:1793). This breaks the AGENTS.md rule to test through the public API. The tests still fail if the filters are reverted, so the cell stays improvement."

Timing:

  • Parse: 11.0s
  • Review agents: 280.0s
  • Judge: 217.3s
  • Total: 508.4s

manki-review[bot]
manki-review Bot previously approved these changes Nov 22, 2026

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.


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.

  1. Let the client connect for several minutes. Expect each dropping ...: lacks required services log line to appear at most once per address.
  2. 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.
  3. 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.
  4. Disable filters and mempool tracking. Expect peers that advertise only NETWORK to be accepted and learned from gossip.
  5. 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-5 and gpt-6.2-sol, judged by claude-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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread dash-spv/src/network/manager.rs Outdated
.inbound
.send(PeerEvent::Message(conn(1, 0), addr.into()))
.expect("the pump is running");
tokio::time::sleep(Duration::from_millis(100)).await;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@manki-review

manki-review Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

✅ Review complete in 5m 32s

Planner (5s)
    feat · 102 lines · 2 agents
    judge effort: medium

Review (behavior · full): 6 findings
    ✅ Claude Opus 5.5 · high: 0 findings (2m 20s)
    ✅ GPT 6.2 Sol · high: 6 findings (2m 8s)
    ✅ Claim checks and fix checks: 5 of 5 done (49s)

Judge: 3 kept · 3 dropped (2m 29s)
    kept: 1 warning · 2 suggestions
    dropped: 1 blocker · 1 warning · 1 suggestion

Review metadata

Config:

  • Models: reviewer=claude-opus-5-5, judge=claude-opus-5-5
  • Triage: trivial=false, subtle=true, paired=true (planner)
  • Team: Claude Opus 5.5 · high, GPT 6.2 Sol · high
  • Memory: enabled (central)

Account limits:

  • Claude subscription: weekly 6% (resets 2026-11-27 01:00 UTC)
  • ChatGPT subscription: weekly 8% (resets 2026-11-25 01:21 UTC)

Judge decisions:

  • Kept: "Configured peers still get redialed after a missing-services rejection" (suggestion): "note. This is the same defect as P2 and P3, and the code at that spot did not change. bans.rs:36 returns early for a configured address unless the ban is DialFailed, so MissingServices is dropped. manager.rs:840 then records DialFailed, capped at MAX_DIAL_BACKOFF. The grade stays on the improvement row it had in earlier rounds."
  • Not listed, on code an earlier round reviewed: "Stale gossip can hide a peer that now offers all required services" (suggestion): "note. The filter at manager.rs:1345 and manager.rs:1353 drops gossip by advertised service bits. This is a deliberate trade-off that the PR description states. The cost is that a relay advertising stale bits can hide one address, while seeds and DNS still feed the pool at discovery.rs:116. Worded as a question: is it worth ranking such addresses below others instead of dropping them?"
  • Kept: "Day-long bans still take slots from the dial sample" (warning): "warning. The new 24 hour MissingServices ban at bans.rs:48 keeps many seed addresses banned for the whole session. discovery.rs:123 samples want addresses before manager.rs:773 removes banned ones, so a three-address replacement batch can come back empty. In that case manager.rs:811 returns, and the fill tick at manager.rs:761 runs only when the set is short. The slow peer is then not replaced until something else wakes the supervisor. It is not shown whether another wake source exists.
    Refutation unsettled: Discoverer::get(want) samples want addresses, which are 3 at capacity, from the pool without checking bans. next_candidates drops banned addresses only afterwards, and repair_round returns on an empty batch. While the set is full, the fill tick is off and every other peer_wake notification needs a short set, so the only retry left is the monitor's wake when a peer becomes underserving, which fires once per change. The new 24-hour MissingServices ban keeps such addresses in the banned... Rule checked: A random sample of a fixed size taken before banned entries are removed can shrink to nothing after filtering, and a select! branch guarded by if short never fires while the peer set is full.
  • Premise "When the peer set is at capacity, nothing other than peer_wake reruns Supervisor::repair_round after a replacement batch comes back empty at manager.rs:811" confirmed. The fill tick runs only if short. The other peer_wake.notify_one() calls (kick, learned gossip, disconnect) fire only when remaining/len() < max_peers. The underserving wake fires only when the slow address differs from last_underserving, so a full set is not re-probed after the empty batch until that peer-wake fires again.
  • Premise "This trigger happens in realistic use: when the seed pool holds many nodes without compact filters and a slow peer needs replacing at capacity" unsettled. The code cannot show how many seed or DNS nodes lack compact filters. Also, get puts the best probed backups first, and those already passed a handshake, so they have the needed services. That makes an empty batch less likely whenever backups exist that are neither live nor banned.
    Pair refutation confirmed: A missing-services ban lasts 24 hours for a discovered peer but does not remove its address from discovery. At capacity, all three sampled addresses can be banned, so the supervisor skips the replacement without trying another address or scheduling a fill-timer retry. Rule checked: Filtering after a size-limited sample can discard every selected item without selecting an eligible item left in the pool.
  • Premise "When the peer set is at capacity, nothing other than peer_wake reruns Supervisor::repair_round after a replacement batch comes back empty at manager.rs:811" confirmed. The same supervisor can rerun at capacity only via peer_wake: shutdown exits, the fill timer is disabled, and the flow controller notifies on a change in the underserving peer rather than on every tick.
  • Premise "This trigger happens in realistic use: when the seed pool holds many nodes without compact filters and a slow peer needs replacing at capacity" confirmed. The normal filter-enabled path admits seed addresses without service screening, bans those whose handshakes lack compact filters, and probes for a replacement when a full, unstalled set has a slow peer and the swap cooldown has elapsed; the code does not establish how common such seed pools are."
  • Dropped: "An address message that yields no candidates can suppress the real reply" (ignore): "ignore. addr_answered.insert(peer) at manager.rs:1359 runs on every in-limit addr or addrv2 message, even when the filtered list is empty. The new service filter therefore does not change which message uses up the allowance. This PR neither causes nor exposes the defect, and the line is unchanged."
  • Dropped: "Peer gossip can direct outbound connections to private network addresses" (ignore): "ignore. The address conversion at manager.rs:1346 and manager.rs:1354 and the dial path are unchanged. This PR only narrows the service filter, so it admits fewer gossiped endpoints than before and neither causes nor exposes private-address dialing."
  • Kept: "The manager regressions bypass the public peer lifecycle" (suggestion): "note. The ban test calls DisconnectedPeer::connect with net.state directly at manager.rs:1793. The gossip test pushes a fabricated PeerEvent into net.state.inbound at manager.rs:1825. Neither goes through PeerNetworkManager::start, which breaks the AGENTS.md rule to test through the public API. This push only swapped the sleep for settle, so the cell stays as it was."

Timing:

  • Parse: 6.6s
  • Review agents: 176.4s
  • Judge: 149.1s
  • Total: 332.1s

Last reviewed c9d4234 · head c9d4234 · up to date

  • Pause automatic reviews
  • Review again
  • Deeper review

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 1 warning to address. Fix it, reply in its thread with a reason Manki accepts, or tick 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.

About this review
  • Reviewed c9d4234, round 3
  • 102 changed lines read in 5m 32s
  • Found by claude-opus-5-5 and gpt-6.2-sol, judged by claude-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

Comment thread dash-spv/src/network/bans.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: address ZocoLini left a review thread unresolved, then post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026

@manki-review manki-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

  1. Let the client connect while some candidate nodes lack compact filter support. Expect a lacks required services warning for each such node once, and no redial of that address in later rounds.
  2. Watch the learned N new peer address(es) logs. Expect only addresses that advertise every required service to be added.
  3. Disable filters and mempool tracking, then restart. Expect nodes that only advertise NETWORK to be accepted again.
  4. Configure a peer with peers that lacks compact filters. Expect it to be retried with dial backoff and never banned.

@ZocoLini
ZocoLini merged commit f0ddfd4 into dev Nov 22, 2026
38 of 40 checks passed
@ZocoLini
ZocoLini deleted the fix/skip-peers-lacking-services branch November 22, 2026 18:42
manki-review Bot added a commit to manki-review/review-memory that referenced this pull request Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants