Documentation ¶
Index ¶
- type Builder
- type Cert
- type CompactOneTimeSignature
- func (_ *CompactOneTimeSignature) CanMarshalMsg(z interface{}) bool
- func (_ *CompactOneTimeSignature) CanUnmarshalMsg(z interface{}) bool
- func (z *CompactOneTimeSignature) MarshalMsg(b []byte) (o []byte)
- func (z *CompactOneTimeSignature) MsgIsZero() bool
- func (z *CompactOneTimeSignature) Msgsize() (s int)
- func (z *CompactOneTimeSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Params
- type Participant
- func (_ *Participant) CanMarshalMsg(z interface{}) bool
- func (_ *Participant) CanUnmarshalMsg(z interface{}) bool
- func (z *Participant) MarshalMsg(b []byte) (o []byte)
- func (z *Participant) MsgIsZero() bool
- func (z *Participant) Msgsize() (s int)
- func (p Participant) ToBeHashed() (protocol.HashID, []byte)
- func (z *Participant) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Reveal
- type SortUint64
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { Params // contains filtered or unexported fields }
Builder keeps track of signatures on a message and eventually produces a compact certificate for that message.
func MkBuilder ¶
func MkBuilder(param Params, part []Participant, parttree *merklearray.Tree) (*Builder, error)
MkBuilder constructs an empty builder (with no signatures). The message to be signed, as well as other security parameters, are specified in param. The participants that will sign the message are in part and parttree.
func (*Builder) Add ¶
Add a signature to the set of signatures available for building a certificate. verifySig should be set to true in production; setting it to false is useful for benchmarking to avoid the cost of signature checks.
func (*Builder) Build ¶
Build returns a compact certificate, if the builder has accumulated enough signatures to construct it.
func (*Builder) Present ¶
Present checks if the builder already contains a signature at a particular offset.
func (*Builder) SignedWeight ¶
SignedWeight returns the total weight of signatures added so far.
type Cert ¶
type Cert struct { SigCommit crypto.Digest `codec:"c"` SignedWeight uint64 `codec:"w"` SigProofs []crypto.Digest `codec:"S,allocbound=maxProofDigests"` PartProofs []crypto.Digest `codec:"P,allocbound=maxProofDigests"` // Reveals is a sparse map from the position being revealed // to the corresponding elements from the sigs and participants // arrays. Reveals map[uint64]Reveal `codec:"r,allocbound=maxReveals"` // contains filtered or unexported fields }
Cert represents a compact certificate.
func (*Cert) CanMarshalMsg ¶
func (*Cert) CanUnmarshalMsg ¶
func (*Cert) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type CompactOneTimeSignature ¶
type CompactOneTimeSignature struct { crypto.OneTimeSignature // contains filtered or unexported fields }
CompactOneTimeSignature is crypto.OneTimeSignature with omitempty
func (*CompactOneTimeSignature) CanMarshalMsg ¶
func (_ *CompactOneTimeSignature) CanMarshalMsg(z interface{}) bool
func (*CompactOneTimeSignature) CanUnmarshalMsg ¶
func (_ *CompactOneTimeSignature) CanUnmarshalMsg(z interface{}) bool
func (*CompactOneTimeSignature) MarshalMsg ¶
func (z *CompactOneTimeSignature) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*CompactOneTimeSignature) MsgIsZero ¶
func (z *CompactOneTimeSignature) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*CompactOneTimeSignature) Msgsize ¶
func (z *CompactOneTimeSignature) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CompactOneTimeSignature) UnmarshalMsg ¶
func (z *CompactOneTimeSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Params ¶
type Params struct { Msg crypto.Hashable // Message to be cerified ProvenWeight uint64 // Weight threshold proven by the certificate SigRound basics.Round // Ephemeral signature round to expect SecKQ uint64 // Security parameter (k+q) from analysis document }
Params defines common parameters for the verifier and builder.
type Participant ¶
type Participant struct { // PK is AccountData.VoteID. PK crypto.OneTimeSignatureVerifier `codec:"p"` // Weight is AccountData.MicroAlgos. Weight uint64 `codec:"w"` // KeyDilution is AccountData.KeyDilution() with the protocol for sigRound // as expected by the Builder. KeyDilution uint64 `codec:"d"` // contains filtered or unexported fields }
A Participant corresponds to an account whose AccountData.Status is Online, and for which the expected sigRound satisfies AccountData.VoteFirstValid <= sigRound <= AccountData.VoteLastValid.
In the Algorand ledger, it is possible for multiple accounts to have the same PK. Thus, the PK is not necessarily unique among Participants. However, each account will produce a unique Participant struct, to avoid potential DoS attacks where one account claims to have the same VoteID PK as another account.
func (*Participant) CanMarshalMsg ¶
func (_ *Participant) CanMarshalMsg(z interface{}) bool
func (*Participant) CanUnmarshalMsg ¶
func (_ *Participant) CanUnmarshalMsg(z interface{}) bool
func (*Participant) MarshalMsg ¶
func (z *Participant) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*Participant) MsgIsZero ¶
func (z *Participant) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*Participant) Msgsize ¶
func (z *Participant) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Participant) ToBeHashed ¶
func (p Participant) ToBeHashed() (protocol.HashID, []byte)
ToBeHashed implements the crypto.Hashable interface.
func (*Participant) UnmarshalMsg ¶
func (z *Participant) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Reveal ¶
type Reveal struct { SigSlot sigslotCommit `codec:"s"` Part Participant `codec:"p"` // contains filtered or unexported fields }
Reveal is a single array position revealed as part of a compact certificate. It reveals an element of the signature array and the corresponding element of the participants array.
func (*Reveal) CanMarshalMsg ¶
func (*Reveal) CanUnmarshalMsg ¶
func (*Reveal) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SortUint64 ¶
type SortUint64 = basics.SortUint64
SortUint64 implements sorting by uint64 keys for canonical encoding of maps in msgpack format.
type Verifier ¶
type Verifier struct { Params // contains filtered or unexported fields }
Verifier is used to verify a compact certificate.
func MkVerifier ¶
MkVerifier constructs a verifier to check the compact certificate on the message specified in p, with partcom specifying the Merkle root of the participants that must sign the message.