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: vulnerabilities in private refunds #7424

Closed
wants to merge 8 commits into from
Closed
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
20 changes: 20 additions & 0 deletions noir-projects/aztec-nr/aztec/src/generators.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use dep::protocol_types::point::Point;

// A set of generators generated with `derive_generators(...)` function from noir::std
global Ga1 = Point { x: 0x30426e64aee30e998c13c8ceecda3a77807dbead52bc2f3bf0eae851b4b710c1, y: 0x113156a068f603023240c96b4da5474667db3b8711c521c748212a15bc034ea6, is_infinite: false };
global Ga2 = Point { x: 0x2825c79cc6a5cbbeef7d6a8f1b6a12b312aa338440aefeb4396148c89147c049, y: 0x129bfd1da54b7062d6b544e7e36b90736350f6fba01228c41c72099509f5701e, is_infinite: false };
global Ga3 = Point { x: 0x0edb1e293c3ce91bfc04e3ceaa50d2c541fa9d091c72eb403efb1cfa2cb3357f, y: 0x1341d675fa030ece3113ad53ca34fd13b19b6e9762046734f414824c4d6ade35, is_infinite: false };

mod test {
use crate::generators::{Ga1, Ga2, Ga3};
use dep::protocol_types::point::Point;
use std::hash::derive_generators;

#[test]
fn test_generators() {
let generators: [Point; 3] = derive_generators("aztec_nr_generators".as_bytes(), 0);
assert_eq(generators[0], Ga1);
assert_eq(generators[1], Ga2);
assert_eq(generators[2], Ga3);
}
}
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
2 changes: 1 addition & 1 deletion noir-projects/noir-contracts/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ members = [
"contracts/pending_note_hashes_contract",
"contracts/price_feed_contract",
"contracts/private_fpc_contract",
"contracts/private_token_contract",
"contracts/token_with_refunds_contract",
"contracts/schnorr_account_contract",
"contracts/schnorr_hardcoded_account_contract",
"contracts/schnorr_single_key_account_contract",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ type = "contract"
[dependencies]
aztec = { path = "../../../aztec-nr/aztec" }
authwit = { path = "../../../aztec-nr/authwit" }
private_token = { path = "../private_token_contract" }
token_with_refunds = { path = "../token_with_refunds_contract" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod lib;
contract PrivateFPC {
use dep::aztec::protocol_types::{abis::log_hash::LogHash, address::AztecAddress, hash::poseidon2_hash};
use dep::aztec::state_vars::SharedImmutable;
use dep::private_token::PrivateToken;
use dep::token_with_refunds::TokenWithRefunds;
use crate::lib::emit_randomness_as_unencrypted_log;

#[aztec(storage)]
Expand Down Expand Up @@ -31,7 +31,7 @@ contract PrivateFPC {
// We emit fee payer randomness to ensure FPC admin can reconstruct their fee note
emit_randomness_as_unencrypted_log(&mut context, fee_payer_randomness);

PrivateToken::at(asset).setup_refund(
TokenWithRefunds::at(asset).setup_refund(
storage.admin_npk_m_hash.read_private(),
context.msg_sender(),
amount,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "private_token_contract"
name = "token_contract"
authors = [""]
compiler_version = ">=0.25.0"
type = "contract"
Expand Down
Loading
Loading