fix(rollup-relayer): address underestimation of commitBatch gas in low-tx batches (#980)

Co-authored-by: colinlyguo <colinlyguo@users.noreply.github.com>
This commit is contained in:
colin
2023-10-07 21:35:53 +08:00
committed by GitHub
parent 7c742da488
commit caa16e1676
3 changed files with 4 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.3.29"
var tag = "v4.3.30"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -177,6 +177,7 @@ func (p *BatchProposer) proposeBatchChunks() ([]*orm.Chunk, *types.BatchMeta, er
}
// Add extra gas costs
totalL1CommitGas += 100000 // constant to account for ops like _getAdmin, _implementation, _requireNotPaused, etc
totalL1CommitGas += 4 * 2100 // 4 one-time cold sload for commitBatch
totalL1CommitGas += 20000 // 1 time sstore
totalL1CommitGas += 21000 // base fee for tx

View File

@@ -68,7 +68,7 @@ func testBatchProposerLimits(t *testing.T) {
{
name: "MaxL1CommitGasPerBatchIsFirstChunk",
maxChunkNum: 10,
maxL1CommitGas: 100000,
maxL1CommitGas: 200000,
maxL1CommitCalldataSize: 1000000,
batchTimeoutSec: 1000000000000,
expectedBatchesLen: 1,
@@ -199,6 +199,6 @@ func testBatchCommitGasAndCalldataSizeEstimation(t *testing.T) {
assert.Equal(t, types.ProvingTaskUnassigned, types.ProvingStatus(chunk.ProvingStatus))
}
assert.Equal(t, uint64(153916), batches[0].TotalL1CommitGas)
assert.Equal(t, uint64(253916), batches[0].TotalL1CommitGas)
assert.Equal(t, uint32(6033), batches[0].TotalL1CommitCalldataSize)
}