Skip to content

Commit

Permalink
Update SnapDeal production params (#1559)
Browse files Browse the repository at this point in the history
* feat: add trusted empty sector update parameters
* fix: remove parameter generation for empty sector update
* feat: add and adjust some logging
  • Loading branch information
cryptonemo authored Feb 2, 2022
1 parent b72bc95 commit de000dd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 35 deletions.
21 changes: 2 additions & 19 deletions filecoin-proofs/src/caches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,10 @@ pub fn get_empty_sector_update_params<Tree: 'static + MerkleTreeTrait<Hasher = T
PublicParams::from_sector_size(u64::from(porep_config.sector_size));

let parameters_generator = || {
// This is required for production and should replace the use
// of the RNG below for testing.
/*<EmptySectorUpdateCompound<Tree> as CompoundProof<
EmptySectorUpdate<Tree>,
EmptySectorUpdateCircuit<Tree>,
>>::groth_params::<OsRng>(None, &public_params)
.map_err(Into::into)*/

let mut rng = rand::rngs::OsRng; // FIXME: test parameters only
<EmptySectorUpdateCompound<Tree> as CompoundProof<
EmptySectorUpdate<Tree>,
EmptySectorUpdateCircuit<Tree>,
>>::groth_params::<OsRng>(Some(&mut rng), &public_params)
>>::groth_params::<OsRng>(None, &public_params)
.map_err(Into::into)
};

Expand Down Expand Up @@ -448,18 +439,10 @@ pub fn get_empty_sector_update_verifying_key<
PublicParams::from_sector_size(u64::from(porep_config.sector_size));

let vk_generator = || {
// This is required for production and should replace the use
// of the RNG below for testing.
/*let vk = <EmptySectorUpdateCompound<Tree> as CompoundProof<
EmptySectorUpdate<Tree>,
EmptySectorUpdateCircuit<Tree>,
>>::verifying_key::<OsRng>(None, &public_params)?;*/

let mut rng = rand::rngs::OsRng; // FIXME: test parameters only
let vk = <EmptySectorUpdateCompound<Tree> as CompoundProof<
EmptySectorUpdate<Tree>,
EmptySectorUpdateCircuit<Tree>,
>>::verifying_key::<OsRng>(Some(&mut rng), &public_params)?;
>>::verifying_key::<OsRng>(None, &public_params)?;
Ok(prepare_verifying_key(&vk))
};

Expand Down
36 changes: 28 additions & 8 deletions parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,43 @@
"sector_size": 2048
},
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.params": {
"cid": "QmeNqDvsvyam4vqwCkstbxgb9S7RZEUeBDrJvBWKcpFKr6",
"digest": "532b53883ed4f794cb9d0db583d0df59",
"cid": "QmNPc75iEfcahCwNKdqnWLtxnjspUGGR4iscjiz3wP3RtS",
"digest": "1b3cfd761a961543f9eb273e435a06a2",
"sector_size": 34359738368
},
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.vk": {
"cid": "QmdLWr6moLUPScJZwoBckWqAeJkrBPAJPNLz8mWAfTdmXH",
"digest": "46990eb1bf5159c394a10309f269c1b6",
"cid": "QmdFFUe1gcz9MMHc6YW8aoV48w4ckvcERjt7PkydQAMfCN",
"digest": "3a6941983754737fde880d29c7094905",
"sector_size": 34359738368
},
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.params": {
"cid": "QmdQsi9uFhxK9cGwuK4rHuwKQoHkz6upYTCz4UdLiy1vA2",
"digest": "4223c63dbd94de1538006a14f37179e3",
"cid": "QmUB6xTVjzBQGuDNeyJMrrJ1byk58vhPm8eY2Lv9pgwanp",
"digest": "1a392e7b759fb18e036c7559b5ece816",
"sector_size": 68719476736
},
"v28-empty-sector-update-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.vk": {
"cid": "QmPirFX9wX99iMGA6zFY2CvcrdcDkj73X4MP6DLduvpbk9",
"digest": "ce39b614d788d3aef26bac1b28521d94",
"cid": "Qmd794Jty7k26XJ8Eg4NDEks65Qk8G4GVfGkwqvymv8HAg",
"digest": "80e366df2f1011953c2d01c7b7c9ee8e",
"sector_size": 68719476736
},
"v28-empty-sector-update-poseidon-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.params": {
"cid": "QmfK4tonETepL6F4kDFdJ3fr72fzRWoRPf3XGMhV3RLX1S",
"digest": "b69983b5d7a97a20f43b3d5ff2a4ed04",
"sector_size": 34359738368
},
"v28-empty-sector-update-poseidon-merkletree-poseidon_hasher-8-8-0-3b7f44a9362e3985369454947bc94022e118211e49fd672d52bec1cbfd599d18.vk": {
"cid": "QmYCTYJQPu8wgtB2rMZ7HJC9nDx8c1fzYRPdCUiErK4q5a",
"digest": "1ac05784f304129f74c5184190c1ec78",
"sector_size": 34359738368
},
"v28-empty-sector-update-poseidon-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.params": {
"cid": "QmNaaQXfm2NveN2Hf7bJ3udnQB2Qa4moMcUoJYJS6oWL6w",
"digest": "a6d4f96e2b641a6d7a1a8e6dc1155c8a",
"sector_size": 68719476736
},
"v28-empty-sector-update-poseidon-merkletree-poseidon_hasher-8-8-2-102e1444a7e9a97ebf1e3d6855dcc77e66c011ea66f936d9b2c508f87f2f83a7.vk": {
"cid": "QmXyeg9hbM7x9dGuUuAS68ozhiFEez4UkPTgwSDCVYKHBw",
"digest": "8e8fb9e2c56eb5d740d0de135305a7b8",
"sector_size": 68719476736
},
"v28-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.params": {
Expand Down
8 changes: 8 additions & 0 deletions storage-proofs-core/src/parameter_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ pub fn read_cached_params(cache_entry_path: &Path) -> Result<groth16::MappedPara
info!("checking cache_path: {:?} for parameters", cache_entry_path);

let verify_production_params = SETTINGS.verify_production_params;
info!(
"Verify production parameters is {}",
verify_production_params
);

// If the verify production params is set, we make sure that the path being accessed matches a
// production cache key, found in the 'srs-inner-product.json' file. The parameter data file is
Expand Down Expand Up @@ -483,6 +487,10 @@ fn read_cached_srs_key(cache_entry_path: &Path) -> Result<groth16::aggregate::Ge
info!("checking cache_path: {:?} for srs", cache_entry_path);

let verify_production_params = SETTINGS.verify_production_params;
info!(
"Verify production parameters is {}",
verify_production_params
);

// If the verify production params is set, we make sure that the path being accessed matches a
// production cache key, found in the 'parameters.json' file. The parameter data file is also
Expand Down
17 changes: 9 additions & 8 deletions storage-proofs-update/src/vanilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ where
let tree_d_arity = TreeDArity::to_usize();
let tree_d_nodes = tree_d_new_config.size.expect("config size failure");
trace!(
"Instantiating TreeDNew: leafs={}, base_store_size={})",
"Instantiating TreeDNew: leafs={}, base_store_size={}",
tree_d_leafs,
tree_d_nodes
);
Expand Down Expand Up @@ -592,13 +592,6 @@ where
tree_r_base_tree_count,
)?;

trace!("ReplicaConfig Path: {:?}", replica_config.path);
for config in &tree_r_configs {
trace!(
"StoreConfig: {:?}",
StoreConfig::data_path(&config.path, &config.id)
);
}
trace!(
"Instantiating {}: arity={}-{}-{}, base_tree_count={}, base_store_size={}",
name,
Expand All @@ -608,6 +601,14 @@ where
tree_r_base_tree_count,
tree_r_base_tree_nodes,
);

trace!("ReplicaConfig Path: {:?}", replica_config.path);
for config in &tree_r_configs {
trace!(
"StoreConfig: {:?}",
StoreConfig::data_path(&config.path, &config.id)
);
}
create_lc_tree::<LCTree<TreeRHasher, TreeR::Arity, TreeR::SubTreeArity, TreeR::TopTreeArity>>(
tree_r_base_tree_nodes,
&tree_r_configs,
Expand Down

0 comments on commit de000dd

Please sign in to comment.