Skip to content
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
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 8 // Minor version component of the current release
VersionPatch = 73 // Patch version component of the current release
VersionPatch = 74 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
43 changes: 27 additions & 16 deletions rollup/rollup_sync_service/rollup_sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ const (
)

var (
finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight")
ErrMissingBatchEvent = errors.New("ErrMissingBatchEvent")
finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
ErrMissingBatchEvent = errors.New("ErrMissingBatchEvent")
)

type errShouldResetSyncHeight struct {
height uint64
}

func (e errShouldResetSyncHeight) Error() string {
return fmt.Sprintf("ErrShouldResetSyncHeight: height=%d", e.height)
}

// RollupSyncService collects ScrollChain batch commit/revert/finalize events and stores metadata into db.
type RollupSyncService struct {
ctx context.Context
Expand Down Expand Up @@ -224,10 +231,10 @@ func (s *RollupSyncService) fetchRollupEvents() error {
}

if err = s.updateRollupEvents(daEntries); err != nil {
if errors.Is(err, ErrShouldResetSyncHeight) {
log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
s.callDataBlobSource.SetL1Height(7892668)

var resetSyncErr errShouldResetSyncHeight
if errors.As(err, &resetSyncErr) {
log.Warn("Resetting rollup sync height", "height", resetSyncErr.height)
s.callDataBlobSource.SetL1Height(resetSyncErr.height)
return nil
}
if errors.Is(err, ErrMissingBatchEvent) {
Expand Down Expand Up @@ -482,14 +489,8 @@ func (s *RollupSyncService) getCommittedBatchMeta(commitedBatch da.EntryWithBloc
return nil, fmt.Errorf("parent committed batch meta = nil, batch index: %v, err: %w", commitedBatch.BatchIndex()-1, ErrMissingBatchEvent)
}

// If parent batch has a lower version this means this is the first batch of CodecV7.
// In this case we need to compute the prevL1MessageQueueHash from the empty hash.
var prevL1MessageQueueHash common.Hash
if encoding.CodecVersion(parentCommittedBatchMeta.Version) < commitedBatch.Version() {
prevL1MessageQueueHash = common.Hash{}
} else {
prevL1MessageQueueHash = parentCommittedBatchMeta.PostL1MessageQueueHash
}
// For the first batch of CodecV7, this will be the empty hash.
prevL1MessageQueueHash := parentCommittedBatchMeta.PostL1MessageQueueHash

chunks, err := s.getLocalChunksForBatch(chunkRanges)
if err != nil {
Expand Down Expand Up @@ -598,7 +599,17 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali
// We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed.
// The node will overwrite the wrongly computed message queue hashes.
if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") {
return 0, nil, ErrShouldResetSyncHeight
log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation issue after EuclidV2 on Scroll Sepolia")
return 0, nil, errShouldResetSyncHeight{height: 7892668}
}
// This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash hashes.
// This happened after upgrading to Feyman where rollup-verifier erroneously reset the prevMessageQueueHash to the empty hash.
// If the error message due to mismatching PostL1MessageQueueHash contains the same hash as the hardcoded one,
// this means the node ran into this issue.
// We need to reset the sync height to before committing the first Feynman batch.
if strings.Contains(err.Error(), "expected 0x19c790f49efb448b523d94e5672d9ed108656886be12c038cf39062700000000, got 0x0000000000000000000000000000000000000000000000000000000000000000") {
log.Warn("Resetting sync height to L1 block 8816625 to fix L1 message queue hash calculation issue after Feynman on Scroll Sepolia")
return 0, nil, errShouldResetSyncHeight{height: 8816625}
}
return 0, nil, fmt.Errorf("failed to create DA batch, batch index: %v, codec version: %v, err: %w", batchIndex, codecVersion, err)
}
Expand Down
Loading