Add buy energy charges #505
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!505
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/332-buy-energy-charges"
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
Verification
Notes
Security review — MR !505
Commit reviewed:
748b8b360f7e58e0ef93e9bcb520496345807c1fScope: Buy-energy pacing (
TimeArenacharge refill/burst gap, deploy params, indexer sale-head fields, frontend CTA/preflight, simulations, verify script).Outcome:
FINDINGS: 0medium+Reviewed the MR diff and traced attacker-controlled inputs to sinks across contracts (
_spendBuyCharge/_refilledBuyEnergy/buyEnergyState), deploy scripts, indexer RPC head polling, and frontend preflight. No inline threads — nothing met the medium+ bar.Summary
_spendBuyChargeruns before external token pulls/burns insidenonReentrantbuy paths; failed txs revert charge spend atomically. Charge refill math caps atmaxBuyCharges; burst gap enforced. No bypass path found forbuy/buyWithCred/ router-onlybuyFor.buyEnergyStateremains an onchain read for submit gating. No new injection/authz/SSRF/XSS surfaces in the diff.buyChargeIntervalSec/maxBuyCharges/burstBuyCooldownSecbeforearenaStartand appends_buyEnergy; upgrading an already-initialized pre-#332 proxy would corrupt storage and reset pacing semantics. Mainnet registry still hasTimeArenaat zero — first deploy with this implementation is layout-consistent. Operators must notupgradeToa live flat-cooldown proxy without an append-only migration plan.Security review: no medium+ findings on this diff.
We are doing a fresh deploy, so do not need to reserve legacy slots.
We should have the cap include level minus one - so level 2 gets +1 cap (6), level 3 gets +1 cap (7), etc, so that level 5 has cap of 9. The frontend will also need to be updated where we share with user their benefits from levelup
changed this line in version 2 of the diff
added 1 commit
ceb0affc- Scale buy energy cap by levelCompare with previous version
Implemented level-adjusted buy-energy caps and frontend level-up benefit copy in
ceb0affc.Confirmed fresh deploy scope; no legacy storage-slot reservation is needed for this MR.
resolved all threads
Security review — MR !505
Commit reviewed:
ceb0affcaf639d3ab0ddd7fcc435410d6496989aScope: Buy-energy pacing (
TimeArenacharge refill/burst gap, level-adjusted caps, deploy params, indexer sale-head fields, frontend CTA/preflight, simulations, verify script).Outcome:
FINDINGS: 0medium+Re-reviewed the full MR diff at head (including level-adjusted
maxBuyCharges + level - 1inceb0affc) and traced attacker-controlled inputs to sinks across contracts, deploy scripts, indexer head polling, and frontend submit paths. No inline threads — nothing met the medium+ bar.Summary
_spendBuyChargeruns before external token pulls/burns insidenonReentrantbuy paths; failed txs revert charge spend atomically. Refill math caps at_effectiveMaxBuyCharges(base cap + level − 1); burst gap enforced. Level bonus applies on pre-buy level, so a single tx cannot spend a charge and simultaneously benefit from a same-tx level-up cap increase. No bypass found forbuy/buyWithCred/ router-onlybuyFor(buyForalways debitsbuyer, router setsbuyer = msg.sender).buyEnergyStateremains an onchain read for submit gating. Frontend preflight gates burst cooldown via computednextBuyAllowedAt; zero-charge submits still fail closed onchain (TimeArena: no buy charges) — UX-only gap, not fund loss or authz bypass.Security review: no medium+ findings on this diff.
We do not need legacy slots as we are not upgrading, we are doing fresh deployment.
changed this line in version 3 of the diff
changed this line in version 3 of the diff
added 1 commit
bf607140- Remove legacy buy cooldown slotCompare with previous version
resolved all threads
Security review — MR !505
Commit reviewed:
bf60714084c055ba611afc0efe29d81c769027c5Scope: Buy-energy pacing (
TimeArenacharge refill/burst gap, level-adjusted caps, deploy params, indexer sale-head fields, frontend CTA/preflight, simulations, verify script). Delta since prior review: removal of reserved_legacyNextBuyAllowedAtstorage slot (bf607140).Outcome:
FINDINGS: 0medium+Re-reviewed the full MR diff at head and traced attacker-controlled inputs to sinks across contracts (
_spendBuyCharge/_refilledBuyEnergy/_effectiveMaxBuyCharges/buyEnergyState),TimeArenaBuyRouter.buyFor→buyer = msg.sender, deploy scripts, indexer RPC head polling, and frontend submit paths. No inline threads — nothing met the medium+ bar.Summary
_spendBuyChargeruns after_requireLiveAndAutoroll/_validateCharmand before external token pulls/burns insidenonReentrantbuy paths; failed txs revert charge spend atomically. Refill math caps at_effectiveMaxBuyCharges(maxBuyCharges + level - 1); burst gap enforced. Level bonus uses pre-buy level, so a single tx cannot spend a charge and simultaneously benefit from a same-tx level-up cap increase. No bypass found forbuy/buyWithCred/ router-onlybuyFor.buyEnergyState/ computednextBuyAllowedAtremain onchain reads for submit gating. Frontend preflight gates burst cooldown; zero-charge submits still fail closed onchain (TimeArena: no buy charges) — UX-only gap, not fund loss or authz bypass.bf607140) is consistent for first deploy with this implementation.Security review: no medium+ findings on this diff.
mentioned in commit
35c938cafd