You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
selection: decide the unknown-stake policy at the lookup layer before wiring on-chain stake #1470
The tier-2 comment in crates/node/src/selection.rs claimed None is "the lowest possible stake". It is not — filter_map drops None before max, so unknown ranks strictly belowSome(0). That behaviour is deliberate and pinned by three tests dating to #380 (some_stake_beats_none_stake, some_zero_stake_beats_none_stake, three_way_zero_stake_falls_through_to_random_tier), so the comment was the defect, not the code. #1469 corrected the comment and documented the two-axis meaning on Candidate.stake.
What is still open
Candidate.stake: Option<u64> conflates "not looked up" with "looked up, holds no bond". Today that is harmless: all three construction sites pass None (node_origin.rs:1177, :1256, plus the test helper), so tier 2 is a uniform no-op.
It stops being harmless the moment on-chain stake lookup is wired, because an RPC read succeeds for some peers and fails for others — a mixed population is the steady state for a chain read, not an edge case. If a failed read is encoded as None alongside successful ones, one flaky call silently sinks a well-staked peer below a zero-stake one.
The decision to make
Make it at the lookup layer, when that layer lands:
Resolve at the boundary. Lookup returns u64; a failed read is retried or the candidate is dropped, never folded to 0. Keeps tier 2 exactly as-is.
Distinguish failure from absence. Widen to a three-state type (Known(u64) / NoBond / Unavailable) and have tier 2 skip entirely when any candidate is Unavailable — unknown poisons the tier rather than losing it.
Option 2 is safer under partial reads; option 1 is simpler and matches what the tests already assert. Either way the three existing tests encode the current contract and should be revisited deliberately, not incidentally.
Pointers
crates/node/src/selection.rs — Candidate.stake field doc and the tier-2 comment in pick_best_in_group both reference this issue
ADR 001 § Node Selection Algorithm; ADR 019 for the capacity-bond interface that will populate the field
Activity
docs: correct review findings in the slashing runbook and ADR 016 row
docs: remove the nonexistent SlashJudge counter-evidence window and t…
revert(cache): remove opt-in remote-origin prewarm from #1510 (#1522)