Repository navigation
refactor(minter): model submitted transactions as a MinterTransaction enum - #252
gregorydemay wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Transaction-size validation changes signer invocation and error precedence despite the stated behavior-preserving scope.
Review effort: Balanced
Findings: 1
What changed in this PR
Refactors submitted transaction state into kind-specific MinterTransaction variants while preserving durable events and monitoring flows.
Changes:
- Replaces
SolanaTransactionwith sweep and withdrawal variants. - Updates monitoring and tests for enum accessors.
- Moves transaction-size validation before signing.
| File | Description |
|---|---|
minter/src/state/mod.rs |
Introduces and processes the transaction enum. |
minter/src/state/tests.rs |
Updates sweep assertions. |
minter/src/monitor/mod.rs |
Uses enum accessors during monitoring. |
minter/src/monitor/tests.rs |
Updates resubmission assertions. |
minter/src/withdraw/tests.rs |
Verifies withdrawal variant metadata. |
minter/src/sol_transfer/mod.rs |
Validates size before signing. |
minter/src/sol_transfer/tests.rs |
Updates oversized-transaction test. |
minter/src/test_fixtures/runtime.rs |
Records timer delays. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ensure_within_transaction_size(&transaction.message)?; | ||
| transaction.signatures = | ||
| sign_bytes(signer_derivation_paths, signer, transaction.message_data()).await?; |
|
✅ No security or compliance issues detected. Reviewed everything up to a8431f3. Security OverviewDetected Code Changes
|
… enum Replace the SolanaTransaction struct and its purpose field with a MinterTransaction enum whose SweepDeposit and Withdrawal variants carry the deposit ids or burn indices directly, so that the transaction lifecycle handlers match exhaustively on the kind of transaction. Stored events and the Candid interface are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…signing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mbjorkqvist
left a comment
There was a problem hiding this comment.
Thanks @gregorydemay! Just a couple of findings from Claude.
| signers: Vec<Signer>, | ||
| /// The block height of the block whose blockhash the transaction uses. | ||
| block_height: BlockHeight, | ||
| /// Total transfer amount in lamports (excluding fees). |
There was a problem hiding this comment.
🤖 Since #221 removed consolidation, amount is only ever written, never read. Its doc is also inaccurate for this variant: it's set to the return value of deposits.sweep(…), which is the expected received amount, i.e. after the fee. A pure refactoring introducing a new type seems the natural moment to drop it; the draft #234 ("remove the per-transaction amount") does exactly that and will conflict with this PR (and #248 carries the field and its doc forward too). Could we drop amount here (and close #234), or land #234 first? Relatedly, deposit_ids and burn_indices are also only written; fine if the nonce work needs them, otherwise they duplicate what the state already tracks per deposit / withdrawal.
| } | ||
|
|
||
| impl MinterTransaction { | ||
| pub fn message(&self) -> &VersionedMessage { |
There was a problem hiding this comment.
ce22834 to
a8431f3
Compare

Pure refactoring in preparation for durable-nonce withdrawals: the transactions the minter submits and monitors are modelled as an enum with one variant per kind (deposit sweep, withdrawal), replacing a struct tagged by a purpose field. Every place handling a submitted transaction now matches exhaustively on its kind, so that the per-kind decisions (what to do on success, failure, or expiry) are explicit and the upcoming nonce-based withdrawal variant can reuse the same finalization infrastructure.
No behaviour change: stored events and the Candid interface are unchanged.
🤖 Generated with Claude Code