Indexer ingest: log ordering and PodiumTimerArmed decode (#346) #521
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!521
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-346-ingest-log-order-podium-timer-armed"
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
Indexer ingest now sorts each block's
eth_getLogsrows by(block_number, transaction_index, log_index)before decode/persist, so globallast_buy_epochassignment matches onchain execution order when RPC returns misordered logs (#278 risk, #346).Adds full
PodiumTimerArmeddecode/persist path →idx_arena_podium_timer_armed(migration, reorg rollback, schema 2.20.0). Extendsverify-last-buy-epoch-anvil.shto assert timer-arm rows and fixes sync wait to use publicGET /v1/statusmax_indexed_block.Acceptance checklist
rg 'sort_rpc_logs_canonical' indexer/src/ingestion.rs+ unit tests iningestion_testsPodiumTimerArmeddecoded and persistedcd indexer && cargo test postgres_stage2_persist_all_events(includes new event)last_buy_epochcd indexer && cargo test last_buy_epoch_order_independent_on_shuffled_logscargo clippycleancd indexer && cargo clippy --all-targets -- -D warningscd indexer && cargo test --test integration_stage2 last_buy_epochbash scripts/verify-last-buy-epoch-anvil.shVerification for third parties
After an Anvil buy that arms the Last Buy timer, confirm:
Related: #346 · parent #342
Security review — MR !521
Commit reviewed:
0c766d5f6ee099a7e94421ea97e1b141f18305a7Scope: Indexer ingest log canonical sorting (
sort_rpc_logs_canonical),PodiumTimerArmeddecode/persist (idx_arena_podium_timer_armed), reorg rollback registration, schema 2.20.0 migration, Anvil verify script update.Outcome:
FINDINGS: 0medium+Summary: No new medium-or-higher vulnerabilities identified on this diff.
Reviewed attack paths:
persist.rsinsert uses sqlx parameterized binds ($1…$6); no string concatenation from log fields.eth_getLogsis address-filtered to registry contracts;decode_rpc_logrequiresblock_hash/tx_hash/log_index;PodiumTimerArmedis emitted only fromTimeArena._armPodiumTimer(internal, idempotent arm). Spoofed rows require a malicious RPC or chain reorg (pre-existing indexer trust model).last_buy_epochintegrity — This MR closes the misordered-RPC mis-tagging risk (#278) by sorting per-block logs on(block_number, transaction_index, log_index)before the decode/persist loop. No new ordering bypass introduced.idx_arena_podium_timer_armedadded toARENA_INDEX_TABLES.curlto indexer status, fixed SQL); no production attack surface.Prior security-review threads: none on this MR.
Inline threads: none (no findings to anchor).
mentioned in commit
fd6da03571