Skip to content

EIP-1559 RPC changes #22834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 48 commits into from
Closed

EIP-1559 RPC changes #22834

wants to merge 48 commits into from

Conversation

lightclient
Copy link
Member

This branch contains EIP-1559 specific changes to the RPC, specifically:

  • eth_gasPrice
  • dynamicFeeTx can be displayed in RPC response
  • effectiveGasPrice is computed on-the-fly for eth_getTransaction*
  • add baseFee to RPC headers

A few things that haven't been addressed yet:

  • eth_estimateGas does not account for dynamicFeeTxs effective gas price vs. EOA balance
  • gas price oracle does not gracefully handle 1559 fork, it naively finds the median gas price of the previous n blocks

@holiman
Copy link
Contributor

holiman commented May 17, 2021

Trying to submit a transaction to baikal on this PR, I get

WARN [05-17|13:20:37.421] Served eth_sendTransaction               reqid=22 t=2.90379ms  err="tip higher than fee cap"

This happens when nothing is specified,

runcode = function(code){
   tx = {from: eth.accounts[0], input: code}
   eth.sendTransaction(tx)
}

@holiman
Copy link
Contributor

holiman commented May 17, 2021

Hm, also,

> runcode("0x61efef6000526010601ff3")
Error: invalid code: must not begin with 0xef
	at web3.js:6347:37(47)
	at web3.js:5081:62(37)
	at baikal.js:5:23(20)
	at <eval>:1:8(2)
> 
runcode = function(code){
   tx = {from: eth.accounts[0], input: code, tip:"0x1", feeCap: "0x10"}
   eth.sendTransaction(tx)
}

It's quirky that it won't allow me to create the tx in that case

adietrichs and others added 16 commits May 17, 2021 15:48
* replace GasPriceCmp and GasPriceIntCmp with FeeCapCmp, FeeCapIntCmp, TipCmp, TipIntCmp (and update all usages)
* update Cost to use FeeCap instead of GasPrice
* add eip1559 status indicator
* add DynamicFeeTx to transaction type check
* remove underpriced transactions on minimum miner tip increases
* require both a fee cap and tip bump for transaction replacement
* use tip as secondary comparison criterion for priceHeap sorting
@lightclient
Copy link
Member Author

lightclient commented May 17, 2021

It appears the issue is that because there are no txs for the gas price oracle to use to calculate a good tip, it uses the client default (1000000000) which is much higher than the recommended feeCap of 0x0a (2x the last block baseFee).

There seems like there are a couple simple ways to resolve this:

  • tip = min(estimatedTip, feeCap)
  • feeCap = max(x*parent.BaseFee(), tip)

I think setting the tip to the minimum of the either the estimatedTip or the feeCap is the weaker of the two. IIUC, the gas price oracle's goal is to return a value that will give a tx a "very high chance of being included in the following blocks". Basing the estimation around the tip makes the most sense in this case, because that is the best correlating factor for determining how quickly the tx will be included. The first solution will work in all cases except where the estimated tip greatly exceeds the feeCap. In that case, the tip will be capped by the feeCap.

The second solution will work in all cases, always returning a value to the caller that is likely to have their transaction included very soon. In the case of the Baikal, it would send a tx with a feeCap = tip = 1000000000, since that is the default minimum value configured.

@lightclient
Copy link
Member Author

lightclient commented May 18, 2021

It's quirky that it won't allow me to create the tx in that case

It seems like that behaviour is consistent with other fatal vm errors. Does it make sense to make an except for this?

@@ -1156,6 +1178,12 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
"transactionsRoot": head.TxHash,
"receiptsRoot": head.ReceiptHash,
}

if head.BaseFee != nil {
result["baseFee"] = (*hexutil.Big)(head.BaseFee)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result["baseFee"] = (*hexutil.Big)(head.BaseFee)
result["baseFeePerGas"] = (*hexutil.Big)(head.BaseFee)

@holiman holiman mentioned this pull request May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants