Documentation
¶
Index ¶
- Constants
- Variables
- func FundAccountFromTestEntity(ctx context.Context, cc consensus.Services, sm consensus.SubmissionManager, ...) error
- type BaseWorkload
- func (bw *BaseWorkload) Consensus() consensus.Services
- func (bw *BaseWorkload) EscrowFunds(ctx context.Context, from signature.Signer, to staking.Address, ...) error
- func (bw *BaseWorkload) FundSignAndSubmitTx(ctx context.Context, caller signature.Signer, tx *transaction.Transaction) error
- func (bw *BaseWorkload) GasPrice() uint64
- func (bw *BaseWorkload) Init(cc consensus.Services, sm consensus.SubmissionManager, ...)
- func (bw *BaseWorkload) TransferFunds(ctx context.Context, from signature.Signer, to staking.Address, amount uint64) error
- func (bw *BaseWorkload) TransferFundsQty(ctx context.Context, from signature.Signer, to staking.Address, ...) error
- type TxnCall
- type TxnOutput
- type Workload
Constants ¶
const ( // CfgConsensusNumKeptVersions is the number of last consensus state versions that the nodes are // keeping (e.g., due to a configured pruning policy). Versions older than that will not be // queried. // // Note that this is only for consensus state versions, not runtime versions. CfgConsensusNumKeptVersions = "queries.consensus.num_kept_versions" // CfgQueriesRuntimeEnabled configures whether runtime queries are enabled. CfgQueriesRuntimeEnabled = "queries.runtime.enabled" )
const (
// CfgRuntimeID is the runtime workload runtime ID.
CfgRuntimeID = "runtime.runtime_id"
)
const NameCommission = "commission"
NameCommission is the name of the commission schedule amendements workload.
const NameDelegation = "delegation"
NameDelegation is the name of the delegation workload.
const NameGovernance = "governance"
NameGovernance is the name of the governance workload.
const NameOversized = "oversized"
NameOversized is the name of the oversized workload.
const NameParallel = "parallel"
NameParallel is the name of the parallel workload.
const NameQueries = "queries"
NameQueries is the name of the queries workload.
const NameRegistration = "registration"
NameRegistration is the name of the registration workload.
const NameRuntime = "runtime"
NameRuntime is the name of the runtime workload.
const NameTransfer = "transfer"
NameTransfer is the name of the transfer workload.
Transfer workload continuously submits transfer and burn transactions.
Variables ¶
var ByName = map[string]Workload{ NameCommission: Commission, NameDelegation: Delegation, NameOversized: Oversized, NameParallel: Parallel, NameQueries: Queries, NameRegistration: Registration, NameRuntime: Runtime, NameTransfer: Transfer, NameGovernance: Governance, }
ByName is the registry of workloads that you can access with `--workload <name>` on the command line.
var Commission = &commission{ BaseWorkload: NewBaseWorkload(NameCommission), }
Commission is the commission schedule amendments workload.
var Delegation = &delegation{ BaseWorkload: NewBaseWorkload(NameDelegation), }
Delegation is the delegation workload.
var Flags = flag.NewFlagSet("", flag.ContinueOnError)
Flags has the workload flags.
var ( // Governance is the governance workload. Governance = &governanceWorkload{ BaseWorkload: NewBaseWorkload(NameGovernance), } )
var Oversized = &oversized{ BaseWorkload: NewBaseWorkload(NameOversized), }
Oversized is the oversized workload.
var Parallel = ¶llel{ BaseWorkload: NewBaseWorkload(NameParallel), }
Parallel is the parallel workload.
var Queries = &queries{}
Queries is the queries workload.
var QueriesFlags = flag.NewFlagSet("", flag.ContinueOnError)
QueriesFlags are the queries workload flags.
var Registration = ®istration{ BaseWorkload: NewBaseWorkload(NameRegistration), }
Registration is the registration workload.
var Runtime = &runtime{ BaseWorkload: NewBaseWorkload(NameRuntime), }
Runtime is the runtime workload.
var RuntimeFlags = flag.NewFlagSet("", flag.ContinueOnError)
RuntimeFlags are the runtime workload flags.
var Transfer = &transfer{ BaseWorkload: NewBaseWorkload(NameTransfer), }
Transfer is the transfer workload.
Functions ¶
Types ¶
type BaseWorkload ¶ added in v0.2100.0
type BaseWorkload struct {
// Logger is the logger for the workload.
Logger *logging.Logger
// contains filtered or unexported fields
}
BaseWorkload provides common methods for a workload.
func NewBaseWorkload ¶ added in v0.2100.0
func NewBaseWorkload(name string) BaseWorkload
NewBaseWorkload creates a new BaseWorkload.
func (*BaseWorkload) Consensus ¶ added in v0.2100.0
func (bw *BaseWorkload) Consensus() consensus.Services
Consensus returns the consensus services.
func (*BaseWorkload) EscrowFunds ¶ added in v0.2300.0
func (bw *BaseWorkload) EscrowFunds(ctx context.Context, from signature.Signer, to staking.Address, amount *quantity.Quantity) error
EscrowFunds escrows from one account to the other.
func (*BaseWorkload) FundSignAndSubmitTx ¶ added in v0.2100.0
func (bw *BaseWorkload) FundSignAndSubmitTx(ctx context.Context, caller signature.Signer, tx *transaction.Transaction) error
FundSignAndSubmitTx funds the caller to cover transaction fees, signs the transaction and submits it to the consensus layer.
func (*BaseWorkload) GasPrice ¶ added in v0.2100.0
func (bw *BaseWorkload) GasPrice() uint64
GasPrice returns the configured consensus gas price.
func (*BaseWorkload) Init ¶ added in v0.2100.0
func (bw *BaseWorkload) Init( cc consensus.Services, sm consensus.SubmissionManager, fundingAccount signature.Signer, )
Init initializes the base workload.
type TxnCall ¶ added in v0.2103.0
type TxnCall struct {
// Sender is the sender.
Sender []byte `json:"sender"`
// Nonce is a nonce.
Nonce uint64 `json:"nonce"`
// Method is the called method name.
Method string `json:"method"`
// Args are the method arguments.
Args any `json:"args"`
}
TxnCall is a transaction call in the test runtime.
type TxnOutput ¶ added in v0.2103.0
type TxnOutput struct {
// Success can be of any type.
Success cbor.RawMessage
// Error is a string describing the error message.
Error *string
}
TxnOutput is a transaction call output in the test runtime.
type Workload ¶
type Workload interface {
// NeedsFunds should return true if the workload requires funding.
NeedsFunds() bool
// Run executes the workload.
// If `gracefulExit`'s deadline passes, it is not an error.
// Return `nil` after any short-ish amount of time in that case.
// Prefer to do at least one "iteration" even so.
Run(
gracefulExit context.Context,
rng *rand.Rand,
conn *grpc.ClientConn,
cnsc consensus.Services,
sm consensus.SubmissionManager,
fundingAccount signature.Signer,
validatorEntities []signature.Signer,
) error
}
Workload is a DRBG-backed schedule of transactions.