Skip to content
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

fix(fork): get next revision start height from sl in validation #1298

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions block/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (m *Manager) checkForkUpdate(msg string) error {
if err != nil {
return err
}
m.freezeNode(fmt.Errorf("%s local_block_height: %d rollapp_revision_start_height: %d local_revision: %d rollapp_revision: %d", msg, m.State.Height(), expectedRevision.StartHeight, actualRevision, expectedRevision.Number))
m.freezeNode(fmt.Errorf("%s local_block_height: %d rollapp_revision_start_height: %d local_revision: %d rollapp_revision: %d", msg, m.State.Height(), expectedRevision.StartHeight, actualRevision, expectedRevision.Number))
}

return nil
Expand Down Expand Up @@ -246,8 +246,6 @@ func (m *Manager) updateStateForNextRevision() error {
if nextRevision.StartHeight == m.State.NextHeight() {
// Set proposer to nil to force updating it from SL
m.State.SetProposer(nil)
// Upgrade revision on state
m.State.RevisionStartHeight = nextRevision.StartHeight
m.State.SetRevision(nextRevision.Number)

// update stored state
Expand Down
7 changes: 6 additions & 1 deletion block/slvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,13 @@ func (v *SettlementValidator) ValidateDaBlocks(slBatch *settlement.ResultRetriev
// last block of the batch
lastDABlock := daBlocks[numSlBDs-1]

// we get revision for the next state update
revision, err := v.blockManager.getRevisionFromSL(lastDABlock.Header.Height + 1)
if err != nil {
return err
}
// if lastDaBlock is previous block to fork, dont validate nextsequencerhash of last block because it will not match
if v.blockManager.State.RevisionStartHeight-1 == lastDABlock.Header.Height {
if revision.StartHeight-1 == lastDABlock.Header.Height {
v.logger.Debug("DA blocks, previous to fork, validated successfully", "start height", daBlocks[0].Header.Height, "end height", daBlocks[len(daBlocks)-1].Header.Height)
return nil
}
Expand Down
Loading