Skip to content

fix: tolerate burn-induced mint supply drift below pool records (v0.1.4) - #5

Merged
mindrunner merged 1 commit into
mainfrom
le/tolerate-mint-supply-drift
Aug 27, 2026
Merged

mindrunner merged 1 commit into
mainfrom
le/tolerate-mint-supply-drift

Conversation

@mindrunner

@mindrunner mindrunner commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Root cause (from live evidence, not guesswork)

Every v0.1.3 pay run on sol3 fails with pool mint authority, supply, decimals, or freeze state mismatch (Loki, vsol-payment.service, 2026-08-27 02:00 and 07:34 CEST). Checking each condition of validate_pool_mint against live mainnet, exactly one fails: the strict supply == pool.pool_token_supply equality. The real vSOL mint supply was 85 base units below the pool's recorded supply — direct burns drift the mint down between epoch updates. The SPL stake pool program tolerates this and re-syncs pool_token_supply from the mint at each epoch's UpdateStakePoolBalance, which is also why the check passed on some runs (fresh after re-sync) and failed on others.

All other assumptions were verified clean against mainnet: invoice PDAs and 96-byte layout, invoicer layout and reserves ATA, payer funding, stake pool decode, withdraw-authority-as-mint-authority.

Changes

  • validate_pool_mint: allow supply <= pool_token_supply (burn drift); still bail when supply exceeds pool records, which would mean minting outside pool accounting.
  • Include actual values in the mint and stake-pool guard error messages — the four prior releases were blind partly because every bail! named no values.
  • Regression test on verbatim mainnet mint bytes (tests/fixtures/mainnet_vsol_mint.bin) with burn-drifted pool supply, plus a supply-above-records rejection test.
  • Bump to 0.1.4.

Note: this branch is based on v0.1.3 (le/fix-simulation-commitment), which was tagged but never merged — merging this lands the whole chain on main.

Verification

  • cargo fmt --check, clippy -D warnings, 47/47 tests pass.
  • Pre-release gate: the built binary's read-only plan mode was run against live mainnet with sol3's production values — it passes every validation and plans payment of the real outstanding epoch-1021 invoice (46,882,974 vSOL base units, 55,061,062 lamports deposit), exit 0.

Every v0.1.3 pay run on sol3 failed with "pool mint authority, supply,
decimals, or freeze state mismatch". Live mainnet forensics showed exactly
one failing condition: validate_pool_mint required the vSOL mint supply to
equal the stake pool's recorded pool_token_supply, but direct burns pull
the mint supply below the pool's records between epoch updates (85 base
units at the time of diagnosis). The on-chain program tolerates this and
re-syncs pool_token_supply from the mint at each epoch's
UpdateStakePoolBalance, and deposit math uses pool_token_supply on both
sides, so the drift is harmless.

Keep the direction that is genuinely suspicious: a mint supply above the
pool's records would mean tokens minted outside pool accounting and still
fails. Add a regression test on verbatim mainnet mint bytes with drifted
pool supply, and include actual values in the mint and stake-pool guard
errors so the next failure is diagnosable from the journal alone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mindrunner
mindrunner merged commit 0595635 into main Aug 27, 2026
1 check passed
@mindrunner
mindrunner deleted the le/tolerate-mint-supply-drift branch August 30, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant