Documentation ¶
Index ¶
- Constants
- func ControllerIdToMessageID(identifier []byte) types.MessageID
- func EncodeTransactions(transactions []*TransactionData) ([]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) CountAuxInValues(round Round) uint64
- func (s *ABAState) CountConfContainedInValues(round Round) uint64
- func (s *ABAState) GetValues(round Round) []byte
- func (s *ABAState) IncrementRound()
- func (s *ABAState) InitializeRound(round Round)
- type ACSRound
- type ACSState
- 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 DECData
- type HBBFTState
- func (s *HBBFTState) GetABAState(round ACSRound) *ABAState
- func (s *HBBFTState) GetBatchSize() int
- func (s *HBBFTState) GetCurrentABAState() *ABAState
- func (s *HBBFTState) GetDECMsgsMap(round ACSRound, author types.OperatorID) map[types.OperatorID][]byte
- func (s *HBBFTState) GetLenDECmsgs(round ACSRound, author types.OperatorID) uint64
- func (s *HBBFTState) GetRandomTransacations(n int) []*TransactionData
- func (s *HBBFTState) GetRound() ACSRound
- func (s *HBBFTState) IncrementRound()
- func (s *HBBFTState) InitMaps(round ACSRound)
- func (s *HBBFTState) RunACS(proposed_encrypted []byte) map[types.OperatorID][]byte
- func (s *HBBFTState) StoreBlockAndUpdateBuffer(y map[types.OperatorID][]*TransactionData)
- type Height
- type IConfig
- type Instance
- func (i *Instance) BaseMsgValidation(msg *SignedMessage) error
- func (i *Instance) Broadcast(msg *SignedMessage) error
- func (i *Instance) Decode(data []byte) error
- 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) HbbftLoop()
- 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)
- 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) GetDECData() (*DECData, error)
- func (msg *Message) GetRBCEchoData() (*RBCEchoData, error)
- func (msg *Message) GetRBCReadyData() (*RBCReadyData, error)
- func (msg *Message) GetRBCValData() (*RBCValData, error)
- func (msg *Message) GetRoot() ([]byte, error)
- func (msg *Message) GetTransactionData() (*TransactionData, 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) Decode(data []byte) error
- func (c *MsgContainer) Encode() ([]byte, error)
- 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 ProposedValueCheckF
- type ProposerF
- type RBCEchoData
- type RBCReadyData
- type RBCValData
- type Round
- type SignedMessage
- func CreateABAAux(state *State, config IConfig, vote byte, round Round, acRound ACSRound) (*SignedMessage, error)
- func CreateABAConf(state *State, config IConfig, votes []byte, round Round, acsRound ACSRound) (*SignedMessage, error)
- func CreateABAFinish(state *State, config IConfig, vote byte, acsRound ACSRound) (*SignedMessage, error)
- func CreateABAInit(state *State, config IConfig, vote byte, round Round, acsRound ACSRound) (*SignedMessage, error)
- func CreateDEC(state *State, config IConfig, acsRound ACSRound, operatorID types.OperatorID, ...) (*SignedMessage, error)
- func CreateRBCEcho(state *State, config IConfig, markleTree []byte, branch []byte, ...) (*SignedMessage, error)
- func CreateRBCReady(state *State, config IConfig, markleTree []byte) (*SignedMessage, error)
- func CreateRBCVal(state *State, config IConfig, markleTree []byte, branch []byte, ...) (*SignedMessage, error)
- func CreateTransaction(state *State, config IConfig, data []byte) (*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 TransactionData
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func ControllerIdToMessageID ¶
func EncodeTransactions ¶
func EncodeTransactions(transactions []*TransactionData) ([]byte, error)
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 // already sent message flags SentInit map[Round][]bool SentAux map[Round][]bool SentConf map[Round]bool SentFinish []bool // current ACS round ACSRound ACSRound // 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 }
func NewABAState ¶
func (*ABAState) AddToValues ¶
func (*ABAState) CountAuxInValues ¶
func (*ABAState) CountConfContainedInValues ¶
func (*ABAState) IncrementRound ¶
func (s *ABAState) IncrementRound()
func (*ABAState) InitializeRound ¶
type ACSState ¶
type ACSState struct {
ABAState *ABAState
}
func NewACSState ¶
func (*ACSState) GetABAState ¶
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 DECData ¶
type DECData struct { ACSRound ACSRound OperatorID types.OperatorID Sender types.OperatorID }
type HBBFTState ¶
type HBBFTState struct { BatchSize int Round ACSRound Buffer []*TransactionData ACSState map[ACSRound]*ACSState DECMsgs map[ACSRound]map[types.OperatorID]map[types.OperatorID][]byte }
func NewHBBFTState ¶
func NewHBBFTState() *HBBFTState
func (*HBBFTState) GetABAState ¶
func (s *HBBFTState) GetABAState(round ACSRound) *ABAState
func (*HBBFTState) GetBatchSize ¶
func (s *HBBFTState) GetBatchSize() int
func (*HBBFTState) GetCurrentABAState ¶
func (s *HBBFTState) GetCurrentABAState() *ABAState
func (*HBBFTState) GetDECMsgsMap ¶
func (s *HBBFTState) GetDECMsgsMap(round ACSRound, author types.OperatorID) map[types.OperatorID][]byte
func (*HBBFTState) GetLenDECmsgs ¶
func (s *HBBFTState) GetLenDECmsgs(round ACSRound, author types.OperatorID) uint64
func (*HBBFTState) GetRandomTransacations ¶
func (s *HBBFTState) GetRandomTransacations(n int) []*TransactionData
func (*HBBFTState) GetRound ¶
func (s *HBBFTState) GetRound() ACSRound
func (*HBBFTState) IncrementRound ¶
func (s *HBBFTState) IncrementRound()
func (*HBBFTState) InitMaps ¶
func (s *HBBFTState) InitMaps(round ACSRound)
func (*HBBFTState) RunACS ¶
func (s *HBBFTState) RunACS(proposed_encrypted []byte) map[types.OperatorID][]byte
func (*HBBFTState) StoreBlockAndUpdateBuffer ¶
func (s *HBBFTState) StoreBlockAndUpdateBuffer(y map[types.OperatorID][]*TransactionData)
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) BaseMsgValidation ¶
func (i *Instance) BaseMsgValidation(msg *SignedMessage) error
func (*Instance) Broadcast ¶
func (i *Instance) Broadcast(msg *SignedMessage) error
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
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 Round Round // QBFT round for which the msg is for 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) GetDECData ¶
GetData returns DEC specific data
func (*Message) GetRBCEchoData ¶
func (msg *Message) GetRBCEchoData() (*RBCEchoData, error)
GetData returns RBCEcho specific data
func (*Message) GetRBCReadyData ¶
func (msg *Message) GetRBCReadyData() (*RBCReadyData, error)
GetData returns RBCReady specific data
func (*Message) GetRBCValData ¶
func (msg *Message) GetRBCValData() (*RBCValData, error)
GetData returns RBCVal specific data
func (*Message) GetTransactionData ¶
func (msg *Message) GetTransactionData() (*TransactionData, error)
GetTransactionData returns transaction specific data
type MessageType ¶
type MessageType int
const ( TransactionMsgType MessageType = iota ABAInitMsgType ABAAuxMsgType ABAConfMsgType ABAFinishMsgType RBCValMsgType RBCEchoMsgType RBCReadyMsgType DECMsgType )
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) 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 ProposedValueCheckF ¶
type RBCEchoData ¶
func (*RBCEchoData) Decode ¶
func (d *RBCEchoData) Decode(data []byte) error
Decode returns error if decoding failed
func (*RBCEchoData) Encode ¶
func (d *RBCEchoData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*RBCEchoData) Validate ¶
func (d *RBCEchoData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, its variables for validity.
type RBCReadyData ¶
type RBCReadyData struct {
MarkleTree []byte
}
func (*RBCReadyData) Decode ¶
func (d *RBCReadyData) Decode(data []byte) error
Decode returns error if decoding failed
func (*RBCReadyData) Encode ¶
func (d *RBCReadyData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*RBCReadyData) Validate ¶
func (d *RBCReadyData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, its variables for validity.
type RBCValData ¶
func (*RBCValData) Decode ¶
func (d *RBCValData) Decode(data []byte) error
Decode returns error if decoding failed
func (*RBCValData) Encode ¶
func (d *RBCValData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
func (*RBCValData) Validate ¶
func (d *RBCValData) Validate() error
Validate returns error if msg validation doesn't pass. Msg validation checks the msg, its variables for validity.
type SignedMessage ¶
type SignedMessage struct { Signature types.Signature Signers []types.OperatorID Message *Message // message for which this signature is for }
func CreateABAAux ¶
func CreateABAConf ¶
func CreateABAFinish ¶
func CreateABAInit ¶
func CreateDEC ¶
func CreateDEC(state *State, config IConfig, acsRound ACSRound, operatorID types.OperatorID, sender types.OperatorID, decryptedShare []byte) (*SignedMessage, error)
CreateDEC
func CreateRBCEcho ¶
func CreateRBCEcho(state *State, config IConfig, markleTree []byte, branch []byte, erasureShare []byte) (*SignedMessage, error)
CreateRBCEcho
func CreateRBCReady ¶
func CreateRBCReady(state *State, config IConfig, markleTree []byte) (*SignedMessage, error)
CreateRBCReady
func CreateRBCVal ¶
func CreateRBCVal(state *State, config IConfig, markleTree []byte, branch []byte, erasureShare []byte) (*SignedMessage, error)
CreateRBCVal
func CreateTransaction ¶
func CreateTransaction(state *State, config IConfig, data []byte) (*SignedMessage, error)
CreateTransaction
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 HBBFTState *HBBFTState }
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 TransactionData ¶
type TransactionData struct {
Data []byte
}
func (*TransactionData) Decode ¶
func (d *TransactionData) Decode(data []byte) error
Decode returns error if decoding failed
func (*TransactionData) Encode ¶
func (d *TransactionData) Encode() ([]byte, error)
Encode returns a msg encoded bytes or error
Source Files ¶
- aba.go
- aba_state.go
- abaaux.go
- abaconf.go
- abafinish.go
- abainit.go
- acs_state.go
- coin.go
- controller.go
- dec.go
- decided.go
- future_msg.go
- hbbft_state.go
- instance.go
- merkle_tree.go
- message_container.go
- messages.go
- rbc_echo.go
- rbc_ready.go
- rbc_val.go
- round_robin_proposer.go
- state.go
- testing_utils.go
- transaction.go
- types.go