Repository navigation
refactor(rewards): remove never-emitted ChainPeakUnavailable (dig_ecosystem#3448) - #636
Conversation
Zero producers and zero consumers; the real adapter already refuses an absent peak via read_distributor (Other/Unavailable). Fix the chain_peak_height doc to name that refusal. Refs DIG-Network/dig_ecosystem#3448 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MichaelTaylor3d
left a comment
There was a problem hiding this comment.
PASS at a9bf40f.
Checked: (1) mock_chain_source refactor is behaviour-identical (same coins/spends/lineage, timestamps 0..=height, same peak applied last); (2) new test reaches the peak step: state.rs read_distributor checks peak only after all coin/lineage checks, message "chain source exposes no peak height" contains the asserted substring, and any NotADistributor/Unavailable/other Other would fail it; it goes red if the adapter emitted a 0 peak (Ok) ; (3) git grep for ChainPeakUnavailable / REWARD_CHAIN_PEAK_UNAVAILABLE is empty at head; (4) rewritten doc matches chain_port.rs reader_error_to_port_error (Malformed -> Other, ChainUnavailable -> Unavailable); (5) readable, no duplication.
CI: Test + coverage and Lint commit messages green; Rustfmt/Clippy/Release-script/CodeQL were runner-starved (not a code signal) - confirm they go green before merge. No threads opened. Did not run cargo locally.
|
PASS — loop-security verdict, dig-node#636 head
Not covered: no cargo build/test run (CI Test + coverage PASS reported at this SHA); dig-rewards-coin internals taken from L1 measurement, not re-read. |
…#637) * refactor(rewards): remove never-emitted ChainPeakUnavailable (dig_ecosystem#3448) (#636) * refactor(rewards): remove never-emitted ChainPeakUnavailable Zero producers and zero consumers; the real adapter already refuses an absent peak via read_distributor (Other/Unavailable). Fix the chain_peak_height doc to name that refusal. Refs DIG-Network/dig_ecosystem#3448 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(rewards): pin absent-peak refusal at the chain port Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> * chore(release): v0.262.2 -- remove never-emitted ChainPeakUnavailable Refs DIG-Network/dig_ecosystem#3448 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Refs DIG-Network/dig_ecosystem#3448
What
ChainPortError::ChainPeakUnavailableand its RPC machine codeREWARD_CHAIN_PEAK_UNAVAILABLE(match arm + const inseams/dig_rpc/dispatch.rs). Zero producers and zero consumers org-wide; dig-rpc-protocol SPEC 4.5 only requires "a JSON-RPC error", whichOther/Unavailablealready give.chain_peak_heightdoc inrewards/port.rsto name the real refusal:dig_rewards_coin::read_distributorrefuses to build aChainObservationwithout a peak (Malformed->ChainPortError::Other; a failed read ->ChainUnavailable->ChainPortError::Unavailable).distributor_report_refuses_when_the_chain_has_no_peakover a real simulator launch with a peak-lessMockChainSource(shared buildermock_chain_source_without_peak;mock_chain_sourcenow calls it).Wire answer for an absent peak
JSON-RPC code -32032,
data.codeCONTROL_ERROR, message "reward-distributor chain read failed: ... no peak height".Test scope (honest)
Port-level: asserts
Err(ChainPortError::Other(msg))with msg containing "no peak height". A NotADistributor/Unavailable refusal would fail the message assertion, so the read provably reaches the peak step. The behaviour already existed, so this is a pin, not a red-first fix. The dispatchOtherarm already maps it to the wire answer above; that mapping is not re-tested here.Not touched:
crates/dig-node-service/src/rewards/chain_port.rs(dig-node#630). No version bump.🤖 Generated with Claude Code