TimeArena Last Buy hard reset with TWAP on chain 4326 #352
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#352
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Transition Gap Analysis (#342) — P2 #12. Bundles H-C2.
Current codebase
TimeArena._sampleCharmAnchor()branches onblock.chainid == 4326→ArenaCharmPriceTwap.compute(MegaETH mainnet); Anvil tests use spot oracle path.ArenaCharmPriceTwap.t.soltests TWAP in isolation; optional fork smoke inArenaCharmPriceTwapFork.t.sol.TimeArena.buyhard-reset test on chain 4326 assertinglastBuyEpoch, anchor, anddoubOwedForBuy.Why needed
DOUB owed at epoch boundary could diverge between test and production TWAP path — transition correctness risk at Last Buy epoch rolls.
Constraints / guardrails
vm.chainId(4326)with mocked TWAP or controlled fork — avoid flaky mainnet dependency in default CI.Relevant files
contracts/src/arena/TimeArena.sol(_sampleCharmAnchor)contracts/src/oracle/ArenaCharmPriceTwap.solcontracts/test/ArenaCharmPriceTwap.t.solcontracts/test/TimeArena.t.solRecommended direction
vm.chainId(4326)and mock TWAP return (or use test harness implementing same interface).epochCharmAnchorWad, anddoubOwedForBuymatch TWAP-derived expectations.time-arena.mdtest coverage cross-link.Acceptance criteria
vm.chainId(4326).forge testclean excluding optional fork/airdrop skips.Test plan
cd contracts && forge test --match-test Twap(or chosen name)cd contracts && forge testAttack / abuse test plan
ArenaCharmPriceTwaptests; this test asserts TimeArena consumes TWAP output correctly at epoch boundary.Verification criteria
mentioned in issue #342
mentioned in merge request !523
mentioned in commit
87b4f06ce1Verification — issue #352 (PASS)
Verified TimeArena Last Buy hard reset with TWAP on chain 4326 on
main(no repo changes required).Acceptance criteria
vm.chainId(4326)cd contracts && forge test --match-contract TimeArenaTwapHardReset4326→test_chain4326_last_buy_hard_reset_twap_reanchorPASSlastBuyEpoch,epochCharmAnchorWad,doubOwedForBuy, buy DOUB)doubOwedForBuypreview, and paid DOUB at hard-reset boundary (contracts/test/TimeArenaTwapHardReset4326.t.sol)forge testclean excluding optional fork/airdrop skipsforge test: 227 passed; 4 failures only inDoubAirdropMegaethFork.t.sol(missing gitignoredairdrop/doub.csv— expected local skip per AGENTS.md). TWAP suites all PASS:ArenaCharmPriceTwap(4),ArenaCharmPriceTwapFork(1),TimeArenaTwapHardReset4326(1)ArenaCharmPriceTwap"; production branch inTimeArena._sampleCharmAnchor()atblock.chainid == 4326docs/product/time-arena.md,docs/testing/invariants-and-business-logic.md(INV-TIME-ARENA-EPOCH-CHARM-TWAP-4326,INV-TIME-ARENA-DOUB-OWED-PREVIEW),skills/play-time-arena-doub/SKILL.mdImplementation notes (already on main)
TimeArenaTwapHardReset4326.t.solmocks Kumbaya V3 pools viavm.chainId(4326)+vm.etch— no flaky mainnet RPC in default CI.ArenaCharmPriceTwap.t.sol; this test covers TimeArena consumption at epoch boundary.Closing as verified.
mentioned in issue #367