Fix WarBow benchmark forge tests (#353) #524

Merged
PlasticDigits merged 1 commit from issue-353-warbow-benchmark-slots into main 2026-06-26 04:29:09 +00:00
PlasticDigits commented 2026-06-26 03:50:37 +00:00 (Migrated from gitlab.com)

Summary

GitLab #353 — TimeArenaWarbowBenchmark.t.sol used stale vm.store slot constants after append-only TimeArena storage layout drift. Wrong slots meant _cachedLevel was never set (level gate / WarBow timer arming failed) and _battlePoints / battlePointsGeneration were written to the wrong words.

Fix: refresh slots from forge inspect TimeArena storage-layout (_battlePoints 60, battlePointsGeneration 62, _cachedLevel 106). No production ranking logic changes (#312).

Acceptance checklist

Criterion Command / step Result
Both benchmark tests PASS cd contracts && forge test --match-contract TimeArenaWarbowBenchmark PASS (2/2)
Default forge test has no unexpected Warbow failures cd contracts && FOUNDRY_PROFILE=ci forge test PASS (227 pass; 4 expected DoubAirdropMegaethFork misses without airdrop/doub.csv)
No WarBow production ranking logic change Diff limited to contracts/test/TimeArenaWarbowBenchmark.t.sol + snapshots/docs PASS

Verification checklist (third parties)

  1. cd contracts && forge test --match-contract TimeArenaWarbowBenchmark -vv — expect 2 passed, gas logs for update/roll/steal.
  2. cd contracts && FOUNDRY_PROFILE=ci forge test — expect Warbow benchmark green; only optional fork/airdrop failures if doub.csv absent.
  3. Confirm TimeArena.sol unchanged in this MR.
## Summary GitLab [#353](https://gitlab.com/PlasticDigits/yieldomega/-/issues/353) — `TimeArenaWarbowBenchmark.t.sol` used stale `vm.store` slot constants after append-only `TimeArena` storage layout drift. Wrong slots meant `_cachedLevel` was never set (level gate / WarBow timer arming failed) and `_battlePoints` / `battlePointsGeneration` were written to the wrong words. **Fix:** refresh slots from `forge inspect TimeArena storage-layout` (`_battlePoints` **60**, `battlePointsGeneration` **62**, `_cachedLevel` **106**). No production ranking logic changes ([#312](https://gitlab.com/PlasticDigits/yieldomega/-/issues/312)). ## Acceptance checklist | Criterion | Command / step | Result | |-----------|----------------|--------| | Both benchmark tests PASS | `cd contracts && forge test --match-contract TimeArenaWarbowBenchmark` | **PASS** (2/2) | | Default `forge test` has no unexpected Warbow failures | `cd contracts && FOUNDRY_PROFILE=ci forge test` | **PASS** (227 pass; 4 expected `DoubAirdropMegaethFork` misses without `airdrop/doub.csv`) | | No WarBow production ranking logic change | Diff limited to `contracts/test/TimeArenaWarbowBenchmark.t.sol` + snapshots/docs | **PASS** | ## Verification checklist (third parties) 1. `cd contracts && forge test --match-contract TimeArenaWarbowBenchmark -vv` — expect **2 passed**, gas logs for update/roll/steal. 2. `cd contracts && FOUNDRY_PROFILE=ci forge test` — expect Warbow benchmark green; only optional fork/airdrop failures if `doub.csv` absent. 3. Confirm `TimeArena.sol` unchanged in this MR. ## Related docs - [`docs/testing/warbow-ranking-benchmark-312.md`](docs/testing/warbow-ranking-benchmark-312.md) — slot refresh note (#353) - [`docs/testing/ci.md`](docs/testing/ci.md) — optional isolated benchmark command - [`docs/testing/invariants-and-business-logic.md`](docs/testing/invariants-and-business-logic.md) — `INV-TIME-ARENA-WARBOW-RANK-312` cross-link
PlasticDigits commented 2026-06-26 03:53:12 +00:00 (Migrated from gitlab.com)

Security review — MR !524

Commit reviewed: df74d3fa85a23731e33b6b668d46f6a56b3b3988
Scope: contracts/test/TimeArenaWarbowBenchmark.t.sol (storage slot constant refresh), contracts/snapshots/TimeArenaWarbowBenchmarkTest.json, and docs (ci.md, invariants-and-business-logic.md, warbow-ranking-benchmark-312.md). No production contract changes (TimeArena.sol unchanged).

Method: Diff review; traced vm.store usage in the benchmark harness; verified slot constants 60 / 62 / 106 against forge inspect TimeArena storage-layout on the MR branch; confirmed vm.store is Foundry test-only (not reachable on deployed contracts).

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Inline threads: none (no findings to anchor).

Notes: This MR corrects stale mapping base slots after append-only TimeArena layout drift so gas benchmarks write _battlePoints, battlePointsGeneration, and _cachedLevel at the intended storage words. Prior wrong slots affected test fidelity only, not on-chain authz or ranking logic.

## Security review — MR !524 **Commit reviewed:** `df74d3fa85a23731e33b6b668d46f6a56b3b3988` **Scope:** `contracts/test/TimeArenaWarbowBenchmark.t.sol` (storage slot constant refresh), `contracts/snapshots/TimeArenaWarbowBenchmarkTest.json`, and docs (`ci.md`, `invariants-and-business-logic.md`, `warbow-ranking-benchmark-312.md`). No production contract changes (`TimeArena.sol` unchanged). **Method:** Diff review; traced `vm.store` usage in the benchmark harness; verified slot constants **60 / 62 / 106** against `forge inspect TimeArena storage-layout` on the MR branch; confirmed `vm.store` is Foundry test-only (not reachable on deployed contracts). **Outcome:** **FINDINGS: 0** medium+ Security review: no medium+ findings on this diff. **Inline threads:** none (no findings to anchor). **Notes:** This MR corrects stale mapping base slots after append-only `TimeArena` layout drift so gas benchmarks write `_battlePoints`, `battlePointsGeneration`, and `_cachedLevel` at the intended storage words. Prior wrong slots affected test fidelity only, not on-chain authz or ranking logic.
PlasticDigits (Migrated from gitlab.com) merged commit 078c379d56 into main 2026-06-26 04:29:10 +00:00
PlasticDigits commented 2026-06-26 04:29:11 +00:00 (Migrated from gitlab.com)

mentioned in commit 078c379d56

mentioned in commit 078c379d56073efe9b9814eba6b79d248141f347
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/yieldomega!524
No description provided.