Description
Problem
-
When querying block 137207 via
curl https://mainnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x217F7", true],"id":1}' | jq
, we noticedbaseFeePerGas
as 1; -
Given the transaction in the block above
0x5e682022ab7291ea4e0e8eb53ab4046e0275be337fe662d219295807d0b58573
, whichtype = 0
, we query it viacurl https://mainnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x5e682022ab7291ea4e0e8eb53ab4046e0275be337fe662d219295807d0b58573"],"id":1}' | jq
, to find out that itsgasPrice = 0
; -
Assuming the blocks are post EIP-1559, we are splitting the calculated fees between base and priority, even though this is a tx whose type is 0 ;
-
According to my understanding, under EIP-1559, legacy transactions are normalized(based on the func
normalize_transaction
from the specs), meaning that this tx normalized version also contains the fieldmax_fee_per_gas
that's equal to the tx'sgasPrice
; -
Also, based on the EIP-1559, we have some assertions, one of which is
assert transaction.max_fee_per_gas >= block.base_fee_per_gas
, thus ensuring that the user was willing to pay at least the base fee that has been indicated at the block; -
We can conclude from this tx, however, that the block's base fee per gas is higher than the transaction gas price, thus if we follow the EIP-1559, we would get a negative priority fee, considering the part of the EIP's code where
priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)
;
Based on the facts above, I'd like to ask the team if this is an issue. Additionally, I'd like to know how Flow EVM calculates its transaction fees, whether it follows these assumptions from EIP-1559, and whether there is any further consideration I should also take for granted.
Acceptance Criteria
Priority fee should be non-negative;
Context
When breaking down a transaction's fee into base and priority fees, the priority fee is getting negative values when applying the specs and calculations from EIP-1559 with instances of values mentioned above;