@aztec/pxe 0.80.0 → 0.82.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/package_info.js +1 -1
- package/dest/entrypoints/server/utils.d.ts +15 -7
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +17 -9
- package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.d.ts +2 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -0
- package/dest/private_kernel/index.d.ts +3 -0
- package/dest/private_kernel/index.d.ts.map +1 -0
- package/dest/private_kernel/index.js +2 -0
- package/dest/{kernel_prover/kernel_prover.d.ts → private_kernel/private_kernel_execution_prover.d.ts} +13 -14
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -0
- package/dest/{kernel_prover/kernel_prover.js → private_kernel/private_kernel_execution_prover.js} +64 -64
- package/dest/{kernel_prover/proving_data_oracle.d.ts → private_kernel/private_kernel_oracle.d.ts} +17 -28
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -0
- package/dest/private_kernel/private_kernel_oracle.js +4 -0
- package/dest/{kernel_oracle/index.d.ts → private_kernel/private_kernel_oracle_impl.d.ts} +5 -5
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -0
- package/dest/{kernel_oracle/index.js → private_kernel/private_kernel_oracle_impl.js} +2 -2
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts +14 -22
- package/dest/pxe_oracle_interface/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/pxe_oracle_interface/pxe_oracle_interface.js +51 -107
- package/dest/pxe_service/pxe_service.d.ts +13 -27
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +213 -241
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +2 -2
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +6 -1
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts +2 -2
- package/dest/storage/contract_data_provider/private_functions_tree.d.ts.map +1 -1
- package/dest/storage/index.d.ts +1 -2
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +1 -2
- package/dest/storage/metadata.d.ts +2 -0
- package/dest/storage/metadata.d.ts.map +1 -0
- package/dest/storage/metadata.js +1 -0
- package/dest/storage/note_data_provider/note_dao.d.ts +9 -13
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_dao.js +11 -15
- package/dest/storage/note_data_provider/note_data_provider.d.ts +2 -2
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +18 -19
- package/dest/synchronizer/synchronizer.js +1 -1
- package/package.json +15 -15
- package/src/config/package_info.ts +1 -1
- package/src/entrypoints/server/utils.ts +25 -11
- package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts +4 -4
- package/src/private_kernel/index.ts +2 -0
- package/src/{kernel_prover/kernel_prover.ts → private_kernel/private_kernel_execution_prover.ts} +76 -71
- package/src/{kernel_prover/proving_data_oracle.ts → private_kernel/private_kernel_oracle.ts} +17 -29
- package/src/{kernel_oracle/index.ts → private_kernel/private_kernel_oracle_impl.ts} +6 -5
- package/src/pxe_oracle_interface/pxe_oracle_interface.ts +77 -153
- package/src/pxe_service/pxe_service.ts +289 -310
- package/src/storage/contract_data_provider/contract_data_provider.ts +11 -2
- package/src/storage/contract_data_provider/private_functions_tree.ts +2 -2
- package/src/storage/index.ts +1 -3
- package/src/storage/metadata.ts +1 -0
- package/src/storage/note_data_provider/note_dao.ts +9 -18
- package/src/storage/note_data_provider/note_data_provider.ts +22 -28
- package/src/synchronizer/synchronizer.ts +1 -1
- package/dest/kernel_oracle/index.d.ts.map +0 -1
- package/dest/kernel_prover/hints/build_private_kernel_reset_private_inputs.d.ts.map +0 -1
- package/dest/kernel_prover/hints/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.d.ts +0 -3
- package/dest/kernel_prover/index.d.ts.map +0 -1
- package/dest/kernel_prover/index.js +0 -2
- package/dest/kernel_prover/kernel_prover.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +0 -1
- package/dest/kernel_prover/proving_data_oracle.js +0 -4
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts +0 -11
- package/dest/note_decryption_utils/add_public_values_to_payload.d.ts.map +0 -1
- package/dest/note_decryption_utils/add_public_values_to_payload.js +0 -47
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts +0 -11
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/auth_witness_data_provider.js +0 -20
- package/dest/storage/auth_witness_data_provider/index.d.ts +0 -2
- package/dest/storage/auth_witness_data_provider/index.d.ts.map +0 -1
- package/dest/storage/auth_witness_data_provider/index.js +0 -1
- package/src/kernel_prover/index.ts +0 -2
- package/src/note_decryption_utils/add_public_values_to_payload.ts +0 -64
- package/src/storage/auth_witness_data_provider/auth_witness_data_provider.ts +0 -34
- package/src/storage/auth_witness_data_provider/index.ts +0 -1
- /package/dest/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.js +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.d.ts +0 -0
- /package/dest/{kernel_prover → private_kernel}/hints/index.js +0 -0
- /package/src/{kernel_prover → private_kernel}/hints/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;GAMG;AACH,qBAAa,oBAAqB,YAAW,YAAY;;IACvD,2DAA2D;IAC3D,OAAO,CAAC,oBAAoB,CAAgD;gBAKhE,KAAK,EAAE,iBAAiB;IAOvB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7E,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB/E;;;;;;;;;OASG;YACW,iBAAiB;IAY/B;;;;;;;;;OASG;YACW,iBAAiB;IAOzB,qBAAqB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKtD,4EAA4E;IAC/D,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQxF,mBAAmB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAKhF,0EAA0E;IAC7D,gBAAgB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAK7D,WAAW,CACtB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,CAAC,2BAA2B,GAAG,gBAAgB,CAAC,GAAG,SAAS,CAAC;IASxE;;;;;;;;OAQG;IACU,mBAAmB,
|
|
1
|
+
{"version":3,"file":"contract_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/contract_data_provider.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAExE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;GAMG;AACH,qBAAa,oBAAqB,YAAW,YAAY;;IACvD,2DAA2D;IAC3D,OAAO,CAAC,oBAAoB,CAAgD;gBAKhE,KAAK,EAAE,iBAAiB;IAOvB,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB7E,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB/E;;;;;;;;;OASG;YACW,iBAAiB;IAY/B;;;;;;;;;OASG;YACW,iBAAiB;IAOzB,qBAAqB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAKtD,4EAA4E;IAC/D,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQxF,mBAAmB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAKhF,0EAA0E;IAC7D,gBAAgB,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAK7D,WAAW,CACtB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,CAAC,2BAA2B,GAAG,gBAAgB,CAAC,GAAG,SAAS,CAAC;IASxE;;;;;;;;OAQG;IACU,mBAAmB,CAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,CAAC;IAU5C;;;;;;;;OAQG;IACU,yBAAyB,CACpC,eAAe,EAAE,YAAY,EAC7B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAKxC;;;;;;;;;OASG;IACU,wBAAwB,CACnC,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAM7C;;;;;;;;;OASG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAKlF;;;;;;;;OAQG;IACU,4BAA4B,CACvC,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAKnB,oBAAoB,CAAC,eAAe,EAAE,YAAY;IAKlD,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB;IAO9E,OAAO;CAKrB"}
|
|
@@ -114,7 +114,12 @@ import { PrivateFunctionsTree } from './private_functions_tree.js';
|
|
|
114
114
|
* @returns The corresponding function's artifact as an object.
|
|
115
115
|
*/ async getFunctionArtifact(contractAddress, selector) {
|
|
116
116
|
const tree = await this.getTreeForAddress(contractAddress);
|
|
117
|
-
|
|
117
|
+
const contractArtifact = tree.getArtifact();
|
|
118
|
+
const functionArtifact = await tree.getFunctionArtifact(selector);
|
|
119
|
+
return {
|
|
120
|
+
...functionArtifact,
|
|
121
|
+
contractName: contractArtifact.name
|
|
122
|
+
};
|
|
118
123
|
}
|
|
119
124
|
/**
|
|
120
125
|
* Retrieves the artifact of a specified function within a given contract.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { FUNCTION_TREE_HEIGHT } from '@aztec/constants';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { MembershipWitness, type MerkleTree } from '@aztec/foundation/trees';
|
|
6
|
-
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
+
import { type ContractArtifact, type FunctionArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
7
|
import { type ContractClassWithId } from '@aztec/stdlib/contract';
|
|
8
8
|
/**
|
|
9
9
|
* Represents a Merkle tree of functions for a particular Contract Class.
|
|
@@ -25,7 +25,7 @@ export declare class PrivateFunctionsTree {
|
|
|
25
25
|
* @param selector - The function selector.
|
|
26
26
|
* @returns The artifact object containing relevant information about the targeted function.
|
|
27
27
|
*/
|
|
28
|
-
getFunctionArtifact(selector: FunctionSelector): Promise<
|
|
28
|
+
getFunctionArtifact(selector: FunctionSelector): Promise<FunctionArtifact>;
|
|
29
29
|
/**
|
|
30
30
|
* Retrieve the bytecode of a function in the contract by its function selector.
|
|
31
31
|
* The function selector is a unique identifier for each function in a contract.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"private_functions_tree.d.ts","sourceRoot":"","sources":["../../../src/storage/contract_data_provider/private_functions_tree.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAGX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAoB,OAAO,CAAC,aAAa;IAFtF,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,OAAO;WAEM,MAAM,CAAC,QAAQ,EAAE,gBAAgB;IAK9C;;;;;;;OAOG;IACU,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkBvF;;;;;;;OAOG;IACU,WAAW,CAAC,QAAQ,EAAE,gBAAgB;IAKnD;;;;;;OAMG;IACI,mBAAmB;IAI1B,yCAAyC;IAClC,gBAAgB;IAIvB,qCAAqC;IAC9B,WAAW;IAIlB;;OAEG;IACI,kBAAkB;IAIzB;;;;;;;;OAQG;IACU,4BAA4B,CACvC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;YAiB5C,OAAO;CAOtB"}
|
package/dest/storage/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
7
|
export * from './data_provider.js';
|
|
9
|
-
export
|
|
8
|
+
export * from './metadata.js';
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
package/dest/storage/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export * from './address_data_provider/index.js';
|
|
2
|
-
export * from './auth_witness_data_provider/index.js';
|
|
3
2
|
export * from './capsule_data_provider/index.js';
|
|
4
3
|
export * from './contract_data_provider/index.js';
|
|
5
4
|
export * from './note_data_provider/index.js';
|
|
6
5
|
export * from './sync_data_provider/index.js';
|
|
7
6
|
export * from './tagging_data_provider/index.js';
|
|
8
7
|
export * from './data_provider.js';
|
|
9
|
-
export
|
|
8
|
+
export * from './metadata.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/storage/metadata.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PXE_DATA_SCHEMA_VERSION = 2;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
5
5
|
import type { NoteData } from '@aztec/simulator/client';
|
|
6
|
-
import { NoteSelector } from '@aztec/stdlib/abi';
|
|
7
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import type { PublicKey } from '@aztec/stdlib/keys';
|
|
9
7
|
import { Note } from '@aztec/stdlib/note';
|
|
10
8
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
11
9
|
/**
|
|
@@ -46,12 +44,11 @@ export declare class NoteDao implements NoteData {
|
|
|
46
44
|
l2BlockHash: string;
|
|
47
45
|
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
48
46
|
index: bigint;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* TODO(#12013): remove
|
|
47
|
+
/**
|
|
48
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
49
|
+
* (This is the x-coordinate of the public key.)
|
|
53
50
|
*/
|
|
54
|
-
|
|
51
|
+
recipient: AztecAddress;
|
|
55
52
|
constructor(
|
|
56
53
|
/** The packed content of the note, as will be returned in the getNotes oracle. */
|
|
57
54
|
note: Note,
|
|
@@ -86,12 +83,11 @@ export declare class NoteDao implements NoteData {
|
|
|
86
83
|
l2BlockHash: string,
|
|
87
84
|
/** The index of the leaf in the global note hash tree the note is stored at */
|
|
88
85
|
index: bigint,
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* TODO(#12013): remove
|
|
86
|
+
/**
|
|
87
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
88
|
+
* (This is the x-coordinate of the public key.)
|
|
93
89
|
*/
|
|
94
|
-
|
|
90
|
+
recipient: AztecAddress);
|
|
95
91
|
toBuffer(): Buffer;
|
|
96
92
|
static fromBuffer(buffer: Buffer | BufferReader): NoteDao;
|
|
97
93
|
toString(): string;
|
|
@@ -101,6 +97,6 @@ export declare class NoteDao implements NoteData {
|
|
|
101
97
|
* @returns - Its size in bytes.
|
|
102
98
|
*/
|
|
103
99
|
getSize(): number;
|
|
104
|
-
static random({ note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index,
|
|
100
|
+
static random({ note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient, }?: Partial<NoteDao>): Promise<NoteDao>;
|
|
105
101
|
}
|
|
106
102
|
//# sourceMappingURL=note_dao.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"note_dao.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_dao.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAS,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IAIpC,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;SAGK;IACE,WAAW,EAAE,EAAE;IACtB,qFAAqF;IAC9E,KAAK,EAAE,EAAE;IAGhB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;;IAzC9B,kFAAkF;IAC3E,IAAI,EAAE,IAAI;IACjB,8GAA8G;IACvG,eAAe,EAAE,YAAY;IACpC;;;SAGK;IACE,WAAW,EAAE,EAAE;IACtB,qFAAqF;IAC9E,KAAK,EAAE,EAAE;IAGhB;;;OAGG;IACI,QAAQ,EAAE,EAAE;IACnB;;;OAGG;IACI,eAAe,EAAE,EAAE;IAG1B;;OAEG;IACI,MAAM,EAAE,MAAM;IACrB;gBACY;IACL,aAAa,EAAE,MAAM;IAC5B;gBACY;IACL,WAAW,EAAE,MAAM;IAC1B,+EAA+E;IACxE,KAAK,EAAE,MAAM;IACpB;;;OAGG;IACI,SAAS,EAAE,YAAY;IAGhC,QAAQ,IAAI,MAAM;IAgBlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IA8B/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAK7B;;;OAGG;IACI,OAAO;WAMD,MAAM,CAAC,EAClB,IAAoB,EACpB,eAA2B,EAC3B,WAAyB,EACzB,KAAmB,EACnB,QAAsB,EACtB,eAA6B,EAC7B,MAAwB,EACxB,aAAgD,EAChD,WAAoC,EACpC,KAA8B,EAC9B,SAAqB,GACtB,GAAE,OAAO,CAAC,OAAO,CAAM;CAezB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
2
2
|
import { Fr, Point } from '@aztec/foundation/fields';
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import { NoteSelector } from '@aztec/stdlib/abi';
|
|
5
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
5
|
import { Note } from '@aztec/stdlib/note';
|
|
7
6
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
@@ -19,8 +18,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
19
18
|
l2BlockNumber;
|
|
20
19
|
l2BlockHash;
|
|
21
20
|
index;
|
|
22
|
-
|
|
23
|
-
noteTypeId;
|
|
21
|
+
recipient;
|
|
24
22
|
constructor(// Note information
|
|
25
23
|
/** The packed content of the note, as will be returned in the getNotes oracle. */ note, /** The address of the contract that created the note (i.e. the address used by the kernel during siloing). */ contractAddress, /**
|
|
26
24
|
* The storage location of the note. This value is not used for anything in PXE, but we do index by storage slot
|
|
@@ -37,9 +35,10 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
37
35
|
* when searching for txEffects.
|
|
38
36
|
*/ txHash, /** The L2 block number in which the tx with this note was included. Used for note management while processing
|
|
39
37
|
* reorgs.*/ l2BlockNumber, /** The L2 block hash in which the tx with this note was included. Used for note management while processing
|
|
40
|
-
* reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
|
|
41
|
-
*
|
|
42
|
-
|
|
38
|
+
* reorgs.*/ l2BlockHash, /** The index of the leaf in the global note hash tree the note is stored at */ index, /**
|
|
39
|
+
* The address whose public key was used to encrypt the note log during delivery.
|
|
40
|
+
* (This is the x-coordinate of the public key.)
|
|
41
|
+
*/ recipient){
|
|
43
42
|
this.note = note;
|
|
44
43
|
this.contractAddress = contractAddress;
|
|
45
44
|
this.storageSlot = storageSlot;
|
|
@@ -50,8 +49,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
50
49
|
this.l2BlockNumber = l2BlockNumber;
|
|
51
50
|
this.l2BlockHash = l2BlockHash;
|
|
52
51
|
this.index = index;
|
|
53
|
-
this.
|
|
54
|
-
this.noteTypeId = noteTypeId;
|
|
52
|
+
this.recipient = recipient;
|
|
55
53
|
}
|
|
56
54
|
toBuffer() {
|
|
57
55
|
return serializeToBuffer([
|
|
@@ -65,8 +63,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
65
63
|
this.l2BlockNumber,
|
|
66
64
|
Fr.fromHexString(this.l2BlockHash),
|
|
67
65
|
this.index,
|
|
68
|
-
this.
|
|
69
|
-
this.noteTypeId
|
|
66
|
+
this.recipient
|
|
70
67
|
]);
|
|
71
68
|
}
|
|
72
69
|
static fromBuffer(buffer) {
|
|
@@ -81,9 +78,8 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
81
78
|
const l2BlockNumber = reader.readNumber();
|
|
82
79
|
const l2BlockHash = Fr.fromBuffer(reader).toString();
|
|
83
80
|
const index = toBigIntBE(reader.readBytes(32));
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
return new NoteDao(note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, publicKey, noteTypeId);
|
|
81
|
+
const recipient = AztecAddress.fromBuffer(reader);
|
|
82
|
+
return new NoteDao(note, contractAddress, storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient);
|
|
87
83
|
}
|
|
88
84
|
toString() {
|
|
89
85
|
return '0x' + this.toBuffer().toString('hex');
|
|
@@ -100,7 +96,7 @@ import { TxHash } from '@aztec/stdlib/tx';
|
|
|
100
96
|
const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
|
|
101
97
|
return noteSize + AztecAddress.SIZE_IN_BYTES + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize;
|
|
102
98
|
}
|
|
103
|
-
static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), nonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(),
|
|
104
|
-
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index,
|
|
99
|
+
static async random({ note = Note.random(), contractAddress = undefined, storageSlot = Fr.random(), nonce = Fr.random(), noteHash = Fr.random(), siloedNullifier = Fr.random(), txHash = TxHash.random(), l2BlockNumber = Math.floor(Math.random() * 1000), l2BlockHash = Fr.random().toString(), index = Fr.random().toBigInt(), recipient = undefined } = {}) {
|
|
100
|
+
return new NoteDao(note, contractAddress ?? await AztecAddress.random(), storageSlot, nonce, noteHash, siloedNullifier, txHash, l2BlockNumber, l2BlockHash, index, recipient ?? await AztecAddress.random());
|
|
105
101
|
}
|
|
106
102
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { InBlock } from '@aztec/stdlib/block';
|
|
@@ -14,7 +14,7 @@ export declare class NoteDataProvider implements DataProvider {
|
|
|
14
14
|
removeNotesAfter(blockNumber: number): Promise<void>;
|
|
15
15
|
unnullifyNotesAfter(blockNumber: number, synchedBlockNumber?: number): Promise<void>;
|
|
16
16
|
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
17
|
-
removeNullifiedNotes(nullifiers: InBlock<Fr>[],
|
|
17
|
+
removeNullifiedNotes(nullifiers: InBlock<Fr>[], recipient: AztecAddress): Promise<NoteDao[]>;
|
|
18
18
|
getSize(): Promise<number>;
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=note_data_provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"note_data_provider.d.ts","sourceRoot":"","sources":["../../../src/storage/note_data_provider/note_data_provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,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;IA6DtF,OAAO;CAGd"}
|
|
@@ -13,14 +13,14 @@ export class NoteDataProvider {
|
|
|
13
13
|
#nullifiedNotesByContract;
|
|
14
14
|
#nullifiedNotesByStorageSlot;
|
|
15
15
|
#nullifiedNotesByTxHash;
|
|
16
|
-
#
|
|
16
|
+
#nullifiedNotesByRecipient;
|
|
17
17
|
#nullifiedNotesByNullifier;
|
|
18
18
|
#scopes;
|
|
19
19
|
#notesToScope;
|
|
20
20
|
#notesByContractAndScope;
|
|
21
21
|
#notesByStorageSlotAndScope;
|
|
22
22
|
#notesByTxHashAndScope;
|
|
23
|
-
#
|
|
23
|
+
#notesByRecipientAndScope;
|
|
24
24
|
constructor(store){
|
|
25
25
|
this.#store = store;
|
|
26
26
|
this.#notes = store.openMap('notes');
|
|
@@ -31,14 +31,14 @@ export class NoteDataProvider {
|
|
|
31
31
|
this.#nullifiedNotesByContract = store.openMultiMap('nullified_notes_by_contract');
|
|
32
32
|
this.#nullifiedNotesByStorageSlot = store.openMultiMap('nullified_notes_by_storage_slot');
|
|
33
33
|
this.#nullifiedNotesByTxHash = store.openMultiMap('nullified_notes_by_tx_hash');
|
|
34
|
-
this.#
|
|
34
|
+
this.#nullifiedNotesByRecipient = store.openMultiMap('nullified_notes_by_recipient');
|
|
35
35
|
this.#nullifiedNotesByNullifier = store.openMap('nullified_notes_by_nullifier');
|
|
36
36
|
this.#scopes = store.openMap('scopes');
|
|
37
37
|
this.#notesToScope = store.openMultiMap('notes_to_scope');
|
|
38
38
|
this.#notesByContractAndScope = new Map();
|
|
39
39
|
this.#notesByStorageSlotAndScope = new Map();
|
|
40
40
|
this.#notesByTxHashAndScope = new Map();
|
|
41
|
-
this.#
|
|
41
|
+
this.#notesByRecipientAndScope = new Map();
|
|
42
42
|
}
|
|
43
43
|
static async create(store) {
|
|
44
44
|
const pxeDB = new NoteDataProvider(store);
|
|
@@ -46,7 +46,7 @@ export class NoteDataProvider {
|
|
|
46
46
|
pxeDB.#notesByContractAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_contract`));
|
|
47
47
|
pxeDB.#notesByStorageSlotAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_storage_slot`));
|
|
48
48
|
pxeDB.#notesByTxHashAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_tx_hash`));
|
|
49
|
-
pxeDB.#
|
|
49
|
+
pxeDB.#notesByRecipientAndScope.set(scope, store.openMultiMap(`${scope}:notes_by_recipient`));
|
|
50
50
|
}
|
|
51
51
|
return pxeDB;
|
|
52
52
|
}
|
|
@@ -59,7 +59,7 @@ export class NoteDataProvider {
|
|
|
59
59
|
this.#notesByContractAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_contract`));
|
|
60
60
|
this.#notesByStorageSlotAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_storage_slot`));
|
|
61
61
|
this.#notesByTxHashAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_tx_hash`));
|
|
62
|
-
this.#
|
|
62
|
+
this.#notesByRecipientAndScope.set(scopeString, this.#store.openMultiMap(`${scopeString}:notes_by_recipient`));
|
|
63
63
|
return true;
|
|
64
64
|
}
|
|
65
65
|
async addNotes(notes, scope = AztecAddress.ZERO) {
|
|
@@ -79,7 +79,7 @@ export class NoteDataProvider {
|
|
|
79
79
|
await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteIndex);
|
|
80
80
|
await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteIndex);
|
|
81
81
|
await this.#notesByTxHashAndScope.get(scope.toString()).set(dao.txHash.toString(), noteIndex);
|
|
82
|
-
await this.#
|
|
82
|
+
await this.#notesByRecipientAndScope.get(scope.toString()).set(dao.recipient.toString(), noteIndex);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -95,7 +95,7 @@ export class NoteDataProvider {
|
|
|
95
95
|
await this.#nullifierToNoteId.delete(noteDao.siloedNullifier.toString());
|
|
96
96
|
const scopes = await toArray(this.#scopes.keysAsync());
|
|
97
97
|
for (const scope of scopes){
|
|
98
|
-
await this.#
|
|
98
|
+
await this.#notesByRecipientAndScope.get(scope).deleteValue(noteDao.recipient.toString(), noteIndex);
|
|
99
99
|
await this.#notesByTxHashAndScope.get(scope).deleteValue(noteDao.txHash.toString(), noteIndex);
|
|
100
100
|
await this.#notesByContractAndScope.get(scope).deleteValue(noteDao.contractAddress.toString(), noteIndex);
|
|
101
101
|
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(noteDao.storageSlot.toString(), noteIndex);
|
|
@@ -123,14 +123,14 @@ export class NoteDataProvider {
|
|
|
123
123
|
let scopes = await toArray(this.#nullifiedNotesToScope.getValuesAsync(noteIndex)) ?? [];
|
|
124
124
|
if (scopes.length === 0) {
|
|
125
125
|
scopes = [
|
|
126
|
-
|
|
126
|
+
dao.recipient.toString()
|
|
127
127
|
];
|
|
128
128
|
}
|
|
129
129
|
for (const scope of scopes){
|
|
130
130
|
await this.#notesByContractAndScope.get(scope.toString()).set(dao.contractAddress.toString(), noteIndex);
|
|
131
131
|
await this.#notesByStorageSlotAndScope.get(scope.toString()).set(dao.storageSlot.toString(), noteIndex);
|
|
132
132
|
await this.#notesByTxHashAndScope.get(scope.toString()).set(dao.txHash.toString(), noteIndex);
|
|
133
|
-
await this.#
|
|
133
|
+
await this.#notesByRecipientAndScope.get(scope.toString()).set(dao.recipient.toString(), noteIndex);
|
|
134
134
|
await this.#notesToScope.set(noteIndex, scope);
|
|
135
135
|
}
|
|
136
136
|
await this.#nullifiedNotes.delete(noteIndex);
|
|
@@ -139,13 +139,12 @@ export class NoteDataProvider {
|
|
|
139
139
|
await this.#nullifiedNotesByContract.deleteValue(dao.contractAddress.toString(), noteIndex);
|
|
140
140
|
await this.#nullifiedNotesByStorageSlot.deleteValue(dao.storageSlot.toString(), noteIndex);
|
|
141
141
|
await this.#nullifiedNotesByTxHash.deleteValue(dao.txHash.toString(), noteIndex);
|
|
142
|
-
await this.#
|
|
142
|
+
await this.#nullifiedNotesByRecipient.deleteValue(dao.recipient.toString(), noteIndex);
|
|
143
143
|
await this.#nullifiedNotesByNullifier.delete(dao.siloedNullifier.toString());
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
async getNotes(filter) {
|
|
148
|
-
const publicKey = filter.owner ? await filter.owner.toAddressPoint() : undefined;
|
|
149
148
|
filter.status = filter.status ?? NoteStatus.ACTIVE;
|
|
150
149
|
const candidateNoteSources = [];
|
|
151
150
|
filter.scopes ??= (await toArray(this.#scopes.keysAsync())).map((addressString)=>AztecAddress.fromString(addressString));
|
|
@@ -155,7 +154,7 @@ export class NoteDataProvider {
|
|
|
155
154
|
if (!await this.#scopes.hasAsync(formattedScopeString)) {
|
|
156
155
|
throw new Error('Trying to get incoming notes of an scope that is not in the PXE database');
|
|
157
156
|
}
|
|
158
|
-
activeNoteIdsPerScope.push(
|
|
157
|
+
activeNoteIdsPerScope.push(filter.recipient ? await toArray(this.#notesByRecipientAndScope.get(formattedScopeString).getValuesAsync(filter.recipient.toString())) : filter.txHash ? await toArray(this.#notesByTxHashAndScope.get(formattedScopeString).getValuesAsync(filter.txHash.toString())) : filter.contractAddress ? await toArray(this.#notesByContractAndScope.get(formattedScopeString).getValuesAsync(filter.contractAddress.toString())) : filter.storageSlot ? await toArray(this.#notesByStorageSlotAndScope.get(formattedScopeString).getValuesAsync(filter.storageSlot.toString())) : await toArray(this.#notesByRecipientAndScope.get(formattedScopeString).valuesAsync()));
|
|
159
158
|
}
|
|
160
159
|
candidateNoteSources.push({
|
|
161
160
|
ids: new Set(activeNoteIdsPerScope.flat()),
|
|
@@ -163,7 +162,7 @@ export class NoteDataProvider {
|
|
|
163
162
|
});
|
|
164
163
|
if (filter.status == NoteStatus.ACTIVE_OR_NULLIFIED) {
|
|
165
164
|
candidateNoteSources.push({
|
|
166
|
-
ids:
|
|
165
|
+
ids: filter.recipient ? await toArray(this.#nullifiedNotesByRecipient.getValuesAsync(filter.recipient.toString())) : filter.txHash ? await toArray(this.#nullifiedNotesByTxHash.getValuesAsync(filter.txHash.toString())) : filter.contractAddress ? await toArray(this.#nullifiedNotesByContract.getValuesAsync(filter.contractAddress.toString())) : filter.storageSlot ? await toArray(this.#nullifiedNotesByStorageSlot.getValuesAsync(filter.storageSlot.toString())) : await toArray(this.#nullifiedNotes.keysAsync()),
|
|
167
166
|
notes: this.#nullifiedNotes
|
|
168
167
|
});
|
|
169
168
|
}
|
|
@@ -184,7 +183,7 @@ export class NoteDataProvider {
|
|
|
184
183
|
if (filter.storageSlot && !note.storageSlot.equals(filter.storageSlot)) {
|
|
185
184
|
continue;
|
|
186
185
|
}
|
|
187
|
-
if (
|
|
186
|
+
if (filter.recipient && !note.recipient.equals(filter.recipient)) {
|
|
188
187
|
continue;
|
|
189
188
|
}
|
|
190
189
|
if (filter.siloedNullifier && !note.siloedNullifier.equals(filter.siloedNullifier)) {
|
|
@@ -195,7 +194,7 @@ export class NoteDataProvider {
|
|
|
195
194
|
}
|
|
196
195
|
return result;
|
|
197
196
|
}
|
|
198
|
-
removeNullifiedNotes(nullifiers,
|
|
197
|
+
removeNullifiedNotes(nullifiers, recipient) {
|
|
199
198
|
if (nullifiers.length === 0) {
|
|
200
199
|
return Promise.resolve([]);
|
|
201
200
|
}
|
|
@@ -213,7 +212,7 @@ export class NoteDataProvider {
|
|
|
213
212
|
}
|
|
214
213
|
const noteScopes = await toArray(this.#notesToScope.getValuesAsync(noteIndex)) ?? [];
|
|
215
214
|
const note = NoteDao.fromBuffer(noteBuffer);
|
|
216
|
-
if (!note.
|
|
215
|
+
if (!note.recipient.equals(recipient)) {
|
|
217
216
|
continue;
|
|
218
217
|
}
|
|
219
218
|
nullifiedNotes.push(note);
|
|
@@ -221,7 +220,7 @@ export class NoteDataProvider {
|
|
|
221
220
|
await this.#notesToScope.delete(noteIndex);
|
|
222
221
|
const scopes = await toArray(this.#scopes.keysAsync());
|
|
223
222
|
for (const scope of scopes){
|
|
224
|
-
await this.#
|
|
223
|
+
await this.#notesByRecipientAndScope.get(scope).deleteValue(note.recipient.toString(), noteIndex);
|
|
225
224
|
await this.#notesByTxHashAndScope.get(scope).deleteValue(note.txHash.toString(), noteIndex);
|
|
226
225
|
await this.#notesByContractAndScope.get(scope).deleteValue(note.contractAddress.toString(), noteIndex);
|
|
227
226
|
await this.#notesByStorageSlotAndScope.get(scope).deleteValue(note.storageSlot.toString(), noteIndex);
|
|
@@ -236,7 +235,7 @@ export class NoteDataProvider {
|
|
|
236
235
|
await this.#nullifiedNotesByContract.set(note.contractAddress.toString(), noteIndex);
|
|
237
236
|
await this.#nullifiedNotesByStorageSlot.set(note.storageSlot.toString(), noteIndex);
|
|
238
237
|
await this.#nullifiedNotesByTxHash.set(note.txHash.toString(), noteIndex);
|
|
239
|
-
await this.#
|
|
238
|
+
await this.#nullifiedNotesByRecipient.set(note.recipient.toString(), noteIndex);
|
|
240
239
|
await this.#nullifiedNotesByNullifier.set(nullifier.toString(), noteIndex);
|
|
241
240
|
await this.#nullifierToNoteId.delete(nullifier.toString());
|
|
242
241
|
}
|
|
@@ -36,7 +36,7 @@ import { L2BlockStream } from '@aztec/stdlib/block';
|
|
|
36
36
|
switch(event.type){
|
|
37
37
|
case 'blocks-added':
|
|
38
38
|
{
|
|
39
|
-
const lastBlock = event.blocks.at(-1);
|
|
39
|
+
const lastBlock = event.blocks.at(-1).block;
|
|
40
40
|
this.log.verbose(`Updated pxe last block to ${lastBlock.number}`, {
|
|
41
41
|
blockHash: lastBlock.hash(),
|
|
42
42
|
archive: lastBlock.archive.root.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -59,19 +59,19 @@
|
|
|
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.82.0",
|
|
63
|
+
"@aztec/bb.js": "0.82.0",
|
|
64
|
+
"@aztec/builder": "0.82.0",
|
|
65
|
+
"@aztec/constants": "0.82.0",
|
|
66
|
+
"@aztec/ethereum": "0.82.0",
|
|
67
|
+
"@aztec/foundation": "0.82.0",
|
|
68
|
+
"@aztec/key-store": "0.82.0",
|
|
69
|
+
"@aztec/kv-store": "0.82.0",
|
|
70
|
+
"@aztec/noir-protocol-circuits-types": "0.82.0",
|
|
71
|
+
"@aztec/noir-types": "0.82.0",
|
|
72
|
+
"@aztec/protocol-contracts": "0.82.0",
|
|
73
|
+
"@aztec/simulator": "0.82.0",
|
|
74
|
+
"@aztec/stdlib": "0.82.0",
|
|
75
75
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
76
76
|
"koa": "^2.14.2",
|
|
77
77
|
"koa-router": "^12.0.0",
|
|
@@ -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.82.0",
|
|
85
85
|
"@jest/globals": "^29.5.0",
|
|
86
86
|
"@types/jest": "^29.5.0",
|
|
87
87
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -5,28 +5,43 @@ 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 type { AztecNode
|
|
8
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
9
9
|
|
|
10
10
|
import type { PXEServiceConfig } from '../../config/index.js';
|
|
11
11
|
import { PXEService } from '../../pxe_service/pxe_service.js';
|
|
12
|
-
import { PXE_DATA_SCHEMA_VERSION } from '
|
|
12
|
+
import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Create and start an PXEService instance with the given AztecNode.
|
|
16
|
-
* If no keyStore or database is provided, it will use KeyStore and MemoryDB as default values.
|
|
17
|
-
* Returns a Promise that resolves to the started PXEService instance.
|
|
15
|
+
* Create and start an PXEService instance with the given AztecNode and config.
|
|
18
16
|
*
|
|
19
17
|
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
20
18
|
* @param config - The PXE Service Config to use
|
|
21
|
-
* @param useLogSuffix -
|
|
22
|
-
* @param proofCreator - An optional proof creator to use in place of any other configuration
|
|
19
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
23
20
|
* @returns A Promise that resolves to the started PXEService instance.
|
|
24
21
|
*/
|
|
25
|
-
export
|
|
22
|
+
export function createPXEService(
|
|
26
23
|
aztecNode: AztecNode,
|
|
27
24
|
config: PXEServiceConfig,
|
|
28
25
|
useLogSuffix: string | boolean | undefined = undefined,
|
|
29
|
-
|
|
26
|
+
) {
|
|
27
|
+
const simulationProvider = new WASMSimulator();
|
|
28
|
+
return createPXEServiceWithSimulationProvider(aztecNode, simulationProvider, config, useLogSuffix);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create and start an PXEService instance with the given AztecNode, SimulationProvider and config.
|
|
33
|
+
*
|
|
34
|
+
* @param aztecNode - The AztecNode instance to be used by the server.
|
|
35
|
+
* @param simulationProvider - The SimulationProvider to use
|
|
36
|
+
* @param config - The PXE Service Config to use
|
|
37
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
38
|
+
* @returns A Promise that resolves to the started PXEService instance.
|
|
39
|
+
*/
|
|
40
|
+
export async function createPXEServiceWithSimulationProvider(
|
|
41
|
+
aztecNode: AztecNode,
|
|
42
|
+
simulationProvider: SimulationProvider,
|
|
43
|
+
config: PXEServiceConfig,
|
|
44
|
+
useLogSuffix: string | boolean | undefined = undefined,
|
|
30
45
|
) {
|
|
31
46
|
const logSuffix =
|
|
32
47
|
typeof useLogSuffix === 'boolean' ? (useLogSuffix ? randomBytes(3).toString('hex') : undefined) : useLogSuffix;
|
|
@@ -44,8 +59,7 @@ export async function createPXEService(
|
|
|
44
59
|
createLogger('pxe:data:lmdb'),
|
|
45
60
|
);
|
|
46
61
|
|
|
47
|
-
const
|
|
48
|
-
const prover = proofCreator ?? (await createProver(config, simulationProvider, logSuffix));
|
|
62
|
+
const prover = await createProver(config, simulationProvider, logSuffix);
|
|
49
63
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
50
64
|
const pxe = await PXEService.create(
|
|
51
65
|
aztecNode,
|
package/src/{kernel_prover → private_kernel}/hints/build_private_kernel_reset_private_inputs.ts
RENAMED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
} from '@aztec/stdlib/kernel';
|
|
44
44
|
import { type PrivateCallExecutionResult, collectNested } from '@aztec/stdlib/tx';
|
|
45
45
|
|
|
46
|
-
import type {
|
|
46
|
+
import type { PrivateKernelOracle } from '../private_kernel_oracle.js';
|
|
47
47
|
|
|
48
48
|
function collectNestedReadRequests(
|
|
49
49
|
executionStack: PrivateCallExecutionResult[],
|
|
@@ -57,7 +57,7 @@ function collectNestedReadRequests(
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
function getNullifierMembershipWitnessResolver(oracle:
|
|
60
|
+
function getNullifierMembershipWitnessResolver(oracle: PrivateKernelOracle) {
|
|
61
61
|
return async (nullifier: Fr) => {
|
|
62
62
|
const res = await oracle.getNullifierMembershipWitness(nullifier);
|
|
63
63
|
if (!res) {
|
|
@@ -74,7 +74,7 @@ function getNullifierMembershipWitnessResolver(oracle: ProvingDataOracle) {
|
|
|
74
74
|
|
|
75
75
|
async function getMasterSecretKeysAndAppKeyGenerators(
|
|
76
76
|
keyValidationRequests: Tuple<ScopedKeyValidationRequestAndGenerator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>,
|
|
77
|
-
oracle:
|
|
77
|
+
oracle: PrivateKernelOracle,
|
|
78
78
|
) {
|
|
79
79
|
const keysHints = [];
|
|
80
80
|
for (let i = 0; i < keyValidationRequests.length; ++i) {
|
|
@@ -144,7 +144,7 @@ export class PrivateKernelResetPrivateInputsBuilder {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
async build(oracle:
|
|
147
|
+
async build(oracle: PrivateKernelOracle, noteHashLeafIndexMap: Map<bigint, bigint>) {
|
|
148
148
|
if (privateKernelResetDimensionNames.every(name => !this.requestedDimensions[name])) {
|
|
149
149
|
throw new Error('Reset is not required.');
|
|
150
150
|
}
|