-
Notifications
You must be signed in to change notification settings - Fork 121
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
Optimistic relaying v2: header only parsing. #466
base: main
Are you sure you want to change the base?
Optimistic relaying v2: header only parsing. #466
Conversation
@@ -781,3 +782,254 @@ func (b *BuilderSubmitBlockRequest) Withdrawals() []*consensuscapella.Withdrawal | |||
} | |||
return nil | |||
} | |||
|
|||
// SubmitBlockRequest is the v2 request from the builder to submit a block. | |||
type SubmitBlockRequest struct { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
interesting, thanks for the PR. it's a lot of code and will take some time to review. tests and linter are currently failing btw. |
This PR was presented and discussed in more detail in mev-boost community call #4 on 2023-06-15 -- recording linked in the page. |
Optimisation-wise this is pretty cool. I want to note that I'm concerned about this significantly increasing colocation pressure, since such v2 submissions with would have a significantly increased risk for builders to cause missed slots if they don't get the data to the relay very quickly, which would not cause missed slots in v1 submissions. For some additional data: 50% of builder submissions to the Flashbots relay are read+decoded in <10ms, which seems to be the median time this would shave off the overall submission latency. |
18524f1
to
6a4f5da
Compare
📝 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 theSubmitBlockRequest
type 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 thegetHeaderResponse
and thus qualify the bid for the auction. The last two fields (txns and withdrawals) are needed to construct the fullExecutionPayload
that is part of thegetPayloadResponse
. This type has the normal SSZ methods, but also includes theUnmarshalSSZHeaderOnly
function, which parses only the first three fields of the type (with the offsets).common/types_spec.go
–– Adding theBuildGetHeaderResponseHeaderOnly
function which builds thegetHeaderResponse
using the full header that is passed in (not using the txn slice to construct the txn root).datastore/redis.go
–– ModifySaveBidAndUpdateTopBid
to only save theExecutionPayload
if thegetPayloadResponse
is 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
––handleSubmitNewBlockV2
handleSubmitNewBlock
handleSubmitNewBlock
to check signature and optimistic eligibilityhandleSubmitNewBlock
to check signature and optimistic eligibilityhandleSubmitNewBlock
getHeaderResponse
before finishing reading the requestoptimisticV2SlowPath
functionoptimisticV2SlowPath
ExecutionPayload
.getPayloadResponse
to redis. this is a critical step! now the bid is active and we have the payload.handleSubmitNewBlock
to 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 lint
make test-race
go mod tidy
CONTRIBUTING.md