Skip to content

Commit

Permalink
feat: updated parameters for election post
Browse files Browse the repository at this point in the history
* Getting closer to realistic number on election post challenges
* v19 params
  • Loading branch information
dignifiedquire committed Nov 27, 2019
1 parent 84f5504 commit ed3d65d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 48 deletions.
76 changes: 38 additions & 38 deletions filecoin-proofs/parameters.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
{
"v18-proof-of-spacetime-election-54266a3979de672c5f59a521e8e4a3fc2108da1eb019af74089ff6d05bfe83aa.params": {
"cid": "QmPhNP5h6W2VjraH76Mqt9Knt5aKWwKz9y2AKAAn128hz3",
"digest": "7c9913cb96717672347fa91a6daf3d3e",
"sector_size": 1024
},
"v18-proof-of-spacetime-election-54266a3979de672c5f59a521e8e4a3fc2108da1eb019af74089ff6d05bfe83aa.vk": {
"cid": "QmVoeBVUruL9rsM6FwgqaZWuq2nnWVeMxcWfpKQfUAV6z8",
"digest": "394a355e08107de25fabe6bf4f055065",
"sector_size": 1024
},
"v18-proof-of-spacetime-election-5dafbb8a1d6802f3b68f0dd2d3eff36d203263b4a867df986b1d434f1852726c.params": {
"cid": "QmXN1msCQwChwNQiniQFepEQfkvM881FEkNinDQyybwEoH",
"digest": "3245eed51a7738a9d2055e57f4cffad1",
"v19-proof-of-spacetime-election-09ae025de08399327e14f0cb6b4c907b6fe1e8b77046e31de8921bde588de900.params": {
"cid": "QmZEKhzKbC7SPngjL85ghyuxabPmiEuUh4fpkC7CDK1J5q",
"digest": "1c81338b8afeaae514fd5d6c08c9c6e5",
"sector_size": 268435456
},
"v18-proof-of-spacetime-election-5dafbb8a1d6802f3b68f0dd2d3eff36d203263b4a867df986b1d434f1852726c.vk": {
"cid": "QmTtz4j6WhvLcnq45H6pPL1gnu47ppf3pqFJNjMcb4ftU7",
"digest": "a6b5ed26e61ee1ba6d0157e2f4a00f91",
"v19-proof-of-spacetime-election-09ae025de08399327e14f0cb6b4c907b6fe1e8b77046e31de8921bde588de900.vk": {
"cid": "Qmf5XQuM58jNmxudXeZMuZtGGiNzcd56Fiyn9h76wpX5dN",
"digest": "bb0f07b6071cd28e9348223c6a9c46d1",
"sector_size": 268435456
},
"v18-proof-of-spacetime-election-8923799c7eba68497833a94802c1f687aca037964aacbec838188c6d3912b718.params": {
"cid": "QmSNwSUEAp4eJC2UWo1HgmQZELiZVUErWceRed9vT7WQKS",
"digest": "52ac57808d3c5132ee66c9693f8af5ee",
"sector_size": 16777216
"v19-proof-of-spacetime-election-4a2342062706429612fac099694f77294e355c6c9265b80feaff12a0268b0a92.params": {
"cid": "QmaHs5CHcSD6QhaGAp4ysJP4HTZaxPxybCGmUVDk3TNocA",
"digest": "727fb2896a5668d04ba6e0ce71eb50d7",
"sector_size": 1024
},
"v18-proof-of-spacetime-election-8923799c7eba68497833a94802c1f687aca037964aacbec838188c6d3912b718.vk": {
"cid": "Qmeg26ZQ57oi8bHkkgeYuafKjyZMGDXJhbg2ZSJW1zbAb5",
"digest": "1a5fc7b62c09a6d96455dcba83ceb9af",
"sector_size": 16777216
"v19-proof-of-spacetime-election-4a2342062706429612fac099694f77294e355c6c9265b80feaff12a0268b0a92.vk": {
"cid": "QmVg8mUXMb6MiZQseAyCmHzEgNkPbV72xQoRmdFr1yJA4w",
"digest": "3fdf4e65a7baf1a2bab5b8a717f3379a",
"sector_size": 1024
},
"v18-proof-of-spacetime-election-8ac1992c7b71f15757f62e11af51abc3d3b9db8ed8ed6804f4f06842d6d23bc5.params": {
"cid": "QmQy5eJwSTyWhRj3eTofVKs7TF1c9FdXUKMKjfwniiLJDE",
"digest": "a88c8497274ca648d7f4e1c25b4c9cb8",
"v19-proof-of-spacetime-election-512f5e6dc00a37fa13c8b0e468188f85957b7bf1ab36d17fb9fe9ed49ae8d657.params": {
"cid": "QmYf1532WoeXhy8AoduWNxpBuwn5DEkpU6YFDGCXh1mqBX",
"digest": "983e641f9df01799bc33d5fb3c3020b2",
"sector_size": 1073741824
},
"v18-proof-of-spacetime-election-8ac1992c7b71f15757f62e11af51abc3d3b9db8ed8ed6804f4f06842d6d23bc5.vk": {
"cid": "QmR5HvUPWfoB1zJmG87dZdD8NrwseUgAkjau7j99RJrvVZ",
"digest": "499db4ed613683f430ba7fafd01f52e6",
"v19-proof-of-spacetime-election-512f5e6dc00a37fa13c8b0e468188f85957b7bf1ab36d17fb9fe9ed49ae8d657.vk": {
"cid": "QmVig7LUpNSXUcfjkSxUKsFaxqYxEZdaEARWvi14sbihJ4",
"digest": "e1f7a46b60217f1dddf56671dd86e6a7",
"sector_size": 1073741824
},
"v18-stacked-proof-of-replication-5a438611c880423c4f5199787cd531b197846ef46af40af69222467ab9073226.params": {
"v19-proof-of-spacetime-election-6c7cbfe7eed40b6c0b23a213a70648770aed65d9ca03ae85451573c18532304b.params": {
"cid": "QmSTF7C6vQbV6qjEQknXpBDuixBkxYeMshX25NonjJxjbi",
"digest": "b434ece6a37e588ca11ed117f1c14325",
"sector_size": 16777216
},
"v19-proof-of-spacetime-election-6c7cbfe7eed40b6c0b23a213a70648770aed65d9ca03ae85451573c18532304b.vk": {
"cid": "QmaFV9n5scuYxKc9QpJnbBUf4sjhkUzpZ7QkoTqL8XsNQz",
"digest": "9c2e40b6635470d3674324b01c9a3976",
"sector_size": 16777216
},
"v19-stacked-proof-of-replication-5a438611c880423c4f5199787cd531b197846ef46af40af69222467ab9073226.params": {
"cid": "QmQb5mc3ksZh2K5GsNwJrkwuHoWXh8adBdJV3qTbFaRvGe",
"digest": "a187287b1d03cd7ec4f1fccd57f3f3d1",
"sector_size": 1024
},
"v18-stacked-proof-of-replication-5a438611c880423c4f5199787cd531b197846ef46af40af69222467ab9073226.vk": {
"v19-stacked-proof-of-replication-5a438611c880423c4f5199787cd531b197846ef46af40af69222467ab9073226.vk": {
"cid": "QmYUjFHzeX22dfzv9wQxF4Qn8wS67bqBwr1Wcz2rga9rAZ",
"digest": "747792363f08d7b53be1a2f51f91582a",
"sector_size": 1024
},
"v18-stacked-proof-of-replication-6ae8ae8998ef393ffd171487bc5141fa3642e9fd39e3a7dbada4f6e7bacffb9b.params": {
"v19-stacked-proof-of-replication-6ae8ae8998ef393ffd171487bc5141fa3642e9fd39e3a7dbada4f6e7bacffb9b.params": {
"cid": "QmRUZqCwYdcVfQ49Z97g2xkJnaSh4b9SHWwfB3kgZiPo9L",
"digest": "b9494e0ae432a0ebde9c8c877c914583",
"sector_size": 16777216
},
"v18-stacked-proof-of-replication-6ae8ae8998ef393ffd171487bc5141fa3642e9fd39e3a7dbada4f6e7bacffb9b.vk": {
"v19-stacked-proof-of-replication-6ae8ae8998ef393ffd171487bc5141fa3642e9fd39e3a7dbada4f6e7bacffb9b.vk": {
"cid": "QmXngrBy74h8LYhYrbBpefXsXQFWLU3WX3LTXnVQnu1Sdc",
"digest": "af2c0d6834fa581b6f507f8266244dfb",
"sector_size": 16777216
},
"v18-stacked-proof-of-replication-d2ca0f634aebcecba88904612ff82f2349b080b1290879f3fba73c1d9a13d84e.params": {
"v19-stacked-proof-of-replication-d2ca0f634aebcecba88904612ff82f2349b080b1290879f3fba73c1d9a13d84e.params": {
"cid": "QmfNstuJFKnBt4yJHsNfoKahn1LafBdpJju23U5UNZd9Xy",
"digest": "3911d84ca2b86f491bc7c6372d7d9285",
"sector_size": 268435456
},
"v18-stacked-proof-of-replication-d2ca0f634aebcecba88904612ff82f2349b080b1290879f3fba73c1d9a13d84e.vk": {
"v19-stacked-proof-of-replication-d2ca0f634aebcecba88904612ff82f2349b080b1290879f3fba73c1d9a13d84e.vk": {
"cid": "QmQgSRQBbp7udHDp5pNA3GSCjSyXktUHBw15wx9meL4wgc",
"digest": "ecd2a9bdd178b0ebc9110f568fd70d07",
"sector_size": 268435456
},
"v18-stacked-proof-of-replication-f7b95455d6b7a5e967388a97c2ddc01807eff4c1736e84be4554853bf7783105.params": {
"v19-stacked-proof-of-replication-f7b95455d6b7a5e967388a97c2ddc01807eff4c1736e84be4554853bf7783105.params": {
"cid": "QmV5mAkhohUHPRWoNtS3Uo4yvmF23CR2u8JxeeCqthMCdX",
"digest": "9306d91c3518b87016d5efc19428b25e",
"sector_size": 1073741824
},
"v18-stacked-proof-of-replication-f7b95455d6b7a5e967388a97c2ddc01807eff4c1736e84be4554853bf7783105.vk": {
"v19-stacked-proof-of-replication-f7b95455d6b7a5e967388a97c2ddc01807eff4c1736e84be4554853bf7783105.vk": {
"cid": "QmPjwPdUQJmqp2rQuJX2dy57AC9YCwYtMHdpZzW5BG9JWh",
"digest": "a2004fca043da423df51f6c4bb65788c",
"sector_size": 1073741824
Expand Down
12 changes: 12 additions & 0 deletions filecoin-proofs/src/api/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ pub fn generate_candidates(
replicas: &BTreeMap<SectorId, PrivateReplicaInfo>,
prover_id: ProverId,
) -> Result<Vec<Candidate>> {
info!("generate_candidates:start");

let vanilla_params = post_setup_params(post_config);
let setup_params = compound_proof::SetupParams {
vanilla_params,
Expand Down Expand Up @@ -212,6 +214,8 @@ pub fn generate_candidates(
randomness,
)?;

info!("generate_candidates:finish");

Ok(candidates)
}

Expand All @@ -232,6 +236,8 @@ pub fn generate_post(
winners: Vec<Candidate>,
prover_id: ProverId,
) -> Result<Vec<SnarkProof>> {
info!("generate_post:start");

let sector_count = replicas.len() as u64;
ensure!(sector_count > 0, "Must supply at least one replica");

Expand Down Expand Up @@ -282,6 +288,8 @@ pub fn generate_post(
proofs.push(proof.to_vec());
}

info!("generate_post:finish");

Ok(proofs)
}

Expand All @@ -295,6 +303,8 @@ pub fn verify_post(
winners: &[Candidate],
prover_id: ProverId,
) -> Result<bool> {
info!("verify_post:start");

let sector_count = replicas.len() as u64;
ensure!(sector_count > 0, "Must supply at least one replica");
ensure!(
Expand Down Expand Up @@ -357,5 +367,7 @@ pub fn verify_post(
}
}

info!("verify_post:finish");

Ok(true)
}
8 changes: 2 additions & 6 deletions storage-proofs/src/circuit/election_post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,8 @@ mod tests {

assert!(cs.is_satisfied(), "constraints not satisfied");

assert_eq!(cs.num_inputs(), 131, "wrong number of inputs");
assert_eq!(
cs.num_constraints(),
1_060_863,
"wrong number of constraints"
);
assert_eq!(cs.num_inputs(), 69, "wrong number of inputs");
assert_eq!(cs.num_constraints(), 549_549, "wrong number of constraints");
assert_eq!(cs.get_input(0, "ONE"), Fr::one());

let generated_inputs = ElectionPoStCompound::<PedersenHasher>::generate_public_inputs(
Expand Down
5 changes: 5 additions & 0 deletions storage-proofs/src/compound_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ where
// This will always run at least once, since there cannot be zero partitions.
assert!(partition_count > 0);

info!("vanilla_proof:start");
let vanilla_proofs =
S::prove_all_partitions(&pub_params.vanilla_params, &pub_in, priv_in, partitions)?;

info!("vanilla_proof:finish");

let sanity_check =
S::verify_all_partitions(&pub_params.vanilla_params, &pub_in, &vanilla_proofs)?;
assert!(sanity_check, "sanity check failed");
Expand All @@ -90,6 +93,7 @@ where
.build()
.expect("failed to build thread pool");

info!("snark_proof:start");
let groth_proofs: Result<Vec<_>> = pool.install(|| {
vanilla_proofs
.par_iter()
Expand All @@ -103,6 +107,7 @@ where
})
.collect()
});
info!("snark_proof:finish");

Ok(MultiProof::new(groth_proofs?, &groth_params.vk))
}
Expand Down
8 changes: 5 additions & 3 deletions storage-proofs/src/election_post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::sector::*;
use crate::stacked::hash::hash3;
use crate::util::NODE_SIZE;

pub const POST_CHALLENGE_COUNT: usize = 8;
pub const POST_CHALLENGED_NODES: usize = 16;
pub const POST_CHALLENGE_COUNT: usize = 66;
pub const POST_CHALLENGED_NODES: usize = 1;

#[derive(Debug, Clone)]
pub struct SetupParams {
Expand All @@ -38,8 +38,10 @@ pub struct PublicParams {
impl ParameterSetMetadata for PublicParams {
fn identifier(&self) -> String {
format!(
"ElectionPoSt::PublicParams{{sector_size: {}}}",
"ElectionPoSt::PublicParams{{sector_size: {}, count: {}, nodes: {}}}",
self.sector_size(),
POST_CHALLENGE_COUNT,
POST_CHALLENGED_NODES,
)
}

Expand Down
2 changes: 1 addition & 1 deletion storage-proofs/src/parameter_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
use std::time::Instant;

/// Bump this when circuits change to invalidate the cache.
pub const VERSION: usize = 18;
pub const VERSION: usize = 19;

pub const PARAMETER_CACHE_ENV_VAR: &str = "FIL_PROOFS_PARAMETER_CACHE";

Expand Down

0 comments on commit ed3d65d

Please sign in to comment.