Skip to content

Commit 26e6e57

Browse files
authored
fix: unsafe balance conversion (#7796)
1 parent 12e53e5 commit 26e6e57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/anvil/src/eth/api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,8 +2206,8 @@ impl EthApi {
22062206
}
22072207
// amount of gas the sender can afford with the `gas_price`
22082208
let allowance =
2209-
available_funds.to::<u128>().checked_div(gas_price).unwrap_or_default();
2210-
highest_gas_limit = std::cmp::min(highest_gas_limit, allowance);
2209+
available_funds.checked_div(U256::from(gas_price)).unwrap_or_default();
2210+
highest_gas_limit = std::cmp::min(highest_gas_limit, allowance.saturating_to());
22112211
}
22122212
}
22132213

0 commit comments

Comments
 (0)