fix!: index the treasury settlement chain (bps floor referrer fees) - #5
Merged
Conversation
clutch-node's treasury-break release moved RidePay referrer fees from
whole-percent ceiling division to basis-points floor division (2% ->
200 bps). Renames referrer_fee_ceiling -> referrer_fee_bps and the
ride_*_referrer_fee_percent config fields -> ride_*_referrer_fee_bps
(u8 -> u16) so the explorer's display-only fee math matches the chain.
Verified via source inspection (see .superpowers/sdd/task-2-report.md)
that the rest of the parser already tolerates the new ChainInit/Mint/
Burn transaction types and chain_id field without code changes: raw
string function_call_type with unwrap_or fallback, a boolean matches!
for is_ride_function, a tolerant `_ => {}` match arm in referrer.rs,
and no deny_unknown_fields anywhere. No changes needed there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to clutchprotocol/clutch-node#9. Merge alongside it.
The surprise: almost nothing needed changing
The expectation going in was that the indexer would break at genesis, because the new chain puts a
ChainInittransaction (RLP tag 9) in block 0 and addschain_idto every transaction, alongside two new types (Minttag 6,Burntag 7) and four new balance-effect kinds.It doesn't. Verified by inspection rather than assumed:
ingestion.rsstoresfunction_call_typeas a raw string with anunwrap_orfallback — no exhaustive match to break.is_ride_functionis a booleanmatches!, so unknown types are simply "not ride-related".referrer.rsalready has a tolerant_ => {}arm.activity.rsrecords unknown effect kinds with their raw string, andeffect_labelfalls back to "Balance change".deny_unknown_fieldsanywhere, so the newchain_idfield is ignored.So
ChainInit/Mint/Burnandchain_idall ingest with zero parser changes. That tolerance was worth confirming explicitly, because the alternative — an enum that must be kept in lockstep with the node — would have made every future node release a two-repo change.What actually changed
referrer.rsfee arithmetic: ceiling percent → floor basis points, using the identical formula to the node'sreferrer_fee_floor:That cross-repo agreement is the point — the explorer displays the fee split, so divergent rounding would make the UI quietly disagree with on-chain state. The old ceiling rule turned 2% of a 3-unit fare into 33%; it existed only because the chain had no decimals, and it is repealed.
Plus the
u8→u16config rename (ride_*_referrer_fee_percent→_bps) and its plumbing.Verification
cargo test— 10/10 pass.Note the tests were run on Rust 1.89, matching this repo's own
backend/Dockerfile(ARG RUST_VERSION=1.89); 1.86 fails here because a transitive dependency requires ≥1.88, and that failure reproduces on unmodifiedmain. Worth flagging separately: this repo commits noCargo.lock, so its builds float on dependency resolution.Not covered here
Live end-to-end indexing of a real
Mintblock needs a running treasury-break node stack; that is verified in the full-stack smoke, not in this source-only change.🤖 Generated with Claude Code