message: op-batcher: Reorder channel builder types
diff: @@ -11,28 +11,7 @@ import (
  "github.com/ethereum/go-ethereum/core/types"
  )
  -type (
  - // channelBuilder uses a ChannelOut to create a channel with output frame
  - // size approximation.
  - channelBuilder struct {
  - cfg ChannelConfig
  -
  - // L1 block timestamp of combined channel & sequencing window timeout. 0 if
  - // no timeout set yet.
  - timeout uint64
  -
  - // marked as full if a) max RLP input bytes, b) max num frames or c) max
  - // allowed frame index (uint16) has been reached
  - fullErr error
  - // current channel
  - co *derive.ChannelOut
  - // list of blocks in the channel. Saved in case the channel must be rebuilt
  - blocks []*types.Block
  - // frames data queue, to be send as txs
  - frames []taggedData
  - }
  -
  - ChannelConfig struct {
  +type ChannelConfig struct {
  // Number of epochs (L1 blocks) per sequencing window, including the epoch
  // L1 origin block itself
  SeqWindowSize uint64
  @@ -60,31 +39,32 @@ type (
  ApproxComprRatio float64
  }
  - ChannelFullError struct {
  - Err error
  - }
  -)
  -
  -func (e *ChannelFullError) Error() string {
  - return "channel full: " + e.Err.Error()
  -}
  -
  -func (e *ChannelFullError) Unwrap() error {
  - return e.Err
  -}
  -
  -var (
  - ErrInputTargetReached = errors.New("target amount of input data reached")
  - ErrMaxFrameIndex = errors.New("max frame index reached (uint16)")
  - ErrChannelTimedOut = errors.New("channel timed out")
  -)
  -
  // InputThreshold calculates the input data threshold in bytes from the given
  // parameters.
  func (c ChannelConfig) InputThreshold() uint64 {
  return uint64(float64(c.TargetNumFrames) * float64(c.TargetFrameSize) / c.ApproxComprRatio)
  }
  +// channelBuilder uses a ChannelOut to create a channel with output frame
  +// size approximation.
  +type channelBuilder struct {
  + cfg ChannelConfig
  +
  + // L1 block timestamp of combined channel & sequencing window timeout. 0 if
  + // no timeout set yet.
  + timeout uint64
  +
  + // marked as full if a) max RLP input bytes, b) max num frames or c) max
  + // allowed frame index (uint16) has been reached
  + fullErr error
  + // current channel
  + co *derive.ChannelOut
  + // list of blocks in the channel. Saved in case the channel must be rebuilt
  + blocks []*types.Block
  + // frames data queue, to be send as txs
  + frames []taggedData
  +}
  +
  func newChannelBuilder(cfg ChannelConfig) (*channelBuilder, error) {
  co, err := derive.NewChannelOut()
  if err != nil {
  @@ -336,3 +316,21 @@ func (c *channelBuilder) PushFrame(id txID, frame []byte) {
  }
  c.frames = append(c.frames, taggedData{id: id, data: frame})
  }
  +
  +var (
  + ErrInputTargetReached = errors.New("target amount of input data reached")
  + ErrMaxFrameIndex = errors.New("max frame index reached (uint16)")
  + ErrChannelTimedOut = errors.New("channel timed out")
  +)
  +
  +type ChannelFullError struct {
  + Err error
  +}
  +
  +func (e *ChannelFullError) Error() string {
  + return "channel full: " + e.Err.Error()
  +}
  +
  +func (e *ChannelFullError) Unwrap() error {
  + return e.Err
  +}
  