I have an autotask that occasionally sets too low of a gasLimit, causing the txn to fail due to running out of gas. Example failed transaction
Code snippet:
let tx = await checkpointerContract.connect(signer).checkpointGaugesOfTypesAboveRelativeWeight(typesToCheckpoint, CHECKPOINTING_THRESHOLD, {value: ethers.utils.parseEther(MAX_ETH_TO_BRIDGE)});
As you can see, I'm not manually setting the gas limit. I suppose under the hood an RPC node is queried for an estimated cost and gasLimit is set to (1+alfa) * estimate with alfa = 0.1 or something.
Questions:
What is the value of alfa?
Can I set the value of alfa?
I know I can do this manually with estimateGas but was hoping a more elegant/native solution might exist?
We attempt to set the gas price of a transaction to be about 2.2x the cost of the estimate to ensure it's included within the next minute. Of course, this may still be insufficient with high network activity.
Hi @markusbkoch apologies for the delayed response here. In terms of the gas limit setting, essentially under the hood we're doing an estimateGas call with an added 20% bump when configuring the gas limit for transactions. There's no way to configure the added bump or alfa parameter, but if this is a feature you'd like to see please let us know! For now, the best solution would be to configure the gasLimit parameter on your transactions to be estimateGas * 1.35 or something like that to ensure the transaction is processed more reliably.