Documentation
¶
Overview ¶
Package liskbft implements state transition logics for BFT protocol following LIP-0056 and LIP-0058.
Index ¶
- Constants
- Variables
- func GetBFTValidatorAndGenerators(validators labi.Validators) (BFTValidators, Generators)
- func GetLabiValidators(validators BFTValidators, generators Generators) labi.Validators
- type API
- func (a *API) AreHeadersContradicting(header1, header2 blockchain.SealedBlockHeader) (bool, error)
- func (a *API) ExistBFTParameters(diffStore *diffdb.Database, height uint32) (bool, error)
- func (a *API) GetBFTHeights(diffStore *diffdb.Database) (uint32, uint32, uint32, error)
- func (a *API) GetBFTParameters(diffStore *diffdb.Database, height uint32) (*BFTParams, error)
- func (a *API) GetCurrentValidators(context *diffdb.Database) (BFTValidators, error)
- func (a *API) GetGeneratorKeys(diffStore *diffdb.Database, height uint32) (Generators, error)
- func (a *API) GetValidator(context *diffdb.Database, address codec.Lisk32, height uint32) (*BFTValidator, error)
- func (a *API) HeaderHasPriority(diffStore *diffdb.Database, header blockchain.SealedBlockHeader, ...) (bool, error)
- func (a *API) ImpliesMaximalPrevotes(context *diffdb.Database, blockHeader blockchain.ReadableBlockHeader) (bool, error)
- func (a *API) IsHeaderContradictingChain(context *diffdb.Database, header blockchain.SealedBlockHeader) (bool, error)
- func (a *API) NextHeightBFTParameters(context *diffdb.Database, height uint32) (uint32, error)
- func (a *API) SetBFTParameters(diffStore *diffdb.Database, precommitThreshold, certificateThreshold uint64, ...) error
- func (a *API) SetGeneratorKeys(diffStore *diffdb.Database, generators Generators) error
- type ActiveValidator
- func (e *ActiveValidator) Decode(data []byte) error
- func (e *ActiveValidator) DecodeFromReader(reader *codec.Reader) error
- func (e *ActiveValidator) DecodeStrict(data []byte) error
- func (e *ActiveValidator) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *ActiveValidator) Encode() []byte
- func (e *ActiveValidator) MustDecode(data []byte)
- type ActiveValidators
- type BFTBlockHeader
- func (e *BFTBlockHeader) Decode(data []byte) error
- func (e *BFTBlockHeader) DecodeFromReader(reader *codec.Reader) error
- func (e *BFTBlockHeader) DecodeStrict(data []byte) error
- func (e *BFTBlockHeader) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *BFTBlockHeader) Encode() []byte
- func (h *BFTBlockHeader) GeneratorAddress() []byte
- func (h *BFTBlockHeader) Height() uint32
- func (h *BFTBlockHeader) MaxHeightGenerated() uint32
- func (h *BFTBlockHeader) MaxHeightPrevoted() uint32
- func (e *BFTBlockHeader) MustDecode(data []byte)
- type BFTBlockHeaders
- type BFTParams
- func (c *BFTParams) CertificateThreshold() uint64
- func (e *BFTParams) Decode(data []byte) error
- func (e *BFTParams) DecodeFromReader(reader *codec.Reader) error
- func (e *BFTParams) DecodeStrict(data []byte) error
- func (e *BFTParams) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *BFTParams) Encode() []byte
- func (e *BFTParams) MustDecode(data []byte)
- func (c *BFTParams) PrecommitThreshold() uint64
- func (c *BFTParams) PrevoteThreshold() uint64
- func (c BFTParams) String() string
- func (c *BFTParams) Validators() []*BFTValidator
- func (c *BFTParams) ValidatorsHash() codec.Hex
- type BFTValidator
- func (v *BFTValidator) Address() codec.Lisk32
- func (v *BFTValidator) BFTWeight() uint64
- func (v *BFTValidator) BLSKey() codec.Hex
- func (e *BFTValidator) Decode(data []byte) error
- func (e *BFTValidator) DecodeFromReader(reader *codec.Reader) error
- func (e *BFTValidator) DecodeStrict(data []byte) error
- func (e *BFTValidator) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *BFTValidator) Encode() []byte
- func (e *BFTValidator) MustDecode(data []byte)
- type BFTValidators
- type BFTVotes
- func (e *BFTVotes) Decode(data []byte) error
- func (e *BFTVotes) DecodeFromReader(reader *codec.Reader) error
- func (e *BFTVotes) DecodeStrict(data []byte) error
- func (e *BFTVotes) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *BFTVotes) Encode() []byte
- func (e *BFTVotes) MustDecode(data []byte)
- func (v BFTVotes) String() string
- type Endpoint
- type Generator
- func (g *Generator) Address() codec.Lisk32
- func (e *Generator) Decode(data []byte) error
- func (e *Generator) DecodeFromReader(reader *codec.Reader) error
- func (e *Generator) DecodeStrict(data []byte) error
- func (e *Generator) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *Generator) Encode() []byte
- func (g *Generator) GeneratorKey() codec.Hex
- func (e *Generator) MustDecode(data []byte)
- type GeneratorKeys
- func (e *GeneratorKeys) Decode(data []byte) error
- func (e *GeneratorKeys) DecodeFromReader(reader *codec.Reader) error
- func (e *GeneratorKeys) DecodeStrict(data []byte) error
- func (e *GeneratorKeys) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GeneratorKeys) Encode() []byte
- func (e *GeneratorKeys) MustDecode(data []byte)
- type Generators
- type GetValidatorInfoResponse
- func (e *GetValidatorInfoResponse) Decode(data []byte) error
- func (e *GetValidatorInfoResponse) DecodeFromReader(reader *codec.Reader) error
- func (e *GetValidatorInfoResponse) DecodeStrict(data []byte) error
- func (e *GetValidatorInfoResponse) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *GetValidatorInfoResponse) Encode() []byte
- func (e *GetValidatorInfoResponse) MustDecode(data []byte)
- type HashValidator
- func (e *HashValidator) Decode(data []byte) error
- func (e *HashValidator) DecodeFromReader(reader *codec.Reader) error
- func (e *HashValidator) DecodeStrict(data []byte) error
- func (e *HashValidator) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *HashValidator) Encode() []byte
- func (e *HashValidator) MustDecode(data []byte)
- type HashValidators
- type HashingValidators
- func (e *HashingValidators) Decode(data []byte) error
- func (e *HashingValidators) DecodeFromReader(reader *codec.Reader) error
- func (e *HashingValidators) DecodeStrict(data []byte) error
- func (e *HashingValidators) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *HashingValidators) Encode() []byte
- func (e *HashingValidators) MustDecode(data []byte)
- type IsBFTComplientRequest
- func (e *IsBFTComplientRequest) Decode(data []byte) error
- func (e *IsBFTComplientRequest) DecodeFromReader(reader *codec.Reader) error
- func (e *IsBFTComplientRequest) DecodeStrict(data []byte) error
- func (e *IsBFTComplientRequest) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *IsBFTComplientRequest) Encode() []byte
- func (e *IsBFTComplientRequest) MustDecode(data []byte)
- type IsBFTComplientResponse
- func (e *IsBFTComplientResponse) Decode(data []byte) error
- func (e *IsBFTComplientResponse) DecodeFromReader(reader *codec.Reader) error
- func (e *IsBFTComplientResponse) DecodeStrict(data []byte) error
- func (e *IsBFTComplientResponse) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *IsBFTComplientResponse) Encode() []byte
- func (e *IsBFTComplientResponse) MustDecode(data []byte)
- type KV
- type Module
- func (m *Module) API() *API
- func (m *Module) BeforeTransactionsExecute(blockHeader blockchain.ReadableBlockHeader, diffStore *diffdb.Database) error
- func (m *Module) Endpoint() statemachine.Endpoint
- func (m *Module) ID() uint32
- func (m *Module) Init(batchSize int) error
- func (m *Module) InitGenesisState(blockHeader blockchain.SealedBlockHeader, diffStore *diffdb.Database) error
- func (m *Module) Name() string
- type ModuleConfig
- type SlotNumberGetter
Constants ¶
View Source
const (
ModuleID uint32 = 11
)
Variables ¶
View Source
var ( ErrBFTParamsNotFound = errors.New("bFT parameters does not exist") ErrGeneratorKeysNotFound = errors.New("generator keys does not exist") )
Functions ¶
func GetBFTValidatorAndGenerators ¶
func GetBFTValidatorAndGenerators(validators labi.Validators) (BFTValidators, Generators)
func GetLabiValidators ¶
func GetLabiValidators(validators BFTValidators, generators Generators) labi.Validators
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) AreHeadersContradicting ¶
func (a *API) AreHeadersContradicting(header1, header2 blockchain.SealedBlockHeader) (bool, error)
func (*API) ExistBFTParameters ¶
func (*API) GetBFTHeights ¶
func (*API) GetBFTParameters ¶
func (*API) GetCurrentValidators ¶
func (a *API) GetCurrentValidators(context *diffdb.Database) (BFTValidators, error)
func (*API) GetGeneratorKeys ¶
func (*API) GetValidator ¶
func (*API) HeaderHasPriority ¶
func (a *API) HeaderHasPriority(diffStore *diffdb.Database, header blockchain.SealedBlockHeader, height, maxHeightPrevoted, maxHeightPreviouslyForged uint32) (bool, error)
func (*API) ImpliesMaximalPrevotes ¶
func (a *API) ImpliesMaximalPrevotes(context *diffdb.Database, blockHeader blockchain.ReadableBlockHeader) (bool, error)
func (*API) IsHeaderContradictingChain ¶
func (a *API) IsHeaderContradictingChain(context *diffdb.Database, header blockchain.SealedBlockHeader) (bool, error)
func (*API) NextHeightBFTParameters ¶
func (*API) SetBFTParameters ¶
func (*API) SetGeneratorKeys ¶
func (a *API) SetGeneratorKeys(diffStore *diffdb.Database, generators Generators) error
type ActiveValidator ¶
type ActiveValidator struct {
// contains filtered or unexported fields
}
ActiveValidator holds information for a particular concenter.
func (*ActiveValidator) Decode ¶
func (e *ActiveValidator) Decode(data []byte) error
func (*ActiveValidator) DecodeFromReader ¶
func (e *ActiveValidator) DecodeFromReader(reader *codec.Reader) error
func (*ActiveValidator) DecodeStrict ¶
func (e *ActiveValidator) DecodeStrict(data []byte) error
func (*ActiveValidator) DecodeStrictFromReader ¶
func (e *ActiveValidator) DecodeStrictFromReader(reader *codec.Reader) error
func (*ActiveValidator) Encode ¶
func (e *ActiveValidator) Encode() []byte
func (*ActiveValidator) MustDecode ¶
func (e *ActiveValidator) MustDecode(data []byte)
type ActiveValidators ¶
type ActiveValidators []*ActiveValidator
type BFTBlockHeader ¶
type BFTBlockHeader struct {
// contains filtered or unexported fields
}
func (*BFTBlockHeader) Decode ¶
func (e *BFTBlockHeader) Decode(data []byte) error
func (*BFTBlockHeader) DecodeFromReader ¶
func (e *BFTBlockHeader) DecodeFromReader(reader *codec.Reader) error
func (*BFTBlockHeader) DecodeStrict ¶
func (e *BFTBlockHeader) DecodeStrict(data []byte) error
func (*BFTBlockHeader) DecodeStrictFromReader ¶
func (e *BFTBlockHeader) DecodeStrictFromReader(reader *codec.Reader) error
func (*BFTBlockHeader) Encode ¶
func (e *BFTBlockHeader) Encode() []byte
func (*BFTBlockHeader) GeneratorAddress ¶
func (h *BFTBlockHeader) GeneratorAddress() []byte
func (*BFTBlockHeader) Height ¶
func (h *BFTBlockHeader) Height() uint32
func (*BFTBlockHeader) MaxHeightGenerated ¶
func (h *BFTBlockHeader) MaxHeightGenerated() uint32
func (*BFTBlockHeader) MaxHeightPrevoted ¶
func (h *BFTBlockHeader) MaxHeightPrevoted() uint32
func (*BFTBlockHeader) MustDecode ¶
func (e *BFTBlockHeader) MustDecode(data []byte)
type BFTBlockHeaders ¶
type BFTBlockHeaders []*BFTBlockHeader
type BFTParams ¶
type BFTParams struct {
// contains filtered or unexported fields
}
func (*BFTParams) CertificateThreshold ¶
func (*BFTParams) DecodeFromReader ¶
func (*BFTParams) DecodeStrict ¶
func (*BFTParams) DecodeStrictFromReader ¶
func (*BFTParams) MustDecode ¶
func (*BFTParams) PrecommitThreshold ¶
func (*BFTParams) PrevoteThreshold ¶
func (*BFTParams) Validators ¶
func (c *BFTParams) Validators() []*BFTValidator
func (*BFTParams) ValidatorsHash ¶
type BFTValidator ¶
type BFTValidator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func (*BFTValidator) Address ¶
func (v *BFTValidator) Address() codec.Lisk32
func (*BFTValidator) BFTWeight ¶
func (v *BFTValidator) BFTWeight() uint64
func (*BFTValidator) BLSKey ¶
func (v *BFTValidator) BLSKey() codec.Hex
func (*BFTValidator) Decode ¶
func (e *BFTValidator) Decode(data []byte) error
func (*BFTValidator) DecodeFromReader ¶
func (e *BFTValidator) DecodeFromReader(reader *codec.Reader) error
func (*BFTValidator) DecodeStrict ¶
func (e *BFTValidator) DecodeStrict(data []byte) error
func (*BFTValidator) DecodeStrictFromReader ¶
func (e *BFTValidator) DecodeStrictFromReader(reader *codec.Reader) error
func (*BFTValidator) Encode ¶
func (e *BFTValidator) Encode() []byte
func (*BFTValidator) MustDecode ¶
func (e *BFTValidator) MustDecode(data []byte)
type BFTValidators ¶
type BFTValidators []*BFTValidator
func (BFTValidators) Equal ¶
func (vs BFTValidators) Equal(validators BFTValidators) bool
func (BFTValidators) Find ¶
func (vs BFTValidators) Find(address []byte) (*BFTValidator, bool)
func (BFTValidators) Get ¶
func (vs BFTValidators) Get(address []byte) (*BFTValidator, bool)
func (*BFTValidators) Sort ¶
func (vs *BFTValidators) Sort()
type BFTVotes ¶
type BFTVotes struct {
// contains filtered or unexported fields
}
func (*BFTVotes) DecodeStrict ¶
func (*BFTVotes) DecodeStrictFromReader ¶
func (*BFTVotes) MustDecode ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) Get ¶
func (e *Endpoint) Get() statemachine.EndpointHandlers
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func (*Generator) DecodeFromReader ¶
func (*Generator) DecodeStrict ¶
func (*Generator) DecodeStrictFromReader ¶
func (*Generator) GeneratorKey ¶
func (*Generator) MustDecode ¶
type GeneratorKeys ¶
type GeneratorKeys struct {
Generators []*Generator `fieldNumber:"1"`
}
func (*GeneratorKeys) Decode ¶
func (e *GeneratorKeys) Decode(data []byte) error
func (*GeneratorKeys) DecodeFromReader ¶
func (e *GeneratorKeys) DecodeFromReader(reader *codec.Reader) error
func (*GeneratorKeys) DecodeStrict ¶
func (e *GeneratorKeys) DecodeStrict(data []byte) error
func (*GeneratorKeys) DecodeStrictFromReader ¶
func (e *GeneratorKeys) DecodeStrictFromReader(reader *codec.Reader) error
func (*GeneratorKeys) Encode ¶
func (e *GeneratorKeys) Encode() []byte
func (*GeneratorKeys) MustDecode ¶
func (e *GeneratorKeys) MustDecode(data []byte)
type Generators ¶
type Generators []*Generator
func (Generators) AtTimestamp ¶
func (vs Generators) AtTimestamp(slot SlotNumberGetter, timestamp uint32) (*Generator, error)
type GetValidatorInfoResponse ¶
type GetValidatorInfoResponse struct {
MaxHeightPrevoted uint32 `json:"maxHeightPrevoted" fieldNumber:"1"`
}
func (*GetValidatorInfoResponse) Decode ¶
func (e *GetValidatorInfoResponse) Decode(data []byte) error
func (*GetValidatorInfoResponse) DecodeFromReader ¶
func (e *GetValidatorInfoResponse) DecodeFromReader(reader *codec.Reader) error
func (*GetValidatorInfoResponse) DecodeStrict ¶
func (e *GetValidatorInfoResponse) DecodeStrict(data []byte) error
func (*GetValidatorInfoResponse) DecodeStrictFromReader ¶
func (e *GetValidatorInfoResponse) DecodeStrictFromReader(reader *codec.Reader) error
func (*GetValidatorInfoResponse) Encode ¶
func (e *GetValidatorInfoResponse) Encode() []byte
func (*GetValidatorInfoResponse) MustDecode ¶
func (e *GetValidatorInfoResponse) MustDecode(data []byte)
type HashValidator ¶
func (*HashValidator) Decode ¶
func (e *HashValidator) Decode(data []byte) error
func (*HashValidator) DecodeFromReader ¶
func (e *HashValidator) DecodeFromReader(reader *codec.Reader) error
func (*HashValidator) DecodeStrict ¶
func (e *HashValidator) DecodeStrict(data []byte) error
func (*HashValidator) DecodeStrictFromReader ¶
func (e *HashValidator) DecodeStrictFromReader(reader *codec.Reader) error
func (*HashValidator) Encode ¶
func (e *HashValidator) Encode() []byte
func (*HashValidator) MustDecode ¶
func (e *HashValidator) MustDecode(data []byte)
type HashValidators ¶
type HashValidators []*HashValidator
type HashingValidators ¶
type HashingValidators struct { ActiveValidators []*HashValidator `fieldNumber:"1"` CertificateThreshold uint64 `fieldNumber:"2"` }
func (*HashingValidators) Decode ¶
func (e *HashingValidators) Decode(data []byte) error
func (*HashingValidators) DecodeFromReader ¶
func (e *HashingValidators) DecodeFromReader(reader *codec.Reader) error
func (*HashingValidators) DecodeStrict ¶
func (e *HashingValidators) DecodeStrict(data []byte) error
func (*HashingValidators) DecodeStrictFromReader ¶
func (e *HashingValidators) DecodeStrictFromReader(reader *codec.Reader) error
func (*HashingValidators) Encode ¶
func (e *HashingValidators) Encode() []byte
func (*HashingValidators) MustDecode ¶
func (e *HashingValidators) MustDecode(data []byte)
type IsBFTComplientRequest ¶
type IsBFTComplientRequest struct { GeneratorPublicKey codec.Hex `json:"generatorPublicKey" fieldNumber:"1"` Height uint32 `json:"height" fieldNumber:"2"` MaxHeightGenerated uint32 `json:"maxHeightPreviouslyForged" fieldNumber:"3"` MaxHeightPrevoted uint32 `json:"maxHeightPrevoted" fieldNumber:"4"` }
func (*IsBFTComplientRequest) Decode ¶
func (e *IsBFTComplientRequest) Decode(data []byte) error
func (*IsBFTComplientRequest) DecodeFromReader ¶
func (e *IsBFTComplientRequest) DecodeFromReader(reader *codec.Reader) error
func (*IsBFTComplientRequest) DecodeStrict ¶
func (e *IsBFTComplientRequest) DecodeStrict(data []byte) error
func (*IsBFTComplientRequest) DecodeStrictFromReader ¶
func (e *IsBFTComplientRequest) DecodeStrictFromReader(reader *codec.Reader) error
func (*IsBFTComplientRequest) Encode ¶
func (e *IsBFTComplientRequest) Encode() []byte
func (*IsBFTComplientRequest) MustDecode ¶
func (e *IsBFTComplientRequest) MustDecode(data []byte)
type IsBFTComplientResponse ¶
type IsBFTComplientResponse struct {
Valid bool `json:"valid" fieldNumber:"1"`
}
func (*IsBFTComplientResponse) Decode ¶
func (e *IsBFTComplientResponse) Decode(data []byte) error
func (*IsBFTComplientResponse) DecodeFromReader ¶
func (e *IsBFTComplientResponse) DecodeFromReader(reader *codec.Reader) error
func (*IsBFTComplientResponse) DecodeStrict ¶
func (e *IsBFTComplientResponse) DecodeStrict(data []byte) error
func (*IsBFTComplientResponse) DecodeStrictFromReader ¶
func (e *IsBFTComplientResponse) DecodeStrictFromReader(reader *codec.Reader) error
func (*IsBFTComplientResponse) Encode ¶
func (e *IsBFTComplientResponse) Encode() []byte
func (*IsBFTComplientResponse) MustDecode ¶
func (e *IsBFTComplientResponse) MustDecode(data []byte)
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) BeforeTransactionsExecute ¶
func (m *Module) BeforeTransactionsExecute(blockHeader blockchain.ReadableBlockHeader, diffStore *diffdb.Database) error
AfterBlockApply applies BFT properties.
func (*Module) Endpoint ¶
func (m *Module) Endpoint() statemachine.Endpoint
func (*Module) InitGenesisState ¶
func (m *Module) InitGenesisState(blockHeader blockchain.SealedBlockHeader, diffStore *diffdb.Database) error
type ModuleConfig ¶
type ModuleConfig struct {
BatchSize int `json:"batchSize"`
}
type SlotNumberGetter ¶
Click to show internal directories.
Click to hide internal directories.