Documentation ¶
Index ¶
- Variables
- func GetNodeListFromConfig(chainConfig *config.ChainConfig) (validators []string)
- func VerifyBlockSignatures(chainConf protocol.ChainConf, ac protocol.AccessControlProvider, ...) error
- type ACS
- type ACSStateJson
- type BBA
- func (bba *BBA) AcceptInput() bool
- func (bba *BBA) GetBBAStateJson() *BBAStateJson
- func (bba *BBA) HandleMessage(sender string, msg *abftpb.BBARequest) error
- func (bba *BBA) Input(val bool) error
- func (bba *BBA) Messages() []*abftpb.ABFTMessageReq
- func (bba *BBA) Output() (outputted bool, output bool)
- type BBAStateJson
- type Config
- type ConsensusABFTImpl
- func (consensus *ConsensusABFTImpl) Close() error
- func (consensus *ConsensusABFTImpl) GetAllNodeInfos() []consensuspb.ConsensusNodeInfo
- func (consensus *ConsensusABFTImpl) GetConsensusStateJSON() ([]byte, error)
- func (consensus *ConsensusABFTImpl) GetConsensusType() consensuspb.ConsensusType
- func (consensus *ConsensusABFTImpl) GetLastHeight() uint64
- func (consensus *ConsensusABFTImpl) GetValidators() ([]string, error)
- func (consensus *ConsensusABFTImpl) OnMessage(message *msgbus.Message)
- func (consensus *ConsensusABFTImpl) OnQuit()
- func (consensus *ConsensusABFTImpl) Start() error
- func (consensus *ConsensusABFTImpl) Stop() error
- type Event
- type RBC
- type RBCStateJson
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetNodeListFromConfig ¶
func GetNodeListFromConfig(chainConfig *config.ChainConfig) (validators []string)
GetNodeListFromConfig get consensus node list
func VerifyBlockSignatures ¶
func VerifyBlockSignatures(chainConf protocol.ChainConf, ac protocol.AccessControlProvider, block *common.Block) error
VerifyBlockSignatures verifies whether the signatures in block is qualified with the consensus algorithm. It should return nil error when verify successfully, and return corresponding error when failed.
Types ¶
type ACS ¶
ACS is asynchronous common subset instance
func (*ACS) GetACSStateJson ¶
func (acs *ACS) GetACSStateJson() *ACSStateJson
GetACSStateJson return ACSStateJson
func (*ACS) HandleMessage ¶
HandleMessage handle rbc or bba message
func (*ACS) InputBBA ¶
InputBBA process verify result of tx batch
type ACSStateJson ¶
type ACSStateJson struct { // RBCStates rbc states RBCStates map[string]*RBCStateJson `json:"rbc_states"` // BBAStates bba states BBAStates map[string]*BBAStateJson `json:"bba_states"` // RBCResults rbc results RBCResults map[string][]byte `json:"rbc_results"` // BBAResults bba results BBAResults map[string]bool `json:"bba_results"` // Outputs acs outputs Outputs [][]byte `json:"outputs"` // Decided whether acs has decided Decided bool `json:"decided"` }
ACSStateJson is acs state json
type BBA ¶
BBA is asynchronous binary byzantine agreement instance
func (*BBA) AcceptInput ¶
AcceptInput judges whether bba can set est
func (*BBA) GetBBAStateJson ¶
func (bba *BBA) GetBBAStateJson() *BBAStateJson
GetBBAStateJson return BBAStateJson
func (*BBA) HandleMessage ¶
func (bba *BBA) HandleMessage(sender string, msg *abftpb.BBARequest) error
HandleMessage handle BVAL and AUX msg
func (*BBA) Input ¶
Input val to set est and broadcast BVAL msg
func (*BBA) Messages ¶
func (bba *BBA) Messages() []*abftpb.ABFTMessageReq
Messages deliver messages to ACS
type BBAStateJson ¶
type BBAStateJson struct { // Estimated json state Estimated bool `json:"estimated"` // Estimation json state Estimation bool `json:"estimation"` // BinValues bin values json state BinValues []bool `json:"bin_values"` // SentBvals sent Bvals json state SentBvals []bool `json:"sent_bvals"` // Outputted state Outputted bool `json:"outputted"` // Output state Output bool `json:"output"` // Decided state Decided bool `json:"decided"` // Decision state Decision bool `json:"decision"` // Done state Done bool `json:"done"` }
BBAStateJson is bba state json
type Config ¶
Config is acs config
type ConsensusABFTImpl ¶
type ConsensusABFTImpl struct { sync.RWMutex // Id is current nodeId Id string // contains filtered or unexported fields }
ConsensusABFTImpl is the implementation of ABFT algorithm it implements the ConsensusEngine interface.
func New ¶
func New(config *consensusutils.ConsensusImplConfig) (*ConsensusABFTImpl, error)
New creates a abft consensus instance
func (*ConsensusABFTImpl) Close ¶ added in v3.0.1
func (consensus *ConsensusABFTImpl) Close() error
Close implements the Close method of ConsensusEngine interface and closes the abft instance.
func (*ConsensusABFTImpl) GetAllNodeInfos ¶
func (consensus *ConsensusABFTImpl) GetAllNodeInfos() []consensuspb.ConsensusNodeInfo
GetAllNodeInfos Get consensus nodes info
func (*ConsensusABFTImpl) GetConsensusStateJSON ¶
func (consensus *ConsensusABFTImpl) GetConsensusStateJSON() ([]byte, error)
GetConsensusStateJSON get consensus state json
func (*ConsensusABFTImpl) GetConsensusType ¶
func (consensus *ConsensusABFTImpl) GetConsensusType() consensuspb.ConsensusType
GetConsensusType get consensus type
func (*ConsensusABFTImpl) GetLastHeight ¶
func (consensus *ConsensusABFTImpl) GetLastHeight() uint64
GetLastHeight get current consensus block height
func (*ConsensusABFTImpl) GetValidators ¶
func (consensus *ConsensusABFTImpl) GetValidators() ([]string, error)
GetValidators get validators
func (*ConsensusABFTImpl) OnMessage ¶
func (consensus *ConsensusABFTImpl) OnMessage(message *msgbus.Message)
OnMessage implements the OnMessage interface of msgbus.Subscriber
func (*ConsensusABFTImpl) OnQuit ¶
func (consensus *ConsensusABFTImpl) OnQuit()
OnQuit implements the OnQuit interface of msgbus.Subscriber
func (*ConsensusABFTImpl) Start ¶
func (consensus *ConsensusABFTImpl) Start() error
Start implements the Stop method of ConsensusEngine interface and starts the abft instance.
func (*ConsensusABFTImpl) Stop ¶
func (consensus *ConsensusABFTImpl) Stop() error
Stop implements the Stop method of ConsensusEngine interface and stops the abft instance.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event transfer msg from acs to abft
type RBC ¶
RBC represents an instance of "Reliable Broadcast".
func NewRBC ¶
NewRBC returns an instance of RBC for reliable broadcast.
func (*RBC) GetRBCStateJson ¶
func (rbc *RBC) GetRBCStateJson() *RBCStateJson
GetRBCStateJson return RBCStateJson
func (*RBC) HandleMessage ¶
func (rbc *RBC) HandleMessage(sender string, msg *abftpb.RBCRequest) error
HandleMessage handle RBC msg
func (*RBC) Messages ¶
func (rbc *RBC) Messages() []*abftpb.ABFTMessageReq
Messages return RBC messages to ACS
type RBCStateJson ¶
type RBCStateJson struct { // ReceivedEchos EchoRequest json state ReceivedEchos map[string]*abft.EchoRequest `json:"received_echos"` // EchoSent state EchoSent bool `json:"echo_sent"` // ReceivedReadys state ReceivedReadys map[string][]byte `json:"received_readys"` // ReadySent state ReadySent bool `json:"ready_sent"` // Output state Output []byte `json:"output"` // OutputDecoded state OutputDecoded bool `json:"output_decoded"` }
RBCStateJson is rbc state json