Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeValidationData(validationData ValidationData) (string, error)
- func ExtractBridgeValidationData(block common.BlockInterface) ([][]byte, []int, error)
- func LoadUserKeyFromIncPrivateKey(privateKey string) (string, error)
- func MakeBFTProposeMsg(proposeCtn *BFTPropose, chainKey string, ts int64, height uint64) (wire.Message, error)
- func MakeBFTRequestBlk(request BFTRequestBlock, peerID string, chainKey string) (wire.Message, error)
- func MakeBFTVoteMsg(vote *BFTVote, chainKey string, ts int64, height uint64) (wire.Message, error)
- func NewConsensusError(key int, err error) error
- func ValidateCommitteeSig(block common.BlockInterface, committee []incognitokey.CommitteePublicKey) error
- func ValidateProducerSig(block common.BlockInterface) error
- type BFTPropose
- type BFTRequestBlock
- type BFTVote
- type BLSBFT_V2
- func (e BLSBFT_V2) CreateValidationData(block common.BlockInterface) ValidationData
- func (e BLSBFT_V2) GetChainID() int
- func (e BLSBFT_V2) GetChainKey() string
- func (e *BLSBFT_V2) GetConsensusName() string
- func (e *BLSBFT_V2) GetUserPublicKey() *incognitokey.CommitteePublicKey
- func (e BLSBFT_V2) IsOngoing() bool
- func (e BLSBFT_V2) IsStarted() bool
- func (e *BLSBFT_V2) LoadUserKey(privateSeed string) error
- func (e *BLSBFT_V2) LoadUserKeyFromIncPrivateKey(privateKey string) (string, error)
- func (e *BLSBFT_V2) ProcessBFTMsg(msgBFT *wire.MessageBFT)
- func (e BLSBFT_V2) SignData(data []byte) (string, error)
- func (e *BLSBFT_V2) Start() error
- func (e *BLSBFT_V2) Stop() error
- func (e BLSBFT_V2) ValidateBlockWithConsensus(block common.BlockInterface) error
- func (e BLSBFT_V2) ValidateData(data []byte, sig string, publicKey string) error
- type ChainInterface
- type ConsensusError
- type MiningKey
- func (miningKey *MiningKey) BLSSignData(data []byte, selfIdx int, committee []blsmultisig.PublicKey) ([]byte, error)
- func (miningKey *MiningKey) BriSignData(data []byte) ([]byte, error)
- func (miningKey *MiningKey) GetPublicKey() incognitokey.CommitteePublicKey
- func (miningKey *MiningKey) GetPublicKeyBase58() string
- type NodeInterface
- type ProposeBlockInfo
- type ValidationData
Constants ¶
View Source
const ( UnExpectedError = iota ConsensusTypeNotExistError ProducerSignatureError CommitteeSignatureError CombineSignatureError SignDataError LoadKeyError ConsensusAlreadyStartedError ConsensusAlreadyStoppedError DecodeValidationDataError EncodeValidationDataError BlockCreationError )
View Source
const ( MSG_PROPOSE = "propose" MSG_VOTE = "vote" MSG_REQUESTBLK = "getblk" )
Variables ¶
View Source
var ErrCodeMessage = map[int]struct { Code int message string }{ UnExpectedError: {-1000, "Unexpected error"}, ConsensusTypeNotExistError: {-1001, "Consensus type isn't exist"}, ProducerSignatureError: {-1002, "Producer signature error"}, CommitteeSignatureError: {-1003, "Committee signature error"}, CombineSignatureError: {-1004, "Combine signature error"}, SignDataError: {-1005, "Sign data error"}, LoadKeyError: {-1006, "Load key error"}, ConsensusAlreadyStartedError: {-1007, "consensus already started error"}, ConsensusAlreadyStoppedError: {-1008, "consensus already stopped error"}, DecodeValidationDataError: {-1009, "Decode Validation Data error"}, EncodeValidationDataError: {-1010, "Encode Validation Data Error"}, BlockCreationError: {-1011, "Block Creation Error"}, }
Functions ¶
func EncodeValidationData ¶
func EncodeValidationData(validationData ValidationData) (string, error)
func ExtractBridgeValidationData ¶
func ExtractBridgeValidationData(block common.BlockInterface) ([][]byte, []int, error)
func MakeBFTProposeMsg ¶
func MakeBFTRequestBlk ¶
func MakeBFTVoteMsg ¶
func NewConsensusError ¶
func ValidateCommitteeSig ¶
func ValidateCommitteeSig(block common.BlockInterface, committee []incognitokey.CommitteePublicKey) error
func ValidateProducerSig ¶
func ValidateProducerSig(block common.BlockInterface) error
Types ¶
type BFTPropose ¶
type BFTPropose struct { PeerID string Block json.RawMessage TimeSlot uint64 }
type BFTRequestBlock ¶
type BLSBFT_V2 ¶
type BLSBFT_V2 struct { Chain ChainInterface Node NodeInterface ChainKey string ChainID int PeerID string UserKeySet *MiningKey BFTMessageCh chan wire.MessageBFT StopCh chan struct{} Logger common.Logger ProposeMessageCh chan BFTPropose VoteMessageCh chan BFTVote // contains filtered or unexported fields }
func NewInstance ¶
func NewInstance(chain ChainInterface, chainKey string, chainID int, node NodeInterface, logger common.Logger) *BLSBFT_V2
func (BLSBFT_V2) CreateValidationData ¶
func (e BLSBFT_V2) CreateValidationData(block common.BlockInterface) ValidationData
func (BLSBFT_V2) GetChainID ¶
func (BLSBFT_V2) GetChainKey ¶
func (*BLSBFT_V2) GetConsensusName ¶
func (*BLSBFT_V2) GetUserPublicKey ¶
func (e *BLSBFT_V2) GetUserPublicKey() *incognitokey.CommitteePublicKey
func (*BLSBFT_V2) LoadUserKey ¶
func (*BLSBFT_V2) LoadUserKeyFromIncPrivateKey ¶
func (*BLSBFT_V2) ProcessBFTMsg ¶
func (e *BLSBFT_V2) ProcessBFTMsg(msgBFT *wire.MessageBFT)
func (BLSBFT_V2) ValidateBlockWithConsensus ¶
func (e BLSBFT_V2) ValidateBlockWithConsensus(block common.BlockInterface) error
type ChainInterface ¶
type ChainInterface interface { GetFinalView() multiview.View GetBestView() multiview.View GetEpoch() uint64 GetChainName() string GetConsensusType() string GetLastBlockTimeStamp() int64 GetMinBlkInterval() time.Duration GetMaxBlkCreateTime() time.Duration IsReady() bool SetReady(bool) GetActiveShardNumber() int CurrentHeight() uint64 GetCommitteeSize() int GetCommittee() []incognitokey.CommitteePublicKey GetPendingCommittee() []incognitokey.CommitteePublicKey GetPubKeyCommitteeIndex(string) int GetLastProposerIndex() int UnmarshalBlock(blockString []byte) (common.BlockInterface, error) CreateNewBlock(version int, proposer string, round int, startTime int64) (common.BlockInterface, error) CreateNewBlockFromOldBlock(oldBlock common.BlockInterface, proposer string, startTime int64) (common.BlockInterface, error) InsertAndBroadcastBlock(block common.BlockInterface) error // ValidateAndInsertBlock(block common.BlockInterface) error ValidateBlockSignatures(block common.BlockInterface, committee []incognitokey.CommitteePublicKey) error ValidatePreSignBlock(block common.BlockInterface) error GetShardID() int //for new syncker GetBestViewHeight() uint64 GetFinalViewHeight() uint64 GetBestViewHash() string GetFinalViewHash() string GetViewByHash(hash common.Hash) multiview.View }
type ConsensusError ¶
func (ConsensusError) Error ¶
func (e ConsensusError) Error() string
type MiningKey ¶
func (*MiningKey) BLSSignData ¶
func (*MiningKey) BriSignData ¶
func (*MiningKey) GetPublicKey ¶
func (miningKey *MiningKey) GetPublicKey() incognitokey.CommitteePublicKey
func (*MiningKey) GetPublicKeyBase58 ¶
type NodeInterface ¶
type NodeInterface interface { PushMessageToChain(msg wire.Message, chain common.ChainInterface) error IsEnableMining() bool GetMiningKeys() string GetPrivateKey() string GetUserMiningState() (role string, chainID int) RequestMissingViewViaStream(peerID string, hashes [][]byte, fromCID int, chainName string) (err error) GetSelfPeerID() peer.ID }
type ProposeBlockInfo ¶
type ProposeBlockInfo struct {
// contains filtered or unexported fields
}
type ValidationData ¶
type ValidationData struct { ProducerBLSSig []byte ProducerBriSig []byte ValidatiorsIdx []int AggSig []byte BridgeSig [][]byte }
func DecodeValidationData ¶
func DecodeValidationData(data string) (*ValidationData, error)
Click to show internal directories.
Click to hide internal directories.