From 1a28786544c1e9e6f48713f645688624d5f8264f Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Thu, 19 Oct 2023 13:25:50 +0100 Subject: [PATCH] rebase master --- .../spec/logic/common/helpers/MiscHelpers.java | 8 ++++++++ .../versions/deneb/helpers/MiscHelpersDeneb.java | 16 ++++++++++++++-- .../SignedValidatorRegistrationFactory.java | 8 ++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/MiscHelpers.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/MiscHelpers.java index cead36ba8a4..a66de6e487b 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/MiscHelpers.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/common/helpers/MiscHelpers.java @@ -35,6 +35,7 @@ import tech.pegasys.teku.infrastructure.ssz.primitive.SszUInt64; import tech.pegasys.teku.infrastructure.unsigned.UInt64; import tech.pegasys.teku.kzg.KZGCommitment; +import tech.pegasys.teku.kzg.KZGProof; import tech.pegasys.teku.spec.config.SpecConfig; import tech.pegasys.teku.spec.constants.NetworkConstants; import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar; @@ -347,6 +348,13 @@ public boolean isDataAvailable(final List blobSidecars, final Beaco return false; } + public boolean isDataAvailable( + final List blobs, + final List kzgCommitments, + final List proofs) { + return false; + } + public boolean verifyBlobKzgProofBatch(final List blobSidecars) { return false; } diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/MiscHelpersDeneb.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/MiscHelpersDeneb.java index 5a486963ef9..f4a6b895649 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/MiscHelpersDeneb.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/deneb/helpers/MiscHelpersDeneb.java @@ -85,6 +85,18 @@ public boolean isDataAvailable(final List blobSidecars, final Beaco return true; } + /** + * Simplified version of {@link #isDataAvailable(List, BeaconBlock)} which accepts + * blobs,commitments and proofs directly instead of blob sidecars + */ + @Override + public boolean isDataAvailable( + final List blobs, + final List kzgCommitments, + final List proofs) { + return kzg.verifyBlobKzgProofBatch(blobs, kzgCommitments, proofs); + } + /** * Performs a verifyBlobKzgProofBatch on the given blob sidecars * @@ -94,14 +106,14 @@ public boolean isDataAvailable(final List blobSidecars, final Beaco @Override public boolean verifyBlobKzgProofBatch(final List blobSidecars) { final List blobs = new ArrayList<>(); - final List kzgProofs = new ArrayList<>(); final List kzgCommitments = new ArrayList<>(); + final List kzgProofs = new ArrayList<>(); blobSidecars.forEach( blobSidecar -> { blobs.add(blobSidecar.getBlob().getBytes()); - kzgProofs.add(blobSidecar.getKZGProof()); kzgCommitments.add(blobSidecar.getKZGCommitment()); + kzgProofs.add(blobSidecar.getKZGProof()); }); return kzg.verifyBlobKzgProofBatch(blobs, kzgCommitments, kzgProofs); diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/SignedValidatorRegistrationFactory.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/SignedValidatorRegistrationFactory.java index e149a522979..e0acd784d3a 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/SignedValidatorRegistrationFactory.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/SignedValidatorRegistrationFactory.java @@ -90,13 +90,13 @@ public SafeFuture createSignedValidatorRegistration .orElseGet( () -> { final Signer signer = validator.getSigner(); - return signAndCacheValidatorRegistration(publicKey, validatorRegistration, signer); + return signValidatorRegistration(publicKey, validatorRegistration, signer); }) .whenException(errorHandler); } - private SafeFuture signAndCacheValidatorRegistration( - final BLSPublicKey cacheKey, + private SafeFuture signValidatorRegistration( + final BLSPublicKey publicKey, final ValidatorRegistration validatorRegistration, final Signer signer) { return signer @@ -106,7 +106,7 @@ private SafeFuture signAndCacheValidatorRegistratio final SignedValidatorRegistration signedValidatorRegistration = ApiSchemas.SIGNED_VALIDATOR_REGISTRATION_SCHEMA.create( validatorRegistration, signature); - LOG.debug("Validator registration signed for {}", cacheKey); + LOG.debug("Validator registration signed for {}", publicKey); return signedValidatorRegistration; }); }