Skip to content

Commit

Permalink
feat: Sync from noir (#8466)
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
fix: suggest trait attributes in LSP
(noir-lang/noir#5972)
fix: Error when `quote` is used in runtime code
(noir-lang/noir#5978)
chore: document HashMap (noir-lang/noir#5984)
fix: Restrict keccak256_injective test input to 8 bits
(noir-lang/noir#5977)
fix: Error when comptime functions are used in runtime code
(noir-lang/noir#5976)
chore: document BoundedVec (noir-lang/noir#5974)
feat: add `Expr::as_let` (noir-lang/noir#5964)
chore: remove 3 unused functions warnings in the stdlib
(noir-lang/noir#5973)
feat: let `nargo` and LSP work well in the stdlib
(noir-lang/noir#5969)
feat: show doc comments in LSP
(noir-lang/noir#5968)
feat: add a `panic` method to the stdlib
(noir-lang/noir#5966)
fix: LSP document symbol didn't work for primitive impls
(noir-lang/noir#5970)
fix(mem2reg): Handle aliases in function last store cleanup and
additional alias unit test (noir-lang/noir#5967)
fix: let `derive(Eq)` work for empty structs
(noir-lang/noir#5965)
feat: add `FunctionDefinition` methods `is_unconstrained` and
`set_unconstrained` (noir-lang/noir#5962)
feat: LSP autocompletion for attributes
(noir-lang/noir#5963)
feat: `Module::add_item` (noir-lang/noir#5947)
feat: Add `StructDefinition::add_generic`
(noir-lang/noir#5961)
feat: Add `StructDefinition::name`
(noir-lang/noir#5960)
fix(mem2reg): Handle aliases better when setting a known value for a
load (noir-lang/noir#5959)
feat: Arithmetic Generics (noir-lang/noir#5950)
feat: add `FunctionDefinition::module` and `StructDefinition::module`
(noir-lang/noir#5956)
feat: LSP now suggests self fields and methods
(noir-lang/noir#5955)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <[email protected]>
  • Loading branch information
AztecBot and TomAFrench committed Sep 11, 2024
1 parent 4be77a0 commit 78c2c28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
19 changes: 16 additions & 3 deletions authwit/src/auth.nr
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ pub fn assert_current_call_valid_authwit(context: &mut PrivateContext, on_behalf
* @param on_behalf_of The address that have authorized the current call
* @param inner_hash The hash of the message to authorize
*/
pub fn assert_inner_hash_valid_authwit(context: &mut PrivateContext, on_behalf_of: AztecAddress, inner_hash: Field) {
pub fn assert_inner_hash_valid_authwit(
context: &mut PrivateContext,
on_behalf_of: AztecAddress,
inner_hash: Field
) {
// We perform a static call here and not a standard one to ensure that the account contract cannot re-enter.
let result: Field = context.static_call_private_function(
on_behalf_of,
Expand Down Expand Up @@ -262,7 +266,11 @@ pub fn assert_current_call_valid_authwit_public(context: &mut PublicContext, on_
*
* @param on_behalf_of The address that have authorized the `inner_hash`
*/
pub fn assert_inner_hash_valid_authwit_public(context: &mut PublicContext, on_behalf_of: AztecAddress, inner_hash: Field) {
pub fn assert_inner_hash_valid_authwit_public(
context: &mut PublicContext,
on_behalf_of: AztecAddress,
inner_hash: Field
) {
let result: Field = context.call_public_function(
CANONICAL_AUTH_REGISTRY_ADDRESS,
comptime {
Expand Down Expand Up @@ -338,7 +346,12 @@ pub fn compute_authwit_nullifier(on_behalf_of: AztecAddress, inner_hash: Field)
* @param version The version of the chain that the message is being consumed on
* @param inner_hash The hash of the "inner" message that is being consumed
*/
pub fn compute_authwit_message_hash(consumer: AztecAddress, chain_id: Field, version: Field, inner_hash: Field) -> Field {
pub fn compute_authwit_message_hash(
consumer: AztecAddress,
chain_id: Field,
version: Field,
inner_hash: Field
) -> Field {
poseidon2_hash_with_separator(
[
consumer.to_field(),
Expand Down
8 changes: 4 additions & 4 deletions aztec/src/encrypted_logs/incoming_body.nr
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ mod test {
}
};

/// 1. `EncryptedLogIncomingBody::from_note` calls `note.to_be_bytes(storage_slot)` function which serializes
/// the note to bytes - note that in the case of `AddressNote` the `to_be_bytes` function was automatically
/// implemented by Aztec macros.
// 1. `EncryptedLogIncomingBody::from_note` calls `note.to_be_bytes(storage_slot)` function which serializes
// the note to bytes - note that in the case of `AddressNote` the `to_be_bytes` function was automatically
// implemented by Aztec macros.
let body = EncryptedLogIncomingBody::from_note(note, storage_slot);

/// 2. `body.compute_ciphertext(...)` function then derives symmetric key from `eph_sk` and `ivpk` and encrypts
// 2. `body.compute_ciphertext(...)` function then derives symmetric key from `eph_sk` and `ivpk` and encrypts
// the note plaintext using AES-128.
let ciphertext = body.compute_ciphertext(eph_sk, ivpk);

Expand Down

0 comments on commit 78c2c28

Please sign in to comment.