mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
fix: remove wrong transition check in rollup-verifier (#1226)
* fix: remove wrong transition check in rollup-verifier * auto-reset sync height * comment
This commit is contained in:
parent
1a2baf0037
commit
3d2f3793d9
2 changed files with 28 additions and 17 deletions
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor 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
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,17 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
|
finalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
|
||||||
ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight")
|
|
||||||
ErrMissingBatchEvent = errors.New("ErrMissingBatchEvent")
|
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.
|
// RollupSyncService collects ScrollChain batch commit/revert/finalize events and stores metadata into db.
|
||||||
type RollupSyncService struct {
|
type RollupSyncService struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
|
|
@ -224,10 +231,10 @@ func (s *RollupSyncService) fetchRollupEvents() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = s.updateRollupEvents(daEntries); err != nil {
|
if err = s.updateRollupEvents(daEntries); err != nil {
|
||||||
if errors.Is(err, ErrShouldResetSyncHeight) {
|
var resetSyncErr errShouldResetSyncHeight
|
||||||
log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
|
if errors.As(err, &resetSyncErr) {
|
||||||
s.callDataBlobSource.SetL1Height(7892668)
|
log.Warn("Resetting rollup sync height", "height", resetSyncErr.height)
|
||||||
|
s.callDataBlobSource.SetL1Height(resetSyncErr.height)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if errors.Is(err, ErrMissingBatchEvent) {
|
if errors.Is(err, ErrMissingBatchEvent) {
|
||||||
|
|
@ -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)
|
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.
|
// For the first batch of CodecV7, this will be the empty hash.
|
||||||
// In this case we need to compute the prevL1MessageQueueHash from the empty hash.
|
prevL1MessageQueueHash := parentCommittedBatchMeta.PostL1MessageQueueHash
|
||||||
var prevL1MessageQueueHash common.Hash
|
|
||||||
if encoding.CodecVersion(parentCommittedBatchMeta.Version) < commitedBatch.Version() {
|
|
||||||
prevL1MessageQueueHash = common.Hash{}
|
|
||||||
} else {
|
|
||||||
prevL1MessageQueueHash = parentCommittedBatchMeta.PostL1MessageQueueHash
|
|
||||||
}
|
|
||||||
|
|
||||||
chunks, err := s.getLocalChunksForBatch(chunkRanges)
|
chunks, err := s.getLocalChunksForBatch(chunkRanges)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -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.
|
// 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.
|
// The node will overwrite the wrongly computed message queue hashes.
|
||||||
if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") {
|
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)
|
return 0, nil, fmt.Errorf("failed to create DA batch, batch index: %v, codec version: %v, err: %w", batchIndex, codecVersion, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue