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

Deneb crypto helpers test coverage #3283

Merged
merged 17 commits into from
Mar 15, 2023
Merged

Deneb crypto helpers test coverage #3283

merged 17 commits into from
Mar 15, 2023

Conversation

dankrad
Copy link
Contributor

@dankrad dankrad commented Mar 6, 2023

Working on #3258

@dankrad
Copy link
Contributor Author

dankrad commented Mar 8, 2023

What's up with tests/core/pyspec/eth2spec/test/deneb/unittests/test_kzg.py? That file seems useless, can we delete it?

@hwwhww
Copy link
Contributor

hwwhww commented Mar 9, 2023

@dankrad yes, it's fine to remove tests/core/pyspec/eth2spec/test/deneb/unittests/test_kzg.py.

@hwwhww hwwhww added the Deneb was called: eip-4844 label Mar 10, 2023
@dankrad dankrad mentioned this pull request Mar 12, 2023
6 tasks
@dankrad dankrad marked this pull request as ready for review March 12, 2023 23:10
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

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

good tests! some suggestions for the API and signatures.

#### `verify_sidecar_signature`

```python
def verify_blob_sidecar_signature(state: BeaconState, signed_blob_sidecar: SignedBlobSidecar) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

should add description of when to use it

Comment on lines 47 to 48
def get_blobs_and_kzg_commitments(payload_id: PayloadId) -> \
Tuple[Sequence[BLSFieldElement], Sequence[KZGCommitment], Sequence[KZGProof]]:
Copy link
Contributor

@hwwhww hwwhww Mar 14, 2023

Choose a reason for hiding this comment

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

[off this PR]

  • By the function name, it looks like it should return Sequence[Blob] instead of Sequence[BLSFieldElement]?
  • And this PR now adds Sequence[KZGProof]... should it be renamed to signal it?

How about using the similar name of verify_blob_kzg_proof_batch:

Suggested change
def get_blobs_and_kzg_commitments(payload_id: PayloadId) -> \
Tuple[Sequence[BLSFieldElement], Sequence[KZGCommitment], Sequence[KZGProof]]:
def get_blob_kzg_proof_batch(
payload_id: PayloadId
) -> Tuple[Sequence[Blob], Sequence[KZGCommitment], Sequence[KZGProof]]:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right on the signature, disagree on the naming though. It's not "batch" -- it's just an API to get all of them from the execution engine. There is no way to "not batch" this.

We could add proofs to the name, but I feel it's a bit long and unnecessary, the name does not need to provide information on everything the function is doing.

@@ -66,13 +67,14 @@ use the `payload_id` to retrieve `blobs` and `blob_kzg_commitments` via `get_blo
```python
def validate_blobs_and_kzg_commitments(execution_payload: ExecutionPayload,
Copy link
Contributor

Choose a reason for hiding this comment

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

how about using a similar name of verify_blob_kzg_proof_batch:

Suggested change
def validate_blobs_and_kzg_commitments(execution_payload: ExecutionPayload,
def validate_blob_kzg_proof_batch(execution_payload: ExecutionPayload,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again I don't think it's a "batch" because it's just all of them. Batch suggests it's an arbitrary set which it is not.

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

nice!

specs/deneb/p2p-interface.md Show resolved Hide resolved
specs/deneb/validator.md Outdated Show resolved Hide resolved
@@ -44,7 +44,8 @@ Note: This API is *unstable*. `get_blobs_and_kzg_commitments` and `get_payload`
Implementers may also retrieve blobs individually per transaction.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Should we remove the "API unstable" warning?
  2. Please update ""The interface to retrieve blobs and corresponding kzg commitments." to note that it retrieves proofs too

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah and I checked, the engine api doesn't currently give you the proofs. so right now, adding the proofs to this would be not in sync with the engine api

That said abstracting it to magically show up in the validator spec does seem correct/safe so I'm okay leaving this as is

Copy link
Contributor Author

@dankrad dankrad Mar 14, 2023

Choose a reason for hiding this comment

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

We should change the engine to give the proofs, because they should be part of the BlobTransactionNetworkWrapper.

Which made me notice, it seems the EIP has not been updated to include this yet. Seems to be included in this PR: ethereum/EIPs#6610

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, let's go to engine api after eip is merged

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

looks good!

@djrtwo djrtwo merged commit 985fcc2 into dev Mar 15, 2023
@djrtwo djrtwo deleted the deneb-crypto-coverage branch March 15, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deneb was called: eip-4844
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants