Skip to content

[Bugfix]: utils::sqrt no longer maps negative values to 1#175

Open
PROWLERx15 wants to merge 2 commits intoLFDT-Lockness:cggmp24/mfrom
PROWLERx15:fix-return-value-utils-sqrt
Open

[Bugfix]: utils::sqrt no longer maps negative values to 1#175
PROWLERx15 wants to merge 2 commits intoLFDT-Lockness:cggmp24/mfrom
PROWLERx15:fix-return-value-utils-sqrt

Conversation

@PROWLERx15
Copy link
Copy Markdown

Fixes #57

utils::sqrt used to return 1 when Integer::sqrt_ref() was None (negative input). That hid bad values and made ZK failures harder to trace and debug.

sqrt now returns Option<Integer> and delegates to sqrt_ref(). Call sites in aux key refresh use .expect() for our own modulus and treat None as a fault when verifying another party’s decommitment.

Tests updated accordingly.

Signed-off-by: PROWLERx15 <prowlerx15@gmail.com>
Signed-off-by: PROWLERx15 <prowlerx15@gmail.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.

utils::sqrt should probably return an error for negative values

1 participant