Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Oct 29, 2024
1 parent 93d88d2 commit 79cab79
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 36 deletions.
45 changes: 23 additions & 22 deletions noir-projects/aztec-nr/authwit/src/auth.nr
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,12 @@ pub unconstrained fn assert_inner_hash_valid_authwit_public(
on_behalf_of: AztecAddress,
inner_hash: Field,
) {
let results: [Field] = context
.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("consume((Field),Field)") },
[on_behalf_of.to_field(), inner_hash].as_slice(),
GasOpts::default(),
);
let results: [Field] = context.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("consume((Field),Field)") },
[on_behalf_of.to_field(), inner_hash].as_slice(),
GasOpts::default(),
);
assert(results.len() == 1, "Invalid response from registry");
assert(results[0] == IS_VALID_SELECTOR, "Message not authorized by account");
}
Expand Down Expand Up @@ -377,14 +376,17 @@ pub fn compute_authwit_message_hash(
* @param message_hash The hash of the message to authorize
* @param authorize True if the message should be authorized, false if it should be revoked
*/
pub unconstrained fn set_authorized(context: &mut PublicContext, message_hash: Field, authorize: bool) {
let res = context
.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("set_authorized(Field,bool)") },
[message_hash, authorize as Field].as_slice(),
GasOpts::default(),
);
pub unconstrained fn set_authorized(
context: &mut PublicContext,
message_hash: Field,
authorize: bool,
) {
let res = context.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("set_authorized(Field,bool)") },
[message_hash, authorize as Field].as_slice(),
GasOpts::default(),
);
assert(res.len() == 0);
}

Expand All @@ -396,12 +398,11 @@ pub unconstrained fn set_authorized(context: &mut PublicContext, message_hash: F
* @param reject True if all authwits should be rejected, false otherwise
*/
pub unconstrained fn set_reject_all(context: &mut PublicContext, reject: bool) {
let res = context
.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("set_reject_all(bool)") },
[context.this_address().to_field(), reject as Field].as_slice(),
GasOpts::default(),
);
let res = context.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime { FunctionSelector::from_signature("set_reject_all(bool)") },
[context.this_address().to_field(), reject as Field].as_slice(),
GasOpts::default(),
);
assert(res.len() == 0);
}
26 changes: 12 additions & 14 deletions noir-projects/aztec-nr/aztec/src/test/helpers/utils.nr
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ impl<let N: u32, let M: u32> Deployer<N, M> {

let mut public_context = PublicContext::new(|| panic(f"Provide args hash manually"));

let results = public_context
.call_public_function(
instance.to_address(),
call_interface.get_selector(),
call_interface.get_args(),
GasOpts::default(),
);
let results = public_context.call_public_function(
instance.to_address(),
call_interface.get_selector(),
call_interface.get_args(),
GasOpts::default(),
);
assert(results.len() == 0);

instance
Expand All @@ -105,13 +104,12 @@ impl<let N: u32, let M: u32> Deployer<N, M> {

let mut public_context = PublicContext::new(|| panic(f"Provide args hash manually"));

let _ = public_context
.call_public_function(
instance.to_address(),
call_interface.get_selector(),
call_interface.get_args(),
GasOpts::default(),
);
let _ = public_context.call_public_function(
instance.to_address(),
call_interface.get_selector(),
call_interface.get_args(),
GasOpts::default(),
);

instance
}
Expand Down

0 comments on commit 79cab79

Please sign in to comment.