Documentation ¶
Overview ¶
Package bootstrap defines canonical models and encoding for bootstrapping.
Index ¶
- Variables
- func ToDKGLookup(dkg DKGData, identities flow.IdentityList) map[flow.Identifier]flow.DKGParticipant
- func ToIdentityList(nodes []NodeInfo) flow.IdentityList
- type DKGData
- type DKGParticipantPriv
- type NodeConfig
- type NodeInfo
- func (node NodeInfo) Identity() *flow.Identity
- func (node NodeInfo) NetworkPubKey() crypto.PublicKey
- func (node NodeInfo) PartnerPublic() PartnerNodeInfoPub
- func (node NodeInfo) Private() (NodeInfoPriv, error)
- func (node NodeInfo) PrivateKeys() (*NodePrivateKeys, error)
- func (node NodeInfo) Public() NodeInfoPub
- func (node NodeInfo) StakingPubKey() crypto.PublicKey
- func (node NodeInfo) Type() NodeInfoType
- type NodeInfoPriv
- type NodeInfoPub
- type NodeInfoType
- type NodePrivateKeys
- type PartnerNodeInfoPub
Constants ¶
This section is empty.
Variables ¶
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 PathRootBlock = filepath.Join(DirnamePublicBootstrap, "root-block.json") PathRootQC = filepath.Join(DirnamePublicBootstrap, "root-qc.json") PathRootResult = filepath.Join(DirnamePublicBootstrap, "root-execution-result.json") PathRootSeal = filepath.Join(DirnamePublicBootstrap, "root-block-seal.json") PathRootProtocolStateSnapshot = filepath.Join(DirnamePublicBootstrap, "root-protocol-state-snapshot.json") PathRootCheckpoint = filepath.Join(DirnameExecutionState, wal.RootCheckpointFilename) // 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.
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 ToDKGLookup ¶
func ToDKGLookup(dkg DKGData, identities flow.IdentityList) map[flow.Identifier]flow.DKGParticipant
func ToIdentityList ¶
func ToIdentityList(nodes []NodeInfo) flow.IdentityList
Types ¶
type DKGData ¶
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 ¶
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 NewPrivateNodeInfo ¶
func NewPrivateNodeInfo( nodeID flow.Identifier, role flow.Role, addr string, stake uint64, networkKey crypto.PrivateKey, stakingKey crypto.PrivateKey, ) NodeInfo
func NewPublicNodeInfo ¶
func (NodeInfo) NetworkPubKey ¶
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 (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.