execution

package
v0.37.12-re-execute-block Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAttestationResult added in v0.31.0

type BlockAttestationResult struct {
	*BlockExecutionResult

	// TODO(ramtin): move this to the outside, everything needed for create this
	// should be available as part of computation result and most likely trieUpdate
	// was the reason this is kept here, long term we don't need this data and should
	// act based on register deltas
	*execution_data.BlockExecutionData
	// contains filtered or unexported fields
}

BlockAttestationResult holds collection attestation results

func NewEmptyBlockAttestationResult added in v0.31.0

func NewEmptyBlockAttestationResult(
	blockExecutionResult *BlockExecutionResult,
) *BlockAttestationResult

func (*BlockAttestationResult) AllChunkDataPacks added in v0.31.0

func (ar *BlockAttestationResult) AllChunkDataPacks() []*flow.ChunkDataPack

func (*BlockAttestationResult) AllChunks added in v0.31.0

func (ar *BlockAttestationResult) AllChunks() []*flow.Chunk

func (*BlockAttestationResult) AllEventCommitments added in v0.31.0

func (ar *BlockAttestationResult) AllEventCommitments() []flow.Identifier

func (*BlockAttestationResult) AppendCollectionAttestationResult added in v0.31.0

func (ar *BlockAttestationResult) AppendCollectionAttestationResult(
	startStateCommit flow.StateCommitment,
	endStateCommit flow.StateCommitment,
	stateProof flow.StorageProof,
	eventCommit flow.Identifier,
	chunkExecutionDatas *execution_data.ChunkExecutionData,
)

func (*BlockAttestationResult) ChunkAt added in v0.31.0

func (ar *BlockAttestationResult) ChunkAt(index int) *flow.Chunk

func (*BlockAttestationResult) ChunkDataPackAt added in v0.31.0

func (ar *BlockAttestationResult) ChunkDataPackAt(index int) *flow.ChunkDataPack

func (*BlockAttestationResult) CollectionAttestationResultAt added in v0.31.0

func (ar *BlockAttestationResult) CollectionAttestationResultAt(colIndex int) *CollectionAttestationResult

CollectionAttestationResultAt returns CollectionAttestationResult at collection index

func (*BlockAttestationResult) Size added in v0.31.0

func (ar *BlockAttestationResult) Size() int

Size returns the size of collection attestation results

type BlockExecutionResult added in v0.31.0

type BlockExecutionResult struct {
	*entity.ExecutableBlock

	ExecutionDataRoot *flow.BlockExecutionDataRoot // full root data structure produced from block
	// contains filtered or unexported fields
}

BlockExecutionResult captures artifacts of execution of block collections

func NewPopulatedBlockExecutionResult added in v0.31.0

func NewPopulatedBlockExecutionResult(eb *entity.ExecutableBlock) *BlockExecutionResult

NewPopulatedBlockExecutionResult constructs a new BlockExecutionResult, pre-populated with `chunkCounts` number of collection results

func (*BlockExecutionResult) AllConvertedServiceEvents added in v0.31.0

func (er *BlockExecutionResult) AllConvertedServiceEvents() flow.ServiceEventList

func (*BlockExecutionResult) AllEvents added in v0.31.0

func (er *BlockExecutionResult) AllEvents() flow.EventsList

func (*BlockExecutionResult) AllExecutionSnapshots added in v0.31.0

func (er *BlockExecutionResult) AllExecutionSnapshots() []*snapshot.ExecutionSnapshot

func (*BlockExecutionResult) AllServiceEvents added in v0.31.0

func (er *BlockExecutionResult) AllServiceEvents() flow.EventsList

func (*BlockExecutionResult) AllTransactionResults added in v0.31.0

func (er *BlockExecutionResult) AllTransactionResults() flow.TransactionResults

func (*BlockExecutionResult) AllUpdatedRegisters added in v0.33.1

func (er *BlockExecutionResult) AllUpdatedRegisters() []flow.RegisterEntry

AllUpdatedRegisters returns all updated unique register entries Note: order is not determinstic

func (*BlockExecutionResult) CollectionExecutionResultAt added in v0.31.0

func (er *BlockExecutionResult) CollectionExecutionResultAt(colIndex int) *CollectionExecutionResult

func (*BlockExecutionResult) Size added in v0.31.0

func (er *BlockExecutionResult) Size() int

Size returns the size of collection execution results

func (*BlockExecutionResult) TransactionResultAt added in v0.31.0

func (er *BlockExecutionResult) TransactionResultAt(txIdx int) *flow.TransactionResult

type CollectionAttestationResult added in v0.31.0

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

CollectionAttestationResult holds attestations generated during post-processing phase of collect execution.

func NewCollectionAttestationResult added in v0.31.0

func NewCollectionAttestationResult(
	startStateCommit flow.StateCommitment,
	endStateCommit flow.StateCommitment,
	stateProof flow.StorageProof,
	eventCommit flow.Identifier,
) *CollectionAttestationResult

func (*CollectionAttestationResult) EndStateCommitment added in v0.31.0

func (a *CollectionAttestationResult) EndStateCommitment() flow.StateCommitment

func (*CollectionAttestationResult) EventCommitment added in v0.31.0

func (a *CollectionAttestationResult) EventCommitment() flow.Identifier

func (*CollectionAttestationResult) StartStateCommitment added in v0.31.0

func (a *CollectionAttestationResult) StartStateCommitment() flow.StateCommitment

func (*CollectionAttestationResult) StateProof added in v0.31.0

func (*CollectionAttestationResult) UpdateEndStateCommitment added in v0.31.0

func (a *CollectionAttestationResult) UpdateEndStateCommitment(endState flow.StateCommitment)

TODO(ramtin): depricate in the future, temp method, needed for uploader for now

type CollectionExecutionResult added in v0.31.0

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

CollectionExecutionResult holds aggregated artifacts (events, tx resutls, ...) generated during collection execution

func NewEmptyCollectionExecutionResult added in v0.31.0

func NewEmptyCollectionExecutionResult() *CollectionExecutionResult

NewEmptyCollectionExecutionResult constructs a new CollectionExecutionResult

func (*CollectionExecutionResult) AppendTransactionResults added in v0.31.0

func (c *CollectionExecutionResult) AppendTransactionResults(
	events flow.EventsList,
	serviceEvents flow.EventsList,
	convertedServiceEvents flow.ServiceEventList,
	transactionResult flow.TransactionResult,
)

func (*CollectionExecutionResult) ConvertedServiceEvents added in v0.31.0

func (c *CollectionExecutionResult) ConvertedServiceEvents() flow.ServiceEventList

func (*CollectionExecutionResult) Events added in v0.31.0

func (*CollectionExecutionResult) ExecutionSnapshot added in v0.31.0

func (c *CollectionExecutionResult) ExecutionSnapshot() *snapshot.ExecutionSnapshot

func (*CollectionExecutionResult) ServiceEventList added in v0.31.0

func (c *CollectionExecutionResult) ServiceEventList() flow.EventsList

func (*CollectionExecutionResult) TransactionResults added in v0.31.0

func (c *CollectionExecutionResult) TransactionResults() flow.TransactionResults

func (*CollectionExecutionResult) UpdateExecutionSnapshot added in v0.31.0

func (c *CollectionExecutionResult) UpdateExecutionSnapshot(
	executionSnapshot *snapshot.ExecutionSnapshot,
)

type ComputationResult

type ComputationResult struct {
	*BlockExecutionResult
	*BlockAttestationResult

	*flow.ExecutionReceipt
}

func NewEmptyComputationResult added in v0.28.7

func NewEmptyComputationResult(
	block *entity.ExecutableBlock,
) *ComputationResult

func (*ComputationResult) CurrentEndState added in v0.31.0

func (cr *ComputationResult) CurrentEndState() flow.StateCommitment

CurrentEndState returns the most recent end state if no attestation appended yet, it returns start state of block TODO(ramtin): we probably don't need this long term as part of this method

type ExecutedFinalizedWAL added in v0.33.1

type ExecutedFinalizedWAL interface {
	Append(height uint64, registers flow.RegisterEntries) error

	// Latest returns the latest height in the WAL.
	Latest() (uint64, error)

	GetReader(height uint64) WALReader
}

type ExtendableStorageSnapshot added in v0.33.1

type ExtendableStorageSnapshot interface {
	snapshot.StorageSnapshot
	Extend(newCommit flow.StateCommitment, updatedRegisters map[flow.RegisterID]flow.RegisterValue) ExtendableStorageSnapshot
	Commitment() flow.StateCommitment
}

type FinalizedReader added in v0.33.1

type FinalizedReader interface {
	// FinalizedBlockIDAtHeight returns the block ID of the finalized block at the given height.
	// It return storage.NotFound if the given height has not been finalized yet
	// any other error returned are exceptions
	FinalizedBlockIDAtHeight(height uint64) (flow.Identifier, error)
}

type InMemoryRegisterStore added in v0.33.1

type InMemoryRegisterStore interface {
	Prune(finalizedHeight uint64, finalizedBlockID flow.Identifier) error
	PrunedHeight() uint64

	// GetRegister will return the latest updated value of the given register since the pruned height.
	// It returns ErrPruned if the register is unknown or not updated since the pruned height
	// It returns exception if internal index is inconsistent
	GetRegister(height uint64, blockID flow.Identifier, register flow.RegisterID) (flow.RegisterValue, error)
	GetUpdatedRegisters(height uint64, blockID flow.Identifier) (flow.RegisterEntries, error)
	SaveRegisters(
		height uint64,
		blockID flow.Identifier,
		parentID flow.Identifier,
		registers flow.RegisterEntries,
	) error

	// IsBlockExecuted returns wheather the given block is executed.
	// It returns:
	// - (true, nil) if the block is above the pruned height and is executed
	// - (true, nil) if the block is the pruned block, since the prunded block are finalized and executed
	// - (false, nil) if the block is above the pruned height and is not executed
	// - (false, nil) if the block's height is the pruned height, but is different from the pruned block
	// - (false, exception) if the block is below the pruned height
	IsBlockExecuted(height uint64, blockID flow.Identifier) (bool, error)
}

see implementation in engine/execution/storehouse/in_memory_register_store.go

type OnDiskRegisterStore added in v0.33.1

type OnDiskRegisterStore = storage.RegisterIndex

type RegisterStore added in v0.33.1

type RegisterStore interface {
	// GetRegister first try to get the register from InMemoryRegisterStore, then OnDiskRegisterStore
	// It returns:
	//  - (value, nil) if the register value is found at the given block
	//  - (nil, nil) if the register is not found
	//  - (nil, storage.ErrHeightNotIndexed) if the height is below the first height that is indexed.
	//  - (nil, storehouse.ErrNotExecuted) if the block is not executed yet
	//  - (nil, storehouse.ErrNotExecuted) if the block is conflicting iwth finalized block
	//  - (nil, err) for any other exceptions
	GetRegister(height uint64, blockID flow.Identifier, register flow.RegisterID) (flow.RegisterValue, error)

	// SaveRegisters saves to InMemoryRegisterStore first, then trigger the same check as OnBlockFinalized
	// Depend on InMemoryRegisterStore.SaveRegisters
	// It returns:
	// - nil if the registers are saved successfully
	// - exception is the block is above the pruned height but does not connect to the pruned height (conflicting block).
	// - exception if the block is below the pruned height
	// - exception if the save block is saved again
	// - exception for any other exception
	SaveRegisters(header *flow.Header, registers flow.RegisterEntries) error

	// Depend on FinalizedReader's FinalizedBlockIDAtHeight
	// Depend on ExecutedFinalizedWAL.Append
	// Depend on OnDiskRegisterStore.SaveRegisters
	// OnBlockFinalized trigger the check of whether a block at the next height becomes finalized and executed.
	// Note: This is a blocking call
	// the next height is the existing finalized and executed block's height + 1.
	// If a block at next height becomes finalized and executed, then:
	// 1. write the registers to write ahead logs
	// 2. save the registers of the block to OnDiskRegisterStore
	// 3. prune the height in InMemoryRegisterStore
	// any error returned are exception
	OnBlockFinalized() error

	// LastFinalizedAndExecutedHeight returns the height of the last finalized and executed block,
	// which has been saved in OnDiskRegisterStore
	LastFinalizedAndExecutedHeight() uint64

	// IsBlockExecuted returns whether the given block is executed.
	// If a block is not executed, it does not distinguish whether the block exists or not.
	// It returns:
	// - (true, nil) if the block is executed, regardless of whether the registers of the block is pruned on disk or not
	// - (false, nil) if the block is not executed
	// - (false, exception) if running into any exception
	IsBlockExecuted(height uint64, blockID flow.Identifier) (bool, error)
}

RegisterStore is the interface for register store see implementation in engine/execution/storehouse/register_store.go

type RegisterStoreNotifier added in v0.33.1

type RegisterStoreNotifier interface {
	OnFinalizedAndExecutedHeightUpdated(height uint64)
}

RegisterStoreNotifier is the interface for register store to notify when a block is finalized and executed

type ScriptExecutor added in v0.32.0

type ScriptExecutor interface {

	// ExecuteScriptAtBlockID executes a script at the given Block id
	// it returns the value, the computation used and the error (if any)
	ExecuteScriptAtBlockID(ctx context.Context, script []byte, arguments [][]byte, blockID flow.Identifier) ([]byte, uint64, error)

	// GetAccount returns the Account details at the given Block id
	GetAccount(ctx context.Context, address flow.Address, blockID flow.Identifier) (*flow.Account, error)

	// GetRegisterAtBlockID returns the value of a register at the given Block id (if available)
	GetRegisterAtBlockID(ctx context.Context, owner, key []byte, blockID flow.Identifier) ([]byte, error)
}

ScriptExecutor represents the RPC calls that the execution script engine exposes to support the Access Node API calls

type WALReader added in v0.33.1

type WALReader interface {
	// Next returns the next height and trie updates in the WAL.
	// It returns EOF when there are no more entries.
	Next() (height uint64, registers flow.RegisterEntries, err error)
}

Jump to

Keyboard shortcuts

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