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

feat: AUTHWIT generator #4798

Merged
merged 1 commit into from
Feb 28, 2024
Merged
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
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/authwit/src/auth.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::aztec::protocol_types::{
abis::function_selector::FunctionSelector, address::AztecAddress,
constants::{GENERATOR_INDEX__SIGNATURE_PAYLOAD}, hash::{hash_args, pedersen_hash}
constants::{GENERATOR_INDEX__AUTHWIT}, hash::{hash_args, pedersen_hash}
};
use dep::aztec::context::{PrivateContext, PublicContext, Context};

Expand Down Expand Up @@ -31,7 +31,7 @@ pub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf
[
context.msg_sender().to_field(), context.this_address().to_field(), context.selector().to_field(), context.args_hash
],
GENERATOR_INDEX__SIGNATURE_PAYLOAD
GENERATOR_INDEX__AUTHWIT
);
assert_valid_authwit(context, on_behalf_of, message_hash);
}
Expand All @@ -55,7 +55,7 @@ pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_
[
context.msg_sender().to_field(), context.this_address().to_field(), context.selector().to_field(), context.args_hash
],
GENERATOR_INDEX__SIGNATURE_PAYLOAD
GENERATOR_INDEX__AUTHWIT
);
assert_valid_authwit_public(context, on_behalf_of, message_hash);
}
Expand All @@ -72,7 +72,7 @@ pub fn compute_authwit_message_hash<N>(
let args_hash = hash_args(args);
pedersen_hash(
[caller.to_field(), target.to_field(), selector.to_field(), args_hash],
GENERATOR_INDEX__SIGNATURE_PAYLOAD
GENERATOR_INDEX__AUTHWIT
)
}
// docs:end:compute_authwit_message_hash
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,4 @@ global GENERATOR_INDEX__VK = 41;
global GENERATOR_INDEX__PRIVATE_CIRCUIT_PUBLIC_INPUTS = 42;
global GENERATOR_INDEX__PUBLIC_CIRCUIT_PUBLIC_INPUTS = 43;
global GENERATOR_INDEX__FUNCTION_ARGS = 44;
global GENERATOR_INDEX__AUTHWIT = 45;
2 changes: 1 addition & 1 deletion yarn-project/aztec.js/src/utils/authwit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const computeAuthWitMessageHash = (caller: AztecAddress, request: Functio
request.functionData.selector.toField(),
PackedArguments.fromArgs(request.args).hash,
].map(fr => fr.toBuffer()),
GeneratorIndex.SIGNATURE_PAYLOAD,
GeneratorIndex.AUTHWIT,
);
};
// docs:end:authwit_computeAuthWitMessageHash
1 change: 1 addition & 0 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ export enum GeneratorIndex {
PRIVATE_CIRCUIT_PUBLIC_INPUTS = 42,
PUBLIC_CIRCUIT_PUBLIC_INPUTS = 43,
FUNCTION_ARGS = 44,
AUTHWIT = 45,
}
Loading