Documentation ¶
Overview ¶
Package consensus implements block execution according to the Lisk BFT protocol following LIP-0055.
Index ¶
- Constants
- type EventBlockDeleteMessage
- func (e *EventBlockDeleteMessage) Decode(data []byte) error
- func (e *EventBlockDeleteMessage) DecodeFromReader(reader *codec.Reader) error
- func (e *EventBlockDeleteMessage) DecodeStrict(data []byte) error
- func (e *EventBlockDeleteMessage) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventBlockDeleteMessage) Encode() []byte
- func (e *EventBlockDeleteMessage) MustDecode(data []byte)
- type EventBlockFinalizeMessage
- func (e *EventBlockFinalizeMessage) Decode(data []byte) error
- func (e *EventBlockFinalizeMessage) DecodeFromReader(reader *codec.Reader) error
- func (e *EventBlockFinalizeMessage) DecodeStrict(data []byte) error
- func (e *EventBlockFinalizeMessage) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventBlockFinalizeMessage) Encode() []byte
- func (e *EventBlockFinalizeMessage) MustDecode(data []byte)
- type EventBlockNewMessage
- func (e *EventBlockNewMessage) Decode(data []byte) error
- func (e *EventBlockNewMessage) DecodeFromReader(reader *codec.Reader) error
- func (e *EventBlockNewMessage) DecodeStrict(data []byte) error
- func (e *EventBlockNewMessage) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventBlockNewMessage) Encode() []byte
- func (e *EventBlockNewMessage) MustDecode(data []byte)
- type EventChainForkMessage
- func (e *EventChainForkMessage) Decode(data []byte) error
- func (e *EventChainForkMessage) DecodeFromReader(reader *codec.Reader) error
- func (e *EventChainForkMessage) DecodeStrict(data []byte) error
- func (e *EventChainForkMessage) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventChainForkMessage) Encode() []byte
- func (e *EventChainForkMessage) MustDecode(data []byte)
- type EventChangeValidator
- func (e *EventChangeValidator) Decode(data []byte) error
- func (e *EventChangeValidator) DecodeFromReader(reader *codec.Reader) error
- func (e *EventChangeValidator) DecodeStrict(data []byte) error
- func (e *EventChangeValidator) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventChangeValidator) Encode() []byte
- func (e *EventChangeValidator) MustDecode(data []byte)
- type EventNetworkBlockNewMessage
- func (e *EventNetworkBlockNewMessage) Decode(data []byte) error
- func (e *EventNetworkBlockNewMessage) DecodeFromReader(reader *codec.Reader) error
- func (e *EventNetworkBlockNewMessage) DecodeStrict(data []byte) error
- func (e *EventNetworkBlockNewMessage) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventNetworkBlockNewMessage) Encode() []byte
- func (e *EventNetworkBlockNewMessage) MustDecode(data []byte)
- type EventPostBlock
- func (e *EventPostBlock) Decode(data []byte) error
- func (e *EventPostBlock) DecodeFromReader(reader *codec.Reader) error
- func (e *EventPostBlock) DecodeStrict(data []byte) error
- func (e *EventPostBlock) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventPostBlock) Encode() []byte
- func (e *EventPostBlock) MustDecode(data []byte)
- type EventPostSingleCommits
- func (e *EventPostSingleCommits) Decode(data []byte) error
- func (e *EventPostSingleCommits) DecodeFromReader(reader *codec.Reader) error
- func (e *EventPostSingleCommits) DecodeStrict(data []byte) error
- func (e *EventPostSingleCommits) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *EventPostSingleCommits) Encode() []byte
- func (e *EventPostSingleCommits) MustDecode(data []byte)
- type Executer
- func (c *Executer) AddInternal(block *blockchain.Block)
- func (c *Executer) BFTBeforeTransactionsExecute(blockHeader blockchain.SealedBlockHeader, diffStore *diffdb.Database) error
- func (c *Executer) Certify(from, to uint32, address codec.Lisk32, blsPrivateKey []byte) error
- func (c *Executer) GetAggregateCommit() (*blockchain.AggregateCommit, error)
- func (c *Executer) GetBFTHeights(diffStore *diffdb.Database) (uint32, uint32, uint32, error)
- func (c *Executer) GetBFTParameters(diffStore *diffdb.Database, height uint32) (*liskbft.BFTParams, error)
- func (c *Executer) GetGeneratorKeys(diffStore *diffdb.Database, height uint32) (liskbft.Generators, error)
- func (c *Executer) GetSlotNumber(unixTime uint32) int
- func (c *Executer) GetSlotTime(slot int) uint32
- func (c *Executer) HeaderHasPriority(context *diffdb.Database, header blockchain.SealedBlockHeader, ...) (bool, error)
- func (c *Executer) ImpliesMaximalPrevotes(context *diffdb.Database, blockHeader blockchain.ReadableBlockHeader) (bool, error)
- func (c *Executer) Init(param *ExecuterInitParam) error
- func (c *Executer) Start() error
- func (c *Executer) Stop() error
- func (c *Executer) Subscribe(topic string) <-chan interface{}
- func (c *Executer) Synced(height, maxHeightPrevoted, maxHeightPreviouslyForged uint32) (bool, error)
- func (c *Executer) Syncing() bool
- type ExecuterConfig
- type ExecuterInitParam
- type NextValidatorParams
- func (e *NextValidatorParams) Decode(data []byte) error
- func (e *NextValidatorParams) DecodeFromReader(reader *codec.Reader) error
- func (e *NextValidatorParams) DecodeStrict(data []byte) error
- func (e *NextValidatorParams) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *NextValidatorParams) Encode() []byte
- func (e *NextValidatorParams) MustDecode(data []byte)
- type ProcessContext
- type ValidatorWithBLSKey
- type ValidatorsHash
- func (e *ValidatorsHash) Decode(data []byte) error
- func (e *ValidatorsHash) DecodeFromReader(reader *codec.Reader) error
- func (e *ValidatorsHash) DecodeStrict(data []byte) error
- func (e *ValidatorsHash) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *ValidatorsHash) Encode() []byte
- func (e *ValidatorsHash) MustDecode(data []byte)
- type ValidatorsWithBLSKey
Constants ¶
View Source
const ( EventNetworkBlockNew = "EventNetworkBlockNew" EventBlockNew = "EventBlockNew" EventBlockDelete = "EventBlockDelete" EventBlockFinalize = "EventBlockFinalize" EventChainFork = "EventChainFork" EventValidatorsChange = "EventValidatorsChange" )
View Source
const ( P2PEventPostBlock = "postBlock" P2PEventPostSingleCommits = "postSingleCommits" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventBlockDeleteMessage ¶
type EventBlockDeleteMessage struct {
Block *blockchain.Block `fieldNumber:"1"`
}
func (*EventBlockDeleteMessage) Decode ¶
func (e *EventBlockDeleteMessage) Decode(data []byte) error
func (*EventBlockDeleteMessage) DecodeFromReader ¶
func (e *EventBlockDeleteMessage) DecodeFromReader(reader *codec.Reader) error
func (*EventBlockDeleteMessage) DecodeStrict ¶
func (e *EventBlockDeleteMessage) DecodeStrict(data []byte) error
func (*EventBlockDeleteMessage) DecodeStrictFromReader ¶
func (e *EventBlockDeleteMessage) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventBlockDeleteMessage) Encode ¶
func (e *EventBlockDeleteMessage) Encode() []byte
func (*EventBlockDeleteMessage) MustDecode ¶
func (e *EventBlockDeleteMessage) MustDecode(data []byte)
type EventBlockFinalizeMessage ¶
type EventBlockFinalizeMessage struct { Original uint32 `fieldNumber:"1"` Next uint32 `fieldNumber:"2"` Trigger *blockchain.BlockHeader `fieldNumber:"3"` }
func (*EventBlockFinalizeMessage) Decode ¶
func (e *EventBlockFinalizeMessage) Decode(data []byte) error
func (*EventBlockFinalizeMessage) DecodeFromReader ¶
func (e *EventBlockFinalizeMessage) DecodeFromReader(reader *codec.Reader) error
func (*EventBlockFinalizeMessage) DecodeStrict ¶
func (e *EventBlockFinalizeMessage) DecodeStrict(data []byte) error
func (*EventBlockFinalizeMessage) DecodeStrictFromReader ¶
func (e *EventBlockFinalizeMessage) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventBlockFinalizeMessage) Encode ¶
func (e *EventBlockFinalizeMessage) Encode() []byte
func (*EventBlockFinalizeMessage) MustDecode ¶
func (e *EventBlockFinalizeMessage) MustDecode(data []byte)
type EventBlockNewMessage ¶
type EventBlockNewMessage struct { Block *blockchain.Block `fieldNumber:"1"` Events []*blockchain.Event `fieldNumber:"2"` }
func (*EventBlockNewMessage) Decode ¶
func (e *EventBlockNewMessage) Decode(data []byte) error
func (*EventBlockNewMessage) DecodeFromReader ¶
func (e *EventBlockNewMessage) DecodeFromReader(reader *codec.Reader) error
func (*EventBlockNewMessage) DecodeStrict ¶
func (e *EventBlockNewMessage) DecodeStrict(data []byte) error
func (*EventBlockNewMessage) DecodeStrictFromReader ¶
func (e *EventBlockNewMessage) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventBlockNewMessage) Encode ¶
func (e *EventBlockNewMessage) Encode() []byte
func (*EventBlockNewMessage) MustDecode ¶
func (e *EventBlockNewMessage) MustDecode(data []byte)
type EventChainForkMessage ¶
type EventChainForkMessage struct {
Block *blockchain.Block `fieldNumber:"1"`
}
func (*EventChainForkMessage) Decode ¶
func (e *EventChainForkMessage) Decode(data []byte) error
func (*EventChainForkMessage) DecodeFromReader ¶
func (e *EventChainForkMessage) DecodeFromReader(reader *codec.Reader) error
func (*EventChainForkMessage) DecodeStrict ¶
func (e *EventChainForkMessage) DecodeStrict(data []byte) error
func (*EventChainForkMessage) DecodeStrictFromReader ¶
func (e *EventChainForkMessage) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventChainForkMessage) Encode ¶
func (e *EventChainForkMessage) Encode() []byte
func (*EventChainForkMessage) MustDecode ¶
func (e *EventChainForkMessage) MustDecode(data []byte)
type EventChangeValidator ¶
type EventChangeValidator struct { NextValidators []*labi.Validator `fieldNumber:"1"` PrecommitThreshold uint64 `fieldNumber:"2"` CertificateThreshold uint64 `fieldNumber:"3"` }
func (*EventChangeValidator) Decode ¶
func (e *EventChangeValidator) Decode(data []byte) error
func (*EventChangeValidator) DecodeFromReader ¶
func (e *EventChangeValidator) DecodeFromReader(reader *codec.Reader) error
func (*EventChangeValidator) DecodeStrict ¶
func (e *EventChangeValidator) DecodeStrict(data []byte) error
func (*EventChangeValidator) DecodeStrictFromReader ¶
func (e *EventChangeValidator) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventChangeValidator) Encode ¶
func (e *EventChangeValidator) Encode() []byte
func (*EventChangeValidator) MustDecode ¶
func (e *EventChangeValidator) MustDecode(data []byte)
type EventNetworkBlockNewMessage ¶
type EventNetworkBlockNewMessage struct {
Block *blockchain.Block `fieldNumber:"1"`
}
func (*EventNetworkBlockNewMessage) Decode ¶
func (e *EventNetworkBlockNewMessage) Decode(data []byte) error
func (*EventNetworkBlockNewMessage) DecodeFromReader ¶
func (e *EventNetworkBlockNewMessage) DecodeFromReader(reader *codec.Reader) error
func (*EventNetworkBlockNewMessage) DecodeStrict ¶
func (e *EventNetworkBlockNewMessage) DecodeStrict(data []byte) error
func (*EventNetworkBlockNewMessage) DecodeStrictFromReader ¶
func (e *EventNetworkBlockNewMessage) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventNetworkBlockNewMessage) Encode ¶
func (e *EventNetworkBlockNewMessage) Encode() []byte
func (*EventNetworkBlockNewMessage) MustDecode ¶
func (e *EventNetworkBlockNewMessage) MustDecode(data []byte)
type EventPostBlock ¶
type EventPostBlock struct {
Block []byte `fieldNumber:"1"`
}
func (*EventPostBlock) Decode ¶
func (e *EventPostBlock) Decode(data []byte) error
func (*EventPostBlock) DecodeFromReader ¶
func (e *EventPostBlock) DecodeFromReader(reader *codec.Reader) error
func (*EventPostBlock) DecodeStrict ¶
func (e *EventPostBlock) DecodeStrict(data []byte) error
func (*EventPostBlock) DecodeStrictFromReader ¶
func (e *EventPostBlock) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventPostBlock) Encode ¶
func (e *EventPostBlock) Encode() []byte
func (*EventPostBlock) MustDecode ¶
func (e *EventPostBlock) MustDecode(data []byte)
type EventPostSingleCommits ¶
type EventPostSingleCommits struct {
SingleCommits []*certificate.SingleCommit `fieldNumber:"1"`
}
func (*EventPostSingleCommits) Decode ¶
func (e *EventPostSingleCommits) Decode(data []byte) error
func (*EventPostSingleCommits) DecodeFromReader ¶
func (e *EventPostSingleCommits) DecodeFromReader(reader *codec.Reader) error
func (*EventPostSingleCommits) DecodeStrict ¶
func (e *EventPostSingleCommits) DecodeStrict(data []byte) error
func (*EventPostSingleCommits) DecodeStrictFromReader ¶
func (e *EventPostSingleCommits) DecodeStrictFromReader(reader *codec.Reader) error
func (*EventPostSingleCommits) Encode ¶
func (e *EventPostSingleCommits) Encode() []byte
func (*EventPostSingleCommits) MustDecode ¶
func (e *EventPostSingleCommits) MustDecode(data []byte)
type Executer ¶
type Executer struct {
// contains filtered or unexported fields
}
Executer is main process for processing a block.
func NewExecuter ¶
func NewExecuter(config *ExecuterConfig) *Executer
NewExecuter creates new consensus component.
func (*Executer) AddInternal ¶
func (c *Executer) AddInternal(block *blockchain.Block)
func (*Executer) BFTBeforeTransactionsExecute ¶
func (c *Executer) BFTBeforeTransactionsExecute(blockHeader blockchain.SealedBlockHeader, diffStore *diffdb.Database) error
func (*Executer) GetAggregateCommit ¶
func (c *Executer) GetAggregateCommit() (*blockchain.AggregateCommit, error)
func (*Executer) GetBFTHeights ¶
func (*Executer) GetBFTParameters ¶
func (*Executer) GetGeneratorKeys ¶
func (*Executer) GetSlotNumber ¶
func (*Executer) GetSlotTime ¶
func (*Executer) HeaderHasPriority ¶
func (c *Executer) HeaderHasPriority(context *diffdb.Database, header blockchain.SealedBlockHeader, height, maxHeightPrevoted, maxHeightGenerated uint32) (bool, error)
func (*Executer) ImpliesMaximalPrevotes ¶
func (c *Executer) ImpliesMaximalPrevotes(context *diffdb.Database, blockHeader blockchain.ReadableBlockHeader) (bool, error)
func (*Executer) Init ¶
func (c *Executer) Init(param *ExecuterInitParam) error
Init consensus process.
type ExecuterConfig ¶
type ExecuterConfig struct { CTX context.Context ABI labi.ABI Chain *blockchain.Chain Conn *p2p.Connection BlockTime uint32 BatchSize int }
ExecuterConfig holds config for consensus.
type ExecuterInitParam ¶
type NextValidatorParams ¶
type NextValidatorParams struct { NextValidators []*labi.Validator `fieldNumber:"1"` PrecommitThreshold uint64 `fieldNumber:"2"` CertificateThreshold uint64 `fieldNumber:"3"` }
func (*NextValidatorParams) Decode ¶
func (e *NextValidatorParams) Decode(data []byte) error
func (*NextValidatorParams) DecodeFromReader ¶
func (e *NextValidatorParams) DecodeFromReader(reader *codec.Reader) error
func (*NextValidatorParams) DecodeStrict ¶
func (e *NextValidatorParams) DecodeStrict(data []byte) error
func (*NextValidatorParams) DecodeStrictFromReader ¶
func (e *NextValidatorParams) DecodeStrictFromReader(reader *codec.Reader) error
func (*NextValidatorParams) Encode ¶
func (e *NextValidatorParams) Encode() []byte
func (*NextValidatorParams) MustDecode ¶
func (e *NextValidatorParams) MustDecode(data []byte)
type ProcessContext ¶
type ProcessContext struct {
// contains filtered or unexported fields
}
ProcessContext holds context for processing a block.
type ValidatorWithBLSKey ¶
type ValidatorsHash ¶
type ValidatorsHash struct { Keys [][]byte `fieldNumber:"1"` Weights []uint64 `fieldNumber:"2"` CertificateThreshold uint64 `fieldNumber:"3"` }
func (*ValidatorsHash) Decode ¶
func (e *ValidatorsHash) Decode(data []byte) error
func (*ValidatorsHash) DecodeFromReader ¶
func (e *ValidatorsHash) DecodeFromReader(reader *codec.Reader) error
func (*ValidatorsHash) DecodeStrict ¶
func (e *ValidatorsHash) DecodeStrict(data []byte) error
func (*ValidatorsHash) DecodeStrictFromReader ¶
func (e *ValidatorsHash) DecodeStrictFromReader(reader *codec.Reader) error
func (*ValidatorsHash) Encode ¶
func (e *ValidatorsHash) Encode() []byte
func (*ValidatorsHash) MustDecode ¶
func (e *ValidatorsHash) MustDecode(data []byte)
type ValidatorsWithBLSKey ¶
type ValidatorsWithBLSKey []*ValidatorWithBLSKey
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package certificate implements block certificate generation protocol following [LIP-0061].
|
Package certificate implements block certificate generation protocol following [LIP-0061]. |
Package contradiction package provides functions to determin contradiction between 2 block headers as defined in [LIP-0014].
|
Package contradiction package provides functions to determin contradiction between 2 block headers as defined in [LIP-0014]. |
Package forkchoice implements block comparison logic for the fork choice mechanism as defined in [LIP-0014].
|
Package forkchoice implements block comparison logic for the fork choice mechanism as defined in [LIP-0014]. |
Package liskbft implements state transition logics for BFT protocol following [LIP-0056] and [LIP-0058].
|
Package liskbft implements state transition logics for BFT protocol following [LIP-0056] and [LIP-0058]. |
Package sync provides block synchronization mechanism following the BFT protocol.
|
Package sync provides block synchronization mechanism following the BFT protocol. |
Package validator implements utility functions regarding BFT validators.
|
Package validator implements utility functions regarding BFT validators. |
Click to show internal directories.
Click to hide internal directories.