-
Notifications
You must be signed in to change notification settings - Fork 268
fix(syncer): refetch latest da height instead of da height +1 #3201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
7ca8de2
1911eb9
b1193fa
dbdd2cc
5ec8178
e5aae15
37ee626
44d8d60
9180a15
5d28492
5ca5224
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -355,7 +355,12 @@ func (s *Syncer) initializeState() error { | |
|
|
||
| // Set DA height to the maximum of the genesis start height, the state's DA height, and the cached DA height. | ||
| // The cache's DaHeight() is initialized from store metadata, so it's always correct even after cache clear. | ||
| s.daRetrieverHeight.Store(max(s.genesis.DAStartHeight, s.cache.DaHeight(), state.DAHeight)) | ||
| // Only use cache.DaHeight() when P2P is actively syncing (headerStore has higher height than current state). | ||
| daHeight := max(s.genesis.DAStartHeight, min(state.DAHeight-1, 0)) | ||
| if s.headerStore != nil && s.headerStore.Height() > state.LastBlockHeight { | ||
| daHeight = max(daHeight, s.cache.DaHeight()) | ||
| } | ||
| s.daRetrieverHeight.Store(daHeight) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: The expression daHeight := max(s.genesis.DAStartHeight, 0) // state.DAHeight is ignoredThis contradicts the PR objective of refetching 🐛 Proposed fix to correctly compute DA height - 1 with underflow protection // Set DA height to the maximum of the genesis start height, the state's DA height, and the cached DA height.
// The cache's DaHeight() is initialized from store metadata, so it's always correct even after cache clear.
// Only use cache.DaHeight() when P2P is actively syncing (headerStore has higher height than current state).
- daHeight := max(s.genesis.DAStartHeight, min(state.DAHeight-1, 0))
+ var daHeight uint64
+ if state.DAHeight > 0 {
+ daHeight = state.DAHeight - 1
+ }
+ daHeight = max(s.genesis.DAStartHeight, daHeight)
if s.headerStore != nil && s.headerStore.Height() > state.LastBlockHeight {
daHeight = max(daHeight, s.cache.DaHeight())
}
s.daRetrieverHeight.Store(daHeight)🤖 Prompt for AI Agents |
||
|
|
||
| s.logger.Info(). | ||
| Uint64("height", state.LastBlockHeight). | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense