Skip to content
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
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/macros/aztec.nr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};

/// Marks a contract as an Aztec contract, generating the interfaces for its functions and notes, as well as injecting
/// the `sync_private_state` utility function PXE requires in order to discover notes.
/// the `sync_private_state` utility function.
/// Note: This is a module annotation, so the returned quote gets injected inside the module (contract) itself.
pub comptime fn aztec(m: Module) -> Quoted {
let interface = generate_contract_interface(m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use protocol_types::{
traits::{Deserialize, Serialize},
};

// Base slot for the pending tagged log array to which the syncPrivateState oracle inserts found private logs.
// Base slot for the pending tagged log array to which the fetchTaggedLogs oracle inserts found private logs.
pub(crate) global PENDING_TAGGED_LOG_ARRAY_BASE_SLOT: Field = sha256_to_field(
"AZTEC_NR::PENDING_TAGGED_PENDING_TAGGED_LOG_ARRAY_BASE_SLOT".as_bytes(),
);

/// Represents a log as it is stored in the pending tagged log array to which the syncPrivateState oracle inserts found private log.
/// Represents a log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle inserts found private log.
#[derive(Deserialize, Serialize)]
pub(crate) struct PendingTaggedLog {
pub log: BoundedVec<Field, PRIVATE_LOG_SIZE_IN_FIELDS>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
PARTIAL_NOTE_PRIVATE_MSG_TYPE_ID, PRIVATE_EVENT_MSG_TYPE_ID, PRIVATE_NOTE_MSG_TYPE_ID,
},
},
oracle::{logs::store_private_event_log, message_discovery::sync_private_state},
oracle::{logs::store_private_event_log, message_discovery::fetch_tagged_logs},
utils::array,
};

Expand All @@ -31,10 +31,10 @@ pub unconstrained fn fetch_and_process_private_tagged_logs<Env>(
contract_address: AztecAddress,
compute_note_hash_and_nullifier: ComputeNoteHashAndNullifier<Env>,
) {
// We will eventually perform log discovery via tagging here, but for now we simply call the `syncPrivateState` oracle.
// We will eventually perform log discovery via tagging here, but for now we simply call the `fetchTaggedLogs` oracle.
// This makes PXE synchronize tags, download logs and store the pending tagged logs in capsule array which are then
// retrieved and processed here.
sync_private_state(PENDING_TAGGED_LOG_ARRAY_BASE_SLOT);
fetch_tagged_logs(PENDING_TAGGED_LOG_ARRAY_BASE_SLOT);

// Get the logs from the capsule array and process them one by one
let logs =
Expand Down
8 changes: 4 additions & 4 deletions noir-projects/aztec-nr/aztec/src/oracle/message_discovery.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use dep::protocol_types::{

/// Finds new private logs that may have been sent to all registered accounts in PXE in the current contract and makes
/// them available for later processing in Noir by storing them in a capsule array.
pub unconstrained fn sync_private_state(pending_tagged_log_array_base_slot: Field) {
sync_private_state_oracle(pending_tagged_log_array_base_slot);
pub unconstrained fn fetch_tagged_logs(pending_tagged_log_array_base_slot: Field) {
fetch_tagged_logs_oracle(pending_tagged_log_array_base_slot);
}

#[oracle(syncPrivateState)]
unconstrained fn sync_private_state_oracle(pending_tagged_log_array_base_slot: Field) {}
#[oracle(fetchTaggedLogs)]
unconstrained fn fetch_tagged_logs_oracle(pending_tagged_log_array_base_slot: Field) {}

/// Informs PXE of a note's existence so that it can later be retrieved by the `getNotes` oracle. The note will be
/// scoped to `contract_address`, meaning other contracts will not be able to access it unless authorized.
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/simulator/src/private/acvm/oracle/oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ export class Oracle {
return [];
}

async syncPrivateState([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
await this.typedOracle.syncPrivateState(Fr.fromString(pendingTaggedLogArrayBaseSlot));
async fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]: ACVMField[]): Promise<ACVMField[]> {
await this.typedOracle.fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
return [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export abstract class TypedOracle {
return Promise.reject(new OracleMethodNotAvailableError('incrementAppTaggingSecretIndexAsSender'));
}

syncPrivateState(_pendingTaggedLogArrayBaseSlot: Fr): Promise<void> {
return Promise.reject(new OracleMethodNotAvailableError('syncPrivateState'));
fetchTaggedLogs(_pendingTaggedLogArrayBaseSlot: Fr): Promise<void> {
return Promise.reject(new OracleMethodNotAvailableError('fetchTaggedLogs'));
}

deliverNote(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
await this.executionDataProvider.incrementAppTaggingSecretIndexAsSender(this.contractAddress, sender, recipient);
}

public override async syncPrivateState(pendingTaggedLogArrayBaseSlot: Fr) {
public override async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);

await this.executionDataProvider.removeNullifiedNotes(this.contractAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { Oracle } from '../../acvm/oracle/oracle.js';
* ]
* },
* {
* "name": "syncPrivateState",
* "name": "fetchTaggedLogs",
* "inputs": []
* }
* ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class UtilityExecutionOracle extends TypedOracle {
return await this.executionDataProvider.getIndexedTaggingSecretAsSender(this.contractAddress, sender, recipient);
}

public override async syncPrivateState(pendingTaggedLogArrayBaseSlot: Fr) {
public override async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);

await this.executionDataProvider.removeNullifiedNotes(this.contractAddress);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/stdlib/src/logs/pending_tagged_log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AztecAddress } from '../aztec-address/index.js';
import type { TxHash } from '../tx/tx_hash.js';

/**
* Represents a pending tagged log as it is stored in the pending tagged log array to which the syncPrivateState oracle
* Represents a pending tagged log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle
* inserts found private logs. A TS version of `pending_tagged_log.nr`.
*/
export class PendingTaggedLog {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/txe/src/oracle/txe_oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ export class TXE implements TypedOracle {
return await this.pxeOracleInterface.getIndexedTaggingSecretAsSender(this.contractAddress, sender, recipient);
}

async syncPrivateState(pendingTaggedLogArrayBaseSlot: Fr) {
async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
await this.pxeOracleInterface.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot);

await this.pxeOracleInterface.removeNullifiedNotes(this.contractAddress);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/txe/src/txe_service/txe_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,14 +689,14 @@ export class TXEService {
return toForeignCallResult(secret.toFields().map(toSingle));
}

async syncPrivateState(pendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
if (!this.oraclesEnabled) {
throw new Error(
'Oracle access from the root of a TXe test are not enabled. Please use env._ to interact with the oracles.',
);
}

await this.typedOracle.syncPrivateState(fromSingle(pendingTaggedLogArrayBaseSlot));
await this.typedOracle.fetchTaggedLogs(fromSingle(pendingTaggedLogArrayBaseSlot));
return toForeignCallResult([]);
}

Expand Down