Skip to content

test(minter): reproduce stranded deposit when address keeps a sub-rent remainder - #206

Draft
gregorydemay wants to merge 6 commits into
mainfrom
test/dust-remainder-consolidation-failure
Draft

gregorydemay wants to merge 6 commits into
mainfrom
test/dust-remainder-consolidation-failure

Conversation

@gregorydemay

Copy link
Copy Markdown
Contributor

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

gregorydemay and others added 6 commits September 22, 2026 12:23
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>
Base automatically changed from test/per-test-solana-validator to main September 23, 2026 09:38
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