Versions in this module Expand all Collapse all v1 v1.3.0 Dec 3, 2024 Changes in this version + var LedgerOnWriteCounter = func(counter *int) LedgerOnWrite + var LedgerOnWriteEntries = func(entries *[]OwnerKeyValue) LedgerOnWrite + func CheckAtreeStorageHealth(tb testing.TB, storage atree.SlabStorage, expectedRootSlabIDs []atree.SlabID) + type LedgerOnRead func(owner, key, value []byte) + type LedgerOnWrite func(owner, key, value []byte) + type OwnerKeyValue struct + Key []byte + Owner []byte + Value []byte type TestLedger + StorageIndices map[string]uint64 v1.2.2 Oct 30, 2024 Changes in this version + var DefaultTestInterpreterConfig = runtime.Config + func DeploymentTransaction(name string, contract []byte) []byte + func MultipleIdentifierLocationResolver(identifiers []ast.Identifier, location common.Location) (result []sema.ResolvedLocation, err error) + func NewLocationGenerator[T ~[32]byte]() func() T + func NewScriptLocationGenerator() func() common.ScriptLocation + func NewSingleIdentifierLocationResolver(t testing.TB) sema.LocationHandlerFunc + func NewTransactionLocationGenerator() func() common.TransactionLocation + func RemovalTransaction(name string) []byte + func TestStorageKey(owner, key string) string + func UpdateTransaction(name string, contract []byte) []byte + type TestInterpreterRuntime struct + func NewTestInterpreterRuntime() TestInterpreterRuntime + func NewTestInterpreterRuntimeWithConfig(config runtime.Config) TestInterpreterRuntime + func (r TestInterpreterRuntime) ExecuteScript(script runtime.Script, context runtime.Context) (cadence.Value, error) + func (r TestInterpreterRuntime) ExecuteTransaction(script runtime.Script, context runtime.Context) error + type TestLedger struct + OnAllocateSlabIndex func(owner []byte) (atree.SlabIndex, error) + OnGetValue func(owner, key []byte) (value []byte, err error) + OnSetValue func(owner, key, value []byte) (err error) + OnValueExists func(owner, key []byte) (exists bool, err error) + StoredValues map[string][]byte + func NewTestLedger(onRead func(owner, key, value []byte), onWrite func(owner, key, value []byte)) TestLedger + func NewTestLedgerWithData(onRead func(owner, key, value []byte), onWrite func(owner, key, value []byte), ...) TestLedger + func (s TestLedger) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error) + func (s TestLedger) Dump() + func (s TestLedger) ForEach(f func(owner, key, value []byte) error) error + func (s TestLedger) GetValue(owner, key []byte) (value []byte, err error) + func (s TestLedger) SetValue(owner, key, value []byte) (err error) + func (s TestLedger) ValueExists(owner, key []byte) (exists bool, err error) + type TestRuntimeInterface struct + OnAccountKeysCount func(address runtime.Address) (uint32, error) + OnAddAccountKey func(address runtime.Address, publicKey *stdlib.PublicKey, ...) (*stdlib.AccountKey, error) + OnAddEncodedAccountKey func(address runtime.Address, publicKey []byte) error + OnBLSAggregatePublicKeys func(keys []*stdlib.PublicKey) (*stdlib.PublicKey, error) + OnBLSAggregateSignatures func(sigs [][]byte) ([]byte, error) + OnBLSVerifyPOP func(pk *stdlib.PublicKey, s []byte) (bool, error) + OnComputationUsed func() (uint64, error) + OnCreateAccount func(payer runtime.Address) (address runtime.Address, err error) + OnDecodeArgument func(b []byte, t cadence.Type) (cadence.Value, error) + OnEmitEvent func(cadence.Event) error + OnGenerateAccountID func(address common.Address) (uint64, error) + OnGenerateUUID func() (uint64, error) + OnGetAccountAvailableBalance func(_ runtime.Address) (uint64, error) + OnGetAccountBalance func(_ runtime.Address) (uint64, error) + OnGetAccountContractCode func(location common.AddressLocation) (code []byte, err error) + OnGetAccountContractNames func(address runtime.Address) ([]string, error) + OnGetAccountKey func(address runtime.Address, index uint32) (*stdlib.AccountKey, error) + OnGetAndSetProgram func(location runtime.Location, load func() (*interpreter.Program, error)) (*interpreter.Program, error) + OnGetCode func(_ runtime.Location) ([]byte, error) + OnGetInterpreterSharedState func() *interpreter.SharedState + OnGetSigningAccounts func() ([]runtime.Address, error) + OnGetStorageCapacity func(_ runtime.Address) (uint64, error) + OnGetStorageUsed func(_ runtime.Address) (uint64, error) + OnHash func(data []byte, tag string, hashAlgorithm runtime.HashAlgorithm) ([]byte, error) + OnImplementationDebugLog func(message string) error + OnInteractionUsed func() (uint64, error) + OnMemoryUsed func() (uint64, error) + OnMeterComputation func(compKind common.ComputationKind, intensity uint) error + OnMeterMemory func(usage common.MemoryUsage) error + OnMinimumRequiredVersion func() (string, error) + OnProgramChecked func(location runtime.Location, duration time.Duration) + OnProgramInterpreted func(location runtime.Location, duration time.Duration) + OnProgramLog func(string) + OnProgramParsed func(location runtime.Location, duration time.Duration) + OnReadRandom func([]byte) error + OnRecordTrace func(operation string, location runtime.Location, duration time.Duration, ...) + OnRecoverProgram func(program *ast.Program, location common.Location) ([]byte, error) + OnRemoveAccountContractCode func(location common.AddressLocation) (err error) + OnRemoveAccountKey func(address runtime.Address, index uint32) (*stdlib.AccountKey, error) + OnRemoveEncodedAccountKey func(address runtime.Address, index int) (publicKey []byte, err error) + OnResolveLocation sema.LocationHandlerFunc + OnResourceOwnerChanged func(interpreter *interpreter.Interpreter, resource *interpreter.CompositeValue, ...) + OnSetCadenceValue func(owner runtime.Address, key string, value cadence.Value) (err error) + OnSetInterpreterSharedState func(state *interpreter.SharedState) + OnUpdateAccountContractCode func(location common.AddressLocation, code []byte) error + OnValidateAccountCapabilitiesGet func(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) (bool, error) + OnValidateAccountCapabilitiesPublish func(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) (bool, error) + OnValidatePublicKey func(publicKey *stdlib.PublicKey) error + OnVerifySignature func(signature []byte, tag string, signedData []byte, publicKey []byte, ...) (bool, error) + Programs map[runtime.Location]*interpreter.Program + Storage TestLedger + func (i *TestRuntimeInterface) AccountKeysCount(address runtime.Address) (uint32, error) + func (i *TestRuntimeInterface) AddAccountKey(address runtime.Address, publicKey *stdlib.PublicKey, ...) (*stdlib.AccountKey, error) + func (i *TestRuntimeInterface) AddEncodedAccountKey(address runtime.Address, publicKey []byte) error + func (i *TestRuntimeInterface) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error) + func (i *TestRuntimeInterface) BLSAggregatePublicKeys(keys []*stdlib.PublicKey) (*stdlib.PublicKey, error) + func (i *TestRuntimeInterface) BLSAggregateSignatures(sigs [][]byte) ([]byte, error) + func (i *TestRuntimeInterface) BLSVerifyPOP(key *stdlib.PublicKey, s []byte) (bool, error) + func (i *TestRuntimeInterface) ComputationUsed() (uint64, error) + func (i *TestRuntimeInterface) CreateAccount(payer runtime.Address) (address runtime.Address, err error) + func (i *TestRuntimeInterface) DecodeArgument(b []byte, t cadence.Type) (cadence.Value, error) + func (i *TestRuntimeInterface) EmitEvent(event cadence.Event) error + func (i *TestRuntimeInterface) GenerateAccountID(address common.Address) (uint64, error) + func (i *TestRuntimeInterface) GenerateUUID() (uint64, error) + func (i *TestRuntimeInterface) GetAccountAvailableBalance(address runtime.Address) (uint64, error) + func (i *TestRuntimeInterface) GetAccountBalance(address runtime.Address) (uint64, error) + func (i *TestRuntimeInterface) GetAccountContractCode(location common.AddressLocation) (code []byte, err error) + func (i *TestRuntimeInterface) GetAccountContractNames(address runtime.Address) ([]string, error) + func (i *TestRuntimeInterface) GetAccountKey(address runtime.Address, index uint32) (*stdlib.AccountKey, error) + func (i *TestRuntimeInterface) GetBlockAtHeight(height uint64) (block stdlib.Block, exists bool, err error) + func (i *TestRuntimeInterface) GetCode(location runtime.Location) ([]byte, error) + func (i *TestRuntimeInterface) GetCurrentBlockHeight() (uint64, error) + func (i *TestRuntimeInterface) GetInterpreterSharedState() *interpreter.SharedState + func (i *TestRuntimeInterface) GetOrLoadProgram(location runtime.Location, load func() (*interpreter.Program, error)) (program *interpreter.Program, err error) + func (i *TestRuntimeInterface) GetSigningAccounts() ([]runtime.Address, error) + func (i *TestRuntimeInterface) GetStorageCapacity(address runtime.Address) (uint64, error) + func (i *TestRuntimeInterface) GetStorageUsed(address runtime.Address) (uint64, error) + func (i *TestRuntimeInterface) GetValue(owner, key []byte) (value []byte, err error) + func (i *TestRuntimeInterface) Hash(data []byte, tag string, hashAlgorithm runtime.HashAlgorithm) ([]byte, error) + func (i *TestRuntimeInterface) ImplementationDebugLog(message string) error + func (i *TestRuntimeInterface) InteractionUsed() (uint64, error) + func (i *TestRuntimeInterface) InvalidateUpdatedPrograms() + func (i *TestRuntimeInterface) MemoryUsed() (uint64, error) + func (i *TestRuntimeInterface) MeterComputation(compKind common.ComputationKind, intensity uint) error + func (i *TestRuntimeInterface) MeterMemory(usage common.MemoryUsage) error + func (i *TestRuntimeInterface) MinimumRequiredVersion() (string, error) + func (i *TestRuntimeInterface) ProgramChecked(location runtime.Location, duration time.Duration) + func (i *TestRuntimeInterface) ProgramInterpreted(location runtime.Location, duration time.Duration) + func (i *TestRuntimeInterface) ProgramLog(message string) error + func (i *TestRuntimeInterface) ProgramParsed(location runtime.Location, duration time.Duration) + func (i *TestRuntimeInterface) ReadRandom(buffer []byte) error + func (i *TestRuntimeInterface) RecordTrace(operation string, location runtime.Location, duration time.Duration, ...) + func (i *TestRuntimeInterface) RecoverProgram(program *ast.Program, location common.Location) ([]byte, error) + func (i *TestRuntimeInterface) RemoveAccountContractCode(location common.AddressLocation) (err error) + func (i *TestRuntimeInterface) ResolveLocation(identifiers []runtime.Identifier, location runtime.Location) ([]runtime.ResolvedLocation, error) + func (i *TestRuntimeInterface) ResourceOwnerChanged(interpreter *interpreter.Interpreter, resource *interpreter.CompositeValue, ...) + func (i *TestRuntimeInterface) RevokeAccountKey(address runtime.Address, index uint32) (*stdlib.AccountKey, error) + func (i *TestRuntimeInterface) RevokeEncodedAccountKey(address runtime.Address, index int) ([]byte, error) + func (i *TestRuntimeInterface) SetCadenceValue(owner common.Address, key string, value cadence.Value) (err error) + func (i *TestRuntimeInterface) SetInterpreterSharedState(state *interpreter.SharedState) + func (i *TestRuntimeInterface) SetValue(owner, key, value []byte) (err error) + func (i *TestRuntimeInterface) UpdateAccountContractCode(location common.AddressLocation, code []byte) (err error) + func (i *TestRuntimeInterface) ValidateAccountCapabilitiesGet(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) (bool, error) + func (i *TestRuntimeInterface) ValidateAccountCapabilitiesPublish(inter *interpreter.Interpreter, locationRange interpreter.LocationRange, ...) (bool, error) + func (i *TestRuntimeInterface) ValidatePublicKey(key *stdlib.PublicKey) error + func (i *TestRuntimeInterface) ValueExists(owner, key []byte) (exists bool, err error) + func (i *TestRuntimeInterface) VerifySignature(signature []byte, tag string, signedData []byte, publicKey []byte, ...) (bool, error)