Skip to content

Commit

Permalink
fix: adding back estimation but with checking the current limit
Browse files Browse the repository at this point in the history
  • Loading branch information
praetoriansentry committed Dec 9, 2023
1 parent 1dbf4d0 commit c8bf8cc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/loadtest/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,24 @@ func loadTestContractCall(ctx context.Context, c *ethclient.Client, nonce uint64
log.Error().Err(err).Msg("Unable to decode calldata string")
return
}

if tops.GasLimit == 0 {
estimateInput := ethereum.CallMsg{
From: tops.From,
To: to,
Value: amount,
GasPrice: tops.GasPrice,
GasTipCap: tops.GasTipCap,
GasFeeCap: tops.GasFeeCap,
Data: calldata,
}
tops.GasLimit, err = c.EstimateGas(ctx, estimateInput)
if err != nil {
log.Error().Err(err).Msg("Unable to estimate gas for transaction. Manually setting gas-limit might be required")
return
}
}

var tx *ethtypes.Transaction
if *ltp.LegacyTransactionMode {
tx = ethtypes.NewTx(&ethtypes.LegacyTx{
Expand Down

0 comments on commit c8bf8cc

Please sign in to comment.