state

package
v0.27.6-block-uploads-... Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 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 LedgerGetRegister

func LedgerGetRegister(ldg ledger.Ledger, commitment flow.StateCommitment) delta.GetRegisterFunc

func RegisterIDSToKeys added in v0.10.0

func RegisterIDSToKeys(ids []flow.RegisterID) []ledger.Key

func RegisterIDToKey added in v0.10.0

func RegisterIDToKey(reg flow.RegisterID) ledger.Key

func RegisterValuesToValues added in v0.10.0

func RegisterValuesToValues(values []flow.RegisterValue) []ledger.Value

Types

type ExecutionState

type ExecutionState interface {
	ReadOnlyExecutionState

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

	SaveExecutionResults(ctx context.Context, header *flow.Header, endState flow.StateCommitment,
		chunkDataPacks []*flow.ChunkDataPack,
		executionReceipt *flow.ExecutionReceipt, events []flow.EventsList, serviceEvents flow.EventsList, results []flow.TransactionResult) 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 ReadOnlyExecutionState

type ReadOnlyExecutionState interface {
	// NewView creates a new ready-only view at the given state commitment.
	NewView(flow.StateCommitment) *delta.View

	GetRegisters(
		context.Context,
		flow.StateCommitment,
		[]flow.RegisterID,
	) ([]flow.RegisterValue, error)

	GetProof(
		context.Context,
		flow.StateCommitment,
		[]flow.RegisterID,
	) (flow.StorageProof, error)

	// 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(context.Context, flow.Identifier) (*flow.ChunkDataPack, error)

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

	RetrieveStateDelta(context.Context, flow.Identifier) (*messages.ExecutionStateDelta, error)

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

	GetCollection(identifier flow.Identifier) (*flow.Collection, 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 {
	RegisterUpdates() ([]flow.RegisterID, []flow.RegisterValue)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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