Documentation ¶
Index ¶
- Constants
- func CheckMachineAccountInfo(log zerolog.Logger, conf MachineAccountValidatorConfig, role flow.Role, ...) error
- func EncodeClusterAssignments(clusterAssignments flow.AssignmentList) []byte
- func WithoutBalanceChecks(conf *MachineAccountValidatorConfig)
- type BaseClient
- type EpochConfig
- type EpochLookup
- type MachineAccountConfigValidator
- type MachineAccountValidatorConfig
- type MachineAccountValidatorConfigOption
- type MockQCContractClient
- type QCContractClient
- type RootQCVoter
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 CheckMachineAccountInfo ¶ added in v0.22.0
func CheckMachineAccountInfo( log zerolog.Logger, conf MachineAccountValidatorConfig, role flow.Role, info bootstrap.NodeMachineAccountInfo, account *sdk.Account, ) error
CheckMachineAccountInfo checks a node machine account config, logging anything noteworthy but not critical, and returning an error if the machine account is not configured correctly, or the configuration cannot be checked.
This function checks most aspects of correct configuration EXCEPT for confirming that the account contains the relevant QCVoter or DKGParticipant resource. This is omitted because it is not possible to query private account info from a script.
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.
func WithoutBalanceChecks ¶ added in v0.23.9
func WithoutBalanceChecks(conf *MachineAccountValidatorConfig)
WithoutBalanceChecks sets minimum balances to 0 to effectively disable minimum balance checks. This is useful for test networks where transaction fees are disabled.
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.
func (*EpochLookup) EpochForViewWithFallback ¶ added in v0.21.1
func (l *EpochLookup) EpochForViewWithFallback(view uint64) (uint64, error)
EpochForViewWithFallback returns the counter of the epoch that the input view belongs to, with the same rules as EpochForView, except that this function will return the last committed epoch counter in perpetuity in the case that any epoch preparation. For example, if we are in epoch 10, and reach the final view of epoch 10 before epoch 11 has finished being setup, this function will return 10 even after the final view of epoch 10.
type MachineAccountConfigValidator ¶ added in v0.22.0
type MachineAccountConfigValidator struct {
// contains filtered or unexported fields
}
MachineAccountConfigValidator is used to validate that a machine account is configured correctly.
func NewMachineAccountConfigValidator ¶ added in v0.22.0
func NewMachineAccountConfigValidator( log zerolog.Logger, flowClient *client.Client, role flow.Role, info bootstrap.NodeMachineAccountInfo, opts ...MachineAccountValidatorConfigOption, ) (*MachineAccountConfigValidator, error)
func (*MachineAccountConfigValidator) Done ¶ added in v0.22.0
func (validator *MachineAccountConfigValidator) Done() <-chan struct{}
Done will cancel the context of the unit, which will end the validator goroutine, if it is still running.
func (*MachineAccountConfigValidator) Ready ¶ added in v0.22.0
func (validator *MachineAccountConfigValidator) Ready() <-chan struct{}
Ready will launch the validator function in a goroutine.
type MachineAccountValidatorConfig ¶ added in v0.23.9
type MachineAccountValidatorConfig struct { SoftMinBalanceLN cadence.UFix64 HardMinBalanceLN cadence.UFix64 SoftMinBalanceSN cadence.UFix64 HardMinBalanceSN cadence.UFix64 }
MachineAccountValidatorConfig defines configuration options for MachineAccountConfigValidator.
func DefaultMachineAccountValidatorConfig ¶ added in v0.23.9
func DefaultMachineAccountValidatorConfig() MachineAccountValidatorConfig
type MachineAccountValidatorConfigOption ¶ added in v0.23.9
type MachineAccountValidatorConfigOption func(*MachineAccountValidatorConfig)
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, flowClientANID flow.Identifier, 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, contractClients []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.