Adaptive chain-timer poll interval when head state is unchanged (#308) #455
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!455
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-308-adaptive-chain-timer-poll"
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
Implements GitLab #308 — adaptive chain-timer poll spacing when head state is unchanged (parent #306 / RPC load benchmark follow-up).
indexer/src/chain_timer_poll.rs: fast vs idle mode selection from snapshot diff + deadline proximity; env knobsCHAIN_TIMER_IDLE_POLL_MS(default 3000, max 3s for timer freshness SLO) andCHAIN_TIMER_DEADLINE_PROXIMITY_SEC(default 30).indexer/src/chain_timer.rs: after successful polls, sleeps 1s (fast) or 3s (idle); on idle cycles with unchanged head block, issues a singleeth_blockNumbershort-circuit instead of fullpoll_once(~32 RPC calls).RpcPollHealthfailure / HTTP 429 backoff unchanged.indexer/README.md,indexer/.env.example,docs/indexer/rpc-load-benchmark.md, invariantsINV-INDEXER-308-*.Acceptance checklist
cd indexer && cargo test chain_timer_pollrpc-benchmark-20260610T111415Z.jsonBENCHMARK_SCENARIO_SEC=120 bash scripts/benchmark-indexer-rpc-anvil.sh→ idlecalls_per_min_1m84 vs baseline 740 (−89%)peak_calls_10s≤50 (idle)CHAIN_TIMER_IDLE_POLL_MSclamped to 3000 max; short-circuit refreshespolled_at_msblock_advance_is_fast,epoch_change_is_fastRpcPollHealthfailure / 429 backoff unchangedcargo test chain_timer_poll(failure_backoff_*,rate_limit_overrides_idle_on_success)INV-INDEXER-306-NO-REGRESSION— clippy + unit testscd indexer && cargo clippy --all-targets -- -D warnings && cargo test --libbash scripts/verify-indexer-rpc-metrics.shbash scripts/verify-podium-live-anvil.shmain:arena_wallet_stats_two_epochs_and_bonus_fieldswithYIELDOMEGA_PG_TEST_URLset (warbow_battle_points1000 vs 750); unrelated to chain-timerVerification for third parties
Manual freshness (idle Anvil stack): poll
GET /v1/arena/timers— cachepolled_at_msin snapshot updates at least every 3s when RPC healthy.Blockers
verify-podium-live-anvil.shintegration tail fails onmainwith the samearena_wallet_stats_two_epochs_and_bonus_fieldsassertion whenYIELDOMEGA_PG_TEST_URLis set (not introduced by this MR).changed the description
changed the description
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit
ae43b67de3. Configure here.Short-circuit clears poll failures
Medium Severity
When a full
poll_oncefails but the failure streak is still below three, the next loop can still enter the idle short-circuit. A successfuleth_blockNumberthen callsreport_success, clears the streak, and returns the cached snapshot without retrying the failing full poll, so timer data can stay stale while RPC health looks healthy.Additional Locations (1)
indexer/src/chain_timer.rs#L267-L284Reviewed by Cursor Bugbot for commit
ae43b67de3. Configure here.Security review — MR !455
Commit reviewed:
ae43b67de3f9be312de1431c948cc2c0e85b20ffScope: Adaptive chain-timer poll interval (#308) —
indexer/src/chain_timer_poll.rs,indexer/src/chain_timer.rspoll loop changes, env knobs, docs/invariants.Outcome:
FINDINGS: 0medium+Summary
Reviewed the MR diff and traced attacker-controlled input to sinks. This change only affects internal indexer RPC polling cadence for the existing read-only
GET /v1/arena/timerscache. No new HTTP routes, SQL, shell execution, auth paths, or user-controlled inputs are introduced.Checked areas (no exploitable path found):
eth_blockNumber+ cached snapshot): Reduces RPC load when head block and adaptive fields are stable. Same-block state drift is bounded by the 3s idle cap and deadline-proximity fast mode; on-chain contracts remain authoritative for buys. Partial-RPC-failure masking (Bugbot thread onchain_timer_poll.rs:124) is an operational freshness concern, not an attacker-exploitable path — no external actor can steer the indexer's RPC health or selectively faileth_callwhile keepingeth_blockNumberhealthy on a trusted endpoint.CHAIN_TIMER_IDLE_POLL_MS,CHAIN_TIMER_DEADLINE_PROXIMITY_SEC): Operator-controlled at process start; idle ms clamped to[1000, 3000].Prior threads: Re-reviewed Bugbot's "Short-circuit clears poll failures" inline note — does not meet medium+ security bar (no plausible external attack path; impact is bounded indexer freshness under partial RPC outage).
Inline findings: None posted (zero medium+).
added 1 commit
f1ef7c79- fix: require full poll after any chain-timer failureCompare with previous version
changed the description
resolved all threads
mentioned in commit
11397d80e9mentioned in issue #308