Skip to content

Commit

Permalink
Merge pull request #2395 from OffchainLabs/dataposter-disable-posting…
Browse files Browse the repository at this point in the history
…-new-batches

Add option to disable posting new batches in dataposter [NIT-2560]
  • Loading branch information
anodar authored Jun 18, 2024
2 parents e56f6b3 + b55484f commit 54f63eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,10 @@ func (p *DataPoster) PostTransaction(ctx context.Context, dataCreatedAt time.Tim
p.mutex.Lock()
defer p.mutex.Unlock()

if p.config().DisableNewTx {
return nil, fmt.Errorf("posting new transaction is disabled")
}

var weight uint64 = 1
if len(kzgBlobs) > 0 {
weight = uint64(len(kzgBlobs))
Expand Down Expand Up @@ -1256,6 +1260,9 @@ type DataPosterConfig struct {
MaxFeeCapFormula string `koanf:"max-fee-cap-formula" reload:"hot"`
ElapsedTimeBase time.Duration `koanf:"elapsed-time-base" reload:"hot"`
ElapsedTimeImportance float64 `koanf:"elapsed-time-importance" reload:"hot"`
// When set, dataposter will not post new batches, but will keep running to
// get existing batches confirmed.
DisableNewTx bool `koanf:"disable-new-tx" reload:"hot"`
}

type ExternalSignerCfg struct {
Expand Down Expand Up @@ -1317,6 +1324,7 @@ func DataPosterConfigAddOptions(prefix string, f *pflag.FlagSet, defaultDataPost
signature.SimpleHmacConfigAddOptions(prefix+".redis-signer", f)
addDangerousOptions(prefix+".dangerous", f)
addExternalSignerOptions(prefix+".external-signer", f)
f.Bool(prefix+".disable-new-tx", defaultDataPosterConfig.DisableNewTx, "disable posting new transactions, data poster will still keep confirming existing batches")
}

func addDangerousOptions(prefix string, f *pflag.FlagSet) {
Expand Down Expand Up @@ -1356,6 +1364,7 @@ var DefaultDataPosterConfig = DataPosterConfig{
MaxFeeCapFormula: "((BacklogOfBatches * UrgencyGWei) ** 2) + ((ElapsedTime/ElapsedTimeBase) ** 2) * ElapsedTimeImportance + TargetPriceGWei",
ElapsedTimeBase: 10 * time.Minute,
ElapsedTimeImportance: 10,
DisableNewTx: false,
}

var DefaultDataPosterConfigForValidator = func() DataPosterConfig {
Expand Down Expand Up @@ -1389,6 +1398,7 @@ var TestDataPosterConfig = DataPosterConfig{
MaxFeeCapFormula: "((BacklogOfBatches * UrgencyGWei) ** 2) + ((ElapsedTime/ElapsedTimeBase) ** 2) * ElapsedTimeImportance + TargetPriceGWei",
ElapsedTimeBase: 10 * time.Minute,
ElapsedTimeImportance: 10,
DisableNewTx: false,
}

var TestDataPosterConfigForValidator = func() DataPosterConfig {
Expand Down

0 comments on commit 54f63eb

Please sign in to comment.