mock

package
v1.0.120 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsStub added in v1.0.115

type AccountsStub struct {
	AddJournalEntryCalled    func(je state.JournalEntry)
	GetExistingAccountCalled func(address []byte) (state.AccountHandler, error)
	LoadAccountCalled        func(address []byte) (state.AccountHandler, error)
	SaveAccountCalled        func(account state.AccountHandler) error
	RemoveAccountCalled      func(address []byte) error
	CommitCalled             func() ([]byte, error)
	JournalLenCalled         func() int
	RevertToSnapshotCalled   func(snapshot int) error
	RootHashCalled           func() ([]byte, error)
	RecreateTrieCalled       func(rootHash []byte) error
	PruneTrieCalled          func(rootHash []byte, identifier data.TriePruningIdentifier)
	CancelPruneCalled        func(rootHash []byte, identifier data.TriePruningIdentifier)
	SnapshotStateCalled      func(rootHash []byte)
	SetStateCheckpointCalled func(rootHash []byte)
	IsPruningEnabledCalled   func() bool
	GetAllLeavesCalled       func(rootHash []byte) (map[string][]byte, error)
	RecreateAllTriesCalled   func(rootHash []byte) (map[string]data.Trie, error)
}

AccountsStub -

func (*AccountsStub) AddJournalEntry added in v1.0.115

func (as *AccountsStub) AddJournalEntry(je state.JournalEntry)

AddJournalEntry -

func (*AccountsStub) CancelPrune added in v1.0.115

func (as *AccountsStub) CancelPrune(rootHash []byte, identifier data.TriePruningIdentifier)

CancelPrune -

func (*AccountsStub) Commit added in v1.0.115

func (as *AccountsStub) Commit() ([]byte, error)

Commit -

func (*AccountsStub) GetAllLeaves added in v1.0.115

func (as *AccountsStub) GetAllLeaves(rootHash []byte) (map[string][]byte, error)

GetAllLeaves -

func (*AccountsStub) GetExistingAccount added in v1.0.115

func (as *AccountsStub) GetExistingAccount(address []byte) (state.AccountHandler, error)

GetExistingAccount -

func (*AccountsStub) IsInterfaceNil added in v1.0.115

func (as *AccountsStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AccountsStub) IsPruningEnabled added in v1.0.115

func (as *AccountsStub) IsPruningEnabled() bool

IsPruningEnabled -

func (*AccountsStub) JournalLen added in v1.0.115

func (as *AccountsStub) JournalLen() int

JournalLen -

func (*AccountsStub) LoadAccount added in v1.0.115

func (as *AccountsStub) LoadAccount(address []byte) (state.AccountHandler, error)

LoadAccount -

func (*AccountsStub) PruneTrie added in v1.0.115

func (as *AccountsStub) PruneTrie(rootHash []byte, identifier data.TriePruningIdentifier)

PruneTrie -

func (*AccountsStub) RecreateAllTries added in v1.0.115

func (as *AccountsStub) RecreateAllTries(rootHash []byte) (map[string]data.Trie, error)

RecreateAllTries -

func (*AccountsStub) RecreateTrie added in v1.0.115

func (as *AccountsStub) RecreateTrie(rootHash []byte) error

RecreateTrie -

func (*AccountsStub) RemoveAccount added in v1.0.115

func (as *AccountsStub) RemoveAccount(address []byte) error

RemoveAccount -

func (*AccountsStub) RevertToSnapshot added in v1.0.115

func (as *AccountsStub) RevertToSnapshot(snapshot int) error

RevertToSnapshot -

func (*AccountsStub) RootHash added in v1.0.115

func (as *AccountsStub) RootHash() ([]byte, error)

RootHash -

func (*AccountsStub) SaveAccount added in v1.0.115

func (as *AccountsStub) SaveAccount(account state.AccountHandler) error

SaveAccount -

func (*AccountsStub) SetStateCheckpoint added in v1.0.115

func (as *AccountsStub) SetStateCheckpoint(rootHash []byte)

SetStateCheckpoint -

func (*AccountsStub) SnapshotState added in v1.0.115

func (as *AccountsStub) SnapshotState(rootHash []byte)

SnapshotState -

type ArgumentParserMock

type ArgumentParserMock struct {
	ParseDataCalled                   func(data string) error
	GetConstructorArgumentsCalled     func() ([][]byte, error)
	GetFunctionArgumentsCalled        func() ([][]byte, error)
	GetCodeCalled                     func() ([]byte, error)
	GetFunctionCalled                 func() (string, error)
	GetSeparatorCalled                func() string
	CreateDataFromStorageUpdateCalled func(storageUpdates []*vmcommon.StorageUpdate) string
	GetStorageUpdatesCalled           func(data string) ([]*vmcommon.StorageUpdate, error)
}

ArgumentParserMock -

func (*ArgumentParserMock) CreateDataFromStorageUpdate

func (ap *ArgumentParserMock) CreateDataFromStorageUpdate(storageUpdates []*vmcommon.StorageUpdate) string

CreateDataFromStorageUpdate -

func (*ArgumentParserMock) GetCode

func (ap *ArgumentParserMock) GetCode() ([]byte, error)

GetCode -

func (*ArgumentParserMock) GetConstructorArguments added in v1.0.103

func (ap *ArgumentParserMock) GetConstructorArguments() ([][]byte, error)

GetConstructorArguments -

func (*ArgumentParserMock) GetFunction

func (ap *ArgumentParserMock) GetFunction() (string, error)

GetFunction -

func (*ArgumentParserMock) GetFunctionArguments added in v1.0.103

func (ap *ArgumentParserMock) GetFunctionArguments() ([][]byte, error)

GetFunctionArguments -

func (*ArgumentParserMock) GetSeparator

func (ap *ArgumentParserMock) GetSeparator() string

GetSeparator -

func (*ArgumentParserMock) GetStorageUpdates

func (ap *ArgumentParserMock) GetStorageUpdates(data string) ([]*vmcommon.StorageUpdate, error)

GetStorageUpdates -

func (*ArgumentParserMock) IsInterfaceNil

func (ap *ArgumentParserMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ArgumentParserMock) ParseData

func (ap *ArgumentParserMock) ParseData(data string) error

ParseData -

type BlockChainHookStub

type BlockChainHookStub struct {
	AccountExtistsCalled          func(address []byte) (bool, error)
	NewAddressCalled              func(creatorAddress []byte, creatorNonce uint64, vmType []byte) ([]byte, error)
	GetBalanceCalled              func(address []byte) (*big.Int, error)
	GetNonceCalled                func(address []byte) (uint64, error)
	GetStorageDataCalled          func(accountsAddress []byte, index []byte) ([]byte, error)
	IsCodeEmptyCalled             func(address []byte) (bool, error)
	GetCodeCalled                 func(address []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)
}

BlockChainHookStub -

func (*BlockChainHookStub) AccountExists

func (b *BlockChainHookStub) AccountExists(address []byte) (bool, error)

AccountExists -

func (*BlockChainHookStub) CurrentEpoch

func (b *BlockChainHookStub) CurrentEpoch() uint32

CurrentEpoch -

func (*BlockChainHookStub) CurrentNonce

func (b *BlockChainHookStub) CurrentNonce() uint64

CurrentNonce -

func (*BlockChainHookStub) CurrentRandomSeed

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

CurrentRandomSeed -

func (*BlockChainHookStub) CurrentRound

func (b *BlockChainHookStub) CurrentRound() uint64

CurrentRound -

func (*BlockChainHookStub) CurrentTimeStamp

func (b *BlockChainHookStub) CurrentTimeStamp() uint64

CurrentTimeStamp -

func (*BlockChainHookStub) GetAllState added in v1.0.114

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

GetAllState -

func (*BlockChainHookStub) GetBalance

func (b *BlockChainHookStub) GetBalance(address []byte) (*big.Int, error)

GetBalance -

func (*BlockChainHookStub) GetBlockhash

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

GetBlockhash -

func (*BlockChainHookStub) GetBuiltinFunctionNames added in v1.0.104

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

GetBuiltinFunctionNames -

func (*BlockChainHookStub) GetCode

func (b *BlockChainHookStub) GetCode(address []byte) ([]byte, error)

GetCode -

func (*BlockChainHookStub) GetNonce

func (b *BlockChainHookStub) GetNonce(address []byte) (uint64, error)

GetNonce -

func (*BlockChainHookStub) GetStateRootHash

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

GetStateRootHash -

func (*BlockChainHookStub) GetStorageData

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

GetStorageData -

func (*BlockChainHookStub) IsCodeEmpty

func (b *BlockChainHookStub) IsCodeEmpty(address []byte) (bool, error)

IsCodeEmpty -

func (*BlockChainHookStub) LastEpoch

func (b *BlockChainHookStub) LastEpoch() uint32

LastEpoch -

func (*BlockChainHookStub) LastNonce

func (b *BlockChainHookStub) LastNonce() uint64

LastNonce -

func (*BlockChainHookStub) LastRandomSeed

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

LastRandomSeed -

func (*BlockChainHookStub) LastRound

func (b *BlockChainHookStub) LastRound() uint64

LastRound -

func (*BlockChainHookStub) LastTimeStamp

func (b *BlockChainHookStub) LastTimeStamp() uint64

LastTimeStamp -

func (*BlockChainHookStub) NewAddress

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

NewAddress -

func (*BlockChainHookStub) ProcessBuiltInFunction added in v1.0.104

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

ProcessBuiltInFunction -

type HasherMock added in v1.0.114

type HasherMock struct {
}

HasherMock that will be used for testing

func (HasherMock) Compute added in v1.0.114

func (sha HasherMock) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (HasherMock) EmptyHash added in v1.0.114

func (sha HasherMock) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (HasherMock) IsInterfaceNil added in v1.0.114

func (sha HasherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherMock) Size added in v1.0.114

func (HasherMock) Size() int

Size returns the required size in bytes

type KeyGenMock

type KeyGenMock struct {
	PublicKeyFromByteArrayCalled func(b []byte) (crypto.PublicKey, error)
}

KeyGenMock -

func (*KeyGenMock) CheckPublicKeyValid added in v1.0.120

func (keyGen *KeyGenMock) CheckPublicKeyValid(_ []byte) error

CheckPublicKeyValid -

func (*KeyGenMock) GeneratePair

func (keyGen *KeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)

GeneratePair -

func (*KeyGenMock) IsInterfaceNil

func (keyGen *KeyGenMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*KeyGenMock) PrivateKeyFromByteArray

func (keyGen *KeyGenMock) PrivateKeyFromByteArray(_ []byte) (crypto.PrivateKey, error)

PrivateKeyFromByteArray -

func (*KeyGenMock) PublicKeyFromByteArray

func (keyGen *KeyGenMock) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)

PublicKeyFromByteArray -

func (*KeyGenMock) Suite

func (keyGen *KeyGenMock) Suite() crypto.Suite

Suite -

type MarshalizerMock added in v1.0.114

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil added in v1.0.114

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal added in v1.0.114

func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal added in v1.0.114

func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal applies the serialized values over an instantiated object

type MessageSignVerifierMock

type MessageSignVerifierMock struct {
	VerifyCalled func(message []byte, signedMessage []byte, pubKey []byte) error
}

MessageSignVerifierMock -

func (*MessageSignVerifierMock) IsInterfaceNil

func (m *MessageSignVerifierMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*MessageSignVerifierMock) Verify

func (m *MessageSignVerifierMock) Verify(message []byte, signedMessage []byte, pubKey []byte) error

Verify -

type NodesConfigProviderStub added in v1.0.110

type NodesConfigProviderStub struct {
	MinNumberOfNodesCalled func() uint32
}

NodesConfigProviderStub -

func (*NodesConfigProviderStub) IsInterfaceNil added in v1.0.110

func (n *NodesConfigProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*NodesConfigProviderStub) MinNumberOfNodes added in v1.0.110

func (n *NodesConfigProviderStub) MinNumberOfNodes() uint32

MinNumberOfNodes -

type PublicKeyMock

type PublicKeyMock struct {
}

PublicKeyMock mocks a public key implementation

func (*PublicKeyMock) IsInterfaceNil

func (pubKey *PublicKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PublicKeyMock) Point

func (pubKey *PublicKeyMock) Point() crypto.Point

Point -

func (*PublicKeyMock) Suite

func (pubKey *PublicKeyMock) Suite() crypto.Suite

Suite -

func (*PublicKeyMock) ToByteArray

func (pubKey *PublicKeyMock) ToByteArray() ([]byte, error)

ToByteArray mocks converting a public key to a byte array

type SignerMock

type SignerMock struct {
	SignCalled   func(private crypto.PrivateKey, msg []byte) ([]byte, error)
	VerifyCalled func(public crypto.PublicKey, msg []byte, sig []byte) error
}

SignerMock -

func (*SignerMock) IsInterfaceNil

func (s *SignerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SignerMock) Sign

func (s *SignerMock) Sign(private crypto.PrivateKey, msg []byte) ([]byte, error)

Sign -

func (*SignerMock) Verify

func (s *SignerMock) Verify(public crypto.PublicKey, msg []byte, sig []byte) error

Verify -

type SystemEIStub

type SystemEIStub struct {
	TransferCalled                  func(destination []byte, sender []byte, value *big.Int, input []byte) error
	GetBalanceCalled                func(addr []byte) *big.Int
	SetStorageCalled                func(key []byte, value []byte)
	SetReturnMessageCalled          func(msg string)
	GetStorageCalled                func(key []byte) []byte
	SelfDestructCalled              func(beneficiary []byte)
	CreateVMOutputCalled            func() *vmcommon.VMOutput
	CleanCacheCalled                func()
	FinishCalled                    func(value []byte)
	AddCodeCalled                   func(addr []byte, code []byte)
	AddTxValueToSmartContractCalled func(value *big.Int, scAddress []byte)
	BlockChainHookCalled            func() vmcommon.BlockchainHook
	CryptoHookCalled                func() vmcommon.CryptoHook
	UseGasCalled                    func(gas uint64) error
	IsValidatorCalled               func(blsKey []byte) bool
}

SystemEIStub -

func (*SystemEIStub) AddCode

func (s *SystemEIStub) AddCode(addr []byte, code []byte)

AddCode -

func (*SystemEIStub) AddReturnMessage added in v1.0.120

func (s *SystemEIStub) AddReturnMessage(msg string)

AddReturnMessage -

func (*SystemEIStub) AddTxValueToSmartContract

func (s *SystemEIStub) AddTxValueToSmartContract(value *big.Int, scAddress []byte)

AddTxValueToSmartContract -

func (*SystemEIStub) BlockChainHook

func (s *SystemEIStub) BlockChainHook() vmcommon.BlockchainHook

BlockChainHook -

func (*SystemEIStub) CleanCache

func (s *SystemEIStub) CleanCache()

CleanCache -

func (*SystemEIStub) CreateVMOutput

func (s *SystemEIStub) CreateVMOutput() *vmcommon.VMOutput

CreateVMOutput -

func (*SystemEIStub) CryptoHook

func (s *SystemEIStub) CryptoHook() vmcommon.CryptoHook

CryptoHook -

func (*SystemEIStub) ExecuteOnDestContext

func (s *SystemEIStub) ExecuteOnDestContext(_ []byte, _ []byte, _ *big.Int, _ []byte) (*vmcommon.VMOutput, error)

ExecuteOnDestContext -

func (*SystemEIStub) Finish

func (s *SystemEIStub) Finish(value []byte)

Finish -

func (*SystemEIStub) GetBalance

func (s *SystemEIStub) GetBalance(addr []byte) *big.Int

GetBalance -

func (*SystemEIStub) GetStorage

func (s *SystemEIStub) GetStorage(key []byte) []byte

GetStorage -

func (*SystemEIStub) IsInterfaceNil

func (s *SystemEIStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*SystemEIStub) IsValidator added in v1.0.115

func (s *SystemEIStub) IsValidator(blsKey []byte) bool

IsValidator -

func (*SystemEIStub) SelfDestruct

func (s *SystemEIStub) SelfDestruct(beneficiary []byte)

SelfDestruct -

func (*SystemEIStub) SetGasProvided

func (s *SystemEIStub) SetGasProvided(_ uint64)

SetGasProvided -

func (*SystemEIStub) SetSCAddress

func (s *SystemEIStub) SetSCAddress(_ []byte)

SetSCAddress -

func (*SystemEIStub) SetStorage

func (s *SystemEIStub) SetStorage(key []byte, value []byte)

SetStorage -

func (*SystemEIStub) SetSystemSCContainer

func (s *SystemEIStub) SetSystemSCContainer(_ vm.SystemSCContainer) error

SetSystemSCContainer -

func (*SystemEIStub) Transfer

func (s *SystemEIStub) Transfer(destination []byte, sender []byte, value *big.Int, input []byte, _ uint64) error

Transfer -

func (*SystemEIStub) UseGas

func (s *SystemEIStub) UseGas(gas uint64) error

UseGas -

type SystemSCContainerStub

type SystemSCContainerStub struct {
	GetCalled     func(key []byte) (vm.SystemSmartContract, error)
	AddCalled     func(key []byte, val vm.SystemSmartContract) error
	ReplaceCalled func(key []byte, val vm.SystemSmartContract) error
	RemoveCalled  func(key []byte)
	LenCalled     func() int
	KeysCalled    func() [][]byte
}

SystemSCContainerStub -

func (*SystemSCContainerStub) Add

Add -

func (*SystemSCContainerStub) Get

Get -

func (*SystemSCContainerStub) IsInterfaceNil

func (s *SystemSCContainerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*SystemSCContainerStub) Keys

func (s *SystemSCContainerStub) Keys() [][]byte

Keys -

func (*SystemSCContainerStub) Len

func (s *SystemSCContainerStub) Len() int

Len -

func (*SystemSCContainerStub) Remove

func (s *SystemSCContainerStub) Remove(key []byte)

Remove -

func (*SystemSCContainerStub) Replace

func (s *SystemSCContainerStub) Replace(key []byte, val vm.SystemSmartContract) error

Replace -

type SystemSCStub

type SystemSCStub struct {
	ExecuteCalled func(args *vmcommon.ContractCallInput) vmcommon.ReturnCode
	ValueOfCalled func(key interface{}) interface{}
}

SystemSCStub -

func (*SystemSCStub) Execute

Execute -

func (*SystemSCStub) IsInterfaceNil

func (s *SystemSCStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*SystemSCStub) ValueOf

func (s *SystemSCStub) ValueOf(key interface{}) interface{}

ValueOf -

type ValidatorSettingsStub

type ValidatorSettingsStub struct {
	MinStepValueCalled             func() *big.Int
	TotalSupplyCalled              func() *big.Int
	NumNodesCalled                 func() uint32
	AuctionEnableNonceCalled       func() uint64
	StakeEnableNonceCalled         func() uint64
	UnBondPeriodCalled             func() uint64
	StakeValueCalled               func() *big.Int
	UnJailValueCalled              func() *big.Int
	NumRoundsWithoutBleedCalled    func() uint64
	BleedPercentagePerRoundCalled  func() float64
	MaximumPercentageToBleedCalled func() float64
}

ValidatorSettingsStub -

func (*ValidatorSettingsStub) AuctionEnableNonce

func (v *ValidatorSettingsStub) AuctionEnableNonce() uint64

AuctionEnableNonce -

func (*ValidatorSettingsStub) BleedPercentagePerRound

func (v *ValidatorSettingsStub) BleedPercentagePerRound() float64

BleedPercentagePerRound -

func (*ValidatorSettingsStub) GenesisNodePrice

func (v *ValidatorSettingsStub) GenesisNodePrice() *big.Int

GenesisNodePrice -

func (*ValidatorSettingsStub) IsInterfaceNil

func (v *ValidatorSettingsStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ValidatorSettingsStub) MaximumPercentageToBleed

func (v *ValidatorSettingsStub) MaximumPercentageToBleed() float64

MaximumPercentageToBleed -

func (*ValidatorSettingsStub) MinStepValue

func (v *ValidatorSettingsStub) MinStepValue() *big.Int

MinStepValue -

func (*ValidatorSettingsStub) NumNodes

func (v *ValidatorSettingsStub) NumNodes() uint32

NumNodes -

func (*ValidatorSettingsStub) NumRoundsWithoutBleed

func (v *ValidatorSettingsStub) NumRoundsWithoutBleed() uint64

NumRoundsWithoutBleed -

func (*ValidatorSettingsStub) StakeEnableNonce

func (v *ValidatorSettingsStub) StakeEnableNonce() uint64

StakeEnableNonce -

func (*ValidatorSettingsStub) TotalSupply

func (v *ValidatorSettingsStub) TotalSupply() *big.Int

TotalSupply -

func (*ValidatorSettingsStub) UnBondPeriod

func (v *ValidatorSettingsStub) UnBondPeriod() uint64

UnBondPeriod -

func (*ValidatorSettingsStub) UnJailValue

func (v *ValidatorSettingsStub) UnJailValue() *big.Int

UnJailValue -

Jump to

Keyboard shortcuts

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