test(pair): count parked dust in proptest escrow invariant (#264) #733

Merged
Brouie merged 1 commit from qa/fix-264-proptest-escrow-parked-dust into main 2026-06-02 06:51:16 +00:00
Brouie commented 2026-06-01 14:12:45 +00:00 (Migrated from gitlab.com)

make test-contracts is red on main (d6701c4): the pair-lib proptests prop_match_bids_maker_cap / prop_match_asks_maker_cap fail, so the whole integration suite never runs.

Root cause is in the #264 wave, and it's test-only — not an escrow leak. The helper assert_escrow_matches_lists (orderbook.rs) still asserts on-book remaining == PENDING_ESCROW, but #264 now parks sub-10 dust off-book into EXPIRED_LIMIT_CLAIMS while escrow keeps backing it until claim (L1). So escrow = on-book + parked dust. The helper under-counted and tripped on any random budget that left <10 dust (counterexample deltas were all 1/3/6/9).

Conservation itself is correct — the dedicated #264 tests pass and prove it (match_bid_dust_remainder_one_flushes_to_expired_claim: escrow drops by cost only, dust stays pending == claimable). This patch makes the helper add the parked-dust total per side:

walk_bid_sum + parked_dust_token1 == PENDING_ESCROW_TOKEN1   (and ask / token0)

After the fix: make test-contracts = 402 passed, 0 failed. Test-only change, orderbook.rs proptest helper only (+19/-2), no contract logic touched.

Found while verifying #262. Needs a quick look — this is gating verification of the whole contract wave (#262/#264/#265/#266/#263).

/cc @PlasticDigits

`make test-contracts` is red on main (d6701c4): the pair-lib proptests `prop_match_bids_maker_cap` / `prop_match_asks_maker_cap` fail, so the whole integration suite never runs. Root cause is in the #264 wave, and it's **test-only — not an escrow leak**. The helper `assert_escrow_matches_lists` (orderbook.rs) still asserts on-book `remaining` == `PENDING_ESCROW`, but #264 now parks sub-10 dust off-book into `EXPIRED_LIMIT_CLAIMS` while escrow keeps backing it until claim (L1). So escrow = on-book + parked dust. The helper under-counted and tripped on any random budget that left <10 dust (counterexample deltas were all 1/3/6/9). Conservation itself is correct — the dedicated #264 tests pass and prove it (`match_bid_dust_remainder_one_flushes_to_expired_claim`: escrow drops by `cost` only, dust stays pending == claimable). This patch makes the helper add the parked-dust total per side: walk_bid_sum + parked_dust_token1 == PENDING_ESCROW_TOKEN1 (and ask / token0) After the fix: `make test-contracts` = **402 passed, 0 failed**. Test-only change, `orderbook.rs` proptest helper only (+19/-2), no contract logic touched. Found while verifying #262. Needs a quick look — this is gating verification of the whole contract wave (#262/#264/#265/#266/#263). /cc @PlasticDigits
Brouie commented 2026-06-01 15:38:45 +00:00 (Migrated from gitlab.com)

mentioned in issue #264

mentioned in issue #264
Brouie commented 2026-06-01 15:41:57 +00:00 (Migrated from gitlab.com)

mentioned in issue #265

mentioned in issue #265
Brouie commented 2026-06-01 15:44:54 +00:00 (Migrated from gitlab.com)

mentioned in issue #266

mentioned in issue #266
Brouie commented 2026-06-01 15:52:53 +00:00 (Migrated from gitlab.com)

mentioned in issue #263

mentioned in issue #263
Brouie commented 2026-06-01 16:16:28 +00:00 (Migrated from gitlab.com)

mentioned in issue #267

mentioned in issue #267
Brouie commented 2026-06-01 16:16:55 +00:00 (Migrated from gitlab.com)

mentioned in issue #269

mentioned in issue #269
PlasticDigits (Migrated from gitlab.com) merged commit 52a865bfb7 into main 2026-06-02 06:51:16 +00:00
PlasticDigits commented 2026-06-02 06:51:23 +00:00 (Migrated from gitlab.com)

mentioned in commit 52a865bfb7

mentioned in commit 52a865bfb73a0eddba244cc6aade010408640a01
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!733
No description provided.