Skip to content

Commit 45283a1

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/barretenberg
2 parents e384b1c + 695c936 commit 45283a1

47 files changed

Lines changed: 1184 additions & 162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci3.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,6 @@ jobs:
456456
# Escape hatch: ci-skip-compat-e2e label makes failures non-blocking on release PRs.
457457
ci-compat-e2e:
458458
runs-on: ubuntu-latest
459-
permissions:
460-
id-token: write
461-
contents: read
462459
needs: [ci]
463460
if: |
464461
always()
@@ -478,17 +475,11 @@ jobs:
478475
with:
479476
ref: ${{ github.event.pull_request.head.sha || github.sha }}
480477

481-
- name: Configure AWS credentials (OIDC)
482-
uses: aws-actions/configure-aws-credentials@v4
483-
with:
484-
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }}
485-
aws-region: us-east-2
486-
role-session-name: ci3-compat-e2e-${{ github.run_id }}
487-
role-duration-seconds: 21600 # 6h – covers AWS_SHUTDOWN_TIME (300 min) + 60 min buffer
488-
489478
- name: Run Backwards Compatibility E2E Tests
490479
timeout-minutes: 330
491480
env:
481+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
482+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
492483
GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
493484
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
494485
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}

aztec-up/test/aztec-cli-acceptance-test/aztec-cli-acceptance-test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ if (result.ok) {
7272
log(`All steps PASSED (${msToSecs(Date.now() - totalStart)}s total)`);
7373
console.log(`TEST_RESULT=pass version=${result.aztecVersion}`);
7474
rmSync(TMP_DIR, { recursive: true, force: true });
75+
// Explicit exit fires the 'exit' handler registered in startLocalNetwork(), which SIGTERMs the
76+
// long-running `aztec start --local-network` child. Without this, the child keeps Node's event
77+
// loop alive — the handler never fires and the process hangs until the CI timeout cancels it.
78+
process.exit(0);
7579
} else {
7680
reportFailure(result.stepName, result.aztecVersion, result.error);
7781
leaveTmpDirForInspection();
78-
process.exitCode = 1;
82+
process.exit(1);
7983
}
8084

8185
async function main(): Promise<RunResult> {

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,40 @@ Aztec is in active development. Each version may introduce breaking changes that
99

1010
## TBD
1111

12+
### [Aztec.nr] `attempt_note_discovery` is no longer exposed; use `process_private_note_msg`
13+
14+
`attempt_note_discovery` is now crate-private. Custom message handlers (implementations of `CustomMessageHandler`) that previously called it directly should call `process_private_note_msg` instead, which runs the standard private note message decoding and discovery pipeline.
15+
16+
`process_private_note_msg` takes the raw `msg_metadata` and `msg_content` rather than already-decoded note fields, so it handles decoding (and silently discards undecodable messages) on your behalf:
17+
18+
```diff
19+
- attempt_note_discovery(
20+
- contract_address,
21+
- tx_hash,
22+
- unique_note_hashes_in_tx,
23+
- first_nullifier_in_tx,
24+
- compute_note_hash,
25+
- compute_note_nullifier,
26+
- owner,
27+
- storage_slot,
28+
- randomness,
29+
- note_type_id,
30+
- packed_note,
31+
- );
32+
+ process_private_note_msg(
33+
+ contract_address,
34+
+ tx_hash,
35+
+ unique_note_hashes_in_tx,
36+
+ first_nullifier_in_tx,
37+
+ compute_note_hash,
38+
+ compute_note_nullifier,
39+
+ msg_metadata,
40+
+ msg_content,
41+
+ );
42+
```
43+
44+
**Impact**: Custom message handlers that reused the standard note message processing pipeline must switch to `process_private_note_msg`. Contracts using only built-in private note handling are unaffected.
45+
1246
### [Aztec.nr] TXE `call_public_incognito` no longer takes a `from` parameter
1347

1448
`TestEnvironment::call_public_incognito` previously accepted a `from` address that was silently ignored (the function always uses a null `msg_sender`). The `from` parameter has been removed.

noir-projects/aztec-nr/aztec/src/history/mod.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ pub mod deployment;
1414
pub mod note;
1515
pub mod nullifier;
1616
pub mod storage;
17-
mod test;
17+
pub(crate) mod test;

noir-projects/aztec-nr/aztec/src/macros/aztec/compute_note_hash_and_nullifier.nr

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@ comptime fn generate_contract_library_method_compute_note_hash() -> Quoted {
126126
let if_note_type_id_match_statements = if_note_type_id_match_statements_list.join(quote {});
127127

128128
quote {
129-
/// Unpacks an array into a note corresponding to `note_type_id` and then computes its note hash (non-siloed).
129+
/// Unpacks an array into a note corresponding to `note_type_id` and then computes its note hash
130+
/// (non-siloed).
130131
///
131-
/// The signature of this function notably matches the `aztec::messages::discovery::ComputeNoteHash` type, and so it can be used to call functions from that module such as `do_sync_state` and `attempt_note_discovery`.
132+
/// The signature of this function notably matches the `aztec::messages::discovery::ComputeNoteHash` type,
133+
/// and so it can be used to call functions from that module such as `do_sync_state` and
134+
/// `process_private_note_msg`.
132135
///
133136
/// This function is automatically injected by the `#[aztec]` macro.
134137
#[contract_library_method]
@@ -240,7 +243,9 @@ comptime fn generate_contract_library_method_compute_note_nullifier() -> Quoted
240243
quote {
241244
/// Computes a note's inner nullifier (non-siloed) given its unique note hash, preimage and extra data.
242245
///
243-
/// The signature of this function notably matches the `aztec::messages::discovery::ComputeNoteNullifier` type, and so it can be used to call functions from that module such as `do_sync_state` and `attempt_note_discovery`.
246+
/// The signature of this function notably matches the `aztec::messages::discovery::ComputeNoteNullifier`
247+
/// type, and so it can be used to call functions from that module such as `do_sync_state` and
248+
/// `process_private_note_msg`.
244249
///
245250
/// This function is automatically injected by the `#[aztec]` macro.
246251
#[contract_library_method]

noir-projects/aztec-nr/aztec/src/messages/discovery/private_notes.nr

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,26 @@ use crate::{
99
protocol::{address::AztecAddress, constants::MAX_NOTE_HASHES_PER_TX, traits::ToField},
1010
};
1111

12-
pub(crate) unconstrained fn process_private_note_msg(
12+
/// Processes a private note message, attempting to discover and enqueue any notes it contains.
13+
///
14+
/// For each note recovered from the message whose computed note hash matches a unique note hash in the transaction,
15+
/// a [`NoteValidationRequest`](crate::messages::processing::NoteValidationRequest) is pushed onto the ephemeral array
16+
/// at `NOTE_VALIDATION_REQUESTS_ARRAY_BASE_SLOT` via
17+
/// [`enqueue_note_for_validation`](crate::messages::processing::enqueue_note_for_validation). PXE later drains this
18+
/// array during `validate_and_store_enqueued_notes_and_events`, after which the notes are retrievable via `get_notes`.
19+
///
20+
/// Messages that fail to decode, or whose computed note hash matches nothing in the transaction, are discarded
21+
/// (with a debug or warning log respectively) and produce no validation requests. Decode failures are not treated
22+
/// as errors since messages may originate from malicious senders and we don't want them to be able to brick message
23+
/// processing.
24+
///
25+
/// ## Use Cases
26+
///
27+
/// This function is invoked automatically by aztec-nr when handling messages with the built-in private note type id,
28+
/// so contracts do not normally need to call it directly. It is exposed for use by custom message handlers (see
29+
/// [`CustomMessageHandler`](crate::messages::discovery::CustomMessageHandler)) that might want to use the standard
30+
/// note message processing pipeline while extending it with custom logic.
31+
pub unconstrained fn process_private_note_msg(
1332
contract_address: AztecAddress,
1433
tx_hash: Field,
1534
unique_note_hashes_in_tx: BoundedVec<Field, MAX_NOTE_HASHES_PER_TX>,
@@ -48,7 +67,7 @@ pub(crate) unconstrained fn process_private_note_msg(
4867

4968
/// Attempts discovery of a note given information about its contents and the transaction in which it is suspected the
5069
/// note was created.
51-
pub unconstrained fn attempt_note_discovery(
70+
unconstrained fn attempt_note_discovery(
5271
contract_address: AztecAddress,
5372
tx_hash: Field,
5473
unique_note_hashes_in_tx: BoundedVec<Field, MAX_NOTE_HASHES_PER_TX>,

noir-projects/aztec-nr/aztec/src/messages/logs/note.nr

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ pub(crate) global PRIVATE_NOTE_MSG_PLAINTEXT_RANDOMNESS_INDEX: u32 = 2;
1919
/// encryption overhead and extra fields in the message (e.g. message type id, storage slot, randomness, etc.).
2020
pub global MAX_NOTE_PACKED_LEN: u32 = MAX_MESSAGE_CONTENT_LEN - PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN;
2121

22-
/// Creates the plaintext for a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]).
22+
/// Creates the plaintext for a private note message with the given `msg_type_id`.
2323
///
24-
/// This plaintext is meant to be decoded via [`decode_private_note_message`].
25-
pub fn encode_private_note_message<Note>(
24+
/// Shared encoder used by [`encode_private_note_message`] and by custom message handlers that use the same format as
25+
/// standard private note message but perform additional validation logic.
26+
pub fn encode_private_note_message_with_msg_type_id<Note>(
27+
msg_type_id: u64,
2628
note: Note,
2729
owner: AztecAddress,
2830
storage_slot: Field,
@@ -49,7 +51,28 @@ where
4951
}
5052

5153
// Notes use the note type id for metadata
52-
encode_message(PRIVATE_NOTE_MSG_TYPE_ID, Note::get_id() as u64, msg_content)
54+
encode_message(msg_type_id, Note::get_id() as u64, msg_content)
55+
}
56+
57+
/// Creates the plaintext for a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]).
58+
///
59+
/// This plaintext is meant to be decoded via [`decode_private_note_message`].
60+
pub fn encode_private_note_message<Note>(
61+
note: Note,
62+
owner: AztecAddress,
63+
storage_slot: Field,
64+
randomness: Field,
65+
) -> [Field; PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN + <Note as Packable>::N + MESSAGE_EXPANDED_METADATA_LEN]
66+
where
67+
Note: NoteType + Packable,
68+
{
69+
encode_private_note_message_with_msg_type_id(
70+
PRIVATE_NOTE_MSG_TYPE_ID,
71+
note,
72+
owner,
73+
storage_slot,
74+
randomness,
75+
)
5376
}
5477

5578
/// Decodes the plaintext from a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]).

noir-projects/aztec-nr/aztec/src/messages/processing/mod.nr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ pub mod offchain;
44
mod message_context;
55
pub use message_context::MessageContext;
66

7-
pub(crate) mod note_validation_request;
7+
mod note_validation_request;
8+
pub use note_validation_request::NoteValidationRequest;
9+
810
pub(crate) mod log_retrieval_request;
911
pub(crate) mod log_retrieval_response;
1012
pub(crate) mod pending_tagged_log;
@@ -17,10 +19,7 @@ use crate::{
1719
discovery::partial_notes::DeliveredPendingPartialNote,
1820
encoding::MESSAGE_CIPHERTEXT_LEN,
1921
logs::{event::MAX_EVENT_SERIALIZED_LEN, note::MAX_NOTE_PACKED_LEN},
20-
processing::{
21-
log_retrieval_request::LogRetrievalRequest, log_retrieval_response::LogRetrievalResponse,
22-
note_validation_request::NoteValidationRequest,
23-
},
22+
processing::{log_retrieval_request::LogRetrievalRequest, log_retrieval_response::LogRetrievalResponse},
2423
},
2524
oracle::message_processing,
2625
};

noir-projects/aztec-nr/aztec/src/messages/processing/note_validation_request.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::messages::logs::note::MAX_NOTE_PACKED_LEN;
2-
use crate::protocol::{address::AztecAddress, traits::Serialize};
2+
use crate::protocol::{address::AztecAddress, traits::{Deserialize, Serialize}};
33

44
/// Intermediate struct used to perform batch note validation by PXE. The
55
/// `aztec_utl_validateAndStoreEnqueuedNotesAndEvents` oracle expects for values of this type to be stored in a
66
/// `EphemeralArray`.
7-
#[derive(Serialize)]
8-
pub(crate) struct NoteValidationRequest {
7+
#[derive(Serialize, Deserialize)]
8+
pub struct NoteValidationRequest {
99
pub contract_address: AztecAddress,
1010
pub owner: AztecAddress,
1111
pub storage_slot: Field,

noir-projects/aztec-nr/aztec/src/note/confirmed_note.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct ConfirmedNote<Note> {
3333
/// The note hash used to prove existence.
3434
///
3535
/// Whether this note hash is unsiloed or unique depends on the note's metadata.
36-
pub(crate) proven_note_hash: Field,
36+
pub proven_note_hash: Field,
3737
}
3838

3939
impl<Note> ConfirmedNote<Note> {

0 commit comments

Comments
 (0)