Bot swarm stalls on Anvil when buy cooldown + idle chain freeze block.timestamp #99
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#99
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?
Summary
The default local Anvil + bot swarm path (
SKIP_ANVIL_RICH_STATE=1→START_BOT_SWARM=1) can stall after an initial burst of indexed buys. The Recent buys panel then shows a fixed head tx and ages that look wrong (chain time frozen; frontend separate issue #already fixed separately).Root cause
DeployDevdefaultsTimeCurve.buyCooldownSecto 300s unlessYIELDOMEGA_DEPLOY_NO_COOLDOWN=1/YIELDOMEGA_ANVIL_BUY_COOLDOWN_SEC(see GitLab #88,scripts/start-local-anvil-stack.sh).timecurve_bot.actions._wait_until_buy_allowedsleeps untillatestblocktimestamp >= nextBuyAllowedAt(sender).block.timestampadvance) occur while every swarm wallet is sleeping off cooldown and no other transaction mines.Result: chain tip and timestamps freeze; swarm workers that depend on advancing chain time (e.g.
defenderwaiting for “<900s window”, buys after cooldown) never make progress until something external mines a block.Impact
Recommended fixes (pick one or combine)
A — Document + script default (lowest risk)
bots/timecurve/README.mdandscripts/start-local-anvil-stack.shheader/next-steps: whenSTART_BOT_SWARM=1, recommendYIELDOMEGA_DEPLOY_NO_COOLDOWN=1(or shortYIELDOMEGA_ANVIL_BUY_COOLDOWN_SEC) for continuous buys on Anvil.START_BOT_SWARM=1&&SKIP_ANVIL_RICH_STATE=1, warn when cooldown env not set.B — Anvil periodic mining
--block-time N(or documented equivalent) when swarm is enabled soblock.timestampadvances during sleeps (validate exact Foundry flag / behavior for this repo’s Anvil version).C — Dev-only RPC in bots
_wait_until_buy_allowedwould sleep longer than X seconds, callevm_increaseTime/ Anvil helper once (behindYIELDOMEGA_ANVIL_TIME_WARP=1or similar) so QA does not depend on operator flags. Must be clearly dev-only and off by default.Acceptance criteria
start-local-anvil-stack.shorbots/timecurve/README.md): default swarm + 300s cooldown + automine → stalled chain time after burst.SKIP_ANVIL_RICH_STATE=1+ swarm run produces newBuyevents over ~10 minutes without manualcast send/ wallet txs (or explicitly scope “burst only” and set expectations).References
bots/timecurve/src/timecurve_bot/actions.py—_wait_until_buy_allowedbots/timecurve/src/timecurve_bot/strategies/defender.py— reset-band / time window waitsscripts/start-local-anvil-stack.sh—YIELDOMEGA_DEPLOY_NO_COOLDOWN,START_BOT_SWARMmentioned in commit
39dd51b9a1Implemented fixes A + B for GitLab #99 on `main` (merged).
What changed
A — Document + defaults
B — Anvil interval mining
Also: removed accidental duplicate Kumbaya `yieldomega_frontend_merge_kumbaya_vite_full` block; docs + `skills/verify-yo-bot-swarm-local-anvil/SKILL.md`; invariants § #99; guardrails #33.
Not implemented: Issue C (dev-only `evm_increaseTime` in bots) — left out per scope (non-Anvil / production bots unchanged).
@brouie please verify:
Issue left open for your sign-off.
mentioned in issue #100
Verified fixes A + B for #99 on
dd1c59aHEAD today. Items 1-3 PASS, Item 4 deferred. Closing as primary fix verified; will retest Item 4 separately if needed.Stack state
Boot via:
SKIP_ANVIL_RICH_STATE=1 START_BOT_SWARM=1 bash scripts/start-local-anvil-stack.sh(defaults: cooldown=300s, --block-time 12s, swarm referrals on)Item 1 —
--block-time 12slog line: PASSStack log on first 5s of boot:
Anvil interval mining: --block-time 12s (GitLab #99; YIELDOMEGA_ANVIL_BLOCK_TIME_SEC=0 disables).Confirmed via
ps:anvil --host 127.0.0.1 --port 8545 --code-size-limit 524288 --accounts 30 --block-time 12Item 2 — Note (GitLab #99) prints with default cooldown: PASS
Stack log:
Note (GitLab #99): SKIP_ANVIL_RICH_STATE=1 + START_BOT_SWARM=1 with default DeployDev buyCooldownSec=300.For continuous indexer demo traffic, prefer: YIELDOMEGA_DEPLOY_NO_COOLDOWN=1 (and optionally YIELDOMEGA_ANVIL_BUY_COOLDOWN_SEC=…).Anvil is started with --block-time when this script launches it so sleeps still advance chain time.Item 3 — Recent buys advancing under interval mining: PASS
Indexer block progression observed:
/v1/timecurve/buys?limit=10returns 10 rows with advancing block_number values. New rows continue to land via the swarm's 18 bots (3× seed-local/defender/fun/shark/pvp/rando) under interval mining.Item 4 — RPC port already-bound warning: DEFERRED
Did not exercise the
bind 8545 then START_BOT_SWARM=1path this session — leaving for follow-up. The reused-RPC code path is documented but not visually confirmed.Closure
Primary mining + cooldown + advance-under-sleep behaviour verified end-to-end. 18 swarm bots produced 40+ buys + 40 ReferralApplied rows under the 12s block-time. Closing.
cc @PlasticDigits
mentioned in issue #102
mentioned in issue #104
mentioned in issue #162