ethereum / staking-launchpad

The deposit launchpad for staking on Ethereum 🦏
Creative Commons Zero v1.0 Universal
278 stars 198 forks source link

Deposit out of gas errors and gas estimate #674

Open hwwhww opened 11 months ago

hwwhww commented 11 months ago

Thank @parithosh and users for helping report it.

Issue

Issue on Holesky:

A lot of deposits are randomly failing via the official launchpad due to Warning! Error encountered during contract execution [out of gas] https://holesky.etherscan.io/address/0x4242424242424242424242424242424242424242 example txn: https://holesky.etherscan.io/tx/0xda360eb53f1d55afedde9077120a8a278ad692364b641462514eed182462cf62 I also looked at other transactions on the contract and it seems that other users have also been observing this behavior for a few days

Issue on Mainnet:

I checked the deposit txs since January 1st, 2023, and there are 32 similar cases by 4 different senders. For example: https://etherscan.io/tx/0x1f0058046a81d08edcf2c6cd720836434269ee22121e5425311f760451feb0ca

Note: not sure if they used launchpad or other tools

Potential cause

From my poor Dapp experience and code trace, I think Launchpad doesn’t set a specific gas limit, so it is using the eth_gasEstimate RPC call result to set the gas limit.

The deposit contract FV report said the best-to-worst gas cost is between [46162, 157642].

A hypothesis

I suspect the gas estimate was inaccurate when deposit call congestion happened because the TX ordering was unknown; therefore, the user may get out of gas error. Does that make sense?

However, in my previous deposit on Holesky launchpad (via metamask, see here), the gas limit was much larger than the gas used.

/cc @CarlBeek @wackerow for consulting 🙏

parithosh commented 11 months ago

Also thanks to @roblinkriver for raising the issue initially :)