From 5bb112190cf62bb99be4e25fdca39f802038c81f Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Tue, 24 Dec 2024 22:50:17 +0100 Subject: [PATCH] fix(fork): get next revision start height from sl in validation (#1298) (cherry picked from commit 7be9ddbb2b101ecc8087240faf9d8fc964e519c3) --- block/fork.go | 4 +--- block/slvalidator.go | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/fork.go b/block/fork.go index 8867a6319..8fe76259a 100644 --- a/block/fork.go +++ b/block/fork.go @@ -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 @@ -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 diff --git a/block/slvalidator.go b/block/slvalidator.go index bf9b8ac0a..758a7f510 100644 --- a/block/slvalidator.go +++ b/block/slvalidator.go @@ -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 }