Contract test: single-hop hybrid consumes book + pool remainder #77

Closed
opened 2026-04-09 03:24:05 +00:00 by PlasticDigits · 5 comments
PlasticDigits commented 2026-04-09 03:24:05 +00:00 (Migrated from gitlab.com)

Evidence

  • smartcontracts/tests/src/limit_order_tests.rs; TEST_GAP_MATRIX.md

Acceptance criteria

  • cargo test covers non-empty book + pool in one execute_swap

Epic

#59

## Evidence - `smartcontracts/tests/src/limit_order_tests.rs`; `TEST_GAP_MATRIX.md` ## Acceptance criteria - [ ] `cargo test` covers non-empty book + pool in one `execute_swap` ## Epic #59
PlasticDigits commented 2026-04-09 03:24:06 +00:00 (Migrated from gitlab.com)

marked this issue as related to #59

marked this issue as related to #59
PlasticDigits commented 2026-04-09 03:24:07 +00:00 (Migrated from gitlab.com)

marked this issue as related to #61

marked this issue as related to #61
PlasticDigits commented 2026-04-13 04:48:31 +00:00 (Migrated from gitlab.com)

Single-hop book + pool: Strengthened hybrid_pool_and_book_legs_one_swap in limit_order_tests.rs: asserts HybridSimulation book return is non-zero, at least one limit_order_fill event, bid remaining decreases, and executed token-B receipt equals HybridSimulation.return_amount (L8 parity for the same snapshot). @brouie please verify cargo test hybrid_pool_and_book in CI.

**Single-hop book + pool:** Strengthened `hybrid_pool_and_book_legs_one_swap` in `limit_order_tests.rs`: asserts `HybridSimulation` book return is non-zero, at least one `limit_order_fill` event, bid remaining decreases, and executed token-B receipt equals `HybridSimulation.return_amount` (L8 parity for the same snapshot). @brouie please verify `cargo test hybrid_pool_and_book` in CI.
Brouie commented 2026-04-20 06:40:30 +00:00 (Migrated from gitlab.com)

@PlasticDigits Verified on current main. Acceptance criteria:

  • cargo test covers non-empty book + pool in one execute_swap: smartcontracts/tests/src/limit_order_tests.rs line 1468 has hybrid_pool_and_book_legs_one_swap. Ran locally: 1 passed, 0 failed (limit_order_tests::hybrid_pool_and_book_legs_one_swap ... ok).

Assertions verified in the test:

  • Line 1519: sim.book_return_amount > Uint128::zero() -- asserts non-zero book return
  • Line 1555-1556: executed token B receipt equals HybridSimulation.return_amount ('L8: executed token B out should match HybridSimulation for same snapshot') -- L8 parity for same snapshot
  • limit_order_fill event emitted
  • Bid remaining decreases after fill

Closing.

@PlasticDigits Verified on current main. Acceptance criteria: - [x] cargo test covers non-empty book + pool in one execute_swap: smartcontracts/tests/src/limit_order_tests.rs line 1468 has hybrid_pool_and_book_legs_one_swap. Ran locally: **1 passed, 0 failed** (limit_order_tests::hybrid_pool_and_book_legs_one_swap ... ok). **Assertions verified in the test:** - Line 1519: sim.book_return_amount > Uint128::zero() -- asserts non-zero book return - Line 1555-1556: executed token B receipt equals HybridSimulation.return_amount ('L8: executed token B out should match HybridSimulation for same snapshot') -- L8 parity for same snapshot - limit_order_fill event emitted - Bid remaining decreases after fill Closing.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-20 06:40:33 +00:00
Brouie commented 2026-04-20 07:26:42 +00:00 (Migrated from gitlab.com)

mentioned in issue #100

mentioned in issue #100
Sign in to join this conversation.
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#77
No description provided.