Documentation ¶
Index ¶
- Constants
- Variables
- type BroadcastMessenger
- type ChronologyHandler
- type FallbackHeaderValidator
- type HeaderSigVerifier
- type HeadersPoolSubscriber
- type InterceptorSubscriber
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (this *Message) Equal(that interface{}) bool
- func (m *Message) GetAggregateSignature() []byte
- func (m *Message) GetBlockHeaderHash() []byte
- func (m *Message) GetBody() []byte
- func (m *Message) GetChainID() []byte
- func (m *Message) GetHeader() []byte
- func (m *Message) GetLeaderSignature() []byte
- func (m *Message) GetMsgType() int64
- func (m *Message) GetOriginatorPid() []byte
- func (m *Message) GetPubKey() []byte
- func (m *Message) GetPubKeysBitmap() []byte
- func (m *Message) GetRoundIndex() int64
- func (m *Message) GetSignature() []byte
- func (m *Message) GetSignatureShare() []byte
- func (this *Message) GoString() string
- func (m *Message) Marshal() (dAtA []byte, err error)
- func (m *Message) MarshalTo(dAtA []byte) (int, error)
- func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (this *Message) String() string
- func (m *Message) Unmarshal(dAtA []byte) error
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type MessageType
- type NetworkShardingCollector
- type NodeRedundancyHandler
- type P2PAntifloodHandler
- type P2PMessenger
- type PeerHonestyHandler
- type RoundHandler
- type ScheduledProcessor
- type SignatureHandler
- type SubroundHandler
Constants ¶
const BlsConsensusType = "bls"
BlsConsensusType specifies the signature scheme used in the consensus
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BroadcastMessenger ¶
type BroadcastMessenger interface { BroadcastBlock(data.BodyHandler, data.HeaderHandler) error BroadcastHeader(data.HeaderHandler) error BroadcastMiniBlocks(map[uint32][]byte) error BroadcastTransactions(map[string][][]byte) error BroadcastConsensusMessage(*Message) error BroadcastBlockDataLeader(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte) error PrepareBroadcastHeaderValidator(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte, order int) PrepareBroadcastBlockDataValidator(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte, idx int) IsInterfaceNil() bool }
BroadcastMessenger defines the behaviour of the broadcast messages by the consensus group
type ChronologyHandler ¶
type ChronologyHandler interface { Close() error AddSubround(SubroundHandler) RemoveAllSubrounds() // StartRounds starts rounds in a sequential manner, one after the other StartRounds() IsInterfaceNil() bool }
ChronologyHandler defines the actions which should be handled by a chronology implementation
type FallbackHeaderValidator ¶
type FallbackHeaderValidator interface { ShouldApplyFallbackValidation(headerHandler data.HeaderHandler) bool IsInterfaceNil() bool }
FallbackHeaderValidator defines the behaviour of a component able to signal when a fallback header validation could be applied
type HeaderSigVerifier ¶
type HeaderSigVerifier interface { VerifyRandSeed(header data.HeaderHandler) error VerifyLeaderSignature(header data.HeaderHandler) error VerifySignature(header data.HeaderHandler) error IsInterfaceNil() bool }
HeaderSigVerifier encapsulates methods that are check if header rand seed, leader signature and aggregate signature are correct
type HeadersPoolSubscriber ¶
type HeadersPoolSubscriber interface { RegisterHandler(handler func(headerHandler data.HeaderHandler, headerHash []byte)) IsInterfaceNil() bool }
HeadersPoolSubscriber can subscribe for notifications when a new block header is added to the headers pool
type InterceptorSubscriber ¶
type InterceptorSubscriber interface { RegisterHandler(handler func(toShard uint32, data []byte)) IsInterfaceNil() bool }
InterceptorSubscriber can subscribe for notifications when data is received by an interceptor
type Message ¶
type Message struct { BlockHeaderHash []byte `protobuf:"bytes,1,opt,name=BlockHeaderHash,proto3" json:"BlockHeaderHash,omitempty"` Body []byte `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` Header []byte `protobuf:"bytes,4,opt,name=Header,proto3" json:"Header,omitempty"` PubKey []byte `protobuf:"bytes,5,opt,name=PubKey,proto3" json:"PubKey,omitempty"` Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` MsgType int64 `protobuf:"varint,7,opt,name=MsgType,proto3" json:"MsgType,omitempty"` RoundIndex int64 `protobuf:"varint,8,opt,name=RoundIndex,proto3" json:"RoundIndex,omitempty"` ChainID []byte `protobuf:"bytes,9,opt,name=ChainID,proto3" json:"ChainID,omitempty"` PubKeysBitmap []byte `protobuf:"bytes,10,opt,name=PubKeysBitmap,proto3" json:"PubKeysBitmap,omitempty"` AggregateSignature []byte `protobuf:"bytes,11,opt,name=AggregateSignature,proto3" json:"AggregateSignature,omitempty"` LeaderSignature []byte `protobuf:"bytes,12,opt,name=LeaderSignature,proto3" json:"LeaderSignature,omitempty"` OriginatorPid []byte `protobuf:"bytes,13,opt,name=OriginatorPid,proto3" json:"OriginatorPid,omitempty"` }
Message defines the data needed by spos to communicate between nodes over network in all subrounds
func NewConsensusMessage ¶
func NewConsensusMessage( blHeaderHash []byte, signatureShare []byte, body []byte, header []byte, pubKey []byte, sig []byte, msg int, roundIndex int64, chainID []byte, pubKeysBitmap []byte, aggregateSignature []byte, leaderSignature []byte, currentPid core.PeerID, ) *Message
NewConsensusMessage creates a new Message object
func (*Message) Descriptor ¶
func (*Message) GetAggregateSignature ¶
func (*Message) GetBlockHeaderHash ¶
func (*Message) GetChainID ¶
func (*Message) GetLeaderSignature ¶
func (*Message) GetMsgType ¶
func (*Message) GetOriginatorPid ¶
func (*Message) GetPubKeysBitmap ¶
func (*Message) GetRoundIndex ¶
func (*Message) GetSignature ¶
func (*Message) GetSignatureShare ¶
func (*Message) MarshalToSizedBuffer ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type NetworkShardingCollector ¶
type NetworkShardingCollector interface { UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32) PutPeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType) GetPeerInfo(pid core.PeerID) core.P2PPeerInfo IsInterfaceNil() bool }
NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components
type NodeRedundancyHandler ¶
type NodeRedundancyHandler interface { IsRedundancyNode() bool IsMainMachineActive() bool AdjustInactivityIfNeeded(selfPubKey string, consensusPubKeys []string, roundIndex int64) ResetInactivityIfNeeded(selfPubKey string, consensusMsgPubKey string, consensusMsgPeerID core.PeerID) ObserverPrivateKey() crypto.PrivateKey IsInterfaceNil() bool }
NodeRedundancyHandler provides functionality to handle the redundancy mechanism for a node
type P2PAntifloodHandler ¶
type P2PAntifloodHandler interface { CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error ResetForTopic(topic string) SetMaxMessagesForTopic(topic string, maxNum uint32) BlacklistPeer(peer core.PeerID, reason string, duration time.Duration) IsInterfaceNil() bool }
P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages
type P2PMessenger ¶
P2PMessenger defines a subset of the p2p.Messenger interface
type PeerHonestyHandler ¶
type PeerHonestyHandler interface { ChangeScore(pk string, topic string, units int) IsInterfaceNil() bool Close() error }
PeerHonestyHandler defines the behaivour of a component able to handle/monitor the peer honesty of nodes which are participating in consensus
type RoundHandler ¶
type RoundHandler interface { Index() int64 BeforeGenesis() bool // UpdateRound updates the index and the time stamp of the round depending on the genesis time and the current time given UpdateRound(time.Time, time.Time) TimeStamp() time.Time TimeDuration() time.Duration RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration IsInterfaceNil() bool }
RoundHandler defines the actions which should be handled by a round implementation
type ScheduledProcessor ¶
type ScheduledProcessor interface { StartScheduledProcessing(header data.HeaderHandler, body data.BodyHandler, startTime time.Time) ForceStopScheduledExecutionBlocking() IsProcessedOKWithTimeout() bool IsInterfaceNil() bool }
ScheduledProcessor encapsulates the scheduled processor functionality required by consensus module
type SignatureHandler ¶
type SignatureHandler interface { Reset(pubKeys []string) error AggregateSigs(bitmap []byte, epoch uint32) ([]byte, error) SetAggregatedSig([]byte) error Verify(msg []byte, bitmap []byte, epoch uint32) error IsInterfaceNil() bool }
SignatureHandler defines the behaviour of a component that handles signatures in consensus
type SubroundHandler ¶
type SubroundHandler interface { // DoWork implements of the subround's job DoWork(ctx context.Context, roundHandler RoundHandler) bool // Previous returns the ID of the previous subround Previous() int // Next returns the ID of the next subround Next() int // Current returns the ID of the current subround Current() int // StartTime returns the start time, in the roundHandler time, of the current subround StartTime() int64 // EndTime returns the top limit time, in the roundHandler time, of the current subround EndTime() int64 // Name returns the name of the current roundHandler Name() string // ConsensusChannel returns the consensus channel ConsensusChannel() chan bool // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
SubroundHandler defines the actions which should be handled by a subround implementation