Skip to content

Commit

Permalink
feat: Sync from noir (#5416)
Browse files Browse the repository at this point in the history
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore(github): Improve PR template "document later" checkbox description
(noir-lang/noir#4625)
chore: Update integers.md to note support for Fields using
`from_integer` (noir-lang/noir#4536)
chore: update docs with function names to match version 0.25.0
specifications (noir-lang/noir#4466)
feat: add specific error for attempting `string[x] = ".."`
(noir-lang/noir#4611)
fix(ssa): Use accurate type during SSA AsSlice simplficiation
(noir-lang/noir#4610)
END_COMMIT_OVERRIDE

---------

Co-authored-by: sirasistant <[email protected]>
  • Loading branch information
AztecBot and sirasistant committed Mar 26, 2024
1 parent 3aebe2f commit a0851e4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 44 deletions.
4 changes: 2 additions & 2 deletions authwit/src/auth.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::aztec::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress,
constants::{GENERATOR_INDEX__AUTHWIT_INNER, GENERATOR_INDEX__AUTHWIT_OUTER},
hash::{hash_args, pedersen_hash}
hash::{hash_args_array, pedersen_hash}
};
use dep::aztec::context::{PrivateContext, PublicContext, Context};

Expand Down Expand Up @@ -37,7 +37,7 @@ pub fn compute_call_authwit_hash<N>(
selector: FunctionSelector,
args: [Field; N]
) -> Field {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
let inner_hash = compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);
compute_outer_authwit_hash(consumer, chain_id, version, inner_hash)
}
Expand Down
2 changes: 1 addition & 1 deletion authwit/src/entrypoint/app.nr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl AppPayload {
for i in 0..ACCOUNT_MAX_CALLS {
bytes.extend_from_array(self.function_calls[i].to_be_bytes());
}
bytes.extend_from_array(self.nonce.to_be_bytes(32));
bytes.extend_from_slice(self.nonce.to_be_bytes(32));

bytes.storage
}
Expand Down
2 changes: 1 addition & 1 deletion authwit/src/entrypoint/fee.nr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl FeePayload {
for i in 0..MAX_FEE_FUNCTION_CALLS {
bytes.extend_from_array(self.function_calls[i].to_be_bytes());
}
bytes.extend_from_array(self.nonce.to_be_bytes(32));
bytes.extend_from_slice(self.nonce.to_be_bytes(32));

bytes.storage
}
Expand Down
17 changes: 9 additions & 8 deletions aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ use dep::protocol_types::{
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL,
MAX_PUBLIC_DATA_READS_PER_CALL, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL, RETURN_VALUES_LENGTH
MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL,
RETURN_VALUES_LENGTH
},
contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest},
grumpkin_private_key::GrumpkinPrivateKey, hash::hash_args, header::Header,
grumpkin_private_key::GrumpkinPrivateKey, hash::hash_args_array, header::Header,
messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader, traits::is_empty
};

Expand Down Expand Up @@ -273,7 +274,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, false)
}
Expand All @@ -284,7 +285,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, true, false)
}
Expand All @@ -295,7 +296,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_private_function_with_packed_args(contract_address, function_selector, args_hash, false, true)
}
Expand Down Expand Up @@ -380,7 +381,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, false)
}
Expand All @@ -391,7 +392,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true, false)
}
Expand All @@ -402,7 +403,7 @@ impl PrivateContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, true)
}
Expand Down
9 changes: 5 additions & 4 deletions aztec/src/context/public_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use dep::protocol_types::{
MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL, RETURN_VALUES_LENGTH
},
contrakt::{storage_read::StorageRead, storage_update_request::StorageUpdateRequest},
hash::hash_args, header::Header, messaging::l2_to_l1_message::L2ToL1Message, utils::reader::Reader
hash::hash_args_array, header::Header, messaging::l2_to_l1_message::L2ToL1Message,
utils::reader::Reader
};

struct PublicContext {
Expand Down Expand Up @@ -266,7 +267,7 @@ impl PublicContextInterface for PublicContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, false)
}
Expand All @@ -277,7 +278,7 @@ impl PublicContextInterface for PublicContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, true, false)
}
Expand All @@ -288,7 +289,7 @@ impl PublicContextInterface for PublicContext {
function_selector: FunctionSelector,
args: [Field; ARGS_COUNT]
) -> [Field; RETURN_VALUES_LENGTH] {
let args_hash = hash_args(args);
let args_hash = hash_args_array(args);
assert(args_hash == arguments::pack_arguments(args));
self.call_public_function_with_packed_args(contract_address, function_selector, args_hash, false, true)
}
Expand Down
2 changes: 2 additions & 0 deletions aztec/src/hash.nr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use dep::protocol_types::{
constants::GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET,
hash::{pedersen_hash, silo_nullifier}};

use dep::protocol_types::hash::{hash_args, hash_args_array};

pub fn compute_secret_hash(secret: Field) -> Field {
// TODO(#1205) This is probably not the right index to use
pedersen_hash([secret], GENERATOR_INDEX__L1_TO_L2_MESSAGE_SECRET)
Expand Down
27 changes: 0 additions & 27 deletions aztec/src/hasher.nr

This file was deleted.

1 change: 0 additions & 1 deletion aztec/src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod avm;
mod context;
mod deploy;
mod hash;
mod hasher;
mod history;
mod initializer;
mod key;
Expand Down

0 comments on commit a0851e4

Please sign in to comment.