-
Notifications
You must be signed in to change notification settings - Fork 21.6k
eth/catalyst: implement getBlobsV3 #33404
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
Open
MarcoPolo
wants to merge
1
commit into
ethereum:master
Choose a base branch
from
MarcoPolo:getBlobsV3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+52
−27
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a6bc74d to
c75be1f
Compare
Member
|
Previous version of this PR: #32170 |
Member
|
This one includes metrics accounting, so it seems like an improvement over the old one. |
Member
|
How do you feel about: diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go
index 109581e240..2be050f084 100644
--- a/eth/catalyst/api.go
+++ b/eth/catalyst/api.go
@@ -571,51 +571,19 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo
if api.config().LatestFork(head.Time) < forks.Osaka {
return nil, unsupportedForkErr("engine_getBlobsV2 is not available before Osaka fork")
}
- if len(hashes) > 128 {
- return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes)))
- }
- available := api.eth.BlobTxPool().AvailableBlobs(hashes)
- getBlobsRequestedCounter.Inc(int64(len(hashes)))
- getBlobsAvailableCounter.Inc(int64(available))
-
- // Optimization: check first if all blobs are available, if not, return empty response
- if available != len(hashes) {
- getBlobsV2RequestMiss.Inc(1)
- return nil, nil
- }
-
- blobs, _, proofs, err := api.eth.BlobTxPool().GetBlobs(hashes, types.BlobSidecarVersion1, false)
- if err != nil {
- return nil, engine.InvalidParams.With(err)
- }
-
- // To comply with API spec, check again that we really got all data needed
- for _, blob := range blobs {
- if blob == nil {
- getBlobsV2RequestMiss.Inc(1)
- return nil, nil
- }
- }
- getBlobsV2RequestHit.Inc(1)
-
- res := make([]*engine.BlobAndProofV2, len(hashes))
- for i := 0; i < len(blobs); i++ {
- var cellProofs []hexutil.Bytes
- for _, proof := range proofs[i] {
- cellProofs = append(cellProofs, proof[:])
- }
- res[i] = &engine.BlobAndProofV2{
- Blob: blobs[i][:],
- CellProofs: cellProofs,
- }
- }
- return res, nil
+ return api.getBlobs(hashes, false)
}
// GetBlobsV3 returns a set of blobs from the transaction pool. Same as
// GetBlobsV2, except will return partial responses in case there is a missing
// blob.
func (api *ConsensusAPI) GetBlobsV3(hashes []common.Hash) ([]*engine.BlobAndProofV2, error) {
+ return api.getBlobs(hashes, true)
+}
+
+// getBlobs returns all available blobs.
+// if allowPartials is not set, either all or no blobs are returned.
+func (api *ConsensusAPI) getBlobs(hashes []common.Hash, allowPartials bool) ([]*engine.BlobAndProofV2, error) {
if len(hashes) > 128 {
return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes)))
}
@@ -631,10 +599,14 @@ func (api *ConsensusAPI) GetBlobsV3(hashes []common.Hash) ([]*engine.BlobAndProo
res := make([]*engine.BlobAndProofV2, len(hashes))
for i := range blobs {
if blobs[i] == nil {
- getBlobsV3RequestMiss.Inc(1)
- continue
+ if allowPartials {
+ getBlobsV3RequestMiss.Inc(1)
+ continue
+ } else {
+ getBlobsV2RequestMiss.Inc(1)
+ return nil, nil
+ }
}
- getBlobsV3RequestHit.Inc(1)
var cellProofs []hexutil.Bytes
for _, proof := range proofs[i] {
cellProofs = append(cellProofs, proof[:])
@@ -644,6 +616,11 @@ func (api *ConsensusAPI) GetBlobsV3(hashes []common.Hash) ([]*engine.BlobAndProo
CellProofs: cellProofs,
}
}
+ if allowPartials {
+ getBlobsV3RequestHit.Inc(int64(len(blobs)))
+ } else {
+ getBlobsV2RequestHit.Inc(1)
+ }
return res, nil
}
|
c75be1f to
5cbe6bd
Compare
Author
|
@MariusVanDerWijden done. Updated in the latest version of the commit |
MariusVanDerWijden
approved these changes
Dec 17, 2025
Member
MariusVanDerWijden
left a comment
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is used by cell-level dissemination (aka partial messages) to give the CL all blobs the EL knows about and let CL communicate efficiently about any other missing blobs. In other words, partial responses from the EL is useful now.
See the related (closed) PR: ethereum/execution-apis#674 and the new PR: ethereum/execution-apis#719