Skip to content

Commit 582a90b

Browse files
Add support to multi-account to loadtest (#591)
* feat: add account pool to loadtest * fix linter and doc gen issues * loadtests: add reusable nonces; refactoring account pool usage; * refactoring FundAccounts to work concurrently * loadtest: add multi-account suppor to all modes * fix loadtest to use funding account when only 1 account must be generated * review eth amount flags to use value in wei intead of decimal eth values * loadtest refund mechanism; fixed finish check taking too long; * add loadtest support to a file with private keys to set the sending addresses * feat: adding proxy support * loadtest: review nonce retry; review return funds tx fee * loadtest: fix add reusable nonce; check funding account balance * update doc * remove unnecessary commented code * loadtest: increase log level from trace for debug for some logs * remove unnecessary files * refactoring rate-limit; fix tests * fix import * loadtest: add check limits back; improve logs; improve tx error check; * loadtest: fix eip-1559 txs base fee * loadtest: fix linter issue * loadtest: use feeHistory to define maxFeePerGas * loadtest: add mutex to control fee updates * loadtest: fix mutex copy issue * upgrade ci go version * fix copilot review issues * loadtest: fix docs; fix summary; better name for fundingAmount in wei * loadtest: fix EIP-1559 fee race condition * loadtest: docs improvements * loadtest: refactor maxFeePerGas computation; * loadtest: fix force and improve maxFeePerGas; read nonce support to start nonce; * loadtest: refactor getSugetSuggestedGasPrices; refactor account pool return funds to retry when overshot error --------- Co-authored-by: John Hilliard <[email protected]>
1 parent 7ebac20 commit 582a90b

File tree

15 files changed

+1471
-420
lines changed

15 files changed

+1471
-420
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
env:
17-
GO_VERSION: "1.23" # https://go.dev/dl/
17+
GO_VERSION: "1.24.1" # https://go.dev/dl/
1818
FOUNDRY_VERSION: stable
1919

2020
jobs:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ permissions:
1010
contents: write
1111

1212
env:
13-
GO_VERSION: "1.23"
13+
GO_VERSION: "1.24.1"
1414

1515
jobs:
1616
manual-release:

cmd/fund/cmd.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package fund
22

33
import (
44
"errors"
5-
"math"
65

76
_ "embed"
87

@@ -28,7 +27,7 @@ type cmdFundParams struct {
2827
WalletsNumber *uint64
2928
UseHDDerivation *bool
3029
WalletAddresses *[]string
31-
FundingAmountInEth *float64
30+
FundingAmountInWei *uint64
3231
OutputFile *string
3332

3433
FunderAddress *string
@@ -68,7 +67,7 @@ func init() {
6867
p.WalletsNumber = flagSet.Uint64P("number", "n", 10, "The number of wallets to fund")
6968
p.UseHDDerivation = flagSet.Bool("hd-derivation", true, "Derive wallets to fund from the private key in a deterministic way")
7069
p.WalletAddresses = flagSet.StringSlice("addresses", nil, "Comma-separated list of wallet addresses to fund")
71-
p.FundingAmountInEth = flagSet.Float64P("eth-amount", "a", 0.05, "The amount of ether to send to each wallet")
70+
p.FundingAmountInWei = flagSet.Uint64P("eth-amount", "a", 50000000000000000, "The amount of wei to send to each wallet")
7271
p.OutputFile = flagSet.StringP("file", "f", "wallets.json", "The output JSON file path for storing the addresses and private keys of funded wallets")
7372

7473
// Marking flags as mutually exclusive
@@ -99,8 +98,8 @@ func checkFlags() error {
9998
if params.WalletsNumber != nil && *params.WalletsNumber == 0 {
10099
return errors.New("the number of wallets to fund is set to zero")
101100
}
102-
if params.FundingAmountInEth != nil && math.Abs(*params.FundingAmountInEth) <= 1e-9 {
103-
return errors.New("the amount of eth to send to each wallet is set to zero")
101+
if params.FundingAmountInWei != nil && *params.FundingAmountInWei <= 1000000000 {
102+
return errors.New("the funding amount must be greater than 1000000000")
104103
}
105104
if params.OutputFile != nil && *params.OutputFile == "" {
106105
return errors.New("the output file is not specified")

cmd/fund/fund.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func deployOrInstantiateFunderContract(ctx context.Context, c *ethclient.Client,
128128
if *params.FunderAddress == "" {
129129
// Deploy the Funder contract.
130130
// Note: `fundingAmountInWei` reprensents the amount the Funder contract will send to each newly generated wallets.
131-
fundingAmountInWei := util.EthToWei(*params.FundingAmountInEth)
131+
fundingAmountInWei := new(big.Int).SetUint64(*params.FundingAmountInWei)
132132
contractAddress, _, _, err = funder.DeployFunder(tops, c, fundingAmountInWei)
133133
if err != nil {
134134
log.Error().Err(err).Msg("Unable to deploy Funder contract")

0 commit comments

Comments
 (0)