Polygon-SDK accepts transactions with an invalid gas limit as valid transactions #294
-
Polygon-SDK accepts transactions with an invalid gas limit as valid transactionsDescriptionDuring our internal testing we notice that if we submit a transaction with an invalid gas limit (this was done on purpose) to a blockchain created using Polygon-SDK the transaction is accepted by the blockchain and added to the tx pool. Later when the method This poses a problem, because the transaction is silently discarded applications that use the blockchain (like metamask) will not be able to receive a confirmation for this transaction meaning that the transaction will be "forever pending". This exact use case doesn't happen in an ethereum test network like the Rinkeby Test Network. The ethereum blockchain validates the gas limit before adding the transaction to the tx pool and returns an appropriate error to the application interacting with the blockchain (like metamask). Attached is a video that shows this test using the Rinkeby Test Network and a blockchain created using the Polygon-SDK. Your environment
Steps to reproduceVideo that shows the use cases in the issue description https://1drv.ms/u/s!AvhuC05QeOJntn9-aiUsXaKgKqZN Expected behaviourWe believe the Polygon-SDK should behave similar to the ethereum blockchain and return an error when we submit an invalid transaction. Actual behaviourThe Polygon-SDK accepts a transaction with an invalid gas limit as a valid transaction unlike the ethereum network. LogsLogs from Polygon-SDK:
Proposed solutionMaybe do something similar to go-ethereum where they have the check in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey @AzulPretoBranco, Thank you for reaching out. So far what you've described is normal behavior - the transaction is accepted into the TxPool of the Polygon SDK but is discarded when it is attempted to be applied. This is because block limits are enforced during transaction execution when the block is being built, and not at the point where you're adding the transaction - which may or may not succeed for whatever reason. The reason block limits are not checked in transaction addition is because these are consensus specific - the TxPool shouldn't care about whether or not the transaction can be executed if it passes the basic checks to be in the pool in the first place. Apps like Metamask, or any web3 providers in general query the transaction by hash or attempt to get the receipt of the transaction after submitting it, and update their own status according to the responses. I'll sync with the rest of the team so we can find an optimal solution to this pending transaction status in MM. I'll keep you posted on this, moving this to a discussion since it's not necessarily an issue with the Polygon SDK, but rather a feature request 👍 |
Beta Was this translation helpful? Give feedback.
-
what token do you use for paying gas on "polygon edge" blockchain you created? |
Beta Was this translation helpful? Give feedback.
Hey @AzulPretoBranco,
Thank you for reaching out.
So far what you've described is normal behavior - the transaction is accepted into the TxPool of the Polygon SDK but is discarded when it is attempted to be applied.
This is because block limits are enforced during transaction execution when the block is being built, and not at the point where you're adding the transaction - which may or may not succeed for whatever reason.
The reason block limits are not checked in transaction addition is because these are consensus specific - the TxPool shouldn't care about whether or not the transaction can be executed if it passes the basic checks to be in the pool in the first place.
Apps like Metamas…