mock

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrMockMarshalizer -

Functions

func InitBlockProcessorHeaderV2Mock

func InitBlockProcessorHeaderV2Mock() *testscommon.BlockProcessorStub

InitBlockProcessorHeaderV2Mock -

func InitBlockProcessorMock

func InitBlockProcessorMock(marshaller marshal.Marshalizer) *testscommon.BlockProcessorStub

InitBlockProcessorMock -

func InitChronologyHandlerMock

func InitChronologyHandlerMock() consensus.ChronologyHandler

InitChronologyHandlerMock -

func InitKeys

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

InitKeys -

func InitMultiSignerMock

func InitMultiSignerMock() *cryptoMocks.MultisignerMock

InitMultiSignerMock -

Types

type AlarmSchedulerStub

type AlarmSchedulerStub struct {
	AddCalled    func(func(alarmID string), time.Duration, string)
	CancelCalled func(string)
	CloseCalled  func()
	ResetCalled  func(string)
}

func (*AlarmSchedulerStub) Add

func (a *AlarmSchedulerStub) Add(callback func(alarmID string), duration time.Duration, alarmID string)

Add -

func (*AlarmSchedulerStub) Cancel

func (a *AlarmSchedulerStub) Cancel(alarmID string)

Cancel -

func (*AlarmSchedulerStub) Close

func (a *AlarmSchedulerStub) Close()

Close -

func (*AlarmSchedulerStub) IsInterfaceNil

func (a *AlarmSchedulerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AlarmSchedulerStub) Reset

func (a *AlarmSchedulerStub) Reset(alarmID string)

Reset -

type BootstrapperStub

type BootstrapperStub struct {
	CreateAndCommitEmptyBlockCalled func(uint32) (data.BodyHandler, data.HeaderHandler, error)
	AddSyncStateListenerCalled      func(func(bool))
	GetNodeStateCalled              func() common.NodeState
	StartSyncingBlocksCalled        func() error
}

BootstrapperStub mocks the implementation for a Bootstrapper

func (*BootstrapperStub) AddSyncStateListener

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

AddSyncStateListener -

func (*BootstrapperStub) Close

func (boot *BootstrapperStub) Close() error

Close -

func (*BootstrapperStub) CreateAndCommitEmptyBlock

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

CreateAndCommitEmptyBlock -

func (*BootstrapperStub) GetNodeState

func (boot *BootstrapperStub) GetNodeState() common.NodeState

GetNodeState -

func (*BootstrapperStub) IsInterfaceNil

func (boot *BootstrapperStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BootstrapperStub) StartSyncingBlocks

func (boot *BootstrapperStub) StartSyncingBlocks() error

StartSyncingBlocks -

type BroadcastMessengerMock

type BroadcastMessengerMock struct {
	BroadcastBlockCalled                     func(data.BodyHandler, data.HeaderHandler) error
	BroadcastHeaderCalled                    func(data.HeaderHandler, []byte) error
	PrepareBroadcastBlockDataValidatorCalled func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte, idx int, pkBytes []byte) error
	PrepareBroadcastHeaderValidatorCalled    func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte, idx int, pkBytes []byte)
	BroadcastMiniBlocksCalled                func(map[uint32][]byte, []byte) error
	BroadcastTransactionsCalled              func(map[string][][]byte, []byte) error
	BroadcastConsensusMessageCalled          func(*consensus.Message) error
	BroadcastBlockDataLeaderCalled           func(h data.HeaderHandler, mbs map[uint32][]byte, txs map[string][][]byte, pkBytes []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,
	pkBytes []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, pkBytes []byte) error

BroadcastHeader -

func (*BroadcastMessengerMock) BroadcastMiniBlocks

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

BroadcastMiniBlocks -

func (*BroadcastMessengerMock) BroadcastTransactions

func (bmm *BroadcastMessengerMock) BroadcastTransactions(transactions map[string][][]byte, pkBytes []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,
	pkBytes []byte,
)

PrepareBroadcastBlockDataValidator -

func (*BroadcastMessengerMock) PrepareBroadcastHeaderValidator

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

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 InitConsensusCoreHeaderV2

func InitConsensusCoreHeaderV2() *ConsensusCoreMock

InitConsensusCoreHeaderV2 -

func InitConsensusCoreWithMultiSigner

func InitConsensusCoreWithMultiSigner(multiSigner crypto.MultiSigner) *ConsensusCoreMock

InitConsensusCoreWithMultiSigner -

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

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

FallbackHeaderValidator -

func (*ConsensusCoreMock) GetAntiFloodHandler

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

GetAntiFloodHandler -

func (*ConsensusCoreMock) Hasher

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

Hasher -

func (*ConsensusCoreMock) HeaderSigVerifier

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

HeaderSigVerifier -

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) MessageSigningHandler added in v1.6.0

func (ccm *ConsensusCoreMock) MessageSigningHandler() consensus.P2PSigningHandler

MessageSigningHandler -

func (*ConsensusCoreMock) MultiSignerContainer

func (ccm *ConsensusCoreMock) MultiSignerContainer() cryptoCommon.MultiSignerContainer

MultiSignerContainer -

func (*ConsensusCoreMock) NodeRedundancyHandler

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

NodeRedundancyHandler -

func (*ConsensusCoreMock) NodesCoordinator

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

NodesCoordinator -

func (*ConsensusCoreMock) PeerBlacklistHandler added in v1.6.0

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

PeerBlacklistHandler will return the peer blacklist handler

func (*ConsensusCoreMock) PeerHonestyHandler

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

PeerHonestyHandler -

func (*ConsensusCoreMock) RoundHandler

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

RoundHandler -

func (*ConsensusCoreMock) ScheduledProcessor

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

ScheduledProcessor -

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

func (ccm *ConsensusCoreMock) SetFallbackHeaderValidator(fallbackHeaderValidator consensus.FallbackHeaderValidator)

SetFallbackHeaderValidator -

func (*ConsensusCoreMock) SetHasher

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

SetHasher -

func (*ConsensusCoreMock) SetHeaderSigVerifier

func (ccm *ConsensusCoreMock) SetHeaderSigVerifier(headerSigVerifier consensus.HeaderSigVerifier)

SetHeaderSigVerifier -

func (*ConsensusCoreMock) SetMarshalizer

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

SetMarshalizer -

func (*ConsensusCoreMock) SetMessageSigningHandler added in v1.6.0

func (ccm *ConsensusCoreMock) SetMessageSigningHandler(messageSigningHandler consensus.P2PSigningHandler)

SetMessageSigningHandler -

func (*ConsensusCoreMock) SetMultiSignerContainer

func (ccm *ConsensusCoreMock) SetMultiSignerContainer(multiSignerContainer cryptoCommon.MultiSignerContainer)

SetMultiSignerContainer -

func (*ConsensusCoreMock) SetNodeRedundancyHandler

func (ccm *ConsensusCoreMock) SetNodeRedundancyHandler(nodeRedundancyHandler consensus.NodeRedundancyHandler)

SetNodeRedundancyHandler -

func (*ConsensusCoreMock) SetRoundHandler

func (ccm *ConsensusCoreMock) SetRoundHandler(roundHandler consensus.RoundHandler)

SetRoundHandler -

func (*ConsensusCoreMock) SetShardCoordinator

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

SetShardCoordinator -

func (*ConsensusCoreMock) SetSigningHandler added in v1.6.0

func (ccm *ConsensusCoreMock) SetSigningHandler(signingHandler consensus.SigningHandler)

SetSigningHandler -

func (*ConsensusCoreMock) SetSyncTimer

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

SetSyncTimer -

func (*ConsensusCoreMock) SetValidatorGroupSelector

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

SetValidatorGroupSelector -

func (*ConsensusCoreMock) ShardCoordinator

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

ShardCoordinator -

func (*ConsensusCoreMock) SigningHandler added in v1.6.0

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

SigningHandler -

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 nodesCoordinator.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 nodesCoordinator.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()
	SetFinalToLastCheckpointCalled  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) SetFinalToLastCheckpoint

func (fdm *ForkDetectorMock) SetFinalToLastCheckpoint()

SetFinalToLastCheckpoint -

func (*ForkDetectorMock) SetRollBackNonce

func (fdm *ForkDetectorMock) SetRollBackNonce(nonce uint64)

SetRollBackNonce -

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 HeaderIntegrityVerifierStub

type HeaderIntegrityVerifierStub struct {
	VerifyCalled     func(header data.HeaderHandler) error
	GetVersionCalled func(epoch uint32) string
}

HeaderIntegrityVerifierStub -

func (*HeaderIntegrityVerifierStub) GetVersion

func (h *HeaderIntegrityVerifierStub) GetVersion(epoch uint32) string

GetVersion -

func (*HeaderIntegrityVerifierStub) IsInterfaceNil

func (h *HeaderIntegrityVerifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeaderIntegrityVerifierStub) Verify

Verify -

type HeaderSigVerifierStub

type HeaderSigVerifierStub struct {
	VerifyRandSeedAndLeaderSignatureCalled func(header data.HeaderHandler) error
	VerifySignatureCalled                  func(header data.HeaderHandler) error
	VerifyRandSeedCalled                   func(header data.HeaderHandler) error
	VerifyLeaderSignatureCalled            func(header data.HeaderHandler) error
}

HeaderSigVerifierStub -

func (*HeaderSigVerifierStub) IsInterfaceNil

func (hsvm *HeaderSigVerifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeaderSigVerifierStub) VerifyLeaderSignature

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

VerifyLeaderSignature -

func (*HeaderSigVerifierStub) VerifyRandSeed

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

VerifyRandSeed -

func (*HeaderSigVerifierStub) VerifyRandSeedAndLeaderSignature

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

VerifyRandSeedAndLeaderSignature -

func (*HeaderSigVerifierStub) VerifySignature

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

VerifySignature -

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{}

IndexerMock is a mock implementation fot the Indexer interface

func (*IndexerMock) IsInterfaceNil

func (im *IndexerMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*IndexerMock) SaveRoundsInfo

func (im *IndexerMock) SaveRoundsInfo(_ []*outport.RoundInfo)

SaveRoundsInfo -

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 its byte array representation

func (*KeyGenMock) PublicKeyFromByteArray

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

PublicKeyFromByteArray generates a public key from its 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 MessageSignerMock added in v1.6.0

type MessageSignerMock struct {
}

MessageSignerMock implements P2PSigningHandler interface but it does nothing as it is disabled

func (*MessageSignerMock) Deserialize added in v1.6.0

func (ms *MessageSignerMock) Deserialize(messagesBytes []byte) ([]p2p.MessageP2P, error)

Deserialize will unmarshal into a list of p2p messages

func (*MessageSignerMock) IsInterfaceNil added in v1.6.0

func (ms *MessageSignerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MessageSignerMock) Serialize added in v1.6.0

func (ms *MessageSignerMock) Serialize(messages []p2p.MessageP2P) ([]byte, error)

Serialize will serialize the list of p2p messages

func (*MessageSignerMock) Verify added in v1.6.0

func (ms *MessageSignerMock) Verify(_ p2p.MessageP2P) error

Verify does nothing

type MessageSigningHandlerStub added in v1.6.0

type MessageSigningHandlerStub struct {
	VerifyCalled      func(message p2p.MessageP2P) error
	SerializeCalled   func(messages []p2p.MessageP2P) ([]byte, error)
	DeserializeCalled func(messagesBytes []byte) ([]p2p.MessageP2P, error)
}

MessageSigningHandlerStub -

func (*MessageSigningHandlerStub) Deserialize added in v1.6.0

func (stub *MessageSigningHandlerStub) Deserialize(messagesBytes []byte) ([]p2p.MessageP2P, error)

Deserialize -

func (*MessageSigningHandlerStub) IsInterfaceNil added in v1.6.0

func (stub *MessageSigningHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MessageSigningHandlerStub) Serialize added in v1.6.0

func (stub *MessageSigningHandlerStub) Serialize(messages []p2p.MessageP2P) ([]byte, error)

Serialize -

func (*MessageSigningHandlerStub) Verify added in v1.6.0

func (stub *MessageSigningHandlerStub) Verify(message p2p.MessageP2P) error

Verify -

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 NodeRedundancyHandlerStub

type NodeRedundancyHandlerStub struct {
	IsRedundancyNodeCalled         func() bool
	IsMainMachineActiveCalled      func() bool
	AdjustInactivityIfNeededCalled func(selfPubKey string, consensusPubKeys []string, roundIndex int64)
	ResetInactivityIfNeededCalled  func(selfPubKey string, consensusMsgPubKey string, consensusMsgPeerID core.PeerID)
	ObserverPrivateKeyCalled       func() crypto.PrivateKey
}

NodeRedundancyHandlerStub -

func (*NodeRedundancyHandlerStub) AdjustInactivityIfNeeded

func (nrhs *NodeRedundancyHandlerStub) AdjustInactivityIfNeeded(selfPubKey string, consensusPubKeys []string, roundIndex int64)

AdjustInactivityIfNeeded -

func (*NodeRedundancyHandlerStub) IsInterfaceNil

func (nrhs *NodeRedundancyHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*NodeRedundancyHandlerStub) IsMainMachineActive

func (nrhs *NodeRedundancyHandlerStub) IsMainMachineActive() bool

IsMainMachineActive -

func (*NodeRedundancyHandlerStub) IsRedundancyNode

func (nrhs *NodeRedundancyHandlerStub) IsRedundancyNode() bool

IsRedundancyNode -

func (*NodeRedundancyHandlerStub) ObserverPrivateKey

func (nrhs *NodeRedundancyHandlerStub) ObserverPrivateKey() crypto.PrivateKey

ObserverPrivateKey -

func (*NodeRedundancyHandlerStub) ResetInactivityIfNeeded

func (nrhs *NodeRedundancyHandlerStub) ResetInactivityIfNeeded(selfPubKey string, consensusMsgPubKey string, consensusMsgPeerID core.PeerID)

ResetInactivityIfNeeded -

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 PeerBlackListCacherStub added in v1.6.0

type PeerBlackListCacherStub struct {
	UpsertCalled func(pid core.PeerID, span time.Duration) error
	HasCalled    func(pid core.PeerID) bool
	SweepCalled  func()
}

PeerBlackListCacherStub -

func (*PeerBlackListCacherStub) Has added in v1.6.0

func (stub *PeerBlackListCacherStub) Has(pid core.PeerID) bool

Has -

func (*PeerBlackListCacherStub) IsInterfaceNil added in v1.6.0

func (stub *PeerBlackListCacherStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeerBlackListCacherStub) Sweep added in v1.6.0

func (stub *PeerBlackListCacherStub) Sweep()

Sweep -

func (*PeerBlackListCacherStub) Upsert added in v1.6.0

func (stub *PeerBlackListCacherStub) Upsert(pid core.PeerID, span time.Duration) error

Upsert -

type PeerBlacklistHandlerStub added in v1.6.0

type PeerBlacklistHandlerStub struct {
	BlacklistPeerCalled          func(peer core.PeerID, duration time.Duration)
	IsPeerBlacklistedCalled      func(peer core.PeerID) bool
	StartSweepingTimeCacheCalled func()
	CloseCalled                  func() error
}

PeerBlacklistHandlerStub -

func (*PeerBlacklistHandlerStub) BlacklistPeer added in v1.6.0

func (stub *PeerBlacklistHandlerStub) BlacklistPeer(peer core.PeerID, duration time.Duration)

BlacklistPeer -

func (*PeerBlacklistHandlerStub) Close added in v1.6.0

func (stub *PeerBlacklistHandlerStub) Close() error

Close -

func (*PeerBlacklistHandlerStub) IsInterfaceNil added in v1.6.0

func (stub *PeerBlacklistHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeerBlacklistHandlerStub) IsPeerBlacklisted added in v1.6.0

func (stub *PeerBlacklistHandlerStub) IsPeerBlacklisted(peer core.PeerID) bool

IsPeerBlacklisted -

func (*PeerBlacklistHandlerStub) StartSweepingTimeCache added in v1.6.0

func (stub *PeerBlacklistHandlerStub) StartSweepingTimeCache()

StartSweepingTimeCache -

type PeerSignatureHandler

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

PeerSignatureHandler -

func (*PeerSignatureHandler) GetPeerSignature

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

GetPeerSignature -

func (*PeerSignatureHandler) IsInterfaceNil

func (p *PeerSignatureHandler) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeerSignatureHandler) VerifyPeerSignature

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 RoundHandlerMock

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

RoundHandlerMock -

func (*RoundHandlerMock) BeforeGenesis

func (rndm *RoundHandlerMock) BeforeGenesis() bool

BeforeGenesis -

func (*RoundHandlerMock) Index

func (rndm *RoundHandlerMock) Index() int64

Index -

func (*RoundHandlerMock) IsInterfaceNil

func (rndm *RoundHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*RoundHandlerMock) RemainingTime

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

RemainingTime -

func (*RoundHandlerMock) TimeDuration

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

TimeDuration -

func (*RoundHandlerMock) TimeStamp

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

TimeStamp -

func (*RoundHandlerMock) UpdateRound

func (rndm *RoundHandlerMock) 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(ctx context.Context, 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
	ResetConsensusMessagesCalled           func()
}

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(ctx context.Context, 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, _ p2p.MessageHandler) 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) ResetConsensusMessages

func (sposWorkerMock *SposWorkerMock) ResetConsensusMessages()

ResetConsensusMessages -

func (*SposWorkerMock) SendConsensusMessage

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

SendConsensusMessage -

func (*SposWorkerMock) StartWorking

func (sposWorkerMock *SposWorkerMock) StartWorking()

StartWorking -

type SubroundHandlerMock

type SubroundHandlerMock struct {
	DoWorkCalled           func(roundHandler consensus.RoundHandler) 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(_ context.Context, roundHandler consensus.RoundHandler) 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 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