-
Notifications
You must be signed in to change notification settings - Fork 742
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
Builder flow for Deneb & Blobs #4428
Builder flow for Deneb & Blobs #4428
Conversation
- Handle new Deneb BuilderBid response from builder endpoint (new BlindedBlobsBundle type) - Build BlockContents response (containing kzg_commitments, proof and blinded_blob_sidecars)
…ting `BlobSidecar` related types to support blinded blobs.
Hey @realbigsean @pawanjay176 @ethDreamer I've introduced an This PR is not complete, but it would be great to get some feedback on the generic parts of it for now, as it would have quite a bit of impact on the implementation. I think it would be good to look at these types: lighthouse/consensus/types/src/blob_sidecar.rs Lines 21 to 29 in 59fb1af
lighthouse/consensus/types/src/signed_blob.rs Lines 32 to 40 in 59fb1af
lighthouse/common/eth2/src/types.rs Lines 1280 to 1284 in 59fb1af
lighthouse/common/eth2/src/types.rs Lines 1358 to 1366 in 59fb1af
I've also maintained some aliases to existing types for readability, and it also allows me to make less changes to existing code: lighthouse/consensus/types/src/signed_blob.rs Lines 43 to 46 in 59fb1af
Let me know your thoughts 🙏 |
I'm going to do the remaining tasks in a separate PR to keep the PR size manageable (already quite big!):
|
produceBlindedBlock
endpoint updates
produceBlindedBlock
endpoint updatesproduceBlindedBlock
endpoint response
Nice work Jimmy!
Well, in my mind, you may have opened up a can of worms here. I think it's worth pausing and considering the best way forward for achieving polymorphism in this case. There are 2 options:
I found some background from this article on this subject. The author tends to lead towards enums, and I suspect they would even more if they used Originally @realbigsean created the Now it could be the case that either implementation leads to complex code once you have to abstract across two dimensions. But the experiment hasn't been run, and this is perhaps an opportunity to consider if we want to run that experiment. I suspect if we tried the enum route then maybe some of the enums you've created to encapsulate the dual behavior might no longer be necessary/be written in a cleaner way. If we do try it out with enums, and then in some future fork there is a change to the If we decide to continue with traits for blinded sidecars, then I suggest the I'm interested to hear if other people have thoughts on this :) |
Hey Mark, thanks a lot for the insights! 🙏 Very useful to understand how we got here and your experience with
My last attempt before generics was using enums without
@sproul pointed out the above won't work because there's no signifier in the blob data that defines whether the sidecar should be full/blinded). So I scrapped that PR and started again with generics. Now your comments made me think again - maybe there's a way that could work using enums if I structure the data differently to the above. I'm keen to give it another try! I'm still pretty new to Rust, and especially with generics & traits, so this is definitely an area worth exploring and I don't mind doing a few iterations. Here's some of my learnings from this current PR using Advantages:
Disadvantages
lighthouse/common/eth2/src/types.rs Lines 1495 to 1502 in 59fb1af
lighthouse/common/eth2/src/types.rs Lines 1289 to 1311 in 59fb1af
Agree with re-naming if we continue with the |
Yeah I definitely thought
If those are true then the only time you |
At some point we will probably use SSZ in the block production APIs (#3701) so we probably still want |
I am generally in support of exploring the enum approach because the payload types are pretty confusing. I think |
I did a small experiment with enums using I think the enum approach above does seem simpler to understand but potentially comes at a cost of increased code duplication (with my implementation anyway), and could get worse if we introduce a new type for EIP-6110 (in-protocol deposits)! There might be a nicer way of doing this. IMO the traits + generics approach doesn't seem too bad - at least it hides the complexity in one place 😅 . I don't see a clear win here between the two approaches ( @michaelsproul raised a few interesting points:
More from @michaelsproul re
In summary, I think it's definitely an experiment worth doing, but at present I don't have a better way that justifies the switch, and given Keen to hear your thoughts! |
# Conflicts: # beacon_node/beacon_chain/src/beacon_chain.rs # beacon_node/beacon_chain/src/blob_verification.rs # beacon_node/beacon_chain/src/test_utils.rs # beacon_node/execution_layer/src/lib.rs # beacon_node/http_api/src/publish_blocks.rs # consensus/types/src/blob_sidecar.rs
hey guys, I have been included in this conversation by accident and will unsubscribe now. Looks like I've been confused for @michaelsproul |
f961990
to
b0d8d90
Compare
478a58f
to
eaeb481
Compare
# Conflicts: # Cargo.lock # beacon_node/beacon_chain/src/blob_verification.rs # beacon_node/execution_layer/src/lib.rs # beacon_node/http_api/src/lib.rs # beacon_node/http_api/src/publish_blocks.rs # beacon_node/network/src/network_beacon_processor/tests.rs # common/eth2/src/types.rs
eaeb481
to
8e5a088
Compare
a4aabc5
to
9e2baaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job Jimmy! Gave it a more thorough review today
# Conflicts: # beacon_node/beacon_chain/src/beacon_chain.rs
Co-authored-by: realbigsean <seananderson33@GMAIL.com>
# Conflicts: # consensus/types/src/builder_bid.rs
…se into deneb-builder-take-2
Thanks for the review @realbigsean ! I've addressed your comments, please take another look when you have time. Diffs here. |
ah looks like I'm getting some weird test failures! On windows it's a state access violation, and I'm getting invalid memory reference on MacOS locally, and in linux the tests just seem to be weird comparisons. Will look into this tomorrow. |
Ok the issue is with the changes I made to
Investigating this made me realize we don't need |
…lder-take-2 # Conflicts: # beacon_node/execution_layer/src/engine_api.rs # beacon_node/execution_layer/src/lib.rs # beacon_node/http_api/src/lib.rs # validator_client/src/validator_store.rs
Nice, make sense! It was an oversight on my part, didn't notice that, but the release tests look happy now 🎉 |
Issue Addressed
Addresses #3689
Builder spec: ethereum/builder-specs#61
4844 Builder flow: https://hackmd.io/@jimmygchen/B1dLR74Io
Proposed Changes
Sidecar
andBlockProposal
traits that allows parameterizing sidecar types inBlockContents
,SignedBlockContents
and to reduce code duplication required for blinded blob flow.Beacon Node
produceBlindedBlock
endpoint updatesBuilderBid
response from builder endpoint (newBlindedBlobsBundle
type)BlockContents
response (containingkzg_commitments
,proof
andblinded_blob_sidecars
)submitBlindedBlock endpoint
updatesSignedBlockContents
request and forward to builderExecutionPayloadAndBlobsBundle
response from builder endpoint, and publish blockValidator Client
produceBlindedBlock
response from Beacon APIblinded_blob_sidecars
SignedBlockContents
and submit to Beacon API (submitBlindedBlock
)