@aztec/pxe 2.1.0-rc.9 → 3.0.0-devnet.2
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/README.md +5 -5
- package/dest/bin/check_oracle_version.js +18 -8
- package/dest/config/index.d.ts +8 -8
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +3 -3
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +82 -26
- package/dest/contract_function_simulator/execution_data_provider.d.ts +27 -38
- package/dest/contract_function_simulator/execution_data_provider.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.d.ts +2 -2
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +7 -4
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +16 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -0
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +26 -0
- package/dest/contract_function_simulator/index.d.ts +3 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +2 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +7 -3
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts +22 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/utility_context.js +33 -0
- package/dest/contract_function_simulator/oracle/index.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/index.js +1 -1
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +97 -0
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/interfaces.js +4 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +12 -11
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +79 -76
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +6 -15
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +26 -10
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +69 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +10 -22
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -38
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts +19 -55
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +174 -187
- package/dest/entrypoints/client/bundle/index.d.ts +3 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +2 -1
- package/dest/entrypoints/client/bundle/utils.d.ts +8 -8
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +8 -8
- package/dest/entrypoints/client/lazy/index.d.ts +3 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +7 -7
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +7 -7
- package/dest/entrypoints/server/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -1
- package/dest/entrypoints/server/utils.d.ts +4 -23
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +4 -25
- package/dest/{pxe_service/error_enriching.d.ts → error_enriching.d.ts} +1 -1
- package/dest/error_enriching.d.ts.map +1 -0
- package/dest/{pxe_service/error_enriching.js → error_enriching.js} +3 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +6 -6
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +7 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +23 -18
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts +2 -2
- package/dest/pxe.d.ts +233 -0
- package/dest/pxe.d.ts.map +1 -0
- package/dest/{pxe_service/pxe_service.js → pxe.js} +215 -217
- package/dest/storage/address_data_provider/address_data_provider.d.ts +1 -3
- package/dest/storage/address_data_provider/address_data_provider.d.ts.map +1 -1
- package/dest/storage/address_data_provider/address_data_provider.js +0 -3
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts +1 -3
- package/dest/storage/capsule_data_provider/capsule_data_provider.d.ts.map +1 -1
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +0 -4
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts +3 -4
- package/dest/storage/contract_data_provider/contract_data_provider.d.ts.map +1 -1
- package/dest/storage/contract_data_provider/contract_data_provider.js +0 -3
- package/dest/storage/index.d.ts +0 -1
- package/dest/storage/index.d.ts.map +1 -1
- package/dest/storage/index.js +0 -1
- package/dest/storage/note_data_provider/note_dao.d.ts +1 -1
- package/dest/storage/note_data_provider/note_dao.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts +70 -7
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +120 -72
- package/dest/storage/private_event_data_provider/private_event_data_provider.d.ts +1 -3
- 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 +0 -3
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts +1 -3
- package/dest/storage/sync_data_provider/sync_data_provider.d.ts.map +1 -1
- package/dest/storage/sync_data_provider/sync_data_provider.js +0 -3
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts +28 -6
- package/dest/storage/tagging_data_provider/tagging_data_provider.d.ts.map +1 -1
- package/dest/storage/tagging_data_provider/tagging_data_provider.js +46 -39
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +2 -3
- package/dest/tagging/constants.d.ts +2 -0
- package/dest/tagging/constants.d.ts.map +1 -0
- package/dest/tagging/constants.js +2 -0
- package/dest/tagging/index.d.ts +7 -0
- package/dest/tagging/index.d.ts.map +1 -0
- package/dest/tagging/index.js +5 -0
- package/dest/tagging/siloed_tag.d.ts +14 -0
- package/dest/tagging/siloed_tag.d.ts.map +1 -0
- package/dest/tagging/siloed_tag.js +20 -0
- package/dest/tagging/tag.d.ts +12 -0
- package/dest/tagging/tag.d.ts.map +1 -0
- package/dest/tagging/tag.js +17 -0
- package/dest/tagging/utils.d.ts +18 -0
- package/dest/tagging/utils.d.ts.map +1 -0
- package/dest/tagging/utils.js +24 -0
- package/package.json +18 -21
- package/src/bin/check_oracle_version.ts +23 -9
- package/src/config/index.ts +11 -10
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +128 -44
- package/src/contract_function_simulator/execution_data_provider.ts +29 -47
- package/src/contract_function_simulator/execution_note_cache.ts +11 -6
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +32 -0
- package/src/contract_function_simulator/index.ts +3 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +8 -3
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/utility_context.ts +42 -0
- package/src/contract_function_simulator/oracle/index.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +160 -0
- package/src/contract_function_simulator/oracle/oracle.ts +102 -77
- package/src/contract_function_simulator/oracle/private_execution.ts +7 -15
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +106 -45
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +51 -76
- package/src/contract_function_simulator/pxe_oracle_interface.ts +199 -218
- package/src/entrypoints/client/bundle/index.ts +3 -1
- package/src/entrypoints/client/bundle/utils.ts +11 -19
- package/src/entrypoints/client/lazy/index.ts +3 -1
- package/src/entrypoints/client/lazy/utils.ts +10 -18
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +9 -39
- package/src/{pxe_service/error_enriching.ts → error_enriching.ts} +5 -1
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +6 -6
- package/src/private_kernel/private_kernel_execution_prover.ts +35 -23
- package/src/{pxe_service/pxe_service.ts → pxe.ts} +230 -261
- package/src/storage/address_data_provider/address_data_provider.ts +1 -7
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -11
- package/src/storage/contract_data_provider/contract_data_provider.ts +3 -9
- package/src/storage/index.ts +0 -1
- package/src/storage/note_data_provider/note_dao.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +142 -99
- package/src/storage/private_event_data_provider/private_event_data_provider.ts +1 -7
- package/src/storage/sync_data_provider/sync_data_provider.ts +1 -7
- package/src/storage/tagging_data_provider/tagging_data_provider.ts +52 -55
- package/src/synchronizer/synchronizer.ts +2 -3
- package/src/tagging/constants.ts +2 -0
- package/src/tagging/index.ts +6 -0
- package/src/tagging/siloed_tag.ts +22 -0
- package/src/tagging/tag.ts +16 -0
- package/src/tagging/utils.ts +31 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -48
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +0 -87
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +0 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +0 -146
- package/dest/contract_function_simulator/tagging_utils.d.ts +0 -17
- package/dest/contract_function_simulator/tagging_utils.d.ts.map +0 -1
- package/dest/contract_function_simulator/tagging_utils.js +0 -23
- package/dest/pxe_service/error_enriching.d.ts.map +0 -1
- package/dest/pxe_service/index.d.ts +0 -3
- package/dest/pxe_service/index.d.ts.map +0 -1
- package/dest/pxe_service/index.js +0 -2
- package/dest/pxe_service/pxe_service.d.ts +0 -101
- package/dest/pxe_service/pxe_service.d.ts.map +0 -1
- package/dest/storage/data_provider.d.ts +0 -4
- package/dest/storage/data_provider.d.ts.map +0 -1
- package/dest/storage/data_provider.js +0 -1
- package/dest/test/pxe_test_suite.d.ts +0 -3
- package/dest/test/pxe_test_suite.d.ts.map +0 -1
- package/dest/test/pxe_test_suite.js +0 -97
- package/src/bin/index.ts +0 -62
- package/src/contract_function_simulator/oracle/typed_oracle.ts +0 -289
- package/src/contract_function_simulator/tagging_utils.ts +0 -32
- package/src/pxe_service/index.ts +0 -2
- package/src/storage/data_provider.ts +0 -3
- package/src/test/pxe_test_suite.ts +0 -113
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# PXE
|
|
1
|
+
# PXE & PXE
|
|
2
2
|
|
|
3
|
-
`PXE
|
|
3
|
+
`PXE` (pronounced "pixie service") is a server-side software that provides a set of apis for interacting with the Aztec network. It acts as a bridge between the network and client applications by exposing methods to manage accounts, deploy contracts, create transactions, and retrieve public and account-specific information. It provides a secure environment for the execution of sensitive operations, ensuring private information and decrypted data are not accessible to unauthorized applications. The PXE is a critical component of the Aztec network, and its security and reliability are essential to the overall trustworthiness of user's data.
|
|
4
4
|
|
|
5
|
-
`PXE` is the interface the PXE
|
|
5
|
+
`PXE` is the interface the PXE and every client-side instance implement. Various implementations of the client-side can exist, including those for different platforms such as mobile apps and web browsers. It is a relay between the dApps and the actual PXE.
|
|
6
6
|
|
|
7
|
-
### Main Components in an PXE
|
|
7
|
+
### Main Components in an PXE
|
|
8
8
|
|
|
9
9
|
- [Simulator](../simulator/)
|
|
10
10
|
- [Key Store](../key-store/)
|
|
11
11
|
- [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronize and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
|
|
12
12
|
|
|
13
|
-

|
|
13
|
+

|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { keccak256String } from '@aztec/foundation/crypto';
|
|
2
|
-
import deterministicStringify from 'json-stringify-deterministic';
|
|
3
2
|
import { Oracle } from '../contract_function_simulator/oracle/oracle.js';
|
|
4
|
-
import { TypedOracle } from '../contract_function_simulator/oracle/typed_oracle.js';
|
|
5
3
|
import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
6
|
-
// Create a minimal mock implementation of TypedOracle to instantiate the Oracle class for interface verification.
|
|
7
|
-
class OracleMock extends TypedOracle {
|
|
8
|
-
}
|
|
9
4
|
/**
|
|
10
5
|
* Verifies that the Oracle interface matches the expected interface hash.
|
|
11
6
|
*
|
|
@@ -18,12 +13,27 @@ class OracleMock extends TypedOracle {
|
|
|
18
13
|
* oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
|
|
19
14
|
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
20
15
|
*/ function assertOracleInterfaceMatches() {
|
|
21
|
-
const
|
|
16
|
+
const excludedProps = [
|
|
17
|
+
'handler',
|
|
18
|
+
'constructor',
|
|
19
|
+
'toACIRCallback',
|
|
20
|
+
'handlerAsMisc',
|
|
21
|
+
'handlerAsUtility',
|
|
22
|
+
'handlerAsPrivate'
|
|
23
|
+
];
|
|
24
|
+
// Create a hashable representation of the oracle interface by concatenating its method names. Return values are
|
|
25
|
+
// excluded from the hash calculation since they are typically arrays of fields and I didn't manage to reliably
|
|
26
|
+
// stringify them.
|
|
27
|
+
// TODO(#16581): we're only checking the functions implemented by the Oracle object, which is really an ACVM
|
|
28
|
+
// translator, akin to TXE's RPC translator. This is correct in that it is ultimately the foreign interface that
|
|
29
|
+
// matters, but incorrect in that it does not take into consideration TXE's extended interface. An improvement would
|
|
30
|
+
// be to check RPCTranslator from TXE, though that still seems a bit fragile.
|
|
31
|
+
const oracleInterfaceMethodNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name)).sort().join('');
|
|
22
32
|
// We use keccak256 here just because we already have it in the dependencies.
|
|
23
|
-
const oracleInterfaceHash = keccak256String(
|
|
33
|
+
const oracleInterfaceHash = keccak256String(oracleInterfaceMethodNames);
|
|
24
34
|
if (oracleInterfaceHash !== ORACLE_INTERFACE_HASH) {
|
|
25
35
|
// This check exists only to notify you when you need to update the ORACLE_VERSION constant.
|
|
26
|
-
throw new Error(`The
|
|
36
|
+
throw new Error(`The Oracle interface has changed, which implies a breaking change in the aztec.nr/PXE oracle interface. Update ORACLE_INTERFACE_HASH to ${oracleInterfaceHash} and bump ORACLE_VERSION in pxe/src/oracle_version.ts.`);
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
assertOracleInterfaceMatches();
|
package/dest/config/index.d.ts
CHANGED
|
@@ -18,26 +18,26 @@ export interface KernelProverConfig {
|
|
|
18
18
|
proverEnabled?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Configuration settings for the
|
|
21
|
+
* Configuration settings for the synchronizer.
|
|
22
22
|
*/
|
|
23
|
-
export interface
|
|
23
|
+
export interface SynchronizerConfig {
|
|
24
24
|
/** Maximum amount of blocks to pull from the stream in one request when synchronizing */
|
|
25
25
|
l2BlockBatchSize: number;
|
|
26
26
|
}
|
|
27
|
-
export type
|
|
27
|
+
export type PXEConfig = KernelProverConfig & BBProverConfig & DataStoreConfig & ChainConfig & SynchronizerConfig;
|
|
28
28
|
export type CliPXEOptions = {
|
|
29
29
|
/** Custom Aztec Node URL to connect to */
|
|
30
30
|
nodeUrl?: string;
|
|
31
31
|
};
|
|
32
|
-
export declare const pxeConfigMappings: ConfigMappingsType<
|
|
32
|
+
export declare const pxeConfigMappings: ConfigMappingsType<PXEConfig>;
|
|
33
33
|
/**
|
|
34
|
-
* Creates an instance of
|
|
34
|
+
* Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
35
35
|
*/
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function getPXEConfig(): PXEConfig;
|
|
37
37
|
export declare const pxeCliConfigMappings: ConfigMappingsType<CliPXEOptions>;
|
|
38
|
-
export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions &
|
|
38
|
+
export declare const allPxeConfigMappings: ConfigMappingsType<CliPXEOptions & PXEConfig>;
|
|
39
39
|
/**
|
|
40
40
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
41
41
|
*/
|
|
42
|
-
export declare function getCliPXEOptions(): CliPXEOptions &
|
|
42
|
+
export declare function getCliPXEOptions(): CliPXEOptions & PXEConfig;
|
|
43
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;AAE7E,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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I,aAAa,GAAG,SAAS,CAQ5D"}
|
package/dest/config/index.js
CHANGED
|
@@ -30,8 +30,8 @@ export const pxeConfigMappings = {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* Creates an instance of
|
|
34
|
-
*/ export function
|
|
33
|
+
* Creates an instance of PXEConfig out of environment variables using sensible defaults for integration testing if not set.
|
|
34
|
+
*/ export function getPXEConfig() {
|
|
35
35
|
return getConfigFromMappings(pxeConfigMappings);
|
|
36
36
|
}
|
|
37
37
|
export const pxeCliConfigMappings = {
|
|
@@ -55,7 +55,7 @@ export const allPxeConfigMappings = {
|
|
|
55
55
|
/**
|
|
56
56
|
* Creates an instance of CliPxeOptions out of environment variables
|
|
57
57
|
*/ export function getCliPXEOptions() {
|
|
58
|
-
const pxeConfig =
|
|
58
|
+
const pxeConfig = getPXEConfig();
|
|
59
59
|
const cliOptions = getConfigFromMappings(pxeCliConfigMappings);
|
|
60
60
|
return {
|
|
61
61
|
...pxeConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAIL,KAAK,iCAAiC,EACt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
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
1
|
+
import { AVM_EMITNOTEHASH_BASE_L2_GAS, AVM_EMITNULLIFIER_BASE_L2_GAS, AVM_SENDL2TOL1MSG_BASE_L2_GAS, DA_BYTES_PER_FIELD, DA_GAS_PER_BYTE, FIXED_AVM_STARTUP_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS, L2_GAS_PER_CONTRACT_CLASS_LOG, L2_GAS_PER_PRIVATE_LOG, MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_ENQUEUED_CALLS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
|
|
2
|
+
import { arrayNonEmptyLength, padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
7
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
8
|
-
import {
|
|
8
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
9
9
|
import { ExecutionError, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
|
|
10
10
|
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -15,8 +15,9 @@ import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputs
|
|
|
15
15
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
16
16
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
17
17
|
import { ClientIvcProof } from '@aztec/stdlib/proofs';
|
|
18
|
-
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested } from '@aztec/stdlib/tx';
|
|
18
|
+
import { CallContext, HashedValues, PrivateExecutionResult, TxConstantData, collectNested, getFinalMinRevertibleSideEffectCounter } from '@aztec/stdlib/tx';
|
|
19
19
|
import { ExecutionNoteCache } from './execution_note_cache.js';
|
|
20
|
+
import { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
20
21
|
import { HashedValuesCache } from './hashed_values_cache.js';
|
|
21
22
|
import { Oracle } from './oracle/oracle.js';
|
|
22
23
|
import { executePrivateFunction, verifyCurrentClassId } from './oracle/private_execution.js';
|
|
@@ -46,7 +47,7 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
46
47
|
* @returns The result of the execution.
|
|
47
48
|
*/ async run(request, contractAddress, selector, msgSender = AztecAddress.fromField(Fr.MAX_FIELD_VALUE), senderForTags, scopes) {
|
|
48
49
|
const simulatorSetupTimer = new Timer();
|
|
49
|
-
const
|
|
50
|
+
const anchorBlockHeader = await this.executionDataProvider.getAnchorBlockHeader();
|
|
50
51
|
await verifyCurrentClassId(contractAddress, this.executionDataProvider);
|
|
51
52
|
const entryPointArtifact = await this.executionDataProvider.getFunctionArtifact(contractAddress, selector);
|
|
52
53
|
if (entryPointArtifact.functionType !== FunctionType.PRIVATE) {
|
|
@@ -60,7 +61,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
60
61
|
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
61
62
|
const txRequestHash = await request.toTxRequest().hash();
|
|
62
63
|
const noteCache = new ExecutionNoteCache(txRequestHash);
|
|
63
|
-
const
|
|
64
|
+
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
65
|
+
const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, anchorBlockHeader, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, taggingIndexCache, this.executionDataProvider, 0, startSideEffectCounter, undefined, scopes, senderForTags, this.simulator);
|
|
64
66
|
const setupTime = simulatorSetupTimer.ms();
|
|
65
67
|
try {
|
|
66
68
|
// Note: any nested private function calls are made recursively within this
|
|
@@ -200,21 +202,23 @@ class OrderedSideEffect {
|
|
|
200
202
|
witness: execution.partialWitness
|
|
201
203
|
});
|
|
202
204
|
}
|
|
203
|
-
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.
|
|
205
|
+
const constantData = new TxConstantData(privateExecutionResult.entrypoint.publicInputs.anchorBlockHeader, privateExecutionResult.entrypoint.publicInputs.txContext, getVKTreeRoot(), protocolContractsHash);
|
|
204
206
|
const hasPublicCalls = privateExecutionResult.publicFunctionCalldata.length !== 0;
|
|
205
207
|
let inputsForRollup;
|
|
206
208
|
let inputsForPublic;
|
|
209
|
+
let gasUsed;
|
|
207
210
|
const sortByCounter = (a, b)=>a.counter - b.counter;
|
|
208
211
|
const getEffect = (orderedSideEffect)=>orderedSideEffect.sideEffect;
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
|
|
212
|
+
const isPrivateOnlyTx = privateExecutionResult.publicFunctionCalldata.length === 0;
|
|
213
|
+
const minRevertibleSideEffectCounter = getFinalMinRevertibleSideEffectCounter(privateExecutionResult);
|
|
214
|
+
const [nonRevertibleNullifiers, revertibleNullifiers] = splitOrderedSideEffects(nullifiers.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
215
|
+
if (nonRevertibleNullifiers.length > 0 && !nonRevertibleNullifiers[0].equals(nonceGenerator)) {
|
|
216
|
+
throw new Error('The first non revertible nullifier should be equal to the nonce generator. This is a bug!');
|
|
217
|
+
} else {
|
|
218
|
+
nonRevertibleNullifiers.unshift(nonceGenerator);
|
|
214
219
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// In case the tx only contains private functions, we must make the note hashes unique by using the
|
|
220
|
+
if (isPrivateOnlyTx) {
|
|
221
|
+
// We must make the note hashes unique by using the
|
|
218
222
|
// nonce generator and their index in the tx.
|
|
219
223
|
const uniqueNoteHashes = await Promise.all(siloedNoteHashes.sort(sortByCounter).map(async (orderedSideEffect, i)=>{
|
|
220
224
|
const siloedNoteHash = orderedSideEffect.sideEffect;
|
|
@@ -222,24 +226,76 @@ class OrderedSideEffect {
|
|
|
222
226
|
const uniqueNoteHash = await computeUniqueNoteHash(nonce, siloedNoteHash);
|
|
223
227
|
return uniqueNoteHash;
|
|
224
228
|
}));
|
|
225
|
-
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(
|
|
229
|
+
const accumulatedDataForRollup = new PrivateToRollupAccumulatedData(padArrayEnd(uniqueNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers.concat(revertibleNullifiers), Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(l2ToL1Messages.sort(sortByCounter).map(getEffect), ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(taggedPrivateLogs.sort(sortByCounter).map(getEffect), PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(contractClassLogsHashes.sort(sortByCounter).map(getEffect), ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX));
|
|
230
|
+
gasUsed = meterGasUsed(accumulatedDataForRollup);
|
|
226
231
|
inputsForRollup = new PartialPrivateTailPublicInputsForRollup(accumulatedDataForRollup);
|
|
227
232
|
} else {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
const [nonRevertibleNoteHashes, revertibleNoteHashes] = splitOrderedSideEffects(siloedNoteHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
234
|
+
const [nonRevertibleL2ToL1Messages, revertibleL2ToL1Messages] = splitOrderedSideEffects(l2ToL1Messages.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
235
|
+
const [nonRevertibleTaggedPrivateLogs, revertibleTaggedPrivateLogs] = splitOrderedSideEffects(taggedPrivateLogs, minRevertibleSideEffectCounter);
|
|
236
|
+
const [nonRevertibleContractClassLogHashes, revertibleContractClassLogHashes] = splitOrderedSideEffects(contractClassLogsHashes.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
237
|
+
const [nonRevertiblePublicCallRequests, revertiblePublicCallRequests] = splitOrderedSideEffects(publicCallRequests.sort(sortByCounter), minRevertibleSideEffectCounter);
|
|
238
|
+
const nonRevertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(nonRevertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(nonRevertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(nonRevertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(nonRevertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(nonRevertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(nonRevertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
239
|
+
const revertibleData = new PrivateToPublicAccumulatedData(padArrayEnd(revertibleNoteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX), padArrayEnd(revertibleNullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX), padArrayEnd(revertibleL2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX), padArrayEnd(revertibleTaggedPrivateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX), padArrayEnd(revertibleContractClassLogHashes, ScopedLogHash.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX), padArrayEnd(revertiblePublicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX));
|
|
240
|
+
gasUsed = meterGasUsed(revertibleData).add(meterGasUsed(nonRevertibleData));
|
|
241
|
+
if (publicTeardownCallRequest) {
|
|
242
|
+
gasUsed.add(privateExecutionResult.entrypoint.publicInputs.txContext.gasSettings.teardownGasLimits);
|
|
243
|
+
}
|
|
237
244
|
inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleData, revertibleData, publicTeardownCallRequest ?? PublicCallRequest.empty());
|
|
238
245
|
}
|
|
239
|
-
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/
|
|
246
|
+
const publicInputs = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ gasUsed.add(Gas.from({
|
|
247
|
+
l2Gas: FIXED_L2_GAS,
|
|
248
|
+
daGas: FIXED_DA_GAS
|
|
249
|
+
})), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, hasPublicCalls ? inputsForPublic : undefined, !hasPublicCalls ? inputsForRollup : undefined);
|
|
240
250
|
return {
|
|
241
251
|
publicInputs,
|
|
242
252
|
clientIvcProof: ClientIvcProof.empty(),
|
|
243
253
|
executionSteps: executionSteps
|
|
244
254
|
};
|
|
245
255
|
}
|
|
256
|
+
function splitOrderedSideEffects(effects, minRevertibleSideEffectCounter) {
|
|
257
|
+
const revertibleSideEffects = [];
|
|
258
|
+
const nonRevertibleSideEffects = [];
|
|
259
|
+
effects.forEach((effect)=>{
|
|
260
|
+
if (effect.counter < minRevertibleSideEffectCounter) {
|
|
261
|
+
nonRevertibleSideEffects.push(effect.sideEffect);
|
|
262
|
+
} else {
|
|
263
|
+
revertibleSideEffects.push(effect.sideEffect);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return [
|
|
267
|
+
nonRevertibleSideEffects,
|
|
268
|
+
revertibleSideEffects
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
function meterGasUsed(data) {
|
|
272
|
+
let meteredDAFields = 0;
|
|
273
|
+
let meteredL2Gas = 0;
|
|
274
|
+
const numNoteHashes = arrayNonEmptyLength(data.noteHashes, (hash)=>hash.isEmpty());
|
|
275
|
+
meteredDAFields += numNoteHashes;
|
|
276
|
+
meteredL2Gas += numNoteHashes * AVM_EMITNOTEHASH_BASE_L2_GAS;
|
|
277
|
+
const numNullifiers = arrayNonEmptyLength(data.nullifiers, (nullifier)=>nullifier.isEmpty());
|
|
278
|
+
meteredDAFields += numNullifiers;
|
|
279
|
+
meteredL2Gas += numNullifiers * AVM_EMITNULLIFIER_BASE_L2_GAS;
|
|
280
|
+
const numL2toL1Messages = arrayNonEmptyLength(data.l2ToL1Msgs, (msg)=>msg.isEmpty());
|
|
281
|
+
meteredDAFields += numL2toL1Messages;
|
|
282
|
+
meteredL2Gas += numL2toL1Messages * AVM_SENDL2TOL1MSG_BASE_L2_GAS;
|
|
283
|
+
const numPrivatelogs = arrayNonEmptyLength(data.privateLogs, (log)=>log.isEmpty());
|
|
284
|
+
// Every private log emits its length as an additional field
|
|
285
|
+
meteredDAFields += data.privateLogs.reduce((acc, log)=>!log.isEmpty() ? acc + log.emittedLength + 1 : acc, 0);
|
|
286
|
+
meteredL2Gas += numPrivatelogs * L2_GAS_PER_PRIVATE_LOG;
|
|
287
|
+
const numContractClassLogs = arrayNonEmptyLength(data.contractClassLogsHashes, (log)=>log.isEmpty());
|
|
288
|
+
// Every contract class log emits its length and contract address as additional fields
|
|
289
|
+
meteredDAFields += data.contractClassLogsHashes.reduce((acc, log)=>!log.isEmpty() ? acc + log.logHash.length + 2 : acc, 0);
|
|
290
|
+
meteredL2Gas += numContractClassLogs * L2_GAS_PER_CONTRACT_CLASS_LOG;
|
|
291
|
+
const meteredDAGas = meteredDAFields * DA_BYTES_PER_FIELD * DA_GAS_PER_BYTE;
|
|
292
|
+
if (data.publicCallRequests) {
|
|
293
|
+
const dataForPublic = data;
|
|
294
|
+
const numPublicCallRequests = arrayNonEmptyLength(dataForPublic.publicCallRequests, (req)=>req.isEmpty());
|
|
295
|
+
meteredL2Gas += numPublicCallRequests * FIXED_AVM_STARTUP_L2_GAS;
|
|
296
|
+
}
|
|
297
|
+
return Gas.from({
|
|
298
|
+
l2Gas: meteredL2Gas,
|
|
299
|
+
daGas: meteredDAGas
|
|
300
|
+
});
|
|
301
|
+
}
|
|
@@ -5,13 +5,12 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
5
5
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
6
6
|
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
|
|
7
7
|
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
|
|
8
|
-
import {
|
|
8
|
+
import type { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
9
9
|
import type { NoteStatus } from '@aztec/stdlib/note';
|
|
10
10
|
import { type MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
11
11
|
import type { BlockHeader, NodeStats } from '@aztec/stdlib/tx';
|
|
12
|
-
import type {
|
|
12
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
13
13
|
import type { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
14
|
-
import type { NoteData } from './oracle/typed_oracle.js';
|
|
15
14
|
/**
|
|
16
15
|
* Error thrown when a contract is not found in the database.
|
|
17
16
|
*/
|
|
@@ -112,11 +111,12 @@ export interface ExecutionDataProvider {
|
|
|
112
111
|
*/
|
|
113
112
|
getL1ToL2MembershipWitness(contractAddress: AztecAddress, messageHash: Fr, secret: Fr): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
|
|
114
113
|
/**
|
|
115
|
-
* Retrieve the latest block header synchronized by the
|
|
116
|
-
*
|
|
117
|
-
*
|
|
114
|
+
* Retrieve the latest block header synchronized by the execution data provider. This block header is referred
|
|
115
|
+
* to as the anchor block header in Aztec terminology and it defines the state that is used during private function
|
|
116
|
+
* execution.
|
|
117
|
+
* @returns The anchor block header.
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
getAnchorBlockHeader(): Promise<BlockHeader>;
|
|
120
120
|
/**
|
|
121
121
|
* Fetches the index and sibling path of a leaf at a given block from a given tree.
|
|
122
122
|
* @param blockNumber - The block number at which to get the membership witness.
|
|
@@ -173,41 +173,30 @@ export interface ExecutionDataProvider {
|
|
|
173
173
|
*/
|
|
174
174
|
assertCompatibleOracleVersion(version: number): void;
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @returns The block number.
|
|
178
|
-
*/
|
|
179
|
-
getBlockNumber(): Promise<number>;
|
|
180
|
-
/**
|
|
181
|
-
* Fetches the timestamp of the latest block synchronized by the node.
|
|
182
|
-
* @returns The timestamp.
|
|
183
|
-
*/
|
|
184
|
-
getTimestamp(): Promise<UInt64>;
|
|
185
|
-
/**
|
|
186
|
-
* Fetches the current chain id.
|
|
187
|
-
* @returns The chain id.
|
|
188
|
-
*/
|
|
189
|
-
getChainId(): Promise<number>;
|
|
190
|
-
/**
|
|
191
|
-
* Fetches the current chain id.
|
|
192
|
-
* @returns The chain id.
|
|
193
|
-
*/
|
|
194
|
-
getVersion(): Promise<number>;
|
|
195
|
-
/**
|
|
196
|
-
* Returns the tagging secret for a given sender and recipient pair. For this to work, the ivsk_m of the sender must be known.
|
|
197
|
-
* Includes the next index to be used used for tagging with this secret.
|
|
176
|
+
* Calculates the directional app tagging secret for a given contract, sender and recipient.
|
|
198
177
|
* @param contractAddress - The contract address to silo the secret for
|
|
199
178
|
* @param sender - The address sending the note
|
|
200
179
|
* @param recipient - The address receiving the note
|
|
201
|
-
* @returns
|
|
180
|
+
* @returns The directional app tagging secret
|
|
202
181
|
*/
|
|
203
|
-
|
|
182
|
+
calculateDirectionalAppTaggingSecret(contractAddress: AztecAddress, sender: AztecAddress, recipient: AztecAddress): Promise<DirectionalAppTaggingSecret>;
|
|
204
183
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* @param
|
|
208
|
-
*
|
|
184
|
+
* Updates the local index of the shared tagging secret of a (sender, recipient, contract) tuple if a log with
|
|
185
|
+
* a larger index is found from the node.
|
|
186
|
+
* @param secret - The secret that's unique for (sender, recipient, contract) tuple while the direction
|
|
187
|
+
* of sender -> recipient matters.
|
|
188
|
+
* @param contractAddress - The address of the contract that the logs are tagged for. Needs to be provided to store
|
|
189
|
+
* because the function performs second round of siloing which is necessary because kernels do it as well (they silo
|
|
190
|
+
* first field of the private log which corresponds to the tag).
|
|
191
|
+
*/
|
|
192
|
+
syncTaggedLogsAsSender(secret: DirectionalAppTaggingSecret, contractAddress: AztecAddress): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Returns the last used index when sending a log with a given secret.
|
|
195
|
+
* @param secret - The directional app tagging secret.
|
|
196
|
+
* @returns The last used index for the given directional app tagging secret, or undefined if we never sent a log
|
|
197
|
+
* from this sender to a recipient in a given contract (implicitly included in the secret).
|
|
209
198
|
*/
|
|
210
|
-
|
|
199
|
+
getLastUsedIndexAsSender(secret: DirectionalAppTaggingSecret): Promise<number | undefined>;
|
|
211
200
|
/**
|
|
212
201
|
* Synchronizes the private logs tagged with scoped addresses and all the senders in the address book. Stores the found
|
|
213
202
|
* logs in CapsuleArray ready for a later retrieval in Aztec.nr.
|
|
@@ -230,9 +219,9 @@ export interface ExecutionDataProvider {
|
|
|
230
219
|
validateEnqueuedNotesAndEvents(contractAddress: AztecAddress, noteValidationRequestsArrayBaseSlot: Fr, eventValidationRequestsArrayBaseSlot: Fr): Promise<void>;
|
|
231
220
|
bulkRetrieveLogs(contractAddress: AztecAddress, logRetrievalRequestsArrayBaseSlot: Fr, logRetrievalResponsesArrayBaseSlot: Fr): Promise<void>;
|
|
232
221
|
/**
|
|
233
|
-
*
|
|
222
|
+
* Looks for nullifiers of active contract notes and marks them as nullified in the db if a nullifier is found.
|
|
234
223
|
*/
|
|
235
|
-
|
|
224
|
+
syncNoteNullifiers(contractAddress: AztecAddress): Promise<void>;
|
|
236
225
|
/**
|
|
237
226
|
* Stores arbitrary information in a per-contract non-volatile database, which can later be retrieved with `loadCapsule`.
|
|
238
227
|
* * If data was already stored at this slot, it is overwritten.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution_data_provider.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"execution_data_provider.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,K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B,gBAAgB,CACd,eAAe,EAAE,YAAY,EAC7B,iCAAiC,EAAE,EAAE,EACrC,kCAAkC,EAAE,EAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,kBAAkB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpF;;;;;OAKG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAE3E;;;;OAIG;IACH,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE;;;;;;;;;;OAUG;IACH,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExG;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAErE;;;OAGG;IACH,QAAQ,IAAI,cAAc,CAAC;CAC5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { NoteData } from './oracle/
|
|
3
|
+
import type { NoteData } from './oracle/interfaces.js';
|
|
4
4
|
interface PendingNote {
|
|
5
5
|
note: NoteData;
|
|
6
6
|
counter: number;
|
|
@@ -87,7 +87,7 @@ export declare class ExecutionNoteCache {
|
|
|
87
87
|
getNullifiers(contractAddress: AztecAddress): Set<bigint>;
|
|
88
88
|
getAllNotes(): PendingNote[];
|
|
89
89
|
getAllNullifiers(): Fr[];
|
|
90
|
-
recordNullifier(contractAddress: AztecAddress, siloedNullifier:
|
|
90
|
+
recordNullifier(contractAddress: AztecAddress, siloedNullifier: bigint): void;
|
|
91
91
|
}
|
|
92
92
|
export {};
|
|
93
93
|
//# sourceMappingURL=execution_note_cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAkB;;IAiCjB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAhC1C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAqB;IAClC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAyC;IAExD;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAuC;IAE3D;;OAEG;IACH,OAAO,CAAC,aAAa,CAA0B;IAE/C,OAAO,CAAC,8BAA8B,CAAK;IAE3C,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,0BAA0B,CAAQ;gBAEb,aAAa,EAAE,EAAE;IAE9C;;;OAGG;IACU,iCAAiC,CAAC,8BAA8B,EAAE,MAAM;IAwC9E,MAAM;;;IAWb;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM;IAWjD;;;;;;OAMG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;IA2BxF;;;;OAIG;IACU,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE;IAK/E;;;;;QAKI;IACG,QAAQ,CAAC,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE;IAK9D;;;;;QAKI;IACG,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAKlE;;;OAGG;IACI,aAAa,CAAC,eAAe,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC;IAYhE,WAAW,IAAI,WAAW,EAAE;IAI5B,gBAAgB,IAAI,EAAE,EAAE;IAIxB,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;CAWvE"}
|
|
@@ -102,7 +102,7 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
102
102
|
* @param noteHash - A hash of the note. If this value equals 0, it means the note being nullified is from a previous
|
|
103
103
|
* transaction (and thus not a new note).
|
|
104
104
|
*/ async nullifyNote(contractAddress, innerNullifier, noteHash) {
|
|
105
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
105
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
106
106
|
let nullifiedNoteHashCounter = undefined;
|
|
107
107
|
// Find and remove the matching new note and log(s) if the emitted noteHash is not empty.
|
|
108
108
|
if (!noteHash.isEmpty()) {
|
|
@@ -130,7 +130,7 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
130
130
|
* @param contractAddress - Contract address that emitted the nullifier.
|
|
131
131
|
* @param innerNullifier
|
|
132
132
|
*/ async nullifierCreated(contractAddress, innerNullifier) {
|
|
133
|
-
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
133
|
+
const siloedNullifier = (await siloNullifier(contractAddress, innerNullifier)).toBigInt();
|
|
134
134
|
this.recordNullifier(contractAddress, siloedNullifier);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -173,8 +173,11 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
173
173
|
}
|
|
174
174
|
recordNullifier(contractAddress, siloedNullifier) {
|
|
175
175
|
const nullifiers = this.getNullifiers(contractAddress);
|
|
176
|
-
nullifiers.
|
|
176
|
+
if (nullifiers.has(siloedNullifier)) {
|
|
177
|
+
throw new Error(`Duplicate siloed nullifier ${siloedNullifier} emitted by contract ${contractAddress}`);
|
|
178
|
+
}
|
|
179
|
+
nullifiers.add(siloedNullifier);
|
|
177
180
|
this.nullifierMap.set(contractAddress.toBigInt(), nullifiers);
|
|
178
|
-
this.allNullifiers.add(siloedNullifier
|
|
181
|
+
this.allNullifiers.add(siloedNullifier);
|
|
179
182
|
}
|
|
180
183
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret, type PreTag } from '@aztec/stdlib/logs';
|
|
2
|
+
/**
|
|
3
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
4
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
5
|
+
* of sender -> recipient matters.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExecutionTaggingIndexCache {
|
|
8
|
+
private taggingIndexMap;
|
|
9
|
+
getLastUsedIndex(secret: DirectionalAppTaggingSecret): number | undefined;
|
|
10
|
+
setLastUsedIndex(secret: DirectionalAppTaggingSecret, index: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the pre tags that were used in this execution (and that need to be stored in the db).
|
|
13
|
+
*/
|
|
14
|
+
getUsedPreTags(): PreTag[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=execution_tagging_index_cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution_tagging_index_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_tagging_index_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,eAAe,CAAkC;IAElD,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,GAAG,SAAS;IAIzE,gBAAgB,CAAC,MAAM,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM;IAQ1E;;OAEG;IACI,cAAc,IAAI,MAAM,EAAE;CAMlC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DirectionalAppTaggingSecret } from '@aztec/stdlib/logs';
|
|
2
|
+
/**
|
|
3
|
+
* A map that stores the tagging index for a given directional app tagging secret.
|
|
4
|
+
* Note: The directional app tagging secret is unique for a (sender, recipient, contract) tuple while the direction
|
|
5
|
+
* of sender -> recipient matters.
|
|
6
|
+
*/ export class ExecutionTaggingIndexCache {
|
|
7
|
+
taggingIndexMap = new Map();
|
|
8
|
+
getLastUsedIndex(secret) {
|
|
9
|
+
return this.taggingIndexMap.get(secret.toString());
|
|
10
|
+
}
|
|
11
|
+
setLastUsedIndex(secret, index) {
|
|
12
|
+
const currentValue = this.taggingIndexMap.get(secret.toString());
|
|
13
|
+
if (currentValue !== undefined && currentValue !== index - 1) {
|
|
14
|
+
throw new Error(`Invalid tagging index update. Current value: ${currentValue}, new value: ${index}`);
|
|
15
|
+
}
|
|
16
|
+
this.taggingIndexMap.set(secret.toString(), index);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the pre tags that were used in this execution (and that need to be stored in the db).
|
|
20
|
+
*/ getUsedPreTags() {
|
|
21
|
+
return Array.from(this.taggingIndexMap.entries()).map(([secret, index])=>({
|
|
22
|
+
secret: DirectionalAppTaggingSecret.fromString(secret),
|
|
23
|
+
index
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
2
|
+
export { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
2
3
|
export { HashedValuesCache } from './hashed_values_cache.js';
|
|
3
4
|
export { pickNotes } from './pick_notes.js';
|
|
4
|
-
export {
|
|
5
|
+
export type { NoteData, IMiscOracle, IUtilityExecutionOracle, IPrivateExecutionOracle } from './oracle/interfaces.js';
|
|
5
6
|
export { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
6
7
|
export { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
7
8
|
export { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
@@ -9,4 +10,5 @@ export { Oracle } from './oracle/oracle.js';
|
|
|
9
10
|
export { executePrivateFunction, extractPrivateCircuitPublicInputs } from './oracle/private_execution.js';
|
|
10
11
|
export { generateSimulatedProvingResult } from './contract_function_simulator.js';
|
|
11
12
|
export { packAsRetrievedNote } from './oracle/note_packing_utils.js';
|
|
13
|
+
export { UtilityContext } from './noir-structs/utility_context.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,iCAAiC,EAAE,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ExecutionNoteCache } from './execution_note_cache.js';
|
|
2
|
+
export { ExecutionTaggingIndexCache } from './execution_tagging_index_cache.js';
|
|
2
3
|
export { HashedValuesCache } from './hashed_values_cache.js';
|
|
3
4
|
export { pickNotes } from './pick_notes.js';
|
|
4
|
-
export { TypedOracle } from './oracle/typed_oracle.js';
|
|
5
5
|
export { MessageLoadOracleInputs } from './oracle/message_load_oracle_inputs.js';
|
|
6
6
|
export { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
7
7
|
export { PrivateExecutionOracle } from './oracle/private_execution_oracle.js';
|
|
@@ -9,3 +9,4 @@ export { Oracle } from './oracle/oracle.js';
|
|
|
9
9
|
export { executePrivateFunction, extractPrivateCircuitPublicInputs } from './oracle/private_execution.js';
|
|
10
10
|
export { generateSimulatedProvingResult } from './contract_function_simulator.js';
|
|
11
11
|
export { packAsRetrievedNote } from './oracle/note_packing_utils.js';
|
|
12
|
+
export { UtilityContext } from './noir-structs/utility_context.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log_retrieval_response.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/noir-structs/log_retrieval_response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"log_retrieval_response.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/noir-structs/log_retrieval_response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;GAGG;AACH,qBAAa,oBAAoB;IAEtB,UAAU,EAAE,EAAE,EAAE;IAChB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;gBAHtB,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE;IAG/B,QAAQ,IAAI,EAAE,EAAE;IAWhB,MAAM,CAAC,aAAa,IAAI,EAAE,EAAE;IAW5B,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,EAAE,EAAE;CAOjE"}
|