Documentation
¶
Index ¶
- Variables
- func CommitDelta(ldg ledger.Ledger, ruh RegisterUpdatesHolder, ...) (flow.StateCommitment, *ledger.TrieUpdate, execution.ExtendableStorageSnapshot, ...)
- func IsParentExecuted(state ReadOnlyExecutionState, header *flow.Header) (bool, error)
- func NewLedgerStorageSnapshot(ldg ledger.Ledger, commitment flow.StateCommitment) snapshot.StorageSnapshot
- func RegisterEntriesToKeysValues(entries flow.RegisterEntries) ([]ledger.Key, []ledger.Value)
- type ExecutionState
- type FinalizedExecutionState
- type LedgerStorageSnapshot
- type ReadOnlyExecutionState
- type RegisterUpdatesHolder
- type ScriptExecutionState
Constants ¶
This section is empty.
Variables ¶
var ErrExecutionStatePruned = fmt.Errorf("execution state is pruned")
var ErrNotExecuted = fmt.Errorf("block not executed")
Functions ¶
func CommitDelta ¶
func CommitDelta( ldg ledger.Ledger, ruh RegisterUpdatesHolder, baseStorageSnapshot execution.ExtendableStorageSnapshot, ) (flow.StateCommitment, *ledger.TrieUpdate, execution.ExtendableStorageSnapshot, error)
CommitDelta takes a base storage snapshot and creates a new storage snapshot with the register updates from the given RegisterUpdatesHolder a new statecommitment is returned from the ledger, along with the trie update any error returned are exceptions
func IsParentExecuted ¶ added in v0.33.1
func IsParentExecuted(state ReadOnlyExecutionState, header *flow.Header) (bool, error)
func NewLedgerStorageSnapshot ¶ added in v0.30.0
func NewLedgerStorageSnapshot( ldg ledger.Ledger, commitment flow.StateCommitment, ) snapshot.StorageSnapshot
func RegisterEntriesToKeysValues ¶ added in v0.30.0
Types ¶
type ExecutionState ¶
type ExecutionState interface { ReadOnlyExecutionState UpdateLastExecutedBlock(context.Context, flow.Identifier) error SaveExecutionResults( ctx context.Context, result *execution.ComputationResult, ) error // only available with storehouse enabled // panic when called with storehouse disabled (which should be a bug) GetHighestFinalizedExecuted() (uint64, error) }
ExecutionState is an interface used to access and mutate the execution state of the blockchain.
func NewExecutionState ¶
func NewExecutionState( ls ledger.Ledger, commits storage.Commits, blocks storage.Blocks, headers storage.Headers, chunkDataPacks storage.ChunkDataPacks, results storage.ExecutionResults, myReceipts storage.MyExecutionReceipts, events storage.Events, serviceEvents storage.ServiceEvents, transactionResults storage.TransactionResults, db storage.DB, getLatestFinalized func() (uint64, error), tracer module.Tracer, registerStore execution.RegisterStore, enableRegisterStore bool, ) ExecutionState
NewExecutionState returns a new execution state access layer for the given ledger storage.
type FinalizedExecutionState ¶ added in v0.33.1
FinalizedExecutionState is an interface used to access the finalized execution state
type LedgerStorageSnapshot ¶ added in v0.30.0
type LedgerStorageSnapshot struct {
// contains filtered or unexported fields
}
func (*LedgerStorageSnapshot) Get ¶ added in v0.30.0
func (storage *LedgerStorageSnapshot) Get( id flow.RegisterID, ) ( flow.RegisterValue, error, )
type ReadOnlyExecutionState ¶
type ReadOnlyExecutionState interface { ScriptExecutionState // ChunkDataPackByChunkID retrieve a chunk data pack given the chunk ID. ChunkDataPackByChunkID(flow.Identifier) (*flow.ChunkDataPack, error) GetExecutionResultID(context.Context, flow.Identifier) (flow.Identifier, error) GetLastExecutedBlockID(context.Context) (uint64, flow.Identifier, error) }
ReadOnlyExecutionState allows to read the execution state
type RegisterUpdatesHolder ¶ added in v0.16.0
type RegisterUpdatesHolder interface { UpdatedRegisters() flow.RegisterEntries UpdatedRegisterSet() map[flow.RegisterID]flow.RegisterValue }
type ScriptExecutionState ¶ added in v0.32.0
type ScriptExecutionState interface { // NewStorageSnapshot creates a new ready-only view at the given block. NewStorageSnapshot(commit flow.StateCommitment, blockID flow.Identifier, height uint64) snapshot.StorageSnapshot // CreateStorageSnapshot creates a new ready-only view at the given block. // It returns: // - (nil, nil, storage.ErrNotFound) if block is unknown // - (nil, nil, state.ErrNotExecuted) if block is not executed // - (nil, nil, state.ErrExecutionStatePruned) if the execution state has been pruned CreateStorageSnapshot(blockID flow.Identifier) (snapshot.StorageSnapshot, *flow.Header, error) // StateCommitmentByBlockID returns the final state commitment for the provided block ID. StateCommitmentByBlockID(flow.Identifier) (flow.StateCommitment, error) // Any error returned is exception IsBlockExecuted(height uint64, blockID flow.Identifier) (bool, error) }
ScriptExecutionState is a subset of the `state.ExecutionState` interface purposed to only access the state used for script execution and not mutate the execution state of the blockchain.