-
Notifications
You must be signed in to change notification settings - Fork 521
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
Calculate EIP1559 gas price in JSON-RPC #1783
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mchmatt thanks for the PR, generally looks good to me.
However, WDYT about setting a gas price in the txpool_content
JSON RPC function as well (https://github.com/mchmatt/polygon-edge/blob/develop/jsonrpc/txpool_endpoint.go#L54)? I was thinking about adding this line there as well tx.GasPrice = tx.GetGasPrice(t.store.GetBaseFee())
.
Also, pay attention to the linting error and fix it, so we can merge it eventually.
I'm not sure how that would work as my understanding is that EIP 1559 TXs in the pool aren't assigned to a block yet, but maybe I'm missing something? Not really familiar with blockchain dev, sorry.
Should be fixed now, really appreciate the quick reply. |
Yes, that is correct, in the tx pool, tx is not yet included in the block. And since the Blockscout indexes only blocks, then we should be ok with your approach. You have my approval. 🙂 |
Please accept this pull request we have big problems with blockscout |
We are going to merge this PR, although we have noticed that the |
Description
Tools like https://github.com/blockscout/blockscout operate under the premise that field "gasPrice" will be present even if the TX is an EIP 1559 type, and thus don't work correctly when connected to Polygon-Edge's RPC.
This PR calculates the gas price on the fly for requests done to the RPC, through the existing function GetGasPrice.
Changes include
Additional comments
This fixes issues blockscout/blockscout#8128 and blockscout/blockscout#8130. All other RPCs I have tested (Llama RPC, Alchemy, Ankr) include the gasPrice field for EIP1559 transactions.