Skip to content

Commit

Permalink
feat(update-validator-rewards): use median instead of avg
Browse files Browse the repository at this point in the history
most proposers, even bigger companies will earn closer to the median
than the average.
  • Loading branch information
alextes committed Dec 3, 2024
1 parent 5e6d772 commit 4f3b014
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/bin/update-validator-rewards/mev_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ pub async fn calc_mev_reward(
) -> Result<ValidatorReward> {
let mev_per_slot: EthNewtype = sqlx::query!(
"
SELECT AVG(bid_wei)::TEXT
SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY bid_wei)::TEXT AS median_bid_wei
FROM mev_blocks
WHERE timestamp > NOW() - INTERVAL '6 months'
"
)
.fetch_one(executor)
.await
.unwrap()
.avg
.median_bid_wei
.context("expect at least one block in mev_blocks table before computing MEV reward")?
.parse::<WeiNewtype>()
.context("failed to parse MEV per slot as Wei")?
Expand Down

0 comments on commit 4f3b014

Please sign in to comment.