-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Currently, it seems all transactions are simulated with a gas_price
of 0 gwei (base_fee_per_gas
and priority_fee_per_gas
are both set to 0). This means the LackOfFundForGasLimit EVM error is only caused by a transaction being sent with a value
that is higher than the amount of ETH held by the from
address.
It would be very useful if Temper also supported simulating with a custom gas_price
so that a simulation fails if the from
address does not have enough ETH to pay for gas * price + value
.
In this case, there would be two options.
- The easiest option to implement would probably be to just set the
gas_price
and let Foundry handle the failure, but in this case Foundry will likely use the providedgasLimit
to calculate the total gas cost, instead of the actual amount of gas used by the tx. - A nicer (but likely more difficult to implement) option would be to fail a TX when the
from
address does not have enough ETH for the amount of gas that was actually used (+ the value of the tx).
One (inefficient) way to implement this second option is by simulating the transaction twice, once with agas_price
of 0,gasLimit
set to the maximum of the block and callingcall_raw
without committing the result. The second simulation could then set thegas_price
to the one provided by the user, and set thegasLimit
to the amount of gas used in the first simulation.
If the second option is implemented, some use cases may still benefit from the option to check for the LackOfFundForGasLimit error using a user-provided gasLimit
instead of the simulated amount, which could be implemented by only running the first simulation if the user does not provide their own gasLimit
parameter. This would make the gasLimit
parameter optional.
A slight ease-of-use addition would be to automatically use the base_fee_per_gas
from the block if the user provides a priority_fee_per_gas
without explicitly providing a base_fee_per_gas
. If the user provides a gas_price
(pre- eip-1559), the base- and priority fee could be set automatically