Closed eduadiez closed 1 year ago
@eduadiez we already have in place a mechanism to accept a transaction when the estimation fails and a forced gas amount is set.
here is the config: https://github.com/0xPolygonHermez/zkevm-node/blob/3a4aa63a8baaee4e70b62db19ccb2977d85bcaf2/ethtxmanager/config.go#L16-L17
here is the code using it: https://github.com/0xPolygonHermez/zkevm-node/blob/3a4aa63a8baaee4e70b62db19ccb2977d85bcaf2/ethtxmanager/ethtxmanager.go#L76-L90
Theoretically, setting the ForcedGas
config parameter would be enough to make the code to be able to continue in case a problem happens to the transaction gas estimation.
Do you think we still need something else?
I'll be adding a test to make sure this scenario is covered and working as expected.
Rationale
Sometimes it may happen that when the EthTxManager tries to estimate a transaction it will result in a revert, so it will not be published in L1. Normally this happens due to an issue on with the SmartContract, for instance a permission issue or that it does not fulfill some of the requirements that the SmartContract has.
It would be very helpful to be able to force these transactions to be published in L1 despite knowing that they will revert since this helps debugging from the SmartContract side.
Implementation
With a flag in the config that allows this to happen would be enough,
forceRevertedTxs
, or something like that.This by default has to be set to false, and should only be enabled at particular times when we need to debug an specific tx.
As an extra measure of protection could be also to add the hash of the transaction in the config, so that only the indicated one is forced, avoiding that more transactions are published since generally one is enough, and thus avoid spending unnecessary gas.