-
Notifications
You must be signed in to change notification settings - Fork 461
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: Add support for block validation (flashbots_validateBuilderSubmissionV3) #7335
base: master
Are you sure you want to change the base?
Conversation
cbd73ae
to
9eb6f70
Compare
src/Nethermind/Nethermind.Consensus/Processing/ReadOnlyTxProcessingEnv.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.BlockValidation/IFlashbotsRpcModule.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.BlockValidation/Handlers/ValidateBuilderSubmissionHandler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.BlockValidation/Handlers/ValidateBuilderSubmissionHandler.cs
Outdated
Show resolved
Hide resolved
if (!_blockTree.IsBetterThanHead(block.Header)) | ||
{ | ||
error = $"Block {block.Header.Hash} is not better than head"; | ||
return false; | ||
} |
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.
We can validate only on future blocks?
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.
src/Nethermind/Nethermind.BlockValidation/Handlers/ValidateBuilderSubmissionHandler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.BlockValidation/Handlers/ValidateBuilderSubmissionHandler.cs
Outdated
Show resolved
Hide resolved
if (block is not null && !ValidateBlobsBundle(block.Transactions, blobsBundle, out string? blobsError)) | ||
{ | ||
if (_logger.IsWarn) _logger.Warn($"Invalid blobs bundle. Result of {payloadStr}. Error: {blobsError}"); | ||
return BlockValidationResult.Invalid(blobsError ?? "Blobs bundle validation failed"); | ||
} |
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.
A but weird that we do validations after processing a block, shouldn't we do it first? (It would be less costly)
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.
I followed the same order as they did, but yeah I agree doing this way would be costly
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.
W should consider changing it later, maybe @Ruteri knows why this is the order of checks?
Co-authored-by: LukaszRozmej <LukaszRozmej@users.noreply.github.com>
Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: Ahmad Bitar <smartprogrammer@windowslive.com>
Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com> Co-authored-by: Marcin Sobczak <marcindsobczak@gmail.com>
afc3ecd
to
4eeeb9f
Compare
Closes #7462
This PR aims to implement flashbots endpoint (
flashbots_validateBuilderSubmissionV3
) ref: https://github.com/flashbots/builder/blob/df9c765067d57ab4b2d0ad39dbb156cbe4965778/eth/block-validation/api.go#L225-L246block
,blobs
and verifies if theParentHash
,BlockHash
,GasLimit
, andGasUsed
in the params.Message match the sent payload and produce an error otherwise.Changes
It introduces a new
JsonRpc
plugin calledNethermind.Flashbots
which implements a new endpoint calledflashbots_validateBuilderSubmissionV3
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
I'll write the tests once I'm done with manual testing