@@ -21,6 +21,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
2121 name string
2222 maxBlockNum uint64
2323 maxTxNum uint64
24+ maxL2Gas uint64
2425 maxL1CommitGas uint64
2526 maxL1CommitCalldataSize uint64
2627 maxRowConsumption uint64
@@ -32,6 +33,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
3233 name : "NoLimitReached" ,
3334 maxBlockNum : 100 ,
3435 maxTxNum : 10000 ,
36+ maxL2Gas : 20_000_000 ,
3537 maxL1CommitGas : 50000000000 ,
3638 maxL1CommitCalldataSize : 1000000 ,
3739 maxRowConsumption : 1000000 ,
@@ -42,6 +44,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
4244 name : "Timeout" ,
4345 maxBlockNum : 100 ,
4446 maxTxNum : 10000 ,
47+ maxL2Gas : 20_000_000 ,
4548 maxL1CommitGas : 50000000000 ,
4649 maxL1CommitCalldataSize : 1000000 ,
4750 maxRowConsumption : 1000000 ,
@@ -53,6 +56,18 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
5356 name : "MaxTxNumPerChunkIs0" ,
5457 maxBlockNum : 10 ,
5558 maxTxNum : 0 ,
59+ maxL2Gas : 20_000_000 ,
60+ maxL1CommitGas : 50000000000 ,
61+ maxL1CommitCalldataSize : 1000000 ,
62+ maxRowConsumption : 1000000 ,
63+ chunkTimeoutSec : 1000000000000 ,
64+ expectedChunksLen : 0 ,
65+ },
66+ {
67+ name : "MaxL2GasPerChunkIs0" ,
68+ maxBlockNum : 10 ,
69+ maxTxNum : 10 ,
70+ maxL2Gas : 0 ,
5671 maxL1CommitGas : 50000000000 ,
5772 maxL1CommitCalldataSize : 1000000 ,
5873 maxRowConsumption : 1000000 ,
@@ -63,6 +78,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
6378 name : "MaxL1CommitGasPerChunkIs0" ,
6479 maxBlockNum : 10 ,
6580 maxTxNum : 10000 ,
81+ maxL2Gas : 20_000_000 ,
6682 maxL1CommitGas : 0 ,
6783 maxL1CommitCalldataSize : 1000000 ,
6884 maxRowConsumption : 1000000 ,
@@ -73,6 +89,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
7389 name : "MaxL1CommitCalldataSizePerChunkIs0" ,
7490 maxBlockNum : 10 ,
7591 maxTxNum : 10000 ,
92+ maxL2Gas : 20_000_000 ,
7693 maxL1CommitGas : 50000000000 ,
7794 maxL1CommitCalldataSize : 0 ,
7895 maxRowConsumption : 1000000 ,
@@ -83,6 +100,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
83100 name : "MaxRowConsumptionPerChunkIs0" ,
84101 maxBlockNum : 100 ,
85102 maxTxNum : 10000 ,
103+ maxL2Gas : 20_000_000 ,
86104 maxL1CommitGas : 50000000000 ,
87105 maxL1CommitCalldataSize : 1000000 ,
88106 maxRowConsumption : 0 ,
@@ -93,6 +111,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
93111 name : "MaxBlockNumPerChunkIs1" ,
94112 maxBlockNum : 1 ,
95113 maxTxNum : 10000 ,
114+ maxL2Gas : 20_000_000 ,
96115 maxL1CommitGas : 50000000000 ,
97116 maxL1CommitCalldataSize : 1000000 ,
98117 maxRowConsumption : 1000000 ,
@@ -104,17 +123,33 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
104123 name : "MaxTxNumPerChunkIsFirstBlock" ,
105124 maxBlockNum : 10 ,
106125 maxTxNum : 2 ,
126+ maxL2Gas : 20_000_000 ,
107127 maxL1CommitGas : 50000000000 ,
108128 maxL1CommitCalldataSize : 1000000 ,
109129 maxRowConsumption : 1000000 ,
110130 chunkTimeoutSec : 1000000000000 ,
111131 expectedChunksLen : 1 ,
112132 expectedBlocksInFirstChunk : 1 ,
113133 },
134+ {
135+ // In this test the second block is not included in the chunk because together
136+ // with the first block it exceeds the maxL2GasPerChunk limit.
137+ name : "MaxL2GasPerChunkIsSecondBlock" ,
138+ maxBlockNum : 10 ,
139+ maxTxNum : 10000 ,
140+ maxL2Gas : 1_153_000 ,
141+ maxL1CommitGas : 50000000000 ,
142+ maxL1CommitCalldataSize : 1000000 ,
143+ maxRowConsumption : 1 ,
144+ chunkTimeoutSec : 1000000000000 ,
145+ expectedChunksLen : 1 ,
146+ expectedBlocksInFirstChunk : 1 ,
147+ },
114148 {
115149 name : "MaxL1CommitGasPerChunkIsFirstBlock" ,
116150 maxBlockNum : 10 ,
117151 maxTxNum : 10000 ,
152+ maxL2Gas : 20_000_000 ,
118153 maxL1CommitGas : 62500 ,
119154 maxL1CommitCalldataSize : 1000000 ,
120155 maxRowConsumption : 1000000 ,
@@ -126,6 +161,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
126161 name : "MaxL1CommitCalldataSizePerChunkIsFirstBlock" ,
127162 maxBlockNum : 10 ,
128163 maxTxNum : 10000 ,
164+ maxL2Gas : 20_000_000 ,
129165 maxL1CommitGas : 50000000000 ,
130166 maxL1CommitCalldataSize : 60 ,
131167 maxRowConsumption : 1000000 ,
@@ -137,6 +173,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
137173 name : "MaxRowConsumptionPerChunkIs1" ,
138174 maxBlockNum : 10 ,
139175 maxTxNum : 10000 ,
176+ maxL2Gas : 20_000_000 ,
140177 maxL1CommitGas : 50000000000 ,
141178 maxL1CommitCalldataSize : 1000000 ,
142179 maxRowConsumption : 1 ,
@@ -158,6 +195,7 @@ func testChunkProposerLimitsCodecV4(t *testing.T) {
158195 cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
159196 MaxBlockNumPerChunk : tt .maxBlockNum ,
160197 MaxTxNumPerChunk : tt .maxTxNum ,
198+ MaxL2GasPerChunk : tt .maxL2Gas ,
161199 MaxL1CommitGasPerChunk : tt .maxL1CommitGas ,
162200 MaxL1CommitCalldataSizePerChunk : tt .maxL1CommitCalldataSize ,
163201 MaxRowConsumptionPerChunk : tt .maxRowConsumption ,
@@ -208,6 +246,7 @@ func testChunkProposerBlobSizeLimitCodecV4(t *testing.T) {
208246 cp := NewChunkProposer (context .Background (), & config.ChunkProposerConfig {
209247 MaxBlockNumPerChunk : 255 ,
210248 MaxTxNumPerChunk : math .MaxUint64 ,
249+ MaxL2GasPerChunk : math .MaxUint64 ,
211250 MaxL1CommitGasPerChunk : math .MaxUint64 ,
212251 MaxL1CommitCalldataSizePerChunk : math .MaxUint64 ,
213252 MaxRowConsumptionPerChunk : math .MaxUint64 ,
0 commit comments