Documentation
¶
Overview ¶
implements consensus interface.
Index ¶
- func ReadExtra(h *types.Header) (*ConsensusGroup, *BlockProof, error)
- func SealHash(header *types.Header) (hash common.Hash)
- func VerifyExtraData(nextcommittee *ConsensusGroup, blkproof *BlockProof) error
- type API
- type BlockProof
- type ConsensusGroup
- type EcPonBada
- func (c *EcPonBada) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (c *EcPonBada) Author(header *types.Header) (common.Address, error)
- func (c *EcPonBada) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
- func (c *EcPonBada) Close() error
- func (c *EcPonBada) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...)
- func (c *EcPonBada) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (c *EcPonBada) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error
- func (c *EcPonBada) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error
- func (c *EcPonBada) SealEcPonBada(chain consensus.ChainHeaderReader, block *types.Block, blockProof *BlockProof, ...) (*types.Block, error)
- func (c *EcPonBada) SealHash(header *types.Header) common.Hash
- func (c *EcPonBada) SetEcRpcHandler(handler EcRpcCall)
- func (c *EcPonBada) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
- func (c *EcPonBada) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (c *EcPonBada) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type EcRpcCall
- type ExtraData
- type ValidatorProof
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadExtra ¶
func ReadExtra(h *types.Header) (*ConsensusGroup, *BlockProof, error)
read a block to get Next Committe info and the correctness proof of the block
func VerifyExtraData ¶
func VerifyExtraData(nextcommittee *ConsensusGroup, blkproof *BlockProof) error
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to allow controlling PON/BADA consensus
type BlockProof ¶
type BlockProof struct { PubKeys []byte `json:"publickeys"` Checksum []byte `json:"checksum"` R []byte `json:"rValue"` // R value of multi signature S []byte `json:"sValue"` /// S value of multi signature }
func NewBlockProof ¶
type ConsensusGroup ¶
type ConsensusGroup struct { BlockNo uint64 //Block number which this committee works for //Validators []enode.ID //validater list, the first one is the leader Validators []string // this time, string id used, later I'll use enode.ID }
func NewConsensusGroup ¶
func NewConsensusGroup(num uint64, validators []string) *ConsensusGroup
type EcPonBada ¶
type EcPonBada struct {
// contains filtered or unexported fields
}
func New ¶
func New(config *params.ExternalConsensusConfig, db ethdb.Database) *EcPonBada
New creates a EcPonBada consensus engine
func (*EcPonBada) APIs ¶
func (c *EcPonBada) APIs(chain consensus.ChainHeaderReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.
func (*EcPonBada) Author ¶
Author implements consensus.Engine, returning the Ethereum address recovered
func (*EcPonBada) CalcDifficulty ¶
func (c *EcPonBada) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
let's just return notUsedDifficulty later, we need to implement it.
func (*EcPonBada) Close ¶
Close implements consensus.Engine. It's a noop for clique as there are no background threads.
func (*EcPonBada) Finalize ¶
func (c *EcPonBada) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header)
Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given.
func (*EcPonBada) FinalizeAndAssemble ¶
func (c *EcPonBada) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set, nor block rewards given, and returns the final block.
func (*EcPonBada) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*EcPonBada) Seal ¶
func (c *EcPonBada) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal implements consensus.Engine, attempting to create a sealed block using multi signature it is not used, instead, below API is used
func (*EcPonBada) SealEcPonBada ¶
func (c *EcPonBada) SealEcPonBada(chain consensus.ChainHeaderReader, block *types.Block, blockProof *BlockProof, nextcommittee *ConsensusGroup) (*types.Block, error)
Seal implements consensus.Engine, attempting to create a sealed block using multi signature this API is not defined in Consensus Interface EcPonBada, we can seal immediately, we don't need channel we put signature data and next committee information in the extradata field of header
func (*EcPonBada) SetEcRpcHandler ¶
this is the api only supported in EcPonBada consensus api register ecrpchandler
func (*EcPonBada) VerifyHeader ¶
func (c *EcPonBada) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
VerifyHeader checks whether a header conforms to the consensus rules.
func (*EcPonBada) VerifyHeaders ¶
func (c *EcPonBada) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. 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 (*EcPonBada) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.
type EcRpcCall ¶
type EcRpcCall interface {
SendVerifySeal(blockno uint64, bhash common.Hash, bproof *BlockProof) error
}
type ExtraData ¶
type ExtraData struct { //in fact both the value must not be nil, for easy testing, nil allowed temporarilly NextCommittee *ConsensusGroup `rlp:"nil"` BlkProof *BlockProof `rlp:"nil"` }
extradata is inserted in block header nextcommittee includes information on next committee members who are reponsible for singing next block blkproof includes mainly signagtures of committee members who validated the block
type ValidatorProof ¶
type ValidatorProof interface{}
ValidatorProof includes the information for convincing the validators are legitimate at the moment, i'll use the empty interface, later, need to define concrete structure