mock

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRuntimeContextWrapper

func NewRuntimeContextWrapper(inputRuntimeContext *vmhost.RuntimeContext) *runtimeContextWrapper

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

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
	GetDCDTTokenCalled            func(address []byte, tokenID []byte, nonce uint64) (*dcdt.DCDigitalToken, 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

func (b *BlockchainHookStub) ExecuteSmartContractCallOnOtherVM(input *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) GetDCDTToken

func (b *BlockchainHookStub) GetDCDTToken(address []byte, tokenID []byte, nonce uint64) (*dcdt.DCDigitalToken, error)

GetDCDTToken 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(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]wasmer.InstanceHandler
	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(code []byte, 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) GetStoredInstance

func (builder *InstanceBuilderMock) GetStoredInstance(code []byte, gasLimit uint64) (wasmer.InstanceHandler, bool)

GetStoredInstance retrieves and initializes a stored Wasmer instance, or nil if it doesn't exist

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) 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
	Points          uint64
	Data            uintptr
	GasLimit        uint64
	BreakpointValue uint64
	Memory          wasmer.MemoryHandler
}

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

func NewInstanceMock

func NewInstanceMock(code []byte) *InstanceMock

NewInstanceMock creates a new InstanceMock

func (*InstanceMock) AddMockMethod

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

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

func (*InstanceMock) Cache

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

Cache mocked method

func (*InstanceMock) Clean

func (instance *InstanceMock) Clean()

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

func (instance *InstanceMock) HasMemory() bool

HasMemory mocked method

func (*InstanceMock) IsFunctionImported

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

IsFunctionImported 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) 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) Length

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

func (m *MeteringContextMock) AddToUsedGas(_ []byte, _ uint64)

AddToUsedGas -

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

func (m *MeteringContextMock) ForwardGas(_ []byte, _ []byte, _ uint64)

ForwardGas 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

func (m *MeteringContextMock) GasUsedForExecution() uint64

GasUsedForExecution mocked method

func (*MeteringContextMock) GetForwardedGas

func (m *MeteringContextMock) GetForwardedGas(_ []byte) uint64

GetForwardedGas -

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

func (m *MeteringContextMock) GetPreviousTotalUsedGas() uint64

GetPreviousTotalUsedGas 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) 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) SetTotalUsedGas

func (m *MeteringContextMock) SetTotalUsedGas(_ uint64)

SetTotalUsedGas mocked method

func (*MeteringContextMock) UnlockGasIfAsyncCallback

func (m *MeteringContextMock) UnlockGasIfAsyncCallback()

UnlockGasIfAsyncCallback mocked method

func (*MeteringContextMock) UnlockGasIfAsyncStep

func (m *MeteringContextMock) UnlockGasIfAsyncStep()

UnlockGasIfAsyncStep 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(_ 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) 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) ResetGas

func (o *OutputContextMock) ResetGas()

ResetGas 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) TransferDCDT

func (o *OutputContextMock) TransferDCDT(_ []byte, _ []byte, _ []byte, _ uint64, _ *big.Int, _ *vmcommon.ContractCallInput) (uint64, error)

TransferDCDT 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()
	ResetGasCalled                    func()
	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
	TransferDCDTCalled                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 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
	GetCurrentTotalUsedGasCalled      func() (uint64, bool)
}

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 vmhost.CodeDeployInput)

DeployCode mocked method

func (*OutputContextStub) Finish

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

Finish mocked method

func (*OutputContextStub) GetCurrentTotalUsedGas

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

GetCurrentTotalUsedGas mocked method

func (*OutputContextStub) GetOutputAccount

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

GetOutputAccount 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) ResetGas

func (o *OutputContextStub) ResetGas()

ResetGas 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) TransferDCDT

func (o *OutputContextStub) TransferDCDT(destination []byte, sender []byte, tokenIdentifier []byte, nonce uint64, value *big.Int, callInput *vmcommon.ContractCallInput) (uint64, error)

TransferDCDT 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 vmhost.BreakpointValue
	PointsUsed             uint64
	InstanceCtxID          int
	MemLoadResult          []byte
	MemLoadMultipleResult  [][]byte
	FailCryptoAPI          bool
	FailBaseOpsAPI         bool
	FailSyncExecAPI        bool
	FailBigIntAPI          bool
	AsyncCallInfo          *vmhost.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, _ *vmhost.AsyncGeneratedCall) error

AddAsyncContextCall 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) 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) 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() *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) 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) 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) 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

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

func (r *RuntimeContextMock) SyncExecAPIErrorShouldFailExecution() bool

SyncExecAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) VerifyContractCode

func (r *RuntimeContextMock) VerifyContractCode() error

VerifyContractCode mocked method

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

DataTrieTracker -

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

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
	BigIntContext     vmhost.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() vmhost.BigIntContext

BigInt mocked method

func (*VMHostMock) Blockchain

func (host *VMHostMock) Blockchain() vmhost.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) ExecuteDCDTTransfer

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

ExecuteDCDTTransfer mocked method

func (*VMHostMock) ExecuteOnDestContext

ExecuteOnDestContext mocked method

func (*VMHostMock) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostMock) GetAPIMethods

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

GetAPIMethods 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) IsBuiltinFunctionName

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

IsBuiltinFunctionName mocked method

func (*VMHostMock) IsDCDTFunctionsEnabled

func (host *VMHostMock) IsDCDTFunctionsEnabled() bool

IsDCDTFunctionsEnabled mocked method

func (*VMHostMock) IsDynamicGasLockingEnabled

func (host *VMHostMock) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled 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) 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) RevertDCDTTransfer

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

RevertDCDTTransfer mocked method

func (*VMHostMock) Runtime

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

Runtime 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()

	CryptoCalled                      func() crypto.VMCrypto
	BlockchainCalled                  func() vmhost.BlockchainContext
	RuntimeCalled                     func() vmhost.RuntimeContext
	BigIntCalled                      func() vmhost.BigIntContext
	OutputCalled                      func() vmhost.OutputContext
	MeteringCalled                    func() vmhost.MeteringContext
	StorageCalled                     func() vmhost.StorageContext
	RevertDCDTTransferCalled          func(input *vmcommon.ContractCallInput)
	ExecuteDCDTTransferCalled         func(destination []byte, sender []byte, tokenIdentifier []byte, nonce uint64, value *big.Int, callType vm.CallType, isRevert bool) (*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, uint64, error)
	GetAPIMethodsCalled               func() *wasmer.Imports
	GetProtocolBuiltinFunctionsCalled func() vmcommon.FunctionNames
	IsBuiltinFunctionNameCalled       func(functionName string) bool
	AreInSameShardCalled              func(left []byte, right []byte) bool
}

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() vmhost.BigIntContext

BigInt mocked method

func (*VMHostStub) Blockchain

func (vhs *VMHostStub) Blockchain() vmhost.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) ExecuteDCDTTransfer

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

ExecuteDCDTTransfer mocked method

func (*VMHostStub) ExecuteOnDestContext

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

ExecuteOnDestContext mocked method

func (*VMHostStub) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostStub) GetAPIMethods

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

GetAPIMethods mocked method

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

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

IsBuiltinFunctionName mocked method

func (*VMHostStub) IsDCDTFunctionsEnabled

func (vhs *VMHostStub) IsDCDTFunctionsEnabled() bool

IsDCDTFunctionsEnabled mocked method

func (*VMHostStub) IsDynamicGasLockingEnabled

func (vhs *VMHostStub) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled 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) 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) RevertDCDTTransfer

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

RevertDCDTTransfer mocked method

func (*VMHostStub) Runtime

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

Runtime 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