Skip to content

feat: Indexed the derived txs in the kv indexer#21

Merged
0xNilesh merged 5 commits into
audit/kv-index-issuefrom
audit/kv-index-derived-txs
Jun 12, 2026
Merged

feat: Indexed the derived txs in the kv indexer#21
0xNilesh merged 5 commits into
audit/kv-index-issuefrom
audit/kv-index-derived-txs

Conversation

@0xNilesh

Copy link
Copy Markdown
Member

Description

Indexes derived EVM txs (internal executions emitted only as events, no embedded
MsgEthereumTx) in the KV indexer and makes them safely servable over JSON-RPC.

  • indexer/kv_indexer.goIndexBlock now indexes derived txs by hash and
    block-index, sharing the block's eth-tx counter so it stays aligned with the emitted
    txIndex ([F-2026-17745] Derived transactions share a constant txIndex value #18). Writes a derived marker (IsDerivedTx) in the same batch.
  • rpc/backend/tx_info.go — on a KV-indexer hit, GetTxByEthHash rebuilds the tx's
    TxResultAdditionalFields from block events when the marker says derived. Without this,
    getTransactionByHash / getTransactionReceipt panic on derived txs
    (interface conversion: *MsgSend, not *MsgEthereumTx); TraceTransaction errored.
    The marker gate keeps standard-tx lookups cheap (one key read, no event reparse).
  • types/indexer.go — adds IsDerivedTx to the EVMTxIndexer interface.

This is the KV-indexer serving path (Option 1) complementing the tx_search fallback
already on this branch (Option 2) — together they serve derived txs even when CometBFT
tx_index is disabled but json-rpc.enable-indexer is on.

Review notes

  • Most critical: derivedTxAdditionalFields in tx_info.go and indexDerivedTxs in kv_indexer.go.
  • Tests: indexer (hash/index resolution + marker) and rpc/backend
    (getTransactionByHash/Receipt derived serving, with the panic reproduced pre-fix).

Closes: F-2026-17740

0xNilesh added 3 commits June 11, 2026 18:33
Marks them via IsDerivedTx so the RPC backend can rebuild their fields.
Fixes getTransactionByHash/Receipt panic on derived txs (no MsgEthereumTx).
…/kv-index-derived-txs

# Conflicts:
#	rpc/backend/tx_info.go
0xNilesh added 2 commits June 12, 2026 17:00
GetTxByTxIndex reconstructs derived txs (gated by IsDerivedTxByBlockAndIndex) so trace predecessors aren't dropped.
@0xNilesh 0xNilesh merged commit 48c22a0 into audit/kv-index-issue Jun 12, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant