execution

package
v0.32.8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDataNotAvailable = errors.New("data for block is not available")

ErrDataNotAvailable indicates that the data for a given block was not available

This generally indicates a request was made for execution data at a block height that was not not locally indexed

Functions

This section is empty.

Types

type RegisterAtHeight added in v0.32.7

type RegisterAtHeight func(ID flow.RegisterID, height uint64) (flow.RegisterValue, error)

RegisterAtHeight returns register value for provided register ID at the block height. Even if the register wasn't indexed at the provided height, returns the highest height the register was indexed at. If the register with the ID was not indexed at all return nil value and no error. Expected errors: - storage.ErrHeightNotIndexed if the given height was not indexed yet or lower than the first indexed height.

type ScriptExecutor added in v0.32.2

type ScriptExecutor interface {
	// ExecuteAtBlockHeight executes provided script against the block height.
	// A result value is returned encoded as byte array. An error will be returned if script
	// doesn't successfully execute.
	// Expected errors:
	// - storage.ErrNotFound if block or register value at height was not found.
	// - ErrDataNotAvailable if the data for the block height is not available
	ExecuteAtBlockHeight(
		ctx context.Context,
		script []byte,
		arguments [][]byte,
		height uint64,
	) ([]byte, error)

	// GetAccountAtBlockHeight returns a Flow account by the provided address and block height.
	// Expected errors:
	// - ErrDataNotAvailable if the data for the block height is not available
	GetAccountAtBlockHeight(ctx context.Context, address flow.Address, height uint64) (*flow.Account, error)
}

type Scripts

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

func NewScripts

func NewScripts(
	log zerolog.Logger,
	metrics module.ExecutionMetrics,
	chainID flow.ChainID,
	entropy query.EntropyProviderPerBlock,
	header storage.Headers,
	registerAtHeight RegisterAtHeight,
) (*Scripts, error)

func (*Scripts) ExecuteAtBlockHeight

func (s *Scripts) ExecuteAtBlockHeight(
	ctx context.Context,
	script []byte,
	arguments [][]byte,
	height uint64,
) ([]byte, error)

ExecuteAtBlockHeight executes provided script against the block height. A result value is returned encoded as byte array. An error will be returned if script doesn't successfully execute. Expected errors: - Script execution related errors - ErrDataNotAvailable if the data for the block height is not available

func (*Scripts) GetAccountAtBlockHeight

func (s *Scripts) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, height uint64) (*flow.Account, error)

GetAccountAtBlockHeight returns a Flow account by the provided address and block height. Expected errors: - Script execution related errors - ErrDataNotAvailable if the data for the block height is not available

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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