Optimistic relaying v2: header only parsing. #466
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
v2 of the optimistic relaying roadmap, which does optimistic header only parsing of an SSZ encoded bid and marks the bid eligible immediately.
change log:
common/types.go–– Adding theSubmitBlockRequesttype to the common package. This type is was discussed in Create v2.SubmitBlockRequest type. attestantio/go-builder-client#8. The first three fields are enough to construct thegetHeaderResponseand thus qualify the bid for the auction. The last two fields (txns and withdrawals) are needed to construct the fullExecutionPayloadthat is part of thegetPayloadResponse. This type has the normal SSZ methods, but also includes theUnmarshalSSZHeaderOnlyfunction, which parses only the first three fields of the type (with the offsets).common/types_spec.go–– Adding theBuildGetHeaderResponseHeaderOnlyfunction which builds thegetHeaderResponseusing the full header that is passed in (not using the txn slice to construct the txn root).datastore/redis.go–– ModifySaveBidAndUpdateTopBidto only save theExecutionPayloadif thegetPayloadResponseis not nil. This allows us to use that function as is to save only the getHeader response and avoid code duplication in that path.services/api/service.go––handleSubmitNewBlockV2handleSubmitNewBlockhandleSubmitNewBlockto check signature and optimistic eligibilityhandleSubmitNewBlockto check signature and optimistic eligibilityhandleSubmitNewBlockgetHeaderResponsebefore finishing reading the requestoptimisticV2SlowPathfunctionoptimisticV2SlowPathExecutionPayload.getPayloadResponseto redis. this is a critical step! now the bid is active and we have the payload.handleSubmitNewBlockto save the entry and simulate the block. We don't do the floor checking because we want all optimistic blocks to be simulated.⛱ Motivation and Context
This change represents the next phase of optimistic relaying, which is an iterative approach of evolving mev-boost to look more like enshrined PBS. See this post for more context.
📚 References
Why enshrine proposer builder separation?
roadmap
optimistic relays and where to find them
✅ I have run these commands
make lintmake test-racego mod tidyCONTRIBUTING.md