mock

package
v1.5.33 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: GPL-3.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainHookStub

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

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

GetESDTToken mocked method

func (*BlockchainHookStub) GetShardOfAddress

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

GetShardOfAddress mocked method

func (*BlockchainHookStub) GetSnapshot

func (b *BlockchainHookStub) GetSnapshot() int

GetSnapshot mocked method

func (*BlockchainHookStub) GetStateRootHash

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

GetStateRootHash mocked method

func (*BlockchainHookStub) GetStorageData

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

GetStorageData mocked method

func (*BlockchainHookStub) GetUserAccount

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

GetUserAccount mocked method

func (*BlockchainHookStub) IsInterfaceNil

func (b *BlockchainHookStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*BlockchainHookStub) IsLimitedTransfer

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

IsLimitedTransfer -

func (*BlockchainHookStub) IsPaused

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

IsPaused -

func (*BlockchainHookStub) IsPayable

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

IsPayable mocked method

func (*BlockchainHookStub) IsSmartContract

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

IsSmartContract mocked method

func (*BlockchainHookStub) LastEpoch

func (b *BlockchainHookStub) LastEpoch() uint32

LastEpoch mocked method

func (*BlockchainHookStub) LastNonce

func (b *BlockchainHookStub) LastNonce() uint64

LastNonce mocked method

func (*BlockchainHookStub) LastRandomSeed

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

LastRandomSeed mocked method

func (*BlockchainHookStub) LastRound

func (b *BlockchainHookStub) LastRound() uint64

LastRound mocked method

func (*BlockchainHookStub) LastTimeStamp

func (b *BlockchainHookStub) LastTimeStamp() uint64

LastTimeStamp mocked method

func (*BlockchainHookStub) NewAddress

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

NewAddress mocked method

func (*BlockchainHookStub) ProcessBuiltInFunction

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

ProcessBuiltInFunction mocked method

func (*BlockchainHookStub) RevertToSnapshot

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

RevertToSnapshot mocked method

func (*BlockchainHookStub) SaveCompiledCode

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

SaveCompiledCode mocked method

type CryptoHookMock

type CryptoHookMock struct {
	Result []byte
	Err    error
}

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

func (*CryptoHookMock) Ecrecover

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

Ecrecover mocked method

func (*CryptoHookMock) EncodeSecp256k1DERSignature

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

EncodeSecp256k1DERSignature mocked method

func (*CryptoHookMock) Keccak256

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

Keccak256 mocked method

func (*CryptoHookMock) Ripemd160

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

Ripemd160 mocked method

func (*CryptoHookMock) Sha256

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

Sha256 mocked method

func (*CryptoHookMock) VerifyAggregatedSig added in v1.5.30

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

VerifyAggregatedSig mocked method

func (*CryptoHookMock) VerifyBLS

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

VerifyBLS mocked method

func (*CryptoHookMock) VerifyEd25519

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

VerifyEd25519 mocked method

func (*CryptoHookMock) VerifySecp256k1

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

VerifySecp256k1 mocked method

func (*CryptoHookMock) VerifySecp256r1 added in v1.5.30

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

VerifySecp256r1 mocked method

func (*CryptoHookMock) VerifySignatureShare added in v1.5.30

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

VerifySignatureShare mocked method

type ExecutorMock

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

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

func NewExecutorMock

func NewExecutorMock(world *worldmock.MockWorld) *ExecutorMock

NewExecutorMock constructs a new InstanceBuilderMock

func (*ExecutorMock) CreateAndStoreInstanceMock

func (executorMock *ExecutorMock) CreateAndStoreInstanceMock(t testing.TB, host vmhost.VMHost, code []byte, codeHash []byte, codeMetadata []byte, ownerAddress []byte, shardID uint32, balance int64, createAccount bool) *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 (*ExecutorMock) FunctionNames

func (executorMock *ExecutorMock) FunctionNames() vmcommon.FunctionNames

FunctionNames mocked method

func (*ExecutorMock) IsInterfaceNil

func (executorMock *ExecutorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ExecutorMock) NewInstanceFromCompiledCodeWithOptions

func (executorMock *ExecutorMock) NewInstanceFromCompiledCodeWithOptions(
	compiledCode []byte,
	options executor.CompilationOptions,
) (executor.Instance, 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 (*ExecutorMock) NewInstanceWithOptions

func (executorMock *ExecutorMock) NewInstanceWithOptions(
	contractCode []byte,
	options executor.CompilationOptions,
) (executor.Instance, 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.

func (*ExecutorMock) SetOpcodeCosts

func (executorMock *ExecutorMock) SetOpcodeCosts(_ *executor.WASMOpcodeCost)

SetOpcodeCosts should set gas costs, but it does nothing in the case of this mock.

type ExecutorMockFactory

type ExecutorMockFactory struct {
	World *worldmock.MockWorld

	// gives access to the created Executor in tests
	LastCreatedExecutor *ExecutorMock
}

ExecutorMockFactory is the factory for the ExecutorRecorderMock.

func NewExecutorMockFactory

func NewExecutorMockFactory(world *worldmock.MockWorld) *ExecutorMockFactory

NewExecutorMockFactory returns the Wasmer executor factory.

func (*ExecutorMockFactory) CreateExecutor

CreateExecutor creates a new Executor instance.

func (*ExecutorMockFactory) IsInterfaceNil

func (emf *ExecutorMockFactory) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type InstanceMock

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

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

func GetMockInstance

func GetMockInstance(host vmhost.VMHost) *InstanceMock

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

func NewInstanceMock

func NewInstanceMock(code []byte) *InstanceMock

NewInstanceMock creates a new InstanceMock

func (*InstanceMock) AddMockMethod

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

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

func (*InstanceMock) AddMockMethodWithError

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

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

func (*InstanceMock) Cache

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

Cache mocked method

func (*InstanceMock) CallFunction

func (instance *InstanceMock) CallFunction(funcName string) error

CallFunction mocked method

func (*InstanceMock) Clean

func (instance *InstanceMock) Clean() bool

Clean mocked method

func (*InstanceMock) GetBreakpointValue

func (instance *InstanceMock) GetBreakpointValue() uint64

GetBreakpointValue mocked method

func (*InstanceMock) GetFunctionNames

func (instance *InstanceMock) GetFunctionNames() []string

GetFunctionNames mocked method

func (*InstanceMock) GetPointsUsed

func (instance *InstanceMock) GetPointsUsed() uint64

GetPointsUsed mocked method

func (*InstanceMock) GetVMHooksPtr

func (instance *InstanceMock) GetVMHooksPtr() uintptr

GetVMHooksPtr mocked method

func (*InstanceMock) HasFunction

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

HasFunction mocked method

func (*InstanceMock) HasMemory

func (instance *InstanceMock) HasMemory() bool

HasMemory mocked method

func (*InstanceMock) ID

func (instance *InstanceMock) ID() string

ID returns an identifier for the instance, unique at runtime

func (*InstanceMock) IsAlreadyCleaned

func (instance *InstanceMock) IsAlreadyCleaned() bool

IsAlreadyCleaned mocked method

func (*InstanceMock) IsFunctionImported

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

IsFunctionImported mocked method

func (*InstanceMock) IsInterfaceNil

func (instance *InstanceMock) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*InstanceMock) MemDump

func (instance *InstanceMock) MemDump() []byte

MemDump yields the entire contents of the memory. Only used in tests.

func (*InstanceMock) MemGrow

func (instance *InstanceMock) MemGrow(pages uint32) error

MemGrow allocates more pages to the current memory. Only called directly in tests.

func (*InstanceMock) MemLength

func (instance *InstanceMock) MemLength() uint32

MemLength returns the length of the allocated memory. Only called directly in tests.

func (*InstanceMock) MemLoad

func (instance *InstanceMock) MemLoad(memPtr executor.MemPtr, length executor.MemLength) ([]byte, error)

MemLoad returns the contents from the given offset of the WASM memory.

func (*InstanceMock) MemStore

func (instance *InstanceMock) MemStore(memPtr executor.MemPtr, data []byte) error

MemStore stores the given data in the WASM memory at the given offset.

func (*InstanceMock) Reset

func (instance *InstanceMock) Reset() bool

Reset mocked method

func (*InstanceMock) SetBreakpointValue

func (instance *InstanceMock) SetBreakpointValue(value uint64)

SetBreakpointValue mocked method

func (*InstanceMock) SetGasLimit

func (instance *InstanceMock) SetGasLimit(gasLimit uint64)

SetGasLimit mocked method

func (*InstanceMock) SetPointsUsed

func (instance *InstanceMock) SetPointsUsed(points uint64)

SetPointsUsed mocked method

func (*InstanceMock) SetVMHooksPtr

func (instance *InstanceMock) SetVMHooksPtr(_ uintptr)

SetVMHooksPtr mocked method

func (*InstanceMock) ValidateFunctionArities

func (instance *InstanceMock) ValidateFunctionArities() error

ValidateFunctionArities mocked method

func (*InstanceMock) ValidateVoidFunction

func (instance *InstanceMock) ValidateVoidFunction(_ string) error

ValidateVoidFunction mocked method

type MemoryMock

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

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

func NewMemoryMock

func NewMemoryMock() *MemoryMock

NewMemoryMock creates a new MemoryMock instance

func (*MemoryMock) Data

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

Data mocked method

func (*MemoryMock) Destroy

func (memory *MemoryMock) Destroy()

Destroy mocked method

func (*MemoryMock) Grow

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

Grow mocked method

func (*MemoryMock) IsInterfaceNil

func (memory *MemoryMock) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying object is nil

func (*MemoryMock) Length

func (memory *MemoryMock) Length() uint32

Length mocked method

type MeteringContextMock

type MeteringContextMock struct {
	GasCost           *config.GasCost
	GasLeftMock       uint64
	GasFreedMock      uint64
	GasLockedMock     uint64
	GasProvidedMock   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) ComputeExtraGasLockedForAsync

func (m *MeteringContextMock) ComputeExtraGasLockedForAsync() uint64

ComputeExtraGasLockedForAsync 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) DisableRestoreGas

func (m *MeteringContextMock) DisableRestoreGas()

DisableRestoreGas mocked method

func (*MeteringContextMock) EnableRestoreGas

func (m *MeteringContextMock) EnableRestoreGas()

EnableRestoreGas mocked method

func (*MeteringContextMock) FreeGas

func (m *MeteringContextMock) FreeGas(gas uint64)

FreeGas mocked method

func (*MeteringContextMock) GasLeft

func (m *MeteringContextMock) GasLeft() uint64

GasLeft mocked method

func (*MeteringContextMock) GasSchedule

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

GasSchedule mocked method

func (*MeteringContextMock) GasSpentByContract

func (m *MeteringContextMock) GasSpentByContract() uint64

GasSpentByContract mocked method

func (*MeteringContextMock) GasUsedByContract

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

GasUsedByContract mocked method

func (*MeteringContextMock) GasUsedForExecution

func (m *MeteringContextMock) GasUsedForExecution() uint64

GasUsedForExecution mocked method

func (*MeteringContextMock) GetGasForExecution

func (m *MeteringContextMock) GetGasForExecution() uint64

GetGasForExecution mocked method

func (*MeteringContextMock) GetGasLocked

func (m *MeteringContextMock) GetGasLocked() uint64

GetGasLocked mocked method

func (*MeteringContextMock) GetGasProvided

func (m *MeteringContextMock) GetGasProvided() uint64

GetGasProvided mocked method

func (*MeteringContextMock) GetGasTrace

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

GetGasTrace returns nil

func (*MeteringContextMock) GetSCPrepareInitialCost

func (m *MeteringContextMock) GetSCPrepareInitialCost() uint64

GetSCPrepareInitialCost mocked method

func (*MeteringContextMock) InitState

func (m *MeteringContextMock) InitState()

InitState mocked method

func (*MeteringContextMock) InitStateFromContractCallInput

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

InitStateFromContractCallInput mocked method

func (*MeteringContextMock) PopDiscard

func (m *MeteringContextMock) PopDiscard()

PopDiscard mocked method

func (*MeteringContextMock) PopMergeActiveState

func (m *MeteringContextMock) PopMergeActiveState()

PopMergeActiveState mocked method

func (*MeteringContextMock) PopSetActiveState

func (m *MeteringContextMock) PopSetActiveState()

PopSetActiveState mocked method

func (*MeteringContextMock) PushState

func (m *MeteringContextMock) PushState()

PushState mocked method

func (*MeteringContextMock) RestoreGas

func (m *MeteringContextMock) RestoreGas(gas uint64)

RestoreGas mocked method

func (*MeteringContextMock) SetGasSchedule

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

SetGasSchedule mocked method

func (*MeteringContextMock) SetGasTracing

func (m *MeteringContextMock) SetGasTracing(_ bool)

SetGasTracing mocked method

func (*MeteringContextMock) StartGasTracing

func (m *MeteringContextMock) StartGasTracing(_ string)

StartGasTracing mocked method

func (*MeteringContextMock) TrackGasUsedByOutOfVMFunction

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

TrackGasUsedByOutOfVMFunction mocked method

func (*MeteringContextMock) UnlockGasIfAsyncCallback

func (m *MeteringContextMock) UnlockGasIfAsyncCallback()

UnlockGasIfAsyncCallback mocked method

func (*MeteringContextMock) UnlockGasIfAsyncStep

func (m *MeteringContextMock) UnlockGasIfAsyncStep()

UnlockGasIfAsyncStep mocked method

func (*MeteringContextMock) UpdateGasStateOnFailure

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

UpdateGasStateOnFailure mocked method

func (*MeteringContextMock) UpdateGasStateOnSuccess

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

UpdateGasStateOnSuccess mocked method

func (*MeteringContextMock) UseGasBounded

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

UseGasBounded mocked method

func (*MeteringContextMock) UseGasBoundedAndAddTracedGas added in v1.5.6

func (m *MeteringContextMock) UseGasBoundedAndAddTracedGas(_ string, _ uint64) error

UseGasBoundedAndAddTracedGas -

func (*MeteringContextMock) UseGasForAsyncStep

func (m *MeteringContextMock) UseGasForAsyncStep() error

UseGasForAsyncStep mocked method

func (*MeteringContextMock) UseGasForContractInit added in v1.5.32

func (m *MeteringContextMock) UseGasForContractInit(gasToUse uint64)

UseGasForContractInit 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
	CrtTransferIndex   uint32
}

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

func (*OutputContextMock) AddToActiveState

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

AddToActiveState mocked method

func (*OutputContextMock) AddTxValueToAccount

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

AddTxValueToAccount mocked method

func (*OutputContextMock) CensorVMOutput

func (o *OutputContextMock) CensorVMOutput()

CensorVMOutput mocked method

func (*OutputContextMock) ClearReturnData

func (o *OutputContextMock) ClearReturnData()

ClearReturnData mocked method

func (*OutputContextMock) ClearStateStack

func (o *OutputContextMock) ClearStateStack()

ClearStateStack mocked method

func (*OutputContextMock) CopyTopOfStackToActiveState

func (o *OutputContextMock) CopyTopOfStackToActiveState()

CopyTopOfStackToActiveState mocked method

func (*OutputContextMock) CreateVMOutputInCaseOfError

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

CreateVMOutputInCaseOfError mocked method

func (*OutputContextMock) DeleteFirstReturnData

func (o *OutputContextMock) DeleteFirstReturnData()

DeleteFirstReturnData mocked method

func (*OutputContextMock) DeleteOutputAccount

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

DeleteOutputAccount mocked method

func (*OutputContextMock) DeployCode

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

DeployCode mocked method

func (*OutputContextMock) Finish

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

Finish mocked method

func (*OutputContextMock) GetCrtTransferIndex added in v1.5.4

func (o *OutputContextMock) GetCrtTransferIndex() uint32

NextOutputTransferIndex mocked method

func (*OutputContextMock) GetCurrentTotalUsedGas

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

GetCurrentTotalUsedGas mocked method

func (*OutputContextMock) GetOutputAccount

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

GetOutputAccount mocked method

func (*OutputContextMock) GetOutputAccounts

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

GetOutputAccounts mocked method

func (*OutputContextMock) GetRefund

func (o *OutputContextMock) GetRefund() uint64

GetRefund mocked method

func (*OutputContextMock) GetVMOutput

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

GetVMOutput mocked method

func (*OutputContextMock) InitState

func (o *OutputContextMock) InitState()

InitState mocked method

func (*OutputContextMock) IsInterfaceNil added in v1.5.4

func (o *OutputContextMock) IsInterfaceNil() bool

IsInterfaceNil 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) NextOutputTransferIndex added in v1.5.4

func (o *OutputContextMock) NextOutputTransferIndex() uint32

NextOutputTransferIndex mocked method

func (*OutputContextMock) PopDiscard

func (o *OutputContextMock) PopDiscard()

PopDiscard mocked method

func (*OutputContextMock) PopMergeActiveState

func (o *OutputContextMock) PopMergeActiveState()

PopMergeActiveState mocked method

func (*OutputContextMock) PopSetActiveState

func (o *OutputContextMock) PopSetActiveState()

PopSetActiveState mocked method

func (*OutputContextMock) PrependFinish

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

PrependFinish mocked method

func (*OutputContextMock) PushState

func (o *OutputContextMock) PushState()

PushState mocked method

func (*OutputContextMock) RemoveNonUpdatedStorage

func (o *OutputContextMock) RemoveNonUpdatedStorage()

RemoveNonUpdatedStorage mocked method

func (*OutputContextMock) RemoveReturnData

func (o *OutputContextMock) RemoveReturnData(_ uint32)

RemoveReturnData mocked method

func (*OutputContextMock) ReturnCode

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

ReturnCode mocked method

func (*OutputContextMock) ReturnData

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

ReturnData mocked method

func (*OutputContextMock) ReturnMessage

func (o *OutputContextMock) ReturnMessage() string

ReturnMessage mocked method

func (*OutputContextMock) SetCrtTransferIndex added in v1.5.4

func (o *OutputContextMock) SetCrtTransferIndex(index uint32)

NextOutputTransferIndex 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, _ []byte, _ vm.CallType) error

Transfer mocked method

func (*OutputContextMock) TransferESDT

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

func (*OutputContextMock) WriteLogWithIdentifier added in v1.5.9

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

WriteLogWithIdentifier 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)
	WriteLogWithIdentifierCalled      func(address []byte, topics [][]byte, data [][]byte, identifier []byte)
	TransferCalled                    func(destination []byte, sender []byte, gasLimit uint64, gasLocked uint64, value *big.Int, asyncData []byte, input []byte) error
	TransferESDTCalled                func(transfersArgs *vmhost.ESDTTransfersArgs, input *vmcommon.ContractCallInput) (uint64, error)
	GetRefundCalled                   func() uint64
	SetRefundCalled                   func(refund uint64)
	ReturnCodeCalled                  func() vmcommon.ReturnCode
	SetReturnCodeCalled               func(returnCode vmcommon.ReturnCode)
	ReturnMessageCalled               func() string
	SetReturnMessageCalled            func(message string)
	ReturnDataCalled                  func() [][]byte
	ClearReturnDataCalled             func()
	RemoveReturnDataCalled            func(index uint32)
	FinishCalled                      func(data []byte)
	PrependFinishCalled               func(data []byte)
	DeleteFirstReturnDataCalled       func()
	GetVMOutputCalled                 func() *vmcommon.VMOutput
	AddTxValueToAccountCalled         func(address []byte, value *big.Int)
	DeployCodeCalled                  func(input vmhost.CodeDeployInput)
	CreateVMOutputInCaseOfErrorCalled func(err error) *vmcommon.VMOutput
	AddToActiveStateCalled            func(vmOutput *vmcommon.VMOutput)
	TransferValueOnlyCalled           func(destination []byte, sender []byte, value *big.Int, checkPayable bool) error
	RemoveNonUpdatedStorageCalled     func()
	NextOutputTransferIndexCalled     func() uint32
	GetCrtTransferIndexCalled         func() uint32
	SetCrtTransferIndexCalled         func(index uint32)
	IsInterfaceNilCalled              func() 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) DeleteFirstReturnData

func (o *OutputContextStub) DeleteFirstReturnData()

DeleteFirstReturnData mocked method

func (*OutputContextStub) DeleteOutputAccount

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

DeleteOutputAccount mocked method

func (*OutputContextStub) DeployCode

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

DeployCode mocked method

func (*OutputContextStub) Finish

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

Finish mocked method

func (*OutputContextStub) GetCrtTransferIndex added in v1.5.4

func (o *OutputContextStub) GetCrtTransferIndex() uint32

GetCrtTransferIndex mocked method

func (*OutputContextStub) GetOutputAccount

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

GetOutputAccount mocked method

func (*OutputContextStub) GetOutputAccounts

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

GetOutputAccounts mocked method

func (*OutputContextStub) GetRefund

func (o *OutputContextStub) GetRefund() uint64

GetRefund mocked method

func (*OutputContextStub) GetVMOutput

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

GetVMOutput mocked method

func (*OutputContextStub) InitState

func (o *OutputContextStub) InitState()

InitState mocked method

func (*OutputContextStub) IsInterfaceNil added in v1.5.4

func (o *OutputContextStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*OutputContextStub) NextOutputTransferIndex added in v1.5.4

func (o *OutputContextStub) NextOutputTransferIndex() uint32

NextOutputTransferIndex mocked method

func (*OutputContextStub) PopDiscard

func (o *OutputContextStub) PopDiscard()

PopDiscard mocked method

func (*OutputContextStub) PopMergeActiveState

func (o *OutputContextStub) PopMergeActiveState()

PopMergeActiveState mocked method

func (*OutputContextStub) PopSetActiveState

func (o *OutputContextStub) PopSetActiveState()

PopSetActiveState mocked method

func (*OutputContextStub) PrependFinish

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

PrependFinish mocked method

func (*OutputContextStub) PushState

func (o *OutputContextStub) PushState()

PushState mocked method

func (*OutputContextStub) RemoveNonUpdatedStorage

func (o *OutputContextStub) RemoveNonUpdatedStorage()

RemoveNonUpdatedStorage mocked method

func (*OutputContextStub) RemoveReturnData

func (o *OutputContextStub) RemoveReturnData(index uint32)

RemoveReturnData mocked method

func (*OutputContextStub) ReturnCode

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

ReturnCode mocked method

func (*OutputContextStub) ReturnData

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

ReturnData mocked method

func (*OutputContextStub) ReturnMessage

func (o *OutputContextStub) ReturnMessage() string

ReturnMessage mocked method

func (*OutputContextStub) SetCrtTransferIndex added in v1.5.4

func (o *OutputContextStub) SetCrtTransferIndex(index uint32)

SetCrtTransferIndex 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, asyncData []byte, input []byte, _ vm.CallType) error

Transfer mocked method

func (*OutputContextStub) TransferESDT

func (o *OutputContextStub) TransferESDT(transfersArgs *vmhost.ESDTTransfersArgs, 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

func (*OutputContextStub) WriteLogWithIdentifier added in v1.5.9

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

WriteLogWithIdentifier mocked method

type RuntimeContextMock

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

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

func (*RuntimeContextMock) AddAsyncContextCall

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

AddAsyncContextCall mocked method

func (*RuntimeContextMock) AddError

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

AddError mocked method

func (*RuntimeContextMock) Arguments

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

Arguments mocked method

func (*RuntimeContextMock) BaseOpsErrorShouldFailExecution

func (r *RuntimeContextMock) BaseOpsErrorShouldFailExecution() bool

BaseOpsErrorShouldFailExecution mocked method

func (*RuntimeContextMock) BigFloatAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigFloatAPIErrorShouldFailExecution() bool

BigFloatAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) BigIntAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigIntAPIErrorShouldFailExecution() bool

BigIntAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) CallSCFunction

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

CallSCFunction mocked method

func (*RuntimeContextMock) CleanInstance

func (r *RuntimeContextMock) CleanInstance()

CleanInstance mocked method

func (*RuntimeContextMock) ClearInstanceStack

func (r *RuntimeContextMock) ClearInstanceStack()

ClearInstanceStack mocked method

func (*RuntimeContextMock) ClearStateStack

func (r *RuntimeContextMock) ClearStateStack()

ClearStateStack mocked method

func (*RuntimeContextMock) ClearWarmInstanceCache

func (r *RuntimeContextMock) ClearWarmInstanceCache()

ClearWarmInstanceCache mocked method

func (*RuntimeContextMock) CountSameContractInstancesOnStack

func (r *RuntimeContextMock) CountSameContractInstancesOnStack(_ []byte) uint64

CountSameContractInstancesOnStack mocked method

func (*RuntimeContextMock) CryptoAPIErrorShouldFailExecution

func (r *RuntimeContextMock) CryptoAPIErrorShouldFailExecution() bool

CryptoAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) EndExecution

func (r *RuntimeContextMock) EndExecution()

EndExecution -

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

func (r *RuntimeContextMock) FunctionName() string

FunctionName mocked method

func (*RuntimeContextMock) FunctionNameChecked

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

FunctionNameChecked mocked method

func (*RuntimeContextMock) GetAllErrors

func (r *RuntimeContextMock) GetAllErrors() error

GetAllErrors mocked method

func (*RuntimeContextMock) GetContextAddress

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

GetContextAddress mocked method

func (*RuntimeContextMock) GetCurrentTxHash

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

GetCurrentTxHash mocked method

func (*RuntimeContextMock) GetInstance

func (r *RuntimeContextMock) GetInstance() executor.Instance

GetInstance mocked method()

func (*RuntimeContextMock) GetInstanceStackSize

func (r *RuntimeContextMock) GetInstanceStackSize() uint64

GetInstanceStackSize mocked method

func (*RuntimeContextMock) GetInstanceTracker

func (context *RuntimeContextMock) GetInstanceTracker() vmhost.InstanceTracker

GetInstanceTracker mocked method

func (*RuntimeContextMock) GetOriginalCallerAddress

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

GetOriginalCallerAddress 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) GetPrevTxHash

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

GetPrevTxHash mocked method

func (*RuntimeContextMock) GetRuntimeBreakpointValue

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

GetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) GetSCCode

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

GetSCCode mocked method

func (*RuntimeContextMock) GetSCCodeSize

func (r *RuntimeContextMock) GetSCCodeSize() uint64

GetSCCodeSize mocked method

func (*RuntimeContextMock) GetVMExecutor

func (r *RuntimeContextMock) GetVMExecutor() executor.Executor

GetVMExecutor mocked method

func (*RuntimeContextMock) GetVMInput

GetVMInput mocked method

func (*RuntimeContextMock) GetVMType

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

GetVMType mocked method

func (*RuntimeContextMock) GetWarmInstance

func (r *RuntimeContextMock) GetWarmInstance(codeHash []byte) (executor.Instance, bool)

GetWarmInstance mocked method

func (*RuntimeContextMock) HasFunction

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

HasFunction mocked method

func (*RuntimeContextMock) InitState

func (r *RuntimeContextMock) InitState()

InitState mocked method

func (*RuntimeContextMock) InitStateFromContractCallInput

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

InitStateFromContractCallInput mocked method

func (*RuntimeContextMock) IsFunctionImported

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

IsFunctionImported mocked method

func (*RuntimeContextMock) IsReservedFunctionName added in v1.5.30

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

IsReservedFunctionName moked method

func (*RuntimeContextMock) IsWarmInstance

func (r *RuntimeContextMock) IsWarmInstance() bool

IsWarmInstance mocked method

func (*RuntimeContextMock) ManagedBufferAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ManagedBufferAPIErrorShouldFailExecution() bool

ManagedBufferAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) ManagedMapAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ManagedMapAPIErrorShouldFailExecution() bool

ManagedMapAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) MustVerifyNextContractCode

func (r *RuntimeContextMock) MustVerifyNextContractCode()

MustVerifyNextContractCode mocked method

func (*RuntimeContextMock) NumRunningInstances

func (r *RuntimeContextMock) NumRunningInstances() (int, int)

NumRunningInstances 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) PrepareLegacyAsyncCall

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

PrepareLegacyAsyncCall 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) ReplaceVMExecutor

func (context *RuntimeContextMock) ReplaceVMExecutor(vmExecutor executor.Executor)

ReplaceVMExecutor mocked method

func (*RuntimeContextMock) ResetWarmInstance

func (r *RuntimeContextMock) ResetWarmInstance()

ResetWarmInstance mocked method

func (*RuntimeContextMock) SetCaching

func (r *RuntimeContextMock) SetCaching(_ bool)

SetCaching mocked method

func (*RuntimeContextMock) SetCodeAddress

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

SetCodeAddress mocked method

func (*RuntimeContextMock) SetCustomCallFunction

func (r *RuntimeContextMock) SetCustomCallFunction(_ string)

SetCustomCallFunction mocked method

func (*RuntimeContextMock) SetMaxInstanceStackSize

func (r *RuntimeContextMock) SetMaxInstanceStackSize(uint64)

SetMaxInstanceStackSize mocked method

func (*RuntimeContextMock) SetOriginalCallerAddress

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

SetOriginalCallerAddress mocked method

func (*RuntimeContextMock) SetPointsUsed

func (r *RuntimeContextMock) SetPointsUsed(gasPoints uint64)

SetPointsUsed mocked method

func (*RuntimeContextMock) SetReadOnly

func (r *RuntimeContextMock) SetReadOnly(readOnly bool)

SetReadOnly mocked method

func (*RuntimeContextMock) SetRuntimeBreakpointValue

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

SetRuntimeBreakpointValue mocked method

func (*RuntimeContextMock) SetVMInput

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

SetVMInput mocked method

func (*RuntimeContextMock) SignalExit

func (r *RuntimeContextMock) SignalExit(_ int)

SignalExit mocked method

func (*RuntimeContextMock) SignalUserError

func (r *RuntimeContextMock) SignalUserError(_ string)

SignalUserError mocked method

func (*RuntimeContextMock) StartWasmerInstance

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

StartWasmerInstance mocked method

func (*RuntimeContextMock) SyncExecAPIErrorShouldFailExecution

func (r *RuntimeContextMock) SyncExecAPIErrorShouldFailExecution() bool

SyncExecAPIErrorShouldFailExecution mocked method

func (*RuntimeContextMock) UseGasBoundedShouldFailExecution added in v1.5.32

func (r *RuntimeContextMock) UseGasBoundedShouldFailExecution() bool

UseGasBoundedShouldFailExecution mocked method

func (*RuntimeContextMock) ValidateCallbackName

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

ValidateCallbackName mocked method

func (*RuntimeContextMock) ValidateInstances

func (r *RuntimeContextMock) ValidateInstances() error

ValidateInstances -

func (*RuntimeContextMock) VerifyContractCode

func (r *RuntimeContextMock) VerifyContractCode() error

VerifyContractCode mocked method

type RuntimeContextWrapper

type RuntimeContextWrapper struct {

	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	InitStateFromContractCallInputFunc func(input *vmcommon.ContractCallInput)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetCustomCallFunctionFunc func(callFunction string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetVMInputFunc func() *vmcommon.ContractCallInput
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetVMInputFunc func(vmInput *vmcommon.ContractCallInput)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCAddressFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetOriginalCallerAddressFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetCodeAddressFunc func(scAddress []byte)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCCodeFunc func() ([]byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetSCCodeSizeFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetVMTypeFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	FunctionFunc func() string
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ArgumentsFunc func() [][]byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetCurrentTxHashFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetOriginalTxHashFunc func() []byte
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ExtractCodeUpgradeFromArgsFunc func() ([]byte, []byte, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SignalUserErrorFunc func(message string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	FailExecutionFunc func(err error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	MustVerifyNextContractCodeFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetRuntimeBreakpointValueFunc func(value vmhost.BreakpointValue)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetRuntimeBreakpointValueFunc func() vmhost.BreakpointValue
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncCallInfoFunc func() *vmhost.AsyncCallInfo
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetAsyncCallInfoFunc func(asyncCallInfo *vmhost.AsyncCallInfo)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	AddAsyncContextCallFunc func(contextIdentifier []byte, asyncCall *vmhost.AsyncGeneratedCall) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAsyncContextFunc func(contextIdentifier []byte) (*vmhost.AsyncContext, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetInstanceStackSizeFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CountSameContractInstancesOnStackFunc func(address []byte) uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	IsFunctionImportedFunc func(name string) bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ReadOnlyFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetReadOnlyFunc func(readOnly bool)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	StartWasmerInstanceFunc func(contract []byte, gasLimit uint64, newCode bool) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ClearWarmInstanceCacheFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetMaxInstanceStackSizeFunc func(maxInstanceStackSize 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() executor.Instance
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	FunctionNameCheckedFunc func() (string, error)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CallSCFunctionFunc func(string) error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetPointsUsedFunc func() uint64
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SetPointsUsedFunc func(gasPoints uint64)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BaseOpsErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	SyncExecAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CryptoAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BigIntAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	BigFloatAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ManagedBufferAPIErrorShouldFailExecutionFunc func() bool
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetVMExecutorFunc func() executor.Executor
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	AddErrorFunc func(err error, otherInfo ...string)
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetAllErrorsFunc func() error
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	InitStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PushStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PopSetActiveStateFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	PopDiscardFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	ClearStateStackFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	CleanInstanceFunc func()
	// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
	GetInstanceTrackerFunc func() vmhost.InstanceTracker
	// contains filtered or unexported fields
}

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

func NewRuntimeContextWrapper

func NewRuntimeContextWrapper(inputRuntimeContext *vmhost.RuntimeContext) *RuntimeContextWrapper

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

func (*RuntimeContextWrapper) AddError

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

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

func (*RuntimeContextWrapper) Arguments

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

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

func (*RuntimeContextWrapper) BaseOpsErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BaseOpsErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) BigFloatAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BigFloatAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) BigIntAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) BigIntAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) CallSCFunction

func (contextWrapper *RuntimeContextWrapper) CallSCFunction(functionName string) error

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

func (*RuntimeContextWrapper) CleanInstance

func (contextWrapper *RuntimeContextWrapper) CleanInstance()

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

func (*RuntimeContextWrapper) ClearStateStack

func (contextWrapper *RuntimeContextWrapper) ClearStateStack()

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

func (*RuntimeContextWrapper) ClearWarmInstanceCache

func (contextWrapper *RuntimeContextWrapper) ClearWarmInstanceCache()

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

func (*RuntimeContextWrapper) CountSameContractInstancesOnStack

func (contextWrapper *RuntimeContextWrapper) CountSameContractInstancesOnStack(address []byte) uint64

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

func (*RuntimeContextWrapper) CryptoAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) CryptoAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) EndExecution

func (contextWrapper *RuntimeContextWrapper) EndExecution()

EndExecution -

func (*RuntimeContextWrapper) ExtractCodeUpgradeFromArgs

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

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

func (*RuntimeContextWrapper) FailExecution

func (contextWrapper *RuntimeContextWrapper) FailExecution(err error)

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

func (*RuntimeContextWrapper) FunctionName

func (contextWrapper *RuntimeContextWrapper) FunctionName() string

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

func (*RuntimeContextWrapper) FunctionNameChecked

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

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

func (*RuntimeContextWrapper) GetAllErrors

func (contextWrapper *RuntimeContextWrapper) GetAllErrors() error

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

func (*RuntimeContextWrapper) GetContextAddress

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

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

func (*RuntimeContextWrapper) GetCurrentTxHash

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

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

func (*RuntimeContextWrapper) GetInstance

func (contextWrapper *RuntimeContextWrapper) GetInstance() executor.Instance

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

func (*RuntimeContextWrapper) GetInstanceStackSize

func (contextWrapper *RuntimeContextWrapper) GetInstanceStackSize() uint64

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

func (*RuntimeContextWrapper) GetInstanceTracker

func (contextWrapper *RuntimeContextWrapper) GetInstanceTracker() vmhost.InstanceTracker

GetInstanceTracker -

func (*RuntimeContextWrapper) GetOriginalCallerAddress

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

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

func (*RuntimeContextWrapper) GetOriginalTxHash

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

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

func (*RuntimeContextWrapper) GetPointsUsed

func (contextWrapper *RuntimeContextWrapper) GetPointsUsed() uint64

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

func (*RuntimeContextWrapper) GetPrevTxHash

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

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

func (*RuntimeContextWrapper) GetRuntimeBreakpointValue

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

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

func (*RuntimeContextWrapper) GetSCCode

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

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

func (*RuntimeContextWrapper) GetSCCodeSize

func (contextWrapper *RuntimeContextWrapper) GetSCCodeSize() uint64

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

func (*RuntimeContextWrapper) GetVMExecutor

func (contextWrapper *RuntimeContextWrapper) GetVMExecutor() executor.Executor

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

func (*RuntimeContextWrapper) GetVMInput

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

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

func (*RuntimeContextWrapper) GetVMType

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

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

func (*RuntimeContextWrapper) GetWrappedRuntimeContext

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

GetWrappedRuntimeContext gets the wrapped RuntimeContext

func (*RuntimeContextWrapper) HasFunction

func (contextWrapper *RuntimeContextWrapper) HasFunction(functionName string) bool

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

func (*RuntimeContextWrapper) InitState

func (contextWrapper *RuntimeContextWrapper) InitState()

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

func (*RuntimeContextWrapper) InitStateFromContractCallInput

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

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

func (*RuntimeContextWrapper) IsFunctionImported

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

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

func (*RuntimeContextWrapper) IsReservedFunctionName added in v1.5.30

func (contextWrapper *RuntimeContextWrapper) IsReservedFunctionName(functionName string) bool

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

func (*RuntimeContextWrapper) ManagedBufferAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) ManagedBufferAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) ManagedMapAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) ManagedMapAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) MustVerifyNextContractCode

func (contextWrapper *RuntimeContextWrapper) MustVerifyNextContractCode()

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

func (*RuntimeContextWrapper) PopDiscard

func (contextWrapper *RuntimeContextWrapper) PopDiscard()

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

func (*RuntimeContextWrapper) PopSetActiveState

func (contextWrapper *RuntimeContextWrapper) PopSetActiveState()

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

func (*RuntimeContextWrapper) PushState

func (contextWrapper *RuntimeContextWrapper) PushState()

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

func (*RuntimeContextWrapper) ReadOnly

func (contextWrapper *RuntimeContextWrapper) ReadOnly() bool

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

func (*RuntimeContextWrapper) ReplaceVMExecutor

func (contextWrapper *RuntimeContextWrapper) ReplaceVMExecutor(vmExecutor executor.Executor)

ReplaceVMExecutor mocked method

func (*RuntimeContextWrapper) SetCodeAddress

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

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

func (*RuntimeContextWrapper) SetCustomCallFunction

func (contextWrapper *RuntimeContextWrapper) SetCustomCallFunction(callFunction string)

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

func (*RuntimeContextWrapper) SetMaxInstanceStackSize

func (contextWrapper *RuntimeContextWrapper) SetMaxInstanceStackSize(maxInstanceStackSize uint64)

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

func (*RuntimeContextWrapper) SetPointsUsed

func (contextWrapper *RuntimeContextWrapper) SetPointsUsed(gasPoints uint64)

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

func (*RuntimeContextWrapper) SetReadOnly

func (contextWrapper *RuntimeContextWrapper) SetReadOnly(readOnly bool)

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

func (*RuntimeContextWrapper) SetRuntimeBreakpointValue

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

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

func (*RuntimeContextWrapper) SetVMInput

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

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

func (*RuntimeContextWrapper) SignalUserError

func (contextWrapper *RuntimeContextWrapper) SignalUserError(message string)

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

func (*RuntimeContextWrapper) StartWasmerInstance

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

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

func (*RuntimeContextWrapper) SyncExecAPIErrorShouldFailExecution

func (contextWrapper *RuntimeContextWrapper) SyncExecAPIErrorShouldFailExecution() bool

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

func (*RuntimeContextWrapper) UseGasBoundedShouldFailExecution added in v1.5.32

func (contextWrapper *RuntimeContextWrapper) UseGasBoundedShouldFailExecution() bool

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

func (*RuntimeContextWrapper) ValidateCallbackName

func (contextWrapper *RuntimeContextWrapper) ValidateCallbackName(callbackName string) error

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

func (*RuntimeContextWrapper) ValidateInstances

func (contextWrapper *RuntimeContextWrapper) ValidateInstances() error

ValidateInstances -

func (*RuntimeContextWrapper) VerifyContractCode

func (contextWrapper *RuntimeContextWrapper) VerifyContractCode() error

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

type StubAccount

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

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

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

func (*StubAccount) AccountDataHandler

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

AccountDataHandler -

func (*StubAccount) AddToBalance

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

AddToBalance -

func (*StubAccount) AddressBytes

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

AddressBytes -

func (*StubAccount) ChangeOwnerAddress

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

ChangeOwnerAddress -

func (*StubAccount) ClaimDeveloperRewards

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

ClaimDeveloperRewards -

func (*StubAccount) GetBalance

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

GetBalance -

func (*StubAccount) GetCodeHash

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

GetCodeHash -

func (*StubAccount) GetCodeMetadata

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

GetCodeMetadata -

func (*StubAccount) GetDeveloperReward

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

GetDeveloperReward -

func (*StubAccount) GetNonce

func (a *StubAccount) GetNonce() uint64

GetNonce -

func (*StubAccount) GetOwnerAddress

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

GetOwnerAddress -

func (*StubAccount) GetRootHash

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

GetRootHash -

func (*StubAccount) GetUserName

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

GetUserName -

func (*StubAccount) IncreaseNonce

func (a *StubAccount) IncreaseNonce(_ uint64)

IncreaseNonce -

func (*StubAccount) IsInterfaceNil

func (a *StubAccount) IsInterfaceNil() bool

IsInterfaceNil -

func (*StubAccount) SetCodeMetadata added in v1.5.4

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

SetCodeMetadata -

func (*StubAccount) SetOwnerAddress

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

SetOwnerAddress -

func (*StubAccount) SetUserName

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

SetUserName -

func (*StubAccount) SubFromBalance added in v1.5.30

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

SubFromBalance -

type VMHostMock

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

	EthInput []byte

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

	IsBuiltinFunc bool

	StoredInputs []*vmcommon.ContractCallInput

	VMOutputQueue    []*vmcommon.VMOutput
	VMOutputToReturn int
	Err              error
}

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

func (*VMHostMock) AreInSameShard

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

AreInSameShard mocked method

func (*VMHostMock) Async

func (host *VMHostMock) Async() vmhost.AsyncContext

Async 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) Close

func (host *VMHostMock) Close() error

Close -

func (*VMHostMock) CompleteLogEntriesWithCallType added in v1.5.7

func (host *VMHostMock) CompleteLogEntriesWithCallType(vmOutput *vmcommon.VMOutput, callType string)

CompleteLogEntriesWithCallType mocked method

func (*VMHostMock) CreateNewContract

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

CreateNewContract mocked method

func (*VMHostMock) Crypto

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

Crypto mocked method

func (*VMHostMock) EnableEpochsHandler

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

EnableEpochsHandler mocked method

func (*VMHostMock) EnqueueVMOutput

func (host *VMHostMock) EnqueueVMOutput(vmOutput *vmcommon.VMOutput)

EnqueueVMOutput enqueues the given VMOutput

func (*VMHostMock) ExecuteESDTTransfer

func (host *VMHostMock) ExecuteESDTTransfer(_ *vmhost.ESDTTransfersArgs, _ vm.CallType) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostMock) ExecuteOnDestContext

func (host *VMHostMock) ExecuteOnDestContext(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, bool, error)

ExecuteOnDestContext mocked method

func (*VMHostMock) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostMock) FixOOGReturnCodeEnabled

func (host *VMHostMock) FixOOGReturnCodeEnabled() bool

FixOOGReturnCodeEnabled mocked method

func (*VMHostMock) GasScheduleChange

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

GasScheduleChange mocked method

func (*VMHostMock) GetGasScheduleMap

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

GetGasScheduleMap mocked method

func (*VMHostMock) GetGasTrace added in v1.5.25

func (host *VMHostMock) GetGasTrace() map[string]map[string][]uint64

GetGasTrace -

func (*VMHostMock) GetNextVMOutput

func (host *VMHostMock) GetNextVMOutput() *vmcommon.VMOutput

GetNextVMOutput returns the next VMOutput in the queue

func (*VMHostMock) GetVersion

func (host *VMHostMock) GetVersion() string

GetVersion mocked method

func (*VMHostMock) InitState

func (host *VMHostMock) InitState()

InitState mocked method

func (*VMHostMock) IsAheadOfTimeCompileEnabled

func (host *VMHostMock) IsAheadOfTimeCompileEnabled() bool

IsAheadOfTimeCompileEnabled mocked method

func (*VMHostMock) IsAllowedToExecute added in v1.5.30

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

IsAllowedToExecute mocked method

func (*VMHostMock) IsBuiltinFunctionCall

func (host *VMHostMock) IsBuiltinFunctionCall(_ []byte) bool

IsBuiltinFunctionCall mocked method

func (*VMHostMock) IsBuiltinFunctionName

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

IsBuiltinFunctionName mocked method

func (*VMHostMock) IsDynamicGasLockingEnabled

func (host *VMHostMock) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled mocked method

func (*VMHostMock) IsESDTFunctionsEnabled

func (host *VMHostMock) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostMock) IsInterfaceNil

func (host *VMHostMock) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostMock) ManagedTypes

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

ManagedTypes mocked method

func (*VMHostMock) Metering

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

Metering mocked method

func (*VMHostMock) Output

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

Output mocked method

func (*VMHostMock) PopState

func (host *VMHostMock) PopState()

PopState mocked method

func (*VMHostMock) PushState

func (host *VMHostMock) PushState()

PushState mocked method

func (*VMHostMock) Reset

func (host *VMHostMock) Reset()

Reset -

func (*VMHostMock) RunSmartContractCall

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

RunSmartContractCall mocked method

func (*VMHostMock) RunSmartContractCreate

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

RunSmartContractCreate mocked method

func (*VMHostMock) Runtime

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

Runtime mocked method

func (*VMHostMock) SetBuiltInFunctionsContainer

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

SetBuiltInFunctionsContainer mocked method

func (*VMHostMock) SetGasTracing added in v1.5.25

func (host *VMHostMock) SetGasTracing(enableGasTracing bool)

SetGasTracing -

func (*VMHostMock) SetRuntimeContext

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

SetRuntimeContext mocked method

func (*VMHostMock) Storage

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

Storage mocked method

func (*VMHostMock) StoreInput

func (host *VMHostMock) StoreInput(input *vmcommon.ContractCallInput)

StoreInput enqueues the given ContractCallInput

type VMHostStub

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

	CryptoCalled              func() crypto.VMCrypto
	BlockchainCalled          func() vmhost.BlockchainContext
	RuntimeCalled             func() vmhost.RuntimeContext
	OutputCalled              func() vmhost.OutputContext
	MeteringCalled            func() vmhost.MeteringContext
	AsyncCalled               func() vmhost.AsyncContext
	StorageCalled             func() vmhost.StorageContext
	EnableEpochsHandlerCalled func() vmhost.EnableEpochsHandler
	GetContextsCalled         func() (vmhost.ManagedTypesContext, vmhost.BlockchainContext, vmhost.MeteringContext, vmhost.OutputContext, vmhost.RuntimeContext, vmhost.AsyncContext, vmhost.StorageContext)
	ManagedTypesCalled        func() vmhost.ManagedTypesContext

	ExecuteESDTTransferCalled   func(transfersArgs *vmhost.ESDTTransfersArgs, callType vm.CallType) (*vmcommon.VMOutput, uint64, error)
	CreateNewContractCalled     func(input *vmcommon.ContractCreateInput, createContractCallType int) ([]byte, error)
	ExecuteOnSameContextCalled  func(input *vmcommon.ContractCallInput) error
	ExecuteOnDestContextCalled  func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, bool, error)
	IsBuiltinFunctionNameCalled func(functionName string) bool
	IsBuiltinFunctionCallCalled func(data []byte) bool
	AreInSameShardCalled        func(left []byte, right []byte) bool
	IsAllowedToExecuteCalled    func(opcode string) 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
	CompleteLogEntriesWithCallTypeCalled func(vmOutput *vmcommon.VMOutput, callType string)

	SetRuntimeContextCalled func(runtime vmhost.RuntimeContext)

	SetBuiltInFunctionsContainerCalled func(builtInFuncs vmcommon.BuiltInFunctionContainer)

	UpdateCurrentAsyncCallStatusCalled func(vmInput *vmcommon.VMInput, prevPrevTxHash []byte) (*vmhost.AsyncCall, error)
}

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

func (vhs *VMHostStub) Async() vmhost.AsyncContext

Async 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) Close

func (vhs *VMHostStub) Close() error

Close -

func (*VMHostStub) CompleteLogEntriesWithCallType added in v1.5.7

func (vhs *VMHostStub) CompleteLogEntriesWithCallType(vmOutput *vmcommon.VMOutput, callType string)

CompleteLogEntriesWithCallType mocked method

func (*VMHostStub) CreateNewContract

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

CreateNewContract mocked method

func (*VMHostStub) Crypto

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

Crypto mocked method

func (*VMHostStub) EnableEpochsHandler

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

EnableEpochsHandler mocked method

func (*VMHostStub) ExecuteESDTTransfer

func (vhs *VMHostStub) ExecuteESDTTransfer(transfersArgs *vmhost.ESDTTransfersArgs, callType vm.CallType) (*vmcommon.VMOutput, uint64, error)

ExecuteESDTTransfer mocked method

func (*VMHostStub) ExecuteOnDestContext

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

ExecuteOnDestContext mocked method

func (*VMHostStub) ExecuteOnSameContext

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

ExecuteOnSameContext mocked method

func (*VMHostStub) GasScheduleChange

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

GasScheduleChange mocked method

func (*VMHostStub) GetGasScheduleMap

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

GetGasScheduleMap returns the currently stored gas schedule

func (*VMHostStub) GetGasTrace added in v1.5.25

func (vhs *VMHostStub) GetGasTrace() map[string]map[string][]uint64

GetGasTrace -

func (*VMHostStub) GetVersion

func (vhs *VMHostStub) GetVersion() string

GetVersion mocked method

func (*VMHostStub) InitState

func (vhs *VMHostStub) InitState()

InitState mocked method

func (*VMHostStub) IsAheadOfTimeCompileEnabled

func (vhs *VMHostStub) IsAheadOfTimeCompileEnabled() bool

IsAheadOfTimeCompileEnabled mocked method

func (*VMHostStub) IsAllowedToExecute added in v1.5.30

func (vhs *VMHostStub) IsAllowedToExecute(opcode string) bool

IsAllowedToExecute mocked method

func (*VMHostStub) IsBuiltinFunctionCall

func (vhs *VMHostStub) IsBuiltinFunctionCall(data []byte) bool

IsBuiltinFunctionCall mocked method

func (*VMHostStub) IsBuiltinFunctionName

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

IsBuiltinFunctionName mocked method

func (*VMHostStub) IsDynamicGasLockingEnabled

func (vhs *VMHostStub) IsDynamicGasLockingEnabled() bool

IsDynamicGasLockingEnabled mocked method

func (*VMHostStub) IsESDTFunctionsEnabled

func (vhs *VMHostStub) IsESDTFunctionsEnabled() bool

IsESDTFunctionsEnabled mocked method

func (*VMHostStub) IsInterfaceNil

func (vhs *VMHostStub) IsInterfaceNil() bool

IsInterfaceNil mocked method

func (*VMHostStub) ManagedTypes

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

ManagedTypes mocked method

func (*VMHostStub) Metering

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

Metering mocked method

func (*VMHostStub) Output

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

Output mocked method

func (*VMHostStub) PopState

func (vhs *VMHostStub) PopState()

PopState mocked method

func (*VMHostStub) PushState

func (vhs *VMHostStub) PushState()

PushState mocked method

func (*VMHostStub) Reset

func (vhs *VMHostStub) Reset()

Reset -

func (*VMHostStub) RunSmartContractCall

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

RunSmartContractCall mocked method

func (*VMHostStub) RunSmartContractCreate

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

RunSmartContractCreate mocked method

func (*VMHostStub) Runtime

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

Runtime mocked method

func (*VMHostStub) SetBuiltInFunctionsContainer

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

SetBuiltInFunctionsContainer mocked method

func (*VMHostStub) SetGasTracing added in v1.5.25

func (vhs *VMHostStub) SetGasTracing(enableGasTracing bool)

SetGasTracing -

func (*VMHostStub) SetRuntimeContext

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

SetRuntimeContext mocked method

func (*VMHostStub) Storage

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

Storage mocked method

Jump to

Keyboard shortcuts

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