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 negation of coordinates in assert_equal_public_point #730

Merged
merged 2 commits into from
Jan 27, 2023

Conversation

moCello
Copy link
Member

@moCello moCello commented Jan 26, 2023

This change also required to change the negation of the constant in append_equal_constant.
Tests added as well.

Resolves #728

@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Merging #730 (fedebc8) into master (c162d2b) will decrease coverage by 0.05%.
The diff coverage is 89.23%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #730      +/-   ##
==========================================
- Coverage   85.07%   85.03%   -0.05%     
==========================================
  Files          47       47              
  Lines        3879     3922      +43     
==========================================
+ Hits         3300     3335      +35     
- Misses        579      587       +8     
Impacted Files Coverage Δ
tests/ecc.rs 82.35% <88.13%> (+0.59%) ⬆️
src/composer.rs 90.96% <100.00%> (-1.01%) ⬇️
tests/composer.rs 95.34% <100.00%> (-0.11%) ⬇️
src/permutation.rs 92.89% <0.00%> (+0.25%) ⬆️
src/fft/evaluations.rs 27.45% <0.00%> (+1.96%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c162d2b...fedebc8. Read the comment docs.

@moCello moCello self-assigned this Jan 26, 2023
@moCello moCello added the team:Core Low Level Core Development Team (Rust) label Jan 26, 2023
This change also required to change the negation of the constant
in `append_equal_constant`.
Tests added as well.

Resolves #728
Copy link
Member

@ureeves ureeves left a comment

Choose a reason for hiding this comment

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

LGTM. Some comments on the structure of the test, but if you don't think they make sense feel free to ignore.

tests/ecc.rs Outdated Show resolved Hide resolved
tests/ecc.rs Outdated Show resolved Hide resolved
tests/ecc.rs Outdated
Comment on lines 522 to 533
// Test:
// GENERATOR != 42 * GENERATOR
{
let scalar = JubJubScalar::from(42u64);
let point = dusk_jubjub::GENERATOR;
let public = dusk_jubjub::GENERATOR_EXTENDED * &scalar;
let circuit = DummyCircuit::new(point, public.into());

prover
.prove(rng, &circuit)
.expect_err("prover should fail because the points are not equal");
}
Copy link
Member

@ureeves ureeves Jan 27, 2023

Choose a reason for hiding this comment

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

I think it might be better to make these scopes a function that gets called with different points. Something like:

fn prove_equal_points(point: JubJubAffine, public: JubJubAffine) -> Result<(Proof, Vec<BlsScalar>), Error> {
    let circuit = DummyCircuit::new();
    prover.prove(rng, &circuit)
}

Copy link
Member Author

@moCello moCello Jan 27, 2023

Choose a reason for hiding this comment

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

that would mean cloning the prover and verifier for each of these functions. i think it's a bit of an overkill. But it might work with references. I'll give it some thought

Copy link
Member Author

Choose a reason for hiding this comment

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

naah, it would need two functions per TestCircuit, one for testing a satisfied circuit and one for testing an unsatisfied circuit and I also want to have custom failure messages for each test case. I think it wouldn't make things easier to read in the end. Also the TestCircuit itself doesn't exist outside of the test function etc... too complicated

@moCello moCello merged commit 44dbecb into master Jan 27, 2023
@moCello moCello deleted the mocello/ecc_tests branch January 27, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:Core Low Level Core Development Team (Rust)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix negation of public input in assert_equal_public_point
2 participants