@aztec/pxe 3.0.0-canary.a9708bd → 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 -214
- 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 +19 -22
- 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 -257
- 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 -100
- 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
|
@@ -5,18 +5,44 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
5
5
|
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
6
6
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
7
7
|
import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
8
|
+
export class UnavailableOracleError extends Error {
|
|
9
|
+
constructor(oracleName){
|
|
10
|
+
super(`${oracleName} oracles not available with the current handler`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* A data source that has all the apis required by Aztec.nr.
|
|
10
15
|
*/ export class Oracle {
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
this.
|
|
16
|
+
handler;
|
|
17
|
+
constructor(handler){
|
|
18
|
+
this.handler = handler;
|
|
19
|
+
}
|
|
20
|
+
handlerAsMisc() {
|
|
21
|
+
if (!('isMisc' in this.handler)) {
|
|
22
|
+
throw new UnavailableOracleError('Misc');
|
|
23
|
+
}
|
|
24
|
+
return this.handler;
|
|
25
|
+
}
|
|
26
|
+
handlerAsUtility() {
|
|
27
|
+
if (!('isUtility' in this.handler)) {
|
|
28
|
+
throw new UnavailableOracleError('Utility');
|
|
29
|
+
}
|
|
30
|
+
return this.handler;
|
|
31
|
+
}
|
|
32
|
+
handlerAsPrivate() {
|
|
33
|
+
if (!('isPrivate' in this.handler)) {
|
|
34
|
+
throw new UnavailableOracleError('Private');
|
|
35
|
+
}
|
|
36
|
+
return this.handler;
|
|
14
37
|
}
|
|
15
38
|
toACIRCallback() {
|
|
16
39
|
const excludedProps = [
|
|
17
|
-
'
|
|
40
|
+
'handler',
|
|
18
41
|
'constructor',
|
|
19
|
-
'toACIRCallback'
|
|
42
|
+
'toACIRCallback',
|
|
43
|
+
'handlerAsMisc',
|
|
44
|
+
'handlerAsUtility',
|
|
45
|
+
'handlerAsPrivate'
|
|
20
46
|
];
|
|
21
47
|
// Get all the oracle function names
|
|
22
48
|
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
@@ -39,57 +65,36 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
39
65
|
}, {});
|
|
40
66
|
}
|
|
41
67
|
utilityAssertCompatibleOracleVersion([version]) {
|
|
42
|
-
this.
|
|
68
|
+
this.handlerAsMisc().utilityAssertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
43
69
|
return Promise.resolve([]);
|
|
44
70
|
}
|
|
45
71
|
utilityGetRandomField() {
|
|
46
|
-
const val = this.
|
|
72
|
+
const val = this.handlerAsMisc().utilityGetRandomField();
|
|
47
73
|
return Promise.resolve([
|
|
48
74
|
toACVMField(val)
|
|
49
75
|
]);
|
|
50
76
|
}
|
|
51
77
|
// Since the argument is a slice, noir automatically adds a length field to oracle call.
|
|
52
78
|
privateStoreInExecutionCache(_length, values, [hash]) {
|
|
53
|
-
this.
|
|
79
|
+
this.handlerAsPrivate().privateStoreInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
54
80
|
return Promise.resolve([]);
|
|
55
81
|
}
|
|
56
82
|
async privateLoadFromExecutionCache([returnsHash]) {
|
|
57
|
-
const values = await this.
|
|
83
|
+
const values = await this.handlerAsPrivate().privateLoadFromExecutionCache(Fr.fromString(returnsHash));
|
|
58
84
|
return [
|
|
59
85
|
values.map(toACVMField)
|
|
60
86
|
];
|
|
61
87
|
}
|
|
62
|
-
async
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
async utilityGetTimestamp() {
|
|
68
|
-
return [
|
|
69
|
-
toACVMField(await this.typedOracle.utilityGetTimestamp())
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
async utilityGetContractAddress() {
|
|
73
|
-
return [
|
|
74
|
-
toACVMField(await this.typedOracle.utilityGetContractAddress())
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
async utilityGetVersion() {
|
|
78
|
-
return [
|
|
79
|
-
toACVMField(await this.typedOracle.utilityGetVersion())
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
async utilityGetChainId() {
|
|
83
|
-
return [
|
|
84
|
-
toACVMField(await this.typedOracle.utilityGetChainId())
|
|
85
|
-
];
|
|
88
|
+
async utilityGetUtilityContext() {
|
|
89
|
+
const context = await this.handlerAsUtility().utilityGetUtilityContext();
|
|
90
|
+
return context.toNoirRepresentation();
|
|
86
91
|
}
|
|
87
92
|
async utilityGetKeyValidationRequest([pkMHash]) {
|
|
88
|
-
const keyValidationRequest = await this.
|
|
93
|
+
const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(Fr.fromString(pkMHash));
|
|
89
94
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
90
95
|
}
|
|
91
96
|
async utilityGetContractInstance([address]) {
|
|
92
|
-
const instance = await this.
|
|
97
|
+
const instance = await this.handlerAsUtility().utilityGetContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
93
98
|
return [
|
|
94
99
|
instance.salt,
|
|
95
100
|
instance.deployer,
|
|
@@ -102,7 +107,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
102
107
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
103
108
|
const parsedTreeId = Fr.fromString(treeId).toNumber();
|
|
104
109
|
const parsedLeafValue = Fr.fromString(leafValue);
|
|
105
|
-
const witness = await this.
|
|
110
|
+
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(parsedBlockNumber, parsedTreeId, parsedLeafValue);
|
|
106
111
|
if (!witness) {
|
|
107
112
|
throw new Error(`Leaf ${leafValue} not found in the tree ${MerkleTreeId[parsedTreeId]} at block ${parsedBlockNumber}.`);
|
|
108
113
|
}
|
|
@@ -114,7 +119,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
114
119
|
async utilityGetNullifierMembershipWitness([blockNumber], [nullifier]) {
|
|
115
120
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
116
121
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
117
|
-
const witness = await this.
|
|
122
|
+
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(parsedBlockNumber, parsedNullifier);
|
|
118
123
|
if (!witness) {
|
|
119
124
|
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block ${parsedBlockNumber}.`);
|
|
120
125
|
}
|
|
@@ -123,7 +128,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
123
128
|
async utilityGetLowNullifierMembershipWitness([blockNumber], [nullifier]) {
|
|
124
129
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
125
130
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
126
|
-
const witness = await this.
|
|
131
|
+
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(parsedBlockNumber, parsedNullifier);
|
|
127
132
|
if (!witness) {
|
|
128
133
|
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block ${parsedBlockNumber}.`);
|
|
129
134
|
}
|
|
@@ -132,7 +137,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
132
137
|
async utilityGetPublicDataWitness([blockNumber], [leafSlot]) {
|
|
133
138
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
134
139
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
135
|
-
const witness = await this.
|
|
140
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(parsedBlockNumber, parsedLeafSlot);
|
|
136
141
|
if (!witness) {
|
|
137
142
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block ${parsedBlockNumber}.`);
|
|
138
143
|
}
|
|
@@ -140,7 +145,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
140
145
|
}
|
|
141
146
|
async utilityGetBlockHeader([blockNumber]) {
|
|
142
147
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
143
|
-
const header = await this.
|
|
148
|
+
const header = await this.handlerAsUtility().utilityGetBlockHeader(parsedBlockNumber);
|
|
144
149
|
if (!header) {
|
|
145
150
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
146
151
|
}
|
|
@@ -148,7 +153,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
148
153
|
}
|
|
149
154
|
async utilityGetAuthWitness([messageHash]) {
|
|
150
155
|
const messageHashField = Fr.fromString(messageHash);
|
|
151
|
-
const witness = await this.
|
|
156
|
+
const witness = await this.handlerAsUtility().utilityGetAuthWitness(messageHashField);
|
|
152
157
|
if (!witness) {
|
|
153
158
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
154
159
|
}
|
|
@@ -156,10 +161,9 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
156
161
|
witness.map(toACVMField)
|
|
157
162
|
];
|
|
158
163
|
}
|
|
159
|
-
// TODO(benesjan): This doesn't map to the underlying oracle name which is just ugly.
|
|
160
164
|
async utilityGetPublicKeysAndPartialAddress([address]) {
|
|
161
165
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
162
|
-
const { publicKeys, partialAddress } = await this.
|
|
166
|
+
const { publicKeys, partialAddress } = await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(parsedAddress);
|
|
163
167
|
return [
|
|
164
168
|
[
|
|
165
169
|
...publicKeys.toFields(),
|
|
@@ -168,7 +172,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
168
172
|
];
|
|
169
173
|
}
|
|
170
174
|
async utilityGetNotes([storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedRetrievedNoteLength]) {
|
|
171
|
-
const noteDatas = await this.
|
|
175
|
+
const noteDatas = await this.handlerAsUtility().utilityGetNotes(Fr.fromString(storageSlot), +numSelects, selectByIndexes.map((s)=>+s), selectByOffsets.map((s)=>+s), selectByLengths.map((s)=>+s), selectValues.map(Fr.fromString), selectComparators.map((s)=>+s), sortByIndexes.map((s)=>+s), sortByOffsets.map((s)=>+s), sortByLengths.map((s)=>+s), sortOrder.map((s)=>+s), +limit, +offset, +status);
|
|
172
176
|
const returnDataAsArrayOfPackedRetrievedNotes = noteDatas.map(packAsRetrievedNote);
|
|
173
177
|
// Now we convert each sub-array to an array of ACVMField
|
|
174
178
|
const returnDataAsArrayOfACVMFieldArrays = returnDataAsArrayOfPackedRetrievedNotes.map((subArray)=>subArray.map(toACVMField));
|
|
@@ -176,29 +180,29 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
176
180
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedRetrievedNoteLength);
|
|
177
181
|
}
|
|
178
182
|
privateNotifyCreatedNote([storageSlot], [noteTypeId], note, [noteHash], [counter]) {
|
|
179
|
-
this.
|
|
183
|
+
this.handlerAsPrivate().privateNotifyCreatedNote(Fr.fromString(storageSlot), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
180
184
|
return Promise.resolve([]);
|
|
181
185
|
}
|
|
182
186
|
async privateNotifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
183
|
-
await this.
|
|
187
|
+
await this.handlerAsPrivate().privateNotifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
184
188
|
return [];
|
|
185
189
|
}
|
|
186
190
|
async privateNotifyCreatedNullifier([innerNullifier]) {
|
|
187
|
-
await this.
|
|
191
|
+
await this.handlerAsPrivate().privateNotifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
188
192
|
return [];
|
|
189
193
|
}
|
|
190
194
|
async utilityCheckNullifierExists([innerNullifier]) {
|
|
191
|
-
const exists = await this.
|
|
195
|
+
const exists = await this.handlerAsUtility().utilityCheckNullifierExists(Fr.fromString(innerNullifier));
|
|
192
196
|
return [
|
|
193
197
|
toACVMField(exists)
|
|
194
198
|
];
|
|
195
199
|
}
|
|
196
200
|
async utilityGetL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
197
|
-
const message = await this.
|
|
201
|
+
const message = await this.handlerAsUtility().utilityGetL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
198
202
|
return message.toNoirRepresentation();
|
|
199
203
|
}
|
|
200
204
|
async utilityStorageRead([contractAddress], [startStorageSlot], [blockNumber], [numberOfElements]) {
|
|
201
|
-
const values = await this.
|
|
205
|
+
const values = await this.handlerAsUtility().utilityStorageRead(new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +blockNumber, +numberOfElements);
|
|
202
206
|
return [
|
|
203
207
|
values.map(toACVMField)
|
|
204
208
|
];
|
|
@@ -206,19 +210,20 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
206
210
|
privateNotifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
207
211
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
208
212
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
209
|
-
this.
|
|
213
|
+
this.handlerAsPrivate().privateNotifyCreatedContractClassLog(log, +counter);
|
|
210
214
|
return Promise.resolve([]);
|
|
211
215
|
}
|
|
212
|
-
utilityDebugLog(message, _ignoredFieldsSize, fields) {
|
|
216
|
+
utilityDebugLog(level, message, _ignoredFieldsSize, fields) {
|
|
217
|
+
const levelFr = Fr.fromString(level[0]);
|
|
213
218
|
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
214
219
|
const fieldsFr = fields.map(Fr.fromString);
|
|
215
|
-
this.
|
|
220
|
+
this.handlerAsMisc().utilityDebugLog(levelFr.toNumber(), messageStr, fieldsFr);
|
|
216
221
|
return Promise.resolve([]);
|
|
217
222
|
}
|
|
218
223
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
219
224
|
// change the name here.
|
|
220
225
|
async privateCallPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
221
|
-
const { endSideEffectCounter, returnsHash } = await this.
|
|
226
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().privateCallPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
222
227
|
return [
|
|
223
228
|
[
|
|
224
229
|
endSideEffectCounter,
|
|
@@ -227,43 +232,41 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
227
232
|
];
|
|
228
233
|
}
|
|
229
234
|
async privateNotifyEnqueuedPublicFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
230
|
-
await this.
|
|
235
|
+
await this.handlerAsPrivate().privateNotifyEnqueuedPublicFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
231
236
|
return [];
|
|
232
237
|
}
|
|
233
238
|
async privateNotifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
234
|
-
await this.
|
|
239
|
+
await this.handlerAsPrivate().privateNotifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
235
240
|
return [];
|
|
236
241
|
}
|
|
237
242
|
async privateNotifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]) {
|
|
238
|
-
await this.
|
|
243
|
+
await this.handlerAsPrivate().privateNotifySetMinRevertibleSideEffectCounter(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
239
244
|
return Promise.resolve([]);
|
|
240
245
|
}
|
|
241
|
-
async
|
|
242
|
-
const
|
|
243
|
-
return
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
await this.typedOracle.privateIncrementAppTaggingSecretIndexAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
247
|
-
return [];
|
|
246
|
+
async privateGetNextAppTagAsSender([sender], [recipient]) {
|
|
247
|
+
const tag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
248
|
+
return [
|
|
249
|
+
toACVMField(tag.value)
|
|
250
|
+
];
|
|
248
251
|
}
|
|
249
252
|
async utilityFetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
250
|
-
await this.
|
|
253
|
+
await this.handlerAsUtility().utilityFetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
251
254
|
return [];
|
|
252
255
|
}
|
|
253
256
|
async utilityValidateEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot]) {
|
|
254
|
-
await this.
|
|
257
|
+
await this.handlerAsUtility().utilityValidateEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot));
|
|
255
258
|
return [];
|
|
256
259
|
}
|
|
257
260
|
async utilityBulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
258
|
-
await this.
|
|
261
|
+
await this.handlerAsUtility().utilityBulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
259
262
|
return [];
|
|
260
263
|
}
|
|
261
264
|
async utilityStoreCapsule([contractAddress], [slot], capsule) {
|
|
262
|
-
await this.
|
|
265
|
+
await this.handlerAsUtility().utilityStoreCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
263
266
|
return [];
|
|
264
267
|
}
|
|
265
268
|
async utilityLoadCapsule([contractAddress], [slot], [tSize]) {
|
|
266
|
-
const values = await this.
|
|
269
|
+
const values = await this.handlerAsUtility().utilityLoadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
267
270
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
268
271
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
269
272
|
if (values === null) {
|
|
@@ -281,22 +284,22 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
281
284
|
}
|
|
282
285
|
}
|
|
283
286
|
async utilityDeleteCapsule([contractAddress], [slot]) {
|
|
284
|
-
await this.
|
|
287
|
+
await this.handlerAsUtility().utilityDeleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
285
288
|
return [];
|
|
286
289
|
}
|
|
287
290
|
async utilityCopyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
288
|
-
await this.
|
|
291
|
+
await this.handlerAsUtility().utilityCopyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
289
292
|
return [];
|
|
290
293
|
}
|
|
291
294
|
async utilityAes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
292
295
|
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
293
296
|
const ivBuffer = fromUintArray(iv, 8);
|
|
294
297
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
295
|
-
const plaintext = await this.
|
|
298
|
+
const plaintext = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
296
299
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
297
300
|
}
|
|
298
301
|
async utilityGetSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
299
|
-
const secret = await this.
|
|
302
|
+
const secret = await this.handlerAsUtility().utilityGetSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
300
303
|
ephPKField0,
|
|
301
304
|
ephPKField1,
|
|
302
305
|
ephPKField2
|
|
@@ -304,11 +307,11 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
304
307
|
return secret.toFields().map(toACVMField);
|
|
305
308
|
}
|
|
306
309
|
async utilityEmitOffchainEffect(data) {
|
|
307
|
-
await this.
|
|
310
|
+
await this.handlerAsPrivate().utilityEmitOffchainEffect(data.map(Fr.fromString));
|
|
308
311
|
return [];
|
|
309
312
|
}
|
|
310
313
|
async privateGetSenderForTags() {
|
|
311
|
-
const sender = await this.
|
|
314
|
+
const sender = await this.handlerAsPrivate().privateGetSenderForTags();
|
|
312
315
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
313
316
|
return sender ? [
|
|
314
317
|
toACVMField(1n),
|
|
@@ -319,7 +322,7 @@ import { packAsRetrievedNote } from './note_packing_utils.js';
|
|
|
319
322
|
];
|
|
320
323
|
}
|
|
321
324
|
async privateSetSenderForTags([senderForTags]) {
|
|
322
|
-
await this.
|
|
325
|
+
await this.handlerAsPrivate().privateSetSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
323
326
|
return [];
|
|
324
327
|
}
|
|
325
328
|
}
|
|
@@ -41,8 +41,8 @@ export declare function readCurrentClassId(contractAddress: AztecAddress, instan
|
|
|
41
41
|
* provider (i.e. PXE).
|
|
42
42
|
* @param contractAddress - The address of the contract to verify class id for.
|
|
43
43
|
* @param executionDataProvider - The execution data provider.
|
|
44
|
-
* @param header - The header of the block at which to verify the current class id. If not provided, the
|
|
45
|
-
*
|
|
44
|
+
* @param header - The header of the block at which to verify the current class id. If not provided, the anchor block
|
|
45
|
+
* header of the execution data provider is used.
|
|
46
46
|
*/
|
|
47
47
|
export declare function verifyCurrentClassId(contractAddress: AztecAddress, executionDataProvider: ExecutionDataProvider, header?: BlockHeader): Promise<void>;
|
|
48
48
|
//# sourceMappingURL=private_execution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAKtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gCAAgC,EACrC,KAAK,gBAAgB,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,gBAAgB,EAC3B,sBAAsB,EAAE,sBAAsB,EAC9C,QAAQ,EAAE,gCAAgC,EAC1C,eAAe,EAAE,YAAY,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,yCAA8C,GAChD,OAAO,CAAC,0BAA0B,CAAC,
|
|
1
|
+
{"version":3,"file":"private_execution.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAKtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gCAAgC,EACrC,KAAK,gBAAgB,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE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const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
54
54
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|
|
55
|
+
const preTags = privateExecutionOracle.getUsedPreTags();
|
|
55
56
|
const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
|
|
56
57
|
let timerSubtractionList = nestedExecutionResults;
|
|
57
58
|
let witgenTime = duration;
|
|
@@ -61,7 +62,7 @@ import { Oracle } from './oracle.js';
|
|
|
61
62
|
timerSubtractionList = timerSubtractionList.flatMap((nested)=>nested.nestedExecutionResults ?? []);
|
|
62
63
|
}
|
|
63
64
|
log.debug(`Returning from call to ${contractAddress.toString()}:${functionSelector}`);
|
|
64
|
-
return new PrivateCallExecutionResult(artifact.bytecode, Buffer.from(artifact.verificationKey, 'base64'), partialWitness, publicInputs, noteHashLeafIndexMap, newNotes, noteHashNullifierCounterMap, rawReturnValues, offchainEffects, nestedExecutionResults, contractClassLogs, {
|
|
65
|
+
return new PrivateCallExecutionResult(artifact.bytecode, Buffer.from(artifact.verificationKey, 'base64'), partialWitness, publicInputs, noteHashLeafIndexMap, newNotes, noteHashNullifierCounterMap, rawReturnValues, offchainEffects, preTags, nestedExecutionResults, contractClassLogs, {
|
|
65
66
|
timings: {
|
|
66
67
|
witgen: witgenTime,
|
|
67
68
|
oracles: acirExecutionResult.oracles
|
|
@@ -110,22 +111,12 @@ import { Oracle } from './oracle.js';
|
|
|
110
111
|
* provider (i.e. PXE).
|
|
111
112
|
* @param contractAddress - The address of the contract to verify class id for.
|
|
112
113
|
* @param executionDataProvider - The execution data provider.
|
|
113
|
-
* @param header - The header of the block at which to verify the current class id. If not provided, the
|
|
114
|
-
*
|
|
114
|
+
* @param header - The header of the block at which to verify the current class id. If not provided, the anchor block
|
|
115
|
+
* header of the execution data provider is used.
|
|
115
116
|
*/ export async function verifyCurrentClassId(contractAddress, executionDataProvider, header) {
|
|
116
|
-
|
|
117
|
-
let timestamp;
|
|
118
|
-
if (header) {
|
|
119
|
-
blockNumber = header.globalVariables.blockNumber;
|
|
120
|
-
timestamp = header.globalVariables.timestamp;
|
|
121
|
-
} else {
|
|
122
|
-
[blockNumber, timestamp] = await Promise.all([
|
|
123
|
-
executionDataProvider.getBlockNumber(),
|
|
124
|
-
executionDataProvider.getTimestamp()
|
|
125
|
-
]);
|
|
126
|
-
}
|
|
117
|
+
header = header ?? await executionDataProvider.getAnchorBlockHeader();
|
|
127
118
|
const instance = await executionDataProvider.getContractInstance(contractAddress);
|
|
128
|
-
const currentClassId = await readCurrentClassId(contractAddress, instance, executionDataProvider, blockNumber, timestamp);
|
|
119
|
+
const currentClassId = await readCurrentClassId(contractAddress, instance, executionDataProvider, header.globalVariables.blockNumber, header.globalVariables.timestamp);
|
|
129
120
|
if (!instance.currentContractClassId.equals(currentClassId)) {
|
|
130
121
|
throw new Error(`Contract ${contractAddress} is outdated, current class id is ${currentClassId}, local class id is ${instance.currentContractClassId}`);
|
|
131
122
|
}
|
|
@@ -3,29 +3,35 @@ import { type CircuitSimulator } from '@aztec/simulator/client';
|
|
|
3
3
|
import { type FunctionAbi, FunctionSelector, type NoteSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import
|
|
6
|
+
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
7
|
+
import type { ContractClassLog, PreTag } from '@aztec/stdlib/logs';
|
|
7
8
|
import { type NoteStatus } from '@aztec/stdlib/note';
|
|
8
9
|
import { type BlockHeader, CallContext, Capsule, CountedContractClassLog, NoteAndSlot, PrivateCallExecutionResult, type TxContext } from '@aztec/stdlib/tx';
|
|
10
|
+
import { Tag } from '../../tagging/tag.js';
|
|
9
11
|
import type { ExecutionDataProvider } from '../execution_data_provider.js';
|
|
10
12
|
import type { ExecutionNoteCache } from '../execution_note_cache.js';
|
|
13
|
+
import { ExecutionTaggingIndexCache } from '../execution_tagging_index_cache.js';
|
|
11
14
|
import type { HashedValuesCache } from '../hashed_values_cache.js';
|
|
12
|
-
import type { NoteData } from './
|
|
15
|
+
import type { IPrivateExecutionOracle, NoteData } from './interfaces.js';
|
|
13
16
|
import { UtilityExecutionOracle } from './utility_execution_oracle.js';
|
|
14
17
|
/**
|
|
15
18
|
* The execution oracle for the private part of a transaction.
|
|
16
19
|
*/
|
|
17
|
-
export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
20
|
+
export declare class PrivateExecutionOracle extends UtilityExecutionOracle implements IPrivateExecutionOracle {
|
|
18
21
|
#private;
|
|
19
22
|
private readonly argsHash;
|
|
20
23
|
private readonly txContext;
|
|
21
24
|
private readonly callContext;
|
|
22
25
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
23
|
-
protected readonly
|
|
26
|
+
protected readonly anchorBlockHeader: BlockHeader;
|
|
24
27
|
private readonly executionCache;
|
|
25
28
|
private readonly noteCache;
|
|
26
|
-
private
|
|
29
|
+
private readonly taggingIndexCache;
|
|
27
30
|
private totalPublicCalldataCount;
|
|
28
31
|
protected sideEffectCounter: number;
|
|
32
|
+
private senderForTags?;
|
|
33
|
+
private simulator?;
|
|
34
|
+
isPrivate: true;
|
|
29
35
|
/**
|
|
30
36
|
* New notes created during this execution.
|
|
31
37
|
* It's possible that a note in this list has been nullified (in the same or other executions) and doesn't exist in
|
|
@@ -49,12 +55,12 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
49
55
|
private contractClassLogs;
|
|
50
56
|
private offchainEffects;
|
|
51
57
|
private nestedExecutionResults;
|
|
52
|
-
private senderForTags?;
|
|
53
58
|
constructor(argsHash: Fr, txContext: TxContext, callContext: CallContext,
|
|
54
59
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
55
|
-
|
|
60
|
+
anchorBlockHeader: BlockHeader,
|
|
56
61
|
/** List of transient auth witnesses to be used during this simulation */
|
|
57
|
-
authWitnesses: AuthWitness[], capsules: Capsule[], executionCache: HashedValuesCache, noteCache: ExecutionNoteCache,
|
|
62
|
+
authWitnesses: AuthWitness[], capsules: Capsule[], executionCache: HashedValuesCache, noteCache: ExecutionNoteCache, taggingIndexCache: ExecutionTaggingIndexCache, executionDataProvider: ExecutionDataProvider, totalPublicCalldataCount?: number, sideEffectCounter?: number, log?: import("@aztec/foundation/log").Logger, scopes?: AztecAddress[], senderForTags?: AztecAddress | undefined, simulator?: CircuitSimulator | undefined);
|
|
63
|
+
getPrivateContextInputs(): PrivateContextInputs;
|
|
58
64
|
/**
|
|
59
65
|
* Writes the function inputs to the initial witness.
|
|
60
66
|
* @param abi - The function ABI.
|
|
@@ -81,6 +87,10 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
81
87
|
getOffchainEffects(): {
|
|
82
88
|
data: Fr[];
|
|
83
89
|
}[];
|
|
90
|
+
/**
|
|
91
|
+
* Returns the pre tags that were used in this execution (and that need to be stored in the db).
|
|
92
|
+
*/
|
|
93
|
+
getUsedPreTags(): PreTag[];
|
|
84
94
|
/**
|
|
85
95
|
* Return the nested execution results during this execution.
|
|
86
96
|
*/
|
|
@@ -108,6 +118,13 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
108
118
|
* value (unless it is replaced by another call to this setter).
|
|
109
119
|
*/
|
|
110
120
|
privateSetSenderForTags(senderForTags: AztecAddress): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Returns the next app tag for a given sender and recipient pair.
|
|
123
|
+
* @param sender - The address sending the log
|
|
124
|
+
* @param recipient - The address receiving the log
|
|
125
|
+
* @returns An app tag to be used in a log.
|
|
126
|
+
*/
|
|
127
|
+
privateGetNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag>;
|
|
111
128
|
/**
|
|
112
129
|
* Store values in the execution cache.
|
|
113
130
|
* @param values - Values to store.
|
|
@@ -120,6 +137,7 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
120
137
|
* @returns The values.
|
|
121
138
|
*/
|
|
122
139
|
privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]>;
|
|
140
|
+
utilityCheckNullifierExists(innerNullifier: Fr): Promise<boolean>;
|
|
123
141
|
/**
|
|
124
142
|
* Gets some notes for a storage slot.
|
|
125
143
|
*
|
|
@@ -213,8 +231,6 @@ export declare class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
213
231
|
*/
|
|
214
232
|
private deriveCallContext;
|
|
215
233
|
getDebugFunctionName(): Promise<string>;
|
|
216
|
-
privateIncrementAppTaggingSecretIndexAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<void>;
|
|
217
|
-
utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr): Promise<void>;
|
|
218
234
|
utilityEmitOffchainEffect(data: Fr[]): Promise<void>;
|
|
219
235
|
}
|
|
220
236
|
//# sourceMappingURL=private_execution_oracle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution_oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACL,KAAK,WAAW,EAEhB,gBAAgB,EAChB,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"private_execution_oracle.d.ts","sourceRoot":"","sources":["../../../src/contract_function_simulator/oracle/private_execution_oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,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