@@ -22,38 +22,33 @@ import (
2222func testChunkProposerLimitsCodecV7 (t * testing.T ) {
2323 tests := []struct {
2424 name string
25- maxBlockNum uint64
2625 maxL2Gas uint64
2726 chunkTimeoutSec uint64
2827 expectedChunksLen int
2928 expectedBlocksInFirstChunk int // only be checked when expectedChunksLen > 0
3029 }{
3130 {
3231 name : "NoLimitReached" ,
33- maxBlockNum : 100 ,
3432 maxL2Gas : 20_000_000 ,
3533 chunkTimeoutSec : 1000000000000 ,
3634 expectedChunksLen : 0 ,
3735 },
3836 {
3937 name : "Timeout" ,
40- maxBlockNum : 100 ,
4138 maxL2Gas : 20_000_000 ,
4239 chunkTimeoutSec : 0 ,
4340 expectedChunksLen : 1 ,
4441 expectedBlocksInFirstChunk : 2 ,
4542 },
4643 {
4744 name : "MaxL2GasPerChunkIs0" ,
48- maxBlockNum : 10 ,
4945 maxL2Gas : 0 ,
5046 chunkTimeoutSec : 1000000000000 ,
5147 expectedChunksLen : 0 ,
5248 },
5349 {
54- name : "MaxBlockNumPerChunkIs1" ,
55- maxBlockNum : 1 ,
56- maxL2Gas : 20_000_000 ,
50+ name : "SingleBlockByGasLimit" ,
51+ maxL2Gas : 1_100_000 ,
5752 chunkTimeoutSec : 1000000000000 ,
5853 expectedChunksLen : 1 ,
5954 expectedBlocksInFirstChunk : 1 ,
@@ -62,7 +57,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
6257 // In this test the second block is not included in the chunk because together
6358 // with the first block it exceeds the maxL2GasPerChunk limit.
6459 name : "MaxL2GasPerChunkIsSecondBlock" ,
65- maxBlockNum : 10 ,
6660 maxL2Gas : 1_153_000 ,
6761 chunkTimeoutSec : 1000000000000 ,
6862 expectedChunksLen : 1 ,
@@ -85,7 +79,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
8579 assert .NoError (t , err )
8680
8781 cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
88- MaxBlockNumPerChunk : tt .maxBlockNum ,
8982 MaxL2GasPerChunk : tt .maxL2Gas ,
9083 ChunkTimeoutSec : tt .chunkTimeoutSec ,
9184 MaxUncompressedBatchBytesSize : math .MaxUint64 ,
@@ -110,53 +103,6 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
110103 }
111104}
112105
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-
160106func testChunkProposerUncompressedBatchBytesLimitCodecV8 (t * testing.T ) {
161107 db := setupDB (t )
162108 defer database .CloseDB (db )
@@ -204,7 +150,6 @@ func testChunkProposerUncompressedBatchBytesLimitCodecV8(t *testing.T) {
204150 // Set max_uncompressed_batch_bytes_size to 4KiB (4 * 1024)
205151 // One block (~3KiB) should fit, but two blocks (~6KiB) should exceed the limit
206152 cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
207- MaxBlockNumPerChunk : math .MaxUint64 , // No block number limit
208153 MaxL2GasPerChunk : math .MaxUint64 , // No gas limit
209154 ChunkTimeoutSec : math .MaxUint32 , // No timeout limit
210155 MaxUncompressedBatchBytesSize : 4 * 1024 , // 4KiB limit
0 commit comments