Documentation ¶
Index ¶
- Constants
- Variables
- func GetExecutionEffortWeights(env environment.Environment, service common.Address) (computationWeights meter.ExecutionEffortWeights, err error)
- func GetExecutionMemoryLimit(env environment.Environment, service common.Address) (memoryLimit uint64, err error)
- func GetExecutionMemoryWeights(env environment.Environment, service common.Address) (memoryWeights meter.ExecutionMemoryWeights, err error)
- func ProcedureStateParameters(ctx Context, proc Procedure) state.StateParameters
- func Run(executor ProcedureExecutor) error
- type BootstrapAccountKeys
- type BootstrapParams
- type BootstrapProcedure
- func (proc *BootstrapProcedure) ComputationLimit(_ Context) uint64
- func (proc *BootstrapProcedure) ExecutionTime() logical.Time
- func (proc *BootstrapProcedure) MemoryLimit(_ Context) uint64
- func (b *BootstrapProcedure) NewExecutor(ctx Context, txnState storage.TransactionPreparer) ProcedureExecutor
- func (proc *BootstrapProcedure) ShouldDisableMemoryAndInteractionLimits(_ Context) bool
- func (BootstrapProcedure) Type() ProcedureType
- type BootstrapProcedureFeeParameters
- type BootstrapProcedureOption
- func WithAccountCreationFee(fee cadence.UFix64) BootstrapProcedureOption
- func WithBootstrapAccountKeys(keys BootstrapAccountKeys) BootstrapProcedureOption
- func WithEpochConfig(epochConfig epochs.EpochConfig) BootstrapProcedureOption
- func WithExecutionEffortWeights(weights meter.ExecutionEffortWeights) BootstrapProcedureOption
- func WithExecutionMemoryLimit(limit uint64) BootstrapProcedureOption
- func WithExecutionMemoryWeights(weights meter.ExecutionMemoryWeights) BootstrapProcedureOption
- func WithIdentities(identities flow.IdentityList) BootstrapProcedureOption
- func WithInitialTokenSupply(supply cadence.UFix64) BootstrapProcedureOption
- func WithMinimumStorageReservation(reservation cadence.UFix64) BootstrapProcedureOption
- func WithRestrictedAccountCreationEnabled(enabled cadence.Bool) BootstrapProcedureOption
- func WithRestrictedContractDeployment(restricted *bool) BootstrapProcedureOption
- func WithRootBlock(rootBlock *flow.Header) BootstrapProcedureOption
- func WithSetupEVMEnabled(enabled cadence.Bool) BootstrapProcedureOption
- func WithStorageMBPerFLOW(ratio cadence.UFix64) BootstrapProcedureOption
- func WithTransactionFee(fees BootstrapProcedureFeeParameters) BootstrapProcedureOption
- type Context
- type MeterParamOverridesComputer
- type Option
- func WithAccountKeyWeightThreshold(threshold int) Option
- func WithAccountStorageLimit(enabled bool) Option
- func WithAllowProgramCacheWritesInScriptsEnabled(enabled bool) Option
- func WithAuthorizationChecksEnabled(enabled bool) Option
- func WithBlockHeader(header *flow.Header) Option
- func WithBlocks(blocks environment.Blocks) Option
- func WithCadenceLogging(enabled bool) Option
- func WithChain(chain flow.Chain) Option
- func WithComputationLimit(limit uint64) Option
- func WithContractDeploymentRestricted(enabled bool) Option
- func WithContractRemovalRestricted(enabled bool) Option
- func WithDerivedBlockData(derivedBlockData *derived.DerivedBlockData) Option
- func WithEVMEnabled(enabled bool) Option
- func WithEVMTracer(tracer debug.EVMTracer) Option
- func WithEntropyProvider(source environment.EntropyProvider) Option
- func WithEventCollectionSizeLimit(limit uint64) Option
- func WithEventEncoder(encoder environment.EventEncoder) Option
- func WithExtensiveTracing() Option
- func WithGasLimit(limit uint64) Option
- func WithLogger(logger zerolog.Logger) Option
- func WithMaxStateInteractionSize(limit uint64) Option
- func WithMaxStateKeySize(limit uint64) Option
- func WithMaxStateValueSize(limit uint64) Option
- func WithMemoryAndInteractionLimitsDisabled() Option
- func WithMemoryLimit(limit uint64) Option
- func WithMetricsReporter(mr environment.MetricsReporter) Option
- func WithRandomSourceHistoryCallAllowed(allowed bool) Option
- func WithReusableCadenceRuntimePool(pool reusableRuntime.ReusableCadenceRuntimePool) Option
- func WithSequenceNumberCheckAndIncrementEnabled(enabled bool) Option
- func WithServiceAccount(enabled bool) Option
- func WithSpan(span otelTrace.Span) Option
- func WithTracer(tr module.Tracer) Option
- func WithTransactionBodyExecutionEnabled(enabled bool) Option
- func WithTransactionFeesEnabled(enabled bool) Option
- type Procedure
- type ProcedureExecutor
- type ProcedureOutput
- type ProcedureType
- type ScriptProcedure
- func (proc *ScriptProcedure) ComputationLimit(ctx Context) uint64
- func (proc *ScriptProcedure) ExecutionTime() logical.Time
- func (proc *ScriptProcedure) MemoryLimit(ctx Context) uint64
- func (proc *ScriptProcedure) NewExecutor(ctx Context, txnState storage.TransactionPreparer) ProcedureExecutor
- func (proc *ScriptProcedure) ShouldDisableMemoryAndInteractionLimits(ctx Context) bool
- func (ScriptProcedure) Type() ProcedureType
- func (proc *ScriptProcedure) WithArguments(args ...[]byte) *ScriptProcedure
- func (proc *ScriptProcedure) WithRequestContext(reqContext context.Context) *ScriptProcedure
- type TransactionExecutorParams
- type TransactionPayerBalanceChecker
- type TransactionProcedure
- func (proc *TransactionProcedure) ComputationLimit(ctx Context) uint64
- func (proc *TransactionProcedure) ExecutionTime() logical.Time
- func (proc *TransactionProcedure) MemoryLimit(ctx Context) uint64
- func (proc *TransactionProcedure) NewExecutor(ctx Context, txnState storage.TransactionPreparer) ProcedureExecutor
- func (proc *TransactionProcedure) ShouldDisableMemoryAndInteractionLimits(ctx Context) bool
- func (TransactionProcedure) Type() ProcedureType
- type TransactionSequenceNumberChecker
- type TransactionStorageLimiter
- type TransactionVerifier
- type VM
- type VirtualMachine
- func (vm *VirtualMachine) GetAccount(ctx Context, address flow.Address, storageSnapshot snapshot.StorageSnapshot) (*flow.Account, error)
- func (vm *VirtualMachine) NewExecutor(ctx Context, proc Procedure, txn storage.TransactionPreparer) ProcedureExecutor
- func (vm *VirtualMachine) Run(ctx Context, proc Procedure, storageSnapshot snapshot.StorageSnapshot) (*snapshot.ExecutionSnapshot, ProcedureOutput, error)
Constants ¶
const ( AccountKeyWeightThreshold = 1000 DefaultComputationLimit = 100_000 // 100K DefaultMemoryLimit = math.MaxUint64 DefaultMaxInteractionSize = 20_000_000 // ~20MB )
const ( BootstrapProcedureType = ProcedureType("bootstrap") TransactionProcedureType = ProcedureType("transaction") ScriptProcedureType = ProcedureType("script") )
const VerifyPayerBalanceResultTypeCanExecuteTransactionFieldName = "canExecuteTransaction"
const VerifyPayerBalanceResultTypeMaximumTransactionFeesFieldName = "maximumTransactionFees"
const VerifyPayerBalanceResultTypeRequiredBalanceFieldName = "requiredBalance"
Variables ¶
var ( DefaultAccountCreationFee = mustParseUFix64( "account creation fee", "0.00100000") DefaultMinimumStorageReservation = mustParseUFix64( "minimum storage reservation", "0.00100000") DefaultStorageMBPerFLOW = mustParseUFix64( "storage mb per flow", "100.00000000") // DefaultTransactionFees are the default transaction fee parameters if // transaction fees are on. Surge factor is 1.0, inclusion effort cost is // 0.0001 (because the static inclusion effort is 1.0) and execution effort // cost is 0.0 because dynamic execution fees are off. If they are off // (which is the default behaviour) that means the transaction fees are 0.0. DefaultTransactionFees = BootstrapProcedureFeeParameters{ SurgeFactor: mustParseUFix64("fee surge factor", "1.0"), InclusionEffortCost: mustParseUFix64( "fee inclusion effort cost", "0.00001"), ExecutionEffortCost: mustParseUFix64( "fee execution effort cost", "0.0"), } // DefaultVersionFreezePeriod is the default NodeVersionBeacon freeze period - // the number of blocks in the future where the version changes are frozen. DefaultVersionFreezePeriod = cadence.UInt64(1000) )
var VerifyPayerBalanceResultType = &cadence.StructType{ Fields: []cadence.Field{ { Identifier: VerifyPayerBalanceResultTypeCanExecuteTransactionFieldName, Type: cadence.BoolType, }, { Identifier: VerifyPayerBalanceResultTypeRequiredBalanceFieldName, Type: cadence.UFix64Type, }, { Identifier: VerifyPayerBalanceResultTypeMaximumTransactionFeesFieldName, Type: cadence.UFix64Type, }, }, }
Functions ¶
func GetExecutionEffortWeights ¶ added in v0.27.0
func GetExecutionEffortWeights( env environment.Environment, service common.Address, ) ( computationWeights meter.ExecutionEffortWeights, err error, )
GetExecutionEffortWeights reads stored execution effort weights from the service account
func GetExecutionMemoryLimit ¶ added in v0.27.0
func GetExecutionMemoryLimit( env environment.Environment, service common.Address, ) ( memoryLimit uint64, err error, )
GetExecutionMemoryLimit reads the stored execution memory limit from the service account
func GetExecutionMemoryWeights ¶ added in v0.27.0
func GetExecutionMemoryWeights( env environment.Environment, service common.Address, ) ( memoryWeights meter.ExecutionMemoryWeights, err error, )
GetExecutionMemoryWeights reads stored execution memory weights from the service account
func ProcedureStateParameters ¶ added in v0.31.0
func ProcedureStateParameters( ctx Context, proc Procedure, ) state.StateParameters
func Run ¶ added in v0.29.0
func Run(executor ProcedureExecutor) error
Types ¶
type BootstrapAccountKeys ¶ added in v0.27.0
type BootstrapAccountKeys struct { ServiceAccountPublicKeys []flow.AccountPublicKey FungibleTokenAccountPublicKeys []flow.AccountPublicKey FlowTokenAccountPublicKeys []flow.AccountPublicKey FlowFeesAccountPublicKeys []flow.AccountPublicKey NodeAccountPublicKeys []flow.AccountPublicKey }
type BootstrapParams ¶ added in v0.29.0
type BootstrapParams struct {
// contains filtered or unexported fields
}
type BootstrapProcedure ¶
type BootstrapProcedure struct {
BootstrapParams
}
A BootstrapProcedure is an invokable that can be used to bootstrap the ledger state with the default accounts and contracts required by the Flow virtual machine.
func Bootstrap ¶
func Bootstrap( serviceAccountPublicKey flow.AccountPublicKey, opts ...BootstrapProcedureOption, ) *BootstrapProcedure
Bootstrap returns a new BootstrapProcedure instance configured with the provided genesis parameters.
func (*BootstrapProcedure) ComputationLimit ¶ added in v0.25.2
func (proc *BootstrapProcedure) ComputationLimit(_ Context) uint64
func (*BootstrapProcedure) ExecutionTime ¶ added in v0.28.0
func (proc *BootstrapProcedure) ExecutionTime() logical.Time
func (*BootstrapProcedure) MemoryLimit ¶ added in v0.25.2
func (proc *BootstrapProcedure) MemoryLimit(_ Context) uint64
func (*BootstrapProcedure) NewExecutor ¶ added in v0.29.0
func (b *BootstrapProcedure) NewExecutor( ctx Context, txnState storage.TransactionPreparer, ) ProcedureExecutor
func (*BootstrapProcedure) ShouldDisableMemoryAndInteractionLimits ¶ added in v0.28.0
func (proc *BootstrapProcedure) ShouldDisableMemoryAndInteractionLimits(_ Context) bool
func (BootstrapProcedure) Type ¶ added in v0.28.0
func (BootstrapProcedure) Type() ProcedureType
type BootstrapProcedureFeeParameters ¶ added in v0.25.2
type BootstrapProcedureOption ¶ added in v0.14.0
type BootstrapProcedureOption func(*BootstrapProcedure) *BootstrapProcedure
func WithAccountCreationFee ¶ added in v0.14.0
func WithAccountCreationFee(fee cadence.UFix64) BootstrapProcedureOption
func WithBootstrapAccountKeys ¶ added in v0.27.0
func WithBootstrapAccountKeys(keys BootstrapAccountKeys) BootstrapProcedureOption
WithBootstrapAccountKeys sets the public keys of the accounts that will be created during bootstrapping by default all accounts are created with the ServiceAccountPublicKey specified when calling `Bootstrap`.
func WithEpochConfig ¶ added in v0.20.0
func WithEpochConfig(epochConfig epochs.EpochConfig) BootstrapProcedureOption
func WithExecutionEffortWeights ¶ added in v0.25.5
func WithExecutionEffortWeights(weights meter.ExecutionEffortWeights) BootstrapProcedureOption
func WithExecutionMemoryLimit ¶ added in v0.26.2
func WithExecutionMemoryLimit(limit uint64) BootstrapProcedureOption
func WithExecutionMemoryWeights ¶ added in v0.26.0
func WithExecutionMemoryWeights(weights meter.ExecutionMemoryWeights) BootstrapProcedureOption
func WithIdentities ¶ added in v0.20.0
func WithIdentities(identities flow.IdentityList) BootstrapProcedureOption
func WithInitialTokenSupply ¶ added in v0.14.0
func WithInitialTokenSupply(supply cadence.UFix64) BootstrapProcedureOption
func WithMinimumStorageReservation ¶ added in v0.14.0
func WithMinimumStorageReservation(reservation cadence.UFix64) BootstrapProcedureOption
func WithRestrictedAccountCreationEnabled ¶ added in v0.17.6
func WithRestrictedAccountCreationEnabled(enabled cadence.Bool) BootstrapProcedureOption
func WithRestrictedContractDeployment ¶ added in v0.26.0
func WithRestrictedContractDeployment(restricted *bool) BootstrapProcedureOption
func WithRootBlock ¶ added in v0.20.0
func WithRootBlock(rootBlock *flow.Header) BootstrapProcedureOption
func WithSetupEVMEnabled ¶ added in v0.33.1
func WithSetupEVMEnabled(enabled cadence.Bool) BootstrapProcedureOption
func WithStorageMBPerFLOW ¶ added in v0.16.1
func WithStorageMBPerFLOW(ratio cadence.UFix64) BootstrapProcedureOption
func WithTransactionFee ¶ added in v0.14.0
func WithTransactionFee(fees BootstrapProcedureFeeParameters) BootstrapProcedureOption
type Context ¶
type Context struct { // DisableMemoryAndInteractionLimits will override memory and interaction // limits and set them to MaxUint64, effectively disabling these limits. DisableMemoryAndInteractionLimits bool EVMEnabled bool ComputationLimit uint64 MemoryLimit uint64 MaxStateKeySize uint64 MaxStateValueSize uint64 MaxStateInteractionSize uint64 TransactionExecutorParams DerivedBlockData *derived.DerivedBlockData tracing.TracerSpan environment.EnvironmentParams // AllowProgramCacheWritesInScripts determines if the program cache can be written to in scripts // By default, the program cache is only updated by transactions. AllowProgramCacheWritesInScripts bool debug.EVMTracer }
A Context defines a set of execution parameters used by the virtual machine.
func NewContext ¶
NewContext initializes a new execution context with the provided options.
func NewContextFromParent ¶
NewContextFromParent spawns a child execution context with the provided options.
type MeterParamOverridesComputer ¶ added in v0.29.0
type MeterParamOverridesComputer struct {
// contains filtered or unexported fields
}
func NewMeterParamOverridesComputer ¶ added in v0.29.0
func NewMeterParamOverridesComputer( ctx Context, txnState storage.TransactionPreparer, ) MeterParamOverridesComputer
func (MeterParamOverridesComputer) Compute ¶ added in v0.29.0
func (computer MeterParamOverridesComputer) Compute( _ state.NestedTransactionPreparer, _ struct{}, ) ( derived.MeterParamOverrides, error, )
type Option ¶
An Option sets a configuration parameter for a virtual machine context.
func WithAccountKeyWeightThreshold ¶ added in v0.29.0
WithAccountKeyWeightThreshold sets the key weight threshold used for authorization checks. If the threshold is a negative number, signature verification is skipped.
Note: This is set only by tests
func WithAccountStorageLimit ¶ added in v0.14.0
WithAccountStorageLimit enables or disables checking if account storage used is over its storage capacity
func WithAllowProgramCacheWritesInScriptsEnabled ¶ added in v0.33.19
WithAllowProgramCacheWritesInScriptsEnabled enables caching of programs accessed by scripts
func WithAuthorizationChecksEnabled ¶ added in v0.29.0
WithAuthorizationCheckxEnabled enables or disables pre-execution authorization checks.
func WithBlockHeader ¶
WithBlockHeader sets the block header for a virtual machine context.
The VM uses the header to provide current block information to the Cadence runtime.
func WithBlocks ¶
func WithBlocks(blocks environment.Blocks) Option
WithBlocks sets the block storage provider for a virtual machine context.
The VM uses the block storage provider to provide historical block information to the Cadence runtime.
func WithCadenceLogging ¶ added in v0.13.1
WithCadenceLogging enables or disables Cadence logging for a virtual machine context.
func WithComputationLimit ¶ added in v0.25.2
WithComputationLimit sets the computation limit for a virtual machine context.
func WithContractDeploymentRestricted ¶ added in v0.27.0
WithRestrictedContractDeployment enables or disables restricted contract deployment for a virtual machine context. Warning! this would be overridden with the flag stored on chain. this is just a fallback value
func WithContractRemovalRestricted ¶ added in v0.27.0
WithRestrictContractRemoval enables or disables restricted contract removal for a virtual machine context. Warning! this would be overridden with the flag stored on chain. this is just a fallback value
func WithDerivedBlockData ¶ added in v0.29.0
func WithDerivedBlockData(derivedBlockData *derived.DerivedBlockData) Option
WithDerivedBlockData sets the derived data cache storage to be used by the transaction/script.
func WithEVMEnabled ¶ added in v0.33.1
WithEVMEnabled enables access to the evm environment
func WithEVMTracer ¶ added in v0.33.30
WithEVMTracer will set the evm execution tracer
func WithEntropyProvider ¶ added in v0.32.0
func WithEntropyProvider(source environment.EntropyProvider) Option
WithEntropyProvider sets the entropy provider of a virtual machine context.
The VM uses the input to provide entropy to the Cadence runtime randomness functions.
func WithEventCollectionSizeLimit ¶ added in v0.13.1
WithEventCollectionSizeLimit sets the event collection byte size limit for a virtual machine context.
func WithEventEncoder ¶ added in v0.29.0
func WithEventEncoder(encoder environment.EventEncoder) Option
WithEventEncoder sets events encoder to be used for encoding events emitted during execution
func WithExtensiveTracing ¶ added in v0.16.0
func WithExtensiveTracing() Option
WithExtensiveTracing sets the extensive tracing
func WithGasLimit ¶
WithGasLimit sets the computation limit for a virtual machine context. @depricated, please use WithComputationLimit instead.
func WithLogger ¶ added in v0.28.0
WithLogger sets the context logger
func WithMaxStateInteractionSize ¶ added in v0.14.0
WithMaxStateInteractionSize sets the byte size limit for total interaction with ledger. this prevents attacks such as reading all large registers
func WithMaxStateKeySize ¶ added in v0.14.0
WithMaxStateKeySize sets the byte size limit for ledger keys
func WithMaxStateValueSize ¶ added in v0.14.0
WithMaxStateValueSize sets the byte size limit for ledger values
func WithMemoryAndInteractionLimitsDisabled ¶ added in v0.28.0
func WithMemoryAndInteractionLimitsDisabled() Option
WithMemoryAndInteractionLimitsDisabled will override memory and interaction limits and set them to MaxUint64, effectively disabling these limits.
func WithMemoryLimit ¶ added in v0.25.2
WithMemoryLimit sets the memory limit for a virtual machine context.
func WithMetricsReporter ¶ added in v0.17.6
func WithMetricsReporter(mr environment.MetricsReporter) Option
WithMetricsReporter sets the metrics collector for a virtual machine context.
A metrics collector is used to gather metrics reported by the Cadence runtime.
func WithRandomSourceHistoryCallAllowed ¶ added in v0.32.2
WithRandomSourceHistoryCallAllowed enables or disables calling the `entropy` function within cadence
func WithReusableCadenceRuntimePool ¶ added in v0.28.0
func WithReusableCadenceRuntimePool( pool reusableRuntime.ReusableCadenceRuntimePool, ) Option
WithReusableCadenceRuntimePool set the (shared) RedusableCadenceRuntimePool use for creating the cadence runtime.
func WithSequenceNumberCheckAndIncrementEnabled ¶ added in v0.29.0
WithSequenceNumberCheckAndIncrementEnabled enables or disables pre-execution sequence number check / increment.
func WithServiceAccount ¶
WithServiceAccount enables or disables calls to the Flow service account.
func WithTracer ¶ added in v0.14.5
WithTracer sets the tracer for a virtual machine context.
func WithTransactionBodyExecutionEnabled ¶ added in v0.29.0
WithTransactionBodyExecutionEnabled enables or disables the transaction body execution.
Note: This is disabled only by tests
func WithTransactionFeesEnabled ¶ added in v0.17.1
WithTransactionFeesEnabled enables or disables deduction of transaction fees
type Procedure ¶
type Procedure interface { NewExecutor( ctx Context, txnState storage.TransactionPreparer, ) ProcedureExecutor ComputationLimit(ctx Context) uint64 MemoryLimit(ctx Context) uint64 ShouldDisableMemoryAndInteractionLimits(ctx Context) bool Type() ProcedureType // For transactions, the execution time is TxIndex. For scripts, the // execution time is EndOfBlockExecutionTime. ExecutionTime() logical.Time }
An Procedure is an operation (or set of operations) that reads or writes ledger state.
type ProcedureExecutor ¶ added in v0.29.0
type ProcedureExecutor interface { Preprocess() error Execute() error Cleanup() Output() ProcedureOutput }
type ProcedureOutput ¶ added in v0.30.0
type ProcedureOutput struct { // Output by both transaction and script. Logs []string Events flow.EventsList ServiceEvents flow.EventsList ConvertedServiceEvents flow.ServiceEventList ComputationUsed uint64 ComputationIntensities meter.MeteredComputationIntensities MemoryEstimate uint64 Err errors.CodedError // Output only by script. Value cadence.Value }
func (*ProcedureOutput) PopulateEnvironmentValues ¶ added in v0.30.0
func (output *ProcedureOutput) PopulateEnvironmentValues( env environment.Environment, ) error
type ProcedureType ¶ added in v0.28.0
type ProcedureType string
type ScriptProcedure ¶
type ScriptProcedure struct { ID flow.Identifier Script []byte Arguments [][]byte RequestContext context.Context }
func NewScriptWithContextAndArgs ¶ added in v0.26.0
func NewScriptWithContextAndArgs( code []byte, reqContext context.Context, args ...[]byte, ) *ScriptProcedure
func Script ¶
func Script(code []byte) *ScriptProcedure
func (*ScriptProcedure) ComputationLimit ¶ added in v0.25.2
func (proc *ScriptProcedure) ComputationLimit(ctx Context) uint64
func (*ScriptProcedure) ExecutionTime ¶ added in v0.28.0
func (proc *ScriptProcedure) ExecutionTime() logical.Time
func (*ScriptProcedure) MemoryLimit ¶ added in v0.25.2
func (proc *ScriptProcedure) MemoryLimit(ctx Context) uint64
func (*ScriptProcedure) NewExecutor ¶ added in v0.29.0
func (proc *ScriptProcedure) NewExecutor( ctx Context, txnState storage.TransactionPreparer, ) ProcedureExecutor
func (*ScriptProcedure) ShouldDisableMemoryAndInteractionLimits ¶ added in v0.28.0
func (proc *ScriptProcedure) ShouldDisableMemoryAndInteractionLimits( ctx Context, ) bool
func (ScriptProcedure) Type ¶ added in v0.28.0
func (ScriptProcedure) Type() ProcedureType
func (*ScriptProcedure) WithArguments ¶
func (proc *ScriptProcedure) WithArguments(args ...[]byte) *ScriptProcedure
func (*ScriptProcedure) WithRequestContext ¶ added in v0.26.0
func (proc *ScriptProcedure) WithRequestContext( reqContext context.Context, ) *ScriptProcedure
type TransactionExecutorParams ¶ added in v0.29.0
type TransactionExecutorParams struct { AuthorizationChecksEnabled bool SequenceNumberCheckAndIncrementEnabled bool // If AccountKeyWeightThreshold is set to a negative number, signature // verification is skipped during authorization checks. // // Note: This is set only by tests AccountKeyWeightThreshold int // Note: This is disabled only by tests TransactionBodyExecutionEnabled bool }
func DefaultTransactionExecutorParams ¶ added in v0.29.0
func DefaultTransactionExecutorParams() TransactionExecutorParams
type TransactionPayerBalanceChecker ¶ added in v0.29.0
type TransactionPayerBalanceChecker struct{}
func (TransactionPayerBalanceChecker) CheckPayerBalanceAndReturnMaxFees ¶ added in v0.29.0
func (_ TransactionPayerBalanceChecker) CheckPayerBalanceAndReturnMaxFees( proc *TransactionProcedure, txnState storage.TransactionPreparer, env environment.Environment, ) (uint64, error)
type TransactionProcedure ¶
type TransactionProcedure struct { ID flow.Identifier Transaction *flow.TransactionBody TxIndex uint32 }
func NewTransaction ¶ added in v0.30.0
func NewTransaction( txnId flow.Identifier, txnIndex uint32, txnBody *flow.TransactionBody, ) *TransactionProcedure
func Transaction ¶
func Transaction( txn *flow.TransactionBody, txnIndex uint32, ) *TransactionProcedure
func (*TransactionProcedure) ComputationLimit ¶ added in v0.25.2
func (proc *TransactionProcedure) ComputationLimit(ctx Context) uint64
func (*TransactionProcedure) ExecutionTime ¶ added in v0.28.0
func (proc *TransactionProcedure) ExecutionTime() logical.Time
func (*TransactionProcedure) MemoryLimit ¶ added in v0.25.2
func (proc *TransactionProcedure) MemoryLimit(ctx Context) uint64
func (*TransactionProcedure) NewExecutor ¶ added in v0.29.0
func (proc *TransactionProcedure) NewExecutor( ctx Context, txnState storage.TransactionPreparer, ) ProcedureExecutor
func (*TransactionProcedure) ShouldDisableMemoryAndInteractionLimits ¶ added in v0.28.0
func (proc *TransactionProcedure) ShouldDisableMemoryAndInteractionLimits( ctx Context, ) bool
func (TransactionProcedure) Type ¶ added in v0.28.0
func (TransactionProcedure) Type() ProcedureType
type TransactionSequenceNumberChecker ¶
type TransactionSequenceNumberChecker struct{}
func (TransactionSequenceNumberChecker) CheckAndIncrementSequenceNumber ¶ added in v0.29.0
func (c TransactionSequenceNumberChecker) CheckAndIncrementSequenceNumber( tracer tracing.TracerSpan, proc *TransactionProcedure, txnState storage.TransactionPreparer, ) error
type TransactionStorageLimiter ¶ added in v0.14.0
type TransactionStorageLimiter struct{}
func (TransactionStorageLimiter) CheckStorageLimits ¶ added in v0.29.0
func (limiter TransactionStorageLimiter) CheckStorageLimits( ctx Context, env environment.Environment, snapshot *snapshot.ExecutionSnapshot, payer flow.Address, maxTxFees uint64, ) error
CheckStorageLimits checks each account that had its storage written to during a transaction, that its storage used is less than its storage capacity. Storage used is an FVM register and is easily accessible. Storage capacity is calculated by the FlowStorageFees contract from the account's flow balance.
The payers balance is considered to be maxTxFees lower that its actual balance, due to the fact that the fee deduction step happens after the storage limit check.
type TransactionVerifier ¶ added in v0.27.0
type TransactionVerifier struct {
VerificationConcurrency int
}
TransactionVerifier verifies the content of the transaction by checking there is no double signature all signatures are valid all accounts provides enoguh weights
if KeyWeightThreshold is set to a negative number, signature verification is skipped
func (*TransactionVerifier) CheckAuthorization ¶ added in v0.29.0
func (v *TransactionVerifier) CheckAuthorization( tracer tracing.TracerSpan, proc *TransactionProcedure, txnState storage.TransactionPreparer, keyWeightThreshold int, ) error
type VM ¶ added in v0.30.0
type VM interface { NewExecutor( Context, Procedure, storage.TransactionPreparer, ) ProcedureExecutor Run( Context, Procedure, snapshot.StorageSnapshot, ) ( *snapshot.ExecutionSnapshot, ProcedureOutput, error, ) GetAccount(Context, flow.Address, snapshot.StorageSnapshot) (*flow.Account, error) }
VM runs procedures
type VirtualMachine ¶
type VirtualMachine struct { }
A VirtualMachine augments the Cadence runtime with Flow host functionality.
func NewVirtualMachine ¶ added in v0.15.1
func NewVirtualMachine() *VirtualMachine
func (*VirtualMachine) GetAccount ¶
func (vm *VirtualMachine) GetAccount( ctx Context, address flow.Address, storageSnapshot snapshot.StorageSnapshot, ) ( *flow.Account, error, )
GetAccount returns an account by address or an error if none exists.
func (*VirtualMachine) NewExecutor ¶ added in v0.31.0
func (vm *VirtualMachine) NewExecutor( ctx Context, proc Procedure, txn storage.TransactionPreparer, ) ProcedureExecutor
func (*VirtualMachine) Run ¶
func (vm *VirtualMachine) Run( ctx Context, proc Procedure, storageSnapshot snapshot.StorageSnapshot, ) ( *snapshot.ExecutionSnapshot, ProcedureOutput, error, )
Run runs a procedure against a ledger in the given context.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package systemcontracts stores canonical address locations for all system smart contracts and service events.
|
Package systemcontracts stores canonical address locations for all system smart contracts and service events. |