Documentation ¶
Overview ¶
Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func DkgToBft(dkgInfo []dkg.PartPub) []bft.BftPeer
- func InitLoggers(logger *logrus.Logger, logdir string)
- type AnnsensusMessage
- type AnnsensusMessageBftEncrypted
- func (z *AnnsensusMessageBftEncrypted) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageBftEncrypted) EncodeMsg(en *msgp.Writer) (err error)
- func (m *AnnsensusMessageBftEncrypted) GetBytes() []byte
- func (m *AnnsensusMessageBftEncrypted) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageBftEncrypted) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageBftEncrypted) Msgsize() (s int)
- func (m *AnnsensusMessageBftEncrypted) String() string
- func (z *AnnsensusMessageBftEncrypted) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageBftPlain
- func (z *AnnsensusMessageBftPlain) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageBftPlain) EncodeMsg(en *msgp.Writer) (err error)
- func (z *AnnsensusMessageBftPlain) GetBytes() []byte
- func (z *AnnsensusMessageBftPlain) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageBftPlain) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageBftPlain) Msgsize() (s int)
- func (z *AnnsensusMessageBftPlain) String() string
- func (z *AnnsensusMessageBftPlain) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageBftSigned
- func (z *AnnsensusMessageBftSigned) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageBftSigned) EncodeMsg(en *msgp.Writer) (err error)
- func (m *AnnsensusMessageBftSigned) GetBytes() []byte
- func (m *AnnsensusMessageBftSigned) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageBftSigned) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageBftSigned) Msgsize() (s int)
- func (m *AnnsensusMessageBftSigned) String() string
- func (z *AnnsensusMessageBftSigned) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageDkgEncrypted
- func (z *AnnsensusMessageDkgEncrypted) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageDkgEncrypted) EncodeMsg(en *msgp.Writer) (err error)
- func (m *AnnsensusMessageDkgEncrypted) GetBytes() []byte
- func (m *AnnsensusMessageDkgEncrypted) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageDkgEncrypted) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageDkgEncrypted) Msgsize() (s int)
- func (m *AnnsensusMessageDkgEncrypted) String() string
- func (z *AnnsensusMessageDkgEncrypted) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageDkgPlain
- func (z *AnnsensusMessageDkgPlain) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageDkgPlain) EncodeMsg(en *msgp.Writer) (err error)
- func (z *AnnsensusMessageDkgPlain) GetBytes() []byte
- func (z *AnnsensusMessageDkgPlain) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageDkgPlain) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageDkgPlain) Msgsize() (s int)
- func (z *AnnsensusMessageDkgPlain) String() string
- func (z *AnnsensusMessageDkgPlain) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageDkgSigned
- func (z *AnnsensusMessageDkgSigned) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *AnnsensusMessageDkgSigned) EncodeMsg(en *msgp.Writer) (err error)
- func (m *AnnsensusMessageDkgSigned) GetBytes() []byte
- func (m *AnnsensusMessageDkgSigned) GetType() AnnsensusMessageType
- func (z *AnnsensusMessageDkgSigned) MarshalMsg(b []byte) (o []byte, err error)
- func (z *AnnsensusMessageDkgSigned) Msgsize() (s int)
- func (m *AnnsensusMessageDkgSigned) String() string
- func (z *AnnsensusMessageDkgSigned) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusMessageEvent
- type AnnsensusMessageHandler
- type AnnsensusMessageType
- func (z *AnnsensusMessageType) DecodeMsg(dc *msgp.Reader) (err error)
- func (z AnnsensusMessageType) EncodeMsg(en *msgp.Writer) (err error)
- func (z AnnsensusMessageType) MarshalMsg(b []byte) (o []byte, err error)
- func (z AnnsensusMessageType) Msgsize() (s int)
- func (z *AnnsensusMessageType) UnmarshalMsg(bts []byte) (o []byte, err error)
- type AnnsensusPartner
- type AnnsensusPeer
- type AnnsensusPeerCommunicatorIncoming
- type AnnsensusPeerCommunicatorOutgoing
- type AnnsensusProcessorConfig
- type AnnsensusTermHolder
- func (b *AnnsensusTermHolder) DebugMyId() int
- func (b *AnnsensusTermHolder) GetTermByHeight(heightInfoCarrier HeightInfoCarrier) (msgTerm *TermCollection, ok bool)
- func (b *AnnsensusTermHolder) GetTermById(termId uint32) (msgTerm *TermCollection, ok bool)
- func (b *AnnsensusTermHolder) SetTerm(termId uint32, termCollection *TermCollection)
- type BftMessageAdapter
- type BftMessageUnmarshaller
- type BftPartnerProvider
- type ConsensusContext
- type ConsensusContextProvider
- type DefaultAnnsensusPartnerProvider
- type DkgMessageAdapter
- type DkgMessageUnmarshaller
- type DkgPartnerProvider
- type HeightInfoCarrier
- type HeightProvider
- type HistoricalTermsHolder
- type PlainBftAdapter
- func (p PlainBftAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg bft.BftMessage, err error)
- func (p PlainBftAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (bft.BftPeer, error)
- func (p PlainBftAdapter) AdaptBftMessage(outgoingMsg bft.BftMessage) (adaptedMessage AnnsensusMessage, err error)
- func (p PlainBftAdapter) AdaptBftPeer(bftPeer bft.BftPeer) (AnnsensusPeer, error)
- type PlainDkgAdapter
- func (p PlainDkgAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg dkg.DkgMessage, err error)
- func (p PlainDkgAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (dkg.DkgPeer, error)
- func (p PlainDkgAdapter) AdaptDkgMessage(outgoingMsg dkg.DkgMessage) (adaptedMessage AnnsensusMessage, err error)
- func (p PlainDkgAdapter) AdaptDkgPeer(dkgPeer dkg.DkgPeer) (AnnsensusPeer, error)
- type ProxyBftPeerCommunicator
- func (p *ProxyBftPeerCommunicator) Broadcast(msg bft.BftMessage, peers []bft.BftPeer)
- func (p *ProxyBftPeerCommunicator) GetPipeIn() chan *bft.BftMessageEvent
- func (p *ProxyBftPeerCommunicator) GetPipeOut() chan *bft.BftMessageEvent
- func (p *ProxyBftPeerCommunicator) Run()
- func (p *ProxyBftPeerCommunicator) Unicast(msg bft.BftMessage, peer bft.BftPeer)
- type ProxyDkgPeerCommunicator
- func (p *ProxyDkgPeerCommunicator) Broadcast(msg dkg.DkgMessage, peers []dkg.DkgPeer)
- func (p *ProxyDkgPeerCommunicator) GetPipeIn() chan *dkg.DkgMessageEvent
- func (p *ProxyDkgPeerCommunicator) GetPipeOut() chan *dkg.DkgMessageEvent
- func (p *ProxyDkgPeerCommunicator) Run()
- func (p *ProxyDkgPeerCommunicator) Unicast(msg dkg.DkgMessage, peer dkg.DkgPeer)
- type TermCollection
- type TermIdProvider
- type TrustfulBftAdapter
- func (b *TrustfulBftAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg bft.BftMessage, err error)
- func (r *TrustfulBftAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (bft.BftPeer, error)
- func (r *TrustfulBftAdapter) AdaptBftMessage(outgoingMsg bft.BftMessage) (msg AnnsensusMessage, err error)
- func (r *TrustfulBftAdapter) AdaptBftPeer(bftPeer bft.BftPeer) (AnnsensusPeer, error)
- func (r *TrustfulBftAdapter) Sign(rawMessage bft.BftMessage) AnnsensusMessageBftSigned
- func (b *TrustfulBftAdapter) VerifyMessageSignature(outMsg bft.BftMessage, publicKey []byte, signature []byte) error
- func (b *TrustfulBftAdapter) VerifyParnterIdentity(signedMsg *AnnsensusMessageBftSigned) error
- type TrustfulDkgAdapter
- func (b *TrustfulDkgAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg dkg.DkgMessage, err error)
- func (r *TrustfulDkgAdapter) AdaptDkgMessage(outgoingMsg dkg.DkgMessage) (msg AnnsensusMessage, err error)
- func (r *TrustfulDkgAdapter) Sign(message dkg.DkgMessage) AnnsensusMessageDkgSigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLoggers ¶
Types ¶
type AnnsensusMessage ¶ added in v0.0.7
type AnnsensusMessage interface { GetType() AnnsensusMessageType GetBytes() []byte String() string }
type AnnsensusMessageBftEncrypted ¶ added in v0.0.7
type AnnsensusMessageBftEncrypted struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessageEncrypted []byte PublicKey hexutil.Bytes }
func (*AnnsensusMessageBftEncrypted) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftEncrypted) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageBftEncrypted) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftEncrypted) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageBftEncrypted) GetBytes ¶ added in v0.0.7
func (m *AnnsensusMessageBftEncrypted) GetBytes() []byte
func (*AnnsensusMessageBftEncrypted) GetType ¶ added in v0.0.7
func (m *AnnsensusMessageBftEncrypted) GetType() AnnsensusMessageType
func (*AnnsensusMessageBftEncrypted) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftEncrypted) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageBftEncrypted) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageBftEncrypted) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageBftEncrypted) String ¶ added in v0.0.7
func (m *AnnsensusMessageBftEncrypted) String() string
func (*AnnsensusMessageBftEncrypted) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftEncrypted) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageBftPlain ¶ added in v0.0.7
type AnnsensusMessageBftPlain struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessage []byte }
func (*AnnsensusMessageBftPlain) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageBftPlain) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageBftPlain) GetBytes ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) GetBytes() []byte
func (*AnnsensusMessageBftPlain) GetType ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) GetType() AnnsensusMessageType
func (*AnnsensusMessageBftPlain) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageBftPlain) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageBftPlain) String ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) String() string
func (*AnnsensusMessageBftPlain) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftPlain) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageBftSigned ¶ added in v0.0.7
type AnnsensusMessageBftSigned struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessage []byte Signature hexutil.Bytes PublicKey hexutil.Bytes TermId uint32 }
func (*AnnsensusMessageBftSigned) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftSigned) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageBftSigned) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftSigned) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageBftSigned) GetBytes ¶ added in v0.0.7
func (m *AnnsensusMessageBftSigned) GetBytes() []byte
func (*AnnsensusMessageBftSigned) GetType ¶ added in v0.0.7
func (m *AnnsensusMessageBftSigned) GetType() AnnsensusMessageType
func (*AnnsensusMessageBftSigned) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftSigned) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageBftSigned) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageBftSigned) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageBftSigned) String ¶ added in v0.0.7
func (m *AnnsensusMessageBftSigned) String() string
func (*AnnsensusMessageBftSigned) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageBftSigned) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageDkgEncrypted ¶ added in v0.0.7
type AnnsensusMessageDkgEncrypted struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessageEncrypted []byte PublicKey hexutil.Bytes }
func (*AnnsensusMessageDkgEncrypted) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgEncrypted) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageDkgEncrypted) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgEncrypted) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageDkgEncrypted) GetBytes ¶ added in v0.0.7
func (m *AnnsensusMessageDkgEncrypted) GetBytes() []byte
func (*AnnsensusMessageDkgEncrypted) GetType ¶ added in v0.0.7
func (m *AnnsensusMessageDkgEncrypted) GetType() AnnsensusMessageType
func (*AnnsensusMessageDkgEncrypted) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgEncrypted) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageDkgEncrypted) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageDkgEncrypted) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageDkgEncrypted) String ¶ added in v0.0.7
func (m *AnnsensusMessageDkgEncrypted) String() string
func (*AnnsensusMessageDkgEncrypted) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgEncrypted) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageDkgPlain ¶ added in v0.0.7
type AnnsensusMessageDkgPlain struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessage []byte }
func (*AnnsensusMessageDkgPlain) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageDkgPlain) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageDkgPlain) GetBytes ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) GetBytes() []byte
func (*AnnsensusMessageDkgPlain) GetType ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) GetType() AnnsensusMessageType
func (*AnnsensusMessageDkgPlain) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageDkgPlain) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageDkgPlain) String ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) String() string
func (*AnnsensusMessageDkgPlain) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgPlain) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageDkgSigned ¶ added in v0.0.7
type AnnsensusMessageDkgSigned struct { InnerMessageType uint16 // either bft or dkg type, use uint16 to generalize it InnerMessage []byte Signature hexutil.Bytes PublicKey hexutil.Bytes TermId uint32 }
func (*AnnsensusMessageDkgSigned) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgSigned) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*AnnsensusMessageDkgSigned) EncodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgSigned) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*AnnsensusMessageDkgSigned) GetBytes ¶ added in v0.0.7
func (m *AnnsensusMessageDkgSigned) GetBytes() []byte
func (*AnnsensusMessageDkgSigned) GetType ¶ added in v0.0.7
func (m *AnnsensusMessageDkgSigned) GetType() AnnsensusMessageType
func (*AnnsensusMessageDkgSigned) MarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgSigned) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*AnnsensusMessageDkgSigned) Msgsize ¶ added in v0.0.7
func (z *AnnsensusMessageDkgSigned) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageDkgSigned) String ¶ added in v0.0.7
func (m *AnnsensusMessageDkgSigned) String() string
func (*AnnsensusMessageDkgSigned) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageDkgSigned) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusMessageEvent ¶ added in v0.0.7
type AnnsensusMessageEvent struct { Message AnnsensusMessage Peer AnnsensusPeer }
type AnnsensusMessageHandler ¶ added in v0.0.7
type AnnsensusMessageHandler interface {
HandleMessage(msg AnnsensusMessage, peer AnnsensusPeer)
}
type AnnsensusMessageType ¶ added in v0.0.7
type AnnsensusMessageType uint16
const ( AnnsensusMessageTypeBftPlain AnnsensusMessageType = iota + 100 AnnsensusMessageTypeBftSigned AnnsensusMessageTypeBftEncrypted AnnsensusMessageTypeDkgPlain AnnsensusMessageTypeDkgSigned AnnsensusMessageTypeDkgEncrypted )
all message type that is supported by annsensus should be listed here
func (*AnnsensusMessageType) DecodeMsg ¶ added in v0.0.7
func (z *AnnsensusMessageType) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (AnnsensusMessageType) EncodeMsg ¶ added in v0.0.7
func (z AnnsensusMessageType) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (AnnsensusMessageType) MarshalMsg ¶ added in v0.0.7
func (z AnnsensusMessageType) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (AnnsensusMessageType) Msgsize ¶ added in v0.0.7
func (z AnnsensusMessageType) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*AnnsensusMessageType) UnmarshalMsg ¶ added in v0.0.7
func (z *AnnsensusMessageType) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type AnnsensusPartner ¶ added in v0.0.7
type AnnsensusPartner struct { Config AnnsensusProcessorConfig BftAdapter BftMessageAdapter // message handlers in common. Injected into commuinicator DkgAdapter DkgMessageAdapter // message handlers in common. Injected into commuinicator TermProvider TermIdProvider TermHolder HistoricalTermsHolder // hold information for each term BftPartnerProvider BftPartnerProvider // factory method to generate a bft partner for each term DkgPartnerProvider DkgPartnerProvider // factory method to generate a dkg partner for each term ConsensusContextProvider ConsensusContextProvider PeerOutgoing AnnsensusPeerCommunicatorOutgoing PeerIncoming AnnsensusPeerCommunicatorIncoming // contains filtered or unexported fields }
AnnsensusPartner integrates dkg, bft and term change with vrf.
func (*AnnsensusPartner) HandleAnnsensusMessage ¶ added in v0.0.7
func (ap *AnnsensusPartner) HandleAnnsensusMessage(msgEvent *AnnsensusMessageEvent)
HandleConsensusMessage is a sub-router for routing consensus message to either bft,dkg or term. As part of Annsensus, bft,dkg and term may not be regarded as a separate component of OG. Annsensus itself is also a plugin of OG supporting consensus messages. Do not block the pipe for any message processing. Router should not be blocked. Use channel.
func (*AnnsensusPartner) InitDefault ¶ added in v0.0.7
func (a *AnnsensusPartner) InitDefault()
func (*AnnsensusPartner) Start ¶ added in v0.0.7
func (ap *AnnsensusPartner) Start()
Start makes AnnsensusPartner receive and handle consensus messages.
func (*AnnsensusPartner) StartNewTerm ¶ added in v0.0.7
func (ap *AnnsensusPartner) StartNewTerm(context ConsensusContext) error
func (*AnnsensusPartner) Stop ¶ added in v0.0.7
func (ap *AnnsensusPartner) Stop()
type AnnsensusPeer ¶ added in v0.0.7
type AnnsensusPeerCommunicatorIncoming ¶ added in v0.0.7
type AnnsensusPeerCommunicatorIncoming interface { GetPipeIn() chan *AnnsensusMessageEvent GetPipeOut() chan *AnnsensusMessageEvent }
type AnnsensusPeerCommunicatorOutgoing ¶ added in v0.0.7
type AnnsensusPeerCommunicatorOutgoing interface { Broadcast(msg AnnsensusMessage, peers []AnnsensusPeer) Unicast(msg AnnsensusMessage, peer AnnsensusPeer) }
type AnnsensusProcessorConfig ¶ added in v0.0.7
type AnnsensusProcessorConfig struct { DisableTermChange bool DisabledConsensus bool TermChangeInterval int GenesisAccounts crypto.PublicKeys }
type AnnsensusTermHolder ¶ added in v0.0.7
type AnnsensusTermHolder struct {
// contains filtered or unexported fields
}
func NewAnnsensusTermHolder ¶ added in v0.0.7
func NewAnnsensusTermHolder(termProvider TermIdProvider) *AnnsensusTermHolder
func (*AnnsensusTermHolder) DebugMyId ¶ added in v0.0.7
func (b *AnnsensusTermHolder) DebugMyId() int
func (*AnnsensusTermHolder) GetTermByHeight ¶ added in v0.0.7
func (b *AnnsensusTermHolder) GetTermByHeight(heightInfoCarrier HeightInfoCarrier) (msgTerm *TermCollection, ok bool)
func (*AnnsensusTermHolder) GetTermById ¶ added in v0.0.7
func (b *AnnsensusTermHolder) GetTermById(termId uint32) (msgTerm *TermCollection, ok bool)
func (*AnnsensusTermHolder) SetTerm ¶ added in v0.0.7
func (b *AnnsensusTermHolder) SetTerm(termId uint32, termCollection *TermCollection)
type BftMessageAdapter ¶ added in v0.0.7
type BftMessageAdapter interface { AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (bft.BftMessage, error) AdaptAnnsensusPeer(AnnsensusPeer) (bft.BftPeer, error) AdaptBftMessage(outgoingMsg bft.BftMessage) (AnnsensusMessage, error) AdaptBftPeer(bftPeer bft.BftPeer) (AnnsensusPeer, error) }
BftMessageAdapter converts messages. During the converting process there may be some validation and signing operations.
type BftMessageUnmarshaller ¶ added in v0.0.7
type BftMessageUnmarshaller struct { }
func (*BftMessageUnmarshaller) Unmarshal ¶ added in v0.0.7
func (b *BftMessageUnmarshaller) Unmarshal(messageType bft.BftMessageType, message []byte) (outMsg bft.BftMessage, err error)
type BftPartnerProvider ¶ added in v0.0.7
type BftPartnerProvider interface {
GetBftPartnerInstance(context ConsensusContext) bft.BftPartner
}
type ConsensusContext ¶ added in v0.0.7
type ConsensusContext interface { GetTerm() *term.Term GetMyBftId() int GetMyPartSec() dkg.PartSec GetBlockTime() time.Duration }
ConsensusContext provides not only term info but also the character the node play in this term.
type ConsensusContextProvider ¶ added in v0.0.7
type ConsensusContextProvider interface {
GetConsensusContext(newTerm *term.Term) ConsensusContext
}
type DefaultAnnsensusPartnerProvider ¶ added in v0.0.7
type DefaultAnnsensusPartnerProvider struct { MyAccountProvider account.AccountProvider // interface to the ledger ProposalGenerator bft.ProposalGenerator // interface to the ledger ProposalValidator bft.ProposalValidator // interface to the ledger DecisionMaker bft.DecisionMaker // interface to the ledger BftAdatper BftMessageAdapter DkgAdatper DkgMessageAdapter PeerOutgoing AnnsensusPeerCommunicatorOutgoing }
func (*DefaultAnnsensusPartnerProvider) GetBftPartnerInstance ¶ added in v0.0.7
func (d *DefaultAnnsensusPartnerProvider) GetBftPartnerInstance(context ConsensusContext) bft.BftPartner
func (*DefaultAnnsensusPartnerProvider) GetDkgPartnerInstance ¶ added in v0.0.7
func (d *DefaultAnnsensusPartnerProvider) GetDkgPartnerInstance(context ConsensusContext) (dkgPartner dkg.DkgPartner, err error)
type DkgMessageAdapter ¶ added in v0.0.7
type DkgMessageAdapter interface { AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (dkg.DkgMessage, error) AdaptAnnsensusPeer(AnnsensusPeer) (dkg.DkgPeer, error) AdaptDkgMessage(outgoingMsg dkg.DkgMessage) (AnnsensusMessage, error) AdaptDkgPeer(dkgPeer dkg.DkgPeer) (AnnsensusPeer, error) }
type DkgMessageUnmarshaller ¶ added in v0.0.7
type DkgMessageUnmarshaller struct { }
func (DkgMessageUnmarshaller) Unmarshal ¶ added in v0.0.7
func (b DkgMessageUnmarshaller) Unmarshal(messageType dkg.DkgMessageType, message []byte) (outMsg dkg.DkgMessage, err error)
type DkgPartnerProvider ¶ added in v0.0.7
type DkgPartnerProvider interface {
GetDkgPartnerInstance(context ConsensusContext) (dkg.DkgPartner, error)
}
type HeightInfoCarrier ¶ added in v0.0.7
type HeightInfoCarrier interface {
ProvideHeight() uint64
}
type HeightProvider ¶ added in v0.0.7
type HeightProvider interface {
CurrentHeight() uint64
}
HeightProvider is called when a height is needed. It is usually implemented by the chain info
type HistoricalTermsHolder ¶ added in v0.0.7
type HistoricalTermsHolder interface { GetTermByHeight(heightInfoCarrier HeightInfoCarrier) (msgTerm *TermCollection, ok bool) GetTermById(termId uint32) (msgTerm *TermCollection, ok bool) SetTerm(termId uint32, composer *TermCollection) DebugMyId() int }
HistoricalTermsHolder saves all historical term handlers(bft, dkg) and term info. In case of some slow messages are coming.
type PlainBftAdapter ¶ added in v0.0.7
type PlainBftAdapter struct {
BftMessageUnmarshaller *BftMessageUnmarshaller
}
PlainBftAdapter will not wrap the message using MessageTypeAnnsensusSigned
func (PlainBftAdapter) AdaptAnnsensusMessage ¶ added in v0.0.7
func (p PlainBftAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg bft.BftMessage, err error)
func (PlainBftAdapter) AdaptAnnsensusPeer ¶ added in v0.0.7
func (p PlainBftAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (bft.BftPeer, error)
func (PlainBftAdapter) AdaptBftMessage ¶ added in v0.0.7
func (p PlainBftAdapter) AdaptBftMessage(outgoingMsg bft.BftMessage) (adaptedMessage AnnsensusMessage, err error)
func (PlainBftAdapter) AdaptBftPeer ¶ added in v0.0.7
func (p PlainBftAdapter) AdaptBftPeer(bftPeer bft.BftPeer) (AnnsensusPeer, error)
type PlainDkgAdapter ¶ added in v0.0.7
type PlainDkgAdapter struct {
DkgMessageUnmarshaller *DkgMessageUnmarshaller
}
func (PlainDkgAdapter) AdaptAnnsensusMessage ¶ added in v0.0.7
func (p PlainDkgAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg dkg.DkgMessage, err error)
func (PlainDkgAdapter) AdaptAnnsensusPeer ¶ added in v0.0.7
func (p PlainDkgAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (dkg.DkgPeer, error)
func (PlainDkgAdapter) AdaptDkgMessage ¶ added in v0.0.7
func (p PlainDkgAdapter) AdaptDkgMessage(outgoingMsg dkg.DkgMessage) (adaptedMessage AnnsensusMessage, err error)
func (PlainDkgAdapter) AdaptDkgPeer ¶ added in v0.0.7
func (p PlainDkgAdapter) AdaptDkgPeer(dkgPeer dkg.DkgPeer) (AnnsensusPeer, error)
type ProxyBftPeerCommunicator ¶ added in v0.0.7
type ProxyBftPeerCommunicator struct {
// contains filtered or unexported fields
}
func NewProxyBftPeerCommunicator ¶ added in v0.0.7
func NewProxyBftPeerCommunicator( bftMessageAdapter BftMessageAdapter, annsensusOutgoing AnnsensusPeerCommunicatorOutgoing) *ProxyBftPeerCommunicator
func (*ProxyBftPeerCommunicator) Broadcast ¶ added in v0.0.7
func (p *ProxyBftPeerCommunicator) Broadcast(msg bft.BftMessage, peers []bft.BftPeer)
func (*ProxyBftPeerCommunicator) GetPipeIn ¶ added in v0.0.7
func (p *ProxyBftPeerCommunicator) GetPipeIn() chan *bft.BftMessageEvent
func (*ProxyBftPeerCommunicator) GetPipeOut ¶ added in v0.0.7
func (p *ProxyBftPeerCommunicator) GetPipeOut() chan *bft.BftMessageEvent
func (*ProxyBftPeerCommunicator) Run ¶ added in v0.0.7
func (p *ProxyBftPeerCommunicator) Run()
func (*ProxyBftPeerCommunicator) Unicast ¶ added in v0.0.7
func (p *ProxyBftPeerCommunicator) Unicast(msg bft.BftMessage, peer bft.BftPeer)
type ProxyDkgPeerCommunicator ¶ added in v0.0.7
type ProxyDkgPeerCommunicator struct {
// contains filtered or unexported fields
}
func NewProxyDkgPeerCommunicator ¶ added in v0.0.7
func NewProxyDkgPeerCommunicator( dkgMessageAdapter DkgMessageAdapter, annsensusCommunicator AnnsensusPeerCommunicatorOutgoing) *ProxyDkgPeerCommunicator
func (*ProxyDkgPeerCommunicator) Broadcast ¶ added in v0.0.7
func (p *ProxyDkgPeerCommunicator) Broadcast(msg dkg.DkgMessage, peers []dkg.DkgPeer)
func (*ProxyDkgPeerCommunicator) GetPipeIn ¶ added in v0.0.7
func (p *ProxyDkgPeerCommunicator) GetPipeIn() chan *dkg.DkgMessageEvent
func (*ProxyDkgPeerCommunicator) GetPipeOut ¶ added in v0.0.7
func (p *ProxyDkgPeerCommunicator) GetPipeOut() chan *dkg.DkgMessageEvent
func (*ProxyDkgPeerCommunicator) Run ¶ added in v0.0.7
func (p *ProxyDkgPeerCommunicator) Run()
func (*ProxyDkgPeerCommunicator) Unicast ¶ added in v0.0.7
func (p *ProxyDkgPeerCommunicator) Unicast(msg dkg.DkgMessage, peer dkg.DkgPeer)
type TermCollection ¶ added in v0.0.7
type TermCollection struct { BftPartner bft.BftPartner DkgPartner dkg.DkgPartner // contains filtered or unexported fields }
func NewTermCollection ¶ added in v0.0.7
func NewTermCollection( contextProvider ConsensusContext, bftPartner bft.BftPartner, dkgPartner dkg.DkgPartner) *TermCollection
func (*TermCollection) Start ¶ added in v0.0.7
func (tc *TermCollection) Start()
func (*TermCollection) Stop ¶ added in v0.0.7
func (tc *TermCollection) Stop()
type TermIdProvider ¶ added in v0.0.7
type TermIdProvider interface { // HeightTerm maps height to dkg term HeightTerm(height uint64) (termId uint32) CurrentTerm() (termId uint32) GetTermChangeEventChannel() chan ConsensusContext }
TermIdProvider provide Dkg term that will be changed every term switching. TermIdProvider maintains historic Sender info that can be retrieved by height. Once a new term is started, the term info will be sent through TermChangeEventChannel
type TrustfulBftAdapter ¶ added in v0.0.7
type TrustfulBftAdapter struct {
// contains filtered or unexported fields
}
TrustfulBftAdapter signs and validate messages using pubkey/privkey given by DKG/BLS
func NewTrustfulBftAdapter ¶ added in v0.0.7
func NewTrustfulBftAdapter( signatureProvider account.SignatureProvider, termHolder HistoricalTermsHolder) *TrustfulBftAdapter
func (*TrustfulBftAdapter) AdaptAnnsensusMessage ¶ added in v0.0.7
func (b *TrustfulBftAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg bft.BftMessage, err error)
func (*TrustfulBftAdapter) AdaptAnnsensusPeer ¶ added in v0.0.7
func (r *TrustfulBftAdapter) AdaptAnnsensusPeer(annPeer AnnsensusPeer) (bft.BftPeer, error)
func (*TrustfulBftAdapter) AdaptBftMessage ¶ added in v0.0.7
func (r *TrustfulBftAdapter) AdaptBftMessage(outgoingMsg bft.BftMessage) (msg AnnsensusMessage, err error)
func (*TrustfulBftAdapter) AdaptBftPeer ¶ added in v0.0.7
func (r *TrustfulBftAdapter) AdaptBftPeer(bftPeer bft.BftPeer) (AnnsensusPeer, error)
func (*TrustfulBftAdapter) Sign ¶ added in v0.0.7
func (r *TrustfulBftAdapter) Sign(rawMessage bft.BftMessage) AnnsensusMessageBftSigned
func (*TrustfulBftAdapter) VerifyMessageSignature ¶ added in v0.0.7
func (b *TrustfulBftAdapter) VerifyMessageSignature(outMsg bft.BftMessage, publicKey []byte, signature []byte) error
func (*TrustfulBftAdapter) VerifyParnterIdentity ¶ added in v0.0.7
func (b *TrustfulBftAdapter) VerifyParnterIdentity(signedMsg *AnnsensusMessageBftSigned) error
type TrustfulDkgAdapter ¶ added in v0.0.7
type TrustfulDkgAdapter struct {
// contains filtered or unexported fields
}
TrustfulDkgAdapter signs and validate messages using pubkey/privkey given by DKG/BLS
func NewTrustfulDkgAdapter ¶ added in v0.0.7
func NewTrustfulDkgAdapter() *TrustfulDkgAdapter
func (*TrustfulDkgAdapter) AdaptAnnsensusMessage ¶ added in v0.0.7
func (b *TrustfulDkgAdapter) AdaptAnnsensusMessage(incomingMsg AnnsensusMessage) (msg dkg.DkgMessage, err error)
func (*TrustfulDkgAdapter) AdaptDkgMessage ¶ added in v0.0.7
func (r *TrustfulDkgAdapter) AdaptDkgMessage(outgoingMsg dkg.DkgMessage) (msg AnnsensusMessage, err error)
func (*TrustfulDkgAdapter) Sign ¶ added in v0.0.7
func (r *TrustfulDkgAdapter) Sign(message dkg.DkgMessage) AnnsensusMessageDkgSigned
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
// Copyright © 2019 Annchain Authors <EMAIL ADDRESS> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.
|
// Copyright © 2019 Annchain Authors <EMAIL ADDRESS> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. |