@@ -19,13 +19,16 @@ import (
1919 "scroll-tech/rollup/internal/utils"
2020)
2121
22+ func newUint64 (val uint64 ) * uint64 { return & val }
23+
2224func testChunkProposerLimitsCodecV7 (t * testing.T ) {
2325 tests := []struct {
2426 name string
2527 maxL2Gas uint64
2628 chunkTimeoutSec uint64
2729 expectedChunksLen int
2830 expectedBlocksInFirstChunk int // only be checked when expectedChunksLen > 0
31+ GalileoTime * uint64
2932 }{
3033 {
3134 name : "NoLimitReached" ,
@@ -62,6 +65,14 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
6265 expectedChunksLen : 1 ,
6366 expectedBlocksInFirstChunk : 1 ,
6467 },
68+ {
69+ name : "SingleBlockByForkBoundary" ,
70+ maxL2Gas : 20_000_000 ,
71+ chunkTimeoutSec : 1000000000000 ,
72+ expectedChunksLen : 1 ,
73+ expectedBlocksInFirstChunk : 1 ,
74+ GalileoTime : newUint64 (1669364525 ), // timestamp of `block2`
75+ },
6576 }
6677
6778 for _ , tt := range tests {
@@ -78,11 +89,26 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
7889 _ , err = chunkOrm .InsertChunk (context .Background (), & encoding.Chunk {Blocks : []* encoding.Block {{Header : & gethTypes.Header {Number : big .NewInt (0 )}}}}, encoding .CodecV0 , utils.ChunkMetrics {})
7990 assert .NoError (t , err )
8091
92+ // Initialize the chunk proposer.
93+ chainConfig := & params.ChainConfig {
94+ LondonBlock : big .NewInt (0 ),
95+ BernoulliBlock : big .NewInt (0 ),
96+ CurieBlock : big .NewInt (0 ),
97+ DarwinTime : new (uint64 ),
98+ DarwinV2Time : new (uint64 ),
99+ EuclidTime : new (uint64 ),
100+ EuclidV2Time : new (uint64 ),
101+ FeynmanTime : new (uint64 ),
102+ GalileoTime : tt .GalileoTime ,
103+ }
104+
81105 cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
82106 MaxL2GasPerChunk : tt .maxL2Gas ,
83107 ChunkTimeoutSec : tt .chunkTimeoutSec ,
84108 MaxUncompressedBatchBytesSize : math .MaxUint64 ,
85- }, encoding .CodecV7 , & 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 )}, db , nil )
109+ }, encoding .CodecV7 , chainConfig , db , nil )
110+
111+ // Run one round of chunk proposing.
86112 cp .TryProposeChunk ()
87113
88114 chunks , err := chunkOrm .GetChunksGEIndex (context .Background (), 1 , 0 )
0 commit comments