derivation

package
v0.0.0-...-d4adcb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBatch

func DecodeBatch(data []byte) (interface{}, error)

TODO: this is not currently called anywhere but will be useful for testing.

func NewBatchBuilder

func NewBatchBuilder(cfg Config, encoder VersionedDataEncoder) *batchBuilder

Types

type BatchEncoderVersion

type BatchEncoderVersion = byte
const V0 BatchEncoderVersion = 0x0

type BatchV0Encoder

type BatchV0Encoder struct {
	// contains filtered or unexported fields
}

func NewBatchV0Encoder

func NewBatchV0Encoder(cfg V0Config) *BatchV0Encoder

func (*BatchV0Encoder) GetBatch

func (e *BatchV0Encoder) GetBatch(force bool) ([]byte, error)

func (*BatchV0Encoder) ProcessBlock

func (e *BatchV0Encoder) ProcessBlock(block *types.Block, isNewEpoch bool) error

Processes a block. If the block is non-empty and fits, add it to the current sub-batch. If the block belongs to a new epoch, close the current sub-batch and start a new one.

func (*BatchV0Encoder) Reset

func (e *BatchV0Encoder) Reset()

type Config

type Config interface {
	GetL1OracleAddr() common.Address
	GetSeqWindowSize() uint64
	GetSubSafetyMargin() uint64
}

type DecodeTxBatchError

type DecodeTxBatchError struct {
	// contains filtered or unexported fields
}

func (*DecodeTxBatchError) Error

func (e *DecodeTxBatchError) Error() string

type InvalidBlockError

type InvalidBlockError struct{ Msg string }

func (InvalidBlockError) Error

func (e InvalidBlockError) Error() string

type V0Config

type V0Config interface {
	GetTargetBatchSize() uint64
}

type VersionedDataEncoder

type VersionedDataEncoder interface {
	// Returns an encoded batch if one is ready (or if forced).
	// If not forced, an error is returned if one cannot yet be built.
	GetBatch(force bool) ([]byte, error)
	// Processes a block, adding its data to the current batch.
	// Returns an `errBatchFull` if the block would cause the batch to exceed the target size.
	// Returns an error if the block could not be processed.
	ProcessBlock(block *ethTypes.Block, isNewEpoch bool) error
	// Resets the encoder, discarding all buffered data.
	Reset()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL