fix: ContractPaused(2) guard on all state-changing functions#155
Merged
levoski1 merged 2 commits intoJun 27, 2026
Conversation
- compliance: add is_paused/check_not_paused helpers; guard allow_address, block_address, allow_address_until, transfer_admin, clear_address; return ContractPaused(2) consistently on all write paths - treasury: guard set_signer, propose_settlement, approve_settlement, execute_settlement, update_threshold, raise_dispute, resolve_dispute, deposit, withdraw, add/remove_token_from_allowlist; add missing Unauthorized=5 and InvalidThreshold=6 error variants; fix execute_settlement not updating status to Executed - invoice (COMEBACKHERE-contracts): add missing check_not_paused guard to set_grace_window - contracts/invoice: expand stub to full implementation with nonce deduplication, expiry, pay/cancel functions, and paused guard on create_invoice; add InvoiceError boundary tests for all six variants (Unauthorized, InvalidAmount, Expired, NotFound, DuplicateNonce, AmountPrecision) - contracts/settlement: add missing PartialEq/Debug to ApproveResult - feat: clear_address now returns AddressNotFound(4) when address has no active record instead of silently overwriting; calls storage.remove() - test: treasury threshold/approval_weight tests covering partial approval, exact threshold, over-threshold, zero-threshold rejection, and multi-signer weight accumulation - build: align workspace to resolver=2, soroban-sdk 20.0.0 across all three COMEBACKHERE contracts, bump rust-toolchain to 1.85.0 (required for edition2024 in transitive deps)
|
@Markodiba6399 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
is_paused/check_not_pausedhelpers and guards on every write function (allow_address,block_address,allow_address_until,transfer_admin,clear_address). All five now returnResult<(), ContractError>and returnContractPaused(2)when paused.clear_addressalso gainsAddressNotFound(4)when the address has no active record, and now callsstorage.remove()instead of silently overwriting.Unauthorized = 5,InvalidThreshold = 6) that were referenced in code but absent from the enum. Fixedexecute_settlementwhich never updated settlement status toExecuted.check_not_pausedguard toset_grace_window.InvoiceErrorvariants.PartialEq/Debugderives onApproveResult.Test plan
cd contracts && cargo test— 20 tests (14 invoice + 6 settlement), all passcd COMEBACKHERE-contracts && cargo test— 31 tests (12 compliance + 4 invoice + 15 treasury), all passContractPaused(2)is returned before any storage mutationInsufficientApprovals, exact threshold → executes, over threshold → executes, zero threshold →InvalidThresholdclear_addresstests: removes allowed/blocked entries, returnsAddressNotFoundwhen not present or already clearedcloses #100
closes #101
closes #102
closes #103