test(minter): reproduce stranded deposit when address keeps a sub-rent remainder - #206
Draft
gregorydemay wants to merge 6 commits into
Draft
gregorydemay wants to merge 6 commits into
gregorydemay wants to merge 6 commits into
Conversation
Each validator test spawns its own solana-test-validator on a reserved block of ports with its own ledger directory, so tests no longer share one validator and can run in parallel. The process is killed and the ledger removed when the test ends. A fresh validator charges no fee for its first blocks, and the minter builds transactions on the finalized slot rounded down by the SOL RPC canister. Readiness therefore waits until that block charges the regular fee, otherwise a consolidation would leave dust below the rent minimum and be rejected. Withdrawal finalization is awaited sequentially while advancing canister time, so the test no longer depends on wall-clock timer ticks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The withdrawal finalization wait advanced canister time every second. A finalization round needs several sequential HTTP outcalls, and an outcall still in flight when time jumps times out, so on CI the round never completed. Time is now advanced through a setup helper that waits long enough for the due timers to finish their outcalls. Also let a failing test unwind instead of aborting in the setup's drop check, so the validator process is still killed, and start port blocks at a process-specific offset while probing UDP as well as TCP. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ances The validator runs with 16 ticks per slot, so a transaction is finalized in a few seconds while a blockhash stays valid for about 17 seconds. The finalization wait advances canister time by two minutes per step, which fires both the withdrawal and the finalization timer, and settles for two seconds after each advance. The validator test drops from about 190 to about 100 seconds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The setup, deposit, and withdrawal finalization helpers move from the test file into integration_tests/src/validator.rs so that further validator tests can reuse them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…t remainder A deposit address can hold more than the amount recorded for consolidation, for example after a second transfer below the minimum deposit that is never processed. Consolidation only moves the recorded amount, and when the remainder is below the rent-exempt minimum, Solana rejects the transaction at preflight. The minter records it as submitted anyway, so it expires and is resubmitted every few minutes, each time paying for a new threshold signature, while the deposit stays stranded on the deposit address, the minter's balance never grows and withdrawals starve. The validator helper now funds senders above the rent-exempt minimum so that small transfers can be made, and exposes that minimum for tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Exercising the withdrawal path was redundant once the test asserts that the minter's balance stays at zero. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Stacked on #204.
Adds a Solana validator integration test that reproduces a consolidation failure: a user deposits the minimum deposit amount in one transaction and 500k lamports, below the rent-exempt minimum, in a second one, then processes only the first. The minter mints for the first deposit and later tries to consolidate the recorded amount, which would leave the sub-rent remainder on the deposit address. Solana rejects that transaction at preflight, so it never reaches the chain.
The test shows what follows: the minter has already recorded the transaction as submitted, so it expires and is resubmitted every few minutes, paying for a new threshold signature each time, while the deposit stays stranded on the deposit address, the minter's balance never grows and a withdrawal of the minted ckSOL stays pending forever.
The validator helper now funds senders above the rent-exempt minimum so that small transfers can be made, and exposes that minimum for tests.
🤖 Generated with Claude Code