Documentation
¶
Index ¶
- func NewSnapshot(ids []hots.ID, pks []*bls.PublicKey) *snapshot
- type API
- func (api *API) Add(expire rpc.BlockNumber, id uint32, pkbytes hexutil.Bytes, ...) error
- func (api *API) Aggregate(mulSigbytes []hexutil.Bytes) (hexutil.Bytes, error)
- func (api *API) GetReplicaInfo(expire rpc.BlockNumber) ([]replica, error)
- func (api *API) ProposeAdd(expire rpc.BlockNumber, id uint32, pkbytes hexutil.Bytes) (hexutil.Bytes, error)
- func (api *API) ProposeRemove(expire rpc.BlockNumber, id uint32) (hexutil.Bytes, error)
- func (api *API) Remove(expire rpc.BlockNumber, id uint32, sigbytes hexutil.Bytes) error
- type Config
- type Council
- func (c *Council) APIs(chain consensus.ChainReader) []rpc.API
- func (c *Council) Close() error
- func (c *Council) MakeService(chain consensus.ChainReader) *Service
- func (c *Council) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (c *Council) Prior(block *types.Block) []enode.ID
- func (c *Council) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (c *Council) Sign(text []byte) (*bls.PartialSignature, error)
- func (c *Council) Timeout(id hots.ID, view uint64) error
- func (c *Council) VerifyAt(header *types.Header, sig *bls.PartialSignature, text []byte) error
- func (c *Council) Vote(id hots.ID, view uint64, block []byte, sig *bls.PartialSignature) error
- type Legal
- func (lg *Legal) APIs(chain consensus.ChainReader) []rpc.API
- func (lg *Legal) Author(header *types.Header) (common.Address, error)
- func (lg *Legal) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (lg *Legal) Close() error
- func (lg *Legal) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) error
- func (lg *Legal) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (lg *Legal) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (lg *Legal) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (lg *Legal) SealHash(header *types.Header) (hash common.Hash)
- func (lg *Legal) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (lg *Legal) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (lg *Legal) VerifySeal(ChainReader consensus.ChainReader, header *types.Header) error
- func (lg *Legal) VerifyUncles(ChainReader consensus.ChainReader, block *types.Block) error
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to send requests for replicas joining/removing to the Hotstuff network
func (*API) GetReplicaInfo ¶
func (api *API) GetReplicaInfo(expire rpc.BlockNumber) ([]replica, error)
func (*API) ProposeAdd ¶
func (*API) ProposeRemove ¶
type Config ¶
type Config struct { Mine bool Id common.ID Key *bls.PrivateKey ServiceMaker func(consensus.ChainReader) *Service ChainReader consensus.ChainReader }
The config to build the Hotstuff consensus engine(council)
type Council ¶
type Council struct { *Legal // contains filtered or unexported fields }
Council is the Hotstuff consensus engine.
func NewCouncil ¶
func (*Council) APIs ¶
func (c *Council) APIs(chain consensus.ChainReader) []rpc.API
APIs implements Hotstuff engine apis.
func (*Council) MakeService ¶
func (c *Council) MakeService(chain consensus.ChainReader) *Service
MakeService returns Hotstuff protocol handler service which implements node.Service. Note, the method should only be called once during the registration of an Ethereum node service.
func (*Council) Prepare ¶
Prepare implements consensus.Engine.Prepare, preparing all the consensus fields of the header for running the transactions on top. Furthermore, the consensus state of the Council will be updated and enter a new consensus round to generate quorum certificates more quickly if there are changes in the passed head header.
func (*Council) Prior ¶
Prior implements handler.priorBroadcastSelector to choose the prior peers for broadcasting the block.
func (*Council) Seal ¶
func (c *Council) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal generates a new sealing request for the given input block and pushes the result into the given channel.
Note, the method returns immediately and will send the result async. More than one result may also be returned depending on the consensus algorithm.
func (*Council) Sign ¶
func (c *Council) Sign(text []byte) (*bls.PartialSignature, error)
Sign signs the ciphertext using the local private key
type Legal ¶
type Legal struct {
// contains filtered or unexported fields
}
Legal tracks the valid Hotstuff relicas and records their public keys and IDs
func (*Legal) APIs ¶
func (lg *Legal) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine.APIs.
func (*Legal) Author ¶
Author implements consensus.Engine.Author and retrieves the Ethereum address of the account that minted the given block.
func (*Legal) CalcDifficulty ¶
func (lg *Legal) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty implements consensus.Engine.CalcDifficulty.
func (*Legal) Finalize ¶
func (lg *Legal) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) error
Finalize implements consensus.Engine.Finalize.
func (*Legal) FinalizeAndAssemble ¶
func (lg *Legal) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
FinalizeAndAssemble implements consensus.Engine.FinalizeAndAssemble.
func (*Legal) Seal ¶
func (lg *Legal) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal implements consensus.Engine.Seal and does nothing.
func (*Legal) SealHash ¶
SealHash implements consensus.Engine.SealHash, returns the hash of a block prior to it being sealed.
func (*Legal) VerifyHeader ¶
VerifyHeader implements consensus.Engine.VerifyHeader and checks whether a header conforms to the consensus rules of the Hotstuff engine. Verifying the seal is done here.
func (*Legal) VerifyHeaders ¶
func (lg *Legal) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders implements consensus.Engine.VerifyHeaders, it is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).
func (*Legal) VerifySeal ¶
VerifySeal checks whether the crypto seal on a header is valid according to the consensus rules of the given engine.
func (*Legal) VerifyUncles ¶
VerifyUncles implements consensus.Engine.VerifyUncles and verifies that the given block's uncles conform to the consensus rules of Hotstuff engine.