Skip to content

Instantly share code, notes, and snippets.

@DrPeterVanNostrand
Last active December 15, 2022 16:23
Show Gist options
  • Save DrPeterVanNostrand/500da541523ae0b8ec2a849a9867bf2a to your computer and use it in GitHub Desktop.
Save DrPeterVanNostrand/500da541523ae0b8ec2a849a9867bf2a to your computer and use it in GitHub Desktop.
Filecoin PoRep Groth16 Constraints
/// Add the following test to the bottom of: rust-fil-proofs/filecoin-proofs/src/api/seal.rs
///
/// Run using:
/// $ cd rust-fil-proofs/filecoin-proofs
/// $ cargo test --release --no-default-features get_groth16_constraints -- --nocapture
///
/// PoRep Partition Constraint Counts:
/// - 32GiB: 130278541
/// - 64GiB: 131185849
#[test]
fn get_groth16_constraints() {
use bellperson::{util_cs::bench_cs::BenchCS, Circuit};
use storage_proofs_core::api_version::ApiVersion;
use crate::{
constants::{SectorShape32GiB, SECTOR_SIZE_32_GIB},
parameters::public_params,
};
let pub_params = public_params::<SectorShape32GiB>(
PaddedBytesAmount(SECTOR_SIZE_32_GIB),
10,
[0u8; 32],
ApiVersion::V1_1_0,
)
.expect("failed to get public params");
let circ = <StackedCompound<SectorShape32GiB, DefaultPieceHasher> as CompoundProof<
StackedDrg<'_, SectorShape32GiB, DefaultPieceHasher>,
_,
>>::blank_circuit(&pub_params);
let mut cs = BenchCS::new();
circ.synthesize(&mut cs).expect("failed to synthesize");
println!("\nnum_constraints: {}\n", cs.num_constraints());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment