Skip to content

Commit

Permalink
rebase master
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Oct 20, 2023
1 parent 620de6e commit bdd378f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -347,6 +348,13 @@ public boolean isDataAvailable(final List<BlobSidecar> blobSidecars, final Beaco
return false;
}

public boolean isDataAvailable(
final List<Bytes> blobs,
final List<KZGCommitment> kzgCommitments,
final List<KZGProof> proofs) {
return false;
}

public boolean verifyBlobKzgProofBatch(final List<BlobSidecar> blobSidecars) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public boolean isDataAvailable(final List<BlobSidecar> 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<Bytes> blobs,
final List<KZGCommitment> kzgCommitments,
final List<KZGProof> proofs) {
return kzg.verifyBlobKzgProofBatch(blobs, kzgCommitments, proofs);
}

/**
* Performs a verifyBlobKzgProofBatch on the given blob sidecars
*
Expand All @@ -94,14 +106,14 @@ public boolean isDataAvailable(final List<BlobSidecar> blobSidecars, final Beaco
@Override
public boolean verifyBlobKzgProofBatch(final List<BlobSidecar> blobSidecars) {
final List<Bytes> blobs = new ArrayList<>();
final List<KZGProof> kzgProofs = new ArrayList<>();
final List<KZGCommitment> kzgCommitments = new ArrayList<>();
final List<KZGProof> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public SafeFuture<SignedValidatorRegistration> createSignedValidatorRegistration
.orElseGet(
() -> {
final Signer signer = validator.getSigner();
return signAndCacheValidatorRegistration(publicKey, validatorRegistration, signer);
return signValidatorRegistration(publicKey, validatorRegistration, signer);
})
.whenException(errorHandler);
}

private SafeFuture<SignedValidatorRegistration> signAndCacheValidatorRegistration(
final BLSPublicKey cacheKey,
private SafeFuture<SignedValidatorRegistration> signValidatorRegistration(
final BLSPublicKey publicKey,
final ValidatorRegistration validatorRegistration,
final Signer signer) {
return signer
Expand All @@ -106,7 +106,7 @@ private SafeFuture<SignedValidatorRegistration> 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;
});
}
Expand Down

0 comments on commit bdd378f

Please sign in to comment.