execution

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexRegisterAdapter

func IndexRegisterAdapter(registerFun func(IDs flow.RegisterIDs, height uint64) ([]flow.RegisterValue, error)) func(flow.RegisterID, uint64) (flow.RegisterValue, error)

IndexRegisterAdapter an adapter for using indexer register values function that takes a slice of IDs in the script executor that only uses a single register ID at a time. It also does additional sanity checks if multiple values are returned, which shouldn't occur in normal operation.

Types

type RegistersAtHeight

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

RegistersAtHeight 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. Expected errors: - storage.ErrNotFound if the register by the ID was never indexed - ErrIndexBoundary if the height is out of indexed height boundary

type Scripts

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

func NewScripts

func NewScripts(
	log zerolog.Logger,
	metrics *metrics.ExecutionCollector,
	chainID flow.ChainID,
	entropy query.EntropyProviderPerBlock,
	header storage.Headers,
	registersAtHeight RegistersAtHeight,
) (*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: - Storage.NotFound if block or register value at height was not found.

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: - Storage.NotFound if block or register value at height was not found.

Jump to

Keyboard shortcuts

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