From 33841a2dad9f06c81fb9fb8f557883c818123287 Mon Sep 17 00:00:00 2001 From: superstar0402 Date: Fri, 12 Jan 2024 13:59:30 +0000 Subject: [PATCH] feat: reexport `protocol_types` from `aztec-nr` (#3926) This PR rexports `protocol_types` from `aztec-nr` so that users of `aztec-nr` don't need to have a direct dependency on `protocol_types` Closes https://github.com/AztecProtocol/aztec-packages/issues/3590 --- address-note/Nargo.toml | 1 - address-note/src/address_note.nr | 2 +- authwit/Nargo.toml | 1 - authwit/src/auth.nr | 10 +++++++--- authwit/src/entrypoint.nr | 2 +- aztec/src/lib.nr | 1 + compressed-string/Nargo.toml | 1 - compressed-string/src/compressed_string.nr | 2 +- easy-private-state/Nargo.toml | 1 - easy-private-state/src/easy_private_state.nr | 2 +- value-note/Nargo.toml | 1 - value-note/src/filter.nr | 2 +- value-note/src/utils.nr | 2 +- value-note/src/value_note.nr | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/address-note/Nargo.toml b/address-note/Nargo.toml index a9de5de..6e1ee8b 100644 --- a/address-note/Nargo.toml +++ b/address-note/Nargo.toml @@ -6,4 +6,3 @@ type = "lib" [dependencies] aztec = { path = "../aztec" } -protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } diff --git a/address-note/src/address_note.nr b/address-note/src/address_note.nr index 314a862..dc5e0fa 100644 --- a/address-note/src/address_note.nr +++ b/address-note/src/address_note.nr @@ -1,8 +1,8 @@ // docs:start:encrypted_import use dep::aztec::log::emit_encrypted_log; // docs:end:encrypted_import -use dep::protocol_types::address::AztecAddress; use dep::aztec::{ + protocol_types::address::AztecAddress, note::{ note_header::NoteHeader, note_interface::NoteInterface, diff --git a/authwit/Nargo.toml b/authwit/Nargo.toml index e225994..a6f2488 100644 --- a/authwit/Nargo.toml +++ b/authwit/Nargo.toml @@ -6,4 +6,3 @@ type = "lib" [dependencies] aztec = { path = "../aztec" } -protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/authwit/src/auth.nr b/authwit/src/auth.nr index 5279aa5..d9dabab 100644 --- a/authwit/src/auth.nr +++ b/authwit/src/auth.nr @@ -1,4 +1,4 @@ -use dep::protocol_types::{ +use dep::aztec::protocol_types::{ abis::function_selector::FunctionSelector, address::AztecAddress, constants::{ @@ -22,7 +22,11 @@ global IS_VALID_PUBLIC_SELECTOR = 0xf3661153; // docs:start:assert_valid_authwit // Assert that `on_behalf_of` have authorized `message_hash` with a valid authentication witness -pub fn assert_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress, message_hash: Field) { +pub fn assert_valid_authwit( + context: &mut PrivateContext, + on_behalf_of: AztecAddress, + message_hash: Field +) { let is_valid_selector = FunctionSelector::from_field(IS_VALID_SELECTOR); let result = context.call_private_function(on_behalf_of, is_valid_selector, [message_hash])[0]; context.push_new_nullifier(message_hash, 0); @@ -82,4 +86,4 @@ pub fn compute_authwit_message_hash( GENERATOR_INDEX__SIGNATURE_PAYLOAD ) } -// docs:end:compute_authwit_message_hash \ No newline at end of file +// docs:end:compute_authwit_message_hash diff --git a/authwit/src/entrypoint.nr b/authwit/src/entrypoint.nr index 5f22a8e..82c3f5f 100644 --- a/authwit/src/entrypoint.nr +++ b/authwit/src/entrypoint.nr @@ -1,7 +1,7 @@ use dep::aztec::abi; use dep::aztec::types::vec::BoundedVec; use dep::aztec::context::PrivateContext; -use dep::protocol_types::{ +use dep::aztec::protocol_types::{ abis::{ call_stack_item::{ PrivateCallStackItem, diff --git a/aztec/src/lib.nr b/aztec/src/lib.nr index 46f548d..39c5b6c 100644 --- a/aztec/src/lib.nr +++ b/aztec/src/lib.nr @@ -9,3 +9,4 @@ mod oracle; mod state_vars; mod types; mod utils; +use dep::protocol_types; diff --git a/compressed-string/Nargo.toml b/compressed-string/Nargo.toml index 431e8d3..238766a 100644 --- a/compressed-string/Nargo.toml +++ b/compressed-string/Nargo.toml @@ -6,4 +6,3 @@ type = "lib" [dependencies] aztec = {path = "../aztec"} -protocol_types = {path = "../../noir-protocol-circuits/src/crates/types"} diff --git a/compressed-string/src/compressed_string.nr b/compressed-string/src/compressed_string.nr index b81d866..0cf51b8 100644 --- a/compressed-string/src/compressed_string.nr +++ b/compressed-string/src/compressed_string.nr @@ -1,5 +1,5 @@ use dep::aztec::types::type_serialization::TypeSerializationInterface; -use dep::protocol_types::utils::field::field_from_bytes; +use dep::aztec::protocol_types::utils::field::field_from_bytes; use dep::std; // A Fixedsize Compressed String. diff --git a/easy-private-state/Nargo.toml b/easy-private-state/Nargo.toml index 55ac93c..31c9616 100644 --- a/easy-private-state/Nargo.toml +++ b/easy-private-state/Nargo.toml @@ -7,4 +7,3 @@ type = "lib" [dependencies] aztec = { path = "../aztec" } value_note = { path = "../value-note" } -protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } diff --git a/easy-private-state/src/easy_private_state.nr b/easy-private-state/src/easy_private_state.nr index 504686d..29feeeb 100644 --- a/easy-private-state/src/easy_private_state.nr +++ b/easy-private-state/src/easy_private_state.nr @@ -1,5 +1,5 @@ -use dep::protocol_types::address::AztecAddress; use dep::aztec::{ + protocol_types::address::AztecAddress, context::Context, note::note_getter_options::NoteGetterOptions, state_vars::set::Set, diff --git a/value-note/Nargo.toml b/value-note/Nargo.toml index 7f87db9..01f5ee1 100644 --- a/value-note/Nargo.toml +++ b/value-note/Nargo.toml @@ -6,4 +6,3 @@ type = "lib" [dependencies] aztec = { path = "../aztec" } -protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" } \ No newline at end of file diff --git a/value-note/src/filter.nr b/value-note/src/filter.nr index 46d3d4e..56dd89a 100644 --- a/value-note/src/filter.nr +++ b/value-note/src/filter.nr @@ -1,5 +1,5 @@ use dep::std::option::Option; -use dep::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; +use dep::aztec::protocol_types::constants::MAX_READ_REQUESTS_PER_CALL; use crate::value_note::ValueNote; pub fn filter_notes_min_sum( diff --git a/value-note/src/utils.nr b/value-note/src/utils.nr index 76fcfd2..277e0b1 100644 --- a/value-note/src/utils.nr +++ b/value-note/src/utils.nr @@ -7,7 +7,7 @@ use crate::{ filter::filter_notes_min_sum, value_note::{ValueNote, VALUE_NOTE_LEN}, }; -use dep::protocol_types::address::AztecAddress; +use dep::aztec::protocol_types::address::AztecAddress; // Sort the note values (0th field) in descending order. // Pick the fewest notes whose sum is equal to or greater than `amount`. diff --git a/value-note/src/value_note.nr b/value-note/src/value_note.nr index 7e7e2db..d02037e 100644 --- a/value-note/src/value_note.nr +++ b/value-note/src/value_note.nr @@ -1,5 +1,5 @@ -use dep::protocol_types::address::AztecAddress; use dep::aztec::{ + protocol_types::address::AztecAddress, note::{ note_header::NoteHeader, note_interface::NoteInterface,