Skip to content

Refactor 2nd stage #77

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

Merged
merged 12 commits into from
Jul 24, 2025
Merged

Refactor 2nd stage #77

merged 12 commits into from
Jul 24, 2025

Conversation

omibo
Copy link
Contributor

@omibo omibo commented Jun 9, 2025

Summary

This PR completes the refactoring stage to enhance code efficiency and readability. The following changes have been made:

  1. Introduced the Norm trait in the ring module to remove repetetive norm computation functionalities.
  2. Split the verifier() function into smaller functions.
  3. Added documentation for the prover and verifier functions.

Next Steps

  1. Refactor the calculate_gh_ci_cj() and calculate_phi_z_c() functions.
  2. Replace usize data types with u32 or u64.
  3. Fix a bug in check_final_norm_sum(), which incorrectly compares the norm bound against beta instead of beta'. Currently, using beta' fails test_verify test case.

@omibo omibo force-pushed the refactor_2nd_stage branch from 282d82e to 0f9265c Compare June 23, 2025 00:12
@omibo
Copy link
Contributor Author

omibo commented Jun 23, 2025

Update

Recent commits resolve the following issues:

  1. check_final_norm_sum() is now correctly using beta_prime instead of beta.
  2. Fixed a flaw in norm computation that returned Zq elements; it now correctly returns a u128 value.

omibo added 5 commits June 22, 2025 23:42
1. Add documentation for subodules and functions of this module
2. Add debug_assert! for some checks in compile time.
3. Change some function names for better readability
…es the sqrt() and then again ^2 operations, and improve efficiency.`
…committing to.

Also, changed the norm bound of matrix_d in common_instances to cover the fact that in our implementation, values of h_ij garbage polynomial are twice the original implementation.
zq, rq, and rq_vector modules include:
1. mod tests for testing arithmatization and operation.
2. mod norm_tests for testing l2 and linf norms.
3. decomposition_tests for testing decomposition.
Copy link
Collaborator

@sonnetx sonnetx left a comment

Choose a reason for hiding this comment

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

It looks good generally, though maybe if we unified some of the constant definitions it would be helpful.

Copy link
Contributor

@NiDimi NiDimi left a comment

Choose a reason for hiding this comment

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

LGTM!

@NiDimi NiDimi merged commit 2161b79 into main Jul 24, 2025
2 checks passed
@NiDimi NiDimi deleted the refactor_2nd_stage branch July 24, 2025 08:42
@NiDimi NiDimi mentioned this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants