What’s going on here, is that by default, the bor nodes that process Polygon transactions will turn away transactions that use more than a certain amount of gas. The node is forked from go ethereum, where the default behavior is to turn away transactions that use more than 1 ether in gas (I’d assume this is 1 MATIC in your case).
There’s two things that might be happening here:
You’re sending way more gas than you need to be for the transaction. This can happen if you’ve hard coded in a gas value that exceeds this limit.
The transaction that you’re calling to is using more gas than the nodes by default are willing to accept.
In the stack exchange post you mentioned, one of the solutions is to change --rpc.txfeecap on the node side; this is here to make sure that public facing nodes don’t get spammed with transactions that use too much compute. That is a setting that individual node runners have the ability to change if they would like, but it’s safe to assume that nodes are going to be using this value of 1.0 as the default. This is something that Pocket has no control over.
If you could give some more detail about how you’re trying to construct the transaction in ether.js, and what method you’re trying to call on the smart contract, it should be easier to narrow down between the two above scenarios. If it’s 1, that’s something that can be addressed on the ether.js side, and if it’s 2, that’s something that would likely have to be addressed on the EVM/solidity side.
I think my code works fine and I really need more gasCost than 1 matic.
I’m using paraswap to swap tokens, which can be heavy sometimes, it’s easy to use 1000 000 gas.
With the recent gas price surge on Polygon, gas price can be 1000 gwei ( it’s 500 right now).
In a case like this, gasCost reaches 1 matic.
“that’s something that would likely have to be addressed on the EVM/solidity side.”
I don’t really know what can I do to bypass this problem, I might switch to BSC instead.
Given your case, unfortunately there’s not much that you can do to get your transaction through here besides wait for your gasCost to drop below 1 MATIC.
I’ve filed an issue to bring attention to the Polygon devs about the issue you ran into here.