jito-foundation / stakenet

Jito StakeNet
https://www.jito.network/stakenet/
Apache License 2.0
50 stars 19 forks source link

Feature: store validator staking APY in the ValidatorHistoryAccount #9

Open buffalu opened 9 months ago

buffalu commented 9 months ago

Is your feature request related to a problem? Please describe. It's not possible to compute the APY for a validator on-chain, but it should be possible with StakeNet and other contextual information that StakeNet can handle.

Describe the solution you'd like In each validator's ValidatorHistoryAccount, store the staker APY for the validator given the validators commission, vote credits, epoch length, and any other variables required to compute the epoch. It probably makes sense to just store the current epoch's APY and do some averaging over the last N epochs using the circular buffer.

It may also make sense to add information about historical epochs to this program, such as the epoch start slot, start time, end slot, and end time. It makes sense for the stake_authority to handle as an administrator unless its fields already available on-chain. If there is other information that's needed that isn't available, one can create instructions for those accounts as well.

It may also be desirable to include the validator's MEV in the APY as that may be a significant contributing factor to a validator's staking APY. This can be leveraged by combining #6 with the validator's MEV commission also stored in the validator history account.

buffalu commented 8 months ago

related #18