Skip to content

Commit 79902c4

Browse files
author
colinlyguo
committed
simplify rollup-relayer
1 parent d26381c commit 79902c4

30 files changed

+465
-1504
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.7"
8+
var tag = "v4.5.8"
99

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

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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,13 @@
9595
"max_block_num_per_chunk": 100,
9696
"max_tx_num_per_chunk": 100,
9797
"max_l2_gas_per_chunk": 20000000,
98-
"max_l1_commit_gas_per_chunk": 11234567,
99-
"max_l1_commit_calldata_size_per_chunk": 112345,
10098
"chunk_timeout_sec": 300,
101-
"max_row_consumption_per_chunk": 1048319,
10299
"gas_cost_increase_multiplier": 1.2,
103100
"max_uncompressed_batch_bytes_size": 634880
104101
},
105102
"batch_proposer_config": {
106103
"propose_interval_milliseconds": 1000,
107104
"max_l1_commit_gas_per_batch": 11234567,
108-
"max_l1_commit_calldata_size_per_batch": 112345,
109105
"batch_timeout_sec": 300,
110106
"gas_cost_increase_multiplier": 1.2,
111107
"max_uncompressed_batch_bytes_size": 634880,

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/internal/config/l2.go

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,20 @@ 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+
MaxTxNumPerChunk uint64 `json:"max_tx_num_per_chunk"`
34+
MaxL2GasPerChunk uint64 `json:"max_l2_gas_per_chunk"`
35+
ChunkTimeoutSec uint64 `json:"chunk_timeout_sec"`
36+
MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"`
4137
}
4238

4339
// BatchProposerConfig loads batch_proposer configuration items.
4440
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"`
41+
ProposeIntervalMilliseconds uint64 `json:"propose_interval_milliseconds"`
42+
BatchTimeoutSec uint64 `json:"batch_timeout_sec"`
43+
MaxUncompressedBatchBytesSize uint64 `json:"max_uncompressed_batch_bytes_size"`
44+
MaxChunksPerBatch int `json:"max_chunks_per_batch"`
5245
}
5346

5447
// BundleProposerConfig loads bundle_proposer configuration items.

rollup/internal/config/relayer.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ type RelayerConfig struct {
7373

7474
// Indicates if bypass features specific to testing environments are enabled.
7575
EnableTestEnvBypassFeatures bool `json:"enable_test_env_bypass_features"`
76-
// Sets rollup-relayer to stop fake finalizing at the fork boundary
77-
TestEnvBypassOnlyUntilForkBoundary bool `json:"test_env_bypass_only_until_fork_boundary"`
7876
// The timeout in seconds for finalizing a batch without proof, only used when EnableTestEnvBypassFeatures is true.
7977
FinalizeBatchWithoutProofTimeoutSec uint64 `json:"finalize_batch_without_proof_timeout_sec"`
8078
// The timeout in seconds for finalizing a bundle without proof, only used when EnableTestEnvBypassFeatures is true.

rollup/internal/controller/relayer/common.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
package relayer
22

3-
import "errors"
4-
53
const (
64
gasPriceDiffPrecision = 1000000
75

86
defaultGasPriceDiff = 50000 // 5%
97
)
108

11-
var (
12-
// ErrExecutionRevertedMessageExpired error of Message expired
13-
ErrExecutionRevertedMessageExpired = errors.New("execution reverted: Message expired")
14-
// ErrExecutionRevertedAlreadySuccessExecuted error of Message was already successfully executed
15-
ErrExecutionRevertedAlreadySuccessExecuted = errors.New("execution reverted: Message was already successfully executed")
16-
)
17-
189
// ServiceType defines the various types of services within the relayer.
1910
type ServiceType int
2011

0 commit comments

Comments
 (0)