@aztec/pxe 0.0.1-commit.29c6b1a3 → 0.0.1-commit.2c85e299c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +9 -3
- package/dest/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +54 -30
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +177 -73
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- 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/oracle/interfaces.d.ts +49 -45
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +156 -101
- package/dest/contract_function_simulator/oracle/private_execution.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +55 -55
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +101 -56
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +77 -51
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +116 -94
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +43 -0
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
- package/dest/contract_sync/contract_sync_service.js +97 -0
- package/dest/contract_sync/helpers.d.ts +29 -0
- package/dest/contract_sync/helpers.d.ts.map +1 -0
- package/dest/contract_sync/{index.js → helpers.js} +13 -12
- package/dest/debug/pxe_debug_utils.d.ts +14 -10
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +16 -15
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +21 -7
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +22 -8
- package/dest/entrypoints/pxe_creation_options.d.ts +3 -2
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +4 -2
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +3 -1
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +28 -9
- package/dest/events/event_service.d.ts +4 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +5 -6
- package/dest/job_coordinator/job_coordinator.d.ts +3 -2
- package/dest/job_coordinator/job_coordinator.d.ts.map +1 -1
- package/dest/job_coordinator/job_coordinator.js +3 -2
- package/dest/logs/log_service.d.ts +7 -5
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +19 -29
- package/dest/notes/note_service.d.ts +7 -7
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +9 -9
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/oracle_version.d.ts +3 -3
- package/dest/oracle_version.d.ts.map +1 -1
- package/dest/oracle_version.js +3 -3
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +3 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +21 -13
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +71 -24
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +104 -66
- package/dest/storage/address_store/address_store.d.ts +1 -1
- package/dest/storage/address_store/address_store.d.ts.map +1 -1
- package/dest/storage/address_store/address_store.js +12 -11
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts +9 -1
- package/dest/storage/anchor_block_store/anchor_block_store.d.ts.map +1 -1
- package/dest/storage/anchor_block_store/anchor_block_store.js +8 -1
- package/dest/storage/capsule_store/capsule_store.js +6 -8
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +157 -72
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/note_store/note_store.d.ts +13 -3
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +147 -107
- package/dest/storage/private_event_store/private_event_store.d.ts +1 -1
- package/dest/storage/private_event_store/private_event_store.d.ts.map +1 -1
- package/dest/storage/private_event_store/private_event_store.js +84 -61
- package/dest/storage/private_event_store/stored_private_event.js +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/recipient_tagging_store.js +31 -19
- package/dest/storage/tagging_store/sender_address_book_store.d.ts +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_address_book_store.js +20 -14
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +184 -114
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
- package/package.json +25 -16
- package/src/access_scopes.ts +9 -0
- package/src/block_synchronizer/block_synchronizer.ts +21 -12
- package/src/config/index.ts +1 -1
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +326 -131
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/interfaces.ts +53 -50
- package/src/contract_function_simulator/oracle/oracle.ts +157 -112
- package/src/contract_function_simulator/oracle/private_execution.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +127 -137
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +167 -105
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +152 -0
- package/src/contract_sync/{index.ts → helpers.ts} +21 -21
- package/src/debug/pxe_debug_utils.ts +48 -18
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/bundle/utils.ts +16 -15
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/client/lazy/utils.ts +17 -15
- package/src/entrypoints/pxe_creation_options.ts +2 -1
- package/src/entrypoints/server/index.ts +3 -1
- package/src/entrypoints/server/utils.ts +22 -26
- package/src/events/event_service.ts +4 -6
- package/src/job_coordinator/job_coordinator.ts +4 -3
- package/src/logs/log_service.ts +31 -38
- package/src/notes/note_service.ts +9 -10
- package/src/notes_filter.ts +26 -0
- package/src/oracle_version.ts +3 -3
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +25 -15
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +197 -118
- package/src/storage/address_store/address_store.ts +15 -15
- package/src/storage/anchor_block_store/anchor_block_store.ts +8 -0
- package/src/storage/capsule_store/capsule_store.ts +8 -8
- package/src/storage/contract_store/contract_store.ts +186 -76
- package/src/storage/metadata.ts +1 -1
- package/src/storage/note_store/note_store.ts +169 -132
- package/src/storage/private_event_store/private_event_store.ts +102 -81
- package/src/storage/private_event_store/stored_private_event.ts +1 -1
- package/src/storage/tagging_store/recipient_tagging_store.ts +38 -24
- package/src/storage/tagging_store/sender_address_book_store.ts +20 -14
- package/src/storage/tagging_store/sender_tagging_store.ts +214 -130
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
- package/dest/contract_sync/index.d.ts +0 -23
- package/dest/contract_sync/index.d.ts.map +0 -1
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
|
@@ -48,11 +48,11 @@ export class UnavailableOracleError extends Error {
|
|
|
48
48
|
];
|
|
49
49
|
// Get all the oracle function names
|
|
50
50
|
const oracleNames = Object.getOwnPropertyNames(Oracle.prototype).filter((name)=>!excludedProps.includes(name));
|
|
51
|
-
// Validate oracle names - these must be prefixed with either "
|
|
51
|
+
// Validate oracle names - these must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate their scope
|
|
52
52
|
// and must correspond to a function on the Oracle class.
|
|
53
53
|
oracleNames.forEach((name)=>{
|
|
54
|
-
if (!name.startsWith('
|
|
55
|
-
throw new Error(`Oracle function "${name}" must be prefixed with either "
|
|
54
|
+
if (!name.startsWith('aztec_prv_') && !name.startsWith('aztec_utl_')) {
|
|
55
|
+
throw new Error(`Oracle function "${name}" must be prefixed with either "aztec_prv_" or "aztec_utl_" to indicate its scope`);
|
|
56
56
|
}
|
|
57
57
|
const method = this[name];
|
|
58
58
|
if (typeof method !== 'function') {
|
|
@@ -66,36 +66,43 @@ export class UnavailableOracleError extends Error {
|
|
|
66
66
|
return acc;
|
|
67
67
|
}, {});
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// eslint-disable-next-line camelcase
|
|
70
|
+
aztec_utl_assertCompatibleOracleVersion([version]) {
|
|
71
|
+
this.handlerAsMisc().assertCompatibleOracleVersion(Fr.fromString(version).toNumber());
|
|
71
72
|
return Promise.resolve([]);
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
// eslint-disable-next-line camelcase
|
|
75
|
+
aztec_utl_getRandomField() {
|
|
76
|
+
const val = this.handlerAsMisc().getRandomField();
|
|
75
77
|
return Promise.resolve([
|
|
76
78
|
toACVMField(val)
|
|
77
79
|
]);
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
// eslint-disable-next-line camelcase
|
|
82
|
+
aztec_prv_storeInExecutionCache(values, [hash]) {
|
|
83
|
+
this.handlerAsPrivate().storeInExecutionCache(values.map(Fr.fromString), Fr.fromString(hash));
|
|
81
84
|
return Promise.resolve([]);
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
// eslint-disable-next-line camelcase
|
|
87
|
+
async aztec_prv_loadFromExecutionCache([returnsHash]) {
|
|
88
|
+
const values = await this.handlerAsPrivate().loadFromExecutionCache(Fr.fromString(returnsHash));
|
|
85
89
|
return [
|
|
86
90
|
values.map(toACVMField)
|
|
87
91
|
];
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
// eslint-disable-next-line camelcase
|
|
94
|
+
aztec_utl_getUtilityContext() {
|
|
95
|
+
const context = this.handlerAsUtility().getUtilityContext();
|
|
91
96
|
return Promise.resolve(context.toNoirRepresentation());
|
|
92
97
|
}
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
// eslint-disable-next-line camelcase
|
|
99
|
+
async aztec_utl_getKeyValidationRequest([pkMHash]) {
|
|
100
|
+
const keyValidationRequest = await this.handlerAsUtility().getKeyValidationRequest(Fr.fromString(pkMHash));
|
|
95
101
|
return keyValidationRequest.toFields().map(toACVMField);
|
|
96
102
|
}
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
// eslint-disable-next-line camelcase
|
|
104
|
+
async aztec_utl_getContractInstance([address]) {
|
|
105
|
+
const instance = await this.handlerAsUtility().getContractInstance(AztecAddress.fromField(Fr.fromString(address)));
|
|
99
106
|
return [
|
|
100
107
|
instance.salt,
|
|
101
108
|
instance.deployer,
|
|
@@ -104,62 +111,69 @@ export class UnavailableOracleError extends Error {
|
|
|
104
111
|
...instance.publicKeys.toFields()
|
|
105
112
|
].map(toACVMField);
|
|
106
113
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
114
|
+
// eslint-disable-next-line camelcase
|
|
115
|
+
async aztec_utl_getNoteHashMembershipWitness([anchorBlockHash], [noteHash]) {
|
|
116
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
117
|
+
const parsedNoteHash = Fr.fromString(noteHash);
|
|
118
|
+
const witness = await this.handlerAsUtility().getNoteHashMembershipWitness(parsedAnchorBlockHash, parsedNoteHash);
|
|
111
119
|
if (!witness) {
|
|
112
|
-
throw new Error(`
|
|
120
|
+
throw new Error(`Note hash ${noteHash} not found in the note hash tree at anchor block hash ${parsedAnchorBlockHash.toString()}.`);
|
|
113
121
|
}
|
|
114
122
|
return witness.toNoirRepresentation();
|
|
115
123
|
}
|
|
116
|
-
|
|
124
|
+
// eslint-disable-next-line camelcase
|
|
125
|
+
async aztec_utl_getBlockHashMembershipWitness([anchorBlockHash], [blockHash]) {
|
|
126
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
117
127
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
118
|
-
const
|
|
119
|
-
const witness = await this.handlerAsUtility().utilityGetArchiveMembershipWitness(parsedBlockHash, parsedLeafValue);
|
|
128
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
120
129
|
if (!witness) {
|
|
121
|
-
throw new Error(`
|
|
130
|
+
throw new Error(`Block hash ${parsedBlockHash.toString()} not found in the archive tree at anchor block ${parsedAnchorBlockHash.toString()}.`);
|
|
122
131
|
}
|
|
123
132
|
return witness.toNoirRepresentation();
|
|
124
133
|
}
|
|
125
|
-
|
|
134
|
+
// eslint-disable-next-line camelcase
|
|
135
|
+
async aztec_utl_getNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
126
136
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
127
137
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
128
|
-
const witness = await this.handlerAsUtility().
|
|
138
|
+
const witness = await this.handlerAsUtility().getNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
129
139
|
if (!witness) {
|
|
130
140
|
throw new Error(`Nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
131
141
|
}
|
|
132
142
|
return witness.toNoirRepresentation();
|
|
133
143
|
}
|
|
134
|
-
|
|
144
|
+
// eslint-disable-next-line camelcase
|
|
145
|
+
async aztec_utl_getLowNullifierMembershipWitness([blockHash], [nullifier]) {
|
|
135
146
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
136
147
|
const parsedNullifier = Fr.fromString(nullifier);
|
|
137
|
-
const witness = await this.handlerAsUtility().
|
|
148
|
+
const witness = await this.handlerAsUtility().getLowNullifierMembershipWitness(parsedBlockHash, parsedNullifier);
|
|
138
149
|
if (!witness) {
|
|
139
150
|
throw new Error(`Low nullifier witness not found for nullifier ${parsedNullifier} at block hash ${parsedBlockHash.toString()}.`);
|
|
140
151
|
}
|
|
141
152
|
return witness.toNoirRepresentation();
|
|
142
153
|
}
|
|
143
|
-
|
|
154
|
+
// eslint-disable-next-line camelcase
|
|
155
|
+
async aztec_utl_getPublicDataWitness([blockHash], [leafSlot]) {
|
|
144
156
|
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
145
157
|
const parsedLeafSlot = Fr.fromString(leafSlot);
|
|
146
|
-
const witness = await this.handlerAsUtility().
|
|
158
|
+
const witness = await this.handlerAsUtility().getPublicDataWitness(parsedBlockHash, parsedLeafSlot);
|
|
147
159
|
if (!witness) {
|
|
148
160
|
throw new Error(`Public data witness not found for slot ${parsedLeafSlot} at block hash ${parsedBlockHash.toString()}.`);
|
|
149
161
|
}
|
|
150
162
|
return witness.toNoirRepresentation();
|
|
151
163
|
}
|
|
152
|
-
|
|
164
|
+
// eslint-disable-next-line camelcase
|
|
165
|
+
async aztec_utl_getBlockHeader([blockNumber]) {
|
|
153
166
|
const parsedBlockNumber = Fr.fromString(blockNumber).toNumber();
|
|
154
|
-
const header = await this.handlerAsUtility().
|
|
167
|
+
const header = await this.handlerAsUtility().getBlockHeader(BlockNumber(parsedBlockNumber));
|
|
155
168
|
if (!header) {
|
|
156
169
|
throw new Error(`Block header not found for block ${parsedBlockNumber}.`);
|
|
157
170
|
}
|
|
158
171
|
return header.toFields().map(toACVMField);
|
|
159
172
|
}
|
|
160
|
-
|
|
173
|
+
// eslint-disable-next-line camelcase
|
|
174
|
+
async aztec_utl_getAuthWitness([messageHash]) {
|
|
161
175
|
const messageHashField = Fr.fromString(messageHash);
|
|
162
|
-
const witness = await this.handlerAsUtility().
|
|
176
|
+
const witness = await this.handlerAsUtility().getAuthWitness(messageHashField);
|
|
163
177
|
if (!witness) {
|
|
164
178
|
throw new Error(`Unknown auth witness for message hash ${messageHashField}`);
|
|
165
179
|
}
|
|
@@ -167,20 +181,34 @@ export class UnavailableOracleError extends Error {
|
|
|
167
181
|
witness.map(toACVMField)
|
|
168
182
|
];
|
|
169
183
|
}
|
|
170
|
-
|
|
184
|
+
// eslint-disable-next-line camelcase
|
|
185
|
+
async aztec_utl_tryGetPublicKeysAndPartialAddress([address]) {
|
|
171
186
|
const parsedAddress = AztecAddress.fromField(Fr.fromString(address));
|
|
172
|
-
const
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(parsedAddress);
|
|
188
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
189
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
190
|
+
if (result === undefined) {
|
|
191
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
192
|
+
return [
|
|
193
|
+
toACVMField(0),
|
|
194
|
+
Array(13).fill(toACVMField(0))
|
|
195
|
+
];
|
|
196
|
+
} else {
|
|
197
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
198
|
+
return [
|
|
199
|
+
toACVMField(1),
|
|
200
|
+
[
|
|
201
|
+
...result.publicKeys.toFields(),
|
|
202
|
+
result.partialAddress
|
|
203
|
+
].map(toACVMField)
|
|
204
|
+
];
|
|
205
|
+
}
|
|
179
206
|
}
|
|
180
|
-
|
|
207
|
+
// eslint-disable-next-line camelcase
|
|
208
|
+
async aztec_utl_getNotes([ownerSome], [ownerValue], [storageSlot], [numSelects], selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, [limit], [offset], [status], [maxNotes], [packedHintedNoteLength]) {
|
|
181
209
|
// Parse Option<AztecAddress>: ownerSome is 0 for None, 1 for Some
|
|
182
210
|
const owner = Fr.fromString(ownerSome).toNumber() === 1 ? AztecAddress.fromString(ownerValue) : undefined;
|
|
183
|
-
const noteDatas = await this.handlerAsUtility().
|
|
211
|
+
const noteDatas = await this.handlerAsUtility().getNotes(owner, 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);
|
|
184
212
|
const returnDataAsArrayOfPackedHintedNotes = noteDatas.map((noteData)=>packAsHintedNote({
|
|
185
213
|
contractAddress: noteData.contractAddress,
|
|
186
214
|
owner: noteData.owner,
|
|
@@ -195,57 +223,67 @@ export class UnavailableOracleError extends Error {
|
|
|
195
223
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
196
224
|
return arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfACVMFieldArrays, +maxNotes, +packedHintedNoteLength);
|
|
197
225
|
}
|
|
198
|
-
|
|
199
|
-
|
|
226
|
+
// eslint-disable-next-line camelcase
|
|
227
|
+
aztec_prv_notifyCreatedNote([owner], [storageSlot], [randomness], [noteTypeId], note, [noteHash], [counter]) {
|
|
228
|
+
this.handlerAsPrivate().notifyCreatedNote(AztecAddress.fromString(owner), Fr.fromString(storageSlot), Fr.fromString(randomness), NoteSelector.fromField(Fr.fromString(noteTypeId)), note.map(Fr.fromString), Fr.fromString(noteHash), +counter);
|
|
200
229
|
return Promise.resolve([]);
|
|
201
230
|
}
|
|
202
|
-
|
|
203
|
-
|
|
231
|
+
// eslint-disable-next-line camelcase
|
|
232
|
+
async aztec_prv_notifyNullifiedNote([innerNullifier], [noteHash], [counter]) {
|
|
233
|
+
await this.handlerAsPrivate().notifyNullifiedNote(Fr.fromString(innerNullifier), Fr.fromString(noteHash), +counter);
|
|
204
234
|
return [];
|
|
205
235
|
}
|
|
206
|
-
|
|
207
|
-
|
|
236
|
+
// eslint-disable-next-line camelcase
|
|
237
|
+
async aztec_prv_notifyCreatedNullifier([innerNullifier]) {
|
|
238
|
+
await this.handlerAsPrivate().notifyCreatedNullifier(Fr.fromString(innerNullifier));
|
|
208
239
|
return [];
|
|
209
240
|
}
|
|
210
|
-
|
|
211
|
-
|
|
241
|
+
// eslint-disable-next-line camelcase
|
|
242
|
+
async aztec_prv_isNullifierPending([innerNullifier], [contractAddress]) {
|
|
243
|
+
const isPending = await this.handlerAsPrivate().isNullifierPending(Fr.fromString(innerNullifier), AztecAddress.fromString(contractAddress));
|
|
212
244
|
return [
|
|
213
245
|
toACVMField(isPending)
|
|
214
246
|
];
|
|
215
247
|
}
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
// eslint-disable-next-line camelcase
|
|
249
|
+
async aztec_utl_checkNullifierExists([innerNullifier]) {
|
|
250
|
+
const exists = await this.handlerAsUtility().checkNullifierExists(Fr.fromString(innerNullifier));
|
|
218
251
|
return [
|
|
219
252
|
toACVMField(exists)
|
|
220
253
|
];
|
|
221
254
|
}
|
|
222
|
-
|
|
223
|
-
|
|
255
|
+
// eslint-disable-next-line camelcase
|
|
256
|
+
async aztec_utl_getL1ToL2MembershipWitness([contractAddress], [messageHash], [secret]) {
|
|
257
|
+
const message = await this.handlerAsUtility().getL1ToL2MembershipWitness(AztecAddress.fromString(contractAddress), Fr.fromString(messageHash), Fr.fromString(secret));
|
|
224
258
|
return message.toNoirRepresentation();
|
|
225
259
|
}
|
|
226
|
-
|
|
227
|
-
|
|
260
|
+
// eslint-disable-next-line camelcase
|
|
261
|
+
async aztec_utl_storageRead([blockHash], [contractAddress], [startStorageSlot], [numberOfElements]) {
|
|
262
|
+
const values = await this.handlerAsUtility().storageRead(BlockHash.fromString(blockHash), new AztecAddress(Fr.fromString(contractAddress)), Fr.fromString(startStorageSlot), +numberOfElements);
|
|
228
263
|
return [
|
|
229
264
|
values.map(toACVMField)
|
|
230
265
|
];
|
|
231
266
|
}
|
|
232
|
-
|
|
267
|
+
// eslint-disable-next-line camelcase
|
|
268
|
+
aztec_prv_notifyCreatedContractClassLog([contractAddress], message, [length], [counter]) {
|
|
233
269
|
const logFields = new ContractClassLogFields(message.map(Fr.fromString));
|
|
234
270
|
const log = new ContractClassLog(new AztecAddress(Fr.fromString(contractAddress)), logFields, +length);
|
|
235
|
-
this.handlerAsPrivate().
|
|
271
|
+
this.handlerAsPrivate().notifyCreatedContractClassLog(log, +counter);
|
|
236
272
|
return Promise.resolve([]);
|
|
237
273
|
}
|
|
238
|
-
|
|
274
|
+
// eslint-disable-next-line camelcase
|
|
275
|
+
async aztec_utl_log(level, message, _ignoredFieldsSize, fields) {
|
|
239
276
|
const levelFr = Fr.fromString(level[0]);
|
|
240
277
|
const messageStr = message.map((acvmField)=>String.fromCharCode(Fr.fromString(acvmField).toNumber())).join('');
|
|
241
278
|
const fieldsFr = fields.map(Fr.fromString);
|
|
242
|
-
this.handlerAsMisc().
|
|
243
|
-
return
|
|
279
|
+
await this.handlerAsMisc().log(levelFr.toNumber(), messageStr, fieldsFr);
|
|
280
|
+
return [];
|
|
244
281
|
}
|
|
245
282
|
// This function's name is directly hardcoded in `circuit_recorder.ts`. Don't forget to update it there if you
|
|
246
283
|
// change the name here.
|
|
247
|
-
|
|
248
|
-
|
|
284
|
+
// eslint-disable-next-line camelcase
|
|
285
|
+
async aztec_prv_callPrivateFunction([contractAddress], [functionSelector], [argsHash], [sideEffectCounter], [isStaticCall]) {
|
|
286
|
+
const { endSideEffectCounter, returnsHash } = await this.handlerAsPrivate().callPrivateFunction(AztecAddress.fromField(Fr.fromString(contractAddress)), FunctionSelector.fromField(Fr.fromString(functionSelector)), Fr.fromString(argsHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
249
287
|
return [
|
|
250
288
|
[
|
|
251
289
|
endSideEffectCounter,
|
|
@@ -253,48 +291,58 @@ export class UnavailableOracleError extends Error {
|
|
|
253
291
|
].map(toACVMField)
|
|
254
292
|
];
|
|
255
293
|
}
|
|
256
|
-
|
|
257
|
-
|
|
294
|
+
// eslint-disable-next-line camelcase
|
|
295
|
+
async aztec_prv_notifyEnqueuedPublicFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
296
|
+
await this.handlerAsPrivate().notifyEnqueuedPublicFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
258
297
|
return [];
|
|
259
298
|
}
|
|
260
|
-
|
|
261
|
-
|
|
299
|
+
// eslint-disable-next-line camelcase
|
|
300
|
+
async aztec_prv_notifySetPublicTeardownFunctionCall([contractAddress], [calldataHash], [sideEffectCounter], [isStaticCall]) {
|
|
301
|
+
await this.handlerAsPrivate().notifySetPublicTeardownFunctionCall(AztecAddress.fromString(contractAddress), Fr.fromString(calldataHash), Fr.fromString(sideEffectCounter).toNumber(), Fr.fromString(isStaticCall).toBool());
|
|
262
302
|
return [];
|
|
263
303
|
}
|
|
264
|
-
|
|
265
|
-
|
|
304
|
+
// eslint-disable-next-line camelcase
|
|
305
|
+
async aztec_prv_notifySetMinRevertibleSideEffectCounter([minRevertibleSideEffectCounter]) {
|
|
306
|
+
await this.handlerAsPrivate().notifySetMinRevertibleSideEffectCounter(Fr.fromString(minRevertibleSideEffectCounter).toNumber());
|
|
266
307
|
return Promise.resolve([]);
|
|
267
308
|
}
|
|
268
|
-
|
|
269
|
-
|
|
309
|
+
// eslint-disable-next-line camelcase
|
|
310
|
+
async aztec_prv_isSideEffectCounterRevertible([sideEffectCounter]) {
|
|
311
|
+
const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(Fr.fromString(sideEffectCounter).toNumber());
|
|
270
312
|
return Promise.resolve([
|
|
271
313
|
toACVMField(isRevertible)
|
|
272
314
|
]);
|
|
273
315
|
}
|
|
274
|
-
|
|
275
|
-
|
|
316
|
+
// eslint-disable-next-line camelcase
|
|
317
|
+
async aztec_prv_getNextAppTagAsSender([sender], [recipient]) {
|
|
318
|
+
const tag = await this.handlerAsPrivate().getNextAppTagAsSender(AztecAddress.fromString(sender), AztecAddress.fromString(recipient));
|
|
276
319
|
return [
|
|
277
320
|
toACVMField(tag.value)
|
|
278
321
|
];
|
|
279
322
|
}
|
|
280
|
-
|
|
281
|
-
|
|
323
|
+
// eslint-disable-next-line camelcase
|
|
324
|
+
async aztec_utl_fetchTaggedLogs([pendingTaggedLogArrayBaseSlot]) {
|
|
325
|
+
await this.handlerAsUtility().fetchTaggedLogs(Fr.fromString(pendingTaggedLogArrayBaseSlot));
|
|
282
326
|
return [];
|
|
283
327
|
}
|
|
284
|
-
|
|
285
|
-
|
|
328
|
+
// eslint-disable-next-line camelcase
|
|
329
|
+
async aztec_utl_validateAndStoreEnqueuedNotesAndEvents([contractAddress], [noteValidationRequestsArrayBaseSlot], [eventValidationRequestsArrayBaseSlot]) {
|
|
330
|
+
await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(AztecAddress.fromString(contractAddress), Fr.fromString(noteValidationRequestsArrayBaseSlot), Fr.fromString(eventValidationRequestsArrayBaseSlot));
|
|
286
331
|
return [];
|
|
287
332
|
}
|
|
288
|
-
|
|
289
|
-
|
|
333
|
+
// eslint-disable-next-line camelcase
|
|
334
|
+
async aztec_utl_bulkRetrieveLogs([contractAddress], [logRetrievalRequestsArrayBaseSlot], [logRetrievalResponsesArrayBaseSlot]) {
|
|
335
|
+
await this.handlerAsUtility().bulkRetrieveLogs(AztecAddress.fromString(contractAddress), Fr.fromString(logRetrievalRequestsArrayBaseSlot), Fr.fromString(logRetrievalResponsesArrayBaseSlot));
|
|
290
336
|
return [];
|
|
291
337
|
}
|
|
292
|
-
|
|
293
|
-
|
|
338
|
+
// eslint-disable-next-line camelcase
|
|
339
|
+
async aztec_utl_storeCapsule([contractAddress], [slot], capsule) {
|
|
340
|
+
await this.handlerAsUtility().storeCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot), capsule.map(Fr.fromString));
|
|
294
341
|
return [];
|
|
295
342
|
}
|
|
296
|
-
|
|
297
|
-
|
|
343
|
+
// eslint-disable-next-line camelcase
|
|
344
|
+
async aztec_utl_loadCapsule([contractAddress], [slot], [tSize]) {
|
|
345
|
+
const values = await this.handlerAsUtility().loadCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
298
346
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
299
347
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
300
348
|
if (values === null) {
|
|
@@ -311,35 +359,41 @@ export class UnavailableOracleError extends Error {
|
|
|
311
359
|
];
|
|
312
360
|
}
|
|
313
361
|
}
|
|
314
|
-
|
|
315
|
-
|
|
362
|
+
// eslint-disable-next-line camelcase
|
|
363
|
+
async aztec_utl_deleteCapsule([contractAddress], [slot]) {
|
|
364
|
+
await this.handlerAsUtility().deleteCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(slot));
|
|
316
365
|
return [];
|
|
317
366
|
}
|
|
318
|
-
|
|
319
|
-
|
|
367
|
+
// eslint-disable-next-line camelcase
|
|
368
|
+
async aztec_utl_copyCapsule([contractAddress], [srcSlot], [dstSlot], [numEntries]) {
|
|
369
|
+
await this.handlerAsUtility().copyCapsule(AztecAddress.fromField(Fr.fromString(contractAddress)), Fr.fromString(srcSlot), Fr.fromString(dstSlot), Fr.fromString(numEntries).toNumber());
|
|
320
370
|
return [];
|
|
321
371
|
}
|
|
322
|
-
|
|
372
|
+
// eslint-disable-next-line camelcase
|
|
373
|
+
async aztec_utl_aes128Decrypt(ciphertextBVecStorage, [ciphertextLength], iv, symKey) {
|
|
323
374
|
const ciphertext = fromUintBoundedVec(ciphertextBVecStorage, ciphertextLength, 8);
|
|
324
375
|
const ivBuffer = fromUintArray(iv, 8);
|
|
325
376
|
const symKeyBuffer = fromUintArray(symKey, 8);
|
|
326
|
-
const plaintext = await this.handlerAsUtility().
|
|
377
|
+
const plaintext = await this.handlerAsUtility().aes128Decrypt(ciphertext, ivBuffer, symKeyBuffer);
|
|
327
378
|
return bufferToBoundedVec(plaintext, ciphertextBVecStorage.length);
|
|
328
379
|
}
|
|
329
|
-
|
|
330
|
-
|
|
380
|
+
// eslint-disable-next-line camelcase
|
|
381
|
+
async aztec_utl_getSharedSecret([address], [ephPKField0], [ephPKField1], [ephPKField2]) {
|
|
382
|
+
const secret = await this.handlerAsUtility().getSharedSecret(AztecAddress.fromField(Fr.fromString(address)), Point.fromFields([
|
|
331
383
|
ephPKField0,
|
|
332
384
|
ephPKField1,
|
|
333
385
|
ephPKField2
|
|
334
386
|
].map(Fr.fromString)));
|
|
335
387
|
return secret.toFields().map(toACVMField);
|
|
336
388
|
}
|
|
337
|
-
|
|
338
|
-
|
|
389
|
+
// eslint-disable-next-line camelcase
|
|
390
|
+
async aztec_utl_emitOffchainEffect(data) {
|
|
391
|
+
await this.handlerAsPrivate().emitOffchainEffect(data.map(Fr.fromString));
|
|
339
392
|
return [];
|
|
340
393
|
}
|
|
341
|
-
|
|
342
|
-
|
|
394
|
+
// eslint-disable-next-line camelcase
|
|
395
|
+
async aztec_prv_getSenderForTags() {
|
|
396
|
+
const sender = await this.handlerAsPrivate().getSenderForTags();
|
|
343
397
|
// Return [1, address] for Some(address), [0, 0] for None
|
|
344
398
|
return sender ? [
|
|
345
399
|
toACVMField(1n),
|
|
@@ -349,8 +403,9 @@ export class UnavailableOracleError extends Error {
|
|
|
349
403
|
toACVMField(0n)
|
|
350
404
|
];
|
|
351
405
|
}
|
|
352
|
-
|
|
353
|
-
|
|
406
|
+
// eslint-disable-next-line camelcase
|
|
407
|
+
async aztec_prv_setSenderForTags([senderForTags]) {
|
|
408
|
+
await this.handlerAsPrivate().setSenderForTags(AztecAddress.fromField(Fr.fromString(senderForTags)));
|
|
354
409
|
return [];
|
|
355
410
|
}
|
|
356
411
|
}
|
|
@@ -45,7 +45,7 @@ import { Oracle } from './oracle.js';
|
|
|
45
45
|
appCircuitName: functionName
|
|
46
46
|
});
|
|
47
47
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
48
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
48
|
+
const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
|
|
49
49
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
50
50
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
51
51
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|