state

package
v0.30.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: AGPL-3.0 Imports: 15 Imported by: 14

Documentation

Index

Constants

View Source
const (
	KeyPartOwner = uint16(0)
	// @deprecated - controller was used only by the very first
	// version of cadence for access controll which was retired later on
	// KeyPartController = uint16(1)
	KeyPartKey = uint16(2)
)

Variables

This section is empty.

Functions

func IsBlockExecuted added in v0.11.0

func IsBlockExecuted(ctx context.Context, state ReadOnlyExecutionState, block flow.Identifier) (bool, error)

IsBlockExecuted returns whether the block has been executed. it checks whether the state commitment exists in execution state.

func NewLedgerStorageSnapshot added in v0.30.0

func NewLedgerStorageSnapshot(
	ldg ledger.Ledger,
	commitment flow.StateCommitment,
) fvmState.StorageSnapshot

func RegisterEntriesToKeysValues added in v0.30.0

func RegisterEntriesToKeysValues(
	entries flow.RegisterEntries,
) (
	[]ledger.Key,
	[]ledger.Value,
)

func RegisterIDToKey added in v0.10.0

func RegisterIDToKey(reg flow.RegisterID) ledger.Key

Types

type ExecutionState

type ExecutionState interface {
	ReadOnlyExecutionState

	UpdateHighestExecutedBlockIfHigher(context.Context, *flow.Header) error

	SaveExecutionResults(
		ctx context.Context,
		result *execution.ComputationResult,
	) 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,
	collections storage.Collections,
	chunkDataPacks storage.ChunkDataPacks,
	results storage.ExecutionResults,
	myReceipts storage.MyExecutionReceipts,
	events storage.Events,
	serviceEvents storage.ServiceEvents,
	transactionResults storage.TransactionResults,
	db *badger.DB,
	tracer module.Tracer,
) ExecutionState

NewExecutionState returns a new execution state access layer for the given ledger storage.

type LedgerStorageSnapshot added in v0.30.0

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

TODO(patrick): revisit caching. readCache needs to be mutex guarded for parallel execution.

func (*LedgerStorageSnapshot) Get added in v0.30.0

func (storage *LedgerStorageSnapshot) Get(
	id flow.RegisterID,
) (
	flow.RegisterValue,
	error,
)

type ReadOnlyExecutionState

type ReadOnlyExecutionState interface {
	// NewStorageSnapshot creates a new ready-only view at the given state commitment.
	NewStorageSnapshot(flow.StateCommitment) fvmState.StorageSnapshot

	// StateCommitmentByBlockID returns the final state commitment for the provided block ID.
	StateCommitmentByBlockID(context.Context, flow.Identifier) (flow.StateCommitment, error)

	// HasState returns true if the state with the given state commitment exists in memory
	HasState(flow.StateCommitment) bool

	// ChunkDataPackByChunkID retrieve a chunk data pack given the chunk ID.
	ChunkDataPackByChunkID(flow.Identifier) (*flow.ChunkDataPack, error)

	GetExecutionResultID(context.Context, flow.Identifier) (flow.Identifier, error)

	GetHighestExecutedBlockID(context.Context) (uint64, flow.Identifier, error)

	GetBlockIDByChunkID(chunkID flow.Identifier) (flow.Identifier, error)
}

ReadOnlyExecutionState allows to read the execution state

type RegisterUpdatesHolder added in v0.16.0

type RegisterUpdatesHolder interface {
	UpdatedRegisters() flow.RegisterEntries
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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