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

fix: improve R1CS folding test to verify cross-terms #311

Conversation

0xObsidian
Copy link
Contributor

The test previously only checked folding of identical instances, missing cross-term verification.

Description

Now it:

  • Tests different R1CS instances (x=3 and x=-2)
  • Explicitly verifies cross-term computation (Az₁Bz₂ + Az₂Bz₁ - u₁Cz₂ - u₂Cz₁)
  • Verifies the complete folding operation with different instances

Testing the introduced fix

clone this pr branch and from the root directory, run:

cargo test --package nexus-nova --lib -- r1cs::tests::folded_with_relaxed_instance_is_satisfied --exact --show-output

Impact

This PR closes ticket #288

The test previously only checked folding of identical
instances, missing cross-term verification.

Description
-----------
Now it:
- Tests different R1CS instances (x=3 and x=-2)
- Explicitly verifies cross-term computation
  (Az₁Bz₂ + Az₂Bz₁ - u₁Cz₂ - u₂Cz₁)
- Verifies the complete folding operation with
  different instances

Testing the introduced fix
--------------------------
clone this pr branch and from the root directory, run:
----
cargo test --package nexus-nova --lib -- r1cs::tests::folded_with_relaxed_instance_is_satisfied --exact --show-output
----
@0xObsidian
Copy link
Contributor Author

0xObsidian commented Dec 11, 2024

Hi @h-hafezi and @sjudson
Feel free to let me know if you have any questions regarding this PR which addressing issue #288

@sjudson sjudson linked an issue Dec 11, 2024 that may be closed by this pull request
@sjudson
Copy link
Contributor

sjudson commented Dec 11, 2024

Thank you for this, we will review.

@sjudson sjudson self-requested a review December 11, 2024 14:20
@0xObsidian
Copy link
Contributor Author

@sjudson
Thank you for this, we will review.

Thanks, feel free to let me know if you have any questions

Copy link
Contributor

@sjudson sjudson left a comment

Choose a reason for hiding this comment

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

Finally got a chance to review, looks great!

@sjudson sjudson merged commit f594536 into nexus-xyz:main Jan 8, 2025
9 checks passed
@0xObsidian
Copy link
Contributor Author

Finally got a chance to review, looks great!

Hi @sjudson, thanks

@0xObsidian 0xObsidian deleted the 0xObsidian/improve-R1CS-folding-to-verify-crossterms branch January 10, 2025 15:47
sjudson added a commit that referenced this pull request Feb 12, 2025
* Baby steps towards porting over sdk.

* Sketch out updated traits.

* More work on new traits.

* More prep work.

* Move macros inboard to SDK and do a lot more prep.

* Incremental work towards building with nova.

* More work on Nova translation.

* Get Nova set.

* Get building with serialization.

* Make some lifetimes easier to manage.

* Minor.

* Work on examples.

* Add legacy examples.

* Get example building working.

* Start working on HyperNova

* Work around strange issue with implementation.

* Get hypernova example working.

* Port over Jolt.

* Format.

* Some trait cleaning up.

* More formatting.

* Even more formatting.

* Fix dependency.

* Fix traits and some implementations

* Minor.

* Try to fix CI error.

* Fix.

* Clippy.

* Clean up .cargo.

* Fix CI.

* Update integration tests.

* Start to work on Stwo integration.

* More work.

* More cleaning up of components.

* A lot of cleanup + redesign work.

* Add log capturing.

* More redesign of log handling.

* Big format.

* More work towards final version.

* Finish out compilation.

* Minor fixes and improvements.

* Extend use of InternalView for tests.

* Fix change.

* Fixes and formatting.

* Sketch out verification interfaces

* A lot of cleanup.

* More fixing.

* Getting there.

* Finish verification.

* Almost there...

* Get building.

* Some clippy.

* Finish clippy.

* Format.

* Fixing tests.

* Format.

* Get building.

* Formatting

* Minor.

* More.

* Somehow even more.

* Oh please make it stop...

* Improved logging elements.

* Fix tests.

* Fix

* More formatting.

* Start to work on examples.

* Get first example working.

* Get all examples working via COBS.

* Clippy

* Format.

* Update sdk/macros/Cargo.toml

Co-authored-by: Ben Hoberman <bhoberman@users.noreply.github.com>

* Minor.

* Fix testing infrastructure.

* Format.

* Move utility functions.

* Format.

* Fix cargo config.

* Fix branch.

* Fix no input examples.

* Getting legacy examples working...

* Add feature gating.

* Port over minimal cli with host program setup.

* Update README.

* Format.

* Update header.

* Typo.

* More formatting.

* A few last fixes.

* Fix doctest.

* Temp improve main readme.

* Spruce up readme a bit more.

* Remove some todos.

* Add some clarifying comments.

* Carry raw logs.

---------

Co-authored-by: Ben Hoberman <bhoberman@users.noreply.github.com>
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.

[BUG]: RelaxedR1CS test isn't complete
2 participants