Skip to content

Commit 3f26ed1

Browse files
authored
Merge branch 'develop' into fix-ga-do-not-persist-git-credentials
2 parents 616e12f + 080afd4 commit 3f26ed1

File tree

7 files changed

+67
-6
lines changed

7 files changed

+67
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require (
5151
github.com/prometheus/tsdb v0.7.1
5252
github.com/rjeczalik/notify v0.9.1
5353
github.com/rs/cors v1.7.0
54-
github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54
54+
github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1
5555
github.com/scroll-tech/zktrie v0.8.4
5656
github.com/shirou/gopsutil v3.21.11+incompatible
5757
github.com/sourcegraph/conc v0.3.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
396396
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
397397
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
398398
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
399-
github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54 h1:qVpsVu1J91opTn6HYeuzWcBRVhQmPR8g05i+PlOjlI4=
400-
github.com/scroll-tech/da-codec v0.1.3-0.20250226072559-f8a8d3898f54/go.mod h1:xECEHZLVzbdUn+tNbRJhRIjLGTOTmnFQuTgUTeVLX58=
399+
github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1 h1:Dhd58LE1D+dnoxpgLVeQBMF9uweL/fhQfZHWtWSiOlE=
400+
github.com/scroll-tech/da-codec v0.1.3-0.20250313120912-344f2d5e33e1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
401401
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
402402
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
403403
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 23 // Patch version component of the current release
27+
VersionPatch = 25 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

rollup/l1/abi.go

Lines changed: 18 additions & 1 deletion
Large diffs are not rendered by default.

rollup/l1/abi_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func TestMethodSignatures(t *testing.T) {
2222
assert.Equal(t, crypto.Keccak256Hash([]byte("commitBatch(uint8,bytes,bytes[],bytes)")).Bytes()[:4], ScrollChainABI.Methods[commitBatchMethodName].ID)
2323
assert.Equal(t, crypto.Keccak256Hash([]byte("commitBatchWithBlobProof(uint8,bytes,bytes[],bytes,bytes)")).Bytes()[:4], ScrollChainABI.Methods[commitBatchWithBlobProofMethodName].ID)
2424
assert.Equal(t, crypto.Keccak256Hash([]byte("commitBatches(uint8,bytes32,bytes32)")).Bytes()[:4], ScrollChainABI.Methods[commitBatchesV7MethodName].ID)
25+
assert.Equal(t, crypto.Keccak256Hash([]byte("commitAndFinalizeBatch(uint8,bytes32,(bytes,uint256,bytes32,bytes32,bytes))")).Bytes()[:4], ScrollChainABI.Methods[commitAndFinalizeBatch].ID)
2526
assert.Equal(t, crypto.Keccak256Hash([]byte("finalizeBundlePostEuclidV2(bytes,uint256,bytes32,bytes32,bytes)")).Bytes()[:4], ScrollChainABI.Methods[finalizeBundlePostEuclidV2MethodName].ID)
2627
}
2728

rollup/l1/reader.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"fmt"
77
"math/big"
88

9+
"github.com/scroll-tech/da-codec/encoding"
10+
911
"github.com/scroll-tech/go-ethereum"
1012
"github.com/scroll-tech/go-ethereum/accounts/abi"
1113
"github.com/scroll-tech/go-ethereum/common"
@@ -97,7 +99,7 @@ func (r *Reader) FinalizedL1MessageQueueIndex(blockNumber uint64) (uint64, error
9799
return next - 1, nil
98100
}
99101

100-
func (r *Reader) LatestFinalizedBatch(blockNumber uint64) (uint64, error) {
102+
func (r *Reader) LatestFinalizedBatchIndex(blockNumber uint64) (uint64, error) {
101103
data, err := r.scrollChainABI.Pack(lastFinalizedBatchIndex)
102104
if err != nil {
103105
return 0, fmt.Errorf("failed to pack %s: %w", lastFinalizedBatchIndex, err)
@@ -398,6 +400,28 @@ func (r *Reader) FetchCommitTxData(commitEvent *CommitBatchEvent) (*CommitBatchA
398400
if err != nil {
399401
return nil, fmt.Errorf("failed to decode calldata into commitBatch args %s, values: %+v, err: %w", commitBatchesV7MethodName, values, err)
400402
}
403+
} else if method.Name == commitAndFinalizeBatch {
404+
commitAndFinalizeArgs, err := newCommitAndFinalizeBatchArgs(method, values)
405+
if err != nil {
406+
return nil, fmt.Errorf("failed to decode calldata into commitAndFinalizeBatch args %s, values: %+v, err: %w", commitAndFinalizeBatch, values, err)
407+
}
408+
409+
// in commitAndFinalizeBatch, the last batch hash is encoded in the finalize struct as this is the only batch we're
410+
// committing when calling this function.
411+
codec, err := encoding.CodecFromVersion(encoding.CodecVersion(commitAndFinalizeArgs.Version))
412+
if err != nil {
413+
return nil, fmt.Errorf("failed to get codec from version %d, err: %w", commitAndFinalizeArgs.Version, err)
414+
}
415+
daBatch, err := codec.NewDABatchFromBytes(commitAndFinalizeArgs.FinalizeStruct.BatchHeader)
416+
if err != nil {
417+
return nil, fmt.Errorf("failed to decode daBatch from bytes, err: %w", err)
418+
}
419+
420+
args = &CommitBatchArgs{
421+
Version: commitAndFinalizeArgs.Version,
422+
ParentBatchHash: commitAndFinalizeArgs.ParentBatchHash,
423+
LastBatchHash: daBatch.Hash(),
424+
}
401425
} else {
402426
return nil, fmt.Errorf("unknown method name for commit transaction: %s", method.Name)
403427
}

rollup/rollup_sync_service/rollup_sync_service.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"os"
9+
"strings"
910
"sync"
1011
"time"
1112

@@ -42,6 +43,8 @@ const (
4243
defaultLogInterval = 5 * time.Minute
4344
)
4445

46+
var ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight")
47+
4548
// RollupSyncService collects ScrollChain batch commit/revert/finalize events and stores metadata into db.
4649
type RollupSyncService struct {
4750
ctx context.Context
@@ -205,6 +208,12 @@ func (s *RollupSyncService) fetchRollupEvents() error {
205208
}
206209

207210
if err = s.updateRollupEvents(daEntries); err != nil {
211+
if errors.Is(err, ErrShouldResetSyncHeight) {
212+
log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
213+
s.callDataBlobSource.SetL1Height(7892668)
214+
215+
return nil
216+
}
208217
// Reset the L1 height to the previous value to retry fetching the same data.
209218
s.callDataBlobSource.SetL1Height(prevL1Height)
210219
return fmt.Errorf("failed to parse and update rollup event logs: %w", err)
@@ -535,6 +544,16 @@ func validateBatch(batchIndex uint64, event *l1.FinalizeBatchEvent, parentFinali
535544

536545
daBatch, err := codec.NewDABatch(batch)
537546
if err != nil {
547+
// This is hotfix for the L1 message hash mismatch issue which lead to wrong committedBatchMeta.PostL1MessageQueueHash hashes.
548+
// These in turn lead to a wrongly computed batch hash locally. This happened after upgrading to EuclidV2
549+
// where da-codec was not updated to the latest version in l2geth.
550+
// If the error message due to mismatching PostL1MessageQueueHash contains the same hash as the hardcoded one,
551+
// this means the node ran into this issue.
552+
// We need to reset the sync height to 1 block before the L1 block in which the last batch in CodecV6 was committed.
553+
// The node will overwrite the wrongly computed message queue hashes.
554+
if strings.Contains(err.Error(), "0xaa16faf2a1685fe1d7e0f2810b1a0e98c2841aef96596d10456a6d0f00000000") {
555+
return 0, nil, ErrShouldResetSyncHeight
556+
}
538557
return 0, nil, fmt.Errorf("failed to create DA batch, batch index: %v, codec version: %v, err: %w", batchIndex, codecVersion, err)
539558
}
540559
localBatchHash := daBatch.Hash()

0 commit comments

Comments
 (0)