run

package
v0.37.0-crescendo-RC7-... Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: AGPL-3.0 Imports: 32 Imported by: 2

Documentation

Overview

contains reusable logic that does not know about a CLI. Instead of exiting a program, functions here will return errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructRootQCsForClusters added in v0.37.1

func ConstructRootQCsForClusters(log zerolog.Logger, clusterList flow.ClusterList, nodeInfos []bootstrap.NodeInfo, clusterBlocks []*cluster.Block) []*flow.QuorumCertificate

ConstructRootQCsForClusters constructs a root QC for each cluster in the list. Args: - log: the logger instance. - clusterList: list of clusters - nodeInfos: list of NodeInfos (must contain all internal nodes) - clusterBlocks: list of root blocks (one for each cluster) Returns: - flow.AssignmentList: the generated assignment list. - flow.ClusterList: the generate collection cluster list.

func GenerateClusterRootQC

func GenerateClusterRootQC(signers []bootstrap.NodeInfo, allCommitteeMembers flow.IdentitySkeletonList, clusterBlock *cluster.Block) (*flow.QuorumCertificate, error)

GenerateClusterRootQC creates votes and generates a QC based on participant data

func GenerateExecutionState

func GenerateExecutionState(
	dbDir string,
	accountKey flow.AccountPublicKey,
	chain flow.Chain,
	bootstrapOptions ...fvm.BootstrapProcedureOption,
) (flow.StateCommitment, error)

func GenerateRecoverEpochTxArgs added in v0.37.1

func GenerateRecoverEpochTxArgs(log zerolog.Logger,
	internalNodePrivInfoDir string,
	nodeConfigJson string,
	collectionClusters int,
	epochCounter uint64,
	rootChainID flow.ChainID,
	numViewsInStakingAuction uint64,
	numViewsInEpoch uint64,
	targetDuration uint64,
	initNewEpoch bool,
	snapshot *inmem.Snapshot,
) ([]cadence.Value, error)

GenerateRecoverEpochTxArgs generates the required transaction arguments for the `recoverEpoch` transaction.

func GenerateRootBlockVotes added in v0.22.8

func GenerateRootBlockVotes(block *flow.Block, participantData *ParticipantData) ([]*model.Vote, error)

GenerateRootBlockVotes generates votes for root block based on participantData

func GenerateRootClusterBlocks

func GenerateRootClusterBlocks(epoch uint64, clusters flow.ClusterList) []*cluster.Block

func GenerateRootHeader added in v0.33.30

func GenerateRootHeader(chainID flow.ChainID, parentID flow.Identifier, height uint64, timestamp time.Time) *flow.Header

func GenerateRootQC

func GenerateRootQC(block *flow.Block, votes []*model.Vote, participantData *ParticipantData, identities flow.IdentityList) (
	*flow.QuorumCertificate,
	[]error,
	error,
)

GenerateRootQC generates QC for root block, caller needs to provide votes for root QC and participantData to build the QC. NOTE: at the moment, we require private keys for one node because we we re-using the full business logic, which assumes that only consensus participants construct QCs, which also have produce votes.

TODO: modularize QC construction code (and code to verify QC) to be instantiated without needing private keys. It returns (qc, nil, nil) if a QC can be constructed with enough votes, and there is no invalid votes It returns (qc, invalidVotes, nil) if there are some invalid votes, but a QC can still be constructed It returns (nil, invalidVotes, err) if no qc can be constructed with not enough votes or running any any exception

func GenerateRootResult

func GenerateRootResult(
	block *flow.Block,
	commit flow.StateCommitment,
	epochSetup *flow.EpochSetup,
	epochCommit *flow.EpochCommit,
) *flow.ExecutionResult

func GenerateRootSeal

func GenerateRootSeal(result *flow.ExecutionResult) (*flow.Seal, error)

Types

type Participant

type Participant struct {
	bootstrap.NodeInfo
	RandomBeaconPrivKey crypto.PrivateKey
}

type ParticipantData

type ParticipantData struct {
	Participants []Participant
	Lookup       map[flow.Identifier]flow.DKGParticipant
	GroupKey     crypto.PublicKey
}

func GenerateQCParticipantData

func GenerateQCParticipantData(allNodes, internalNodes []bootstrap.NodeInfo, dkgData dkg.DKGData) (*ParticipantData, error)

GenerateQCParticipantData generates QC participant data used to create the random beacon and staking signatures on the QC.

allNodes must be in the same order that was used when running the DKG.

func (*ParticipantData) Identities

func (pd *ParticipantData) Identities() flow.IdentityList

func (*ParticipantData) PublicBeaconKeys added in v0.33.30

func (pd *ParticipantData) PublicBeaconKeys() []crypto.PublicKey

PublicBeaconKeys returns the nodes' individual public random-beacon keys (excluding the group public key). The keys are returned in the same order as the nodes appear in the Participants list, which must be the DKG index order.

Jump to

Keyboard shortcuts

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