feat(#321): guard emergency_pause_claim_refund on zero balance - #430
Open
iexwr wants to merge 2 commits into
Open
feat(#321): guard emergency_pause_claim_refund on zero balance#430iexwr wants to merge 2 commits into
iexwr wants to merge 2 commits into
Conversation
- annotate test modules with #[cfg(test)] so the wasm build succeeds without dev-dependencies - make setup_funded_escrow pub(crate) and fix test imports so sibling test modules can use it (Address::generate requires testutils trait) - remove redundant admin.require_auth() before require_admin in admin_override_cancel_refund; require_admin already performs the signature check, and env-host 22.1.3 rejects the double auth with Error(Auth, ExistingValue) - fund a terminal-state cancel test through the zero-balance boundary guard in cancel_escrow so its invalid-amount assertion stays intact - add missing admin_override_cancel_tests snapshot files (untracked, would otherwise fail CI on a fresh checkout)
…lance - add Error::EmptyBalance (=32) and assert_nonzero_balance helper - reject emergency_pause_claim_refund while the contract token balance is zero, so an emergency settlement never attempts an empty transfer - fund the initialized-escrow fixture mint via its own token id so the existing claim_refund split-math tests keep passing - add a test asserting EmptyBalance is returned for a paused but unfunded escrow
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.
Closes #321
Blocks
emergency_pause_claim_refund(the admin-gated settle endpoint) while the contract token balance is zero, so an emergency refund never attempts an empty transfer.Changes
Error::EmptyBalance(=32).assert_nonzero_balancehelper and call it fromemergency_pause_claim_refundafter the paused check.initialised_escrowtest fixture (mint to the contract via its own token id) so existing claim-refund split-math tests keep passing.EmptyBalanceis returned for a paused but unfunded escrow.Validation
cargo testformilestone-escrow: 464 passed, 0 failed.