Skip to content

Commit 9334ed5

Browse files
committed
add test
1 parent e24a899 commit 9334ed5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

rollup/internal/controller/watcher/chunk_proposer_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ import (
1919
"scroll-tech/rollup/internal/utils"
2020
)
2121

22+
func newUint64(val uint64) *uint64 { return &val }
23+
2224
func 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 {
@@ -82,7 +93,7 @@ func testChunkProposerLimitsCodecV7(t *testing.T) {
8293
MaxL2GasPerChunk: tt.maxL2Gas,
8394
ChunkTimeoutSec: tt.chunkTimeoutSec,
8495
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)
96+
}, 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), FeynmanTime: new(uint64), GalileoTime: tt.GalileoTime}, db, nil)
8697
cp.TryProposeChunk()
8798

8899
chunks, err := chunkOrm.GetChunksGEIndex(context.Background(), 1, 0)

0 commit comments

Comments
 (0)