onflow / flow-evm-gateway

FlowEVM Gateway implements an Ethereum-equivalent JSON-RPC API for EVM clients to use
https://developers.flow.com/evm/about
Apache License 2.0
11 stars 9 forks source link

Use the proper value for `EffectiveGasPrice` #355

Closed m-Peter closed 1 month ago

m-Peter commented 2 months ago

As described in https://docs.infura.io/api/networks/ethereum/json-rpc-methods/eth_gettransactionreceipt:

effectiveGasPrice: The actual value per gas deducted from the sender's account. Before EIP-1559, equal to the gas price.

Currently we use the gas price the sender is willing to pay (https://github.com/onflow/flow-evm-gateway/blob/main/models/receipt.go#L158), which is not necessarily the charged value. We need to be using the gas price that was charged for a given transaction.

Using the gas price that is set by the EVM Gateway operators, at the time the transaction was processed, is also not sufficient, as different EVM Gateway operators, will set different gas prices.

Most likely, this value has to be included in the payload of EVM.TransactionExecuted event.

m-Peter commented 2 months ago

cc @sideninja @ramtinms

ramtinms commented 1 month ago

Since we don't have any basefee on the network the effective gas price is always with this formula Min(GasTipCap, GasFeeCap)

ramtinms commented 1 month ago

hmm, I don't EVM Gateway operators can set any value, basically they can ignore transactions that has GasTipCap below their target. so anyway the effective gas used by transactions can be computed using the formula I mentioned.