Documentation ¶
Index ¶
- func DistributeFunds(ctx context.Context, client ethclient.Client, keys []*key.Key, numKeys int, ...) ([]*key.Key, error)
- func ExecuteLoader(ctx context.Context, config config.Config) error
- func GenerateTxSequence(ctx context.Context, generator CreateTx, client ethclient.Client, ...) ([]*types.Transaction, error)
- func GenerateTxSequences(ctx context.Context, generator CreateTx, client ethclient.Client, ...) ([][]*types.Transaction, error)
- type CreateTx
- type Worker
- type WorkerGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistributeFunds ¶
func DistributeFunds(ctx context.Context, client ethclient.Client, keys []*key.Key, numKeys int, minFundsPerAddr *big.Int) ([]*key.Key, error)
DistributeFunds ensures that each address in keys has at least [minFundsPerAddr] by sending funds from the key with the highest starting balance. This function returns a set of at least [numKeys] keys, each having a minimum balance [minFundsPerAddr].
func ExecuteLoader ¶
ExecuteLoader runs the load simulation specified by config.
func GenerateTxSequence ¶
func GenerateTxSequence(ctx context.Context, generator CreateTx, client ethclient.Client, key *ecdsa.PrivateKey, numTxs uint64) ([]*types.Transaction, error)
GenerateTxSequence fetches the current nonce of key and calls [generator] [numTxs] times sequentially to generate a sequence of transactions.
func GenerateTxSequences ¶
Types ¶
type CreateTx ¶
type CreateTx func(key *ecdsa.PrivateKey, nonce uint64) (*types.Transaction, error)
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
NewWorker creates a new worker that will issue the sequence of transactions from the given address
Assumes that all transactions are from the same address, ordered by nonce, and this worker has exclusive access to issuance of transactions from the underlying private key.
func (*Worker) AwaitTxs ¶
AwaitTxs awaits for the nonce of the last transaction issued by the worker to be confirmed or rejected by the network.
Assumes that a non-zero number of transactions were already generated and that they were issued by this worker.
func (*Worker) ConfirmAllTransactions ¶
ConfirmAllTransactions iterates over every transaction of this worker and confirms it via eth_getTransactionByHash
type WorkerGroup ¶
type WorkerGroup struct {
// contains filtered or unexported fields
}
func CreateLoader ¶
CreateLoader creates a WorkerGroup from config to perform the specified simulation.
func NewWorkerGroup ¶
func NewWorkerGroup(clients []ethclient.Client, senders []common.Address, txSequences [][]*types.Transaction) *WorkerGroup
func (*WorkerGroup) AwaitTxs ¶
func (wg *WorkerGroup) AwaitTxs(ctx context.Context) error
AwaitTxs concurrently waits for each worker to confirm the nonce of its last issued transaction.
func (*WorkerGroup) ConfirmAllTransactions ¶
func (wg *WorkerGroup) ConfirmAllTransactions(ctx context.Context) error
ConfirmAllTransactions concurrently waits for each worker to confirm each transaction by checking for it via eth_getTransactionByHash