config

package
v0.0.0-...-dfb9311 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 21

Documentation

Overview

Package config reads and writes the configuration of the program.

This package handles both the parameters of the protocol, as well as all the needed keys and committee information.

Index

Constants

View Source
const (
	// MaxDataBytesPerUnit is the maximal allowed size of data included in a unit, in bytes.
	MaxDataBytesPerUnit = 2e6
	// MaxRandomSourceDataBytesPerUnit is the maximal allowed size of random source data included in a unit, in bytes.
	MaxRandomSourceDataBytesPerUnit = 1e6
	// MaxUnitsInChunk is the maximal number of units in a chunk.
	MaxUnitsInChunk = 1e6
)

Variables

This section is empty.

Functions

func AddCheck

func AddCheck(c Config, check gomel.UnitChecker)

AddCheck adds a unit checker to the given Config.

func StoreCommittee

func StoreCommittee(w io.Writer, c *Committee) error

StoreCommittee writes the given committee to the writer.

func StoreMember

func StoreMember(w io.Writer, m *Member) error

StoreMember writes the given member to the writer.

func Valid

func Valid(cnf Config) error

Valid checks if a given config is in valid state for consensus

func ValidSetup

func ValidSetup(cnf Config) error

ValidSetup checks if a given config is in valid state for setup

Types

type Committee

type Committee struct {
	// Public keys of all committee members, ordered according to process ids.
	PublicKeys []gomel.PublicKey

	// PublicKeys of all committee members use for generating keys for p2p communication. Ordered according to process ids.
	P2PPublicKeys []*p2p.PublicKey

	// Verification keys of all committee members use for RMC, ordered according to process ids.
	RMCVerificationKeys []*bn256.VerificationKey

	// SetupAddresses of all committee members
	SetupAddresses map[string][]string

	// Addresses of all committee members
	Addresses map[string][]string
}

Committee represents the public data about the committee known before the algorithm starts.

func LoadCommittee

func LoadCommittee(r io.Reader) (*Committee, error)

LoadCommittee loads the data from the given reader and creates a committee.

type Config

type Config *conf

Config represents a complete configuration needed for a process to start. Exported type is a pointer type to make sure that we always deal with only one underlying struct.

func Empty

func Empty() Config

Empty returns an empty Config populated by zero-values.

func New

func New(m *Member, c *Committee) Config

New returns a Config for regular consensus run from the given Member and Committee data.

func NewSetup

func NewSetup(m *Member, c *Committee) Config

NewSetup returns a Config for setup phase given Member and Committee data.

type Member

type Member struct {
	// The process id of this member.
	Pid uint16

	// The private key of this committee member.
	PrivateKey gomel.PrivateKey

	// The secret key of this committee member use for RMC.
	RMCSecretKey *bn256.SecretKey

	// The key for generating keys for p2p communication.
	P2PSecretKey *p2p.SecretKey
}

Member represents the private data about a committee member.

func LoadMember

func LoadMember(r io.Reader) (*Member, error)

LoadMember loads the data from the given reader and creates a member.

Jump to

Keyboard shortcuts

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