@aztec/pxe 0.84.0 → 0.85.0
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/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +4 -5
- package/dest/config/package_info.js +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +1 -0
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +5 -2
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +2 -2
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/pxe_oracle_interface/pxe_oracle_interface.js +14 -10
- package/dest/pxe_service/pxe_service.d.ts +3 -3
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +19 -17
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +3 -3
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +3 -2
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts.map +1 -1
- package/dest/storage/private_event_data_provider/private_event_data_provider.js +18 -12
- package/dest/synchronizer/synchronizer.d.ts +2 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +4 -1
- package/package.json +16 -16
- package/src/config/index.ts +6 -7
- package/src/config/package_info.ts +1 -1
- package/src/entrypoints/client/bundle/utils.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +1 -0
- package/src/entrypoints/server/utils.ts +4 -1
- package/src/pxe_oracle_interface/pxe_oracle_interface.ts +22 -10
- package/src/pxe_service/pxe_service.ts +3 -3
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +21 -19
- package/src/storage/note_data_provider/note_data_provider.ts +3 -5
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +29 -13
- package/src/synchronizer/synchronizer.ts +6 -3
package/dest/config/index.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export interface KernelProverConfig {
|
|
|
22
22
|
* Configuration settings for the PXE.
|
|
23
23
|
*/
|
|
24
24
|
export interface PXEConfig {
|
|
25
|
-
/**
|
|
26
|
-
|
|
25
|
+
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
26
|
+
l2BlockBatchSize: number;
|
|
27
27
|
}
|
|
28
28
|
export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig;
|
|
29
29
|
export type CliPXEOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,yFAAyF;IACzF,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,eAAe,GAAG,WAAW,CAAC;AAE/G,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,gBAAgB,CA0BlE,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,CAclE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,kBAAkB,CAAC,aAAa,GAAG,gBAAgB,CAWrF,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,gBAAgB,CAQnE"}
|
package/dest/config/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
1
|
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, parseBooleanEnv } from '@aztec/foundation/config';
|
|
3
2
|
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
3
|
import { chainConfigMappings } from '@aztec/stdlib/config';
|
|
@@ -6,10 +5,10 @@ export { getPackageInfo } from './package_info.js';
|
|
|
6
5
|
export const pxeConfigMappings = {
|
|
7
6
|
...dataConfigMappings,
|
|
8
7
|
...chainConfigMappings,
|
|
9
|
-
|
|
10
|
-
env: '
|
|
11
|
-
...numberConfigHelper(
|
|
12
|
-
description: '
|
|
8
|
+
l2BlockBatchSize: {
|
|
9
|
+
env: 'PXE_L2_BLOCK_BATCH_SIZE',
|
|
10
|
+
...numberConfigHelper(200),
|
|
11
|
+
description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing'
|
|
13
12
|
},
|
|
14
13
|
bbBinaryPath: {
|
|
15
14
|
env: 'BB_BINARY_PATH',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/bundle/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBAkC9C"}
|
|
@@ -19,7 +19,8 @@ import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
|
19
19
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
20
20
|
const configWithContracts = {
|
|
21
21
|
...config,
|
|
22
|
-
l1Contracts
|
|
22
|
+
l1Contracts,
|
|
23
|
+
l2BlockBatchSize: 200
|
|
23
24
|
};
|
|
24
25
|
const store = await createStore('pxe_data', configWithContracts, options.loggers.store ?? createLogger('pxe:data:indexeddb'));
|
|
25
26
|
const simulationProvider = new WASMSimulator();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/entrypoints/client/lazy/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,kBAAoC,uBA8B9C"}
|
|
@@ -18,6 +18,7 @@ import { PXEService } from '../../../pxe_service/pxe_service.js';
|
|
|
18
18
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
19
19
|
const configWithContracts = {
|
|
20
20
|
...config,
|
|
21
|
+
l2BlockBatchSize: 200,
|
|
21
22
|
l1Contracts
|
|
22
23
|
};
|
|
23
24
|
const store = await createStore('pxe_data', configWithContracts, options.loggers.store ?? createLogger('pxe:data:indexeddb'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/server/utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,yBAAyB,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAG9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,uBAKvD;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAC1D,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,MAAM,EAAE,gBAAgB,EACxB,YAAY,GAAE,MAAM,GAAG,OAAO,GAAG,SAAqB,uBA+BvD"}
|
|
@@ -5,6 +5,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
6
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
7
7
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
8
|
+
import { SimulationProviderRecorderWrapper } from '@aztec/simulator/testing';
|
|
8
9
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
9
10
|
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
10
11
|
/**
|
|
@@ -16,7 +17,8 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
|
16
17
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
17
18
|
*/ export function createPXEService(aztecNode, config, useLogSuffix = undefined) {
|
|
18
19
|
const simulationProvider = new WASMSimulator();
|
|
19
|
-
|
|
20
|
+
const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider);
|
|
21
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, useLogSuffix);
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
@@ -31,7 +33,8 @@ import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
|
31
33
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
32
34
|
const configWithContracts = {
|
|
33
35
|
...config,
|
|
34
|
-
l1Contracts
|
|
36
|
+
l1Contracts,
|
|
37
|
+
l2BlockBatchSize: 200
|
|
35
38
|
};
|
|
36
39
|
const store = await createStore('pxe_data', PXE_DATA_SCHEMA_VERSION, configWithContracts, createLogger('pxe:data:lmdb'));
|
|
37
40
|
const prover = await createProver(config, simulationProvider, logSuffix);
|
|
@@ -133,7 +133,7 @@ export declare class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
133
133
|
* synced.
|
|
134
134
|
*/
|
|
135
135
|
syncTaggedLogs(contractAddress: AztecAddress, pendingTaggedLogArrayBaseSlot: Fr, scopes?: AztecAddress[]): Promise<void>;
|
|
136
|
-
deliverNote(contractAddress: AztecAddress, storageSlot: Fr, nonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash:
|
|
136
|
+
deliverNote(contractAddress: AztecAddress, storageSlot: Fr, nonce: Fr, content: Fr[], noteHash: Fr, nullifier: Fr, txHash: TxHash, recipient: AztecAddress): Promise<void>;
|
|
137
137
|
getLogByTag(tag: Fr): Promise<LogWithTxData | null>;
|
|
138
138
|
removeNullifiedNotes(contractAddress: AztecAddress): Promise<void>;
|
|
139
139
|
storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void>;
|
|
@@ -141,6 +141,6 @@ export declare class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
141
141
|
deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void>;
|
|
142
142
|
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void>;
|
|
143
143
|
getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point>;
|
|
144
|
-
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector,
|
|
144
|
+
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector, msgContent: Fr[], txHash: TxHash, logIndexInTx: number, txIndexInBlock: number): Promise<void>;
|
|
145
145
|
}
|
|
146
146
|
//# sourceMappingURL=pxe_oracle_interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_oracle_interface.d.ts","sourceRoot":"","sources":["../../src/pxe_oracle_interface/pxe_oracle_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EACL,aAAa,EACb,KAAK,gCAAgC,EACrC,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,O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cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;CAuBjB"}
|
|
@@ -9,7 +9,6 @@ import { IndexedTaggingSecret, LogWithTxData, PendingTaggedLog, deriveEcdhShared
|
|
|
9
9
|
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
10
10
|
import { Note } from '@aztec/stdlib/note';
|
|
11
11
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
12
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
13
12
|
import { NoteDao } from '../storage/note_data_provider/note_dao.js';
|
|
14
13
|
import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndexesMap } from './tagging_utils.js';
|
|
15
14
|
/**
|
|
@@ -434,7 +433,7 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
|
|
|
434
433
|
if (!txEffect) {
|
|
435
434
|
throw new Error(`Could not find tx effect for tx hash ${scopedLog.txHash}`);
|
|
436
435
|
}
|
|
437
|
-
const pendingTaggedLog = new PendingTaggedLog(scopedLog.log.toFields(), scopedLog.txHash
|
|
436
|
+
const pendingTaggedLog = new PendingTaggedLog(scopedLog.log.toFields(), scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0], recipient, scopedLog.logIndexInTx, txEffect.txIndexInBlock);
|
|
438
437
|
return pendingTaggedLog.toFields();
|
|
439
438
|
}));
|
|
440
439
|
return this.capsuleDataProvider.appendToCapsuleArray(contractAddress, capsuleArrayBaseSlot, pendingTaggedLogs);
|
|
@@ -469,7 +468,7 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
|
|
|
469
468
|
if (uniqueNoteHashTreeIndexInBlock === undefined) {
|
|
470
469
|
throw new Error(`Note hash ${noteHash} (uniqued as ${uniqueNoteHash}) is not present on the tree at block ${syncedBlockNumber} (from tx ${txHash})`);
|
|
471
470
|
}
|
|
472
|
-
const noteDao = new NoteDao(new Note(content), contractAddress, storageSlot, nonce, noteHash, siloedNullifier,
|
|
471
|
+
const noteDao = new NoteDao(new Note(content), contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, uniqueNoteHashTreeIndexInBlock?.l2BlockNumber, uniqueNoteHashTreeIndexInBlock?.l2BlockHash, uniqueNoteHashTreeIndexInBlock?.data, recipient);
|
|
473
472
|
await this.noteDataProvider.addNotes([
|
|
474
473
|
noteDao
|
|
475
474
|
], recipient);
|
|
@@ -524,22 +523,27 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
|
|
|
524
523
|
// end).
|
|
525
524
|
// TODO(#11636): use the actual log length.
|
|
526
525
|
const trimmedLog = scopedLog.log.toFields().filter((x)=>!x.isZero());
|
|
527
|
-
return new LogWithTxData(trimmedLog, scopedLog.txHash
|
|
526
|
+
return new LogWithTxData(trimmedLog, scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
|
|
528
527
|
}
|
|
529
|
-
// TODO(#12553): nuke this as part of tackling that issue. This function is no longer unit tested as I had to remove
|
|
530
|
-
// it from pxe_oracle_interface.test.ts when moving decryption to Noir (at that point we could not get a hold of
|
|
531
|
-
// the decrypted note in the test as TS decryption no longer existed).
|
|
532
528
|
async removeNullifiedNotes(contractAddress) {
|
|
533
529
|
this.log.verbose('Searching for nullifiers of known notes', {
|
|
534
530
|
contract: contractAddress
|
|
535
531
|
});
|
|
532
|
+
// We avoid making node queries at 'latest' since we mark notes as nullified only if the corresponding nullifier
|
|
533
|
+
// has been included in a block up to which PXE has synced. Note that while this technically results in historical
|
|
534
|
+
// queries, we perform it at the latest locally synced block number which *should* be recent enough to be
|
|
535
|
+
// available, even for non-archive nodes.
|
|
536
|
+
const syncedBlockNumber = await this.syncDataProvider.getBlockNumber();
|
|
536
537
|
for (const recipient of (await this.keyStore.getAccounts())){
|
|
537
538
|
const currentNotesForRecipient = await this.noteDataProvider.getNotes({
|
|
538
539
|
contractAddress,
|
|
539
540
|
recipient
|
|
540
541
|
});
|
|
542
|
+
if (currentNotesForRecipient.length === 0) {
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
541
545
|
const nullifiersToCheck = currentNotesForRecipient.map((note)=>note.siloedNullifier);
|
|
542
|
-
const nullifierIndexes = await this.aztecNode.findLeavesIndexes(
|
|
546
|
+
const nullifierIndexes = await this.aztecNode.findLeavesIndexes(syncedBlockNumber, MerkleTreeId.NULLIFIER_TREE, nullifiersToCheck);
|
|
543
547
|
const foundNullifiers = nullifiersToCheck.map((nullifier, i)=>{
|
|
544
548
|
if (nullifierIndexes[i] !== undefined) {
|
|
545
549
|
return {
|
|
@@ -579,7 +583,7 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
|
|
|
579
583
|
const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
|
|
580
584
|
return deriveEcdhSharedSecret(addressSecret, ephPk);
|
|
581
585
|
}
|
|
582
|
-
async storePrivateEventLog(contractAddress, recipient, eventSelector,
|
|
586
|
+
async storePrivateEventLog(contractAddress, recipient, eventSelector, msgContent, txHash, logIndexInTx, txIndexInBlock) {
|
|
583
587
|
const txReceipt = await this.aztecNode.getTxReceipt(txHash);
|
|
584
588
|
const blockNumber = txReceipt.blockNumber;
|
|
585
589
|
if (blockNumber === undefined) {
|
|
@@ -589,6 +593,6 @@ import { WINDOW_HALF_SIZE, getIndexedTaggingSecretsForTheWindow, getInitialIndex
|
|
|
589
593
|
if (blockNumber > historicalBlockNumber) {
|
|
590
594
|
throw new Error(`Attempting to store private event log from a block newer than the historical block of the simulation. Log block number: ${blockNumber}, historical block number: ${historicalBlockNumber}`);
|
|
591
595
|
}
|
|
592
|
-
return this.privateEventDataProvider.storePrivateEventLog(contractAddress, recipient, eventSelector,
|
|
596
|
+
return this.privateEventDataProvider.storePrivateEventLog(contractAddress, recipient, eventSelector, msgContent, txHash, logIndexInTx, txIndexInBlock, blockNumber);
|
|
593
597
|
}
|
|
594
598
|
}
|
|
@@ -8,13 +8,13 @@ import { type SimulationProvider } from '@aztec/simulator/client';
|
|
|
8
8
|
import { type AbiDecoded, type ContractArtifact } from '@aztec/stdlib/abi';
|
|
9
9
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
10
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
|
-
import type {
|
|
11
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
12
12
|
import { CompleteAddress, type ContractClassWithId, type ContractInstanceWithAddress, type NodeInfo, type PartialAddress } from '@aztec/stdlib/contract';
|
|
13
13
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
14
14
|
import type { AztecNode, EventMetadataDefinition, GetContractClassLogsResponse, GetPublicLogsResponse, PXE, PXEInfo, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
15
15
|
import type { LogFilter } from '@aztec/stdlib/logs';
|
|
16
16
|
import { type NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
17
|
-
import { PrivateExecutionResult, Tx,
|
|
17
|
+
import { type IndexedTxEffect, PrivateExecutionResult, Tx, TxExecutionRequest, type TxHash, TxProfileResult, TxProvingResult, type TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
18
18
|
import type { PXEServiceConfig } from '../config/index.js';
|
|
19
19
|
/**
|
|
20
20
|
* A Private eXecution Environment (PXE) implementation.
|
|
@@ -50,7 +50,7 @@ export declare class PXEService implements PXE {
|
|
|
50
50
|
isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
51
51
|
getL2ToL1MembershipWitness(blockNumber: number, l2Tol1Message: Fr): Promise<[bigint, SiblingPath<number>]>;
|
|
52
52
|
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
53
|
-
getTxEffect(txHash: TxHash): Promise<
|
|
53
|
+
getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined>;
|
|
54
54
|
getBlockNumber(): Promise<number>;
|
|
55
55
|
getProvenBlockNumber(): Promise<number>;
|
|
56
56
|
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_service.d.ts","sourceRoot":"","sources":["../../src/pxe_service/pxe_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAiB,KAAK,kBAAkB,EAAsB,MAAM,yBAAyB,CAAC;AACrG,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EAQtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pxe_service.d.ts","sourceRoot":"","sources":["../../src/pxe_service/pxe_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAEL,KAAK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MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC;IAuBT,eAAe,CAAC,CAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IA6BxG,iBAAiB;CAGxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capsule_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_data_provider/capsule_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,mBAAoB,YAAW,YAAY;;IAMtD,MAAM,EAAE,MAAM,CAAC;gBAEH,KAAK,EAAE,iBAAiB;IAQ9B,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInF,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IAa1E,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"capsule_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/capsule_data_provider/capsule_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,mBAAoB,YAAW,YAAY;;IAMtD,MAAM,EAAE,MAAM,CAAC;gBAEH,KAAK,EAAE,iBAAiB;IAQ9B,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInF,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IAa1E,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BvG;;;;;;;OAOG;IACH,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrF,OAAO;CAMrB"}
|
|
@@ -29,24 +29,26 @@ export class CapsuleDataProvider {
|
|
|
29
29
|
async deleteCapsule(contractAddress, slot) {
|
|
30
30
|
await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const i of indexes){
|
|
42
|
-
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
43
|
-
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
44
|
-
const toCopy = await this.#capsules.getAsync(currentSrcSlot);
|
|
45
|
-
if (!toCopy) {
|
|
46
|
-
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
32
|
+
copyCapsule(contractAddress, srcSlot, dstSlot, numEntries) {
|
|
33
|
+
return this.#store.transactionAsync(async ()=>{
|
|
34
|
+
// In order to support overlapping source and destination regions, we need to check the relative positions of source
|
|
35
|
+
// and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
|
|
36
|
+
// indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
|
|
37
|
+
// indexes to avoid reading elements that've been overwritten.
|
|
38
|
+
const indexes = Array.from(Array(numEntries).keys());
|
|
39
|
+
if (srcSlot.lt(dstSlot)) {
|
|
40
|
+
indexes.reverse();
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
for (const i of indexes){
|
|
43
|
+
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
44
|
+
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
45
|
+
const toCopy = await this.#capsules.getAsync(currentSrcSlot);
|
|
46
|
+
if (!toCopy) {
|
|
47
|
+
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
48
|
+
}
|
|
49
|
+
await this.#capsules.set(currentDstSlot, toCopy);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Appends multiple capsules to a capsule array stored at the base slot.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":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AE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,gBAAiB,YAAW,YAAY;;IAsBnD,OAAO;WAsBa,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAWlE,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBtD,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,GAAE,YAAgC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjF,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB9C,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkD3F,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAgGvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA2DtF,OAAO;CAGd"}
|
|
@@ -204,16 +204,16 @@ export class NoteDataProvider {
|
|
|
204
204
|
const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
|
|
205
205
|
const noteIndex = await this.#nullifierToNoteId.getAsync(nullifier.toString());
|
|
206
206
|
if (!noteIndex) {
|
|
207
|
-
|
|
207
|
+
throw new Error('Nullifier not found in removeNullifiedNotes');
|
|
208
208
|
}
|
|
209
209
|
const noteBuffer = noteIndex ? await this.#notes.getAsync(noteIndex) : undefined;
|
|
210
210
|
if (!noteBuffer) {
|
|
211
|
-
|
|
211
|
+
throw new Error('Note not found in removeNullifiedNotes');
|
|
212
212
|
}
|
|
213
213
|
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex)) ?? [];
|
|
214
214
|
const note = NoteDao.fromBuffer(noteBuffer);
|
|
215
215
|
if (!note.recipient.equals(recipient)) {
|
|
216
|
-
|
|
216
|
+
throw new Error("Tried to nullify someone else's note");
|
|
217
217
|
}
|
|
218
218
|
nullifiedNotes.push(note);
|
|
219
219
|
await this.#notes.delete(noteIndex);
|
|
@@ -16,12 +16,13 @@ export declare class PrivateEventDataProvider implements DataProvider {
|
|
|
16
16
|
* @param contractAddress - The address of the contract that emitted the event.
|
|
17
17
|
* @param recipient - The recipient of the event.
|
|
18
18
|
* @param eventSelector - The event selector of the event.
|
|
19
|
-
* @param
|
|
19
|
+
* @param msgContent - The content of the event.
|
|
20
20
|
* @param txHash - The transaction hash of the event log.
|
|
21
21
|
* @param logIndexInTx - The index of the log within the transaction.
|
|
22
|
+
* @param txIndexInBlock - The index of the transaction in which the log was emitted in the block.
|
|
22
23
|
* @param blockNumber - The block number in which the event was emitted.
|
|
23
24
|
*/
|
|
24
|
-
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector,
|
|
25
|
+
storePrivateEventLog(contractAddress: AztecAddress, recipient: AztecAddress, eventSelector: EventSelector, msgContent: Fr[], txHash: TxHash, logIndexInTx: number, txIndexInBlock: number, blockNumber: number): Promise<void>;
|
|
25
26
|
/**
|
|
26
27
|
* Returns the private events given search parameters.
|
|
27
28
|
* @param contractAddress - The address of the contract to get events from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_event_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_data_provider/private_event_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"private_event_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/private_event_data_provider/private_event_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,KAAK,EAAmB,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASxD;;GAEG;AACH,qBAAa,wBAAyB,YAAW,YAAY;;IAY3D,MAAM,yCAA+C;gBAEzC,KAAK,EAAE,iBAAiB;IAOpC;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,eAAe,EAAE,YAAY,EAC7B,SAAS,EAAE,YAAY,EACvB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAgChB;;;;;;;;OAQG;IACU,gBAAgB,CAC3B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;IAyClB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAG3B"}
|
|
@@ -23,11 +23,12 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
23
23
|
* @param contractAddress - The address of the contract that emitted the event.
|
|
24
24
|
* @param recipient - The recipient of the event.
|
|
25
25
|
* @param eventSelector - The event selector of the event.
|
|
26
|
-
* @param
|
|
26
|
+
* @param msgContent - The content of the event.
|
|
27
27
|
* @param txHash - The transaction hash of the event log.
|
|
28
28
|
* @param logIndexInTx - The index of the log within the transaction.
|
|
29
|
+
* @param txIndexInBlock - The index of the transaction in which the log was emitted in the block.
|
|
29
30
|
* @param blockNumber - The block number in which the event was emitted.
|
|
30
|
-
*/ storePrivateEventLog(contractAddress, recipient, eventSelector,
|
|
31
|
+
*/ storePrivateEventLog(contractAddress, recipient, eventSelector, msgContent, txHash, logIndexInTx, txIndexInBlock, blockNumber) {
|
|
31
32
|
return this.#store.transactionAsync(async ()=>{
|
|
32
33
|
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
33
34
|
// We identify a unique log by its transaction hash and index within that transaction
|
|
@@ -44,14 +45,15 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
44
45
|
this.logger.verbose('storing private event log', {
|
|
45
46
|
contractAddress,
|
|
46
47
|
recipient,
|
|
47
|
-
|
|
48
|
+
msgContent,
|
|
48
49
|
blockNumber
|
|
49
50
|
});
|
|
50
51
|
const index = await this.#eventLogs.lengthAsync();
|
|
51
52
|
await this.#eventLogs.push({
|
|
52
|
-
|
|
53
|
+
msgContent: serializeToBuffer(msgContent),
|
|
53
54
|
blockNumber,
|
|
54
|
-
logIndexInTx
|
|
55
|
+
logIndexInTx,
|
|
56
|
+
txIndexInBlock
|
|
55
57
|
});
|
|
56
58
|
const existingIndices = await this.#eventLogIndex.getAsync(key) || [];
|
|
57
59
|
await this.#eventLogIndex.set(key, [
|
|
@@ -81,24 +83,28 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
81
83
|
continue;
|
|
82
84
|
}
|
|
83
85
|
// Convert buffer back to Fr array
|
|
84
|
-
const reader = BufferReader.asReader(entry.
|
|
85
|
-
const numFields = entry.
|
|
86
|
-
const
|
|
86
|
+
const reader = BufferReader.asReader(entry.msgContent);
|
|
87
|
+
const numFields = entry.msgContent.length / Fr.SIZE_IN_BYTES;
|
|
88
|
+
const msgContent = reader.readArray(numFields, Fr);
|
|
87
89
|
events.push({
|
|
88
|
-
|
|
90
|
+
msgContent,
|
|
89
91
|
blockNumber: entry.blockNumber,
|
|
90
|
-
logIndexInTx: entry.logIndexInTx
|
|
92
|
+
logIndexInTx: entry.logIndexInTx,
|
|
93
|
+
txIndexInBlock: entry.txIndexInBlock
|
|
91
94
|
});
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
|
-
// Sort by block number first, then by
|
|
97
|
+
// Sort by block number first, then by txIndexInBlock, then by logIndexInTx
|
|
95
98
|
events.sort((a, b)=>{
|
|
96
99
|
if (a.blockNumber !== b.blockNumber) {
|
|
97
100
|
return a.blockNumber - b.blockNumber;
|
|
98
101
|
}
|
|
102
|
+
if (a.txIndexInBlock !== b.txIndexInBlock) {
|
|
103
|
+
return a.txIndexInBlock - b.txIndexInBlock;
|
|
104
|
+
}
|
|
99
105
|
return a.logIndexInTx - b.logIndexInTx;
|
|
100
106
|
});
|
|
101
|
-
return events.map((e)=>e.
|
|
107
|
+
return events.map((e)=>e.msgContent);
|
|
102
108
|
}
|
|
103
109
|
getSize() {
|
|
104
110
|
return this.#eventLogs.lengthAsync();
|
|
@@ -20,8 +20,8 @@ export declare class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
20
20
|
private log;
|
|
21
21
|
private isSyncing;
|
|
22
22
|
protected readonly blockStream: L2BlockStream;
|
|
23
|
-
constructor(node: AztecNode, syncDataProvider: SyncDataProvider, noteDataProvider: NoteDataProvider, taggingDataProvider: TaggingDataProvider, l2TipsStore: L2TipsKVStore, config?: Partial<Pick<PXEConfig, '
|
|
24
|
-
protected createBlockStream(config: Partial<Pick<PXEConfig, '
|
|
23
|
+
constructor(node: AztecNode, syncDataProvider: SyncDataProvider, noteDataProvider: NoteDataProvider, taggingDataProvider: TaggingDataProvider, l2TipsStore: L2TipsKVStore, config?: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>, loggerOrSuffix?: string | Logger);
|
|
24
|
+
protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>): L2BlockStream;
|
|
25
25
|
/** Handle events emitted by the block stream. */
|
|
26
26
|
handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
|
|
27
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synchronizer.d.ts","sourceRoot":"","sources":["../../src/synchronizer/synchronizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAErG;;;;GAIG;AACH,qBAAa,YAAa,YAAW,yBAAyB;IAM1D,OAAO,CAA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O,CAAC,SAAS,CAA4B;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;gBAGpC,IAAI,EAAE,SAAS,EACf,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,aAAa,EAClC,MAAM,GAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAM,EACzD,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM;IASlC,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAShF,iDAAiD;IACpC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC7E;;;OAGG;IACU,IAAI;YAiBH,MAAM;IAeb,qBAAqB;CAG7B"}
|
|
@@ -24,7 +24,10 @@ import { L2BlockStream } from '@aztec/stdlib/block';
|
|
|
24
24
|
}
|
|
25
25
|
createBlockStream(config) {
|
|
26
26
|
return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
|
|
27
|
-
|
|
27
|
+
batchSize: config.l2BlockBatchSize,
|
|
28
|
+
// Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
|
|
29
|
+
// in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
|
|
30
|
+
skipFinalized: true
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
33
|
/** Handle events emitted by the block stream. */ async handleBlockStreamEvent(event) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -59,21 +59,21 @@
|
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@aztec/bb-prover": "0.
|
|
63
|
-
"@aztec/bb.js": "0.
|
|
64
|
-
"@aztec/builder": "0.
|
|
65
|
-
"@aztec/constants": "0.
|
|
66
|
-
"@aztec/ethereum": "0.
|
|
67
|
-
"@aztec/foundation": "0.
|
|
68
|
-
"@aztec/key-store": "0.
|
|
69
|
-
"@aztec/kv-store": "0.
|
|
70
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
71
|
-
"@aztec/noir-types": "0.
|
|
72
|
-
"@aztec/protocol-contracts": "0.
|
|
73
|
-
"@aztec/simulator": "0.
|
|
74
|
-
"@aztec/stdlib": "0.
|
|
62
|
+
"@aztec/bb-prover": "0.85.0",
|
|
63
|
+
"@aztec/bb.js": "0.85.0",
|
|
64
|
+
"@aztec/builder": "0.85.0",
|
|
65
|
+
"@aztec/constants": "0.85.0",
|
|
66
|
+
"@aztec/ethereum": "0.85.0",
|
|
67
|
+
"@aztec/foundation": "0.85.0",
|
|
68
|
+
"@aztec/key-store": "0.85.0",
|
|
69
|
+
"@aztec/kv-store": "0.85.0",
|
|
70
|
+
"@aztec/noir-protocol-circuits-types": "0.85.0",
|
|
71
|
+
"@aztec/noir-types": "0.85.0",
|
|
72
|
+
"@aztec/protocol-contracts": "0.85.0",
|
|
73
|
+
"@aztec/simulator": "0.85.0",
|
|
74
|
+
"@aztec/stdlib": "0.85.0",
|
|
75
75
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
76
|
-
"koa": "^2.
|
|
76
|
+
"koa": "^2.16.1",
|
|
77
77
|
"koa-router": "^12.0.0",
|
|
78
78
|
"lodash.omit": "^4.5.0",
|
|
79
79
|
"sha3": "^2.1.4",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"viem": "2.23.7"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@aztec/noir-contracts.js": "0.
|
|
84
|
+
"@aztec/noir-contracts.js": "0.85.0",
|
|
85
85
|
"@jest/globals": "^29.5.0",
|
|
86
86
|
"@types/jest": "^29.5.0",
|
|
87
87
|
"@types/lodash.omit": "^4.5.7",
|
package/src/config/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
1
|
import {
|
|
3
2
|
type ConfigMappingsType,
|
|
4
3
|
booleanConfigHelper,
|
|
@@ -32,8 +31,8 @@ export interface KernelProverConfig {
|
|
|
32
31
|
* Configuration settings for the PXE.
|
|
33
32
|
*/
|
|
34
33
|
export interface PXEConfig {
|
|
35
|
-
/**
|
|
36
|
-
|
|
34
|
+
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
35
|
+
l2BlockBatchSize: number;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export type PXEServiceConfig = PXEConfig & KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig;
|
|
@@ -50,10 +49,10 @@ export type CliPXEOptions = {
|
|
|
50
49
|
export const pxeConfigMappings: ConfigMappingsType<PXEServiceConfig> = {
|
|
51
50
|
...dataConfigMappings,
|
|
52
51
|
...chainConfigMappings,
|
|
53
|
-
|
|
54
|
-
env: '
|
|
55
|
-
...numberConfigHelper(
|
|
56
|
-
description: '
|
|
52
|
+
l2BlockBatchSize: {
|
|
53
|
+
env: 'PXE_L2_BLOCK_BATCH_SIZE',
|
|
54
|
+
...numberConfigHelper(200),
|
|
55
|
+
description: 'Maximum amount of blocks to pull from the stream in one request when synchronizing',
|
|
57
56
|
},
|
|
58
57
|
bbBinaryPath: {
|
|
59
58
|
env: 'BB_BINARY_PATH',
|
|
@@ -5,6 +5,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
6
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
7
7
|
import { type SimulationProvider, WASMSimulator } from '@aztec/simulator/client';
|
|
8
|
+
import { SimulationProviderRecorderWrapper } from '@aztec/simulator/testing';
|
|
8
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
9
10
|
|
|
10
11
|
import type { PXEServiceConfig } from '../../config/index.js';
|
|
@@ -25,7 +26,8 @@ export function createPXEService(
|
|
|
25
26
|
useLogSuffix: string | boolean | undefined = undefined,
|
|
26
27
|
) {
|
|
27
28
|
const simulationProvider = new WASMSimulator();
|
|
28
|
-
|
|
29
|
+
const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider);
|
|
30
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProviderWithRecorder, config, useLogSuffix);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -50,6 +52,7 @@ export async function createPXEServiceWithSimulationProvider(
|
|
|
50
52
|
const configWithContracts = {
|
|
51
53
|
...config,
|
|
52
54
|
l1Contracts,
|
|
55
|
+
l2BlockBatchSize: 200,
|
|
53
56
|
} as PXEServiceConfig;
|
|
54
57
|
|
|
55
58
|
const store = await createStore(
|
|
@@ -598,11 +598,12 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
598
598
|
|
|
599
599
|
const pendingTaggedLog = new PendingTaggedLog(
|
|
600
600
|
scopedLog.log.toFields(),
|
|
601
|
-
scopedLog.txHash
|
|
601
|
+
scopedLog.txHash,
|
|
602
602
|
txEffect.data.noteHashes,
|
|
603
603
|
txEffect.data.nullifiers[0],
|
|
604
604
|
recipient,
|
|
605
605
|
scopedLog.logIndexInTx,
|
|
606
|
+
txEffect.txIndexInBlock,
|
|
606
607
|
);
|
|
607
608
|
|
|
608
609
|
return pendingTaggedLog.toFields();
|
|
@@ -619,7 +620,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
619
620
|
content: Fr[],
|
|
620
621
|
noteHash: Fr,
|
|
621
622
|
nullifier: Fr,
|
|
622
|
-
txHash:
|
|
623
|
+
txHash: TxHash,
|
|
623
624
|
recipient: AztecAddress,
|
|
624
625
|
): Promise<void> {
|
|
625
626
|
// We are going to store the new note in the NoteDataProvider, which will let us later return it via `getNotes`.
|
|
@@ -666,7 +667,7 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
666
667
|
nonce,
|
|
667
668
|
noteHash,
|
|
668
669
|
siloedNullifier,
|
|
669
|
-
|
|
670
|
+
txHash,
|
|
670
671
|
uniqueNoteHashTreeIndexInBlock?.l2BlockNumber,
|
|
671
672
|
uniqueNoteHashTreeIndexInBlock?.l2BlockHash,
|
|
672
673
|
uniqueNoteHashTreeIndexInBlock?.data,
|
|
@@ -729,20 +730,29 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
729
730
|
// TODO(#11636): use the actual log length.
|
|
730
731
|
const trimmedLog = scopedLog.log.toFields().filter(x => !x.isZero());
|
|
731
732
|
|
|
732
|
-
return new LogWithTxData(trimmedLog, scopedLog.txHash
|
|
733
|
+
return new LogWithTxData(trimmedLog, scopedLog.txHash, txEffect.data.noteHashes, txEffect.data.nullifiers[0]);
|
|
733
734
|
}
|
|
734
735
|
|
|
735
|
-
// TODO(#12553): nuke this as part of tackling that issue. This function is no longer unit tested as I had to remove
|
|
736
|
-
// it from pxe_oracle_interface.test.ts when moving decryption to Noir (at that point we could not get a hold of
|
|
737
|
-
// the decrypted note in the test as TS decryption no longer existed).
|
|
738
736
|
public async removeNullifiedNotes(contractAddress: AztecAddress) {
|
|
739
737
|
this.log.verbose('Searching for nullifiers of known notes', { contract: contractAddress });
|
|
740
738
|
|
|
739
|
+
// We avoid making node queries at 'latest' since we mark notes as nullified only if the corresponding nullifier
|
|
740
|
+
// has been included in a block up to which PXE has synced. Note that while this technically results in historical
|
|
741
|
+
// queries, we perform it at the latest locally synced block number which *should* be recent enough to be
|
|
742
|
+
// available, even for non-archive nodes.
|
|
743
|
+
const syncedBlockNumber = await this.syncDataProvider.getBlockNumber();
|
|
744
|
+
|
|
741
745
|
for (const recipient of await this.keyStore.getAccounts()) {
|
|
742
746
|
const currentNotesForRecipient = await this.noteDataProvider.getNotes({ contractAddress, recipient });
|
|
747
|
+
|
|
748
|
+
if (currentNotesForRecipient.length === 0) {
|
|
749
|
+
// Save a call to the node if there are no notes for the recipient
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
|
|
743
753
|
const nullifiersToCheck = currentNotesForRecipient.map(note => note.siloedNullifier);
|
|
744
754
|
const nullifierIndexes = await this.aztecNode.findLeavesIndexes(
|
|
745
|
-
|
|
755
|
+
syncedBlockNumber,
|
|
746
756
|
MerkleTreeId.NULLIFIER_TREE,
|
|
747
757
|
nullifiersToCheck,
|
|
748
758
|
);
|
|
@@ -796,9 +806,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
796
806
|
contractAddress: AztecAddress,
|
|
797
807
|
recipient: AztecAddress,
|
|
798
808
|
eventSelector: EventSelector,
|
|
799
|
-
|
|
809
|
+
msgContent: Fr[],
|
|
800
810
|
txHash: TxHash,
|
|
801
811
|
logIndexInTx: number,
|
|
812
|
+
txIndexInBlock: number,
|
|
802
813
|
): Promise<void> {
|
|
803
814
|
const txReceipt = await this.aztecNode.getTxReceipt(txHash);
|
|
804
815
|
const blockNumber = txReceipt.blockNumber;
|
|
@@ -815,9 +826,10 @@ export class PXEOracleInterface implements ExecutionDataProvider {
|
|
|
815
826
|
contractAddress,
|
|
816
827
|
recipient,
|
|
817
828
|
eventSelector,
|
|
818
|
-
|
|
829
|
+
msgContent,
|
|
819
830
|
txHash,
|
|
820
831
|
logIndexInTx,
|
|
832
|
+
txIndexInBlock,
|
|
821
833
|
blockNumber,
|
|
822
834
|
);
|
|
823
835
|
}
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '@aztec/stdlib/abi';
|
|
27
27
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
28
28
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
29
|
-
import type {
|
|
29
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
30
30
|
import {
|
|
31
31
|
CompleteAddress,
|
|
32
32
|
type ContractClassWithId,
|
|
@@ -54,11 +54,11 @@ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
|
54
54
|
import { type NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
55
55
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
56
56
|
import {
|
|
57
|
+
type IndexedTxEffect,
|
|
57
58
|
PrivateExecutionResult,
|
|
58
59
|
PrivateSimulationResult,
|
|
59
60
|
PublicSimulationOutput,
|
|
60
61
|
Tx,
|
|
61
|
-
type TxEffect,
|
|
62
62
|
TxExecutionRequest,
|
|
63
63
|
type TxHash,
|
|
64
64
|
TxProfileResult,
|
|
@@ -209,7 +209,7 @@ export class PXEService implements PXE {
|
|
|
209
209
|
return this.node.getTxReceipt(txHash);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
public getTxEffect(txHash: TxHash): Promise<
|
|
212
|
+
public getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined> {
|
|
213
213
|
return this.node.getTxEffect(txHash);
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -43,28 +43,30 @@ export class CapsuleDataProvider implements DataProvider {
|
|
|
43
43
|
await this.#capsules.delete(dbSlotToKey(contractAddress, slot));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void> {
|
|
47
|
+
return this.#store.transactionAsync(async () => {
|
|
48
|
+
// In order to support overlapping source and destination regions, we need to check the relative positions of source
|
|
49
|
+
// and destination. If destination is ahead of source, then by the time we overwrite source elements using forward
|
|
50
|
+
// indexes we'll have already read those. On the contrary, if source is ahead of destination we need to use backward
|
|
51
|
+
// indexes to avoid reading elements that've been overwritten.
|
|
52
|
+
|
|
53
|
+
const indexes = Array.from(Array(numEntries).keys());
|
|
54
|
+
if (srcSlot.lt(dstSlot)) {
|
|
55
|
+
indexes.reverse();
|
|
56
|
+
}
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
for (const i of indexes) {
|
|
59
|
+
const currentSrcSlot = dbSlotToKey(contractAddress, srcSlot.add(new Fr(i)));
|
|
60
|
+
const currentDstSlot = dbSlotToKey(contractAddress, dstSlot.add(new Fr(i)));
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const toCopy = await this.#capsules.getAsync(currentSrcSlot);
|
|
63
|
+
if (!toCopy) {
|
|
64
|
+
throw new Error(`Attempted to copy empty slot ${currentSrcSlot} for contract ${contractAddress.toString()}`);
|
|
65
|
+
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
await this.#capsules.set(currentDstSlot, toCopy);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|
|
@@ -284,20 +284,18 @@ export class NoteDataProvider implements DataProvider {
|
|
|
284
284
|
const { data: nullifier, l2BlockNumber: blockNumber } = blockScopedNullifier;
|
|
285
285
|
const noteIndex = await this.#nullifierToNoteId.getAsync(nullifier.toString());
|
|
286
286
|
if (!noteIndex) {
|
|
287
|
-
|
|
287
|
+
throw new Error('Nullifier not found in removeNullifiedNotes');
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
const noteBuffer = noteIndex ? await this.#notes.getAsync(noteIndex) : undefined;
|
|
291
291
|
|
|
292
292
|
if (!noteBuffer) {
|
|
293
|
-
|
|
294
|
-
continue;
|
|
293
|
+
throw new Error('Note not found in removeNullifiedNotes');
|
|
295
294
|
}
|
|
296
295
|
const noteScopes = (await toArray(this.#notesToScope.getValuesAsync(noteIndex))) ?? [];
|
|
297
296
|
const note = NoteDao.fromBuffer(noteBuffer);
|
|
298
297
|
if (!note.recipient.equals(recipient)) {
|
|
299
|
-
|
|
300
|
-
continue;
|
|
298
|
+
throw new Error("Tried to nullify someone else's note");
|
|
301
299
|
}
|
|
302
300
|
|
|
303
301
|
nullifiedNotes.push(note);
|
|
@@ -9,9 +9,10 @@ import type { TxHash } from '@aztec/stdlib/tx';
|
|
|
9
9
|
import type { DataProvider } from '../data_provider.js';
|
|
10
10
|
|
|
11
11
|
interface PrivateEventEntry {
|
|
12
|
-
|
|
12
|
+
msgContent: Buffer;
|
|
13
13
|
blockNumber: number;
|
|
14
14
|
logIndexInTx: number;
|
|
15
|
+
txIndexInBlock: number;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -43,18 +44,20 @@ export class PrivateEventDataProvider implements DataProvider {
|
|
|
43
44
|
* @param contractAddress - The address of the contract that emitted the event.
|
|
44
45
|
* @param recipient - The recipient of the event.
|
|
45
46
|
* @param eventSelector - The event selector of the event.
|
|
46
|
-
* @param
|
|
47
|
+
* @param msgContent - The content of the event.
|
|
47
48
|
* @param txHash - The transaction hash of the event log.
|
|
48
49
|
* @param logIndexInTx - The index of the log within the transaction.
|
|
50
|
+
* @param txIndexInBlock - The index of the transaction in which the log was emitted in the block.
|
|
49
51
|
* @param blockNumber - The block number in which the event was emitted.
|
|
50
52
|
*/
|
|
51
53
|
storePrivateEventLog(
|
|
52
54
|
contractAddress: AztecAddress,
|
|
53
55
|
recipient: AztecAddress,
|
|
54
56
|
eventSelector: EventSelector,
|
|
55
|
-
|
|
57
|
+
msgContent: Fr[],
|
|
56
58
|
txHash: TxHash,
|
|
57
59
|
logIndexInTx: number,
|
|
60
|
+
txIndexInBlock: number,
|
|
58
61
|
blockNumber: number,
|
|
59
62
|
): Promise<void> {
|
|
60
63
|
return this.#store.transactionAsync(async () => {
|
|
@@ -70,10 +73,15 @@ export class PrivateEventDataProvider implements DataProvider {
|
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
this.logger.verbose('storing private event log', { contractAddress, recipient,
|
|
76
|
+
this.logger.verbose('storing private event log', { contractAddress, recipient, msgContent, blockNumber });
|
|
74
77
|
|
|
75
78
|
const index = await this.#eventLogs.lengthAsync();
|
|
76
|
-
await this.#eventLogs.push({
|
|
79
|
+
await this.#eventLogs.push({
|
|
80
|
+
msgContent: serializeToBuffer(msgContent),
|
|
81
|
+
blockNumber,
|
|
82
|
+
logIndexInTx,
|
|
83
|
+
txIndexInBlock,
|
|
84
|
+
});
|
|
77
85
|
|
|
78
86
|
const existingIndices = (await this.#eventLogIndex.getAsync(key)) || [];
|
|
79
87
|
await this.#eventLogIndex.set(key, [...existingIndices, index]);
|
|
@@ -99,7 +107,7 @@ export class PrivateEventDataProvider implements DataProvider {
|
|
|
99
107
|
recipients: AztecAddress[],
|
|
100
108
|
eventSelector: EventSelector,
|
|
101
109
|
): Promise<Fr[][]> {
|
|
102
|
-
const events: Array<{
|
|
110
|
+
const events: Array<{ msgContent: Fr[]; blockNumber: number; logIndexInTx: number; txIndexInBlock: number }> = [];
|
|
103
111
|
|
|
104
112
|
for (const recipient of recipients) {
|
|
105
113
|
const key = `${contractAddress.toString()}_${recipient.toString()}_${eventSelector.toString()}`;
|
|
@@ -112,23 +120,31 @@ export class PrivateEventDataProvider implements DataProvider {
|
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
// Convert buffer back to Fr array
|
|
115
|
-
const reader = BufferReader.asReader(entry.
|
|
116
|
-
const numFields = entry.
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
events.push({
|
|
123
|
+
const reader = BufferReader.asReader(entry.msgContent);
|
|
124
|
+
const numFields = entry.msgContent.length / Fr.SIZE_IN_BYTES;
|
|
125
|
+
const msgContent = reader.readArray(numFields, Fr);
|
|
126
|
+
|
|
127
|
+
events.push({
|
|
128
|
+
msgContent,
|
|
129
|
+
blockNumber: entry.blockNumber,
|
|
130
|
+
logIndexInTx: entry.logIndexInTx,
|
|
131
|
+
txIndexInBlock: entry.txIndexInBlock,
|
|
132
|
+
});
|
|
120
133
|
}
|
|
121
134
|
}
|
|
122
135
|
|
|
123
|
-
// Sort by block number first, then by
|
|
136
|
+
// Sort by block number first, then by txIndexInBlock, then by logIndexInTx
|
|
124
137
|
events.sort((a, b) => {
|
|
125
138
|
if (a.blockNumber !== b.blockNumber) {
|
|
126
139
|
return a.blockNumber - b.blockNumber;
|
|
127
140
|
}
|
|
141
|
+
if (a.txIndexInBlock !== b.txIndexInBlock) {
|
|
142
|
+
return a.txIndexInBlock - b.txIndexInBlock;
|
|
143
|
+
}
|
|
128
144
|
return a.logIndexInTx - b.logIndexInTx;
|
|
129
145
|
});
|
|
130
146
|
|
|
131
|
-
return events.map(e => e.
|
|
147
|
+
return events.map(e => e.msgContent);
|
|
132
148
|
}
|
|
133
149
|
|
|
134
150
|
getSize(): Promise<number> {
|
|
@@ -24,7 +24,7 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
24
24
|
private noteDataProvider: NoteDataProvider,
|
|
25
25
|
private taggingDataProvider: TaggingDataProvider,
|
|
26
26
|
private l2TipsStore: L2TipsKVStore,
|
|
27
|
-
config: Partial<Pick<PXEConfig, '
|
|
27
|
+
config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>> = {},
|
|
28
28
|
loggerOrSuffix?: string | Logger,
|
|
29
29
|
) {
|
|
30
30
|
this.log =
|
|
@@ -34,9 +34,12 @@ export class Synchronizer implements L2BlockStreamEventHandler {
|
|
|
34
34
|
this.blockStream = this.createBlockStream(config);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
protected createBlockStream(config: Partial<Pick<PXEConfig, '
|
|
37
|
+
protected createBlockStream(config: Partial<Pick<PXEConfig, 'l2BlockBatchSize'>>) {
|
|
38
38
|
return new L2BlockStream(this.node, this.l2TipsStore, this, createLogger('pxe:block_stream'), {
|
|
39
|
-
|
|
39
|
+
batchSize: config.l2BlockBatchSize,
|
|
40
|
+
// Skipping finalized blocks makes us sync much faster - we only need to download blocks other than the latest one
|
|
41
|
+
// in order to detect reorgs, and there can be no reorgs on finalized block, making this safe.
|
|
42
|
+
skipFinalized: true,
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
|