Wire WarBow ambush/streak-break BP and route WarBow DOUB like buys #310

Closed
opened 2026-06-13 07:34:13 +00:00 by PlasticDigits · 15 comments
PlasticDigits commented 2026-06-13 07:34:13 +00:00 (Migrated from gitlab.com)

Parent

Gap analysis follow-up from #309.

Current codebase

  • contracts/src/arena/TimeArena.sol declares WARBOW_AMBUSH_BONUS_BP (200) and WARBOW_STREAK_BREAK_MULT_BP (100) at L52–53 but _applyBuyWarBowBp (L719–725) only applies base, hard-reset, and clutch bonuses.
  • WarBow PvP (warbowSteal, warbowRevenge, warbowActivateGuard) pull DOUB via _pullDoubExact only; DOUB accumulates on TimeArena with no _routeDoubPrizeSplit / vault transfer. Tests assert stranded balance (TimeArena.t.sol steal/guard/revenge tests).
  • Normal buy routes 100% DOUB to podium vaults and increments totalDoubRaised; WarBow spends do neither.
  • Reference sim: simulations/timecurve_sim/model.py implements streak-break and ambush BP.

Why needed

Approved gap items: unwired ambush/streak-break BP; WarBow DOUB stranded; WarBow DOUB not prize-funded. Economic parity requires WarBow DOUB to behave like buy DOUB for prize accounting and vault routing.

Constraints / guardrails

  • Read .cursor/skills/yieldomega-guardrails/SKILL.md and docs/product/arena-v2.md.
  • Keep 100% podium routing (#300); no platform take via AdminSellVault.
  • Balance-delta parity (#123) and fee-on-transfer checks must remain.
  • Update contracts/PARAMETERS.md when constants change.

Relevant files

  • contracts/src/arena/TimeArena.sol — _applyBuyWarBowBp, WarBow spend paths, _routeDoubPrizeSplit
  • contracts/src/arena/libraries/ArenaBuyRouting.sol
  • contracts/test/TimeArena.t.sol
  • simulations/timecurve_sim/model.py, simulations/ecostrategy/warbow_pvp.py
  • contracts/PARAMETERS.md
  1. Wire streak-break (active_streak × WARBOW_STREAK_BREAK_MULT_BP) and ambush (+WARBOW_AMBUSH_BONUS_BP on hard reset + streak break) in _applyBuyWarBowBp, ordering BP after _processDefendedStreak consistent with sim.
  2. Route WarBow DOUB through the same prize split as buy (increment totalDoubRaised, vault transfers).
  3. Add Forge tests asserting BP amounts and vault balances after steal/guard/revenge.

Acceptance criteria

  • Ambush and streak-break BP applied on qualifying buys per sim/spec.
  • WarBow DOUB increments totalDoubRaised and lands in podium vaults like normal buys.
  • No DOUB stranded on TimeArena after WarBow actions (beyond rounding dust).
  • PARAMETERS.md and any progression docs updated.

Test plan

  • cd contracts && forge test --match-contract TimeArena (WarBow BP + routing cases).
  • cd contracts && forge test full suite (skip doub.csv fork tests if absent).
  • bash scripts/verify-podium-live-anvil.sh if routing touches deploy/indexer path.

Attack / abuse test plan

  • Fuzz WarBow steal/revenge with max streak; assert BP cap and vault split invariants hold.
  • Reentrancy: WarBow paths use nonReentrant; confirm no double-route on callback tokens.
  • Fee-on-transfer DOUB: balance-delta checks still pass after routing change.

Verification criteria

  • Forge WarBow BP tests pass with explicit expected BP values.
  • Integration test shows vault balances increase after WarBow spend equal to pulled DOUB.
  • Reviewer confirms no regression on #300 100% podium routing.
## Parent Gap analysis follow-up from [#309](https://gitlab.com/PlasticDigits/yieldomega/-/issues/309). ## Current codebase - `contracts/src/arena/TimeArena.sol` declares `WARBOW_AMBUSH_BONUS_BP` (200) and `WARBOW_STREAK_BREAK_MULT_BP` (100) at L52–53 but `_applyBuyWarBowBp` (L719–725) only applies base, hard-reset, and clutch bonuses. - WarBow PvP (`warbowSteal`, `warbowRevenge`, `warbowActivateGuard`) pull DOUB via `_pullDoubExact` only; DOUB accumulates on `TimeArena` with no `_routeDoubPrizeSplit` / vault transfer. Tests assert stranded balance (`TimeArena.t.sol` steal/guard/revenge tests). - Normal `buy` routes 100% DOUB to podium vaults and increments `totalDoubRaised`; WarBow spends do neither. - Reference sim: `simulations/timecurve_sim/model.py` implements streak-break and ambush BP. ## Why needed Approved gap items: unwired ambush/streak-break BP; WarBow DOUB stranded; WarBow DOUB not prize-funded. Economic parity requires WarBow DOUB to behave like buy DOUB for prize accounting and vault routing. ## Constraints / guardrails - Read `.cursor/skills/yieldomega-guardrails/SKILL.md` and `docs/product/arena-v2.md`. - Keep 100% podium routing (#300); no platform take via `AdminSellVault`. - Balance-delta parity (#123) and fee-on-transfer checks must remain. - Update `contracts/PARAMETERS.md` when constants change. ## Relevant files - `contracts/src/arena/TimeArena.sol` — `_applyBuyWarBowBp`, WarBow spend paths, `_routeDoubPrizeSplit` - `contracts/src/arena/libraries/ArenaBuyRouting.sol` - `contracts/test/TimeArena.t.sol` - `simulations/timecurve_sim/model.py`, `simulations/ecostrategy/warbow_pvp.py` - `contracts/PARAMETERS.md` ## Recommended direction 1. Wire streak-break (`active_streak × WARBOW_STREAK_BREAK_MULT_BP`) and ambush (+`WARBOW_AMBUSH_BONUS_BP` on hard reset + streak break) in `_applyBuyWarBowBp`, ordering BP after `_processDefendedStreak` consistent with sim. 2. Route WarBow DOUB through the same prize split as `buy` (increment `totalDoubRaised`, vault transfers). 3. Add Forge tests asserting BP amounts and vault balances after steal/guard/revenge. ## Acceptance criteria - [ ] Ambush and streak-break BP applied on qualifying buys per sim/spec. - [ ] WarBow DOUB increments `totalDoubRaised` and lands in podium vaults like normal buys. - [ ] No DOUB stranded on `TimeArena` after WarBow actions (beyond rounding dust). - [ ] `PARAMETERS.md` and any progression docs updated. ## Test plan - `cd contracts && forge test --match-contract TimeArena` (WarBow BP + routing cases). - `cd contracts && forge test` full suite (skip `doub.csv` fork tests if absent). - `bash scripts/verify-podium-live-anvil.sh` if routing touches deploy/indexer path. ## Attack / abuse test plan - Fuzz WarBow steal/revenge with max streak; assert BP cap and vault split invariants hold. - Reentrancy: WarBow paths use `nonReentrant`; confirm no double-route on callback tokens. - Fee-on-transfer DOUB: balance-delta checks still pass after routing change. ## Verification criteria - Forge WarBow BP tests pass with explicit expected BP values. - Integration test shows vault balances increase after WarBow spend equal to pulled DOUB. - Reviewer confirms no regression on #300 100% podium routing.
PlasticDigits commented 2026-06-13 07:34:43 +00:00 (Migrated from gitlab.com)

mentioned in issue #309

mentioned in issue #309
PlasticDigits commented 2026-06-13 10:19:34 +00:00 (Migrated from gitlab.com)

mentioned in merge request !465

mentioned in merge request !465
project_80561744_bot_5118c68a88bff95eacb6ab1c47c19cae commented 2026-06-13 10:24:11 +00:00 (Migrated from gitlab.com)

mentioned in commit daf39b3099

mentioned in commit daf39b309984c5f1a0c8b2897854d516b4307009
PlasticDigits commented 2026-06-13 12:58:34 +00:00 (Migrated from gitlab.com)

mentioned in commit 28fbbba370

mentioned in commit 28fbbba37045376e6af1aac1cc6700db0c483a28
PlasticDigits commented 2026-06-13 13:26:58 +00:00 (Migrated from gitlab.com)

Verification report — #310 (loop 1/5)

Verdict: FAIL — acceptance criteria are not met on main. Implementation gap matches the issue body’s “Current codebase” section; no MR opened (no repo changes).

Acceptance criteria

Criterion Result Evidence
Ambush + streak-break BP on qualifying buys (per sim/spec) FAIL _applyBuyWarBowBp (TimeArena.sol L719–725) applies only WARBOW_BASE_BUY_BP, timer-reset, and clutch — constants WARBOW_STREAK_BREAK_MULT_BP / WARBOW_AMBUSH_BONUS_BP are declared (L52–53) but unused. No Forge tests assert ambush/streak-break BP. Sim reference: simulations/timecurve_sim/model.py::warbow_buy_bp_delta.
WarBow DOUB increments totalDoubRaised + routes to podium vaults like buy FAIL warbowSteal / warbowRevenge / warbowActivateGuard call _pullDoubExact only (L429–474); no _routeDoubPrizeSplit or totalDoubRaised +=. Existing tests assert DOUB stranded on TimeArena (test_warbow_steal_pulls_doub, test_warbow_guard_pulls_doub, test_warbow_revenge_pulls_doub).
No DOUB stranded on TimeArena after WarBow actions FAIL Same tests above expect doub.balanceOf(address(arena)) to increase by pulled amounts (1000 / 10000 / 51000 DOUB).
PARAMETERS.md + progression docs updated PARTIAL / FAIL PARAMETERS.md L74–75 documents streak-break/ambush constants, but L77 still claims WarBow steal/revenge/guard spends are “routed like buy” — not true in code. No #310-specific invariant or Forge cases.

Test plan (issue body)

Command Result Notes
cd contracts && forge test --match-contract TimeArena PASS 76/76 passed
cd contracts && forge test PASS* 157 passed; 5 DoubAirdropMegaethFork tests SKIP/FAIL (missing airdrop/doub.csv, expected)
bash scripts/verify-podium-live-anvil.sh SKIP Script exited: indexer /v1/status unavailable during first-run compile; out of scope for #310 until WarBow DOUB routing lands (indexer only ingests buy-sourced PodiumEpochFunded today)

Verification criteria (issue body)

Item Result How verified
Forge WarBow BP tests with explicit expected BP values (ambush/streak-break) FAIL No such tests; test_warbow_bp_bonus_uses_last_buy_hard_reset_not_warbow_timer only checks reset bonus absence
Integration: vault balances ↑ after WarBow spend = pulled DOUB FAIL Tests assert arena contract balance ↑, not vault pools
No regression on #300 100% podium routing for normal buy PASS test_buy_routes_doub_split, test_buy_routes_epoch_tranches_worked_example pass

Attack / abuse plan

Item Result Notes
Fuzz WarBow steal/revenge at max streak; BP cap + vault split FAIL Not implemented / no tests
Reentrancy: WarBow paths nonReentrant PASS Code review: warbowSteal, warbowRevenge, warbowActivateGuard, claimWarBowFlag all nonReentrant
Fee-on-transfer DOUB after routing change SKIP Routing change not present; test_feeOnTransfer_buy_reverts_erc20Parity covers buy only

Implementation notes for follow-up

  1. Wire streak-break + ambush in _applyBuyWarBowBp before _processDefendedStreak mutates _dsLastUnderWindowBuyer / activeDefendedStreak (sim order in warbow_buy_bp_delta).
  2. After _pullDoubExact in WarBow spend paths, call _routeDoubPrizeSplit(spent) and totalDoubRaised += spent; flip existing #252 tests from stranded-balance assertions to vault/totalDoubRaised parity.
  3. Add explicit Forge cases for ambush (+200 BP) and streak-break (activeStreak × 100 BP).
  4. Align PARAMETERS.md L77 and add INV-TIME-ARENA-WARBOW-PRIZE-ROUTING (or extend INV-TIME-ARENA-WARBOW-DOUB) in invariants.

Issue left open — requires implementation MR before re-verify.

## Verification report — #310 (loop 1/5) **Verdict: FAIL** — acceptance criteria are not met on `main`. Implementation gap matches the issue body’s “Current codebase” section; no MR opened (no repo changes). ### Acceptance criteria | Criterion | Result | Evidence | |-----------|--------|----------| | Ambush + streak-break BP on qualifying buys (per sim/spec) | **FAIL** | `_applyBuyWarBowBp` (`TimeArena.sol` L719–725) applies only `WARBOW_BASE_BUY_BP`, timer-reset, and clutch — constants `WARBOW_STREAK_BREAK_MULT_BP` / `WARBOW_AMBUSH_BONUS_BP` are declared (L52–53) but unused. No Forge tests assert ambush/streak-break BP. Sim reference: `simulations/timecurve_sim/model.py::warbow_buy_bp_delta`. | | WarBow DOUB increments `totalDoubRaised` + routes to podium vaults like `buy` | **FAIL** | `warbowSteal` / `warbowRevenge` / `warbowActivateGuard` call `_pullDoubExact` only (L429–474); no `_routeDoubPrizeSplit` or `totalDoubRaised +=`. Existing tests assert DOUB **stranded** on `TimeArena` (`test_warbow_steal_pulls_doub`, `test_warbow_guard_pulls_doub`, `test_warbow_revenge_pulls_doub`). | | No DOUB stranded on `TimeArena` after WarBow actions | **FAIL** | Same tests above expect `doub.balanceOf(address(arena))` to increase by pulled amounts (1000 / 10000 / 51000 DOUB). | | `PARAMETERS.md` + progression docs updated | **PARTIAL / FAIL** | `PARAMETERS.md` L74–75 documents streak-break/ambush constants, but L77 still claims WarBow steal/revenge/guard spends are “routed like `buy`” — not true in code. No `#310`-specific invariant or Forge cases. | ### Test plan (issue body) | Command | Result | Notes | |---------|--------|-------| | `cd contracts && forge test --match-contract TimeArena` | **PASS** | 76/76 passed | | `cd contracts && forge test` | **PASS\*** | 157 passed; 5 `DoubAirdropMegaethFork` tests **SKIP/FAIL** (missing `airdrop/doub.csv`, expected) | | `bash scripts/verify-podium-live-anvil.sh` | **SKIP** | Script exited: indexer `/v1/status` unavailable during first-run compile; **out of scope for #310** until WarBow DOUB routing lands (indexer only ingests buy-sourced `PodiumEpochFunded` today) | ### Verification criteria (issue body) | Item | Result | How verified | |------|--------|--------------| | Forge WarBow BP tests with explicit expected BP values (ambush/streak-break) | **FAIL** | No such tests; `test_warbow_bp_bonus_uses_last_buy_hard_reset_not_warbow_timer` only checks reset bonus absence | | Integration: vault balances ↑ after WarBow spend = pulled DOUB | **FAIL** | Tests assert arena contract balance ↑, not vault pools | | No regression on #300 100% podium routing for normal `buy` | **PASS** | `test_buy_routes_doub_split`, `test_buy_routes_epoch_tranches_worked_example` pass | ### Attack / abuse plan | Item | Result | Notes | |------|--------|-------| | Fuzz WarBow steal/revenge at max streak; BP cap + vault split | **FAIL** | Not implemented / no tests | | Reentrancy: WarBow paths `nonReentrant` | **PASS** | Code review: `warbowSteal`, `warbowRevenge`, `warbowActivateGuard`, `claimWarBowFlag` all `nonReentrant` | | Fee-on-transfer DOUB after routing change | **SKIP** | Routing change not present; `test_feeOnTransfer_buy_reverts_erc20Parity` covers `buy` only | ### Implementation notes for follow-up 1. Wire streak-break + ambush in `_applyBuyWarBowBp` **before** `_processDefendedStreak` mutates `_dsLastUnderWindowBuyer` / `activeDefendedStreak` (sim order in `warbow_buy_bp_delta`). 2. After `_pullDoubExact` in WarBow spend paths, call `_routeDoubPrizeSplit(spent)` and `totalDoubRaised += spent`; flip existing #252 tests from stranded-balance assertions to vault/`totalDoubRaised` parity. 3. Add explicit Forge cases for ambush (+200 BP) and streak-break (`activeStreak × 100` BP). 4. Align `PARAMETERS.md` L77 and add `INV-TIME-ARENA-WARBOW-PRIZE-ROUTING` (or extend `INV-TIME-ARENA-WARBOW-DOUB`) in invariants. **Issue left open** — requires implementation MR before re-verify.
PlasticDigits commented 2026-06-13 13:59:29 +00:00 (Migrated from gitlab.com)

mentioned in issue #308

mentioned in issue #308
PlasticDigits commented 2026-06-13 14:09:21 +00:00 (Migrated from gitlab.com)

mentioned in commit 0bc2582912

mentioned in commit 0bc25829124980e1004c90a92d11e964b6dcd9c5
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-13 14:09:21 +00:00
PlasticDigits commented 2026-06-13 14:12:28 +00:00 (Migrated from gitlab.com)

mentioned in commit bc74435db9

mentioned in commit bc74435db9558298f2bd32140f3ed74867a9dcc5
PlasticDigits commented 2026-06-13 14:12:32 +00:00 (Migrated from gitlab.com)

mentioned in merge request !466

mentioned in merge request !466
PlasticDigits commented 2026-06-14 03:00:42 +00:00 (Migrated from gitlab.com)

mentioned in commit 6dda90975b

mentioned in commit 6dda90975b2407b117817eb5deb65a49ddb378c2
PlasticDigits commented 2026-06-14 03:00:46 +00:00 (Migrated from gitlab.com)

mentioned in merge request !479

mentioned in merge request !479
PlasticDigits commented 2026-06-14 05:02:48 +00:00 (Migrated from gitlab.com)

mentioned in commit 082d27f3a0

mentioned in commit 082d27f3a08929eca7e48c992cafd35dcf5827e9
PlasticDigits commented 2026-06-14 05:02:52 +00:00 (Migrated from gitlab.com)

mentioned in merge request !463

mentioned in merge request !463
PlasticDigits commented 2026-07-07 12:41:28 +00:00 (Migrated from gitlab.com)

mentioned in issue #366

mentioned in issue #366
PlasticDigits commented 2026-07-07 12:54:36 +00:00 (Migrated from gitlab.com)

mentioned in issue #367

mentioned in issue #367
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#310
No description provided.