diff --git a/op-batcher/batcher/config.go b/op-batcher/batcher/config.go index d927a420ec09..456000625450 100644 --- a/op-batcher/batcher/config.go +++ b/op-batcher/batcher/config.go @@ -57,6 +57,12 @@ type CLIConfig struct { // If using blobs, this setting is ignored and the max blob size is used. MaxL1TxSize uint64 + // MaxFrameSize is the maximum size of a frame in a batch tx. + MaxFrameSize uint64 + + // MultiFrameTxs controls whether to put all frames of a channel inside a single tx. + MultiFrameTxs bool + // The target number of frames to create per channel. Controls number of blobs // per blob tx, if using Blob DA. TargetNumFrames int @@ -101,8 +107,8 @@ type CLIConfig struct { MetricsConfig opmetrics.CLIConfig PprofConfig oppprof.CLIConfig RPC oprpc.CLIConfig - PlasmaDA plasma.CLIConfig - DaConfig celestia.CLIConfig + PlasmaDA plasma.CLIConfig + DaConfig celestia.CLIConfig } func (c *CLIConfig) Check() error { @@ -177,6 +183,8 @@ func NewConfig(ctx *cli.Context) *CLIConfig { MaxPendingTransactions: ctx.Uint64(flags.MaxPendingTransactionsFlag.Name), MaxChannelDuration: ctx.Uint64(flags.MaxChannelDurationFlag.Name), MaxL1TxSize: ctx.Uint64(flags.MaxL1TxSizeBytesFlag.Name), + MaxFrameSize: ctx.Uint64(flags.MaxFrameSizeFlag.Name), + MultiFrameTxs: ctx.Bool(flags.MultiFrameTxsFlag.Name), TargetNumFrames: ctx.Int(flags.TargetNumFramesFlag.Name), ApproxComprRatio: ctx.Float64(flags.ApproxComprRatioFlag.Name), Compressor: ctx.String(flags.CompressorFlag.Name), diff --git a/op-batcher/batcher/driver.go b/op-batcher/batcher/driver.go index 3af4d806404e..ba01b1f867d8 100644 --- a/op-batcher/batcher/driver.go +++ b/op-batcher/batcher/driver.go @@ -494,7 +494,7 @@ func (l *BatchSubmitter) sendTransaction(ctx context.Context, txdata txData, que } } else { // sanity check - if nf := len(txdata.frames); nf != 1 { + if nf := len(txdata.frames); nf > l.ChannelConfig.TargetNumFrames { l.Log.Crit("unexpected number of frames in calldata tx", "num_frames", nf) } data := txdata.CallData() diff --git a/op-batcher/batcher/service.go b/op-batcher/batcher/service.go index 8ba8ab3423e6..19b409a726a3 100644 --- a/op-batcher/batcher/service.go +++ b/op-batcher/batcher/service.go @@ -206,6 +206,16 @@ func (bs *BatcherService) initChannelConfig(cfg *CLIConfig) error { BatchType: cfg.BatchType, } + // override max frame size if set + if cfg.MaxFrameSize > 0 { + cc.MaxFrameSize = cfg.MaxFrameSize + } + + // enable multi-frame txs if set + if cfg.MultiFrameTxs { + cc.MultiFrameTxs = true + } + switch cfg.DataAvailabilityType { case flags.BlobsType: if !cfg.TestUseMaxTxSizeForBlobs { diff --git a/op-batcher/flags/flags.go b/op-batcher/flags/flags.go index 67390a0f2007..43b39db2f634 100644 --- a/op-batcher/flags/flags.go +++ b/op-batcher/flags/flags.go @@ -76,6 +76,18 @@ var ( Value: 120_000, // will be overwritten to max for blob da-type EnvVars: prefixEnvVars("MAX_L1_TX_SIZE_BYTES"), } + MaxFrameSizeFlag = &cli.Uint64Flag{ + Name: "max-frame-size-bytes", + Usage: "The maximum size of a frame. 0 to use default value (120k-1)", + Value: 0, + EnvVars: prefixEnvVars("MAX_FRAME_SIZE_BYTES"), + } + MultiFrameTxsFlag = &cli.BoolFlag{ + Name: "multi-frame-txs", + Usage: "Whether to put all frames of a channel inside a single tx. Ignored for blobs, where true will be used.", + Value: false, + EnvVars: prefixEnvVars("MULTI_FRAME_TXS"), + } TargetNumFramesFlag = &cli.IntFlag{ Name: "target-num-frames", Usage: "The target number of frames to create per channel. Controls number of blobs per blob tx, if using Blob DA.", @@ -169,6 +181,8 @@ var optionalFlags = []cli.Flag{ MaxPendingTransactionsFlag, MaxChannelDurationFlag, MaxL1TxSizeBytesFlag, + MaxFrameSizeFlag, + MultiFrameTxsFlag, TargetNumFramesFlag, ApproxComprRatioFlag, CompressorFlag,