Documentation
¶
Index ¶
- func CredentialMaxSize() (s int)
- func HashableCredentialMaxSize() (s int)
- func SeedMaxSize() (s int)
- func UnauthenticatedCredentialMaxSize() (s int)
- type BalanceRecord
- type Credential
- func (_ *Credential) CanMarshalMsg(z interface{}) bool
- func (_ *Credential) CanUnmarshalMsg(z interface{}) bool
- func (cred Credential) Equals(otherCred Credential) bool
- func (cred Credential) Less(otherCred Credential) bool
- func (cred Credential) LowestOutputDigest() crypto.Digest
- func (z *Credential) MarshalMsg(b []byte) (o []byte)
- func (z *Credential) MsgIsZero() bool
- func (z *Credential) Msgsize() (s int)
- func (cred Credential) Selected() bool
- func (z *Credential) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *Credential) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type Membership
- type Seed
- func (_ *Seed) CanMarshalMsg(z interface{}) bool
- func (_ *Seed) CanUnmarshalMsg(z interface{}) bool
- func (z *Seed) MarshalMsg(b []byte) (o []byte)
- func (z *Seed) MsgIsZero() bool
- func (z *Seed) Msgsize() (s int)
- func (s Seed) ToBeHashed() (protocol.HashID, []byte)
- func (z *Seed) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *Seed) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type Selector
- type UnauthenticatedCredential
- func (_ *UnauthenticatedCredential) CanMarshalMsg(z interface{}) bool
- func (_ *UnauthenticatedCredential) CanUnmarshalMsg(z interface{}) bool
- func (z *UnauthenticatedCredential) MarshalMsg(b []byte) (o []byte)
- func (z *UnauthenticatedCredential) MsgIsZero() bool
- func (z *UnauthenticatedCredential) Msgsize() (s int)
- func (z *UnauthenticatedCredential) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *UnauthenticatedCredential) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- func (cred UnauthenticatedCredential) Verify(proto config.ConsensusParams, m Membership) (res Credential, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CredentialMaxSize ¶
func CredentialMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func HashableCredentialMaxSize ¶
func HashableCredentialMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func SeedMaxSize ¶
func SeedMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func UnauthenticatedCredentialMaxSize ¶
func UnauthenticatedCredentialMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
Types ¶
type BalanceRecord ¶
type BalanceRecord struct { basics.OnlineAccountData Addr basics.Address }
BalanceRecord pairs an account's address with its associated data.
This struct is used to decouple LedgerReader.AccountData from basics.BalanceRecord.
type Credential ¶
type Credential struct { Weight uint64 `codec:"wt"` VrfOut crypto.Digest `codec:"h"` DomainSeparationEnabled bool `codec:"ds"` Hashable hashableCredential `codec:"hc"` UnauthenticatedCredential // contains filtered or unexported fields }
A Credential represents a proof of committee membership.
The multiplicity of this membership is specified in the Credential's weight. The VRF output hash (with the owner's address hashed in) is also cached.
Upgrades: whether or not domain separation is enabled is cached. If this flag is set, this flag also includes original hashable credential.
func (*Credential) CanMarshalMsg ¶
func (_ *Credential) CanMarshalMsg(z interface{}) bool
func (*Credential) CanUnmarshalMsg ¶
func (_ *Credential) CanUnmarshalMsg(z interface{}) bool
func (Credential) Equals ¶
func (cred Credential) Equals(otherCred Credential) bool
Equals compares the hash of two Credentials to determine equality and returns true if they're equal.
func (Credential) Less ¶
func (cred Credential) Less(otherCred Credential) bool
Less returns true if this Credential is less than the other credential; false otherwise (i.e., >=). Used for breaking ties when there are multiple proposals.
Precondition: both credentials have nonzero weight
func (Credential) LowestOutputDigest ¶
func (cred Credential) LowestOutputDigest() crypto.Digest
LowestOutputDigest gives the lowestOutput as a crypto.Digest, which allows pretty-printing a proposal's lowest output. This function is only used for debugging.
func (*Credential) MarshalMsg ¶
func (z *Credential) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*Credential) MsgIsZero ¶
func (z *Credential) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*Credential) Msgsize ¶
func (z *Credential) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Credential) Selected ¶
func (cred Credential) Selected() bool
Selected returns whether this Credential was selected (i.e., if its weight is greater than zero).
func (*Credential) UnmarshalMsg ¶
func (z *Credential) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*Credential) UnmarshalMsgWithState ¶
func (z *Credential) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Membership ¶
type Membership struct { Record BalanceRecord Selector Selector TotalMoney basics.MicroAlgos }
Membership encodes the parameters used to verify membership in a committee.
type Seed ¶
type Seed [32]byte
A Seed contains cryptographic entropy which can be used to determine a committee.
func (*Seed) CanMarshalMsg ¶
func (*Seed) CanUnmarshalMsg ¶
func (*Seed) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Seed) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Seed) ToBeHashed ¶
ToBeHashed implements the crypto.Hashable interface
func (*Seed) UnmarshalMsgWithState ¶
UnmarshalMsg implements msgp.Unmarshaler
type Selector ¶
type Selector interface { // The hash of a struct which implements Selector is used as the input // to the VRF. crypto.Hashable // CommitteeSize returns the size of the committee determined by this // Selector. CommitteeSize(config.ConsensusParams) uint64 }
A Selector deterministically defines a cryptographic sortition committee. It contains both the input to the sortition VRF and the size of the sortition committee.
type UnauthenticatedCredential ¶
type UnauthenticatedCredential struct { Proof crypto.VrfProof `codec:"pf"` // contains filtered or unexported fields }
An UnauthenticatedCredential is a Credential which has not yet been authenticated.
func MakeCredential ¶
func MakeCredential(secrets *crypto.VrfPrivkey, sel Selector) UnauthenticatedCredential
MakeCredential creates a new unauthenticated Credential given some selector.
func (*UnauthenticatedCredential) CanMarshalMsg ¶
func (_ *UnauthenticatedCredential) CanMarshalMsg(z interface{}) bool
func (*UnauthenticatedCredential) CanUnmarshalMsg ¶
func (_ *UnauthenticatedCredential) CanUnmarshalMsg(z interface{}) bool
func (*UnauthenticatedCredential) MarshalMsg ¶
func (z *UnauthenticatedCredential) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*UnauthenticatedCredential) MsgIsZero ¶
func (z *UnauthenticatedCredential) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*UnauthenticatedCredential) Msgsize ¶
func (z *UnauthenticatedCredential) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*UnauthenticatedCredential) UnmarshalMsg ¶
func (z *UnauthenticatedCredential) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*UnauthenticatedCredential) UnmarshalMsgWithState ¶
func (z *UnauthenticatedCredential) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (UnauthenticatedCredential) Verify ¶
func (cred UnauthenticatedCredential) Verify(proto config.ConsensusParams, m Membership) (res Credential, err error)
Verify an unauthenticated Credential that was received from the network.
Verify checks if the given credential is a valid proof of membership conditioned on the provided committee membership parameters.
If it is, the returned Credential constitutes a proof of this fact. Otherwise, an error is returned.