@aztec/pxe 0.0.1-commit.f5d02921e → 0.0.1-commit.f7ea82942
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/block_synchronizer/block_synchronizer.d.ts +6 -2
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +13 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +7 -14
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +6 -4
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +6 -4
- 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 +4 -4
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +19 -4
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +30 -16
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +106 -37
- 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 +20 -3
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.d.ts.map +1 -1
- package/dest/contract_function_simulator/proxied_contract_data_source.js +3 -0
- 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 +38 -46
- 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/events/event_service.d.ts +1 -1
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +10 -1
- package/dest/events/private_event_filter_validator.d.ts +3 -2
- package/dest/events/private_event_filter_validator.d.ts.map +1 -1
- package/dest/events/private_event_filter_validator.js +15 -0
- package/dest/logs/log_service.d.ts +6 -6
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +15 -21
- 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/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +4 -7
- package/dest/private_kernel/private_kernel_oracle.d.ts +5 -5
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +12 -15
- package/dest/pxe.d.ts +5 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +27 -20
- package/dest/storage/anchor_block_store/anchor_block_store.js +1 -1
- 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/capsule_store/capsule_store.d.ts +1 -1
- package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
- package/dest/storage/capsule_store/capsule_store.js +8 -5
- package/dest/storage/contract_store/contract_store.d.ts +1 -1
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +4 -2
- 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/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +3 -0
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +2 -2
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +2 -16
- package/package.json +16 -16
- package/src/bin/check_oracle_version.ts +4 -4
- package/src/block_synchronizer/block_synchronizer.ts +16 -2
- package/src/config/index.ts +2 -8
- package/src/contract_function_simulator/contract_function_simulator.ts +9 -7
- 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 +28 -6
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +171 -67
- package/src/contract_function_simulator/pick_notes.ts +22 -3
- package/src/contract_function_simulator/proxied_contract_data_source.ts +8 -1
- package/src/contract_sync/contract_sync_service.ts +64 -80
- 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/events/event_service.ts +13 -1
- package/src/events/private_event_filter_validator.ts +21 -1
- package/src/logs/log_service.ts +24 -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/private_kernel/private_kernel_execution_prover.ts +4 -9
- package/src/private_kernel/private_kernel_oracle.ts +14 -14
- package/src/pxe.ts +61 -26
- package/src/storage/anchor_block_store/anchor_block_store.ts +1 -1
- package/src/storage/capsule_store/capsule_service.ts +5 -6
- package/src/storage/capsule_store/capsule_store.ts +15 -5
- package/src/storage/contract_store/contract_store.ts +8 -6
- package/src/storage/note_store/note_store.ts +2 -5
- package/src/storage/private_event_store/private_event_store.ts +4 -0
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +5 -15
- 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
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';
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from '@aztec/stdlib/tx';
|
|
34
34
|
import { VerificationKeyAsFields, VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
35
35
|
|
|
36
|
+
import { computeTxExpirationTimestamp } from './hints/compute_tx_expiration_timestamp.js';
|
|
36
37
|
import { PrivateKernelResetPrivateInputsBuilder } from './hints/private_kernel_reset_private_inputs_builder.js';
|
|
37
38
|
import type { PrivateKernelOracle } from './private_kernel_oracle.js';
|
|
38
39
|
|
|
@@ -267,15 +268,9 @@ export class PrivateKernelExecutionProver {
|
|
|
267
268
|
// TODO: Enable padding once we better understand the final amounts to pad to.
|
|
268
269
|
const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
|
|
269
270
|
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
const expirationTimestampUpperBound = previousKernelData.publicInputs
|
|
273
|
-
const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
|
|
274
|
-
if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
|
|
275
|
-
throw new Error(
|
|
276
|
-
`Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`,
|
|
277
|
-
);
|
|
278
|
-
}
|
|
271
|
+
// Round the aggregated expirationTimestamp down to reduce precision and avoid leaking which private
|
|
272
|
+
// functions were called via their exact expiration offsets.
|
|
273
|
+
const expirationTimestampUpperBound = computeTxExpirationTimestamp(previousKernelData.publicInputs);
|
|
279
274
|
|
|
280
275
|
const privateInputs = new PrivateKernelTailCircuitPrivateInputs(
|
|
281
276
|
previousKernelData,
|
|
@@ -7,13 +7,13 @@ import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-type
|
|
|
7
7
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
8
8
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
-
import { BlockHash } from '@aztec/stdlib/block';
|
|
11
10
|
import { type ContractInstanceWithAddress, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
12
11
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
13
12
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
14
13
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
15
14
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
16
15
|
import type { NullifierMembershipWitness } from '@aztec/stdlib/trees';
|
|
16
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
17
17
|
import type { VerificationKeyAsFields } from '@aztec/stdlib/vks';
|
|
18
18
|
|
|
19
19
|
import type { ContractStore } from '../storage/contract_store/contract_store.js';
|
|
@@ -26,7 +26,7 @@ export class PrivateKernelOracle {
|
|
|
26
26
|
private contractStore: ContractStore,
|
|
27
27
|
private keyStore: KeyStore,
|
|
28
28
|
private node: AztecNode,
|
|
29
|
-
private
|
|
29
|
+
private blockHeader: BlockHeader,
|
|
30
30
|
) {}
|
|
31
31
|
|
|
32
32
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
@@ -80,22 +80,20 @@ export class PrivateKernelOracle {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/** Returns a membership witness with the sibling path and leaf index in our note hash tree. */
|
|
83
|
-
getNoteHashMembershipWitness(
|
|
84
|
-
|
|
83
|
+
async getNoteHashMembershipWitness(
|
|
84
|
+
noteHash: Fr,
|
|
85
|
+
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
|
|
86
|
+
return this.node.getNoteHashMembershipWitness(await this.blockHeader.hash(), noteHash);
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
/** Returns a membership witness with the sibling path and leaf index in our nullifier indexed merkle tree. */
|
|
88
|
-
getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
89
|
-
return this.node.getNullifierMembershipWitness(this.
|
|
90
|
+
async getNullifierMembershipWitness(nullifier: Fr): Promise<NullifierMembershipWitness | undefined> {
|
|
91
|
+
return this.node.getNullifierMembershipWitness(await this.blockHeader.hash(), nullifier);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/** Returns the root of our note hash merkle tree. */
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!header) {
|
|
96
|
-
throw new Error(`No block header found for block hash ${this.blockHash}`);
|
|
97
|
-
}
|
|
98
|
-
return header.state.partial.noteHashTree.root;
|
|
95
|
+
getNoteHashTreeRoot(): Fr {
|
|
96
|
+
return this.blockHeader.state.partial.noteHashTree.root;
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
/**
|
|
@@ -126,14 +124,16 @@ export class PrivateKernelOracle {
|
|
|
126
124
|
ProtocolContractAddress.ContractInstanceRegistry,
|
|
127
125
|
delayedPublicMutableHashSlot,
|
|
128
126
|
);
|
|
129
|
-
const
|
|
127
|
+
const blockHash = await this.blockHeader.hash();
|
|
128
|
+
|
|
129
|
+
const updatedClassIdWitness = await this.node.getPublicDataWitness(blockHash, hashLeafSlot);
|
|
130
130
|
|
|
131
131
|
if (!updatedClassIdWitness) {
|
|
132
132
|
throw new Error(`No public data tree witness found for ${hashLeafSlot}`);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const readStorage = (storageSlot: Fr) =>
|
|
136
|
-
this.node.getPublicStorageAt(
|
|
136
|
+
this.node.getPublicStorageAt(blockHash, ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
|
|
137
137
|
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
|
|
138
138
|
delayedPublicMutableSlot,
|
|
139
139
|
readStorage,
|
package/src/pxe.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from '@aztec/stdlib/abi';
|
|
19
19
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
20
20
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
|
+
import type { L2TipsProvider } from '@aztec/stdlib/block';
|
|
21
22
|
import {
|
|
22
23
|
CompleteAddress,
|
|
23
24
|
type ContractInstanceWithAddress,
|
|
@@ -52,7 +53,6 @@ import {
|
|
|
52
53
|
|
|
53
54
|
import { inspect } from 'util';
|
|
54
55
|
|
|
55
|
-
import type { AccessScopes } from './access_scopes.js';
|
|
56
56
|
import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
57
57
|
import type { PXEConfig } from './config/index.js';
|
|
58
58
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
@@ -96,7 +96,7 @@ export type ProfileTxOpts = {
|
|
|
96
96
|
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
97
97
|
skipProofGeneration?: boolean;
|
|
98
98
|
/** Addresses whose private state and keys are accessible during private execution. */
|
|
99
|
-
scopes:
|
|
99
|
+
scopes: AztecAddress[];
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
/** Options for PXE.simulateTx. */
|
|
@@ -112,7 +112,7 @@ export type SimulateTxOpts = {
|
|
|
112
112
|
/** State overrides for the simulation, such as contract instances and artifacts. Requires skipKernels: true */
|
|
113
113
|
overrides?: SimulationOverrides;
|
|
114
114
|
/** Addresses whose private state and keys are accessible during private execution */
|
|
115
|
-
scopes:
|
|
115
|
+
scopes: AztecAddress[];
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
/** Options for PXE.executeUtility. */
|
|
@@ -120,7 +120,7 @@ export type ExecuteUtilityOpts = {
|
|
|
120
120
|
/** The authentication witnesses required for the function call. */
|
|
121
121
|
authwits?: AuthWitness[];
|
|
122
122
|
/** The accounts whose notes we can access in this call */
|
|
123
|
-
scopes:
|
|
123
|
+
scopes: AztecAddress[];
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
/** Args for PXE.create. */
|
|
@@ -162,6 +162,7 @@ export class PXE {
|
|
|
162
162
|
private privateEventStore: PrivateEventStore,
|
|
163
163
|
private contractSyncService: ContractSyncService,
|
|
164
164
|
private messageContextService: MessageContextService,
|
|
165
|
+
private l2TipsStore: L2TipsProvider,
|
|
165
166
|
private simulator: CircuitSimulator,
|
|
166
167
|
private proverEnabled: boolean,
|
|
167
168
|
private proofCreator: PrivateKernelProver,
|
|
@@ -215,7 +216,6 @@ export class PXE {
|
|
|
215
216
|
node,
|
|
216
217
|
contractStore,
|
|
217
218
|
noteStore,
|
|
218
|
-
() => keyStore.getAccounts(),
|
|
219
219
|
createLogger('pxe:contract_sync', bindings),
|
|
220
220
|
);
|
|
221
221
|
const messageContextService = new MessageContextService(node);
|
|
@@ -262,6 +262,7 @@ export class PXE {
|
|
|
262
262
|
privateEventStore,
|
|
263
263
|
contractSyncService,
|
|
264
264
|
messageContextService,
|
|
265
|
+
tipsStore,
|
|
265
266
|
simulator,
|
|
266
267
|
proverEnabled,
|
|
267
268
|
proofCreator,
|
|
@@ -296,6 +297,7 @@ export class PXE {
|
|
|
296
297
|
keyStore: this.keyStore,
|
|
297
298
|
addressStore: this.addressStore,
|
|
298
299
|
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
300
|
+
l2TipsStore: this.l2TipsStore,
|
|
299
301
|
senderTaggingStore: this.senderTaggingStore,
|
|
300
302
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
301
303
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
@@ -369,14 +371,13 @@ export class PXE {
|
|
|
369
371
|
async #executePrivate(
|
|
370
372
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
371
373
|
txRequest: TxExecutionRequest,
|
|
372
|
-
|
|
374
|
+
anchorBlockHeader: BlockHeader,
|
|
375
|
+
scopes: AztecAddress[],
|
|
373
376
|
jobId: string,
|
|
374
377
|
): Promise<PrivateExecutionResult> {
|
|
375
378
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
376
379
|
|
|
377
380
|
try {
|
|
378
|
-
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
379
|
-
|
|
380
381
|
await this.contractSyncService.ensureContractSynced(
|
|
381
382
|
contractAddress,
|
|
382
383
|
functionSelector,
|
|
@@ -418,7 +419,7 @@ export class PXE {
|
|
|
418
419
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
419
420
|
call: FunctionCall,
|
|
420
421
|
authWitnesses: AuthWitness[] | undefined,
|
|
421
|
-
scopes:
|
|
422
|
+
scopes: AztecAddress[],
|
|
422
423
|
jobId: string,
|
|
423
424
|
) {
|
|
424
425
|
try {
|
|
@@ -481,11 +482,10 @@ export class PXE {
|
|
|
481
482
|
txExecutionRequest: TxExecutionRequest,
|
|
482
483
|
proofCreator: PrivateKernelProver,
|
|
483
484
|
privateExecutionResult: PrivateExecutionResult,
|
|
485
|
+
anchorBlockHeader: BlockHeader,
|
|
484
486
|
config: PrivateKernelExecutionProverConfig,
|
|
485
487
|
): Promise<PrivateKernelExecutionProofOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
486
|
-
const
|
|
487
|
-
const anchorBlockHash = await anchorBlockHeader.hash();
|
|
488
|
-
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHash);
|
|
488
|
+
const kernelOracle = new PrivateKernelOracle(this.contractStore, this.keyStore, this.node, anchorBlockHeader);
|
|
489
489
|
const kernelTraceProver = new PrivateKernelExecutionProver(
|
|
490
490
|
kernelOracle,
|
|
491
491
|
proofCreator,
|
|
@@ -562,6 +562,12 @@ export class PXE {
|
|
|
562
562
|
* TODO: It's strange that we return the address here and I (benesjan) think we should drop the return value.
|
|
563
563
|
*/
|
|
564
564
|
public async registerSender(sender: AztecAddress): Promise<AztecAddress> {
|
|
565
|
+
if (!(await sender.isValid())) {
|
|
566
|
+
throw new Error(
|
|
567
|
+
`Address ${sender} is not valid: it does not correspond to a point on the Grumpkin curve. Cannot register it as a sender.`,
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
|
|
565
571
|
const accounts = await this.keyStore.getAccounts();
|
|
566
572
|
if (accounts.includes(sender)) {
|
|
567
573
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
@@ -573,8 +579,8 @@ export class PXE {
|
|
|
573
579
|
if (wasAdded) {
|
|
574
580
|
this.log.info(`Added sender:\n ${sender.toString()}`);
|
|
575
581
|
// Wipe the entire sync cache: the new sender's tagged logs could contain notes/events for any contract, so
|
|
576
|
-
// all contracts must re-sync to discover them.
|
|
577
|
-
this.contractSyncService.wipe();
|
|
582
|
+
// all contracts must re-sync to discover them. Queued to avoid wiping while a job is in flight.
|
|
583
|
+
await this.#putInJobQueue(() => Promise.resolve(this.contractSyncService.wipe()));
|
|
578
584
|
} else {
|
|
579
585
|
this.log.info(`Sender:\n "${sender.toString()}"\n already registered.`);
|
|
580
586
|
}
|
|
@@ -743,16 +749,23 @@ export class PXE {
|
|
|
743
749
|
try {
|
|
744
750
|
const syncTimer = new Timer();
|
|
745
751
|
await this.blockStateSynchronizer.sync();
|
|
752
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
746
753
|
const syncTime = syncTimer.ms();
|
|
747
754
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
748
|
-
privateExecutionResult = await this.#executePrivate(
|
|
755
|
+
privateExecutionResult = await this.#executePrivate(
|
|
756
|
+
contractFunctionSimulator,
|
|
757
|
+
txRequest,
|
|
758
|
+
anchorBlockHeader,
|
|
759
|
+
scopes,
|
|
760
|
+
jobId,
|
|
761
|
+
);
|
|
749
762
|
|
|
750
763
|
const {
|
|
751
764
|
publicInputs,
|
|
752
765
|
chonkProof,
|
|
753
766
|
executionSteps,
|
|
754
767
|
timings: { proving } = {},
|
|
755
|
-
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, {
|
|
768
|
+
} = await this.#prove(txRequest, this.proofCreator, privateExecutionResult, anchorBlockHeader, {
|
|
756
769
|
simulate: false,
|
|
757
770
|
skipFeeEnforcement: false,
|
|
758
771
|
profileMode: 'none',
|
|
@@ -835,15 +848,23 @@ export class PXE {
|
|
|
835
848
|
);
|
|
836
849
|
const syncTimer = new Timer();
|
|
837
850
|
await this.blockStateSynchronizer.sync();
|
|
851
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
838
852
|
const syncTime = syncTimer.ms();
|
|
839
853
|
|
|
840
854
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
841
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
855
|
+
const privateExecutionResult = await this.#executePrivate(
|
|
856
|
+
contractFunctionSimulator,
|
|
857
|
+
txRequest,
|
|
858
|
+
anchorBlockHeader,
|
|
859
|
+
scopes,
|
|
860
|
+
jobId,
|
|
861
|
+
);
|
|
842
862
|
|
|
843
863
|
const { executionSteps, timings: { proving } = {} } = await this.#prove(
|
|
844
864
|
txRequest,
|
|
845
865
|
this.proofCreator,
|
|
846
866
|
privateExecutionResult,
|
|
867
|
+
anchorBlockHeader,
|
|
847
868
|
{
|
|
848
869
|
simulate: skipProofGeneration,
|
|
849
870
|
skipFeeEnforcement: false,
|
|
@@ -933,6 +954,7 @@ export class PXE {
|
|
|
933
954
|
);
|
|
934
955
|
const syncTimer = new Timer();
|
|
935
956
|
await this.blockStateSynchronizer.sync();
|
|
957
|
+
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
936
958
|
const syncTime = syncTimer.ms();
|
|
937
959
|
|
|
938
960
|
const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
|
|
@@ -952,7 +974,13 @@ export class PXE {
|
|
|
952
974
|
}
|
|
953
975
|
|
|
954
976
|
// Execution of private functions only; no proving, and no kernel logic.
|
|
955
|
-
const privateExecutionResult = await this.#executePrivate(
|
|
977
|
+
const privateExecutionResult = await this.#executePrivate(
|
|
978
|
+
contractFunctionSimulator,
|
|
979
|
+
txRequest,
|
|
980
|
+
anchorBlockHeader,
|
|
981
|
+
scopes,
|
|
982
|
+
jobId,
|
|
983
|
+
);
|
|
956
984
|
|
|
957
985
|
let publicInputs: PrivateKernelTailCircuitPublicInputs | undefined;
|
|
958
986
|
let executionSteps: PrivateExecutionStep[] = [];
|
|
@@ -965,11 +993,17 @@ export class PXE {
|
|
|
965
993
|
));
|
|
966
994
|
} else {
|
|
967
995
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
968
|
-
({ publicInputs, executionSteps } = await this.#prove(
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
996
|
+
({ publicInputs, executionSteps } = await this.#prove(
|
|
997
|
+
txRequest,
|
|
998
|
+
this.proofCreator,
|
|
999
|
+
privateExecutionResult,
|
|
1000
|
+
anchorBlockHeader,
|
|
1001
|
+
{
|
|
1002
|
+
simulate: true,
|
|
1003
|
+
skipFeeEnforcement,
|
|
1004
|
+
profileMode: 'none',
|
|
1005
|
+
},
|
|
1006
|
+
));
|
|
973
1007
|
}
|
|
974
1008
|
|
|
975
1009
|
const privateSimulationResult = new PrivateSimulationResult(privateExecutionResult, publicInputs);
|
|
@@ -1043,7 +1077,7 @@ export class PXE {
|
|
|
1043
1077
|
inspect(txRequest),
|
|
1044
1078
|
`simulatePublic=${simulatePublic}`,
|
|
1045
1079
|
`skipTxValidation=${skipTxValidation}`,
|
|
1046
|
-
`scopes=${scopes
|
|
1080
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1047
1081
|
);
|
|
1048
1082
|
}
|
|
1049
1083
|
});
|
|
@@ -1055,7 +1089,7 @@ export class PXE {
|
|
|
1055
1089
|
*/
|
|
1056
1090
|
public executeUtility(
|
|
1057
1091
|
call: FunctionCall,
|
|
1058
|
-
{ authwits, scopes }: ExecuteUtilityOpts = { scopes:
|
|
1092
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
|
|
1059
1093
|
): Promise<UtilityExecutionResult> {
|
|
1060
1094
|
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1061
1095
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -1113,7 +1147,7 @@ export class PXE {
|
|
|
1113
1147
|
throw this.#contextualizeError(
|
|
1114
1148
|
err,
|
|
1115
1149
|
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1116
|
-
`scopes=${scopes
|
|
1150
|
+
`scopes=${scopes.map(s => s.toString()).join(', ')}`,
|
|
1117
1151
|
);
|
|
1118
1152
|
}
|
|
1119
1153
|
});
|
|
@@ -1172,6 +1206,7 @@ export class PXE {
|
|
|
1172
1206
|
*/
|
|
1173
1207
|
public async stop(): Promise<void> {
|
|
1174
1208
|
await this.jobQueue.end();
|
|
1209
|
+
await this.blockStateSynchronizer.stop();
|
|
1175
1210
|
await this.db.close();
|
|
1176
1211
|
}
|
|
1177
1212
|
}
|
|
@@ -23,7 +23,7 @@ export class AnchorBlockStore {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async getBlockHeader(): Promise<BlockHeader> {
|
|
26
|
-
const headerBuffer = await this.#synchronizedHeader.getAsync();
|
|
26
|
+
const headerBuffer = await this.#store.transactionAsync(() => this.#synchronizedHeader.getAsync());
|
|
27
27
|
if (!headerBuffer) {
|
|
28
28
|
throw new Error(`Trying to get block header with a not-yet-synchronized PXE - this should never happen`);
|
|
29
29
|
}
|
|
@@ -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
|
}
|
|
@@ -148,7 +148,17 @@ export class CapsuleStore implements StagedStore {
|
|
|
148
148
|
* @param slot - The slot in the database to read.
|
|
149
149
|
* @returns The stored data or `null` if no data is stored under the slot.
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
getCapsule(contractAddress: AztecAddress, slot: Fr, jobId: string, scope: AztecAddress): Promise<Fr[] | null> {
|
|
152
|
+
return this.#store.transactionAsync(() => this.#getCapsuleInternal(contractAddress, slot, jobId, scope));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Same as getCapsule but without its own transaction, for use inside an existing transactionAsync. */
|
|
156
|
+
async #getCapsuleInternal(
|
|
157
|
+
contractAddress: AztecAddress,
|
|
158
|
+
slot: Fr,
|
|
159
|
+
jobId: string,
|
|
160
|
+
scope: AztecAddress,
|
|
161
|
+
): Promise<Fr[] | null> {
|
|
152
162
|
const dataBuffer = await this.#getFromStage(jobId, dbSlotToKey(contractAddress, slot, scope));
|
|
153
163
|
if (!dataBuffer) {
|
|
154
164
|
this.logger.trace(`Data not found for contract ${contractAddress.toString()} and slot ${slot.toString()}`);
|
|
@@ -240,7 +250,7 @@ export class CapsuleStore implements StagedStore {
|
|
|
240
250
|
// and not using a transaction here would heavily impact performance.
|
|
241
251
|
return this.#store.transactionAsync(async () => {
|
|
242
252
|
// Load current length, defaulting to 0 if not found
|
|
243
|
-
const lengthData = await this
|
|
253
|
+
const lengthData = await this.#getCapsuleInternal(contractAddress, baseSlot, jobId, scope);
|
|
244
254
|
const currentLength = lengthData ? lengthData[0].toNumber() : 0;
|
|
245
255
|
|
|
246
256
|
// Store each capsule at consecutive slots after baseSlot + 1 + currentLength
|
|
@@ -263,14 +273,14 @@ export class CapsuleStore implements StagedStore {
|
|
|
263
273
|
// of jobs: different calls running concurrently on the same contract may cause trouble.
|
|
264
274
|
return this.#store.transactionAsync(async () => {
|
|
265
275
|
// Load length, defaulting to 0 if not found
|
|
266
|
-
const maybeLength = await this
|
|
276
|
+
const maybeLength = await this.#getCapsuleInternal(contractAddress, baseSlot, jobId, scope);
|
|
267
277
|
const length = maybeLength ? maybeLength[0].toBigInt() : 0n;
|
|
268
278
|
|
|
269
279
|
const values: Fr[][] = [];
|
|
270
280
|
|
|
271
281
|
// Read each capsule at consecutive slots after baseSlot
|
|
272
282
|
for (let i = 0; i < length; i++) {
|
|
273
|
-
const currentValue = await this
|
|
283
|
+
const currentValue = await this.#getCapsuleInternal(contractAddress, arraySlot(baseSlot, i), jobId, scope);
|
|
274
284
|
if (currentValue == undefined) {
|
|
275
285
|
throw new Error(
|
|
276
286
|
`Expected non-empty value at capsule array in base slot ${baseSlot} at index ${i} for contract ${contractAddress}`,
|
|
@@ -295,7 +305,7 @@ export class CapsuleStore implements StagedStore {
|
|
|
295
305
|
// of jobs: different calls running concurrently on the same contract may cause trouble.
|
|
296
306
|
return this.#store.transactionAsync(async () => {
|
|
297
307
|
// Load current length, defaulting to 0 if not found
|
|
298
|
-
const maybeLength = await this
|
|
308
|
+
const maybeLength = await this.#getCapsuleInternal(contractAddress, baseSlot, jobId, scope);
|
|
299
309
|
const originalLength = maybeLength ? maybeLength[0].toNumber() : 0;
|
|
300
310
|
|
|
301
311
|
// Set the new length
|
|
@@ -168,12 +168,14 @@ export class ContractStore {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
async addContractInstance(contract: ContractInstanceWithAddress): Promise<void> {
|
|
171
|
-
this.#
|
|
171
|
+
await this.#store.transactionAsync(async () => {
|
|
172
|
+
await this.#contractInstances.set(
|
|
173
|
+
contract.address.toString(),
|
|
174
|
+
new SerializableContractInstance(contract).toBuffer(),
|
|
175
|
+
);
|
|
176
|
+
});
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
contract.address.toString(),
|
|
175
|
-
new SerializableContractInstance(contract).toBuffer(),
|
|
176
|
-
);
|
|
178
|
+
this.#contractClassIdMap.set(contract.address.toString(), contract.currentContractClassId);
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
// Private getters
|
|
@@ -246,7 +248,7 @@ export class ContractStore {
|
|
|
246
248
|
contractClassId: Fr,
|
|
247
249
|
): Promise<(ContractClassWithId & ContractClassIdPreimage) | undefined> {
|
|
248
250
|
const key = contractClassId.toString();
|
|
249
|
-
const buf = await this.#contractClassData.getAsync(key);
|
|
251
|
+
const buf = await this.#store.transactionAsync(() => this.#contractClassData.getAsync(key));
|
|
250
252
|
if (!buf) {
|
|
251
253
|
return undefined;
|
|
252
254
|
}
|
|
@@ -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
|
|
|
@@ -234,6 +234,10 @@ export class PrivateEventStore implements StagedStore {
|
|
|
234
234
|
* IMPORTANT: This method must be called within a transaction to ensure atomicity.
|
|
235
235
|
*/
|
|
236
236
|
public async rollback(blockNumber: number, synchedBlockNumber: number): Promise<void> {
|
|
237
|
+
if (this.#eventsForJob.size > 0) {
|
|
238
|
+
throw new Error('PXE private event store rollback is not allowed while jobs are running');
|
|
239
|
+
}
|
|
240
|
+
|
|
237
241
|
// First pass: collect all event IDs for all blocks, starting reads during iteration to keep tx alive.
|
|
238
242
|
const eventsByBlock: Map<number, { eventId: string; eventReadPromise: Promise<Buffer | undefined> }[]> = new Map();
|
|
239
243
|
|
|
@@ -49,7 +49,7 @@ export class StoredPrivateEvent {
|
|
|
49
49
|
const msgContentLength = reader.readNumber();
|
|
50
50
|
const msgContent = reader.readArray(msgContentLength, Fr);
|
|
51
51
|
const l2BlockNumber = reader.readNumber();
|
|
52
|
-
const l2BlockHash =
|
|
52
|
+
const l2BlockHash = BlockHash.fromBuffer(reader);
|
|
53
53
|
const txHash = TxHash.fromBuffer(reader);
|
|
54
54
|
const txIndexInBlock = reader.readNumber();
|
|
55
55
|
const eventIndexInTx = reader.readNumber();
|
|
@@ -21,6 +21,8 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
21
21
|
taggingStore: RecipientTaggingStore,
|
|
22
22
|
anchorBlockNumber: BlockNumber,
|
|
23
23
|
anchorBlockHash: BlockHash,
|
|
24
|
+
currentTimestamp: bigint,
|
|
25
|
+
finalizedBlockNumber: BlockNumber,
|
|
24
26
|
jobId: string,
|
|
25
27
|
): Promise<TxScopedL2Log[]> {
|
|
26
28
|
// # Explanation of how the algorithm works
|
|
@@ -61,20 +63,6 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
61
63
|
// the highest finalized index. If that index was already used, they will throw an error. For this reason we
|
|
62
64
|
// don't have to look further than `highestFinalizedIndex + WINDOW_LEN`.
|
|
63
65
|
|
|
64
|
-
let finalizedBlockNumber: number, currentTimestamp: bigint;
|
|
65
|
-
{
|
|
66
|
-
const [l2Tips, latestBlockHeader] = await Promise.all([aztecNode.getL2Tips(), aztecNode.getBlockHeader('latest')]);
|
|
67
|
-
|
|
68
|
-
if (!latestBlockHeader) {
|
|
69
|
-
throw new Error('Node failed to return latest block header when syncing logs');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
[finalizedBlockNumber, currentTimestamp] = [
|
|
73
|
-
l2Tips.finalized.block.number,
|
|
74
|
-
latestBlockHeader.globalVariables.timestamp,
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
66
|
let start: number, end: number;
|
|
79
67
|
{
|
|
80
68
|
const currentHighestAgedIndex = await taggingStore.getHighestAgedIndex(secret, jobId);
|
|
@@ -125,7 +113,9 @@ export async function loadPrivateLogsForSenderRecipientPair(
|
|
|
125
113
|
|
|
126
114
|
if (highestAgedIndex !== undefined && highestAgedIndex > highestFinalizedIndex) {
|
|
127
115
|
// This is just a sanity check as this should never happen.
|
|
128
|
-
throw new Error(
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Highest aged index (${highestAgedIndex}) must not exceed highest finalized index (${highestFinalizedIndex})`,
|
|
118
|
+
);
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
await taggingStore.updateHighestFinalizedIndex(secret, highestFinalizedIndex, jobId);
|
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[];
|