Documentation ¶
Index ¶
- Variables
- func InitChronologyHandlerMock() consensus.ChronologyHandler
- func InitKeys() (*KeyGenMock, *PrivateKeyMock, *PublicKeyMock)
- type AppStatusHandlerMock
- func (ashs *AppStatusHandlerMock) AddUint64(key string, value uint64)
- func (ashs *AppStatusHandlerMock) Close()
- func (ashs *AppStatusHandlerMock) Decrement(key string)
- func (ashs *AppStatusHandlerMock) Increment(key string)
- func (ashs *AppStatusHandlerMock) IsInterfaceNil() bool
- func (ashs *AppStatusHandlerMock) SetInt64Value(key string, value int64)
- func (ashs *AppStatusHandlerMock) SetStringValue(key string, value string)
- func (ashs *AppStatusHandlerMock) SetUInt64Value(key string, value uint64)
- type AppStatusHandlerStub
- func (ashs *AppStatusHandlerStub) AddUint64(key string, value uint64)
- func (ashs *AppStatusHandlerStub) Close()
- func (ashs *AppStatusHandlerStub) Decrement(key string)
- func (ashs *AppStatusHandlerStub) Increment(key string)
- func (ashs *AppStatusHandlerStub) IsInterfaceNil() bool
- func (ashs *AppStatusHandlerStub) SetInt64Value(key string, value int64)
- func (ashs *AppStatusHandlerStub) SetStringValue(key string, value string)
- func (ashs *AppStatusHandlerStub) SetUInt64Value(key string, value uint64)
- type BelNevMock
- func (bnm *BelNevMock) AggregateCommitments(bitmap []byte) error
- func (bnm *BelNevMock) AggregateSigs(bitmap []byte) ([]byte, error)
- func (bnm *BelNevMock) Commitment(index uint16) ([]byte, error)
- func (bnm *BelNevMock) CommitmentHash(index uint16) ([]byte, error)
- func (bnm *BelNevMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
- func (bnm *BelNevMock) CreateCommitment() (commSecret []byte, commitment []byte)
- func (bnm *BelNevMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)
- func (bnm *BelNevMock) IsInterfaceNil() bool
- func (bnm *BelNevMock) Reset(pubKeys []string, index uint16) error
- func (bnm *BelNevMock) SetAggregatedSig(aggSig []byte) error
- func (bnm *BelNevMock) SignatureShare(index uint16) ([]byte, error)
- func (bnm *BelNevMock) StoreCommitment(index uint16, value []byte) error
- func (bnm *BelNevMock) StoreCommitmentHash(index uint16, commHash []byte) error
- func (bnm *BelNevMock) StoreSignatureShare(index uint16, sig []byte) error
- func (bnm *BelNevMock) Verify(msg []byte, bitmap []byte) error
- func (bnm *BelNevMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error
- type BlockChainMock
- func (bc *BlockChainMock) GetCurrentBlockBody() data.BodyHandler
- func (bc *BlockChainMock) GetCurrentBlockHeader() data.HeaderHandler
- func (bc *BlockChainMock) GetCurrentBlockHeaderHash() []byte
- func (bc *BlockChainMock) GetGenesisHeader() data.HeaderHandler
- func (bc *BlockChainMock) GetGenesisHeaderHash() []byte
- func (bc *BlockChainMock) GetLocalHeight() int64
- func (bc *BlockChainMock) GetNetworkHeight() int64
- func (bc *BlockChainMock) HasBadBlock(blockHash []byte) bool
- func (bc *BlockChainMock) IsInterfaceNil() bool
- func (bc *BlockChainMock) PutBadBlock(blockHash []byte)
- func (bc *BlockChainMock) SetCurrentBlockBody(body data.BodyHandler) error
- func (bc *BlockChainMock) SetCurrentBlockHeader(header data.HeaderHandler) error
- func (bc *BlockChainMock) SetCurrentBlockHeaderHash(hash []byte)
- func (bc *BlockChainMock) SetGenesisHeader(genesisBlock data.HeaderHandler) error
- func (bc *BlockChainMock) SetGenesisHeaderHash(hash []byte)
- func (bc *BlockChainMock) SetLocalHeight(height int64)
- func (bc *BlockChainMock) SetNetworkHeight(height int64)
- type BlockProcessorMock
- func (blProcMock BlockProcessorMock) AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)
- func (blProcMock BlockProcessorMock) ApplyBodyToHeader(hdr data.HeaderHandler, body data.BodyHandler) error
- func (blProcMock *BlockProcessorMock) ApplyProcessedMiniBlocks(miniBlocks map[string]map[string]struct{})
- func (blProcMock *BlockProcessorMock) CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error
- func (blProcMock *BlockProcessorMock) CreateBlockBody(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)
- func (blProcMock *BlockProcessorMock) CreateNewHeader() data.HeaderHandler
- func (blProcMock BlockProcessorMock) DecodeBlockBody(dta []byte) data.BodyHandler
- func (blProcMock BlockProcessorMock) DecodeBlockHeader(dta []byte) data.HeaderHandler
- func (blProcMock *BlockProcessorMock) IsInterfaceNil() bool
- func (blProcMock BlockProcessorMock) MarshalizedDataToBroadcast(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)
- func (blProcMock *BlockProcessorMock) ProcessBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, ...) error
- func (blProcMock *BlockProcessorMock) RestoreBlockIntoPools(header data.HeaderHandler, body data.BodyHandler) error
- func (blProcMock *BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis()
- func (blProcMock *BlockProcessorMock) RevertAccountState()
- func (blProcMock *BlockProcessorMock) RevertStateToBlock(header data.HeaderHandler) error
- func (blProcMock BlockProcessorMock) SetConsensusData(randomness []byte, round uint64, epoch uint32, shardId uint32)
- type BootstrapperMock
- func (boot *BootstrapperMock) AddSyncStateListener(syncStateNotifier func(isSyncing bool))
- func (boot *BootstrapperMock) CreateAndCommitEmptyBlock(shardForCurrentNode uint32) (data.BodyHandler, data.HeaderHandler, error)
- func (boot *BootstrapperMock) IsInterfaceNil() bool
- func (boot *BootstrapperMock) SetStatusHandler(handler core.AppStatusHandler) error
- func (boot *BootstrapperMock) ShouldSync() bool
- func (boot *BootstrapperMock) StartSync()
- func (boot *BootstrapperMock) StopSync()
- type BroadcastMessengerMock
- func (bmm *BroadcastMessengerMock) BroadcastBlock(bodyHandler data.BodyHandler, headerhandler data.HeaderHandler) error
- func (bmm *BroadcastMessengerMock) BroadcastConsensusMessage(message *consensus.Message) error
- func (bmm *BroadcastMessengerMock) BroadcastHeader(headerhandler data.HeaderHandler) error
- func (bmm *BroadcastMessengerMock) BroadcastMiniBlocks(miniBlocks map[uint32][]byte) error
- func (bmm *BroadcastMessengerMock) BroadcastShardHeader(headerHandler data.HeaderHandler) error
- func (bmm *BroadcastMessengerMock) BroadcastTransactions(transactions map[string][][]byte) error
- func (bmm *BroadcastMessengerMock) IsInterfaceNil() bool
- type ChronologyHandlerMock
- type ConsensusCoreMock
- func (ccm *ConsensusCoreMock) BlockProcessor() process.BlockProcessor
- func (ccm *ConsensusCoreMock) Blockchain() data.ChainHandler
- func (ccm *ConsensusCoreMock) BootStrapper() process.Bootstrapper
- func (ccm *ConsensusCoreMock) BroadcastMessenger() consensus.BroadcastMessenger
- func (ccm *ConsensusCoreMock) Chronology() consensus.ChronologyHandler
- func (ccm *ConsensusCoreMock) Hasher() hashing.Hasher
- func (ccm *ConsensusCoreMock) IsInterfaceNil() bool
- func (ccm *ConsensusCoreMock) Marshalizer() marshal.Marshalizer
- func (ccm *ConsensusCoreMock) MultiSigner() crypto.MultiSigner
- func (ccm *ConsensusCoreMock) NodesCoordinator() sharding.NodesCoordinator
- func (ccm *ConsensusCoreMock) PrivateKey() crypto.PrivateKey
- func (ccm *ConsensusCoreMock) Rounder() consensus.Rounder
- func (ccm *ConsensusCoreMock) SetBlockProcessor(blockProcessor process.BlockProcessor)
- func (ccm *ConsensusCoreMock) SetBlockchain(blockChain data.ChainHandler)
- func (ccm *ConsensusCoreMock) SetBootStrapper(bootstrapper process.Bootstrapper)
- func (ccm *ConsensusCoreMock) SetBroadcastMessenger(broadcastMessenger consensus.BroadcastMessenger)
- func (ccm *ConsensusCoreMock) SetChronology(chronologyHandler consensus.ChronologyHandler)
- func (ccm *ConsensusCoreMock) SetHasher(hasher hashing.Hasher)
- func (ccm *ConsensusCoreMock) SetMarshalizer(marshalizer marshal.Marshalizer)
- func (ccm *ConsensusCoreMock) SetMultiSigner(multiSigner crypto.MultiSigner)
- func (ccm *ConsensusCoreMock) SetRounder(rounder consensus.Rounder)
- func (ccm *ConsensusCoreMock) SetShardCoordinator(shardCoordinator sharding.Coordinator)
- func (ccm *ConsensusCoreMock) SetSingleSigner(signer crypto.SingleSigner)
- func (ccm *ConsensusCoreMock) SetSyncTimer(syncTimer ntp.SyncTimer)
- func (ccm *ConsensusCoreMock) SetValidatorGroupSelector(validatorGroupSelector sharding.NodesCoordinator)
- func (ccm *ConsensusCoreMock) ShardCoordinator() sharding.Coordinator
- func (ccm *ConsensusCoreMock) SingleSigner() crypto.SingleSigner
- func (ccm *ConsensusCoreMock) SyncTimer() ntp.SyncTimer
- type ConsensusStateMock
- func (cnsm *ConsensusStateMock) CanDoSubroundJob(currentSubroundId int) bool
- func (cnsm *ConsensusStateMock) CanProcessReceivedMessage(cnsDta consensus.Message, currentRoundIndex int32, currentSubroundId int) bool
- func (cnsm *ConsensusStateMock) ConsensusGroupSize() int
- func (cnsm *ConsensusStateMock) GenerateBitmap(subroundId int) []byte
- func (cnsm *ConsensusStateMock) GetLeader() (string, error)
- func (cnsm *ConsensusStateMock) GetNextConsensusGroup(randomSource string, vgs sharding.NodesCoordinator) ([]string, error)
- func (cnsm *ConsensusStateMock) IsBlockBodyAlreadyReceived() bool
- func (cnsm *ConsensusStateMock) IsConsensusDataEqual(data []byte) bool
- func (cnsm *ConsensusStateMock) IsConsensusDataSet() bool
- func (cnsm *ConsensusStateMock) IsCurrentSubroundFinished(currentSubroundId int) bool
- func (cnsm *ConsensusStateMock) IsHeaderAlreadyReceived() bool
- func (cnsm *ConsensusStateMock) IsJobDone(node string, currentSubroundId int) bool
- func (cnsm *ConsensusStateMock) IsNodeLeaderInCurrentRound(node string) bool
- func (cnsm *ConsensusStateMock) IsNodeSelf(node string) bool
- func (cnsm *ConsensusStateMock) IsSelfJobDone(currentSubroundId int) bool
- func (cnsm *ConsensusStateMock) IsSelfLeaderInCurrentRound() bool
- func (cnsm *ConsensusStateMock) ProcessingBlock() bool
- func (cnsm *ConsensusStateMock) ResetConsensusState()
- func (cnsm *ConsensusStateMock) SetProcessingBlock(processingBlock bool)
- func (cnsm *ConsensusStateMock) SetThreshold(subroundId int, threshold int)
- type ForkDetectorMock
- func (fdm *ForkDetectorMock) AddHeader(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, ...) error
- func (fdm *ForkDetectorMock) CheckFork() *process.ForkInfo
- func (fdm *ForkDetectorMock) GetHighestFinalBlockNonce() uint64
- func (fdm *ForkDetectorMock) GetNotarizedHeaderHash(nonce uint64) []byte
- func (fdm *ForkDetectorMock) IsInterfaceNil() bool
- func (fdm *ForkDetectorMock) ProbableHighestNonce() uint64
- func (fdm *ForkDetectorMock) RemoveHeaders(nonce uint64, hash []byte)
- func (fdm *ForkDetectorMock) ResetFork()
- func (fdm *ForkDetectorMock) ResetProbableHighestNonce()
- func (f *ForkDetectorMock) RestoreFinalCheckPointToGenesis()
- type HasherMock
- type HasherStub
- type KeyGenMock
- func (keyGen *KeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)
- func (keyGen *KeyGenMock) IsInterfaceNil() bool
- func (keyGen *KeyGenMock) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)
- func (keyGen *KeyGenMock) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)
- func (keyGen *KeyGenMock) Suite() crypto.Suite
- type MarshalizerMock
- type MessengerStub
- type NodesCoordinatorMock
- func (ncm *NodesCoordinatorMock) ComputeValidatorsGroup(randomness []byte, round uint64, shardId uint32) (validatorsGroup []sharding.Validator, err error)
- func (ncm *NodesCoordinatorMock) ConsensusGroupSize(shardId uint32) int
- func (ncm *NodesCoordinatorMock) GetAllValidatorsPublicKeys() map[uint32][][]byte
- func (ncm *NodesCoordinatorMock) GetOwnPublicKey() []byte
- func (ncm *NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte, shardId uint32) (publicKeys []string, err error)
- func (ncm *NodesCoordinatorMock) GetValidatorWithPublicKey(publicKey []byte) (sharding.Validator, uint32, error)
- func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(publicKeys []string) []uint64
- func (ncm *NodesCoordinatorMock) GetValidatorsPublicKeys(randomness []byte, round uint64, shardId uint32) ([]string, error)
- func (ncm *NodesCoordinatorMock) GetValidatorsRewardsAddresses(randomness []byte, round uint64, shardId uint32) ([]string, error)
- func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool
- func (ncm *NodesCoordinatorMock) SetConsensusGroupSize(int) error
- func (ncm *NodesCoordinatorMock) SetNodesPerShards(map[uint32][]sharding.Validator) error
- type P2PMessageMock
- func (msg *P2PMessageMock) Data() []byte
- func (msg *P2PMessageMock) From() []byte
- func (msg *P2PMessageMock) IsInterfaceNil() bool
- func (msg *P2PMessageMock) Key() []byte
- func (msg *P2PMessageMock) Peer() p2p.PeerID
- func (msg *P2PMessageMock) SeqNo() []byte
- func (msg *P2PMessageMock) Signature() []byte
- func (msg *P2PMessageMock) TopicIDs() []string
- type PrivateKeyMock
- type PublicKeyMock
- type RounderMock
- func (rndm *RounderMock) Index() int64
- func (rndm *RounderMock) IsInterfaceNil() bool
- func (rndm *RounderMock) RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration
- func (rndm *RounderMock) TimeDuration() time.Duration
- func (rndm *RounderMock) TimeStamp() time.Time
- func (rndm *RounderMock) UpdateRound(genesisRoundTimeStamp time.Time, timeStamp time.Time)
- type ShardCoordinatorMock
- func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
- func (scm ShardCoordinatorMock) ComputeId(address state.AddressContainer) uint32
- func (scm ShardCoordinatorMock) IsInterfaceNil() bool
- func (scm ShardCoordinatorMock) NumberOfShards() uint32
- func (scm ShardCoordinatorMock) SameShard(firstAddress, secondAddress state.AddressContainer) bool
- func (scm ShardCoordinatorMock) SelfId() uint32
- func (scm ShardCoordinatorMock) SetSelfId(shardId uint32) error
- type SingleSignerMock
- type SposWorkerMock
- func (sposWorkerMock *SposWorkerMock) AddReceivedMessageCall(messageType consensus.MessageType, ...)
- func (sposWorkerMock *SposWorkerMock) BroadcastBlock(body data.BodyHandler, header data.HeaderHandler) error
- func (sposWorkerMock *SposWorkerMock) ExecuteStoredMessages()
- func (sposWorkerMock *SposWorkerMock) Extend(subroundId int)
- func (sposWorkerMock *SposWorkerMock) GetConsensusStateChangedChannel() chan bool
- func (sposWorkerMock *SposWorkerMock) IsInterfaceNil() bool
- func (sposWorkerMock *SposWorkerMock) ProcessReceivedMessage(message p2p.MessageP2P, _ func(buffToSend []byte)) error
- func (sposWorkerMock *SposWorkerMock) RemoveAllReceivedMessagesCalls()
- func (sposWorkerMock *SposWorkerMock) SendConsensusMessage(cnsDta *consensus.Message) bool
- type SubroundHandlerMock
- func (srm *SubroundHandlerMock) Current() int
- func (srm *SubroundHandlerMock) DoWork(rounder consensus.Rounder) bool
- func (srm *SubroundHandlerMock) EndTime() int64
- func (srm *SubroundHandlerMock) IsInterfaceNil() bool
- func (srm *SubroundHandlerMock) Name() string
- func (srm *SubroundHandlerMock) Next() int
- func (srm *SubroundHandlerMock) Previous() int
- func (srm *SubroundHandlerMock) StartTime() int64
- type SyncTimerMock
- type ValidatorMock
- type ValidatorStatisticsProcessorMock
Constants ¶
This section is empty.
Variables ¶
var ErrMockMarshalizer = errors.New("MarshalizerMock generic error")
Functions ¶
func InitChronologyHandlerMock ¶
func InitChronologyHandlerMock() consensus.ChronologyHandler
func InitKeys ¶
func InitKeys() (*KeyGenMock, *PrivateKeyMock, *PublicKeyMock)
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(key string, value uint64)
func (*AppStatusHandlerMock) Close ¶
func (ashs *AppStatusHandlerMock) Close()
Close won't do anything
func (*AppStatusHandlerMock) Decrement ¶
func (ashs *AppStatusHandlerMock) Decrement(key string)
Decrement method won't do anything
func (*AppStatusHandlerMock) Increment ¶
func (ashs *AppStatusHandlerMock) Increment(key string)
Increment method won't do anything
func (*AppStatusHandlerMock) IsInterfaceNil ¶
func (ashs *AppStatusHandlerMock) IsInterfaceNil() bool
func (*AppStatusHandlerMock) SetInt64Value ¶
func (ashs *AppStatusHandlerMock) SetInt64Value(key string, value int64)
SetInt64Value method won't do anything
func (*AppStatusHandlerMock) SetStringValue ¶
func (ashs *AppStatusHandlerMock) SetStringValue(key string, value string)
SetStringValue method won't do anything
func (*AppStatusHandlerMock) SetUInt64Value ¶
func (ashs *AppStatusHandlerMock) SetUInt64Value(key string, value 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
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 AggregateSigsMock func(bitmap []byte) ([]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
func NewMultiSigner ¶
func NewMultiSigner() *BelNevMock
func (*BelNevMock) AggregateCommitments ¶
func (bnm *BelNevMock) AggregateCommitments(bitmap []byte) error
AggregateCommitments aggregates the list of commitments
func (*BelNevMock) AggregateSigs ¶
func (bnm *BelNevMock) AggregateSigs(bitmap []byte) ([]byte, error)
AggregateSigs aggregates all collected partial signatures
func (*BelNevMock) Commitment ¶
func (bnm *BelNevMock) Commitment(index uint16) ([]byte, error)
Commitment returns the commitment from the list with the specified position
func (*BelNevMock) CommitmentHash ¶
func (bnm *BelNevMock) CommitmentHash(index uint16) ([]byte, error)
CommitmentHash returns the commitment hash from the list on the specified position
func (*BelNevMock) Create ¶
func (bnm *BelNevMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)
Create 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) 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) GetCurrentBlockBodyCalled func() data.BodyHandler SetCurrentBlockBodyCalled func(data.BodyHandler) error GetLocalHeightCalled func() int64 SetLocalHeightCalled func(int64) GetNetworkHeightCalled func() int64 SetNetworkHeightCalled func(int64) HasBadBlockCalled func([]byte) bool PutBadBlockCalled func([]byte) }
BlockChainMock is a mock implementation of the blockchain interface
func (*BlockChainMock) GetCurrentBlockBody ¶
func (bc *BlockChainMock) GetCurrentBlockBody() data.BodyHandler
GetCurrentBlockBody returns the tx block body pointer
func (*BlockChainMock) GetCurrentBlockHeader ¶
func (bc *BlockChainMock) GetCurrentBlockHeader() data.HeaderHandler
GetCurrentBlockHeader returns current block header pointer
func (*BlockChainMock) GetCurrentBlockHeaderHash ¶
func (bc *BlockChainMock) GetCurrentBlockHeaderHash() []byte
GetCurrentBlockHeaderHash returns the current block header hash
func (*BlockChainMock) GetGenesisHeader ¶
func (bc *BlockChainMock) GetGenesisHeader() data.HeaderHandler
GetGenesisHeader returns the genesis block header pointer
func (*BlockChainMock) GetGenesisHeaderHash ¶
func (bc *BlockChainMock) GetGenesisHeaderHash() []byte
GetGenesisHeaderHash returns the genesis block header hash
func (*BlockChainMock) GetLocalHeight ¶ added in v1.0.3
func (bc *BlockChainMock) GetLocalHeight() int64
GetLocalHeight returns the height of the local chain
func (*BlockChainMock) GetNetworkHeight ¶ added in v1.0.3
func (bc *BlockChainMock) GetNetworkHeight() int64
GetNetworkHeight sets the perceived height of the network chain
func (*BlockChainMock) HasBadBlock ¶ added in v1.0.3
func (bc *BlockChainMock) HasBadBlock(blockHash []byte) bool
HasBadBlock returns true if the provided hash is blacklisted as a bad block, or false otherwise
func (*BlockChainMock) IsInterfaceNil ¶
func (bc *BlockChainMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*BlockChainMock) PutBadBlock ¶ added in v1.0.3
func (bc *BlockChainMock) PutBadBlock(blockHash []byte)
PutBadBlock adds the given serialized block to the bad block cache, blacklisting it
func (*BlockChainMock) SetCurrentBlockBody ¶
func (bc *BlockChainMock) SetCurrentBlockBody(body data.BodyHandler) error
SetCurrentBlockBody sets the tx block body pointer
func (*BlockChainMock) SetCurrentBlockHeader ¶
func (bc *BlockChainMock) SetCurrentBlockHeader(header data.HeaderHandler) error
SetCurrentBlockHeader sets current block header pointer
func (*BlockChainMock) SetCurrentBlockHeaderHash ¶
func (bc *BlockChainMock) SetCurrentBlockHeaderHash(hash []byte)
SetCurrentBlockHeaderHash returns the current block header hash
func (*BlockChainMock) SetGenesisHeader ¶
func (bc *BlockChainMock) SetGenesisHeader(genesisBlock data.HeaderHandler) error
SetGenesisHeader sets the genesis block header pointer
func (*BlockChainMock) SetGenesisHeaderHash ¶
func (bc *BlockChainMock) SetGenesisHeaderHash(hash []byte)
SetGenesisHeaderHash sets the genesis block header hash
func (*BlockChainMock) SetLocalHeight ¶ added in v1.0.3
func (bc *BlockChainMock) SetLocalHeight(height int64)
SetLocalHeight sets the height of the local chain
func (*BlockChainMock) SetNetworkHeight ¶ added in v1.0.3
func (bc *BlockChainMock) SetNetworkHeight(height int64)
SetNetworkHeight sets the perceived height of the network chain
type BlockProcessorMock ¶
type BlockProcessorMock struct { ProcessBlockCalled func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error CommitBlockCalled func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error RevertAccountStateCalled func() RevertStateToBlockCalled func(header data.HeaderHandler) error CreateGenesisBlockCalled func(balances map[string]*big.Int) (data.HeaderHandler, error) CreateBlockCalled func(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error) RestoreBlockIntoPoolsCalled func(header data.HeaderHandler, body data.BodyHandler) error SetOnRequestTransactionCalled func(f func(destShardID uint32, txHash []byte)) ApplyBodyToHeaderCalled func(hdr data.HeaderHandler, body data.BodyHandler) error MarshalizedDataToBroadcastCalled func(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error) DecodeBlockBodyCalled func(dta []byte) data.BodyHandler DecodeBlockHeaderCalled func(dta []byte) data.HeaderHandler AddLastNotarizedHdrCalled func(shardId uint32, processedHdr data.HeaderHandler) CreateNewHeaderCalled func() data.HeaderHandler }
BlockProcessorMock mocks the implementation for a blockProcessor
func InitBlockProcessorMock ¶
func InitBlockProcessorMock() *BlockProcessorMock
func (BlockProcessorMock) AddLastNotarizedHdr ¶
func (blProcMock BlockProcessorMock) AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)
func (BlockProcessorMock) ApplyBodyToHeader ¶ added in v1.0.39
func (blProcMock BlockProcessorMock) ApplyBodyToHeader(hdr data.HeaderHandler, body data.BodyHandler) error
func (*BlockProcessorMock) ApplyProcessedMiniBlocks ¶
func (blProcMock *BlockProcessorMock) ApplyProcessedMiniBlocks(miniBlocks map[string]map[string]struct{})
func (*BlockProcessorMock) CommitBlock ¶
func (blProcMock *BlockProcessorMock) CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error
CommitBlock mocks the commit of a block
func (*BlockProcessorMock) CreateBlockBody ¶ added in v1.0.3
func (blProcMock *BlockProcessorMock) CreateBlockBody(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)
CreateBlockBody mocks the creation of a transaction block body
func (*BlockProcessorMock) CreateNewHeader ¶
func (blProcMock *BlockProcessorMock) CreateNewHeader() data.HeaderHandler
func (BlockProcessorMock) DecodeBlockBody ¶
func (blProcMock BlockProcessorMock) DecodeBlockBody(dta []byte) data.BodyHandler
func (BlockProcessorMock) DecodeBlockHeader ¶
func (blProcMock BlockProcessorMock) DecodeBlockHeader(dta []byte) data.HeaderHandler
func (*BlockProcessorMock) IsInterfaceNil ¶
func (blProcMock *BlockProcessorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (BlockProcessorMock) MarshalizedDataToBroadcast ¶
func (blProcMock BlockProcessorMock) MarshalizedDataToBroadcast(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)
func (*BlockProcessorMock) ProcessBlock ¶
func (blProcMock *BlockProcessorMock) ProcessBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error
ProcessBlock mocks pocessing a block
func (*BlockProcessorMock) RestoreBlockIntoPools ¶
func (blProcMock *BlockProcessorMock) RestoreBlockIntoPools(header data.HeaderHandler, body data.BodyHandler) error
func (*BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis ¶
func (blProcMock *BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis()
func (*BlockProcessorMock) RevertAccountState ¶
func (blProcMock *BlockProcessorMock) RevertAccountState()
RevertAccountState mocks revert of the accounts state
func (*BlockProcessorMock) RevertStateToBlock ¶
func (blProcMock *BlockProcessorMock) RevertStateToBlock(header data.HeaderHandler) error
RevertStateToBlock recreates the state tries to the root hashes indicated by the provided header
func (BlockProcessorMock) SetConsensusData ¶ added in v1.0.20
func (blProcMock BlockProcessorMock) SetConsensusData(randomness []byte, round uint64, epoch uint32, shardId uint32)
type BootstrapperMock ¶
type BootstrapperMock struct { CreateAndCommitEmptyBlockCalled func(uint32) (data.BodyHandler, data.HeaderHandler, error) AddSyncStateListenerCalled func(func(bool)) ShouldSyncCalled func() bool StartSyncCalled func() StopSyncCalled 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))
func (*BootstrapperMock) CreateAndCommitEmptyBlock ¶
func (boot *BootstrapperMock) CreateAndCommitEmptyBlock(shardForCurrentNode uint32) (data.BodyHandler, data.HeaderHandler, error)
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
func (*BootstrapperMock) ShouldSync ¶ added in v1.0.8
func (boot *BootstrapperMock) ShouldSync() bool
func (*BootstrapperMock) StartSync ¶
func (boot *BootstrapperMock) StartSync()
func (*BootstrapperMock) StopSync ¶
func (boot *BootstrapperMock) StopSync()
type BroadcastMessengerMock ¶
type BroadcastMessengerMock struct { BroadcastBlockCalled func(data.BodyHandler, data.HeaderHandler) error BroadcastHeaderCalled func(data.HeaderHandler) error BroadcastShardHeaderCalled func(data.HeaderHandler) error BroadcastMiniBlocksCalled func(map[uint32][]byte) error BroadcastTransactionsCalled func(map[string][][]byte) error BroadcastConsensusMessageCalled func(*consensus.Message) error }
func (*BroadcastMessengerMock) BroadcastBlock ¶
func (bmm *BroadcastMessengerMock) BroadcastBlock(bodyHandler data.BodyHandler, headerhandler data.HeaderHandler) error
func (*BroadcastMessengerMock) BroadcastConsensusMessage ¶
func (bmm *BroadcastMessengerMock) BroadcastConsensusMessage(message *consensus.Message) error
func (*BroadcastMessengerMock) BroadcastHeader ¶
func (bmm *BroadcastMessengerMock) BroadcastHeader(headerhandler data.HeaderHandler) error
func (*BroadcastMessengerMock) BroadcastMiniBlocks ¶
func (bmm *BroadcastMessengerMock) BroadcastMiniBlocks(miniBlocks map[uint32][]byte) error
func (*BroadcastMessengerMock) BroadcastShardHeader ¶ added in v1.0.37
func (bmm *BroadcastMessengerMock) BroadcastShardHeader(headerHandler data.HeaderHandler) error
func (*BroadcastMessengerMock) BroadcastTransactions ¶
func (bmm *BroadcastMessengerMock) BroadcastTransactions(transactions map[string][][]byte) error
func (*BroadcastMessengerMock) IsInterfaceNil ¶
func (bmm *BroadcastMessengerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type ChronologyHandlerMock ¶
type ChronologyHandlerMock struct { AddSubroundCalled func(consensus.SubroundHandler) RemoveAllSubroundsCalled func() StartRoundCalled func() }
func (*ChronologyHandlerMock) AddSubround ¶
func (chrm *ChronologyHandlerMock) AddSubround(subroundHandler consensus.SubroundHandler)
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()
func (*ChronologyHandlerMock) StartRounds ¶
func (chrm *ChronologyHandlerMock) StartRounds()
type ConsensusCoreMock ¶
type ConsensusCoreMock struct {
// contains filtered or unexported fields
}
func InitConsensusCore ¶
func InitConsensusCore() *ConsensusCoreMock
func (*ConsensusCoreMock) BlockProcessor ¶
func (ccm *ConsensusCoreMock) BlockProcessor() process.BlockProcessor
func (*ConsensusCoreMock) Blockchain ¶
func (ccm *ConsensusCoreMock) Blockchain() data.ChainHandler
func (*ConsensusCoreMock) BootStrapper ¶
func (ccm *ConsensusCoreMock) BootStrapper() process.Bootstrapper
func (*ConsensusCoreMock) BroadcastMessenger ¶
func (ccm *ConsensusCoreMock) BroadcastMessenger() consensus.BroadcastMessenger
func (*ConsensusCoreMock) Chronology ¶
func (ccm *ConsensusCoreMock) Chronology() consensus.ChronologyHandler
func (*ConsensusCoreMock) Hasher ¶
func (ccm *ConsensusCoreMock) Hasher() hashing.Hasher
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
func (*ConsensusCoreMock) MultiSigner ¶
func (ccm *ConsensusCoreMock) MultiSigner() crypto.MultiSigner
func (*ConsensusCoreMock) NodesCoordinator ¶
func (ccm *ConsensusCoreMock) NodesCoordinator() sharding.NodesCoordinator
func (*ConsensusCoreMock) PrivateKey ¶
func (ccm *ConsensusCoreMock) PrivateKey() crypto.PrivateKey
func (*ConsensusCoreMock) Rounder ¶
func (ccm *ConsensusCoreMock) Rounder() consensus.Rounder
func (*ConsensusCoreMock) SetBlockProcessor ¶
func (ccm *ConsensusCoreMock) SetBlockProcessor(blockProcessor process.BlockProcessor)
func (*ConsensusCoreMock) SetBlockchain ¶
func (ccm *ConsensusCoreMock) SetBlockchain(blockChain data.ChainHandler)
func (*ConsensusCoreMock) SetBootStrapper ¶
func (ccm *ConsensusCoreMock) SetBootStrapper(bootstrapper process.Bootstrapper)
func (*ConsensusCoreMock) SetBroadcastMessenger ¶
func (ccm *ConsensusCoreMock) SetBroadcastMessenger(broadcastMessenger consensus.BroadcastMessenger)
func (*ConsensusCoreMock) SetChronology ¶
func (ccm *ConsensusCoreMock) SetChronology(chronologyHandler consensus.ChronologyHandler)
func (*ConsensusCoreMock) SetHasher ¶
func (ccm *ConsensusCoreMock) SetHasher(hasher hashing.Hasher)
func (*ConsensusCoreMock) SetMarshalizer ¶
func (ccm *ConsensusCoreMock) SetMarshalizer(marshalizer marshal.Marshalizer)
func (*ConsensusCoreMock) SetMultiSigner ¶
func (ccm *ConsensusCoreMock) SetMultiSigner(multiSigner crypto.MultiSigner)
func (*ConsensusCoreMock) SetRounder ¶
func (ccm *ConsensusCoreMock) SetRounder(rounder consensus.Rounder)
func (*ConsensusCoreMock) SetShardCoordinator ¶
func (ccm *ConsensusCoreMock) SetShardCoordinator(shardCoordinator sharding.Coordinator)
func (*ConsensusCoreMock) SetSingleSigner ¶
func (ccm *ConsensusCoreMock) SetSingleSigner(signer crypto.SingleSigner)
func (*ConsensusCoreMock) SetSyncTimer ¶
func (ccm *ConsensusCoreMock) SetSyncTimer(syncTimer ntp.SyncTimer)
func (*ConsensusCoreMock) SetValidatorGroupSelector ¶
func (ccm *ConsensusCoreMock) SetValidatorGroupSelector(validatorGroupSelector sharding.NodesCoordinator)
func (*ConsensusCoreMock) ShardCoordinator ¶
func (ccm *ConsensusCoreMock) ShardCoordinator() sharding.Coordinator
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
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) }
func (*ConsensusStateMock) CanDoSubroundJob ¶
func (cnsm *ConsensusStateMock) CanDoSubroundJob(currentSubroundId int) bool
func (*ConsensusStateMock) CanProcessReceivedMessage ¶
func (*ConsensusStateMock) ConsensusGroupSize ¶
func (cnsm *ConsensusStateMock) ConsensusGroupSize() int
func (*ConsensusStateMock) GenerateBitmap ¶
func (cnsm *ConsensusStateMock) GenerateBitmap(subroundId int) []byte
func (*ConsensusStateMock) GetLeader ¶
func (cnsm *ConsensusStateMock) GetLeader() (string, error)
func (*ConsensusStateMock) GetNextConsensusGroup ¶
func (cnsm *ConsensusStateMock) GetNextConsensusGroup( randomSource string, vgs sharding.NodesCoordinator, ) ([]string, error)
func (*ConsensusStateMock) IsBlockBodyAlreadyReceived ¶
func (cnsm *ConsensusStateMock) IsBlockBodyAlreadyReceived() bool
func (*ConsensusStateMock) IsConsensusDataEqual ¶
func (cnsm *ConsensusStateMock) IsConsensusDataEqual(data []byte) bool
func (*ConsensusStateMock) IsConsensusDataSet ¶
func (cnsm *ConsensusStateMock) IsConsensusDataSet() bool
func (*ConsensusStateMock) IsCurrentSubroundFinished ¶
func (cnsm *ConsensusStateMock) IsCurrentSubroundFinished(currentSubroundId int) bool
func (*ConsensusStateMock) IsHeaderAlreadyReceived ¶
func (cnsm *ConsensusStateMock) IsHeaderAlreadyReceived() bool
func (*ConsensusStateMock) IsJobDone ¶
func (cnsm *ConsensusStateMock) IsJobDone(node string, currentSubroundId int) bool
func (*ConsensusStateMock) IsNodeLeaderInCurrentRound ¶
func (cnsm *ConsensusStateMock) IsNodeLeaderInCurrentRound(node string) bool
func (*ConsensusStateMock) IsNodeSelf ¶
func (cnsm *ConsensusStateMock) IsNodeSelf(node string) bool
func (*ConsensusStateMock) IsSelfJobDone ¶
func (cnsm *ConsensusStateMock) IsSelfJobDone(currentSubroundId int) bool
func (*ConsensusStateMock) IsSelfLeaderInCurrentRound ¶
func (cnsm *ConsensusStateMock) IsSelfLeaderInCurrentRound() bool
func (*ConsensusStateMock) ProcessingBlock ¶
func (cnsm *ConsensusStateMock) ProcessingBlock() bool
func (*ConsensusStateMock) ResetConsensusState ¶
func (cnsm *ConsensusStateMock) ResetConsensusState()
func (*ConsensusStateMock) SetProcessingBlock ¶
func (cnsm *ConsensusStateMock) SetProcessingBlock(processingBlock bool)
func (*ConsensusStateMock) SetThreshold ¶
func (cnsm *ConsensusStateMock) SetThreshold(subroundId int, threshold int)
type ForkDetectorMock ¶
type ForkDetectorMock struct { AddHeaderCalled func(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte, isNotarizedShardStuck bool) error RemoveHeadersCalled func(nonce uint64, hash []byte) CheckForkCalled func() *process.ForkInfo GetHighestFinalBlockNonceCalled func() uint64 ProbableHighestNonceCalled func() uint64 ResetProbableHighestNonceCalled func() ResetForkCalled func() GetNotarizedHeaderHashCalled func(nonce uint64) []byte }
func (*ForkDetectorMock) AddHeader ¶
func (fdm *ForkDetectorMock) AddHeader(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte, isNotarizedShardStuck bool) error
func (*ForkDetectorMock) CheckFork ¶
func (fdm *ForkDetectorMock) CheckFork() *process.ForkInfo
func (*ForkDetectorMock) GetHighestFinalBlockNonce ¶
func (fdm *ForkDetectorMock) GetHighestFinalBlockNonce() uint64
func (*ForkDetectorMock) GetNotarizedHeaderHash ¶
func (fdm *ForkDetectorMock) GetNotarizedHeaderHash(nonce uint64) []byte
func (*ForkDetectorMock) IsInterfaceNil ¶
func (fdm *ForkDetectorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ForkDetectorMock) ProbableHighestNonce ¶
func (fdm *ForkDetectorMock) ProbableHighestNonce() uint64
func (*ForkDetectorMock) RemoveHeaders ¶ added in v1.0.3
func (fdm *ForkDetectorMock) RemoveHeaders(nonce uint64, hash []byte)
func (*ForkDetectorMock) ResetFork ¶
func (fdm *ForkDetectorMock) ResetFork()
func (*ForkDetectorMock) ResetProbableHighestNonce ¶
func (fdm *ForkDetectorMock) ResetProbableHighestNonce()
func (*ForkDetectorMock) RestoreFinalCheckPointToGenesis ¶ added in v1.0.41
func (f *ForkDetectorMock) RestoreFinalCheckPointToGenesis()
type 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
type HasherStub ¶
type HasherStub struct { ComputeCalled func(s string) []byte EmptyHashCalled func() []byte SizeCalled func() int }
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
type KeyGenMock ¶
type KeyGenMock struct { GeneratePairMock func() (crypto.PrivateKey, crypto.PublicKey) PrivateKeyFromByteArrayMock func(b []byte) (crypto.PrivateKey, error) PublicKeyFromByteArrayMock func(b []byte) (crypto.PublicKey, error) SuiteMock func() crypto.Suite }
KeyGenMock mocks a key generation implementation
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)
PublicKeyFromByteArrayMock generate a public key from it's byte array representation
func (*KeyGenMock) Suite ¶
func (keyGen *KeyGenMock) Suite() crypto.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
func (MarshalizerMock) Version ¶
func (MarshalizerMock) Version() string
Version is deprecated and will be removed
type MessengerStub ¶
func (*MessengerStub) Broadcast ¶
func (ms *MessengerStub) Broadcast(topic string, buff []byte)
func (*MessengerStub) IsInterfaceNil ¶
func (ms *MessengerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type NodesCoordinatorMock ¶
type NodesCoordinatorMock struct { ComputeValidatorsGroupCalled func(randomness []byte, round uint64, shardId uint32) ([]sharding.Validator, error) GetValidatorsPublicKeysCalled func(randomness []byte, round uint64, shardId uint32) ([]string, error) GetValidatorsRewardsAddressesCalled func(randomness []byte, round uint64, shardId uint32) ([]string, error) }
func (*NodesCoordinatorMock) ComputeValidatorsGroup ¶ added in v1.0.20
func (*NodesCoordinatorMock) ConsensusGroupSize ¶
func (ncm *NodesCoordinatorMock) ConsensusGroupSize(shardId uint32) int
func (*NodesCoordinatorMock) GetAllValidatorsPublicKeys ¶ added in v1.0.20
func (ncm *NodesCoordinatorMock) GetAllValidatorsPublicKeys() map[uint32][][]byte
func (*NodesCoordinatorMock) GetOwnPublicKey ¶
func (ncm *NodesCoordinatorMock) GetOwnPublicKey() []byte
func (*NodesCoordinatorMock) GetSelectedPublicKeys ¶
func (ncm *NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte, shardId uint32) (publicKeys []string, err error)
func (*NodesCoordinatorMock) GetValidatorWithPublicKey ¶
func (*NodesCoordinatorMock) GetValidatorsIndexes ¶
func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(publicKeys []string) []uint64
func (*NodesCoordinatorMock) GetValidatorsPublicKeys ¶ added in v1.0.20
func (*NodesCoordinatorMock) GetValidatorsRewardsAddresses ¶ added in v1.0.20
func (*NodesCoordinatorMock) IsInterfaceNil ¶
func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*NodesCoordinatorMock) SetConsensusGroupSize ¶
func (ncm *NodesCoordinatorMock) SetConsensusGroupSize(int) error
func (*NodesCoordinatorMock) SetNodesPerShards ¶
func (ncm *NodesCoordinatorMock) SetNodesPerShards(map[uint32][]sharding.Validator) error
type P2PMessageMock ¶
type P2PMessageMock struct { FromField []byte DataField []byte SeqNoField []byte TopicIDsField []string SignatureField []byte KeyField []byte PeerField p2p.PeerID }
func (*P2PMessageMock) Data ¶
func (msg *P2PMessageMock) Data() []byte
func (*P2PMessageMock) From ¶
func (msg *P2PMessageMock) From() []byte
func (*P2PMessageMock) IsInterfaceNil ¶
func (msg *P2PMessageMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*P2PMessageMock) Key ¶
func (msg *P2PMessageMock) Key() []byte
func (*P2PMessageMock) Peer ¶
func (msg *P2PMessageMock) Peer() p2p.PeerID
func (*P2PMessageMock) SeqNo ¶
func (msg *P2PMessageMock) SeqNo() []byte
func (*P2PMessageMock) Signature ¶
func (msg *P2PMessageMock) Signature() []byte
func (*P2PMessageMock) TopicIDs ¶ added in v1.0.3
func (msg *P2PMessageMock) TopicIDs() []string
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
func (*PrivateKeyMock) Suite ¶
func (privKey *PrivateKeyMock) Suite() crypto.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
func (*PublicKeyMock) Suite ¶
func (pubKey *PublicKeyMock) Suite() crypto.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 }
func (*RounderMock) Index ¶
func (rndm *RounderMock) Index() int64
func (*RounderMock) IsInterfaceNil ¶
func (rndm *RounderMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*RounderMock) RemainingTime ¶
func (*RounderMock) TimeDuration ¶
func (rndm *RounderMock) TimeDuration() time.Duration
func (*RounderMock) TimeStamp ¶
func (rndm *RounderMock) TimeStamp() time.Time
func (*RounderMock) UpdateRound ¶
func (rndm *RounderMock) UpdateRound(genesisRoundTimeStamp time.Time, timeStamp time.Time)
type ShardCoordinatorMock ¶
type ShardCoordinatorMock struct { }
func (ShardCoordinatorMock) CommunicationIdentifier ¶
func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
func (ShardCoordinatorMock) ComputeId ¶
func (scm ShardCoordinatorMock) ComputeId(address state.AddressContainer) uint32
func (ShardCoordinatorMock) IsInterfaceNil ¶
func (scm ShardCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (ShardCoordinatorMock) NumberOfShards ¶
func (scm ShardCoordinatorMock) NumberOfShards() uint32
func (ShardCoordinatorMock) SameShard ¶
func (scm ShardCoordinatorMock) SameShard(firstAddress, secondAddress state.AddressContainer) bool
func (ShardCoordinatorMock) SelfId ¶
func (scm ShardCoordinatorMock) SelfId() uint32
func (ShardCoordinatorMock) SetSelfId ¶
func (scm ShardCoordinatorMock) SetSelfId(shardId uint32) error
type SingleSignerMock ¶
type SingleSignerMock struct { SignStub func(private crypto.PrivateKey, msg []byte) ([]byte, error) VerifyStub func(public crypto.PublicKey, msg []byte, sig []byte) error }
func (*SingleSignerMock) IsInterfaceNil ¶
func (s *SingleSignerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*SingleSignerMock) Sign ¶
func (s *SingleSignerMock) Sign(private crypto.PrivateKey, msg []byte) ([]byte, error)
type SposWorkerMock ¶
type SposWorkerMock struct { AddReceivedMessageCallCalled func( messageType consensus.MessageType, receivedMessageCall func(cnsDta *consensus.Message) bool, ) 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() }
func (*SposWorkerMock) AddReceivedMessageCall ¶
func (sposWorkerMock *SposWorkerMock) AddReceivedMessageCall(messageType consensus.MessageType, receivedMessageCall func(cnsDta *consensus.Message) bool)
func (*SposWorkerMock) BroadcastBlock ¶
func (sposWorkerMock *SposWorkerMock) BroadcastBlock(body data.BodyHandler, header data.HeaderHandler) error
func (*SposWorkerMock) ExecuteStoredMessages ¶
func (sposWorkerMock *SposWorkerMock) ExecuteStoredMessages()
func (*SposWorkerMock) Extend ¶
func (sposWorkerMock *SposWorkerMock) Extend(subroundId int)
func (*SposWorkerMock) GetConsensusStateChangedChannel ¶
func (sposWorkerMock *SposWorkerMock) GetConsensusStateChangedChannel() chan bool
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, _ func(buffToSend []byte)) error
func (*SposWorkerMock) RemoveAllReceivedMessagesCalls ¶
func (sposWorkerMock *SposWorkerMock) RemoveAllReceivedMessagesCalls()
func (*SposWorkerMock) SendConsensusMessage ¶
func (sposWorkerMock *SposWorkerMock) SendConsensusMessage(cnsDta *consensus.Message) bool
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 }
func (*SubroundHandlerMock) Current ¶
func (srm *SubroundHandlerMock) Current() int
func (*SubroundHandlerMock) DoWork ¶
func (srm *SubroundHandlerMock) DoWork(rounder consensus.Rounder) bool
func (*SubroundHandlerMock) EndTime ¶
func (srm *SubroundHandlerMock) EndTime() int64
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
func (*SubroundHandlerMock) Next ¶
func (srm *SubroundHandlerMock) Next() int
func (*SubroundHandlerMock) Previous ¶
func (srm *SubroundHandlerMock) Previous() int
func (*SubroundHandlerMock) StartTime ¶
func (srm *SubroundHandlerMock) StartTime() int64
type SyncTimerMock ¶
type SyncTimerMock struct { ClockOffsetCalled func() time.Duration CurrentTimeCalled func() time.Time }
SyncTimerMock mocks the implementation for a SyncTimer
func (*SyncTimerMock) ClockOffset ¶
func (stm *SyncTimerMock) ClockOffset() time.Duration
ClockOffset method gets the current time offset
func (*SyncTimerMock) CurrentTime ¶
func (stm *SyncTimerMock) CurrentTime() time.Time
CurrentTime method gets the current time on which is added the current offset
func (*SyncTimerMock) FormattedCurrentTime ¶
func (stm *SyncTimerMock) FormattedCurrentTime() string
FormattedCurrentTime method gets the formatted current time on which is added a given offset
func (*SyncTimerMock) IsInterfaceNil ¶
func (stm *SyncTimerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*SyncTimerMock) StartSync ¶
func (stm *SyncTimerMock) StartSync()
StartSync method does the time synchronization at every syncPeriod time elapsed. This should be started as a go routine
type ValidatorMock ¶
type ValidatorMock struct {
// contains filtered or unexported fields
}
func NewValidatorMock ¶
func (*ValidatorMock) Address ¶
func (vm *ValidatorMock) Address() []byte
func (*ValidatorMock) IsInterfaceNil ¶
func (vm *ValidatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ValidatorMock) PubKey ¶
func (vm *ValidatorMock) PubKey() []byte
func (*ValidatorMock) Rating ¶ added in v1.0.3
func (vm *ValidatorMock) Rating() int32
func (*ValidatorMock) Stake ¶ added in v1.0.3
func (vm *ValidatorMock) Stake() *big.Int
type ValidatorStatisticsProcessorMock ¶ added in v1.0.39
type ValidatorStatisticsProcessorMock struct { LoadInitialStateCalled func(in []*sharding.InitialNode) error UpdatePeerStateCalled func(header, previousHeader data.HeaderHandler) error IsInterfaceNilCalled func() bool }
func (*ValidatorStatisticsProcessorMock) IsInterfaceNil ¶ added in v1.0.39
func (pm *ValidatorStatisticsProcessorMock) IsInterfaceNil() bool
func (*ValidatorStatisticsProcessorMock) LoadInitialState ¶ added in v1.0.39
func (pm *ValidatorStatisticsProcessorMock) LoadInitialState(in []*sharding.InitialNode) error
func (*ValidatorStatisticsProcessorMock) UpdatePeerState ¶ added in v1.0.39
func (pm *ValidatorStatisticsProcessorMock) UpdatePeerState(header, previousHeader data.HeaderHandler) error
Source Files ¶
- appStatusHandlerStub.go
- blockChainMock.go
- blockProcessorMock.go
- bootstrapMock.go
- broadcastMessangerMock.go
- chronologyHandlerMock.go
- consensusDataContainerMock.go
- consensusStateMock.go
- forkDetectorMock.go
- hasherMock.go
- hasherStub.go
- keyGenMock.go
- marshalizerMock.go
- messengerStub.go
- mockTestInitializer.go
- multiSigMock.go
- nodesCoordinatorMock.go
- p2pMessageMock.go
- peerProcessorMock.go
- rounderMock.go
- shardCoordinatorMock.go
- singleSigMock.go
- sposWorkerMock.go
- statusHandlerMock.go
- subroundHandlerMock.go
- syncTimerMock.go
- validatorMock.go