Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
180cf86
feat: processing events in Aztec.nr
benesjan Mar 22, 2025
c946941
WIP
benesjan Mar 22, 2025
a6dccd7
WIP on storing events
benesjan Mar 23, 2025
30328e8
it works?!
benesjan Mar 23, 2025
32ba0ba
WIP
benesjan Mar 24, 2025
85d23da
WIP
benesjan Mar 24, 2025
089db2c
fixes
benesjan Mar 24, 2025
bcb29ed
better logs
benesjan Mar 24, 2025
965c026
wip
benesjan Mar 24, 2025
25998a1
fix
benesjan Mar 24, 2025
3033186
WIP
benesjan Mar 24, 2025
3757c92
WIP
benesjan Mar 24, 2025
eb7aafe
fix
benesjan Mar 24, 2025
b7704eb
test
benesjan Mar 24, 2025
0150cc3
updated migration notes
benesjan Mar 24, 2025
2435776
narrowing down bug
benesjan Mar 25, 2025
2acade5
prefixing_with_tag test
benesjan Mar 25, 2025
3c9ed20
fix
benesjan Mar 25, 2025
c59c6d3
fix after restack
benesjan Mar 25, 2025
07d149c
diff cleanup
benesjan Mar 26, 2025
20d3ec4
comp fix after restack
benesjan Mar 26, 2025
00138c9
comment
benesjan Mar 26, 2025
ef2461b
packing metadata + api cleanup
benesjan Mar 27, 2025
9d9cbea
conflicts fix
benesjan Mar 27, 2025
7b9720e
Update noir-projects/aztec-nr/aztec/src/discovery/private_logs.nr
benesjan Mar 27, 2025
4c759a2
Update noir-projects/aztec-nr/aztec/src/discovery/private_logs.nr
benesjan Mar 27, 2025
88fcb44
nuking unnecessart comment
benesjan Mar 28, 2025
6d36c65
linking issue
benesjan Mar 28, 2025
e545484
storing logs in a non-retarded way
benesjan Mar 28, 2025
b3ea42c
disabling problematic check
benesjan Mar 28, 2025
7dacf7b
TXE issue workaround
benesjan Mar 28, 2025
3ce78b2
workaround fix
benesjan Mar 28, 2025
a09f275
historical block check in storePrivateEventLog
benesjan Mar 28, 2025
c5667c1
Update yarn-project/pxe/src/pxe_oracle_interface/pxe_oracle_interface.ts
benesjan Mar 28, 2025
cf8d36d
incorrect block num fix
benesjan Mar 28, 2025
6ab8a69
linking issue
benesjan Mar 28, 2025
ed1e55d
removing no longer necessary check
benesjan Mar 28, 2025
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
17 changes: 14 additions & 3 deletions docs/docs/migration_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,30 @@ Aztec is in full-speed development. Literally every version breaks compatibility

## TBD

## [aztec.js] AztecNode.findLeavesIndexes returns indexes with block metadata
### [aztec.js] AztecNode.getPrivateEvents API change

The `getPrivateEvents` method signature has changed to require an address of a contract that emitted the event and use recipient addresses instead of viewing public keys:

```diff
- const events = await wallet.getPrivateEvents<Transfer>(TokenContract.events.Transfer, 1, 1, [recipient.getCompleteAddress().publicKeys.masterIncomingViewingPublicKey()]);
+ const events = await wallet.getPrivateEvents<Transfer>(token.address, TokenContract.events.Transfer, 1, 1, [recipient.getAddress()]);
```

## 0.82.0

### [aztec.js] AztecNode.findLeavesIndexes returns indexes with block metadata

It's common that we need block metadata of a block in which leaves where inserted when querying indexes of these tree leaves.
For this reason we now return that information along with the indexes.
This allows us to reduce the number of individual AztecNode queries.

Along this change `findNullifiersIndexesWithBlock` and `findBlockNumbersForIndexes` functions wer removed as all its uses can now be replaced with the newly modified `findLeavesIndexes` function.

## [aztec.js] AztecNode.getPublicDataTreeWitness renamed as AztecNode.getPublicDataWitness
### [aztec.js] AztecNode.getPublicDataTreeWitness renamed as AztecNode.getPublicDataWitness

This change was done to have consistent naming across codebase.

## [aztec.js] Wallet interface and Authwit management
### [aztec.js] Wallet interface and Authwit management

The `Wallet` interface in `aztec.js` is undergoing transformations, trying to be friendlier to wallet builders and reducing the surface of its API. This means `Wallet` no longer extends `PXE`, and instead just implements a subset of the methods of the former. This is NOT going to be its final form, but paves the way towards better interfaces and starts to clarify what the responsibilities of the wallet are:

Expand Down
4 changes: 2 additions & 2 deletions noir-projects/aztec-nr/aztec/src/discovery/mod.nr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::encrypted_logs::log_encryption::PRIVATE_LOG_PLAINTEXT_SIZE_IN_FIELDS;
use protocol_types::{address::AztecAddress, debug_log::debug_log};

pub mod nonce_discovery;
pub mod partial_notes;
pub mod private_logs;
pub mod private_notes;
pub mod partial_notes;
pub mod nonce_discovery;

/// We reserve two fields in the note private log that are not part of the note content: one for the storage slot, and
/// one for the combined log and note type ID.
Expand Down
26 changes: 22 additions & 4 deletions noir-projects/aztec-nr/aztec/src/discovery/private_logs.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ use crate::{
encrypted_logs::{
log_assembly_strategies::default_aes128::aes128::AES128,
log_encryption::LogEncryption,
log_type::{PARTIAL_NOTE_PRIVATE_LOG_TYPE_ID, PRIVATE_NOTE_LOG_TYPE_ID},
log_type::{
PARTIAL_NOTE_PRIVATE_LOG_TYPE_ID, PRIVATE_EVENT_LOG_TYPE_ID, PRIVATE_NOTE_LOG_TYPE_ID,
},
metadata_packing::from_expanded_metadata,
},
oracle::message_discovery::sync_notes,
oracle::{logs::store_private_event_log, message_discovery::sync_notes},
utils::array,
};

use protocol_types::{
abis::event_selector::EventSelector,
address::AztecAddress,
constants::{MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_SIZE_IN_FIELDS},
debug_log::{debug_log, debug_log_format},
traits::FromField,
};

// TODO(#12750): don't make these values assume we're using AES.
Expand Down Expand Up @@ -52,14 +56,14 @@ pub unconstrained fn do_process_log<Env>(
tx_hash: Field,
unique_note_hashes_in_tx: BoundedVec<Field, MAX_NOTE_HASHES_PER_TX>,
first_nullifier_in_tx: Field,
log_index_in_tx: Field,
recipient: AztecAddress,
compute_note_hash_and_nullifier: ComputeNoteHashAndNullifier<Env>,
) {
debug_log_format("Processing log with tag {0}", [log.get(0)]);

// The tag is ignored for now.
// The first field of the log is the tag, which we don't need right now, and the rest is all ciphertext.
let ciphertext = array::subbvec(log, 1);

let log_plaintext = AES128::decrypt_log(ciphertext, recipient);

// The first thing to do after decrypting the log is to determine what type of private log we're processing. We
Expand All @@ -84,6 +88,20 @@ pub unconstrained fn do_process_log<Env>(
debug_log("Processing partial note private log");

process_partial_note_private_log(contract_address, recipient, log_metadata, log_content);
} else if log_type_id == PRIVATE_EVENT_LOG_TYPE_ID {
debug_log("Processing private event log");

// In the case of event logs, the log metadata is the event selector.
let event_selector = EventSelector::from_field(log_metadata as Field);

store_private_event_log(
contract_address,
recipient,
event_selector,
log_content,
tx_hash,
log_index_in_tx,
);
} else {
// TODO(#11569): handle events
debug_log_format(
Expand Down
Loading