maxbft

package module
v0.0.0-...-8d456d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 35 Imported by: 2

README

consensus-maxbft

介绍

hercules 链 maxbft 共识模块

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

View Source
const (
	CONSENSUSCAPABILITY = 100000
	INTERNALCAPABILITY  = 100000
	ModuleName          = "maxbft"
)
View Source
const (
	MaxSyncBlockNum = 10
)

Variables

View Source
var (
	ErrInvalidPeer  = errors.New("invalid peer")
	ErrValidateSign = errors.New("validate sign error")
)

Functions

func VerifyBlockSignatures

func VerifyBlockSignatures(chainConf protocol.ChainConf, ac protocol.AccessControlProvider,
	store protocol.BlockchainStore, block *common.Block, ledger protocol.LedgerCache) error

VerifyBlockSignatures verify consensus qc at incoming block and chainconf now, implement check commit in all nodes, not in selected committee

Types

type ConsensusMaxBftImpl

type ConsensusMaxBftImpl struct {
	// contains filtered or unexported fields
}

ConsensusMaxBftImpl implements maxbft protocol

func New

New returns an instance of maxbft consensus

func (*ConsensusMaxBftImpl) Broadcast

func (cbi *ConsensusMaxBftImpl) Broadcast(height uint64, data []byte)

Broadcast signs the consensus message and broadcasts it to consensus group

func (*ConsensusMaxBftImpl) GetConsensusStateJSON

func (cbi *ConsensusMaxBftImpl) GetConsensusStateJSON() ([]byte, error)

func (*ConsensusMaxBftImpl) GetLastHeight

func (cbi *ConsensusMaxBftImpl) GetLastHeight() uint64

func (*ConsensusMaxBftImpl) GetValidators

func (cbi *ConsensusMaxBftImpl) GetValidators() ([]string, error)

func (*ConsensusMaxBftImpl) Module

func (cbi *ConsensusMaxBftImpl) Module() string

Module MaxBft

func (*ConsensusMaxBftImpl) OnMessage

func (cbi *ConsensusMaxBftImpl) OnMessage(message *msgbus.Message)

OnMessage MsgBus implement interface, receive message from MsgBus

func (*ConsensusMaxBftImpl) OnQuit

func (cbi *ConsensusMaxBftImpl) OnQuit()

OnQuit msgbus quit

func (*ConsensusMaxBftImpl) Start

func (cbi *ConsensusMaxBftImpl) Start() error

Start start consensus

func (*ConsensusMaxBftImpl) Stop

func (cbi *ConsensusMaxBftImpl) Stop() error

Stop stop consensus

func (*ConsensusMaxBftImpl) Verify

func (cbi *ConsensusMaxBftImpl) Verify(consensusType consensus.ConsensusType, chainConfig *configPb.ChainConfig) error

Verify use by chainConf, check chain config before chain_config_contract run

func (*ConsensusMaxBftImpl) VerifyBlockSignatures

func (cbi *ConsensusMaxBftImpl) VerifyBlockSignatures(block *common.Block) error

VerifyBlockSignatures verify consensus qc at incoming block

type MaxBftState

type MaxBftState struct {
	Id               string // The identity of the local node
	ChainId          string // chain ID
	SelfIndexInEpoch uint64 // Index of the local node in the validator collection of the
	// current epoch
	EpochId               uint64 // The epochID in now
	CurrentLevel          uint64 // The current level of the local node
	LockedLevel           uint64 // the latest locked level in local node
	HighestTCLevel        uint64 // The tc level in incoming msg(proposal or vote)
	LastCommittedLevel    uint64 // the latest committed level in local node
	LastReceivedQcHeight  uint64 // The height of the latest received QC
	LastVoteLevel         uint64
	LastCommitWalIndex    uint64
	State                 maxbftpb.ConsStateType // The current consensus state of the local node
	LockedBlock           *common.Block          // the latest locked block in local node
	HighestCertifiedBlock *common.Block          // highest block with qc in local node
	HighestQC             *maxbftpb.QuorumCert   // highest qc in local node
	CommitQuorumCert      *maxbftpb.QuorumCert   // The latest committed QC on the chain
	TimeoutCertificate    *maxbftpb.QuorumCert   // The latest timeout QC info
	LastVoteMsg           *maxbftpb.ConsensusPayload
	Validators            []*peer // The collection of validators for the current epoch
	LastValidators        []*peer // The collection of validators for the prev epoch
}

type SecpAlgo

type SecpAlgo struct {
	// contains filtered or unexported fields
}

func NewSecpAlgo

func NewSecpAlgo(cbi *ConsensusMaxBftImpl) *SecpAlgo

type ThresholdAlgo

type ThresholdAlgo struct {
}

func NewThresholdAlgo

func NewThresholdAlgo() *ThresholdAlgo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL