EnsoFinance / temper

Temper your expectations - Ethereum Transaction Simulator
MIT License
343 stars 43 forks source link

Simulating with a custom gas price #28

Open Denzel-Haverkamp opened 8 months ago

Denzel-Haverkamp commented 8 months ago

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.

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