Skip to content

Ensure provide_liquidity_multi/withdraw_liquidity_multi enforce min_liquidity/max_settlement_amount per asset #70

Description

@Jagadeeshftw

📌 Description

set_min_liquidity(asset, floor) and set_max_settlement_amount(asset, amount) gate the single-asset withdraw_liquidity/open_settlement paths. The batch variants provide_liquidity_multi/withdraw_liquidity_multi validate "no duplicate assets" per the README, but it's not documented whether each per-asset leg of the batch is checked against the same floor/cap as its single-asset counterpart.

🧩 Requirements and context

  • Add a test where a batch withdraw_liquidity_multi request includes a leg that would violate min_liquidity for that asset — assert the whole batch is rejected (atomic, per the existing batch semantics), not partially applied.
  • Add the equivalent test for a per-asset max_settlement_amount cap and open_settlement-adjacent batch behavior if applicable.
  • Fix src/lib.rs if either guard is currently only enforced in the single-asset path.

🛠️ Suggested execution

  • Add reproduction tests in src/test.rs covering multi-asset batches that individually violate per-asset floors/caps.
  • If gaps are found, route the batch entrypoints through the same per-asset guard helper the single-asset entrypoints use.
  • Confirm atomicity is preserved (zero partial writes) when a batch is rejected.

✅ Acceptance criteria

  • Batch multi-asset calls enforce the same per-asset floor/cap as their single-asset counterparts.
  • A violating leg rejects the entire batch atomically.
  • Regression tests cover both.

🔒 Security notes

A gap here would let a caller bypass a configured liquidity floor or settlement cap simply by using the batch entrypoint instead of the single-asset one.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuesecuritySecurity hardening / audittestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions