mock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: GPL-3.0 Imports: 7 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

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

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

AddressBytes -

func (*AccountMock) GetBalance

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

GetBalance -

func (*AccountMock) GetCode

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

GetCode -

func (*AccountMock) GetCodeHash

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

GetCodeHash -

func (*AccountMock) GetCodeMetadata

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

GetCodeMetadata -

func (*AccountMock) GetDeveloperReward

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

GetDeveloperReward -

func (*AccountMock) GetNonce

func (a *AccountMock) GetNonce() uint64

GetNonce -

func (*AccountMock) GetOwnerAddress

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

GetOwnerAddress -

func (*AccountMock) GetRootHash

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

GetRootHash -

func (*AccountMock) GetUserName

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

GetOwnerAddress -

func (*AccountMock) IsInterfaceNil

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

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

func (*BlockchainHookMock) GetBlockhash

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

func (*BlockchainHookMock) GetBuiltinFunctionNames

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

func (*BlockchainHookMock) GetShardOfAddress

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

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

func (*BlockchainHookMock) IsPayable added in v0.0.2

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

func (*BlockchainHookMock) IsSmartContract

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

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

func (*BlockchainHookMock) UpdateAccounts

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

type BlockchainHookStub

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

func (*BlockchainHookStub) CurrentEpoch

func (b *BlockchainHookStub) CurrentEpoch() uint32

func (*BlockchainHookStub) CurrentNonce

func (b *BlockchainHookStub) CurrentNonce() uint64

func (*BlockchainHookStub) CurrentRandomSeed

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

func (*BlockchainHookStub) CurrentRound

func (b *BlockchainHookStub) CurrentRound() uint64

func (*BlockchainHookStub) CurrentTimeStamp

func (b *BlockchainHookStub) CurrentTimeStamp() uint64

func (*BlockchainHookStub) GetAllState

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

func (*BlockchainHookStub) GetBlockhash

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

func (*BlockchainHookStub) GetBuiltinFunctionNames

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

func (*BlockchainHookStub) GetShardOfAddress

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

func (*BlockchainHookStub) GetStateRootHash

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

func (*BlockchainHookStub) GetStorageData

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

func (*BlockchainHookStub) GetUserAccount

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

func (*BlockchainHookStub) IsPayable added in v0.0.2

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

func (*BlockchainHookStub) IsSmartContract

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

func (*BlockchainHookStub) LastEpoch

func (b *BlockchainHookStub) LastEpoch() uint32

func (*BlockchainHookStub) LastNonce

func (b *BlockchainHookStub) LastNonce() uint64

func (*BlockchainHookStub) LastRandomSeed

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

func (*BlockchainHookStub) LastRound

func (b *BlockchainHookStub) LastRound() uint64

func (*BlockchainHookStub) LastTimeStamp

func (b *BlockchainHookStub) LastTimeStamp() uint64

func (*BlockchainHookStub) NewAddress

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

func (*BlockchainHookStub) ProcessBuiltInFunction

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)

func (*CryptoHookMock) VerifyBLS added in v0.0.3

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

func (*CryptoHookMock) VerifyEd25519 added in v0.0.3

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

func (*CryptoHookMock) VerifySecp256k1 added in v0.0.3

func (c *CryptoHookMock) VerifySecp256k1(key []byte, msg []byte, sig []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) DeductAndLockGasIfAsyncStep added in v0.0.3

func (m *MeteringContextMock) DeductAndLockGasIfAsyncStep() error

func (*MeteringContextMock) DeductInitialGasForDirectDeployment

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

func (*MeteringContextMock) DeductInitialGasForExecution

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

func (*MeteringContextMock) DeductInitialGasForIndirectDeployment

func (m *MeteringContextMock) DeductInitialGasForIndirectDeployment(input core.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

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

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

func (*OutputContextMock) AddTxValueToAccount

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

func (*OutputContextMock) CensorVMOutput

func (o *OutputContextMock) CensorVMOutput()

func (*OutputContextMock) ClearReturnData

func (o *OutputContextMock) ClearReturnData()

func (*OutputContextMock) ClearStateStack

func (o *OutputContextMock) ClearStateStack()

func (*OutputContextMock) CopyTopOfStackToActiveState

func (o *OutputContextMock) CopyTopOfStackToActiveState()

func (*OutputContextMock) CreateVMOutputInCaseOfError

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

func (*OutputContextMock) DeleteOutputAccount added in v0.0.2

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

func (*OutputContextMock) DeployCode

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

func (*OutputContextMock) Finish

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

func (*OutputContextMock) GetOutputAccount

func (o *OutputContextMock) GetOutputAccount(_ []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

func (o *OutputContextMock) PopDiscard()

func (*OutputContextMock) PopMergeActiveState

func (o *OutputContextMock) PopMergeActiveState()

func (*OutputContextMock) PopSetActiveState

func (o *OutputContextMock) PopSetActiveState()

func (*OutputContextMock) PushState

func (o *OutputContextMock) PushState()

func (*OutputContextMock) ResetGas added in v0.0.3

func (o *OutputContextMock) ResetGas()

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(_ []byte, _ []byte, _ uint64, _ *big.Int, _ []byte, _ vmcommon.CallType) error

func (*OutputContextMock) TransferValueOnly added in v0.0.3

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

func (*OutputContextMock) WriteLog

func (o *OutputContextMock) WriteLog(_ []byte, _ [][]byte, _ []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)
	DeleteOutputAccountCalled         func(address []byte)
	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 core.CodeDeployInput)
	CreateVMOutputInCaseOfErrorCalled func(err error) *vmcommon.VMOutput
	AddToActiveStateCalled            func(vmOutput *vmcommon.VMOutput)
	ResetConsumedGasCalled            func()
	TransferValueOnlyCalled           func(destination []byte, sender []byte, value *big.Int) error
}

func (*OutputContextStub) AddToActiveState

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

func (*OutputContextStub) AddTxValueToAccount

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

func (*OutputContextStub) CensorVMOutput

func (o *OutputContextStub) CensorVMOutput()

func (*OutputContextStub) ClearReturnData

func (o *OutputContextStub) ClearReturnData()

func (*OutputContextStub) ClearStateStack

func (o *OutputContextStub) ClearStateStack()

func (*OutputContextStub) CopyTopOfStackToActiveState

func (o *OutputContextStub) CopyTopOfStackToActiveState()

func (*OutputContextStub) CreateVMOutputInCaseOfError

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

func (*OutputContextStub) DeleteOutputAccount added in v0.0.2

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

func (*OutputContextStub) DeployCode

func (o *OutputContextStub) DeployCode(input core.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

func (o *OutputContextStub) PopDiscard()

func (*OutputContextStub) PopMergeActiveState

func (o *OutputContextStub) PopMergeActiveState()

func (*OutputContextStub) PopSetActiveState

func (o *OutputContextStub) PopSetActiveState()

func (*OutputContextStub) PushState

func (o *OutputContextStub) PushState()

func (*OutputContextStub) ResetGas added in v0.0.3

func (o *OutputContextStub) ResetGas()

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

func (*OutputContextStub) TransferValueOnly added in v0.0.3

func (o *OutputContextStub) TransferValueOnly(destination []byte, sender []byte, value *big.Int) 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
	VerifyCode             bool
	CurrentBreakpointValue core.BreakpointValue
	PointsUsed             uint64
	InstanceCtxID          int
	MemLoadResult          []byte
	FailCryptoAPI          bool
	FailDharitriAPI        bool
	FailBigIntAPI          bool
	AsyncCallInfo          *core.AsyncCallInfo
	RunningInstances       uint64
	CurrentTxHash          []byte
	OriginalTxHash         []byte
}

func (*RuntimeContextMock) AddAsyncContextCall

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

func (*RuntimeContextMock) Arguments

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

func (*RuntimeContextMock) BigIntAPIErrorShouldFailExecution

func (r *RuntimeContextMock) BigIntAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) CleanWasmerInstance added in v0.0.2

func (r *RuntimeContextMock) CleanWasmerInstance()

func (*RuntimeContextMock) ClearInstanceStack

func (r *RuntimeContextMock) ClearInstanceStack()

func (*RuntimeContextMock) ClearStateStack

func (r *RuntimeContextMock) ClearStateStack()

func (*RuntimeContextMock) CryptoAPIErrorShouldFailExecution

func (r *RuntimeContextMock) CryptoAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) DharitriAPIErrorShouldFailExecution

func (r *RuntimeContextMock) DharitriAPIErrorShouldFailExecution() bool

func (*RuntimeContextMock) ExtractCodeUpgradeFromArgs

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() *core.AsyncCallInfo

func (*RuntimeContextMock) GetAsyncContext

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

func (*RuntimeContextMock) GetAsyncContextInfo

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

func (*RuntimeContextMock) GetCurrentTxHash

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

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

func (*RuntimeContextMock) GetOriginalTxHash

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

func (*RuntimeContextMock) GetPointsUsed

func (r *RuntimeContextMock) GetPointsUsed() uint64

func (*RuntimeContextMock) GetRuntimeBreakpointValue

func (r *RuntimeContextMock) GetRuntimeBreakpointValue() core.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) IsWarmInstance added in v0.0.3

func (r *RuntimeContextMock) IsWarmInstance() bool

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

func (r *RuntimeContextMock) MustVerifyNextContractCode()

func (*RuntimeContextMock) PopDiscard

func (r *RuntimeContextMock) PopDiscard()

func (*RuntimeContextMock) PopInstance

func (r *RuntimeContextMock) PopInstance()

func (*RuntimeContextMock) PopSetActiveState

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) ResetWarmInstance added in v0.0.3

func (r *RuntimeContextMock) ResetWarmInstance()

func (*RuntimeContextMock) RunningInstancesCount

func (r *RuntimeContextMock) RunningInstancesCount() uint64

func (*RuntimeContextMock) SetAsyncCallInfo

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

func (*RuntimeContextMock) SetCustomCallFunction

func (r *RuntimeContextMock) SetCustomCallFunction(callFunction string)

func (*RuntimeContextMock) SetMaxInstanceCount

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 core.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

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     crypto.VMCrypto

	EthInput []byte

	BlockchainContext core.BlockchainContext
	RuntimeContext    core.RuntimeContext
	OutputContext     core.OutputContext
	MeteringContext   core.MeteringContext
	StorageContext    core.StorageContext
	BigIntContext     core.BigIntContext

	SCAPIMethods  *wasmer.Imports
	IsBuiltinFunc bool
}

func (*VmHostMock) BigInt

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

func (*VmHostMock) Blockchain

func (host *VmHostMock) Blockchain() core.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() crypto.VMCrypto

func (*VmHostMock) EthereumCallData

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

func (*VmHostMock) ExecuteOnDestContext

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

func (*VmHostMock) ExecuteOnSameContext

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

func (*VmHostMock) GetAPIMethods

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

func (*VmHostMock) GetProtocolBuiltinFunctions

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

func (*VmHostMock) InitState

func (host *VmHostMock) InitState()

func (*VmHostMock) IsBuiltinFunctionName added in v0.0.2

func (host *VmHostMock) IsBuiltinFunctionName(functionName string) bool

func (*VmHostMock) IsCoreV2Enabled added in v0.0.3

func (host *VmHostMock) IsCoreV2Enabled() bool

func (*VmHostMock) Metering

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

func (*VmHostMock) Output

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

func (*VmHostMock) PopState

func (host *VmHostMock) PopState()

func (*VmHostMock) PushState

func (host *VmHostMock) PushState()

func (*VmHostMock) Runtime

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

func (*VmHostMock) Storage

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

type VmHostStub

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

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

func (*VmHostStub) BigInt

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

func (*VmHostStub) Blockchain

func (vhs *VmHostStub) Blockchain() core.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() crypto.VMCrypto

func (*VmHostStub) EthereumCallData

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

func (*VmHostStub) ExecuteOnDestContext

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

func (*VmHostStub) ExecuteOnSameContext

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

func (*VmHostStub) GetAPIMethods

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

func (*VmHostStub) GetProtocolBuiltinFunctions

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

func (*VmHostStub) InitState

func (vhs *VmHostStub) InitState()

func (*VmHostStub) IsBuiltinFunctionName added in v0.0.2

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

func (*VmHostStub) IsCoreV2Enabled added in v0.0.3

func (vhs *VmHostStub) IsCoreV2Enabled() bool

func (*VmHostStub) Metering

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

func (*VmHostStub) Output

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

func (*VmHostStub) PopState

func (vhs *VmHostStub) PopState()

func (*VmHostStub) PushState

func (vhs *VmHostStub) PushState()

func (*VmHostStub) Runtime

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

func (*VmHostStub) Storage

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

Jump to

Keyboard shortcuts

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