Documentation ¶
Index ¶
- Constants
- func ControllerIdToMessageID(identifier []byte) types.MessageID
- func EncodeProposals(proposals []*ProposalData) ([]byte, error)
- func GetProposalsHash(proposals []*ProposalData) ([]byte, error)
- func HasPartialQuorum(share *types.Share, msgs []*SignedMessage) bool
- func HasQuorum(share *types.Share, msgs []*SignedMessage) bool
- func IsDecidedMsg(share *types.Share, signedDecided *SignedMessage) bool
- func RoundRobinProposer(state *State, round Round) types.OperatorID
- func SharedCoinF(round Round) byte
- func ValidateDecided(config IConfig, signedDecided *SignedMessage, share *types.Share) error
- func ValidateFutureMsg(config IConfig, msg *SignedMessage, operators []*types.Operator) error
- type ABAAuxData
- type ABAConfData
- type ABAFinishData
- type ABAInitData
- type ABAState
- func (s *ABAState) AddToValues(round Round, vote byte)
- func (s *ABAState) CountAux(round Round, vote byte) uint64
- func (s *ABAState) CountAuxInValues(round Round) uint64
- func (s *ABAState) CountConf(round Round) uint64
- func (s *ABAState) CountConfContainedInValues(round Round) uint64
- func (s *ABAState) CountFinish(vote byte) uint64
- func (s *ABAState) CountInit(round Round, vote byte) uint64
- func (s *ABAState) GetVInput(round Round) byte
- func (s *ABAState) GetValues(round Round) []byte
- func (s *ABAState) HasAux(round Round, operatorID types.OperatorID, vote byte) bool
- func (s *ABAState) HasConf(round Round, operatorID types.OperatorID) bool
- func (s *ABAState) HasFinish(operatorID types.OperatorID) bool
- func (s *ABAState) HasInit(round Round, operatorID types.OperatorID, vote byte) bool
- func (s *ABAState) IncrementRound()
- func (s *ABAState) InitializeRound(round Round)
- func (s *ABAState) SentAux(round Round, vote byte) bool
- func (s *ABAState) SentConf(round Round) bool
- func (s *ABAState) SentFinish(vote byte) bool
- func (s *ABAState) SentInit(round Round, vote byte) bool
- func (s *ABAState) SetAux(round Round, operatorID types.OperatorID, vote byte)
- func (s *ABAState) SetConf(round Round, operatorID types.OperatorID, votes []byte)
- func (s *ABAState) SetDecided(vote byte)
- func (s *ABAState) SetFinish(operatorID types.OperatorID, vote byte)
- func (s *ABAState) SetInit(round Round, operatorID types.OperatorID, vote byte)
- func (s *ABAState) SetSentAux(round Round, vote byte, value bool)
- func (s *ABAState) SetSentConf(round Round, value bool)
- func (s *ABAState) SetSentFinish(vote byte, value bool)
- func (s *ABAState) SetSentInit(round Round, vote byte, value bool)
- func (s *ABAState) SetTerminate(value bool)
- func (s *ABAState) SetVInput(round Round, vote byte)
- type ACRound
- type ACState
- type CoinF
- type Config
- func (c *Config) GetCoinF() CoinF
- func (c *Config) GetNetwork() Network
- func (c *Config) GetProposerF() ProposerF
- func (c *Config) GetSignatureDomainType() types.DomainType
- func (c *Config) GetSigner() types.SSVSigner
- func (c *Config) GetSigningPubKey() []byte
- func (c *Config) GetTimer() Timer
- func (c *Config) GetValueCheckF() ProposedValueCheckF
- type Controller
- func (c *Controller) BaseMsgValidation(msg *SignedMessage) error
- func (c *Controller) CanStartInstance() error
- func (c *Controller) Decode(data []byte) error
- func (c *Controller) Encode() ([]byte, error)
- func (c *Controller) GetConfig() IConfig
- func (c *Controller) GetIdentifier() []byte
- func (c *Controller) GetRoot() ([]byte, error)
- func (c *Controller) InstanceForHeight(height Height) *Instance
- func (c *Controller) ProcessMsg(msg *SignedMessage) (*SignedMessage, error)
- func (c *Controller) StartNewInstance(value []byte) error
- func (c *Controller) UponDecided(msg *SignedMessage) (*SignedMessage, error)
- func (c *Controller) UponExistingInstanceMsg(msg *SignedMessage) (*SignedMessage, error)
- func (c *Controller) UponFutureMsg(msg *SignedMessage) (*SignedMessage, error)
- type FillGapData
- type FillerData
- type Height
- type IConfig
- type Instance
- func (i *Instance) AddOwnVCBCReady(proposals []*ProposalData, priorioty Priority) error
- func (i *Instance) AddVCBCOutput(proposals []*ProposalData, priority Priority, author types.OperatorID)
- func (i *Instance) BaseMsgValidation(msg *SignedMessage) error
- func (i *Instance) Broadcast(msg *SignedMessage) error
- func (i *Instance) Decode(data []byte) error
- func (i *Instance) Deliver(proposals []*ProposalData) int
- func (i *Instance) Encode() ([]byte, error)
- func (i *Instance) GetConfig() IConfig
- func (i *Instance) GetHeight() Height
- func (i *Instance) GetRoot() ([]byte, error)
- func (i *Instance) IsDecided() (bool, []byte)
- func (i *Instance) ProcessMsg(msg *SignedMessage) (decided bool, decidedValue []byte, aggregatedCommit *SignedMessage, err error)
- func (i *Instance) Start(value []byte, height Height)
- func (i *Instance) StartABA(vote byte) (byte, error)
- func (i *Instance) StartAgreementComponent() error
- func (i *Instance) StartVCBC(priority Priority) error
- func (i *Instance) WaitFillGapResponse(leader types.OperatorID, priority Priority, fillerContLen int)
- type InstanceContainer
- type Message
- func (msg *Message) Decode(data []byte) error
- func (msg *Message) Encode() ([]byte, error)
- func (msg *Message) GetABAAuxData() (*ABAAuxData, error)
- func (msg *Message) GetABAConfData() (*ABAConfData, error)
- func (msg *Message) GetABAFinishData() (*ABAFinishData, error)
- func (msg *Message) GetABAInitData() (*ABAInitData, error)
- func (msg *Message) GetFillGapData() (*FillGapData, error)
- func (msg *Message) GetFillerData() (*FillerData, error)
- func (msg *Message) GetProposalData() (*ProposalData, error)
- func (msg *Message) GetRoot() ([]byte, error)
- func (msg *Message) GetVCBCAnswerData() (*VCBCAnswerData, error)
- func (msg *Message) GetVCBCFinalData() (*VCBCFinalData, error)
- func (msg *Message) GetVCBCReadyData() (*VCBCReadyData, error)
- func (msg *Message) GetVCBCRequestData() (*VCBCRequestData, error)
- func (msg *Message) GetVCBCSendData() (*VCBCSendData, error)
- func (msg *Message) Validate() error
- type MessageType
- type MsgContainer
- func (c *MsgContainer) AddFirstMsgForSignerAndRound(msg *SignedMessage) (bool, error)
- func (c *MsgContainer) AddMsg(msg *SignedMessage)
- func (c *MsgContainer) AllMessaged() []*SignedMessage
- func (c *MsgContainer) Clear()
- func (c *MsgContainer) Decode(data []byte) error
- func (c *MsgContainer) Encode() ([]byte, error)
- func (c *MsgContainer) HasMsg(msg *SignedMessage) (bool, error)
- func (c *MsgContainer) Len(roundNumber Round) int
- func (c *MsgContainer) LongestUniqueSignersForRoundAndValue(round Round, value []byte) ([]types.OperatorID, []*SignedMessage)
- func (c *MsgContainer) MessagesForRound(round Round) []*SignedMessage
- func (c *MsgContainer) MessagesForRoundAndValue(round Round, value []byte) []*SignedMessage
- type Network
- type Priority
- type ProposalData
- type ProposedValueCheckF
- type ProposerF
- type Round
- type SignedMessage
- func AggregateMsgs(msgs []*SignedMessage) (*SignedMessage, error)
- func CreateABAAux(state *State, config IConfig, vote byte, round Round, acRound ACRound) (*SignedMessage, error)
- func CreateABAConf(state *State, config IConfig, votes []byte, round Round, acRound ACRound) (*SignedMessage, error)
- func CreateABAFinish(state *State, config IConfig, vote byte, acRound ACRound) (*SignedMessage, error)
- func CreateABAInit(state *State, config IConfig, vote byte, round Round, acRound ACRound) (*SignedMessage, error)
- func CreateFillGap(state *State, config IConfig, operatorID types.OperatorID, priority Priority) (*SignedMessage, error)
- func CreateFiller(state *State, config IConfig, entries [][]*ProposalData, priorities []Priority, ...) (*SignedMessage, error)
- func CreateProposal(state *State, config IConfig, value []byte) (*SignedMessage, error)
- func CreateVCBCAnswer(state *State, config IConfig, proposals []*ProposalData, priority Priority, ...) (*SignedMessage, error)
- func CreateVCBCFinal(state *State, config IConfig, hash []byte, priority Priority, ...) (*SignedMessage, error)
- func CreateVCBCReady(state *State, config IConfig, hash []byte, priority Priority, ...) (*SignedMessage, error)
- func CreateVCBCRequest(state *State, config IConfig, priority Priority, author types.OperatorID) (*SignedMessage, error)
- func CreateVCBCSend(state *State, config IConfig, proposals []*ProposalData, priority Priority, ...) (*SignedMessage, error)
- func (signedMsg *SignedMessage) Aggregate(sig types.MessageSignature) error
- func (signedMsg *SignedMessage) CommonSigners(ids []types.OperatorID) bool
- func (signedMsg *SignedMessage) Decode(data []byte) error
- func (signedMsg *SignedMessage) DeepCopy() *SignedMessage
- func (signedMsg *SignedMessage) Encode() ([]byte, error)
- func (signedMsg *SignedMessage) GetRoot() ([]byte, error)
- func (signedMsg *SignedMessage) GetSignature() types.Signature
- func (signedMsg *SignedMessage) GetSigners() []types.OperatorID
- func (signedMsg *SignedMessage) MatchedSigners(ids []types.OperatorID) bool
- func (signedMsg *SignedMessage) Validate() error
- type State
- type Syncer
- type Timer
- type VCBCAnswerData
- type VCBCFinalData
- type VCBCQueue
- func (queue *VCBCQueue) Clear()
- func (queue *VCBCQueue) Dequeue() ([]*ProposalData, Priority)
- func (queue *VCBCQueue) Enqueue(proposals []*ProposalData, priority Priority)
- func (queue *VCBCQueue) GetPriorities() []Priority
- func (queue *VCBCQueue) GetValues() [][]*ProposalData
- func (queue *VCBCQueue) HasPriority(priority Priority) bool
- func (queue *VCBCQueue) HasProposal(proposalInstance *ProposalData) bool
- func (queue *VCBCQueue) HasProposalList(proposalList []*ProposalData) bool
- func (queue *VCBCQueue) IsEmpty() bool
- func (queue *VCBCQueue) Peek() ([]*ProposalData, Priority)
- func (queue *VCBCQueue) PeekLast() ([]*ProposalData, Priority)
- type VCBCReadyData
- type VCBCRequestData
- type VCBCSendData
- type VCBCState
- func (s *VCBCState) AppendToM(operatorID types.OperatorID, priority Priority, proposal *ProposalData)
- func (s *VCBCState) AppendToW(operatorID types.OperatorID, priority Priority, signedMessage *SignedMessage)
- func (s *VCBCState) EqualM(operatorID types.OperatorID, priority Priority, proposals []*ProposalData) bool
- func (s *VCBCState) GetM(operatorID types.OperatorID, priority Priority) []*ProposalData
- func (s *VCBCState) GetR(operatorID types.OperatorID, priority Priority) uint64
- func (s *VCBCState) GetU(operatorID types.OperatorID, priority Priority) []byte
- func (s *VCBCState) GetW(operatorID types.OperatorID, priority Priority) []*SignedMessage
- func (s *VCBCState) HasM(operatorID types.OperatorID, priority Priority) bool
- func (s *VCBCState) HasReceivedReady(author types.OperatorID, priority Priority, operatorID types.OperatorID) bool
- func (s *VCBCState) IncrementR(operatorID types.OperatorID, priority Priority)
- func (s *VCBCState) SetM(operatorID types.OperatorID, priority Priority, proposals []*ProposalData)
- func (s *VCBCState) SetReceivedReady(author types.OperatorID, priority Priority, operatorID types.OperatorID, ...)
- func (s *VCBCState) SetU(operatorID types.OperatorID, priority Priority, u []byte)
Constants ¶
const ( NoRound Round = 0 // NoRound represents a nil/ zero round FirstRound Round = 1 // FirstRound value is the first round in any QBFT instance start FirstHeight Height = 0 FirstACRound ACRound = 1 )
Variables ¶
This section is empty.
Functions ¶
func ControllerIdToMessageID ¶
func EncodeProposals ¶
func EncodeProposals(proposals []*ProposalData) ([]byte, error)
Encode returns the list encoded bytes or error
func GetProposalsHash ¶
func GetProposalsHash(proposals []*ProposalData) ([]byte, error)
GetHash returns the SHA-256 hash
func HasPartialQuorum ¶
func HasPartialQuorum(share *types.Share, msgs []*SignedMessage) bool
HasPartialQuorum returns true if a unique set of signers has partial quorum
func HasQuorum ¶
func HasQuorum(share *types.Share, msgs []*SignedMessage) bool
HasQuorum returns true if a unique set of signers has quorum
func IsDecidedMsg ¶
func IsDecidedMsg(share *types.Share, signedDecided *SignedMessage) bool
IsDecidedMsg returns true if signed commit has all quorum sigs
func RoundRobinProposer ¶
func RoundRobinProposer(state *State, round Round) types.OperatorID
RoundRobinProposer returns the proposer for the round. Each new height starts with the first proposer and increments by 1 with each following round. Each new height has a different first round proposer which is +1 from the previous height. First height starts with index 0
func SharedCoinF ¶
func ValidateDecided ¶
func ValidateDecided( config IConfig, signedDecided *SignedMessage, share *types.Share, ) error
func ValidateFutureMsg ¶
func ValidateFutureMsg( config IConfig, msg *SignedMessage, operators []*types.Operator, ) error
Types ¶
type ABAAuxData ¶
func (*ABAAuxData) Decode ¶
func (d *ABAAuxData) Decode(data []byte) error
Decode returns error if decoding failed
func (*ABAAuxData) Encode ¶
func (d *ABAAuxData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*ABAAuxData) Validate ¶
func (d *ABAAuxData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type ABAConfData ¶
func (*ABAConfData) Decode ¶
func (d *ABAConfData) Decode(data []byte) error
Decode returns error if decoding failed
func (*ABAConfData) Encode ¶
func (d *ABAConfData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*ABAConfData) Validate ¶
func (d *ABAConfData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type ABAFinishData ¶
func (*ABAFinishData) Decode ¶
func (d *ABAFinishData) Decode(data []byte) error
Decode returns error if decoding failed
func (*ABAFinishData) Encode ¶
func (d *ABAFinishData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*ABAFinishData) Validate ¶
func (d *ABAFinishData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type ABAInitData ¶
func (*ABAInitData) Decode ¶
func (d *ABAInitData) Decode(data []byte) error
Decode returns error if decoding failed
func (*ABAInitData) Encode ¶
func (d *ABAInitData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*ABAInitData) Validate ¶
func (d *ABAInitData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type ABAState ¶
type ABAState struct { // message containers ABAInitContainer *MsgContainer ABAAuxContainer *MsgContainer ABAConfContainer *MsgContainer ABAFinishContainer *MsgContainer // message counters InitCounter map[Round]map[byte][]types.OperatorID AuxCounter map[Round]map[byte][]types.OperatorID ConfCounter map[Round][]types.OperatorID ConfValues map[Round]map[types.OperatorID][]byte FinishCounter map[byte][]types.OperatorID // current ABA round ACRound ACRound // value inputed to ABA Vin map[Round]byte // value decided by ABA Vdecided byte // current ABA round Round Round // values that completed strong support of INIT messages Values map[Round][]byte // terminate channel to announce to ABA caller Terminate bool // contains filtered or unexported fields }
func NewABAState ¶
func (*ABAState) AddToValues ¶
func (*ABAState) CountAuxInValues ¶
func (*ABAState) CountConfContainedInValues ¶
func (*ABAState) CountFinish ¶ added in v0.3.1
func (*ABAState) HasConf ¶ added in v0.3.1
func (s *ABAState) HasConf(round Round, operatorID types.OperatorID) bool
func (*ABAState) HasFinish ¶ added in v0.3.1
func (s *ABAState) HasFinish(operatorID types.OperatorID) bool
func (*ABAState) IncrementRound ¶
func (s *ABAState) IncrementRound()
func (*ABAState) InitializeRound ¶
func (*ABAState) SentFinish ¶
func (*ABAState) SetAux ¶ added in v0.3.1
func (s *ABAState) SetAux(round Round, operatorID types.OperatorID, vote byte)
func (*ABAState) SetConf ¶ added in v0.3.1
func (s *ABAState) SetConf(round Round, operatorID types.OperatorID, votes []byte)
func (*ABAState) SetDecided ¶ added in v0.3.1
func (*ABAState) SetFinish ¶ added in v0.3.1
func (s *ABAState) SetFinish(operatorID types.OperatorID, vote byte)
func (*ABAState) SetInit ¶ added in v0.3.1
func (s *ABAState) SetInit(round Round, operatorID types.OperatorID, vote byte)
func (*ABAState) SetSentAux ¶ added in v0.3.1
func (*ABAState) SetSentConf ¶ added in v0.3.1
func (*ABAState) SetSentFinish ¶ added in v0.3.1
func (*ABAState) SetSentInit ¶ added in v0.3.1
func (*ABAState) SetTerminate ¶ added in v0.3.1
type ACState ¶
func NewACState ¶
func NewACState() *ACState
func (*ACState) GetABAState ¶
func (*ACState) GetCurrentABAState ¶
func (*ACState) IncrementRound ¶
func (s *ACState) IncrementRound()
func (*ACState) InitializeRound ¶
type Config ¶
type Config struct { Signer types.SSVSigner SigningPK []byte Domain types.DomainType ValueCheckF ProposedValueCheckF ProposerF ProposerF Network Network Timer Timer CoinF CoinF }
func (*Config) GetNetwork ¶
GetNetwork returns a p2p Network instance
func (*Config) GetProposerF ¶
GetProposerF returns func used to calculate proposer
func (*Config) GetSignatureDomainType ¶
func (c *Config) GetSignatureDomainType() types.DomainType
GetSignatureDomainType returns the Domain type used for signatures
func (*Config) GetSigningPubKey ¶
GetSigningPubKey returns the public key used to sign all QBFT messages
func (*Config) GetValueCheckF ¶
func (c *Config) GetValueCheckF() ProposedValueCheckF
GetValueCheckF returns value check instance
type Controller ¶
type Controller struct { Identifier []byte Height Height // incremental Height for InstanceContainer // StoredInstances stores the last HistoricalInstanceCapacity in an array for message processing purposes. StoredInstances InstanceContainer // FutureMsgsContainer holds all msgs from a higher height FutureMsgsContainer map[types.OperatorID]Height // maps msg signer to height of higher height received msgs Domain types.DomainType // contains filtered or unexported fields }
Controller is a QBFT coordinator responsible for starting and following the entire life cycle of multiple QBFT InstanceContainer
func NewController ¶
func NewController( identifier []byte, share *types.Share, domain types.DomainType, config IConfig, ) *Controller
func (*Controller) BaseMsgValidation ¶
func (c *Controller) BaseMsgValidation(msg *SignedMessage) error
BaseMsgValidation returns error if msg is invalid (base validation)
func (*Controller) CanStartInstance ¶
func (c *Controller) CanStartInstance() error
CanStartInstance returns nil if controller can start a new instance
func (*Controller) GetConfig ¶
func (c *Controller) GetConfig() IConfig
func (*Controller) GetIdentifier ¶
func (c *Controller) GetIdentifier() []byte
GetIdentifier returns QBFT Identifier, used to identify messages
func (*Controller) GetRoot ¶
func (c *Controller) GetRoot() ([]byte, error)
GetRoot returns the state's deterministic root
func (*Controller) InstanceForHeight ¶
func (c *Controller) InstanceForHeight(height Height) *Instance
func (*Controller) ProcessMsg ¶
func (c *Controller) ProcessMsg(msg *SignedMessage) (*SignedMessage, error)
ProcessMsg processes a new msg, returns decided message or error
func (*Controller) StartNewInstance ¶
func (c *Controller) StartNewInstance(value []byte) error
StartNewInstance will start a new QBFT instance, if can't will return error
func (*Controller) UponDecided ¶
func (c *Controller) UponDecided(msg *SignedMessage) (*SignedMessage, error)
UponDecided returns decided msg if decided, nil otherwise
func (*Controller) UponExistingInstanceMsg ¶
func (c *Controller) UponExistingInstanceMsg(msg *SignedMessage) (*SignedMessage, error)
func (*Controller) UponFutureMsg ¶
func (c *Controller) UponFutureMsg(msg *SignedMessage) (*SignedMessage, error)
type FillGapData ¶
type FillGapData struct { OperatorID types.OperatorID Priority Priority }
func (*FillGapData) Decode ¶
func (d *FillGapData) Decode(data []byte) error
Decode returns error if decoding failed
func (*FillGapData) Encode ¶
func (d *FillGapData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*FillGapData) Validate ¶
func (d *FillGapData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type FillerData ¶
type FillerData struct { Entries [][]*ProposalData Priorities []Priority AggregatedMsgs [][]byte OperatorID types.OperatorID }
func (*FillerData) Decode ¶
func (d *FillerData) Decode(data []byte) error
Decode returns error if decoding failed
func (*FillerData) Encode ¶
func (d *FillerData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*FillerData) Validate ¶
func (d *FillerData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type IConfig ¶
type IConfig interface { // GetValueCheckF returns value check function GetValueCheckF() ProposedValueCheckF // GetProposerF returns func used to calculate proposer GetProposerF() ProposerF // GetNetwork returns a p2p Network instance GetNetwork() Network // GetTimer returns round timer GetTimer() Timer // GetCoinF returns a shared coin GetCoinF() CoinF // contains filtered or unexported methods }
type Instance ¶
Instance is a single QBFT instance that starts with a Start call (including a value). Every new msg the ProcessMsg function needs to be called
func NewInstance ¶
func (*Instance) AddOwnVCBCReady ¶
func (i *Instance) AddOwnVCBCReady(proposals []*ProposalData, priorioty Priority) error
func (*Instance) AddVCBCOutput ¶
func (i *Instance) AddVCBCOutput(proposals []*ProposalData, priority Priority, author types.OperatorID)
func (*Instance) BaseMsgValidation ¶
func (i *Instance) BaseMsgValidation(msg *SignedMessage) error
func (*Instance) Broadcast ¶
func (i *Instance) Broadcast(msg *SignedMessage) error
func (*Instance) Deliver ¶
func (i *Instance) Deliver(proposals []*ProposalData) int
func (*Instance) ProcessMsg ¶
func (i *Instance) ProcessMsg(msg *SignedMessage) (decided bool, decidedValue []byte, aggregatedCommit *SignedMessage, err error)
ProcessMsg processes a new QBFT msg, returns non nil error on msg processing error
func (*Instance) StartAgreementComponent ¶
func (*Instance) WaitFillGapResponse ¶
func (i *Instance) WaitFillGapResponse(leader types.OperatorID, priority Priority, fillerContLen int)
type InstanceContainer ¶
type InstanceContainer []*Instance
func (InstanceContainer) FindInstance ¶
func (i InstanceContainer) FindInstance(height Height) *Instance
type Message ¶
type Message struct { MsgType MessageType Height Height // QBFT instance Height (Though not used for AleaBFT, leave field) Round Round // QBFT round for which the msg is for (Though not used for AleaBFT, leave field) Identifier []byte // instance Identifier this msg belongs to Data []byte }
func (*Message) GetABAAuxData ¶
func (msg *Message) GetABAAuxData() (*ABAAuxData, error)
GetABAAuxData returns abainit specific data
func (*Message) GetABAConfData ¶
func (msg *Message) GetABAConfData() (*ABAConfData, error)
GetABAConfData returns abainit specific data
func (*Message) GetABAFinishData ¶
func (msg *Message) GetABAFinishData() (*ABAFinishData, error)
GetABAFinishData returns abainit specific data
func (*Message) GetABAInitData ¶
func (msg *Message) GetABAInitData() (*ABAInitData, error)
GetABAInitData returns abainit specific data
func (*Message) GetFillGapData ¶
func (msg *Message) GetFillGapData() (*FillGapData, error)
GetFillGapData returns fillgap specific data
func (*Message) GetFillerData ¶
func (msg *Message) GetFillerData() (*FillerData, error)
GetFillerData returns filler specific data
func (*Message) GetProposalData ¶
func (msg *Message) GetProposalData() (*ProposalData, error)
GetProposalData returns proposal specific data
func (*Message) GetVCBCAnswerData ¶
func (msg *Message) GetVCBCAnswerData() (*VCBCAnswerData, error)
VCBCAnswerData returns abainit specific data
func (*Message) GetVCBCFinalData ¶
func (msg *Message) GetVCBCFinalData() (*VCBCFinalData, error)
VCBCFinalData returns abainit specific data
func (*Message) GetVCBCReadyData ¶
func (msg *Message) GetVCBCReadyData() (*VCBCReadyData, error)
VCBCReadyData returns abainit specific data
func (*Message) GetVCBCRequestData ¶
func (msg *Message) GetVCBCRequestData() (*VCBCRequestData, error)
VCBCRequestData returns abainit specific data
func (*Message) GetVCBCSendData ¶
func (msg *Message) GetVCBCSendData() (*VCBCSendData, error)
VCBCSendData returns abainit specific data
type MessageType ¶
type MessageType int
const ( ProposalMsgType MessageType = iota FillGapMsgType FillerMsgType ABAInitMsgType ABAAuxMsgType ABAConfMsgType ABAFinishMsgType VCBCSendMsgType VCBCReadyMsgType VCBCFinalMsgType VCBCRequestMsgType VCBCAnswerMsgType )
type MsgContainer ¶
type MsgContainer struct {
Msgs map[Round][]*SignedMessage
}
func NewMsgContainer ¶
func NewMsgContainer() *MsgContainer
func (*MsgContainer) AddFirstMsgForSignerAndRound ¶
func (c *MsgContainer) AddFirstMsgForSignerAndRound(msg *SignedMessage) (bool, error)
AddFirstMsgForSignerAndRound will add the first msg for each signer for a specific round, consequent msgs will not be added
func (*MsgContainer) AddMsg ¶
func (c *MsgContainer) AddMsg(msg *SignedMessage)
AddMsg will add any message regardless of signers
func (*MsgContainer) AllMessaged ¶
func (c *MsgContainer) AllMessaged() []*SignedMessage
AllMessaged returns all messages
func (*MsgContainer) Decode ¶
func (c *MsgContainer) Decode(data []byte) error
Decode returns error if decoding failed
func (*MsgContainer) Encode ¶
func (c *MsgContainer) Encode() ([]byte, error)
Encode returns the encoded struct in bytes or error
func (*MsgContainer) HasMsg ¶
func (c *MsgContainer) HasMsg(msg *SignedMessage) (bool, error)
HasMsg returns if message exists in the container
func (*MsgContainer) Len ¶
func (c *MsgContainer) Len(roundNumber Round) int
Len returns the number of messages stored
func (*MsgContainer) LongestUniqueSignersForRoundAndValue ¶
func (c *MsgContainer) LongestUniqueSignersForRoundAndValue(round Round, value []byte) ([]types.OperatorID, []*SignedMessage)
LongestUniqueSignersForRoundAndValue returns the longest set of unique signers and msgs for a specific round and value
func (*MsgContainer) MessagesForRound ¶
func (c *MsgContainer) MessagesForRound(round Round) []*SignedMessage
MessagesForRound returns all msgs for Height and round, empty slice otherwise
func (*MsgContainer) MessagesForRoundAndValue ¶
func (c *MsgContainer) MessagesForRoundAndValue(round Round, value []byte) []*SignedMessage
MessagesForRoundAndValue returns all msgs for round and value, empty slice otherwise
type Network ¶
type Network interface { Syncer p2p.Broadcaster }
Network is the interface for networking across QBFT components
type ProposalData ¶
type ProposalData struct {
Data []byte
}
func DecodeProposals ¶
func DecodeProposals(data []byte) ([]*ProposalData, error)
Decode returns error if decoding failed
func (*ProposalData) Decode ¶
func (d *ProposalData) Decode(data []byte) error
Decode returns error if decoding failed
func (*ProposalData) Encode ¶
func (d *ProposalData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*ProposalData) Equal ¶
func (d *ProposalData) Equal(other *ProposalData) bool
func (*ProposalData) Validate ¶
func (d *ProposalData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type ProposedValueCheckF ¶
type SignedMessage ¶
type SignedMessage struct { Signature types.Signature Signers []types.OperatorID Message *Message // message for which this signature is for }
func AggregateMsgs ¶
func AggregateMsgs(msgs []*SignedMessage) (*SignedMessage, error)
func CreateABAAux ¶
func CreateABAConf ¶
func CreateABAFinish ¶
func CreateABAInit ¶
func CreateFillGap ¶
func CreateFillGap(state *State, config IConfig, operatorID types.OperatorID, priority Priority) (*SignedMessage, error)
func CreateFiller ¶
func CreateFiller(state *State, config IConfig, entries [][]*ProposalData, priorities []Priority, aggregatedMsgs [][]byte, operatorID types.OperatorID) (*SignedMessage, error)
func CreateProposal ¶
func CreateProposal(state *State, config IConfig, value []byte) (*SignedMessage, error)
CreateProposal
func CreateVCBCAnswer ¶
func CreateVCBCAnswer(state *State, config IConfig, proposals []*ProposalData, priority Priority, aggregatedMsg []byte, author types.OperatorID) (*SignedMessage, error)
func CreateVCBCFinal ¶
func CreateVCBCFinal(state *State, config IConfig, hash []byte, priority Priority, aggregatedMsg []byte, author types.OperatorID) (*SignedMessage, error)
func CreateVCBCReady ¶
func CreateVCBCReady(state *State, config IConfig, hash []byte, priority Priority, author types.OperatorID) (*SignedMessage, error)
func CreateVCBCRequest ¶
func CreateVCBCRequest(state *State, config IConfig, priority Priority, author types.OperatorID) (*SignedMessage, error)
func CreateVCBCSend ¶
func CreateVCBCSend(state *State, config IConfig, proposals []*ProposalData, priority Priority, author types.OperatorID) (*SignedMessage, error)
func (*SignedMessage) Aggregate ¶
func (signedMsg *SignedMessage) Aggregate(sig types.MessageSignature) error
Aggregate will aggregate the signed message if possible (unique signers, same digest, valid)
func (*SignedMessage) CommonSigners ¶
func (signedMsg *SignedMessage) CommonSigners(ids []types.OperatorID) bool
CommonSigners returns true if there is at least 1 common signer
func (*SignedMessage) Decode ¶
func (signedMsg *SignedMessage) Decode(data []byte) error
Decode returns error if decoding failed
func (*SignedMessage) DeepCopy ¶
func (signedMsg *SignedMessage) DeepCopy() *SignedMessage
DeepCopy returns a new instance of SignedMessage, deep copied
func (*SignedMessage) Encode ¶
func (signedMsg *SignedMessage) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*SignedMessage) GetRoot ¶
func (signedMsg *SignedMessage) GetRoot() ([]byte, error)
GetRoot returns the root used for signing and verification
func (*SignedMessage) GetSignature ¶
func (signedMsg *SignedMessage) GetSignature() types.Signature
func (*SignedMessage) GetSigners ¶
func (signedMsg *SignedMessage) GetSigners() []types.OperatorID
func (*SignedMessage) MatchedSigners ¶
func (signedMsg *SignedMessage) MatchedSigners(ids []types.OperatorID) bool
MatchedSigners returns true if the provided signer ids are equal to GetSignerIds() without order significance
func (*SignedMessage) Validate ¶
func (signedMsg *SignedMessage) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type State ¶
type State struct { ID []byte // instance Identifier Round Round Height Height LastPreparedRound Round LastPreparedValue []byte ProposalAcceptedForCurrentRound *SignedMessage Decided bool DecidedValue []byte ProposeContainer *MsgContainer PrepareContainer *MsgContainer CommitContainer *MsgContainer RoundChangeContainer *MsgContainer // alea AleaDefaultRound Round Delivered *VCBCQueue BatchSize int VCBCState *VCBCState StopAgreement bool ACState *ACState FillerMsgReceived int FillGapContainer *MsgContainer FillerContainer *MsgContainer }
type Timer ¶
type Timer interface { // TimeoutForRound will reset running timer if exists and will start a new timer for a specific round TimeoutForRound(round Round) }
Timer is an interface for a round timer, calling the UponRoundTimeout when times out
type VCBCAnswerData ¶
type VCBCAnswerData struct { Proposals []*ProposalData Priority Priority AggregatedMsg []byte Author types.OperatorID }
func (*VCBCAnswerData) Decode ¶
func (d *VCBCAnswerData) Decode(data []byte) error
Decode returns error if decoding failed
func (*VCBCAnswerData) Encode ¶
func (d *VCBCAnswerData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*VCBCAnswerData) Validate ¶
func (d *VCBCAnswerData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type VCBCFinalData ¶
type VCBCFinalData struct { Hash []byte Priority Priority AggregatedMsg []byte Author types.OperatorID }
func (*VCBCFinalData) Decode ¶
func (d *VCBCFinalData) Decode(data []byte) error
Decode returns error if decoding failed
func (*VCBCFinalData) Encode ¶
func (d *VCBCFinalData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*VCBCFinalData) Validate ¶
func (d *VCBCFinalData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type VCBCQueue ¶
type VCBCQueue struct {
// contains filtered or unexported fields
}
func NewVCBCQueue ¶
func NewVCBCQueue() *VCBCQueue
func (*VCBCQueue) Dequeue ¶
func (queue *VCBCQueue) Dequeue() ([]*ProposalData, Priority)
func (*VCBCQueue) Enqueue ¶
func (queue *VCBCQueue) Enqueue(proposals []*ProposalData, priority Priority)
func (*VCBCQueue) GetPriorities ¶
func (*VCBCQueue) GetValues ¶
func (queue *VCBCQueue) GetValues() [][]*ProposalData
func (*VCBCQueue) HasPriority ¶ added in v0.3.2
func (*VCBCQueue) HasProposal ¶ added in v0.3.1
func (queue *VCBCQueue) HasProposal(proposalInstance *ProposalData) bool
func (*VCBCQueue) HasProposalList ¶ added in v0.3.1
func (queue *VCBCQueue) HasProposalList(proposalList []*ProposalData) bool
func (*VCBCQueue) Peek ¶
func (queue *VCBCQueue) Peek() ([]*ProposalData, Priority)
func (*VCBCQueue) PeekLast ¶
func (queue *VCBCQueue) PeekLast() ([]*ProposalData, Priority)
type VCBCReadyData ¶
type VCBCReadyData struct { Hash []byte Priority Priority // Proof types.Signature Author types.OperatorID }
func (*VCBCReadyData) Decode ¶
func (d *VCBCReadyData) Decode(data []byte) error
Decode returns error if decoding failed
func (*VCBCReadyData) Encode ¶
func (d *VCBCReadyData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*VCBCReadyData) Validate ¶
func (d *VCBCReadyData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type VCBCRequestData ¶
type VCBCRequestData struct { Priority Priority Author types.OperatorID }
func (*VCBCRequestData) Decode ¶
func (d *VCBCRequestData) Decode(data []byte) error
Decode returns error if decoding failed
func (*VCBCRequestData) Encode ¶
func (d *VCBCRequestData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*VCBCRequestData) Validate ¶
func (d *VCBCRequestData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type VCBCSendData ¶
type VCBCSendData struct { Proposals []*ProposalData Priority Priority Author types.OperatorID }
func (*VCBCSendData) Decode ¶
func (d *VCBCSendData) Decode(data []byte) error
Decode returns error if decoding failed
func (*VCBCSendData) Encode ¶
func (d *VCBCSendData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*VCBCSendData) Validate ¶
func (d *VCBCSendData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, it's variables for validity.
type VCBCState ¶
type VCBCState struct { Priority Priority Queues map[types.OperatorID]*VCBCQueue // used to store info about READY messages received VCBCr map[types.OperatorID]map[Priority]uint64 VCBCW map[types.OperatorID]map[Priority][]*SignedMessage // used to store data from SEND messages received VCBCm map[types.OperatorID]map[Priority][]*ProposalData // used to store receipt proofs VCBCu map[types.OperatorID]map[Priority][]byte // store already received ready messages ReceivedReady map[types.OperatorID]map[Priority]map[types.OperatorID]bool }
func NewVCBCState ¶
func NewVCBCState() *VCBCState
func (*VCBCState) AppendToM ¶ added in v0.3.1
func (s *VCBCState) AppendToM(operatorID types.OperatorID, priority Priority, proposal *ProposalData)
func (*VCBCState) AppendToW ¶ added in v0.3.1
func (s *VCBCState) AppendToW(operatorID types.OperatorID, priority Priority, signedMessage *SignedMessage)
func (*VCBCState) EqualM ¶ added in v0.3.1
func (s *VCBCState) EqualM(operatorID types.OperatorID, priority Priority, proposals []*ProposalData) bool
func (*VCBCState) GetM ¶ added in v0.3.1
func (s *VCBCState) GetM(operatorID types.OperatorID, priority Priority) []*ProposalData
func (*VCBCState) GetR ¶ added in v0.3.1
func (s *VCBCState) GetR(operatorID types.OperatorID, priority Priority) uint64
func (*VCBCState) GetU ¶ added in v0.3.1
func (s *VCBCState) GetU(operatorID types.OperatorID, priority Priority) []byte
func (*VCBCState) GetW ¶ added in v0.3.1
func (s *VCBCState) GetW(operatorID types.OperatorID, priority Priority) []*SignedMessage
func (*VCBCState) HasM ¶ added in v0.3.1
func (s *VCBCState) HasM(operatorID types.OperatorID, priority Priority) bool
func (*VCBCState) HasReceivedReady ¶ added in v0.3.1
func (s *VCBCState) HasReceivedReady(author types.OperatorID, priority Priority, operatorID types.OperatorID) bool
func (*VCBCState) IncrementR ¶ added in v0.3.1
func (s *VCBCState) IncrementR(operatorID types.OperatorID, priority Priority)
func (*VCBCState) SetM ¶ added in v0.3.2
func (s *VCBCState) SetM(operatorID types.OperatorID, priority Priority, proposals []*ProposalData)
func (*VCBCState) SetReceivedReady ¶ added in v0.3.1
func (s *VCBCState) SetReceivedReady(author types.OperatorID, priority Priority, operatorID types.OperatorID, received bool)
Source Files ¶
- aba.go
- aba_state.go
- abaaux.go
- abaconf.go
- abafinish.go
- abainit.go
- ac_state.go
- coin.go
- controller.go
- decided.go
- filler.go
- fillgap.go
- future_msg.go
- instance.go
- message_container.go
- messages.go
- proposal.go
- round_robin_proposer.go
- state.go
- testing_utils.go
- types.go
- vcbc.go
- vcbc_answer.go
- vcbc_final.go
- vcbc_queue.go
- vcbc_ready.go
- vcbc_request.go
- vcbc_send.go
- vcbc_state.go