mock

package
v0.3.27 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountDoesntExist = errors.New("account does not exist")

Functions

This section is empty.

Types

type AccountMock added in v0.3.21

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

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

AccountMock holds the account info

func (*AccountMock) AddressBytes added in v0.3.21

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

AddressBytes -

func (*AccountMock) GetBalance added in v0.3.21

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

GetBalance -

func (*AccountMock) GetCode added in v0.3.21

func (a *AccountMock) GetCode() []byte

GetCode -

func (*AccountMock) GetCodeHash added in v0.3.21

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

GetCodeHash -

func (*AccountMock) GetCodeMetadata added in v0.3.21

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

GetCodeMetadata -

func (*AccountMock) GetDeveloperReward added in v0.3.21

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

GetDeveloperReward -

func (*AccountMock) GetNonce added in v0.3.21

func (a *AccountMock) GetNonce() uint64

GetNonce -

func (*AccountMock) GetOwnerAddress added in v0.3.21

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

GetOwnerAddress -

func (*AccountMock) GetRootHash added in v0.3.21

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

GetRootHash -

func (*AccountMock) GetUserName added in v0.3.21

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

GetOwnerAddress -

func (*AccountMock) IsInterfaceNil added in v0.3.21

func (a *AccountMock) IsInterfaceNil() bool

IsInterfaceNil -

type AccountsMap

type AccountsMap map[string]*AccountMock

AccountMap is a map from address to account

type BlockchainHookMock

type BlockchainHookMock struct {
	Accounts      AccountsMap
	BlockHash     []byte
	LNonce        uint64
	LRound        uint64
	CNonce        uint64
	CRound        uint64
	LTimeStamp    uint64
	CTimeStamp    uint64
	LRandomSeed   []byte
	CRandomSeed   []byte
	LEpoch        uint32
	CEpoch        uint32
	StateRootHash []byte
	NewAddr       []byte
	Value         *big.Int
	Gas           uint64
	Err           error
}

func NewBlockchainHookMock

func NewBlockchainHookMock() *BlockchainHookMock

func (*BlockchainHookMock) AddAccount

func (b *BlockchainHookMock) AddAccount(account *AccountMock)

func (*BlockchainHookMock) AddAccounts

func (b *BlockchainHookMock) AddAccounts(accounts []*AccountMock)

func (*BlockchainHookMock) CurrentEpoch

func (b *BlockchainHookMock) CurrentEpoch() uint32

func (*BlockchainHookMock) CurrentNonce

func (b *BlockchainHookMock) CurrentNonce() uint64

func (*BlockchainHookMock) CurrentRandomSeed

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

func (*BlockchainHookMock) CurrentRound

func (b *BlockchainHookMock) CurrentRound() uint64

func (*BlockchainHookMock) CurrentTimeStamp

func (b *BlockchainHookMock) CurrentTimeStamp() uint64

func (*BlockchainHookMock) GetAllState added in v0.3.16

func (b *BlockchainHookMock) GetAllState(_ []byte) (map[string][]byte, error)

func (*BlockchainHookMock) GetBlockhash

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

func (*BlockchainHookMock) GetBuiltinFunctionNames added in v0.3.14

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

func (*BlockchainHookMock) GetShardOfAddress added in v0.3.21

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

func (*BlockchainHookMock) GetStateRootHash

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

func (*BlockchainHookMock) GetStorageData

func (b *BlockchainHookMock) GetStorageData(address []byte, index []byte) ([]byte, error)

func (*BlockchainHookMock) GetUserAccount added in v0.3.21

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

func (*BlockchainHookMock) IsSmartContract added in v0.3.21

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

func (*BlockchainHookMock) LastEpoch

func (b *BlockchainHookMock) LastEpoch() uint32

func (*BlockchainHookMock) LastNonce

func (b *BlockchainHookMock) LastNonce() uint64

func (*BlockchainHookMock) LastRandomSeed

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

func (*BlockchainHookMock) LastRound

func (b *BlockchainHookMock) LastRound() uint64

func (*BlockchainHookMock) LastTimeStamp

func (b *BlockchainHookMock) LastTimeStamp() uint64

func (*BlockchainHookMock) NewAddress

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

func (*BlockchainHookMock) ProcessBuiltInFunction added in v0.3.13

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

func (*BlockchainHookMock) UpdateAccounts added in v0.3.12

func (b *BlockchainHookMock) UpdateAccounts(outputAccounts map[string]*vmcommon.OutputAccount)

type BlockchainHookStub added in v0.3.8

type BlockchainHookStub struct {
	NewAddressCalled              func(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)
	GetStorageDataCalled          func(accountsAddress []byte, index []byte) ([]byte, error)
	GetBlockHashCalled            func(nonce uint64) ([]byte, error)
	LastNonceCalled               func() uint64
	LastRoundCalled               func() uint64
	LastTimeStampCalled           func() uint64
	LastRandomSeedCalled          func() []byte
	LastEpochCalled               func() uint32
	GetStateRootHashCalled        func() []byte
	CurrentNonceCalled            func() uint64
	CurrentRoundCalled            func() uint64
	CurrentTimeStampCalled        func() uint64
	CurrentRandomSeedCalled       func() []byte
	CurrentEpochCalled            func() uint32
	ProcessBuiltInFunctionCalled  func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
	GetBuiltinFunctionNamesCalled func() vmcommon.FunctionNames
	GetAllStateCalled             func(address []byte) (map[string][]byte, error)
	GetUserAccountCalled          func(address []byte) (vmcommon.UserAccountHandler, error)
	GetShardOfAddressCalled       func(address []byte) uint32
	IsSmartContractCalled         func(address []byte) bool
}

func (*BlockchainHookStub) CurrentEpoch added in v0.3.8

func (b *BlockchainHookStub) CurrentEpoch() uint32

func (*BlockchainHookStub) CurrentNonce added in v0.3.8

func (b *BlockchainHookStub) CurrentNonce() uint64

func (*BlockchainHookStub) CurrentRandomSeed added in v0.3.8

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

func (*BlockchainHookStub) CurrentRound added in v0.3.8

func (b *BlockchainHookStub) CurrentRound() uint64

func (*BlockchainHookStub) CurrentTimeStamp added in v0.3.8

func (b *BlockchainHookStub) CurrentTimeStamp() uint64

func (*BlockchainHookStub) GetAllState added in v0.3.16

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

func (*BlockchainHookStub) GetBlockhash added in v0.3.8

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

func (*BlockchainHookStub) GetBuiltinFunctionNames added in v0.3.14

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

func (*BlockchainHookStub) GetShardOfAddress added in v0.3.21

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

func (*BlockchainHookStub) GetStateRootHash added in v0.3.8

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

func (*BlockchainHookStub) GetStorageData added in v0.3.8

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

func (*BlockchainHookStub) GetUserAccount added in v0.3.21

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

func (*BlockchainHookStub) IsSmartContract added in v0.3.21

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

func (*BlockchainHookStub) LastEpoch added in v0.3.8

func (b *BlockchainHookStub) LastEpoch() uint32

func (*BlockchainHookStub) LastNonce added in v0.3.8

func (b *BlockchainHookStub) LastNonce() uint64

func (*BlockchainHookStub) LastRandomSeed added in v0.3.8

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

func (*BlockchainHookStub) LastRound added in v0.3.8

func (b *BlockchainHookStub) LastRound() uint64

func (*BlockchainHookStub) LastTimeStamp added in v0.3.8

func (b *BlockchainHookStub) LastTimeStamp() uint64

func (*BlockchainHookStub) NewAddress added in v0.3.8

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

func (*BlockchainHookStub) ProcessBuiltInFunction added in v0.3.13

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

type CryptoHookMock

type CryptoHookMock struct {
	Result []byte
	Err    error
}

func (*CryptoHookMock) Ecrecover

func (c *CryptoHookMock) Ecrecover(hash []byte, recoveryID []byte, r []byte, s []byte) ([]byte, error)

func (*CryptoHookMock) Keccak256

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

func (*CryptoHookMock) Ripemd160

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

func (*CryptoHookMock) Sha256

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

type MeteringContextMock

type MeteringContextMock struct {
	GasCost           *config.GasCost
	GasLeftMock       uint64
	BlockGasLimitMock uint64
	GasLocked         uint64
	Err               error
}

func (*MeteringContextMock) BlockGasLimit

func (m *MeteringContextMock) BlockGasLimit() uint64

func (*MeteringContextMock) BoundGasLimit

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

func (*MeteringContextMock) DeductInitialGasForDirectDeployment

func (m *MeteringContextMock) DeductInitialGasForDirectDeployment(input arwen.CodeDeployInput) error

func (*MeteringContextMock) DeductInitialGasForExecution

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

func (*MeteringContextMock) DeductInitialGasForIndirectDeployment

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

func (*MeteringContextMock) FreeGas

func (m *MeteringContextMock) FreeGas(gas uint64)

func (*MeteringContextMock) GasLeft

func (m *MeteringContextMock) GasLeft() uint64

func (*MeteringContextMock) GasSchedule

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

func (*MeteringContextMock) GetGasLockedForAsyncStep added in v0.3.13

func (m *MeteringContextMock) GetGasLockedForAsyncStep() uint64

func (*MeteringContextMock) RestoreGas

func (m *MeteringContextMock) RestoreGas(gas uint64)

func (*MeteringContextMock) SetGasSchedule

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

func (*MeteringContextMock) UnlockGasIfAsyncStep

func (m *MeteringContextMock) UnlockGasIfAsyncStep()

func (*MeteringContextMock) UseGas

func (m *MeteringContextMock) UseGas(gas uint64)

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
}

func (*OutputContextMock) AddToActiveState added in v0.3.16

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

func (*OutputContextMock) AddTxValueToAccount

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

func (*OutputContextMock) CensorVMOutput added in v0.3.13

func (o *OutputContextMock) CensorVMOutput()

func (*OutputContextMock) ClearReturnData

func (o *OutputContextMock) ClearReturnData()

func (*OutputContextMock) ClearStateStack

func (o *OutputContextMock) ClearStateStack()

func (*OutputContextMock) CopyTopOfStackToActiveState added in v0.3.13

func (o *OutputContextMock) CopyTopOfStackToActiveState()

func (*OutputContextMock) CreateVMOutputInCaseOfError

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

func (*OutputContextMock) DeployCode

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

func (*OutputContextMock) Finish

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

func (*OutputContextMock) GetOutputAccount

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

func (*OutputContextMock) GetRefund

func (o *OutputContextMock) GetRefund() uint64

func (*OutputContextMock) GetVMOutput

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

func (*OutputContextMock) InitState

func (o *OutputContextMock) InitState()

func (*OutputContextMock) NewVMOutputAccount

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

func (*OutputContextMock) NewVMOutputAccountFromMockAccount

func (o *OutputContextMock) NewVMOutputAccountFromMockAccount(account *AccountMock) *vmcommon.OutputAccount

func (*OutputContextMock) PopDiscard added in v0.3.13

func (o *OutputContextMock) PopDiscard()

func (*OutputContextMock) PopMergeActiveState added in v0.3.13

func (o *OutputContextMock) PopMergeActiveState()

func (*OutputContextMock) PopSetActiveState added in v0.3.13

func (o *OutputContextMock) PopSetActiveState()

func (*OutputContextMock) PushState

func (o *OutputContextMock) PushState()

func (*OutputContextMock) ReturnCode

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

func (*OutputContextMock) ReturnData

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

func (*OutputContextMock) ReturnMessage

func (o *OutputContextMock) ReturnMessage() string

func (*OutputContextMock) SelfDestruct

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

func (*OutputContextMock) SetRefund

func (o *OutputContextMock) SetRefund(refund uint64)

func (*OutputContextMock) SetReturnCode

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

func (*OutputContextMock) SetReturnMessage

func (o *OutputContextMock) SetReturnMessage(returnMessage string)

func (*OutputContextMock) Transfer

func (o *OutputContextMock) Transfer(destination []byte, sender []byte, gasLimit uint64, value *big.Int, input []byte) error

func (*OutputContextMock) WriteLog

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

type OutputContextStub

type OutputContextStub struct {
	InitStateCalled                   func()
	PushStateCalled                   func()
	PopSetActiveStateCalled           func()
	PopMergeActiveStateCalled         func()
	PopDiscardCalled                  func()
	ClearStateStackCalled             func()
	CopyTopOfStackToActiveStateCalled func()
	CensorVMOutputCalled              func()
	GetOutputAccountCalled            func(address []byte) (*vmcommon.OutputAccount, bool)
	WriteLogCalled                    func(address []byte, topics [][]byte, data []byte)
	TransferCalled                    func(destination []byte, sender []byte, gasLimit uint64, value *big.Int, input []byte) error
	SelfDestructCalled                func(address []byte, beneficiary []byte)
	GetRefundCalled                   func() uint64
	SetRefundCalled                   func(refund uint64)
	ReturnCodeCalled                  func() vmcommon.ReturnCode
	SetReturnCodeCalled               func(returnCode vmcommon.ReturnCode)
	ReturnMessageCalled               func() string
	SetReturnMessageCalled            func(message string)
	ReturnDataCalled                  func() [][]byte
	ClearReturnDataCalled             func()
	FinishCalled                      func(data []byte)
	GetVMOutputCalled                 func() *vmcommon.VMOutput
	AddTxValueToAccountCalled         func(address []byte, value *big.Int)
	DeployCodeCalled                  func(input arwen.CodeDeployInput)
	CreateVMOutputInCaseOfErrorCalled func(err error) *vmcommon.VMOutput
	AddToActiveStateCalled            func(vmOutput *vmcommon.VMOutput)
}

func (*OutputContextStub) AddToActiveState added in v0.3.16

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

func (*OutputContextStub) AddTxValueToAccount

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

func (*OutputContextStub) CensorVMOutput added in v0.3.13

func (o *OutputContextStub) CensorVMOutput()

func (*OutputContextStub) ClearReturnData

func (o *OutputContextStub) ClearReturnData()

func (*OutputContextStub) ClearStateStack

func (o *OutputContextStub) ClearStateStack()

func (*OutputContextStub) CopyTopOfStackToActiveState added in v0.3.13

func (o *OutputContextStub) CopyTopOfStackToActiveState()

func (*OutputContextStub) CreateVMOutputInCaseOfError

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

func (*OutputContextStub) DeployCode

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

func (*OutputContextStub) Finish

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

func (*OutputContextStub) GetOutputAccount

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

func (*OutputContextStub) GetRefund

func (o *OutputContextStub) GetRefund() uint64

func (*OutputContextStub) GetVMOutput

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

func (*OutputContextStub) InitState

func (o *OutputContextStub) InitState()

func (*OutputContextStub) PopDiscard added in v0.3.13

func (o *OutputContextStub) PopDiscard()

func (*OutputContextStub) PopMergeActiveState added in v0.3.13

func (o *OutputContextStub) PopMergeActiveState()

func (*OutputContextStub) PopSetActiveState added in v0.3.13

func (o *OutputContextStub) PopSetActiveState()

func (*OutputContextStub) PushState

func (o *OutputContextStub) PushState()

func (*OutputContextStub) ReturnCode

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

func (*OutputContextStub) ReturnData

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

func (*OutputContextStub) ReturnMessage

func (o *OutputContextStub) ReturnMessage() string

func (*OutputContextStub) SelfDestruct

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

func (*OutputContextStub) SetRefund

func (o *OutputContextStub) SetRefund(refund uint64)

func (*OutputContextStub) SetReturnCode

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

func (*OutputContextStub) SetReturnMessage

func (o *OutputContextStub) SetReturnMessage(message string)

func (*OutputContextStub) Transfer

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

func (*OutputContextStub) WriteLog

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

type RuntimeContextMock

type RuntimeContextMock struct {
	Err                    error
	VmInput                *vmcommon.VMInput
	SCAddress              []byte
	CallFunction           string
	VmType                 []byte
	ReadOnlyFlag           bool
	CurrentBreakpointValue arwen.BreakpointValue
	PointsUsed             uint64
	InstanceCtxID          int
	MemLoadResult          []byte
	FailCryptoAPI          bool
	FailElrondAPI          bool
	FailBigIntAPI          bool
	AsyncCallInfo          *arwen.AsyncCallInfo
	RunningInstances       uint64
	CurrentTxHash          []byte
	OriginalTxHash         []byte
}

func (*RuntimeContextMock) AddAsyncContextCall added in v0.3.21

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

func (*RuntimeContextMock) Arguments

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

func (*RuntimeContextMock) BigIntAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigIntAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) CleanInstance

func (r *RuntimeContextMock) CleanInstance()

func (*RuntimeContextMock) ClearInstanceStack

func (r *RuntimeContextMock) ClearInstanceStack()

func (*RuntimeContextMock) ClearStateStack

func (r *RuntimeContextMock) ClearStateStack()

func (*RuntimeContextMock) CryptoAPIErrorShouldFailExecution

func (r *RuntimeContextMock) CryptoAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) ElrondAPIErrorShouldFailExecution

func (r *RuntimeContextMock) ElrondAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) ExtractCodeUpgradeFromArgs added in v0.3.21

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

func (*RuntimeContextMock) FailExecution

func (r *RuntimeContextMock) FailExecution(err error)

func (*RuntimeContextMock) Function

func (r *RuntimeContextMock) Function() string

func (*RuntimeContextMock) GetAsyncCallInfo

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

func (*RuntimeContextMock) GetAsyncContext added in v0.3.21

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

func (*RuntimeContextMock) GetAsyncContextInfo added in v0.3.21

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

func (*RuntimeContextMock) GetCurrentTxHash added in v0.3.13

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

func (*RuntimeContextMock) GetFunctionToCall

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

func (*RuntimeContextMock) GetInitFunction

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

func (*RuntimeContextMock) GetInstanceContext

func (r *RuntimeContextMock) GetInstanceContext() *wasmer.InstanceContext

func (*RuntimeContextMock) GetInstanceExports

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

func (*RuntimeContextMock) GetOriginalTxHash added in v0.3.13

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

func (*RuntimeContextMock) GetPointsUsed

func (r *RuntimeContextMock) GetPointsUsed() uint64

func (*RuntimeContextMock) GetRuntimeBreakpointValue

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

func (*RuntimeContextMock) GetSCAddress

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

func (*RuntimeContextMock) GetVMInput

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

func (*RuntimeContextMock) GetVMType

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

func (*RuntimeContextMock) InitState

func (r *RuntimeContextMock) InitState()

func (*RuntimeContextMock) InitStateFromContractCallInput

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

func (*RuntimeContextMock) MemLoad

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

func (*RuntimeContextMock) MemStore

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

func (*RuntimeContextMock) PopDiscard added in v0.3.13

func (r *RuntimeContextMock) PopDiscard()

func (*RuntimeContextMock) PopInstance

func (r *RuntimeContextMock) PopInstance()

func (*RuntimeContextMock) PopSetActiveState added in v0.3.13

func (r *RuntimeContextMock) PopSetActiveState()

func (*RuntimeContextMock) PushInstance

func (r *RuntimeContextMock) PushInstance()

func (*RuntimeContextMock) PushState

func (r *RuntimeContextMock) PushState()

func (*RuntimeContextMock) ReadOnly

func (r *RuntimeContextMock) ReadOnly() bool

func (*RuntimeContextMock) RunningInstancesCount added in v0.3.13

func (r *RuntimeContextMock) RunningInstancesCount() uint64

func (*RuntimeContextMock) SetAsyncCallInfo

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

func (*RuntimeContextMock) SetCustomCallFunction added in v0.3.21

func (r *RuntimeContextMock) SetCustomCallFunction(callFunction string)

func (*RuntimeContextMock) SetInstanceContext

func (r *RuntimeContextMock) SetInstanceContext(instCtx *wasmer.InstanceContext)

func (*RuntimeContextMock) SetInstanceContextID added in v0.3.11

func (r *RuntimeContextMock) SetInstanceContextID(id int)

func (*RuntimeContextMock) SetMaxInstanceCount added in v0.3.13

func (r *RuntimeContextMock) SetMaxInstanceCount(uint64)

func (*RuntimeContextMock) SetPointsUsed

func (r *RuntimeContextMock) SetPointsUsed(gasPoints uint64)

func (*RuntimeContextMock) SetReadOnly

func (r *RuntimeContextMock) SetReadOnly(readOnly bool)

func (*RuntimeContextMock) SetRuntimeBreakpointValue

func (r *RuntimeContextMock) SetRuntimeBreakpointValue(value arwen.BreakpointValue)

func (*RuntimeContextMock) SetSCAddress

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

func (*RuntimeContextMock) SetVMInput

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

func (*RuntimeContextMock) SignalExit

func (r *RuntimeContextMock) SignalExit(_ int)

func (*RuntimeContextMock) SignalUserError

func (r *RuntimeContextMock) SignalUserError(_ string)

func (*RuntimeContextMock) StartWasmerInstance added in v0.3.13

func (r *RuntimeContextMock) StartWasmerInstance(contract []byte, gasLimit uint64) error

func (*RuntimeContextMock) VerifyContractCode

func (r *RuntimeContextMock) VerifyContractCode() error

type VmHostMock

type VmHostMock struct {
	BlockChainHook vmcommon.BlockchainHook
	CryptoHook     vmcommon.CryptoHook

	EthInput []byte

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

	SCAPIMethods *wasmer.Imports
}

func (*VmHostMock) BigInt

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

func (*VmHostMock) Blockchain

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

func (*VmHostMock) ClearStateStack

func (host *VmHostMock) ClearStateStack()

func (*VmHostMock) CreateNewContract

func (host *VmHostMock) CreateNewContract(input *vmcommon.ContractCreateInput) ([]byte, error)

func (*VmHostMock) Crypto

func (host *VmHostMock) Crypto() vmcommon.CryptoHook

func (*VmHostMock) EthereumCallData

func (host *VmHostMock) EthereumCallData() []byte

func (*VmHostMock) ExecuteOnDestContext

func (host *VmHostMock) ExecuteOnDestContext(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *arwen.AsyncContextInfo, error)

func (*VmHostMock) ExecuteOnSameContext

func (host *VmHostMock) ExecuteOnSameContext(input *vmcommon.ContractCallInput) (*arwen.AsyncContextInfo, error)

func (*VmHostMock) GetAPIMethods added in v0.3.12

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

func (*VmHostMock) GetProtocolBuiltinFunctions added in v0.3.14

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

func (*VmHostMock) InitState

func (host *VmHostMock) InitState()

func (*VmHostMock) Metering

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

func (*VmHostMock) Output

func (host *VmHostMock) Output() arwen.OutputContext

func (*VmHostMock) PopState

func (host *VmHostMock) PopState()

func (*VmHostMock) PushState

func (host *VmHostMock) PushState()

func (*VmHostMock) Runtime

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

func (*VmHostMock) Storage

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

type VmHostStub

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

	CryptoCalled                      func() vmcommon.CryptoHook
	BlockchainCalled                  func() arwen.BlockchainContext
	RuntimeCalled                     func() arwen.RuntimeContext
	BigIntCalled                      func() arwen.BigIntContext
	OutputCalled                      func() arwen.OutputContext
	MeteringCalled                    func() arwen.MeteringContext
	StorageCalled                     func() arwen.StorageContext
	CreateNewContractCalled           func(input *vmcommon.ContractCreateInput) ([]byte, error)
	ExecuteOnSameContextCalled        func(input *vmcommon.ContractCallInput) (*arwen.AsyncContextInfo, error)
	ExecuteOnDestContextCalled        func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, *arwen.AsyncContextInfo, error)
	EthereumCallDataCalled            func() []byte
	GetAPIMethodsCalled               func() *wasmer.Imports
	GetProtocolBuiltinFunctionsCalled func() vmcommon.FunctionNames
}

func (*VmHostStub) BigInt

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

func (*VmHostStub) Blockchain

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

func (*VmHostStub) ClearStateStack

func (vhs *VmHostStub) ClearStateStack()

func (*VmHostStub) CreateNewContract

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

func (*VmHostStub) Crypto

func (vhs *VmHostStub) Crypto() vmcommon.CryptoHook

func (*VmHostStub) EthereumCallData

func (vhs *VmHostStub) EthereumCallData() []byte

func (*VmHostStub) ExecuteOnDestContext

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

func (*VmHostStub) ExecuteOnSameContext

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

func (*VmHostStub) GetAPIMethods added in v0.3.12

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

func (*VmHostStub) GetProtocolBuiltinFunctions added in v0.3.14

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

func (*VmHostStub) InitState

func (vhs *VmHostStub) InitState()

func (*VmHostStub) Metering

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

func (*VmHostStub) Output

func (vhs *VmHostStub) Output() arwen.OutputContext

func (*VmHostStub) PopState

func (vhs *VmHostStub) PopState()

func (*VmHostStub) PushState

func (vhs *VmHostStub) PushState()

func (*VmHostStub) Runtime

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

func (*VmHostStub) Storage

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

Jump to

Keyboard shortcuts

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