Repository navigation
Debit a spent block reward from the scanner address balance (phantom genesis premint holder) - #2181
Open
nullPointerEnjoyer wants to merge 9 commits into
Open
nullPointerEnjoyer wants to merge 9 commits into
nullPointerEnjoyer wants to merge 9 commits into
Conversation
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.
Closes #2158.
Root cause
The scanner credits block-reward-sourced outputs (the genesis premint is one) to their destination address, but the spend arm of
update_tables_from_transaction_inputsforOutPointSourceId::BlockReward(_)never debitedaddress_amountforTransfer/LockThenTransferoutputs - unlike theOutPointSourceId::Transaction(_)arm, which always debits. The genesis premint output spent at block 134 therefore kept its 399.9M ML balance row forever: a phantom #1 top holder with zero UTXOs.What changed
scanner-lib/src/blockchain_state/mod.rs): the BlockReward spend arm now handlesTransfer/LockThenTransferexactly like the Transaction arm: the receiving address is recorded in the address history and the amount is debited fromaddress_amount(coin or token). Output kinds that are never credited (Burn, IssueNft, DataDeposit, CreateDelegationId, DelegateStaking, IssueFungibleToken, Htlc, CreateOrder) stay no-ops, so no negative balances can appear. Pool arms unchanged.collect_secondary_history): the same Transfer/LockThenTransfer spend now records the address in the deferred-history path too, so databases rebuilt via fast catch-up + backfill match fully-scanned ones (the mirror's per-source split for IssueNft/Htlc and pool decommission is preserved, and its comments are updated).address_amountand the holders listing with the fixed logic and drops the existing phantom row.Operational note: upgrading the scanner daemon (either backend) triggers a full re-scan - plan the maintenance window for the production api-servers accordingly.
Supply-chain check adjustments
RUSTSEC-2026-0383ignore: the advisory now markswebpki-root-certs0.26.11 as unaffected and>= 1.0.10as patched; both locked versions (0.26.11, 1.0.11) are clean, so the ignore no longer matches anything.RUSTSEC-2026-0620ignore with rationale: thecurve25519-dalekAVX-512 scalar-multiplication bug is only reachable on nightly builds with theunstable_avx512backend; our builds use stable toolchains without that cfg, and the patched>= 5.1.0needs aschnorrkelrelease that supports dalek 5.x.Tests
spending_the_genesis_premint_debits_the_address(scanner sync tests): scans genesis, asserts the premint is credited, spends it to a different destination, and asserts the premint address is zeroed and absent from the holders listing, the recipient is credited, and the spend appears in both address histories. Fails without the fix, passes with it.backfill_matches_full_scanand the full scanner suite pass;./do_checks.shgreen; workspace tests green.Known follow-ups (pre-existing, not introduced here)
BalanceAccumulatoraddress underflow panics (parity with the pre-aggregation behavior) instead of returning a scan error; the same for the i128 conversion of extreme token amounts.LockThenTransferoutputs are credited/debited unlocked-only (no timelock split), consistent on both sides.