Skip to content
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

Simplify blob sidecar availability checker #8840

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

tbenr
Copy link
Contributor

@tbenr tbenr commented Nov 20, 2024

blobs get from EL are marked as valid (trust assumption on EL)

TODO:

  • historical sync unit tests
  • gossip unit tests
  • rpc unit tests

fixes #8740

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@@ -39,6 +39,9 @@ public class BlobSidecar
SignedBeaconBlockHeader,
SszBytes32Vector> {

private volatile boolean kzgAndInclusionProofValidated = false;
private volatile boolean signatureValidated = false;
Copy link
Contributor

@mehdi-aouadi mehdi-aouadi Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find these validation steps a bit confusing and I'm wondering if we can't simply mark the blob sidecar as valid or not (merge them) or split the kzgAndInclusionProofValidated into two validation flags: kzgValidated and inclusionProofValidated. An and in a boolean variable name is red flag to me. Or do we really need this design for some reason I'm missing?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason I put kzg and inclusion proof together and signatureValidation as a separate boolean is because we can perform kzg and inclusion proof validation just having the blob itself (you don't need anything else). For the signature validation you need a prevalidated signed block OR the state to get the pubkey from and do the signature check.

&& !blobSidecar
.getSignedBeaconBlockHeader()
.hashTreeRoot()
.equals(block.hashTreeRoot())) {
Copy link
Contributor

@mehdi-aouadi mehdi-aouadi Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same check done twice?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same check as which one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant same as blobSidecar.isSignatureValidated()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok but where am I doing this the second time?
I'm not sure this always checked. For instance the RPC lookups check blobs via BlobSidecarsByRootValidator.validate, which can only do kzg and inclusion proof.
So if we end up processing blobs coming from RPC source, we are not checking the block header in the blobSidecar (correct me if i'm wrong :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh. I actually forgot to do the marking in BlobSidecarsByRangeListenerValidatingProxy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm maybe I can move those marking deeper in the stack and have them separated as you suggested

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we end up processing blobs coming from RPC source, we are not checking the block header in the blobSidecar (correct me if i'm wrong :) )

Ok I see what you mean. One should keep in mind the whole flow to understand that...

@tbenr
Copy link
Contributor Author

tbenr commented Nov 22, 2024

since i forgot to do this marking i think the way I did it is a bit error prone. I'll change it.

@zilm13
Copy link
Contributor

zilm13 commented Nov 24, 2024

I will join Mehdi feedback:

  • if some validation was not performed I expect that we want to run it now
  • if it means that it was actually performed but failed it's confusing
  • I'm not sure on extending base BlobSidecar class, maybe better make some wrapper? It would be cleaner.
  • I'm happy with split kzg+inclusion / signature

@tbenr tbenr force-pushed the simplify-BlobSidecarAvailabilityChecker branch 2 times, most recently from ab8c9e8 to 36ef653 Compare November 26, 2024 14:04
@tbenr tbenr force-pushed the simplify-BlobSidecarAvailabilityChecker branch from 0cfe5bb to 39ecb99 Compare November 26, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify blobSidecar availability checker
3 participants