Skip to content

feat(block): track consensus proposer pubkey#178

Open
0xrusowsky wants to merge 5 commits intomainfrom
rus/block-proposer-pubkey
Open

feat(block): track consensus proposer pubkey#178
0xrusowsky wants to merge 5 commits intomainfrom
rus/block-proposer-pubkey

Conversation

@0xrusowsky
Copy link
Copy Markdown
Contributor

Adds a consensus_proposer column to the blocks table, populated from the consensus_context.proposer field embedded in the Tempo block header by TIP-1031. Pre-T4 blocks store NULL.

To deserialize the new field, the Block/Transaction type aliases now use TempoNetwork::BlockResponse from tempo-alloy directly, picking up TempoHeaderResponse with its consensus context. Header field accesses move to BlockHeader trait methods since TempoHeader no longer exposes alloy_consensus::Header fields directly.

Adds a `consensus_proposer` column to the `blocks` table on both PostgreSQL
(BYTEA, 32-byte CHECK) and ClickHouse (Nullable(String)), populated from the
optional consensus_context.proposer field embedded in the Tempo block header
by TIP-1031. Pre-fork blocks store NULL.

To deserialize the new field, the Block/Transaction type aliases now use
TempoNetwork::BlockResponse from tempo-alloy directly, picking up
TempoHeaderResponse with its consensus context. Header field accesses move
to BlockHeader trait methods since TempoHeader no longer exposes
alloy_consensus::Header fields directly.

Existing rows self-heal from NULL to populated on any later reinsert via
`ON CONFLICT DO UPDATE ... WHERE consensus_proposer IS NULL` so no separate
backfill is required after upgrading past T4. A
`tidx_blocks_consensus_context_total{proposer="present"|"absent"}` counter
gives operators a deploy-day signal that the field is flowing through.

Refs: tempoxyz/tempo TIP-1031
Comment thread src/sync/decoder.rs Outdated
Comment thread src/sync/decoder.rs Outdated
Comment thread src/sync/writer.rs Outdated
Comment thread src/sync/writer.rs Outdated
Comment thread src/metrics.rs Outdated
Comment thread src/types.rs Outdated
Comment thread Cargo.toml Outdated
@0xrusowsky 0xrusowsky marked this pull request as ready for review April 30, 2026 19:09
Copy link
Copy Markdown
Member

@o-az o-az left a comment

Choose a reason for hiding this comment

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

Just one note, could you please do the postgres migration via pgroll? if you have mise you can mise install and it'll become available in the env. See https://github.com/tempoxyz/tidx/tree/main/db/pgroll#readme

0xrusowsky and others added 2 commits May 4, 2026 09:25
Mirror db/migrations/20260430_add_blocks_consensus_proposer.sql as a
pgroll migration so production deploys via pgroll pick up the new
column. Bump expected final pgroll version in compose files and the
pgroll README.
@0xrusowsky 0xrusowsky requested a review from o-az May 4, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants