Repository navigation
Drop LoadHint from NodeAnnounce; trustless tie-break only - #620
Conversation
|
|
||
| /// Current `GossipEnvelope::version` emitted by this protocol version. | ||
| pub const GOSSIP_VERSION: u8 = 1; | ||
| /// |
There was a problem hiding this comment.
No need for this at all, drop it please.
There was a problem hiding this comment.
Code Review
This pull request removes the LoadHint field from NodeAnnounce messages and eliminates the load-based tie-breaking tier from the node selection algorithm, reducing it to a three-tier process (geographic diversity, stake, and randomness). These changes are reflected across several ADR documents, the protocol definition—which includes a bump of GOSSIP_VERSION to 2—and the CLI's peer table output. A review comment suggests renaming a test in crates/node/src/selection.rs to more accurately reflect its behavior regarding the interaction between geographic diversity and stake tiers.
| // Different load → stake doesn't matter, lower load wins. | ||
| let busy_rich = with_stake( | ||
| with_region(with_load(make_candidate(1, 100, 10, 1.0), 0, 90), "US"), | ||
| fn stake_tier_only_runs_when_geo_tied() { |
There was a problem hiding this comment.
The test name stake_tier_only_runs_when_geo_tied is a bit misleading. The test setup uses candidates from different regions ('US' and 'DE'), so the geo diversity is not tied. The test actually demonstrates that when both regions are 'unseen', the geo tier doesn't filter the candidates, and the decision falls through to the stake tier. A more descriptive name could prevent future confusion.
There was a problem hiding this comment.
Good catch — the regions are different, not tied. The actual behavior being pinned is that geo tier 1 is a no-op when no region has been emitted yet (start of a fresh tie group), so stake tier 2 decides. Renamed to higher_stake_wins_when_all_regions_unseen in c162b58 and rewrote the leading comment to explain what's actually happening.
8b98161 to
63069cc
Compare
…only
LoadHint advertised a node's `active_streams` and `bandwidth_utilization`
in every gossip announce and fed tier 1 of the selection tie-breaker.
The honesty story was "reputation penalizes nodes whose observed delivery
contradicts the advertised load" — but that cross-check was never built:
reputation updates from delivery outcomes (latency, errors), not from any
advertised-vs-observed load comparison. A lying node looks slow, same as
an honest slow node, so the incentive was rhetorical. The publisher
emitted zeros on every announce since the gossip crate landed, the tier-1
tie-break compared zero to zero, and the closed-loop RTT+reputation
signal already de-selects saturated nodes within seconds.
A trustless network doesn't carry unenforceable self-claims on the wire.
Saturation handling now flows entirely through the existing closed loop:
slower nodes get worse RTT, worse RTT lifts the selection score, and
reputation drops on observed slow deliveries. Tie-break shrinks from
four tiers to three: geo diversity → stake → random.
Touched:
- crates/protocol/src/gossip.rs — drop struct, drop signed-body field
- crates/protocol/src/lib.rs — drop re-export
- crates/gossip/{service,validation,peer_table}.rs — drop usage
- crates/node/src/selection.rs — drop `Candidate.load`, `compare_load`,
tier-1 block in `pick_best_in_group`; tests rewritten to exercise
geo+stake+random over stake-based determinism
- crates/node/src/admin.rs — drop from RawPeer/PeerView mapping
- crates/common/src/admin.rs — drop PeerView.load + doc references
- crates/cli/src/commands/node.rs — drop LOAD column from `node peers`
table output
- crates/cli/tests/admin_peers.rs — drop fixture field
- adr/{001,005,008,012,013,019}.md — drop struct definitions, drop
tier-1 from tie-break, drop advisory/trust-model references, drop
signed-fields-table row
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
63069cc to
c162b58
Compare
Coverage reportTotal: 89.90% (was 89.90%, ● 0.00%) — 16524/18381 lines
History
|
Closes #616.
LoadHintadvertised a node'sactive_streamsandbandwidth_utilizationin every gossip announce and fed tier 1 of the selection tie-breaker. The honesty story was "reputation penalizes nodes whose observed delivery contradicts the advertised load" — but that cross-check was never built: reputation updates from delivery outcomes (latency, errors), not from any advertised-vs-observed load comparison. The publisher emitted zeros on every announce since the gossip crate landed, so tier 1 has been comparing zero to zero in production.A trustless network doesn't carry unenforceable self-claims on the wire. Saturation handling flows entirely through the closed loop already in place: slower nodes get worse RTT → worse RTT lifts the selection score → reputation drops on observed slow deliveries. Tie-break shrinks from four tiers to three: geo diversity → stake → random.
What's touched
Code (10 files):
crates/protocol/src/gossip.rs— dropLoadHintstruct, droploadfield fromNodeAnnounceBodycrates/protocol/src/lib.rs— drop re-exportcrates/gossip/src/{service,validation,peer_table}.rs— drop usage from publisher + test fixturescrates/node/src/selection.rs— dropCandidate.load,compare_load, tier-1 block inpick_best_in_group; tests rewritten to exercise geo + stake + random with stake-based determinismcrates/node/src/admin.rs— drop fromRawPeerand thePeerEntry → PeerViewmappingcrates/common/src/admin.rs— dropPeerView.loadand doc referencescrates/cli/src/commands/node.rs— dropLOADcolumn fromdecdn node peerstable outputcrates/cli/tests/admin_peers.rs— drop fixture fieldADRs (6 files):
adr/001-network.md— drop struct, drop the advisory paragraph, drop tie-break bulletadr/005-protocol.md— drop "and load hint" from metadata descriptionadr/008-reputation.md— drop tier 1, renumber tie-break tiersadr/012-client.md— drop advisory mention from trust modeladr/013-schema-evolution.md— drop from both `NodeAnnounceBody` examples and the signed-fields table rowadr/019-node-onboarding.md— drop from onboarding's first announce exampleVerification