Skip to content

Commit

Permalink
refactor: make configuration more obvious (#1716)
Browse files Browse the repository at this point in the history
Instead of creating two configs, that depend on each other, create
a single one in the most straightforward way.
  • Loading branch information
vmx committed Sep 13, 2023
1 parent 8ce806e commit d23f3bc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions storage-proofs-porep/src/stacked/vanilla/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,16 +1930,12 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr
let tree_count = get_base_tree_count::<Tree>();
let nodes_count = leaf_count / tree_count;

let config = StoreConfig::new(
cache_path.as_ref(),
CacheKey::CommRLastTree.to_string(),
default_rows_to_discard(nodes_count, Tree::Arity::to_usize()),
);
let tree_r_last_config = StoreConfig::from_config(
&config,
CacheKey::CommRLastTree.to_string(),
Some(get_merkle_tree_len(nodes_count, Tree::Arity::to_usize())?),
);
let tree_r_last_config = StoreConfig {
path: cache_path.as_ref().into(),
id: CacheKey::CommRLastTree.to_string(),
size: Some(get_merkle_tree_len(nodes_count, Tree::Arity::to_usize())?),
rows_to_discard: default_rows_to_discard(nodes_count, Tree::Arity::to_usize()),
};

// Encode original data into the last layer.
info!("building tree_r_last");
Expand Down

0 comments on commit d23f3bc

Please sign in to comment.