Improve builder profit estimation by taking bid adjustments into account#55
Improve builder profit estimation by taking bid adjustments into account#55ababino wants to merge 24 commits intoflashbots:mainfrom
Conversation
| round(PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY CASE WHEN coinbase_diff_eth IS NOT NULL THEN coinbase_diff_eth ELSE 0 END), 4) as median_profit_per_block, | ||
| round(sum(CASE WHEN coinbase_diff_eth IS NOT NULL THEN coinbase_diff_eth ELSE 0 END), 4) as total_profit, | ||
| round(abs(sum(CASE WHEN coinbase_diff_eth < 0 THEN coinbase_diff_eth ELSE 0 END)), 4) as total_subsidies | ||
| FROM adjusted_payloads |
There was a problem hiding this comment.
This query worries me a little bit -- how much more expensive is it to run? Not sure if this could be a bottleneck. Do you have any data or estimates on query performance?
|
@metachris I made some changes:
Regarding the performance of the new query, I ran it with 1 day of data, and these are the stats (I used New query: So, we are talking about 2x slower and 2x more memory. I don't know what our hardware requirements are. If we need more performance, we'd have to change the way we store the data, so we move the computation from query time to data fetching time. Let me know how we should proceed. |
📝 Summary
cmd/core/bid-adjustments-backfill.goto fetch bid adjustments from ultrasound relay.GetBuilderProfitsindatabase/database.go. Now, if the slot is a bid-adjusted-slot, the query will subtract the validator profit from coinbase_diff.⛱ Motivation and Context
Builder profit is not accurate when bids are adjusted by ultrasound relay.
✅ I have run these commands
make lintmake testgo mod tidy