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: Add necessary unsafe blocks #23

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl<Params> Curve<Params> {
let x2 = other.x;
let y1 = self.y;
let y2 = other.y;
let (x, y, lambda) = __add_unconstrained(x1, x2, y1, y2, a, d);
let (x, y, lambda) = unsafe { __add_unconstrained(x1, x2, y1, y2, a, d) };
let x1x2 = x1 * x2;
let x1y2 = x1 * y2;
std::as_witness(x1x2);
Expand All @@ -349,7 +349,7 @@ impl<Params> Curve<Params> {
fn dbl_internal(self, a: Field, d: Field) -> Self {
let x1 = self.x;
let y1 = self.y;
let (x3, y3, _) = __add_unconstrained(x1, x1, y1, y1, a, d);
let (x3, y3, _) = unsafe { __add_unconstrained(x1, x1, y1, y1, a, d) };
let x1x1a = x1 * x1 * a;
std::as_witness(x1x1a);
// t1 = a*x_1^2 + y_1^2
Expand Down
2 changes: 1 addition & 1 deletion src/scalar_field.nr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<let N: u32> std::convert::From<Field> for ScalarField<N> {
/// (e.g. sum of slices != x + modulus)
fn from(x: Field) -> Self {
let mut result: Self = ScalarField { base4_slices: [0; N], skew: false };
let (slices, skew): ([u8; N], bool) = get_wnaf_slices(x);
let (slices, skew): ([u8; N], bool) = unsafe { get_wnaf_slices(x) };
result.base4_slices = slices;
result.skew = skew;
if (N < 64) {
Expand Down
Loading