Documentation ¶
Index ¶
- Variables
- func BaseCommitValidation(config qbft.IConfig, signedCommit *specqbft.SignedMessage, ...) error
- func Compact(state *specqbft.State, decidedMessage *specqbft.SignedMessage)
- func CompactCopy(state *specqbft.State, decidedMessage *specqbft.SignedMessage) *specqbft.State
- func CreateCommit(state *specqbft.State, config qbft.IConfig, root [32]byte) (*specqbft.SignedMessage, error)
- func CreatePrepare(state *specqbft.State, config qbft.IConfig, newRound specqbft.Round, ...) (*specqbft.SignedMessage, error)
- func CreateProposal(state *specqbft.State, config qbft.IConfig, fullData []byte, ...) (*specqbft.SignedMessage, error)
- func CreateRoundChange(state *specqbft.State, config qbft.IConfig, newRound specqbft.Round, ...) (*specqbft.SignedMessage, error)
- func IsProposalJustification(config qbft.IConfig, share *ssvtypes.SSVShare, ...) error
- type Instance
- func (i *Instance) BaseMsgValidation(msg *specqbft.SignedMessage) error
- func (i *Instance) Broadcast(logger *zap.Logger, msg *specqbft.SignedMessage) error
- func (i *Instance) CanProcessMessages() bool
- func (i *Instance) Decode(data []byte) error
- func (i *Instance) Encode() ([]byte, error)
- func (i *Instance) ForceStop()
- func (i *Instance) GetConfig() qbft.IConfig
- func (i *Instance) GetHeight() specqbft.Height
- func (i *Instance) GetRoot() ([32]byte, error)
- func (i *Instance) IsDecided() (bool, []byte)
- func (i *Instance) MarshalJSON() ([]byte, error)
- func (i *Instance) ProcessMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (decided bool, decidedValue []byte, aggregatedCommit *specqbft.SignedMessage, ...)
- func (i *Instance) SetConfig(config qbft.IConfig)
- func (i *Instance) Start(logger *zap.Logger, value []byte, height specqbft.Height)
- func (i *Instance) UnmarshalJSON(data []byte) error
- func (i *Instance) UponCommit(logger *zap.Logger, signedCommit *specqbft.SignedMessage, ...) (bool, []byte, *specqbft.SignedMessage, error)
- func (i *Instance) UponRoundTimeout(logger *zap.Logger) error
Constants ¶
This section is empty.
Variables ¶
var CutoffRound = 15 // stop processing instances after 8*2+120*6 = 14.2 min (~ 2 epochs)
Functions ¶
func BaseCommitValidation ¶
func Compact ¶ added in v0.4.7
func Compact(state *specqbft.State, decidedMessage *specqbft.SignedMessage)
Compact trims the given qbft.State down to the minimum required for consensus to proceed.
Compact always discards message from previous rounds. Compact discards all non-commit messages, only if the given state is decided.
This helps reduce the state's memory footprint.
func CompactCopy ¶ added in v0.4.7
CompactCopy returns a compacted copy of the given qbft.State. CompactCopy is guaranteed to not modify the given state, but the returned state may be modified when the given state is modified.
TODO: this is a temporary solution to not break spec-tests. Revert this once spec is aligned.
See Compact for more details.
func CreateCommit ¶
func CreateCommit(state *specqbft.State, config qbft.IConfig, root [32]byte) (*specqbft.SignedMessage, error)
CreateCommit * Commit(
signCommit( UnsignedCommit( |current.blockchain|, current.round, signHash(hashBlockForCommitSeal(proposedBlock), current.id), digest(proposedBlock)), current.id ) );
func CreatePrepare ¶
func CreatePrepare(state *specqbft.State, config qbft.IConfig, newRound specqbft.Round, root [32]byte) (*specqbft.SignedMessage, error)
CreatePrepare * Prepare(
signPrepare( UnsignedPrepare( |current.blockchain|, newRound, digest(m.proposedBlock)), current.id ) );
func CreateProposal ¶
func CreateProposal(state *specqbft.State, config qbft.IConfig, fullData []byte, roundChanges, prepares []*specqbft.SignedMessage) (*specqbft.SignedMessage, error)
CreateProposal *
Proposal( signProposal( UnsignedProposal( |current.blockchain|, newRound, digest(block)), current.id), block, extractSignedRoundChanges(roundChanges), extractSignedPrepares(prepares));
func CreateRoundChange ¶
func CreateRoundChange(state *specqbft.State, config qbft.IConfig, newRound specqbft.Round, instanceStartValue []byte) (*specqbft.SignedMessage, error)
CreateRoundChange * RoundChange(
signRoundChange( UnsignedRoundChange( |current.blockchain|, newRound, digestOptionalBlock(current.lastPreparedBlock), current.lastPreparedRound), current.id), current.lastPreparedBlock, getRoundChangeJustification(current) )
Types ¶
type Instance ¶
type Instance struct { State *specqbft.State StartValue []byte // contains filtered or unexported fields }
Instance is a single QBFT instance that starts with a Start call (including a value). Every new msg the ProcessMsg function needs to be called
func NewInstance ¶
func (*Instance) BaseMsgValidation ¶
func (i *Instance) BaseMsgValidation(msg *specqbft.SignedMessage) error
func (*Instance) CanProcessMessages ¶ added in v1.1.0
CanProcessMessages will return true if instance can process messages
func (*Instance) MarshalJSON ¶ added in v1.1.0
MarshalJSON is a custom JSON marshaller for Instance
func (*Instance) ProcessMsg ¶
func (i *Instance) ProcessMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (decided bool, decidedValue []byte, aggregatedCommit *specqbft.SignedMessage, err error)
ProcessMsg processes a new QBFT msg, returns non nil error on msg processing error
func (*Instance) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON is a custom JSON unmarshaller for Instance
func (*Instance) UponCommit ¶
func (i *Instance) UponCommit(logger *zap.Logger, signedCommit *specqbft.SignedMessage, commitMsgContainer *specqbft.MsgContainer) (bool, []byte, *specqbft.SignedMessage, error)
UponCommit returns true if a quorum of commit messages was received. Assumes commit message is valid!