mock

package
v1.4.90 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainHookStub

type BlockchainHookStub struct {
	NewAddressCalled              func(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)
	GetStorageDataCalled          func(accountsAddress []byte, index []byte) ([]byte, uint32, error)
	GetBlockHashCalled            func(nonce uint64) ([]byte, error)
	LastNonceCalled               func() uint64
	LastRoundCalled               func() uint64
	LastTimeStampCalled           func() uint64
	LastRandomSeedCalled          func() []byte
	LastEpochCalled               func() uint32
	GetStateRootHashCalled        func() []byte
	CurrentNonceCalled            func() uint64
	CurrentRoundCalled            func() uint64
	CurrentTimeStampCalled        func() uint64
	CurrentRandomSeedCalled       func() []byte
	CurrentEpochCalled            func() uint32
	ProcessBuiltInFunctionCalled  func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
	GetBuiltinFunctionNamesCalled func() vmcommon.FunctionNames
	GetAllStateCalled             func(address []byte) (map[string][]byte, error)
	GetUserAccountCalled          func(address []byte) (vmcommon.UserAccountHandler, error)
	GetShardOfAddressCalled       func(address []byte) uint32
	IsSmartContractCalled         func(address []byte) bool
	IsPayableCalled               func(address []byte) (bool, error)
	GetCompiledCodeCalled         func(codeHash []byte) (bool, []byte)
	SaveCompiledCodeCalled        func(codeHash []byte, code []byte)
	GetCodeCalled                 func(account vmcommon.UserAccountHandler) []byte
	GetESDTTokenCalled            func(address []byte, tokenID []byte, nonce uint64) (*esdt.ESDigitalToken, error)
	GetSnapshotCalled             func() int
	RevertToSnapshotCalled        func(snapshot int) error
}

BlockchainHookStub is used in tests to check that interface methods were called

func (*BlockchainHookStub) ClearCompiledCodes

func (b *BlockchainHookStub) ClearCompiledCodes()

ClearCompiledCodes mocked method

func (*BlockchainHookStub) CurrentEpoch

func (b *BlockchainHookStub) CurrentEpoch() uint32

CurrentEpoch mocked method

func (*BlockchainHookStub) CurrentNonce

func (b *BlockchainHookStub) CurrentNonce() uint64

CurrentNonce mocked method

func (*BlockchainHookStub) CurrentRandomSeed

func (b *BlockchainHookStub) CurrentRandomSeed() []byte

CurrentRandomSeed mocked method

func (*BlockchainHookStub) CurrentRound

func (b *BlockchainHookStub) CurrentRound() uint64

CurrentRound mocked method

func (*BlockchainHookStub) CurrentTimeStamp

func (b *BlockchainHookStub) CurrentTimeStamp() uint64

CurrentTimeStamp mocked method

func (*BlockchainHookStub) ExecuteSmartContractCallOnOtherVM added in v1.4.86

func (b *BlockchainHookStub) ExecuteSmartContractCallOnOtherVM(_ *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

ExecuteSmartContractCallOnOtherVM -

func (*BlockchainHookStub) GetAllState

func (b *BlockchainHookStub) GetAllState(address []byte) (map[string][]byte, error)

GetAllState mocked method

func (*BlockchainHookStub) GetBlockhash

func (b *BlockchainHookStub) GetBlockhash(nonce uint64) ([]byte, error)

GetBlockhash mocked method

func (*BlockchainHookStub) GetBuiltinFunctionNames

func (b *BlockchainHookStub) GetBuiltinFunctionNames() vmcommon.FunctionNames

GetBuiltinFunctionNames mocked method

func (*BlockchainHookStub) GetCode

func (b *BlockchainHookStub) GetCode(account vmcommon.UserAccountHandler) []byte

GetCode mocked method

func (*BlockchainHookStub) GetCompiledCode

func (b *BlockchainHookStub) GetCompiledCode(codeHash []byte) (bool, []byte)

GetCompiledCode mocked method

func (*BlockchainHookStub) GetESDTToken

func (b *BlockchainHookStub) GetESDTToken(address []byte, tokenID []byte, nonce uint64) (*esdt.ESDigitalToken, error)

GetESDTToken mocked method

func (*BlockchainHookStub) GetShardOfAddress

func (b *BlockchainHookStub) GetShardOfAddress(address []byte) uint32

GetShardOfAddress mocked method

func (*BlockchainHookStub) GetSnapshot

func (b *BlockchainHookStub) GetSnapshot() int

GetSnapshot mocked method

func (*BlockchainHookStub) GetStateRootHash

func (b *BlockchainHookStub) GetStateRootHash() []byte

GetStateRootHash mocked method

func (*BlockchainHookStub) GetStorageData

func (b *BlockchainHookStub) GetStorageData(accountAddress []byte, index []byte) ([]byte, uint32, error)

GetStorageData mocked method

func (*BlockchainHookStub) GetUserAccount

func (b *BlockchainHookStub) GetUserAccount(address []byte) (vmcommon.UserAccountHandler, error)

GetUserAccount mocked method

func (*BlockchainHookStub) IsInterfaceNil

func (b *BlockchainHookStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*BlockchainHookStub) IsLimitedTransfer

func (b *BlockchainHookStub) IsLimitedTransfer(_ []byte) bool

IsLimitedTransfer -

func (*BlockchainHookStub) IsPaused

func (b *BlockchainHookStub) IsPaused(_ []byte) bool

IsPaused -

func (*BlockchainHookStub) IsPayable

func (b *BlockchainHookStub) IsPayable(_, address []byte) (bool, error)

IsPayable mocked method

func (*BlockchainHookStub) IsSmartContract

func (b *BlockchainHookStub) IsSmartContract(address []byte) bool

IsSmartContract mocked method

func (*BlockchainHookStub) LastEpoch

func (b *BlockchainHookStub) LastEpoch() uint32

LastEpoch mocked method

func (*BlockchainHookStub) LastNonce

func (b *BlockchainHookStub) LastNonce() uint64

LastNonce mocked method

func (*BlockchainHookStub) LastRandomSeed

func (b *BlockchainHookStub) LastRandomSeed() []byte

LastRandomSeed mocked method

func (*BlockchainHookStub) LastRound

func (b *BlockchainHookStub) LastRound() uint64

LastRound mocked method

func (*BlockchainHookStub) LastTimeStamp

func (b *BlockchainHookStub) LastTimeStamp() uint64

LastTimeStamp mocked method

func (*BlockchainHookStub) NewAddress

func (b *BlockchainHookStub) NewAddress(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)

NewAddress mocked method

func (*BlockchainHookStub) ProcessBuiltInFunction

func (b *BlockchainHookStub) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

ProcessBuiltInFunction mocked method

func (*BlockchainHookStub) RevertToSnapshot

func (b *BlockchainHookStub) RevertToSnapshot(snapshot int) error

RevertToSnapshot mocked method

func (*BlockchainHookStub) SaveCompiledCode

func (b *BlockchainHookStub) SaveCompiledCode(codeHash []byte, code []byte)

SaveCompiledCode mocked method

type CryptoHookMock

type CryptoHookMock struct {
	Result []byte
	Err    error
}

CryptoHookMock is used in tests to check that interface methods were called

func (*CryptoHookMock) Ecrecover

func (c *CryptoHookMock) Ecrecover(_ []byte, _ []byte, _ []byte, _ []byte) ([]byte, error)

Ecrecover mocked method

func (*CryptoHookMock) EncodeSecp256k1DERSignature

func (c *CryptoHookMock) EncodeSecp256k1DERSignature(_, _ []byte) []byte

EncodeSecp256k1DERSignature mocked method

func (*CryptoHookMock) Keccak256

func (c *CryptoHookMock) Keccak256(_ []byte) ([]byte, error)

Keccak256 mocked method

func (*CryptoHookMock) Ripemd160

func (c *CryptoHookMock) Ripemd160(_ []byte) ([]byte, error)

Ripemd160 mocked method

func (*CryptoHookMock) Sha256

func (c *CryptoHookMock) Sha256(_ []byte) ([]byte, error)

Sha256 mocked method

func (*CryptoHookMock) VerifyBLS

func (c *CryptoHookMock) VerifyBLS(_ []byte, _ []byte, _ []byte) error

VerifyBLS mocked method

func (*CryptoHookMock) VerifyEd25519

func (c *CryptoHookMock) VerifyEd25519(_ []byte, _ []byte, _ []byte) error

VerifyEd25519 mocked method

func (*CryptoHookMock) VerifySecp256k1

func (c *CryptoHookMock) VerifySecp256k1(_ []byte, _ []byte, _ []byte, _ uint8) error

VerifySecp256k1 mocked method

type InstanceBuilderMock

type InstanceBuilderMock struct {
	InstanceMap map[string]InstanceMock
	World       *worldmock.MockWorld
}

InstanceBuilderMock can be passed to RuntimeContext as an InstanceBuilder to create mocked Wasmer instances.

func NewInstanceBuilderMock

func NewInstanceBuilderMock(world *worldmock.MockWorld) *InstanceBuilderMock

NewInstanceBuilderMock constructs a new InstanceBuilderMock

func (*InstanceBuilderMock) CreateAndStoreInstanceMock

func (builder *InstanceBuilderMock) CreateAndStoreInstanceMock(t testing.TB, host vmhost.VMHost, code []byte, codeHash []byte, codeMetadata []byte, ownerAddress []byte, shardID uint32, balance int64) *InstanceMock

CreateAndStoreInstanceMock creates a new InstanceMock and registers it as a smart contract account in the World, using `code` as the address of the account

func (*InstanceBuilderMock) Id

func (builder *InstanceBuilderMock) Id() string

Id -

func (*InstanceBuilderMock) NewInstanceFromCompiledCodeWithOptions

func (builder *InstanceBuilderMock) NewInstanceFromCompiledCodeWithOptions(
	compiledCode []byte,
	options wasmer.CompilationOptions,
) (wasmer.InstanceHandler, error)

NewInstanceFromCompiledCodeWithOptions attempts to load a prepared instance using GetStoredInstance; if it doesn't exist, it creates a true Wasmer instance with the provided precompiled code.

func (*InstanceBuilderMock) NewInstanceWithOptions

func (builder *InstanceBuilderMock) NewInstanceWithOptions(
	contractCode []byte,
	options wasmer.CompilationOptions,
) (wasmer.InstanceHandler, error)

NewInstanceWithOptions attempts to load a prepared instance using GetStoredInstance; if it doesn't exist, it creates a true Wasmer instance with the provided contract code.

type InstanceBuilderRecorderMock

type InstanceBuilderRecorderMock struct {
	InstanceMap map[string][]wasmer.InstanceHandler
}

InstanceBuilderRecorderMock can be passed to RuntimeContext as an InstanceBuilder to create mocked Wasmer instances.

func NewInstanceBuilderRecorderMock

func NewInstanceBuilderRecorderMock() *InstanceBuilderRecorderMock

NewInstanceBuilderRecorderMock constructs a new InstanceBuilderRecorderMock

func (*InstanceBuilderRecorderMock) GetContractInstances

func (builder *InstanceBuilderRecorderMock) GetContractInstances(code []byte) []wasmer.InstanceHandler

GetContractInstances gets contract instances for code

func (*InstanceBuilderRecorderMock) Id

func (builder *InstanceBuilderRecorderMock) Id() string

Id -

func (*InstanceBuilderRecorderMock) NewInstanceFromCompiledCodeWithOptions

func (builder *InstanceBuilderRecorderMock) NewInstanceFromCompiledCodeWithOptions(
	compiledCode []byte,
	options wasmer.CompilationOptions,
) (wasmer.InstanceHandler, error)

NewInstanceFromCompiledCodeWithOptions - see InstanceBuilderMock.NewInstanceFromCompiledCodeWithOptions()

func (*InstanceBuilderRecorderMock) NewInstanceWithOptions

func (builder *InstanceBuilderRecorderMock) NewInstanceWithOptions(
	contractCode []byte,
	options wasmer.CompilationOptions,
) (wasmer.InstanceHandler, error)

NewInstanceWithOptions - see InstanceBuilderMock.NewInstanceWithOptions()

type InstanceMock

type InstanceMock struct {
	Code            []byte
	Exports         wasmer.ExportsMap
	DefaultErrors   map[string]error
	Methods         map[string]mockMethod
	Points          uint64
	Data            uintptr
	GasLimit        uint64
	BreakpointValue vmhost.BreakpointValue
	Memory          wasmer.MemoryHandler
	Host            vmhost.VMHost
	T               testing.TB
	Address         []byte
	AlreadyClean    bool
}

InstanceMock is a mock for Wasmer instances; it allows creating mock smart contracts within tests, without needing actual WASM smart contracts.

func GetMockInstance

func GetMockInstance(host vmhost.VMHost) *InstanceMock

GetMockInstance gets the mock instance from the runtime of the provided host

func NewInstanceMock

func NewInstanceMock(code []byte) *InstanceMock

NewInstanceMock creates a new InstanceMock

func (*InstanceMock) AddMockMethod

func (instance *InstanceMock) AddMockMethod(name string, method mockMethod)

AddMockMethod adds the provided function as a mocked method to the instance under the specified name.

func (*InstanceMock) AddMockMethodWithError

func (instance *InstanceMock) AddMockMethodWithError(name string, method mockMethod, err error)

AddMockMethodWithError adds the provided function as a mocked method to the instance under the specified name and returns an error

func (*InstanceMock) AlreadyCleaned

func (instance *InstanceMock) AlreadyCleaned() bool

AlreadyCleaned mocked method

func (*InstanceMock) Cache

func (instance *InstanceMock) Cache() ([]byte, error)

Cache mocked method

func (*InstanceMock) CallFunction

func (instance *InstanceMock) CallFunction(funcName string) (wasmer.Value, error)

CallFunction mocked method

func (*InstanceMock) Clean

func (instance *InstanceMock) Clean() bool

Clean mocked method

func (*InstanceMock) GetBreakpointValue

func (instance *InstanceMock) GetBreakpointValue() uint64

GetBreakpointValue mocked method

func (*InstanceMock) GetData

func (instance *InstanceMock) GetData() uintptr

GetData mocked method

func (*InstanceMock) GetExports

func (instance *InstanceMock) GetExports() wasmer.ExportsMap

GetExports mocked method

func (*InstanceMock) GetInstanceCtxMemory

func (instance *InstanceMock) GetInstanceCtxMemory() wasmer.MemoryHandler

GetInstanceCtxMemory mocked method

func (*InstanceMock) GetMemory

func (instance *InstanceMock) GetMemory() wasmer.MemoryHandler

GetMemory mocked method

func (*InstanceMock) GetPointsUsed

func (instance *InstanceMock) GetPointsUsed() uint64

GetPointsUsed mocked method

func (*InstanceMock) GetSignature

func (instance *InstanceMock) GetSignature(functionName string) (*wasmer.ExportedFunctionSignature, bool)

GetSignature mocked method

func (*InstanceMock) HasFunction

func (instance *InstanceMock) HasFunction(name string) bool

HasFunction mocked method

func (*InstanceMock) HasMemory

func (instance *InstanceMock) HasMemory() bool

HasMemory mocked method

func (*InstanceMock) ID

func (instance *InstanceMock) ID() string

ID -

func (*InstanceMock) IsFunctionImported

func (instance *InstanceMock) IsFunctionImported(name string) bool

IsFunctionImported mocked method

func (*InstanceMock) IsInterfaceNil

func (instance *InstanceMock) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*InstanceMock) Reset

func (instance *InstanceMock) Reset() bool

Reset mocked method

func (*InstanceMock) SetBreakpointValue

func (instance *InstanceMock) SetBreakpointValue(value uint64)

SetBreakpointValue mocked method

func (*InstanceMock) SetContextData

func (instance *InstanceMock) SetContextData(data uintptr)

SetContextData mocked method

func (*InstanceMock) SetGasLimit

func (instance *InstanceMock) SetGasLimit(gasLimit uint64)

SetGasLimit mocked method

func (*InstanceMock) SetMemory

func (instance *InstanceMock) SetMemory(_ []byte) bool

SetMemory mocked method

func (*InstanceMock) SetPointsUsed

func (instance *InstanceMock) SetPointsUsed(points uint64)

SetPointsUsed mocked method

type MemoryMock

type MemoryMock struct {
	Pages    uint32
	PageSize uint32
	Contents []byte
}

MemoryMock mocks the linear memory of a Wasmer instance and is used by the InstanceMock.

func NewMemoryMock

func NewMemoryMock() *MemoryMock

NewMemoryMock creates a new MemoryMock instance

func (*MemoryMock) Data

func (memory *MemoryMock) Data() []byte

Data mocked method

func (*MemoryMock) Destroy

func (memory *MemoryMock) Destroy()

Destroy mocked method

func (*MemoryMock) Grow

func (memory *MemoryMock) Grow(pages uint32) error

Grow mocked method

func (*MemoryMock) IsInterfaceNil

func (memory *MemoryMock) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying object is nil

func (*MemoryMock) Length

func (memory *MemoryMock) Length() uint32

Length mocked method

type MeteringContextMock

type MeteringContextMock struct {
	GasCost           *config.GasCost
	GasLeftMock       uint64
	GasFreedMock      uint64
	GasLockedMock     uint64
	GasComputedToLock uint64
	BlockGasLimitMock uint64
	Err               error
}

MeteringContextMock is used in tests to check the MeteringContext interface method calls

func (*MeteringContextMock) BlockGasLimit

func (m *MeteringContextMock) BlockGasLimit() uint64

BlockGasLimit mocked method

func (*MeteringContextMock) BoundGasLimit

func (m *MeteringContextMock) BoundGasLimit(value int64) uint64

BoundGasLimit mocked method

func (*MeteringContextMock) ClearStateStack

func (m *MeteringContextMock) ClearStateStack()

ClearStateStack mocked method

func (*MeteringContextMock) ComputeGasLockedForAsync

func (m *MeteringContextMock) ComputeGasLockedForAsync() uint64

ComputeGasLockedForAsync mocked method

func (*MeteringContextMock) DeductGasIfAsyncStep

func (m *MeteringContextMock) DeductGasIfAsyncStep() error

DeductGasIfAsyncStep mocked method

func (*MeteringContextMock) DeductInitialGasForDirectDeployment

func (m *MeteringContextMock) DeductInitialGasForDirectDeployment(_ vmhost.CodeDeployInput) error

DeductInitialGasForDirectDeployment mocked method

func (*MeteringContextMock) DeductInitialGasForExecution

func (m *MeteringContextMock) DeductInitialGasForExecution(_ []byte) error

DeductInitialGasForExecution mocked method

func (*MeteringContextMock) DeductInitialGasForIndirectDeployment

func (m *MeteringContextMock) DeductInitialGasForIndirectDeployment(_ vmhost.CodeDeployInput) error

DeductInitialGasForIndirectDeployment mocked method

func (*MeteringContextMock) FreeGas

func (m *MeteringContextMock) FreeGas(gas uint64)

FreeGas mocked method

func (*MeteringContextMock) GasLeft

func (m *MeteringContextMock) GasLeft() uint64

GasLeft mocked method

func (*MeteringContextMock) GasSchedule

func (m *MeteringContextMock) GasSchedule() *config.GasCost

GasSchedule mocked method

func (*MeteringContextMock) GasSpentByContract

func (m *MeteringContextMock) GasSpentByContract() uint64

GasSpentByContract mocked method

func (*MeteringContextMock) GasUsedByContract

func (m *MeteringContextMock) GasUsedByContract() (uint64, uint64)

GasUsedByContract mocked method

func (*MeteringContextMock) GasUsedForExecution

func (m *MeteringContextMock) GasUsedForExecution() uint64

GasUsedForExecution mocked method

func (*MeteringContextMock) GetGasForExecution

func (m *MeteringContextMock) GetGasForExecution() uint64

GetGasForExecution mocked method

func (*MeteringContextMock) GetGasLocked

func (m *MeteringContextMock) GetGasLocked() uint64

GetGasLocked mocked method

func (*MeteringContextMock) GetGasProvided

func (m *MeteringContextMock) GetGasProvided() uint64

GetGasProvided mocked method

func (*MeteringContextMock) GetGasTrace

func (m *MeteringContextMock) GetGasTrace() map[string]map[string][]uint64

func (*MeteringContextMock) GetSCPrepareInitialCost

func (m *MeteringContextMock) GetSCPrepareInitialCost() uint64

GetSCPrepareInitialCost mocked method

func (*MeteringContextMock) InitState

func (m *MeteringContextMock) InitState()

InitState mocked method

func (*MeteringContextMock) InitStateFromContractCallInput

func (m *MeteringContextMock) InitStateFromContractCallInput(_ *vmcommon.VMInput)

InitStateFromContractCallInput mocked method

func (*MeteringContextMock) PopDiscard

func (m *MeteringContextMock) PopDiscard()

PopDiscard mocked method

func (*MeteringContextMock) PopMergeActiveState

func (m *MeteringContextMock) PopMergeActiveState()

PopMergeActiveState mocked method

func (*MeteringContextMock) PopSetActiveState

func (m *MeteringContextMock) PopSetActiveState()

PopSetActiveState mocked method

func (*MeteringContextMock) PushState

func (m *MeteringContextMock) PushState()

PushState mocked method

func (*MeteringContextMock) RestoreGas

func (m *MeteringContextMock) RestoreGas(gas uint64)

RestoreGas mocked method

func (*MeteringContextMock) SetGasSchedule

func (m *MeteringContextMock) SetGasSchedule(gasSchedule config.GasScheduleMap)

SetGasSchedule mocked method

func (*MeteringContextMock) SetGasTracing

func (m *MeteringContextMock) SetGasTracing(_ bool)

func (*MeteringContextMock) StartGasTracing

func (m *MeteringContextMock) StartGasTracing(_ string)

func (*MeteringContextMock) TrackGasUsedByBuiltinFunction

func (m *MeteringContextMock) TrackGasUsedByBuiltinFunction(_ *vmcommon.ContractCallInput, _ *vmcommon.VMOutput, _ *vmcommon.ContractCallInput)

TrackGasUsedByBuiltinFunction mocked method

func (*MeteringContextMock) UnlockGasIfAsyncCallback

func (m *MeteringContextMock) UnlockGasIfAsyncCallback()

UnlockGasIfAsyncCallback mocked method

func (*MeteringContextMock) UnlockGasIfAsyncStep

func (m *MeteringContextMock) UnlockGasIfAsyncStep()

UnlockGasIfAsyncStep mocked method

func (*MeteringContextMock) UpdateGasStateOnFailure

func (m *MeteringContextMock) UpdateGasStateOnFailure(_ *vmcommon.VMOutput)

UpdateGasStateOnFailure mocked method

func (*MeteringContextMock) UpdateGasStateOnSuccess

func (m *MeteringContextMock) UpdateGasStateOnSuccess(_ *vmcommon.VMOutput) error

UpdateGasStateOnSuccess mocked method

func (*MeteringContextMock) UseAndTraceGas

func (m *MeteringContextMock) UseAndTraceGas(_ uint64)

UseAndTraceGas mocked method

func (*MeteringContextMock) UseGas

func (m *MeteringContextMock) UseGas(gas uint64)

UseGas mocked method

func (*MeteringContextMock) UseGasAndAddTracedGas

func (m *MeteringContextMock) UseGasAndAddTracedGas(_ string, _ uint64)

func (*MeteringContextMock) UseGasBounded

func (m *MeteringContextMock) UseGasBounded(gas uint64) error

UseGasBounded mocked method

func (*MeteringContextMock) UseGasForAsyncStep

func (m *MeteringContextMock) UseGasForAsyncStep() error

UseGasForAsyncStep mocked method

type OutputContextMock

type OutputContextMock struct {
	OutputStateMock    *vmcommon.VMOutput
	ReturnDataMock     [][]byte
	ReturnCodeMock     vmcommon.ReturnCode
	ReturnMessageMock  string
	GasRemaining       uint64
	GasRefund          *big.Int
	OutputAccounts     map[string]*vmcommon.OutputAccount
	DeletedAccounts    [][]byte
	TouchedAccounts    [][]byte
	Logs               []*vmcommon.LogEntry
	OutputAccountMock  *vmcommon.OutputAccount
	OutputAccountIsNew bool
	Err                error
	TransferResult     error
}

OutputContextMock is used in tests to check the OutputContext interface method calls

func (*OutputContextMock) AddToActiveState

func (o *OutputContextMock) AddToActiveState(_ *vmcommon.VMOutput)

AddToActiveState mocked method

func (*OutputContextMock) AddTxValueToAccount

func (o *OutputContextMock) AddTxValueToAccount(_ []byte, _ *big.Int)

AddTxValueToAccount mocked method

func (*OutputContextMock) CensorVMOutput

func (o *OutputContextMock) CensorVMOutput()

CensorVMOutput mocked method

func (*OutputContextMock) ClearReturnData

func (o *OutputContextMock) ClearReturnData()

ClearReturnData mocked method

func (*OutputContextMock) ClearStateStack

func (o *OutputContextMock) ClearStateStack()

ClearStateStack mocked method

func (*OutputContextMock) CopyTopOfStackToActiveState

func (o *OutputContextMock) CopyTopOfStackToActiveState()

CopyTopOfStackToActiveState mocked method

func (*OutputContextMock) CreateVMOutputInCaseOfError

func (o *OutputContextMock) CreateVMOutputInCaseOfError(_ error) *vmcommon.VMOutput

CreateVMOutputInCaseOfError mocked method

func (*OutputContextMock) DeleteFirstReturnData

func (o *OutputContextMock) DeleteFirstReturnData()

DeleteFirstReturnData mocked method

func (*OutputContextMock) DeleteOutputAccount

func (o *OutputContextMock) DeleteOutputAccount(_ []byte)

DeleteOutputAccount mocked method

func (*OutputContextMock) DeployCode

func (o *OutputContextMock) DeployCode(_ vmhost.CodeDeployInput)

DeployCode mocked method

func (*OutputContextMock) Finish

func (o *OutputContextMock) Finish(data []byte)

Finish mocked method

func (*OutputContextMock) GetCurrentTotalUsedGas

func (o *OutputContextMock) GetCurrentTotalUsedGas() (uint64, bool)

GetCurrentTotalUsedGas mocked method

func (*OutputContextMock) GetOutputAccount

func (o *OutputContextMock) GetOutputAccount(_ []byte) (*vmcommon.OutputAccount, bool)

GetOutputAccount mocked method

func (*OutputContextMock) GetOutputAccounts

func (o *OutputContextMock) GetOutputAccounts() map[string]*vmcommon.OutputAccount

GetOutputAccounts mocked method

func (*OutputContextMock) GetRefund

func (o *OutputContextMock) GetRefund() uint64

GetRefund mocked method

func (*OutputContextMock) GetVMOutput

func (o *OutputContextMock) GetVMOutput() *vmcommon.VMOutput

GetVMOutput mocked method

func (*OutputContextMock) InitState

func (o *OutputContextMock) InitState()

InitState mocked method

func (*OutputContextMock) NewVMOutputAccount

func (o *OutputContextMock) NewVMOutputAccount(address []byte) *vmcommon.OutputAccount

NewVMOutputAccount mocked method

func (*OutputContextMock) NewVMOutputAccountFromMockAccount

func (o *OutputContextMock) NewVMOutputAccountFromMockAccount(account *worldmock.Account) *vmcommon.OutputAccount

NewVMOutputAccountFromMockAccount mocked method

func (*OutputContextMock) PopDiscard

func (o *OutputContextMock) PopDiscard()

PopDiscard mocked method

func (*OutputContextMock) PopMergeActiveState

func (o *OutputContextMock) PopMergeActiveState()

PopMergeActiveState mocked method

func (*OutputContextMock) PopSetActiveState

func (o *OutputContextMock) PopSetActiveState()

PopSetActiveState mocked method

func (*OutputContextMock) PrependFinish

func (o *OutputContextMock) PrependFinish(data []byte)

PrependFinish mocked method

func (*OutputContextMock) PushState

func (o *OutputContextMock) PushState()

PushState mocked method

func (*OutputContextMock) RemoveNonUpdatedStorage

func (o *OutputContextMock) RemoveNonUpdatedStorage()

RemoveNonUpdatedStorage mocked method

func (*OutputContextMock) RemoveReturnData

func (o *OutputContextMock) RemoveReturnData(_ uint32)

RemoveReturnData mocked method

func (*OutputContextMock) ReturnCode

func (o *OutputContextMock) ReturnCode() vmcommon.ReturnCode

ReturnCode mocked method

func (*OutputContextMock) ReturnData

func (o *OutputContextMock) ReturnData() [][]byte

ReturnData mocked method

func (*OutputContextMock) ReturnMessage

func (o *OutputContextMock) ReturnMessage() string

ReturnMessage mocked method

func (*OutputContextMock) SelfDestruct

func (o *OutputContextMock) SelfDestruct(_ []byte, _ []byte)

SelfDestruct mocked method

func (*OutputContextMock) SetRefund

func (o *OutputContextMock) SetRefund(refund uint64)

SetRefund mocked method

func (*OutputContextMock) SetReturnCode

func (o *OutputContextMock) SetReturnCode(returnCode vmcommon.ReturnCode)

SetReturnCode mocked method

func (*OutputContextMock) SetReturnMessage

func (o *OutputContextMock) SetReturnMessage(returnMessage string)

SetReturnMessage mocked method

func (*OutputContextMock) Transfer

func (o *OutputContextMock) Transfer(_ []byte, _ []byte, _ uint64, _ uint64, _ *big.Int, _ []byte, _ vm.CallType) error

Transfer mocked method

func (*OutputContextMock) TransferESDT

func (o *OutputContextMock) TransferESDT(_ []byte, _ []byte, _ []*vmcommon.ESDTTransfer, _ *vmcommon.ContractCallInput) (uint64, error)

TransferESDT mocked method

func (*OutputContextMock) TransferValueOnly

func (o *OutputContextMock) TransferValueOnly(_ []byte, _ []byte, _ *big.Int, _ bool) error

TransferValueOnly mocked method

func (*OutputContextMock) WriteLog

func (o *OutputContextMock) WriteLog(_ []byte, _ [][]byte, _ []byte)

WriteLog mocked method

type OutputContextStub

type OutputContextStub struct {
	InitStateCalled                   func()
	PushStateCalled                   func()
	PopSetActiveStateCalled           func()
	PopMergeActiveStateCalled         func()
	PopDiscardCalled                  func()
	ClearStateStackCalled             func()
	CopyTopOfStackToActiveStateCalled func()
	CensorVMOutputCalled              func()
	GetOutputAccountsCalled           func() map[string]*vmcommon.OutputAccount
	GetOutputAccountCalled            func(address []byte) (*vmcommon.OutputAccount, bool)
	DeleteOutputAccountCalled         func(address []byte)
	WriteLogCalled                    func(address []byte, topics [][]byte, data []byte)
	TransferCalled                    func(destination []byte, sender []byte, gasLimit uint64, gasLocked uint64, value *big.Int, input []byte) error
	TransferESDTCalled                func(destination []byte, sender []byte, transfers []*vmcommon.ESDTTransfer, input *vmcommon.ContractCallInput) (uint64, error)
	SelfDestructCalled                func(address []byte, beneficiary []byte)
	GetRefundCalled                   func() uint64
	SetRefundCalled                   func(refund uint64)
	ReturnCodeCalled                  func() vmcommon.ReturnCode
	SetReturnCodeCalled               func(returnCode vmcommon.ReturnCode)
	ReturnMessageCalled               func() string
	SetReturnMessageCalled            func(message string)
	ReturnDataCalled                  func() [][]byte
	ClearReturnDataCalled             func()
	RemoveReturnDataCalled            func(index uint32)
	FinishCalled                      func(data []byte)
	PrependFinishCalled               func(data []byte)
	DeleteFirstReturnDataCalled       func()
	GetVMOutputCalled                 func() *vmcommon.VMOutput
	AddTxValueToAccountCalled         func(address []byte, value *big.Int)
	DeployCodeCalled                  func(input vmhost.CodeDeployInput)
	CreateVMOutputInCaseOfErrorCalled func(err error) *vmcommon.VMOutput
	AddToActiveStateCalled            func(vmOutput *vmcommon.VMOutput)
	TransferValueOnlyCalled           func(destination []byte, sender []byte, value *big.Int, checkPayable bool) error
	RemoveNonUpdatedStorageCalled     func()
}

OutputContextStub is used in tests to check the OutputContext interface method calls

func (*OutputContextStub) AddToActiveState

func (o *OutputContextStub) AddToActiveState(vmOutput *vmcommon.VMOutput)

AddToActiveState mocked method

func (*OutputContextStub) AddTxValueToAccount

func (o *OutputContextStub) AddTxValueToAccount(address []byte, value *big.Int)

AddTxValueToAccount mocked method

func (*OutputContextStub) CensorVMOutput

func (o *OutputContextStub) CensorVMOutput()

CensorVMOutput mocked method

func (*OutputContextStub) ClearReturnData

func (o *OutputContextStub) ClearReturnData()

ClearReturnData mocked method

func (*OutputContextStub) ClearStateStack

func (o *OutputContextStub) ClearStateStack()

ClearStateStack mocked method

func (*OutputContextStub) CopyTopOfStackToActiveState

func (o *OutputContextStub) CopyTopOfStackToActiveState()

CopyTopOfStackToActiveState mocked method

func (*OutputContextStub) CreateVMOutputInCaseOfError

func (o *OutputContextStub) CreateVMOutputInCaseOfError(err error) *vmcommon.VMOutput

CreateVMOutputInCaseOfError mocked method

func (*OutputContextStub) DeleteFirstReturnData

func (o *OutputContextStub) DeleteFirstReturnData()

DeleteFirstReturnData mocked method

func (*OutputContextStub) DeleteOutputAccount

func (o *OutputContextStub) DeleteOutputAccount(address []byte)

DeleteOutputAccount mocked method

func (*OutputContextStub) DeployCode

func (o *OutputContextStub) DeployCode(input vmhost.CodeDeployInput)

DeployCode mocked method

func (*OutputContextStub) Finish

func (o *OutputContextStub) Finish(data []byte)

Finish mocked method

func (*OutputContextStub) GetOutputAccount

func (o *OutputContextStub) GetOutputAccount(address []byte) (*vmcommon.OutputAccount, bool)

GetOutputAccount mocked method

func (*OutputContextStub) GetOutputAccounts

func (o *OutputContextStub) GetOutputAccounts() map[string]*vmcommon.OutputAccount

GetOutputAccounts mocked method

func (*OutputContextStub) GetRefund

func (o *OutputContextStub) GetRefund() uint64

GetRefund mocked method

func (*OutputContextStub) GetVMOutput

func (o *OutputContextStub) GetVMOutput() *vmcommon.VMOutput

GetVMOutput mocked method

func (*OutputContextStub) InitState

func (o *OutputContextStub) InitState()

InitState mocked method

func (*OutputContextStub) PopDiscard

func (o *OutputContextStub) PopDiscard()

PopDiscard mocked method

func (*OutputContextStub) PopMergeActiveState

func (o *OutputContextStub) PopMergeActiveState()

PopMergeActiveState mocked method

func (*OutputContextStub) PopSetActiveState

func (o *OutputContextStub) PopSetActiveState()

PopSetActiveState mocked method

func (*OutputContextStub) PrependFinish

func (o *OutputContextStub) PrependFinish(data []byte)

PrependFinish mocked method

func (*OutputContextStub) PushState

func (o *OutputContextStub) PushState()

PushState mocked method

func (*OutputContextStub) RemoveNonUpdatedStorage

func (o *OutputContextStub) RemoveNonUpdatedStorage()

RemoveNonUpdatedStorage mocked method

func (*OutputContextStub) RemoveReturnData

func (o *OutputContextStub) RemoveReturnData(index uint32)

RemoveReturnData mocked method

func (*OutputContextStub) ReturnCode

func (o *OutputContextStub) ReturnCode() vmcommon.ReturnCode

ReturnCode mocked method

func (*OutputContextStub) ReturnData

func (o *OutputContextStub) ReturnData() [][]byte

ReturnData mocked method

func (*OutputContextStub) ReturnMessage

func (o *OutputContextStub) ReturnMessage() string

ReturnMessage mocked method

func (*OutputContextStub) SelfDestruct

func (o *OutputContextStub) SelfDestruct(address []byte, beneficiary []byte)

SelfDestruct mocked method

func (*OutputContextStub) SetRefund

func (o *OutputContextStub) SetRefund(refund uint64)

SetRefund mocked method

func (*OutputContextStub) SetReturnCode

func (o *OutputContextStub) SetReturnCode(returnCode vmcommon.ReturnCode)

SetReturnCode mocked method

func (*OutputContextStub) SetReturnMessage

func (o *OutputContextStub) SetReturnMessage(message string)

SetReturnMessage mocked method

func (*OutputContextStub) Transfer

func (o *OutputContextStub) Transfer(destination []byte, sender []byte, gasLimit uint64, gasLocked uint64, value *big.Int, input []byte, _ vm.CallType) error

Transfer mocked method

func (*OutputContextStub) TransferESDT

func (o *OutputContextStub) TransferESDT(destination []byte, sender []byte, transfers []*vmcommon.ESDTTransfer, callInput *vmcommon.ContractCallInput) (uint64, error)

TransferESDT mocked method

func (*OutputContextStub) TransferValueOnly

func (o *OutputContextStub) TransferValueOnly(destination []byte, sender []byte, value *big.Int, checkPayable bool) error

TransferValueOnly mocked method

func (*OutputContextStub) WriteLog

func (o *OutputContextStub) WriteLog(address []byte, topics [][]byte, data []byte)

WriteLog mocked method

type RuntimeContextMock

type RuntimeContextMock struct {
	Err                    error
	VMInput                *vmcommon.ContractCallInput
	SCAddress              []byte
	SCCode                 []byte
	SCCodeSize             uint64
	CallFunctionName       string
	VMType                 []byte
	ReadOnlyFlag           bool
	VerifyCode             bool
	CurrentBreakpointValue vmhost.BreakpointValue
	PointsUsed             uint64
	InstanceCtxID          int
	MemLoadResult          []byte
	MemLoadMultipleResult  [][]byte
	FailCryptoAPI          bool
	FailBaseOpsAPI         bool
	FailSyncExecAPI        bool
	FailBigIntAPI          bool
	FailBigFloatAPI        bool
	FailManagedBuffersAPI  bool
	AsyncCallInfo          *vmhost.AsyncCallInfo
	RunningInstances       uint64
	CurrentTxHash          []byte
	OriginalTxHash         []byte
	TraceGasEnabled        bool
	GasTrace               map[string]map[string][]uint64
}

RuntimeContextMock is used in tests to check the RuntimeContextMock interface method calls

func (*RuntimeContextMock) AddAsyncContextCall

func (r *RuntimeContextMock) AddAsyncContextCall(_ []byte, _ *vmhost.AsyncGeneratedCall) error

AddAsyncContextCall mocked method

func (*RuntimeContextMock) AddError

func (r *RuntimeContextMock) AddError(_ error, _ ...string)

AddError mocked method

func (*RuntimeContextMock) Arguments

func (r *RuntimeContextMock) Arguments() [][]byte

Arguments mocked method

func (*RuntimeContextMock) BaseOpsErrorShouldFailExecution

func (r *RuntimeContextMock) BaseOpsErrorShouldFailExecution() bool

BaseOpsErrorShouldFailExecution mocked method

func (*RuntimeContextMock) BigFloatAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigFloatAPIErrorShouldFailExecution() bool

BigFloatAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) BigIntAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigIntAPIErrorShouldFailExecution() bool

BigIntAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) CallFunction

func (r *RuntimeContextMock) CallFunction(_ string) error

CallFunction mocked method

func (*RuntimeContextMock) CleanInstance

func (r *RuntimeContextMock) CleanInstance()

CleanInstance mocked method

func (*RuntimeContextMock) ClearInstanceStack

func (r *RuntimeContextMock) ClearInstanceStack()

ClearInstanceStack mocked method

func (*RuntimeContextMock) ClearStateStack

func (r *RuntimeContextMock) ClearStateStack()

ClearStateStack mocked method

func (*RuntimeContextMock) ClearWarmInstanceCache

func (r *RuntimeContextMock) ClearWarmInstanceCache()

ClearWarmInstanceCache mocked method

func (*RuntimeContextMock) CryptoAPIErrorShouldFailExecution

func (r *RuntimeContextMock) CryptoAPIErrorShouldFailExecution() bool

CryptoAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) EndExecution

func (r *RuntimeContextMock) EndExecution()

EndExecution -

func (*RuntimeContextMock) ExecuteAsyncCall

func (r *RuntimeContextMock) ExecuteAsyncCall(_ []byte, _ []byte, _ []byte) error

ExecuteAsyncCall mocked method

func (*RuntimeContextMock) ExtractCodeUpgradeFromArgs

func (r *RuntimeContextMock) ExtractCodeUpgradeFromArgs() ([]byte, []byte, error)

ExtractCodeUpgradeFromArgs mocked method

func (*RuntimeContextMock) FailExecution

func (r *RuntimeContextMock) FailExecution(_ error)

FailExecution mocked method

func (*RuntimeContextMock) Function

func (r *RuntimeContextMock) Function() string

Function mocked method

func (*RuntimeContextMock) GetAllErrors

func (r *RuntimeContextMock) GetAllErrors() error

GetAllErrors mocked method

func (*RuntimeContextMock) GetAsyncCallInfo

func (r *RuntimeContextMock) GetAsyncCallInfo() *vmhost.AsyncCallInfo

GetAsyncCallInfo mocked method

func (*RuntimeContextMock) GetAsyncContext

func (r *RuntimeContextMock) GetAsyncContext(_ []byte) (*vmhost.AsyncContext, error)

GetAsyncContext mocked method

func (*RuntimeContextMock) GetAsyncContextInfo

func (r *RuntimeContextMock) GetAsyncContextInfo() *vmhost.AsyncContextInfo

GetAsyncContextInfo mocked method

func (*RuntimeContextMock) GetContextAddress

func (r *RuntimeContextMock) GetContextAddress() []byte

GetContextAddress mocked method

func (*RuntimeContextMock) GetCurrentTxHash

func (r *RuntimeContextMock) GetCurrentTxHash() []byte

GetCurrentTxHash mocked method

func (*RuntimeContextMock) GetFunctionToCall

func (r *RuntimeContextMock) GetFunctionToCall() (string, error)

GetFunctionToCall mocked method

func (*RuntimeContextMock) GetInitFunction

func (r *RuntimeContextMock) GetInitFunction() string

GetInitFunction mocked method

func (*RuntimeContextMock) GetInstance

func (r *RuntimeContextMock) GetInstance() wasmer.InstanceHandler

GetInstance mocked method

func (*RuntimeContextMock) GetInstanceExports

func (r *RuntimeContextMock) GetInstanceExports() wasmer.ExportsMap

GetInstanceExports mocked method

func (*RuntimeContextMock) GetOriginalTxHash

func (r *RuntimeContextMock) GetOriginalTxHash() []byte

GetOriginalTxHash mocked method

func (*RuntimeContextMock) GetPointsUsed

func (r *RuntimeContextMock) GetPointsUsed() uint64

GetPointsUsed mocked method

func (*RuntimeContextMock) GetRuntimeBreakpointValue

func (r *RuntimeContextMock) GetRuntimeBreakpointValue() vmhost.BreakpointValue

GetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) GetSCCode

func (r *RuntimeContextMock) GetSCCode() ([]byte, error)

GetSCCode mocked method

func (*RuntimeContextMock) GetSCCodeSize

func (r *RuntimeContextMock) GetSCCodeSize() uint64

GetSCCodeSize mocked method

func (*RuntimeContextMock) GetVMInput

GetVMInput mocked method

func (*RuntimeContextMock) GetVMType

func (r *RuntimeContextMock) GetVMType() []byte

GetVMType mocked method

func (*RuntimeContextMock) GetWarmInstance

func (r *RuntimeContextMock) GetWarmInstance(codeHash []byte) (wasmer.InstanceHandler, bool)

GetWarmInstance mocked method

func (*RuntimeContextMock) InitState

func (r *RuntimeContextMock) InitState()

InitState mocked method

func (*RuntimeContextMock) InitStateFromContractCallInput

func (r *RuntimeContextMock) InitStateFromContractCallInput(_ *vmcommon.ContractCallInput)

InitStateFromContractCallInput mocked method

func (*RuntimeContextMock) IsFunctionImported

func (r *RuntimeContextMock) IsFunctionImported(_ string) bool

IsFunctionImported mocked method

func (*RuntimeContextMock) IsWarmInstance

func (r *RuntimeContextMock) IsWarmInstance() bool

IsWarmInstance mocked method

func (*RuntimeContextMock) ManagedBufferAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ManagedBufferAPIErrorShouldFailExecution() bool

ManagedBufferAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) MemLoad

func (r *RuntimeContextMock) MemLoad(_ int32, _ int32) ([]byte, error)

MemLoad mocked method

func (*RuntimeContextMock) MemLoadMultiple

func (r *RuntimeContextMock) MemLoadMultiple(_ int32, _ []int32) ([][]byte, error)

MemLoadMultiple mocked method

func (*RuntimeContextMock) MemStore

func (r *RuntimeContextMock) MemStore(_ int32, _ []byte) error

MemStore mocked method

func (*RuntimeContextMock) MustVerifyNextContractCode

func (r *RuntimeContextMock) MustVerifyNextContractCode()

MustVerifyNextContractCode mocked method

func (*RuntimeContextMock) PopDiscard

func (r *RuntimeContextMock) PopDiscard()

PopDiscard mocked method

func (*RuntimeContextMock) PopInstance

func (r *RuntimeContextMock) PopInstance()

PopInstance mocked method

func (*RuntimeContextMock) PopSetActiveState

func (r *RuntimeContextMock) PopSetActiveState()

PopSetActiveState mocked method

func (*RuntimeContextMock) PushInstance

func (r *RuntimeContextMock) PushInstance()

PushInstance mocked method

func (*RuntimeContextMock) PushState

func (r *RuntimeContextMock) PushState()

PushState mocked method

func (*RuntimeContextMock) ReadOnly

func (r *RuntimeContextMock) ReadOnly() bool

ReadOnly mocked method

func (*RuntimeContextMock) ReplaceInstanceBuilder

func (r *RuntimeContextMock) ReplaceInstanceBuilder(_ vmhost.InstanceBuilder)

ReplaceInstanceBuilder mocked method()

func (*RuntimeContextMock) ResetWarmInstance

func (r *RuntimeContextMock) ResetWarmInstance()

ResetWarmInstance mocked method

func (*RuntimeContextMock) RunningInstancesCount

func (r *RuntimeContextMock) RunningInstancesCount() uint64

RunningInstancesCount mocked method

func (*RuntimeContextMock) SetAsyncCallInfo

func (r *RuntimeContextMock) SetAsyncCallInfo(asyncCallInfo *vmhost.AsyncCallInfo)

SetAsyncCallInfo mocked method

func (*RuntimeContextMock) SetCaching

func (r *RuntimeContextMock) SetCaching(_ bool)

SetCaching mocked method

func (*RuntimeContextMock) SetCodeAddress

func (r *RuntimeContextMock) SetCodeAddress(scAddress []byte)

SetCodeAddress mocked method

func (*RuntimeContextMock) SetCustomCallFunction

func (r *RuntimeContextMock) SetCustomCallFunction(_ string)

SetCustomCallFunction mocked method

func (*RuntimeContextMock) SetMaxInstanceCount

func (r *RuntimeContextMock) SetMaxInstanceCount(uint64)

SetMaxInstanceCount mocked method

func (*RuntimeContextMock) SetPointsUsed

func (r *RuntimeContextMock) SetPointsUsed(gasPoints uint64)

SetPointsUsed mocked method

func (*RuntimeContextMock) SetReadOnly

func (r *RuntimeContextMock) SetReadOnly(readOnly bool)

SetReadOnly mocked method

func (*RuntimeContextMock) SetRuntimeBreakpointValue

func (r *RuntimeContextMock) SetRuntimeBreakpointValue(_ vmhost.BreakpointValue)

SetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) SetVMInput

func (r *RuntimeContextMock) SetVMInput(vmInput *vmcommon.ContractCallInput)

SetVMInput mocked method

func (*RuntimeContextMock) SignalExit

func (r *RuntimeContextMock) SignalExit(_ int)

SignalExit mocked method

func (*RuntimeContextMock) SignalUserError

func (r *RuntimeContextMock) SignalUserError(_ string)

SignalUserError mocked method

func (*RuntimeContextMock) StartWasmerInstance

func (r *RuntimeContextMock) StartWasmerInstance(_ []byte, _ uint64, _ bool) error

StartWasmerInstance mocked method

func (*RuntimeContextMock) SyncExecAPIErrorShouldFailExecution

func (r *RuntimeContextMock) SyncExecAPIErrorShouldFailExecution() bool

SyncExecAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) ValidateInstances

func (r *RuntimeContextMock) ValidateInstances() error

ValidateInstances -

func (*RuntimeContextMock) VerifyContractCode

func (r *RuntimeContextMock) VerifyContractCode() error

VerifyContractCode mocked method

type RuntimeContextWrapper

type RuntimeContextWrapper struct {

	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	InitStateFromContractCallInputFunc func(input *vmcommon.ContractCallInput)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetCustomCallFunctionFunc func(callFunction string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetVMInputFunc func() *vmcommon.ContractCallInput
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetVMInputFunc func(vmInput *vmcommon.ContractCallInput)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCAddressFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetCodeAddressFunc func(scAddress []byte)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCCodeFunc func() ([]byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCCodeSizeFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetVMTypeFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	FunctionFunc func() string
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ArgumentsFunc func() [][]byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetCurrentTxHashFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetOriginalTxHashFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ExtractCodeUpgradeFromArgsFunc func() ([]byte, []byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SignalUserErrorFunc func(message string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	FailExecutionFunc func(err error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	MustVerifyNextContractCodeFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetRuntimeBreakpointValueFunc func(value vmhost.BreakpointValue)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetRuntimeBreakpointValueFunc func() vmhost.BreakpointValue
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncCallInfoFunc func() *vmhost.AsyncCallInfo
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetAsyncCallInfoFunc func(asyncCallInfo *vmhost.AsyncCallInfo)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	AddAsyncContextCallFunc func(contextIdentifier []byte, asyncCall *vmhost.AsyncGeneratedCall) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncContextInfoFunc func() *vmhost.AsyncContextInfo
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncContextFunc func(contextIdentifier []byte) (*vmhost.AsyncContext, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	RunningInstancesCountFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	IsFunctionImportedFunc func(name string) bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ReadOnlyFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetReadOnlyFunc func(readOnly bool)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	StartWasmerInstanceFunc func(contract []byte, gasLimit uint64, newCode bool) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ClearWarmInstanceCacheFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetMaxInstanceCountFunc func(maxInstances uint64)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	VerifyContractCodeFunc func() error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetInstanceFunc func() wasmer.InstanceHandler
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetWarmInstanceFunc func(codeHash []byte) (wasmer.InstanceHandler, bool)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetInstanceExportsFunc func() wasmer.ExportsMap
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CallFunctionFunc func(funcName string) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetInitFunctionFunc func() string
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetFunctionToCallFunc func() (string, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetPointsUsedFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetPointsUsedFunc func(gasPoints uint64)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	MemStoreFunc func(offset int32, data []byte) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	MemLoadFunc func(offset int32, length int32) ([]byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	MemLoadMultipleFunc func(offset int32, lengths []int32) ([][]byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BaseOpsErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SyncExecAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CryptoAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BigIntAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BigFloatAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ManagedBufferAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ExecuteAsyncCallFunc func(address []byte, data []byte, value []byte) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ReplaceInstanceBuilderFunc func(builder vmhost.InstanceBuilder)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	AddErrorFunc func(err error, otherInfo ...string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAllErrorsFunc func() error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	InitStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PushStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PopSetActiveStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PopDiscardFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ClearStateStackFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CleanInstanceFunc func()
	// contains filtered or unexported fields
}

RuntimeContextWrapper a wrapper over a RuntimeContext that delegates to if if function is not redefined

func NewRuntimeContextWrapper

func NewRuntimeContextWrapper(inputRuntimeContext *vmhost.RuntimeContext) *RuntimeContextWrapper

NewRuntimeContextWrapper builds a new runtimeContextWrapper that by default will delagate all calls to the provided RuntimeContext

func (*RuntimeContextWrapper) AddAsyncContextCall

func (contextWrapper *RuntimeContextWrapper) AddAsyncContextCall(contextIdentifier []byte, asyncCall *vmhost.AsyncGeneratedCall) error

AddAsyncContextCall calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) AddError

func (contextWrapper *RuntimeContextWrapper) AddError(err error, otherInfo ...string)

AddError calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) Arguments

func (contextWrapper *RuntimeContextWrapper) Arguments() [][]byte

Arguments calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) BaseOpsErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BaseOpsErrorShouldFailExecution() bool

BaseOpsErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) BigFloatAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BigFloatAPIErrorShouldFailExecution() bool

BigFloatAPIErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) BigIntAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BigIntAPIErrorShouldFailExecution() bool

BigIntAPIErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) CallFunction

func (contextWrapper *RuntimeContextWrapper) CallFunction(funcName string) error

CallFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) CleanInstance

func (contextWrapper *RuntimeContextWrapper) CleanInstance()

CleanInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ClearStateStack

func (contextWrapper *RuntimeContextWrapper) ClearStateStack()

ClearStateStack calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ClearWarmInstanceCache

func (contextWrapper *RuntimeContextWrapper) ClearWarmInstanceCache()

ClearWarmInstanceCache calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) CryptoAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) CryptoAPIErrorShouldFailExecution() bool

CryptoAPIErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) EndExecution

func (contextWrapper *RuntimeContextWrapper) EndExecution()

EndExecution -

func (*RuntimeContextWrapper) ExecuteAsyncCall

func (contextWrapper *RuntimeContextWrapper) ExecuteAsyncCall(address []byte, data []byte, value []byte) error

ExecuteAsyncCall calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ExtractCodeUpgradeFromArgs

func (contextWrapper *RuntimeContextWrapper) ExtractCodeUpgradeFromArgs() ([]byte, []byte, error)

ExtractCodeUpgradeFromArgs calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) FailExecution

func (contextWrapper *RuntimeContextWrapper) FailExecution(err error)

FailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) Function

func (contextWrapper *RuntimeContextWrapper) Function() string

Function calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetAllErrors

func (contextWrapper *RuntimeContextWrapper) GetAllErrors() error

GetAllErrors calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetAsyncCallInfo

func (contextWrapper *RuntimeContextWrapper) GetAsyncCallInfo() *vmhost.AsyncCallInfo

GetAsyncCallInfo calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetAsyncContext

func (contextWrapper *RuntimeContextWrapper) GetAsyncContext(contextIdentifier []byte) (*vmhost.AsyncContext, error)

GetAsyncContext calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetAsyncContextInfo

func (contextWrapper *RuntimeContextWrapper) GetAsyncContextInfo() *vmhost.AsyncContextInfo

GetAsyncContextInfo calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetContextAddress

func (contextWrapper *RuntimeContextWrapper) GetContextAddress() []byte

GetContextAddress calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetCurrentTxHash

func (contextWrapper *RuntimeContextWrapper) GetCurrentTxHash() []byte

GetCurrentTxHash calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetFunctionToCall

func (contextWrapper *RuntimeContextWrapper) GetFunctionToCall() (string, error)

GetFunctionToCall calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetInitFunction

func (contextWrapper *RuntimeContextWrapper) GetInitFunction() string

GetInitFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetInstance

func (contextWrapper *RuntimeContextWrapper) GetInstance() wasmer.InstanceHandler

GetInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetInstanceExports

func (contextWrapper *RuntimeContextWrapper) GetInstanceExports() wasmer.ExportsMap

GetInstanceExports calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetOriginalTxHash

func (contextWrapper *RuntimeContextWrapper) GetOriginalTxHash() []byte

GetOriginalTxHash calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetPointsUsed

func (contextWrapper *RuntimeContextWrapper) GetPointsUsed() uint64

GetPointsUsed calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetRuntimeBreakpointValue

func (contextWrapper *RuntimeContextWrapper) GetRuntimeBreakpointValue() vmhost.BreakpointValue

GetRuntimeBreakpointValue calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetSCCode

func (contextWrapper *RuntimeContextWrapper) GetSCCode() ([]byte, error)

GetSCCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetSCCodeSize

func (contextWrapper *RuntimeContextWrapper) GetSCCodeSize() uint64

GetSCCodeSize calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetVMInput

func (contextWrapper *RuntimeContextWrapper) GetVMInput() *vmcommon.ContractCallInput

GetVMInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetVMType

func (contextWrapper *RuntimeContextWrapper) GetVMType() []byte

GetVMType calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetWarmInstance

func (contextWrapper *RuntimeContextWrapper) GetWarmInstance(codeHash []byte) (wasmer.InstanceHandler, bool)

GetWarmInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) GetWrappedRuntimeContext

func (contextWrapper *RuntimeContextWrapper) GetWrappedRuntimeContext() vmhost.RuntimeContext

GetWrappedRuntimeContext gets the wrapped RuntimeContext

func (*RuntimeContextWrapper) InitState

func (contextWrapper *RuntimeContextWrapper) InitState()

InitState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) InitStateFromContractCallInput

func (contextWrapper *RuntimeContextWrapper) InitStateFromContractCallInput(input *vmcommon.ContractCallInput)

InitStateFromContractCallInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) IsFunctionImported

func (contextWrapper *RuntimeContextWrapper) IsFunctionImported(name string) bool

IsFunctionImported calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ManagedBufferAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) ManagedBufferAPIErrorShouldFailExecution() bool

ManagedBufferAPIErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) MemLoad

func (contextWrapper *RuntimeContextWrapper) MemLoad(offset int32, length int32) ([]byte, error)

MemLoad calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) MemLoadMultiple

func (contextWrapper *RuntimeContextWrapper) MemLoadMultiple(offset int32, lengths []int32) ([][]byte, error)

MemLoadMultiple calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) MemStore

func (contextWrapper *RuntimeContextWrapper) MemStore(offset int32, data []byte) error

MemStore calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) MustVerifyNextContractCode

func (contextWrapper *RuntimeContextWrapper) MustVerifyNextContractCode()

MustVerifyNextContractCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) PopDiscard

func (contextWrapper *RuntimeContextWrapper) PopDiscard()

PopDiscard calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) PopSetActiveState

func (contextWrapper *RuntimeContextWrapper) PopSetActiveState()

PopSetActiveState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) PushState

func (contextWrapper *RuntimeContextWrapper) PushState()

PushState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ReadOnly

func (contextWrapper *RuntimeContextWrapper) ReadOnly() bool

ReadOnly calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ReplaceInstanceBuilder

func (contextWrapper *RuntimeContextWrapper) ReplaceInstanceBuilder(builder vmhost.InstanceBuilder)

ReplaceInstanceBuilder calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) RunningInstancesCount

func (contextWrapper *RuntimeContextWrapper) RunningInstancesCount() uint64

RunningInstancesCount calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetAsyncCallInfo

func (contextWrapper *RuntimeContextWrapper) SetAsyncCallInfo(asyncCallInfo *vmhost.AsyncCallInfo)

SetAsyncCallInfo calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetCodeAddress

func (contextWrapper *RuntimeContextWrapper) SetCodeAddress(scAddress []byte)

SetCodeAddress calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetCustomCallFunction

func (contextWrapper *RuntimeContextWrapper) SetCustomCallFunction(callFunction string)

SetCustomCallFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetMaxInstanceCount

func (contextWrapper *RuntimeContextWrapper) SetMaxInstanceCount(maxInstances uint64)

SetMaxInstanceCount calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetPointsUsed

func (contextWrapper *RuntimeContextWrapper) SetPointsUsed(gasPoints uint64)

SetPointsUsed calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetReadOnly

func (contextWrapper *RuntimeContextWrapper) SetReadOnly(readOnly bool)

SetReadOnly calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetRuntimeBreakpointValue

func (contextWrapper *RuntimeContextWrapper) SetRuntimeBreakpointValue(value vmhost.BreakpointValue)

SetRuntimeBreakpointValue calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SetVMInput

func (contextWrapper *RuntimeContextWrapper) SetVMInput(vmInput *vmcommon.ContractCallInput)

SetVMInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SignalUserError

func (contextWrapper *RuntimeContextWrapper) SignalUserError(message string)

SignalUserError calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) StartWasmerInstance

func (contextWrapper *RuntimeContextWrapper) StartWasmerInstance(contract []byte, gasLimit uint64, newCode bool) error

StartWasmerInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) SyncExecAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) SyncExecAPIErrorShouldFailExecution() bool

SyncExecAPIErrorShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

func (*RuntimeContextWrapper) ValidateInstances

func (contextWrapper *RuntimeContextWrapper) ValidateInstances() error

ValidateInstances -

func (*RuntimeContextWrapper) VerifyContractCode

func (contextWrapper *RuntimeContextWrapper) VerifyContractCode() error

VerifyContractCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext

type StubAccount

type StubAccount struct {
	Address      []byte
	Nonce        uint64
	Balance      *big.Int
	CodeHash     []byte
	CodeMetadata []byte
	OwnerAddress []byte
	UserName     []byte

	ShardID uint32
	Storage map[string][]byte
	Err     error
}

StubAccount is used with the blockchain stub in vm context tests. It has minimal functionality.

func (*StubAccount) AccountDataHandler

func (a *StubAccount) AccountDataHandler() vmcommon.AccountDataHandler

AccountDataHandler -

func (*StubAccount) AddToBalance

func (a *StubAccount) AddToBalance(_ *big.Int) error

AddToBalance -

func (*StubAccount) AddressBytes

func (a *StubAccount) AddressBytes() []byte

AddressBytes -

func (*StubAccount) ChangeOwnerAddress

func (a *StubAccount) ChangeOwnerAddress(_ []byte, _ []byte) error

ChangeOwnerAddress -

func (*StubAccount) ClaimDeveloperRewards

func (a *StubAccount) ClaimDeveloperRewards(_ []byte) (*big.Int, error)

ClaimDeveloperRewards -

func (*StubAccount) GetBalance

func (a *StubAccount) GetBalance() *big.Int

GetBalance -

func (*StubAccount) GetCodeHash

func (a *StubAccount) GetCodeHash() []byte

GetCodeHash -

func (*StubAccount) GetCodeMetadata

func (a *StubAccount) GetCodeMetadata() []byte

GetCodeMetadata -

func (*StubAccount) GetDeveloperReward

func (a *StubAccount) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*StubAccount) GetNonce

func (a *StubAccount) GetNonce() uint64

GetNonce -

func (*StubAccount) GetOwnerAddress

func (a *StubAccount) GetOwnerAddress() []byte

GetOwnerAddress -

func (*StubAccount) GetRootHash

func (a *StubAccount) GetRootHash() []byte

GetRootHash -

func (*StubAccount) GetUserName

func (a *StubAccount) GetUserName() []byte

GetUserName -

func (*StubAccount) IncreaseNonce

func (a *StubAccount) IncreaseNonce(_ uint64)

IncreaseNonce -

func (*StubAccount) IsInterfaceNil

func (a *StubAccount) IsInterfaceNil() bool

IsInterfaceNil -

func (*StubAccount) SetCodeMetadata added in v1.4.78

func (a *StubAccount) SetCodeMetadata(_ []byte)

SetCodeMetadata -

func (*StubAccount) SetOwnerAddress

func (a *StubAccount) SetOwnerAddress(_ []byte)

SetOwnerAddress -

func (*StubAccount) SetUserName

func (a *StubAccount) SetUserName(_ []byte)

SetUserName -

type VMHostMock

type VMHostMock struct {
	BlockChainHook vmcommon.BlockchainHook
	CryptoHook     crypto.VMCrypto

	EthInput []byte

	BlockchainContext        vmhost.BlockchainContext
	RuntimeContext           vmhost.RuntimeContext
	OutputContext            vmhost.OutputContext
	MeteringContext          vmhost.MeteringContext
	StorageContext           vmhost.StorageContext
	EnableEpochsHandlerField vmcommon.EnableEpochsHandler
	ManagedTypesContext      vmhost.ManagedTypesContext

	SCAPIMethods  *wasmer.Imports
	IsBuiltinFunc bool
}

VMHostMock is used in tests to check the VMHost interface method calls

func (*VMHostMock) AreInSameShard

func (host *VMHostMock) AreInSameShard(_ []byte, _ []byte) bool

AreInSameShard mocked method

func (*VMHostMock) Blockchain

func (host *VMHostMock) Blockchain() vmhost.BlockchainContext

Blockchain mocked method

func (*VMHostMock) CheckExecuteReadOnly

func (host *VMHostMock) CheckExecuteReadOnly() bool

CheckExecuteReadOnly mocked method

func (*VMHostMock) ClearStateStack

func (host *VMHostMock) ClearStateStack()

ClearStateStack mocked method

func (*VMHostMock) Close

func (host *VMHostMock) Close() error

Close -

func (*VMHostMock) CreateNFTOnExecByCallerEnabled

func (host *VMHostMock) CreateNFTOnExecByCallerEnabled() bool

CreateNFTOnExecByCallerEnabled mocked method

func (*VMHostMock) CreateNewContract

func (host *VMHostMock) CreateNewContract(_ *vmcommon.ContractCreateInput) ([]byte, error)

CreateNewContract mocked method

func (*VMHostMock) Crypto

func (host *VMHostMock) Crypto() crypto.VMCrypto

Crypto mocked method

func (*VMHostMock) DisableExecByCaller

func (host *VMHostMock) DisableExecByCaller() bool

DisableExecByCaller mocked method

func (*VMHostMock) EnableEpochsHandler

func (host *VMHostMock) EnableEpochsHandler() vmcommon.EnableEpochsHandler

EnableEpochsHandler mocked method

func (*VMHostMock) EpochsStub

func (host *VMHostMock) EpochsStub() *mock.EnableEpochsHandlerStub

EpochsStub returns the EnableEpochsHandlerField casted to the corresponding stub

func (*VMHostMock) ExecuteESDTTransfer

func (host *VMHostMock) ExecuteESDTTransfer(_ []byte, _ []byte, _ []*vmcommon.ESDTTransfer, _ vm.CallType) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostMock) ExecuteOnDestContext

func (host *VMHostMock) ExecuteOnDestContext(_ *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *vmhost.AsyncContextInfo, error)

ExecuteOnDestContext mocked method

func (*VMHostMock) ExecuteOnSameContext

func (host *VMHostMock) ExecuteOnSameContext(_ *vmcommon.ContractCallInput) (*vmhost.AsyncContextInfo, error)

ExecuteOnSameContext mocked method

func (*VMHostMock) FixFailExecutionEnabled

func (host *VMHostMock) FixFailExecutionEnabled() bool

FixFailExecutionEnabled mocked method

func (*VMHostMock) FixOOGReturnCodeEnabled

func (host *VMHostMock) FixOOGReturnCodeEnabled() bool

FixOOGReturnCodeEnabled mocked method

func (*VMHostMock) GasScheduleChange

func (host *VMHostMock) GasScheduleChange(_ config.GasScheduleMap)

GasScheduleChange mocked method

func (*VMHostMock) GetAPIMethods

func (host *VMHostMock) GetAPIMethods() *wasmer.Imports

GetAPIMethods mocked method

func (*VMHostMock) GetGasScheduleMap

func (host *VMHostMock) GetGasScheduleMap() config.GasScheduleMap

GetGasScheduleMap mocked method

func (*VMHostMock) GetVersion

func (host *VMHostMock) GetVersion() string

GetVersion mocked method

func (*VMHostMock) InitState

func (host *VMHostMock) InitState()

InitState mocked method

func (*VMHostMock) IsAheadOfTimeCompileEnabled

func (host *VMHostMock) IsAheadOfTimeCompileEnabled() bool

IsAheadOfTimeCompileEnabled mocked method

func (*VMHostMock) IsBuiltinFunctionName

func (host *VMHostMock) IsBuiltinFunctionName(_ string) bool

IsBuiltinFunctionName mocked method

func (*VMHostMock) IsDynamicGasLockingEnabled

func (host *VMHostMock) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled mocked method

func (*VMHostMock) IsESDTFunctionsEnabled

func (host *VMHostMock) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostMock) IsInterfaceNil

func (host *VMHostMock) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostMock) IsVMV2Enabled

func (host *VMHostMock) IsVMV2Enabled() bool

IsVMV2Enabled mocked method

func (*VMHostMock) IsVMV3Enabled

func (host *VMHostMock) IsVMV3Enabled() bool

IsVMV3Enabled mocked method

func (*VMHostMock) ManagedTypes

func (host *VMHostMock) ManagedTypes() vmhost.ManagedTypesContext

ManagedTypes mocked method

func (*VMHostMock) Metering

func (host *VMHostMock) Metering() vmhost.MeteringContext

Metering mocked method

func (*VMHostMock) Output

func (host *VMHostMock) Output() vmhost.OutputContext

Output mocked method

func (*VMHostMock) PopState

func (host *VMHostMock) PopState()

PopState mocked method

func (*VMHostMock) PushState

func (host *VMHostMock) PushState()

PushState mocked method

func (*VMHostMock) Reset

func (host *VMHostMock) Reset()

Reset -

func (*VMHostMock) RunSmartContractCall

func (host *VMHostMock) RunSmartContractCall(_ *vmcommon.ContractCallInput) (vmOutput *vmcommon.VMOutput, err error)

RunSmartContractCall mocked method

func (*VMHostMock) RunSmartContractCreate

func (host *VMHostMock) RunSmartContractCreate(_ *vmcommon.ContractCreateInput) (vmOutput *vmcommon.VMOutput, err error)

RunSmartContractCreate mocked method

func (*VMHostMock) Runtime

func (host *VMHostMock) Runtime() vmhost.RuntimeContext

Runtime mocked method

func (*VMHostMock) SetBuiltInFunctionsContainer

func (host *VMHostMock) SetBuiltInFunctionsContainer(_ vmcommon.BuiltInFunctionContainer)

SetBuiltInFunctionsContainer mocked method

func (*VMHostMock) SetRuntimeContext

func (host *VMHostMock) SetRuntimeContext(runtime vmhost.RuntimeContext)

SetRuntimeContext mocked method

func (*VMHostMock) Storage

func (host *VMHostMock) Storage() vmhost.StorageContext

Storage mocked method

type VMHostStub

type VMHostStub struct {
	InitStateCalled       func()
	PushStateCalled       func()
	PopStateCalled        func()
	ClearStateStackCalled func()
	GetVersionCalled      func() string

	CryptoCalled                func() crypto.VMCrypto
	BlockchainCalled            func() vmhost.BlockchainContext
	RuntimeCalled               func() vmhost.RuntimeContext
	ManagedTypesCalled          func() vmhost.ManagedTypesContext
	OutputCalled                func() vmhost.OutputContext
	MeteringCalled              func() vmhost.MeteringContext
	StorageCalled               func() vmhost.StorageContext
	EnableEpochsHandlerCalled   func() vmcommon.EnableEpochsHandler
	ExecuteESDTTransferCalled   func(destination []byte, sender []byte, transfers []*vmcommon.ESDTTransfer, callType vm.CallType) (*vmcommon.VMOutput, uint64, error)
	CreateNewContractCalled     func(input *vmcommon.ContractCreateInput) ([]byte, error)
	ExecuteOnSameContextCalled  func(input *vmcommon.ContractCallInput) (*vmhost.AsyncContextInfo, error)
	ExecuteOnDestContextCalled  func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *vmhost.AsyncContextInfo, error)
	GetAPIMethodsCalled         func() *wasmer.Imports
	IsBuiltinFunctionNameCalled func(functionName string) bool
	AreInSameShardCalled        func(left []byte, right []byte) bool

	RunSmartContractCallCalled   func(input *vmcommon.ContractCallInput) (vmOutput *vmcommon.VMOutput, err error)
	RunSmartContractCreateCalled func(input *vmcommon.ContractCreateInput) (vmOutput *vmcommon.VMOutput, err error)
	GetGasScheduleMapCalled      func() config.GasScheduleMap
	GasScheduleChangeCalled      func(newGasSchedule config.GasScheduleMap)
	IsInterfaceNilCalled         func() bool

	SetRuntimeContextCalled func(runtime vmhost.RuntimeContext)
	GetContextsCalled       func() (vmhost.ManagedTypesContext, vmhost.BlockchainContext, vmhost.MeteringContext, vmhost.OutputContext, vmhost.RuntimeContext, vmhost.StorageContext)

	SetBuiltInFunctionsContainerCalled func(builtInFuncs vmcommon.BuiltInFunctionContainer)
}

VMHostStub is used in tests to check the VMHost interface method calls

func (*VMHostStub) AreInSameShard

func (vhs *VMHostStub) AreInSameShard(left []byte, right []byte) bool

AreInSameShard mocked method

func (*VMHostStub) Blockchain

func (vhs *VMHostStub) Blockchain() vmhost.BlockchainContext

Blockchain mocked method

func (*VMHostStub) CheckExecuteReadOnly

func (vhs *VMHostStub) CheckExecuteReadOnly() bool

CheckExecuteReadOnly mocked method

func (*VMHostStub) ClearStateStack

func (vhs *VMHostStub) ClearStateStack()

ClearStateStack mocked method

func (*VMHostStub) Close

func (vhs *VMHostStub) Close() error

Close -

func (*VMHostStub) CreateNFTOnExecByCallerEnabled

func (vhs *VMHostStub) CreateNFTOnExecByCallerEnabled() bool

CreateNFTOnExecByCallerEnabled mocked method

func (*VMHostStub) CreateNewContract

func (vhs *VMHostStub) CreateNewContract(input *vmcommon.ContractCreateInput) ([]byte, error)

CreateNewContract mocked method

func (*VMHostStub) Crypto

func (vhs *VMHostStub) Crypto() crypto.VMCrypto

Crypto mocked method

func (*VMHostStub) DisableExecByCaller

func (vhs *VMHostStub) DisableExecByCaller() bool

DisableExecByCaller mocked method

func (*VMHostStub) EnableEpochsHandler

func (vhs *VMHostStub) EnableEpochsHandler() vmcommon.EnableEpochsHandler

EnableEpochsHandler mocked method

func (*VMHostStub) ExecuteESDTTransfer

func (vhs *VMHostStub) ExecuteESDTTransfer(destination []byte, sender []byte, transfers []*vmcommon.ESDTTransfer, callType vm.CallType) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostStub) ExecuteOnDestContext

func (vhs *VMHostStub) ExecuteOnDestContext(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *vmhost.AsyncContextInfo, error)

ExecuteOnDestContext mocked method

func (*VMHostStub) ExecuteOnSameContext

func (vhs *VMHostStub) ExecuteOnSameContext(input *vmcommon.ContractCallInput) (*vmhost.AsyncContextInfo, error)

ExecuteOnSameContext mocked method

func (*VMHostStub) FixFailExecutionEnabled

func (vhs *VMHostStub) FixFailExecutionEnabled() bool

FixFailExecutionEnabled mocked method

func (*VMHostStub) FixOOGReturnCodeEnabled

func (vhs *VMHostStub) FixOOGReturnCodeEnabled() bool

FixOOGReturnCodeEnabled mocked method

func (*VMHostStub) GasScheduleChange

func (vhs *VMHostStub) GasScheduleChange(newGasSchedule config.GasScheduleMap)

GasScheduleChange mocked method

func (*VMHostStub) GetAPIMethods

func (vhs *VMHostStub) GetAPIMethods() *wasmer.Imports

GetAPIMethods mocked method

func (*VMHostStub) GetGasScheduleMap

func (vhs *VMHostStub) GetGasScheduleMap() config.GasScheduleMap

GetGasScheduleMap returns the currently stored gas schedule

func (*VMHostStub) GetVersion

func (vhs *VMHostStub) GetVersion() string

GetVersion mocked method

func (*VMHostStub) InitState

func (vhs *VMHostStub) InitState()

InitState mocked method

func (*VMHostStub) IsAheadOfTimeCompileEnabled

func (vhs *VMHostStub) IsAheadOfTimeCompileEnabled() bool

IsAheadOfTimeCompileEnabled mocked method

func (*VMHostStub) IsBuiltinFunctionName

func (vhs *VMHostStub) IsBuiltinFunctionName(functionName string) bool

IsBuiltinFunctionName mocked method

func (*VMHostStub) IsDynamicGasLockingEnabled

func (vhs *VMHostStub) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled mocked method

func (*VMHostStub) IsESDTFunctionsEnabled

func (vhs *VMHostStub) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostStub) IsInterfaceNil

func (vhs *VMHostStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostStub) IsVMV2Enabled

func (vhs *VMHostStub) IsVMV2Enabled() bool

IsVMV2Enabled mocked method

func (*VMHostStub) IsVMV3Enabled

func (vhs *VMHostStub) IsVMV3Enabled() bool

IsVMV3Enabled mocked method

func (*VMHostStub) ManagedTypes

func (vhs *VMHostStub) ManagedTypes() vmhost.ManagedTypesContext

ManagedTypes mocked method

func (*VMHostStub) Metering

func (vhs *VMHostStub) Metering() vmhost.MeteringContext

Metering mocked method

func (*VMHostStub) Output

func (vhs *VMHostStub) Output() vmhost.OutputContext

Output mocked method

func (*VMHostStub) PopState

func (vhs *VMHostStub) PopState()

PopState mocked method

func (*VMHostStub) PushState

func (vhs *VMHostStub) PushState()

PushState mocked method

func (*VMHostStub) Reset

func (vhs *VMHostStub) Reset()

Reset -

func (*VMHostStub) RunSmartContractCall

func (vhs *VMHostStub) RunSmartContractCall(input *vmcommon.ContractCallInput) (vmOutput *vmcommon.VMOutput, err error)

RunSmartContractCall mocked method

func (*VMHostStub) RunSmartContractCreate

func (vhs *VMHostStub) RunSmartContractCreate(input *vmcommon.ContractCreateInput) (vmOutput *vmcommon.VMOutput, err error)

RunSmartContractCreate mocked method

func (*VMHostStub) Runtime

func (vhs *VMHostStub) Runtime() vmhost.RuntimeContext

Runtime mocked method

func (*VMHostStub) SetBuiltInFunctionsContainer

func (vhs *VMHostStub) SetBuiltInFunctionsContainer(builtInFuncs vmcommon.BuiltInFunctionContainer)

SetBuiltInFunctionsContainer mocked method

func (*VMHostStub) SetRuntimeContext

func (vhs *VMHostStub) SetRuntimeContext(runtime vmhost.RuntimeContext)

SetRuntimeContext mocked method

func (*VMHostStub) Storage

func (vhs *VMHostStub) Storage() vmhost.StorageContext

Storage mocked method

Jump to

Keyboard shortcuts

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