committee

package
v0.0.0-...-76c1feb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceRecord

type BalanceRecord struct {
	basics.AccountData
	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)

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) CanMarshalMsg(z interface{}) bool

func (*Seed) CanUnmarshalMsg

func (_ *Seed) CanUnmarshalMsg(z interface{}) bool

func (*Seed) MarshalMsg

func (z *Seed) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Seed) MsgIsZero

func (z *Seed) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Seed) Msgsize

func (z *Seed) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Seed) ToBeHashed

func (s Seed) ToBeHashed() (protocol.HashID, []byte)

ToBeHashed implements the crypto.Hashable interface

func (*Seed) UnmarshalMsg

func (z *Seed) UnmarshalMsg(bts []byte) (o []byte, err error)

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)

UnmarshalMsg implements msgp.Unmarshaler

func (UnauthenticatedCredential) Verify

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL