You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(minter): submit withdrawals as durable-nonce transactions - #248
Withdrawal transactions no longer reference a recent blockhash: each batch of up to ten transfers is built on a durable nonce account reserved from the pool, with AdvanceNonceAccount as the first instruction and the account's nonce value in place of the blockhash. The unsigned message is recorded in a CreatedTransaction event before the threshold signature is requested, so an interrupted signing resumes with the identical message, and a SignedTransaction event records the identifier before the transaction is sent with skipPreflight. A nonce value already bound to an earlier transaction of the same account is recognized as a stale read and skipped, and the batch selection keeps the rent exemption threshold back from the available balance.
Since a durable-nonce transaction never expires, withdrawals are excluded from the expiry and re-signing path entirely; a missing status leaves the transaction in flight (re-broadcasting and landed-detection follow in later PRs). A finalized success or failure frees the nonce account for reuse. The legacy blockhash withdrawal flow and its events are removed.
The Solana test validator suite now provisions a real nonce account before installing the minter and verifies the on-chain nonce advance after a withdrawal end to end.
This PR refactors withdrawal processing to use durable nonce accounts, persisting withdrawal transaction creation/signing as separate events and adjusting state tracking to prevent nonce reuse and hold back rent exemption.
Changes:
Split withdrawal transaction lifecycle into CreatedTransaction and SignedTransaction events, with new state buckets/maps to persist messages and nonce bindings.
Introduce durable-nonce-aware batching limits and rent-exemption holdback when determining affordable withdrawal batches.
Update RPC submission to optionally skip preflight for withdrawals, and adjust monitoring/tests/integration scaffolding for the new flow.
File
Description
minter/src/withdraw/tests.rs
Updates unit tests to assert created/signed withdrawal events and nonce-based batching behavior.
minter/src/withdraw/mod.rs
Refactors withdrawal processing into create→sign→send phases and adds retry delay constant.
minter/src/test_fixtures/runtime.rs
Makes the test runtime capture timer delays (not just count) for more precise assertions.
minter/src/test_fixtures/mod.rs
Adds fixtures for created/signed withdrawal events and nonce-account handling in tests.
minter/src/state/tests.rs
Extends state tests for new withdrawal buckets, rent holdback, and nonce-tx replay semantics.
minter/src/state/nonce_pool/tests.rs
Adds tests for reserving/binding/freeing durable nonce accounts and stale nonce detection.
minter/src/state/nonce_pool/mod.rs
Implements nonce account reservation/binding and “seen nonce values” tracking.
minter/src/state/mod.rs
Adds new withdrawal state maps, batch affordability changes, and event handlers for created/signed txs.
minter/src/state/event/cbor/tests.rs
Adds CBOR roundtrip tests for solana_hash::Hash.
minter/src/state/event/cbor/mod.rs
Introduces CBOR encode/decode for Solana Hash.
minter/src/state/event.rs
Adds new withdrawal event types and removes TransactionPurpose::WithdrawSol.
minter/src/state/audit.rs
Applies new withdrawal lifecycle events during event replay/auditing.
minter/src/sol_transfer/tests.rs
Reworks withdrawal message/signing tests for durable nonce messages and size limits.
When even one blockhash-based sweep exists, a get_recent_block failure returns before checking any durable-withdrawal signatures. Thus a block RPC outage prevents otherwise independent withdrawals from finalizing and freeing their nonce accounts (and the immediate retry can repeatedly hit the same failing block call). Check transaction statuses regardless, and use the block height only when deciding whether a missing blockhash transaction expired.
Cap accumulated transactions before concurrent RPC submission
minter/src/withdraw/mod.rs:286
This collects every previously created transaction, not just this round's capped batches. If signing fails across rounds, up to the entire nonce pool can accumulate here; once signing recovers, all of them are signed and passed to send_transactions_batch concurrently, bypassing MAX_CONCURRENT_RPC_CALLS. Cap this snapshot so recovery cannot create an unbounded burst of SOL RPC submissions.
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the nonce_account as part of SignedTransaction? We could identify the nonce account based on the nonce value used as block hash in the transaction if the full signed transaction was part of the event
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
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.
Withdrawal transactions no longer reference a recent blockhash: each batch of up to ten transfers is built on a durable nonce account reserved from the pool, with
AdvanceNonceAccountas the first instruction and the account's nonce value in place of the blockhash. The unsigned message is recorded in aCreatedTransactionevent before the threshold signature is requested, so an interrupted signing resumes with the identical message, and aSignedTransactionevent records the identifier before the transaction is sent withskipPreflight. A nonce value already bound to an earlier transaction of the same account is recognized as a stale read and skipped, and the batch selection keeps the rent exemption threshold back from the available balance.Since a durable-nonce transaction never expires, withdrawals are excluded from the expiry and re-signing path entirely; a missing status leaves the transaction in flight (re-broadcasting and landed-detection follow in later PRs). A finalized success or failure frees the nonce account for reuse. The legacy blockhash withdrawal flow and its events are removed.
The Solana test validator suite now provisions a real nonce account before installing the minter and verifies the on-chain nonce advance after a withdrawal end to end.
🤖 Generated with Claude Code