mock

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: GPL-3.0 Imports: 10 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, 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)
}

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) 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 added in v1.0.2

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 added in v1.2.0

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) GetStateRootHash

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

GetStateRootHash mocked method

func (*BlockchainHookStub) GetStorageData

func (b *BlockchainHookStub) GetStorageData(accountAddress []byte, index []byte) ([]byte, 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) 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) 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(hash []byte, recoveryID []byte, r []byte, s []byte) ([]byte, error)

Ecrecover mocked method

func (*CryptoHookMock) Keccak256

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

Keccak256 mocked method

func (*CryptoHookMock) Ripemd160

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

Ripemd160 mocked method

func (*CryptoHookMock) Sha256

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

Sha256 mocked method

func (*CryptoHookMock) VerifyBLS

func (c *CryptoHookMock) VerifyBLS(key []byte, msg []byte, sig []byte) error

VerifyBLS mocked method

func (*CryptoHookMock) VerifyEd25519

func (c *CryptoHookMock) VerifyEd25519(key []byte, msg []byte, sig []byte) error

VerifyEd25519 mocked method

func (*CryptoHookMock) VerifySecp256k1

func (c *CryptoHookMock) VerifySecp256k1(key []byte, msg []byte, sig []byte) 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 arwen.VMHost, code []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) 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 added in v1.2.9

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

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

func NewInstanceBuilderRecorderMock added in v1.2.9

func NewInstanceBuilderRecorderMock() *InstanceBuilderRecorderMock

NewInstanceBuilderRecorderMock constructs a new InstanceBuilderRecorderMock

func (*InstanceBuilderRecorderMock) GetContractInstances added in v1.2.9

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

GetContractInstances gets contract instances for code

func (*InstanceBuilderRecorderMock) NewInstanceFromCompiledCodeWithOptions added in v1.2.9

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

NewInstanceFromCompiledCodeWithOptions - see InstanceBuilderMock.NewInstanceFromCompiledCodeWithOptions()

func (*InstanceBuilderRecorderMock) NewInstanceWithOptions added in v1.2.9

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

NewInstanceWithOptions - see InstanceBuilderMock.NewInstanceWithOptions()

type InstanceMock added in v1.1.2

type InstanceMock struct {
	Code            []byte
	Exports         wasmer.ExportsMap
	Points          uint64
	Data            uintptr
	GasLimit        uint64
	BreakpointValue uint64
	Memory          wasmer.MemoryHandler
	Host            arwen.VMHost
	T               testing.TB
	Address         []byte
}

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

func GetMockInstance added in v1.3.0

func GetMockInstance(host arwen.VMHost) *InstanceMock

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

func NewInstanceMock added in v1.1.2

func NewInstanceMock(code []byte) *InstanceMock

NewInstanceMock creates a new InstanceMock

func (*InstanceMock) AddMockMethod added in v1.1.2

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

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

func (*InstanceMock) AddMockMethodWithError added in v1.3.0

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

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

func (*InstanceMock) Cache added in v1.1.2

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

Cache mocked method

func (*InstanceMock) Clean added in v1.1.2

func (instance *InstanceMock) Clean()

Clean mocked method

func (*InstanceMock) GetBreakpointValue added in v1.1.2

func (instance *InstanceMock) GetBreakpointValue() uint64

GetBreakpointValue mocked method

func (*InstanceMock) GetData added in v1.1.2

func (instance *InstanceMock) GetData() uintptr

GetData mocked method

func (*InstanceMock) GetExports added in v1.1.2

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

GetExports mocked method

func (*InstanceMock) GetInstanceCtxMemory added in v1.1.2

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

GetInstanceCtxMemory mocked method

func (*InstanceMock) GetMemory added in v1.1.2

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

GetMemory mocked method

func (*InstanceMock) GetPointsUsed added in v1.1.2

func (instance *InstanceMock) GetPointsUsed() uint64

GetPointsUsed mocked method

func (*InstanceMock) GetSignature added in v1.1.2

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

GetSignature mocked method

func (*InstanceMock) HasMemory added in v1.1.2

func (instance *InstanceMock) HasMemory() bool

HasMemory mocked method

func (*InstanceMock) IsFunctionImported added in v1.1.2

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

IsFunctionImported mocked method

func (*InstanceMock) SetBreakpointValue added in v1.1.2

func (instance *InstanceMock) SetBreakpointValue(value uint64)

SetBreakpointValue mocked method

func (*InstanceMock) SetContextData added in v1.1.2

func (instance *InstanceMock) SetContextData(data uintptr)

SetContextData mocked method

func (*InstanceMock) SetGasLimit added in v1.1.2

func (instance *InstanceMock) SetGasLimit(gasLimit uint64)

SetGasLimit mocked method

func (*InstanceMock) SetPointsUsed added in v1.1.2

func (instance *InstanceMock) SetPointsUsed(points uint64)

SetPointsUsed mocked method

type MemoryMock added in v1.1.2

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 added in v1.1.2

func NewMemoryMock() *MemoryMock

NewMemoryMock creates a new MemoryMock instance

func (*MemoryMock) Data added in v1.1.2

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

Data mocked method

func (*MemoryMock) Destroy added in v1.1.2

func (memory *MemoryMock) Destroy()

Destroy mocked method

func (*MemoryMock) Grow added in v1.1.2

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

Grow mocked method

func (*MemoryMock) Length added in v1.1.2

func (memory *MemoryMock) Length() uint32

Length mocked method

type MeteringContextMock

type MeteringContextMock struct {
	GasCost           *config.GasCost
	GasLeftMock       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(_ arwen.CodeDeployInput) error

DeductInitialGasForDirectDeployment mocked method

func (*MeteringContextMock) DeductInitialGasForExecution

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

DeductInitialGasForExecution mocked method

func (*MeteringContextMock) DeductInitialGasForIndirectDeployment

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

DeductInitialGasForIndirectDeployment mocked method

func (*MeteringContextMock) FreeGas

func (m *MeteringContextMock) FreeGas(_ 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 added in v1.0.4

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) 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 added in v1.2.10

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(_ uint64)

RestoreGas mocked method

func (*MeteringContextMock) SetGasSchedule

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

SetGasSchedule mocked method

func (*MeteringContextMock) TrackGasUsedByBuiltinFunction added in v1.2.10

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 added in v1.2.10

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

UpdateGasStateOnFailure mocked method

func (*MeteringContextMock) UpdateGasStateOnSuccess added in v1.2.10

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

UpdateGasStateOnSuccess mocked method

func (*MeteringContextMock) UseGas

func (m *MeteringContextMock) UseGas(_ uint64)

UseGas mocked method

func (*MeteringContextMock) UseGasBounded

func (m *MeteringContextMock) UseGasBounded(_ 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) DeleteOutputAccount

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

DeleteOutputAccount mocked method

func (*OutputContextMock) DeployCode

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

DeployCode mocked method

func (*OutputContextMock) Finish

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

Finish mocked method

func (*OutputContextMock) GetCurrentTotalUsedGas added in v1.1.1

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 added in v1.2.10

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 added in v1.1.0

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

PrependFinish mocked method

func (*OutputContextMock) PushState

func (o *OutputContextMock) PushState()

PushState 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, _ vmcommon.CallType) error

Transfer mocked method

func (*OutputContextMock) TransferESDT added in v1.1.0

func (o *OutputContextMock) TransferESDT(_ []byte, _ []byte, _ []byte, _ uint64, _ *big.Int, _ *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, tokenIdentifier []byte, nonce uint64, value *big.Int, 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()
	FinishCalled                      func(data []byte)
	PrependFinishCalled               func(data []byte)
	GetVMOutputCalled                 func() *vmcommon.VMOutput
	AddTxValueToAccountCalled         func(address []byte, value *big.Int)
	DeployCodeCalled                  func(input arwen.CodeDeployInput)
	CreateVMOutputInCaseOfErrorCalled func(err error) *vmcommon.VMOutput
	AddToActiveStateCalled            func(vmOutput *vmcommon.VMOutput)
	TransferValueOnlyCalled           func(destination []byte, sender []byte, value *big.Int, checkPayable bool) error
}

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) DeleteOutputAccount

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

DeleteOutputAccount mocked method

func (*OutputContextStub) DeployCode

func (o *OutputContextStub) DeployCode(input arwen.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 added in v1.2.10

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 added in v1.1.0

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

PrependFinish mocked method

func (*OutputContextStub) PushState

func (o *OutputContextStub) PushState()

PushState 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, _ vmcommon.CallType) error

Transfer mocked method

func (*OutputContextStub) TransferESDT added in v1.1.0

func (o *OutputContextStub) TransferESDT(destination []byte, sender []byte, tokenIdentifier []byte, nonce uint64, value *big.Int, 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.VMInput
	SCAddress              []byte
	SCCode                 []byte
	SCCodeSize             uint64
	CallFunction           string
	VMType                 []byte
	IsContractOnStack      bool
	ReadOnlyFlag           bool
	VerifyCode             bool
	CurrentBreakpointValue arwen.BreakpointValue
	PointsUsed             uint64
	InstanceCtxID          int
	MemLoadResult          []byte
	MemLoadMultipleResult  [][]byte
	FailCryptoAPI          bool
	FailElrondAPI          bool
	FailElrondSyncExecAPI  bool
	FailBigIntAPI          bool
	AsyncCallInfo          *arwen.AsyncCallInfo
	RunningInstances       uint64
	CurrentTxHash          []byte
	OriginalTxHash         []byte
}

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

func (*RuntimeContextMock) AddAsyncContextCall

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

AddAsyncContextCall mocked method

func (*RuntimeContextMock) Arguments

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

Arguments mocked method

func (*RuntimeContextMock) BigIntAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigIntAPIErrorShouldFailExecution() bool

BigIntAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) CleanWasmerInstance

func (r *RuntimeContextMock) CleanWasmerInstance()

CleanWasmerInstance mocked method

func (*RuntimeContextMock) ClearInstanceStack

func (r *RuntimeContextMock) ClearInstanceStack()

ClearInstanceStack mocked method

func (*RuntimeContextMock) ClearStateStack

func (r *RuntimeContextMock) ClearStateStack()

ClearStateStack mocked method

func (*RuntimeContextMock) CryptoAPIErrorShouldFailExecution

func (r *RuntimeContextMock) CryptoAPIErrorShouldFailExecution() bool

CryptoAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) ElrondAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ElrondAPIErrorShouldFailExecution() bool

ElrondAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) ElrondSyncExecAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ElrondSyncExecAPIErrorShouldFailExecution() bool

ElrondSyncExecAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) ExecuteAsyncCall

func (r *RuntimeContextMock) ExecuteAsyncCall(address []byte, data []byte, value []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) GetAsyncCallInfo

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

GetAsyncCallInfo mocked method

func (*RuntimeContextMock) GetAsyncContext

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

GetAsyncContext mocked method

func (*RuntimeContextMock) GetAsyncContextInfo

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

GetAsyncContextInfo mocked method

func (*RuntimeContextMock) GetCurrentTxHash

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

GetCurrentTxHash mocked method

func (*RuntimeContextMock) GetFunctionToCall

func (r *RuntimeContextMock) GetFunctionToCall() (wasmer.ExportedFunctionCallback, error)

GetFunctionToCall mocked method

func (*RuntimeContextMock) GetInitFunction

func (r *RuntimeContextMock) GetInitFunction() wasmer.ExportedFunctionCallback

GetInitFunction mocked method

func (*RuntimeContextMock) GetInstance added in v1.3.0

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() arwen.BreakpointValue

GetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) GetSCAddress

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

GetSCAddress 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

func (r *RuntimeContextMock) GetVMInput() *vmcommon.VMInput

GetVMInput mocked method

func (*RuntimeContextMock) GetVMType

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

GetVMType 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) IsContractOnTheStack

func (r *RuntimeContextMock) IsContractOnTheStack(_ []byte) bool

IsContractOnTheStack mocked method

func (*RuntimeContextMock) IsFunctionImported added in v1.1.1

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

IsFunctionImported mocked method

func (*RuntimeContextMock) IsWarmInstance

func (r *RuntimeContextMock) IsWarmInstance() bool

IsWarmInstance 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(_ arwen.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 *arwen.AsyncCallInfo)

SetAsyncCallInfo mocked method

func (*RuntimeContextMock) SetCaching

func (r *RuntimeContextMock) SetCaching(_ bool)

SetCaching 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(_ arwen.BreakpointValue)

SetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) SetSCAddress

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

SetSCAddress mocked method

func (*RuntimeContextMock) SetVMInput

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

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) VerifyContractCode

func (r *RuntimeContextMock) VerifyContractCode() error

VerifyContractCode mocked method

type RuntimeContextWrapper added in v1.3.0

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.VMInput
	// 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.VMInput)
	// 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)
	SetSCAddressFunc 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 arwen.BreakpointValue)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetRuntimeBreakpointValueFunc func() arwen.BreakpointValue
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	IsContractOnTheStackFunc func(address []byte) bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncCallInfoFunc func() *arwen.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 *arwen.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 *arwen.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() *arwen.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) (*arwen.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)
	IsWarmInstanceFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ResetWarmInstanceFunc func()
	// 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)
	CleanWasmerInstanceFunc 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)
	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)
	GetInitFunctionFunc func() wasmer.ExportedFunctionCallback
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetFunctionToCallFunc func() (wasmer.ExportedFunctionCallback, 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)
	ElrondAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ElrondSyncExecAPIErrorShouldFailExecutionFunc 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)
	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 arwen.InstanceBuilder)

	// 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()
	// contains filtered or unexported fields
}

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

func NewRuntimeContextWrapper added in v1.2.9

func NewRuntimeContextWrapper(inputRuntimeContext *arwen.RuntimeContext) *RuntimeContextWrapper

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

func (*RuntimeContextWrapper) AddAsyncContextCall added in v1.3.0

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

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

func (*RuntimeContextWrapper) Arguments added in v1.3.0

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) BigIntAPIErrorShouldFailExecution added in v1.3.0

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) CleanWasmerInstance added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) CleanWasmerInstance()

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

func (*RuntimeContextWrapper) ClearStateStack added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) ClearStateStack()

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

func (*RuntimeContextWrapper) CryptoAPIErrorShouldFailExecution added in v1.3.0

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) ElrondAPIErrorShouldFailExecution added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) ElrondAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) ElrondSyncExecAPIErrorShouldFailExecution added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) ElrondSyncExecAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) ExecuteAsyncCall added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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) GetAsyncCallInfo added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetAsyncContext added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetAsyncContextInfo added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetCurrentTxHash added in v1.3.0

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 added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) GetFunctionToCall() (wasmer.ExportedFunctionCallback, error)

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

func (*RuntimeContextWrapper) GetInitFunction added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) GetInitFunction() wasmer.ExportedFunctionCallback

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

func (*RuntimeContextWrapper) GetInstance added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetSCAddress added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetSCCode added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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

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

func (*RuntimeContextWrapper) GetVMType added in v1.3.0

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) GetWrappedRuntimeContext added in v1.3.0

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

GetWrappedRuntimeContext gets the wrapped RuntimeContext

func (*RuntimeContextWrapper) InitState added in v1.3.0

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 added in v1.3.0

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) IsContractOnTheStack added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) IsContractOnTheStack(address []byte) bool

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

func (*RuntimeContextWrapper) IsFunctionImported added in v1.3.0

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) IsWarmInstance added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) IsWarmInstance() bool

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

func (*RuntimeContextWrapper) MemLoad added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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

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

func (*RuntimeContextWrapper) ResetWarmInstance added in v1.3.0

func (contextWrapper *RuntimeContextWrapper) ResetWarmInstance()

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

func (*RuntimeContextWrapper) RunningInstancesCount added in v1.3.0

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 added in v1.3.0

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

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

func (*RuntimeContextWrapper) SetCustomCallFunction added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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

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

func (*RuntimeContextWrapper) SetSCAddress added in v1.3.0

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

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

func (*RuntimeContextWrapper) SetVMInput added in v1.3.0

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

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

func (*RuntimeContextWrapper) SignalUserError added in v1.3.0

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 added in v1.3.0

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) VerifyContractCode added in v1.3.0

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 arwen context tests. It has minimal functionality.

func (*StubAccount) AddressBytes

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

AddressBytes -

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) IsInterfaceNil

func (a *StubAccount) IsInterfaceNil() bool

IsInterfaceNil -

type VMHostMock

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

	EthInput []byte

	BlockchainContext arwen.BlockchainContext
	RuntimeContext    arwen.RuntimeContext
	OutputContext     arwen.OutputContext
	MeteringContext   arwen.MeteringContext
	StorageContext    arwen.StorageContext
	BigIntContext     arwen.BigIntContext

	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) BigInt

func (host *VMHostMock) BigInt() arwen.BigIntContext

BigInt mocked method

func (*VMHostMock) Blockchain

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

Blockchain mocked method

func (*VMHostMock) ClearStateStack

func (host *VMHostMock) ClearStateStack()

ClearStateStack 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) ExecuteESDTTransfer added in v1.1.0

func (host *VMHostMock) ExecuteESDTTransfer(_ []byte, _ []byte, _ []byte, _ uint64, _ *big.Int, _ vmcommon.CallType, _ bool) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostMock) ExecuteOnDestContext

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

ExecuteOnDestContext mocked method

func (*VMHostMock) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostMock) GasScheduleChange added in v1.3.0

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

GasScheduleChange mocked method

func (*VMHostMock) GetAPIMethods

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

GetAPIMethods mocked method

func (*VMHostMock) GetContexts added in v1.3.0

GetContexts mocked method

func (*VMHostMock) GetGasScheduleMap added in v1.3.0

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

GetGasScheduleMap mocked method

func (*VMHostMock) GetProtocolBuiltinFunctions

func (host *VMHostMock) GetProtocolBuiltinFunctions() vmcommon.FunctionNames

GetProtocolBuiltinFunctions 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) IsArwenV2Enabled

func (host *VMHostMock) IsArwenV2Enabled() bool

IsArwenV2Enabled mocked method

func (*VMHostMock) IsArwenV3Enabled added in v1.1.1

func (host *VMHostMock) IsArwenV3Enabled() bool

IsArwenV3Enabled 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 added in v1.2.0

func (host *VMHostMock) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostMock) IsInterfaceNil added in v1.3.0

func (host *VMHostMock) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostMock) Metering

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

Metering mocked method

func (*VMHostMock) Output

func (host *VMHostMock) Output() arwen.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) RevertESDTTransfer added in v1.1.2

func (host *VMHostMock) RevertESDTTransfer(_ *vmcommon.ContractCallInput)

RevertESDTTransfer mocked method

func (*VMHostMock) RunSmartContractCall added in v1.3.0

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

RunSmartContractCall mocked method

func (*VMHostMock) RunSmartContractCreate added in v1.3.0

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

RunSmartContractCreate mocked method

func (*VMHostMock) Runtime

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

Runtime mocked method

func (*VMHostMock) SetProtocolBuiltinFunctions added in v1.3.0

func (host *VMHostMock) SetProtocolBuiltinFunctions(functionNames vmcommon.FunctionNames)

SetProtocolBuiltinFunctions sets the names of build-in functions, reserved by the protocol

func (*VMHostMock) SetRuntimeContext added in v1.3.0

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

SetRuntimeContext mocked method

func (*VMHostMock) Storage

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

Storage mocked method

type VMHostStub

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

	CryptoCalled                      func() crypto.VMCrypto
	BlockchainCalled                  func() arwen.BlockchainContext
	RuntimeCalled                     func() arwen.RuntimeContext
	BigIntCalled                      func() arwen.BigIntContext
	OutputCalled                      func() arwen.OutputContext
	MeteringCalled                    func() arwen.MeteringContext
	StorageCalled                     func() arwen.StorageContext
	RevertESDTTransferCalled          func(input *vmcommon.ContractCallInput)
	ExecuteESDTTransferCalled         func(destination []byte, sender []byte, tokenIdentifier []byte, nonce uint64, value *big.Int, callType vmcommon.CallType, isRevert bool) (*vmcommon.VMOutput, uint64, error)
	CreateNewContractCalled           func(input *vmcommon.ContractCreateInput) ([]byte, error)
	ExecuteOnSameContextCalled        func(input *vmcommon.ContractCallInput) (*arwen.AsyncContextInfo, error)
	ExecuteOnDestContextCalled        func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *arwen.AsyncContextInfo, error)
	GetAPIMethodsCalled               func() *wasmer.Imports
	GetProtocolBuiltinFunctionsCalled func() vmcommon.FunctionNames
	SetProtocolBuiltinFunctionsCalled func(vmcommon.FunctionNames)
	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 arwen.RuntimeContext)
	GetContextsCalled       func() (arwen.BigIntContext, arwen.BlockchainContext, arwen.MeteringContext, arwen.OutputContext, arwen.RuntimeContext, arwen.StorageContext)
}

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) BigInt

func (vhs *VMHostStub) BigInt() arwen.BigIntContext

BigInt mocked method

func (*VMHostStub) Blockchain

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

Blockchain mocked method

func (*VMHostStub) ClearStateStack

func (vhs *VMHostStub) ClearStateStack()

ClearStateStack 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) ExecuteESDTTransfer added in v1.1.0

func (vhs *VMHostStub) ExecuteESDTTransfer(destination []byte, sender []byte, tokenIdentifier []byte, nonce uint64, value *big.Int, callType vmcommon.CallType, isRevert bool) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostStub) ExecuteOnDestContext

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

ExecuteOnDestContext mocked method

func (*VMHostStub) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostStub) GasScheduleChange added in v1.3.0

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

GasScheduleChange mocked method

func (*VMHostStub) GetAPIMethods

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

GetAPIMethods mocked method

func (*VMHostStub) GetContexts added in v1.3.0

GetContexts mocked method

func (*VMHostStub) GetGasScheduleMap added in v1.3.0

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

GetGasScheduleMap returns the currently stored gas schedule

func (*VMHostStub) GetProtocolBuiltinFunctions

func (vhs *VMHostStub) GetProtocolBuiltinFunctions() vmcommon.FunctionNames

GetProtocolBuiltinFunctions 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) IsArwenV2Enabled

func (vhs *VMHostStub) IsArwenV2Enabled() bool

IsArwenV2Enabled mocked method

func (*VMHostStub) IsArwenV3Enabled added in v1.1.1

func (vhs *VMHostStub) IsArwenV3Enabled() bool

IsArwenV3Enabled 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 added in v1.2.0

func (vhs *VMHostStub) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostStub) IsInterfaceNil added in v1.3.0

func (vhs *VMHostStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostStub) Metering

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

Metering mocked method

func (*VMHostStub) Output

func (vhs *VMHostStub) Output() arwen.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) RevertESDTTransfer added in v1.1.2

func (vhs *VMHostStub) RevertESDTTransfer(input *vmcommon.ContractCallInput)

RevertESDTTransfer mocked method

func (*VMHostStub) RunSmartContractCall added in v1.3.0

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

RunSmartContractCall mocked method

func (*VMHostStub) RunSmartContractCreate added in v1.3.0

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

RunSmartContractCreate mocked method

func (*VMHostStub) Runtime

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

Runtime mocked method

func (*VMHostStub) SetProtocolBuiltinFunctions added in v1.3.0

func (vhs *VMHostStub) SetProtocolBuiltinFunctions(functionNames vmcommon.FunctionNames)

SetProtocolBuiltinFunctions mocked method

func (*VMHostStub) SetRuntimeContext added in v1.3.0

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

SetRuntimeContext mocked method

func (*VMHostStub) Storage

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

Storage mocked method

Jump to

Keyboard shortcuts

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