Indexer ingest correctness: log ordering and PodiumTimerArmed decode #346
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#346
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
Transition Gap Analysis (#342) — P1 #4, P1 #5. Bundles M-I1, M-I2.
Current codebase
ingestion.rsiterates RPCeth_getLogsreturn order withfor lg in &logs— nosort_by(log_index)(or tx_index).LastBuyEpochStartedafterBuycould mis-taglast_buy_epochon misordered RPC (#278 risk).PodiumTimerArmedis emitted inTimeArena.sol(line ~724) but absent fromdecoder.rs/persist.rs. Head poller readspodiumTimerArmedvia Multicall; armed transition is not in event tables.Why needed
Log ordering is a correctness best-practice for epoch assignment and live podium projection.
PodiumTimerArmeddecode enables API/history for timer-arm transitions beyond RPC head polling.Constraints / guardrails
(block_number, transaction_index, log_index)beforepersist_decoded_log_conn.Relevant files
indexer/src/ingestion.rsindexer/src/decoder.rsindexer/src/persist.rscontracts/src/arena/TimeArena.sol(event PodiumTimerArmed)indexer/tests/integration_stage2.rsRecommended direction
PodiumTimerArmedto alloy event bindings,DecodedEvent, persist table (or extend existing podium timer state), and migration if needed.Acceptance criteria
PodiumTimerArmeddecoded and persisted.last_buy_epochassignment.cargo clippyclean.Test plan
cd indexer && cargo clippy --all-targets -- -D warnings && cargo testintegration_stage2.rslast-buy epoch testsbash scripts/verify-last-buy-epoch-anvil.shAttack / abuse test plan
PodiumTimerArmedrows consistently.Verification criteria
PodiumTimerArmedrow.mentioned in issue #342
mentioned in merge request !521
mentioned in commit
fd6da03571Verification — #346 Indexer ingest correctness: log ordering and PodiumTimerArmed decode
All acceptance criteria PASS. No repo changes required.
Acceptance criteria
ingestion.rscallssort_rpc_logs_canonicalon(block_number, transaction_index, log_index)before decode/persist; unit testssort_rpc_logs_canonical_orders_block_tx_log_indexandsort_rpc_logs_canonical_is_stable_for_equal_keyspassPodiumTimerArmeddecoded and persisteddecoder.rs→ArenaPodiumTimerArmed;persist.rs→idx_arena_podium_timer_armed; migration20260625120000_idx_arena_podium_timer_armed_gl346.up.sql;postgres_stage2_persist_all_events_and_rollback_afterasserts row count = 1last_buy_epochintegration_stage2::last_buy_epoch_order_independent_on_shuffled_logspassescargo clippycleancd indexer && cargo clippy --all-targets -- -D warnings— exit 0Test plan
cd indexer && cargo clippy --all-targets -- -D warnings && cargo testlast_buy_epoch_order_independent_on_shuffled_logsbash scripts/verify-last-buy-epoch-anvil.shidx_arena_podium_timer_armedrow for category 0; Boblast_buy_epoch=1; wallet statsepochs_participated=1bash scripts/verify-cloud-postgres.shAttack / abuse criteria
PodiumTimerArmedrowsidx_arena_podium_timer_armedinARENA_INDEX_TABLES;postgres_stage2_persist_all_events_and_rollback_afterasserts count 0 afterrollback_aftersort_rpc_logs_canonical_is_stable_for_equal_keysunit testDocs / invariants
INV-INDEXER-346-INGEST-LOG-ORDERdocumented indocs/testing/invariants-and-business-logic.mdanddocs/indexer/design.md— cross-links match implementation.