Documentation ¶
Index ¶
- Constants
- func DeriveNewSeed(address common.Address, vrfSK *vrf.PrivateKey, rnd uint64, period uint64, ...) (newSeed common.Seed, seedProof vrf.Proof, err error)
- func Hash(data []byte) common.Hash
- func HashHeader(h *types.Header) common.Hash
- func HashObj(h Hashable) common.Hash
- func VerifyNewSeed(p *UnauthenticatedProposal, ledger consensus.ChainReader) error
- type Algorand
- type AsyncPseudoNode
- type AsyncVoteVerifier
- type BlockFactory
- type BlockValidator
- type Hashable
- type Proposal
- type ProposalValue
- type ProposerSeed
- type PseudoNodeBaseTask
- type PseudoNodeProposalsTask
- type PseudoNodeTask
- type PseudoNodeVerifier
- type Round
- type SeedInput
- type SignTxFn
- type SignerFn
- type UnauthenticatedProposal
- func (p *UnauthenticatedProposal) Seed() common.Seed
- func (p *UnauthenticatedProposal) ToBeHashed() (protocol.HashID, []byte, error)
- func (p UnauthenticatedProposal) Validate(ctx context.Context, current uint64, ledger consensus.ChainReader, ...) (*Proposal, error)
- func (p *UnauthenticatedProposal) Value() *ProposalValue
Constants ¶
const AssemblyTime time.Duration = 250 * time.Millisecond
AssemblyTime is the max amount of time to spend on generating a proposal block.
Variables ¶
This section is empty.
Functions ¶
func DeriveNewSeed ¶
func VerifyNewSeed ¶
func VerifyNewSeed(p *UnauthenticatedProposal, ledger consensus.ChainReader) error
Types ¶
type AsyncPseudoNode ¶
type AsyncPseudoNode struct {
// contains filtered or unexported fields
}
func (*AsyncPseudoNode) MakeProposals ¶
type AsyncVoteVerifier ¶
type AsyncVoteVerifier struct {
// contains filtered or unexported fields
}
AsyncVoteVerifier uses workers to verify agreement protocol votes and writes the results on an output channel specified by the user.
type BlockFactory ¶
type BlockFactory interface { // AssembleBlock produces a new ValidatedBlock which is suitable for proposal // at a given Round. The time argument specifies a target deadline by // which the block should be produced. Specifically, the deadline can // cause the factory to add fewer transactions to the block in question // than might otherwise be possible. // // AssembleBlock should produce a ValidatedBlock for which the corresponding // BlockValidator validates (i.e. for which BlockValidator.Validate // returns true). If an insufficient number of nodes can assemble valid // entries, the agreement protocol may lose liveness. // // AssembleBlock may return an error if the BlockFactory is unable to // produce a ValidatedBlock for the given round. If an insufficient number of // nodes on the network can assemble entries, the agreement protocol may // lose liveness. AssembleBlock(uint64, time.Time) (*types.Block, error) }
type BlockValidator ¶
type BlockValidator interface { // Validate must return an error if a given Block cannot be determined // to be valid as applied to the agreement state; otherwise, it returns // nil. // // The correctness of Validate is essential to the correctness of the // protocol. If Validate accepts an invalid Block (i.e., a false // positive), the agreement protocol may fork, or the system state may // even become undefined. If Validate rejects a valid Block (i.e., a // false negative), the agreement protocol may even lose // liveness. Validate should therefore be conservative in which Entries // it accepts. // // TODO There should probably be a second Round argument here. Validate(context.Context, *types.Block) (*types.Block, error) }
type Hashable ¶
Hashable is an interface implemented by an object that can be represented with a sequence of bytes to be hashed or signed, together with a type ID to distinguish different types of objects.
type Proposal ¶
type Proposal struct { UnauthenticatedProposal // contains filtered or unexported fields }
A proposal is an Block along with everything needed to validate it.
func MakeProposal ¶
func (*Proposal) U ¶
func (p *Proposal) U() *UnauthenticatedProposal
type ProposalValue ¶
type ProposalValue struct { OriginalPeriod uint64 OriginalProposer []byte BlockDigest common.Hash EncodingDigest common.Hash }
ProposalValue is a triplet of a block hashes (the contents themselves and the encoding of the block), its proposer, and the period in which it was proposed.
type ProposerSeed ¶
A proposerSeed is a Hashable input to proposer seed derivation.
func (*ProposerSeed) ToBeHashed ¶
func (s *ProposerSeed) ToBeHashed() (protocol.HashID, []byte, error)
ToBeHashed implements the Hashable interface.
type PseudoNodeBaseTask ¶
type PseudoNodeBaseTask struct {
// contains filtered or unexported fields
}
type PseudoNodeProposalsTask ¶
type PseudoNodeProposalsTask struct { PseudoNodeBaseTask // contains filtered or unexported fields }
type PseudoNodeTask ¶
type PseudoNodeTask interface {
// contains filtered or unexported methods
}
PseudoNodeTask encapsulates a single task which should be executed by the pseudonode.
type PseudoNodeVerifier ¶
type PseudoNodeVerifier struct {
// contains filtered or unexported fields
}
type SignTxFn ¶
type SignTxFn func(accounts.Account, *types.Transaction, *big.Int) (*types.Transaction, error)
SignTxFn is a signTx
type SignerFn ¶
SignerFn is a signer callback function to request a hash to be signed by a backing account.
type UnauthenticatedProposal ¶
type UnauthenticatedProposal struct { *types.Block SeedProof []byte OriginalPeriod uint64 OriginalProposer []byte }
UnauthenticatedProposal is an Block along with everything needed to validate it.
func (*UnauthenticatedProposal) Seed ¶
func (p *UnauthenticatedProposal) Seed() common.Seed
value returns the proposal-value associated with this proposal.
func (*UnauthenticatedProposal) ToBeHashed ¶
func (p *UnauthenticatedProposal) ToBeHashed() (protocol.HashID, []byte, error)
ToBeHashed implements the Hashable interface.
func (UnauthenticatedProposal) Validate ¶
func (p UnauthenticatedProposal) Validate(ctx context.Context, current uint64, ledger consensus.ChainReader, validator BlockValidator) (*Proposal, error)
Validate returns true if the proposal is valid. It checks the proposal seed and then calls validator.Validate.
func (*UnauthenticatedProposal) Value ¶
func (p *UnauthenticatedProposal) Value() *ProposalValue
value returns the proposal-value associated with this proposal.