Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kek kek kek committed Oct 27, 2023
1 parent f208f14 commit 86c52da
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/integration-tests/circuits/recursion/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main(
public_inputs : [Field; 1],
key_hash : Field,
input_aggregation_object : [Field; 16],
) -> pub [Field;16] {
) -> pub [Field; 16] {
let vk : [Field] = verification_key;
let p : [Field] = proof;
let pi : [Field] = public_inputs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ fn main() {
assert(p5_affine.eq(Gaffine::zero()));

// Check that these points are on the curve
assert(bjj_affine.contains(bjj_affine.gen) & bjj_affine.contains(p1_affine) & bjj_affine.contains(p2_affine) & bjj_affine.contains(p3_affine) & bjj_affine.contains(p4_affine) & bjj_affine.contains(p5_affine));
assert(
bjj_affine.contains(bjj_affine.gen) &
bjj_affine.contains(p1_affine) &
bjj_affine.contains(p2_affine) &
bjj_affine.contains(p3_affine) &
bjj_affine.contains(p4_affine) &
bjj_affine.contains(p5_affine)
);

// Test CurveGroup equivalents
let bjj = bjj_affine.into_group(); // Baby Jubjub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ fn main() {

// Test addition
let p1_affine = Gaffine::new(
17777552123799933955779906779655732241715742912184938656739573121738514868268, 2626589144620713026669568689430873010625803728049924121243784502389097019475
17777552123799933955779906779655732241715742912184938656739573121738514868268,
2626589144620713026669568689430873010625803728049924121243784502389097019475
);
let p2_affine = Gaffine::new(
16540640123574156134436876038791482806971768689494387082833631921987005038935, 20819045374670962167435360035096875258406992893633759881276124905556507972311
16540640123574156134436876038791482806971768689494387082833631921987005038935,
20819045374670962167435360035096875258406992893633759881276124905556507972311
);
let _p3_affine = bjj_affine.add(p1_affine, p2_affine);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,15 @@ unconstrained fn merge_slices_else(x: Field) {
// Test returning a merged slice without a mutation
unconstrained fn merge_slices_return(x: Field, y: Field) -> [Field] {
let slice = [0; 2];
if x != y { if x != 20 { slice.push_back(y) } else { slice } } else { slice }
if x != y {
if x != 20 {
slice.push_back(y)
} else {
slice
}
} else {
slice
}
}

// Test mutating a slice inside of an if statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ fn main(
// Receiver public key
to_pubkey_x: Field,
to_pubkey_y: Field,
) -> pub [Field; 2]
{
) -> pub [Field; 2] {
// Compute public key from private key to show ownership
let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0);
let pubkey_x = pubkey[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ fn main(pair : (Field, Field), x: [(u8, u8, u8); 2], struct_pair: (Foo, Bar)) ->
assert(struct_pair.0.bar.inner == [100, 101, 102]);
assert(struct_pair.1.inner == [103, 104, 105]);

let (u, v) = if pair.0 as u32 < 1 { (pair.0, pair.0 + 1) } else { (pair.0 + 1, pair.0) };
let (u, v) = if pair.0 as u32 < 1 {
(pair.0, pair.0 + 1)
} else {
(pair.0 + 1, pair.0)
};

assert(u == pair.0 + 1);
assert(v == pair.0);

Expand Down

0 comments on commit 86c52da

Please sign in to comment.