Problem with the YearnV1EarnKeep3r Job?

Hi Andre,

First, thank you for all your wonderful contributions!

I have been running a keep3r against the YearnV1EarnKeep3r job. It was quiet for a while (no work), but then last night I started getting transaction errors calling the work() function every minute or so. Each failed with an out of gas error (999,181 gas used from 1,000,000 gas limit) and they cost me roughly $10 each for gas fees. It drained my wallet before I was able to stop it. Not a huge amount of money, but not the best outcome either.

I want to find out what I did wrong, if anything, and how to avoid this in future, as I want to fully embrace the zero maintenance philosophy of Keep3r.

I can provide more details in a PM.


1 Like

In the Eth virtual machine, you need to allocate a high enough gas limit to run a tx. Because of the concept of gas refunds, sometimes the required gas limit to finish a tx without an out-of-gas error is much higher than the gas that will actually be used. In your gas, your gas limit was too low.

Also, I recommend adding some backstops to your code so that if you fail a tx, you don’t try again for some time. That way you don’t get drained like that.

I suggest upping your gas limit. You can manually pass a higher gas limit or adjust the algorithm used to calculate a proper one.

1 Like

Thank you for your response, kx9x. I can certainly increase, and looking at some of the existing transactions that have succeeded, they are using a 2.5x higher limit. I’ll adjust.

@kx9x I ran with a higher limit, but now the transaction fee cost me more than the KP3R rewarded. That doesn’t seem right?

I see a similar situation with the new Uniswap Sliding Oracle job from someone else’s transaction:

The reward helper was just adjusted 10 hours ago or so to use the pricing oracle for KP3R/WETH, Andre is tuning the parameters for both that and the gas price calculation.

See here Working not profitable after helper update - Projects / Keep3r -