@aztec/pxe 0.0.1-commit.f5d02921e → 0.0.1-commit.f650c0a5c
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/bin/check_oracle_version.js +4 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +3 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
- package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
- package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +13 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +10 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +13 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +98 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +2 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +9 -0
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +25 -12
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +102 -34
- package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
- package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
- package/dest/contract_function_simulator/pick_notes.js +9 -2
- package/dest/contract_sync/contract_sync_service.d.ts +4 -6
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +7 -27
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.d.ts +3 -3
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.d.ts +1 -2
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +0 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -2
- package/dest/entrypoints/client/lazy/index.d.ts +1 -2
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +0 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -2
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/pxe_creation_options.js +3 -1
- package/dest/entrypoints/server/index.d.ts +2 -3
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -2
- package/dest/entrypoints/server/utils.d.ts +2 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -2
- package/dest/logs/log_service.d.ts +4 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +11 -20
- package/dest/notes/note_service.d.ts +3 -4
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes_filter.d.ts +2 -3
- package/dest/notes_filter.d.ts.map +1 -1
- package/dest/oracle_version.d.ts +4 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +20 -10
- package/dest/pxe.d.ts +4 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +4 -4
- package/dest/storage/capsule_store/capsule_service.d.ts +2 -3
- package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_service.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +1 -1
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/contract_function_simulator/contract_function_simulator.ts +2 -3
- package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +20 -1
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +7 -1
- package/src/contract_function_simulator/oracle/oracle.ts +143 -3
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +12 -3
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +164 -63
- package/src/contract_function_simulator/pick_notes.ts +9 -2
- package/src/contract_sync/contract_sync_service.ts +15 -37
- package/src/contract_sync/helpers.ts +2 -3
- package/src/debug/pxe_debug_utils.ts +3 -3
- package/src/entrypoints/client/bundle/index.ts +0 -1
- package/src/entrypoints/client/bundle/utils.ts +2 -3
- package/src/entrypoints/client/lazy/index.ts +0 -1
- package/src/entrypoints/client/lazy/utils.ts +2 -3
- package/src/entrypoints/pxe_creation_options.ts +7 -0
- package/src/entrypoints/server/index.ts +1 -2
- package/src/entrypoints/server/utils.ts +2 -3
- package/src/logs/log_service.ts +19 -50
- package/src/notes/note_service.ts +2 -3
- package/src/notes_filter.ts +1 -3
- package/src/oracle_version.ts +20 -10
- package/src/pxe.ts +8 -10
- package/src/storage/capsule_store/capsule_service.ts +5 -6
- package/src/storage/note_store/note_store.ts +2 -5
- package/dest/access_scopes.d.ts +0 -9
- package/dest/access_scopes.d.ts.map +0 -1
- package/dest/access_scopes.js +0 -6
- package/src/access_scopes.ts +0 -9
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
|
|
2
1
|
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
3
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
3
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
@@ -10,7 +9,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
10
9
|
import type { PXEConfig } from '../../config/index.js';
|
|
11
10
|
import { PXE } from '../../pxe.js';
|
|
12
11
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
13
|
-
import type
|
|
12
|
+
import { type PXECreationOptions, isPrivateKernelProver } from '../pxe_creation_options.js';
|
|
14
13
|
|
|
15
14
|
type PXEConfigWithoutDefaults = Omit<PXEConfig, 'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'>;
|
|
16
15
|
|
|
@@ -49,7 +48,7 @@ export async function createPXE(
|
|
|
49
48
|
const proverLogger = loggers.prover ?? createLogger('pxe:bb:native', { actor });
|
|
50
49
|
|
|
51
50
|
let prover;
|
|
52
|
-
if (options.proverOrOptions
|
|
51
|
+
if (isPrivateKernelProver(options.proverOrOptions)) {
|
|
53
52
|
prover = options.proverOrOptions;
|
|
54
53
|
} else {
|
|
55
54
|
prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
|
package/src/logs/log_service.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
2
|
import type { KeyStore } from '@aztec/key-store';
|
|
4
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import {
|
|
7
|
-
ExtendedDirectionalAppTaggingSecret,
|
|
8
|
-
PendingTaggedLog,
|
|
9
|
-
SiloedTag,
|
|
10
|
-
Tag,
|
|
11
|
-
TxScopedL2Log,
|
|
12
|
-
} from '@aztec/stdlib/logs';
|
|
5
|
+
import { ExtendedDirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag } from '@aztec/stdlib/logs';
|
|
13
6
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
14
7
|
|
|
15
8
|
import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
|
|
16
9
|
import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
|
|
17
10
|
import { AddressStore } from '../storage/address_store/address_store.js';
|
|
18
|
-
import type { CapsuleService } from '../storage/capsule_store/capsule_service.js';
|
|
19
11
|
import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
|
|
20
12
|
import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
|
|
21
13
|
import {
|
|
@@ -31,7 +23,6 @@ export class LogService {
|
|
|
31
23
|
private readonly aztecNode: AztecNode,
|
|
32
24
|
private readonly anchorBlockHeader: BlockHeader,
|
|
33
25
|
private readonly keyStore: KeyStore,
|
|
34
|
-
private readonly capsuleService: CapsuleService,
|
|
35
26
|
private readonly recipientTaggingStore: RecipientTaggingStore,
|
|
36
27
|
private readonly senderAddressBookStore: SenderAddressBookStore,
|
|
37
28
|
private readonly addressStore: AddressStore,
|
|
@@ -120,11 +111,7 @@ export class LogService {
|
|
|
120
111
|
);
|
|
121
112
|
}
|
|
122
113
|
|
|
123
|
-
public async fetchTaggedLogs(
|
|
124
|
-
contractAddress: AztecAddress,
|
|
125
|
-
pendingTaggedLogArrayBaseSlot: Fr,
|
|
126
|
-
recipient: AztecAddress,
|
|
127
|
-
) {
|
|
114
|
+
public async fetchTaggedLogs(contractAddress: AztecAddress, recipient: AztecAddress): Promise<PendingTaggedLog[]> {
|
|
128
115
|
this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
|
|
129
116
|
|
|
130
117
|
// We only load logs from block up to and including the anchor block number
|
|
@@ -148,12 +135,12 @@ export class LogService {
|
|
|
148
135
|
),
|
|
149
136
|
);
|
|
150
137
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
138
|
+
return logArrays
|
|
139
|
+
.flat()
|
|
140
|
+
.map(
|
|
141
|
+
scopedLog =>
|
|
142
|
+
new PendingTaggedLog(scopedLog.logData, scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier),
|
|
143
|
+
);
|
|
157
144
|
}
|
|
158
145
|
|
|
159
146
|
async #getSecretsForSenders(
|
|
@@ -176,43 +163,25 @@ export class LogService {
|
|
|
176
163
|
);
|
|
177
164
|
|
|
178
165
|
return Promise.all(
|
|
179
|
-
deduplicatedSenders.map(sender => {
|
|
180
|
-
|
|
166
|
+
deduplicatedSenders.map(async sender => {
|
|
167
|
+
const secret = await ExtendedDirectionalAppTaggingSecret.compute(
|
|
181
168
|
recipientCompleteAddress,
|
|
182
169
|
recipientIvsk,
|
|
183
170
|
sender,
|
|
184
171
|
contractAddress,
|
|
185
172
|
recipient,
|
|
186
173
|
);
|
|
187
|
-
}),
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
174
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const pendingTaggedLogs = privateLogs.map(scopedLog => {
|
|
199
|
-
const pendingTaggedLog = new PendingTaggedLog(
|
|
200
|
-
scopedLog.logData,
|
|
201
|
-
scopedLog.txHash,
|
|
202
|
-
scopedLog.noteHashes,
|
|
203
|
-
scopedLog.firstNullifier,
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
return pendingTaggedLog.toFields();
|
|
207
|
-
});
|
|
175
|
+
if (!secret) {
|
|
176
|
+
// Note that all senders originate from either the SenderAddressBookStore or the KeyStore.
|
|
177
|
+
// TODO(F-512): make sure we actually prevent registering invalid senders.
|
|
178
|
+
throw new Error(
|
|
179
|
+
`Failed to compute a tagging secret for sender ${sender} - this implies this is an invalid address, which should not happen as they have been previously registered in PXE.`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
208
182
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
contractAddress,
|
|
212
|
-
capsuleArrayBaseSlot,
|
|
213
|
-
pendingTaggedLogs,
|
|
214
|
-
this.jobId,
|
|
215
|
-
recipient,
|
|
183
|
+
return secret;
|
|
184
|
+
}),
|
|
216
185
|
);
|
|
217
186
|
}
|
|
218
187
|
}
|
|
@@ -7,7 +7,6 @@ import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
|
|
|
7
7
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
8
8
|
import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
|
|
9
9
|
|
|
10
|
-
import type { AccessScopes } from '../access_scopes.js';
|
|
11
10
|
import type { NoteStore } from '../storage/note_store/note_store.js';
|
|
12
11
|
|
|
13
12
|
export class NoteService {
|
|
@@ -32,7 +31,7 @@ export class NoteService {
|
|
|
32
31
|
owner: AztecAddress | undefined,
|
|
33
32
|
storageSlot: Fr,
|
|
34
33
|
status: NoteStatus,
|
|
35
|
-
scopes:
|
|
34
|
+
scopes: AztecAddress[],
|
|
36
35
|
) {
|
|
37
36
|
const noteDaos = await this.noteStore.getNotes(
|
|
38
37
|
{
|
|
@@ -71,7 +70,7 @@ export class NoteService {
|
|
|
71
70
|
*
|
|
72
71
|
* @param contractAddress - The contract whose notes should be checked and nullified.
|
|
73
72
|
*/
|
|
74
|
-
public async syncNoteNullifiers(contractAddress: AztecAddress, scopes:
|
|
73
|
+
public async syncNoteNullifiers(contractAddress: AztecAddress, scopes: AztecAddress[]): Promise<void> {
|
|
75
74
|
const anchorBlockHash = await this.anchorBlockHeader.hash();
|
|
76
75
|
|
|
77
76
|
const contractNotes = await this.noteStore.getNotes({ contractAddress, scopes }, this.jobId);
|
package/src/notes_filter.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
4
4
|
|
|
5
|
-
import type { AccessScopes } from './access_scopes.js';
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* A filter used to fetch notes.
|
|
9
7
|
* @remarks This filter is applied as an intersection of all its params.
|
|
@@ -22,5 +20,5 @@ export type NotesFilter = {
|
|
|
22
20
|
status?: NoteStatus;
|
|
23
21
|
/** The siloed nullifier for the note. */
|
|
24
22
|
siloedNullifier?: Fr;
|
|
25
|
-
scopes:
|
|
23
|
+
scopes: AztecAddress[];
|
|
26
24
|
};
|
package/src/oracle_version.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
/// The
|
|
2
|
-
///
|
|
3
|
-
///
|
|
1
|
+
/// The oracle version constants are used to check that the oracle interface is in sync between PXE and Aztec.nr.
|
|
2
|
+
/// We version the oracle interface as `major.minor` where:
|
|
3
|
+
/// - `major` = backward-breaking changes (must match exactly between PXE and Aztec.nr)
|
|
4
|
+
/// - `minor` = oracle additions (non-breaking; PXE minor >= contract minor)
|
|
4
5
|
///
|
|
5
|
-
///
|
|
6
|
-
///
|
|
7
|
-
|
|
6
|
+
/// The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
7
|
+
///
|
|
8
|
+
/// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is called.
|
|
9
|
+
/// If the major version is incompatible, an error is thrown immediately. The minor version is recorded by the PXE and
|
|
10
|
+
/// used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw immediately
|
|
11
|
+
/// if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency without actually
|
|
12
|
+
/// using any of the new oracles then there is no reason to throw.
|
|
13
|
+
export const ORACLE_VERSION_MAJOR = 22;
|
|
14
|
+
export const ORACLE_VERSION_MINOR = 1;
|
|
8
15
|
|
|
9
|
-
/// This hash is computed
|
|
10
|
-
///
|
|
11
|
-
/// `
|
|
12
|
-
|
|
16
|
+
/// This hash is computed from the Oracle interface and is used to detect when that interface changes. When it does,
|
|
17
|
+
/// you need to either:
|
|
18
|
+
/// - increment `ORACLE_VERSION_MAJOR` and reset `ORACLE_VERSION_MINOR` to zero if the change is breaking, or
|
|
19
|
+
/// - increment only `ORACLE_VERSION_MINOR` if the change is additive (a new oracle was added).
|
|
20
|
+
///
|
|
21
|
+
/// These constants must be kept in sync between this file and `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
22
|
+
export const ORACLE_INTERFACE_HASH = 'efafa0db2cc1f94e26d794d0079c8f71115261df0c3d0fa8cb5b64f17a12db92';
|
package/src/pxe.ts
CHANGED
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
|
|
53
53
|
import { inspect } from 'util';
|
|
54
54
|
|
|
55
|
-
import type { AccessScopes } from './access_scopes.js';
|
|
56
55
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
57
56
|
import type { PXEConfig } from './config/index.js';
|
|
58
57
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
@@ -96,7 +95,7 @@ export type ProfileTxOpts = {
|
|
|
96
95
|
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
97
96
|
skipProofGeneration?: boolean;
|
|
98
97
|
/** Addresses whose private state and keys are accessible during private execution. */
|
|
99
|
-
scopes:
|
|
98
|
+
scopes: AztecAddress[];
|
|
100
99
|
};
|
|
101
100
|
|
|
102
101
|
/** Options for PXE.simulateTx. */
|
|
@@ -112,7 +111,7 @@ export type SimulateTxOpts = {
|
|
|
112
111
|
/** State overrides for the simulation, such as contract instances and artifacts. Requires skipKernels: true */
|
|
113
112
|
overrides?: SimulationOverrides;
|
|
114
113
|
/** Addresses whose private state and keys are accessible during private execution */
|
|
115
|
-
scopes:
|
|
114
|
+
scopes: AztecAddress[];
|
|
116
115
|
};
|
|
117
116
|
|
|
118
117
|
/** Options for PXE.executeUtility. */
|
|
@@ -120,7 +119,7 @@ export type ExecuteUtilityOpts = {
|
|
|
120
119
|
/** The authentication witnesses required for the function call. */
|
|
121
120
|
authwits?: AuthWitness[];
|
|
122
121
|
/** The accounts whose notes we can access in this call */
|
|
123
|
-
scopes:
|
|
122
|
+
scopes: AztecAddress[];
|
|
124
123
|
};
|
|
125
124
|
|
|
126
125
|
/** Args for PXE.create. */
|
|
@@ -215,7 +214,6 @@ export class PXE {
|
|
|
215
214
|
node,
|
|
216
215
|
contractStore,
|
|
217
216
|
noteStore,
|
|
218
|
-
() => keyStore.getAccounts(),
|
|
219
217
|
createLogger('pxe:contract_sync', bindings),
|
|
220
218
|
);
|
|
221
219
|
const messageContextService = new MessageContextService(node);
|
|
@@ -369,7 +367,7 @@ export class PXE {
|
|
|
369
367
|
async #executePrivate(
|
|
370
368
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
371
369
|
txRequest: TxExecutionRequest,
|
|
372
|
-
scopes:
|
|
370
|
+
scopes: AztecAddress[],
|
|
373
371
|
jobId: string,
|
|
374
372
|
): Promise<PrivateExecutionResult> {
|
|
375
373
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
@@ -418,7 +416,7 @@ export class PXE {
|
|
|
418
416
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
419
417
|
call: FunctionCall,
|
|
420
418
|
authWitnesses: AuthWitness[] | undefined,
|
|
421
|
-
scopes:
|
|
419
|
+
scopes: AztecAddress[],
|
|
422
420
|
jobId: string,
|
|
423
421
|
) {
|
|
424
422
|
try {
|
|
@@ -1043,7 +1041,7 @@ export class PXE {
|
|
|
1043
1041
|
inspect(txRequest),
|
|
1044
1042
|
`simulatePublic=${simulatePublic}`,
|
|
1045
1043
|
`skipTxValidation=${skipTxValidation}`,
|
|
1046
|
-
`scopes=${scopes
|
|
1044
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1047
1045
|
);
|
|
1048
1046
|
}
|
|
1049
1047
|
});
|
|
@@ -1055,7 +1053,7 @@ export class PXE {
|
|
|
1055
1053
|
*/
|
|
1056
1054
|
public executeUtility(
|
|
1057
1055
|
call: FunctionCall,
|
|
1058
|
-
{ authwits, scopes }: ExecuteUtilityOpts = { scopes:
|
|
1056
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
|
|
1059
1057
|
): Promise<UtilityExecutionResult> {
|
|
1060
1058
|
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1061
1059
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -1113,7 +1111,7 @@ export class PXE {
|
|
|
1113
1111
|
throw this.#contextualizeError(
|
|
1114
1112
|
err,
|
|
1115
1113
|
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1116
|
-
`scopes=${scopes
|
|
1114
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1117
1115
|
);
|
|
1118
1116
|
}
|
|
1119
1117
|
});
|
|
@@ -2,7 +2,6 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
import type { Capsule } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
|
-
import type { AccessScopes } from '../../access_scopes.js';
|
|
6
5
|
import type { CapsuleStore } from './capsule_store.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -12,7 +11,7 @@ import type { CapsuleStore } from './capsule_store.js';
|
|
|
12
11
|
export class CapsuleService {
|
|
13
12
|
constructor(
|
|
14
13
|
private readonly capsuleStore: CapsuleStore,
|
|
15
|
-
private readonly allowedScopes:
|
|
14
|
+
private readonly allowedScopes: AztecAddress[],
|
|
16
15
|
) {}
|
|
17
16
|
|
|
18
17
|
setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string, scope: AztecAddress) {
|
|
@@ -79,13 +78,13 @@ export class CapsuleService {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
function assertAllowedScope(scope: AztecAddress, allowedScopes:
|
|
83
|
-
if (
|
|
81
|
+
function assertAllowedScope(scope: AztecAddress, allowedScopes: AztecAddress[]) {
|
|
82
|
+
if (scope.equals(AztecAddress.ZERO)) {
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
86
|
-
if (!allowedScopes.some(allowed => allowed.equals(scope))) {
|
|
85
|
+
if (!allowedScopes.some((allowed: AztecAddress) => allowed.equals(scope))) {
|
|
87
86
|
throw new Error(
|
|
88
|
-
`Scope ${scope.toString()} is not in the allowed scopes list: [${allowedScopes.map(s => s.toString()).join(', ')}]. See https://docs.aztec.network/errors/10`,
|
|
87
|
+
`Scope ${scope.toString()} is not in the allowed scopes list: [${allowedScopes.map((s: AztecAddress) => s.toString()).join(', ')}]. See https://docs.aztec.network/errors/10`,
|
|
89
88
|
);
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -106,7 +106,7 @@ export class NoteStore implements StagedStore {
|
|
|
106
106
|
* returned once if this is the case)
|
|
107
107
|
*/
|
|
108
108
|
getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]> {
|
|
109
|
-
if (filter.scopes
|
|
109
|
+
if (filter.scopes.length === 0) {
|
|
110
110
|
return Promise.resolve([]);
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -180,10 +180,7 @@ export class NoteStore implements StagedStore {
|
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
if (
|
|
184
|
-
filter.scopes !== 'ALL_SCOPES' &&
|
|
185
|
-
note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0
|
|
186
|
-
) {
|
|
183
|
+
if (note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0) {
|
|
187
184
|
continue;
|
|
188
185
|
}
|
|
189
186
|
|
package/dest/access_scopes.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
/**
|
|
3
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
4
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
5
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
6
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
7
|
-
*/
|
|
8
|
-
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzX3Njb3Blcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FjY2Vzc19zY29wZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sWUFBWSxHQUFHLFlBQVksR0FBRyxZQUFZLEVBQUUsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access_scopes.d.ts","sourceRoot":"","sources":["../src/access_scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC"}
|
package/dest/access_scopes.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
3
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
4
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
5
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
6
|
-
*/ export { };
|
package/src/access_scopes.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Controls which accounts' private state and keys are accessible during execution.
|
|
5
|
-
* - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
|
|
6
|
-
* - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
|
|
7
|
-
* - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
|
|
8
|
-
*/
|
|
9
|
-
export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
|