Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(levm): change gas to return in
post_execution_changes
(#1464)
**Motivation** We have a problem when we need to refund the senders gas but it is too high. **Description** This PR address an issue where we fail with `InternalState` error due to an overflow when multiplying a very large number of `gas_to_return` by `gas_price`. The overflow occur because the `u64` type cannot handle the new value. I change the name of the variable to something that is more related to what it does: `gwei_return_amount`. Since this gas is what we are going to add to the balance, it converts to `gwei` and we use `U256` ```rust let gwei_return_amount = self .env .gas_price .checked_mul(U256::from(gas_to_return)) .ok_or(VMError::Internal(InternalError::UndefinedState(1)))?; self.increase_account_balance(sender_address, gwei_return_amount)?; ```
- Loading branch information