Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ns/bench zk cs ghl #1825

Merged
merged 2 commits into from
Dec 2, 2024
Merged

Ns/bench zk cs ghl #1825

merged 2 commits into from
Dec 2, 2024

Conversation

nsarlin-zama
Copy link
Contributor

@nsarlin-zama nsarlin-zama commented Nov 26, 2024

PR content/description

Adds a bench to compare ghl and cs bounds for zk v2. Also add some limit tests for zk with extreme but supported values

@nsarlin-zama
Copy link
Contributor Author

@nsarlin-zama nsarlin-zama changed the base branch from main to ns/zk_test_bad_delta November 26, 2024 15:09
ComputeLoad::Verify => "compute_load_verify",
};
let bench_id = format!("{bench_name}::{param_name}_{bits}_bits_packed_{zk_load}");
let bench_id = format!("{bench_name}::{param_name}_{bits}_bits_packed_{load}_{bound:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug formatting of bounds is ok for our format ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will print "GHL" or "CS", which is ok as David confirmed

Comment on lines 462 to 465
#[allow(unused)]
pub fn init_params_v2_ghl(
test_params: PkeTestParameters,
) -> (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be a single function taking the bound kind and then match in there, otherwise the caller needs to know how this works

})
.checked_mul(B_squared + (sqr((d + 2) as u128) * (d + k) as u128) / 4)
.unwrap_or_else(|| {
panic!("Invalid parameters for zk_pok, B_squared: {B_squared}, d: {d}, k: {k}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a clearer error message please

// safely used for this
assert!(
m_bound <= 64,
"Invalid parameters for zk_pok, B_squared: {B_squared}, d: {d}, k: {k}, m_bound: {m_bound} > 64"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for the m_bound could be "we only support 64 bits integer, the computed m parameter is {m_bound} bits > 64 bits"

Base automatically changed from ns/zk_test_bad_delta to main November 29, 2024 15:00
@zama-bot zama-bot removed the approved label Nov 29, 2024
@nsarlin-zama nsarlin-zama merged commit 95772b5 into main Dec 2, 2024
105 checks passed
@nsarlin-zama nsarlin-zama deleted the ns/bench_zk_cs_ghl branch December 2, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants