Skip to content

Commit

Permalink
fix: unsafe balance conversion (#7796)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Apr 27, 2024
1 parent 12e53e5 commit 26e6e57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2206,8 +2206,8 @@ impl EthApi {
}
// amount of gas the sender can afford with the `gas_price`
let allowance =
available_funds.to::<u128>().checked_div(gas_price).unwrap_or_default();
highest_gas_limit = std::cmp::min(highest_gas_limit, allowance);
available_funds.checked_div(U256::from(gas_price)).unwrap_or_default();
highest_gas_limit = std::cmp::min(highest_gas_limit, allowance.saturating_to());
}
}

Expand Down

0 comments on commit 26e6e57

Please sign in to comment.