livepeer / go-livepeer

Official Go implementation of the Livepeer protocol
http://livepeer.org
MIT License
546 stars 170 forks source link

Implement a solution to account for highly state dependent gas usage fluctuations in transactions #2081

Open yondonfu opened 2 years ago

yondonfu commented 2 years ago

The gas usage of all smart contract functions are state dependent. But, some functions are more state dependent than others. It is possible that the ones that are more state dependent can consume a non-trivial amount of additional gas if the state of the contract changes in a certain way in between the time that the node runs gas estimation for the transaction and the time that the transaction is actually mined. The greater the gas usage difference the higher the probability of the transaction running out of gas.

We should implement a solution that betters accounts for this to make sure that non-reverting transactions never run out of gas.

0xVires commented 2 years ago

Will this be fixed with the migration to Arbitrum? I've had 3 "out of gas" failed txs during the last 7 rounds while automatically claiming the reward -> Currently, daily monitoring of the reward call is required if you don't want to miss out on the rewards.

leszko commented 2 years ago

@ArcAster @yondonfu Do we still want to work on this since the migration to Arbitrum helped a lot when it comes to gas prices.

0xVires commented 2 years ago

I never had any "out of gas" issues since the Arbitrum migration. Gas limit vs gas used is quite constant at around 88-89%, so it looks like the estimation has become better/easier

yondonfu commented 2 years ago

I think it makes sense to icebox this for now and if it comes up again we can move it back to the backlog.