Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCertificate(header *block.Header, data []byte) error
- func Config() *config
- func GetCredentialVotes(cs *CredentialSign) float64
- func MsgTransfer() *msgTransfer
- func NewMsgBlockProposal(bp *BlockProposal) *msgBlockProposal
- func NewMsgByzantineAgreementStar(ba *ByzantineAgreementStar) *msgByzantineAgreementStar
- func NewMsgCredential(c *CredentialSign) *msgCredentialSig
- type Apos
- type BaEvent
- type BlockCertificate
- func (z *BlockCertificate) DecodeMsg(dc *msgp.Reader) (err error)
- func (z BlockCertificate) EncodeMsg(en *msgp.Writer) (err error)
- func (z BlockCertificate) MarshalMsg(b []byte) (o []byte, err error)
- func (z BlockCertificate) Msgsize() (s int)
- func (z *BlockCertificate) UnmarshalMsg(bts []byte) (o []byte, err error)
- type BlockChainHandler
- type BlockProducerHandler
- type BlockProposal
- func (z *BlockProposal) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *BlockProposal) EncodeMsg(en *msgp.Writer) (err error)
- func (z *BlockProposal) MarshalMsg(b []byte) (o []byte, err error)
- func (z *BlockProposal) Msgsize() (s int)
- func (z *BlockProposal) UnmarshalMsg(bts []byte) (o []byte, err error)
- type BpEvent
- type BpObj
- type BpWithPriority
- type BpWithPriorityHeap
- type ByzantineAgreementStar
- func (ba *ByzantineAgreementStar) BaHash() types.Hash
- func (z *ByzantineAgreementStar) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *ByzantineAgreementStar) EncodeMsg(en *msgp.Writer) (err error)
- func (z *ByzantineAgreementStar) MarshalMsg(b []byte) (o []byte, err error)
- func (z *ByzantineAgreementStar) Msgsize() (s int)
- func (z *ByzantineAgreementStar) UnmarshalMsg(bts []byte) (o []byte, err error)
- type CommonCoinMinHash
- func (z *CommonCoinMinHash) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *CommonCoinMinHash) EncodeMsg(en *msgp.Writer) (err error)
- func (z *CommonCoinMinHash) MarshalMsg(b []byte) (o []byte, err error)
- func (z *CommonCoinMinHash) Msgsize() (s int)
- func (z *CommonCoinMinHash) UnmarshalMsg(bts []byte) (o []byte, err error)
- type CommonTools
- type CredentialSigForHash
- func (z *CredentialSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *CredentialSigForHash) EncodeMsg(en *msgp.Writer) (err error)
- func (z *CredentialSigForHash) MarshalMsg(b []byte) (o []byte, err error)
- func (z *CredentialSigForHash) Msgsize() (s int)
- func (z *CredentialSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
- type CredentialSign
- func (a *CredentialSign) Cmp(b *CredentialSign) int
- func (cs *CredentialSign) CsHash() types.Hash
- func (z *CredentialSign) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *CredentialSign) EncodeMsg(en *msgp.Writer) (err error)
- func (z *CredentialSign) MarshalMsg(b []byte) (o []byte, err error)
- func (z *CredentialSign) Msgsize() (s int)
- func (cret *CredentialSign) Sender() (types.Address, error)
- func (z *CredentialSign) UnmarshalMsg(bts []byte) (o []byte, err error)
- type CsEvent
- type EngineApos
- func (this *EngineApos) Author(chain consensus.ChainReader, header *block.Header) (types.Address, error)
- func (this *EngineApos) Finalize(chain consensus.ChainReader, header *block.Header, state *state.StateDB, ...) (*block.Block, error)
- func (this *EngineApos) Incentive(producer types.Address, state *state.StateDB, header *block.Header) (*transaction.Transaction, error)
- func (this *EngineApos) Prepare(chain consensus.ChainReader, header *block.Header) error
- func (this *EngineApos) Seal(chain consensus.ChainReader, block *block.Block, stop <-chan struct{}) (*block.Block, error)
- func (this *EngineApos) SetKey(prv *ecdsa.PrivateKey)
- func (this *EngineApos) VerifyHeader(chain consensus.ChainReader, header *block.Header, seal bool) error
- func (this *EngineApos) VerifyHeaders(chain consensus.ChainReader, headers []*block.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (this *EngineApos) VerifySeal(chain consensus.ChainReader, header *block.Header) error
- type EphemeralSigForHash
- func (z *EphemeralSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *EphemeralSigForHash) EncodeMsg(en *msgp.Writer) (err error)
- func (z *EphemeralSigForHash) MarshalMsg(b []byte) (o []byte, err error)
- func (z *EphemeralSigForHash) Msgsize() (s int)
- func (z *EphemeralSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
- type EphemeralSign
- func (z *EphemeralSign) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *EphemeralSign) EncodeMsg(en *msgp.Writer) (err error)
- func (esig *EphemeralSign) GetStep() uint64
- func (z *EphemeralSign) MarshalMsg(b []byte) (o []byte, err error)
- func (z *EphemeralSign) Msgsize() (s int)
- func (z *EphemeralSign) UnmarshalMsg(bts []byte) (o []byte, err error)
- type OutMsger
- type PriKeyHandler
- type QuantityEmpty
- func (z *QuantityEmpty) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *QuantityEmpty) EncodeMsg(en *msgp.Writer) (err error)
- func (this *QuantityEmpty) Hash() types.Hash
- func (z *QuantityEmpty) MarshalMsg(b []byte) (o []byte, err error)
- func (z *QuantityEmpty) Msgsize() (s int)
- func (z *QuantityEmpty) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Round
- type SeedData
- func (z *SeedData) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *SeedData) EncodeMsg(en *msgp.Writer) (err error)
- func (this *SeedData) Hash() types.Hash
- func (z *SeedData) MarshalMsg(b []byte) (o []byte, err error)
- func (z *SeedData) Msgsize() (s int)
- func (z *SeedData) UnmarshalMsg(bts []byte) (o []byte, err error)
- type SeedDataSigForHash
- func (z *SeedDataSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *SeedDataSigForHash) EncodeMsg(en *msgp.Writer) (err error)
- func (z *SeedDataSigForHash) MarshalMsg(b []byte) (o []byte, err error)
- func (z *SeedDataSigForHash) Msgsize() (s int)
- func (z *SeedDataSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Signature
- func (z *Signature) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Signature) EncodeMsg(en *msgp.Writer) (err error)
- func (s *Signature) FillBySig(sig []byte) (R, S, V *big.Int, err error)
- func (s *Signature) Hash() types.Hash
- func (s *Signature) Init()
- func (z *Signature) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Signature) Msgsize() (s int)
- func (z *Signature) UnmarshalMsg(bts []byte) (o []byte, err error)
- type SortitionPriority
- type VoteData
- type VoteObj
Constants ¶
const ( ROUND_OK = iota ROUND_HANGFOREVER ROUND_NO_BLOCK ROUND_STOP ROUND_INSERT_ERR ROUND_WRITE_CERTIFICATE_ERR )
const ( //font style COLOR_STYLE_RESET = ";0" COLOR_STYLE_HIGHLIGHT = ";1" COLOR_STYLE_DIM = ";2" COLOR_STYLE_UNDERLINE = ";4" COLOR_STYLE_REV = ";7" COLOR_FRONT_BLACK = COLOR_PREFIX + ";30" + COLOR_SUFFIX COLOR_FRONT_RED = COLOR_PREFIX + ";31" + COLOR_SUFFIX COLOR_FRONT_GREEN = COLOR_PREFIX + ";32" + COLOR_SUFFIX COLOR_FRONT_YELLOW = COLOR_PREFIX + ";33" + COLOR_SUFFIX COLOR_FRONT_BLUE = COLOR_PREFIX + ";34" + COLOR_SUFFIX COLOR_FRONT_PINK = COLOR_PREFIX + ";35" + COLOR_SUFFIX COLOR_FRONT_CYAN = COLOR_PREFIX + ";36" + COLOR_SUFFIX COLOR_FRONT_WHITE = COLOR_PREFIX + ";37" + COLOR_SUFFIX //background color COLOR_BACK_BLACK = COLOR_PREFIX + ";40" + COLOR_SUFFIX COLOR_BACK_RED = COLOR_PREFIX + ";41" + COLOR_SUFFIX COLOR_BACK_GREEN = COLOR_PREFIX + ";42" + COLOR_SUFFIX COLOR_BACK_YELLOW = COLOR_PREFIX + ";43" + COLOR_SUFFIX COLOR_BACK_BLUE = COLOR_PREFIX + ";44" + COLOR_SUFFIX COLOR_BACK_PINK = COLOR_PREFIX + ";45" + COLOR_SUFFIX COLOR_BACK_CYAN = COLOR_PREFIX + ";46" + COLOR_SUFFIX COLOR_BACK_WHITE = COLOR_PREFIX + ";47" + COLOR_SUFFIX //prefix COLOR_PREFIX = "\033[" COLOR_SUFFIX = "m" //short struct COLOR_SHORT_RESET = COLOR_PREFIX + COLOR_STYLE_RESET + COLOR_SUFFIX )
const ( StepBp = STEP_BP StepReduction1 = STEP_REDUCTION_1 StepReduction2 = STEP_REDUCTION_2 StepFinal = STEP_FINAL )
const ( STEP_BP = iota + 0xffff STEP_REDUCTION_1 STEP_REDUCTION_2 STEP_FINAL STEP_IDLE )
Variables ¶
var ( ErrBlockTime = errors.New("timestamp less than or equal parent's timestamp") ErrSignature = errors.New("signature is not right") ErrAposID = errors.New("consensus Id is not apos") ErrAposData = errors.New("apos consensus fail") ErrAposSign = errors.New("apos consensus signature is not equal to header") ErrCertSteps = errors.New("apos consensus certificate step is not same") ErrCertPHash = errors.New("apos consensus certificate parent hash is not same") ErrCertStep = errors.New("apos consensus certificate step is not bba step") ErrCertVotes = errors.New("apos consensus certificate votes is not enough") )
var ( ErrDuplicateMsg = errors.New("recovery duplicate credential message") ErrDuplicatePropagateMsg = errors.New("recovery duplicate Propagate credential message") )
var ( ErrInvalidSig = errors.New("invalid v, r, s values") ErrInvalidChainId = errors.New("invalid chain id for signer") )
var (
ConsensusDataId = "apos"
)
var (
TimeOut types.Hash = types.HexToHash("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
)
Functions ¶
func GetCredentialVotes ¶
func GetCredentialVotes(cs *CredentialSign) float64
func NewMsgBlockProposal ¶
func NewMsgBlockProposal(bp *BlockProposal) *msgBlockProposal
new a message
func NewMsgByzantineAgreementStar ¶
func NewMsgByzantineAgreementStar(ba *ByzantineAgreementStar) *msgByzantineAgreementStar
func NewMsgCredential ¶
func NewMsgCredential(c *CredentialSign) *msgCredentialSig
Types ¶
type Apos ¶
type Apos struct {
// contains filtered or unexported fields
}
func NewApos ¶
func NewApos(bcHandler BlockChainHandler, producerHandler BlockProducerHandler, mux *event.TypeMux) *Apos
Create Apos
func (*Apos) InRecovering ¶
func (*Apos) SetCoinBase ¶
func (*Apos) SetPriKey ¶
func (this *Apos) SetPriKey(priKey *ecdsa.PrivateKey)
type BaEvent ¶
type BaEvent struct{ Ba *ByzantineAgreementStar }
func (*BaEvent) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type BlockCertificate ¶
type BlockCertificate []*CredentialSign
func (*BlockCertificate) DecodeMsg ¶
func (z *BlockCertificate) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (BlockCertificate) EncodeMsg ¶
func (z BlockCertificate) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (BlockCertificate) MarshalMsg ¶
func (z BlockCertificate) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (BlockCertificate) Msgsize ¶
func (z BlockCertificate) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BlockCertificate) UnmarshalMsg ¶
func (z *BlockCertificate) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type BlockChainHandler ¶
type BlockChainHandler interface { CurrentBlock() *block.Block CurrentBlockNum() uint64 GetNowBlockHash() types.Hash InsertChain(chain block.Blocks) (int, error) GetBlockByNumber(number uint64) *block.Block GetHeaderByNumber(number uint64) *block.Header StateAt(root types.Hash) (*state.StateDB, error) GetDb() database.IDatabase GetBlockByHash(hash types.Hash) *block.Block SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription GetConsensusData(key types.Hash) []byte WriteConsensusData(key types.Hash, value []byte) error GetExtra(key []byte) []byte VerifyNextRoundBlock(block *block.Block) bool }
type BlockProducerHandler ¶
type BlockProducerHandler interface {
GetProducerNewBlock(data *block.ConsensusData, timeLimit int64) *block.Block
}
type BlockProposal ¶
type BlockProposal struct { Block *block.Block Esig *EphemeralSign Credential *CredentialSign }
step1 (Block Proposal) message m(r,1) = (Br, esig(H(Br)), σr1)
func (*BlockProposal) DecodeMsg ¶
func (z *BlockProposal) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*BlockProposal) EncodeMsg ¶
func (z *BlockProposal) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*BlockProposal) MarshalMsg ¶
func (z *BlockProposal) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*BlockProposal) Msgsize ¶
func (z *BlockProposal) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BlockProposal) UnmarshalMsg ¶
func (z *BlockProposal) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type BpEvent ¶
type BpEvent struct{ Bp *BlockProposal }
func (*BpEvent) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type BpObj ¶
type BpObj struct { BpHeap BpWithPriorityHeap // contains filtered or unexported fields }
func (*BpObj) CommitteeVote ¶
type BpWithPriority ¶
type BpWithPriority struct {
// contains filtered or unexported fields
}
type BpWithPriorityHeap ¶
type BpWithPriorityHeap []*BpWithPriority
func (BpWithPriorityHeap) Len ¶
func (h BpWithPriorityHeap) Len() int
func (BpWithPriorityHeap) Less ¶
func (h BpWithPriorityHeap) Less(i, j int) bool
func (*BpWithPriorityHeap) Pop ¶
func (h *BpWithPriorityHeap) Pop() interface{}
func (*BpWithPriorityHeap) Push ¶
func (h *BpWithPriorityHeap) Push(x interface{})
func (BpWithPriorityHeap) Swap ¶
func (h BpWithPriorityHeap) Swap(i, j int)
type ByzantineAgreementStar ¶
type ByzantineAgreementStar struct { Hash types.Hash //voted block's hash. Esig *EphemeralSign //the signature of somebody's ephemeral secret key Credential *CredentialSign }
func (*ByzantineAgreementStar) BaHash ¶
func (ba *ByzantineAgreementStar) BaHash() types.Hash
func (*ByzantineAgreementStar) DecodeMsg ¶
func (z *ByzantineAgreementStar) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*ByzantineAgreementStar) EncodeMsg ¶
func (z *ByzantineAgreementStar) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*ByzantineAgreementStar) MarshalMsg ¶
func (z *ByzantineAgreementStar) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*ByzantineAgreementStar) Msgsize ¶
func (z *ByzantineAgreementStar) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ByzantineAgreementStar) UnmarshalMsg ¶
func (z *ByzantineAgreementStar) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type CommonCoinMinHash ¶
func (*CommonCoinMinHash) DecodeMsg ¶
func (z *CommonCoinMinHash) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*CommonCoinMinHash) EncodeMsg ¶
func (z *CommonCoinMinHash) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*CommonCoinMinHash) MarshalMsg ¶
func (z *CommonCoinMinHash) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*CommonCoinMinHash) Msgsize ¶
func (z *CommonCoinMinHash) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CommonCoinMinHash) UnmarshalMsg ¶
func (z *CommonCoinMinHash) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type CommonTools ¶
type CommonTools interface { //Note: apos no right to hold a privateKey , so the Sig in commontools just though a privateKey to apos Sig(pCs *CredentialSign) error Esig(pEphemeralSign *EphemeralSign) error SigHash(hash types.Hash) []byte SeedSig(psd *SeedData) error ESigVerify(hash types.Hash, sig []byte) error ESender(hash types.Hash, sig []byte) (types.Address, error) GetLastQrSignature() []byte GetQrSignature(round uint64) []byte GetNowBlockNum() uint64 GetNextRound() int GetNowBlockHash() types.Hash SetPriKey(priKey *ecdsa.PrivateKey) SetCoinBase(coinbase types.Address) GetCoinBase() types.Address CreateTmpPriKey(step int) DelTmpKey(step int) ClearTmpKeys() GetProducerNewBlock(data *block.ConsensusData, timeLimit int64) *block.Block //get a new block from block producer MakeEmptyBlock(data *block.ConsensusData) *block.Block InsertChain(chain block.Blocks) (int, error) GetCurrentBlock() *block.Block GetBlockByNum(num uint64) *block.Block VerifyNextRoundBlock(block *block.Block) bool //version 1.1 GetBlockByHash(hash types.Hash) *block.Block SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription WriteBlockCertificate(blk *block.Block, certificate BlockCertificate) error GetBlockCertificate(blockHash types.Hash) BlockCertificate GetWeight(r uint64, addr types.Address) (int64, int64) }
some out tools offered by Bchain,such as signer and blockInfo getter
type CredentialSigForHash ¶
type CredentialSigForHash struct { Round uint64 // round Step uint64 // step Quantity []byte // quantity(seed, Qr-1) }
func (*CredentialSigForHash) DecodeMsg ¶
func (z *CredentialSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*CredentialSigForHash) EncodeMsg ¶
func (z *CredentialSigForHash) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*CredentialSigForHash) MarshalMsg ¶
func (z *CredentialSigForHash) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*CredentialSigForHash) Msgsize ¶
func (z *CredentialSigForHash) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CredentialSigForHash) UnmarshalMsg ¶
func (z *CredentialSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type CredentialSign ¶
type CredentialSign struct { Signature Round uint64 // round Step uint64 // step ParentHash types.Hash Time *types.BigInt // contains filtered or unexported fields }
long-term key singer
func (*CredentialSign) Cmp ¶
func (a *CredentialSign) Cmp(b *CredentialSign) int
func (*CredentialSign) CsHash ¶
func (cs *CredentialSign) CsHash() types.Hash
func (*CredentialSign) DecodeMsg ¶
func (z *CredentialSign) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*CredentialSign) EncodeMsg ¶
func (z *CredentialSign) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*CredentialSign) MarshalMsg ¶
func (z *CredentialSign) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*CredentialSign) Msgsize ¶
func (z *CredentialSign) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CredentialSign) UnmarshalMsg ¶
func (z *CredentialSign) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type CsEvent ¶
type CsEvent struct{ Cs *CredentialSign }
func (*CsEvent) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type EngineApos ¶
type EngineApos struct {
// contains filtered or unexported fields
}
func NewAposEngine ¶
func NewAposEngine(prv *ecdsa.PrivateKey) *EngineApos
func (*EngineApos) Author ¶
func (this *EngineApos) Author(chain consensus.ChainReader, header *block.Header) (types.Address, error)
func (*EngineApos) Finalize ¶
func (this *EngineApos) Finalize(chain consensus.ChainReader, header *block.Header, state *state.StateDB, txs []*transaction.Transaction, receipts []*transaction.Receipt, sign bool) (*block.Block, error)
todo this need interpreter process interpreter need change state
func (*EngineApos) Incentive ¶
func (this *EngineApos) Incentive(producer types.Address, state *state.StateDB, header *block.Header) (*transaction.Transaction, error)
func (*EngineApos) Prepare ¶
func (this *EngineApos) Prepare(chain consensus.ChainReader, header *block.Header) error
func (*EngineApos) Seal ¶
func (this *EngineApos) Seal(chain consensus.ChainReader, block *block.Block, stop <-chan struct{}) (*block.Block, error)
func (*EngineApos) SetKey ¶
func (this *EngineApos) SetKey(prv *ecdsa.PrivateKey)
func (*EngineApos) VerifyHeader ¶
func (this *EngineApos) VerifyHeader(chain consensus.ChainReader, header *block.Header, seal bool) error
func (*EngineApos) VerifyHeaders ¶
func (this *EngineApos) VerifyHeaders(chain consensus.ChainReader, headers []*block.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders 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.
func (*EngineApos) VerifySeal ¶
func (this *EngineApos) VerifySeal(chain consensus.ChainReader, header *block.Header) error
verify block certificate
type EphemeralSigForHash ¶
type EphemeralSigForHash struct { Round uint64 // round Step uint64 // step Val []byte // Val = Hash(B), or Val = 0, or Val = 1 }
func (*EphemeralSigForHash) DecodeMsg ¶
func (z *EphemeralSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*EphemeralSigForHash) EncodeMsg ¶
func (z *EphemeralSigForHash) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*EphemeralSigForHash) MarshalMsg ¶
func (z *EphemeralSigForHash) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*EphemeralSigForHash) Msgsize ¶
func (z *EphemeralSigForHash) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*EphemeralSigForHash) UnmarshalMsg ¶
func (z *EphemeralSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type EphemeralSign ¶
type EphemeralSign struct { Signature // contains filtered or unexported fields }
TODO: In current, EphemeralSig is the same as the Credential, need to be modified in the next version ephemeral key singer
func (*EphemeralSign) DecodeMsg ¶
func (z *EphemeralSign) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*EphemeralSign) EncodeMsg ¶
func (z *EphemeralSign) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*EphemeralSign) GetStep ¶
func (esig *EphemeralSign) GetStep() uint64
func (*EphemeralSign) MarshalMsg ¶
func (z *EphemeralSign) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*EphemeralSign) Msgsize ¶
func (z *EphemeralSign) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*EphemeralSign) UnmarshalMsg ¶
func (z *EphemeralSign) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type PriKeyHandler ¶
type PriKeyHandler interface {
GetBasePriKey(kind reflect.Type) *ecdsa.PrivateKey
}
type QuantityEmpty ¶
empty block Qr = H(Qr−1, r)
func (*QuantityEmpty) DecodeMsg ¶
func (z *QuantityEmpty) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*QuantityEmpty) EncodeMsg ¶
func (z *QuantityEmpty) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*QuantityEmpty) Hash ¶
func (this *QuantityEmpty) Hash() types.Hash
func (*QuantityEmpty) MarshalMsg ¶
func (z *QuantityEmpty) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*QuantityEmpty) Msgsize ¶
func (z *QuantityEmpty) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*QuantityEmpty) UnmarshalMsg ¶
func (z *QuantityEmpty) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type SeedData ¶
Qr = H(SIGℓr (Qr−1), r),
func (*SeedData) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SeedDataSigForHash ¶
ReadMe: what the relationship between SeedDataSigForHash and SeedData? if I say hash-SeedData is Qr-1 and hash-SeedDataSigForHash is Qr , it's not wrong. although hash-SeedDataSigForHash just a hash not equal Qr and Qr-1,but it's used for producing Qr. like this below: h := hash-SeedDataSigForHash SeedData.sign(h , privateKey),the sign will fill the R,S,V in SeedData and the consensusData.para = SeedData.toBytes(),the function toBytes() equal SeedData.Signature.toBytes(),it's meaning that the bytes equal R,S,V. But the consensusData not equal the Qr-1/r ,it's just a part of Qr-1/r
but now,how to get hash-SeedDataSigForHash? The defination of SeedDataSigForHash like below:
type SeedDataSigForHash struct { Round uint64 // round Seed []byte // quantity(seed, Qr-1) }
here we know Round,but,what is Seed? 1.Seed-Round(Qr) is depend on Qr-1 2.Qr = H(Qr-1 , r)
so we know Seed is Qr-1(hash -> bytes) sigBytes(r-1) = block(r-1).consensusData.Para Signature(r-1) = Signature.get(sigBytes(r-1)) SeedData(Signature(r-1) , r-1).Hash()-->Qr-1
so ,here we know how to get Qr-1,now ,how to get Qr? First,it's a bad question,the result we get is not Qr,just a part of Qr--we called Signature's bytes. SeedDataSigForHash{Round:r , Seed:bytes(Qr-1)}-->hash,this hash just for sign,because we want get signature's bytes
h := hash-SeedDataSigForHash{Round:r , Seed:bytes(Qr-1)} SeedData{Signature:init() , r}.sign(h , privateKey),the r is useless in sign,but we fill Signature in this fucntion. so A PART OF Qr = SeedData{Signature:signed and filled , r}.toBytes().
Another tips: Seed is continuous , but Credential is not like: Seed0->Seed1->Seed2->Seed3->Seed4 C1(Seed0)->C2(Seed0)->C3(Seed0)->C4(Seed1)->C5(Seed1)->C6(Seed1)......
func (*SeedDataSigForHash) DecodeMsg ¶
func (z *SeedDataSigForHash) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*SeedDataSigForHash) EncodeMsg ¶
func (z *SeedDataSigForHash) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*SeedDataSigForHash) MarshalMsg ¶
func (z *SeedDataSigForHash) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*SeedDataSigForHash) Msgsize ¶
func (z *SeedDataSigForHash) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*SeedDataSigForHash) UnmarshalMsg ¶
func (z *SeedDataSigForHash) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Signature ¶
signature R, S, V
func MakeEmptySignature ¶
func MakeEmptySignature() *Signature
func (*Signature) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SortitionPriority ¶
type SortitionPriority interface {
// contains filtered or unexported methods
}