Skip to content

Commit 0cee9a5

Browse files
authored
refactor(rollup-relayer): simplify logic post-Euclid (#1658)
Co-authored-by: colinlyguo <[email protected]>
1 parent 97de988 commit 0cee9a5

33 files changed

+464
-1593
lines changed

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "v4.5.12"
8+
var tag = "v4.5.13"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

go.work.sum

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,8 +1357,7 @@ github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b h1:5H6V6yba
13571357
github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b/go.mod h1:48uxaqVgpD8ulH8p+nrBtfeLHZ9tX82bVVdPNkW3rPE=
13581358
github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f h1:YYbhuUwjowqI4oyXtECRofck7Fyj18e1tcRjuQlZpJE=
13591359
github.com/scroll-tech/da-codec v0.1.3-0.20250227072756-a1482833595f/go.mod h1:xECEHZLVzbdUn+tNbRJhRIjLGTOTmnFQuTgUTeVLX58=
1360-
github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493 h1:Ioc01J0WEMxuwFvEPGJeBKXdf2KY4Yc3XbFky/IxLlI=
1361-
github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
1360+
github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
13621361
github.com/scroll-tech/go-ethereum v1.10.14-0.20240607130425-e2becce6a1a4/go.mod h1:byf/mZ8jLYUCnUePTicjJWn+RvKdxDn7buS6glTnMwQ=
13631362
github.com/scroll-tech/go-ethereum v1.10.14-0.20240821074444-b3fa00861e5e/go.mod h1:swB5NSp8pKNDuYsTxfR08bHS6L56i119PBx8fxvV8Cs=
13641363
github.com/scroll-tech/go-ethereum v1.10.14-0.20241010064814-3d88e870ae22/go.mod h1:r9FwtxCtybMkTbWYCyBuevT9TW3zHmOTHqD082Uh+Oo=

rollup/abi/bridge_abi_test.go

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,6 @@ import (
1010
"github.com/stretchr/testify/assert"
1111
)
1212

13-
func TestPackCommitBatch(t *testing.T) {
14-
scrollChainABI, err := ScrollChainMetaData.GetAbi()
15-
assert.NoError(t, err)
16-
17-
version := uint8(1)
18-
var parentBatchHeader []byte
19-
var chunks [][]byte
20-
var skippedL1MessageBitmap []byte
21-
22-
_, err = scrollChainABI.Pack("commitBatch", version, parentBatchHeader, chunks, skippedL1MessageBitmap)
23-
assert.NoError(t, err)
24-
}
25-
26-
func TestPackCommitBatchWithBlobProof(t *testing.T) {
27-
scrollChainABI, err := ScrollChainMetaData.GetAbi()
28-
assert.NoError(t, err)
29-
30-
version := uint8(1)
31-
var parentBatchHeader []byte
32-
var chunks [][]byte
33-
var skippedL1MessageBitmap []byte
34-
var blobDataProof []byte
35-
36-
_, err = scrollChainABI.Pack("commitBatchWithBlobProof", version, parentBatchHeader, chunks, skippedL1MessageBitmap, blobDataProof)
37-
assert.NoError(t, err)
38-
}
39-
4013
func TestPackCommitBatches(t *testing.T) {
4114
scrollChainABI, err := ScrollChainMetaData.GetAbi()
4215
assert.NoError(t, err)
@@ -49,58 +22,6 @@ func TestPackCommitBatches(t *testing.T) {
4922
assert.NoError(t, err)
5023
}
5124

52-
func TestPackFinalizeBatchWithProof(t *testing.T) {
53-
l1RollupABI, err := ScrollChainMetaData.GetAbi()
54-
assert.NoError(t, err)
55-
56-
var batchHeader []byte
57-
var prevStateRoot common.Hash
58-
var postStateRoot common.Hash
59-
var withdrawRoot common.Hash
60-
var aggrProof []byte
61-
62-
_, err = l1RollupABI.Pack("finalizeBatchWithProof", batchHeader, prevStateRoot, postStateRoot, withdrawRoot, aggrProof)
63-
assert.NoError(t, err)
64-
}
65-
66-
func TestPackFinalizeBatchWithProof4844(t *testing.T) {
67-
l1RollupABI, err := ScrollChainMetaData.GetAbi()
68-
assert.NoError(t, err)
69-
70-
var batchHeader []byte
71-
var prevStateRoot common.Hash
72-
var postStateRoot common.Hash
73-
var withdrawRoot common.Hash
74-
var blobDataProof []byte
75-
var aggrProof []byte
76-
77-
_, err = l1RollupABI.Pack("finalizeBatchWithProof4844", batchHeader, prevStateRoot, postStateRoot, withdrawRoot, blobDataProof, aggrProof)
78-
assert.NoError(t, err)
79-
}
80-
81-
func TestPackFinalizeBundleWithProof(t *testing.T) {
82-
l1RollupABI, err := ScrollChainMetaData.GetAbi()
83-
assert.NoError(t, err)
84-
85-
var batchHeader []byte
86-
var postStateRoot common.Hash
87-
var withdrawRoot common.Hash
88-
var aggrProof []byte
89-
90-
_, err = l1RollupABI.Pack("finalizeBundleWithProof", batchHeader, postStateRoot, withdrawRoot, aggrProof)
91-
assert.NoError(t, err)
92-
}
93-
94-
func TestPackFinalizeEuclidInitialBatch(t *testing.T) {
95-
l1RollupABI, err := ScrollChainMetaData.GetAbi()
96-
assert.NoError(t, err)
97-
98-
var postStateRoot common.Hash
99-
100-
_, err = l1RollupABI.Pack("finalizeEuclidInitialBatch", postStateRoot)
101-
assert.NoError(t, err)
102-
}
103-
10425
func TestPackFinalizeBundlePostEuclidV2(t *testing.T) {
10526
l1RollupABI, err := ScrollChainMetaData.GetAbi()
10627
assert.NoError(t, err)

rollup/cmd/proposer_tool/app/app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func action(ctx *cli.Context) error {
5454
}
5555

5656
minCodecVersion := encoding.CodecVersion(ctx.Uint(utils.MinCodecVersionFlag.Name))
57+
if minCodecVersion < encoding.CodecV7 {
58+
log.Crit("min codec version must be greater than or equal to CodecV7", "minCodecVersion", minCodecVersion)
59+
}
5760

5861
// sanity check config
5962
if cfg.L2Config.BatchProposerConfig.MaxChunksPerBatch <= 0 {

rollup/cmd/rollup_relayer/app/app.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ func action(ctx *cli.Context) error {
102102
}
103103

104104
minCodecVersion := encoding.CodecVersion(ctx.Uint(utils.MinCodecVersionFlag.Name))
105+
if minCodecVersion < encoding.CodecV7 {
106+
log.Crit("min codec version must be greater than or equal to CodecV7", "minCodecVersion", minCodecVersion)
107+
}
108+
105109
chunkProposer := watcher.NewChunkProposer(subCtx, cfg.L2Config.ChunkProposerConfig, minCodecVersion, genesis.Config, db, registry)
106110
batchProposer := watcher.NewBatchProposer(subCtx, cfg.L2Config.BatchProposerConfig, minCodecVersion, genesis.Config, db, registry)
107111
bundleProposer := watcher.NewBundleProposer(subCtx, cfg.L2Config.BundleProposerConfig, minCodecVersion, genesis.Config, db, registry)

rollup/conf/config.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,13 @@
9494
"chunk_proposer_config": {
9595
"propose_interval_milliseconds": 100,
9696
"max_block_num_per_chunk": 100,
97-
"max_tx_num_per_chunk": 100,
9897
"max_l2_gas_per_chunk": 20000000,
99-
"max_l1_commit_gas_per_chunk": 11234567,
100-
"max_l1_commit_calldata_size_per_chunk": 112345,
101-
"chunk_timeout_sec": 300,
102-
"max_row_consumption_per_chunk": 1048319,
103-
"gas_cost_increase_multiplier": 1.2,
104-
"max_uncompressed_batch_bytes_size": 634880
98+
"chunk_timeout_sec": 300
10599
},
106100
"batch_proposer_config": {
107101
"propose_interval_milliseconds": 1000,
108-
"max_l1_commit_gas_per_batch": 11234567,
109-
"max_l1_commit_calldata_size_per_batch": 112345,
110102
"batch_timeout_sec": 300,
111-
"gas_cost_increase_multiplier": 1.2,
112-
"max_uncompressed_batch_bytes_size": 634880,
113-
"max_chunks_per_batch": 12
103+
"max_chunks_per_batch": 45
114104
},
115105
"bundle_proposer_config": {
116106
"max_batch_num_per_bundle": 20,

rollup/docker-compose-proposer-tool.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
command: [
2828
"--config", "/app/conf/proposer-tool-config.json",
2929
"--genesis", "/app/conf/proposer-tool-genesis.json",
30-
"--min-codec-version", "4",
30+
"--min-codec-version", "7",
3131
"--start-l2-block", "10000",
3232
"--log.debug", "--verbosity", "3"
3333
]

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.3.2
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.3-0.20250401062930-9f9f53898493
14+
github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1
1515
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601
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
@@ -249,8 +249,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
249249
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
250250
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
251251
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
252-
github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493 h1:Ioc01J0WEMxuwFvEPGJeBKXdf2KY4Yc3XbFky/IxLlI=
253-
github.com/scroll-tech/da-codec v0.1.3-0.20250401062930-9f9f53898493/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
252+
github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1 h1:6aKqJSal+QVdB5HMWMs0JTbAIZ6/iAHJx9qizz0w9dU=
253+
github.com/scroll-tech/da-codec v0.1.3-0.20250519114140-bfa7133d4ad1/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
254254
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601 h1:NEsjCG6uSvLRBlsP3+x6PL1kM+Ojs3g8UGotIPgJSz8=
255255
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601/go.mod h1:OblWe1+QrZwdpwO0j/LY3BSGuKT3YPUFBDQQgvvfStQ=
256256
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=

rollup/internal/config/l2.go

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,17 @@ type L2Config struct {
2828

2929
// ChunkProposerConfig loads chunk_proposer configuration items.
3030
type ChunkProposerConfig struct {
31-
ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"`
32-
MaxBlockNumPerChunk uint64 `json:"max_block_num_per_chunk"`
33-
MaxTxNumPerChunk uint64 `json:"max_tx_num_per_chunk"`
34-
MaxL2GasPerChunk uint64 `json:"max_l2_gas_per_chunk"`
35-
MaxL1CommitGasPerChunk uint64 `json:"max_l1_commit_gas_per_chunk"`
36-
MaxL1CommitCalldataSizePerChunk uint64 `json:"max_l1_commit_calldata_size_per_chunk"`
37-
ChunkTimeoutSec uint64 `json:"chunk_timeout_sec"`
38-
MaxRowConsumptionPerChunk uint64 `json:"max_row_consumption_per_chunk"`
39-
GasCostIncreaseMultiplier float64 `json:"gas_cost_increase_multiplier"`
40-
MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"`
31+
ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"`
32+
MaxBlockNumPerChunk uint64 `json:"max_block_num_per_chunk"`
33+
MaxL2GasPerChunk uint64 `json:"max_l2_gas_per_chunk"`
34+
ChunkTimeoutSec uint64 `json:"chunk_timeout_sec"`
4135
}
4236

4337
// BatchProposerConfig loads batch_proposer configuration items.
4438
type BatchProposerConfig struct {
45-
ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"`
46-
MaxL1CommitGasPerBatch uint64 `json:"max_l1_commit_gas_per_batch"`
47-
MaxL1CommitCalldataSizePerBatch uint64 `json:"max_l1_commit_calldata_size_per_batch"`
48-
BatchTimeoutSec uint64 `json:"batch_timeout_sec"`
49-
GasCostIncreaseMultiplier float64 `json:"gas_cost_increase_multiplier"`
50-
MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"`
51-
MaxChunksPerBatch int `json:"max_chunks_per_batch"`
39+
ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"`
40+
BatchTimeoutSec uint64 `json:"batch_timeout_sec"`
41+
MaxChunksPerBatch int `json:"max_chunks_per_batch"`
5242
}
5343

5444
// BundleProposerConfig loads bundle_proposer configuration items.

0 commit comments

Comments
 (0)