Skip to content

rpc(autobahn): return the committee that certified /validators height (CON-358) - #4083

Open
wen-coding wants to merge 2 commits into
mainfrom
wen/autobahn_validators
Open

rpc(autobahn): return the committee that certified /validators height (CON-358)#4083
wen-coding wants to merge 2 commits into
mainfrom
wen/autobahn_validators

Conversation

@wen-coding

Copy link
Copy Markdown
Contributor

Summary

  • Autobahn /validators currently returns the genesis GenDoc set at every height. After epoch 0 that is the wrong committee.
  • Height is a global block number (same as /block). The covering CommitQC supplies the road; the epoch registry supplies the committee. Before the first QC, omitted/first height resolve to genesis.
  • Pruned heights return ErrHeightNotAvailable; uncertified heights return ErrHeightExceedsChainHead.

Test plan

  • go test ./internal/p2p/ ./internal/autobahn/data/ ./internal/rpc/core/ in sei-tendermint
  • Autobahn integration /validators?height=h and omitted-height /validators (asserted in assertTmRPCEndpoints)

Made with Cursor

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 2, 2026, 9:17 PM

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.31373% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.26%. Comparing base (7273a43) to head (38af828).

Files with missing lines Patch % Lines
sei-tendermint/internal/p2p/giga_router_common.go 87.50% 3 Missing and 1 partial ⚠️
sei-tendermint/internal/rpc/core/consensus.go 60.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4083      +/-   ##
==========================================
- Coverage   61.30%   60.26%   -1.05%     
==========================================
  Files        2178     2070     -108     
  Lines      190788   178331   -12457     
==========================================
- Hits       116968   107474    -9494     
+ Misses      62796    60872    -1924     
+ Partials    11024     9985    -1039     
Flag Coverage Δ
sei-chain-pr 72.33% <84.31%> (?)
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/autobahn/types/msg.go 89.51% <100.00%> (+0.04%) ⬆️
sei-tendermint/internal/autobahn/data/state.go 77.49% <100.00%> (+0.71%) ⬆️
sei-tendermint/internal/autobahn/epoch/registry.go 82.87% <ø> (ø)
sei-tendermint/internal/p2p/giga_router.go 100.00% <ø> (ø)
sei-tendermint/internal/p2p/giga_router_common.go 61.25% <87.50%> (+2.91%) ⬆️
sei-tendermint/internal/rpc/core/consensus.go 59.37% <60.00%> (+20.42%) ⬆️

... and 109 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.

@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.

Replacing the genesis-set stub in Autobahn's /validators with a CommitQC → epoch-registry lookup is correct: the QC covering the global height picks the certifying committee, the pre-first-QC fallback to nextCommitEpoch is sound, and the router-level test covers the resolved height, omitted height, uncertified height, power ordering and pruned-epoch cases. No blocking issues; the notes below concern the availability window the epoch registry imposes and a duplicated error mapping.

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

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] Voting powers reported by /validators now change shape at the epoch-2 boundary: epochs 0/1 use the genesis committee built in BuildDataState, which assigns weight 1 per entry in ValidatorAddrs, while epochs ≥2 use committeeWeights(app.GetValidators()) (real stake). Previously the endpoint always echoed GenDoc powers. This is faithful to the committee that actually certified each block, but it is an externally visible response change the PR description doesn't mention — worth calling out for downstream consumers that compute stake fractions.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.

Comment thread sei-tendermint/internal/p2p/giga_router_common.go Outdated
}

// heightLookupError returns the RPC error for a data lookup at global height n.
func heightLookupError(n atypes.GlobalBlockNumber, err error) error {

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] BlockByNumber (line ~126) still maps atypes.ErrPrunedWrapErrHeightNotAvailable inline; its comment even claims "both call sites format through the same helper". Now that heightLookupError exists, routing BlockByNumber through it keeps the /block and /validators error shapes from drifting apart. The only wrinkle is the default arm: BlockByNumber wraps with data.GlobalBlock(%v): %w context while this helper returns the raw error — worth preserving that wrap at the call site if you consolidate.

@wen-coding
wen-coding force-pushed the wen/autobahn_validators branch 3 times, most recently from 47d5ae1 to 2cd026a Compare September 2, 2026 20:49
/validators still served the genesis validator list. Height is a global
block number; the set comes from the covering CommitQC's epoch.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wen-coding
wen-coding force-pushed the wen/autobahn_validators branch from 2cd026a to 833db38 Compare September 2, 2026 21:14
@wen-coding wen-coding changed the title rpc(autobahn): return the committee that certified /validators height rpc(autobahn): return the committee that certified /validators height (CON-358) Sep 2, 2026
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.

2 participants