Skip to content

Commit 2469d18

Browse files
authored
Merge pull request #3099 from OffchainLabs/fixed-bp-gas-master
Add a node.batch-poster.dangerous.fixed-gas-limit flag
2 parents 0badeac + f46ff6e commit 2469d18

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Diff for: arbnode/batch_poster.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ const (
139139
)
140140

141141
type BatchPosterDangerousConfig struct {
142-
AllowPostingFirstBatchWhenSequencerMessageCountMismatch bool `koanf:"allow-posting-first-batch-when-sequencer-message-count-mismatch"`
142+
AllowPostingFirstBatchWhenSequencerMessageCountMismatch bool `koanf:"allow-posting-first-batch-when-sequencer-message-count-mismatch"`
143+
FixedGasLimit uint64 `koanf:"fixed-gas-limit"`
143144
}
144145

145146
type BatchPosterConfig struct {
@@ -209,6 +210,7 @@ type BatchPosterConfigFetcher func() *BatchPosterConfig
209210

210211
func DangerousBatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
211212
f.Bool(prefix+".allow-posting-first-batch-when-sequencer-message-count-mismatch", DefaultBatchPosterConfig.Dangerous.AllowPostingFirstBatchWhenSequencerMessageCountMismatch, "allow posting the first batch even if sequence number doesn't match chain (useful after force-inclusion)")
213+
f.Uint64(prefix+".fixed-gas-limit", DefaultBatchPosterConfig.Dangerous.FixedGasLimit, "use this gas limit for batch posting instead of estimating it")
212214
}
213215

214216
func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
@@ -1669,9 +1671,14 @@ func (b *BatchPoster) MaybePostSequencerBatch(ctx context.Context) (bool, error)
16691671
// In theory, this might reduce gas usage, but only by a factor that's already
16701672
// accounted for in `config.ExtraBatchGas`, as that same factor can appear if a user
16711673
// posts a new delayed message that we didn't see while gas estimating.
1672-
gasLimit, err := b.estimateGas(ctx, sequencerMsg, lastPotentialMsg.DelayedMessagesRead, data, kzgBlobs, nonce, accessList, delayProof)
1673-
if err != nil {
1674-
return false, err
1674+
var gasLimit uint64
1675+
if b.config().Dangerous.FixedGasLimit != 0 {
1676+
gasLimit = b.config().Dangerous.FixedGasLimit
1677+
} else {
1678+
gasLimit, err = b.estimateGas(ctx, sequencerMsg, lastPotentialMsg.DelayedMessagesRead, data, kzgBlobs, nonce, accessList, delayProof)
1679+
if err != nil {
1680+
return false, err
1681+
}
16751682
}
16761683
newMeta, err := rlp.EncodeToBytes(batchPosterPosition{
16771684
MessageCount: b.building.msgCount,

0 commit comments

Comments
 (0)