Documentation ¶
Index ¶
- Constants
- Variables
- func GenMiningKeyFromPrivateKey(privateKey string) (string, error)
- func GetMiningKeyFromPrivateSeed(privateSeed string) (*signatureschemes2.MiningKey, error)
- func LoadUserKeyFromIncPrivateKey(privateKey string) (string, error)
- func NewConsensusError(key int, err error) error
- type ConsensusError
- type Engine
- func (engine *Engine) BFTProcess() map[int]blsbft.Actor
- func (engine *Engine) ExtractBridgeValidationData(block types.BlockInterface) ([][]byte, []int, error)
- func (engine *Engine) ExtractPortalV4ValidationData(block types.BlockInterface) ([]*portalprocessv4.PortalSig, error)
- func (engine *Engine) GetAllMiningPublicKeys() []string
- func (engine *Engine) GetAllValidatorKeyState() map[string]consensus.MiningState
- func (engine *Engine) GetCurrentMiningPublicKey() (publickey string, keyType string)
- func (s *Engine) GetCurrentValidators() []*consensus.Validator
- func (engine *Engine) GetMiningPublicKeyByConsensus(consensusName string) (publickey string, err error)
- func (s *Engine) GetMiningPublicKeys() *incognitokey.CommitteePublicKey
- func (s *Engine) GetNodeMiningPublicKeys() (userPks []*incognitokey.CommitteePublicKey)
- func (engine *Engine) GetOneValidator() *consensus.Validator
- func (engine *Engine) GetOneValidatorForEachConsensusProcess() map[int]*consensus.Validator
- func (s *Engine) GetUserRole() (string, string, int)
- func (s *Engine) GetValidators() []*consensus.Validator
- func (engine *Engine) Init(config *EngineConfig)
- func (engine *Engine) IsCommitteeInShard(shardID byte) bool
- func (engine *Engine) NotifyNewRole(newCID int, newRole string)
- func (engine *Engine) OnBFTMsg(msg *wire.MessageBFT)
- func (engine *Engine) SignDataWithCurrentMiningKey(data []byte) (publicKeyStr string, publicKeyType string, signature string, err error)
- func (engine *Engine) Start() error
- func (engine *Engine) Stop() error
- func (engine *Engine) ValidateBlockCommitteSig(block types.BlockInterface, committees []incognitokey.CommitteePublicKey, ...) error
- func (engine *Engine) ValidateProducerPosition(blk types.BlockInterface, lastProposerIdx int, ...) error
- func (engine *Engine) ValidateProducerSig(block types.BlockInterface, consensusType string) error
- func (engine *Engine) VerifyData(data []byte, sig string, publicKey string, consensusType string) error
- func (engine *Engine) WatchCommitteeChange()
- type EngineConfig
- type NodeInterface
Constants ¶
View Source
const ( UnExpectedError = iota ConsensusTypeNotExistError ProducerSignatureError CommitteeSignatureError CombineSignatureError SignDataError LoadKeyError ConsensusAlreadyStartedError ConsensusAlreadyStoppedError DecodeValidationDataError EncodeValidationDataError BlockCreationError )
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"}, }
View Source
var Logger = consensusLogger{}
Global instant to use
Functions ¶
func GetMiningKeyFromPrivateSeed ¶
func GetMiningKeyFromPrivateSeed(privateSeed string) (*signatureschemes2.MiningKey, error)
func NewConsensusError ¶
Types ¶
type ConsensusError ¶
func (ConsensusError) Error ¶
func (e ConsensusError) Error() string
type Engine ¶
type Engine struct { IsEnabled int //0 > stop, 1: running // contains filtered or unexported fields }
func NewConsensusEngine ¶
func NewConsensusEngine() *Engine
func (*Engine) BFTProcess ¶
BFTProcess for testing only
func (*Engine) ExtractBridgeValidationData ¶
func (*Engine) ExtractPortalV4ValidationData ¶
func (engine *Engine) ExtractPortalV4ValidationData(block types.BlockInterface) ([]*portalprocessv4.PortalSig, error)
func (*Engine) GetAllMiningPublicKeys ¶
legacy code -> get all key type of 1 mining key
func (*Engine) GetAllValidatorKeyState ¶
func (engine *Engine) GetAllValidatorKeyState() map[string]consensus.MiningState
func (*Engine) GetCurrentMiningPublicKey ¶
func (*Engine) GetCurrentValidators ¶
func (*Engine) GetMiningPublicKeyByConsensus ¶
func (*Engine) GetMiningPublicKeys ¶
func (s *Engine) GetMiningPublicKeys() *incognitokey.CommitteePublicKey
func (*Engine) GetNodeMiningPublicKeys ¶
func (s *Engine) GetNodeMiningPublicKeys() (userPks []*incognitokey.CommitteePublicKey)
func (*Engine) GetOneValidator ¶
func (*Engine) GetOneValidatorForEachConsensusProcess ¶
func (*Engine) GetUserRole ¶
just get role of first validator this function support NODE monitor (getmininginfo) which assumed running only 1 validator
func (*Engine) GetValidators ¶
func (*Engine) Init ¶
func (engine *Engine) Init(config *EngineConfig)
func (*Engine) IsCommitteeInShard ¶
func (*Engine) NotifyNewRole ¶
func (*Engine) OnBFTMsg ¶
func (engine *Engine) OnBFTMsg(msg *wire.MessageBFT)
func (*Engine) SignDataWithCurrentMiningKey ¶
func (*Engine) ValidateBlockCommitteSig ¶
func (engine *Engine) ValidateBlockCommitteSig(block types.BlockInterface, committees []incognitokey.CommitteePublicKey, numFixNode int) error
func (*Engine) ValidateProducerPosition ¶
func (engine *Engine) ValidateProducerPosition( blk types.BlockInterface, lastProposerIdx int, committee []incognitokey.CommitteePublicKey, lenProposers int, produceTimeSlot int64, proposeTimeSlot int64, ) error
func (*Engine) ValidateProducerSig ¶
func (engine *Engine) ValidateProducerSig(block types.BlockInterface, consensusType string) error
func (*Engine) VerifyData ¶
func (*Engine) WatchCommitteeChange ¶
func (engine *Engine) WatchCommitteeChange()
type EngineConfig ¶
type EngineConfig struct { Node NodeInterface Blockchain *blockchain.BlockChain PubSubManager *pubsub.PubSubManager }
type NodeInterface ¶
type NodeInterface interface { PushBlockToAll(block types.BlockInterface, previousValidationData string, isBeacon bool) error PushMessageToChain(msg wire.Message, chain common.ChainInterface) error IsEnableMining() bool GetMiningKeys() string GetPrivateKey() string GetUserMiningState() (role string, chainID int) GetPubkeyMiningState(*incognitokey.CommitteePublicKey) (role string, chainID int) IsBeaconFullnode(*incognitokey.CommitteePublicKey) (bool, string) RequestMissingViewViaStream(peerID string, hashes [][]byte, fromCID int, chainName string) (err error) GetSelfPeerID() peer.ID }
Used interfaces NodeInterface
Click to show internal directories.
Click to hide internal directories.