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
Support for Block Building #1923
Comments
Duplicate of #1013, but since this is more fleshed out I will close the other issue |
Thank you Chris. Excited to start working on this soon...pinging searchers/builders to weigh in as well. |
My 2c: I don't think reth should implement a builder, but rather reth by default should provide RPC calls that make it possible to build a block without explicitly accessing the EL database. If builders want to modify reth the way geth is modified, then they're welcome to do so as well. A possible barebones API:
A few notes: The returned type is an execution payload (or a Block ethers-rs style). Based on the builder_api (https://flashbots.github.io/relay-specs/#/Builder/submitBlock), builders would then only need to fill in a few more fields easily accessible from a CL client. Beyond this, you can offer additional functionality either through separate rpc calls or flags to
|
Makes a ton of sense, thanks @jasalper. Should there also be extra parameters supplied which allow for state overrides? |
@jasalper this would certainly fit our needs, and fits relatively nicely with my suggested interface in #1013 (here). To implement the Engine API, however, I believe Reth will require the ability to build a block from its mempool? Both v1 and v2 of I think the key here is that as opposed to Geth, we can make Reth easy for people with alternative transaction selection criteria to build their own payloads (and thus be more usable as a library). |
@gakonst - I don't think the state overrides would be relevant for us specifically, but I could see |
Just an API call with transactions as input and returning a block seems entirely insufficient for building blocks that have a chance to land on mainnet. Building blocks for a slot is not an one-off task, but an ongoing effort to find the highest value block by trying (simulating) combinations of transactions and bundles (that aren't allowed to be unbundled), including new ones that arrive over time (from mempool, through The block building process would also often have more transactions available than fit into the block, and needs to decide which transactions to include or skip based on simulation results and block value. It's also important to point out that bundles need to be supported, which are a list of transactions that can either be included all together or none at all, and which must not be included if one of the transactions reverts. If an external service would need to go through this API call, it would need to be connected to the mempool, and receive bundles/private transactions through additional APIs, and would be very inefficient because of the request/response pattern, even if the API would allow for revert protection, transactions, private transactions and bundles, and even if reth would try to find the most valuable block out of all the supplied inputs while adhering to the expressed preferences. |
Let us leave it open. This issue is more discussion on API and that issue is for implementation and how it gets integrated, so there is a difference. |
@metachris - I don't think reth should be making a block builder - just adding support for external builders. I think there is a misunderstanding of what reth does in my proposal. Here, reth does not try to find the most valuable block. reth simply exposes a call that computes the block sealing values for builders that have already computed the most valuable block, and are submitting this block via a list of transactions. "Building blocks for a slot is not an one-off task, but an ongoing effort to find the highest value block by trying (simulating) combinations of transactions and bundles (that aren't allowed to be unbundled), including new ones that arrive over time (from mempool, through eth_sendBundle, etc.), and continuously submitting them to the relays." The RPC call doesn't broadcast the block anywhere. The RPC call is used to compute the state root (+ logs bloom, transactions root, etc) for a given list of transactions. An efficient block builder will not be computing these cryptographic values for any potential block, only the ones they wish to submit. In this model, builders would do their simulation via something more efficient like "It's also important to point out that bundles need to be supported, which are a list of transactions that can either be included all together or none at all, and which must not be included if one of the transactions reverts." I don't think "If an external service would need to go through this API call, it would need to be connected to the mempool, and receive bundles/private transactions through additional APIs, and would be very inefficient because of the request/response pattern, even if the API would allow for revert protection, transactions, private transactions and bundles, and even if reth would try to find the most valuable block out of all the supplied inputs while adhering to the expressed preferences." Having external builders subscribe to the txnpool to pack the block doesn't seem like a particularly big ask - everybody is doing it anyways, and if they don't wish to do it, the The builder already receives bundles/private transactions through additional APIs, so I'm not sure what the distinction is. === All of this being said, while I do like the separation of responsibilities, I do see a couple potential advantages to doing building with direct access to the db, such as the one you mentioned: "Fast multi-transaction simulation with cheap reverts, in particular reverting ethereum state to one from before a list of transactions". But, I think that stuff like this is already exposed via reth revm db bindings, and anybody who wants this level of customization/optimization in their builder will be modifying their builder extensively themselves to the point where it doesn't make sense to ask the reth team to write their builder for them. |
This issue is stale because it has been open for 14 days with no activity. |
I think we can close this given the also see integrations: https://github.com/ralexstokes/mev-rs/pull/112/files |
Describe the feature
It would be great if reth supports building blocks, and allows submitting to multiple mev-boost relays.
Based on early reth metrics, it looks like it could be several times as performant as typical geth-based block builders, and perhaps provide some nice features on top!
At Flashbots we maintain a block builder based on geth, and would be happy to support the development of this functionality in reth with our experience and learnings.
Additional context
References
payload_attributes
SSE eventPayloadAttributesV2
structureGoals
gasLimit
,feeRecipient
block.coinbase
addressblock.coinbase
) to proposer feeRecipienteth_callBundle
,eth_sendBundle
,eth_sendPrivateTransaction
([1] [2] [3]) /eth_sendPrivateRawTransaction
([1])How it works
payload_attributes
SSE event subscription to a CL client to receive information about the current slot and the required payload attributes (timestamp, withdrawals, prevRandao) which are required for the produced block.Additional notes
The text was updated successfully, but these errors were encountered: