Skip to content

Commit

Permalink
feat: Sync from noir (#11138)
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
feat!: require trait primitive functions/calls to have their trait in
scope (noir-lang/noir#6901)
feat(lsp): use trait method docs for trait impl method docs on hover
(noir-lang/noir#7003)
chore: turn on averaging for protocol circuits metrics in CI
(noir-lang/noir#6999)
feat(comptime): Implement to_be_bits and to_le_bits in the interpreter
(noir-lang/noir#7008)
chore: Add short circuit in ssa-gen for known if conditions
(noir-lang/noir#7007)
chore: Only resolved globals monomorphization
(noir-lang/noir#7006)
chore: Remove resolve_is_unconstrained pass
(noir-lang/noir#7004)
chore: require safety doc comment for unsafe instead of `//@safety`
(noir-lang/noir#6992)
fix: Reproduce and fix bytecode blowup
(noir-lang/noir#6972)
chore: mark casts as able to be deduplicated
(noir-lang/noir#6996)
fix: return trait impl method as FuncId if there's only one
(noir-lang/noir#6989)
chore(ci): fail properly in `external-repo-checks`
(noir-lang/noir#6988)
fix: allow multiple trait impls for the same trait as long as one is in
scope (noir-lang/noir#6987)
chore: Use DFG in SSA printer
(noir-lang/noir#6986)
chore!: Reserve `enum` and `match` keywords
(noir-lang/noir#6961)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <[email protected]>
  • Loading branch information
AztecBot and TomAFrench committed Jan 12, 2025
1 parent 36b50a6 commit f0c7d04
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions authwit/src/cheatcodes.nr
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ where
C: CallInterface<M>,
{
let target = call_interface.get_contract_address();
let inputs = cheatcodes::get_private_context_inputs(get_block_number());
let inputs = unsafe { cheatcodes::get_private_context_inputs(get_block_number()) };
let chain_id = inputs.tx_context.chain_id;
let version = inputs.tx_context.version;
let args_hash = hash_args(call_interface.get_args());
let selector = call_interface.get_selector();
let inner_hash =
compute_inner_authwit_hash([caller.to_field(), selector.to_field(), args_hash]);
let message_hash = compute_authwit_message_hash(target, chain_id, version, inner_hash);
cheatcodes::add_authwit(on_behalf_of, message_hash);
unsafe { cheatcodes::add_authwit(on_behalf_of, message_hash) };
}

pub unconstrained fn add_public_authwit_from_call_interface<C, let M: u32>(
Expand Down
32 changes: 18 additions & 14 deletions aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,15 @@ impl PrivateContext {
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
let args_hash = enqueue_public_function_call_internal(
contract_address,
function_selector,
args_hash,
counter,
is_static_call,
);
let args_hash = unsafe {
enqueue_public_function_call_internal(
contract_address,
function_selector,
args_hash,
counter,
is_static_call,
)
};

// Public calls are rerouted through the dispatch function.
let function_selector = comptime { FunctionSelector::from_field(PUBLIC_DISPATCH_SELECTOR) };
Expand Down Expand Up @@ -548,13 +550,15 @@ impl PrivateContext {
// new_args = [selector, ...old_args], so as to make it suitable to call the public dispatch function.
// We don't validate or compute it in the circuit because a) it's harder to do with slices, and
// b) this is only temporary.
let args_hash = set_public_teardown_function_call_internal(
contract_address,
function_selector,
args_hash,
counter,
is_static_call,
);
let args_hash = unsafe {
set_public_teardown_function_call_internal(
contract_address,
function_selector,
args_hash,
counter,
is_static_call,
)
};

let function_selector = comptime { FunctionSelector::from_field(PUBLIC_DISPATCH_SELECTOR) };

Expand Down
7 changes: 4 additions & 3 deletions aztec/src/oracle/get_contract_instance.nr
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,24 @@ pub unconstrained fn get_contract_instance_initialization_hash_internal_avm(
}

pub fn get_contract_instance_deployer_avm(address: AztecAddress) -> Option<AztecAddress> {
let (member, exists) = get_contract_instance_deployer_internal_avm(address);
let (member, exists) = unsafe { get_contract_instance_deployer_internal_avm(address) };
if exists {
Option::some(AztecAddress::from_field(member))
} else {
Option::none()
}
}
pub fn get_contract_instance_class_id_avm(address: AztecAddress) -> Option<ContractClassId> {
let (member, exists) = get_contract_instance_class_id_internal_avm(address);
let (member, exists) = unsafe { get_contract_instance_class_id_internal_avm(address) };
if exists {
Option::some(ContractClassId::from_field(member))
} else {
Option::none()
}
}
pub fn get_contract_instance_initialization_hash_avm(address: AztecAddress) -> Option<Field> {
let (member, exists) = get_contract_instance_initialization_hash_internal_avm(address);
let (member, exists) =
unsafe { get_contract_instance_initialization_hash_internal_avm(address) };
if exists {
Option::some(member)
} else {
Expand Down

0 comments on commit f0c7d04

Please sign in to comment.