state

package
v0.37.0-preview-4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockState

type BlockState struct {
	types.StateDB // todo change to types.ReadOnlyView
	// contains filtered or unexported fields
}

func NewBlockState

func NewBlockState(
	block *models.Block,
	registers atree.Ledger,
	chainID flowGo.ChainID,
	blocks storage.BlockIndexer,
	receipts storage.ReceiptIndexer,
	logger zerolog.Logger,
) (*BlockState, error)

func (*BlockState) Call

func (s *BlockState) Call(from common.Address, data []byte) (*types.Result, error)

func (*BlockState) Execute

func (s *BlockState) Execute(tx models.Transaction) (*gethTypes.Receipt, error)

type Engine

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

func NewStateEngine

func NewStateEngine(
	config *config.Config,
	execution executiondata.ExecutionDataAPIClient,
	blockPublisher *models.Publisher,
	store *pebble.Storage,
	blocks storage.BlockIndexer,
	transactions storage.TransactionIndexer,
	receipts storage.ReceiptIndexer,
	logger zerolog.Logger,
) *Engine

func (*Engine) Done

func (e *Engine) Done() <-chan struct{}

func (*Engine) Error

func (e *Engine) Error() <-chan error

func (*Engine) ID

func (e *Engine) ID() uuid.UUID

func (*Engine) Notify

func (e *Engine) Notify(data any)

func (*Engine) Ready

func (e *Engine) Ready() <-chan struct{}

func (*Engine) Run

func (e *Engine) Run(ctx context.Context) error

func (*Engine) Stop

func (e *Engine) Stop()

type RegisterValidator

type RegisterValidator struct {
	atree.Ledger
	// contains filtered or unexported fields
}

RegisterValidator keeps track of all set register during execution and is checked once the block is executed.

func NewRegisterValidator

func NewRegisterValidator(
	register atree.Ledger,
	execution executiondata.ExecutionDataAPIClient,
) *RegisterValidator

NewRegisterValidator will create a new register validator. The register validator should only be used once for atree.Ledger it wraps for a specific block height. After we must call ValidateBlock only once.

func (*RegisterValidator) SetValue

func (r *RegisterValidator) SetValue(owner, key, value []byte) (err error)

func (*RegisterValidator) ValidateBlock

func (r *RegisterValidator) ValidateBlock(cadenceHeight uint64) error

ValidateBlock will go over all registers that were set during block execution and compare them against the registers stored on-chain using an execution data client for the provided Cadence height. Expected errors: - ErrStateMismatch error if there is a mismatch in any of the register values Any other error is an issue with client request or response.

Jump to

Keyboard shortcuts

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