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

Assert proof is valid in validate_blobs_sidecar + update version of jc-kzg-4844 #6708

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ public boolean isMergeTransitionComplete(final BeaconState state) {
/**
* Performs data availability by validating blobs and proof from Sidecar against blobs kzg
* commitments from the block. It will also make check slot and blockRoot consistency.
*
* @param slot
* @param beaconBlockRoot
* @param kzgCommitments
* @param blobsSidecar
* @return
*/
public boolean isDataAvailable(
final UInt64 slot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package tech.pegasys.teku.spec.logic.versions.eip4844.helpers;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static tech.pegasys.teku.spec.config.SpecConfigEip4844.BLOB_TX_TYPE;
import static tech.pegasys.teku.spec.config.SpecConfigEip4844.VERSIONED_HASH_VERSION_KZG;

Expand Down Expand Up @@ -68,17 +69,19 @@ private void validateBlobSidecar(
final BlobsSidecar blobsSidecar) {
checkArgument(
slot.equals(blobsSidecar.getBeaconBlockSlot()),
"Block slot should match blobsSidecar slot");
"Block slot should match blobs sidecar slot");
checkArgument(
beaconBlockRoot.equals(blobsSidecar.getBeaconBlockRoot()),
"Block root should match blobsSidecar beacon block root");
"Block root should match blobs sidecar beacon block root");
checkArgument(
kzgCommitments.size() == blobsSidecar.getBlobs().size(),
"Number of kzgCommitments should match number of blobs");
kzg.verifyAggregateKzgProof(
blobsSidecar.getBlobs().stream().map(Blob::getBytes).collect(Collectors.toList()),
kzgCommitments,
blobsSidecar.getKZGAggregatedProof());
"Number of KZG commitments should match number of blobs");
final boolean isValidProof =
kzg.verifyAggregateKzgProof(
blobsSidecar.getBlobs().stream().map(Blob::getBytes).collect(Collectors.toList()),
kzgCommitments,
blobsSidecar.getKZGAggregatedProof());
checkState(isValidProof, "Invalid aggregate KZG proof for the given blobs and commitments");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencyManagement {

dependency 'io.libp2p:jvm-libp2p-minimal:0.10.0-RELEASE'
dependency 'tech.pegasys:jblst:0.3.10'
dependency 'tech.pegasys:jc-kzg-4844:0.2.1'
dependency 'tech.pegasys:jc-kzg-4844:0.3.0'

dependency 'org.hdrhistogram:HdrHistogram:2.1.12'

Expand Down