mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMockMarshalizer = errors.New("MarshalizerMock generic error")

ErrMockMarshalizer -

Functions

func InitChronologyHandlerMock

func InitChronologyHandlerMock() consensus.ChronologyHandler

InitChronologyHandlerMock -

func InitKeys

func InitKeys() (*KeyGenMock, *PrivateKeyMock, *PublicKeyMock)

InitKeys -

func NewValidator

func NewValidator(pubKey []byte, chances uint32, index uint32) *validator

NewValidator creates a new instance of a validator

Types

type AppStatusHandlerMock

type AppStatusHandlerMock struct {
}

AppStatusHandlerMock is an empty implementation of AppStatusHandler in order to be used in constructors

func (*AppStatusHandlerMock) AddUint64

func (ashs *AppStatusHandlerMock) AddUint64(_ string, _ uint64)

AddUint64 -

func (*AppStatusHandlerMock) Close

func (ashs *AppStatusHandlerMock) Close()

Close won't do anything

func (*AppStatusHandlerMock) Decrement

func (ashs *AppStatusHandlerMock) Decrement(_ string)

Decrement method won't do anything

func (*AppStatusHandlerMock) Increment

func (ashs *AppStatusHandlerMock) Increment(_ string)

Increment method won't do anything

func (*AppStatusHandlerMock) IsInterfaceNil

func (ashs *AppStatusHandlerMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*AppStatusHandlerMock) SetInt64Value

func (ashs *AppStatusHandlerMock) SetInt64Value(_ string, _ int64)

SetInt64Value method won't do anything

func (*AppStatusHandlerMock) SetStringValue

func (ashs *AppStatusHandlerMock) SetStringValue(_ string, _ string)

SetStringValue method won't do anything

func (*AppStatusHandlerMock) SetUInt64Value

func (ashs *AppStatusHandlerMock) SetUInt64Value(_ string, _ uint64)

SetUInt64Value method won't do anything

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

IsInterfaceNil -

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 uint64 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 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)
	SignatureShareMock       func(index uint16) ([]byte, error)
	StoreCommitmentMock      func(index uint16, value []byte) error
	StoreCommitmentHashMock  func(uint16, []byte) error
	CommitmentMock           func(uint16) ([]byte, error)
	CreateCalled             func(pubKeys []string, index uint16) (crypto.MultiSigner, error)
	ResetCalled              func(pubKeys []string, index uint16) error
	// contains filtered or unexported fields
}

BelNevMock is used to mock belare neven multisignature scheme

func InitMultiSignerMock

func InitMultiSignerMock() *BelNevMock

InitMultiSignerMock -

func NewMultiSigner

func NewMultiSigner() *BelNevMock

NewMultiSigner -

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 creates a multiSigner using receiver as template 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) IsInterfaceNil

func (bnm *BelNevMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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) 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)
	GetLocalHeightCalled            func() int64
	SetLocalHeightCalled            func(int64)
	GetNetworkHeightCalled          func() int64
	SetNetworkHeightCalled          func(int64)
	HasBadBlockCalled               func([]byte) bool
	PutBadBlockCalled               func([]byte)
	CreateNewHeaderCalled           func() data.HeaderHandler
}

BlockChainMock is a mock implementation of the blockchain interface

func (*BlockChainMock) CreateNewHeader

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

CreateNewHeader -

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

func (bc *BlockChainMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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

type BlockProcessorMock

type BlockProcessorMock struct {
	ProcessBlockCalled               func(header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error
	CommitBlockCalled                func(header data.HeaderHandler, body data.BodyHandler) error
	RevertAccountStateCalled         func(header data.HeaderHandler)
	PruneStateOnRollbackCalled       func(currHeader data.HeaderHandler, prevHeader data.HeaderHandler)
	CreateGenesisBlockCalled         func(balances map[string]*big.Int) (data.HeaderHandler, error)
	CreateBlockCalled                func(initialHdrData data.HeaderHandler, haveTime func() bool) (data.HeaderHandler, data.BodyHandler, error)
	RestoreBlockIntoPoolsCalled      func(header data.HeaderHandler, body data.BodyHandler) error
	SetOnRequestTransactionCalled    func(f func(destShardID uint32, txHash []byte))
	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(round uint64, nonce uint64) data.HeaderHandler
	RevertStateToBlockCalled         func(header data.HeaderHandler) error
}

BlockProcessorMock mocks the implementation for a blockProcessor

func InitBlockProcessorMock

func InitBlockProcessorMock() *BlockProcessorMock

InitBlockProcessorMock -

func (*BlockProcessorMock) AddLastNotarizedHdr

func (bpm *BlockProcessorMock) AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)

AddLastNotarizedHdr -

func (*BlockProcessorMock) ApplyProcessedMiniBlocks

func (bpm *BlockProcessorMock) ApplyProcessedMiniBlocks(_ *processedMb.ProcessedMiniBlockTracker)

ApplyProcessedMiniBlocks -

func (*BlockProcessorMock) CommitBlock

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

CommitBlock mocks the commit of a block

func (*BlockProcessorMock) CreateBlock

func (bpm *BlockProcessorMock) CreateBlock(initialHdrData data.HeaderHandler, haveTime func() bool) (data.HeaderHandler, data.BodyHandler, error)

CreateBlock mocks the creation of a new block with header and body

func (*BlockProcessorMock) CreateNewHeader

func (bpm *BlockProcessorMock) CreateNewHeader(round uint64, nonce uint64) data.HeaderHandler

CreateNewHeader -

func (*BlockProcessorMock) DecodeBlockBody

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

DecodeBlockBody -

func (*BlockProcessorMock) DecodeBlockHeader

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

DecodeBlockHeader -

func (*BlockProcessorMock) IsInterfaceNil

func (bpm *BlockProcessorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BlockProcessorMock) MarshalizedDataToBroadcast

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

MarshalizedDataToBroadcast -

func (*BlockProcessorMock) ProcessBlock

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

ProcessBlock mocks pocessing a block

func (*BlockProcessorMock) PruneStateOnRollback

func (bpm *BlockProcessorMock) PruneStateOnRollback(currHeader data.HeaderHandler, prevHeader data.HeaderHandler)

PruneStateOnRollback recreates the state tries to the root hashes indicated by the provided header

func (*BlockProcessorMock) RestoreBlockIntoPools

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

RestoreBlockIntoPools -

func (*BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis

func (bpm *BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis()

RestoreLastNotarizedHrdsToGenesis -

func (*BlockProcessorMock) RevertAccountState

func (bpm *BlockProcessorMock) RevertAccountState(header data.HeaderHandler)

RevertAccountState mocks revert of the accounts state

func (*BlockProcessorMock) RevertStateToBlock

func (bpm *BlockProcessorMock) RevertStateToBlock(header data.HeaderHandler) error

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

func (*BlockProcessorMock) SetNumProcessedObj

func (bpm *BlockProcessorMock) SetNumProcessedObj(_ uint64)

SetNumProcessedObj -

type BootstrapperMock

type BootstrapperMock struct {
	CreateAndCommitEmptyBlockCalled func(uint32) (data.BodyHandler, data.HeaderHandler, error)
	AddSyncStateListenerCalled      func(func(bool))
	GetNodeStateCalled              func() core.NodeState
	StartSyncingBlocksCalled        func()
	SetStatusHandlerCalled          func(handler core.AppStatusHandler) error
}

BootstrapperMock mocks the implementation for a Bootstrapper

func (*BootstrapperMock) AddSyncStateListener

func (boot *BootstrapperMock) AddSyncStateListener(syncStateNotifier func(isSyncing bool))

AddSyncStateListener -

func (*BootstrapperMock) Close

func (boot *BootstrapperMock) Close() error

Close -

func (*BootstrapperMock) CreateAndCommitEmptyBlock

func (boot *BootstrapperMock) CreateAndCommitEmptyBlock(shardForCurrentNode uint32) (data.BodyHandler, data.HeaderHandler, error)

CreateAndCommitEmptyBlock -

func (*BootstrapperMock) GetNodeState

func (boot *BootstrapperMock) GetNodeState() core.NodeState

GetNodeState -

func (*BootstrapperMock) IsInterfaceNil

func (boot *BootstrapperMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BootstrapperMock) SetStatusHandler

func (boot *BootstrapperMock) SetStatusHandler(handler core.AppStatusHandler) error

SetStatusHandler -

func (*BootstrapperMock) StartSyncingBlocks

func (boot *BootstrapperMock) StartSyncingBlocks()

StartSyncingBlocks -

type BroadcastMessengerMock

type BroadcastMessengerMock struct {
	BroadcastBlockCalled                     func(data.BodyHandler, data.HeaderHandler) error
	BroadcastHeaderCalled                    func(data.HeaderHandler) error
	PrepareBroadcastBlockDataValidatorCalled func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte, idx int) error
	PrepareBroadcastHeaderValidatorCalled    func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte, idx int)
	BroadcastMiniBlocksCalled                func(map[uint32][]byte) error
	BroadcastTransactionsCalled              func(map[string][][]byte) error
	BroadcastConsensusMessageCalled          func(*consensus.Message) error
	BroadcastBlockDataLeaderCalled           func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte) error
}

BroadcastMessengerMock -

func (*BroadcastMessengerMock) BroadcastBlock

func (bmm *BroadcastMessengerMock) BroadcastBlock(bodyHandler data.BodyHandler, headerhandler data.HeaderHandler) error

BroadcastBlock -

func (*BroadcastMessengerMock) BroadcastBlockDataLeader

func (bmm *BroadcastMessengerMock) BroadcastBlockDataLeader(
	header data.HeaderHandler,
	miniBlocks map[uint32][]byte,
	transactions map[string][][]byte,
) error

BroadcastBlockDataLeader -

func (*BroadcastMessengerMock) BroadcastConsensusMessage

func (bmm *BroadcastMessengerMock) BroadcastConsensusMessage(message *consensus.Message) error

BroadcastConsensusMessage -

func (*BroadcastMessengerMock) BroadcastHeader

func (bmm *BroadcastMessengerMock) BroadcastHeader(headerhandler data.HeaderHandler) error

BroadcastHeader -

func (*BroadcastMessengerMock) BroadcastMiniBlocks

func (bmm *BroadcastMessengerMock) BroadcastMiniBlocks(miniBlocks map[uint32][]byte) error

BroadcastMiniBlocks -

func (*BroadcastMessengerMock) BroadcastTransactions

func (bmm *BroadcastMessengerMock) BroadcastTransactions(transactions map[string][][]byte) error

BroadcastTransactions -

func (*BroadcastMessengerMock) IsInterfaceNil

func (bmm *BroadcastMessengerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BroadcastMessengerMock) PrepareBroadcastBlockDataValidator

func (bmm *BroadcastMessengerMock) PrepareBroadcastBlockDataValidator(
	header data.HeaderHandler,
	miniBlocks map[uint32][]byte,
	transactions map[string][][]byte,
	idx int,
)

PrepareBroadcastBlockDataValidator -

func (*BroadcastMessengerMock) PrepareBroadcastHeaderValidator

func (bmm *BroadcastMessengerMock) PrepareBroadcastHeaderValidator(
	header data.HeaderHandler,
	miniBlocks map[uint32][]byte,
	transactions map[string][][]byte,
	order int,
)

PrepareBroadcastHeaderValidator -

type ChronologyHandlerMock

type ChronologyHandlerMock struct {
	AddSubroundCalled        func(consensus.SubroundHandler)
	RemoveAllSubroundsCalled func()
	StartRoundCalled         func()
	EpochCalled              func() uint32
}

ChronologyHandlerMock -

func (*ChronologyHandlerMock) AddSubround

func (chrm *ChronologyHandlerMock) AddSubround(subroundHandler consensus.SubroundHandler)

AddSubround -

func (*ChronologyHandlerMock) Close

func (chrm *ChronologyHandlerMock) Close() error

Close -

func (*ChronologyHandlerMock) Epoch

func (chrm *ChronologyHandlerMock) Epoch() uint32

Epoch -

func (*ChronologyHandlerMock) IsInterfaceNil

func (chrm *ChronologyHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChronologyHandlerMock) RemoveAllSubrounds

func (chrm *ChronologyHandlerMock) RemoveAllSubrounds()

RemoveAllSubrounds -

func (*ChronologyHandlerMock) StartRounds

func (chrm *ChronologyHandlerMock) StartRounds()

StartRounds -

type ConsensusCoreMock

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

ConsensusCoreMock -

func InitConsensusCore

func InitConsensusCore() *ConsensusCoreMock

InitConsensusCore -

func (*ConsensusCoreMock) BlockProcessor

func (ccm *ConsensusCoreMock) BlockProcessor() process.BlockProcessor

BlockProcessor -

func (*ConsensusCoreMock) Blockchain

func (ccm *ConsensusCoreMock) Blockchain() data.ChainHandler

Blockchain -

func (*ConsensusCoreMock) BootStrapper

func (ccm *ConsensusCoreMock) BootStrapper() process.Bootstrapper

BootStrapper -

func (*ConsensusCoreMock) BroadcastMessenger

func (ccm *ConsensusCoreMock) BroadcastMessenger() consensus.BroadcastMessenger

BroadcastMessenger -

func (*ConsensusCoreMock) Chronology

func (ccm *ConsensusCoreMock) Chronology() consensus.ChronologyHandler

Chronology -

func (*ConsensusCoreMock) EpochStartRegistrationHandler

func (ccm *ConsensusCoreMock) EpochStartRegistrationHandler() epochStart.RegistrationHandler

EpochStartRegistrationHandler -

func (*ConsensusCoreMock) GetAntiFloodHandler

func (ccm *ConsensusCoreMock) GetAntiFloodHandler() consensus.P2PAntifloodHandler

GetAntiFloodHandler -

func (*ConsensusCoreMock) Hasher

func (ccm *ConsensusCoreMock) Hasher() hashing.Hasher

Hasher -

func (*ConsensusCoreMock) HeadersPoolSubscriber

func (ccm *ConsensusCoreMock) HeadersPoolSubscriber() consensus.HeadersPoolSubscriber

HeadersPoolSubscriber -

func (*ConsensusCoreMock) IsInterfaceNil

func (ccm *ConsensusCoreMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ConsensusCoreMock) Marshalizer

func (ccm *ConsensusCoreMock) Marshalizer() marshal.Marshalizer

Marshalizer -

func (*ConsensusCoreMock) MultiSigner

func (ccm *ConsensusCoreMock) MultiSigner() crypto.MultiSigner

MultiSigner -

func (*ConsensusCoreMock) NodesCoordinator

func (ccm *ConsensusCoreMock) NodesCoordinator() sharding.NodesCoordinator

NodesCoordinator -

func (*ConsensusCoreMock) PeerHonestyHandler

func (ccm *ConsensusCoreMock) PeerHonestyHandler() consensus.PeerHonestyHandler

PeerHonestyHandler -

func (*ConsensusCoreMock) PrivateKey

func (ccm *ConsensusCoreMock) PrivateKey() crypto.PrivateKey

PrivateKey -

func (*ConsensusCoreMock) Rounder

func (ccm *ConsensusCoreMock) Rounder() consensus.Rounder

Rounder -

func (*ConsensusCoreMock) SetBlockProcessor

func (ccm *ConsensusCoreMock) SetBlockProcessor(blockProcessor process.BlockProcessor)

SetBlockProcessor -

func (*ConsensusCoreMock) SetBlockchain

func (ccm *ConsensusCoreMock) SetBlockchain(blockChain data.ChainHandler)

SetBlockchain -

func (*ConsensusCoreMock) SetBootStrapper

func (ccm *ConsensusCoreMock) SetBootStrapper(bootstrapper process.Bootstrapper)

SetBootStrapper -

func (*ConsensusCoreMock) SetBroadcastMessenger

func (ccm *ConsensusCoreMock) SetBroadcastMessenger(broadcastMessenger consensus.BroadcastMessenger)

SetBroadcastMessenger -

func (*ConsensusCoreMock) SetChronology

func (ccm *ConsensusCoreMock) SetChronology(chronologyHandler consensus.ChronologyHandler)

SetChronology -

func (*ConsensusCoreMock) SetHasher

func (ccm *ConsensusCoreMock) SetHasher(hasher hashing.Hasher)

SetHasher -

func (*ConsensusCoreMock) SetMarshalizer

func (ccm *ConsensusCoreMock) SetMarshalizer(marshalizer marshal.Marshalizer)

SetMarshalizer -

func (*ConsensusCoreMock) SetMultiSigner

func (ccm *ConsensusCoreMock) SetMultiSigner(multiSigner crypto.MultiSigner)

SetMultiSigner -

func (*ConsensusCoreMock) SetRounder

func (ccm *ConsensusCoreMock) SetRounder(rounder consensus.Rounder)

SetRounder -

func (*ConsensusCoreMock) SetShardCoordinator

func (ccm *ConsensusCoreMock) SetShardCoordinator(shardCoordinator sharding.Coordinator)

SetShardCoordinator -

func (*ConsensusCoreMock) SetSingleSigner

func (ccm *ConsensusCoreMock) SetSingleSigner(signer crypto.SingleSigner)

SetSingleSigner -

func (*ConsensusCoreMock) SetSyncTimer

func (ccm *ConsensusCoreMock) SetSyncTimer(syncTimer ntp.SyncTimer)

SetSyncTimer -

func (*ConsensusCoreMock) SetValidatorGroupSelector

func (ccm *ConsensusCoreMock) SetValidatorGroupSelector(validatorGroupSelector sharding.NodesCoordinator)

SetValidatorGroupSelector -

func (*ConsensusCoreMock) ShardCoordinator

func (ccm *ConsensusCoreMock) ShardCoordinator() sharding.Coordinator

ShardCoordinator -

func (*ConsensusCoreMock) SingleSigner

func (ccm *ConsensusCoreMock) SingleSigner() crypto.SingleSigner

SingleSigner returns the bls single signer stored in the ConsensusStore

func (*ConsensusCoreMock) SyncTimer

func (ccm *ConsensusCoreMock) SyncTimer() ntp.SyncTimer

SyncTimer -

type ConsensusStateMock

type ConsensusStateMock struct {
	ResetConsensusStateCalled        func()
	IsNodeLeaderInCurrentRoundCalled func(node string) bool
	IsSelfLeaderInCurrentRoundCalled func() bool
	GetLeaderCalled                  func() (string, error)
	GetNextConsensusGroupCalled      func(randomSource string, vgs sharding.NodesCoordinator) ([]string, error)
	IsConsensusDataSetCalled         func() bool
	IsConsensusDataEqualCalled       func(data []byte) bool
	IsJobDoneCalled                  func(node string, currentSubroundId int) bool
	IsSelfJobDoneCalled              func(currentSubroundId int) bool
	IsCurrentSubroundFinishedCalled  func(currentSubroundId int) bool
	IsNodeSelfCalled                 func(node string) bool
	IsBlockBodyAlreadyReceivedCalled func() bool
	IsHeaderAlreadyReceivedCalled    func() bool
	CanDoSubroundJobCalled           func(currentSubroundId int) bool
	CanProcessReceivedMessageCalled  func(cnsDta consensus.Message, currentRoundIndex int32, currentSubroundId int) bool
	GenerateBitmapCalled             func(subroundId int) []byte
	ProcessingBlockCalled            func() bool
	SetProcessingBlockCalled         func(processingBlock bool)
	ConsensusGroupSizeCalled         func() int
	SetThresholdCalled               func(subroundId int, threshold int)
}

ConsensusStateMock -

func (*ConsensusStateMock) CanDoSubroundJob

func (cnsm *ConsensusStateMock) CanDoSubroundJob(currentSubroundId int) bool

CanDoSubroundJob -

func (*ConsensusStateMock) CanProcessReceivedMessage

func (cnsm *ConsensusStateMock) CanProcessReceivedMessage(
	cnsDta consensus.Message,
	currentRoundIndex int32,
	currentSubroundId int,
) bool

CanProcessReceivedMessage -

func (*ConsensusStateMock) ConsensusGroupSize

func (cnsm *ConsensusStateMock) ConsensusGroupSize() int

ConsensusGroupSize -

func (*ConsensusStateMock) GenerateBitmap

func (cnsm *ConsensusStateMock) GenerateBitmap(subroundId int) []byte

GenerateBitmap -

func (*ConsensusStateMock) GetLeader

func (cnsm *ConsensusStateMock) GetLeader() (string, error)

GetLeader -

func (*ConsensusStateMock) GetNextConsensusGroup

func (cnsm *ConsensusStateMock) GetNextConsensusGroup(
	randomSource string,
	vgs sharding.NodesCoordinator,
) ([]string, error)

GetNextConsensusGroup -

func (*ConsensusStateMock) IsBlockBodyAlreadyReceived

func (cnsm *ConsensusStateMock) IsBlockBodyAlreadyReceived() bool

IsBlockBodyAlreadyReceived -

func (*ConsensusStateMock) IsConsensusDataEqual

func (cnsm *ConsensusStateMock) IsConsensusDataEqual(data []byte) bool

IsConsensusDataEqual -

func (*ConsensusStateMock) IsConsensusDataSet

func (cnsm *ConsensusStateMock) IsConsensusDataSet() bool

IsConsensusDataSet -

func (*ConsensusStateMock) IsCurrentSubroundFinished

func (cnsm *ConsensusStateMock) IsCurrentSubroundFinished(currentSubroundId int) bool

IsCurrentSubroundFinished -

func (*ConsensusStateMock) IsHeaderAlreadyReceived

func (cnsm *ConsensusStateMock) IsHeaderAlreadyReceived() bool

IsHeaderAlreadyReceived -

func (*ConsensusStateMock) IsJobDone

func (cnsm *ConsensusStateMock) IsJobDone(node string, currentSubroundId int) bool

IsJobDone -

func (*ConsensusStateMock) IsNodeLeaderInCurrentRound

func (cnsm *ConsensusStateMock) IsNodeLeaderInCurrentRound(node string) bool

IsNodeLeaderInCurrentRound -

func (*ConsensusStateMock) IsNodeSelf

func (cnsm *ConsensusStateMock) IsNodeSelf(node string) bool

IsNodeSelf -

func (*ConsensusStateMock) IsSelfJobDone

func (cnsm *ConsensusStateMock) IsSelfJobDone(currentSubroundId int) bool

IsSelfJobDone -

func (*ConsensusStateMock) IsSelfLeaderInCurrentRound

func (cnsm *ConsensusStateMock) IsSelfLeaderInCurrentRound() bool

IsSelfLeaderInCurrentRound -

func (*ConsensusStateMock) ProcessingBlock

func (cnsm *ConsensusStateMock) ProcessingBlock() bool

ProcessingBlock -

func (*ConsensusStateMock) ResetConsensusState

func (cnsm *ConsensusStateMock) ResetConsensusState()

ResetConsensusState -

func (*ConsensusStateMock) SetProcessingBlock

func (cnsm *ConsensusStateMock) SetProcessingBlock(processingBlock bool)

SetProcessingBlock -

func (*ConsensusStateMock) SetThreshold

func (cnsm *ConsensusStateMock) SetThreshold(subroundId int, threshold int)

SetThreshold -

type EpochStartNotifierStub

type EpochStartNotifierStub struct {
	RegisterHandlerCalled   func(handler epochStart.ActionHandler)
	UnregisterHandlerCalled func(handler epochStart.ActionHandler)
	NotifyAllCalled         func(hdr data.HeaderHandler)
	NotifyAllPrepareCalled  func(hdr data.HeaderHandler, body data.BodyHandler)
	// contains filtered or unexported fields
}

EpochStartNotifierStub -

func (*EpochStartNotifierStub) IsInterfaceNil

func (esnm *EpochStartNotifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*EpochStartNotifierStub) NotifyAll

func (esnm *EpochStartNotifierStub) NotifyAll(hdr data.HeaderHandler)

NotifyAll -

func (*EpochStartNotifierStub) NotifyAllPrepare

func (esnm *EpochStartNotifierStub) NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)

NotifyAllPrepare -

func (*EpochStartNotifierStub) RegisterHandler

func (esnm *EpochStartNotifierStub) RegisterHandler(handler epochStart.ActionHandler)

RegisterHandler -

func (*EpochStartNotifierStub) UnregisterHandler

func (esnm *EpochStartNotifierStub) UnregisterHandler(handler epochStart.ActionHandler)

UnregisterHandler -

type ForkDetectorMock

type ForkDetectorMock struct {
	AddHeaderCalled                 func(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, selfNotarizedHeaders []data.HeaderHandler, selfNotarizedHeadersHashes [][]byte) error
	RemoveHeaderCalled              func(nonce uint64, hash []byte)
	CheckForkCalled                 func() *process.ForkInfo
	GetHighestFinalBlockNonceCalled func() uint64
	GetHighestFinalBlockHashCalled  func() []byte
	ProbableHighestNonceCalled      func() uint64
	ResetForkCalled                 func()
	GetNotarizedHeaderHashCalled    func(nonce uint64) []byte
	SetRollBackNonceCalled          func(nonce uint64)
	RestoreToGenesisCalled          func()
	ResetProbableHighestNonceCalled func()
}

ForkDetectorMock -

func (*ForkDetectorMock) AddHeader

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

AddHeader -

func (*ForkDetectorMock) CheckFork

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

CheckFork -

func (*ForkDetectorMock) GetHighestFinalBlockHash

func (fdm *ForkDetectorMock) GetHighestFinalBlockHash() []byte

GetHighestFinalBlockHash -

func (*ForkDetectorMock) GetHighestFinalBlockNonce

func (fdm *ForkDetectorMock) GetHighestFinalBlockNonce() uint64

GetHighestFinalBlockNonce -

func (*ForkDetectorMock) GetNotarizedHeaderHash

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

GetNotarizedHeaderHash -

func (*ForkDetectorMock) IsInterfaceNil

func (fdm *ForkDetectorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ForkDetectorMock) ProbableHighestNonce

func (fdm *ForkDetectorMock) ProbableHighestNonce() uint64

ProbableHighestNonce -

func (*ForkDetectorMock) RemoveHeader

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

RemoveHeader -

func (*ForkDetectorMock) ResetFork

func (fdm *ForkDetectorMock) ResetFork()

ResetFork -

func (*ForkDetectorMock) ResetProbableHighestNonce

func (fdm *ForkDetectorMock) ResetProbableHighestNonce()

ResetProbableHighestNonce -

func (*ForkDetectorMock) RestoreToGenesis

func (fdm *ForkDetectorMock) RestoreToGenesis()

RestoreToGenesis -

func (*ForkDetectorMock) SetRollBackNonce

func (fdm *ForkDetectorMock) SetRollBackNonce(nonce uint64)

SetRollBackNonce -

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

func (sha HasherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherMock) Size

func (HasherMock) Size() int

Size return the required size in bytes

type HasherStub

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

HasherStub -

func (*HasherStub) Compute

func (hs *HasherStub) Compute(s string) []byte

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

func (*HasherStub) EmptyHash

func (hs *HasherStub) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (*HasherStub) IsInterfaceNil

func (hs *HasherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HasherStub) Size

func (hs *HasherStub) Size() int

Size returns the required size in bytes

type HeaderHandlerStub

type HeaderHandlerStub struct {
	GetMiniBlockHeadersWithDstCalled func(destId uint32) map[string]uint32
	GetPubKeysBitmapCalled           func() []byte
	GetSignatureCalled               func() []byte
	GetRootHashCalled                func() []byte
	GetRandSeedCalled                func() []byte
	GetPrevRandSeedCalled            func() []byte
	GetPrevHashCalled                func() []byte
	CloneCalled                      func() data.HeaderHandler
	GetChainIDCalled                 func() []byte
	CheckChainIDCalled               func(reference []byte) error
	GetReservedCalled                func() []byte
}

HeaderHandlerStub -

func (*HeaderHandlerStub) Clone

func (hhs *HeaderHandlerStub) Clone() data.HeaderHandler

Clone -

func (*HeaderHandlerStub) GetAccumulatedFees

func (hhs *HeaderHandlerStub) GetAccumulatedFees() *big.Int

GetAccumulatedFees -

func (*HeaderHandlerStub) GetChainID

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

GetChainID -

func (*HeaderHandlerStub) GetDeveloperFees

func (hhs *HeaderHandlerStub) GetDeveloperFees() *big.Int

GetDeveloperFees -

func (*HeaderHandlerStub) GetEpoch

func (hhs *HeaderHandlerStub) GetEpoch() uint32

GetEpoch -

func (*HeaderHandlerStub) GetEpochStartMetaHash

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

GetEpochStartMetaHash -

func (*HeaderHandlerStub) GetLeaderSignature

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

GetLeaderSignature -

func (*HeaderHandlerStub) GetMiniBlockHeadersWithDst

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

GetMiniBlockHeadersWithDst -

func (*HeaderHandlerStub) GetNonce

func (hhs *HeaderHandlerStub) GetNonce() uint64

GetNonce -

func (*HeaderHandlerStub) GetPrevHash

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

GetPrevHash -

func (*HeaderHandlerStub) GetPrevRandSeed

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

GetPrevRandSeed -

func (*HeaderHandlerStub) GetPubKeysBitmap

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

GetPubKeysBitmap -

func (*HeaderHandlerStub) GetRandSeed

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

GetRandSeed -

func (*HeaderHandlerStub) GetReceiptsHash

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

GetReceiptsHash -

func (*HeaderHandlerStub) GetReserved added in v0.0.2

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

GetReserved -

func (*HeaderHandlerStub) GetRootHash

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

GetRootHash -

func (*HeaderHandlerStub) GetRound

func (hhs *HeaderHandlerStub) GetRound() uint64

GetRound -

func (*HeaderHandlerStub) GetShardID

func (hhs *HeaderHandlerStub) GetShardID() uint32

GetShardID -

func (*HeaderHandlerStub) GetSignature

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

GetSignature -

func (*HeaderHandlerStub) GetSoftwareVersion

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

GetSoftwareVersion -

func (*HeaderHandlerStub) GetTimeStamp

func (hhs *HeaderHandlerStub) GetTimeStamp() uint64

GetTimeStamp -

func (*HeaderHandlerStub) GetTxCount

func (hhs *HeaderHandlerStub) GetTxCount() uint32

GetTxCount -

func (*HeaderHandlerStub) GetValidatorStatsRootHash

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

GetValidatorStatsRootHash -

func (*HeaderHandlerStub) IsInterfaceNil

func (hhs *HeaderHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HeaderHandlerStub) IsStartOfEpochBlock

func (hhs *HeaderHandlerStub) IsStartOfEpochBlock() bool

IsStartOfEpochBlock -

func (*HeaderHandlerStub) SetAccumulatedFees

func (hhs *HeaderHandlerStub) SetAccumulatedFees(_ *big.Int)

SetAccumulatedFees -

func (*HeaderHandlerStub) SetChainID

func (hhs *HeaderHandlerStub) SetChainID(_ []byte)

SetChainID -

func (*HeaderHandlerStub) SetDeveloperFees

func (hhs *HeaderHandlerStub) SetDeveloperFees(_ *big.Int)

SetDeveloperFees -

func (*HeaderHandlerStub) SetEpoch

func (hhs *HeaderHandlerStub) SetEpoch(_ uint32)

SetEpoch -

func (*HeaderHandlerStub) SetLeaderSignature

func (hhs *HeaderHandlerStub) SetLeaderSignature(_ []byte)

SetLeaderSignature -

func (*HeaderHandlerStub) SetNonce

func (hhs *HeaderHandlerStub) SetNonce(_ uint64)

SetNonce -

func (*HeaderHandlerStub) SetPrevHash

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

SetPrevHash -

func (*HeaderHandlerStub) SetPrevRandSeed

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

SetPrevRandSeed -

func (*HeaderHandlerStub) SetPubKeysBitmap

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

SetPubKeysBitmap -

func (*HeaderHandlerStub) SetRandSeed

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

SetRandSeed -

func (*HeaderHandlerStub) SetRootHash

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

SetRootHash -

func (*HeaderHandlerStub) SetRound

func (hhs *HeaderHandlerStub) SetRound(_ uint64)

SetRound -

func (*HeaderHandlerStub) SetShardID

func (hhs *HeaderHandlerStub) SetShardID(_ uint32)

SetShardID -

func (*HeaderHandlerStub) SetSignature

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

SetSignature -

func (*HeaderHandlerStub) SetSoftwareVersion

func (hhs *HeaderHandlerStub) SetSoftwareVersion(_ []byte)

SetSoftwareVersion -

func (*HeaderHandlerStub) SetTimeStamp

func (hhs *HeaderHandlerStub) SetTimeStamp(_ uint64)

SetTimeStamp -

func (*HeaderHandlerStub) SetTxCount

func (hhs *HeaderHandlerStub) SetTxCount(_ uint32)

SetTxCount -

func (*HeaderHandlerStub) SetValidatorStatsRootHash

func (hhs *HeaderHandlerStub) SetValidatorStatsRootHash(_ []byte)

SetValidatorStatsRootHash -

type HeaderIntegrityVerifierStub

type HeaderIntegrityVerifierStub struct {
	VerifyCalled func(header data.HeaderHandler) error
}

HeaderIntegrityVerifierStub -

func (*HeaderIntegrityVerifierStub) IsInterfaceNil

func (h *HeaderIntegrityVerifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeaderIntegrityVerifierStub) Verify

Verify -

type HeaderSigVerifierStub

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

HeaderSigVerifierStub -

func (*HeaderSigVerifierStub) IsInterfaceNil

func (hsvm *HeaderSigVerifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeaderSigVerifierStub) VerifyRandSeed

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

VerifyRandSeed -

type HeadersCacherStub

type HeadersCacherStub struct {
	AddCalled                           func(headerHash []byte, header data.HeaderHandler)
	RemoveHeaderByHashCalled            func(headerHash []byte)
	RemoveHeaderByNonceAndShardIdCalled func(hdrNonce uint64, shardId uint32)
	GetHeaderByNonceAndShardIdCalled    func(hdrNonce uint64, shardId uint32) ([]data.HeaderHandler, [][]byte, error)
	GetHeaderByHashCalled               func(hash []byte) (data.HeaderHandler, error)
	ClearCalled                         func()
	RegisterHandlerCalled               func(handler func(header data.HeaderHandler, shardHeaderHash []byte))
	NoncesCalled                        func(shardId uint32) []uint64
	LenCalled                           func() int
	MaxSizeCalled                       func() int
	GetNumHeadersCalled                 func(shardId uint32) int
}

HeadersCacherStub -

func (*HeadersCacherStub) AddHeader

func (hcs *HeadersCacherStub) AddHeader(headerHash []byte, header data.HeaderHandler)

AddHeader -

func (*HeadersCacherStub) Clear

func (hcs *HeadersCacherStub) Clear()

Clear -

func (*HeadersCacherStub) GetHeaderByHash

func (hcs *HeadersCacherStub) GetHeaderByHash(hash []byte) (data.HeaderHandler, error)

GetHeaderByHash -

func (*HeadersCacherStub) GetHeadersByNonceAndShardId

func (hcs *HeadersCacherStub) GetHeadersByNonceAndShardId(hdrNonce uint64, shardId uint32) ([]data.HeaderHandler, [][]byte, error)

GetHeadersByNonceAndShardId -

func (*HeadersCacherStub) GetNumHeaders

func (hcs *HeadersCacherStub) GetNumHeaders(shardId uint32) int

GetNumHeaders -

func (*HeadersCacherStub) IsInterfaceNil

func (hcs *HeadersCacherStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeadersCacherStub) Len

func (hcs *HeadersCacherStub) Len() int

Len -

func (*HeadersCacherStub) MaxSize

func (hcs *HeadersCacherStub) MaxSize() int

MaxSize -

func (*HeadersCacherStub) Nonces

func (hcs *HeadersCacherStub) Nonces(shardId uint32) []uint64

Nonces -

func (*HeadersCacherStub) RegisterHandler

func (hcs *HeadersCacherStub) RegisterHandler(handler func(header data.HeaderHandler, shardHeaderHash []byte))

RegisterHandler -

func (*HeadersCacherStub) RemoveHeaderByHash

func (hcs *HeadersCacherStub) RemoveHeaderByHash(headerHash []byte)

RemoveHeaderByHash -

func (*HeadersCacherStub) RemoveHeaderByNonceAndShardId

func (hcs *HeadersCacherStub) RemoveHeaderByNonceAndShardId(hdrNonce uint64, shardId uint32)

RemoveHeaderByNonceAndShardId -

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

IsNilIndexer -

func (*IndexerMock) SaveBlock

SaveBlock -

func (*IndexerMock) SaveRoundsInfos

func (im *IndexerMock) SaveRoundsInfos(_ []indexer.RoundInfo)

SaveRoundsInfos -

func (*IndexerMock) SaveValidatorsPubKeys

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

SaveValidatorsPubKeys -

func (*IndexerMock) SaveValidatorsRating

func (im *IndexerMock) SaveValidatorsRating(_ string, _ []indexer.ValidatorRatingInfo)

SaveValidatorsRating --

func (*IndexerMock) SetTxLogsProcessor

func (im *IndexerMock) SetTxLogsProcessor(_ process.TransactionLogProcessorDatabase)

SetTxLogsProcessor will do nothing

func (*IndexerMock) UpdateTPS

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

UpdateTPS -

type InterceptorStub

type InterceptorStub struct {
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
	RegisterHandlerCalled        func(handler func(topic string, hash []byte, data interface{}))
}

InterceptorStub -

func (*InterceptorStub) IsInterfaceNil

func (is *InterceptorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*InterceptorStub) ProcessReceivedMessage

func (is *InterceptorStub) ProcessReceivedMessage(message p2p.MessageP2P, _ core.PeerID) error

ProcessReceivedMessage -

func (*InterceptorStub) RegisterHandler

func (is *InterceptorStub) RegisterHandler(handler func(topic string, hash []byte, data interface{}))

RegisterHandler -

func (*InterceptorStub) SetInterceptedDebugHandler

func (is *InterceptorStub) SetInterceptedDebugHandler(_ process.InterceptedDebugger) error

SetInterceptedDebugHandler -

type InterceptorsContainerStub

type InterceptorsContainerStub struct {
	GetCalled func(string) (process.Interceptor, error)
}

InterceptorsContainerStub -

func (*InterceptorsContainerStub) Add

Add -

func (*InterceptorsContainerStub) AddMultiple

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

AddMultiple -

func (*InterceptorsContainerStub) Get

Get -

func (*InterceptorsContainerStub) IsInterfaceNil

func (ics *InterceptorsContainerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*InterceptorsContainerStub) Iterate

func (ics *InterceptorsContainerStub) Iterate(_ func(key string, interceptor process.Interceptor) bool)

Iterate -

func (*InterceptorsContainerStub) Len

func (ics *InterceptorsContainerStub) Len() int

Len -

func (*InterceptorsContainerStub) Remove

func (ics *InterceptorsContainerStub) Remove(_ string)

Remove -

func (*InterceptorsContainerStub) Replace

Replace -

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)
	CheckPublicKeyValidMock     func(b []byte) error
	SuiteMock                   func() crypto.Suite
}

KeyGenMock mocks a key generation implementation

func (*KeyGenMock) CheckPublicKeyValid

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

CheckPublicKeyValid verifies the validity of the public key

func (*KeyGenMock) GeneratePair

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

GeneratePair generates a pair of private and public keys

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)

PrivateKeyFromByteArray generates the private key from it's byte array representation

func (*KeyGenMock) PublicKeyFromByteArray

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

PublicKeyFromByteArray generates a public key from it's byte array representation

func (*KeyGenMock) Suite

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

Suite -

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (MarshalizerMock) IsInterfaceNil

func (mm MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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 MessengerStub

type MessengerStub struct {
	BroadcastCalled func(topic string, buff []byte)
}

MessengerStub -

func (*MessengerStub) Broadcast

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

Broadcast -

func (*MessengerStub) IsInterfaceNil

func (ms *MessengerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type MultipleShardsCoordinatorMock

type MultipleShardsCoordinatorMock struct {
	NoShards        uint32
	CurrentShard    uint32
	ComputeIdCalled func(address []byte) uint32
	SelfIDCalled    func() uint32
}

MultipleShardsCoordinatorMock -

func NewMultiShardsCoordinatorMock

func NewMultiShardsCoordinatorMock(nrShard uint32) *MultipleShardsCoordinatorMock

NewMultiShardsCoordinatorMock -

func (*MultipleShardsCoordinatorMock) CommunicationIdentifier

func (scm *MultipleShardsCoordinatorMock) CommunicationIdentifier(destShardID uint32) string

CommunicationIdentifier returns the identifier between current shard ID and destination shard ID identifier is generated such as the first shard from identifier is always smaller than the last

func (*MultipleShardsCoordinatorMock) ComputeId

func (scm *MultipleShardsCoordinatorMock) ComputeId(address []byte) uint32

ComputeId -

func (*MultipleShardsCoordinatorMock) IsInterfaceNil

func (scm *MultipleShardsCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MultipleShardsCoordinatorMock) NumberOfShards

func (scm *MultipleShardsCoordinatorMock) NumberOfShards() uint32

NumberOfShards -

func (*MultipleShardsCoordinatorMock) SameShard

func (scm *MultipleShardsCoordinatorMock) SameShard(_, _ []byte) bool

SameShard -

func (*MultipleShardsCoordinatorMock) SelfId

func (scm *MultipleShardsCoordinatorMock) SelfId() uint32

SelfId -

func (*MultipleShardsCoordinatorMock) SetNoShards

func (scm *MultipleShardsCoordinatorMock) SetNoShards(noShards uint32)

SetNoShards -

func (*MultipleShardsCoordinatorMock) SetSelfId

func (scm *MultipleShardsCoordinatorMock) SetSelfId(_ uint32) error

SetSelfId -

type NetworkShardingCollectorStub

type NetworkShardingCollectorStub struct {
	UpdatePeerIdPublicKeyCalled  func(pid core.PeerID, pk []byte)
	UpdatePublicKeyShardIdCalled func(pk []byte, shardId uint32)
	UpdatePeerIdShardIdCalled    func(pid core.PeerID, shardId uint32)
	GetPeerInfoCalled            func(pid core.PeerID) core.P2PPeerInfo
}

NetworkShardingCollectorStub -

func (*NetworkShardingCollectorStub) GetPeerInfo

func (nscs *NetworkShardingCollectorStub) GetPeerInfo(pid core.PeerID) core.P2PPeerInfo

GetPeerInfo -

func (*NetworkShardingCollectorStub) IsInterfaceNil

func (nscs *NetworkShardingCollectorStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*NetworkShardingCollectorStub) UpdatePeerIdPublicKey

func (nscs *NetworkShardingCollectorStub) UpdatePeerIdPublicKey(pid core.PeerID, pk []byte)

UpdatePeerIdPublicKey -

func (*NetworkShardingCollectorStub) UpdatePeerIdShardId

func (nscs *NetworkShardingCollectorStub) UpdatePeerIdShardId(pid core.PeerID, shardId uint32)

UpdatePeerIdShardId -

func (*NetworkShardingCollectorStub) UpdatePublicKeyShardId

func (nscs *NetworkShardingCollectorStub) UpdatePublicKeyShardId(pk []byte, shardId uint32)

UpdatePublicKeyShardId -

type NodesCoordinatorMock

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

NodesCoordinatorMock -

func (*NodesCoordinatorMock) ComputeAdditionalLeaving

func (ncm *NodesCoordinatorMock) ComputeAdditionalLeaving([]*state.ShardValidatorInfo) (map[uint32][]sharding.Validator, error)

ComputeAdditionalLeaving -

func (*NodesCoordinatorMock) ComputeConsensusGroup

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

ComputeConsensusGroup -

func (*NodesCoordinatorMock) ConsensusGroupSize

func (ncm *NodesCoordinatorMock) ConsensusGroupSize(uint32) int

ConsensusGroupSize -

func (*NodesCoordinatorMock) GetAllEligibleValidatorsPublicKeys

func (ncm *NodesCoordinatorMock) GetAllEligibleValidatorsPublicKeys(_ uint32) (map[uint32][][]byte, error)

GetAllEligibleValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetAllLeavingValidatorsPublicKeys

func (ncm *NodesCoordinatorMock) GetAllLeavingValidatorsPublicKeys(_ uint32) (map[uint32][][]byte, error)

GetAllLeavingValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetAllWaitingValidatorsPublicKeys

func (ncm *NodesCoordinatorMock) GetAllWaitingValidatorsPublicKeys(_ uint32) (map[uint32][][]byte, error)

GetAllWaitingValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetChance

func (ncm *NodesCoordinatorMock) GetChance(uint32) uint32

GetChance -

func (*NodesCoordinatorMock) GetConsensusValidatorsPublicKeys

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

GetConsensusValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetConsensusWhitelistedNodes

func (ncm *NodesCoordinatorMock) GetConsensusWhitelistedNodes(
	_ uint32,
) (map[string]struct{}, error)

GetConsensusWhitelistedNodes return the whitelisted nodes allowed to send consensus messages, for each of the shards

func (*NodesCoordinatorMock) GetNumTotalEligible

func (ncm *NodesCoordinatorMock) GetNumTotalEligible() uint64

GetNumTotalEligible -

func (*NodesCoordinatorMock) GetOwnPublicKey

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

GetOwnPublicKey -

func (*NodesCoordinatorMock) GetSavedStateKey

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

GetSavedStateKey -

func (*NodesCoordinatorMock) GetValidatorWithPublicKey

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

GetValidatorWithPublicKey -

func (*NodesCoordinatorMock) GetValidatorsIndexes

func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(_ []string, _ uint32) ([]uint64, error)

GetValidatorsIndexes -

func (*NodesCoordinatorMock) IsInterfaceNil

func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodesCoordinatorMock) LoadState

func (ncm *NodesCoordinatorMock) LoadState(_ []byte) error

LoadState -

func (*NodesCoordinatorMock) ShardIdForEpoch

func (ncm *NodesCoordinatorMock) ShardIdForEpoch(_ uint32) (uint32, error)

ShardIdForEpoch returns the nodesCoordinator configured ShardId for specified epoch if epoch configuration exists, otherwise error

func (*NodesCoordinatorMock) ShuffleOutForEpoch

func (ncm *NodesCoordinatorMock) ShuffleOutForEpoch(_ uint32)

ShuffleOutForEpoch verifies if the shards changed in the new epoch and calls the shuffleOutHandler

func (*NodesCoordinatorMock) ValidatorsWeights

func (ncm *NodesCoordinatorMock) ValidatorsWeights(validators []sharding.Validator) ([]uint32, error)

ValidatorsWeights -

type P2PAntifloodHandlerStub

type P2PAntifloodHandlerStub struct {
	CanProcessMessageCalled         func(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopicCalled func(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error
	BlacklistPeerCalled             func(peer core.PeerID, reason string, duration time.Duration)
}

P2PAntifloodHandlerStub -

func (*P2PAntifloodHandlerStub) BlacklistPeer

func (p2pahs *P2PAntifloodHandlerStub) BlacklistPeer(peer core.PeerID, reason string, duration time.Duration)

BlacklistPeer -

func (*P2PAntifloodHandlerStub) CanProcessMessage

func (p2pahs *P2PAntifloodHandlerStub) CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error

CanProcessMessage -

func (*P2PAntifloodHandlerStub) CanProcessMessagesOnTopic

func (p2pahs *P2PAntifloodHandlerStub) CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error

CanProcessMessagesOnTopic -

func (*P2PAntifloodHandlerStub) IsInterfaceNil

func (p2pahs *P2PAntifloodHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*P2PAntifloodHandlerStub) ResetForTopic

func (p2pahs *P2PAntifloodHandlerStub) ResetForTopic(_ string)

ResetForTopic -

func (*P2PAntifloodHandlerStub) SetMaxMessagesForTopic

func (p2pahs *P2PAntifloodHandlerStub) SetMaxMessagesForTopic(_ string, _ uint32)

SetMaxMessagesForTopic -

type P2PMessageMock

type P2PMessageMock struct {
	FromField      []byte
	DataField      []byte
	SeqNoField     []byte
	TopicsField    []string
	SignatureField []byte
	KeyField       []byte
	PeerField      core.PeerID
	PayloadField   []byte
	TimestampField int64
}

P2PMessageMock -

func (*P2PMessageMock) Data

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

Data -

func (*P2PMessageMock) From

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

From -

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

Key -

func (*P2PMessageMock) Payload

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

Payload -

func (*P2PMessageMock) Peer

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

Peer -

func (*P2PMessageMock) SeqNo

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

SeqNo -

func (*P2PMessageMock) Signature

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

Signature -

func (*P2PMessageMock) Timestamp

func (msg *P2PMessageMock) Timestamp() int64

Timestamp -

func (*P2PMessageMock) Topics

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

Topics -

type PeerSignatureHandler added in v0.0.2

type PeerSignatureHandler struct {
	Signer crypto.SingleSigner
	KeyGen crypto.KeyGenerator
}

PeerSignatureHandler -

func (*PeerSignatureHandler) GetPeerSignature added in v0.0.2

func (p *PeerSignatureHandler) GetPeerSignature(privateKey crypto.PrivateKey, msg []byte) ([]byte, error)

GetPeerSignature -

func (*PeerSignatureHandler) IsInterfaceNil added in v0.0.2

func (p *PeerSignatureHandler) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeerSignatureHandler) VerifyPeerSignature added in v0.0.2

func (p *PeerSignatureHandler) VerifyPeerSignature(pk []byte, pid core.PeerID, sig []byte) error

VerifyPeerSignature -

type PrivateKeyMock

type PrivateKeyMock struct {
	GeneratePublicMock func() crypto.PublicKey
	ToByteArrayMock    func() ([]byte, error)
	SuiteMock          func() crypto.Suite
	ScalarMock         func() crypto.Scalar
}

PrivateKeyMock mocks a private key implementation

func (*PrivateKeyMock) GeneratePublic

func (privKey *PrivateKeyMock) GeneratePublic() crypto.PublicKey

GeneratePublic mocks generating a public key from the private key

func (*PrivateKeyMock) IsInterfaceNil

func (privKey *PrivateKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PrivateKeyMock) Scalar

func (privKey *PrivateKeyMock) Scalar() crypto.Scalar

Scalar -

func (*PrivateKeyMock) Suite

func (privKey *PrivateKeyMock) Suite() crypto.Suite

Suite -

func (*PrivateKeyMock) ToByteArray

func (privKey *PrivateKeyMock) ToByteArray() ([]byte, error)

ToByteArray mocks converting the private key to a byte array

type PublicKeyMock

type PublicKeyMock struct {
	ToByteArrayMock func() ([]byte, error)
	SuiteMock       func() crypto.Suite
	PointMock       func() crypto.Point
}

PublicKeyMock mocks a public key implementation

func (*PublicKeyMock) IsInterfaceNil

func (pubKey *PublicKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PublicKeyMock) Point

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

Point -

func (*PublicKeyMock) Suite

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

Suite -

func (*PublicKeyMock) ToByteArray

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

ToByteArray mocks converting a public key to a byte array

type RounderMock

type RounderMock struct {
	RoundIndex int64

	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
	BeforeGenesisCalled func() bool
}

RounderMock -

func (*RounderMock) BeforeGenesis

func (rndm *RounderMock) BeforeGenesis() bool

BeforeGenesis -

func (*RounderMock) Index

func (rndm *RounderMock) Index() int64

Index -

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

RemainingTime -

func (*RounderMock) TimeDuration

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

TimeDuration -

func (*RounderMock) TimeStamp

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

TimeStamp -

func (*RounderMock) UpdateRound

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

UpdateRound -

type ShardCoordinatorMock

type ShardCoordinatorMock struct {
	ShardID uint32
}

ShardCoordinatorMock -

func (ShardCoordinatorMock) CommunicationIdentifier

func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string

CommunicationIdentifier -

func (ShardCoordinatorMock) ComputeId

func (scm ShardCoordinatorMock) ComputeId(_ []byte) uint32

ComputeId -

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

NumberOfShards -

func (ShardCoordinatorMock) SameShard

func (scm ShardCoordinatorMock) SameShard(_, _ []byte) bool

SameShard -

func (ShardCoordinatorMock) SelfId

func (scm ShardCoordinatorMock) SelfId() uint32

SelfId -

func (ShardCoordinatorMock) SetSelfId

func (scm ShardCoordinatorMock) SetSelfId(_ uint32) error

SetSelfId -

type SingleSignerMock

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

SingleSignerMock -

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)

Sign -

func (*SingleSignerMock) Verify

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

Verify -

type SposWorkerMock

type SposWorkerMock struct {
	AddReceivedMessageCallCalled func(
		messageType consensus.MessageType,
		receivedMessageCall func(cnsDta *consensus.Message) bool,
	)
	AddReceivedHeaderHandlerCalled         func(handler func(data.HeaderHandler))
	RemoveAllReceivedMessagesCallsCalled   func()
	ProcessReceivedMessageCalled           func(message p2p.MessageP2P) error
	SendConsensusMessageCalled             func(cnsDta *consensus.Message) bool
	ExtendCalled                           func(subroundId int)
	GetConsensusStateChangedChannelsCalled func() chan bool
	GetBroadcastBlockCalled                func(data.BodyHandler, data.HeaderHandler) error
	GetBroadcastHeaderCalled               func(data.HeaderHandler) error
	ExecuteStoredMessagesCalled            func()
	DisplayStatisticsCalled                func()
	ReceivedHeaderCalled                   func(headerHandler data.HeaderHandler, headerHash []byte)
	SetAppStatusHandlerCalled              func(ash core.AppStatusHandler) error
}

SposWorkerMock -

func (*SposWorkerMock) AddReceivedHeaderHandler

func (sposWorkerMock *SposWorkerMock) AddReceivedHeaderHandler(handler func(data.HeaderHandler))

AddReceivedHeaderHandler -

func (*SposWorkerMock) AddReceivedMessageCall

func (sposWorkerMock *SposWorkerMock) AddReceivedMessageCall(messageType consensus.MessageType,
	receivedMessageCall func(cnsDta *consensus.Message) bool)

AddReceivedMessageCall -

func (*SposWorkerMock) BroadcastBlock

func (sposWorkerMock *SposWorkerMock) BroadcastBlock(body data.BodyHandler, header data.HeaderHandler) error

BroadcastBlock -

func (*SposWorkerMock) Close

func (sposWorkerMock *SposWorkerMock) Close() error

Close -

func (*SposWorkerMock) DisplayStatistics

func (sposWorkerMock *SposWorkerMock) DisplayStatistics()

DisplayStatistics -

func (*SposWorkerMock) ExecuteStoredMessages

func (sposWorkerMock *SposWorkerMock) ExecuteStoredMessages()

ExecuteStoredMessages -

func (*SposWorkerMock) Extend

func (sposWorkerMock *SposWorkerMock) Extend(subroundId int)

Extend -

func (*SposWorkerMock) GetConsensusStateChangedChannel

func (sposWorkerMock *SposWorkerMock) GetConsensusStateChangedChannel() chan bool

GetConsensusStateChangedChannel -

func (*SposWorkerMock) IsInterfaceNil

func (sposWorkerMock *SposWorkerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SposWorkerMock) ProcessReceivedMessage

func (sposWorkerMock *SposWorkerMock) ProcessReceivedMessage(message p2p.MessageP2P, _ core.PeerID) error

ProcessReceivedMessage -

func (*SposWorkerMock) ReceivedHeader

func (sposWorkerMock *SposWorkerMock) ReceivedHeader(headerHandler data.HeaderHandler, headerHash []byte)

ReceivedHeader -

func (*SposWorkerMock) RemoveAllReceivedMessagesCalls

func (sposWorkerMock *SposWorkerMock) RemoveAllReceivedMessagesCalls()

RemoveAllReceivedMessagesCalls -

func (*SposWorkerMock) SendConsensusMessage

func (sposWorkerMock *SposWorkerMock) SendConsensusMessage(cnsDta *consensus.Message) bool

SendConsensusMessage -

func (*SposWorkerMock) SetAppStatusHandler

func (sposWorkerMock *SposWorkerMock) SetAppStatusHandler(ash core.AppStatusHandler) error

SetAppStatusHandler -

func (*SposWorkerMock) StartWorking

func (sposWorkerMock *SposWorkerMock) StartWorking()

StartWorking -

type SubroundHandlerMock

type SubroundHandlerMock struct {
	DoWorkCalled           func(rounder consensus.Rounder) bool
	PreviousCalled         func() int
	NextCalled             func() int
	CurrentCalled          func() int
	StartTimeCalled        func() int64
	EndTimeCalled          func() int64
	NameCalled             func() string
	JobCalled              func() bool
	CheckCalled            func() bool
	ConsensusChannelCalled func() chan bool
}

SubroundHandlerMock -

func (*SubroundHandlerMock) ConsensusChannel

func (srm *SubroundHandlerMock) ConsensusChannel() chan bool

ConsensusChannel -

func (*SubroundHandlerMock) Current

func (srm *SubroundHandlerMock) Current() int

Current -

func (*SubroundHandlerMock) DoWork

func (srm *SubroundHandlerMock) DoWork(rounder consensus.Rounder) bool

DoWork -

func (*SubroundHandlerMock) EndTime

func (srm *SubroundHandlerMock) EndTime() int64

EndTime -

func (*SubroundHandlerMock) IsInterfaceNil

func (srm *SubroundHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SubroundHandlerMock) Name

func (srm *SubroundHandlerMock) Name() string

Name -

func (*SubroundHandlerMock) Next

func (srm *SubroundHandlerMock) Next() int

Next -

func (*SubroundHandlerMock) Previous

func (srm *SubroundHandlerMock) Previous() int

Previous -

func (*SubroundHandlerMock) StartTime

func (srm *SubroundHandlerMock) StartTime() int64

StartTime -

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

func (stm *SyncTimerMock) Close() error

Close -

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

func (stm *SyncTimerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncTimerMock) StartSyncingTime

func (stm *SyncTimerMock) StartSyncingTime()

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

type ValidatorStatisticsProcessorStub

type ValidatorStatisticsProcessorStub struct {
	LoadInitialStateCalled func(in []*sharding.InitialNode) error
	UpdatePeerStateCalled  func(header, previousHeader data.HeaderHandler) error
	IsInterfaceNilCalled   func() bool
}

ValidatorStatisticsProcessorStub -

func (*ValidatorStatisticsProcessorStub) IsInterfaceNil

func (pm *ValidatorStatisticsProcessorStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ValidatorStatisticsProcessorStub) LoadInitialState

func (pm *ValidatorStatisticsProcessorStub) LoadInitialState(in []*sharding.InitialNode) error

LoadInitialState -

func (*ValidatorStatisticsProcessorStub) UpdatePeerState

func (pm *ValidatorStatisticsProcessorStub) UpdatePeerState(header, previousHeader data.HeaderHandler) error

UpdatePeerState -

type WatchdogMock

type WatchdogMock struct {
}

WatchdogMock -

func (*WatchdogMock) IsInterfaceNil

func (w *WatchdogMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*WatchdogMock) Reset

func (w *WatchdogMock) Reset(alarmID string)

Reset -

func (*WatchdogMock) Set

func (w *WatchdogMock) Set(callback func(alarmID string), duration time.Duration, alarmID string)

Set -

func (*WatchdogMock) SetDefault

func (w *WatchdogMock) SetDefault(duration time.Duration, alarmID string)

SetDefault -

func (*WatchdogMock) Stop

func (w *WatchdogMock) Stop(alarmID string)

Stop -

Jump to

Keyboard shortcuts

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