diff --git a/cmd/nitro/nitro.go b/cmd/nitro/nitro.go index e4e1b79353..b697902f7e 100644 --- a/cmd/nitro/nitro.go +++ b/cmd/nitro/nitro.go @@ -580,12 +580,16 @@ func mainImpl() int { return 1 } } - // If sequencer is enabled, validate MaxTxDataSize to be at least 5kB below the batch poster's MaxSize to allow space for headers and such. - // And since batchposter's MaxSize is to be at least 10kB below the sequencer inbox’s maxDataSize, this leads to another condition of atlest 15kB below the sequencer inbox’s maxDataSize. + if nodeConfig.Execution.Sequencer.Enable { - if nodeConfig.Execution.Sequencer.MaxTxDataSize > nodeConfig.Node.BatchPoster.MaxSize-5000 || - nodeConfig.Execution.Sequencer.MaxTxDataSize > seqInboxMaxDataSize-15000 { - log.Error("sequencer's MaxTxDataSize too large") + // Validate MaxTxDataSize to be at least 5kB below the batch poster's MaxSize to allow space for headers and such. + if nodeConfig.Execution.Sequencer.MaxTxDataSize > nodeConfig.Node.BatchPoster.MaxSize-5000 { + log.Error("sequencer's MaxTxDataSize too large compared to the batchPoster's MaxSize") + return 1 + } + // Since the batchposter's MaxSize must be at least 10kB below the sequencer inbox’s maxDataSize, then MaxTxDataSize must also be 15kB below the sequencer inbox’s maxDataSize. + if nodeConfig.Execution.Sequencer.MaxTxDataSize > seqInboxMaxDataSize-15000 && !nodeConfig.Execution.Sequencer.Dangerous.DisableSeqInboxMaxDataSizeCheck { + log.Error("sequencer's MaxTxDataSize too large compared to the sequencer inbox's MaxDataSize") return 1 } } diff --git a/execution/gethexec/sequencer.go b/execution/gethexec/sequencer.go index faded7375c..ce5394865a 100644 --- a/execution/gethexec/sequencer.go +++ b/execution/gethexec/sequencer.go @@ -68,6 +68,7 @@ type SequencerConfig struct { MaxAcceptableTimestampDelta time.Duration `koanf:"max-acceptable-timestamp-delta" reload:"hot"` SenderWhitelist []string `koanf:"sender-whitelist"` Forwarder ForwarderConfig `koanf:"forwarder"` + Dangerous DangerousConfig `koanf:"dangerous"` QueueSize int `koanf:"queue-size"` QueueTimeout time.Duration `koanf:"queue-timeout" reload:"hot"` NonceCacheSize int `koanf:"nonce-cache-size" reload:"hot"` @@ -119,6 +120,7 @@ var DefaultSequencerConfig = SequencerConfig{ MaxAcceptableTimestampDelta: time.Hour, SenderWhitelist: []string{}, Forwarder: DefaultSequencerForwarderConfig, + Dangerous: DefaultDangerousConfig, QueueSize: 1024, QueueTimeout: time.Second * 12, NonceCacheSize: 1024, @@ -139,6 +141,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.StringSlice(prefix+".sender-whitelist", DefaultSequencerConfig.SenderWhitelist, "comma separated whitelist of authorized senders (if empty, everyone is allowed)") AddOptionsForSequencerForwarderConfig(prefix+".forwarder", f) + AddOptionsForDangerousConfig(prefix+".dangerous", f) f.Int(prefix+".queue-size", DefaultSequencerConfig.QueueSize, "size of the pending tx queue") f.Duration(prefix+".queue-timeout", DefaultSequencerConfig.QueueTimeout, "maximum amount of time transaction can wait in queue") f.Int(prefix+".nonce-cache-size", DefaultSequencerConfig.NonceCacheSize, "size of the tx sender nonce cache") @@ -150,6 +153,18 @@ func SequencerConfigAddOptions(prefix string, f *flag.FlagSet) { f.Bool(prefix+".enable-profiling", DefaultSequencerConfig.EnableProfiling, "enable CPU profiling and tracing") } +type DangerousConfig struct { + DisableSeqInboxMaxDataSizeCheck bool `koanf:"disable-seq-inbox-max-data-size-check"` +} + +var DefaultDangerousConfig = DangerousConfig{ + DisableSeqInboxMaxDataSizeCheck: false, +} + +func AddOptionsForDangerousConfig(prefix string, f *flag.FlagSet) { + f.Bool(prefix+".disable-seq-inbox-max-data-size-check", DefaultDangerousConfig.DisableSeqInboxMaxDataSizeCheck, "DANGEROUS! disables nitro checks on sequencer MaxTxDataSize against the sequencer inbox MaxDataSize") +} + type txQueueItem struct { tx *types.Transaction txSize int // size in bytes of the marshalled transaction