@aztec/pxe 0.0.1-commit.43c09e3f → 0.0.1-commit.4d79d1f2d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +49 -27
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +65 -31
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +3 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +71 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +31 -11
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +58 -29
- package/dest/contract_sync/contract_sync_service.d.ts +3 -2
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +32 -17
- package/dest/debug/pxe_debug_utils.d.ts +2 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +1 -4
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +9 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +9 -1
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +4 -9
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +67 -23
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +49 -34
- package/dest/storage/contract_store/contract_store.js +5 -5
- package/dest/storage/note_store/note_store.d.ts +1 -2
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +4 -2
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +109 -74
- package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
- package/src/contract_function_simulator/oracle/oracle.ts +3 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +91 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +99 -28
- package/src/contract_sync/contract_sync_service.ts +41 -25
- package/src/debug/pxe_debug_utils.ts +4 -8
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/logs/log_service.ts +4 -13
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +113 -71
- package/src/storage/contract_store/contract_store.ts +4 -4
- package/src/storage/note_store/note_store.ts +5 -2
|
@@ -3,7 +3,7 @@ import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { Aes128 } from '@aztec/foundation/crypto/aes128';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
6
|
-
import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { LogLevels, type Logger, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
7
7
|
import type { MembershipWitness } from '@aztec/foundation/trees';
|
|
8
8
|
import type { KeyStore } from '@aztec/key-store';
|
|
9
9
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
@@ -40,6 +40,27 @@ import { pickNotes } from '../pick_notes.js';
|
|
|
40
40
|
import type { IMiscOracle, IUtilityExecutionOracle, NoteData } from './interfaces.js';
|
|
41
41
|
import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
42
42
|
|
|
43
|
+
/** Args for UtilityExecutionOracle constructor. */
|
|
44
|
+
export type UtilityExecutionOracleArgs = {
|
|
45
|
+
contractAddress: AztecAddress;
|
|
46
|
+
/** List of transient auth witnesses to be used during this simulation */
|
|
47
|
+
authWitnesses: AuthWitness[];
|
|
48
|
+
capsules: Capsule[]; // TODO(#12425): Rename to transientCapsules
|
|
49
|
+
anchorBlockHeader: BlockHeader;
|
|
50
|
+
contractStore: ContractStore;
|
|
51
|
+
noteStore: NoteStore;
|
|
52
|
+
keyStore: KeyStore;
|
|
53
|
+
addressStore: AddressStore;
|
|
54
|
+
aztecNode: AztecNode;
|
|
55
|
+
recipientTaggingStore: RecipientTaggingStore;
|
|
56
|
+
senderAddressBookStore: SenderAddressBookStore;
|
|
57
|
+
capsuleStore: CapsuleStore;
|
|
58
|
+
privateEventStore: PrivateEventStore;
|
|
59
|
+
jobId: string;
|
|
60
|
+
log?: ReturnType<typeof createLogger>;
|
|
61
|
+
scopes?: AztecAddress[];
|
|
62
|
+
};
|
|
63
|
+
|
|
43
64
|
/**
|
|
44
65
|
* The oracle for an execution of utility contract functions.
|
|
45
66
|
*/
|
|
@@ -47,27 +68,43 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
47
68
|
isMisc = true as const;
|
|
48
69
|
isUtility = true as const;
|
|
49
70
|
|
|
50
|
-
private
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
private contractLogger: Logger | undefined;
|
|
72
|
+
|
|
73
|
+
protected readonly contractAddress: AztecAddress;
|
|
74
|
+
protected readonly authWitnesses: AuthWitness[];
|
|
75
|
+
protected readonly capsules: Capsule[];
|
|
76
|
+
protected readonly anchorBlockHeader: BlockHeader;
|
|
77
|
+
protected readonly contractStore: ContractStore;
|
|
78
|
+
protected readonly noteStore: NoteStore;
|
|
79
|
+
protected readonly keyStore: KeyStore;
|
|
80
|
+
protected readonly addressStore: AddressStore;
|
|
81
|
+
protected readonly aztecNode: AztecNode;
|
|
82
|
+
protected readonly recipientTaggingStore: RecipientTaggingStore;
|
|
83
|
+
protected readonly senderAddressBookStore: SenderAddressBookStore;
|
|
84
|
+
protected readonly capsuleStore: CapsuleStore;
|
|
85
|
+
protected readonly privateEventStore: PrivateEventStore;
|
|
86
|
+
protected readonly jobId: string;
|
|
87
|
+
protected log: ReturnType<typeof createLogger>;
|
|
88
|
+
protected readonly scopes?: AztecAddress[];
|
|
89
|
+
|
|
90
|
+
constructor(args: UtilityExecutionOracleArgs) {
|
|
91
|
+
this.contractAddress = args.contractAddress;
|
|
92
|
+
this.authWitnesses = args.authWitnesses;
|
|
93
|
+
this.capsules = args.capsules;
|
|
94
|
+
this.anchorBlockHeader = args.anchorBlockHeader;
|
|
95
|
+
this.contractStore = args.contractStore;
|
|
96
|
+
this.noteStore = args.noteStore;
|
|
97
|
+
this.keyStore = args.keyStore;
|
|
98
|
+
this.addressStore = args.addressStore;
|
|
99
|
+
this.aztecNode = args.aztecNode;
|
|
100
|
+
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
101
|
+
this.senderAddressBookStore = args.senderAddressBookStore;
|
|
102
|
+
this.capsuleStore = args.capsuleStore;
|
|
103
|
+
this.privateEventStore = args.privateEventStore;
|
|
104
|
+
this.jobId = args.jobId;
|
|
105
|
+
this.log = args.log ?? createLogger('simulator:client_view_context');
|
|
106
|
+
this.scopes = args.scopes;
|
|
107
|
+
}
|
|
71
108
|
|
|
72
109
|
public utilityAssertCompatibleOracleVersion(version: number): void {
|
|
73
110
|
if (version !== ORACLE_VERSION) {
|
|
@@ -88,8 +125,21 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
88
125
|
* @param pkMHash - The master public key hash.
|
|
89
126
|
* @returns A Promise that resolves to nullifier keys.
|
|
90
127
|
* @throws If the keys are not registered in the key store.
|
|
128
|
+
* @throws If scopes are defined and the account is not in the scopes.
|
|
91
129
|
*/
|
|
92
|
-
public utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
130
|
+
public async utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
131
|
+
// If scopes are defined, check that the key belongs to an account in the scopes.
|
|
132
|
+
if (this.scopes && this.scopes.length > 0) {
|
|
133
|
+
let hasAccess = false;
|
|
134
|
+
for (let i = 0; i < this.scopes.length && !hasAccess; i++) {
|
|
135
|
+
if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
|
|
136
|
+
hasAccess = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (!hasAccess) {
|
|
140
|
+
throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
93
143
|
return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
|
|
94
144
|
}
|
|
95
145
|
|
|
@@ -289,8 +339,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
289
339
|
* @returns A boolean indicating whether the nullifier exists in the tree or not.
|
|
290
340
|
*/
|
|
291
341
|
public async utilityCheckNullifierExists(innerNullifier: Fr) {
|
|
292
|
-
const nullifier = await
|
|
293
|
-
|
|
342
|
+
const [nullifier, anchorBlockHash] = await Promise.all([
|
|
343
|
+
siloNullifier(this.contractAddress, innerNullifier!),
|
|
344
|
+
this.anchorBlockHeader.hash(),
|
|
345
|
+
]);
|
|
346
|
+
const [leafIndex] = await this.aztecNode.findLeavesIndexes(anchorBlockHash, MerkleTreeId.NULLIFIER_TREE, [
|
|
347
|
+
nullifier,
|
|
348
|
+
]);
|
|
294
349
|
return leafIndex?.data !== undefined;
|
|
295
350
|
}
|
|
296
351
|
|
|
@@ -341,12 +396,28 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
341
396
|
return values;
|
|
342
397
|
}
|
|
343
398
|
|
|
344
|
-
|
|
399
|
+
/**
|
|
400
|
+
* Returns a per-contract logger whose output is prefixed with `contract_log::<name>(<addrAbbrev>)`.
|
|
401
|
+
*/
|
|
402
|
+
async #getContractLogger(): Promise<Logger> {
|
|
403
|
+
if (!this.contractLogger) {
|
|
404
|
+
const addrAbbrev = this.contractAddress.toString().slice(0, 10);
|
|
405
|
+
const name = await this.contractStore.getDebugContractName(this.contractAddress);
|
|
406
|
+
const module = name ? `contract_log::${name}(${addrAbbrev})` : `contract_log::${addrAbbrev}`;
|
|
407
|
+
// Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
|
|
408
|
+
// to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
|
|
409
|
+
this.contractLogger = createLogger(module, { instanceId: this.jobId });
|
|
410
|
+
}
|
|
411
|
+
return this.contractLogger;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
public async utilityLog(level: number, message: string, fields: Fr[]): Promise<void> {
|
|
345
415
|
if (!LogLevels[level]) {
|
|
346
|
-
throw new Error(`Invalid
|
|
416
|
+
throw new Error(`Invalid log level: ${level}`);
|
|
347
417
|
}
|
|
348
418
|
const levelName = LogLevels[level];
|
|
349
|
-
this
|
|
419
|
+
const logger = await this.#getContractLogger();
|
|
420
|
+
logger[levelName](`${applyStringFormatting(message, fields)}`);
|
|
350
421
|
}
|
|
351
422
|
|
|
352
423
|
public async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
|
|
@@ -18,8 +18,9 @@ import { syncState, verifyCurrentClassId } from './helpers.js';
|
|
|
18
18
|
export class ContractSyncService implements StagedStore {
|
|
19
19
|
readonly storeName = 'contract_sync';
|
|
20
20
|
|
|
21
|
-
// Tracks contracts synced since last wipe.
|
|
22
|
-
//
|
|
21
|
+
// Tracks contracts synced since last wipe. The cache is keyed per individual scope address
|
|
22
|
+
// (`contractAddress:scopeAddress`), or `contractAddress:*` for undefined scopes (all accounts).
|
|
23
|
+
// The value is a promise that resolves when the contract is synced.
|
|
23
24
|
private syncedContracts: Map<string, Promise<void>> = new Map();
|
|
24
25
|
|
|
25
26
|
// Per-job overridden contract addresses - these contracts should not be synced.
|
|
@@ -44,43 +45,50 @@ export class ContractSyncService implements StagedStore {
|
|
|
44
45
|
* @param functionToInvokeAfterSync - The function selector that will be called after sync (used to validate it's
|
|
45
46
|
* not sync_state itself).
|
|
46
47
|
* @param utilityExecutor - Executor function for running the sync_state utility function.
|
|
48
|
+
* @param scopes - Scopes to pass through to the utility executor (affects which notes are discovered).
|
|
47
49
|
*/
|
|
48
50
|
async ensureContractSynced(
|
|
49
51
|
contractAddress: AztecAddress,
|
|
50
52
|
functionToInvokeAfterSync: FunctionSelector | null,
|
|
51
|
-
utilityExecutor: (call: FunctionCall) => Promise<any>,
|
|
53
|
+
utilityExecutor: (call: FunctionCall, scopes: undefined | AztecAddress[]) => Promise<any>,
|
|
52
54
|
anchorBlockHeader: BlockHeader,
|
|
53
55
|
jobId: string,
|
|
56
|
+
scopes: undefined | AztecAddress[],
|
|
54
57
|
): Promise<void> {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Skip sync if this contract has an override for this job
|
|
58
|
+
// Skip sync if this contract has an override for this job (overrides are keyed by contract address only)
|
|
58
59
|
const overrides = this.overriddenContracts.get(jobId);
|
|
59
|
-
if (overrides?.has(
|
|
60
|
+
if (overrides?.has(contractAddress.toString())) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
// Skip sync if we already synced for "all scopes", or if we have an empty list of scopes
|
|
65
|
+
const allScopesKey = toKey(contractAddress, undefined);
|
|
66
|
+
const allScopesExisting = this.syncedContracts.get(allScopesKey);
|
|
67
|
+
if (allScopesExisting || (scopes && scopes.length == 0)) {
|
|
68
|
+
return;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
const unsyncedScopes = scopes?.filter(scope => !this.syncedContracts.has(toKey(contractAddress, scope)));
|
|
72
|
+
const unsyncedScopesKeys = toKeys(contractAddress, unsyncedScopes);
|
|
73
|
+
|
|
74
|
+
if (unsyncedScopesKeys.length > 0) {
|
|
75
|
+
// Start sync and store the promise for all unsynced scopes
|
|
76
|
+
const promise = this.#doSync(
|
|
77
|
+
contractAddress,
|
|
78
|
+
functionToInvokeAfterSync,
|
|
79
|
+
call => utilityExecutor(call, unsyncedScopes),
|
|
80
|
+
anchorBlockHeader,
|
|
81
|
+
jobId,
|
|
82
|
+
).catch(err => {
|
|
83
|
+
// There was an error syncing the contract, so we remove it from the cache so that it can be retried.
|
|
84
|
+
unsyncedScopesKeys.forEach(key => this.syncedContracts.delete(key));
|
|
85
|
+
throw err;
|
|
86
|
+
});
|
|
87
|
+
unsyncedScopesKeys.forEach(key => this.syncedContracts.set(key, promise));
|
|
83
88
|
}
|
|
89
|
+
|
|
90
|
+
const promises = toKeys(contractAddress, scopes).map(key => this.syncedContracts.get(key)!);
|
|
91
|
+
await Promise.all(promises);
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
async #doSync(
|
|
@@ -127,3 +135,11 @@ export class ContractSyncService implements StagedStore {
|
|
|
127
135
|
return Promise.resolve();
|
|
128
136
|
}
|
|
129
137
|
}
|
|
138
|
+
|
|
139
|
+
function toKeys(contract: AztecAddress, scopes: undefined | AztecAddress[]) {
|
|
140
|
+
return scopes === undefined ? [toKey(contract, undefined)] : scopes.map(scope => toKey(contract, scope));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function toKey(contract: AztecAddress, scope: AztecAddress | undefined) {
|
|
144
|
+
return scope === undefined ? `${contract.toString()}:*` : `${contract.toString()}:${scope.toString()}`;
|
|
145
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
|
2
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ContractOverrides } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
7
7
|
import type { BlockSynchronizer } from '../block_synchronizer/block_synchronizer.js';
|
|
8
8
|
import type { ContractFunctionSimulator } from '../contract_function_simulator/contract_function_simulator.js';
|
|
@@ -71,21 +71,17 @@ export class PXEDebugUtils {
|
|
|
71
71
|
await this.contractSyncService.ensureContractSynced(
|
|
72
72
|
filter.contractAddress,
|
|
73
73
|
null,
|
|
74
|
-
async privateSyncCall =>
|
|
75
|
-
await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [],
|
|
74
|
+
async (privateSyncCall, execScopes) =>
|
|
75
|
+
await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
76
76
|
anchorBlockHeader,
|
|
77
77
|
jobId,
|
|
78
|
+
filter.scopes,
|
|
78
79
|
);
|
|
79
80
|
|
|
80
81
|
return this.noteStore.getNotes(filter, jobId);
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
/** Returns the block header up to which the PXE has synced. */
|
|
85
|
-
public getSyncedBlockHeader(): Promise<BlockHeader> {
|
|
86
|
-
return this.anchorBlockStore.getBlockHeader();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
85
|
/**
|
|
90
86
|
* Triggers a sync of the PXE with the node.
|
|
91
87
|
* Blocks until the sync is complete.
|
|
@@ -52,6 +52,14 @@ export async function createPXE(
|
|
|
52
52
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
53
53
|
|
|
54
54
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
55
|
-
const pxe = await PXE.create(
|
|
55
|
+
const pxe = await PXE.create({
|
|
56
|
+
node: aztecNode,
|
|
57
|
+
store,
|
|
58
|
+
proofCreator: prover,
|
|
59
|
+
simulator,
|
|
60
|
+
protocolContractsProvider,
|
|
61
|
+
config,
|
|
62
|
+
loggerOrSuffix: pxeLogger,
|
|
63
|
+
});
|
|
56
64
|
return pxe;
|
|
57
65
|
}
|
|
@@ -52,6 +52,14 @@ export async function createPXE(
|
|
|
52
52
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
53
53
|
|
|
54
54
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
55
|
-
const pxe = await PXE.create(
|
|
55
|
+
const pxe = await PXE.create({
|
|
56
|
+
node: aztecNode,
|
|
57
|
+
store,
|
|
58
|
+
proofCreator: prover,
|
|
59
|
+
simulator,
|
|
60
|
+
protocolContractsProvider,
|
|
61
|
+
config,
|
|
62
|
+
loggerOrSuffix: pxeLogger,
|
|
63
|
+
});
|
|
56
64
|
return pxe;
|
|
57
65
|
}
|
|
@@ -58,14 +58,14 @@ export async function createPXE(
|
|
|
58
58
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
59
59
|
|
|
60
60
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
61
|
-
const pxe = await PXE.create(
|
|
62
|
-
aztecNode,
|
|
63
|
-
options.store,
|
|
64
|
-
prover,
|
|
61
|
+
const pxe = await PXE.create({
|
|
62
|
+
node: aztecNode,
|
|
63
|
+
store: options.store,
|
|
64
|
+
proofCreator: prover,
|
|
65
65
|
simulator,
|
|
66
66
|
protocolContractsProvider,
|
|
67
|
-
configWithContracts,
|
|
68
|
-
pxeLogger,
|
|
69
|
-
);
|
|
67
|
+
config: configWithContracts,
|
|
68
|
+
loggerOrSuffix: pxeLogger,
|
|
69
|
+
});
|
|
70
70
|
return pxe;
|
|
71
71
|
}
|
package/src/logs/log_service.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import type { KeyStore } from '@aztec/key-store';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
-
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
5
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
7
6
|
import { DirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
8
7
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
@@ -159,7 +158,10 @@ export class LogService {
|
|
|
159
158
|
contractAddress: AztecAddress,
|
|
160
159
|
recipient: AztecAddress,
|
|
161
160
|
): Promise<DirectionalAppTaggingSecret[]> {
|
|
162
|
-
const recipientCompleteAddress = await this
|
|
161
|
+
const recipientCompleteAddress = await this.addressStore.getCompleteAddress(recipient);
|
|
162
|
+
if (!recipientCompleteAddress) {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
163
165
|
const recipientIvsk = await this.keyStore.getMasterIncomingViewingSecretKey(recipient);
|
|
164
166
|
|
|
165
167
|
// We implicitly add all PXE accounts as senders, this helps us decrypt tags on notes that we send to ourselves
|
|
@@ -206,15 +208,4 @@ export class LogService {
|
|
|
206
208
|
// TODO: This looks like it could belong more at the oracle interface level
|
|
207
209
|
return this.capsuleStore.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs, this.jobId);
|
|
208
210
|
}
|
|
209
|
-
|
|
210
|
-
async #getCompleteAddress(account: AztecAddress): Promise<CompleteAddress> {
|
|
211
|
-
const completeAddress = await this.addressStore.getCompleteAddress(account);
|
|
212
|
-
if (!completeAddress) {
|
|
213
|
-
throw new Error(
|
|
214
|
-
`No public key registered for address ${account}.
|
|
215
|
-
Register it by calling pxe.addAccount(...).\nSee docs for context: https://docs.aztec.network/developers/resources/debugging/aztecnr-errors#simulation-error-no-public-key-registered-for-address-0x0-register-it-by-calling-pxeregisterrecipient-or-pxeregisteraccount`,
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
return completeAddress;
|
|
219
|
-
}
|
|
220
211
|
}
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 12;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
|
|
11
11
|
/// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
12
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
12
|
+
export const ORACLE_INTERFACE_HASH = '666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4';
|