Delta security review: document the post-baseline delta, fix 2 findings - #155
Merged
Conversation
AUDIT_DELTA.md is the internal adversarial review of every contract change since the audited baseline (618fb9d), written to hand to the external auditor: per-change security analysis, invariants checked, test evidence, and suggested external focus areas. Two findings, both Low, both fixed here with regression tests: DA-1: simulations on zero-reserve pools panicked the query VM. Quoting from POOL_STATE (the earlier optimistic-quote fix) exposed compute_swap's Decimal256::from_ratio division by a zero offer reserve on pre-threshold commit pools (reserves 0/0). Both query_simulation and query_reverse_simulation now return a clean "no active liquidity" error instead. DA-2: the router accepted minimum_receive = 0. With per-hop max_spread now pinned to the pools' 5% hard cap, minimum_receive is the only end-to-end slippage protection, and zero meant none at all (~14% worst case over 3 hops vs ~1.5% before the cap change). The shared start_multi_hop entry now rejects zero on both the native and CW20 paths. Workspace suite after fixes: 663 tests, 0 failures. https://claude.ai/code/session_01PBHdD9Wpt5rB8eUCWQHzVw
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.
AUDIT_DELTA.md is the internal adversarial review of every contract change since the audited baseline (618fb9d), written to hand to the external auditor: per-change security analysis, invariants checked, test evidence, and suggested external focus areas.
Two findings, both Low, both fixed here with regression tests:
DA-1: simulations on zero-reserve pools panicked the query VM. Quoting from POOL_STATE (the earlier optimistic-quote fix) exposed compute_swap's Decimal256::from_ratio division by a zero offer reserve on pre-threshold commit pools (reserves 0/0). Both query_simulation and query_reverse_simulation now return a clean "no active liquidity" error instead.
DA-2: the router accepted minimum_receive = 0. With per-hop max_spread now pinned to the pools' 5% hard cap, minimum_receive is the only end-to-end slippage protection, and zero meant none at all (~14% worst case over 3 hops vs ~1.5% before the cap change). The shared start_multi_hop entry now rejects zero on both the native and CW20 paths.
Workspace suite after fixes: 663 tests, 0 failures.
https://claude.ai/code/session_01PBHdD9Wpt5rB8eUCWQHzVw