Skip to content

Commit

Permalink
fix(anvil): treat 0 basefee as constant (#5163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir authored Jun 15, 2023
1 parent 58771c8 commit fca0a6c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions anvil/src/eth/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ impl FeeManager {
gas_limit: U256,
last_fee_per_gas: U256,
) -> u64 {
// It's naturally impossible for base fee to be 0;
// It means it was set by the user deliberately and therefore we treat it as a constant.
// Therefore, we skip the base fee calculation altogether and we return 0.
if self.base_fee() == U256::zero() {
return 0
}
calculate_next_block_base_fee(
gas_used.as_u64(),
gas_limit.as_u64(),
Expand Down

0 comments on commit fca0a6c

Please sign in to comment.