From caa16e167675574e7d439d76900726252daf2168 Mon Sep 17 00:00:00 2001 From: colin <102356659+colinlyguo@users.noreply.github.com> Date: Sat, 7 Oct 2023 21:35:53 +0800 Subject: [PATCH] fix(rollup-relayer): address underestimation of commitBatch gas in low-tx batches (#980) Co-authored-by: colinlyguo --- common/version/version.go | 2 +- rollup/internal/controller/watcher/batch_proposer.go | 1 + rollup/internal/controller/watcher/batch_proposer_test.go | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/version/version.go b/common/version/version.go index bb852e4f87..43e2510125 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -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 { diff --git a/rollup/internal/controller/watcher/batch_proposer.go b/rollup/internal/controller/watcher/batch_proposer.go index d66786c69a..0e2fa66a2b 100644 --- a/rollup/internal/controller/watcher/batch_proposer.go +++ b/rollup/internal/controller/watcher/batch_proposer.go @@ -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 diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index 0d0e23e0bd..e140bcd5e3 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -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) }