Skip to content

Commit

Permalink
fix: using different generators in private refund
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jul 10, 2024
1 parent b456086 commit 82d090e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 3 additions & 0 deletions noir-projects/aztec-nr/aztec/src/generators.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use dep::protocol_types::point::Point;

global G1 = Point { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };
1 change: 1 addition & 0 deletions noir-projects/aztec-nr/aztec/src/lib.nr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod context;
mod deploy;
mod generators;
mod hash;
mod history;
mod initializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ contract AvmTest {
use dep::aztec::oracle::get_contract_instance::{get_contract_instance_avm, get_contract_instance_internal_avm};
use dep::aztec::protocol_types::abis::function_selector::FunctionSelector;
use dep::aztec::context::gas::GasOpts;
use dep::aztec::generators::G1;
use dep::compressed_string::CompressedString;

#[aztec(storage)]
Expand Down Expand Up @@ -137,19 +138,16 @@ contract AvmTest {

#[aztec(public)]
fn elliptic_curve_add_and_double() -> Point {
let g = Point { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };

let doubled = g + g;
let added = g + doubled;
let doubled = G1 + G1;
let added = G1 + doubled;
added
}

#[aztec(public)]
fn variable_base_msm() -> Point {
let g = Point { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };
let scalar = Scalar { lo: 3, hi: 0 };
let scalar2 = Scalar { lo: 20, hi: 0 };
multi_scalar_mul([g, g], [scalar, scalar2])
multi_scalar_mul([G1, G1], [scalar, scalar2])
}

/************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use dep::aztec::{
prelude::{AztecAddress, NoteHeader, NoteInterface, PrivateContext},
protocol_types::{constants::GENERATOR_INDEX__NOTE_NULLIFIER, point::Point, scalar::Scalar, hash::poseidon2_hash},
note::utils::compute_note_hash_for_consumption, oracle::unsafe_rand::unsafe_rand,
keys::getters::get_nsk_app, note::note_getter_options::PropertySelector
keys::getters::get_nsk_app, note::note_getter_options::PropertySelector,
generators::G1,
};
use dep::std::field::bn254::decompose;
use dep::std::embedded_curve_ops::multi_scalar_mul;
Expand Down Expand Up @@ -32,8 +33,6 @@ trait PrivatelyRefundable {

global TOKEN_NOTE_LEN: Field = 3; // 3 plus a header.
global TOKEN_NOTE_BYTES_LEN: Field = 3 * 32 + 64;
// Grumpkin generator point.
global G1 = Point { x: 1, y: 17631683881184975370165255887551781615748388533673675138860, is_infinite: false };

#[aztec(note)]
struct TokenNote {
Expand Down

0 comments on commit 82d090e

Please sign in to comment.