core

package
v0.0.0-...-91d38f8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: GPL-3.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RoundStepNewHeight     = RoundStepType(0x01) // Wait til CommitTime + timeoutCommit
	RoundStepNewRound      = RoundStepType(0x02) // Setup new round and go to RoundStepPropose
	RoundStepPropose       = RoundStepType(0x03) // Did propose, gossip proposal
	RoundStepPrevote       = RoundStepType(0x04) // Did prevote, gossip prevotes
	RoundStepPrevoteWait   = RoundStepType(0x05) // Did receive any +2/3 prevotes, start timeout
	RoundStepPrecommit     = RoundStepType(0x06) // Did precommit, gossip precommits
	RoundStepPrecommitWait = RoundStepType(0x07) // Did receive any +2/3 precommits, start timeout
	RoundStepCommit        = RoundStepType(0x08) // Entered commit state machine

)

RoundStepType

Variables

View Source
var (
	ErrInvalidProposalPOLRound      = errors.New("invalid proposal POL round")
	ErrInvalidProposalSignature     = errors.New("invalid proposal signature")
	ErrVoteHeightMismatch           = errors.New("vote height mismatch")
	ErrVoteInvalidValidatorAddress  = errors.New("invalid validator address")
	ErrEmptyBlockProposal           = errors.New("empty block proposal")
	ErrSignerMessageMissMatch       = errors.New("deprived signer and address field of msg are miss-match")
	ErrCatchUpReplyAddressMissMatch = errors.New("address of catch up reply msg and its child are miss match")
)
View Source
var (
	ErrConflictingVotes = errors.New("vote received from the same validator for different block in the same round")
	ErrDifferentMsgType = errors.New("message set is not of the same type of the received message")
)

Functions

func NewMsgStorage

func NewMsgStorage() *msgStorage

NewMsgStorage returns new instance of msgStorage

Types

type CatchUpReplyMsg

type CatchUpReplyMsg struct {
	BlockNumber *big.Int
	Payloads    [][]byte
}

CatchUpReplyMsg stores the data of previous message send to a stuck node

type CatchUpRequestMsg

type CatchUpRequestMsg struct {
	BlockNumber *big.Int
	Round       int64
	Step        RoundStepType
}

CatchUpRequestMsg represents the info of current stage of a node which is stuck in prevote or precommit for a while

func (*CatchUpRequestMsg) DecodeRLP

func (msg *CatchUpRequestMsg) DecodeRLP(s *rlp.Stream) error

func (*CatchUpRequestMsg) EncodeRLP

func (msg *CatchUpRequestMsg) EncodeRLP(w io.Writer) error

type Engine

type Engine interface {
	Start() error
	Stop() error
}

Engine abstract the core's functions Note that backend and other packages doesn't care about core's internal logic. It only requires core to start receiving/handling messages The sending of events/message from core to backend will be done by calling accessing Backend.EventMux()

func New

func New(backend tendermint.Backend, config *tendermint.Config, opts ...Option) Engine

New creates an Tendermint consensus core

type MsgStorageData

type MsgStorageData struct {
	Step  RoundStepType
	Round int64
	Data  []byte
}

MsgStorageData contain data for message stored

type Option

type Option func(c *core) error

func WithoutRebroadcast

func WithoutRebroadcast() Option

WithoutRebroadcast return an option to set whether or not core will rebroadcast its message

type Proposal

type Proposal struct {
	Block    *types.Block
	Round    int64
	POLRound int64
}

Proposal represent a propose message to be sent in the case of the node is a proposer for its Round.

func (*Proposal) DecodeRLP

func (p *Proposal) DecodeRLP(s *rlp.Stream) error

func (*Proposal) EncodeRLP

func (p *Proposal) EncodeRLP(w io.Writer) error

type RoundStepType

type RoundStepType uint8 // These must be numeric, ordered.

RoundStepType enumerates the state of the consensus state machine

func (RoundStepType) IsValid

func (rs RoundStepType) IsValid() bool

IsValid returns true if the step is valid, false if unknown/undefined.

func (RoundStepType) String

func (rs RoundStepType) String() string

String returns a string represent the current step based on RoundStepType Todo: use stringer for this.

type TimeoutTicker

type TimeoutTicker interface {
	Start() error
	Stop() error
	Chan() <-chan timeoutInfo       // on which to receive a timeout
	ScheduleTimeout(ti timeoutInfo) // reset the timer
}

TimeoutTicker is a timer that schedules timeouts conditional on the height/round/step in the timeoutInfo. The timeoutInfo.Duration may be non-positive. TimeoutTicker is thread-safe

func NewTimeoutTicker

func NewTimeoutTicker() TimeoutTicker

NewTimeoutTicker returns a new TimeoutTicker that's ready to use

type Vote

type Vote struct {
	BlockHash   *common.Hash
	BlockNumber *big.Int
	Round       int64
	Seal        []byte
}

Vote represents a vote for a new-block

func (*Vote) DecodeRLP

func (v *Vote) DecodeRLP(s *rlp.Stream) error

func (*Vote) EncodeRLP

func (v *Vote) EncodeRLP(w io.Writer) error

Jump to

Keyboard shortcuts

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