@aztec/txe 5.0.0-private.20260319 → 5.0.0-rc.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.
Files changed (160) hide show
  1. package/dest/AuthRegistry-URXCCPYF.js +3 -0
  2. package/dest/AuthRegistry-URXCCPYF.js.map +7 -0
  3. package/dest/ContractClassRegistry-5RDBM6TC.js +3 -0
  4. package/dest/ContractClassRegistry-5RDBM6TC.js.map +7 -0
  5. package/dest/ContractInstanceRegistry-GCR4G4D7.js +3 -0
  6. package/dest/ContractInstanceRegistry-GCR4G4D7.js.map +7 -0
  7. package/dest/FeeJuice-O3KOSZO5.js +3 -0
  8. package/dest/FeeJuice-O3KOSZO5.js.map +7 -0
  9. package/dest/HandshakeRegistry-TXSMHMNY.js +3 -0
  10. package/dest/HandshakeRegistry-TXSMHMNY.js.map +7 -0
  11. package/dest/MultiCallEntrypoint-P4FSRXAD.js +3 -0
  12. package/dest/MultiCallEntrypoint-P4FSRXAD.js.map +7 -0
  13. package/dest/SchnorrAccount-AQZX7ROU.js +3 -0
  14. package/dest/SchnorrAccount-AQZX7ROU.js.map +7 -0
  15. package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js +3 -0
  16. package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js.map +7 -0
  17. package/dest/bin/check_txe_oracle_version.d.ts +2 -0
  18. package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
  19. package/dest/bin/check_txe_oracle_version.js +61 -0
  20. package/dest/bin/index.js +3 -30
  21. package/dest/bin/index.js.map +7 -0
  22. package/dest/bin/oracle_test_server.d.ts +3 -0
  23. package/dest/bin/oracle_test_server.d.ts.map +1 -0
  24. package/dest/bin/oracle_test_server.js +41 -0
  25. package/dest/chunk-BJVAAXNA.js +3 -0
  26. package/dest/chunk-BJVAAXNA.js.map +7 -0
  27. package/dest/chunk-I6DL4FT2.js +304 -0
  28. package/dest/chunk-I6DL4FT2.js.map +7 -0
  29. package/dest/chunk-IAO54JS2.js +266 -0
  30. package/dest/chunk-IAO54JS2.js.map +7 -0
  31. package/dest/constants.d.ts +5 -1
  32. package/dest/constants.d.ts.map +1 -1
  33. package/dest/constants.js +9 -1
  34. package/dest/dispatcher_pool.d.ts +67 -0
  35. package/dest/dispatcher_pool.d.ts.map +1 -0
  36. package/dest/dispatcher_pool.js +286 -0
  37. package/dest/index.d.ts +51 -7
  38. package/dest/index.d.ts.map +1 -1
  39. package/dest/index.js +70 -190
  40. package/dest/metafile.json +39364 -0
  41. package/dest/msgpackr_fr_extension.d.ts +2 -0
  42. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  43. package/dest/msgpackr_fr_extension.js +21 -0
  44. package/dest/oracle/interfaces.d.ts +38 -8
  45. package/dest/oracle/interfaces.d.ts.map +1 -1
  46. package/dest/oracle/test-resolver/default_fixtures.d.ts +9 -0
  47. package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
  48. package/dest/oracle/test-resolver/default_fixtures.js +164 -0
  49. package/dest/oracle/test-resolver/index.d.ts +9 -0
  50. package/dest/oracle/test-resolver/index.d.ts.map +1 -0
  51. package/dest/oracle/test-resolver/index.js +32 -0
  52. package/dest/oracle/test-resolver/resolver.d.ts +48 -0
  53. package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
  54. package/dest/oracle/test-resolver/resolver.js +144 -0
  55. package/dest/oracle/txe_oracle_public_context.d.ts +26 -2
  56. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  57. package/dest/oracle/txe_oracle_public_context.js +43 -1
  58. package/dest/oracle/txe_oracle_registry.d.ts +167 -0
  59. package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
  60. package/dest/oracle/txe_oracle_registry.js +715 -0
  61. package/dest/oracle/txe_oracle_top_level_context.d.ts +42 -17
  62. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  63. package/dest/oracle/txe_oracle_top_level_context.js +205 -70
  64. package/dest/oracle/txe_oracle_version.d.ts +17 -0
  65. package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
  66. package/dest/oracle/txe_oracle_version.js +14 -0
  67. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  68. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  69. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  70. package/dest/rpc_server.d.ts +14 -0
  71. package/dest/rpc_server.d.ts.map +1 -0
  72. package/dest/rpc_server.js +78 -0
  73. package/dest/rpc_translator.d.ts +111 -233
  74. package/dest/rpc_translator.d.ts.map +1 -1
  75. package/dest/rpc_translator.js +759 -636
  76. package/dest/server.bundle.js +3 -0
  77. package/dest/server.bundle.js.map +7 -0
  78. package/dest/state_machine/archiver.d.ts +4 -3
  79. package/dest/state_machine/archiver.d.ts.map +1 -1
  80. package/dest/state_machine/archiver.js +24 -14
  81. package/dest/state_machine/dummy_p2p_client.d.ts +15 -7
  82. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  83. package/dest/state_machine/dummy_p2p_client.js +22 -4
  84. package/dest/state_machine/global_variable_builder.d.ts +10 -6
  85. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  86. package/dest/state_machine/global_variable_builder.js +8 -5
  87. package/dest/state_machine/index.d.ts +9 -6
  88. package/dest/state_machine/index.d.ts.map +1 -1
  89. package/dest/state_machine/index.js +45 -12
  90. package/dest/state_machine/mock_epoch_cache.d.ts +1 -2
  91. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  92. package/dest/state_machine/mock_epoch_cache.js +0 -3
  93. package/dest/state_machine/synchronizer.d.ts +3 -2
  94. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  95. package/dest/state_machine/synchronizer.js +4 -3
  96. package/dest/txe_session.d.ts +89 -20
  97. package/dest/txe_session.d.ts.map +1 -1
  98. package/dest/txe_session.js +289 -64
  99. package/dest/utils/block_creation.d.ts +2 -2
  100. package/dest/utils/block_creation.d.ts.map +1 -1
  101. package/dest/utils/block_creation.js +2 -2
  102. package/dest/utils/encoding.d.ts +191 -0
  103. package/dest/utils/encoding.d.ts.map +1 -0
  104. package/dest/{util → utils}/encoding.js +7 -2
  105. package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
  106. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  107. package/dest/{util → utils}/txe_account_store.d.ts +1 -1
  108. package/dest/utils/txe_account_store.d.ts.map +1 -0
  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/{util → utils}/txe_public_contract_data_source.js +1 -3
  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 +38 -21
  121. package/src/bin/check_txe_oracle_version.ts +70 -0
  122. package/src/bin/index.ts +11 -2
  123. package/src/bin/oracle_test_server.ts +51 -0
  124. package/src/constants.ts +11 -1
  125. package/src/dispatcher_pool.ts +317 -0
  126. package/src/index.ts +97 -227
  127. package/src/msgpackr_fr_extension.ts +23 -0
  128. package/src/oracle/interfaces.ts +35 -7
  129. package/src/oracle/test-resolver/default_fixtures.ts +226 -0
  130. package/src/oracle/test-resolver/index.ts +44 -0
  131. package/src/oracle/test-resolver/resolver.ts +198 -0
  132. package/src/oracle/txe_oracle_public_context.ts +60 -0
  133. package/src/oracle/txe_oracle_registry.ts +494 -0
  134. package/src/oracle/txe_oracle_top_level_context.ts +245 -81
  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 +845 -905
  139. package/src/state_machine/archiver.ts +37 -16
  140. package/src/state_machine/dummy_p2p_client.ts +40 -11
  141. package/src/state_machine/global_variable_builder.ts +12 -11
  142. package/src/state_machine/index.ts +44 -30
  143. package/src/state_machine/mock_epoch_cache.ts +0 -4
  144. package/src/state_machine/synchronizer.ts +4 -3
  145. package/src/txe_session.ts +496 -80
  146. package/src/utils/block_creation.ts +2 -1
  147. package/src/{util → utils}/encoding.ts +8 -2
  148. package/src/utils/txe_artifact_resolver.ts +217 -0
  149. package/src/{util → utils}/txe_public_contract_data_source.ts +0 -2
  150. package/src/worker.ts +98 -0
  151. package/dest/util/encoding.d.ts +0 -720
  152. package/dest/util/encoding.d.ts.map +0 -1
  153. package/dest/util/expected_failure_error.d.ts.map +0 -1
  154. package/dest/util/txe_account_store.d.ts.map +0 -1
  155. package/dest/util/txe_public_contract_data_source.d.ts +0 -20
  156. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  157. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  158. /package/dest/{util → utils}/txe_account_store.js +0 -0
  159. /package/src/{util → utils}/expected_failure_error.ts +0 -0
  160. /package/src/{util → utils}/txe_account_store.ts +0 -0
@@ -1,11 +1,11 @@
1
- import { CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT, DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
1
+ import { CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, MAX_PRIVATE_LOGS_PER_TX, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
2
  import { BlockNumber } from '@aztec/foundation/branded-types';
3
3
  import { Schnorr } from '@aztec/foundation/crypto/schnorr';
4
4
  import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import { LogLevels, applyStringFormatting, createLogger } from '@aztec/foundation/log';
6
6
  import { TestDateProvider } from '@aztec/foundation/timer';
7
- import { ORACLE_VERSION, enrichPublicSimulationError } from '@aztec/pxe/server';
8
- import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle, executePrivateFunction, generateSimulatedProvingResult } from '@aztec/pxe/simulator';
7
+ import { CapsuleService, FactService, ORACLE_VERSION_MAJOR, composeHooks, enrichPublicSimulationError } from '@aztec/pxe/server';
8
+ import { CONTRACT_INSTANCE, ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, PrivateExecutionOracle, TransientArrayService, UtilityExecutionOracle, buildACIRCallback, executePrivateFunction, generateSimulatedProvingResult } from '@aztec/pxe/simulator';
9
9
  import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness, witnessMapToFields } from '@aztec/simulator/client';
10
10
  import { CppPublicTxSimulator, GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor } from '@aztec/simulator/server';
11
11
  import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
@@ -13,17 +13,19 @@ import { AuthWitness } from '@aztec/stdlib/auth-witness';
13
13
  import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
14
14
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
15
15
  import { computePartialAddress } from '@aztec/stdlib/contract';
16
- import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
16
+ import { Gas, GasFees } from '@aztec/stdlib/gas';
17
17
  import { computeCalldataHash, computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
18
18
  import { PartialPrivateTailPublicInputsForPublic, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PublicCallRequest } from '@aztec/stdlib/kernel';
19
+ import { hashPublicKey } from '@aztec/stdlib/keys';
20
+ import { L1Actor, L1ToL2Message, L2Actor } from '@aztec/stdlib/messaging';
19
21
  import { ChonkProof } from '@aztec/stdlib/proofs';
20
22
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
21
23
  import { MerkleTreeId } from '@aztec/stdlib/trees';
22
24
  import { CallContext, HashedValues, PrivateExecutionResult, Tx, TxConstantData, TxContext, TxEffect, TxHash, collectNested } from '@aztec/stdlib/tx';
23
- import { ForkCheckpoint } from '@aztec/world-state';
24
- import { DEFAULT_ADDRESS } from '../constants.js';
25
- import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
25
+ import { ForkCheckpoint } from '@aztec/world-state/native';
26
+ import { DEFAULT_ADDRESS, MAX_PRIVATE_EVENTS_PER_TXE_QUERY, MAX_PRIVATE_EVENT_LEN } from '../constants.js';
26
27
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
28
+ import { TXEPublicContractDataSource } from '../utils/txe_public_contract_data_source.js';
27
29
  export class TXEOracleTopLevelContext {
28
30
  stateMachine;
29
31
  contractStore;
@@ -33,18 +35,22 @@ export class TXEOracleTopLevelContext {
33
35
  accountStore;
34
36
  senderTaggingStore;
35
37
  recipientTaggingStore;
36
- senderAddressBookStore;
38
+ taggingSecretSourcesStore;
37
39
  capsuleStore;
40
+ factStore;
38
41
  privateEventStore;
39
42
  nextBlockTimestamp;
40
43
  version;
41
44
  chainId;
42
45
  authwits;
43
- contractSyncService;
46
+ taggingSecretStrategy;
47
+ artifactResolver;
48
+ rootPath;
49
+ packageName;
44
50
  isMisc;
45
51
  isTxe;
46
52
  logger;
47
- constructor(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, authwits, contractSyncService){
53
+ constructor(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, taggingSecretSourcesStore, capsuleStore, factStore, privateEventStore, nextBlockTimestamp, version, chainId, authwits, taggingSecretStrategy, artifactResolver, rootPath, packageName){
48
54
  this.stateMachine = stateMachine;
49
55
  this.contractStore = contractStore;
50
56
  this.noteStore = noteStore;
@@ -53,23 +59,37 @@ export class TXEOracleTopLevelContext {
53
59
  this.accountStore = accountStore;
54
60
  this.senderTaggingStore = senderTaggingStore;
55
61
  this.recipientTaggingStore = recipientTaggingStore;
56
- this.senderAddressBookStore = senderAddressBookStore;
62
+ this.taggingSecretSourcesStore = taggingSecretSourcesStore;
57
63
  this.capsuleStore = capsuleStore;
64
+ this.factStore = factStore;
58
65
  this.privateEventStore = privateEventStore;
59
66
  this.nextBlockTimestamp = nextBlockTimestamp;
60
67
  this.version = version;
61
68
  this.chainId = chainId;
62
69
  this.authwits = authwits;
63
- this.contractSyncService = contractSyncService;
70
+ this.taggingSecretStrategy = taggingSecretStrategy;
71
+ this.artifactResolver = artifactResolver;
72
+ this.rootPath = rootPath;
73
+ this.packageName = packageName;
64
74
  this.isMisc = true;
65
75
  this.isTxe = true;
66
76
  this.logger = createLogger('txe:top_level_context');
67
77
  this.logger.debug('Entering Top Level Context');
68
78
  }
69
- assertCompatibleOracleVersion(version) {
70
- if (version !== ORACLE_VERSION) {
71
- throw new Error(`Incompatible oracle version. TXE is using version '${ORACLE_VERSION}', but got a request for '${version}'.`);
79
+ contractOracleVersion;
80
+ assertCompatibleOracleVersion(major, minor) {
81
+ if (major !== ORACLE_VERSION_MAJOR) {
82
+ 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.';
83
+ throw new Error(`Incompatible aztec cli version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle major version ${ORACLE_VERSION_MAJOR}, got ${major})`);
72
84
  }
85
+ this.contractOracleVersion = {
86
+ major,
87
+ minor
88
+ };
89
+ }
90
+ // Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
91
+ nonOracleFunctionGetContractOracleVersion() {
92
+ return this.contractOracleVersion;
73
93
  }
74
94
  // This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
75
95
  // setup.
@@ -77,7 +97,7 @@ export class TXEOracleTopLevelContext {
77
97
  return Fr.random();
78
98
  }
79
99
  // We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
80
- log(level, message, fields) {
100
+ log(level, message, _fieldsSize, fields) {
81
101
  if (!LogLevels[level]) {
82
102
  throw new Error(`Invalid log level: ${level}`);
83
103
  }
@@ -97,20 +117,27 @@ export class TXEOracleTopLevelContext {
97
117
  return Promise.resolve(this.nextBlockTimestamp);
98
118
  }
99
119
  async getLastBlockTimestamp() {
100
- return (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.timestamp;
120
+ return (await this.stateMachine.node.getBlockData('latest')).header.globalVariables.timestamp;
101
121
  }
102
122
  async getLastTxEffects() {
103
123
  const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
104
- const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
124
+ const block = await this.stateMachine.archiver.getBlock({
125
+ number: latestBlockNumber
126
+ });
105
127
  if (block.body.txEffects.length != 1) {
106
128
  // Note that calls like env.mine() will result in blocks with no transactions, hitting this
107
129
  throw new Error(`Expected a single transaction in the last block, found ${block.body.txEffects.length}`);
108
130
  }
109
131
  const txEffects = block.body.txEffects[0];
132
+ const privateLogs = txEffects.privateLogs;
133
+ if (privateLogs.length > MAX_PRIVATE_LOGS_PER_TX) {
134
+ throw new Error(`${privateLogs.length} private logs exceed max ${MAX_PRIVATE_LOGS_PER_TX}`);
135
+ }
110
136
  return {
111
137
  txHash: txEffects.txHash,
112
138
  noteHashes: txEffects.noteHashes,
113
- nullifiers: txEffects.nullifiers
139
+ nullifiers: txEffects.nullifiers,
140
+ privateLogs
114
141
  };
115
142
  }
116
143
  async syncContractNonOracleMethod(contractAddress, scope, jobId) {
@@ -120,13 +147,16 @@ export class TXEOracleTopLevelContext {
120
147
  }
121
148
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
122
149
  await this.stateMachine.contractSyncService.ensureContractSynced(contractAddress, null, async (call, execScopes)=>{
123
- await this.executeUtilityCall(call, execScopes, jobId);
150
+ await this.executeUtilityCall(call, {
151
+ scopes: execScopes,
152
+ jobId
153
+ });
124
154
  }, blockHeader, jobId, [
125
155
  scope
126
156
  ]);
127
157
  }
128
158
  async getPrivateEvents(selector, contractAddress, scope) {
129
- return (await this.privateEventStore.getPrivateEvents(selector, {
159
+ const events = (await this.privateEventStore.getPrivateEvents(selector, {
130
160
  contractAddress,
131
161
  scopes: [
132
162
  scope
@@ -134,6 +164,13 @@ export class TXEOracleTopLevelContext {
134
164
  fromBlock: 0,
135
165
  toBlock: await this.getLastBlockNumber() + 1
136
166
  })).map((e)=>e.packedEvent);
167
+ if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
168
+ throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
169
+ }
170
+ if (events.some((e)=>e.length > MAX_PRIVATE_EVENT_LEN)) {
171
+ throw new Error(`Some private event has length larger than maxLen ${MAX_PRIVATE_EVENT_LEN}`);
172
+ }
173
+ return events;
137
174
  }
138
175
  async advanceBlocksBy(blocks) {
139
176
  this.logger.debug(`time traveling ${blocks} blocks`);
@@ -145,22 +182,47 @@ export class TXEOracleTopLevelContext {
145
182
  this.logger.debug(`time traveling ${duration} seconds`);
146
183
  this.nextBlockTimestamp += duration;
147
184
  }
148
- async deploy(artifact, instance, secret) {
185
+ deploymentNullifier(address) {
186
+ return siloNullifier(AztecAddress.fromNumberUnsafe(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), address.toField());
187
+ }
188
+ async deploy(contractPath, initializer, args, secret, salt, deployer) {
189
+ const { artifact, instance } = await this.artifactResolver.resolveDeployArtifact({
190
+ rootPath: this.rootPath,
191
+ packageName: this.packageName,
192
+ contractPath,
193
+ initializer,
194
+ args,
195
+ secret,
196
+ salt,
197
+ deployer
198
+ });
149
199
  // Emit deployment nullifier
150
200
  await this.mineBlock({
151
201
  nullifiers: [
152
- await siloNullifier(AztecAddress.fromNumber(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), instance.address.toField())
202
+ await this.deploymentNullifier(instance.address)
153
203
  ]
154
204
  });
155
205
  if (!secret.equals(Fr.ZERO)) {
156
- await this.addAccount(artifact, instance, secret);
206
+ await this.registerContractAndAddAccount(artifact, instance, secret);
157
207
  } else {
158
208
  await this.contractStore.addContractInstance(instance);
159
209
  await this.contractStore.addContractArtifact(artifact);
160
210
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
161
211
  }
212
+ return CONTRACT_INSTANCE.serialization.fn(instance).flat();
213
+ }
214
+ /**
215
+ * Mines a single block containing only the deployment nullifiers for the contracts at the given addresses.
216
+ */ async mineDeploymentNullifiers(addresses) {
217
+ await this.mineBlock({
218
+ nullifiers: await Promise.all(addresses.map((address)=>this.deploymentNullifier(address)))
219
+ });
220
+ }
221
+ async addAccount(secret) {
222
+ const { artifact, instance } = await this.artifactResolver.resolveAccountArtifact(secret);
223
+ return this.registerContractAndAddAccount(artifact, instance, secret);
162
224
  }
163
- async addAccount(artifact, instance, secret) {
225
+ async registerContractAndAddAccount(artifact, instance, secret) {
164
226
  const partialAddress = await computePartialAddress(instance);
165
227
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
166
228
  await this.contractStore.addContractInstance(instance);
@@ -181,14 +243,28 @@ export class TXEOracleTopLevelContext {
181
243
  }
182
244
  async addAuthWitness(address, messageHash) {
183
245
  const account = await this.accountStore.getAccount(address);
184
- const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
246
+ const ivpkMHash = await hashPublicKey(account.publicKeys.ivpkM);
247
+ const privateKey = await this.keyStore.getMasterSecretKey(ivpkMHash);
185
248
  const schnorr = new Schnorr();
186
- const signature = await schnorr.constructSignature(messageHash.toBuffer(), privateKey);
187
- const authWitness = new AuthWitness(messageHash, [
188
- ...signature.toBuffer()
189
- ]);
249
+ const signature = await schnorr.constructSignature(messageHash, privateKey);
250
+ const authWitness = new AuthWitness(messageHash, signature.toLimbFields());
190
251
  this.authwits.set(authWitness.requestHash.toString(), authWitness);
191
252
  }
253
+ setTaggingSecretStrategy(strategy) {
254
+ this.taggingSecretStrategy = strategy.value;
255
+ }
256
+ async sendL1ToL2Message(content, secretHash, sender, recipient) {
257
+ // Messages are appended to the tree, so the next free slot is simply the current tree size.
258
+ const { size } = await this.stateMachine.synchronizer.getCommitted().getTreeInfo(MerkleTreeId.L1_TO_L2_MESSAGE_TREE);
259
+ const leafIndex = new Fr(size);
260
+ const message = new L1ToL2Message(new L1Actor(sender, this.chainId.toNumber()), new L2Actor(recipient, this.version.toNumber()), content, secretHash, leafIndex);
261
+ await this.mineBlock({
262
+ l1ToL2Messages: [
263
+ message.hash()
264
+ ]
265
+ });
266
+ return leafIndex;
267
+ }
192
268
  async mineBlock(options = {}) {
193
269
  const blockNumber = await this.getNextBlockNumber();
194
270
  const txEffect = TxEffect.empty();
@@ -198,7 +274,7 @@ export class TXEOracleTopLevelContext {
198
274
  ];
199
275
  txEffect.txHash = new TxHash(new Fr(blockNumber));
200
276
  const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
201
- await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
277
+ await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees, options.l1ToL2Messages ?? []);
202
278
  const globals = makeGlobalVariables(undefined, {
203
279
  blockNumber,
204
280
  timestamp: this.nextBlockTimestamp,
@@ -210,31 +286,31 @@ export class TXEOracleTopLevelContext {
210
286
  ]);
211
287
  await forkedWorldTrees.close();
212
288
  this.logger.info(`Created block ${blockNumber} with timestamp ${block.header.globalVariables.timestamp}`);
213
- await this.stateMachine.handleL2Block(block);
289
+ await this.stateMachine.handleL2Block(block, options.l1ToL2Messages ?? []);
214
290
  }
215
- async privateCallNewFlow(from, targetContractAddress = AztecAddress.zero(), functionSelector = FunctionSelector.empty(), args, argsHash = Fr.zero(), isStaticCall = false, jobId) {
291
+ async privateCallNewFlow(from, targetContractAddress = AztecAddress.zero(), functionSelector = FunctionSelector.empty(), args, argsHash = Fr.zero(), isStaticCall = false, additionalScopes = [], jobId, authorizedUtilityCallTargets, gasSettings) {
216
292
  this.logger.verbose(`Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`);
217
293
  const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
218
294
  if (!artifact) {
219
295
  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';
220
296
  throw new Error(message);
221
297
  }
222
- // When `from` is the zero address (e.g. when deploying a new account contract), we return an
223
- // empty scope list which acts as deny-all: no notes are visible and no keys are accessible.
224
- const effectiveScopes = from.isZero() ? [] : [
225
- from
298
+ const scopes = from === undefined ? additionalScopes : [
299
+ from,
300
+ ...additionalScopes
226
301
  ];
227
302
  // Sync notes before executing private function to discover notes from previous transactions
228
303
  const utilityExecutor = async (call, execScopes)=>{
229
- await this.executeUtilityCall(call, execScopes, jobId);
304
+ await this.executeUtilityCall(call, {
305
+ scopes: execScopes,
306
+ jobId
307
+ });
230
308
  };
231
309
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
232
- await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, utilityExecutor, blockHeader, jobId, effectiveScopes);
310
+ await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, utilityExecutor, blockHeader, jobId, scopes);
233
311
  const blockNumber = await this.getNextBlockNumber();
234
- const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
235
- const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
236
- const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
237
- const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
312
+ const msgSender = from ?? AztecAddress.NULL_MSG_SENDER;
313
+ const callContext = new CallContext(msgSender, targetContractAddress, functionSelector, isStaticCall);
238
314
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
239
315
  const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
240
316
  const noteCache = new ExecutionNoteCache(protocolNullifier);
@@ -245,6 +321,8 @@ export class TXEOracleTopLevelContext {
245
321
  await noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
246
322
  const taggingIndexCache = new ExecutionTaggingIndexCache();
247
323
  const simulator = new WASMSimulator();
324
+ const transientArrayService = new TransientArrayService();
325
+ const taggingSecretStrategy = this.taggingSecretStrategy;
248
326
  const privateExecutionOracle = new PrivateExecutionOracle({
249
327
  argsHash,
250
328
  txContext,
@@ -265,19 +343,28 @@ export class TXEOracleTopLevelContext {
265
343
  aztecNode: this.stateMachine.node,
266
344
  senderTaggingStore: this.senderTaggingStore,
267
345
  recipientTaggingStore: this.recipientTaggingStore,
268
- senderAddressBookStore: this.senderAddressBookStore,
269
- capsuleStore: this.capsuleStore,
346
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
347
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
348
+ factService: new FactService(this.factStore, scopes),
270
349
  privateEventStore: this.privateEventStore,
271
350
  contractSyncService: this.stateMachine.contractSyncService,
272
351
  jobId,
273
352
  totalPublicCalldataCount: 0,
274
353
  sideEffectCounter: minRevertibleSideEffectCounter,
275
- scopes: effectiveScopes,
354
+ scopes,
276
355
  // In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
277
356
  // contract would perform, including setting senderForTags.
278
357
  senderForTags: from,
279
358
  simulator,
280
- messageContextService: this.stateMachine.messageContextService
359
+ txResolver: this.stateMachine.txResolver,
360
+ l2TipsStore: this.stateMachine.l2TipsProvider,
361
+ hooks: composeHooks({
362
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook(isStaticCall ? 'private view' : 'private', authorizedUtilityCallTargets),
363
+ // Only configure the hook when a strategy was explicitly set, so that otherwise the default tagging secret
364
+ // strategy is exercised.
365
+ resolveTaggingSecretStrategy: taggingSecretStrategy ? ()=>Promise.resolve(taggingSecretStrategy) : undefined
366
+ }),
367
+ transientArrayService
281
368
  });
282
369
  // 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.
283
370
  let result;
@@ -290,7 +377,7 @@ export class TXEOracleTopLevelContext {
290
377
  r.publicInputs.publicTeardownCallRequest
291
378
  ]));
292
379
  const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
293
- const calldata = await privateExecutionOracle.loadFromExecutionCache(r.calldataHash);
380
+ const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
294
381
  return new HashedValues(calldata, r.calldataHash);
295
382
  }));
296
383
  noteCache.finish();
@@ -349,10 +436,20 @@ export class TXEOracleTopLevelContext {
349
436
  throw new Error('Contract execution has reverted');
350
437
  }
351
438
  }
439
+ // Walk the nested private-call tree and collect every offchain effect the transaction emitted.
440
+ // PXE stores these on each `PrivateCallExecutionResult` and they never reach TXE via the
441
+ // `aztec_utl_emitOffchainEffect` foreign-call path (that path only fires at the top-level), so
442
+ // we pull them out here and the RPC wrapper will hand them to `TXESession` for buffering.
443
+ const offchainEffects = collectNested([
444
+ executionResult
445
+ ], (r)=>r.offchainEffects.map((e)=>e.data));
352
446
  if (isStaticCall) {
353
447
  await checkpoint.revert();
354
448
  await forkedWorldTrees.close();
355
- return executionResult.returnValues ?? [];
449
+ return {
450
+ returnValues: executionResult.returnValues ?? [],
451
+ offchainEffects
452
+ };
356
453
  }
357
454
  const txEffect = TxEffect.empty();
358
455
  txEffect.noteHashes = processedTx.txEffect.noteHashes;
@@ -368,14 +465,14 @@ export class TXEOracleTopLevelContext {
368
465
  ]);
369
466
  await this.stateMachine.handleL2Block(l2Block);
370
467
  await forkedWorldTrees.close();
371
- return executionResult.returnValues ?? [];
468
+ return {
469
+ returnValues: executionResult.returnValues ?? [],
470
+ offchainEffects
471
+ };
372
472
  }
373
- async publicCallNewFlow(from, targetContractAddress, calldata, isStaticCall) {
473
+ async publicCallNewFlow(from, targetContractAddress, calldata, isStaticCall, gasSettings) {
374
474
  this.logger.verbose(`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`);
375
475
  const blockNumber = await this.getNextBlockNumber();
376
- const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
377
- const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
378
- const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
379
476
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
380
477
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
381
478
  const calldataHash = await computeCalldataHash(calldata);
@@ -408,7 +505,7 @@ export class TXEOracleTopLevelContext {
408
505
  // The enqueued public call itself we make be revertible so that the public execution is itself revertible, as tests
409
506
  // may require producing reverts.
410
507
  const revertibleAccumulatedData = PrivateToPublicAccumulatedData.empty();
411
- revertibleAccumulatedData.publicCallRequests[0] = new PublicCallRequest(from, targetContractAddress, isStaticCall, calldataHash);
508
+ revertibleAccumulatedData.publicCallRequests[0] = new PublicCallRequest(from ?? AztecAddress.NULL_MSG_SENDER, targetContractAddress, isStaticCall, calldataHash);
412
509
  const inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleAccumulatedData, revertibleAccumulatedData, PublicCallRequest.empty());
413
510
  const constantData = new TxConstantData(anchorBlockHeader, txContext, Fr.zero(), Fr.zero());
414
511
  const txData = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), /*expirationTimestamp=*/ 0n, inputsForPublic, undefined);
@@ -464,7 +561,7 @@ export class TXEOracleTopLevelContext {
464
561
  await forkedWorldTrees.close();
465
562
  return returnValues ?? [];
466
563
  }
467
- async executeUtilityFunction(targetContractAddress, functionSelector, args, jobId) {
564
+ async executeUtilityFunction(from, targetContractAddress, functionSelector, args, jobId, authorizedUtilityCallTargets) {
468
565
  const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
469
566
  if (!artifact) {
470
567
  throw new Error(`Cannot call ${functionSelector} as there is no artifact found at ${targetContractAddress}.`);
@@ -472,8 +569,11 @@ export class TXEOracleTopLevelContext {
472
569
  // Sync notes before executing utility function to discover notes from previous transactions
473
570
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
474
571
  await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, async (call, execScopes)=>{
475
- await this.executeUtilityCall(call, execScopes, jobId);
476
- }, blockHeader, jobId, 'ALL_SCOPES');
572
+ await this.executeUtilityCall(call, {
573
+ scopes: execScopes,
574
+ jobId
575
+ });
576
+ }, blockHeader, jobId, await this.keyStore.getAccounts());
477
577
  const call = FunctionCall.from({
478
578
  name: artifact.name,
479
579
  to: targetContractAddress,
@@ -484,9 +584,14 @@ export class TXEOracleTopLevelContext {
484
584
  args,
485
585
  returnTypes: []
486
586
  });
487
- return this.executeUtilityCall(call, 'ALL_SCOPES', jobId);
587
+ return this.executeUtilityCall(call, {
588
+ from,
589
+ scopes: await this.keyStore.getAccounts(),
590
+ jobId,
591
+ authorizedUtilityCallTargets
592
+ });
488
593
  }
489
- async executeUtilityCall(call, scopes, jobId) {
594
+ async executeUtilityCall(call, { from = AztecAddress.NULL_MSG_SENDER, scopes, jobId, authorizedUtilityCallTargets = [] }) {
490
595
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
491
596
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
492
597
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
@@ -497,8 +602,20 @@ export class TXEOracleTopLevelContext {
497
602
  });
498
603
  try {
499
604
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
605
+ const simulator = new WASMSimulator();
606
+ const utilityExecutor = async (syncCall, execScopes)=>{
607
+ await this.executeUtilityCall(syncCall, {
608
+ scopes: execScopes,
609
+ jobId
610
+ });
611
+ };
500
612
  const oracle = new UtilityExecutionOracle({
501
- contractAddress: call.to,
613
+ callContext: CallContext.from({
614
+ msgSender: from,
615
+ contractAddress: call.to,
616
+ functionSelector: call.selector,
617
+ isStaticCall: true
618
+ }),
502
619
  authWitnesses: [],
503
620
  capsules: [],
504
621
  anchorBlockHeader,
@@ -508,15 +625,24 @@ export class TXEOracleTopLevelContext {
508
625
  addressStore: this.addressStore,
509
626
  aztecNode: this.stateMachine.node,
510
627
  recipientTaggingStore: this.recipientTaggingStore,
511
- senderAddressBookStore: this.senderAddressBookStore,
512
- capsuleStore: this.capsuleStore,
628
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
629
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
630
+ factService: new FactService(this.factStore, scopes),
513
631
  privateEventStore: this.privateEventStore,
514
- messageContextService: this.stateMachine.messageContextService,
515
- contractSyncService: this.contractSyncService,
632
+ txResolver: this.stateMachine.txResolver,
633
+ contractSyncService: this.stateMachine.contractSyncService,
634
+ l2TipsStore: this.stateMachine.l2TipsProvider,
516
635
  jobId,
517
- scopes
636
+ scopes,
637
+ simulator,
638
+ hooks: composeHooks({
639
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook('utility', authorizedUtilityCallTargets)
640
+ }),
641
+ utilityExecutor,
642
+ // Execution-tree root (top-level utility run or contract sync): own store; nested frames inherit it.
643
+ transientArrayService: new TransientArrayService()
518
644
  });
519
- const acirExecutionResult = await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
645
+ const acirExecutionResult = await simulator.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, buildACIRCallback(oracle)).catch((err)=>{
520
646
  err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
521
647
  throw new ExecutionError(err.message, {
522
648
  contractAddress: call.to,
@@ -535,11 +661,20 @@ export class TXEOracleTopLevelContext {
535
661
  this.logger.debug('Exiting Top Level Context');
536
662
  return [
537
663
  this.nextBlockTimestamp,
538
- this.authwits
664
+ this.authwits,
665
+ this.taggingSecretStrategy
539
666
  ];
540
667
  }
541
668
  async getLastBlockNumber() {
542
- const header = await this.stateMachine.node.getBlockHeader('latest');
543
- return header ? header.globalVariables.blockNumber : BlockNumber.ZERO;
669
+ const block = await this.stateMachine.node.getBlock('latest');
670
+ return block ? block.header.globalVariables.blockNumber : BlockNumber.ZERO;
671
+ }
672
+ buildAuthorizeUtilityCallHook(callerContext, authorizedTargets) {
673
+ if (authorizedTargets.length === 0) {
674
+ return undefined;
675
+ }
676
+ return (req)=>Promise.resolve({
677
+ authorized: req.callerContext === callerContext && authorizedTargets.some((t)=>t.equals(req.target))
678
+ });
544
679
  }
545
680
  }
@@ -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 = 2;
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 = "118698345ea9d368ca82ea574a051e72f4df0b85454539ade14838a934976b62";
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 = 2;
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 = '118698345ea9d368ca82ea574a051e72f4df0b85454539ade14838a934976b62';
@@ -0,0 +1,17 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { PrivateExecutionOracle } from '@aztec/pxe/simulator';
3
+ import type { FunctionSelector } from '@aztec/stdlib/abi';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ /**
6
+ * TXE-specific subclass of PrivateExecutionOracle that forbids operations not supported in
7
+ * TestEnvironment::private_context. TXE uses dedicated oracle flows (e.g. private_call) instead.
8
+ */
9
+ export declare class TXEPrivateExecutionOracle extends PrivateExecutionOracle {
10
+ callPrivateFunction(_targetContractAddress: AztecAddress, _functionSelector: FunctionSelector, _argsHash: Fr, _sideEffectCounter: number, _isStaticCall: boolean): Promise<{
11
+ endSideEffectCounter: Fr;
12
+ returnsHash: Fr;
13
+ }>;
14
+ assertValidPublicCalldata(_calldataHash: Fr): Promise<void>;
15
+ notifyRevertiblePhaseStart(_minRevertibleSideEffectCounter: number): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3ByaXZhdGVfZXhlY3V0aW9uX29yYWNsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL29yYWNsZS90eGVfcHJpdmF0ZV9leGVjdXRpb25fb3JhY2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7OztHQUdHO0FBQ0gscUJBQWEseUJBQTBCLFNBQVEsc0JBQXNCO0lBQzFELG1CQUFtQixDQUMxQixzQkFBc0IsRUFBRSxZQUFZLEVBQ3BDLGlCQUFpQixFQUFFLGdCQUFnQixFQUNuQyxTQUFTLEVBQUUsRUFBRSxFQUNiLGtCQUFrQixFQUFFLE1BQU0sRUFDMUIsYUFBYSxFQUFFLE9BQU8sR0FDckIsT0FBTyxDQUFDO1FBQUUsb0JBQW9CLEVBQUUsRUFBRSxDQUFDO1FBQUMsV0FBVyxFQUFFLEVBQUUsQ0FBQTtLQUFFLENBQUMsQ0FJeEQ7SUFFUSx5QkFBeUIsQ0FBQyxhQUFhLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFbkU7SUFFUSwwQkFBMEIsQ0FBQywrQkFBK0IsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUxRjtDQUNGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txe_private_execution_oracle.d.ts","sourceRoot":"","sources":["../../src/oracle/txe_private_execution_oracle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,sBAAsB;IAC1D,mBAAmB,CAC1B,sBAAsB,EAAE,YAAY,EACpC,iBAAiB,EAAE,gBAAgB,EACnC,SAAS,EAAE,EAAE,EACb,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC;QAAE,oBAAoB,EAAE,EAAE,CAAC;QAAC,WAAW,EAAE,EAAE,CAAA;KAAE,CAAC,CAIxD;IAEQ,yBAAyB,CAAC,aAAa,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;IAEQ,0BAA0B,CAAC,+BAA+B,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1F;CACF"}
@@ -0,0 +1,15 @@
1
+ import { PrivateExecutionOracle } from '@aztec/pxe/simulator';
2
+ /**
3
+ * TXE-specific subclass of PrivateExecutionOracle that forbids operations not supported in
4
+ * TestEnvironment::private_context. TXE uses dedicated oracle flows (e.g. private_call) instead.
5
+ */ export class TXEPrivateExecutionOracle extends PrivateExecutionOracle {
6
+ callPrivateFunction(_targetContractAddress, _functionSelector, _argsHash, _sideEffectCounter, _isStaticCall) {
7
+ throw new Error('Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead');
8
+ }
9
+ assertValidPublicCalldata(_calldataHash) {
10
+ throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
11
+ }
12
+ notifyRevertiblePhaseStart(_minRevertibleSideEffectCounter) {
13
+ throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
14
+ }
15
+ }
@@ -0,0 +1,14 @@
1
+ import type { Logger } from '@aztec/foundation/log';
2
+ /**
3
+ * Creates the TXE RPC server. With `TXE_WORKERS=1` oracle calls run on the main thread (no
4
+ * worker_threads, no IPC overhead). With any other value oracle calls are
5
+ * routed to a pool of worker threads sized to that value, sticky by `session_id`.
6
+ *
7
+ * Each incoming TCP socket is tagged with the `session_id` of the first oracle call it carries —
8
+ * nargo uses one HTTP client per test, so the socket-to-session mapping is 1:1. When the socket
9
+ * closes (end of test), the dispatcher disposes the session and frees its world state + LMDB.
10
+ *
11
+ * Lives in its own module so the worker bundle does not pull in the HTTP server stack.
12
+ */
13
+ export declare function createTXERpcServer(logger: Logger): Promise<import("@aztec/foundation/json-rpc/server").SafeJsonRpcServer>;
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjX3NlcnZlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3JwY19zZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFlcEQ7Ozs7Ozs7Ozs7R0FVRztBQUNILHdCQUFzQixrQkFBa0IsQ0FBQyxNQUFNLEVBQUUsTUFBTSwwRUE0Q3REIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc_server.d.ts","sourceRoot":"","sources":["../src/rpc_server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAepD;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,0EA4CtD"}