From cc00b0a5981d6a869aad19404ccbe2be26d0267c Mon Sep 17 00:00:00 2001 From: Ji Hwan Date: Tue, 4 Jun 2024 09:56:36 +0900 Subject: [PATCH] feat: add input load test parameter flag for blob fee cap Signed-off-by: Ji Hwan --- cmd/loadtest/app.go | 2 ++ cmd/loadtest/loadtest.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/loadtest/app.go b/cmd/loadtest/app.go index 150c5731..246a9693 100644 --- a/cmd/loadtest/app.go +++ b/cmd/loadtest/app.go @@ -78,6 +78,7 @@ type ( ContractCallFunctionArgs *[]string ContractCallPayable *bool InscriptionContent *string + BlobFeeCap *uint64 // Computed CurrentGasPrice *big.Int @@ -229,6 +230,7 @@ func initFlags() { ltp.SummaryOutputMode = LoadtestCmd.PersistentFlags().String("output-mode", "text", "Format mode for summary output (json | text)") ltp.LegacyTransactionMode = LoadtestCmd.PersistentFlags().Bool("legacy", false, "Send a legacy transaction instead of an EIP1559 transaction.") ltp.SendOnly = LoadtestCmd.PersistentFlags().Bool("send-only", false, "Send transactions and load without waiting for it to be mined.") + ltp.BlobFeeCap = LoadtestCmd.Flags().Uint64("blob-fee-cap", 100000, "The blob fee cap, or the maximum blob fee per chunk, in Gwei.") // Local flags. ltp.Modes = LoadtestCmd.Flags().StringSliceP("mode", "m", []string{"t"}, `The testing mode to use. It can be multiple like: "t,c,d,f" diff --git a/cmd/loadtest/loadtest.go b/cmd/loadtest/loadtest.go index c54639a7..35a37c25 100644 --- a/cmd/loadtest/loadtest.go +++ b/cmd/loadtest/loadtest.go @@ -1501,7 +1501,8 @@ func loadTestBlob(ctx context.Context, c *ethclient.Client, nonce uint64) (t1 ti gasLimit := uint64(21000) gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) - blobFeeCap := uint64(1000000000) // 1eth + // blobFeeCap := uint64(1000000000) // 1eth + blobFeeCap := ltp.BlobFeeCap // Initialize blobTx with blob transaction type blobTx := ethtypes.BlobTx{ @@ -1509,7 +1510,7 @@ func loadTestBlob(ctx context.Context, c *ethclient.Client, nonce uint64) (t1 ti Nonce: nonce, GasTipCap: uint256.NewInt(gasTipCap.Uint64()), GasFeeCap: uint256.NewInt(gasPrice.Uint64()), - BlobFeeCap: uint256.NewInt(blobFeeCap), + BlobFeeCap: uint256.NewInt(*blobFeeCap), Gas: gasLimit, To: *to, Value: uint256.NewInt(amount.Uint64()),