Documentation ¶
Index ¶
- func ABlock(previousBlock interfaces.Block) interfaces.Block
- func CalculateBlockHash(block interfaces.Block) primitives.BlockHash
- type BlocksPool
- type CommunicationMock
- func (g *CommunicationMock) ClearIncomingWhitelist()
- func (g *CommunicationMock) ClearOutgoingWhitelist()
- func (g *CommunicationMock) CountSentMessages(messageType protocol.MessageType) int
- func (g *CommunicationMock) GetSentMessages(messageType protocol.MessageType) []*interfaces.ConsensusRawMessage
- func (g *CommunicationMock) OnRemoteMessage(ctx context.Context, rawMessage *interfaces.ConsensusRawMessage)
- func (g *CommunicationMock) RegisterOnMessage(cb func(ctx context.Context, message *interfaces.ConsensusRawMessage)) int
- func (g *CommunicationMock) SendConsensusMessage(ctx context.Context, targets []primitives.MemberId, ...)
- func (g *CommunicationMock) SendToNode(ctx context.Context, targetMemberId primitives.MemberId, ...)
- func (g *CommunicationMock) SetIncomingWhitelist(incomingWhitelist []primitives.MemberId)
- func (g *CommunicationMock) SetMessagesMaxDelay(duration time.Duration)
- func (g *CommunicationMock) SetOutgoingWhitelist(outgoingWhitelist []primitives.MemberId)
- func (g *CommunicationMock) UnregisterOnMessage(subscriptionToken int)
- type Discovery
- func (d *Discovery) AllCommunicationsMemberIds() []primitives.MemberId
- func (d *Discovery) Communications(memberIds []primitives.MemberId) []*CommunicationMock
- func (d *Discovery) GetCommunicationById(memberId primitives.MemberId) *CommunicationMock
- func (d *Discovery) RegisterCommunication(memberId primitives.MemberId, communication *CommunicationMock)
- func (d *Discovery) UnregisterCommunication(memberId primitives.MemberId)
- type ElectionTriggerMock
- func (et *ElectionTriggerMock) CalcTimeout(view primitives.View) time.Duration
- func (et *ElectionTriggerMock) ElectionChannel() chan func(ctx context.Context)
- func (et *ElectionTriggerMock) ManualTrigger(ctx context.Context)
- func (et *ElectionTriggerMock) ManualTriggerSync(ctx context.Context)
- func (et *ElectionTriggerMock) RegisterOnElection(ctx context.Context, blockHeight primitives.BlockHeight, view primitives.View, ...)
- func (et *ElectionTriggerMock) Stop()
- type InMemoryBlockChain
- type MockBlock
- type MockBlockUtils
- func (b *MockBlockUtils) CounterOfValidation() int
- func (b *MockBlockUtils) RequestNewBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, ...) (interfaces.Block, primitives.BlockHash)
- func (b *MockBlockUtils) ValidateBlockCommitment(blockHeight primitives.BlockHeight, block interfaces.Block, ...) bool
- func (b *MockBlockUtils) ValidateBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, ...) error
- type MockKeyManager
- func (km *MockKeyManager) AggregateRandomSeed(blockHeight primitives.BlockHeight, ...) primitives.RandomSeedSignature
- func (km *MockKeyManager) SignConsensusMessage(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.Signature
- func (km *MockKeyManager) SignRandomSeed(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.RandomSeedSignature
- func (km *MockKeyManager) VerifyConsensusMessage(blockHeight primitives.BlockHeight, content []byte, ...) error
- func (km *MockKeyManager) VerifyRandomSeed(blockHeight primitives.BlockHeight, content []byte, ...) error
- type MockMembership
- type SubscriptionValue
- type TermMessagesHandlerMock
- func (tmh *TermMessagesHandlerMock) HandleCommit(ctx context.Context, cm *interfaces.CommitMessage)
- func (tmh *TermMessagesHandlerMock) HandleNewView(ctx context.Context, nvm *interfaces.NewViewMessage)
- func (tmh *TermMessagesHandlerMock) HandlePrePrepare(ctx context.Context, ppm *interfaces.PreprepareMessage)
- func (tmh *TermMessagesHandlerMock) HandlePrepare(ctx context.Context, pm *interfaces.PrepareMessage)
- func (tmh *TermMessagesHandlerMock) HandleViewChange(ctx context.Context, vcm *interfaces.ViewChangeMessage)
- type VerifyRandomSeedCallParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ABlock ¶
func ABlock(previousBlock interfaces.Block) interfaces.Block
func CalculateBlockHash ¶
func CalculateBlockHash(block interfaces.Block) primitives.BlockHash
Types ¶
type BlocksPool ¶
type BlocksPool struct {
// contains filtered or unexported fields
}
func NewBlocksPool ¶
func NewBlocksPool(upcomingBlocks []interfaces.Block) *BlocksPool
func (*BlocksPool) PopBlock ¶
func (bp *BlocksPool) PopBlock(prevBlock interfaces.Block) interfaces.Block
type CommunicationMock ¶
type CommunicationMock struct {
// contains filtered or unexported fields
}
func NewCommunication ¶
func NewCommunication(discovery *Discovery) *CommunicationMock
func (*CommunicationMock) ClearIncomingWhitelist ¶
func (g *CommunicationMock) ClearIncomingWhitelist()
func (*CommunicationMock) ClearOutgoingWhitelist ¶
func (g *CommunicationMock) ClearOutgoingWhitelist()
func (*CommunicationMock) CountSentMessages ¶
func (g *CommunicationMock) CountSentMessages(messageType protocol.MessageType) int
func (*CommunicationMock) GetSentMessages ¶
func (g *CommunicationMock) GetSentMessages(messageType protocol.MessageType) []*interfaces.ConsensusRawMessage
func (*CommunicationMock) OnRemoteMessage ¶
func (g *CommunicationMock) OnRemoteMessage(ctx context.Context, rawMessage *interfaces.ConsensusRawMessage)
func (*CommunicationMock) RegisterOnMessage ¶
func (g *CommunicationMock) RegisterOnMessage(cb func(ctx context.Context, message *interfaces.ConsensusRawMessage)) int
func (*CommunicationMock) SendConsensusMessage ¶
func (g *CommunicationMock) SendConsensusMessage(ctx context.Context, targets []primitives.MemberId, message *interfaces.ConsensusRawMessage)
func (*CommunicationMock) SendToNode ¶
func (g *CommunicationMock) SendToNode(ctx context.Context, targetMemberId primitives.MemberId, consensusRawMessage *interfaces.ConsensusRawMessage)
func (*CommunicationMock) SetIncomingWhitelist ¶
func (g *CommunicationMock) SetIncomingWhitelist(incomingWhitelist []primitives.MemberId)
func (*CommunicationMock) SetMessagesMaxDelay ¶
func (g *CommunicationMock) SetMessagesMaxDelay(duration time.Duration)
func (*CommunicationMock) SetOutgoingWhitelist ¶
func (g *CommunicationMock) SetOutgoingWhitelist(outgoingWhitelist []primitives.MemberId)
func (*CommunicationMock) UnregisterOnMessage ¶
func (g *CommunicationMock) UnregisterOnMessage(subscriptionToken int)
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
func NewDiscovery ¶
func NewDiscovery() *Discovery
func (*Discovery) AllCommunicationsMemberIds ¶
func (d *Discovery) AllCommunicationsMemberIds() []primitives.MemberId
func (*Discovery) Communications ¶
func (d *Discovery) Communications(memberIds []primitives.MemberId) []*CommunicationMock
func (*Discovery) GetCommunicationById ¶
func (d *Discovery) GetCommunicationById(memberId primitives.MemberId) *CommunicationMock
func (*Discovery) RegisterCommunication ¶
func (d *Discovery) RegisterCommunication(memberId primitives.MemberId, communication *CommunicationMock)
func (*Discovery) UnregisterCommunication ¶
func (d *Discovery) UnregisterCommunication(memberId primitives.MemberId)
type ElectionTriggerMock ¶
type ElectionTriggerMock struct {
// contains filtered or unexported fields
}
func NewMockElectionTrigger ¶
func NewMockElectionTrigger() *ElectionTriggerMock
func (*ElectionTriggerMock) CalcTimeout ¶
func (et *ElectionTriggerMock) CalcTimeout(view primitives.View) time.Duration
func (*ElectionTriggerMock) ElectionChannel ¶
func (et *ElectionTriggerMock) ElectionChannel() chan func(ctx context.Context)
func (*ElectionTriggerMock) ManualTrigger ¶
func (et *ElectionTriggerMock) ManualTrigger(ctx context.Context)
func (*ElectionTriggerMock) ManualTriggerSync ¶
func (et *ElectionTriggerMock) ManualTriggerSync(ctx context.Context)
func (*ElectionTriggerMock) RegisterOnElection ¶
func (et *ElectionTriggerMock) RegisterOnElection(ctx context.Context, blockHeight primitives.BlockHeight, view primitives.View, electionHandler func(ctx context.Context, blockHeight primitives.BlockHeight, view primitives.View, onElectionCB func(m metrics.ElectionMetrics)))
func (*ElectionTriggerMock) Stop ¶
func (et *ElectionTriggerMock) Stop()
type InMemoryBlockChain ¶
type InMemoryBlockChain struct {
// contains filtered or unexported fields
}
func NewInMemoryBlockChain ¶
func NewInMemoryBlockChain() *InMemoryBlockChain
func (*InMemoryBlockChain) AppendBlockToChain ¶
func (bs *InMemoryBlockChain) AppendBlockToChain(block interfaces.Block, blockProof []byte)
func (*InMemoryBlockChain) GetBlockProofAt ¶
func (bs *InMemoryBlockChain) GetBlockProofAt(height primitives.BlockHeight) []byte
func (*InMemoryBlockChain) GetLastBlock ¶
func (bs *InMemoryBlockChain) GetLastBlock() interfaces.Block
func (*InMemoryBlockChain) GetLastBlockProof ¶
func (bs *InMemoryBlockChain) GetLastBlockProof() []byte
type MockBlock ¶
type MockBlock struct {
// contains filtered or unexported fields
}
MockBlock
func (*MockBlock) Height ¶
func (b *MockBlock) Height() primitives.BlockHeight
type MockBlockUtils ¶
type MockBlockUtils struct { PauseOnRequestNewBlock bool RequestNewBlockLatch *test.Latch ValidationCounter int ValidationLatch *test.Latch PauseOnValidation bool ValidationResult bool // contains filtered or unexported fields }
func NewMockBlockUtils ¶
func NewMockBlockUtils(blocksPool *BlocksPool) *MockBlockUtils
func (*MockBlockUtils) CounterOfValidation ¶
func (b *MockBlockUtils) CounterOfValidation() int
func (*MockBlockUtils) RequestNewBlockProposal ¶
func (b *MockBlockUtils) RequestNewBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, prevBlock interfaces.Block) (interfaces.Block, primitives.BlockHash)
func (*MockBlockUtils) ValidateBlockCommitment ¶
func (b *MockBlockUtils) ValidateBlockCommitment(blockHeight primitives.BlockHeight, block interfaces.Block, blockHash primitives.BlockHash) bool
func (*MockBlockUtils) ValidateBlockProposal ¶
func (b *MockBlockUtils) ValidateBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, block interfaces.Block, blockHash primitives.BlockHash, prevBlock interfaces.Block) error
type MockKeyManager ¶
type MockKeyManager struct { FailFutureVerifications bool VerifyRandomSeedHistory []*VerifyRandomSeedCallParams // contains filtered or unexported fields }
func NewMockKeyManager ¶
func NewMockKeyManager(memberId primitives.MemberId, rejectedMemberIds ...primitives.MemberId) *MockKeyManager
func (*MockKeyManager) AggregateRandomSeed ¶
func (km *MockKeyManager) AggregateRandomSeed(blockHeight primitives.BlockHeight, randomSeedShares []*protocol.SenderSignature) primitives.RandomSeedSignature
func (*MockKeyManager) SignConsensusMessage ¶
func (km *MockKeyManager) SignConsensusMessage(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.Signature
func (*MockKeyManager) SignRandomSeed ¶
func (km *MockKeyManager) SignRandomSeed(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.RandomSeedSignature
func (*MockKeyManager) VerifyConsensusMessage ¶
func (km *MockKeyManager) VerifyConsensusMessage(blockHeight primitives.BlockHeight, content []byte, sender *protocol.SenderSignature) error
func (*MockKeyManager) VerifyRandomSeed ¶
func (km *MockKeyManager) VerifyRandomSeed(blockHeight primitives.BlockHeight, content []byte, sender *protocol.SenderSignature) error
type MockMembership ¶
type MockMembership struct {
// contains filtered or unexported fields
}
func NewMockMembership ¶
func NewMockMembership(myMemberId primitives.MemberId, discovery *Discovery, orderCommitteeByHeight bool) *MockMembership
func (*MockMembership) MyMemberId ¶
func (m *MockMembership) MyMemberId() primitives.MemberId
func (*MockMembership) RequestOrderedCommittee ¶
func (m *MockMembership) RequestOrderedCommittee(ctx context.Context, blockHeight primitives.BlockHeight, randomSeed uint64) ([]primitives.MemberId, error)
type SubscriptionValue ¶
type SubscriptionValue struct {
// contains filtered or unexported fields
}
type TermMessagesHandlerMock ¶
type TermMessagesHandlerMock struct { HistoryPP []*interfaces.PreprepareMessage HistoryP []*interfaces.PrepareMessage HistoryC []*interfaces.CommitMessage HistoryNV []*interfaces.NewViewMessage HistoryVC []*interfaces.ViewChangeMessage }
func NewTermMessagesHandlerMock ¶
func NewTermMessagesHandlerMock() *TermMessagesHandlerMock
func (*TermMessagesHandlerMock) HandleCommit ¶
func (tmh *TermMessagesHandlerMock) HandleCommit(ctx context.Context, cm *interfaces.CommitMessage)
func (*TermMessagesHandlerMock) HandleNewView ¶
func (tmh *TermMessagesHandlerMock) HandleNewView(ctx context.Context, nvm *interfaces.NewViewMessage)
func (*TermMessagesHandlerMock) HandlePrePrepare ¶
func (tmh *TermMessagesHandlerMock) HandlePrePrepare(ctx context.Context, ppm *interfaces.PreprepareMessage)
func (*TermMessagesHandlerMock) HandlePrepare ¶
func (tmh *TermMessagesHandlerMock) HandlePrepare(ctx context.Context, pm *interfaces.PrepareMessage)
func (*TermMessagesHandlerMock) HandleViewChange ¶
func (tmh *TermMessagesHandlerMock) HandleViewChange(ctx context.Context, vcm *interfaces.ViewChangeMessage)
type VerifyRandomSeedCallParams ¶
type VerifyRandomSeedCallParams struct { BlockHeight primitives.BlockHeight Content []byte Sender *protocol.SenderSignature }
Click to show internal directories.
Click to hide internal directories.