WarBow steal daily-cap UX: UTC reset in summary and inline cap warning #361
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#361
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
GitLab #360 — User bug report (ui/ux)
Bundled approved items:
Current codebase
Primary play surface is
/(ArenaSimplePage.tsx), which rendersArenaWarbowHeroPanelfor WarBow PvP.Viewer summary (
warbow-hero-card--viewer-summaryinArenaWarbowHeroPanel.tsx) currently shows only:YOUR BP: …GUARD: …(countdown when active, elseINACTIVE)Steal daily caps (onchain):
TimeArena.WARBOW_MAX_STEALS_PER_DAY = 3block.timestamp / SECONDS_PER_DAY(contracts/src/arena/TimeArena.sol,warbowSteal)stealsReceivedOnDay[victim][day]stealsCommittedByAttackerOnDay[attacker][day]WARBOW_STEAL_LIMIT_BYPASS_DOUBwhen either cap is hitFrontend steal UX gap:
useArenaWarbowHero.tscomputesutcDayIdfromchainNowSecandSECONDS_PER_DAY, but does not expose live steal-cap reads or inline preflight to the panel.readFreshWarbowStealPreflightreads victim BP / victim steals / victim guard, but passesattackerStealsToday: undefinedintodescribeStealPreflight(timeArenaUx.ts).pvpErrafter a blocked submit — not inline near the Steal button.ArenaSections.tsx) already rendersdescribeStealPreflightin aStatusMessagedirectly above the steal action row.Indexer-first display (#301): When
VITE_INDEXER_URLis set,chainNowSecand guard reads come from indexer head (indexerWarbowHead); steal-cap reads should use the same clock source and avoid duplicating browser RPC mirrors for display-only fields where indexer wallet stats can supply them.Why needed
Players cannot see when their free steal quota resets without mental UTC math, and the daily-cap warning is easy to miss because it surfaces only after a failed transaction at the bottom of the WarBow section. This was reported as a UX bug in #360 and approved for implementation.
Constraints / guardrails
TimeArena(SECONDS_PER_DAY,stealsReceivedOnDay,stealsCommittedByAttackerOnDay).VITE_INDEXER_URLis set; do not add parallel browser RPC polling for fields the indexer already serves.describeStealPreflight/ existing constants (arenaWarbowConstants.ts,abis.ts).warbowHeroSubcardHelpCopy.ts(“per UTC day”, bypass spend label).warbow-hero-viewer-summary__linestyling inindex.css.Relevant files
frontend/src/pages/arena/ArenaWarbowHeroPanel.tsxfrontend/src/pages/arena/useArenaWarbowHero.tsfrontend/src/lib/timeArenaUx.ts(describeStealPreflight)frontend/src/lib/timeArenaWarbowStealSubmitPreflight.tsfrontend/src/lib/arenaWarbowConstants.ts,frontend/src/lib/abis.tsfrontend/src/pages/arena/ArenaSections.tsxfrontend/src/pages/arena/ArenaSimplePage.tsxfrontend/src/index.css(.warbow-hero-card--viewer-summary)frontend/src/pages/arena/ArenaWarbowHeroPanel.test.tsx,frontend/src/lib/timeArenaUx.test.tsRecommended direction
UTC-day reset in viewer summary
STEAL QUOTA:orNEXT FREE STEALS:, showing:X / 3(fromstealsCommittedByAttackerOnDaywhen connected).formatCountdown(secondsUntilNextUtcDay)derived fromchainNowSec % SECONDS_PER_DAY.warbowUtcDayResetSec(chainNowSec, secondsPerDay)) next to existing timer helpers; unit-test it.Inline steal-cap warning near Steal button
ArenaSections.tsx: when a victim is selected, renderdescribeStealPreflight(warning/error tones) immediately above the Steal button inside the steal card — not only in the globalpvpErrfooter.useArenaWarbowHeroto readstealsCommittedByAttackerOnDay(viewer, utcDayId)and victim steals when a victim is selected (wagmiuseReadContractwhen indexer off; optional indexer wallet stats if available).attackerStealsTodayintodescribeStealPreflight(fix the currentundefinedgap).readFreshWarbowStealPreflightas the final gate beforewarbowSteal(#216 / #101).Optional polish: disable Steal button when preflight tone is
error(protocol page already does this); keep bypass checkbox behavior unchanged.Acceptance criteria
X/3and a live countdown to the next UTC-day reset.describeStealPreflightcopy.VITE_INDEXER_URLset) still renders correct countdown and cap state (no extra RPC mirror violations).Test plan
cd frontend && npm test -- ArenaWarbowHeroPanel.test.ts timeArenaUx.test.tscd frontend && npm run typecheckcd frontend && npm run lintbash scripts/start-qa-local-full-stack.sh --live-sale --no-swarm --no-frontendthencd frontend && npm run dev/, connect wallet, open WarBow panel: summary shows quota + reset; select victim at cap → warning adjacent to Stealbash scripts/qa/build-frontend-for-rabby.sh+ preview + Rabby on chain 31337cd frontend && npm testAttack / abuse test plan
SECONDS_PER_DAYand floor division asTimeArena— verify helper against known timestamps (not local timezone).warninguntil bypass checked.PlayerIdentitypatterns.Verification criteria
npm run typecheck && npm run lint && npm testinfrontend/— PASS/with connected wallet — quota line + inline cap warning visible per acceptance criteriamentioned in issue #360
mentioned in commit
78f57e5fccmentioned in merge request !533
mentioned in commit
824be4bf42mentioned in commit
d363d40ff3mentioned in merge request !534
mentioned in commit
6550fe97a0mentioned in commit
1459ead164mentioned in commit
c4de872e05mentioned in issue #366