feat(multisig): validate amount > 0 and to != from in submit_transaction - #337
Closed
benzy018 wants to merge 1 commit into
Closed
feat(multisig): validate amount > 0 and to != from in submit_transaction#337benzy018 wants to merge 1 commit into
benzy018 wants to merge 1 commit into
Conversation
- Add SelfTransfer = 14 to MultiSigError enum - Reject amount <= 0 with InvalidAmount (VertexChainLabs#6) in submit_transaction - Reject to == from (self-transfer) with SelfTransfer (VertexChainLabs#14) - Add tests: rejects zero amount, negative amount, and self-transfer Closes VertexChainLabs#130
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.
Summary
Fixes two missing input validations in
submit_transactionthat allowed griefing and silent storage inflation.Changes
contracts/multisig/src/lib.rsSelfTransfer = 14toMultiSigErrorenum.submit_transaction: rejectsamount <= 0withInvalidAmount(infra: create backend Dockerfile with multi-stage build targets #6).submit_transaction: rejectsto == caller(self-transfer) withSelfTransfer(feat: implement IndexerService to consume Soroban events and upsert to database #14).test_submit_transaction_rejects_zero_amounttest_submit_transaction_rejects_negative_amounttest_submit_transaction_rejects_self_transferWhy
amount <= 0: Storing pending transactions with zero or negative amounts silently inflates the persistent storage budget with useless entries.to == from(self-transfer): A signer sending to themselves is a semantic no-op and can be used to grief the contract by burning approvals.Testing
Tests use
#[should_panic(expected = "Error(Contract, #N)")]matching the#[repr(u32)]discriminants, consistent with existing test patterns in the file.Closes #130