blockbuilder

package
v1.27.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0, MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOutOfGas

func IsOutOfGas(err error) bool

IsOutOfGas returns true if the error is an "out of gas" error.

Types

type BlockBuilder

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

func NewBlockBuilder

func NewBlockBuilder(ctx context.Context, logger *zap.SugaredLogger, sm *stmgr.StateManager, parentTs *types.TipSet) (*BlockBuilder, error)

NewBlockBuilder constructs a new block builder from the parent state. Use this to pack a block with messages.

NOTE: The context applies to the life of the block builder itself (but does not need to be canceled).

func (*BlockBuilder) ActorStore

func (bb *BlockBuilder) ActorStore() adt.Store

ActorStore returns the LegacyVM's current (pending) blockstore.

func (*BlockBuilder) ActorsVersion

func (bb *BlockBuilder) ActorsVersion() (actorstypes.Version, error)

ActorsVersion returns the actors version for the target block.

func (*BlockBuilder) GasRemaining

func (bb *BlockBuilder) GasRemaining() int64

GasRemaining returns the amount of remaining gas in the next block.

func (*BlockBuilder) Height

func (bb *BlockBuilder) Height() abi.ChainEpoch

Height returns the epoch for the target block.

func (*BlockBuilder) L

func (bb *BlockBuilder) L() *zap.SugaredLogger

func (*BlockBuilder) Messages

func (bb *BlockBuilder) Messages() []*types.Message

Messages returns all messages currently packed into the next block. 1. DO NOT modify the slice, copy it. 2. DO NOT retain the slice, copy it.

func (*BlockBuilder) NetworkVersion

func (bb *BlockBuilder) NetworkVersion() network.Version

NetworkVersion returns the network version for the target block.

func (*BlockBuilder) ParentStateTree

func (bb *BlockBuilder) ParentStateTree() *state.StateTree

ParentStateTree returns the parent state-tree (not the paren't tipset's parent state-tree).

func (*BlockBuilder) ParentTipSet

func (bb *BlockBuilder) ParentTipSet() *types.TipSet

ParentTipSet returns the parent tipset.

func (*BlockBuilder) PushMessage

func (bb *BlockBuilder) PushMessage(msg *types.Message) (*types.MessageReceipt, error)

PushMessage tries to push the specified message into the block.

1. All messages will be executed in-order. 2. Gas computation & nonce selection will be handled internally. 3. The base-fee is 0 so the sender does not need funds. 4. As usual, the sender must be an account (any account). 5. If the message fails to execute, this method will fail.

Returns ErrOutOfGas when out of gas. Check BlockBuilder.GasRemaining and try pushing a cheaper message.

func (*BlockBuilder) StateManager

func (bb *BlockBuilder) StateManager() *stmgr.StateManager

StateManager returns the stmgr.StateManager.

func (*BlockBuilder) StateTree

func (bb *BlockBuilder) StateTree() *state.StateTree

StateTree returns the LegacyVM's current (pending) state-tree. This includes any changes made by successfully pushed messages.

You probably want ParentStateTree

func (*BlockBuilder) StateTreeByHeight

func (bb *BlockBuilder) StateTreeByHeight(epoch abi.ChainEpoch) (*state.StateTree, error)

StateTreeByHeight will return a state-tree up through and including the current in-progress epoch.

NOTE: This will return the state after the given epoch, not the parent state for the epoch.

type ErrOutOfGas

type ErrOutOfGas struct {
	Available, Required int64
}

ErrOutOfGas is returned from BlockBuilder.PushMessage when the block does not have enough gas to fit the given message.

func (*ErrOutOfGas) Error

func (e *ErrOutOfGas) Error() string

Jump to

Keyboard shortcuts

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