fee-suggestions icon indicating copy to clipboard operation
fee-suggestions copied to clipboard

Question on error when running on polygon

Open TatisLois opened this issue 3 years ago • 5 comments

This is a great lib! I was wondering if this utility supports polygon mainnet?

When I import this library and use it to get suggestions for tx on polygon (as a provider) an error is throw with

node_modules/@rainbow-me/fee-suggestions/dist/index.js:133
                        throw new Error('Error: ema was undefined');

An example implementation

const provider = ethers.getDefaultProvider('https://polygon-mainnet.infura.io/v3/008a971363b748c7bdfb80bfe3df977e');
feeSuggestions.suggestFees(provider).then(console.log);

even stranger is that it works on the mumbai test net. Any clarity or support would be appreciated. Thank you

TatisLois avatar Jan 25 '22 06:01 TatisLois

Hey mate, I believe this only work on the eth chain as it using EIP-1559 and the basefee math I could be wrong tho!

cybercorey avatar Mar 18 '22 01:03 cybercorey

Hey mate, I believe this only work on the eth chain as it using EIP-1559 and the basefee math

I could be wrong tho!

Good point, I believe polygon is also on EIP-1559 now so I was hoping it would have worked all the same.

TatisLois avatar Mar 23 '22 03:03 TatisLois

Any workarounds? We have the same issue.

kraikov avatar Jun 23 '22 12:06 kraikov

Hi,

I took a look to see if there was a quick win in this regard, but there are some barriers to using this for polygon. We currently don't have capacity to exhaustively test these changes since there is significant data analysis that needs to be done on retroactive data:

Immediate issues that would need to be fixed:

  • getOutlierBlocksToRemove currently has a hardcoded 5 gwei cutoff for priority fees which would need to be updated to use quantiles, median absolute deviation, or a more appropriate statistical function for outlier detection
  • suggestMaxPriorityFee looks at only the past ten blocks which does not work for polygon due to higher block production

welps avatar Nov 22 '22 19:11 welps

Hey,

any update on this? Why is there a hard-coded limit of 5 gwei? Here is a reproduction code, with a block that has only rewards above 5 gwei

const provider = new providers.JsonRpcProvider("https://rpc.ankr.com/gnosis");
await suggestMaxPriorityFee(provider, "28704700");

benjlevesque avatar Jun 30 '23 10:06 benjlevesque