Skip to content

Commit

Permalink
Merge pull request #1056 from OffchainLabs/seq-config-queue-size
Browse files Browse the repository at this point in the history
Make sequencer pending tx queue size configurable
  • Loading branch information
PlasmaPower authored Aug 31, 2022
2 parents ea3ac50 + c93034f commit ef15bab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ type SequencerConfig struct {
MaxAcceptableTimestampDelta time.Duration `koanf:"max-acceptable-timestamp-delta"`
SenderWhitelist string `koanf:"sender-whitelist"`
ForwardTimeout time.Duration `koanf:"forward-timeout"`
QueueSize int `koanf:"queue-size"`
Dangerous DangerousSequencerConfig `koanf:"dangerous"`
}

Expand All @@ -548,6 +549,7 @@ var DefaultSequencerConfig = SequencerConfig{
MaxRevertGasReject: params.TxGas + 10000,
MaxAcceptableTimestampDelta: time.Hour,
ForwardTimeout: time.Second * 30,
QueueSize: 1024,
Dangerous: DefaultDangerousSequencerConfig,
}

Expand All @@ -558,6 +560,7 @@ var TestSequencerConfig = SequencerConfig{
MaxAcceptableTimestampDelta: time.Hour,
SenderWhitelist: "",
ForwardTimeout: time.Second * 2,
QueueSize: 128,
Dangerous: TestDangerousSequencerConfig,
}

Expand All @@ -568,6 +571,7 @@ func SequencerConfigAddOptions(prefix string, f *flag.FlagSet) {
f.Duration(prefix+".max-acceptable-timestamp-delta", DefaultSequencerConfig.MaxAcceptableTimestampDelta, "maximum acceptable time difference between the local time and the latest L1 block's timestamp")
f.String(prefix+".sender-whitelist", DefaultSequencerConfig.SenderWhitelist, "comma separated whitelist of authorized senders (if empty, everyone is allowed)")
f.Duration(prefix+".forward-timeout", DefaultSequencerConfig.ForwardTimeout, "timeout when forwarding to a different sequencer")
f.Int(prefix+".queue-size", DefaultSequencerConfig.QueueSize, "size of the pending tx queue")
DangerousSequencerConfigAddOptions(prefix+".dangerous", f)
}

Expand Down
4 changes: 2 additions & 2 deletions arbnode/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func NewSequencer(txStreamer *TransactionStreamer, l1Reader *headerreader.Header
}
return &Sequencer{
txStreamer: txStreamer,
txQueue: make(chan txQueueItem, 128),
txQueue: make(chan txQueueItem, config().QueueSize),
l1Reader: l1Reader,
config: config,
senderWhitelist: senderWhitelist,
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *Sequencer) DontForward() {
s.forwarder = nil
}

var ErrQueueFull error = errors.New("queue full")
var ErrQueueFull error = errors.New("sequencer pending tx pool full, please try again")
var ErrNoSequencer error = errors.New("sequencer temporarily not available")

func (s *Sequencer) requeueOrFail(queueItem txQueueItem, err error) {
Expand Down

0 comments on commit ef15bab

Please sign in to comment.