Skip to content

Commit

Permalink
fix property tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Nov 17, 2023
1 parent 9eeffd4 commit 107b2ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.Blob;
import tech.pegasys.teku.spec.datastructures.blobs.versions.deneb.BlobSidecar;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.versions.deneb.SignedBlockContents;
import tech.pegasys.teku.spec.datastructures.type.SszKZGCommitment;
import tech.pegasys.teku.spec.datastructures.type.SszKZGProof;
import tech.pegasys.teku.spec.logic.common.helpers.Predicates;
import tech.pegasys.teku.spec.propertytest.suppliers.SpecSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.BlobSidecarIndexSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.BlobSidecarSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blobs.versions.deneb.BlobSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blocks.SignedBeaconBlockSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blocks.versions.deneb.BeaconBlockSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.blocks.versions.deneb.SignedBlockContentsSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.type.KZGCommitmentSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.type.SszKZGCommitmentSupplier;
import tech.pegasys.teku.spec.propertytest.suppliers.type.SszKZGProofSupplier;
Expand Down Expand Up @@ -114,12 +114,14 @@ void fuzzVerifyBlobSidecarCompleteness(

@Property(tries = 100)
void fuzzComputeBlobSidecar(
@ForAll(supplier = SignedBeaconBlockSupplier.class) final SignedBeaconBlock signedBlock,
@ForAll(supplier = SignedBlockContentsSupplier.class)
final SignedBlockContents signedBlockContents,
@ForAll(supplier = BlobSidecarIndexSupplier.class) final UInt64 index,
@ForAll(supplier = BlobSupplier.class) final Blob blob,
@ForAll(supplier = SszKZGCommitmentSupplier.class) final SszKZGCommitment commitment,
@ForAll(supplier = SszKZGProofSupplier.class) final SszKZGProof proof) {
miscHelpers.computeBlobSidecar(signedBlock, index, blob, commitment, proof);
miscHelpers.computeBlobSidecar(
signedBlockContents.getSignedBlock(), index, blob, commitment, proof);
}

@Property(tries = 100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2574,11 +2574,10 @@ public BlobSidecar build() {
}

public List<Bytes32> randomKzgCommitmentInclusionProof() {
final BlobSidecarSchema blobSidecarSchema =
getDenebSchemaDefinitions(randomSlot()).getBlobSidecarSchema();
return IntStream.range(0, blobSidecarSchema.getKzgCommitmentInclusionProofSchema().getLength())
.mapToObj(__ -> randomBytes32())
.toList();
final int depth =
SpecConfigDeneb.required(spec.forMilestone(SpecMilestone.DENEB).getConfig())
.getKzgCommitmentInclusionProofDepth();
return IntStream.range(0, depth).mapToObj(__ -> randomBytes32()).toList();
}

public SszList<SszKZGCommitment> randomBlobKzgCommitments() {
Expand Down

0 comments on commit 107b2ee

Please sign in to comment.