builder

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func New

func New(
	mpool *mempool.Pool,
	app monomer.Application,
	blockStore DB,
	txStore txstore.TxStore,
	eventBus *bfttypes.EventBus,
	chainID monomer.ChainID,
	ethstatedb state.Database,
) *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, payload *Payload) (*monomer.Block, error)

func (*Builder) Rollback

func (b *Builder) Rollback(ctx context.Context, unsafe, safe, finalized common.Hash) error

Rollback rolls back the block store, tx store, and application. TODO does anything need to be done with the event bus? assumptions:

  • all hashes exist in the block store.
  • finalized.Height <= safe.Height <= head.Height

type DB

type DB interface {
	Height() (uint64, error)
	HeaderByHash(hash common.Hash) (*monomer.Header, error)
	Rollback(unsafe, safe, finalized common.Hash) error
	HeaderByHeight(height uint64) (*monomer.Header, error)
	HeadHeader() (*monomer.Header, error)
	AppendBlock(*monomer.Block) error
}

type Payload

type Payload struct {
	// InjectedTransactions functions as an inclusion list. It contains transactions
	// from the consensus layer that must be included in the block.
	InjectedTransactions bfttypes.Txs
	// TODO: make the gas limit actually be enforced. Need to translate between cosmos and op gas limit.
	GasLimit         uint64
	Timestamp        uint64
	NoTxPool         bool
	ParentBeaconRoot *common.Hash
	Coinbase         common.Address
}

Jump to

Keyboard shortcuts

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