Problem

Beanstalk is currently overpaying for Sunrise function calls. We propose changing the base incentive for Farmers to call the Sunrise function

Proposed Solution

gasUsed = min(deltaGas + GAS_OVERHEAD, MAX_SUNRISE_GAS)
gasFee = blockBaseGasFee + PRIORITY_FEE_BUFFER

sunriseReward = max(min(gasFee * gasUsed * beanEtherPrice + BASE_REWARD, MAX_REWARD), MIN_PAYOUT)

Where:


Rationale

This solution seeks the mathematically minimize the number of Beans that Beanstalk needs to pay for the sunrise() call.

The cost to execute a sunrise() transaction in Beans is:

gasUsed * (baseGasFee + priorityFee) * beanEthPrice

This solution computes an on-chain estimation of the above formula function while adding sufficient tunable parameters to properly account for estimation error and potential manipulation.