Sparse and empty podium roll contract tests #355

Closed
opened 2026-06-25 20:07:36 +00:00 by PlasticDigits · 6 comments
PlasticDigits commented 2026-06-25 20:07:36 +00:00 (Migrated from gitlab.com)

Parent

Transition Gap Analysis (#342) — P2 #15. Bundles M-C2.

Current codebase

  • Podium roll (_rollPodiumEpoch) handles winners and tranche promotion; sparse paths lightly exercised.
  • No explicit tests for poolBal == 0 or zero-address winners during roll.
  • Tranche promotion still runs on empty/partial winner sets.

Why needed

Edge transitions at epoch roll (empty pool, partial winners) can strand DOUB or mis-pay; need contract tests before production incidents.

Constraints / guardrails

  • Match existing TimeArena.t.sol roll test style.
  • Use commingled default vault wiring unless paired with non-commingled issue.
  • Assert tranche promotion invariants from INV-TIME-ARENA-*.

Relevant files

  • contracts/src/arena/TimeArena.sol (_rollPodiumEpoch)
  • contracts/src/arena/ArenaPodiumSettlement.sol
  • contracts/test/TimeArena.t.sol
  1. test_roll_empty_pool_tranche_promotion — roll with zero active pool balance; assert promotion still correct, no revert loop.
  2. test_roll_partial_winners — one or more zero-address winner slots; assert payout math and events.
  3. Reference docs/product/time-arena.md payout rules in test comments.

Acceptance criteria

  • Two new tests PASS in forge test.
  • Document expected behavior for empty/partial rolls in test names/comments.
  • No regression in existing roll tests.

Test plan

Path Command
Targeted cd contracts && forge test --match-test test_roll_empty
Full cd contracts && forge test

Attack / abuse test plan

  • Roll cannot be used to extract DOUB from empty pool.
  • Zero-address winner must not receive payout.

Verification criteria

  • forge test PASS for new tests.
  • Invariants doc updated if new IDs assigned.
## Parent [Transition Gap Analysis (#342)](https://gitlab.com/PlasticDigits/yieldomega/-/issues/342) — P2 #15. Bundles **M-C2**. ## Current codebase - Podium roll (`_rollPodiumEpoch`) handles winners and tranche promotion; sparse paths lightly exercised. - No explicit tests for `poolBal == 0` or zero-address winners during roll. - Tranche promotion still runs on empty/partial winner sets. ## Why needed Edge transitions at epoch roll (empty pool, partial winners) can strand DOUB or mis-pay; need contract tests before production incidents. ## Constraints / guardrails - Match existing `TimeArena.t.sol` roll test style. - Use commingled default vault wiring unless paired with non-commingled issue. - Assert tranche promotion invariants from `INV-TIME-ARENA-*`. ## Relevant files - `contracts/src/arena/TimeArena.sol` (`_rollPodiumEpoch`) - `contracts/src/arena/ArenaPodiumSettlement.sol` - `contracts/test/TimeArena.t.sol` ## Recommended direction 1. `test_roll_empty_pool_tranche_promotion` — roll with zero active pool balance; assert promotion still correct, no revert loop. 2. `test_roll_partial_winners` — one or more zero-address winner slots; assert payout math and events. 3. Reference `docs/product/time-arena.md` payout rules in test comments. ## Acceptance criteria - [ ] Two new tests PASS in `forge test`. - [ ] Document expected behavior for empty/partial rolls in test names/comments. - [ ] No regression in existing roll tests. ## Test plan | Path | Command | |------|---------| | Targeted | `cd contracts && forge test --match-test test_roll_empty` | | Full | `cd contracts && forge test` | ## Attack / abuse test plan - Roll cannot be used to extract DOUB from empty pool. - Zero-address winner must not receive payout. ## Verification criteria - `forge test` PASS for new tests. - Invariants doc updated if new IDs assigned.
PlasticDigits commented 2026-06-25 20:07:51 +00:00 (Migrated from gitlab.com)

mentioned in issue #342

mentioned in issue #342
PlasticDigits commented 2026-06-28 02:29:03 +00:00 (Migrated from gitlab.com)

Timer for a podium should not start if the associated prize pool is empty

Timer for a podium should not start if the associated prize pool is empty
PlasticDigits commented 2026-06-28 02:44:27 +00:00 (Migrated from gitlab.com)

mentioned in commit a824654811

mentioned in commit a824654811746579d1a7563deff71727df11a32c
PlasticDigits commented 2026-06-28 02:44:49 +00:00 (Migrated from gitlab.com)

mentioned in merge request !528

mentioned in merge request !528
PlasticDigits commented 2026-06-28 04:49:09 +00:00 (Migrated from gitlab.com)

mentioned in commit d8fbb7ab2f

mentioned in commit d8fbb7ab2f9ec653c72676661dae2274e42b21c7
PlasticDigits commented 2026-06-28 04:57:25 +00:00 (Migrated from gitlab.com)

Verification — GitLab #355 (sparse / empty podium roll contract tests)

Result: PASS — acceptance criteria met on main (no repo changes required).

What was verified

Item Result How
test_roll_empty_pool_tranche_promotion PASS cd contracts && forge test --match-test test_roll_empty
test_roll_partial_winners PASS cd contracts && forge test --match-test test_roll_partial_winners
Test names/comments document empty/partial roll behavior PASS TimeArena.t.sol — comments reference time-arena.md tranches and 4:2:1 payout; empty-pool test asserts timer disarmed (podiumDeadline=0) after roll
No regression in existing roll tests PASS forge test --match-test test_roll_ — 7/7 PASS (5 existing + 2 new)
Invariants doc updated PASS INV-TIME-ARENA-PODIUM-ROLL-EMPTY, INV-TIME-ARENA-PODIUM-ROLL-SPARSE (+ detail IDs) in docs/testing/invariants-and-business-logic.md §355
Roll cannot extract DOUB from empty pool PASS test_roll_empty_pool_tranche_promotion — alice/vault balances unchanged; tranches still promote
Zero-address winner receives no payout PASS test_roll_partial_winners — bob balance unchanged; sole winner gets 4/7 only
Issue comment: timer must not restart on empty pool PASS Empty-pool test asserts podiumTimerArmed == false and podiumDeadline == 0 after roll; invariants operator note documents same

Full suite note

cd contracts && forge test — 234 PASS, 4 FAIL on DoubAirdropMegaethFork fork tests only (../airdrop/doub.csv missing; expected on Cloud VMs per AGENTS.md). No TimeArena / roll regressions.

Follow-ups

None required for this issue scope.

## Verification — GitLab #355 (sparse / empty podium roll contract tests) **Result: PASS** — acceptance criteria met on `main` (no repo changes required). ### What was verified | Item | Result | How | |------|--------|-----| | `test_roll_empty_pool_tranche_promotion` | **PASS** | `cd contracts && forge test --match-test test_roll_empty` | | `test_roll_partial_winners` | **PASS** | `cd contracts && forge test --match-test test_roll_partial_winners` | | Test names/comments document empty/partial roll behavior | **PASS** | `TimeArena.t.sol` — comments reference [time-arena.md](docs/product/time-arena.md) tranches and 4:2:1 payout; empty-pool test asserts timer disarmed (`podiumDeadline=0`) after roll | | No regression in existing roll tests | **PASS** | `forge test --match-test test_roll_` — 7/7 PASS (5 existing + 2 new) | | Invariants doc updated | **PASS** | `INV-TIME-ARENA-PODIUM-ROLL-EMPTY`, `INV-TIME-ARENA-PODIUM-ROLL-SPARSE` (+ detail IDs) in `docs/testing/invariants-and-business-logic.md` §355 | | Roll cannot extract DOUB from empty pool | **PASS** | `test_roll_empty_pool_tranche_promotion` — alice/vault balances unchanged; tranches still promote | | Zero-address winner receives no payout | **PASS** | `test_roll_partial_winners` — bob balance unchanged; sole winner gets 4/7 only | | Issue comment: timer must not restart on empty pool | **PASS** | Empty-pool test asserts `podiumTimerArmed == false` and `podiumDeadline == 0` after roll; invariants operator note documents same | ### Full suite note `cd contracts && forge test` — **234 PASS**, **4 FAIL** on `DoubAirdropMegaethFork` fork tests only (`../airdrop/doub.csv` missing; expected on Cloud VMs per AGENTS.md). No TimeArena / roll regressions. ### Follow-ups None required for this issue scope.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-28 04:57:25 +00:00
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/yieldomega#355
No description provided.