Skip to content
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

Create ssz type: SubmitBlockRequestV2Optimistic #518

Merged
merged 4 commits into from
Sep 6, 2023

Conversation

michaelneuder
Copy link
Collaborator

📝 Summary

Creating the type and SSZ encoding needed for the v2 optimistic builder submissions.

This type implements the standard SSZ interface

MarshalSSZ
UnmarshalSSZ
MarshalSSZTo
SizeSSZ

We also define a custom decode that only parses the header part of the bid UnmarshalSSZHeaderOnly.

This follows up on the series: #479, #491, #494, #498, #513, #514, which aim at reducing the diff and productionizing #466.

⛱ Motivation and Context

SubmitBlockRequestV2Optimistic is the v2 request from the builder to submit a block. The message must be SSZ encoded. The first three fields are at most 944 bytes, which fit into a single 1500 MTU ethernet packet. The UnmarshalSSZHeaderOnly function just parses the first three fields, which is sufficient data to set the bid of the builder. The Transactions and Withdrawals fields are required to construct the full SignedBeaconBlock and are parsed asynchronously.

Header only layout:
[000-236) = Message   (236 bytes)
[236-240) = offset1   (  4 bytes)
[240-336) = Signature ( 96 bytes)
[336-340) = offset2   (  4 bytes)
[340-344) = offset3   (  4 bytes)
[344-944) = EPH       (600 bytes)

📚 References

https://notes.ethereum.org/@mikeneuder/optimistic-v2

https://github.com/michaelneuder/optimistic-relay-documentation/blob/main/towards-epbs.md#optimistic-relay-v2-header-only-parsing


✅ I have run these commands

  • make lint
  • make test-race
  • go mod tidy
  • I have seen and agree to CONTRIBUTING.md

@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2023

Codecov Report

Merging #518 (a1b3ad0) into main (36d55f7) will increase coverage by 1.08%.
Report is 1 commits behind head on main.
The diff coverage is 55.08%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
+ Coverage   32.15%   33.24%   +1.08%     
==========================================
  Files          24       24              
  Lines        4876     5078     +202     
==========================================
+ Hits         1568     1688     +120     
- Misses       3116     3171      +55     
- Partials      192      219      +27     
Flag Coverage Δ
unittests 33.24% <55.08%> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
common/types.go 15.01% <55.08%> (+12.92%) ⬆️

... and 1 file with indirect coverage changes

*/
type SubmitBlockRequestV2Optimistic struct {
Message *apiv1.BidTrace
ExecutionPayloadHeader *consensuscapella.ExecutionPayloadHeader
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the upgrade path for deneb?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deneb blocks will have the kzg commitments. The ExecutionPayload and the ExecutionPayloadHeader each have two new fields, blob_gas_used and excess_blob_gas for sure will need to include these types because they are part of what the validator signs over.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you making a versioned struct for future upgrades?

@michaelneuder michaelneuder merged commit 4e78ec8 into main Sep 6, 2023
4 checks passed
@michaelneuder michaelneuder deleted the mikeneuder-2023-09-05-01 branch September 6, 2023 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants