Skip to content

Conversation

cypriansakwa
Copy link
Contributor

@cypriansakwa cypriansakwa commented Jun 2, 2025

Hi @critesjosh. When you get a chance, I’d appreciate your review on these changes.
Let me know if you'd like me to add any test cases or make adjustments!

Description

Generalized the circuit logic in main.nr:

  • Replaced the hardcoded assertion x * 2 + y == 9 with a parameterized version:
    x * 2 + y == expected.

  • This makes the circuit reusable for different inputs and expected outputs.

Added unit tests to verify correct behavior:

  • test_correct_values_case1 and test_correct_values_case2 test valid input-output combinations.

  • Left a commented-out failing test (test_incorrect_expected) to illustrate how the circuit responds to invalid expectations.

Problem*

The original circuit was hardcoded to assert that x * 2 + y == 9, limiting its reusability and flexibility.

Resolves

Summary*

This PR generalizes the Noir circuit in main.nr by:

  • Replacing the hardcoded check with a parameterized version: x * 2 + y == expected.
  • Making the circuit reusable for different public inputs and expected results.
  • Adding two unit tests (test_correct_values_case1 and test_correct_values_case2) to validate correct behavior.
  • Including a commented-out failing test (test_incorrect_expected) to illustrate failure behavior.

Additional Context

This improvement will help others reuse the same circuit for a range of values without changing the source code each time.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@cypriansakwa cypriansakwa changed the title Refactor verifier flow: update circuit, JS proof generation, and Soli… Generalize Circuit Logic and Add Unit Tests in main.nr Jun 2, 2025
@critesjosh
Copy link
Collaborator

Thanks for you contributions. I just added some new issues and tagged them with good first issue, would you be interested in taking on any of these?

@cypriansakwa
Copy link
Contributor Author

cypriansakwa commented Jun 5, 2025 via email

@cypriansakwa
Copy link
Contributor Author

Hi @critesjosh ! 👋

I've just synced everything with the latest changes and checked out this PR locally to ensure everything is clean and up to date. Let me know if there's anything else you'd like me to adjust or improve!

Looking forward to your feedback—thanks for taking the time to review it! 🙏

Copy link

socket-security bot commented Jun 10, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedreact-router-dom@​6.30.1981007399100
Addedwagmi@​2.14.91001007696100
Addedtoml@​3.0.01001009876100
Addedpostcss@​8.5.6991008192100
Addedvite@​5.4.19951008199100
Addedreact@​18.3.11001008397100
Addedtailwindcss@​4.1.111001008498100
Addedreact-toastify@​9.1.310010010084100
Addedsolidity-coverage@​0.8.169810010086100
Addedreact-dom@​18.3.11001009197100
Addedprettier@​3.6.19910010096100
Addedviem@​2.22.2110010010097100

View full report

@cypriansakwa
Copy link
Contributor Author

Hi @critesjosh,

Thanks for your work on the project! I have a couple of quick questions and would appreciate your clarification:

Has the proof generation using the bb CLI changed recently to no longer require splitting the proof and public inputs into two separate files? If so, will this be the new standard format going forward?

I also have seen a socket security image here—could you explain what it represents or its significance in the context of the project?
1

Thanks in advance!

Best regards

@cypriansakwa
Copy link
Contributor Author

Hi @critesjosh ! 👋

I've just synced everything with the latest changes and checked out this PR locally to ensure everything is clean and up to date. Let me know if there's anything else you'd like me to adjust or improve!

Looking forward to your feedback—thanks for taking the time to review it! 🙏

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.

2 participants