-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Stream best blocks to the relay instead of pushing them #277
Draft
SkandaBhat
wants to merge
27
commits into
flashbots:develop
Choose a base branch
from
SkandaBhat:best-block-store
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SkandaBhat
changed the title
Stream best blocks to the relay instead of pushing them
[WIP] Stream best blocks to the relay instead of pushing them
Dec 11, 2024
Benchmark results for
|
Date (UTC) | 2024-12-13T09:57:25+00:00 |
Commit | 6446e089e874beaeea353f1838d545f9bea4388a |
Base SHA | 16290b62a7b1a7693b04589ce403013bee09b20b |
Significant changes
Benchmark | Mean | Status |
---|---|---|
MEV-Boost SubmitBlock serialization/JSON encoding | -35.40% | Performance has improved. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
Use a block store that keeps track of the single best block at all times and streams it to any subscriber: https://github.com/SkandaBhat/rbuilder/blob/82f3d829ad4e9787847c66cb9cc157d22bad57dc/crates/rbuilder/src/building/builders/best_block_store.rs. Also added tests for both the store and tracker.
added a helper function on
Block
that helps keep the comparing logic more readable: https://github.com/flashbots/rbuilder/compare/develop...SkandaBhat:best-block-store?expand=1#diff-3349e9f2b5d24a3da06ac[…]1334cc81518f9090a131c9dR47. This is used in best_block_storeIn relay_submit, we now subscribe to best_block_store and process best blocks as and when they arrive. BlockBuildingSink and BlockBuildingSinkFactory is not needed anymore here and we now call RelayCoordinator: https://github.com/flashbots/rbuilder/compare/develop...SkandaBhat:best-block-store?expand=1#diff-1ab827716722c4d9c2be8[…]19983e2a53a4c54b2553bf3cf0
In bid maker, we call try_and_update on the tracker, which checks if the block is better than the global best block, and if so, updates it on the global best block store: https://github.com/flashbots/rbuilder/compare/develop...SkandaBhat:best-block-store?expand=1#diff-be9eab4716937ef12a623[…]dfb88b7571d7f82e54c23eR131
UnfinishedBlockBuildingSink and UnfinishedBlockBuildingSinkFactory can be decoupled from BlockSealingBidder and the Sink can be entirely removed in favour of the new architecture, making the end to end process simpler.
💡 Motivation and Context
We have a push-based architecture for block building right now, where each builder runs a building algorithm and pushes blocks to a Sink, which sorts the blocks and submits the best block in a loop. This causes unnecessary flooding of the sink with low value blocks and additional overhead for the sink to sort every block it receives.
We can instead have a global best block store that stores a single best block at all times, and stream updates to any subscriber. This way, the relay sink can react immediately to updates from the store, and the builders can push best blocks only when they have a block that has a higher bid value than the global best block, thereby keeping the channel only for new best blocks found.
Overview
✅ I have completed the following steps:
make lint
make test