📌 Description
set_max_settlement_amount(asset, amount) documents 0 as disabling the cap per the README's table, mirroring set_min_liquidity's 0-disables-floor convention. This "0 means disabled" sentinel is a common source of off-by-one bugs (e.g. accidentally treating 0 as "cap of zero, reject everything") and deserves an explicit named test rather than incidental coverage.
🧩 Requirements and context
- Add a test: with
max_settlement_amount(asset) at 0, open a large settlement via open_settlement and assert it succeeds (cap is disabled, not zero).
- Add a companion test with a nonzero cap confirming a settlement exceeding it is correctly rejected.
- Cross-check
set_min_liquidity's equivalent 0 sentinel has the same explicit test coverage; add it if missing.
🛠️ Suggested execution
- Add both tests to
src/test.rs.
- Fix
open_settlement's cap-check logic in src/lib.rs if the 0 sentinel is mishandled.
✅ Acceptance criteria
🔒 Security notes
An inverted sentinel here would either silently disable a risk control or brick settlements entirely for an asset — worth locking down explicitly.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
set_max_settlement_amount(asset, amount)documents0as disabling the cap per the README's table, mirroringset_min_liquidity's0-disables-floor convention. This "0 means disabled" sentinel is a common source of off-by-one bugs (e.g. accidentally treating0as "cap of zero, reject everything") and deserves an explicit named test rather than incidental coverage.🧩 Requirements and context
max_settlement_amount(asset)at0, open a large settlement viaopen_settlementand assert it succeeds (cap is disabled, not zero).set_min_liquidity's equivalent0sentinel has the same explicit test coverage; add it if missing.🛠️ Suggested execution
src/test.rs.open_settlement's cap-check logic insrc/lib.rsif the0sentinel is mishandled.✅ Acceptance criteria
0correctly disables the settlement-amount cap.min_liquidityequivalent.🔒 Security notes
An inverted sentinel here would either silently disable a risk control or brick settlements entirely for an asset — worth locking down explicitly.
📋 Guidelines