app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Overview

Package app provides the top app-level abstraction and entrypoint for a charon DVC instance. The sub-packages also provide app-level functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, conf Config) (err error)

Run is the entrypoint for running a charon DVC instance. All processes and their dependencies are wired and added to the life cycle manager which handles starting and graceful shutdown.

Types

type Config

type Config struct {
	P2P              p2p.Config
	Log              log.Config
	ManifestFile     string
	DataDir          string
	MonitoringAddr   string
	ValidatorAPIAddr string
	BeaconNodeAddr   string
	JaegerAddr       string
	JaegerService    string
	SimnetBMock      bool
	SimnetVMock      bool

	TestConfig TestConfig
}

type Manifest added in v0.2.0

type Manifest struct {
	// DVs is the set of distributed validators managed by the cluster.
	// Each DV is defined by its threshold signature scheme.
	DVs []tbls.TSS

	// Peers is set of charon nodes in the cluster.
	Peers []p2p.Peer
}

Manifest defines a charon cluster. The same manifest is loaded by all charon nodes in the cluster. TODO(corver): Add authentication signatures for each peer per DV.

func NewClusterForT added in v0.2.0

func NewClusterForT(t *testing.T, dv, k, n, seed int) (Manifest, []*ecdsa.PrivateKey, [][]*bls_sig.SecretKeyShare)

NewClusterForT returns a new cluster manifest with dv number of distributed validators, k threshold and n peers. It also returns the peer p2p keys and BLS secret shares. If the seed is zero a random cluster on available loopback ports is generated, else a deterministic cluster is generated. Note this is not defined in testutil since it is tightly coupled with the app package.

func (Manifest) ENRs added in v0.2.0

func (m Manifest) ENRs() []enr.Record

ENRs is a convenience function that returns the peer ENRs.

func (Manifest) MarshalJSON added in v0.2.0

func (m Manifest) MarshalJSON() ([]byte, error)

func (Manifest) NodeIdx added in v0.2.0

func (m Manifest) NodeIdx(pID peer.ID) (NodeIdx, error)

NodeIdx returns the node index for the peer.

func (Manifest) PeerIDs added in v0.2.0

func (m Manifest) PeerIDs() []peer.ID

PeerIDs is a convenience function that returns the peer IDs.

func (Manifest) PublicKeys added in v0.2.0

func (m Manifest) PublicKeys() []*bls_sig.PublicKey

PublicKeys is a convenience function that returns the DV root public keys.

func (*Manifest) UnmarshalJSON added in v0.2.0

func (m *Manifest) UnmarshalJSON(data []byte) error

type NodeIdx added in v0.2.0

type NodeIdx struct {
	// PeerIdx is the index of a peer in the peer list (it 0-indexed).
	PeerIdx int
	// ShareIdx is the tbls share identifier (it is 1-indexed).
	ShareIdx int
}

NodeIdx represents the index of a node/peer/share in the cluster as defined in the manifest.

type TestConfig

type TestConfig struct {
	// Manifest provides the manifest explicitly, skips loading ManifestFile from disk.
	Manifest *Manifest
	// P2PKey provides the p2p privkey explicitly, skips loading from keystore on disk.
	P2PKey *ecdsa.PrivateKey
	// DisablePing disables the ping service.
	DisablePing bool
	// PingCallback is called when a ping was completed to a peer.
	PingCallback func(peer.ID)
	// ParSigExFunc provides an in-memory partial signature exchange.
	ParSigExFunc func() core.ParSigEx
	// LcastTransportFunc provides an in-memory leader cast transport.
	LcastTransportFunc func() leadercast.Transport
	// SimnetKeys provides private key shares for the simnet validatormock signer.
	SimnetKeys []*bls_sig.SecretKey
	// SimnetBMockOpts defines additional simnet beacon mock options.
	SimnetBMockOpts []beaconmock.Option
	// BroadcastCallback is called when a duty is completed and sent to the broadcast component.
	BroadcastCallback func(context.Context, core.Duty, core.PubKey, core.AggSignedData) error
}

TestConfig defines additional test-only config.

Directories

Path Synopsis
Package errors provides errors with structured fields and stack traces.
Package errors provides errors with structured fields and stack traces.
Package lifecycle provides a life cycle manager abstracting the starting and stopping of processes by registered start or stop hooks.
Package lifecycle provides a life cycle manager abstracting the starting and stopping of processes by registered start or stop hooks.
Package log provides global logging functions to be used throughout the charon app.
Package log provides global logging functions to be used throughout the charon app.
Package tracer provides a global OpenTelemetry tracer.
Package tracer provides a global OpenTelemetry tracer.
z
Package z provides an API for structured logging fields by wrapping zap.Field.
Package z provides an API for structured logging fields by wrapping zap.Field.

Jump to

Keyboard shortcuts

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