Skip to content

Commit

Permalink
Merge pull request #2657 from OffchainLabs/allow_only_posting_batch_p…
Browse files Browse the repository at this point in the history
…osting_report

PeriodToAllowPostingBatchWithOnlyBatchPostingReport config
  • Loading branch information
PlasmaPower authored Oct 25, 2024
2 parents 1a452f3 + 489e152 commit 00d0069
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ type BatchPosterConfig struct {
Dangerous BatchPosterDangerousConfig `koanf:"dangerous"`
ReorgResistanceMargin time.Duration `koanf:"reorg-resistance-margin" reload:"hot"`
CheckBatchCorrectness bool `koanf:"check-batch-correctness"`
MaxEmptyBatchDelay time.Duration `koanf:"max-empty-batch-delay"`

gasRefunder common.Address
l1BlockBound l1BlockBound
Expand Down Expand Up @@ -224,6 +225,7 @@ func BatchPosterConfigAddOptions(prefix string, f *pflag.FlagSet) {
f.Uint64(prefix+".gas-estimate-base-fee-multiple-bips", uint64(DefaultBatchPosterConfig.GasEstimateBaseFeeMultipleBips), "for gas estimation, use this multiple of the basefee (measured in basis points) as the max fee per gas")
f.Duration(prefix+".reorg-resistance-margin", DefaultBatchPosterConfig.ReorgResistanceMargin, "do not post batch if its within this duration from layer 1 minimum bounds. Requires l1-block-bound option not be set to \"ignore\"")
f.Bool(prefix+".check-batch-correctness", DefaultBatchPosterConfig.CheckBatchCorrectness, "setting this to true will run the batch against an inbox multiplexer and verifies that it produces the correct set of messages")
f.Duration(prefix+".max-empty-batch-delay", DefaultBatchPosterConfig.MaxEmptyBatchDelay, "maximum empty batch posting delay, batch poster will only be able to post an empty batch if this time period building a batch has passed")
redislock.AddConfigOptions(prefix+".redis-lock", f)
dataposter.DataPosterConfigAddOptions(prefix+".data-poster", f, dataposter.DefaultDataPosterConfig)
genericconf.WalletConfigAddOptions(prefix+".parent-chain-wallet", f, DefaultBatchPosterConfig.ParentChainWallet.Pathname)
Expand Down Expand Up @@ -255,6 +257,7 @@ var DefaultBatchPosterConfig = BatchPosterConfig{
GasEstimateBaseFeeMultipleBips: arbmath.OneInUBips * 3 / 2,
ReorgResistanceMargin: 10 * time.Minute,
CheckBatchCorrectness: true,
MaxEmptyBatchDelay: 3 * 24 * time.Hour,
}

var DefaultBatchPosterL1WalletConfig = genericconf.WalletConfig{
Expand Down Expand Up @@ -1303,7 +1306,9 @@ func (b *BatchPoster) maybePostSequencerBatch(ctx context.Context) (bool, error)
b.building.muxBackend.delayedInbox = append(b.building.muxBackend.delayedInbox, msg)
}
}
if msg.Message.Header.Kind != arbostypes.L1MessageType_BatchPostingReport {
// #nosec G115
timeSinceMsg := time.Since(time.Unix(int64(msg.Message.Header.Timestamp), 0))
if (msg.Message.Header.Kind != arbostypes.L1MessageType_BatchPostingReport) || (timeSinceMsg >= config.MaxEmptyBatchDelay) {
b.building.haveUsefulMessage = true
if b.building.firstUsefulMsg == nil {
b.building.firstUsefulMsg = msg
Expand Down

0 comments on commit 00d0069

Please sign in to comment.