TimeCurve: warbowRevenge missing !ended guard (inconsistent with other 3 WarBow actions) #47
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#47
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?
Filed per dev request from #39 section B5 findings.
Summary
Across the 4 WarBow actions in
contracts/src/TimeCurve.sol, three consistently guard against post-sale-end execution viasaleStart > 0 && !ended. One does not:warbowStealsaleStart > 0 && !endedwarbowActivateGuardsaleStart > 0 && !endedclaimWarBowFlagsaleStart > 0 && !endedwarbowRevengesaleStart > 0!endedConcern
warbowRevengeafter sale end still executes_subBattlePoints(stealer, take)+_addBattlePoints(msg.sender, take), which triggers_updateWarbowPodiumand re-orders the WarBow ladder.Since
distributePrizesreads live_warbowPodiumstate, a revenge called betweenendSale()anddistributePrizes()would mutate the ladder the distribution reads from.Mitigating factors
Recommendation
Either:
(a) Add
&& !endedtowarbowRevengeto match the other three actions, or(b) Explicitly document why revenge is post-end-allowed if intentional (e.g. 'revenge is grievance settlement not ladder-mutation')
cc @PlasticDigits
mentioned in issue #49
mentioned in issue #39
mentioned in commit
a39f827e12Fix shipped on
main(a39f827)Change:
warbowRevengenow uses the same phase guard as the other WarBow actions:require(saleStart > 0 && !ended, "TimeCurve: bad phase");so revenge cannot run afterendSale()and mutate_warbowPodiumbeforedistributePrizes().Tests: Added
test_warbow_revenge_reverts_after_end_sale(short-timer sale: steal → warp pastdeadline→endSale()while the 24h revenge window is still open →warbowRevengereverts withTimeCurve: bad phase). Fullforge testsuite passed locally.@brouie Can you verify when you have a moment?
Checklist
warbowSteal/warbowActivateGuard/claimWarBowFlag/warbowRevengeall usesaleStart > 0 && !ended(same revert string for phase).endSale()thenwarbowRevenge(stealer)reverts and does not move battle points or the WarBow ladder.test_warbow_revenge_once/ happy-path flows unchanged.mainfor the contracts job.cc @PlasticDigits
mentioned in issue #42
@PlasticDigits verified on
a39f827.require(saleStart > 0 && !ended, 'TimeCurve: bad phase')at TimeCurve.sol L432/446/496/520. Inconsistency resolved.test_warbow_revenge_reverts_after_end_saleat TimeCurve.t.sol:605 withvm.expectRevert('TimeCurve: bad phase')at L623 — exercises the exact flow I described (steal → warp past deadline → endSale → warbowRevenge while 24h window still open).FOUNDRY_PROFILE=ci forge testrun this morning: 178/178 passing, 0 failed. The new revenge-reverts test is part of the count.Closing as verified.