committee

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) 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., >=).

Precondition: both credentials have nonzero weight

func (Credential) Selected

func (cred Credential) Selected() bool

Selected returns whether this Credential was selected (i.e., if its weight is greater than zero).

type Membership

type Membership struct {
	Record     basics.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) ToBeHashed

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

ToBeHashed implements the crypto.Hashable interface

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) 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