Skip to content

test: capacity-boundary and rebalance coverage for allocation_logic#499

Open
Whiznificent wants to merge 3 commits into
Commitlabs-Org:masterfrom
Whiznificent:test/allocation-capacity-bounds
Open

test: capacity-boundary and rebalance coverage for allocation_logic#499
Whiznificent wants to merge 3 commits into
Commitlabs-Org:masterfrom
Whiznificent:test/allocation-capacity-bounds

Conversation

@Whiznificent

Copy link
Copy Markdown

Summary

Closes #480

Adds exhaustive capacity-boundary and rebalance tests to contracts/allocation_logic/src/tests.rs and documents the boundary matrix in docs/ALLOCATION_LOGIC_POOL_REGISTRY_AND_RISK_LEVELS.md.

Tests Added

Test What it covers
test_allocate_exactly_at_max_capacity_accepted Allocation at exact max_capacity boundary is accepted
test_allocate_one_over_max_capacity_rejected Allocation 1 stroop over capacity fails with PoolCapacityExceeded (#7)
test_rebalance_across_pools_respects_capacity Rebalance releases old liquidity and reallocates without violating any pool cap
test_update_pool_capacity_below_total_liquidity_rejected Lowering capacity below current total_liquidity fails with PoolCapacityExceeded (#7)
test_rebalance_total_liquidity_no_underflow total_liquidity never goes below zero after rebalance

Docs Updated

  • docs/ALLOCATION_LOGIC_POOL_REGISTRY_AND_RISK_LEVELS.md: added Capacity Boundary Test Matrix table.

- Add test_allocate_exactly_at_max_capacity_accepted: exact boundary accepted
- Add test_allocate_one_over_max_capacity_rejected: +1 stroop fails (Commitlabs-Org#7)
- Add test_rebalance_across_pools_respects_capacity: rebalance stays within caps
- Add test_update_pool_capacity_below_total_liquidity_rejected: cap < liquidity fails
- Add test_rebalance_total_liquidity_no_underflow: liquidity never goes negative
- Document boundary matrix in docs/ALLOCATION_LOGIC_POOL_REGISTRY_AND_RISK_LEVELS.md

Closes Commitlabs-Org#480
- Add missing 'use crate::error::{category, Error}' imports to lib.rs tests module
- Add CommitmentMetadata and CommitmentNFT to types.rs to match commitment_nft
- Fix get_owner_commitments signature to include offset/limit params (matches live core)
- Update live-core signature check to match paginated get_owner_commitments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add capacity-boundary and rebalance tests for allocation_logic pools

1 participant