Skip to content

Commit 3312c89

Browse files
committed
Merge branch 'main' into thiago/dumpblocks-batch-receipts
2 parents a00a20e + 5a5e676 commit 3312c89

File tree

18 files changed

+11836
-213
lines changed

18 files changed

+11836
-213
lines changed

bindings/tokens/ERC20.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

bindings/tokens/ERC20.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/loadtest/app.go

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -37,58 +37,56 @@ type (
3737
}
3838
loadTestParams struct {
3939
// inputs
40-
RPCUrl *string
41-
Requests *int64
42-
Concurrency *int64
43-
BatchSize *uint64
44-
TimeLimit *int64
45-
RandomRecipients *bool
46-
EthCallOnly *bool
47-
EthCallOnlyLatestBlock *bool
48-
ChainID *uint64
49-
PrivateKey *string
50-
ToAddress *string
51-
EthAmountInWei *uint64
52-
RateLimit *float64
53-
AdaptiveRateLimit *bool
54-
AdaptiveTargetSize *uint64
55-
AdaptiveRateLimitIncrement *uint64
56-
AdaptiveCycleDuration *uint64
57-
AdaptiveBackoffFactor *float64
58-
Modes *[]string
59-
StoreDataSize *uint64
60-
Seed *int64
61-
LoadtestContractAddress *string
62-
ERC20Address *string
63-
ERC721Address *string
64-
DelAddress *string
65-
ForceGasLimit *uint64
66-
ForceGasPrice *uint64
67-
ForcePriorityGasPrice *uint64
68-
ShouldProduceSummary *bool
69-
SummaryOutputMode *string
70-
LegacyTransactionMode *bool
71-
FireAndForget *bool
72-
RecallLength *uint64
73-
ContractAddress *string
74-
ContractCallData *string
75-
ContractCallFunctionSignature *string
76-
ContractCallFunctionArgs *[]string
77-
ContractCallPayable *bool
78-
InscriptionContent *string
79-
BlobFeeCap *uint64
80-
StartNonce *uint64
81-
GasPriceMultiplier *float64
82-
SendingAccountsCount *uint64
83-
AccountFundingAmount *big.Int
84-
PreFundSendingAccounts *bool
85-
RefundRemainingFunds *bool
86-
SendingAccountsFile *string
87-
Proxy *string
88-
WaitForReceipt *bool
89-
ReceiptRetryMax *uint
90-
ReceiptRetryInitialDelayMs *uint
91-
MaxBaseFeeWei *uint64
40+
RPCUrl *string
41+
Requests *int64
42+
Concurrency *int64
43+
BatchSize *uint64
44+
TimeLimit *int64
45+
RandomRecipients *bool
46+
EthCallOnly *bool
47+
EthCallOnlyLatestBlock *bool
48+
ChainID *uint64
49+
PrivateKey *string
50+
ToAddress *string
51+
EthAmountInWei *uint64
52+
RateLimit *float64
53+
AdaptiveRateLimit *bool
54+
AdaptiveTargetSize *uint64
55+
AdaptiveRateLimitIncrement *uint64
56+
AdaptiveCycleDuration *uint64
57+
AdaptiveBackoffFactor *float64
58+
Modes *[]string
59+
StoreDataSize *uint64
60+
Seed *int64
61+
LoadtestContractAddress *string
62+
ERC20Address *string
63+
ERC721Address *string
64+
DelAddress *string
65+
ForceGasLimit *uint64
66+
ForceGasPrice *uint64
67+
ForcePriorityGasPrice *uint64
68+
ShouldProduceSummary *bool
69+
SummaryOutputMode *string
70+
LegacyTransactionMode *bool
71+
FireAndForget *bool
72+
RecallLength *uint64
73+
ContractAddress *string
74+
ContractCallData *string
75+
ContractCallPayable *bool
76+
BlobFeeCap *uint64
77+
StartNonce *uint64
78+
GasPriceMultiplier *float64
79+
SendingAccountsCount *uint64
80+
AccountFundingAmount *big.Int
81+
PreFundSendingAccounts *bool
82+
RefundRemainingFunds *bool
83+
SendingAccountsFile *string
84+
Proxy *string
85+
WaitForReceipt *bool
86+
ReceiptRetryMax *uint
87+
ReceiptRetryInitialDelayMs *uint
88+
MaxBaseFeeWei *uint64
89+
OutputRawTxOnly *bool
9290

9391
// Computed
9492
CurrentGasPrice *big.Int
@@ -204,6 +202,25 @@ func checkLoadtestFlags() error {
204202
return fmt.Errorf("the backoff factor needs to be non-zero positive. Given: %f", *ltp.AdaptiveBackoffFactor)
205203
}
206204

205+
if *ltp.WaitForReceipt && *ltp.ReceiptRetryMax <= 1 {
206+
return fmt.Errorf("when waiting for a receipt, use a max retry greater than 1")
207+
}
208+
209+
if *ltp.PreFundSendingAccounts && ltp.AccountFundingAmount != nil && ltp.AccountFundingAmount.Uint64() == 0 {
210+
return fmt.Errorf("a non-zero funding amount is required when pre-funding sending accounts")
211+
}
212+
if *ltp.EthCallOnly {
213+
if *ltp.PreFundSendingAccounts || *ltp.SendingAccountsFile != "" || *ltp.SendingAccountsCount > 0 {
214+
return fmt.Errorf("pre-funding accounts with call only mode doesn't make sense")
215+
}
216+
if *ltp.WaitForReceipt {
217+
return fmt.Errorf("waiting for receipts doesn't make sense with call only mode")
218+
}
219+
}
220+
if *ltp.GasPriceMultiplier == 0 {
221+
return fmt.Errorf("gas price multiplier should be non-zero")
222+
}
223+
207224
return nil
208225
}
209226

@@ -226,6 +243,7 @@ func initFlags() {
226243
ltp.RandomRecipients = LoadtestCmd.PersistentFlags().Bool("random-recipients", false, "When doing a transfer test, should we send to random addresses rather than DEADBEEFx5")
227244
ltp.EthCallOnly = LoadtestCmd.PersistentFlags().Bool("eth-call-only", false, "When using this mode, rather than sending a transaction, we'll just call. This mode is incompatible with adaptive rate limiting, summarization, and a few other features.")
228245
ltp.EthCallOnlyLatestBlock = LoadtestCmd.PersistentFlags().Bool("eth-call-only-latest", false, "When using call only mode with recall, should we execute on the latest block or on the original block")
246+
ltp.OutputRawTxOnly = LoadtestCmd.PersistentFlags().Bool("output-raw-tx-only", false, "When using this mode, rather than sending a transaction, we'll just output the raw signed transaction hex. Works with most load test modes except RPC and UniswapV3.")
229247
ltp.EthAmountInWei = LoadtestCmd.PersistentFlags().Uint64("eth-amount-in-wei", 0, "The amount of ether in wei to send on every transaction")
230248
ltp.RateLimit = LoadtestCmd.PersistentFlags().Float64("rate-limit", 4, "An overall limit to the number of requests per second. Give a number less than zero to remove this limit all together")
231249
ltp.AdaptiveRateLimit = LoadtestCmd.PersistentFlags().Bool("adaptive-rate-limit", false, "Enable AIMD-style congestion control to automatically adjust request rate")
@@ -261,7 +279,6 @@ func initFlags() {
261279
b, blob - Send blob transactions
262280
cc, contract-call - Make contract calls
263281
d, deploy - Deploy contracts
264-
i, inscription - Send inscription transactions
265282
inc, increment - Increment a counter
266283
r, random - Random modes (does not include the following modes: blob, call, inscription, recall, rpc, uniswapv3)
267284
R, recall - Replay or simulate transactions
@@ -276,10 +293,7 @@ v3, uniswapv3 - Perform UniswapV3 swaps`)
276293
ltp.RecallLength = LoadtestCmd.Flags().Uint64("recall-blocks", 50, "The number of blocks that we'll attempt to fetch for recall")
277294
ltp.ContractAddress = LoadtestCmd.Flags().String("contract-address", "", "The address of the contract that will be used in --mode contract-call. This must be paired up with --mode contract-call and --calldata")
278295
ltp.ContractCallData = LoadtestCmd.Flags().String("calldata", "", "The hex encoded calldata passed in. The format is function signature + arguments encoded together. This must be paired up with --mode contract-call and --contract-address")
279-
ltp.ContractCallFunctionSignature = LoadtestCmd.Flags().String("function-signature", "", "The contract's function signature that will be called. The format is '<function name>(<types...>)'. This must be paired up with '--mode contract-call' and '--contract-address'. If the function requires parameters you can pass them with '--function-arg <value>'.")
280-
ltp.ContractCallFunctionArgs = LoadtestCmd.Flags().StringSlice("function-arg", []string{}, `The arguments that will be passed to a contract function call. This must be paired up with "--mode contract-call" and "--contract-address". Args can be passed multiple times: "--function-arg 'test' --function-arg 999" or comma separated values "--function-arg "test",9". The ordering of the arguments must match the ordering of the function parameters.`)
281296
ltp.ContractCallPayable = LoadtestCmd.Flags().Bool("contract-call-payable", false, "Use this flag if the function is payable, the value amount passed will be from --eth-amount-in-wei. This must be paired up with --mode contract-call and --contract-address")
282-
ltp.InscriptionContent = LoadtestCmd.Flags().String("inscription-content", `data:,{"p":"erc-20","op":"mint","tick":"TEST","amt":"1"}`, "The inscription content that will be encoded as calldata. This must be paired up with --mode inscription")
283297
ltp.Proxy = LoadtestCmd.Flags().String("proxy", "", "Use the proxy specified")
284298
ltp.WaitForReceipt = LoadtestCmd.Flags().Bool("wait-for-receipt", false, "If set to true, the load test will wait for the transaction receipt to be mined. If set to false, the load test will not wait for the transaction receipt and will just send the transaction.")
285299
ltp.ReceiptRetryMax = LoadtestCmd.Flags().Uint("receipt-retry-max", 30, "Maximum number of attempts to poll for transaction receipt when --wait-for-receipt is enabled.")

0 commit comments

Comments
 (0)