committee

package
v0.0.0-...-4cc056f Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment struct {
	Data  []byte // Data should be persisted for future initialization
	Proof []byte // Proof denotes the proof the data was honestly computed
	From  int32  // From who this commitment was sent
}

Commitment represents a commitment to randomness of a node

type Config

type Config struct {
	// Nodes denotes all nodes the committee can be selected from
	Nodes Nodes
	// How many consensus rounds at minimum the committee remains
	MinimumLifespan int32
	// FailedTotalNodesPercentage is the assumed upper bound
	// on the percentage of nodes that can fail out of all nodes
	// in the network.
	FailedTotalNodesPercentage int64
	// InverseFailureChance is 1/p where p is the probability
	// to select more than a third
	// of failed nodes to the committee.
	// The higher this number is, the larger the committee.
	// The lower this number is, the bigger chance to select
	// a committee with too many failed nodes.
	InverseFailureChance int64
	// ExcludedNodes are nodes the current committee decided
	// not to be included in this committee
	ExcludedNodes []int32
	// MandatoryNodes are nodes that current committee decided
	// that must be in this committee
	MandatoryNodes []int32
	// Weights denote relative multipliers for each node's chance
	// to be selected into a committee.
	Weights []Weight
}

Config is the configuration of a committee

func (Config) EffectiveWeights

func (config Config) EffectiveWeights() []Weight

func (*Config) Marshal

func (config *Config) Marshal() []byte

func (*Config) Unmarshal

func (config *Config) Unmarshal(bytes []byte) error

type Feedback

type Feedback struct {
	Commitment    *Commitment  // Commitment to broadcast, if applicable
	ReconShares   []ReconShare // ReconShares to broadcast, if applicable
	NextCommittee []int32      // The next committee, if applicable. It may be equal to the current committee
}

Feedback denotes the action the committee selection library wants us to perform, namely to send a Commitment or ReconShares or to notify that a new committee has been selected

type Input

type Input struct {
	// Commitments denotes commitments arriving from nodes
	Commitments []Commitment
	// ReconShares denote the ReconShares received from all nodes if applicable
	ReconShares []ReconShare
	// NextConfig is the configuration of the next committee selection if applicable
	NextConfig Config
}

Input is what the committee selection library consumes each round

type Logger

type Logger interface {
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Errorf(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Panicf(template string, args ...interface{})
}

Logger defines the contract for logging.

type Node

type Node struct {
	ID     int32
	PubKey []byte
}

Node denotes a node in our protocol, which is identified by an identifier and a public key

type Nodes

type Nodes []Node

Nodes is an aggregation of multiple nodes

func (Nodes) IDs

func (nodes Nodes) IDs() []int32

IDs returns the identifiers of all nodes

func (Nodes) PubKeys

func (nodes Nodes) PubKeys() [][]byte

PubKeys returns the public keys of the Nodes in the same order they appear

func (Nodes) String

func (nodes Nodes) String() string

type PrivateKey

type PrivateKey []byte

type PublicKey

type PublicKey []byte

type ReconShare

type ReconShare struct {
	Data  []byte // Data should be persisted for future initialization
	Proof []byte // Proof denotes the proof the data was honestly computed
	About int32  // About denotes whose randomness are we reconstructing
	From  int32  // Who sent this ReconShare
}

ReconShare represents a share for reconstructing the randomness of a node

type Selection

type Selection interface {
	// GeneratePrivateKey generates a private key for an instance using the given randomness
	GenerateKeyPair(rand io.Reader) (PublicKey, PrivateKey, error)
	// Initialize initializes the committee selection instance with the given identifier and private key,
	// as well as with all the other nodes.
	Initialize(ID int32, PrivateKey PrivateKey, nodes Nodes) error
	// Process interacts with the committee selection and feeds it with events of other remote instances from Input,
	// and receives feedback on a committee change or requests of messages to be sent via Feedback.
	// The operation operates on the given state and the new state is returned.
	Process(State, Input) (Feedback, State, error)
	// VerifyCommitment should be called whenever the node receives a commitment
	// and before passing it to the library or persisting it
	VerifyCommitment(Commitment) error
	// VerifyReconShare should be called whenever the node receives a ReconShare
	// and before passing it to the library or persisting it
	VerifyReconShare(ReconShare) error
}

Selection is an interface that describes the API of the committee selection library

type State

type State interface {
	Initialize([]byte) error
	ToBytes() []byte
}

State denotes the data structures that we should persist and input to the committee selection at each round.

type Weight

type Weight struct {
	ID, Weight int32
}

Weight is a mapping between a node's identifier and a relative multiplier.

Jump to

Keyboard shortcuts

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