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) GetAllNodeInfos() []protocol.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 the verify result of tx batch
type ACSStateJson ¶
type ACSStateJson struct { RBCStates map[string]*RBCStateJson `json:"rbc_states"` BBAStates map[string]*BBAStateJson `json:"bba_states"` RBCResults map[string][]byte `json:"rbc_results"` BBAResults map[string]bool `json:"bba_results"` Outputs [][]byte `json:"outputs"` Decided bool `json:"decided"` }
ACSStateJson is acs state json
type BBA ¶
BBA is asynchronous binary byzantine agreement instance
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 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 bool `json:"estimated"` Estimation bool `json:"estimation"` BinValues []bool `json:"bin_values"` SentBvals []bool `json:"sent_bvals"` Outputted bool `json:"outputted"` Output bool `json:"output"` Decided bool `json:"decided"` Decision bool `json:"decision"` Done bool `json:"done"` }
BBAStateJson is bba state json
type Config ¶
Config is acs config
type ConsensusABFTImpl ¶
type ConsensusABFTImpl struct { sync.RWMutex Id string // nodeId // contains filtered or unexported fields }
ConsensusABFTImpl is the implementation of ABFT algorithm and it implements the ConsensusEngine interface.
func New ¶
func New(config *consensusutils.ConsensusImplConfig) (*ConsensusABFTImpl, error)
New creates a abft consensus instance
func (*ConsensusABFTImpl) GetAllNodeInfos ¶
func (consensus *ConsensusABFTImpl) GetAllNodeInfos() []protocol.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 typs
func (*ConsensusABFTImpl) GetLastHeight ¶
func (consensus *ConsensusABFTImpl) GetLastHeight() uint64
GetLastHeight get last 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 map[string]*abft.EchoRequest `json:"received_echos"` EchoSent bool `json:"echo_sent"` ReceivedReadys map[string][]byte `json:"received_readys"` ReadySent bool `json:"ready_sent"` Output []byte `json:"output"` OutputDecoded bool `json:"output_decoded"` }
RBCStateJson is rbc state json