-
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
[feature] Optimistic v2 submission flow #524
base: main
Are you sure you want to change the base?
Conversation
services/api/service.go
Outdated
"value": bid.Value.String(), | ||
}) | ||
|
||
// Verify the signature |
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.
Is there a reason why the signature verification was moved above some of the other checks? (compared to handleSubmitNewBlock v1)
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.
honestly it was just a gut feeling that the signature check should probably come first.
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.
good rule of thumb to do inexpensive checks first, if they don't lead to DoS issues and can quickly determine if the request is bad or not
then ramp up in resource demand to signature verification
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.
yep agree, signature checks are expensive and should come after the cheaper checks
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.
done in 3e5f962 !
ty
fix(redis): move WasBidSaved to after exec We have several conditions where we don't execute the pipelined commands. Only set the WasBidSaved flag after we execute the pipeline successfully. Do note, if the pipeline fails we may or may not have actually saved the bid.
Bumps [github.com/flashbots/go-utils](https://github.com/flashbots/go-utils) from 0.4.11 to 0.4.12. - [Commits](flashbots/go-utils@v0.4.11...v0.4.12) --- updated-dependencies: - dependency-name: github.com/flashbots/go-utils dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add feature flags for backwards compatibility * improve readability of flags * renaming flags * remove fork schedule checks and flag
Edited descriptions for Validators stats
* Try fix log point in builder api * Fix log reassignment in builder submission
Bumps [github.com/flashbots/go-utils](https://github.com/flashbots/go-utils) from 0.4.12 to 0.5.0. - [Commits](flashbots/go-utils@v0.4.12...v0.5.0) --- updated-dependencies: - dependency-name: github.com/flashbots/go-utils dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/ethereum/go-ethereum](https://github.com/ethereum/go-ethereum) from 1.12.2 to 1.13.1. - [Release notes](https://github.com/ethereum/go-ethereum/releases) - [Commits](ethereum/go-ethereum@v1.12.2...v1.13.1) --- updated-dependencies: - dependency-name: github.com/ethereum/go-ethereum dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## main #524 +/- ##
==========================================
+ Coverage 33.23% 35.64% +2.41%
==========================================
Files 24 24
Lines 5079 5397 +318
==========================================
+ Hits 1688 1924 +236
- Misses 3173 3248 +75
- Partials 218 225 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pipeliner redis.Pipeliner | ||
} | ||
|
||
func (api *RelayAPI) optimisticV2SlowPath(r io.Reader, v2Opts v2SlowPathOpts) { |
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.
what is slowPath
supposed to be doing?
A new API should be proposed and merged in the relay specs first: https://github.com/flashbots/relay-specs Would it be good if v2 also supports non-optimistic submissions? |
📝 Summary
Spiritual successor to #466.
This follows up on the series: #479, #491, #494, #498, #513, #514, #518, which aim at reducing the diff and productionizing #466.
⛱ Motivation and Context
This PR implements the
handleSubmitNewBlockV2
and the surrounding test infrastructure. The general flow is:SubmitBlockRequestV2Optimistic
SSZ type from Create ssz type: SubmitBlockRequestV2Optimistic #518 to decode the header only from the stream.checkSubmissionSlotDetails, checkBuilderEntry, checkSubmissionPayloadAttrs, and checkBidFloorValue
to run prechecks against the submission. each of these functions was part of the refactor set of the originalhandleSubmitNewBlock
function.SaveBidAndUpdateTopBid
with just thegetHeaderResponse
because thegetPayloadResponse
is not yet available.optimisticV2SlowPath
, which currently just does nothing. The logic from the slow path will come in a follow up PR.In an effort to increase review-ability of this PR, I stopped here. the slow path logic is quite simple in that it just decodes the full block and simulates it before updating redis with the
getPayloadResponse
.Also have nearly 100% coverage of the new lines!
📚 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
CONTRIBUTING.md