@@ -22,38 +22,33 @@ import (
22
22
func testChunkProposerLimitsCodecV7 (t * testing.T ) {
23
23
tests := []struct {
24
24
name string
25
- maxBlockNum uint64
26
25
maxL2Gas uint64
27
26
chunkTimeoutSec uint64
28
27
expectedChunksLen int
29
28
expectedBlocksInFirstChunk int // only be checked when expectedChunksLen > 0
30
29
}{
31
30
{
32
31
name : "NoLimitReached" ,
33
- maxBlockNum : 100 ,
34
32
maxL2Gas : 20_000_000 ,
35
33
chunkTimeoutSec : 1000000000000 ,
36
34
expectedChunksLen : 0 ,
37
35
},
38
36
{
39
37
name : "Timeout" ,
40
- maxBlockNum : 100 ,
41
38
maxL2Gas : 20_000_000 ,
42
39
chunkTimeoutSec : 0 ,
43
40
expectedChunksLen : 1 ,
44
41
expectedBlocksInFirstChunk : 2 ,
45
42
},
46
43
{
47
44
name : "MaxL2GasPerChunkIs0" ,
48
- maxBlockNum : 10 ,
49
45
maxL2Gas : 0 ,
50
46
chunkTimeoutSec : 1000000000000 ,
51
47
expectedChunksLen : 0 ,
52
48
},
53
49
{
54
- name : "MaxBlockNumPerChunkIs1" ,
55
- maxBlockNum : 1 ,
56
- maxL2Gas : 20_000_000 ,
50
+ name : "SingleBlockByGasLimit" ,
51
+ maxL2Gas : 1_100_000 ,
57
52
chunkTimeoutSec : 1000000000000 ,
58
53
expectedChunksLen : 1 ,
59
54
expectedBlocksInFirstChunk : 1 ,
@@ -62,7 +57,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
62
57
// In this test the second block is not included in the chunk because together
63
58
// with the first block it exceeds the maxL2GasPerChunk limit.
64
59
name : "MaxL2GasPerChunkIsSecondBlock" ,
65
- maxBlockNum : 10 ,
66
60
maxL2Gas : 1_153_000 ,
67
61
chunkTimeoutSec : 1000000000000 ,
68
62
expectedChunksLen : 1 ,
@@ -85,7 +79,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
85
79
assert .NoError (t , err )
86
80
87
81
cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
88
- MaxBlockNumPerChunk : tt .maxBlockNum ,
89
82
MaxL2GasPerChunk : tt .maxL2Gas ,
90
83
ChunkTimeoutSec : tt .chunkTimeoutSec ,
91
84
MaxUncompressedBatchBytesSize : math .MaxUint64 ,
@@ -110,53 +103,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
110
103
}
111
104
}
112
105
113
- func testChunkProposerBlobSizeLimitCodecV7 (t * testing.T ) {
114
- db := setupDB (t )
115
- defer database .CloseDB (db )
116
- block := readBlockFromJSON (t , "../../../testdata/blockTrace_03.json" )
117
- for i := uint64 (0 ); i < 510 ; i ++ {
118
- l2BlockOrm := orm .NewL2Block (db )
119
- block .Header .Number = new (big.Int ).SetUint64 (i + 1 )
120
- block .Header .Time = i + 1
121
- err := l2BlockOrm .InsertL2Blocks (context .Background (), []* encoding.Block {block })
122
- assert .NoError (t , err )
123
- }
124
-
125
- // Add genesis chunk.
126
- chunkOrm := orm .NewChunk (db )
127
- _ , err := chunkOrm .InsertChunk (context .Background (), & encoding.Chunk {Blocks : []* encoding.Block {{Header : & gethTypes.Header {Number : big .NewInt (0 )}}}}, encoding .CodecV0 , utils.ChunkMetrics {})
128
- assert .NoError (t , err )
129
-
130
- chainConfig := & params.ChainConfig {LondonBlock : big .NewInt (0 ), BernoulliBlock : big .NewInt (0 ), CurieBlock : big .NewInt (0 ), DarwinTime : new (uint64 ), DarwinV2Time : new (uint64 ), EuclidTime : new (uint64 ), EuclidV2Time : new (uint64 )}
131
-
132
- cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
133
- MaxBlockNumPerChunk : 255 ,
134
- MaxL2GasPerChunk : math .MaxUint64 ,
135
- ChunkTimeoutSec : math .MaxUint32 ,
136
- MaxUncompressedBatchBytesSize : math .MaxUint64 ,
137
- }, encoding .CodecV7 , chainConfig , db , nil )
138
-
139
- for i := 0 ; i < 2 ; i ++ {
140
- cp .TryProposeChunk ()
141
- }
142
-
143
- chunkOrm = orm .NewChunk (db )
144
- chunks , err := chunkOrm .GetChunksGEIndex (context .Background (), 1 , 0 )
145
- assert .NoError (t , err )
146
-
147
- var expectedNumChunks int = 2
148
- var numBlocksMultiplier uint64 = 255
149
- assert .Len (t , chunks , expectedNumChunks )
150
-
151
- for i , chunk := range chunks {
152
- expected := numBlocksMultiplier * (uint64 (i ) + 1 )
153
- if expected > 2000 {
154
- expected = 2000
155
- }
156
- assert .Equal (t , expected , chunk .EndBlockNumber )
157
- }
158
- }
159
-
160
106
func testChunkProposerUncompressedBatchBytesLimitCodecV8 (t * testing.T ) {
161
107
db := setupDB (t )
162
108
defer database .CloseDB (db )
@@ -204,7 +150,6 @@ func testChunkProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) {
204
150
// Set max_uncompressed_batch_bytes_size to 4KiB (4 * 1024)
205
151
// One block (~3KiB) should fit, but two blocks (~6KiB) should exceed the limit
206
152
cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
207
- MaxBlockNumPerChunk : math .MaxUint64 , // No block number limit
208
153
MaxL2GasPerChunk : math .MaxUint64 , // No gas limit
209
154
ChunkTimeoutSec : math .MaxUint32 , // No timeout limit
210
155
MaxUncompressedBatchBytesSize : 4 * 1024 , // 4KiB limit
0 commit comments