@aztec/txe 0.0.1-commit.86469d5 → 0.0.1-commit.8655d4a

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 (134) hide show
  1. package/dest/ContractClassRegistry-KKNT527R.js +3 -0
  2. package/dest/ContractClassRegistry-KKNT527R.js.map +7 -0
  3. package/dest/ContractInstanceRegistry-GSKBNL3Q.js +3 -0
  4. package/dest/ContractInstanceRegistry-GSKBNL3Q.js.map +7 -0
  5. package/dest/FeeJuice-GUJ5O6GB.js +3 -0
  6. package/dest/FeeJuice-GUJ5O6GB.js.map +7 -0
  7. package/dest/MultiCallEntrypoint-ZQPCKVKL.js +3 -0
  8. package/dest/MultiCallEntrypoint-ZQPCKVKL.js.map +7 -0
  9. package/dest/SchnorrAccount-QIXE5DXA.js +3 -0
  10. package/dest/SchnorrAccount-QIXE5DXA.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 +32 -0
  14. package/dest/bin/index.js +3 -30
  15. package/dest/bin/index.js.map +7 -0
  16. package/dest/chunk-BJVAAXNA.js +3 -0
  17. package/dest/chunk-BJVAAXNA.js.map +7 -0
  18. package/dest/chunk-DF6RMOC6.js +304 -0
  19. package/dest/chunk-DF6RMOC6.js.map +7 -0
  20. package/dest/chunk-PPJTNNUG.js +265 -0
  21. package/dest/chunk-PPJTNNUG.js.map +7 -0
  22. package/dest/constants.d.ts +3 -1
  23. package/dest/constants.d.ts.map +1 -1
  24. package/dest/constants.js +5 -0
  25. package/dest/dispatcher_pool.d.ts +67 -0
  26. package/dest/dispatcher_pool.d.ts.map +1 -0
  27. package/dest/dispatcher_pool.js +284 -0
  28. package/dest/index.d.ts +188 -7
  29. package/dest/index.d.ts.map +1 -1
  30. package/dest/index.js +148 -75
  31. package/dest/metafile.json +38147 -0
  32. package/dest/msgpackr_fr_extension.d.ts +2 -0
  33. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  34. package/dest/msgpackr_fr_extension.js +21 -0
  35. package/dest/oracle/interfaces.d.ts +40 -28
  36. package/dest/oracle/interfaces.d.ts.map +1 -1
  37. package/dest/oracle/txe_oracle_public_context.d.ts +18 -13
  38. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  39. package/dest/oracle/txe_oracle_public_context.js +27 -12
  40. package/dest/oracle/txe_oracle_top_level_context.d.ts +39 -24
  41. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  42. package/dest/oracle/txe_oracle_top_level_context.js +205 -78
  43. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  44. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  45. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  46. package/dest/rpc_server.d.ts +14 -0
  47. package/dest/rpc_server.d.ts.map +1 -0
  48. package/dest/rpc_server.js +78 -0
  49. package/dest/rpc_translator.d.ts +140 -84
  50. package/dest/rpc_translator.d.ts.map +1 -1
  51. package/dest/rpc_translator.js +587 -239
  52. package/dest/server.bundle.js +3 -0
  53. package/dest/server.bundle.js.map +7 -0
  54. package/dest/state_machine/archiver.d.ts +4 -4
  55. package/dest/state_machine/archiver.d.ts.map +1 -1
  56. package/dest/state_machine/archiver.js +24 -20
  57. package/dest/state_machine/dummy_p2p_client.d.ts +26 -16
  58. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  59. package/dest/state_machine/dummy_p2p_client.js +44 -20
  60. package/dest/state_machine/global_variable_builder.d.ts +9 -4
  61. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  62. package/dest/state_machine/global_variable_builder.js +9 -3
  63. package/dest/state_machine/index.d.ts +10 -6
  64. package/dest/state_machine/index.d.ts.map +1 -1
  65. package/dest/state_machine/index.js +35 -12
  66. package/dest/state_machine/mock_epoch_cache.d.ts +20 -3
  67. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  68. package/dest/state_machine/mock_epoch_cache.js +39 -2
  69. package/dest/state_machine/synchronizer.d.ts +5 -5
  70. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  71. package/dest/state_machine/synchronizer.js +4 -4
  72. package/dest/txe_oracle_version.d.ts +17 -0
  73. package/dest/txe_oracle_version.d.ts.map +1 -0
  74. package/dest/txe_oracle_version.js +14 -0
  75. package/dest/txe_session.d.ts +71 -10
  76. package/dest/txe_session.d.ts.map +1 -1
  77. package/dest/txe_session.js +227 -40
  78. package/dest/utils/block_creation.d.ts +1 -1
  79. package/dest/utils/block_creation.d.ts.map +1 -1
  80. package/dest/utils/block_creation.js +3 -1
  81. package/dest/utils/encoding.d.ts +191 -0
  82. package/dest/utils/encoding.d.ts.map +1 -0
  83. package/dest/{util → utils}/encoding.js +7 -2
  84. package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
  85. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  86. package/dest/{util → utils}/txe_account_store.d.ts +1 -1
  87. package/dest/utils/txe_account_store.d.ts.map +1 -0
  88. package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
  89. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
  90. package/dest/{util → utils}/txe_public_contract_data_source.js +6 -25
  91. package/dest/worker.bundle.js +3 -0
  92. package/dest/worker.bundle.js.map +7 -0
  93. package/dest/worker.d.ts +2 -0
  94. package/dest/worker.d.ts.map +1 -0
  95. package/dest/worker.js +92 -0
  96. package/package.json +37 -21
  97. package/src/bin/check_txe_oracle_version.ts +37 -0
  98. package/src/bin/index.ts +11 -2
  99. package/src/constants.ts +6 -0
  100. package/src/dispatcher_pool.ts +316 -0
  101. package/src/index.ts +166 -80
  102. package/src/msgpackr_fr_extension.ts +23 -0
  103. package/src/oracle/interfaces.ts +48 -34
  104. package/src/oracle/txe_oracle_public_context.ts +42 -12
  105. package/src/oracle/txe_oracle_top_level_context.ts +231 -144
  106. package/src/oracle/txe_private_execution_oracle.ts +30 -0
  107. package/src/rpc_server.ts +87 -0
  108. package/src/rpc_translator.ts +662 -316
  109. package/src/state_machine/archiver.ts +35 -18
  110. package/src/state_machine/dummy_p2p_client.ts +70 -32
  111. package/src/state_machine/global_variable_builder.ts +18 -3
  112. package/src/state_machine/index.ts +48 -13
  113. package/src/state_machine/mock_epoch_cache.ts +51 -3
  114. package/src/state_machine/synchronizer.ts +5 -5
  115. package/src/txe_oracle_version.ts +17 -0
  116. package/src/txe_session.ts +324 -90
  117. package/src/utils/block_creation.ts +3 -1
  118. package/src/{util → utils}/encoding.ts +8 -2
  119. package/src/{util → utils}/txe_public_contract_data_source.ts +10 -38
  120. package/src/worker.ts +98 -0
  121. package/dest/util/encoding.d.ts +0 -720
  122. package/dest/util/encoding.d.ts.map +0 -1
  123. package/dest/util/expected_failure_error.d.ts.map +0 -1
  124. package/dest/util/txe_account_store.d.ts.map +0 -1
  125. package/dest/util/txe_contract_store.d.ts +0 -12
  126. package/dest/util/txe_contract_store.d.ts.map +0 -1
  127. package/dest/util/txe_contract_store.js +0 -22
  128. package/dest/util/txe_public_contract_data_source.d.ts +0 -21
  129. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  130. package/src/util/txe_contract_store.ts +0 -36
  131. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  132. /package/dest/{util → utils}/txe_account_store.js +0 -0
  133. /package/src/{util → utils}/expected_failure_error.ts +0 -0
  134. /package/src/{util → utils}/txe_account_store.ts +0 -0
@@ -1,10 +1,10 @@
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, syncState } from '@aztec/pxe/server';
7
+ import { CapsuleService, ORACLE_VERSION_MAJOR, composeHooks, enrichPublicSimulationError } from '@aztec/pxe/server';
8
8
  import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle, 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';
@@ -13,17 +13,18 @@ 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';
19
20
  import { ChonkProof } from '@aztec/stdlib/proofs';
20
21
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
21
22
  import { MerkleTreeId } from '@aztec/stdlib/trees';
22
23
  import { CallContext, HashedValues, PrivateExecutionResult, Tx, TxConstantData, TxContext, TxEffect, TxHash, collectNested } from '@aztec/stdlib/tx';
23
- import { ForkCheckpoint } from '@aztec/world-state';
24
+ import { ForkCheckpoint } from '@aztec/world-state/native';
24
25
  import { DEFAULT_ADDRESS } from '../constants.js';
25
- import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
26
26
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
27
+ import { TXEPublicContractDataSource } from '../utils/txe_public_contract_data_source.js';
27
28
  export class TXEOracleTopLevelContext {
28
29
  stateMachine;
29
30
  contractStore;
@@ -36,7 +37,6 @@ export class TXEOracleTopLevelContext {
36
37
  senderAddressBookStore;
37
38
  capsuleStore;
38
39
  privateEventStore;
39
- jobId;
40
40
  nextBlockTimestamp;
41
41
  version;
42
42
  chainId;
@@ -44,7 +44,7 @@ export class TXEOracleTopLevelContext {
44
44
  isMisc;
45
45
  isTxe;
46
46
  logger;
47
- constructor(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobId, nextBlockTimestamp, version, chainId, authwits){
47
+ constructor(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, authwits){
48
48
  this.stateMachine = stateMachine;
49
49
  this.contractStore = contractStore;
50
50
  this.noteStore = noteStore;
@@ -56,7 +56,6 @@ export class TXEOracleTopLevelContext {
56
56
  this.senderAddressBookStore = senderAddressBookStore;
57
57
  this.capsuleStore = capsuleStore;
58
58
  this.privateEventStore = privateEventStore;
59
- this.jobId = jobId;
60
59
  this.nextBlockTimestamp = nextBlockTimestamp;
61
60
  this.version = version;
62
61
  this.chainId = chainId;
@@ -66,53 +65,83 @@ export class TXEOracleTopLevelContext {
66
65
  this.logger = createLogger('txe:top_level_context');
67
66
  this.logger.debug('Entering Top Level Context');
68
67
  }
69
- utilityAssertCompatibleOracleVersion(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}'.`);
68
+ contractOracleVersion;
69
+ assertCompatibleOracleVersion(major, minor) {
70
+ if (major !== ORACLE_VERSION_MAJOR) {
71
+ 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.';
72
+ 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
73
  }
74
+ this.contractOracleVersion = {
75
+ major,
76
+ minor
77
+ };
78
+ }
79
+ // Prefixed with "nonOracleFunction" as it is not used as an oracle handler.
80
+ nonOracleFunctionGetContractOracleVersion() {
81
+ return this.contractOracleVersion;
73
82
  }
74
83
  // This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
75
84
  // setup.
76
- utilityGetRandomField() {
85
+ getRandomField() {
77
86
  return Fr.random();
78
87
  }
79
88
  // We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
80
- utilityDebugLog(level, message, fields) {
89
+ log(level, message, fields) {
81
90
  if (!LogLevels[level]) {
82
- throw new Error(`Invalid debug log level: ${level}`);
91
+ throw new Error(`Invalid log level: ${level}`);
83
92
  }
84
93
  const levelName = LogLevels[level];
85
94
  this.logger[levelName](`${applyStringFormatting(message, fields)}`, {
86
95
  module: `${this.logger.module}:debug_log`
87
96
  });
97
+ return Promise.resolve();
88
98
  }
89
- txeGetDefaultAddress() {
99
+ getDefaultAddress() {
90
100
  return DEFAULT_ADDRESS;
91
101
  }
92
- async txeGetNextBlockNumber() {
102
+ async getNextBlockNumber() {
93
103
  return BlockNumber(await this.getLastBlockNumber() + 1);
94
104
  }
95
- txeGetNextBlockTimestamp() {
105
+ getNextBlockTimestamp() {
96
106
  return Promise.resolve(this.nextBlockTimestamp);
97
107
  }
98
- async txeGetLastBlockTimestamp() {
99
- return (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.timestamp;
108
+ async getLastBlockTimestamp() {
109
+ return (await this.stateMachine.node.getBlockData('latest')).header.globalVariables.timestamp;
100
110
  }
101
- async txeGetLastTxEffects() {
111
+ async getLastTxEffects() {
102
112
  const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
103
- const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
113
+ const block = await this.stateMachine.archiver.getBlock({
114
+ number: latestBlockNumber
115
+ });
104
116
  if (block.body.txEffects.length != 1) {
105
117
  // Note that calls like env.mine() will result in blocks with no transactions, hitting this
106
118
  throw new Error(`Expected a single transaction in the last block, found ${block.body.txEffects.length}`);
107
119
  }
108
120
  const txEffects = block.body.txEffects[0];
121
+ const privateLogs = txEffects.privateLogs;
122
+ if (privateLogs.length > MAX_PRIVATE_LOGS_PER_TX) {
123
+ throw new Error(`${privateLogs.length} private logs exceed max ${MAX_PRIVATE_LOGS_PER_TX}`);
124
+ }
109
125
  return {
110
126
  txHash: txEffects.txHash,
111
127
  noteHashes: txEffects.noteHashes,
112
- nullifiers: txEffects.nullifiers
128
+ nullifiers: txEffects.nullifiers,
129
+ privateLogs
113
130
  };
114
131
  }
115
- async txeGetPrivateEvents(selector, contractAddress, scope) {
132
+ async syncContractNonOracleMethod(contractAddress, scope, jobId) {
133
+ if (contractAddress.equals(DEFAULT_ADDRESS)) {
134
+ this.logger.debug(`Skipping sync in getPrivateEvents because the events correspond to the default address.`);
135
+ return;
136
+ }
137
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
138
+ await this.stateMachine.contractSyncService.ensureContractSynced(contractAddress, null, async (call, execScopes)=>{
139
+ await this.executeUtilityCall(call, execScopes, jobId);
140
+ }, blockHeader, jobId, [
141
+ scope
142
+ ]);
143
+ }
144
+ async getPrivateEvents(selector, contractAddress, scope) {
116
145
  return (await this.privateEventStore.getPrivateEvents(selector, {
117
146
  contractAddress,
118
147
  scopes: [
@@ -122,43 +151,53 @@ export class TXEOracleTopLevelContext {
122
151
  toBlock: await this.getLastBlockNumber() + 1
123
152
  })).map((e)=>e.packedEvent);
124
153
  }
125
- async txeAdvanceBlocksBy(blocks) {
154
+ async advanceBlocksBy(blocks) {
126
155
  this.logger.debug(`time traveling ${blocks} blocks`);
127
156
  for(let i = 0; i < blocks; i++){
128
157
  await this.mineBlock();
129
158
  }
130
159
  }
131
- txeAdvanceTimestampBy(duration) {
160
+ advanceTimestampBy(duration) {
132
161
  this.logger.debug(`time traveling ${duration} seconds`);
133
162
  this.nextBlockTimestamp += duration;
134
163
  }
135
- async txeDeploy(artifact, instance, secret) {
164
+ deploymentNullifier(address) {
165
+ return siloNullifier(AztecAddress.fromNumber(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), address.toField());
166
+ }
167
+ async deploy(artifact, instance, secret) {
136
168
  // Emit deployment nullifier
137
169
  await this.mineBlock({
138
170
  nullifiers: [
139
- await siloNullifier(AztecAddress.fromNumber(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), instance.address.toField())
171
+ await this.deploymentNullifier(instance.address)
140
172
  ]
141
173
  });
142
174
  if (!secret.equals(Fr.ZERO)) {
143
- await this.txeAddAccount(artifact, instance, secret);
175
+ await this.addAccount(artifact, instance, secret);
144
176
  } else {
145
177
  await this.contractStore.addContractInstance(instance);
146
- await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
178
+ await this.contractStore.addContractArtifact(artifact);
147
179
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
148
180
  }
149
181
  }
150
- async txeAddAccount(artifact, instance, secret) {
182
+ /**
183
+ * Mines a single block containing only the deployment nullifiers for the contracts at the given addresses.
184
+ */ async mineDeploymentNullifiers(addresses) {
185
+ await this.mineBlock({
186
+ nullifiers: await Promise.all(addresses.map((address)=>this.deploymentNullifier(address)))
187
+ });
188
+ }
189
+ async addAccount(artifact, instance, secret) {
151
190
  const partialAddress = await computePartialAddress(instance);
152
191
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
153
192
  await this.contractStore.addContractInstance(instance);
154
- await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
193
+ await this.contractStore.addContractArtifact(artifact);
155
194
  const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
156
195
  await this.accountStore.setAccount(completeAddress.address, completeAddress);
157
196
  await this.addressStore.addCompleteAddress(completeAddress);
158
197
  this.logger.debug(`Created account ${completeAddress.address}`);
159
198
  return completeAddress;
160
199
  }
161
- async txeCreateAccount(secret) {
200
+ async createAccount(secret) {
162
201
  // This is a foot gun !
163
202
  const completeAddress = await this.keyStore.addAccount(secret, secret);
164
203
  await this.accountStore.setAccount(completeAddress.address, completeAddress);
@@ -166,18 +205,17 @@ export class TXEOracleTopLevelContext {
166
205
  this.logger.debug(`Created account ${completeAddress.address}`);
167
206
  return completeAddress;
168
207
  }
169
- async txeAddAuthWitness(address, messageHash) {
208
+ async addAuthWitness(address, messageHash) {
170
209
  const account = await this.accountStore.getAccount(address);
171
- const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
210
+ const ivpkMHash = await hashPublicKey(account.publicKeys.ivpkM);
211
+ const privateKey = await this.keyStore.getMasterSecretKey(ivpkMHash);
172
212
  const schnorr = new Schnorr();
173
- const signature = await schnorr.constructSignature(messageHash.toBuffer(), privateKey);
174
- const authWitness = new AuthWitness(messageHash, [
175
- ...signature.toBuffer()
176
- ]);
213
+ const signature = await schnorr.constructSignature(messageHash, privateKey);
214
+ const authWitness = new AuthWitness(messageHash, signature.toLimbFields());
177
215
  this.authwits.set(authWitness.requestHash.toString(), authWitness);
178
216
  }
179
217
  async mineBlock(options = {}) {
180
- const blockNumber = await this.txeGetNextBlockNumber();
218
+ const blockNumber = await this.getNextBlockNumber();
181
219
  const txEffect = TxEffect.empty();
182
220
  txEffect.nullifiers = [
183
221
  getSingleTxBlockRequestHash(blockNumber),
@@ -199,24 +237,26 @@ export class TXEOracleTopLevelContext {
199
237
  this.logger.info(`Created block ${blockNumber} with timestamp ${block.header.globalVariables.timestamp}`);
200
238
  await this.stateMachine.handleL2Block(block);
201
239
  }
202
- async txePrivateCallNewFlow(from, targetContractAddress = AztecAddress.zero(), functionSelector = FunctionSelector.empty(), args, argsHash = Fr.zero(), isStaticCall = false) {
240
+ async privateCallNewFlow(from, targetContractAddress = AztecAddress.zero(), functionSelector = FunctionSelector.empty(), args, argsHash = Fr.zero(), isStaticCall = false, additionalScopes = [], jobId, authorizedUtilityCallTargets, gasSettings) {
203
241
  this.logger.verbose(`Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`);
204
242
  const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
205
243
  if (!artifact) {
206
244
  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';
207
245
  throw new Error(message);
208
246
  }
247
+ const scopes = from === undefined ? additionalScopes : [
248
+ from,
249
+ ...additionalScopes
250
+ ];
209
251
  // Sync notes before executing private function to discover notes from previous transactions
210
- const utilityExecutor = async (call)=>{
211
- await this.executeUtilityCall(call);
252
+ const utilityExecutor = async (call, execScopes)=>{
253
+ await this.executeUtilityCall(call, execScopes, jobId);
212
254
  };
213
255
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
214
- await syncState(targetContractAddress, this.contractStore, functionSelector, utilityExecutor, this.noteStore, this.stateMachine.node, blockHeader, this.jobId);
215
- const blockNumber = await this.txeGetNextBlockNumber();
216
- const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
217
- const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
218
- const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
219
- const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
256
+ await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, utilityExecutor, blockHeader, jobId, scopes);
257
+ const blockNumber = await this.getNextBlockNumber();
258
+ const msgSender = from ?? AztecAddress.NULL_MSG_SENDER;
259
+ const callContext = new CallContext(msgSender, targetContractAddress, functionSelector, isStaticCall);
220
260
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
221
261
  const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
222
262
  const noteCache = new ExecutionNoteCache(protocolNullifier);
@@ -227,12 +267,44 @@ export class TXEOracleTopLevelContext {
227
267
  await noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
228
268
  const taggingIndexCache = new ExecutionTaggingIndexCache();
229
269
  const simulator = new WASMSimulator();
230
- const privateExecutionOracle = new PrivateExecutionOracle(argsHash, txContext, callContext, /** Header of a block whose state is used during private execution (not the block the transaction is included in). */ blockHeader, utilityExecutor, /** List of transient auth witnesses to be used during this simulation */ Array.from(this.authwits.values()), /** List of transient auth witnesses to be used during this simulation */ [], HashedValuesCache.create([
231
- new HashedValues(args, argsHash)
232
- ]), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.jobId, 0, minRevertibleSideEffectCounter, undefined, undefined, /**
233
- * In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
234
- * contract would perform, including setting senderForTags.
235
- */ from, simulator);
270
+ const privateExecutionOracle = new PrivateExecutionOracle({
271
+ argsHash,
272
+ txContext,
273
+ callContext,
274
+ anchorBlockHeader: blockHeader,
275
+ utilityExecutor,
276
+ authWitnesses: Array.from(this.authwits.values()),
277
+ capsules: [],
278
+ executionCache: HashedValuesCache.create([
279
+ new HashedValues(args, argsHash)
280
+ ]),
281
+ noteCache,
282
+ taggingIndexCache,
283
+ contractStore: this.contractStore,
284
+ noteStore: this.noteStore,
285
+ keyStore: this.keyStore,
286
+ addressStore: this.addressStore,
287
+ aztecNode: this.stateMachine.node,
288
+ senderTaggingStore: this.senderTaggingStore,
289
+ recipientTaggingStore: this.recipientTaggingStore,
290
+ senderAddressBookStore: this.senderAddressBookStore,
291
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
292
+ privateEventStore: this.privateEventStore,
293
+ contractSyncService: this.stateMachine.contractSyncService,
294
+ jobId,
295
+ totalPublicCalldataCount: 0,
296
+ sideEffectCounter: minRevertibleSideEffectCounter,
297
+ scopes,
298
+ // In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
299
+ // contract would perform, including setting senderForTags.
300
+ senderForTags: from,
301
+ simulator,
302
+ messageContextService: this.stateMachine.messageContextService,
303
+ l2TipsStore: this.stateMachine.l2TipsProvider,
304
+ hooks: composeHooks({
305
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook(isStaticCall ? 'private view' : 'private', authorizedUtilityCallTargets)
306
+ })
307
+ });
236
308
  // 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.
237
309
  let result;
238
310
  let executionResult;
@@ -244,7 +316,7 @@ export class TXEOracleTopLevelContext {
244
316
  r.publicInputs.publicTeardownCallRequest
245
317
  ]));
246
318
  const publicFunctionsCalldata = await Promise.all(publicCallRequests.map(async (r)=>{
247
- const calldata = await privateExecutionOracle.privateLoadFromExecutionCache(r.calldataHash);
319
+ const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
248
320
  return new HashedValues(calldata, r.calldataHash);
249
321
  }));
250
322
  noteCache.finish();
@@ -256,7 +328,7 @@ export class TXEOracleTopLevelContext {
256
328
  // According to the protocol rules, there must be at least one nullifier in the tx. The first nullifier is used as
257
329
  // the nonce generator for the note hashes.
258
330
  // We pass the non-zero minRevertibleSideEffectCounter to make sure the side effects are split correctly.
259
- const { publicInputs } = await generateSimulatedProvingResult(result, this.contractStore, minRevertibleSideEffectCounter);
331
+ const { publicInputs } = await generateSimulatedProvingResult(result, (addr, sel)=>this.contractStore.getDebugFunctionName(addr, sel), this.stateMachine.node, minRevertibleSideEffectCounter);
260
332
  const globals = makeGlobalVariables();
261
333
  globals.blockNumber = blockNumber;
262
334
  globals.timestamp = this.nextBlockTimestamp;
@@ -303,10 +375,20 @@ export class TXEOracleTopLevelContext {
303
375
  throw new Error('Contract execution has reverted');
304
376
  }
305
377
  }
378
+ // Walk the nested private-call tree and collect every offchain effect the transaction emitted.
379
+ // PXE stores these on each `PrivateCallExecutionResult` and they never reach TXE via the
380
+ // `aztec_utl_emitOffchainEffect` foreign-call path (that path only fires at the top-level), so
381
+ // we pull them out here and the RPC wrapper will hand them to `TXESession` for buffering.
382
+ const offchainEffects = collectNested([
383
+ executionResult
384
+ ], (r)=>r.offchainEffects.map((e)=>e.data));
306
385
  if (isStaticCall) {
307
386
  await checkpoint.revert();
308
387
  await forkedWorldTrees.close();
309
- return executionResult.returnValues ?? [];
388
+ return {
389
+ returnValues: executionResult.returnValues ?? [],
390
+ offchainEffects
391
+ };
310
392
  }
311
393
  const txEffect = TxEffect.empty();
312
394
  txEffect.noteHashes = processedTx.txEffect.noteHashes;
@@ -322,14 +404,14 @@ export class TXEOracleTopLevelContext {
322
404
  ]);
323
405
  await this.stateMachine.handleL2Block(l2Block);
324
406
  await forkedWorldTrees.close();
325
- return executionResult.returnValues ?? [];
407
+ return {
408
+ returnValues: executionResult.returnValues ?? [],
409
+ offchainEffects
410
+ };
326
411
  }
327
- async txePublicCallNewFlow(from, targetContractAddress, calldata, isStaticCall) {
412
+ async publicCallNewFlow(from, targetContractAddress, calldata, isStaticCall, gasSettings) {
328
413
  this.logger.verbose(`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`);
329
- const blockNumber = await this.txeGetNextBlockNumber();
330
- const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
331
- const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
332
- const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
414
+ const blockNumber = await this.getNextBlockNumber();
333
415
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
334
416
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
335
417
  const calldataHash = await computeCalldataHash(calldata);
@@ -362,10 +444,10 @@ export class TXEOracleTopLevelContext {
362
444
  // The enqueued public call itself we make be revertible so that the public execution is itself revertible, as tests
363
445
  // may require producing reverts.
364
446
  const revertibleAccumulatedData = PrivateToPublicAccumulatedData.empty();
365
- revertibleAccumulatedData.publicCallRequests[0] = new PublicCallRequest(from, targetContractAddress, isStaticCall, calldataHash);
447
+ revertibleAccumulatedData.publicCallRequests[0] = new PublicCallRequest(from ?? AztecAddress.NULL_MSG_SENDER, targetContractAddress, isStaticCall, calldataHash);
366
448
  const inputsForPublic = new PartialPrivateTailPublicInputsForPublic(nonRevertibleAccumulatedData, revertibleAccumulatedData, PublicCallRequest.empty());
367
449
  const constantData = new TxConstantData(anchorBlockHeader, txContext, Fr.zero(), Fr.zero());
368
- const txData = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), /*includeByTimestamp=*/ 0n, inputsForPublic, undefined);
450
+ const txData = new PrivateKernelTailCircuitPublicInputs(constantData, /*gasUsed=*/ new Gas(0, 0), /*feePayer=*/ AztecAddress.zero(), /*expirationTimestamp=*/ 0n, inputsForPublic, undefined);
369
451
  const tx = await Tx.create({
370
452
  data: txData,
371
453
  chonkProof: ChonkProof.empty(),
@@ -418,20 +500,29 @@ export class TXEOracleTopLevelContext {
418
500
  await forkedWorldTrees.close();
419
501
  return returnValues ?? [];
420
502
  }
421
- async txeSimulateUtilityFunction(targetContractAddress, functionSelector, args) {
503
+ async executeUtilityFunction(targetContractAddress, functionSelector, args, jobId, authorizedUtilityCallTargets) {
422
504
  const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
423
505
  if (!artifact) {
424
506
  throw new Error(`Cannot call ${functionSelector} as there is no artifact found at ${targetContractAddress}.`);
425
507
  }
426
508
  // Sync notes before executing utility function to discover notes from previous transactions
427
509
  const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
428
- await syncState(targetContractAddress, this.contractStore, functionSelector, async (call)=>{
429
- await this.executeUtilityCall(call);
430
- }, this.noteStore, this.stateMachine.node, blockHeader, this.jobId);
431
- const call = new FunctionCall(artifact.name, targetContractAddress, functionSelector, FunctionType.UTILITY, false, false, args, []);
432
- return this.executeUtilityCall(call);
510
+ await this.stateMachine.contractSyncService.ensureContractSynced(targetContractAddress, functionSelector, async (call, execScopes)=>{
511
+ await this.executeUtilityCall(call, execScopes, jobId);
512
+ }, blockHeader, jobId, await this.keyStore.getAccounts());
513
+ const call = FunctionCall.from({
514
+ name: artifact.name,
515
+ to: targetContractAddress,
516
+ selector: functionSelector,
517
+ type: FunctionType.UTILITY,
518
+ hideMsgSender: false,
519
+ isStatic: false,
520
+ args,
521
+ returnTypes: []
522
+ });
523
+ return this.executeUtilityCall(call, await this.keyStore.getAccounts(), jobId, authorizedUtilityCallTargets);
433
524
  }
434
- async executeUtilityCall(call) {
525
+ async executeUtilityCall(call, scopes, jobId, authorizedUtilityCallTargets = []) {
435
526
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
436
527
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
437
528
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
@@ -442,8 +533,36 @@ export class TXEOracleTopLevelContext {
442
533
  });
443
534
  try {
444
535
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
445
- const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.jobId);
446
- const acirExecutionResult = await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
536
+ const simulator = new WASMSimulator();
537
+ const utilityExecutor = async (syncCall, execScopes)=>{
538
+ await this.executeUtilityCall(syncCall, execScopes, jobId);
539
+ };
540
+ const oracle = new UtilityExecutionOracle({
541
+ contractAddress: call.to,
542
+ authWitnesses: [],
543
+ capsules: [],
544
+ anchorBlockHeader,
545
+ contractStore: this.contractStore,
546
+ noteStore: this.noteStore,
547
+ keyStore: this.keyStore,
548
+ addressStore: this.addressStore,
549
+ aztecNode: this.stateMachine.node,
550
+ recipientTaggingStore: this.recipientTaggingStore,
551
+ senderAddressBookStore: this.senderAddressBookStore,
552
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
553
+ privateEventStore: this.privateEventStore,
554
+ messageContextService: this.stateMachine.messageContextService,
555
+ contractSyncService: this.stateMachine.contractSyncService,
556
+ l2TipsStore: this.stateMachine.l2TipsProvider,
557
+ jobId,
558
+ scopes,
559
+ simulator,
560
+ hooks: composeHooks({
561
+ authorizeUtilityCall: this.buildAuthorizeUtilityCallHook('utility', authorizedUtilityCallTargets)
562
+ }),
563
+ utilityExecutor
564
+ });
565
+ const acirExecutionResult = await simulator.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
447
566
  err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
448
567
  throw new ExecutionError(err.message, {
449
568
  contractAddress: call.to,
@@ -452,10 +571,10 @@ export class TXEOracleTopLevelContext {
452
571
  cause: err
453
572
  });
454
573
  });
455
- this.logger.verbose(`Utility simulation for ${call.to}.${call.selector} completed`);
574
+ this.logger.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
456
575
  return witnessMapToFields(acirExecutionResult.returnWitness);
457
576
  } catch (err) {
458
- throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility simulation'));
577
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility execution'));
459
578
  }
460
579
  }
461
580
  close() {
@@ -466,7 +585,15 @@ export class TXEOracleTopLevelContext {
466
585
  ];
467
586
  }
468
587
  async getLastBlockNumber() {
469
- const header = await this.stateMachine.node.getBlockHeader('latest');
470
- return header ? header.globalVariables.blockNumber : BlockNumber.ZERO;
588
+ const block = await this.stateMachine.node.getBlock('latest');
589
+ return block ? block.header.globalVariables.blockNumber : BlockNumber.ZERO;
590
+ }
591
+ buildAuthorizeUtilityCallHook(callerContext, authorizedTargets) {
592
+ if (authorizedTargets.length === 0) {
593
+ return undefined;
594
+ }
595
+ return (req)=>Promise.resolve({
596
+ authorized: req.callerContext === callerContext && authorizedTargets.some((t)=>t.equals(req.target))
597
+ });
471
598
  }
472
599
  }
@@ -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"}