@aztec/txe 0.0.0-test.1 → 0.0.1-commit.017a351

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.
Files changed (182) hide show
  1. package/dest/ContractClassRegistry-PII7Q556.js +3 -0
  2. package/dest/ContractClassRegistry-PII7Q556.js.map +7 -0
  3. package/dest/ContractInstanceRegistry-3MHLGFNZ.js +3 -0
  4. package/dest/ContractInstanceRegistry-3MHLGFNZ.js.map +7 -0
  5. package/dest/FeeJuice-TQV5AQK7.js +3 -0
  6. package/dest/FeeJuice-TQV5AQK7.js.map +7 -0
  7. package/dest/MultiCallEntrypoint-SBJUIJY7.js +3 -0
  8. package/dest/MultiCallEntrypoint-SBJUIJY7.js.map +7 -0
  9. package/dest/SchnorrAccount-MQXPIZ44.js +3 -0
  10. package/dest/SchnorrAccount-MQXPIZ44.js.map +7 -0
  11. package/dest/bin/check_txe_oracle_version.d.ts +2 -0
  12. package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
  13. package/dest/bin/check_txe_oracle_version.js +61 -0
  14. package/dest/bin/index.d.ts +1 -1
  15. package/dest/bin/index.js +3 -29
  16. package/dest/bin/index.js.map +7 -0
  17. package/dest/bin/oracle_test_server.d.ts +3 -0
  18. package/dest/bin/oracle_test_server.d.ts.map +1 -0
  19. package/dest/bin/oracle_test_server.js +41 -0
  20. package/dest/chunk-BA54BEZH.js +265 -0
  21. package/dest/chunk-BA54BEZH.js.map +7 -0
  22. package/dest/chunk-BJVAAXNA.js +3 -0
  23. package/dest/chunk-BJVAAXNA.js.map +7 -0
  24. package/dest/chunk-ZKW35DT6.js +304 -0
  25. package/dest/chunk-ZKW35DT6.js.map +7 -0
  26. package/dest/constants.d.ts +7 -0
  27. package/dest/constants.d.ts.map +1 -0
  28. package/dest/constants.js +10 -0
  29. package/dest/dispatcher_pool.d.ts +67 -0
  30. package/dest/dispatcher_pool.d.ts.map +1 -0
  31. package/dest/dispatcher_pool.js +284 -0
  32. package/dest/index.d.ts +185 -7
  33. package/dest/index.d.ts.map +1 -1
  34. package/dest/index.js +76 -132
  35. package/dest/metafile.json +38691 -0
  36. package/dest/msgpackr_fr_extension.d.ts +2 -0
  37. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  38. package/dest/msgpackr_fr_extension.js +21 -0
  39. package/dest/oracle/interfaces.d.ts +83 -0
  40. package/dest/oracle/interfaces.d.ts.map +1 -0
  41. package/dest/oracle/interfaces.js +3 -0
  42. package/dest/oracle/test-resolver/fixtures.d.ts +43 -0
  43. package/dest/oracle/test-resolver/fixtures.d.ts.map +1 -0
  44. package/dest/oracle/test-resolver/fixtures.js +39 -0
  45. package/dest/oracle/test-resolver/index.d.ts +9 -0
  46. package/dest/oracle/test-resolver/index.d.ts.map +1 -0
  47. package/dest/oracle/test-resolver/index.js +33 -0
  48. package/dest/oracle/test-resolver/resolver.d.ts +34 -0
  49. package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
  50. package/dest/oracle/test-resolver/resolver.js +114 -0
  51. package/dest/oracle/txe_oracle_public_context.d.ts +58 -0
  52. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -0
  53. package/dest/oracle/txe_oracle_public_context.js +164 -0
  54. package/dest/oracle/txe_oracle_registry.d.ts +147 -0
  55. package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
  56. package/dest/oracle/txe_oracle_registry.js +562 -0
  57. package/dest/oracle/txe_oracle_top_level_context.d.ts +85 -0
  58. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
  59. package/dest/oracle/txe_oracle_top_level_context.js +634 -0
  60. package/dest/oracle/txe_oracle_version.d.ts +17 -0
  61. package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
  62. package/dest/oracle/txe_oracle_version.js +14 -0
  63. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  64. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  65. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  66. package/dest/rpc_server.d.ts +14 -0
  67. package/dest/rpc_server.d.ts.map +1 -0
  68. package/dest/rpc_server.js +78 -0
  69. package/dest/rpc_translator.d.ts +120 -0
  70. package/dest/rpc_translator.d.ts.map +1 -0
  71. package/dest/rpc_translator.js +882 -0
  72. package/dest/server.bundle.js +3 -0
  73. package/dest/server.bundle.js.map +7 -0
  74. package/dest/state_machine/archiver.d.ts +32 -0
  75. package/dest/state_machine/archiver.d.ts.map +1 -0
  76. package/dest/state_machine/archiver.js +96 -0
  77. package/dest/state_machine/dummy_p2p_client.d.ts +65 -0
  78. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -0
  79. package/dest/state_machine/dummy_p2p_client.js +165 -0
  80. package/dest/state_machine/global_variable_builder.d.ts +16 -0
  81. package/dest/state_machine/global_variable_builder.d.ts.map +1 -0
  82. package/dest/state_machine/global_variable_builder.js +28 -0
  83. package/dest/state_machine/index.d.ts +20 -0
  84. package/dest/state_machine/index.d.ts.map +1 -0
  85. package/dest/state_machine/index.js +86 -0
  86. package/dest/state_machine/mock_epoch_cache.d.ts +42 -0
  87. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -0
  88. package/dest/state_machine/mock_epoch_cache.js +85 -0
  89. package/dest/state_machine/synchronizer.d.ts +33 -0
  90. package/dest/state_machine/synchronizer.d.ts.map +1 -0
  91. package/dest/state_machine/synchronizer.js +59 -0
  92. package/dest/txe_session.d.ts +140 -0
  93. package/dest/txe_session.d.ts.map +1 -0
  94. package/dest/txe_session.js +499 -0
  95. package/dest/utils/block_creation.d.ts +28 -0
  96. package/dest/utils/block_creation.d.ts.map +1 -0
  97. package/dest/utils/block_creation.js +58 -0
  98. package/dest/utils/encoding.d.ts +191 -0
  99. package/dest/utils/encoding.d.ts.map +1 -0
  100. package/dest/utils/encoding.js +136 -0
  101. package/dest/utils/expected_failure_error.d.ts +4 -0
  102. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  103. package/dest/utils/tx_effect_creation.d.ts +5 -0
  104. package/dest/utils/tx_effect_creation.d.ts.map +1 -0
  105. package/dest/utils/tx_effect_creation.js +13 -0
  106. package/dest/utils/txe_account_store.d.ts +10 -0
  107. package/dest/utils/txe_account_store.d.ts.map +1 -0
  108. package/dest/{util/txe_account_data_provider.js → utils/txe_account_store.js} +1 -1
  109. package/dest/utils/txe_artifact_resolver.d.ts +37 -0
  110. package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
  111. package/dest/utils/txe_artifact_resolver.js +161 -0
  112. package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
  113. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
  114. package/dest/utils/txe_public_contract_data_source.js +48 -0
  115. package/dest/worker.bundle.js +3 -0
  116. package/dest/worker.bundle.js.map +7 -0
  117. package/dest/worker.d.ts +2 -0
  118. package/dest/worker.d.ts.map +1 -0
  119. package/dest/worker.js +92 -0
  120. package/package.json +52 -29
  121. package/src/bin/check_txe_oracle_version.ts +70 -0
  122. package/src/bin/index.ts +14 -4
  123. package/src/bin/oracle_test_server.ts +51 -0
  124. package/src/constants.ts +13 -0
  125. package/src/dispatcher_pool.ts +316 -0
  126. package/src/index.ts +113 -175
  127. package/src/msgpackr_fr_extension.ts +23 -0
  128. package/src/oracle/interfaces.ts +109 -0
  129. package/src/oracle/test-resolver/fixtures.ts +84 -0
  130. package/src/oracle/test-resolver/index.ts +45 -0
  131. package/src/oracle/test-resolver/resolver.ts +165 -0
  132. package/src/oracle/txe_oracle_public_context.ts +218 -0
  133. package/src/oracle/txe_oracle_registry.ts +401 -0
  134. package/src/oracle/txe_oracle_top_level_context.ts +898 -0
  135. package/src/oracle/txe_oracle_version.ts +17 -0
  136. package/src/oracle/txe_private_execution_oracle.ts +30 -0
  137. package/src/rpc_server.ts +87 -0
  138. package/src/rpc_translator.ts +1103 -0
  139. package/src/state_machine/archiver.ts +119 -0
  140. package/src/state_machine/dummy_p2p_client.ts +247 -0
  141. package/src/state_machine/global_variable_builder.ts +53 -0
  142. package/src/state_machine/index.ts +135 -0
  143. package/src/state_machine/mock_epoch_cache.ts +107 -0
  144. package/src/state_machine/synchronizer.ts +88 -0
  145. package/src/txe_session.ts +799 -0
  146. package/src/utils/block_creation.ts +97 -0
  147. package/src/utils/encoding.ts +172 -0
  148. package/src/utils/tx_effect_creation.ts +30 -0
  149. package/src/{util/txe_account_data_provider.ts → utils/txe_account_store.ts} +1 -1
  150. package/src/utils/txe_artifact_resolver.ts +217 -0
  151. package/src/utils/txe_public_contract_data_source.ts +58 -0
  152. package/src/worker.ts +98 -0
  153. package/dest/node/txe_node.d.ts +0 -358
  154. package/dest/node/txe_node.d.ts.map +0 -1
  155. package/dest/node/txe_node.js +0 -504
  156. package/dest/oracle/txe_oracle.d.ts +0 -152
  157. package/dest/oracle/txe_oracle.d.ts.map +0 -1
  158. package/dest/oracle/txe_oracle.js +0 -833
  159. package/dest/txe_service/txe_service.d.ts +0 -212
  160. package/dest/txe_service/txe_service.d.ts.map +0 -1
  161. package/dest/txe_service/txe_service.js +0 -572
  162. package/dest/util/encoding.d.ts +0 -103
  163. package/dest/util/encoding.d.ts.map +0 -1
  164. package/dest/util/encoding.js +0 -76
  165. package/dest/util/expected_failure_error.d.ts +0 -4
  166. package/dest/util/expected_failure_error.d.ts.map +0 -1
  167. package/dest/util/txe_account_data_provider.d.ts +0 -10
  168. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  169. package/dest/util/txe_public_contract_data_source.d.ts +0 -20
  170. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  171. package/dest/util/txe_public_contract_data_source.js +0 -88
  172. package/dest/util/txe_world_state_db.d.ts +0 -14
  173. package/dest/util/txe_world_state_db.d.ts.map +0 -1
  174. package/dest/util/txe_world_state_db.js +0 -27
  175. package/src/node/txe_node.ts +0 -725
  176. package/src/oracle/txe_oracle.ts +0 -1241
  177. package/src/txe_service/txe_service.ts +0 -749
  178. package/src/util/encoding.ts +0 -92
  179. package/src/util/txe_public_contract_data_source.ts +0 -101
  180. package/src/util/txe_world_state_db.ts +0 -38
  181. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  182. /package/src/{util → utils}/expected_failure_error.ts +0 -0
@@ -0,0 +1,634 @@
1
+ import { CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, MAX_PRIVATE_LOGS_PER_TX, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
+ import { BlockNumber } from '@aztec/foundation/branded-types';
3
+ import { Schnorr } from '@aztec/foundation/crypto/schnorr';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
+ import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
6
+ import { TestDateProvider } from '@aztec/foundation/timer';
7
+ import { CapsuleService, ORACLE_VERSION_MAJOR, composeHooks, enrichPublicSimulationError } from '@aztec/pxe/server';
8
+ import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle, executePrivateFunction, generateSimulatedProvingResult } from '@aztec/pxe/simulator';
9
+ import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
10
+ import { CppPublicTxSimulator, GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor } from '@aztec/simulator/server';
11
+ import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
12
+ import { AuthWitness } from '@aztec/stdlib/auth-witness';
13
+ import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
14
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
+ import { computePartialAddress } from '@aztec/stdlib/contract';
16
+ import { Gas, GasFees } from '@aztec/stdlib/gas';
17
+ import { computeCalldataHash, computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
18
+ import { PartialPrivateTailPublicInputsForPublic, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PublicCallRequest } from '@aztec/stdlib/kernel';
19
+ import { hashPublicKey } from '@aztec/stdlib/keys';
20
+ import { ChonkProof } from '@aztec/stdlib/proofs';
21
+ import { makeGlobalVariables } from '@aztec/stdlib/testing';
22
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
23
+ import { CallContext, HashedValues, PrivateExecutionResult, Tx, TxConstantData, TxContext, TxEffect, TxHash, collectNested } from '@aztec/stdlib/tx';
24
+ import { ForkCheckpoint } from '@aztec/world-state/native';
25
+ import { DEFAULT_ADDRESS, MAX_PRIVATE_EVENTS_PER_TXE_QUERY, MAX_PRIVATE_EVENT_LEN } from '../constants.js';
26
+ import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
27
+ import { TXEPublicContractDataSource } from '../utils/txe_public_contract_data_source.js';
28
+ export class TXEOracleTopLevelContext {
29
+ stateMachine;
30
+ contractStore;
31
+ noteStore;
32
+ keyStore;
33
+ addressStore;
34
+ accountStore;
35
+ senderTaggingStore;
36
+ recipientTaggingStore;
37
+ senderAddressBookStore;
38
+ capsuleStore;
39
+ privateEventStore;
40
+ nextBlockTimestamp;
41
+ version;
42
+ chainId;
43
+ authwits;
44
+ artifactResolver;
45
+ rootPath;
46
+ packageName;
47
+ isMisc;
48
+ isTxe;
49
+ logger;
50
+ constructor(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, authwits, artifactResolver, rootPath, packageName){
51
+ this.stateMachine = stateMachine;
52
+ this.contractStore = contractStore;
53
+ this.noteStore = noteStore;
54
+ this.keyStore = keyStore;
55
+ this.addressStore = addressStore;
56
+ this.accountStore = accountStore;
57
+ this.senderTaggingStore = senderTaggingStore;
58
+ this.recipientTaggingStore = recipientTaggingStore;
59
+ this.senderAddressBookStore = senderAddressBookStore;
60
+ this.capsuleStore = capsuleStore;
61
+ this.privateEventStore = privateEventStore;
62
+ this.nextBlockTimestamp = nextBlockTimestamp;
63
+ this.version = version;
64
+ this.chainId = chainId;
65
+ this.authwits = authwits;
66
+ this.artifactResolver = artifactResolver;
67
+ this.rootPath = rootPath;
68
+ this.packageName = packageName;
69
+ this.isMisc = true;
70
+ this.isTxe = true;
71
+ this.logger = createLogger('txe:top_level_context');
72
+ this.logger.debug('Entering Top Level Context');
73
+ }
74
+ contractOracleVersion;
75
+ assertCompatibleOracleVersion(major, minor) {
76
+ if (major !== ORACLE_VERSION_MAJOR) {
77
+ const hint = major > ORACLE_VERSION_MAJOR ? 'The contract was compiled with a newer version of Aztec.nr than this aztec cli version supports. Upgrade your aztec cli version to a compatible version.' : 'The contract was compiled with an older version of Aztec.nr than this aztec cli version supports. Recompile the contract with a compatible version of Aztec.nr.';
78
+ throw new Error(`Incompatible aztec cli version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${ORACLE_VERSION_MAJOR}, got ${major})`);
79
+ }
80
+ this.contractOracleVersion = {
81
+ major,
82
+ minor
83
+ };
84
+ }
85
+ // Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
86
+ nonOracleFunctionGetContractOracleVersion() {
87
+ return this.contractOracleVersion;
88
+ }
89
+ // This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
90
+ // setup.
91
+ getRandomField() {
92
+ return Fr.random();
93
+ }
94
+ // We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
95
+ log(level, message, _fieldsSize, fields) {
96
+ if (!LogLevels[level]) {
97
+ throw new Error(`Invalid log level: ${level}`);
98
+ }
99
+ const levelName = LogLevels[level];
100
+ this.logger[levelName](`${applyStringFormatting(message, fields)}`, {
101
+ module: `${this.logger.module}:debug_log`
102
+ });
103
+ return Promise.resolve();
104
+ }
105
+ getDefaultAddress() {
106
+ return DEFAULT_ADDRESS;
107
+ }
108
+ async getNextBlockNumber() {
109
+ return BlockNumber(await this.getLastBlockNumber() + 1);
110
+ }
111
+ getNextBlockTimestamp() {
112
+ return Promise.resolve(this.nextBlockTimestamp);
113
+ }
114
+ async getLastBlockTimestamp() {
115
+ return (await this.stateMachine.node.getBlockData('latest')).header.globalVariables.timestamp;
116
+ }
117
+ async getLastTxEffects() {
118
+ const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
119
+ const block = await this.stateMachine.archiver.getBlock({
120
+ number: latestBlockNumber
121
+ });
122
+ if (block.body.txEffects.length != 1) {
123
+ // Note that calls like env.mine() will result in blocks with no transactions, hitting this
124
+ throw new Error(`Expected a single transaction in the last block, found ${block.body.txEffects.length}`);
125
+ }
126
+ const txEffects = block.body.txEffects[0];
127
+ const privateLogs = txEffects.privateLogs;
128
+ if (privateLogs.length > MAX_PRIVATE_LOGS_PER_TX) {
129
+ throw new Error(`${privateLogs.length} private logs exceed max ${MAX_PRIVATE_LOGS_PER_TX}`);
130
+ }
131
+ return {
132
+ txHash: txEffects.txHash,
133
+ noteHashes: txEffects.noteHashes,
134
+ nullifiers: txEffects.nullifiers,
135
+ privateLogs
136
+ };
137
+ }
138
+ async syncContractNonOracleMethod(contractAddress, scope, jobId) {
139
+ if (contractAddress.equals(DEFAULT_ADDRESS)) {
140
+ this.logger.debug(`Skipping sync in getPrivateEvents because the events correspond to the default address.`);
141
+ return;
142
+ }
143
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
144
+ await this.stateMachine.contractSyncService.ensureContractSynced(contractAddress, null, async (call, execScopes)=>{
145
+ await this.executeUtilityCall(call, execScopes, jobId);
146
+ }, blockHeader, jobId, [
147
+ scope
148
+ ]);
149
+ }
150
+ async getPrivateEvents(selector, contractAddress, scope) {
151
+ const events = (await this.privateEventStore.getPrivateEvents(selector, {
152
+ contractAddress,
153
+ scopes: [
154
+ scope
155
+ ],
156
+ fromBlock: 0,
157
+ toBlock: await this.getLastBlockNumber() + 1
158
+ })).map((e)=>e.packedEvent);
159
+ if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
160
+ throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
161
+ }
162
+ if (events.some((e)=>e.length > MAX_PRIVATE_EVENT_LEN)) {
163
+ throw new Error(`Some private event has length larger than maxLen ${MAX_PRIVATE_EVENT_LEN}`);
164
+ }
165
+ return events;
166
+ }
167
+ async advanceBlocksBy(blocks) {
168
+ this.logger.debug(`time traveling ${blocks} blocks`);
169
+ for(let i = 0; i < blocks; i++){
170
+ await this.mineBlock();
171
+ }
172
+ }
173
+ advanceTimestampBy(duration) {
174
+ this.logger.debug(`time traveling ${duration} seconds`);
175
+ this.nextBlockTimestamp += duration;
176
+ }
177
+ deploymentNullifier(address) {
178
+ return siloNullifier(AztecAddress.fromNumber(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), address.toField());
179
+ }
180
+ async deploy(contractPath, initializer, args, secret, salt, deployer) {
181
+ const { artifact, instance } = await this.artifactResolver.resolveDeployArtifact({
182
+ rootPath: this.rootPath,
183
+ packageName: this.packageName,
184
+ contractPath,
185
+ initializer,
186
+ args,
187
+ secret,
188
+ salt,
189
+ deployer
190
+ });
191
+ // Emit deployment nullifier
192
+ await this.mineBlock({
193
+ nullifiers: [
194
+ await this.deploymentNullifier(instance.address)
195
+ ]
196
+ });
197
+ if (!secret.equals(Fr.ZERO)) {
198
+ await this.registerContractAndAddAccount(artifact, instance, secret);
199
+ } else {
200
+ await this.contractStore.addContractInstance(instance);
201
+ await this.contractStore.addContractArtifact(artifact);
202
+ this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
203
+ }
204
+ return [
205
+ instance.salt,
206
+ instance.deployer.toField(),
207
+ instance.currentContractClassId,
208
+ instance.initializationHash,
209
+ instance.immutablesHash,
210
+ ...instance.publicKeys.toFields()
211
+ ];
212
+ }
213
+ /**
214
+ * Mines a single block containing only the deployment nullifiers for the contracts at the given addresses.
215
+ */ async mineDeploymentNullifiers(addresses) {
216
+ await this.mineBlock({
217
+ nullifiers: await Promise.all(addresses.map((address)=>this.deploymentNullifier(address)))
218
+ });
219
+ }
220
+ async addAccount(secret) {
221
+ const { artifact, instance } = await this.artifactResolver.resolveAccountArtifact(secret);
222
+ return this.registerContractAndAddAccount(artifact, instance, secret);
223
+ }
224
+ async registerContractAndAddAccount(artifact, instance, secret) {
225
+ const partialAddress = await computePartialAddress(instance);
226
+ this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
227
+ await this.contractStore.addContractInstance(instance);
228
+ await this.contractStore.addContractArtifact(artifact);
229
+ const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
230
+ await this.accountStore.setAccount(completeAddress.address, completeAddress);
231
+ await this.addressStore.addCompleteAddress(completeAddress);
232
+ this.logger.debug(`Created account ${completeAddress.address}`);
233
+ return completeAddress;
234
+ }
235
+ async createAccount(secret) {
236
+ // This is a foot gun !
237
+ const completeAddress = await this.keyStore.addAccount(secret, secret);
238
+ await this.accountStore.setAccount(completeAddress.address, completeAddress);
239
+ await this.addressStore.addCompleteAddress(completeAddress);
240
+ this.logger.debug(`Created account ${completeAddress.address}`);
241
+ return completeAddress;
242
+ }
243
+ async addAuthWitness(address, messageHash) {
244
+ const account = await this.accountStore.getAccount(address);
245
+ const ivpkMHash = await hashPublicKey(account.publicKeys.ivpkM);
246
+ const privateKey = await this.keyStore.getMasterSecretKey(ivpkMHash);
247
+ const schnorr = new Schnorr();
248
+ const signature = await schnorr.constructSignature(messageHash, privateKey);
249
+ const authWitness = new AuthWitness(messageHash, signature.toLimbFields());
250
+ this.authwits.set(authWitness.requestHash.toString(), authWitness);
251
+ }
252
+ async mineBlock(options = {}) {
253
+ const blockNumber = await this.getNextBlockNumber();
254
+ const txEffect = TxEffect.empty();
255
+ txEffect.nullifiers = [
256
+ getSingleTxBlockRequestHash(blockNumber),
257
+ ...options.nullifiers ?? []
258
+ ];
259
+ txEffect.txHash = new TxHash(new Fr(blockNumber));
260
+ const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
261
+ await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
262
+ const globals = makeGlobalVariables(undefined, {
263
+ blockNumber,
264
+ timestamp: this.nextBlockTimestamp,
265
+ version: this.version,
266
+ chainId: this.chainId
267
+ });
268
+ const block = await makeTXEBlock(forkedWorldTrees, globals, [
269
+ txEffect
270
+ ]);
271
+ await forkedWorldTrees.close();
272
+ this.logger.info(`Created block ${blockNumber} with timestamp ${block.header.globalVariables.timestamp}`);
273
+ await this.stateMachine.handleL2Block(block);
274
+ }
275
+ async privateCallNewFlow(from, targetContractAddress = AztecAddress.zero(), functionSelector = FunctionSelector.empty(), args, argsHash = Fr.zero(), isStaticCall = false, additionalScopes = [], jobId, authorizedUtilityCallTargets, gasSettings) {
276
+ this.logger.verbose(`Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`);
277
+ const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
278
+ if (!artifact) {
279
+ const message = functionSelector.equals(await FunctionSelector.fromSignature('verify_private_authwit(Field)')) ? 'Found no account contract artifact for a private authwit check - use `create_contract_account` instead of `create_light_account` for authwit support.' : 'Function Artifact does not exist';
280
+ throw new Error(message);
281
+ }
282
+ const scopes = from === undefined ? additionalScopes : [
283
+ from,
284
+ ...additionalScopes
285
+ ];
286
+ // Sync notes before executing private function to discover notes from previous transactions
287
+ const utilityExecutor = async (call, execScopes)=>{
288
+ await this.executeUtilityCall(call, execScopes, jobId);
289
+ };
290
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
291
+ await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, utilityExecutor, blockHeader, jobId, scopes);
292
+ const blockNumber = await this.getNextBlockNumber();
293
+ const msgSender = from ?? AztecAddress.NULL_MSG_SENDER;
294
+ const callContext = new CallContext(msgSender, targetContractAddress, functionSelector, isStaticCall);
295
+ const txContext = new TxContext(this.chainId, this.version, gasSettings);
296
+ const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
297
+ const noteCache = new ExecutionNoteCache(protocolNullifier);
298
+ // In production, the account contract sets the min revertible counter before calling the app function.
299
+ // Since TXE bypasses the account contract, we simulate this by setting minRevertibleSideEffectCounter to 1,
300
+ // marking all side effects as revertible.
301
+ const minRevertibleSideEffectCounter = 1;
302
+ await noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
303
+ const taggingIndexCache = new ExecutionTaggingIndexCache();
304
+ const simulator = new WASMSimulator();
305
+ const privateExecutionOracle = new PrivateExecutionOracle({
306
+ argsHash,
307
+ txContext,
308
+ callContext,
309
+ anchorBlockHeader: blockHeader,
310
+ utilityExecutor,
311
+ authWitnesses: Array.from(this.authwits.values()),
312
+ capsules: [],
313
+ executionCache: HashedValuesCache.create([
314
+ new HashedValues(args, argsHash)
315
+ ]),
316
+ noteCache,
317
+ taggingIndexCache,
318
+ contractStore: this.contractStore,
319
+ noteStore: this.noteStore,
320
+ keyStore: this.keyStore,
321
+ addressStore: this.addressStore,
322
+ aztecNode: this.stateMachine.node,
323
+ senderTaggingStore: this.senderTaggingStore,
324
+ recipientTaggingStore: this.recipientTaggingStore,
325
+ senderAddressBookStore: this.senderAddressBookStore,
326
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
327
+ privateEventStore: this.privateEventStore,
328
+ contractSyncService: this.stateMachine.contractSyncService,
329
+ jobId,
330
+ totalPublicCalldataCount: 0,
331
+ sideEffectCounter: minRevertibleSideEffectCounter,
332
+ scopes,
333
+ // In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
334
+ // contract would perform, including setting senderForTags.
335
+ senderForTags: from,
336
+ simulator,
337
+ messageContextService: this.stateMachine.messageContextService,
338
+ l2TipsStore: this.stateMachine.l2TipsProvider,
339
+ hooks: composeHooks({
340
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook(isStaticCall ? 'private view' : 'private', authorizedUtilityCallTargets)
341
+ })
342
+ });
343
+ // Note: This is a slight modification of simulator.run without any of the checks. Maybe we should modify simulator.run with a boolean value to skip checks.
344
+ let result;
345
+ let executionResult;
346
+ try {
347
+ executionResult = await executePrivateFunction(simulator, privateExecutionOracle, artifact, targetContractAddress, functionSelector);
348
+ const publicCallRequests = collectNested([
349
+ executionResult
350
+ ], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
351
+ r.publicInputs.publicTeardownCallRequest
352
+ ]));
353
+ const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
354
+ const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
355
+ return new HashedValues(calldata, r.calldataHash);
356
+ }));
357
+ noteCache.finish();
358
+ const nonceGenerator = noteCache.getNonceGenerator();
359
+ result = new PrivateExecutionResult(executionResult, nonceGenerator, publicFunctionsCalldata);
360
+ } catch (err) {
361
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
362
+ }
363
+ // According to the protocol rules, there must be at least one nullifier in the tx. The first nullifier is used as
364
+ // the nonce generator for the note hashes.
365
+ // We pass the non-zero minRevertibleSideEffectCounter to make sure the side effects are split correctly.
366
+ const { publicInputs } = await generateSimulatedProvingResult(result, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.stateMachine.node, minRevertibleSideEffectCounter);
367
+ const globals = makeGlobalVariables();
368
+ globals.blockNumber = blockNumber;
369
+ globals.timestamp = this.nextBlockTimestamp;
370
+ globals.chainId = this.chainId;
371
+ globals.version = this.version;
372
+ globals.gasFees = GasFees.empty();
373
+ const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
374
+ const bindings = this.logger.getBindings();
375
+ const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore), bindings);
376
+ const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
377
+ const config = PublicSimulatorConfig.from({
378
+ skipFeeEnforcement: true,
379
+ collectDebugLogs: true,
380
+ collectHints: false,
381
+ collectStatistics: false,
382
+ collectCallMetadata: true
383
+ });
384
+ const processor = new PublicProcessor(globals, guardedMerkleTrees, contractsDB, new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config, bindings), new TestDateProvider(), undefined, createLogger('simulator:public-processor', bindings));
385
+ const tx = await Tx.create({
386
+ data: publicInputs,
387
+ chonkProof: ChonkProof.empty(),
388
+ contractClassLogFields: [],
389
+ publicFunctionCalldata: result.publicFunctionCalldata
390
+ });
391
+ let checkpoint;
392
+ if (isStaticCall) {
393
+ checkpoint = await ForkCheckpoint.new(forkedWorldTrees);
394
+ }
395
+ const results = await processor.process([
396
+ tx
397
+ ]);
398
+ const [processedTx] = results[0];
399
+ const failedTxs = results[1];
400
+ if (failedTxs.length !== 0) {
401
+ throw new Error(`Public execution has failed: ${failedTxs[0].error}`);
402
+ } else if (!processedTx.revertCode.isOK()) {
403
+ if (processedTx.revertReason) {
404
+ try {
405
+ await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
406
+ // eslint-disable-next-line no-empty
407
+ } catch {}
408
+ throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
409
+ } else {
410
+ throw new Error('Contract execution has reverted');
411
+ }
412
+ }
413
+ // Walk the nested private-call tree and collect every offchain effect the transaction emitted.
414
+ // PXE stores these on each `PrivateCallExecutionResult` and they never reach TXE via the
415
+ // `aztec_utl_emitOffchainEffect` foreign-call path (that path only fires at the top-level), so
416
+ // we pull them out here and the RPC wrapper will hand them to `TXESession` for buffering.
417
+ const offchainEffects = collectNested([
418
+ executionResult
419
+ ], (r)=>r.offchainEffects.map((e)=>e.data));
420
+ if (isStaticCall) {
421
+ await checkpoint.revert();
422
+ await forkedWorldTrees.close();
423
+ return {
424
+ returnValues: executionResult.returnValues ?? [],
425
+ offchainEffects
426
+ };
427
+ }
428
+ const txEffect = TxEffect.empty();
429
+ txEffect.noteHashes = processedTx.txEffect.noteHashes;
430
+ txEffect.nullifiers = processedTx.txEffect.nullifiers;
431
+ txEffect.privateLogs = processedTx.txEffect.privateLogs;
432
+ txEffect.publicLogs = processedTx.txEffect.publicLogs;
433
+ txEffect.publicDataWrites = processedTx.txEffect.publicDataWrites;
434
+ txEffect.txHash = new TxHash(new Fr(blockNumber));
435
+ const l1ToL2Messages = Array(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).fill(0).map(Fr.zero);
436
+ await forkedWorldTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2Messages);
437
+ const l2Block = await makeTXEBlock(forkedWorldTrees, globals, [
438
+ txEffect
439
+ ]);
440
+ await this.stateMachine.handleL2Block(l2Block);
441
+ await forkedWorldTrees.close();
442
+ return {
443
+ returnValues: executionResult.returnValues ?? [],
444
+ offchainEffects
445
+ };
446
+ }
447
+ async publicCallNewFlow(from, targetContractAddress, calldata, isStaticCall, gasSettings) {
448
+ this.logger.verbose(`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`);
449
+ const blockNumber = await this.getNextBlockNumber();
450
+ const txContext = new TxContext(this.chainId, this.version, gasSettings);
451
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
452
+ const calldataHash = await computeCalldataHash(calldata);
453
+ const calldataHashedValues = new HashedValues(calldata, calldataHash);
454
+ const globals = makeGlobalVariables();
455
+ globals.blockNumber = blockNumber;
456
+ globals.timestamp = this.nextBlockTimestamp;
457
+ globals.chainId = this.chainId;
458
+ globals.version = this.version;
459
+ globals.gasFees = GasFees.empty();
460
+ const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
461
+ const bindings2 = this.logger.getBindings();
462
+ const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore), bindings2);
463
+ const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
464
+ const config = PublicSimulatorConfig.from({
465
+ skipFeeEnforcement: true,
466
+ collectDebugLogs: true,
467
+ collectHints: false,
468
+ collectStatistics: false,
469
+ collectCallMetadata: true
470
+ });
471
+ const simulator = new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config, bindings2);
472
+ const processor = new PublicProcessor(globals, guardedMerkleTrees, contractsDB, simulator, new TestDateProvider(), undefined, createLogger('simulator:public-processor', bindings2));
473
+ // We're simulating a scenario in which private execution immediately enqueues a public call and halts. The private
474
+ // kernel init would in this case inject a nullifier with the transaction request hash as a non-revertible
475
+ // side-effect, which the AVM then expects to exist in order to use it as the nonce generator when siloing notes as
476
+ // unique.
477
+ const nonRevertibleAccumulatedData = PrivateToPublicAccumulatedData.empty();
478
+ nonRevertibleAccumulatedData.nullifiers[0] = getSingleTxBlockRequestHash(blockNumber);
479
+ // The enqueued public call itself we make be revertible so that the public execution is itself revertible, as tests
480
+ // may require producing reverts.
481
+ const revertibleAccumulatedData = PrivateToPublicAccumulatedData.empty();
482
+ revertibleAccumulatedData.publicCallRequests[0] = new PublicCallRequest(from ?? AztecAddress.NULL_MSG_SENDER, targetContractAddress, isStaticCall, calldataHash);
483
+ const inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleAccumulatedData, revertibleAccumulatedData, PublicCallRequest.empty());
484
+ const constantData = new TxConstantData(anchorBlockHeader, txContext, Fr.zero(), Fr.zero());
485
+ const txData = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), /*expirationTimestamp=*/ 0n, inputsForPublic, undefined);
486
+ const tx = await Tx.create({
487
+ data: txData,
488
+ chonkProof: ChonkProof.empty(),
489
+ contractClassLogFields: [],
490
+ publicFunctionCalldata: [
491
+ calldataHashedValues
492
+ ]
493
+ });
494
+ let checkpoint;
495
+ if (isStaticCall) {
496
+ checkpoint = await ForkCheckpoint.new(forkedWorldTrees);
497
+ }
498
+ const results = await processor.process([
499
+ tx
500
+ ]);
501
+ const [processedTx] = results[0];
502
+ const failedTxs = results[1];
503
+ if (failedTxs.length !== 0) {
504
+ throw new Error(`Public execution has failed: ${failedTxs[0].error}`);
505
+ } else if (!processedTx.revertCode.isOK()) {
506
+ if (processedTx.revertReason) {
507
+ try {
508
+ await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
509
+ // eslint-disable-next-line no-empty
510
+ } catch {}
511
+ throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
512
+ } else {
513
+ throw new Error('Contract execution has reverted');
514
+ }
515
+ }
516
+ const returnValues = results[3][0].values;
517
+ if (isStaticCall) {
518
+ await checkpoint.revert();
519
+ await forkedWorldTrees.close();
520
+ return returnValues ?? [];
521
+ }
522
+ const txEffect = TxEffect.empty();
523
+ txEffect.noteHashes = processedTx.txEffect.noteHashes;
524
+ txEffect.nullifiers = processedTx.txEffect.nullifiers;
525
+ txEffect.privateLogs = processedTx.txEffect.privateLogs;
526
+ txEffect.publicLogs = processedTx.txEffect.publicLogs;
527
+ txEffect.publicDataWrites = processedTx.txEffect.publicDataWrites;
528
+ txEffect.txHash = new TxHash(new Fr(blockNumber));
529
+ const l1ToL2Messages = Array(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).fill(0).map(Fr.zero);
530
+ await forkedWorldTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2Messages);
531
+ const l2Block = await makeTXEBlock(forkedWorldTrees, globals, [
532
+ txEffect
533
+ ]);
534
+ await this.stateMachine.handleL2Block(l2Block);
535
+ await forkedWorldTrees.close();
536
+ return returnValues ?? [];
537
+ }
538
+ async executeUtilityFunction(targetContractAddress, functionSelector, args, jobId, authorizedUtilityCallTargets) {
539
+ const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
540
+ if (!artifact) {
541
+ throw new Error(`Cannot call ${functionSelector} as there is no artifact found at ${targetContractAddress}.`);
542
+ }
543
+ // Sync notes before executing utility function to discover notes from previous transactions
544
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
545
+ await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, async (call, execScopes)=>{
546
+ await this.executeUtilityCall(call, execScopes, jobId);
547
+ }, blockHeader, jobId, await this.keyStore.getAccounts());
548
+ const call = FunctionCall.from({
549
+ name: artifact.name,
550
+ to: targetContractAddress,
551
+ selector: functionSelector,
552
+ type: FunctionType.UTILITY,
553
+ hideMsgSender: false,
554
+ isStatic: false,
555
+ args,
556
+ returnTypes: []
557
+ });
558
+ return this.executeUtilityCall(call, await this.keyStore.getAccounts(), jobId, authorizedUtilityCallTargets);
559
+ }
560
+ async executeUtilityCall(call, scopes, jobId, authorizedUtilityCallTargets = []) {
561
+ const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
562
+ if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
563
+ throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
564
+ }
565
+ this.logger.verbose(`Executing utility function ${entryPointArtifact.name}`, {
566
+ contract: call.to,
567
+ selector: call.selector
568
+ });
569
+ try {
570
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
571
+ const simulator = new WASMSimulator();
572
+ const utilityExecutor = async (syncCall, execScopes)=>{
573
+ await this.executeUtilityCall(syncCall, execScopes, jobId);
574
+ };
575
+ const oracle = new UtilityExecutionOracle({
576
+ contractAddress: call.to,
577
+ authWitnesses: [],
578
+ capsules: [],
579
+ anchorBlockHeader,
580
+ contractStore: this.contractStore,
581
+ noteStore: this.noteStore,
582
+ keyStore: this.keyStore,
583
+ addressStore: this.addressStore,
584
+ aztecNode: this.stateMachine.node,
585
+ recipientTaggingStore: this.recipientTaggingStore,
586
+ senderAddressBookStore: this.senderAddressBookStore,
587
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
588
+ privateEventStore: this.privateEventStore,
589
+ messageContextService: this.stateMachine.messageContextService,
590
+ contractSyncService: this.stateMachine.contractSyncService,
591
+ l2TipsStore: this.stateMachine.l2TipsProvider,
592
+ jobId,
593
+ scopes,
594
+ simulator,
595
+ hooks: composeHooks({
596
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook('utility', authorizedUtilityCallTargets)
597
+ }),
598
+ utilityExecutor
599
+ });
600
+ const acirExecutionResult = await simulator.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
601
+ err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
602
+ throw new ExecutionError(err.message, {
603
+ contractAddress: call.to,
604
+ functionSelector: call.selector
605
+ }, extractCallStack(err, entryPointArtifact.debug), {
606
+ cause: err
607
+ });
608
+ });
609
+ this.logger.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
610
+ return witnessMapToFields(acirExecutionResult.returnWitness);
611
+ } catch (err) {
612
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility execution'));
613
+ }
614
+ }
615
+ close() {
616
+ this.logger.debug('Exiting Top Level Context');
617
+ return [
618
+ this.nextBlockTimestamp,
619
+ this.authwits
620
+ ];
621
+ }
622
+ async getLastBlockNumber() {
623
+ const block = await this.stateMachine.node.getBlock('latest');
624
+ return block ? block.header.globalVariables.blockNumber : BlockNumber.ZERO;
625
+ }
626
+ buildAuthorizeUtilityCallHook(callerContext, authorizedTargets) {
627
+ if (authorizedTargets.length === 0) {
628
+ return undefined;
629
+ }
630
+ return (req)=>Promise.resolve({
631
+ authorized: req.callerContext === callerContext && authorizedTargets.some((t)=>t.equals(req.target))
632
+ });
633
+ }
634
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The TXE oracle version constants are used to check that the oracle interface used for tests is in sync between
3
+ * TXE and Aztec.nr. This is separate from the contract oracle version in `pxe/src/oracle_version.ts`, which covers
4
+ * oracles used during contract execution by PXE.
5
+ *
6
+ * The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr`.
7
+ */
8
+ export declare const TXE_ORACLE_VERSION_MAJOR = 1;
9
+ export declare const TXE_ORACLE_VERSION_MINOR = 2;
10
+ /**
11
+ * This hash is computed from the TXE oracle interfaces (IAvmExecutionOracle and ITxeExecutionOracle) and is used to
12
+ * detect when those interfaces change. When it does, bump:
13
+ * - TXE_ORACLE_VERSION_MAJOR (and reset MINOR to 0) for breaking changes, or
14
+ * - TXE_ORACLE_VERSION_MINOR for additive changes (new oracle method added).
15
+ */
16
+ export declare const TXE_ORACLE_INTERFACE_HASH = "9e5f6ad5fd170d1de5ddd417f19cce47b17382567e08360dc6a783154828e218";
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX29yYWNsZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3JhY2xlL3R4ZV9vcmFjbGVfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFDSCxlQUFPLE1BQU0sd0JBQXdCLElBQUksQ0FBQztBQUMxQyxlQUFPLE1BQU0sd0JBQXdCLElBQUksQ0FBQztBQUUxQzs7Ozs7R0FLRztBQUNILGVBQU8sTUFBTSx5QkFBeUIscUVBQXFFLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txe_oracle_version.d.ts","sourceRoot":"","sources":["../../src/oracle/txe_oracle_version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,qEAAqE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The TXE oracle version constants are used to check that the oracle interface used for tests is in sync between
3
+ * TXE and Aztec.nr. This is separate from the contract oracle version in `pxe/src/oracle_version.ts`, which covers
4
+ * oracles used during contract execution by PXE.
5
+ *
6
+ * The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr`.
7
+ */ export const TXE_ORACLE_VERSION_MAJOR = 1;
8
+ export const TXE_ORACLE_VERSION_MINOR = 2;
9
+ /**
10
+ * This hash is computed from the TXE oracle interfaces (IAvmExecutionOracle and ITxeExecutionOracle) and is used to
11
+ * detect when those interfaces change. When it does, bump:
12
+ * - TXE_ORACLE_VERSION_MAJOR (and reset MINOR to 0) for breaking changes, or
13
+ * - TXE_ORACLE_VERSION_MINOR for additive changes (new oracle method added).
14
+ */ export const TXE_ORACLE_INTERFACE_HASH = '9e5f6ad5fd170d1de5ddd417f19cce47b17382567e08360dc6a783154828e218';