Skip to content

Commit

Permalink
fix: Add necessary unsafe blocks (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtriley2p authored Jan 16, 2025
1 parent 221d656 commit dbd41da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit dbd41da

Please sign in to comment.