Skip to content

Commit 93e4357

Browse files
committed
review docs
1 parent c078331 commit 93e4357

File tree

4 files changed

+9
-53
lines changed

4 files changed

+9
-53
lines changed

cmd/loadtest/app.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,16 @@ func initFlags() {
243243
ltp.BlobFeeCap = LoadtestCmd.Flags().Uint64("blob-fee-cap", 100000, "The blob fee cap, or the maximum blob fee per chunk, in Gwei.")
244244
ltp.SendingAddressCount = LoadtestCmd.Flags().Uint64("sending-address-count", 1, "The number of sending addresses to use. This is useful for avoiding pool account queue.")
245245
ltp.AddressFundingAmount = defaultFunding
246-
LoadtestCmd.Flags().Var(&flag_loader.BigIntValue{Val: ltp.AddressFundingAmount}, "address-funding-amount", "The amount in wei to fund the sending addresses with. Set to 0 to disable account funding (useful for call-only mode or pre-funded addresses).")
246+
LoadtestCmd.Flags().Var(&flag_loader.BigIntValue{Val: ltp.AddressFundingAmount}, "address-funding-amount", "The amount in wei to fund the sending addresses with. Set to 0 to disable account funding (useful for eth-call-only mode or pre-funded addresses).")
247247
ltp.PreFundSendingAddresses = LoadtestCmd.Flags().Bool("pre-fund-sending-addresses", false, "If set to true, the sending addresses will be funded at the start of the execution, otherwise all addresses will be funded when used for the first time.")
248248
ltp.KeepFundsAfterTest = LoadtestCmd.Flags().Bool("keep-funds-after-test", false, "If set to true, the funded amount will be kept in the sending addresses. Otherwise, the funded amount will be refunded back to the account used to fund the account.")
249249
ltp.SendingAddressesFile = LoadtestCmd.Flags().String("sending-addresses-file", "", "The file containing the sending addresses private keys, one per line. This is useful for avoiding pool account queue but also to keep the same sending addresses for different execution cycles.")
250250

251251
// Local flags.
252-
ltp.Modes = LoadtestCmd.Flags().StringSliceP("mode", "m", []string{"t"}, `The testing mode to use. It can be multiple like: "c,d,f,t"
252+
ltp.Modes = LoadtestCmd.Flags().StringSliceP("mode", "m", []string{"t"}, `The testing mode to use. It can be multiple like: "d,t"
253253
2, erc20 - Send ERC20 tokens
254254
7, erc721 - Mint ERC721 tokens
255255
b, blob - Send blob transactions
256-
c, call - Call random contract functions
257256
cc, contract-call - Make contract calls
258257
d, deploy - Deploy contracts
259258
i, inscription - Send inscription transactions

cmd/loadtest/loadtest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func initializeLoadTestParams(ctx context.Context, c *ethclient.Client) error {
285285
return errors.New("random mode can't be used in combinations with any other modes")
286286
}
287287
if hasMode(loadTestModeRPC, inputLoadTestParams.ParsedModes) && inputLoadTestParams.MultiMode && !*inputLoadTestParams.EthCallOnly {
288-
return errors.New("rpc mode must be called with call-only when multiple modes are used")
288+
return errors.New("rpc mode must be called with eth-call-only when multiple modes are used")
289289
} else if hasMode(loadTestModeRPC, inputLoadTestParams.ParsedModes) {
290290
log.Trace().Msg("Setting call only mode since we're doing RPC testing")
291291
*inputLoadTestParams.EthCallOnly = true
@@ -376,7 +376,7 @@ func initializeLoadTestParams(ctx context.Context, c *ethclient.Client) error {
376376
return fmt.Errorf("unable to fund sending addresses. %w", err)
377377
}
378378
} else if !*inputLoadTestParams.EthCallOnly {
379-
// When using multiple sending addresses and not using --call-only and --address-funding-amount <= 0, we need to make sure the addresses get funded
379+
// When using multiple sending addresses and not using --eth-call-only and --address-funding-amount <= 0, we need to make sure the addresses get funded
380380
// Set default funding to 1 ETH (1000000000000000000 wei)
381381
defaultFunding := new(big.Int).SetUint64(1000000000000000000)
382382
inputLoadTestParams.AddressFundingAmount = defaultFunding

cmd/loadtest/loadtestUsage.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,17 @@ The `--mode` flag is important for this command.
1010
and cheapest transaction that can be performed.
1111
- `d`/`deploy` will deploy the load testing contract over and over
1212
again.
13-
- `c`/`call` will call random opcodes in our load test contract. The
14-
random function that is called will be repeatedly called in a loop
15-
based on the number of iterations from the `iterations` flag
16-
- `f`/`function` works the same way as `call` mode but instead of
17-
calling random op codes, the opcode can be specified with the `-f`
18-
flag. If you want to call `LOG4` you would pass `-f 164` which is
19-
the opcode for `LOG4`.
2013
- `2`/`erc20` will run an ERC20 transfer test. The process initializes
2114
by minting a large amount of tokens then transferring it in small
2215
amounts. Each transaction is a single transfer.
2316
- `7`/`erc721` will run an ERC721 mint test which will mint an NFT
24-
over and over again. The `iterations` flag here can be used to
25-
control if we are mint 1 NFT or many.
17+
over and over again.
2618
- `i`/`inc`/`increment` will call the increment function repeatedly on
2719
the load test contract. It's a minimal example of a contract call
2820
that will require an update to a contract's storage.
2921
- `s`/`store` is used to store random data in the smart contract
3022
storage. The amount of data stored per transaction is controlled
31-
with the `byte-count` flag.
32-
- `P`/`precompiles` will randomly call the commonly implemented
33-
precompiled functions. This functions the same way as `call` mode
34-
except it's hitting precompiles rather than opcodes.
35-
- `p`/`precompile` will call a specific precompile in a loop. This
36-
works the same way as `function` mode except rather than specifying
37-
an opcode, you're specifying a precompile. E.g to call `ECRECOVER`
38-
you would pass `-f 1` because it's the contract at address `0x01`
23+
with the `store-data-size` flag.
3924
- `R`/`recall` will attempt to replay all of the transactions from the
4025
previous blocks. You can use `--recall-blocks` to specify how many
4126
previous blocks should be used to seed transaction history. It's
@@ -58,12 +43,6 @@ Here is a simple example that runs 1000 requests at a max rate of 1 request per
5843
$ polycli loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 1000 --rate-limit 1 --mode t --rpc-url http://localhost:8888
5944
```
6045

61-
Another example, a bit slower, and that specifically calls the [LOG4](https://www.evm.codes/#a4) function in the load test contract in a loop for 25,078 iterations. That number was picked specifically to require almost all of the gas for a single transaction.
62-
63-
```bash
64-
$ polycli loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 50 --rate-limit 0.5 --mode f --function 164 --iterations 25078 --rpc-url http://private.validator-001.devnet02.pos-v3.polygon.private:8545
65-
```
66-
6746
### Load Test Contract
6847

6948
The codebase has a contract that used for load testing. It's written in Solidity. The workflow for modifying this contract is.

doc/polycli_loadtest.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,17 @@ The `--mode` flag is important for this command.
3131
and cheapest transaction that can be performed.
3232
- `d`/`deploy` will deploy the load testing contract over and over
3333
again.
34-
- `c`/`call` will call random opcodes in our load test contract. The
35-
random function that is called will be repeatedly called in a loop
36-
based on the number of iterations from the `iterations` flag
37-
- `f`/`function` works the same way as `call` mode but instead of
38-
calling random op codes, the opcode can be specified with the `-f`
39-
flag. If you want to call `LOG4` you would pass `-f 164` which is
40-
the opcode for `LOG4`.
4134
- `2`/`erc20` will run an ERC20 transfer test. The process initializes
4235
by minting a large amount of tokens then transferring it in small
4336
amounts. Each transaction is a single transfer.
4437
- `7`/`erc721` will run an ERC721 mint test which will mint an NFT
45-
over and over again. The `iterations` flag here can be used to
46-
control if we are mint 1 NFT or many.
38+
over and over again.
4739
- `i`/`inc`/`increment` will call the increment function repeatedly on
4840
the load test contract. It's a minimal example of a contract call
4941
that will require an update to a contract's storage.
5042
- `s`/`store` is used to store random data in the smart contract
5143
storage. The amount of data stored per transaction is controlled
52-
with the `byte-count` flag.
53-
- `P`/`precompiles` will randomly call the commonly implemented
54-
precompiled functions. This functions the same way as `call` mode
55-
except it's hitting precompiles rather than opcodes.
56-
- `p`/`precompile` will call a specific precompile in a loop. This
57-
works the same way as `function` mode except rather than specifying
58-
an opcode, you're specifying a precompile. E.g to call `ECRECOVER`
59-
you would pass `-f 1` because it's the contract at address `0x01`
44+
with the `store-data-size` flag.
6045
- `R`/`recall` will attempt to replay all of the transactions from the
6146
previous blocks. You can use `--recall-blocks` to specify how many
6247
previous blocks should be used to seed transaction history. It's
@@ -79,12 +64,6 @@ Here is a simple example that runs 1000 requests at a max rate of 1 request per
7964
$ polycli loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 1000 --rate-limit 1 --mode t --rpc-url http://localhost:8888
8065
```
8166

82-
Another example, a bit slower, and that specifically calls the [LOG4](https://www.evm.codes/#a4) function in the load test contract in a loop for 25,078 iterations. That number was picked specifically to require almost all of the gas for a single transaction.
83-
84-
```bash
85-
$ polycli loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 50 --rate-limit 0.5 --mode f --function 164 --iterations 25078 --rpc-url http://private.validator-001.devnet02.pos-v3.polygon.private:8545
86-
```
87-
8867
### Load Test Contract
8968

9069
The codebase has a contract that used for load testing. It's written in Solidity. The workflow for modifying this contract is.
@@ -129,11 +108,10 @@ The codebase has a contract that used for load testing. It's written in Solidity
129108
--keep-funds-after-test If set to true, the funded amount will be kept in the sending addresses. Otherwise, the funded amount will be refunded back to the account used to fund the account.
130109
--legacy Send a legacy transaction instead of an EIP1559 transaction.
131110
--loadtest-contract-address string The address of a pre-deployed load test contract
132-
-m, --mode strings The testing mode to use. It can be multiple like: "c,d,f,t"
111+
-m, --mode strings The testing mode to use. It can be multiple like: "d,t"
133112
2, erc20 - Send ERC20 tokens
134113
7, erc721 - Mint ERC721 tokens
135114
b, blob - Send blob transactions
136-
c, call - Call random contract functions
137115
cc, contract-call - Make contract calls
138116
d, deploy - Deploy contracts
139117
i, inscription - Send inscription transactions

0 commit comments

Comments
 (0)