Repository navigation
test: lock down the 0-disables sentinel for settlement cap and liquidity floor - #179
Open
mordabdul1 wants to merge 1 commit into
Open
mordabdul1 wants to merge 1 commit into
mordabdul1 wants to merge 1 commit into
Conversation
mordabdul1
force-pushed
the
test/zero-sentinel-caps-81
branch
from
October 23, 2026 12:57
9d0ff4b to
9f44526
Compare
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
Closes #81.
Adds explicit named regression tests for the "0 disables" sentinel on both limits that share the convention, covering the sharpest inversion risk: resetting an active limit back to 0 (not just the never-configured default).
Tests added
test_max_settlement_amount_zero_sentinel_disables_cap— sets a 500 cap and asserts a 600 settlement is rejected withAboveMaxSettlementAmount; then resets the cap to 0 and asserts a settlement for the entire pool (1,000, double the former cap) succeeds. 0 means "no cap", never "cap of zero, reject everything".test_min_liquidity_zero_sentinel_disables_floor— the cross-checked min_liquidity equivalent: an active 700 floor rejects a withdrawal withBelowMinLiquidity; resetting the floor to 0 lets the pool drain to exactly zero.Both scenarios the issue names were already partially covered (
test_max_settlement_amount_disabled_by_defaultfor the untouched default,test_open_settlement_rejects_amount_above_cap/test_open_settlement_allows_amount_at_capfor nonzero-cap enforcement including the at-cap boundary); those remain unchanged, and the new tests add the explicit active→0 transition neither covered.Review of the sentinel logic (no gap found)
open_settlementguards withcap > 0 && amount > cap(src/lib.rs), so a zero cap short-circuits cleanly.require_min_liquidityearly-returnsOkonfloor == 0.No fix needed in src/lib.rs.
Testing
Full suite: 155 passed, 0 failed.
cargo fmt --checkclean.Incidental
Bumps
ethnum1.5.2 → 1.5.3 inCargo.lock(1.5.2 fails to compile on recent rustc, E0512). Same patch bump as the other open PRs; merges cleanly in any order.