jito-foundation / stakenet

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

Feature: Add the MEV earned per epoch in the ValidatorHistoryAccount #6

Open buffalu opened 7 months ago

buffalu commented 7 months ago

Is your feature request related to a problem? Please describe. The ValidatorHistoryAccount should track the MEV earned per epoch for every validator on-chain. This allows one to determine the MEV / stake amount on-chain to determine how much MEV relative to stake every validator is receiving.

Describe the solution you'd like The MEV earned every epoch is stored in the TipDistributionAccount, a PDA owned by the tip distribution program. After the merkle root is uploaded, the max_total_claim field can be referenced to find the total amount of MEV earned by the validator for a given epoch.

This can likely be copied over to the ValidatorHistory account in a modified version of the update_mev_comission instruction, which loads the tip distribution account. There would be a slight change to relax the epoch constraint and pass in the epoch as instruction data and ensure the MEV tips update the ValidatorHistoryAccount for the correct epoch.

In fact, it may be worth it to relax the epoch constraint on the update_mev_comission instruction as well to allow one to backfill missed epochs.

thearyanag commented 7 months ago

hey @buffalu , I'd like to work on this, can you please assign me?