mock

package
v1.0.65 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2019 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultiShardsCoordinatorMock

func NewMultiShardsCoordinatorMock(nrShard uint32) *multipleShardsCoordinatorMock

func NewMultipleShardsCoordinatorMock added in v1.0.16

func NewMultipleShardsCoordinatorMock() *multipleShardsCoordinatorMock

func NewNonceHashConverterMock

func NewNonceHashConverterMock() *nonceHashConverterMock

func NewOneShardCoordinatorMock

func NewOneShardCoordinatorMock() *oneShardCoordinatorMock

Types

type AccountsStub

type AccountsStub struct {
	AddJournalEntryCalled       func(je state.JournalEntry)
	CommitCalled                func() ([]byte, error)
	GetAccountWithJournalCalled func(addressContainer state.AddressContainer) (state.AccountHandler, error)
	GetExistingAccountCalled    func(addressContainer state.AddressContainer) (state.AccountHandler, error)
	HasAccountStateCalled       func(addressContainer state.AddressContainer) (bool, error)
	JournalLenCalled            func() int
	PutCodeCalled               func(accountHandler state.AccountHandler, code []byte) error
	RemoveAccountCalled         func(addressContainer state.AddressContainer) error
	RemoveCodeCalled            func(codeHash []byte) error
	RevertToSnapshotCalled      func(snapshot int) error
	SaveAccountStateCalled      func(acountWrapper state.AccountHandler) error
	SaveDataTrieCalled          func(acountWrapper state.AccountHandler) error
	RootHashCalled              func() ([]byte, error)
	RecreateTrieCalled          func(rootHash []byte) error
}

func (*AccountsStub) AddJournalEntry added in v1.0.3

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

func (*AccountsStub) Commit

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

func (*AccountsStub) GetAccountWithJournal added in v1.0.3

func (aam *AccountsStub) GetAccountWithJournal(addressContainer state.AddressContainer) (state.AccountHandler, error)

func (*AccountsStub) GetExistingAccount

func (aam *AccountsStub) GetExistingAccount(addressContainer state.AddressContainer) (state.AccountHandler, error)

func (*AccountsStub) HasAccount added in v1.0.3

func (aam *AccountsStub) HasAccount(addressContainer state.AddressContainer) (bool, error)

func (*AccountsStub) IsInterfaceNil

func (aam *AccountsStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AccountsStub) JournalLen

func (aam *AccountsStub) JournalLen() int

func (*AccountsStub) PutCode added in v1.0.3

func (aam *AccountsStub) PutCode(accountHandler state.AccountHandler, code []byte) error

func (*AccountsStub) RecreateTrie

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

func (*AccountsStub) RemoveAccount

func (aam *AccountsStub) RemoveAccount(addressContainer state.AddressContainer) error

func (*AccountsStub) RemoveCode added in v1.0.3

func (aam *AccountsStub) RemoveCode(codeHash []byte) error

func (*AccountsStub) RevertToSnapshot

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

func (*AccountsStub) RootHash

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

func (*AccountsStub) SaveDataTrie added in v1.0.3

func (aam *AccountsStub) SaveDataTrie(journalizedAccountHandler state.AccountHandler) error

func (*AccountsStub) SaveJournalizedAccount added in v1.0.3

func (aam *AccountsStub) SaveJournalizedAccount(journalizedAccountHandler state.AccountHandler) error

type AddressConverterFake

type AddressConverterFake struct {
	// contains filtered or unexported fields
}

func NewAddressConverterFake

func NewAddressConverterFake(addressLen int, prefix string) *AddressConverterFake

func (*AddressConverterFake) AddressLen

func (acf *AddressConverterFake) AddressLen() int

func (*AddressConverterFake) ConvertToHex

func (acf *AddressConverterFake) ConvertToHex(addressContainer state.AddressContainer) (string, error)

func (*AddressConverterFake) CreateAddressFromHex

func (acf *AddressConverterFake) CreateAddressFromHex(hexAddress string) (state.AddressContainer, error)

func (*AddressConverterFake) CreateAddressFromPublicKeyBytes

func (acf *AddressConverterFake) CreateAddressFromPublicKeyBytes(pubKey []byte) (state.AddressContainer, error)

func (*AddressConverterFake) IsInterfaceNil

func (acf *AddressConverterFake) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AddressConverterFake) PrepareAddressBytes

func (acf *AddressConverterFake) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

type AddressConverterStub

type AddressConverterStub struct {
	CreateAddressFromPublicKeyBytesHandler func(pubKey []byte) (state.AddressContainer, error)
	ConvertToHexHandler                    func(addressContainer state.AddressContainer) (string, error)
	CreateAddressFromHexHandler            func(hexAddress string) (state.AddressContainer, error)
	PrepareAddressBytesHandler             func(addressBytes []byte) ([]byte, error)
	AddressLenHandler                      func() int
}

func (AddressConverterStub) AddressLen

func (ac AddressConverterStub) AddressLen() int

func (AddressConverterStub) ConvertToHex

func (ac AddressConverterStub) ConvertToHex(addressContainer state.AddressContainer) (string, error)

func (AddressConverterStub) CreateAddressFromHex

func (ac AddressConverterStub) CreateAddressFromHex(hexAddress string) (state.AddressContainer, error)

func (AddressConverterStub) CreateAddressFromPublicKeyBytes

func (ac AddressConverterStub) CreateAddressFromPublicKeyBytes(pubKey []byte) (state.AddressContainer, error)

func (*AddressConverterStub) IsInterfaceNil

func (ac *AddressConverterStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (AddressConverterStub) PrepareAddressBytes

func (ac AddressConverterStub) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

type AppStatusHandlerStub

type AppStatusHandlerStub struct {
	AddUint64Handler      func(key string, value uint64)
	IncrementHandler      func(key string)
	DecrementHandler      func(key string)
	SetUInt64ValueHandler func(key string, value uint64)
	SetInt64ValueHandler  func(key string, value int64)
	SetStringValueHandler func(key string, value string)
	CloseHandler          func()
}

AppStatusHandlerStub is a stub implementation of AppStatusHandler

func (*AppStatusHandlerStub) AddUint64

func (ashs *AppStatusHandlerStub) AddUint64(key string, value uint64)

AddUint64 will call the handler of the stub for incrementing

func (*AppStatusHandlerStub) Close

func (ashs *AppStatusHandlerStub) Close()

Close will call the handler of the stub for closing

func (*AppStatusHandlerStub) Decrement

func (ashs *AppStatusHandlerStub) Decrement(key string)

Decrement will call the handler of the stub for decrementing

func (*AppStatusHandlerStub) Increment

func (ashs *AppStatusHandlerStub) Increment(key string)

Increment will call the handler of the stub for incrementing

func (*AppStatusHandlerStub) IsInterfaceNil

func (ashs *AppStatusHandlerStub) IsInterfaceNil() bool

func (*AppStatusHandlerStub) SetInt64Value

func (ashs *AppStatusHandlerStub) SetInt64Value(key string, value int64)

SetInt64Value will call the handler of the stub for setting an int64 value

func (*AppStatusHandlerStub) SetStringValue

func (ashs *AppStatusHandlerStub) SetStringValue(key string, value string)

SetStringValue will call the handler of the stub for setting an string value

func (*AppStatusHandlerStub) SetUInt64Value

func (ashs *AppStatusHandlerStub) SetUInt64Value(key string, value uint64)

SetUInt64Value will call the handler of the stub for setting an uint64 value

type BlockChainMock

type BlockChainMock struct {
	GetGenesisHeaderCalled          func() data.HeaderHandler
	SetGenesisHeaderCalled          func(handler data.HeaderHandler) error
	GetGenesisHeaderHashCalled      func() []byte
	SetGenesisHeaderHashCalled      func([]byte)
	GetCurrentBlockHeaderCalled     func() data.HeaderHandler
	SetCurrentBlockHeaderCalled     func(data.HeaderHandler) error
	GetCurrentBlockHeaderHashCalled func() []byte
	SetCurrentBlockHeaderHashCalled func([]byte)
	GetCurrentBlockBodyCalled       func() data.BodyHandler
	SetCurrentBlockBodyCalled       func(data.BodyHandler) error
	GetLocalHeightCalled            func() int64
	SetLocalHeightCalled            func(int64)
	GetNetworkHeightCalled          func() int64
	SetNetworkHeightCalled          func(int64)
	HasBadBlockCalled               func([]byte) bool
	PutBadBlockCalled               func([]byte)
}

BlockChainMock is a mock implementation of the blockchain interface

func (*BlockChainMock) GetCurrentBlockBody

func (bc *BlockChainMock) GetCurrentBlockBody() data.BodyHandler

GetCurrentBlockBody returns the tx block body pointer

func (*BlockChainMock) GetCurrentBlockHeader

func (bc *BlockChainMock) GetCurrentBlockHeader() data.HeaderHandler

GetCurrentBlockHeader returns current block header pointer

func (*BlockChainMock) GetCurrentBlockHeaderHash

func (bc *BlockChainMock) GetCurrentBlockHeaderHash() []byte

GetCurrentBlockHeaderHash returns the current block header hash

func (*BlockChainMock) GetGenesisHeader

func (bc *BlockChainMock) GetGenesisHeader() data.HeaderHandler

GetGenesisHeader returns the genesis block header pointer

func (*BlockChainMock) GetGenesisHeaderHash

func (bc *BlockChainMock) GetGenesisHeaderHash() []byte

GetGenesisHeaderHash returns the genesis block header hash

func (*BlockChainMock) GetLocalHeight added in v1.0.3

func (bc *BlockChainMock) GetLocalHeight() int64

GetLocalHeight returns the height of the local chain

func (*BlockChainMock) GetNetworkHeight added in v1.0.3

func (bc *BlockChainMock) GetNetworkHeight() int64

GetNetworkHeight sets the perceived height of the network chain

func (*BlockChainMock) HasBadBlock added in v1.0.3

func (bc *BlockChainMock) HasBadBlock(blockHash []byte) bool

HasBadBlock returns true if the provided hash is blacklisted as a bad block, or false otherwise

func (*BlockChainMock) IsInterfaceNil

func (bc *BlockChainMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BlockChainMock) PutBadBlock added in v1.0.3

func (bc *BlockChainMock) PutBadBlock(blockHash []byte)

PutBadBlock adds the given serialized block to the bad block cache, blacklisting it

func (*BlockChainMock) SetCurrentBlockBody

func (bc *BlockChainMock) SetCurrentBlockBody(body data.BodyHandler) error

SetCurrentBlockBody sets the tx block body pointer

func (*BlockChainMock) SetCurrentBlockHeader

func (bc *BlockChainMock) SetCurrentBlockHeader(header data.HeaderHandler) error

SetCurrentBlockHeader sets current block header pointer

func (*BlockChainMock) SetCurrentBlockHeaderHash

func (bc *BlockChainMock) SetCurrentBlockHeaderHash(hash []byte)

SetCurrentBlockHeaderHash returns the current block header hash

func (*BlockChainMock) SetGenesisHeader

func (bc *BlockChainMock) SetGenesisHeader(genesisBlock data.HeaderHandler) error

SetGenesisHeader sets the genesis block header pointer

func (*BlockChainMock) SetGenesisHeaderHash

func (bc *BlockChainMock) SetGenesisHeaderHash(hash []byte)

SetGenesisHeaderHash sets the genesis block header hash

func (*BlockChainMock) SetLocalHeight added in v1.0.3

func (bc *BlockChainMock) SetLocalHeight(height int64)

SetLocalHeight sets the height of the local chain

func (*BlockChainMock) SetNetworkHeight added in v1.0.3

func (bc *BlockChainMock) SetNetworkHeight(height int64)

SetNetworkHeight sets the perceived height of the network chain

type BlockProcessorStub

type BlockProcessorStub struct {
	ProcessBlockCalled               func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error
	CommitBlockCalled                func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error
	RevertAccountStateCalled         func()
	CreateGenesisBlockCalled         func(balances map[string]*big.Int) (data.HeaderHandler, error)
	CreateBlockBodyCalled            func(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)
	RestoreBlockIntoPoolsCalled      func(header data.HeaderHandler, body data.BodyHandler) error
	SetOnRequestTransactionCalled    func(f func(destShardID uint32, txHash []byte))
	ApplyBodyToHeaderCalled          func(header data.HeaderHandler, body data.BodyHandler) error
	MarshalizedDataToBroadcastCalled func(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)
	DecodeBlockBodyCalled            func(dta []byte) data.BodyHandler
	DecodeBlockHeaderCalled          func(dta []byte) data.HeaderHandler
	AddLastNotarizedHdrCalled        func(shardId uint32, processedHdr data.HeaderHandler)
	CreateNewHeaderCalled            func() data.HeaderHandler
	RevertStateToBlockCalled         func(header data.HeaderHandler) error
}

BlockProcessorStub mocks the implementation for a blockProcessor

func (BlockProcessorStub) AddLastNotarizedHdr

func (blProcMock BlockProcessorStub) AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)

func (BlockProcessorStub) ApplyBodyToHeader added in v1.0.39

func (blProcMock BlockProcessorStub) ApplyBodyToHeader(header data.HeaderHandler, body data.BodyHandler) error

func (*BlockProcessorStub) ApplyProcessedMiniBlocks

func (bpm *BlockProcessorStub) ApplyProcessedMiniBlocks(miniBlocks map[string]map[string]struct{})

func (*BlockProcessorStub) CommitBlock

func (blProcMock *BlockProcessorStub) CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error

CommitBlock mocks the commit of a block

func (*BlockProcessorStub) CreateBlockBody added in v1.0.3

func (blProcMock *BlockProcessorStub) CreateBlockBody(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)

CreateTxBlockBody mocks the creation of a transaction block body

func (*BlockProcessorStub) CreateGenesisBlock

func (blProcMock *BlockProcessorStub) CreateGenesisBlock(balances map[string]*big.Int) (data.HeaderHandler, error)

CreateGenesisBlock mocks the creation of a genesis block body

func (BlockProcessorStub) CreateNewHeader

func (blProcMock BlockProcessorStub) CreateNewHeader() data.HeaderHandler

CreateNewHeader creates a new header

func (BlockProcessorStub) DecodeBlockBody

func (blProcMock BlockProcessorStub) DecodeBlockBody(dta []byte) data.BodyHandler

func (BlockProcessorStub) DecodeBlockHeader

func (blProcMock BlockProcessorStub) DecodeBlockHeader(dta []byte) data.HeaderHandler

func (*BlockProcessorStub) IsInterfaceNil

func (blProcMock *BlockProcessorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (BlockProcessorStub) MarshalizedDataToBroadcast

func (blProcMock BlockProcessorStub) MarshalizedDataToBroadcast(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)

func (*BlockProcessorStub) ProcessBlock

func (blProcMock *BlockProcessorStub) ProcessBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error

ProcessBlock mocks pocessing a block

func (*BlockProcessorStub) RestoreBlockIntoPools

func (blProcMock *BlockProcessorStub) RestoreBlockIntoPools(header data.HeaderHandler, body data.BodyHandler) error

func (*BlockProcessorStub) RestoreLastNotarizedHrdsToGenesis

func (blProcMock *BlockProcessorStub) RestoreLastNotarizedHrdsToGenesis()

func (*BlockProcessorStub) RevertAccountState

func (blProcMock *BlockProcessorStub) RevertAccountState()

RevertAccountState mocks revert of the accounts state

func (*BlockProcessorStub) RevertStateToBlock

func (blProcMock *BlockProcessorStub) RevertStateToBlock(header data.HeaderHandler) error

RevertStateToBlock recreates thee state tries to the root hashes indicated by the provided header

func (BlockProcessorStub) SetConsensusData added in v1.0.20

func (blProcMock BlockProcessorStub) SetConsensusData(randomness []byte, round uint64, epoch uint32, shardId uint32)

func (*BlockProcessorStub) SetNumProcessedObj

func (blProcMock *BlockProcessorStub) SetNumProcessedObj(numObj uint64)

type BoostrapStorerMock

type BoostrapStorerMock struct {
	PutCalled             func(round int64, bootData bootstrapStorage.BootstrapData) error
	GetCalled             func(round int64) (bootstrapStorage.BootstrapData, error)
	GetHighestRoundCalled func() int64
}

func (*BoostrapStorerMock) Get

func (*BoostrapStorerMock) GetHighestRound

func (bsm *BoostrapStorerMock) GetHighestRound() int64

func (*BoostrapStorerMock) IsInterfaceNil

func (bsm *BoostrapStorerMock) IsInterfaceNil() bool

func (*BoostrapStorerMock) Put

func (bsm *BoostrapStorerMock) Put(round int64, bootData bootstrapStorage.BootstrapData) error

func (*BoostrapStorerMock) SaveLastRound

func (bsm *BoostrapStorerMock) SaveLastRound(round int64) error

type CacherStub

type CacherStub struct {
	ClearCalled           func()
	PutCalled             func(key []byte, value interface{}) (evicted bool)
	GetCalled             func(key []byte) (value interface{}, ok bool)
	HasCalled             func(key []byte) bool
	PeekCalled            func(key []byte) (value interface{}, ok bool)
	HasOrAddCalled        func(key []byte, value interface{}) (ok, evicted bool)
	RemoveCalled          func(key []byte)
	RemoveOldestCalled    func()
	KeysCalled            func() [][]byte
	LenCalled             func() int
	MaxSizeCalled         func() int
	RegisterHandlerCalled func(func(key []byte))
}

func (*CacherStub) Clear

func (cs *CacherStub) Clear()

func (*CacherStub) Get

func (cs *CacherStub) Get(key []byte) (value interface{}, ok bool)

func (*CacherStub) Has

func (cs *CacherStub) Has(key []byte) bool

func (*CacherStub) HasOrAdd

func (cs *CacherStub) HasOrAdd(key []byte, value interface{}) (ok, evicted bool)

func (*CacherStub) IsInterfaceNil

func (cs *CacherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherStub) Keys

func (cs *CacherStub) Keys() [][]byte

func (*CacherStub) Len

func (cs *CacherStub) Len() int

func (*CacherStub) MaxSize

func (cs *CacherStub) MaxSize() int

func (*CacherStub) Peek

func (cs *CacherStub) Peek(key []byte) (value interface{}, ok bool)

func (*CacherStub) Put

func (cs *CacherStub) Put(key []byte, value interface{}) (evicted bool)

func (*CacherStub) RegisterHandler

func (cs *CacherStub) RegisterHandler(handler func(key []byte))

func (*CacherStub) Remove

func (cs *CacherStub) Remove(key []byte)

func (*CacherStub) RemoveOldest

func (cs *CacherStub) RemoveOldest()

type ChainHandlerStub

type ChainHandlerStub struct {
	GetGenesisHeaderCalled     func() data.HeaderHandler
	GetGenesisHeaderHashCalled func() []byte
	SetGenesisHeaderCalled     func(gb data.HeaderHandler) error
	SetGenesisHeaderHashCalled func(hash []byte)
}

func (*ChainHandlerStub) GetCurrentBlockBody

func (chs *ChainHandlerStub) GetCurrentBlockBody() data.BodyHandler

func (*ChainHandlerStub) GetCurrentBlockHeader

func (chs *ChainHandlerStub) GetCurrentBlockHeader() data.HeaderHandler

func (*ChainHandlerStub) GetCurrentBlockHeaderHash

func (chs *ChainHandlerStub) GetCurrentBlockHeaderHash() []byte

func (*ChainHandlerStub) GetGenesisHeader

func (chs *ChainHandlerStub) GetGenesisHeader() data.HeaderHandler

func (*ChainHandlerStub) GetGenesisHeaderHash

func (chs *ChainHandlerStub) GetGenesisHeaderHash() []byte

func (*ChainHandlerStub) GetLocalHeight added in v1.0.3

func (chs *ChainHandlerStub) GetLocalHeight() int64

func (*ChainHandlerStub) GetNetworkHeight added in v1.0.3

func (chs *ChainHandlerStub) GetNetworkHeight() int64

func (*ChainHandlerStub) HasBadBlock added in v1.0.3

func (chs *ChainHandlerStub) HasBadBlock(blockHash []byte) bool

func (*ChainHandlerStub) IsInterfaceNil

func (chs *ChainHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChainHandlerStub) PutBadBlock added in v1.0.3

func (chs *ChainHandlerStub) PutBadBlock(blockHash []byte)

func (*ChainHandlerStub) SetCurrentBlockBody

func (chs *ChainHandlerStub) SetCurrentBlockBody(body data.BodyHandler) error

func (*ChainHandlerStub) SetCurrentBlockHeader

func (chs *ChainHandlerStub) SetCurrentBlockHeader(bh data.HeaderHandler) error

func (*ChainHandlerStub) SetCurrentBlockHeaderHash

func (chs *ChainHandlerStub) SetCurrentBlockHeaderHash(hash []byte)

func (*ChainHandlerStub) SetGenesisHeader

func (chs *ChainHandlerStub) SetGenesisHeader(gb data.HeaderHandler) error

func (*ChainHandlerStub) SetGenesisHeaderHash

func (chs *ChainHandlerStub) SetGenesisHeaderHash(hash []byte)

func (*ChainHandlerStub) SetLocalHeight added in v1.0.3

func (chs *ChainHandlerStub) SetLocalHeight(height int64)

func (*ChainHandlerStub) SetNetworkHeight added in v1.0.3

func (chs *ChainHandlerStub) SetNetworkHeight(height int64)

type ChainStorerMock

type ChainStorerMock struct {
	AddStorerCalled func(key dataRetriever.UnitType, s storage.Storer)
	GetStorerCalled func(unitType dataRetriever.UnitType) storage.Storer
	HasCalled       func(unitType dataRetriever.UnitType, key []byte) error
	GetCalled       func(unitType dataRetriever.UnitType, key []byte) ([]byte, error)
	PutCalled       func(unitType dataRetriever.UnitType, key []byte, value []byte) error
	GetAllCalled    func(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)
	DestroyCalled   func() error
}

ChainStorerMock is a mock implementation of the ChianStorer interface

func (*ChainStorerMock) AddStorer

func (bc *ChainStorerMock) AddStorer(key dataRetriever.UnitType, s storage.Storer)

AddStorer will add a new storer to the chain map

func (*ChainStorerMock) Destroy

func (bc *ChainStorerMock) Destroy() error

Destroy removes the underlying files/resources used by the storage service

func (*ChainStorerMock) Get

func (bc *ChainStorerMock) Get(unitType dataRetriever.UnitType, key []byte) ([]byte, error)

Get returns the value for the given key if found in the selected storage unit, nil otherwise. It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorerMock) GetAll

func (bc *ChainStorerMock) GetAll(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)

GetAll gets all the elements with keys in the keys array, from the selected storage unit It can report an error if the provided unit type is not supported, if there is a missing key in the unit, or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) GetStorer

func (bc *ChainStorerMock) GetStorer(unitType dataRetriever.UnitType) storage.Storer

GetStorer returns the storer from the chain map or nil if the storer was not found

func (*ChainStorerMock) Has

func (bc *ChainStorerMock) Has(unitType dataRetriever.UnitType, key []byte) error

Has returns true if the key is found in the selected Unit or false otherwise It can return an error if the provided unit type is not supported or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) IsInterfaceNil

func (bc *ChainStorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChainStorerMock) Put

func (bc *ChainStorerMock) Put(unitType dataRetriever.UnitType, key []byte, value []byte) error

Put stores the key, value pair in the selected storage unit It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

type FeeHandlerStub

type FeeHandlerStub struct {
	MaxGasLimitPerBlockCalled   func() uint64
	SetMinGasPriceCalled        func(minasPrice uint64)
	SetMinGasLimitCalled        func(minGasLimit uint64)
	ComputeGasLimitCalled       func(tx process.TransactionWithFeeHandler) uint64
	ComputeFeeCalled            func(tx process.TransactionWithFeeHandler) *big.Int
	CheckValidityTxValuesCalled func(tx process.TransactionWithFeeHandler) error
}

func (*FeeHandlerStub) CheckValidityTxValues

func (fhs *FeeHandlerStub) CheckValidityTxValues(tx process.TransactionWithFeeHandler) error

func (*FeeHandlerStub) ComputeFee

func (*FeeHandlerStub) ComputeGasLimit

func (fhs *FeeHandlerStub) ComputeGasLimit(tx process.TransactionWithFeeHandler) uint64

func (*FeeHandlerStub) IsInterfaceNil

func (fhs *FeeHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*FeeHandlerStub) MaxGasLimitPerBlock

func (fhs *FeeHandlerStub) MaxGasLimitPerBlock() uint64

type ForkDetectorMock

type ForkDetectorMock struct {
	AddHeaderCalled                 func(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte, isNotarizedShardStuck bool) error
	RemoveHeadersCalled             func(nonce uint64, hash []byte)
	CheckForkCalled                 func() *process.ForkInfo
	GetHighestFinalBlockNonceCalled func() uint64
	ProbableHighestNonceCalled      func() uint64
	ResetProbableHighestNonceCalled func()
	ResetForkCalled                 func()
	GetNotarizedHeaderHashCalled    func(nonce uint64) []byte
}

ForkDetectorMock is a mock implementation for the ForkDetector interface

func (*ForkDetectorMock) AddHeader

func (f *ForkDetectorMock) AddHeader(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte, isNotarizedShardStuck bool) error

AddHeader is a mock implementation for AddHeader

func (*ForkDetectorMock) CheckFork

func (f *ForkDetectorMock) CheckFork() *process.ForkInfo

CheckFork is a mock implementation for CheckFork

func (*ForkDetectorMock) GetHighestFinalBlockNonce

func (f *ForkDetectorMock) GetHighestFinalBlockNonce() uint64

GetHighestFinalBlockNonce is a mock implementation for GetHighestFinalBlockNonce

func (*ForkDetectorMock) GetNotarizedHeaderHash

func (fdm *ForkDetectorMock) GetNotarizedHeaderHash(nonce uint64) []byte

func (*ForkDetectorMock) IsInterfaceNil

func (fdm *ForkDetectorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ForkDetectorMock) ProbableHighestNonce

func (f *ForkDetectorMock) ProbableHighestNonce() uint64

ProbableHighestNonce is a mock implementation for GetProbableHighestNonce

func (*ForkDetectorMock) RemoveHeaders added in v1.0.3

func (f *ForkDetectorMock) RemoveHeaders(nonce uint64, hash []byte)

RemoveHeaders is a mock implementation for RemoveHeaders

func (*ForkDetectorMock) ResetFork

func (fdm *ForkDetectorMock) ResetFork()

func (*ForkDetectorMock) ResetProbableHighestNonce

func (fdm *ForkDetectorMock) ResetProbableHighestNonce()

func (*ForkDetectorMock) RestoreFinalCheckPointToGenesis added in v1.0.41

func (f *ForkDetectorMock) RestoreFinalCheckPointToGenesis()

type GeneratorSuite

type GeneratorSuite struct {
	SuiteMock
	CreateKeyStub func(cipher.Stream) crypto.Scalar
}

func (*GeneratorSuite) CreateKey

func (gs *GeneratorSuite) CreateKey(c cipher.Stream) crypto.Scalar

type HasherFake

type HasherFake struct {
}

HasherFake that will be used for testing

func (HasherFake) Compute

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

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

func (HasherFake) EmptyHash

func (sha HasherFake) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (*HasherFake) IsInterfaceNil

func (sha *HasherFake) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherFake) Size

func (HasherFake) Size() int

Size return the required size in bytes

type HasherMock

type HasherMock struct {
	ComputeCalled   func(s string) []byte
	EmptyHashCalled func() []byte
}

func (HasherMock) Compute

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

func (HasherMock) EmptyHash

func (hash HasherMock) EmptyHash() []byte

func (*HasherMock) IsInterfaceNil

func (hash *HasherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherMock) Size

func (HasherMock) Size() int

type HeaderSigVerifierStub

type HeaderSigVerifierStub struct {
	VerifyRandSeedCaller func(header data.HeaderHandler) error
}

func (*HeaderSigVerifierStub) IsInterfaceNil

func (hsvm *HeaderSigVerifierStub) IsInterfaceNil() bool

func (*HeaderSigVerifierStub) VerifyRandSeed

func (hsvm *HeaderSigVerifierStub) VerifyRandSeed(header data.HeaderHandler) error

type HeartbeatStorerStub

type HeartbeatStorerStub struct {
	LoadGenesisTimeCalled   func() (time.Time, error)
	UpdateGenesisTimeCalled func(genesisTime time.Time) error
	LoadHbmiDTOCalled       func(pubKey string) (*heartbeat.HeartbeatDTO, error)
	SavePubkeyDataCalled    func(pubkey []byte, heartbeat *heartbeat.HeartbeatDTO) error
	LoadKeysCalled          func() ([][]byte, error)
	SaveKeysCalled          func(peersSlice [][]byte) error
}

func (*HeartbeatStorerStub) IsInterfaceNil

func (hss *HeartbeatStorerStub) IsInterfaceNil() bool

func (*HeartbeatStorerStub) LoadGenesisTime

func (hss *HeartbeatStorerStub) LoadGenesisTime() (time.Time, error)

func (*HeartbeatStorerStub) LoadHbmiDTO

func (hss *HeartbeatStorerStub) LoadHbmiDTO(pubKey string) (*heartbeat.HeartbeatDTO, error)

func (*HeartbeatStorerStub) LoadKeys

func (hss *HeartbeatStorerStub) LoadKeys() ([][]byte, error)

func (*HeartbeatStorerStub) SaveKeys

func (hss *HeartbeatStorerStub) SaveKeys(peersSlice [][]byte) error

func (*HeartbeatStorerStub) SavePubkeyData

func (hss *HeartbeatStorerStub) SavePubkeyData(pubkey []byte, heartbeat *heartbeat.HeartbeatDTO) error

func (*HeartbeatStorerStub) UpdateGenesisTime

func (hss *HeartbeatStorerStub) UpdateGenesisTime(genesisTime time.Time) error

type IndexerMock

type IndexerMock struct {
	SaveBlockCalled func(body block.Body, header *block.Header)
}

IndexerMock is a mock implementation fot the Indexer interface

func (*IndexerMock) IsInterfaceNil

func (im *IndexerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*IndexerMock) IsNilIndexer

func (im *IndexerMock) IsNilIndexer() bool

func (*IndexerMock) SaveBlock

func (im *IndexerMock) SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler, signersIndexes []uint64)

func (*IndexerMock) SaveMetaBlock

func (im *IndexerMock) SaveMetaBlock(header data.HeaderHandler, signersIndexes []uint64)

func (*IndexerMock) SaveRoundInfo

func (im *IndexerMock) SaveRoundInfo(roundInfo indexer.RoundInfo)

func (*IndexerMock) SaveValidatorsPubKeys

func (im *IndexerMock) SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte)

func (*IndexerMock) UpdateTPS

func (im *IndexerMock) UpdateTPS(tpsBenchmark statistics.TPSBenchmark)

type InterceptorsContainerStub

type InterceptorsContainerStub struct {
}

func (*InterceptorsContainerStub) Add

func (*InterceptorsContainerStub) AddMultiple

func (ics *InterceptorsContainerStub) AddMultiple(keys []string, interceptors []process.Interceptor) error

func (*InterceptorsContainerStub) Get

func (*InterceptorsContainerStub) IsInterfaceNil

func (ics *InterceptorsContainerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*InterceptorsContainerStub) Len

func (ics *InterceptorsContainerStub) Len() int

func (*InterceptorsContainerStub) Remove

func (ics *InterceptorsContainerStub) Remove(key string)

func (*InterceptorsContainerStub) Replace

func (ics *InterceptorsContainerStub) Replace(key string, val process.Interceptor) error

type KeyGenMock

type KeyGenMock struct {
	GeneratePairMock            func() (crypto.PrivateKey, crypto.PublicKey)
	PrivateKeyFromByteArrayMock func(b []byte) (crypto.PrivateKey, error)
	PublicKeyFromByteArrayMock  func(b []byte) (crypto.PublicKey, error)
	SuiteMock                   func() crypto.Suite
}

func (*KeyGenMock) GeneratePair

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

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(b []byte) (crypto.PrivateKey, error)

func (*KeyGenMock) PublicKeyFromByteArray

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

func (*KeyGenMock) Suite

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

type MarshalizerFake

type MarshalizerFake struct {
	Fail bool
}

MarshalizerFake that will be used for testing

func (*MarshalizerFake) IsInterfaceNil

func (mm *MarshalizerFake) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerFake) Marshal

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

Marshal converts the input object in a slice of bytes

func (*MarshalizerFake) Unmarshal

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

Unmarshal applies the serialized values over an instantiated object

type MarshalizerMock

type MarshalizerMock struct {
	MarshalHandler   func(obj interface{}) ([]byte, error)
	UnmarshalHandler func(obj interface{}, buff []byte) error
}

func (*MarshalizerMock) IsInterfaceNil

func (j *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (MarshalizerMock) Marshal

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

func (MarshalizerMock) Unmarshal

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

type MessageHandlerStub

type MessageHandlerStub struct {
	CreateHeartbeatFromP2pMessageCalled func(message p2p.MessageP2P) (*heartbeat.Heartbeat, error)
}

func (*MessageHandlerStub) CreateHeartbeatFromP2pMessage added in v1.0.23

func (mhs *MessageHandlerStub) CreateHeartbeatFromP2pMessage(message p2p.MessageP2P) (*heartbeat.Heartbeat, error)

func (*MessageHandlerStub) IsInterfaceNil

func (mhs *MessageHandlerStub) IsInterfaceNil() bool

type MessengerStub

type MessengerStub struct {
	CloseCalled                      func() error
	CreateTopicCalled                func(name string, createChannelForTopic bool) error
	HasTopicCalled                   func(name string) bool
	HasTopicValidatorCalled          func(name string) bool
	BroadcastOnChannelCalled         func(channel string, topic string, buff []byte)
	BroadcastCalled                  func(topic string, buff []byte)
	RegisterMessageProcessorCalled   func(topic string, handler p2p.MessageProcessor) error
	BootstrapCalled                  func() error
	PeerAddressCalled                func(pid p2p.PeerID) string
	BroadcastOnChannelBlockingCalled func(channel string, topic string, buff []byte) error
	IsConnectedToTheNetworkCalled    func() bool
}

func (*MessengerStub) Bootstrap

func (ms *MessengerStub) Bootstrap() error

func (*MessengerStub) Broadcast

func (ms *MessengerStub) Broadcast(topic string, buff []byte)

func (*MessengerStub) BroadcastOnChannel

func (ms *MessengerStub) BroadcastOnChannel(channel string, topic string, buff []byte)

func (*MessengerStub) BroadcastOnChannelBlocking

func (ms *MessengerStub) BroadcastOnChannelBlocking(channel string, topic string, buff []byte) error

func (*MessengerStub) Close

func (ms *MessengerStub) Close() error

func (*MessengerStub) CreateTopic

func (ms *MessengerStub) CreateTopic(name string, createChannelForTopic bool) error

func (*MessengerStub) HasTopic

func (ms *MessengerStub) HasTopic(name string) bool

func (*MessengerStub) HasTopicValidator

func (ms *MessengerStub) HasTopicValidator(name string) bool

func (*MessengerStub) IsConnectedToTheNetwork

func (ms *MessengerStub) IsConnectedToTheNetwork() bool

func (*MessengerStub) IsInterfaceNil

func (ms *MessengerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MessengerStub) PeerAddress

func (ms *MessengerStub) PeerAddress(pid p2p.PeerID) string

func (*MessengerStub) RegisterMessageProcessor

func (ms *MessengerStub) RegisterMessageProcessor(topic string, handler p2p.MessageProcessor) error

type MetaPoolsHolderStub added in v1.0.3

type MetaPoolsHolderStub struct {
	MetaBlocksCalled           func() storage.Cacher
	MiniBlocksCalled           func() storage.Cacher
	ShardHeadersCalled         func() storage.Cacher
	HeadersNoncesCalled        func() dataRetriever.Uint64SyncMapCacher
	TransactionsCalled         func() dataRetriever.ShardedDataCacherNotifier
	UnsignedTransactionsCalled func() dataRetriever.ShardedDataCacherNotifier
	CurrBlockTxsCalled         func() dataRetriever.TransactionCacher
}

func (*MetaPoolsHolderStub) CurrentBlockTxs added in v1.0.39

func (mphs *MetaPoolsHolderStub) CurrentBlockTxs() dataRetriever.TransactionCacher

func (*MetaPoolsHolderStub) HeadersNonces added in v1.0.11

func (*MetaPoolsHolderStub) IsInterfaceNil added in v1.0.16

func (mphs *MetaPoolsHolderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MetaPoolsHolderStub) MetaBlocks added in v1.0.30

func (mphs *MetaPoolsHolderStub) MetaBlocks() storage.Cacher

func (*MetaPoolsHolderStub) MiniBlocks added in v1.0.28

func (mphs *MetaPoolsHolderStub) MiniBlocks() storage.Cacher

func (*MetaPoolsHolderStub) ShardHeaders added in v1.0.3

func (mphs *MetaPoolsHolderStub) ShardHeaders() storage.Cacher

func (*MetaPoolsHolderStub) Transactions added in v1.0.28

func (*MetaPoolsHolderStub) UnsignedTransactions added in v1.0.28

func (mphs *MetaPoolsHolderStub) UnsignedTransactions() dataRetriever.ShardedDataCacherNotifier

type MockTimer

type MockTimer struct {
	// contains filtered or unexported fields
}

func NewMockTimer

func NewMockTimer() *MockTimer

func (*MockTimer) IncrementSeconds

func (m *MockTimer) IncrementSeconds(value int)

func (*MockTimer) IsInterfaceNil

func (m *MockTimer) IsInterfaceNil() bool

func (*MockTimer) Now

func (m *MockTimer) Now() time.Time

func (*MockTimer) SetSeconds

func (m *MockTimer) SetSeconds(value int)

type MultisignMock

type MultisignMock struct {
}

func (*MultisignMock) AggregateCommitments

func (mm *MultisignMock) AggregateCommitments(bitmap []byte) error

func (*MultisignMock) AggregateSigs

func (mm *MultisignMock) AggregateSigs(bitmap []byte) ([]byte, error)

func (*MultisignMock) Commitment

func (mm *MultisignMock) Commitment(index uint16) ([]byte, error)

func (*MultisignMock) CommitmentHash

func (mm *MultisignMock) CommitmentHash(index uint16) ([]byte, error)

func (*MultisignMock) Create

func (mm *MultisignMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)

func (*MultisignMock) CreateCommitment

func (mm *MultisignMock) CreateCommitment() (commSecret []byte, commitment []byte)

func (*MultisignMock) CreateSignatureShare

func (mm *MultisignMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)

func (*MultisignMock) IsInterfaceNil

func (mm *MultisignMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MultisignMock) Reset

func (mm *MultisignMock) Reset(pubKeys []string, index uint16) error

func (*MultisignMock) SetAggregatedSig

func (mm *MultisignMock) SetAggregatedSig([]byte) error

func (*MultisignMock) SignatureShare

func (mm *MultisignMock) SignatureShare(index uint16) ([]byte, error)

func (*MultisignMock) StoreCommitment

func (mm *MultisignMock) StoreCommitment(index uint16, value []byte) error

func (*MultisignMock) StoreCommitmentHash

func (mm *MultisignMock) StoreCommitmentHash(index uint16, commHash []byte) error

func (*MultisignMock) StoreSignatureShare

func (mm *MultisignMock) StoreSignatureShare(index uint16, sig []byte) error

func (*MultisignMock) Verify

func (mm *MultisignMock) Verify(msg []byte, bitmap []byte) error

func (*MultisignMock) VerifySignatureShare

func (mm *MultisignMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error

type NodesCoordinatorMock

type NodesCoordinatorMock struct {
	ComputeValidatorsGroupCalled        func(randomness []byte, round uint64, shardId uint32) ([]sharding.Validator, error)
	GetValidatorsPublicKeysCalled       func(randomness []byte, round uint64, shardId uint32) ([]string, error)
	GetValidatorsRewardsAddressesCalled func(randomness []byte, round uint64, shardId uint32) ([]string, error)
}

func (*NodesCoordinatorMock) ComputeValidatorsGroup added in v1.0.20

func (ncm *NodesCoordinatorMock) ComputeValidatorsGroup(
	randomness []byte,
	round uint64,
	shardId uint32,
) (validatorsGroup []sharding.Validator, err error)

func (*NodesCoordinatorMock) ConsensusGroupSize

func (ncm *NodesCoordinatorMock) ConsensusGroupSize(shardId uint32) int

func (*NodesCoordinatorMock) GetAllValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetAllValidatorsPublicKeys() map[uint32][][]byte

func (*NodesCoordinatorMock) GetOwnPublicKey

func (ncm *NodesCoordinatorMock) GetOwnPublicKey() []byte

func (*NodesCoordinatorMock) GetSelectedPublicKeys

func (ncm *NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte, shardId uint32) (publicKeys []string, err error)

func (*NodesCoordinatorMock) GetValidatorWithPublicKey

func (ncm *NodesCoordinatorMock) GetValidatorWithPublicKey(publicKey []byte) (sharding.Validator, uint32, error)

func (*NodesCoordinatorMock) GetValidatorsIndexes

func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(publicKeys []string) []uint64

func (*NodesCoordinatorMock) GetValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsPublicKeys(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

func (*NodesCoordinatorMock) GetValidatorsRewardsAddresses added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsRewardsAddresses(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

func (*NodesCoordinatorMock) IsInterfaceNil

func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodesCoordinatorMock) SetConsensusGroupSize

func (ncm *NodesCoordinatorMock) SetConsensusGroupSize(int) error

func (*NodesCoordinatorMock) SetNodesPerShards

func (ncm *NodesCoordinatorMock) SetNodesPerShards(map[uint32][]sharding.Validator) error

type P2PMessageMock

type P2PMessageMock struct {
	FromField      []byte
	DataField      []byte
	SeqNoField     []byte
	TopicIDsField  []string
	SignatureField []byte
	KeyField       []byte
	PeerField      p2p.PeerID
}

func (*P2PMessageMock) Data

func (msg *P2PMessageMock) Data() []byte

func (*P2PMessageMock) From

func (msg *P2PMessageMock) From() []byte

func (*P2PMessageMock) IsInterfaceNil

func (msg *P2PMessageMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*P2PMessageMock) Key

func (msg *P2PMessageMock) Key() []byte

func (*P2PMessageMock) Peer

func (msg *P2PMessageMock) Peer() p2p.PeerID

func (*P2PMessageMock) SeqNo

func (msg *P2PMessageMock) SeqNo() []byte

func (*P2PMessageMock) Signature

func (msg *P2PMessageMock) Signature() []byte

func (*P2PMessageMock) TopicIDs added in v1.0.38

func (msg *P2PMessageMock) TopicIDs() []string

type P2PMessageStub

type P2PMessageStub struct {
	FromField      []byte
	DataField      []byte
	SeqNoField     []byte
	TopicIDsField  []string
	SignatureField []byte
	KeyField       []byte
	PeerField      p2p.PeerID
}

func (*P2PMessageStub) Data

func (msg *P2PMessageStub) Data() []byte

func (*P2PMessageStub) From

func (msg *P2PMessageStub) From() []byte

func (*P2PMessageStub) IsInterfaceNil

func (msg *P2PMessageStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*P2PMessageStub) Key

func (msg *P2PMessageStub) Key() []byte

func (*P2PMessageStub) Peer

func (msg *P2PMessageStub) Peer() p2p.PeerID

func (*P2PMessageStub) SeqNo

func (msg *P2PMessageStub) SeqNo() []byte

func (*P2PMessageStub) Signature

func (msg *P2PMessageStub) Signature() []byte

func (*P2PMessageStub) TopicIDs added in v1.0.3

func (msg *P2PMessageStub) TopicIDs() []string

type PoolsHolderStub

type PoolsHolderStub struct {
	HeadersCalled              func() storage.Cacher
	HeadersNoncesCalled        func() dataRetriever.Uint64SyncMapCacher
	PeerChangesBlocksCalled    func() storage.Cacher
	TransactionsCalled         func() dataRetriever.ShardedDataCacherNotifier
	UnsignedTransactionsCalled func() dataRetriever.ShardedDataCacherNotifier
	RewardTransactionsCalled   func() dataRetriever.ShardedDataCacherNotifier
	MiniBlocksCalled           func() storage.Cacher
	MetaBlocksCalled           func() storage.Cacher
	CurrBlockTxsCalled         func() dataRetriever.TransactionCacher
}

func (*PoolsHolderStub) CurrentBlockTxs

func (phs *PoolsHolderStub) CurrentBlockTxs() dataRetriever.TransactionCacher

func (*PoolsHolderStub) Headers

func (phs *PoolsHolderStub) Headers() storage.Cacher

func (*PoolsHolderStub) HeadersNonces added in v1.0.3

func (phs *PoolsHolderStub) HeadersNonces() dataRetriever.Uint64SyncMapCacher

func (*PoolsHolderStub) IsInterfaceNil

func (phs *PoolsHolderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PoolsHolderStub) MetaBlocks added in v1.0.3

func (phs *PoolsHolderStub) MetaBlocks() storage.Cacher

func (*PoolsHolderStub) MiniBlocks

func (phs *PoolsHolderStub) MiniBlocks() storage.Cacher

func (*PoolsHolderStub) PeerChangesBlocks

func (phs *PoolsHolderStub) PeerChangesBlocks() storage.Cacher

func (*PoolsHolderStub) RewardTransactions

func (phs *PoolsHolderStub) RewardTransactions() dataRetriever.ShardedDataCacherNotifier

func (*PoolsHolderStub) Transactions

func (*PoolsHolderStub) UnsignedTransactions

func (phs *PoolsHolderStub) UnsignedTransactions() dataRetriever.ShardedDataCacherNotifier

type PrivateKeyStub

type PrivateKeyStub struct {
	ToByteArrayHandler    func() ([]byte, error)
	GeneratePublicHandler func() crypto.PublicKey
	SuiteHandler          func() crypto.Suite
	ScalarHandler         func() crypto.Scalar
}

func (*PrivateKeyStub) GeneratePublic

func (sk *PrivateKeyStub) GeneratePublic() crypto.PublicKey

func (*PrivateKeyStub) IsInterfaceNil

func (sk *PrivateKeyStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PrivateKeyStub) Scalar

func (sk *PrivateKeyStub) Scalar() crypto.Scalar

func (*PrivateKeyStub) Suite

func (sk *PrivateKeyStub) Suite() crypto.Suite

func (*PrivateKeyStub) ToByteArray

func (sk *PrivateKeyStub) ToByteArray() ([]byte, error)

type PublicKeyMock

type PublicKeyMock struct {
	ToByteArrayHandler func() ([]byte, error)
	SuiteCalled        func() crypto.Suite
	PointCalled        func() crypto.Point
}

func (*PublicKeyMock) IsInterfaceNil

func (sspk *PublicKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PublicKeyMock) Point

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

func (*PublicKeyMock) Suite

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

func (*PublicKeyMock) ToByteArray

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

type RequestedItemsHandlerStub

type RequestedItemsHandlerStub struct {
	AddCalled   func(key string) error
	HasCalled   func(key string) bool
	SweepCalled func()
}

func (*RequestedItemsHandlerStub) Add

func (rihs *RequestedItemsHandlerStub) Add(key string) error

func (*RequestedItemsHandlerStub) Has

func (rihs *RequestedItemsHandlerStub) Has(key string) bool

func (*RequestedItemsHandlerStub) IsInterfaceNil

func (rihs *RequestedItemsHandlerStub) IsInterfaceNil() bool

func (*RequestedItemsHandlerStub) Sweep

func (rihs *RequestedItemsHandlerStub) Sweep()

type ResolversFinderStub

type ResolversFinderStub struct {
	GetCalled                func(key string) (dataRetriever.Resolver, error)
	AddCalled                func(key string, val dataRetriever.Resolver) error
	ReplaceCalled            func(key string, val dataRetriever.Resolver) error
	RemoveCalled             func(key string)
	LenCalled                func() int
	IntraShardResolverCalled func(baseTopic string) (dataRetriever.Resolver, error)
	MetaChainResolverCalled  func(baseTopic string) (dataRetriever.Resolver, error)
	CrossShardResolverCalled func(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)
}

func (*ResolversFinderStub) Add

func (*ResolversFinderStub) AddMultiple

func (rfs *ResolversFinderStub) AddMultiple(keys []string, resolvers []dataRetriever.Resolver) error

func (*ResolversFinderStub) CrossShardResolver

func (rfs *ResolversFinderStub) CrossShardResolver(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)

func (*ResolversFinderStub) Get

func (*ResolversFinderStub) IntraShardResolver

func (rfs *ResolversFinderStub) IntraShardResolver(baseTopic string) (dataRetriever.Resolver, error)

func (*ResolversFinderStub) IsInterfaceNil

func (rfs *ResolversFinderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ResolversFinderStub) Len

func (rfs *ResolversFinderStub) Len() int

func (*ResolversFinderStub) MetaChainResolver

func (rfs *ResolversFinderStub) MetaChainResolver(baseTopic string) (dataRetriever.Resolver, error)

func (*ResolversFinderStub) Remove

func (rfs *ResolversFinderStub) Remove(key string)

func (*ResolversFinderStub) Replace

func (rfs *ResolversFinderStub) Replace(key string, val dataRetriever.Resolver) error

type RounderMock

type RounderMock struct {
	IndexCalled         func() int64
	TimeDurationCalled  func() time.Duration
	TimeStampCalled     func() time.Time
	UpdateRoundCalled   func(time.Time, time.Time)
	RemainingTimeCalled func(startTime time.Time, maxTime time.Duration) time.Duration
	// contains filtered or unexported fields
}

func (*RounderMock) Index

func (rndm *RounderMock) Index() int64

func (*RounderMock) IsInterfaceNil

func (rndm *RounderMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*RounderMock) RemainingTime

func (rndm *RounderMock) RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration

func (*RounderMock) TimeDuration

func (rndm *RounderMock) TimeDuration() time.Duration

func (*RounderMock) TimeStamp

func (rndm *RounderMock) TimeStamp() time.Time

func (*RounderMock) UpdateRound

func (rndm *RounderMock) UpdateRound(genesisRoundTimeStamp time.Time, timeStamp time.Time)

type SCQueryServiceStub

type SCQueryServiceStub struct {
	ExecuteQueryCalled func(*process.SCQuery) (*vmcommon.VMOutput, error)
}

func (*SCQueryServiceStub) ExecuteQuery

func (serviceStub *SCQueryServiceStub) ExecuteQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

func (*SCQueryServiceStub) IsInterfaceNil

func (serviceStub *SCQueryServiceStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type ShardCoordinatorMock

type ShardCoordinatorMock struct {
	SelfShardId uint32
}

func (ShardCoordinatorMock) CommunicationIdentifier

func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string

func (ShardCoordinatorMock) ComputeId

func (scm ShardCoordinatorMock) ComputeId(address state.AddressContainer) uint32

func (*ShardCoordinatorMock) IsInterfaceNil

func (scm *ShardCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (ShardCoordinatorMock) NumberOfShards

func (scm ShardCoordinatorMock) NumberOfShards() uint32

func (ShardCoordinatorMock) SameShard

func (scm ShardCoordinatorMock) SameShard(firstAddress, secondAddress state.AddressContainer) bool

func (ShardCoordinatorMock) SelfId

func (scm ShardCoordinatorMock) SelfId() uint32

func (ShardCoordinatorMock) SetSelfShardId

func (scm ShardCoordinatorMock) SetSelfShardId(shardId uint32) error

type ShardedDataStub

type ShardedDataStub struct {
	RegisterHandlerCalled         func(func(key []byte))
	ShardDataStoreCalled          func(cacheId string) (c storage.Cacher)
	AddDataCalled                 func(key []byte, data interface{}, cacheId string)
	SearchFirstDataCalled         func(key []byte) (value interface{}, ok bool)
	RemoveDataCalled              func(key []byte, cacheId string)
	RemoveDataFromAllShardsCalled func(key []byte)
	MergeShardStoresCalled        func(sourceCacheId, destCacheId string)
	MoveDataCalled                func(sourceCacheId, destCacheId string, key [][]byte)
	ClearCalled                   func()
	ClearShardStoreCalled         func(cacheId string)
	RemoveSetOfDataFromPoolCalled func(keys [][]byte, destCacheId string)
	CreateShardStoreCalled        func(destCacheId string)
}

func (*ShardedDataStub) AddData

func (sd *ShardedDataStub) AddData(key []byte, data interface{}, cacheId string)

func (*ShardedDataStub) Clear

func (sd *ShardedDataStub) Clear()

func (*ShardedDataStub) ClearShardStore

func (sd *ShardedDataStub) ClearShardStore(cacheId string)

func (*ShardedDataStub) CreateShardStore

func (sd *ShardedDataStub) CreateShardStore(cacheId string)

func (*ShardedDataStub) IsInterfaceNil

func (sd *ShardedDataStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardedDataStub) MergeShardStores

func (sd *ShardedDataStub) MergeShardStores(sourceCacheId, destCacheId string)

func (*ShardedDataStub) MoveData added in v1.0.3

func (sd *ShardedDataStub) MoveData(sourceCacheId, destCacheId string, key [][]byte)

func (*ShardedDataStub) RegisterHandler

func (sd *ShardedDataStub) RegisterHandler(handler func(key []byte))

func (*ShardedDataStub) RemoveData

func (sd *ShardedDataStub) RemoveData(key []byte, cacheId string)

func (*ShardedDataStub) RemoveDataFromAllShards

func (sd *ShardedDataStub) RemoveDataFromAllShards(key []byte)

func (*ShardedDataStub) RemoveSetOfDataFromPool

func (sd *ShardedDataStub) RemoveSetOfDataFromPool(keys [][]byte, cacheId string)

func (*ShardedDataStub) SearchFirstData

func (sd *ShardedDataStub) SearchFirstData(key []byte) (value interface{}, ok bool)

func (*ShardedDataStub) ShardDataStore

func (sd *ShardedDataStub) ShardDataStore(cacheId string) (c storage.Cacher)

type SingleSignerMock

type SingleSignerMock struct {
	SignStub   func(private crypto.PrivateKey, msg []byte) ([]byte, error)
	VerifyStub func(public crypto.PublicKey, msg []byte, sig []byte) error
}

func (*SingleSignerMock) IsInterfaceNil

func (s *SingleSignerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SingleSignerMock) Sign

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

func (*SingleSignerMock) Verify

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

type SinglesignFailMock

type SinglesignFailMock struct {
}

func (*SinglesignFailMock) IsInterfaceNil

func (s *SinglesignFailMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SinglesignFailMock) Sign

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

Sign Signs a message with using a single signature schnorr scheme

func (*SinglesignFailMock) Verify

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

Verify verifies a signature using a single signature schnorr scheme

type SinglesignMock

type SinglesignMock struct {
}

func (*SinglesignMock) IsInterfaceNil

func (s *SinglesignMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SinglesignMock) Sign

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

Sign Signs a message with using a single signature schnorr scheme

func (*SinglesignMock) Verify

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

Verify verifies a signature using a single signature schnorr scheme

type SinglesignStub

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

func (*SinglesignStub) IsInterfaceNil

func (s *SinglesignStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SinglesignStub) Sign

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

Sign Signs a message with using a single signature schnorr scheme

func (*SinglesignStub) Verify

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

Verify verifies a signature using a single signature schnorr scheme

type StatusMetricsStub

type StatusMetricsStub struct {
	StatusMetricsMapCalled func() (map[string]interface{}, error)
	IsInterfaceNilCalled   func() bool
}

func (*StatusMetricsStub) IsInterfaceNil

func (nds *StatusMetricsStub) IsInterfaceNil() bool

func (*StatusMetricsStub) StatusMetricsMap added in v1.0.17

func (nds *StatusMetricsStub) StatusMetricsMap() (map[string]interface{}, error)

type StorerMock

type StorerMock struct {
	// contains filtered or unexported fields
}

func NewStorerMock

func NewStorerMock() *StorerMock

func (*StorerMock) ClearCache

func (sm *StorerMock) ClearCache()

func (*StorerMock) DestroyUnit

func (sm *StorerMock) DestroyUnit() error

func (*StorerMock) Get

func (sm *StorerMock) Get(key []byte) ([]byte, error)

func (*StorerMock) Has

func (sm *StorerMock) Has(key []byte) error

func (*StorerMock) IsInterfaceNil

func (sm *StorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerMock) Put

func (sm *StorerMock) Put(key, data []byte) error

func (*StorerMock) Remove

func (sm *StorerMock) Remove(key []byte) error

type StorerStub

type StorerStub struct {
	PutCalled         func(key, data []byte) error
	GetCalled         func(key []byte) ([]byte, error)
	HasCalled         func(key []byte) error
	RemoveCalled      func(key []byte) error
	ClearCacheCalled  func()
	DestroyUnitCalled func() error
}

func (*StorerStub) ClearCache

func (ss *StorerStub) ClearCache()

func (*StorerStub) DestroyUnit

func (ss *StorerStub) DestroyUnit() error

func (*StorerStub) Get

func (ss *StorerStub) Get(key []byte) ([]byte, error)

func (*StorerStub) Has

func (ss *StorerStub) Has(key []byte) error

func (*StorerStub) IsInterfaceNil

func (ss *StorerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerStub) Put

func (ss *StorerStub) Put(key, data []byte) error

func (*StorerStub) Remove

func (ss *StorerStub) Remove(key []byte) error

type Streamer

type Streamer struct {
	// contains filtered or unexported fields
}

func NewStreamer

func NewStreamer() *Streamer

func (*Streamer) XORKeyStream

func (stream *Streamer) XORKeyStream(dst, src []byte)

type SuiteMock

type SuiteMock struct {
	StringStub             func() string
	ScalarLenStub          func() int
	CreateScalarStub       func() crypto.Scalar
	PointLenStub           func() int
	CreatePointStub        func() crypto.Point
	RandomStreamStub       func() cipher.Stream
	GetUnderlyingSuiteStub func() interface{}
}

func (*SuiteMock) CreatePoint

func (s *SuiteMock) CreatePoint() crypto.Point

func (*SuiteMock) CreateScalar

func (s *SuiteMock) CreateScalar() crypto.Scalar

func (*SuiteMock) GetUnderlyingSuite

func (s *SuiteMock) GetUnderlyingSuite() interface{}

func (*SuiteMock) IsInterfaceNil

func (s *SuiteMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SuiteMock) PointLen

func (s *SuiteMock) PointLen() int

func (*SuiteMock) RandomStream

func (s *SuiteMock) RandomStream() cipher.Stream

func (*SuiteMock) ScalarLen

func (s *SuiteMock) ScalarLen() int

func (*SuiteMock) String

func (s *SuiteMock) String() string

type SyncStub

type SyncStub struct {
}

func (*SyncStub) ClockOffset

func (ss *SyncStub) ClockOffset() time.Duration

func (*SyncStub) CurrentTime

func (ss *SyncStub) CurrentTime() time.Time

func (*SyncStub) FormattedCurrentTime

func (ss *SyncStub) FormattedCurrentTime() string

func (*SyncStub) IsInterfaceNil

func (ss *SyncStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncStub) StartSync

func (ss *SyncStub) StartSync()

type Uint64CacherStub

type Uint64CacherStub struct {
	ClearCalled           func()
	PutCalled             func(uint64, []byte) bool
	GetCalled             func(uint64) ([]byte, bool)
	HasCalled             func(uint64) bool
	PeekCalled            func(uint64) ([]byte, bool)
	HasOrAddCalled        func(uint64, []byte) (bool, bool)
	RemoveCalled          func(uint64)
	RemoveOldestCalled    func()
	KeysCalled            func() []uint64
	LenCalled             func() int
	RegisterHandlerCalled func(handler func(nonce uint64))
}

func (*Uint64CacherStub) Clear

func (ucs *Uint64CacherStub) Clear()

func (*Uint64CacherStub) Get

func (ucs *Uint64CacherStub) Get(nonce uint64) ([]byte, bool)

func (*Uint64CacherStub) Has

func (ucs *Uint64CacherStub) Has(nonce uint64) bool

func (*Uint64CacherStub) HasOrAdd

func (ucs *Uint64CacherStub) HasOrAdd(nonce uint64, value []byte) (bool, bool)

func (*Uint64CacherStub) Keys

func (ucs *Uint64CacherStub) Keys() []uint64

func (*Uint64CacherStub) Len

func (ucs *Uint64CacherStub) Len() int

func (*Uint64CacherStub) Peek

func (ucs *Uint64CacherStub) Peek(nonce uint64) ([]byte, bool)

func (*Uint64CacherStub) Put

func (ucs *Uint64CacherStub) Put(nonce uint64, value []byte) bool

func (*Uint64CacherStub) RegisterHandler

func (ucs *Uint64CacherStub) RegisterHandler(handler func(nonce uint64))

func (*Uint64CacherStub) Remove

func (ucs *Uint64CacherStub) Remove(nonce uint64)

func (*Uint64CacherStub) RemoveOldest

func (ucs *Uint64CacherStub) RemoveOldest()

type ValidatorMock

type ValidatorMock struct {
	// contains filtered or unexported fields
}

func NewValidatorMock

func NewValidatorMock(stake *big.Int, rating int32, pubKey []byte, address []byte) *ValidatorMock

func (*ValidatorMock) Address

func (vm *ValidatorMock) Address() []byte

func (*ValidatorMock) PubKey

func (vm *ValidatorMock) PubKey() []byte

func (*ValidatorMock) Rating added in v1.0.20

func (vm *ValidatorMock) Rating() int32

func (*ValidatorMock) Stake added in v1.0.20

func (vm *ValidatorMock) Stake() *big.Int

type ValidatorStatisticsProcessorMock

type ValidatorStatisticsProcessorMock struct {
	UpdatePeerStateCalled           func(header data.HeaderHandler) ([]byte, error)
	RevertPeerStateCalled           func(header data.HeaderHandler) error
	IsInterfaceNilCalled            func() bool
	RevertPeerStateToSnapshotCalled func(snapshot int) error
	GetPeerAccountCalled            func(address []byte) (state.PeerAccountHandler, error)
	CommitCalled                    func() ([]byte, error)
	RootHashCalled                  func() ([]byte, error)
}

func (*ValidatorStatisticsProcessorMock) Commit added in v0.0.5

func (vsp *ValidatorStatisticsProcessorMock) Commit() ([]byte, error)

func (*ValidatorStatisticsProcessorMock) GetPeerAccount

func (vsp *ValidatorStatisticsProcessorMock) GetPeerAccount(address []byte) (state.PeerAccountHandler, error)

func (*ValidatorStatisticsProcessorMock) IsInterfaceNil

func (vsp *ValidatorStatisticsProcessorMock) IsInterfaceNil() bool

func (*ValidatorStatisticsProcessorMock) RevertPeerState

func (vsp *ValidatorStatisticsProcessorMock) RevertPeerState(header data.HeaderHandler) error

func (*ValidatorStatisticsProcessorMock) RevertPeerStateToSnapshot added in v1.0.63

func (vsp *ValidatorStatisticsProcessorMock) RevertPeerStateToSnapshot(snapshot int) error

func (*ValidatorStatisticsProcessorMock) RootHash

func (vsp *ValidatorStatisticsProcessorMock) RootHash() ([]byte, error)

func (*ValidatorStatisticsProcessorMock) UpdatePeerState

func (vsp *ValidatorStatisticsProcessorMock) UpdatePeerState(header data.HeaderHandler) ([]byte, error)

Jump to

Keyboard shortcuts

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