Skip to content

fix(sei-tendermint): publish Autobahn block events (CON-352) - #3998

Draft
shemnon wants to merge 1 commit into
mainfrom
shemnon/con-352-auditor-feedback-fix-broadcasttxcommit-timeout-under
Draft

fix(sei-tendermint): publish Autobahn block events (CON-352)#3998
shemnon wants to merge 1 commit into
mainfrom
shemnon/con-352-auditor-feedback-fix-broadcasttxcommit-timeout-under

Conversation

@shemnon

@shemnon shemnon commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Publish committed Autobahn blocks and transactions to the event bus so indexer-backed RPC methods can observe inclusion.

  • Wire the node event bus into validator and fullnode Giga routers
  • Publish block, header, and transaction events after application commit
  • Cover transaction indexing, empty blocks, result-count mismatches, and broadcast_tx_commit end to end

Summary

Autobahn committed blocks were not publishing block and transaction events. As a result, the transaction indexer never observed Autobahn transactions, causing indexer-backed RPC methods such as broadcast_tx_commit and /tx
to wait until timeout.

  • Wire the node event bus into validator and fullnode Giga routers.
  • Publish NewBlock, NewBlockHeader, and per-transaction events after application commit.
  • Validate transaction and ABCI result counts before dispatching events.
  • Cover transaction indexing, empty blocks, mismatched results, and broadcast_tx_commit end to end.

Testing

  • go test ./internal/p2p ./internal/rpc/core ./node -count=1
  • make fmtcheck

Publish committed Autobahn blocks and transactions to the event bus so
indexer-backed RPC methods can observe inclusion.

- Wire the node event bus into validator and fullnode Giga routers
- Publish block, header, and transaction events after application commit
- Cover transaction indexing, empty blocks, result-count mismatches, and
 broadcast_tx_commit end to end
@cursor

cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes the post-commit path for all Autobahn nodes and affects RPC correctness for tx inclusion; behavior is additive (events after commit) with a hard panic on ABCI/tx count mismatch, but misconfigured EventBus could leave indexer RPCs broken without failing block execution.

Overview
Autobahn committed blocks did not emit the block/tx events that the transaction indexer and RPC layer expect, so broadcast_tx_commit and /tx could hang until timeout. This PR wires the node’s EventBus into validator and fullnode Giga routers and publishes events after each Autobahn commit.

After app.Commit() in executeBlock, the router now calls publishExecutedBlockEvents, which translates the global block, sets the proposer, checks that len(TxResults) matches len(block.Txs) (panic before any publish on mismatch), then emits NewBlock, NewBlockHeader, and one Tx event per transaction with height, index, and deliver result. Publish failures are logged only; they do not fail commit.

Node setup passes the shared types.BlockEventPublisher from makeNode / seed construction through createRouterbuildGigaRouter into GigaRouterCommonConfig.EventBus. Tests cover KV indexing (multi-tx and empty blocks), mismatch panic, multi-validator finalize + indexer lookup, and end-to-end BroadcastTxCommit under Autobahn.

Reviewed by Cursor Bugbot for commit 1c31e68. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 24, 2026, 10:23 PM

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.67568% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.02%. Comparing base (cc85598) to head (1c31e68).

Files with missing lines Patch % Lines
sei-tendermint/internal/p2p/giga_router_common.go 81.25% 3 Missing and 3 partials ⚠️
sei-tendermint/node/setup.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3998      +/-   ##
==========================================
- Coverage   59.10%   58.02%   -1.08%     
==========================================
  Files        2305     2206      -99     
  Lines      197039   185504   -11535     
==========================================
- Hits       116452   107635    -8817     
+ Misses      69817    68037    -1780     
+ Partials    10770     9832     -938     
Flag Coverage Δ
sei-chain-pr 62.07% <75.67%> (?)
sei-db 69.80% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-tendermint/internal/p2p/giga_router.go 100.00% <ø> (ø)
sei-tendermint/node/node.go 66.02% <100.00%> (+0.07%) ⬆️
sei-tendermint/node/seed.go 52.13% <100.00%> (ø)
sei-tendermint/node/setup.go 57.84% <0.00%> (-0.27%) ⬇️
sei-tendermint/internal/p2p/giga_router_common.go 63.85% <81.25%> (+5.13%) ⬆️

... and 102 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1c31e68. Configure here.

return nil, fmt.Errorf("app.Commit(): %w", err)
}
// Indexer-backed RPCs (broadcast_tx_commit, /tx) wait on these events.
r.publishExecutedBlockEvents(b, proposerAddress, resp)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Autobahn event reindex path

Medium Severity

Autobahn now publishes indexer events only inside executeBlock after app.Commit, but restart recovery advances from the app tip without re-publishing the last committed height. A crash after commit and before those events are indexed permanently skips that block for /tx and broadcast_tx_commit. CometBFT covers this with handshake replayEvents; Autobahn skips the handshaker.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1c31e68. Configure here.

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wiring is sound: the event bus reaches both Giga roles through the single buildGigaRouter choke point, events are published after app.Commit in the same order (and with the same sanity-check panic) as the classic state.FireEvents path, and the added tests cover indexing, empty blocks, count mismatch, and broadcast_tx_commit end to end. Two non-blocking notes: the published block carries an empty Block.Hash(), and the publish sequence is a verbatim copy of state.FireEvents.

Findings: 0 blocking | 2 non-blocking | 1 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] publishExecutedBlockEvents is a near-verbatim copy of the exported state.FireEvents (sei-tendermint/internal/state/execution.go:643) — same three publish blocks, same panic message, same //nolint:gosec comment — minus the evidence and validator-update publishes. Nothing keeps the two in sync, so a future fix to FireEvents (a new event type, an index/height fix) silently misses the Autobahn path. Consider calling state.FireEvents directly, or extracting the shared sequence into a small package both can depend on. Worth checking the import direction first: internal/state's non-test deps (eventbus, mempool, store, proxy, pubsub) do not reach internal/p2p today, so the import appears cycle-free.
  • 1 suggestion(s)/nit(s) flagged inline on specific lines.

}
eventBus := r.cfg.EventBus

if err := eventBus.PublishEventNewBlock(types.EventDataNewBlock{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The translated block's header has no ValidatorsHash, so Block.Hash() returns nil for these events (types/block.go:511 short-circuits on len(h.ValidatorsHash) == 0). Only BlockID carries the real Autobahn hash. That was harmless while nothing consumed these events, but publishing them makes consumers that key off Block.Hash() start emitting zero hashes rather than nothing: the RPC event log subscribes to all bus events and is on by default (event-log-window-size = 30s), and evmrpc's block filters read exactly that field — getBlockHeadersAfter does common.BytesToHash(block.Block.Hash()) (evmrpc/filter.go:695), so eth_newBlockFilter + eth_getFilterChanges will now return 0x000…0 for every Autobahn block, which clients can mistake for a real hash. Same applies to websocket tm.event='NewBlock' subscribers. Either populate the header fields the hash derives from, or switch the affected consumers to BlockID (and note the limitation on translateGlobalBlock, whose doc currently lists only the evmrpc receipt path as a caller).

@shemnon
shemnon marked this pull request as draft August 24, 2026 22:26
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