From c93034f2902b3d74ced5359267cbe11b569dd47c Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Wed, 31 Aug 2022 15:53:48 -0500 Subject: [PATCH] Make sequencer pending tx queue size configurable --- arbnode/node.go | 4 ++++ arbnode/sequencer.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arbnode/node.go b/arbnode/node.go index 71fe8fd866..2093dc290a 100644 --- a/arbnode/node.go +++ b/arbnode/node.go @@ -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"` } @@ -548,6 +549,7 @@ var DefaultSequencerConfig = SequencerConfig{ MaxRevertGasReject: params.TxGas + 10000, MaxAcceptableTimestampDelta: time.Hour, ForwardTimeout: time.Second * 30, + QueueSize: 1024, Dangerous: DefaultDangerousSequencerConfig, } @@ -558,6 +560,7 @@ var TestSequencerConfig = SequencerConfig{ MaxAcceptableTimestampDelta: time.Hour, SenderWhitelist: "", ForwardTimeout: time.Second * 2, + QueueSize: 128, Dangerous: TestDangerousSequencerConfig, } @@ -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) } diff --git a/arbnode/sequencer.go b/arbnode/sequencer.go index 879cf12453..9f0d95ddc0 100644 --- a/arbnode/sequencer.go +++ b/arbnode/sequencer.go @@ -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, @@ -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) {