Skip to content

refactored epoch registry - #4697

Merged
pompon0 merged 42 commits into
mainfrom
gprusak-cleanup
Nov 2, 2026
Merged

pompon0 merged 42 commits into
mainfrom
gprusak-cleanup

Conversation

@pompon0

@pompon0 pompon0 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
  • Replaced utils.Alloc and protobuf scalar-pointer helpers with new().
  • Reworked epoch persistence around one immutable persistedRegistry
  • Allowed genesis epochs to be pruned
  • Moved genesis timestamp metadata out of Epoch

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedNov 2, 2026, 10:09 AM

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.46377% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.31%. Comparing base (069543a) to head (c5e641d).

Files with missing lines Patch % Lines
...dermint/internal/autobahn/pb/autobahn.wireguard.go 0.00% 6 Missing ⚠️
sei-tendermint/internal/autobahn/epoch/snapshot.go 96.29% 4 Missing ⚠️
sei-tendermint/autobahn/types/epoch.go 89.28% 3 Missing ⚠️
sei-tendermint/internal/autobahn/data/state.go 87.50% 3 Missing ⚠️
sei-tendermint/internal/autobahn/avail/state.go 92.59% 2 Missing ⚠️
sei-tendermint/internal/autobahn/epoch/testonly.go 33.33% 2 Missing ⚠️
sei-tendermint/crypto/conv.go 0.00% 1 Missing ⚠️
sei-tendermint/internal/autobahn/avail/inner.go 96.15% 1 Missing ⚠️
sei-tendermint/internal/autobahn/epoch/registry.go 98.57% 1 Missing ⚠️
sei-tendermint/internal/p2p/mux/mux.go 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4697      +/-   ##
==========================================
- Coverage   60.31%   60.31%   -0.01%     
==========================================
  Files        2029     2029              
  Lines      158351   158352       +1     
==========================================
- Hits        95515    95512       -3     
- Misses      62831    62835       +4     
  Partials        5        5              
Flag Coverage Δ
sei-chain 58.37% <92.46%> (-0.01%) ⬇️
sei-db 75.17% <ø> (ø)
sei-db-state-db 81.14% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-tendermint/autobahn/types/app_proposal.go 70.37% <100.00%> (ø)
sei-tendermint/autobahn/types/block.go 90.67% <100.00%> (ø)
sei-tendermint/autobahn/types/commit_vote.go 100.00% <100.00%> (ø)
sei-tendermint/autobahn/types/committee.go 93.75% <100.00%> (+2.08%) ⬆️
sei-tendermint/autobahn/types/lane_id.go 92.59% <100.00%> (ø)
sei-tendermint/autobahn/types/prepare_vote.go 100.00% <100.00%> (ø)
sei-tendermint/autobahn/types/proposal.go 93.20% <100.00%> (ø)
sei-tendermint/autobahn/types/road_block.go 97.29% <100.00%> (ø)
sei-tendermint/autobahn/types/testonly.go 67.28% <ø> (-0.16%) ⬇️
sei-tendermint/autobahn/types/time.go 96.42% <100.00%> (ø)
... and 26 more

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

@pompon0
pompon0 marked this pull request as ready for review October 30, 2026 16:25
@cursor

cursor Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
Changes epoch persistence wire format, pruning/recovery paths, and genesis timestamp placement in consensus verification—core autobahn state that must restart and advance epochs correctly.

Overview
Epoch registry and wire format are reworked around an immutable persistedRegistry that stores full epoch records (index, committee, road range) via new protobuf fields live_v2 / pending_v2, replacing the old committee-only EpochRecord layout. Registry APIs are renamed (Epoch, Activate, etc.), road bounds come from each epoch’s RoadRange, and pruning can drop genesis epochs while nodes still recover from anchor + optional commit-QC WAL.

Consensus timing moves genesis timestamp off Epoch onto ConsensusSpec.GenesisTimestamp (ViewSpec.NextTimestamp reads it instead of Epoch.FirstTimestamp()), and NewEpoch drops the timestamp argument everywhere.

Availability startup is refactored: newInner takes anchor commit-QC + genesis timestamp, initializes lanes via advanceEpoch/pruneTo, and restoreInner is simplified to build from registry anchor state rather than a separate restorePlan. A new test covers recovery after early epochs are pruned.

Mechanical cleanup replaces utils.Alloc / proto.Int64 with Go new() across autobahn protobuf converters and assorted call sites.

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

seidroid[bot]
seidroid Bot previously requested changes Oct 30, 2026

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

This PR replaces utils.Alloc and the proto scalar-pointer helpers with new(), rebuilds the epoch registry around one immutable persistedRegistry stored as an Epoch with its road range, lets the genesis epochs be pruned, and moves the genesis timestamp into ConsensusSpec. It blocks on one issue: snapshots written by the current release can no longer be read, so any node that already has one fails to start after upgrading. That is codex's finding, which I verified and kept; codex raised nothing else.

Blocking

1 finding on the changed lines, as inline comments.

1 nit, not posted on the code
  • sei-tendermint/internal/autobahn/avail/inner.go:205 — With the frontier guard gone, logLocalBlock runs after every restored block, but it only ever checks the block at q.first. When that block does not extend the certified tip, the same line is logged once per restored block in the lane, up to BlocksPerLane times.

seidroid review · decision request_changes · session 8b0f848604aa4d298d61598b8b628daf · turn resp_claude_55537b80af335b207d0fc81449d9416c · item e0bfbcee605359719615ac11843d87ed

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

@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 be3fe31. Configure here.

@pompon0 pompon0 added the ai: skip-review Skips Seidroid AI review triggered via Unified CI. label Nov 2, 2026
@pompon0
pompon0 dismissed seidroid[bot]’s stale review November 2, 2026 10:08

giga code doesn't need backward compatibility

@pompon0 pompon0 removed the ai: skip-review Skips Seidroid AI review triggered via Unified CI. label Nov 2, 2026
@pompon0

pompon0 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@seidroid review

seidroid[bot]
seidroid Bot previously requested changes Nov 2, 2026

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

Nothing has changed since my last review: the diff is byte-identical and the head and merge commits are the same. The snapshot-compatibility blocker is still in the code even though its thread is marked resolved and the 'wai' reply gives no reason. codex raised the same point, and I kept it as one finding; codex contributed nothing else.

Blocking

1 finding on the changed lines, as inline comments.

seidroid review · decision request_changes · session 8b0f848604aa4d298d61598b8b628daf · turn resp_claude_11ce188905bf54575380d50ed3a78b48 · item 47e267b0de2c53709a27ffd043caf5b0

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

@pompon0

pompon0 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@seidroid review

@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 code has not changed since my last review (same diff, same commits); what changed is the author's explicit statement that giga persisted state carries no backward-compatibility promise yet, and the tree supports that: Autobahn only runs when an autobahn-config-file is set, REVIEW.md sets no compatibility rule for it, and the reserved fields and _v2 names show the format break is deliberate. I have downgraded the snapshot-format finding, raised by me and by codex (the only scout, with nothing else to add), from blocker to a suggestion, because the failure is loud at startup rather than silent and nothing else blocks.

Non-blocking

1 finding on the changed lines, as inline comments.

seidroid review · decision approve · session 8b0f848604aa4d298d61598b8b628daf · turn resp_claude_64b8c663dab4ce8e0105c7a83043efd2 · item 0eb44c2d18545af18d331d324e796002

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

if err != nil {
return nil, fmt.Errorf("pending: %w", err)
}
if len(live) == 0 {

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 — Breaking the format is a deliberate choice, but a node with a pre-upgrade snapshot will fail here with "persisted registry has no live epochs", which reads like corruption rather than a format change. Deleting only epochs/ does not recover either, because the blockstore and avail state still reference epochs ≥2. Consider detecting the legacy fields 1/2 and returning an explicit "incompatible epoch snapshot format; reset Autobahn persistent_state_dir" error, so giga-testnet operators know to reset the whole persistent state. (Also raised by codex.)

@seidroid
seidroid Bot dismissed their stale review November 2, 2026 10:30

Superseded: the latest review found nothing blocking in this change.

@pompon0
pompon0 added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit f83ad59 Nov 2, 2026
83 of 84 checks passed
@pompon0
pompon0 deleted the gprusak-cleanup branch November 2, 2026 10:49
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