bootstrap

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: AGPL-3.0 Imports: 6 Imported by: 16

Documentation

Overview

Package bootstrap defines canonical models and encoding for bootstrapping.

Index

Constants

This section is empty.

Variables

View Source
var (
	// The Node ID file is used as a helper by the transit scripts
	FilenameNodeID = "node-id"
	PathNodeID     = filepath.Join(DirnamePublicBootstrap, FilenameNodeID) // %v will be replaced by NodeID

	// execution state
	DirnameExecutionState = "execution-state"

	// public genesis information
	DirnamePublicBootstrap    = "public-root-information"
	PathInternalNodeInfosPub  = filepath.Join(DirnamePublicBootstrap, "node-internal-infos.pub.json")
	PathFinallist             = filepath.Join(DirnamePublicBootstrap, "finallist.pub.json")
	PathNodeInfosPub          = filepath.Join(DirnamePublicBootstrap, "node-infos.pub.json")
	PathPartnerNodeInfoPrefix = filepath.Join(DirnamePublicBootstrap, "node-info.pub.")
	PathNodeInfoPub           = filepath.Join(DirnamePublicBootstrap, "node-info.pub.%v.json") // %v will be replaced by NodeID

	PathRootProtocolStateSnapshot = filepath.Join(DirnamePublicBootstrap, "root-protocol-state-snapshot.json")

	FilenameWALRootCheckpoint = "root.checkpoint"
	PathRootCheckpoint        = filepath.Join(DirnameExecutionState, FilenameWALRootCheckpoint) // only available on an execution node

	// private genesis information
	DirPrivateRoot           = "private-root-information"
	FilenameRandomBeaconPriv = "random-beacon.priv.json"
	PathPrivNodeInfoPrefix   = "node-info.priv."
	PathNodeInfoPriv         = filepath.Join(DirPrivateRoot, "private-node-info_%v", "node-info.priv.json")    // %v will be replaced by NodeID
	PathRandomBeaconPriv     = filepath.Join(DirPrivateRoot, "private-node-info_%v", FilenameRandomBeaconPriv) // %v will be replaced by NodeID
)

Canonical filenames/paths for bootstrapping files.

View Source
var ErrMissingPrivateInfo = fmt.Errorf("can not access private information for a public node type")

ErrMissingPrivateInfo is returned when a method is called on NodeInfo that is only valid on instances containing private info.

Functions

func ToIdentityList

func ToIdentityList(nodes []NodeInfo) flow.IdentityList

Types

type DKGData

type DKGData struct {
	PrivKeyShares []crypto.PrivateKey
	PubGroupKey   crypto.PublicKey
	PubKeyShares  []crypto.PublicKey
}

DKGData represents all the output data from the DKG process, including private information. It is used while running the DKG during bootstrapping.

type DKGParticipantPriv

type DKGParticipantPriv struct {
	NodeID              flow.Identifier
	RandomBeaconPrivKey encodable.RandomBeaconPrivKey
	GroupIndex          int
}

bootstrap.DKGParticipantPriv is the canonical structure for encoding private node DKG information.

type NodeConfig

type NodeConfig struct {
	Role    flow.Role
	Address string
	Stake   uint64
}

NodeConfig contains configuration information used as input to the bootstrap process.

type NodeInfo

type NodeInfo struct {
	NodeID  flow.Identifier
	Role    flow.Role
	Address string
	Stake   uint64
	// contains filtered or unexported fields
}

NodeInfo contains information for a node. This is used during the bootstrapping process to represent each node. When writing node information to disk, use `Public` or `Private` to obtain the appropriate canonical structure.

A NodeInfo instance can contain EITHER public keys OR private keys, not both. This can be ensured by using only using the provided constructors and NOT manually constructing an instance.

func FilterByRole

func FilterByRole(nodes []NodeInfo, role flow.Role) []NodeInfo

func NewPrivateNodeInfo

func NewPrivateNodeInfo(
	nodeID flow.Identifier,
	role flow.Role,
	addr string,
	stake uint64,
	networkKey crypto.PrivateKey,
	stakingKey crypto.PrivateKey,
) NodeInfo

func NewPublicNodeInfo

func NewPublicNodeInfo(
	nodeID flow.Identifier,
	role flow.Role,
	addr string,
	stake uint64,
	networkKey crypto.PublicKey,
	stakingKey crypto.PublicKey,
) NodeInfo

func NodeInfoFromIdentity added in v0.16.1

func NodeInfoFromIdentity(identity *flow.Identity) NodeInfo

NodeInfoFromIdentity converts an identity to a public NodeInfo

func Sort added in v0.17.0

func Sort(nodes []NodeInfo, order flow.IdentityOrder) []NodeInfo

Sort sorts the NodeInfo list in place using the given ordering.

func (NodeInfo) Identity

func (node NodeInfo) Identity() *flow.Identity

Identity returns the node info as a public Flow identity.

func (NodeInfo) NetworkPubKey

func (node NodeInfo) NetworkPubKey() crypto.PublicKey

func (NodeInfo) PartnerPublic

func (node NodeInfo) PartnerPublic() PartnerNodeInfoPub

PartnerPublic returns the public data for a partner node.

func (NodeInfo) Private

func (node NodeInfo) Private() (NodeInfoPriv, error)

Private returns the canonical private encodable structure.

func (NodeInfo) PrivateKeys

func (node NodeInfo) PrivateKeys() (*NodePrivateKeys, error)

func (NodeInfo) Public

func (node NodeInfo) Public() NodeInfoPub

Public returns the canonical public encodable structure

func (NodeInfo) StakingPubKey

func (node NodeInfo) StakingPubKey() crypto.PublicKey

func (NodeInfo) Type

func (node NodeInfo) Type() NodeInfoType

Type returns the type of the node info instance.

type NodeInfoPriv

type NodeInfoPriv struct {
	Role           flow.Role
	Address        string
	NodeID         flow.Identifier
	NetworkPrivKey encodable.NetworkPrivKey
	StakingPrivKey encodable.StakingPrivKey
}

Defines the canonical structure for encoding private node info.

type NodeInfoPub

type NodeInfoPub struct {
	Role          flow.Role
	Address       string
	NodeID        flow.Identifier
	Stake         uint64
	NetworkPubKey encodable.NetworkPubKey
	StakingPubKey encodable.StakingPubKey
}

Defines the canonical structure for encoding public node info.

func ToPublicNodeInfoList

func ToPublicNodeInfoList(nodes []NodeInfo) []NodeInfoPub

type NodeInfoType

type NodeInfoType int

NodeInfoType enumerates the two different options for

const (
	NodeInfoTypeInvalid NodeInfoType = iota
	NodeInfoTypePublic
	NodeInfoTypePrivate
)

type NodePrivateKeys

type NodePrivateKeys struct {
	StakingKey crypto.PrivateKey
	NetworkKey crypto.PrivateKey
}

NodePrivateKeys is a wrapper for the private keys for a node, comprising all sensitive information for a node.

type PartnerNodeInfoPub

type PartnerNodeInfoPub struct {
	Role          flow.Role
	Address       string
	NodeID        flow.Identifier
	NetworkPubKey encodable.NetworkPubKey
	StakingPubKey encodable.StakingPubKey
}

PartnerNodeInfoPub represents public information about a partner/external node. It is identical to NodeInfoPub, but without stake information, as this is determined externally to the process that generates this information.

Jump to

Keyboard shortcuts

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