-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Removing polygon gas station #4670
Comments
I'm all for this, but can I get some feedback from Polygon (or do you work with Polygon)? That change was co-ordinated with them directly... Trying to find the Telegram conversation to forward this issue to them for further comment... |
@ricmoo Reasons to remove their API endpoint is that 1. EIP-1559 works without centralized gas oracle API 2. Their API endpoint has blocked Tor endpoints which makes my wallet implementation useless on Tor. 3. Their API is slower than public polygon nodes. So we could move forward to remove the endpoint it would be great and thus we can remove another centralized resources being relied by ethers.js. |
The reason it was added though is because the Polygon implementation of EIP-1559 doesn’t operate like the Ethereum network; the base fee doesn’t float with the protocol defined value (I believe in an attempt to keep fees low), so the priority fee is used to mimic the classic fee market, which is why the price oracle was added (again, at their request ;)). As a result transactions would consistently fail during network congestion. If this has changed though, I’d be thrilled to remove it. I’ve reached out to them and sent a link to this issue for comment. ;) You can of course experiment with no price oracle by creating the Network instance sans the oracle plug-in, which will behave exactly like a standard EIP-1559 network, but unless there have been protocol changes, I suspect transactions will fail during times the priority fee is under turmoil… |
Here is the original issue with some additional context. |
@ricmoo Ah I think I would end up running my own gas station API do you know how to replace the existing network plugins maybe initing new Network object would be the only answer? |
Ah you already told me here thank you. |
This should get you started for your own custom implementation of a Gas Station: import { FetchUrlFeeDataNetworkPlugin } from "ethers";
const customFeeDataPlugin = new FetchUrlFeeDataNetworkPlugin("https://my-gas-station.com", (defaultFunc, provider, request) => {
// An example
// Get the standard values that would otherwise be returned without this plugin
let { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = await defaultFunc();
// If your URL returns { maxPriorityFee }
maxPriorityFee = BigInt((await request.send()).maxPriorityFee);
// Return the fee data
return { gasPrice, maxFeePerGas, maxPriorityFeePerGas };
});
const network = new Network(name, chainId);
network.attachPlugin(customFeeDataPlugin);
// Now you can use this network object in a Provider; and if your network is static (the underlying
// network cannot change), enable those optimizations
const provider = new JsonRpcProvider(url, network, { staticNetwork: network }); |
@ricmoo Ended up coding an operating an on-chain mirror of the gas station myself which could be retrieved from any running polygon nodes without being blocked by cloudflare https://polygonscan.com/address/0xf81a8d8d3581985d3969fe53bfa67074adfa8f3c#readContract https://github.com/tornadocontrib/gas-price-oracle/blob/main/example/index.ts#L43 Using multicalls it is even much faster than before as well Generally inspired by the Chainlink's on chain oracle btw https://data.chain.link/feeds/ethereum/mainnet/fast-gas-gwei. Updates for every 25% gas price change or in 2 hour basis. I think we should keep following the spirit of the decentralization though. |
That’s a cool idea. You should reach out to Polygon and see if they would incorporate it (and possible manage the oracle themselves) into their official tool chain. :) |
Ethers Version
latest
Search Terms
No response
Describe the Problem
Have experienced numerous times of the polygon gas station API not responding or blocked and considering that we now have maxPriorityGas opted in we should be removing it and rely on the node data instead of the centralized API
Also related: #4320
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: