Add chain 4326 TWAP hard-reset Forge test (#352) #523
No reviewers
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!523
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-352-twap-hard-reset-4326"
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?
Summary
Adds Forge coverage for GitLab #352: TimeArena Last Buy hard reset on MegaETH chain 4326 uses
ArenaCharmPriceTwap(production Kumbaya V3 TWAP path), not the Anvil spot oracle.What changed
contracts/test/TimeArenaTwapHardReset4326.t.sol—vm.chainId(4326)with mocked MegaETH factory/pools (vm.etch); triggers Last Buy hard reset; assertslastBuyEpoch,epochCharmAnchorWad,doubOwedForBuy, and buy DOUB pull match TWAP-derived anchor.INV-TIME-ARENA-EPOCH-CHARM-TWAP-4326; cross-links intime-arena.md,invariants-and-business-logic.md,skills/play-time-arena-doub/SKILL.md.Why: Anvil spot tests (#305/#315) did not exercise the
block.chainid == 4326branch in_sampleCharmAnchor, risking transition divergence at epoch boundary.Acceptance checklist
vm.chainId(4326)on default Anvil setupcd contracts && forge test --match-contract TimeArenaTwapHardReset4326TestlastBuyEpoch,epochCharmAnchorWad,doubOwedForBuy)test_chain4326_last_buy_hard_reset_twap_reanchor)forge testclean excluding optional fork/airdrop skipscd contracts && forge test --no-match-contract "DoubAirdropMegaethFork|TimeArenaWarbowBenchmark"docs/testing/invariants-and-business-logic.md,docs/product/time-arena.md,skills/play-time-arena-doub/SKILL.mdVerification for third parties
Confirm test comments reference MegaETH 4326 and that
charmAnchorKumbayaRouterstays zero (TWAP path, not Anvil spot).Related issue: #352 (leave open until merge).
Security review — MR !523
Commit reviewed:
e006e48698eb377c5940501b43bf1d43114f24d1Base:
fd6da035719d8096b21c7c91b8032f2f7dea2c69Scope
contracts/test/TimeArenaTwapHardReset4326.t.sol(new Forge test)time-arena.md,invariants-and-business-logic.md,skills/play-time-arena-doub/SKILL.mdMethod
Traced attacker-controlled inputs through the diff and exercised production paths referenced by the test (
TimeArena._sampleCharmAnchorchain-4326 branch,ArenaCharmPriceTwap.computeMegaethMainnet,doubOwedForBuyat hard-reset boundary). Checked for injection, authz, secret leakage, SSRF/XSS, supply-chain, and EVM-specific risks (reentrancy, oracle manipulation, access control). No prior security-review threads on this MR.Outcome
FINDINGS: 0 medium+
Security review: no medium+ findings on this diff.
This MR adds test-only coverage and documentation. It does not modify production contracts, scripts, indexer, or frontend runtime code. The new test uses standard Foundry cheatcodes (
vm.chainId,vm.etch,vm.warp) with existingtest/mocks/*helpers and hardcoded MegaETH addresses already present inArenaCharmPriceTwap.sol. No secrets, credentials, or new dependencies were introduced. Mock contracts andvm.etchcannot affect mainnet deployment artifacts.The test validates that Last Buy hard reset on chain 4326 re-anchors from
ArenaCharmPriceTwapand thatdoubOwedForBuymatches the subsequentbuyDOUB pull — consistent with existingnonReentrantbuy flow and pre-existing TWAP safeguards (15-minute horizon, observation cardinality, spot/TWAP deviation band). No new exploitable sink or permission-boundary regression was identified.Inline threads
None (no medium+ findings).
mentioned in commit
87b4f06ce1