Skip to content

Commit

Permalink
fix(fork): get next revision start height from sl in validation (#1298)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7be9ddb)
  • Loading branch information
srene authored and omritoptix committed Dec 25, 2024
1 parent 1dfee6a commit 5bb1121
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit 5bb1121

Please sign in to comment.