SEC-C03: commission treasury unchanged on non-hook swap revert (#402) #931
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!931
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-402-commission-treasury-revert-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds contract regression tests for SEC-C03 (#402): swap commission is transferred to treasury atomically with swap execution, so a reverted swap must leave commission treasury balances unchanged.
audit_invariant_tests:commission_treasury_unchanged_after_max_spread_rejected_swap,commission_treasury_unchanged_after_deadline_rejected_swap(snapshot treasury after a successful swap, then assert no change on revert).docs/contracts-security-audit.mdand cross-links fromdocs/security-model.md§ Treasury Management.Acceptance checklist
cargo test -p cl8y-dex-tests commission_treasury_unchanged_after_max_spreadcargo test -p cl8y-dex-tests commission_treasury_unchanged_after_deadlinecargo test -p cl8y-dex-tests commission_treasury_unchanged(2/2 ok locally)Third-party verification
Expected: 2 tests pass (
max_spread_rejected_swap,deadline_rejected_swap).Docs: confirm invariant P10 row in
docs/contracts-security-audit.mdand SEC-C03 paragraph indocs/security-model.md§ Treasury Management.Security review — MR !931
Commit reviewed:
ccab0ae342239f007fe2254c4b088e6d59a787e3Scope: Documentation (
docs/contracts-security-audit.md,docs/security-model.md) and regression tests (audit_invariant_tests::commission_treasury_unchanged_after_max_spread_rejected_swap,commission_treasury_unchanged_after_deadline_rejected_swap). No production contract, indexer, or frontend code changes.Method: Traced pair
execute_swap/cw20_receivesettlement order against SEC-C03 (P10):assert_deadlineruns beforeexecute_swap;assert_max_spreadandmin_returnrun before treasury CW20Transfermessages are emitted in the response; CosmWasm transaction atomicity rolls back storage (includingRESERVESupdates) and undispatched submessages onErr. Confirmed new tests pass locally (cargo test -p cl8y-dex-tests commission_treasury_unchanged— 2/2).Outcome:
FINDINGS: 0medium+Security review: no medium+ findings on this diff. No inline threads (nothing to flag).
Prior MR security-review notes: none found.
mentioned in commit
6d893483d3