mock

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: GPL-3.0 Imports: 31 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

func NewMultipleShardsCoordinatorMock() *multipleShardsCoordinatorMock

func NewNonceHashConverterMock

func NewNonceHashConverterMock() *nonceHashConverterMock

func NewOneShardCoordinatorMock

func NewOneShardCoordinatorMock() *oneShardCoordinatorMock

func NewTopicMessageHandlerStub added in v1.0.3

func NewTopicMessageHandlerStub() *topicMessageHandlerStub

Types

type AccountTrackerStub added in v1.0.3

type AccountTrackerStub struct {
	SaveAccountCalled func(accountHandler state.AccountHandler) error
	JournalizeCalled  func(entry state.JournalEntry)
}

func (*AccountTrackerStub) Journalize added in v1.0.3

func (ats *AccountTrackerStub) Journalize(entry state.JournalEntry)

func (*AccountTrackerStub) SaveAccount added in v1.0.3

func (ats *AccountTrackerStub) SaveAccount(accountHandler state.AccountHandler) error

type AccountWrapMock

type AccountWrapMock struct {
	MockValue int

	SetNonceWithJournalCalled    func(nonce uint64) error    `json:"-"`
	SetCodeHashWithJournalCalled func(codeHash []byte) error `json:"-"`
	SetRootHashWithJournalCalled func([]byte) error          `json:"-"`
	SetCodeWithJournalCalled     func(codeHash []byte) error `json:"-"`
	// contains filtered or unexported fields
}

func NewAccountWrapMock

func NewAccountWrapMock(adr state.AddressContainer, tracker state.AccountTracker) *AccountWrapMock

func (*AccountWrapMock) AddressContainer

func (awm *AccountWrapMock) AddressContainer() state.AddressContainer

func (*AccountWrapMock) DataTrie

func (awm *AccountWrapMock) DataTrie() data.Trie

func (*AccountWrapMock) DataTrieTracker

func (awm *AccountWrapMock) DataTrieTracker() state.DataTrieTracker

func (*AccountWrapMock) GetCode

func (awm *AccountWrapMock) GetCode() []byte

func (*AccountWrapMock) GetCodeHash

func (awm *AccountWrapMock) GetCodeHash() []byte

func (*AccountWrapMock) GetNonce

func (awm *AccountWrapMock) GetNonce() uint64

func (*AccountWrapMock) GetRootHash

func (awm *AccountWrapMock) GetRootHash() []byte

func (*AccountWrapMock) IsInterfaceNil

func (awm *AccountWrapMock) IsInterfaceNil() bool

func (*AccountWrapMock) SetCode

func (awm *AccountWrapMock) SetCode(code []byte)

func (*AccountWrapMock) SetCodeHash

func (awm *AccountWrapMock) SetCodeHash(codeHash []byte)

func (*AccountWrapMock) SetCodeHashWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetCodeHashWithJournal(codeHash []byte) error

func (*AccountWrapMock) SetCodeWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetCodeWithJournal(code []byte) error

func (*AccountWrapMock) SetDataTrie

func (awm *AccountWrapMock) SetDataTrie(trie data.Trie)

func (*AccountWrapMock) SetDataTrieTracker added in v1.0.3

func (awm *AccountWrapMock) SetDataTrieTracker(tracker state.DataTrieTracker)

func (*AccountWrapMock) SetNonce added in v1.0.3

func (awm *AccountWrapMock) SetNonce(nonce uint64)

func (*AccountWrapMock) SetNonceWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetNonceWithJournal(nonce uint64) error

func (*AccountWrapMock) SetRootHash

func (awm *AccountWrapMock) SetRootHash(rootHash []byte)

func (*AccountWrapMock) SetRootHashWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetRootHashWithJournal(rootHash []byte) error

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
	LoadDataTrieCalled          func(acountWrapper state.AccountHandler) 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 NewAccountsStub added in v1.0.3

func NewAccountsStub() *AccountsStub

func (*AccountsStub) AddJournalEntry

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

func (aam *AccountsStub) JournalLen() int

func (*AccountsStub) LoadDataTrie added in v1.0.3

func (aam *AccountsStub) LoadDataTrie(accountHandler state.AccountHandler) error

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

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

type AddressConverterMock

type AddressConverterMock struct {
	Fail                                          bool
	CreateAddressFromPublicKeyBytesRetErrForValue []byte
}

func (*AddressConverterMock) AddressLen

func (acm *AddressConverterMock) AddressLen() int

func (*AddressConverterMock) ConvertToHex

func (acm *AddressConverterMock) ConvertToHex(addressContainer state.AddressContainer) (string, error)

func (*AddressConverterMock) CreateAddressFromHex

func (acm *AddressConverterMock) CreateAddressFromHex(hexAddress string) (state.AddressContainer, error)

func (*AddressConverterMock) CreateAddressFromPublicKeyBytes

func (acm *AddressConverterMock) CreateAddressFromPublicKeyBytes(pubKey []byte) (state.AddressContainer, error)

func (*AddressConverterMock) PrepareAddressBytes

func (acm *AddressConverterMock) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

type AddressConverterStub

type AddressConverterStub struct {
	CreateAddressFromPublicKeyBytesCalled func(pubKey []byte) (state.AddressContainer, error)
	ConvertToHexCalled                    func(addressContainer state.AddressContainer) (string, error)
	CreateAddressFromHexCalled            func(hexAddress string) (state.AddressContainer, error)
	PrepareAddressBytesCalled             func(addressBytes []byte) ([]byte, error)
	AddressLenHandler                     func() int
}

func (AddressConverterStub) AddressLen

func (ac AddressConverterStub) AddressLen() int

func (*AddressConverterStub) ConvertToHex

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

func (*AddressConverterStub) CreateAddressFromHex

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

func (*AddressConverterStub) CreateAddressFromPublicKeyBytes

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

func (*AddressConverterStub) PrepareAddressBytes

func (acs *AddressConverterStub) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

type AddressMock

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

AddressMock is the struct holding a mock address

func NewAddressMock

func NewAddressMock(adr []byte) *AddressMock

NewAddressMock creates a new Address with the same byte slice as the parameter received

func (*AddressMock) Bytes

func (adr *AddressMock) Bytes() []byte

Bytes returns the data corresponding to this address

type ArgumentParserMock

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

func (*ArgumentParserMock) CreateDataFromStorageUpdate

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

func (*ArgumentParserMock) GetArguments

func (ap *ArgumentParserMock) GetArguments() ([]*big.Int, error)

func (*ArgumentParserMock) GetCode

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

func (*ArgumentParserMock) GetFunction

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

func (*ArgumentParserMock) GetSeparator

func (ap *ArgumentParserMock) GetSeparator() string

func (*ArgumentParserMock) GetStorageUpdates

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

func (*ArgumentParserMock) ParseData

func (ap *ArgumentParserMock) ParseData(data []byte) error

type BelNevMock

type BelNevMock struct {
	VerifyMock               func(msg []byte, bitmap []byte) error
	CommitmentHashMock       func(index uint16) ([]byte, error)
	CreateCommitmentMock     func() ([]byte, []byte)
	AggregateCommitmentsMock func(bitmap []byte) error
	CreateSignatureShareMock func(msg []byte, bitmap []byte) ([]byte, error)
	VerifySignatureShareMock func(index uint16, sig []byte, msg []byte, bitmap []byte) error
	AggregateSigsMock        func(bitmap []byte) ([]byte, error)
	StoreCommitmentMock      func(index uint16, value []byte) error
	StoreCommitmentHashMock  func(uint16, []byte) error
	CommitmentMock           func(uint16) ([]byte, error)
	// contains filtered or unexported fields
}

BelNevMock is used to mock belare neven multisignature scheme

func NewMultiSigner

func NewMultiSigner() *BelNevMock

func (*BelNevMock) AggregateCommitments

func (bnm *BelNevMock) AggregateCommitments(bitmap []byte) error

AggregateCommitments aggregates the list of commitments

func (*BelNevMock) AggregateSigs

func (bnm *BelNevMock) AggregateSigs(bitmap []byte) ([]byte, error)

AggregateSigs aggregates all collected partial signatures

func (*BelNevMock) Commitment

func (bnm *BelNevMock) Commitment(index uint16) ([]byte, error)

Commitment returns the commitment from the list with the specified position

func (*BelNevMock) CommitmentHash

func (bnm *BelNevMock) CommitmentHash(index uint16) ([]byte, error)

CommitmentHash returns the commitment hash from the list on the specified position

func (*BelNevMock) Create

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

Create resets the multiSigner and initializes corresponding fields with the given params

func (*BelNevMock) CreateCommitment

func (bnm *BelNevMock) CreateCommitment() (commSecret []byte, commitment []byte)

CreateCommitment creates a secret commitment and the corresponding public commitment point

func (*BelNevMock) CreateSignatureShare

func (bnm *BelNevMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)

CreateSignatureShare creates a partial signature

func (*BelNevMock) Reset

func (bnm *BelNevMock) Reset(pubKeys []string, index uint16) error

Reset

func (*BelNevMock) SetAggregatedSig

func (bnm *BelNevMock) SetAggregatedSig(aggSig []byte) error

SetAggregatedSig sets the aggregated signature according to the given byte array

func (*BelNevMock) SetMessage

func (bnm *BelNevMock) SetMessage(msg []byte) error

SetMessage sets the message to be signed

func (*BelNevMock) SignatureShare

func (bnm *BelNevMock) SignatureShare(index uint16) ([]byte, error)

SignatureShare

func (*BelNevMock) StoreCommitment

func (bnm *BelNevMock) StoreCommitment(index uint16, value []byte) error

StoreCommitment adds a commitment to the list on the specified position

func (*BelNevMock) StoreCommitmentHash

func (bnm *BelNevMock) StoreCommitmentHash(index uint16, commHash []byte) error

StoreCommitmentHash adds a commitment hash to the list on the specified position

func (*BelNevMock) StoreSignatureShare

func (bnm *BelNevMock) StoreSignatureShare(index uint16, sig []byte) error

StoreSignatureShare adds the partial signature of the signer with specified position

func (*BelNevMock) Verify

func (bnm *BelNevMock) Verify(msg []byte, bitmap []byte) error

Verify returns nil if the aggregateed signature is verified for the given public keys

func (*BelNevMock) VerifySignatureShare

func (bnm *BelNevMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error

VerifySignatureShare verifies the partial signature of the signer with specified position

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 percieved 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) 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 percieved height of the network chain

type BlockProcessorMock

type BlockProcessorMock 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)
	CreateBlockCalled           func(round uint32, haveTime func() bool) (data.BodyHandler, error)
	RestoreBlockIntoPoolsCalled func(header data.HeaderHandler, body data.BodyHandler) error

	SetOnRequestTransactionCalled    func(f func(destShardID uint32, txHash []byte))
	CreateBlockHeaderCalled          func(body data.BodyHandler, round uint32, haveTime func() bool) (data.HeaderHandler, error)
	MarshalizedDataToBroadcastCalled func(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[uint32][][]byte, error)
	DecodeBlockBodyCalled            func(dta []byte) data.BodyHandler
	DecodeBlockHeaderCalled          func(dta []byte) data.HeaderHandler
	SetLastNotarizedHdrCalled        func(shardId uint32, processedHdr data.HeaderHandler)
	// contains filtered or unexported fields
}

func (*BlockProcessorMock) CommitBlock

func (bpm *BlockProcessorMock) CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error

func (BlockProcessorMock) CreateBlockBody added in v1.0.3

func (blProcMock BlockProcessorMock) CreateBlockBody(round uint32, haveTime func() bool) (data.BodyHandler, error)

func (BlockProcessorMock) CreateBlockHeader added in v1.0.3

func (blProcMock BlockProcessorMock) CreateBlockHeader(body data.BodyHandler, round uint32, haveTime func() bool) (data.HeaderHandler, error)

func (BlockProcessorMock) CreateGenesisBlock

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

func (BlockProcessorMock) DecodeBlockBody

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

func (BlockProcessorMock) DecodeBlockHeader

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

func (BlockProcessorMock) MarshalizedDataToBroadcast

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

func (*BlockProcessorMock) ProcessBlock

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

func (BlockProcessorMock) RestoreBlockIntoPools

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

func (*BlockProcessorMock) RevertAccountState

func (bpm *BlockProcessorMock) RevertAccountState()

func (BlockProcessorMock) SetLastNotarizedHdr added in v1.0.3

func (blProcMock BlockProcessorMock) SetLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)

type BlocksTrackerMock added in v1.0.3

type BlocksTrackerMock struct {
	UnnotarisedBlocksCalled      func() []data.HeaderHandler
	RemoveNotarisedBlocksCalled  func(headerHandler data.HeaderHandler) error
	AddBlockCalled               func(headerHandler data.HeaderHandler)
	SetBlockBroadcastRoundCalled func(nonce uint64, round int32)
	BlockBroadcastRoundCalled    func(nonce uint64) int32
}

func (*BlocksTrackerMock) AddBlock added in v1.0.3

func (btm *BlocksTrackerMock) AddBlock(headerHandler data.HeaderHandler)

func (*BlocksTrackerMock) BlockBroadcastRound added in v1.0.3

func (btm *BlocksTrackerMock) BlockBroadcastRound(nonce uint64) int32

func (*BlocksTrackerMock) RemoveNotarisedBlocks added in v1.0.3

func (btm *BlocksTrackerMock) RemoveNotarisedBlocks(headerHandler data.HeaderHandler) error

func (*BlocksTrackerMock) SetBlockBroadcastRound added in v1.0.3

func (btm *BlocksTrackerMock) SetBlockBroadcastRound(nonce uint64, round int32)

func (*BlocksTrackerMock) UnnotarisedBlocks added in v1.0.3

func (btm *BlocksTrackerMock) UnnotarisedBlocks() []data.HeaderHandler

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

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

func (*CacherStub) Len

func (cs *CacherStub) Len() 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 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) 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 ChronologyValidatorStub added in v1.0.3

type ChronologyValidatorStub struct {
	ValidateReceivedBlockCalled func(shardID uint32, epoch uint32, nonce uint64, round uint32) error
}

func (*ChronologyValidatorStub) ValidateReceivedBlock added in v1.0.3

func (cvs *ChronologyValidatorStub) ValidateReceivedBlock(shardID uint32, epoch uint32, nonce uint64, round uint32) error

type CoordinatorStub

type CoordinatorStub struct {
	NumberOfShardsCalled          func() uint32
	ComputeIdCalled               func(address state.AddressContainer) uint32
	SelfIdCalled                  func() uint32
	SameShardCalled               func(firstAddress, secondAddress state.AddressContainer) bool
	CommunicationIdentifierCalled func(destShardID uint32) string
}

func (*CoordinatorStub) CommunicationIdentifier

func (coordinator *CoordinatorStub) CommunicationIdentifier(destShardID uint32) string

func (*CoordinatorStub) ComputeId

func (coordinator *CoordinatorStub) ComputeId(address state.AddressContainer) uint32

func (*CoordinatorStub) NumberOfShards

func (coordinator *CoordinatorStub) NumberOfShards() uint32

func (*CoordinatorStub) SameShard

func (coordinator *CoordinatorStub) SameShard(firstAddress, secondAddress state.AddressContainer) bool

func (*CoordinatorStub) SelfId

func (coordinator *CoordinatorStub) SelfId() uint32

type ForkDetectorMock

type ForkDetectorMock struct {
	AddHeaderCalled                 func(header data.HeaderHandler, hash []byte, state process.BlockHeaderState) error
	RemoveHeadersCalled             func(nonce uint64, hash []byte)
	CheckForkCalled                 func() (bool, uint64)
	GetHighestFinalBlockNonceCalled func() uint64
	ProbableHighestNonceCalled      func() uint64
}

func (*ForkDetectorMock) AddHeader

func (fdm *ForkDetectorMock) AddHeader(header data.HeaderHandler, hash []byte, state process.BlockHeaderState) error

func (*ForkDetectorMock) CheckFork

func (fdm *ForkDetectorMock) CheckFork() (bool, uint64)

func (*ForkDetectorMock) GetHighestFinalBlockNonce

func (fdm *ForkDetectorMock) GetHighestFinalBlockNonce() uint64

func (*ForkDetectorMock) ProbableHighestNonce

func (fdm *ForkDetectorMock) ProbableHighestNonce() uint64

func (*ForkDetectorMock) RemoveHeaders added in v1.0.3

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

type HasherMock

type HasherMock struct {
}

HasherMock that will be used for testing

func (HasherMock) Compute

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

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

func (HasherMock) EmptyHash

func (sha HasherMock) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (HasherMock) Size

func (HasherMock) Size() int

Size returns the required size in bytes

type HasherStub

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

func (HasherStub) Compute

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

func (HasherStub) EmptyHash

func (hash HasherStub) EmptyHash() []byte

func (HasherStub) Size

func (HasherStub) Size() int

type HeaderHandlerStub

type HeaderHandlerStub struct {
	GetMiniBlockHeadersWithDstCalled func(destId uint32) map[string]uint32
}

func (*HeaderHandlerStub) GetEpoch

func (hhs *HeaderHandlerStub) GetEpoch() uint32

func (*HeaderHandlerStub) GetMiniBlockHeadersWithDst

func (hhs *HeaderHandlerStub) GetMiniBlockHeadersWithDst(destId uint32) map[string]uint32

func (*HeaderHandlerStub) GetMiniBlockProcessed

func (hhs *HeaderHandlerStub) GetMiniBlockProcessed(hash []byte) bool

func (*HeaderHandlerStub) GetNonce

func (hhs *HeaderHandlerStub) GetNonce() uint64

func (*HeaderHandlerStub) GetPrevHash

func (hhs *HeaderHandlerStub) GetPrevHash() []byte

func (*HeaderHandlerStub) GetPrevRandSeed

func (hhs *HeaderHandlerStub) GetPrevRandSeed() []byte

func (*HeaderHandlerStub) GetPubKeysBitmap

func (hhs *HeaderHandlerStub) GetPubKeysBitmap() []byte

func (*HeaderHandlerStub) GetRandSeed

func (hhs *HeaderHandlerStub) GetRandSeed() []byte

func (*HeaderHandlerStub) GetRootHash

func (hhs *HeaderHandlerStub) GetRootHash() []byte

func (*HeaderHandlerStub) GetRound

func (hhs *HeaderHandlerStub) GetRound() uint32

func (*HeaderHandlerStub) GetShardID

func (hhs *HeaderHandlerStub) GetShardID() uint32

func (*HeaderHandlerStub) GetSignature

func (hhs *HeaderHandlerStub) GetSignature() []byte

func (*HeaderHandlerStub) GetTimeStamp

func (hhs *HeaderHandlerStub) GetTimeStamp() uint64

func (*HeaderHandlerStub) GetTxCount

func (hhs *HeaderHandlerStub) GetTxCount() uint32

func (*HeaderHandlerStub) IsInterfaceNil

func (hhs *HeaderHandlerStub) IsInterfaceNil() bool

IsInterfaceNil return if there is no value under the interface

func (*HeaderHandlerStub) SetEpoch

func (hhs *HeaderHandlerStub) SetEpoch(e uint32)

func (*HeaderHandlerStub) SetMiniBlockProcessed

func (hhs *HeaderHandlerStub) SetMiniBlockProcessed(hash []byte, processed bool)

func (*HeaderHandlerStub) SetNonce

func (hhs *HeaderHandlerStub) SetNonce(n uint64)

func (*HeaderHandlerStub) SetPrevHash

func (hhs *HeaderHandlerStub) SetPrevHash(pvHash []byte)

func (*HeaderHandlerStub) SetPrevRandSeed

func (hhs *HeaderHandlerStub) SetPrevRandSeed(pvRandSeed []byte)

func (*HeaderHandlerStub) SetPubKeysBitmap

func (hhs *HeaderHandlerStub) SetPubKeysBitmap(pkbm []byte)

func (*HeaderHandlerStub) SetRandSeed

func (hhs *HeaderHandlerStub) SetRandSeed(randSeed []byte)

func (*HeaderHandlerStub) SetRootHash

func (hhs *HeaderHandlerStub) SetRootHash(rHash []byte)

func (*HeaderHandlerStub) SetRound

func (hhs *HeaderHandlerStub) SetRound(r uint32)

func (*HeaderHandlerStub) SetSignature

func (hhs *HeaderHandlerStub) SetSignature(sg []byte)

func (*HeaderHandlerStub) SetTimeStamp

func (hhs *HeaderHandlerStub) SetTimeStamp(ts uint64)

func (*HeaderHandlerStub) SetTxCount

func (hhs *HeaderHandlerStub) SetTxCount(txCount uint32)

type HeaderResolverMock

type HeaderResolverMock struct {
	RequestDataFromHashCalled    func(hash []byte) error
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
	RequestDataFromNonceCalled   func(nonce uint64) error
}

func (*HeaderResolverMock) ProcessReceivedMessage

func (hrm *HeaderResolverMock) ProcessReceivedMessage(message p2p.MessageP2P) error

func (*HeaderResolverMock) RequestDataFromHash

func (hrm *HeaderResolverMock) RequestDataFromHash(hash []byte) error

func (*HeaderResolverMock) RequestDataFromNonce

func (hrm *HeaderResolverMock) RequestDataFromNonce(nonce uint64) error

type InterceptorStub

type InterceptorStub struct {
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
}

func (*InterceptorStub) ProcessReceivedMessage

func (is *InterceptorStub) ProcessReceivedMessage(message p2p.MessageP2P) error

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) Marshal

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

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal

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

Unmarshal applies the serialized values over an instantiated object

type MarshalizerStub

type MarshalizerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

func (*MarshalizerStub) Marshal

func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)

func (*MarshalizerStub) Unmarshal

func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error

type MessageHandlerStub

type MessageHandlerStub struct {
	ConnectedPeersOnTopicCalled func(topic string) []p2p.PeerID
	SendToConnectedPeerCalled   func(topic string, buff []byte, peerID p2p.PeerID) error
}

func (*MessageHandlerStub) ConnectedPeersOnTopic

func (mhs *MessageHandlerStub) ConnectedPeersOnTopic(topic string) []p2p.PeerID

func (*MessageHandlerStub) SendToConnectedPeer

func (mhs *MessageHandlerStub) SendToConnectedPeer(topic string, buff []byte, peerID p2p.PeerID) error

type MessengerStub

type MessengerStub struct {
	CloseCalled                       func() error
	IDCalled                          func() p2p.PeerID
	PeersCalled                       func() []p2p.PeerID
	AddressesCalled                   func() []string
	ConnectToPeerCalled               func(address string) error
	TrimConnectionsCalled             func()
	IsConnectedCalled                 func(peerID p2p.PeerID) bool
	ConnectedPeersCalled              func() []p2p.PeerID
	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
	UnregisterMessageProcessorCalled  func(topic string) error
	SendToConnectedPeerCalled         func(topic string, buff []byte, peerID p2p.PeerID) error
	OutgoingChannelLoadBalancerCalled func() p2p.ChannelLoadBalancer
	BootstrapCalled                   func() error
}

func (*MessengerStub) Addresses

func (ms *MessengerStub) Addresses() []string

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

func (ms *MessengerStub) Close() error

func (*MessengerStub) ConnectToPeer

func (ms *MessengerStub) ConnectToPeer(address string) error

func (*MessengerStub) ConnectedPeers

func (ms *MessengerStub) ConnectedPeers() []p2p.PeerID

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

func (ms *MessengerStub) ID() p2p.PeerID

func (*MessengerStub) IsConnected

func (ms *MessengerStub) IsConnected(peerID p2p.PeerID) bool

func (*MessengerStub) OutgoingChannelLoadBalancer

func (ms *MessengerStub) OutgoingChannelLoadBalancer() p2p.ChannelLoadBalancer

func (*MessengerStub) Peers

func (ms *MessengerStub) Peers() []p2p.PeerID

func (*MessengerStub) RegisterMessageProcessor

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

func (*MessengerStub) SendToConnectedPeer

func (ms *MessengerStub) SendToConnectedPeer(topic string, buff []byte, peerID p2p.PeerID) error

func (*MessengerStub) TrimConnections

func (ms *MessengerStub) TrimConnections()

func (*MessengerStub) UnregisterMessageProcessor

func (ms *MessengerStub) UnregisterMessageProcessor(topic string) error

type MetaPoolsHolderFake added in v1.0.3

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

func NewMetaPoolsHolderFake added in v1.0.3

func NewMetaPoolsHolderFake() *MetaPoolsHolderFake

func (*MetaPoolsHolderFake) MetaBlockNonces added in v1.0.3

func (mphf *MetaPoolsHolderFake) MetaBlockNonces() dataRetriever.Uint64Cacher

func (*MetaPoolsHolderFake) MetaChainBlocks added in v1.0.3

func (mphf *MetaPoolsHolderFake) MetaChainBlocks() storage.Cacher

func (*MetaPoolsHolderFake) MiniBlockHashes added in v1.0.3

func (*MetaPoolsHolderFake) ShardHeaders added in v1.0.3

func (mphf *MetaPoolsHolderFake) ShardHeaders() storage.Cacher

func (*MetaPoolsHolderFake) ShardHeadersNonces added in v1.0.3

func (mphf *MetaPoolsHolderFake) ShardHeadersNonces() dataRetriever.Uint64Cacher

type MetaPoolsHolderStub added in v1.0.3

type MetaPoolsHolderStub struct {
	MetaChainBlocksCalled    func() storage.Cacher
	MiniBlockHashesCalled    func() dataRetriever.ShardedDataCacherNotifier
	ShardHeadersCalled       func() storage.Cacher
	ShardHeadersNoncesCalled func() dataRetriever.Uint64Cacher
	MetaBlockNoncesCalled    func() dataRetriever.Uint64Cacher
}

func (*MetaPoolsHolderStub) MetaBlockNonces added in v1.0.3

func (mphs *MetaPoolsHolderStub) MetaBlockNonces() dataRetriever.Uint64Cacher

func (*MetaPoolsHolderStub) MetaChainBlocks added in v1.0.3

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

func (*MetaPoolsHolderStub) MiniBlockHashes added in v1.0.3

func (*MetaPoolsHolderStub) ShardHeaders added in v1.0.3

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

func (*MetaPoolsHolderStub) ShardHeadersNonces added in v1.0.3

func (mphs *MetaPoolsHolderStub) ShardHeadersNonces() dataRetriever.Uint64Cacher

type MiniBlocksResolverMock

type MiniBlocksResolverMock struct {
	RequestDataFromHashCalled      func(hash []byte) error
	RequestDataFromHashArrayCalled func(hashes [][]byte) error
	ProcessReceivedMessageCalled   func(message p2p.MessageP2P) error
	GetMiniBlocksCalled            func(hashes [][]byte) block.MiniBlockSlice
}

func (*MiniBlocksResolverMock) GetMiniBlocks

func (hrm *MiniBlocksResolverMock) GetMiniBlocks(hashes [][]byte) block.MiniBlockSlice

func (*MiniBlocksResolverMock) ProcessReceivedMessage

func (hrm *MiniBlocksResolverMock) ProcessReceivedMessage(message p2p.MessageP2P) error

func (*MiniBlocksResolverMock) RequestDataFromHash

func (hrm *MiniBlocksResolverMock) RequestDataFromHash(hash []byte) error

func (*MiniBlocksResolverMock) RequestDataFromHashArray

func (hrm *MiniBlocksResolverMock) RequestDataFromHashArray(hashes [][]byte) error

type ObjectsContainerStub

type ObjectsContainerStub struct {
	GetCalled     func(key string) (interface{}, error)
	AddCalled     func(key string, val interface{}) error
	ReplaceCalled func(key string, val interface{}) error
	RemoveCalled  func(key string)
	LenCalled     func() int
}

func (*ObjectsContainerStub) Add

func (ocs *ObjectsContainerStub) Add(key string, val interface{}) error

func (*ObjectsContainerStub) Get

func (ocs *ObjectsContainerStub) Get(key string) (interface{}, error)

func (*ObjectsContainerStub) Len

func (ocs *ObjectsContainerStub) Len() int

func (*ObjectsContainerStub) Remove

func (ocs *ObjectsContainerStub) Remove(key string)

func (*ObjectsContainerStub) Replace

func (ocs *ObjectsContainerStub) Replace(key string, val interface{}) 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) 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.3

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

type PoolsHolderFake added in v1.0.3

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

func NewPoolsHolderFake added in v1.0.3

func NewPoolsHolderFake() *PoolsHolderFake

func (*PoolsHolderFake) Headers added in v1.0.3

func (phf *PoolsHolderFake) Headers() storage.Cacher

func (*PoolsHolderFake) HeadersNonces added in v1.0.3

func (phf *PoolsHolderFake) HeadersNonces() dataRetriever.Uint64Cacher

func (*PoolsHolderFake) MetaBlocks added in v1.0.3

func (phf *PoolsHolderFake) MetaBlocks() storage.Cacher

func (*PoolsHolderFake) MetaHeadersNonces added in v1.0.3

func (phf *PoolsHolderFake) MetaHeadersNonces() dataRetriever.Uint64Cacher

func (*PoolsHolderFake) MiniBlocks added in v1.0.3

func (phf *PoolsHolderFake) MiniBlocks() storage.Cacher

func (*PoolsHolderFake) PeerChangesBlocks added in v1.0.3

func (phf *PoolsHolderFake) PeerChangesBlocks() storage.Cacher

func (*PoolsHolderFake) SetTransactions added in v1.0.3

func (phf *PoolsHolderFake) SetTransactions(transactions dataRetriever.ShardedDataCacherNotifier)

func (*PoolsHolderFake) SmartContractResults added in v1.0.3

func (phf *PoolsHolderFake) SmartContractResults() dataRetriever.ShardedDataCacherNotifier

func (*PoolsHolderFake) Transactions added in v1.0.3

type PoolsHolderStub

type PoolsHolderStub struct {
	HeadersCalled              func() storage.Cacher
	HeadersNoncesCalled        func() dataRetriever.Uint64Cacher
	PeerChangesBlocksCalled    func() storage.Cacher
	TransactionsCalled         func() dataRetriever.ShardedDataCacherNotifier
	SmartContractResultsCalled func() dataRetriever.ShardedDataCacherNotifier
	MiniBlocksCalled           func() storage.Cacher
	MetaBlocksCalled           func() storage.Cacher
	MetaHeadersNoncesCalled    func() dataRetriever.Uint64Cacher
}

func (*PoolsHolderStub) Headers

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

func (*PoolsHolderStub) HeadersNonces added in v1.0.3

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

func (*PoolsHolderStub) MetaBlocks

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

func (*PoolsHolderStub) MetaHeadersNonces added in v1.0.3

func (phs *PoolsHolderStub) MetaHeadersNonces() dataRetriever.Uint64Cacher

func (*PoolsHolderStub) MiniBlocks

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

func (*PoolsHolderStub) PeerChangesBlocks

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

func (*PoolsHolderStub) SmartContractResults added in v1.0.3

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

func (*PoolsHolderStub) Transactions

type RequestHandlerMock added in v1.0.3

type RequestHandlerMock struct {
	RequestTransactionHandlerCalled   func(destShardID uint32, txHashes [][]byte)
	RequestScrHandlerCalled           func(destShardID uint32, txHashes [][]byte)
	RequestMiniBlockHandlerCalled     func(destShardID uint32, miniblockHash []byte)
	RequestHeaderHandlerCalled        func(destShardID uint32, hash []byte)
	RequestHeaderHandlerByNonceCalled func(destShardID uint32, nonce uint64)
}

func (*RequestHandlerMock) RequestHeader added in v1.0.3

func (rrh *RequestHandlerMock) RequestHeader(shardId uint32, hash []byte)

func (*RequestHandlerMock) RequestHeaderByNonce added in v1.0.3

func (rrh *RequestHandlerMock) RequestHeaderByNonce(destShardID uint32, nonce uint64)

func (*RequestHandlerMock) RequestMiniBlock added in v1.0.3

func (rrh *RequestHandlerMock) RequestMiniBlock(shardId uint32, miniblockHash []byte)

func (*RequestHandlerMock) RequestSmartContractResults added in v1.0.3

func (rrh *RequestHandlerMock) RequestSmartContractResults(destShardID uint32, txHashes [][]byte)

func (*RequestHandlerMock) RequestTransaction added in v1.0.3

func (rrh *RequestHandlerMock) RequestTransaction(destShardID uint32, txHashes [][]byte)

type ResolverStub

type ResolverStub struct {
	RequestDataFromHashCalled    func(hash []byte) error
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
}

func (*ResolverStub) ProcessReceivedMessage

func (rs *ResolverStub) ProcessReceivedMessage(message p2p.MessageP2P) error

func (*ResolverStub) RequestDataFromHash

func (rs *ResolverStub) RequestDataFromHash(hash []byte) error

type ResolversContainerStub

type ResolversContainerStub 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
}

func (*ResolversContainerStub) Add

func (*ResolversContainerStub) AddMultiple

func (rcs *ResolversContainerStub) AddMultiple(keys []string, resolvers []dataRetriever.Resolver) error

func (*ResolversContainerStub) Get

func (*ResolversContainerStub) Len

func (rcs *ResolversContainerStub) Len() int

func (*ResolversContainerStub) Remove

func (rcs *ResolversContainerStub) Remove(key string)

func (*ResolversContainerStub) Replace

func (rcs *ResolversContainerStub) Replace(key string, val dataRetriever.Resolver) error

type ResolversFinderStub

type ResolversFinderStub struct {
	ResolversContainerStub
	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) CrossShardResolver

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

func (*ResolversFinderStub) IntraShardResolver

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

func (*ResolversFinderStub) MetaChainResolver

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

type RoundStub

type RoundStub struct {
	IndexCalled         func() int32
	TimeDurationCalled  func() time.Duration
	TimeStampCalled     func() time.Time
	UpdateRoundCalled   func(time.Time, time.Time)
	RemainingTimeCalled func(time.Time, time.Duration) time.Duration
}

func (*RoundStub) Index

func (rnds *RoundStub) Index() int32

func (*RoundStub) RemainingTime

func (rnds *RoundStub) RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration

func (*RoundStub) TimeDuration

func (rnds *RoundStub) TimeDuration() time.Duration

func (*RoundStub) TimeStamp

func (rnds *RoundStub) TimeStamp() time.Time

func (*RoundStub) UpdateRound

func (rnds *RoundStub) UpdateRound(genesisRoundTimeStamp time.Time, timeStamp time.Time)

type RounderMock

type RounderMock struct {
	RoundIndex        int32
	RoundTimeStamp    time.Time
	RoundTimeDuration time.Duration
}

func (*RounderMock) Index

func (rndm *RounderMock) Index() int32

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 SCProcessorMock

type SCProcessorMock struct {
	ComputeTransactionTypeCalled          func(tx *transaction.Transaction) (process.TransactionType, error)
	ExecuteSmartContractTransactionCalled func(tx *transaction.Transaction, acntSrc, acntDst state.AccountHandler, round uint32) ([]*smartContractResult.SmartContractResult, error)
	DeploySmartContractCalled             func(tx *transaction.Transaction, acntSrc state.AccountHandler, round uint32) ([]*smartContractResult.SmartContractResult, error)
	ProcessSmartContractResultCalled      func(scr *smartContractResult.SmartContractResult) error
}

func (*SCProcessorMock) ComputeTransactionType

func (sc *SCProcessorMock) ComputeTransactionType(
	tx *transaction.Transaction,
) (process.TransactionType, error)

func (*SCProcessorMock) DeploySmartContract

func (sc *SCProcessorMock) DeploySmartContract(
	tx *transaction.Transaction,
	acntSrc state.AccountHandler,
	round uint32,
) ([]*smartContractResult.SmartContractResult, error)

func (*SCProcessorMock) ExecuteSmartContractTransaction

func (sc *SCProcessorMock) ExecuteSmartContractTransaction(
	tx *transaction.Transaction,
	acntSrc, acntDst state.AccountHandler,
	round uint32,
) ([]*smartContractResult.SmartContractResult, error)

func (*SCProcessorMock) ProcessSmartContractResult

func (sc *SCProcessorMock) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error

type ServiceContainerMock

type ServiceContainerMock struct {
	IndexerCalled      func() indexer.Indexer
	TPSBenchmarkCalled func() statistics.TPSBenchmark
}

ServiceContainerMock is a mock implementation of the Core interface

func (*ServiceContainerMock) Indexer

func (scm *ServiceContainerMock) Indexer() indexer.Indexer

Indexer returns a mock implementation for core.Indexer

func (*ServiceContainerMock) TPSBenchmark

func (scm *ServiceContainerMock) TPSBenchmark() statistics.TPSBenchmark

TPSBenchmark returns a mock implementation for core.TPSBenchmark

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

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

func (*SignerMock) Sign

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

func (*SignerMock) Verify

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

type SingleSignKeyGenMock

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

func (*SingleSignKeyGenMock) GeneratePair

func (sskgm *SingleSignKeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)

func (*SingleSignKeyGenMock) PrivateKeyFromByteArray

func (sskgm *SingleSignKeyGenMock) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)

func (*SingleSignKeyGenMock) PublicKeyFromByteArray

func (sskgm *SingleSignKeyGenMock) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)

func (*SingleSignKeyGenMock) Suite

func (sskgm *SingleSignKeyGenMock) Suite() crypto.Suite

type SingleSignPublicKey

type SingleSignPublicKey struct {
	SuiteCalled func() crypto.Suite
	PointCalled func() crypto.Point
}

func (*SingleSignPublicKey) Point

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

func (*SingleSignPublicKey) Suite

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

func (*SingleSignPublicKey) ToByteArray

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

type StorerStub

type StorerStub struct {
	PutCalled         func(key, data []byte) error
	GetCalled         func(key []byte) ([]byte, error)
	HasCalled         func(key []byte) error
	HasOrAddCalled    func(key []byte, value []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) HasOrAdd added in v1.0.3

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

func (*StorerStub) Put

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

func (*StorerStub) Remove

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

type SyncTimerMock

type SyncTimerMock struct {
	ClockOffsetCalled func() time.Duration
	CurrentTimeCalled func() time.Time
}

SyncTimerMock mocks the implementation for a SyncTimer

func (SyncTimerMock) ClockOffset

func (stm SyncTimerMock) ClockOffset() time.Duration

ClockOffset method gets the current time offset

func (SyncTimerMock) CurrentTime

func (stm SyncTimerMock) CurrentTime() time.Time

CurrentTime method gets the current time on which is added the current offset

func (SyncTimerMock) FormattedCurrentTime

func (stm SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime method gets the formatted current time on which is added a given offset

func (SyncTimerMock) StartSync

func (stm SyncTimerMock) StartSync()

StartSync method does the time synchronization at every syncPeriod time elapsed. This should be started as a go routine

type TemporaryAccountsHandlerMock

type TemporaryAccountsHandlerMock struct {
	AddTempAccountCalled    func(address []byte, balance *big.Int, nonce uint64)
	CleanTempAccountsCalled func()
	TempAccountCalled       func(address []byte) state.AccountHandler
}

func (*TemporaryAccountsHandlerMock) AddTempAccount

func (tahm *TemporaryAccountsHandlerMock) AddTempAccount(address []byte, balance *big.Int, nonce uint64)

func (*TemporaryAccountsHandlerMock) CleanTempAccounts

func (tahm *TemporaryAccountsHandlerMock) CleanTempAccounts()

func (*TemporaryAccountsHandlerMock) TempAccount

func (tahm *TemporaryAccountsHandlerMock) TempAccount(address []byte) state.AccountHandler

type TopicHandlerStub

type TopicHandlerStub struct {
	HasTopicCalled                 func(name string) bool
	CreateTopicCalled              func(name string, createChannelForTopic bool) error
	RegisterMessageProcessorCalled func(topic string, handler p2p.MessageProcessor) error
}

func (*TopicHandlerStub) CreateTopic

func (ths *TopicHandlerStub) CreateTopic(name string, createChannelForTopic bool) error

func (*TopicHandlerStub) HasTopic

func (ths *TopicHandlerStub) HasTopic(name string) bool

func (*TopicHandlerStub) RegisterMessageProcessor

func (ths *TopicHandlerStub) RegisterMessageProcessor(topic string, handler p2p.MessageProcessor) error

type TransactionInterceptorMock

type TransactionInterceptorMock struct {
	IsChecked                   bool
	IsVerified                  bool
	RcvShardVal                 uint32
	SndShardVal                 uint32
	IsAddressedToOtherShardsVal bool
	AddrConverter               state.AddressConverter
	Tx                          *transaction.Transaction
	// contains filtered or unexported fields
}

func (*TransactionInterceptorMock) AddressConverter

func (tim *TransactionInterceptorMock) AddressConverter() state.AddressConverter

func (*TransactionInterceptorMock) Check

func (tim *TransactionInterceptorMock) Check() bool

func (*TransactionInterceptorMock) GetTransaction

func (tim *TransactionInterceptorMock) GetTransaction() *transaction.Transaction

func (*TransactionInterceptorMock) Hash

func (tim *TransactionInterceptorMock) Hash() []byte

func (*TransactionInterceptorMock) ID

func (*TransactionInterceptorMock) IsAddressedToOtherShards

func (tim *TransactionInterceptorMock) IsAddressedToOtherShards() bool

func (*TransactionInterceptorMock) RcvShard

func (tim *TransactionInterceptorMock) RcvShard() uint32

func (*TransactionInterceptorMock) SetAddressConverter

func (tim *TransactionInterceptorMock) SetAddressConverter(converter state.AddressConverter)

func (*TransactionInterceptorMock) SetHash

func (tim *TransactionInterceptorMock) SetHash(hash []byte)

func (*TransactionInterceptorMock) SndShard

func (tim *TransactionInterceptorMock) SndShard() uint32

func (*TransactionInterceptorMock) VerifySig

func (tim *TransactionInterceptorMock) VerifySig() bool

type TransactionPoolMock

type TransactionPoolMock struct {
	RegisterTransactionHandlerCalled func(transactionHandler func(txHash []byte))
	RemoveTransactionsFromPoolCalled func(txHashes [][]byte, destShardID uint32)
	MiniPoolTxStoreCalled            func(shardID uint32) (c storage.Cacher)
}

func (*TransactionPoolMock) MiniPoolTxStore

func (tpm *TransactionPoolMock) MiniPoolTxStore(shardID uint32) (c storage.Cacher)

func (*TransactionPoolMock) RegisterTransactionHandler

func (tpm *TransactionPoolMock) RegisterTransactionHandler(transactionHandler func(txHash []byte))

func (*TransactionPoolMock) RemoveTransactionsFromPool

func (tpm *TransactionPoolMock) RemoveTransactionsFromPool(txHashes [][]byte, destShardID uint32)

type TxProcessorMock

type TxProcessorMock struct {
	ProcessTransactionCalled         func(transaction *transaction.Transaction, round uint32) ([]*smartContractResult.SmartContractResult, error)
	SetBalancesToTrieCalled          func(accBalance map[string]*big.Int) (rootHash []byte, err error)
	ProcessSmartContractResultCalled func(scr *smartContractResult.SmartContractResult) error
}

func (*TxProcessorMock) ProcessSmartContractResult

func (etm *TxProcessorMock) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error

func (*TxProcessorMock) ProcessTransaction

func (etm *TxProcessorMock) ProcessTransaction(transaction *transaction.Transaction, round uint32) ([]*smartContractResult.SmartContractResult, error)

func (*TxProcessorMock) SetBalancesToTrie

func (etm *TxProcessorMock) SetBalancesToTrie(accBalance map[string]*big.Int) (rootHash []byte, err error)

type Uint64ByteSliceConverterMock

type Uint64ByteSliceConverterMock struct {
	ToByteSliceCalled func(uint64) []byte
	ToUint64Called    func([]byte) (uint64, error)
}

Uint64ByteSliceConverterMock converts byte slice to/from uint64

func (*Uint64ByteSliceConverterMock) ToByteSlice

func (u *Uint64ByteSliceConverterMock) ToByteSlice(p uint64) []byte

ToByteSlice is a mock implementation for Uint64ByteSliceConverter

func (*Uint64ByteSliceConverterMock) ToUint64

func (u *Uint64ByteSliceConverterMock) ToUint64(p []byte) (uint64, error)

ToUint64 is a mock implementation for Uint64ByteSliceConverter

type Uint64CacherStub added in v1.0.3

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

func (*Uint64CacherStub) Clear added in v1.0.3

func (ucs *Uint64CacherStub) Clear()

func (*Uint64CacherStub) Get added in v1.0.3

func (ucs *Uint64CacherStub) Get(nonce uint64) (interface{}, bool)

func (*Uint64CacherStub) Has added in v1.0.3

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

func (*Uint64CacherStub) HasOrAdd added in v1.0.3

func (ucs *Uint64CacherStub) HasOrAdd(nonce uint64, value interface{}) (bool, bool)

func (*Uint64CacherStub) Keys added in v1.0.3

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

func (*Uint64CacherStub) Len added in v1.0.3

func (ucs *Uint64CacherStub) Len() int

func (*Uint64CacherStub) Peek added in v1.0.3

func (ucs *Uint64CacherStub) Peek(nonce uint64) (interface{}, bool)

func (*Uint64CacherStub) Put added in v1.0.3

func (ucs *Uint64CacherStub) Put(nonce uint64, value interface{}) bool

func (*Uint64CacherStub) RegisterHandler added in v1.0.3

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

func (*Uint64CacherStub) Remove added in v1.0.3

func (ucs *Uint64CacherStub) Remove(nonce uint64)

func (*Uint64CacherStub) RemoveOldest added in v1.0.3

func (ucs *Uint64CacherStub) RemoveOldest()

type VMExecutionHandlerStub

type VMExecutionHandlerStub struct {
	G0CreateCalled               func(input *vmcommon.ContractCreateInput) (*big.Int, error)
	G0CallCalled                 func(input *vmcommon.ContractCallInput) (*big.Int, error)
	RunSmartContractCreateCalled func(input *vmcommon.ContractCreateInput) (*vmcommon.VMOutput, error)
	RunSmartContractCallCalled   func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
}

func (*VMExecutionHandlerStub) G0Call added in v1.0.3

func (vm *VMExecutionHandlerStub) G0Call(input *vmcommon.ContractCallInput) (*big.Int, error)

G0Call yields the initial gas cost of calling an existing smart contract

func (*VMExecutionHandlerStub) G0Create added in v1.0.3

func (vm *VMExecutionHandlerStub) G0Create(input *vmcommon.ContractCreateInput) (*big.Int, error)

G0Create yields the initial gas cost of creating a new smart contract

func (*VMExecutionHandlerStub) RunSmartContractCall

func (vm *VMExecutionHandlerStub) RunSmartContractCall(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

RunSmartContractCall Computes the result of a smart contract call and how the system must change after the execution

func (*VMExecutionHandlerStub) RunSmartContractCreate

func (vm *VMExecutionHandlerStub) RunSmartContractCreate(input *vmcommon.ContractCreateInput) (*vmcommon.VMOutput, error)

Computes how a smart contract creation should be performed

Jump to

Keyboard shortcuts

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