Skip to content

Commit 79fdd37

Browse files
author
colinlyguo
committed
fix CI
1 parent 1102e04 commit 79fdd37

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

rollup/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/holiman/uint256 v1.2.4
1212
github.com/mitchellh/mapstructure v1.5.0
1313
github.com/prometheus/client_golang v1.16.0
14-
github.com/scroll-tech/da-codec v0.1.1-0.20241007144555-0079225045cc
14+
github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33
1515
github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7
1616
github.com/smartystreets/goconvey v1.8.0
1717
github.com/spf13/viper v1.19.0

rollup/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
250250
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
251251
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
252252
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
253-
github.com/scroll-tech/da-codec v0.1.1-0.20241007144555-0079225045cc h1:jBGGDSmpb1oxuWe4URwDN7cmHdEN5mvHFPijGudFCQs=
254-
github.com/scroll-tech/da-codec v0.1.1-0.20241007144555-0079225045cc/go.mod h1:6jxEQvNc7GQKMSUi25PthAUY3WnZL8CN0yWivBgAXi0=
253+
github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33 h1:e7ZFclDH2hX9JE/+5I5MpXrVe4mB5a3EpDUtc2QI+I0=
254+
github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33/go.mod h1:6jxEQvNc7GQKMSUi25PthAUY3WnZL8CN0yWivBgAXi0=
255255
github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7 h1:uj6kHOscSmho2oQsIFdTL5yWN/84mdd+LTQkdfBSH/s=
256256
github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7/go.mod h1:DWGorBlnlr6aLwN9IX4LLuHcgbMeYUUEvLjn186CNAY=
257257
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=

rollup/internal/controller/relayer/l2_relayer.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
393393
codecVersion := encoding.CodecVersion(dbBatch.CodecVersion)
394394
switch codecVersion {
395395
case encoding.CodecV0, encoding.CodecV1, encoding.CodecV2:
396-
calldata, err = r.constructCommitBatchPayloadCodecV0AndV1AndV2(dbBatch, dbParentBatch, dbChunks, chunks)
396+
calldata, blob, err = r.constructCommitBatchPayloadCodecV0AndV1AndV2(dbBatch, dbParentBatch, dbChunks, chunks)
397397
if err != nil {
398398
log.Error("failed to construct commitBatch payload for V0/V1/V2", "codecVersion", codecVersion, "index", dbBatch.Index, "err", err)
399399
return
@@ -638,7 +638,7 @@ func (r *Layer2Relayer) finalizeBatch(dbBatch *orm.Batch, withProof bool) error
638638
return fmt.Errorf("failed to construct finalizeBatch payload codecv1, index: %v, err: %w", dbBatch.Index, err)
639639
}
640640
} else { // >= codecv3
641-
log.Info("encoding is codecv3, using finalizeBundle instead", "index", dbBatch.Index)
641+
log.Debug("encoding is codecv3, using finalizeBundle instead", "index", dbBatch.Index)
642642
return nil
643643
}
644644

@@ -932,35 +932,42 @@ func (r *Layer2Relayer) handleL2RollupRelayerConfirmLoop(ctx context.Context) {
932932
}
933933
}
934934

935-
func (r *Layer2Relayer) constructCommitBatchPayloadCodecV0AndV1AndV2(dbBatch *orm.Batch, dbParentBatch *orm.Batch, dbChunks []*orm.Chunk, chunks []*encoding.Chunk) ([]byte, error) {
935+
func (r *Layer2Relayer) constructCommitBatchPayloadCodecV0AndV1AndV2(dbBatch *orm.Batch, dbParentBatch *orm.Batch, dbChunks []*orm.Chunk, chunks []*encoding.Chunk) ([]byte, *kzg4844.Blob, error) {
936936
codec, err := encoding.CodecFromVersion(encoding.CodecVersion(dbBatch.CodecVersion))
937937
if err != nil {
938-
return nil, fmt.Errorf("failed to get codec from version: %w", err)
938+
return nil, nil, fmt.Errorf("failed to get codec from version: %w", err)
939939
}
940940

941-
daBatch, err := codec.NewDABatchFromBytes(dbBatch.BatchHeader)
942-
if err != nil {
943-
return nil, fmt.Errorf("failed to create DA batch from bytes: %w", err)
941+
batch := &encoding.Batch{
942+
Index: dbBatch.Index,
943+
TotalL1MessagePoppedBefore: dbChunks[0].TotalL1MessagesPoppedBefore,
944+
ParentBatchHash: common.HexToHash(dbParentBatch.Hash),
945+
Chunks: chunks,
946+
}
947+
948+
daBatch, createErr := codec.NewDABatch(batch)
949+
if createErr != nil {
950+
return nil, nil, fmt.Errorf("failed to create DA batch: %w", createErr)
944951
}
945952

946953
encodedChunks := make([][]byte, len(dbChunks))
947954
for i, c := range dbChunks {
948955
daChunk, createErr := codec.NewDAChunk(chunks[i], c.TotalL1MessagesPoppedBefore)
949956
if createErr != nil {
950-
return nil, fmt.Errorf("failed to create DA chunk: %w", createErr)
957+
return nil, nil, fmt.Errorf("failed to create DA chunk: %w", createErr)
951958
}
952959
daChunkBytes, encodeErr := daChunk.Encode()
953960
if encodeErr != nil {
954-
return nil, fmt.Errorf("failed to encode DA chunk: %w", encodeErr)
961+
return nil, nil, fmt.Errorf("failed to encode DA chunk: %w", encodeErr)
955962
}
956963
encodedChunks[i] = daChunkBytes
957964
}
958965

959966
calldata, packErr := r.l1RollupABI.Pack("commitBatch", daBatch.Version(), dbParentBatch.BatchHeader, encodedChunks, daBatch.SkippedL1MessageBitmap())
960967
if packErr != nil {
961-
return nil, fmt.Errorf("failed to pack commitBatch: %w", packErr)
968+
return nil, nil, fmt.Errorf("failed to pack commitBatch: %w", packErr)
962969
}
963-
return calldata, nil
970+
return calldata, daBatch.Blob(), nil
964971
}
965972

966973
func (r *Layer2Relayer) constructCommitBatchPayloadCodecV3AndV4(dbBatch *orm.Batch, dbParentBatch *orm.Batch, dbChunks []*orm.Chunk, chunks []*encoding.Chunk) ([]byte, *kzg4844.Blob, error) {

rollup/tests/rollup_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func testCommitAndFinalizeGenesisBatch(t *testing.T) {
5353
}
5454

5555
func testCommitBatchAndFinalizeBatchOrBundleWithAllCodecVersions(t *testing.T) {
56-
codecVersions := []encoding.CodecVersion{encoding.CodecV0, encoding.CodecV1, encoding.CodecV2, encoding.CodecV3}
56+
codecVersions := []encoding.CodecVersion{encoding.CodecV0, encoding.CodecV1, encoding.CodecV2, encoding.CodecV3, encoding.CodecV4}
5757
for _, codecVersion := range codecVersions {
5858
db := setupDB(t)
5959

@@ -66,6 +66,8 @@ func testCommitBatchAndFinalizeBatchOrBundleWithAllCodecVersions(t *testing.T) {
6666
chainConfig = &params.ChainConfig{BernoulliBlock: big.NewInt(0)}
6767
} else if codecVersion == encoding.CodecV2 {
6868
chainConfig = &params.ChainConfig{BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0)}
69+
} else if codecVersion == encoding.CodecV3 {
70+
chainConfig = &params.ChainConfig{BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64)}
6971
} else {
7072
chainConfig = &params.ChainConfig{BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64)}
7173
}

0 commit comments

Comments
 (0)