consensus

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConsensus        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConsensus          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConsensus = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ConsensusType_name = map[int32]string{
	0: "SOLO",
	1: "PBFT",
	2: "HOTSTUFF",
	3: "RAFT",
}
View Source
var ConsensusType_value = map[string]int32{
	"SOLO":     0,
	"PBFT":     1,
	"HOTSTUFF": 2,
	"RAFT":     3,
}
View Source
var VerifyResult_Code_name = map[int32]string{
	0: "SUCCESS",
	1: "FAIL",
}
View Source
var VerifyResult_Code_value = map[string]int32{
	"SUCCESS": 0,
	"FAIL":    1,
}

Functions

This section is empty.

Types

type BlockHeaderConsensusArgs

type BlockHeaderConsensusArgs struct {
	ConsensusType int64 `protobuf:"varint,1,opt,name=consensus_type,json=consensusType,proto3" json:"consensus_type,omitempty"`
	// status of the round in XBFT
	Round uint64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
	// status of the view in HBFT
	View          uint64          `protobuf:"varint,3,opt,name=view,proto3" json:"view,omitempty"`
	ConsensusData *common.TxRWSet `protobuf:"bytes,4,opt,name=consensus_data,json=consensusData,proto3" json:"consensus_data,omitempty"`
}

func (*BlockHeaderConsensusArgs) Descriptor

func (*BlockHeaderConsensusArgs) Descriptor() ([]byte, []int)

func (*BlockHeaderConsensusArgs) GetConsensusData

func (m *BlockHeaderConsensusArgs) GetConsensusData() *common.TxRWSet

func (*BlockHeaderConsensusArgs) GetConsensusType

func (m *BlockHeaderConsensusArgs) GetConsensusType() int64

func (*BlockHeaderConsensusArgs) GetRound

func (m *BlockHeaderConsensusArgs) GetRound() uint64

func (*BlockHeaderConsensusArgs) GetView

func (m *BlockHeaderConsensusArgs) GetView() uint64

func (*BlockHeaderConsensusArgs) Marshal

func (m *BlockHeaderConsensusArgs) Marshal() (dAtA []byte, err error)

func (*BlockHeaderConsensusArgs) MarshalTo

func (m *BlockHeaderConsensusArgs) MarshalTo(dAtA []byte) (int, error)

func (*BlockHeaderConsensusArgs) MarshalToSizedBuffer

func (m *BlockHeaderConsensusArgs) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlockHeaderConsensusArgs) ProtoMessage

func (*BlockHeaderConsensusArgs) ProtoMessage()

func (*BlockHeaderConsensusArgs) Reset

func (m *BlockHeaderConsensusArgs) Reset()

func (*BlockHeaderConsensusArgs) Size

func (m *BlockHeaderConsensusArgs) Size() (n int)

func (*BlockHeaderConsensusArgs) String

func (m *BlockHeaderConsensusArgs) String() string

func (*BlockHeaderConsensusArgs) Unmarshal

func (m *BlockHeaderConsensusArgs) Unmarshal(dAtA []byte) error

func (*BlockHeaderConsensusArgs) XXX_DiscardUnknown

func (m *BlockHeaderConsensusArgs) XXX_DiscardUnknown()

func (*BlockHeaderConsensusArgs) XXX_Marshal

func (m *BlockHeaderConsensusArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockHeaderConsensusArgs) XXX_Merge

func (m *BlockHeaderConsensusArgs) XXX_Merge(src proto.Message)

func (*BlockHeaderConsensusArgs) XXX_Size

func (m *BlockHeaderConsensusArgs) XXX_Size() int

func (*BlockHeaderConsensusArgs) XXX_Unmarshal

func (m *BlockHeaderConsensusArgs) XXX_Unmarshal(b []byte) error

type ConsensusType

type ConsensusType int32
const (
	ConsensusType_SOLO     ConsensusType = 0
	ConsensusType_PBFT     ConsensusType = 1
	ConsensusType_HOTSTUFF ConsensusType = 2
	ConsensusType_RAFT     ConsensusType = 3
)

func (ConsensusType) EnumDescriptor

func (ConsensusType) EnumDescriptor() ([]byte, []int)

func (ConsensusType) String

func (x ConsensusType) String() string

type GovernanceContract

type GovernanceContract struct {
	//epoch id,increase by epoch switch
	EpochId uint64 `protobuf:"varint,1,opt,name=epoch_id,json=epochId,proto3" json:"epoch_id,omitempty"`
	//consensus type
	Type ConsensusType `protobuf:"varint,2,opt,name=type,proto3,enum=consensus.ConsensusType" json:"type,omitempty"`
	//current index to be assigned
	CurMaxIndex       int64 `protobuf:"varint,3,opt,name=cur_max_index,json=curMaxIndex,proto3" json:"cur_max_index,omitempty"`
	SkipTimeoutCommit bool  `protobuf:"varint,4,opt,name=skip_timeout_commit,json=skipTimeoutCommit,proto3" json:"skip_timeout_commit,omitempty"`
	//is the configuration changed
	//bool is_config_chg = 4;
	//is the validator changed
	//bool is_validator_chg = 5;
	//config sequence, check whether the configuration is changed
	ConfigSequence uint64 `protobuf:"varint,6,opt,name=config_sequence,json=configSequence,proto3" json:"config_sequence,omitempty"`
	//number of nodes participating in the consensus
	N uint64 `protobuf:"varint,7,opt,name=n,proto3" json:"n,omitempty"`
	//the minimum number of consensus nodes that need to survive
	MinQuorumForQc uint64 `protobuf:"varint,8,opt,name=min_quorum_for_qc,json=minQuorumForQc,proto3" json:"min_quorum_for_qc,omitempty"`
	CachedLen      uint64 `protobuf:"varint,9,opt,name=cached_len,json=cachedLen,proto3" json:"cached_len,omitempty"`
	//the next height of switching validator
	NextSwitchHeight uint64 `protobuf:"varint,10,opt,name=next_switch_height,json=nextSwitchHeight,proto3" json:"next_switch_height,omitempty"`
	//the buffer height of switching validator
	TransitBlock uint64 `protobuf:"varint,11,opt,name=transit_block,json=transitBlock,proto3" json:"transit_block,omitempty"`
	//cycle of switching validator
	BlockNumPerEpoch uint64 `protobuf:"varint,12,opt,name=block_num_per_epoch,json=blockNumPerEpoch,proto3" json:"block_num_per_epoch,omitempty"`
	//maximum number of participating validators
	ValidatorNum uint64 `protobuf:"varint,13,opt,name=validator_num,json=validatorNum,proto3" json:"validator_num,omitempty"`
	//the rounds in which each validator can produce blocks continuously
	NodeProposeRound uint64 `protobuf:"varint,14,opt,name=node_propose_round,json=nodeProposeRound,proto3" json:"node_propose_round,omitempty"`
	//currently maintained nodes
	Participants []*GovernanceParticipant `protobuf:"bytes,15,rep,name=participants,proto3" json:"participants,omitempty"`
	//currently participate validators
	Validators []*GovernanceParticipant `protobuf:"bytes,16,rep,name=validators,proto3" json:"validators,omitempty"`
	//next participate validators
	NextValidators []*GovernanceParticipant `protobuf:"bytes,17,rep,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"`
	//the last epoch minimum number of consensus nodes that need to survive
	LastMinQuorumForQc uint64 `protobuf:"varint,18,opt,name=last_min_quorum_for_qc,json=lastMinQuorumForQc,proto3" json:"last_min_quorum_for_qc,omitempty"`
	//The base timeout for viewChange
	HotstuffRoundTimeoutMill uint64 `` /* 139-byte string literal not displayed */
	//The delta timeout for the viewChange
	HotstuffRoundTimeoutIntervalMill uint64 `` /* 165-byte string literal not displayed */
	//last epoch participate validators
	LastValidators []*GovernanceParticipant `protobuf:"bytes,21,rep,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"`
}

func (*GovernanceContract) Descriptor

func (*GovernanceContract) Descriptor() ([]byte, []int)

func (*GovernanceContract) GetBlockNumPerEpoch

func (m *GovernanceContract) GetBlockNumPerEpoch() uint64

func (*GovernanceContract) GetCachedLen

func (m *GovernanceContract) GetCachedLen() uint64

func (*GovernanceContract) GetConfigSequence

func (m *GovernanceContract) GetConfigSequence() uint64

func (*GovernanceContract) GetCurMaxIndex

func (m *GovernanceContract) GetCurMaxIndex() int64

func (*GovernanceContract) GetEpochId

func (m *GovernanceContract) GetEpochId() uint64

func (*GovernanceContract) GetHotstuffRoundTimeoutIntervalMill added in v1.5.0

func (m *GovernanceContract) GetHotstuffRoundTimeoutIntervalMill() uint64

func (*GovernanceContract) GetHotstuffRoundTimeoutMill added in v1.5.0

func (m *GovernanceContract) GetHotstuffRoundTimeoutMill() uint64

func (*GovernanceContract) GetLastMinQuorumForQc

func (m *GovernanceContract) GetLastMinQuorumForQc() uint64

func (*GovernanceContract) GetLastValidators

func (m *GovernanceContract) GetLastValidators() []*GovernanceParticipant

func (*GovernanceContract) GetMinQuorumForQc

func (m *GovernanceContract) GetMinQuorumForQc() uint64

func (*GovernanceContract) GetN

func (m *GovernanceContract) GetN() uint64

func (*GovernanceContract) GetNextSwitchHeight

func (m *GovernanceContract) GetNextSwitchHeight() uint64

func (*GovernanceContract) GetNextValidators

func (m *GovernanceContract) GetNextValidators() []*GovernanceParticipant

func (*GovernanceContract) GetNodeProposeRound

func (m *GovernanceContract) GetNodeProposeRound() uint64

func (*GovernanceContract) GetParticipants

func (m *GovernanceContract) GetParticipants() []*GovernanceParticipant

func (*GovernanceContract) GetSkipTimeoutCommit

func (m *GovernanceContract) GetSkipTimeoutCommit() bool

func (*GovernanceContract) GetTransitBlock

func (m *GovernanceContract) GetTransitBlock() uint64

func (*GovernanceContract) GetType

func (m *GovernanceContract) GetType() ConsensusType

func (*GovernanceContract) GetValidatorNum

func (m *GovernanceContract) GetValidatorNum() uint64

func (*GovernanceContract) GetValidators

func (m *GovernanceContract) GetValidators() []*GovernanceParticipant

func (*GovernanceContract) Marshal

func (m *GovernanceContract) Marshal() (dAtA []byte, err error)

func (*GovernanceContract) MarshalTo

func (m *GovernanceContract) MarshalTo(dAtA []byte) (int, error)

func (*GovernanceContract) MarshalToSizedBuffer

func (m *GovernanceContract) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GovernanceContract) ProtoMessage

func (*GovernanceContract) ProtoMessage()

func (*GovernanceContract) Reset

func (m *GovernanceContract) Reset()

func (*GovernanceContract) Size

func (m *GovernanceContract) Size() (n int)

func (*GovernanceContract) String

func (m *GovernanceContract) String() string

func (*GovernanceContract) Unmarshal

func (m *GovernanceContract) Unmarshal(dAtA []byte) error

func (*GovernanceContract) XXX_DiscardUnknown

func (m *GovernanceContract) XXX_DiscardUnknown()

func (*GovernanceContract) XXX_Marshal

func (m *GovernanceContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GovernanceContract) XXX_Merge

func (m *GovernanceContract) XXX_Merge(src proto.Message)

func (*GovernanceContract) XXX_Size

func (m *GovernanceContract) XXX_Size() int

func (*GovernanceContract) XXX_Unmarshal

func (m *GovernanceContract) XXX_Unmarshal(b []byte) error

type GovernanceParticipant

type GovernanceParticipant struct {
	NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
	Index  int64  `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
}

func (*GovernanceParticipant) Descriptor

func (*GovernanceParticipant) Descriptor() ([]byte, []int)

func (*GovernanceParticipant) GetIndex

func (m *GovernanceParticipant) GetIndex() int64

func (*GovernanceParticipant) GetNodeId

func (m *GovernanceParticipant) GetNodeId() string

func (*GovernanceParticipant) Marshal

func (m *GovernanceParticipant) Marshal() (dAtA []byte, err error)

func (*GovernanceParticipant) MarshalTo

func (m *GovernanceParticipant) MarshalTo(dAtA []byte) (int, error)

func (*GovernanceParticipant) MarshalToSizedBuffer

func (m *GovernanceParticipant) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GovernanceParticipant) ProtoMessage

func (*GovernanceParticipant) ProtoMessage()

func (*GovernanceParticipant) Reset

func (m *GovernanceParticipant) Reset()

func (*GovernanceParticipant) Size

func (m *GovernanceParticipant) Size() (n int)

func (*GovernanceParticipant) String

func (m *GovernanceParticipant) String() string

func (*GovernanceParticipant) Unmarshal

func (m *GovernanceParticipant) Unmarshal(dAtA []byte) error

func (*GovernanceParticipant) XXX_DiscardUnknown

func (m *GovernanceParticipant) XXX_DiscardUnknown()

func (*GovernanceParticipant) XXX_Marshal

func (m *GovernanceParticipant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GovernanceParticipant) XXX_Merge

func (m *GovernanceParticipant) XXX_Merge(src proto.Message)

func (*GovernanceParticipant) XXX_Size

func (m *GovernanceParticipant) XXX_Size() int

func (*GovernanceParticipant) XXX_Unmarshal

func (m *GovernanceParticipant) XXX_Unmarshal(b []byte) error

type ProposalBlock

type ProposalBlock struct {
	Block    *common.Block              `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
	TxsRwSet map[string]*common.TxRWSet `` /* 175-byte string literal not displayed */
	CutBlock *common.Block              `protobuf:"bytes,3,opt,name=cut_block,json=cutBlock,proto3" json:"cut_block,omitempty"`
}

func (*ProposalBlock) Descriptor

func (*ProposalBlock) Descriptor() ([]byte, []int)

func (*ProposalBlock) GetBlock

func (m *ProposalBlock) GetBlock() *common.Block

func (*ProposalBlock) GetCutBlock

func (m *ProposalBlock) GetCutBlock() *common.Block

func (*ProposalBlock) GetTxsRwSet

func (m *ProposalBlock) GetTxsRwSet() map[string]*common.TxRWSet

func (*ProposalBlock) Marshal

func (m *ProposalBlock) Marshal() (dAtA []byte, err error)

func (*ProposalBlock) MarshalTo

func (m *ProposalBlock) MarshalTo(dAtA []byte) (int, error)

func (*ProposalBlock) MarshalToSizedBuffer

func (m *ProposalBlock) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ProposalBlock) ProtoMessage

func (*ProposalBlock) ProtoMessage()

func (*ProposalBlock) Reset

func (m *ProposalBlock) Reset()

func (*ProposalBlock) Size

func (m *ProposalBlock) Size() (n int)

func (*ProposalBlock) String

func (m *ProposalBlock) String() string

func (*ProposalBlock) Unmarshal

func (m *ProposalBlock) Unmarshal(dAtA []byte) error

func (*ProposalBlock) XXX_DiscardUnknown

func (m *ProposalBlock) XXX_DiscardUnknown()

func (*ProposalBlock) XXX_Marshal

func (m *ProposalBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProposalBlock) XXX_Merge

func (m *ProposalBlock) XXX_Merge(src proto.Message)

func (*ProposalBlock) XXX_Size

func (m *ProposalBlock) XXX_Size() int

func (*ProposalBlock) XXX_Unmarshal

func (m *ProposalBlock) XXX_Unmarshal(b []byte) error

type RwSetVerifyFailTxs

type RwSetVerifyFailTxs struct {
	BlockHeight uint64   `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	TxIds       []string `protobuf:"bytes,2,rep,name=tx_ids,json=txIds,proto3" json:"tx_ids,omitempty"`
}

func (*RwSetVerifyFailTxs) Descriptor

func (*RwSetVerifyFailTxs) Descriptor() ([]byte, []int)

func (*RwSetVerifyFailTxs) GetBlockHeight

func (m *RwSetVerifyFailTxs) GetBlockHeight() uint64

func (*RwSetVerifyFailTxs) GetTxIds

func (m *RwSetVerifyFailTxs) GetTxIds() []string

func (*RwSetVerifyFailTxs) Marshal

func (m *RwSetVerifyFailTxs) Marshal() (dAtA []byte, err error)

func (*RwSetVerifyFailTxs) MarshalTo

func (m *RwSetVerifyFailTxs) MarshalTo(dAtA []byte) (int, error)

func (*RwSetVerifyFailTxs) MarshalToSizedBuffer

func (m *RwSetVerifyFailTxs) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RwSetVerifyFailTxs) ProtoMessage

func (*RwSetVerifyFailTxs) ProtoMessage()

func (*RwSetVerifyFailTxs) Reset

func (m *RwSetVerifyFailTxs) Reset()

func (*RwSetVerifyFailTxs) Size

func (m *RwSetVerifyFailTxs) Size() (n int)

func (*RwSetVerifyFailTxs) String

func (m *RwSetVerifyFailTxs) String() string

func (*RwSetVerifyFailTxs) Unmarshal

func (m *RwSetVerifyFailTxs) Unmarshal(dAtA []byte) error

func (*RwSetVerifyFailTxs) XXX_DiscardUnknown

func (m *RwSetVerifyFailTxs) XXX_DiscardUnknown()

func (*RwSetVerifyFailTxs) XXX_Marshal

func (m *RwSetVerifyFailTxs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RwSetVerifyFailTxs) XXX_Merge

func (m *RwSetVerifyFailTxs) XXX_Merge(src proto.Message)

func (*RwSetVerifyFailTxs) XXX_Size

func (m *RwSetVerifyFailTxs) XXX_Size() int

func (*RwSetVerifyFailTxs) XXX_Unmarshal

func (m *RwSetVerifyFailTxs) XXX_Unmarshal(b []byte) error

type VerifyResult

type VerifyResult struct {
	VerifiedBlock      *common.Block              `protobuf:"bytes,1,opt,name=verified_block,json=verifiedBlock,proto3" json:"verified_block,omitempty"`
	Code               VerifyResult_Code          `protobuf:"varint,2,opt,name=code,proto3,enum=consensus.VerifyResult_Code" json:"code,omitempty"`
	Msg                string                     `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"`
	TxsRwSet           map[string]*common.TxRWSet `` /* 175-byte string literal not displayed */
	RwSetVerifyFailTxs *RwSetVerifyFailTxs        `protobuf:"bytes,5,opt,name=rw_set_verify_fail_txs,json=rwSetVerifyFailTxs,proto3" json:"rw_set_verify_fail_txs,omitempty"`
}

func (*VerifyResult) Descriptor

func (*VerifyResult) Descriptor() ([]byte, []int)

func (*VerifyResult) GetCode

func (m *VerifyResult) GetCode() VerifyResult_Code

func (*VerifyResult) GetMsg

func (m *VerifyResult) GetMsg() string

func (*VerifyResult) GetRwSetVerifyFailTxs

func (m *VerifyResult) GetRwSetVerifyFailTxs() *RwSetVerifyFailTxs

func (*VerifyResult) GetTxsRwSet

func (m *VerifyResult) GetTxsRwSet() map[string]*common.TxRWSet

func (*VerifyResult) GetVerifiedBlock

func (m *VerifyResult) GetVerifiedBlock() *common.Block

func (*VerifyResult) Marshal

func (m *VerifyResult) Marshal() (dAtA []byte, err error)

func (*VerifyResult) MarshalTo

func (m *VerifyResult) MarshalTo(dAtA []byte) (int, error)

func (*VerifyResult) MarshalToSizedBuffer

func (m *VerifyResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*VerifyResult) ProtoMessage

func (*VerifyResult) ProtoMessage()

func (*VerifyResult) Reset

func (m *VerifyResult) Reset()

func (*VerifyResult) Size

func (m *VerifyResult) Size() (n int)

func (*VerifyResult) String

func (m *VerifyResult) String() string

func (*VerifyResult) Unmarshal

func (m *VerifyResult) Unmarshal(dAtA []byte) error

func (*VerifyResult) XXX_DiscardUnknown

func (m *VerifyResult) XXX_DiscardUnknown()

func (*VerifyResult) XXX_Marshal

func (m *VerifyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VerifyResult) XXX_Merge

func (m *VerifyResult) XXX_Merge(src proto.Message)

func (*VerifyResult) XXX_Size

func (m *VerifyResult) XXX_Size() int

func (*VerifyResult) XXX_Unmarshal

func (m *VerifyResult) XXX_Unmarshal(b []byte) error

type VerifyResult_Code

type VerifyResult_Code int32
const (
	VerifyResult_SUCCESS VerifyResult_Code = 0
	VerifyResult_FAIL    VerifyResult_Code = 1
)

func (VerifyResult_Code) EnumDescriptor

func (VerifyResult_Code) EnumDescriptor() ([]byte, []int)

func (VerifyResult_Code) String

func (x VerifyResult_Code) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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