Skip to content

Commit

Permalink
Rename all params
Browse files Browse the repository at this point in the history
  • Loading branch information
autquis committed Nov 13, 2023
1 parent 80f44ca commit 890b4b1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
20 changes: 10 additions & 10 deletions poly-commit/src/linear_codes/brakedown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ where
}

fn leaf_hash_param(&self) -> &<<C as Config>::LeafHash as CRHScheme>::Parameters {
&self.leaf_hash_params
&self.leaf_hash_param
}

fn two_to_one_hash_param(
&self,
) -> &<<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters {
&self.two_to_one_params
&self.two_to_one_hash_param
}

fn col_hash_params(&self) -> &<H as CRHScheme>::Parameters {
Expand All @@ -104,8 +104,8 @@ where
rng: &mut R,
poly_len: usize,
check_well_formedness: bool,
leaf_hash_params: LeafParam<C>,
two_to_one_params: TwoToOneParam<C>,
leaf_hash_param: LeafParam<C>,
two_to_one_hash_param: TwoToOneParam<C>,
col_hash_params: H::Parameters,
) -> Self {
let sec_param = 128;
Expand Down Expand Up @@ -136,8 +136,8 @@ where
a_mats,
b_mats,
check_well_formedness,
leaf_hash_params,
two_to_one_params,
leaf_hash_param,
two_to_one_hash_param,
col_hash_params,
)
}
Expand All @@ -156,8 +156,8 @@ where
a_mats: Vec<SprsMat<F>>,
b_mats: Vec<SprsMat<F>>,
check_well_formedness: bool,
leaf_hash_params: LeafParam<C>,
two_to_one_params: TwoToOneParam<C>,
leaf_hash_param: LeafParam<C>,
two_to_one_hash_param: TwoToOneParam<C>,
col_hash_params: H::Parameters,
) -> Self {
let m_ext = if a_dims.is_empty() {
Expand Down Expand Up @@ -196,8 +196,8 @@ where
a_mats,
b_mats,
check_well_formedness,
leaf_hash_params,
two_to_one_params,
leaf_hash_param,
two_to_one_hash_param,
col_hash_params,
}
}
Expand Down
4 changes: 2 additions & 2 deletions poly-commit/src/linear_codes/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ pub struct BrakedownPCParams<F: PrimeField, C: Config, H: CRHScheme> {
pub(crate) check_well_formedness: bool,
/// Parameters for hash function of Merkle tree leaves
#[derivative(Debug = "ignore")]
pub(crate) leaf_hash_params: LeafParam<C>,
pub(crate) leaf_hash_param: LeafParam<C>,
/// Parameters for hash function of Merke tree combining two nodes into one
#[derivative(Debug = "ignore")]
pub(crate) two_to_one_params: TwoToOneParam<C>,
pub(crate) two_to_one_hash_param: TwoToOneParam<C>,
// Parameters for obtaining leaf digest from leaf value.
#[derivative(Debug = "ignore")]
pub(crate) col_hash_params: H::Parameters,
Expand Down
22 changes: 11 additions & 11 deletions poly-commit/src/linear_codes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ where
max_degree: usize,
num_vars: Option<usize>,
rng: &mut R,
leaf_hash_params: <<C as Config>::LeafHash as CRHScheme>::Parameters,
two_to_one_params: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters,
leaf_hash_param: <<C as Config>::LeafHash as CRHScheme>::Parameters,
two_to_one_hash_param: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters,
col_hash_params: H::Parameters,
) -> Self::LinCodePCParams;

Expand Down Expand Up @@ -189,17 +189,17 @@ where
num_vars: Option<usize>,
rng: &mut R,
) -> Result<Self::UniversalParams, Self::Error> {
let leaf_hash_params = <C::LeafHash as CRHScheme>::setup(rng).unwrap();
let two_to_one_params = <C::TwoToOneHash as TwoToOneCRHScheme>::setup(rng)
let leaf_hash_param = <C::LeafHash as CRHScheme>::setup(rng).unwrap();
let two_to_one_hash_param = <C::TwoToOneHash as TwoToOneCRHScheme>::setup(rng)
.unwrap()
.clone();
let col_hash_params = <H as CRHScheme>::setup(rng).unwrap();
let pp = L::setup::<R>(
max_degree,
num_vars,
rng,
leaf_hash_params,
two_to_one_params,
leaf_hash_param,
two_to_one_hash_param,
col_hash_params,
);
let real_max_degree = <Self::UniversalParams as PCUniversalParams>::max_degree(&pp);
Expand Down Expand Up @@ -263,7 +263,7 @@ where
leaves,
};
let mut leaves: Vec<C::Leaf> =
state.leaves.clone().into_iter().map(|h| h.into()).collect(); // TODO cfg_inter
state.leaves.clone().into_iter().map(|h| h.into()).collect();
let col_tree = create_merkle_tree::<C>(
&mut leaves,
ck.leaf_hash_param(),
Expand Down Expand Up @@ -343,7 +343,7 @@ where
leaves: col_hashes,
} = states[i];
let mut col_hashes: Vec<C::Leaf> =
col_hashes.clone().into_iter().map(|h| h.into()).collect(); // TODO cfg_inter
col_hashes.clone().into_iter().map(|h| h.into()).collect();

let col_tree = create_merkle_tree::<C>(
&mut col_hashes,
Expand Down Expand Up @@ -429,9 +429,9 @@ where
)
));
}
let leaf_hash_params: &<<C as Config>::LeafHash as CRHScheme>::Parameters =
let leaf_hash_param: &<<C as Config>::LeafHash as CRHScheme>::Parameters =
vk.leaf_hash_param();
let two_to_one_params: &<<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters =
let two_to_one_hash_param: &<<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters =
vk.two_to_one_hash_param();

for (i, labeled_commitment) in labeled_commitments.iter().enumerate() {
Expand Down Expand Up @@ -508,7 +508,7 @@ where
return Err(Error::InvalidCommitment);
}

path.verify(leaf_hash_params, two_to_one_params, root, leaf.clone())
path.verify(leaf_hash_param, two_to_one_hash_param, root, leaf.clone())
.map_err(|_| Error::InvalidCommitment)?;
}

Expand Down
8 changes: 4 additions & 4 deletions poly-commit/src/linear_codes/multilinear_brakedown/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ where
_max_degree: usize,
num_vars: Option<usize>,
rng: &mut R,
leaf_hash_params: <<C as Config>::LeafHash as CRHScheme>::Parameters,
two_to_one_params: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters,
leaf_hash_param: <<C as Config>::LeafHash as CRHScheme>::Parameters,
two_to_one_hash_param: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters,
col_hash_params: H::Parameters,
) -> Self::LinCodePCParams {
Self::LinCodePCParams::default(
rng,
1 << num_vars.unwrap(),
true,
leaf_hash_params,
two_to_one_params,
leaf_hash_param,
two_to_one_hash_param,
col_hash_params,
)
}
Expand Down
8 changes: 4 additions & 4 deletions poly-commit/src/linear_codes/multilinear_brakedown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ mod tests {
let mut rng = &mut test_rng();
let num_vars = 11;
// just to make sure we have the right degree given the FFT domain for our field
let leaf_hash_params = <LeafH as CRHScheme>::setup(&mut rng).unwrap();
let two_to_one_params = <CompressH as TwoToOneCRHScheme>::setup(&mut rng)
let leaf_hash_param = <LeafH as CRHScheme>::setup(&mut rng).unwrap();
let two_to_one_hash_param = <CompressH as TwoToOneCRHScheme>::setup(&mut rng)
.unwrap()
.clone();
let col_hash_params = <ColHasher<Fr, Blake2s256> as CRHScheme>::setup(&mut rng).unwrap();
Expand All @@ -98,8 +98,8 @@ mod tests {
rng,
1 << num_vars,
check_well_formedness,
leaf_hash_params,
two_to_one_params,
leaf_hash_param,
two_to_one_hash_param,
col_hash_params,
);

Expand Down

0 comments on commit 890b4b1

Please sign in to comment.