-
Notifications
You must be signed in to change notification settings - Fork 995
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
Use engine api get-blobs
for block subscriber
#14513
base: develop
Are you sure you want to change the base?
Conversation
f52c455
to
7f73d11
Compare
|
||
// Initialize KZG hashes and retrieve blobs | ||
kzgHashes := make([]common.Hash, len(kzgCommitments)) | ||
blobs, err := s.GetBlobs(ctx, kzgHashes) |
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.
Can we check if the EL supports this API (cached exchange capabilities result?) before attempting to call it? Otherwise the logs could be noisy for anyone who upgrades to this version with an EL that does not support getBlobs.
defer span.End() | ||
|
||
result := make([]*pb.BlobAndProof, len(versionedHashes)) | ||
err := s.rpcClient.CallContext(ctx, &result, GetBlobsV1, versionedHashes) |
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 don't see the json methodset defined on this type, you probably need to define unmarshaling for the encoding to come through corrrectly.
if err != nil { | ||
return nil, errors.Wrap(err, "could not create RO blob with root") | ||
} | ||
verifiedBlobs = append(verifiedBlobs, blocks.NewVerifiedROBlob(roBlob)) |
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.
You're calling NewVerifiedROBlob and minting VerifiedROBlobs here, rather than getting those values from a verifier. That is risky. Would it be possible to define a verifier for this? Maybe something like the initial sync verifier that can deal with a batch.
On that note, I don't see you verifying the commitment inclusion proof anywhere in this PR.
Terence reminded me we are constructing the proof so we don't have to verify it, derp.
log.WithFields(blobFields(sidecar.ROBlob)).WithError(err).Error("Failed to receive blob") | ||
} | ||
|
||
if err := s.cfg.p2p.BroadcastBlob(ctx, sidecar.Index, sidecar.BlobSidecar); err != nil { |
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.
Would it be safe to broadcast before we call ReceiveBlob? I think it would be best to do these steps across multiple loops, like:
- verify all of the blobs (I actually think we should do this inside ReconstructBlobSidecars since that method returns VerifiedROBlobs).
- call BroadcastBlob for all the blobs. - this ensures we get the most benefit from idontwant. I think that calling broadcast is non-blocking; io with the individual peers happens in separate libp2p threads. don't need to worry about "rebroadcasting" blobs where we have the index on disk, because libp2p handles that.
- Call ReceiveBlob for each blob. Do this after all the broadcasts because it will save the blobs to disk, which can block, esp if they have fsync enabled.
f75b0e0
to
e64a726
Compare
89e329c
to
7cbbb68
Compare
Debug changelog add proto marshal and unmarshal Kasey's feedback
7cbbb68
to
82b87b9
Compare
Reference: ethereum/execution-apis#559
Background
The$T_{BlockArrival} + \triangle_{BlobsOverEngineAPI} < T_{BlockArrival} + \triangle_{BlobsOverP2P}$ which simplifies to: $\triangle_{BlobsOverEngineAPI} < \triangle_{BlobsOverP2P}$
engine_getBlobsV1
function allows the CL to retrieve blobs and their proofs from the EL by providing the block body's KZG version hashes. If the blobs and proofs are already available in the local mempool, the EL will return them. Once the CL receives the blobs and proofs, it can import the block and run the fork choice algorithm to update the head. In the best-case scenario, this process is faster than waiting for blobs to propagate through the network. By assuming the following condition holds:The benefits include:
Prysm Implementation
Now we will discuss how Prysm may implement this optimization. Feel free to stop reading here if you're not interested in the Prysm side of things.
One way to study this is by reviewing the following task timeline:
Implementation Details
get blobs
endpoint, it will be a no-op instead of returning an error. We added exchange capabilities caching and a check beforehand.The preliminary result is documented here: https://hackmd.io/@ttsao/get-blobs-early-results