Documentation ¶
Index ¶
Constants ¶
const ( // TransactionSubmissionTimeout is the time after which we return an error. TransactionSubmissionTimeout = 5 * time.Minute // TransactionStatusRetryTimeout is the time after which the status of a // transaction is checked again TransactionStatusRetryTimeout = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func EncodeClusterAssignments ¶ added in v0.20.0
func EncodeClusterAssignments(clusterAssignments flow.AssignmentList) []byte
EncodeClusterAssignments encodes a slice of QuorumCertificates into an encoded transaction argument for the deployEpoch transaction used during execution state bootstrapping.
The resulting argument has type [{String: UInt64}] which represents a list of weight mappings for each cluster. The full Cluster struct is constructed within the transaction in Cadence for simplicity here.
Types ¶
type BaseClient ¶ added in v0.20.0
type BaseClient struct { Log zerolog.Logger // default logger ContractAddress string // contract address FlowClient module.SDKClientWrapper // flow access node client AccountAddress sdk.Address // account belonging to node interacting with the contract AccountKeyIndex uint // account key index Signer sdkcrypto.Signer // signer used to sign transactions }
BaseClient represents the core fields and methods needed to create a client to a contract on the Flow Network.
func NewBaseClient ¶ added in v0.20.0
func NewBaseClient(log zerolog.Logger, flowClient module.SDKClientWrapper, accountAddress string, accountKeyIndex uint, signer sdkcrypto.Signer, contractAddress string) *BaseClient
NewBaseClient creates a instance of BaseClient
func (*BaseClient) GetAccount ¶ added in v0.20.0
func (*BaseClient) SendTransaction ¶ added in v0.20.0
func (c *BaseClient) SendTransaction(ctx context.Context, tx *sdk.Transaction) (sdk.Identifier, error)
SendTransaction submits a transaction to Flow. Requires transaction to be signed.
func (*BaseClient) WaitForSealed ¶ added in v0.20.0
func (c *BaseClient) WaitForSealed(ctx context.Context, txID sdk.Identifier, started time.Time) error
WaitForSealed waits for a transaction to be sealed
type EpochConfig ¶ added in v0.20.0
type EpochConfig struct { EpochTokenPayout cadence.UFix64 RewardCut cadence.UFix64 CurrentEpochCounter cadence.UInt64 NumViewsInEpoch cadence.UInt64 NumViewsInStakingAuction cadence.UInt64 NumViewsInDKGPhase cadence.UInt64 NumCollectorClusters cadence.UInt16 FLOWsupplyIncreasePercentage cadence.UFix64 RandomSource cadence.String CollectorClusters flow.AssignmentList ClusterQCs []*flow.QuorumCertificate DKGPubKeys []crypto.PublicKey }
EpochConfig is a placeholder for config values used to deploy the epochs smart-contract.
func DefaultEpochConfig ¶ added in v0.20.0
func DefaultEpochConfig() EpochConfig
DefaultEpochConfig returns an EpochConfig with default values used for testing.
type EpochLookup ¶ added in v0.20.0
type EpochLookup struct {
// contains filtered or unexported fields
}
EpochLookup implements the EpochLookup interface using protocol state to match views to epochs.
func NewEpochLookup ¶ added in v0.20.0
func NewEpochLookup(state protocol.State) *EpochLookup
NewEpochLookup instantiates a new EpochLookup
func (*EpochLookup) EpochForView ¶ added in v0.20.0
func (l *EpochLookup) EpochForView(view uint64) (epochCounter uint64, err error)
EpochForView returns the counter of the epoch that the view belongs to. The protocol.State#Epochs object exposes previous, current, and next epochs, which should be all we need. In general we can't guarantee that a node will have access to epoch data beyond these three, so it is safe to throw an error for a query that doesn't fit within the view bounds of these three epochs (even if the node does happen to have that stored in the underlying storage) -- these queries indicate a bug in the querier.
type MockQCContractClient ¶ added in v0.20.0
type MockQCContractClient struct {
// contains filtered or unexported fields
}
func NewMockQCContractClient ¶ added in v0.20.0
func NewMockQCContractClient(log zerolog.Logger) *MockQCContractClient
func (*MockQCContractClient) SubmitVote ¶ added in v0.20.0
type QCContractClient ¶ added in v0.20.0
type QCContractClient struct { BaseClient // contains filtered or unexported fields }
QCContractClient is a client to the Quorum Certificate contract. Allows the client to functionality to submit a vote and check if collection node has voted already.
func NewQCContractClient ¶ added in v0.20.0
func NewQCContractClient(log zerolog.Logger, flowClient module.SDKClientWrapper, nodeID flow.Identifier, accountAddress string, accountKeyIndex uint, qcContractAddress string, signer sdkcrypto.Signer) *QCContractClient
NewQCContractClient returns a new client to the Quorum Certificate contract
func (*QCContractClient) SubmitVote ¶ added in v0.20.0
SubmitVote submits the given vote to the cluster QC aggregator smart contract. This function returns only once the transaction has been processed by the network. An error is returned if the transaction has failed and should be re-submitted.
type RootQCVoter ¶
type RootQCVoter struct {
// contains filtered or unexported fields
}
RootQCVoter is responsible for generating and submitting votes for the root quorum certificate of the upcoming epoch for this node's cluster.
func NewRootQCVoter ¶
func NewRootQCVoter( log zerolog.Logger, me module.Local, signer hotstuff.Signer, state protocol.State, client module.QCContractClient, ) *RootQCVoter
NewRootQCVoter returns a new root QC voter, configured for a particular epoch.
func (*RootQCVoter) Vote ¶
Vote handles the full procedure of generating a vote, submitting it to the epoch smart contract, and verifying submission. Returns an error only if there is a critical error that would make it impossible for the vote to be submitted. Otherwise, exits when the vote has been successfully submitted.
It is safe to run multiple times within a single setup phase.