@aztec/txe 0.0.1-commit.e558bd1c → 0.0.1-commit.e57c76e

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 (154) hide show
  1. package/dest/ContractClassRegistry-PII7Q556.js +3 -0
  2. package/dest/ContractClassRegistry-PII7Q556.js.map +7 -0
  3. package/dest/ContractInstanceRegistry-3MHLGFNZ.js +3 -0
  4. package/dest/ContractInstanceRegistry-3MHLGFNZ.js.map +7 -0
  5. package/dest/FeeJuice-TQV5AQK7.js +3 -0
  6. package/dest/FeeJuice-TQV5AQK7.js.map +7 -0
  7. package/dest/MultiCallEntrypoint-SBJUIJY7.js +3 -0
  8. package/dest/MultiCallEntrypoint-SBJUIJY7.js.map +7 -0
  9. package/dest/SchnorrAccount-MQXPIZ44.js +3 -0
  10. package/dest/SchnorrAccount-MQXPIZ44.js.map +7 -0
  11. package/dest/bin/check_txe_oracle_version.d.ts +2 -0
  12. package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
  13. package/dest/bin/check_txe_oracle_version.js +61 -0
  14. package/dest/bin/index.js +3 -30
  15. package/dest/bin/index.js.map +7 -0
  16. package/dest/bin/oracle_test_server.d.ts +3 -0
  17. package/dest/bin/oracle_test_server.d.ts.map +1 -0
  18. package/dest/bin/oracle_test_server.js +41 -0
  19. package/dest/chunk-3VX4QA7B.js +265 -0
  20. package/dest/chunk-3VX4QA7B.js.map +7 -0
  21. package/dest/chunk-BJVAAXNA.js +3 -0
  22. package/dest/chunk-BJVAAXNA.js.map +7 -0
  23. package/dest/chunk-FU3LBVE4.js +304 -0
  24. package/dest/chunk-FU3LBVE4.js.map +7 -0
  25. package/dest/constants.d.ts +5 -1
  26. package/dest/constants.d.ts.map +1 -1
  27. package/dest/constants.js +8 -0
  28. package/dest/dispatcher_pool.d.ts +67 -0
  29. package/dest/dispatcher_pool.d.ts.map +1 -0
  30. package/dest/dispatcher_pool.js +284 -0
  31. package/dest/index.d.ts +185 -7
  32. package/dest/index.d.ts.map +1 -1
  33. package/dest/index.js +71 -157
  34. package/dest/metafile.json +38352 -0
  35. package/dest/msgpackr_fr_extension.d.ts +2 -0
  36. package/dest/msgpackr_fr_extension.d.ts.map +1 -0
  37. package/dest/msgpackr_fr_extension.js +21 -0
  38. package/dest/oracle/interfaces.d.ts +56 -30
  39. package/dest/oracle/interfaces.d.ts.map +1 -1
  40. package/dest/oracle/test-resolver/fixtures.d.ts +43 -0
  41. package/dest/oracle/test-resolver/fixtures.d.ts.map +1 -0
  42. package/dest/oracle/test-resolver/fixtures.js +39 -0
  43. package/dest/oracle/test-resolver/index.d.ts +9 -0
  44. package/dest/oracle/test-resolver/index.d.ts.map +1 -0
  45. package/dest/oracle/test-resolver/index.js +33 -0
  46. package/dest/oracle/test-resolver/resolver.d.ts +34 -0
  47. package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
  48. package/dest/oracle/test-resolver/resolver.js +114 -0
  49. package/dest/oracle/txe_oracle_public_context.d.ts +38 -14
  50. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  51. package/dest/oracle/txe_oracle_public_context.js +55 -13
  52. package/dest/oracle/txe_oracle_registry.d.ts +147 -0
  53. package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
  54. package/dest/oracle/txe_oracle_registry.js +562 -0
  55. package/dest/oracle/txe_oracle_top_level_context.d.ts +45 -26
  56. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  57. package/dest/oracle/txe_oracle_top_level_context.js +241 -85
  58. package/dest/oracle/txe_oracle_version.d.ts +17 -0
  59. package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
  60. package/dest/oracle/txe_oracle_version.js +14 -0
  61. package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
  62. package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
  63. package/dest/oracle/txe_private_execution_oracle.js +15 -0
  64. package/dest/rpc_server.d.ts +14 -0
  65. package/dest/rpc_server.d.ts.map +1 -0
  66. package/dest/rpc_server.js +78 -0
  67. package/dest/rpc_translator.d.ts +96 -228
  68. package/dest/rpc_translator.d.ts.map +1 -1
  69. package/dest/rpc_translator.js +815 -624
  70. package/dest/server.bundle.js +3 -0
  71. package/dest/server.bundle.js.map +7 -0
  72. package/dest/state_machine/archiver.d.ts +6 -5
  73. package/dest/state_machine/archiver.d.ts.map +1 -1
  74. package/dest/state_machine/archiver.js +30 -21
  75. package/dest/state_machine/dummy_p2p_client.d.ts +24 -15
  76. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  77. package/dest/state_machine/dummy_p2p_client.js +39 -18
  78. package/dest/state_machine/global_variable_builder.d.ts +9 -4
  79. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  80. package/dest/state_machine/global_variable_builder.js +9 -3
  81. package/dest/state_machine/index.d.ts +7 -3
  82. package/dest/state_machine/index.d.ts.map +1 -1
  83. package/dest/state_machine/index.js +23 -5
  84. package/dest/state_machine/mock_epoch_cache.d.ts +18 -3
  85. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  86. package/dest/state_machine/mock_epoch_cache.js +33 -2
  87. package/dest/state_machine/synchronizer.d.ts +5 -5
  88. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  89. package/dest/state_machine/synchronizer.js +4 -4
  90. package/dest/txe_session.d.ts +80 -15
  91. package/dest/txe_session.d.ts.map +1 -1
  92. package/dest/txe_session.js +236 -42
  93. package/dest/utils/encoding.d.ts +191 -0
  94. package/dest/utils/encoding.d.ts.map +1 -0
  95. package/dest/{util → utils}/encoding.js +7 -2
  96. package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
  97. package/dest/utils/expected_failure_error.d.ts.map +1 -0
  98. package/dest/{util → utils}/txe_account_store.d.ts +1 -1
  99. package/dest/utils/txe_account_store.d.ts.map +1 -0
  100. package/dest/utils/txe_artifact_resolver.d.ts +37 -0
  101. package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
  102. package/dest/utils/txe_artifact_resolver.js +161 -0
  103. package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
  104. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
  105. package/dest/{util → utils}/txe_public_contract_data_source.js +6 -25
  106. package/dest/worker.bundle.js +3 -0
  107. package/dest/worker.bundle.js.map +7 -0
  108. package/dest/worker.d.ts +2 -0
  109. package/dest/worker.d.ts.map +1 -0
  110. package/dest/worker.js +92 -0
  111. package/package.json +38 -21
  112. package/src/bin/check_txe_oracle_version.ts +70 -0
  113. package/src/bin/index.ts +11 -2
  114. package/src/bin/oracle_test_server.ts +51 -0
  115. package/src/constants.ts +10 -0
  116. package/src/dispatcher_pool.ts +316 -0
  117. package/src/index.ts +97 -190
  118. package/src/msgpackr_fr_extension.ts +23 -0
  119. package/src/oracle/interfaces.ts +58 -35
  120. package/src/oracle/test-resolver/fixtures.ts +84 -0
  121. package/src/oracle/test-resolver/index.ts +45 -0
  122. package/src/oracle/test-resolver/resolver.ts +165 -0
  123. package/src/oracle/txe_oracle_public_context.ts +72 -12
  124. package/src/oracle/txe_oracle_registry.ts +401 -0
  125. package/src/oracle/txe_oracle_top_level_context.ts +279 -144
  126. package/src/oracle/txe_oracle_version.ts +17 -0
  127. package/src/oracle/txe_private_execution_oracle.ts +30 -0
  128. package/src/rpc_server.ts +87 -0
  129. package/src/rpc_translator.ts +1000 -1006
  130. package/src/state_machine/archiver.ts +42 -20
  131. package/src/state_machine/dummy_p2p_client.ts +63 -30
  132. package/src/state_machine/global_variable_builder.ts +18 -3
  133. package/src/state_machine/index.ts +25 -5
  134. package/src/state_machine/mock_epoch_cache.ts +43 -3
  135. package/src/state_machine/synchronizer.ts +5 -5
  136. package/src/txe_session.ts +351 -96
  137. package/src/{util → utils}/encoding.ts +8 -2
  138. package/src/utils/txe_artifact_resolver.ts +217 -0
  139. package/src/{util → utils}/txe_public_contract_data_source.ts +10 -38
  140. package/src/worker.ts +98 -0
  141. package/dest/util/encoding.d.ts +0 -720
  142. package/dest/util/encoding.d.ts.map +0 -1
  143. package/dest/util/expected_failure_error.d.ts.map +0 -1
  144. package/dest/util/txe_account_store.d.ts.map +0 -1
  145. package/dest/util/txe_contract_store.d.ts +0 -12
  146. package/dest/util/txe_contract_store.d.ts.map +0 -1
  147. package/dest/util/txe_contract_store.js +0 -22
  148. package/dest/util/txe_public_contract_data_source.d.ts +0 -21
  149. package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
  150. package/src/util/txe_contract_store.ts +0 -36
  151. /package/dest/{util → utils}/expected_failure_error.js +0 -0
  152. /package/dest/{util → utils}/txe_account_store.js +0 -0
  153. /package/src/{util → utils}/expected_failure_error.ts +0 -0
  154. /package/src/{util → utils}/txe_account_store.ts +0 -0
@@ -2,32 +2,42 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { KeyStore } from '@aztec/key-store';
5
- import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
- import { AddressStore, AnchorBlockStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
- import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
5
+ import { openEphemeralStore } from '@aztec/kv-store/lmdb-v2';
6
+ import { AddressStore, AnchorBlockStore, CapsuleService, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
+ import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
8
8
  import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
9
+ import { STANDARD_AUTH_REGISTRY_ADDRESS } from '@aztec/standard-contracts/auth-registry/constants';
9
10
  import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
10
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
11
- import { GasSettings } from '@aztec/stdlib/gas';
12
12
  import { computeProtocolNullifier } from '@aztec/stdlib/hash';
13
13
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
14
- import { CallContext, TxContext } from '@aztec/stdlib/tx';
14
+ import { CallContext, OFFCHAIN_MESSAGE_IDENTIFIER, TxContext } from '@aztec/stdlib/tx';
15
15
  import { z } from 'zod';
16
- import { DEFAULT_ADDRESS } from './constants.js';
16
+ import { DEFAULT_ADDRESS, MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFECT_LEN } from './constants.js';
17
17
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
18
18
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
19
+ import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
20
+ import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
19
21
  import { RPCTranslator } from './rpc_translator.js';
20
22
  import { TXEArchiver } from './state_machine/archiver.js';
21
23
  import { TXEStateMachine } from './state_machine/index.js';
22
- import { TXEAccountStore } from './util/txe_account_store.js';
23
- import { TXEContractStore } from './util/txe_contract_store.js';
24
24
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
25
25
  import { makeTxEffect } from './utils/tx_effect_creation.js';
26
+ import { TXEAccountStore } from './utils/txe_account_store.js';
27
+ function emptyLastCallState() {
28
+ return {
29
+ offchainEffects: [],
30
+ queried: false,
31
+ txHash: Fr.ZERO,
32
+ anchorBlockTimestamp: 0n
33
+ };
34
+ }
26
35
  /**
27
36
  * A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
28
37
  * state, etc., independent of all other tests running in parallel.
29
38
  */ export class TXESession {
30
39
  logger;
40
+ sessionStore;
31
41
  stateMachine;
32
42
  oracleHandler;
33
43
  contractStore;
@@ -45,10 +55,17 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
45
55
  chainId;
46
56
  version;
47
57
  nextBlockTimestamp;
58
+ artifactResolver;
59
+ rootPath;
60
+ packageName;
48
61
  state;
49
62
  authwits;
50
- constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp){
63
+ lastCallInfo;
64
+ txeOracleVersion;
65
+ disposed;
66
+ constructor(logger, sessionStore, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp, artifactResolver, rootPath, packageName){
51
67
  this.logger = logger;
68
+ this.sessionStore = sessionStore;
52
69
  this.stateMachine = stateMachine;
53
70
  this.oracleHandler = oracleHandler;
54
71
  this.contractStore = contractStore;
@@ -66,16 +83,43 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
66
83
  this.chainId = chainId;
67
84
  this.version = version;
68
85
  this.nextBlockTimestamp = nextBlockTimestamp;
86
+ this.artifactResolver = artifactResolver;
87
+ this.rootPath = rootPath;
88
+ this.packageName = packageName;
69
89
  this.state = {
70
90
  name: 'TOP_LEVEL'
71
91
  };
72
92
  this.authwits = new Map();
93
+ this.lastCallInfo = emptyLastCallState();
94
+ this.disposed = false;
73
95
  }
74
- static async init(protocolContracts) {
75
- const store = await openTmpStore('txe-session');
96
+ /**
97
+ * Closes the per-session `txe-session` LMDB and the `NativeWorldStateService` .
98
+ * Called via IPC when the dispatcher detects the end of a test. Idempotent.
99
+ */ async dispose() {
100
+ if (this.disposed) {
101
+ return;
102
+ }
103
+ this.disposed = true;
104
+ try {
105
+ await this.stateMachine.synchronizer.nativeWorldStateService.close();
106
+ } catch (err) {
107
+ this.logger.warn(`Error closing native world state during session dispose`, err);
108
+ }
109
+ try {
110
+ await this.sessionStore.close();
111
+ } catch (err) {
112
+ this.logger.warn(`Error closing session LMDB during dispose`, err);
113
+ }
114
+ }
115
+ static async init(contractStore, artifactResolver, rootPath, packageName) {
116
+ // Size LMDB's reader slots to the libuv pool (capped to 2 in bin/index.ts via
117
+ // HARDWARE_CONCURRENCY): each native LMDB read needs a libuv worker thread to run, so any
118
+ // slot beyond the pool size would sit idle while still consuming a semaphore + reader-table
119
+ // entry per session.
120
+ const store = await openEphemeralStore('txe-session', undefined, 2);
76
121
  const addressStore = new AddressStore(store);
77
122
  const privateEventStore = new PrivateEventStore(store);
78
- const contractStore = new TXEContractStore(store);
79
123
  const noteStore = new NoteStore(store);
80
124
  const senderTaggingStore = new SenderTaggingStore(store);
81
125
  const recipientTaggingStore = new RecipientTaggingStore(store);
@@ -83,7 +127,6 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
83
127
  const capsuleStore = new CapsuleStore(store);
84
128
  const keyStore = new KeyStore(store);
85
129
  const accountStore = new TXEAccountStore(store);
86
- // Create job coordinator and register staged stores
87
130
  const jobCoordinator = new JobCoordinator(store);
88
131
  jobCoordinator.registerStores([
89
132
  capsuleStore,
@@ -92,11 +135,6 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
92
135
  privateEventStore,
93
136
  noteStore
94
137
  ]);
95
- // Register protocol contracts.
96
- for (const { contractClass, instance, artifact } of protocolContracts){
97
- await contractStore.addContractArtifact(contractClass.id, artifact);
98
- await contractStore.addContractInstance(instance);
99
- }
100
138
  const archiver = new TXEArchiver(store);
101
139
  const anchorBlockStore = new AnchorBlockStore(store);
102
140
  const stateMachine = await TXEStateMachine.create(archiver, anchorBlockStore, contractStore, noteStore);
@@ -104,9 +142,12 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
104
142
  const version = new Fr(await stateMachine.node.getVersion());
105
143
  const chainId = new Fr(await stateMachine.node.getChainId());
106
144
  const initialJobId = jobCoordinator.beginJob();
107
- const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, initialJobId, nextBlockTimestamp, version, chainId, new Map());
108
- await topLevelOracleHandler.txeAdvanceBlocksBy(1);
109
- return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
145
+ const logger = createLogger('txe:session');
146
+ const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map(), artifactResolver, rootPath, packageName);
147
+ await topLevelOracleHandler.mineDeploymentNullifiers([
148
+ STANDARD_AUTH_REGISTRY_ADDRESS
149
+ ]);
150
+ return new TXESession(logger, store, stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp, artifactResolver, rootPath, packageName);
110
151
  }
111
152
  /**
112
153
  * Processes an oracle function invoked by the Noir test associated to this session.
@@ -121,7 +162,15 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
121
162
  return translator[validatedFunctionName](...inputs);
122
163
  } catch (error) {
123
164
  if (error instanceof z.ZodError) {
124
- throw new Error(`${functionName} does not correspond to any oracle handler available on RPCTranslator`);
165
+ let versionHint;
166
+ if (!this.txeOracleVersion) {
167
+ versionHint = ' The test appears to use an older version of Aztec.nr that does not' + ' support test environment oracle versioning. Update Aztec.nr to a compatible version.' + ' See https://docs.aztec.network/errors/12';
168
+ } else if (this.txeOracleVersion.minor > TXE_ORACLE_VERSION_MINOR) {
169
+ versionHint = ` The test uses Aztec.nr test oracle version` + ` ${this.txeOracleVersion.major}.${this.txeOracleVersion.minor}, but this test environment` + ` only supports up to ${TXE_ORACLE_VERSION_MAJOR}.${TXE_ORACLE_VERSION_MINOR}.` + ` Upgrade the Aztec CLI to a compatible version.` + ` See https://docs.aztec.network/errors/12`;
170
+ } else {
171
+ versionHint = ` The test's oracle version (${this.txeOracleVersion.major}.${this.txeOracleVersion.minor})` + ` is compatible with this test environment` + ` (${TXE_ORACLE_VERSION_MAJOR}.${TXE_ORACLE_VERSION_MINOR}), so this oracle should be` + ` available. This is an unexpected error, please report it.` + ` See https://docs.aztec.network/errors/13`;
172
+ }
173
+ throw new Error(`Unknown oracle '${functionName}'.${versionHint}`);
125
174
  } else if (error instanceof Error) {
126
175
  throw new Error(`Execution error while processing function ${functionName} in state ${this.state.name}: ${error.message}`);
127
176
  } else {
@@ -129,6 +178,68 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
129
178
  }
130
179
  }
131
180
  }
181
+ getCurrentJob() {
182
+ return this.currentJobId;
183
+ }
184
+ /** Commits the current job and begins a new one. Returns the new job ID. */ async cycleJob() {
185
+ await this.jobCoordinator.commitJob(this.currentJobId);
186
+ this.currentJobId = this.jobCoordinator.beginJob();
187
+ return this.currentJobId;
188
+ }
189
+ resetLastCall() {
190
+ const notQueriedMessageCount = this.lastCallInfo.queried ? 0 : this.lastCallInfo.offchainEffects.filter((payload)=>payload[0]?.equals(OFFCHAIN_MESSAGE_IDENTIFIER)).length;
191
+ if (notQueriedMessageCount > 0) {
192
+ this.logger.warn(`Dropping ${notQueriedMessageCount} unqueried offchain message(s) from the previous top-level call. ` + `To deliver them, call \`env.offchain_messages()\` and forward the result to the recipient contract's ` + `\`offchain_receive\` utility before issuing another top-level call. To intentionally discard, assign ` + `to \`let _ = env.offchain_messages()\` to silence this warning.`);
193
+ }
194
+ this.lastCallInfo = emptyLastCallState();
195
+ }
196
+ recordOffchainEffect(data) {
197
+ this.lastCallInfo.offchainEffects.push(data);
198
+ }
199
+ setLastCallContext(txHash, anchorBlockTimestamp) {
200
+ this.lastCallInfo.txHash = txHash;
201
+ this.lastCallInfo.anchorBlockTimestamp = anchorBlockTimestamp;
202
+ }
203
+ async withTopLevelCallTracking(work) {
204
+ this.resetLastCall();
205
+ // Capture the anchor *before* `work` runs: private/public executor calls mine a new block as a
206
+ // side effect, and that block's timestamp should not be attributed to this call's anchor.
207
+ const anchorBlockTimestamp = (await this.stateMachine.node.getBlockData('latest')).header.globalVariables.timestamp;
208
+ const { result, txHash } = await work();
209
+ this.setLastCallContext(txHash ?? Fr.ZERO, anchorBlockTimestamp);
210
+ return result;
211
+ }
212
+ getLastCallOffchainEffects() {
213
+ this.lastCallInfo.queried = true;
214
+ const effects = this.lastCallInfo.offchainEffects;
215
+ if (effects.length > MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY) {
216
+ throw new Error(`${effects.length} offchain effects exceed max ${MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY}`);
217
+ }
218
+ if (effects.some((e)=>e.length > MAX_OFFCHAIN_EFFECT_LEN)) {
219
+ throw new Error(`Some offchain effect has length larger than max ${MAX_OFFCHAIN_EFFECT_LEN}`);
220
+ }
221
+ return {
222
+ effects
223
+ };
224
+ }
225
+ getLastCallContext() {
226
+ const { txHash, anchorBlockTimestamp } = this.lastCallInfo;
227
+ return {
228
+ txHash,
229
+ anchorBlockTimestamp
230
+ };
231
+ }
232
+ setTxeOracleVersion(major, minor) {
233
+ if (major !== TXE_ORACLE_VERSION_MAJOR) {
234
+ const hint = major > TXE_ORACLE_VERSION_MAJOR ? 'The test was compiled with a newer version of Aztec.nr than your test environment supports. Upgrade your test environment to a compatible version.' : 'The test was compiled with an older version of Aztec.nr than your test environment supports. Recompile the test with a compatible version of Aztec.nr.';
235
+ throw new Error(`Incompatible test environment version: ${hint} See https://docs.aztec.network/errors/12 (expected test oracle major version ${TXE_ORACLE_VERSION_MAJOR}, got ${major})`);
236
+ }
237
+ this.txeOracleVersion = {
238
+ major,
239
+ minor
240
+ };
241
+ this.logger.debug(`Test compiled with test oracle version ${major}.${minor}`);
242
+ }
132
243
  async enterTopLevelState() {
133
244
  switch(this.state.name){
134
245
  case 'PRIVATE':
@@ -156,22 +267,24 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
156
267
  }
157
268
  }
158
269
  // Commit all staged stores from the job that was just completed, then begin a new job
159
- await this.jobCoordinator.commitJob(this.currentJobId);
160
- this.currentJobId = this.jobCoordinator.beginJob();
161
- this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
270
+ await this.cycleJob();
271
+ this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits, this.artifactResolver, this.rootPath, this.packageName);
162
272
  this.state = {
163
273
  name: 'TOP_LEVEL'
164
274
  };
165
275
  this.logger.debug(`Entered state ${this.state.name}`);
166
276
  }
167
- async enterPrivateState(contractAddress = DEFAULT_ADDRESS, anchorBlockNumber) {
277
+ async enterPrivateState(contractAddressOpt, anchorBlockNumberOpt, gasSettings) {
278
+ const contractAddress = contractAddressOpt?.value ?? DEFAULT_ADDRESS;
279
+ const anchorBlockNumber = anchorBlockNumberOpt?.value;
168
280
  this.exitTopLevelState();
281
+ this.resetLastCall();
169
282
  // Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
170
283
  // build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
171
284
  // a single transaction with the effects of what was done in the test.
172
- const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
173
- await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock, this.currentJobId).syncNoteNullifiers(contractAddress);
174
- const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
285
+ const anchorBlock = await this.stateMachine.node.getBlock(anchorBlockNumber ?? 'latest').then((b)=>b?.header);
286
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock, this.currentJobId).syncNoteNullifiers(contractAddress, await this.keyStore.getAccounts());
287
+ const latestBlock = await this.stateMachine.node.getBlock('latest').then((b)=>b?.header);
175
288
  const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
176
289
  blockNumber: BlockNumber(latestBlock.globalVariables.blockNumber + 1),
177
290
  timestamp: this.nextBlockTimestamp,
@@ -183,7 +296,34 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
183
296
  const noteCache = new ExecutionNoteCache(protocolNullifier);
184
297
  const taggingIndexCache = new ExecutionTaggingIndexCache();
185
298
  const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
186
- this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, utilityExecutor, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.stateMachine.contractSyncService, this.currentJobId);
299
+ this.oracleHandler = new TXEPrivateExecutionOracle({
300
+ argsHash: Fr.ZERO,
301
+ txContext: new TxContext(this.chainId, this.version, gasSettings),
302
+ callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
303
+ anchorBlockHeader: anchorBlock,
304
+ utilityExecutor,
305
+ authWitnesses: [],
306
+ capsules: [],
307
+ executionCache: new HashedValuesCache(),
308
+ noteCache,
309
+ taggingIndexCache,
310
+ contractStore: this.contractStore,
311
+ noteStore: this.noteStore,
312
+ keyStore: this.keyStore,
313
+ addressStore: this.addressStore,
314
+ aztecNode: this.stateMachine.node,
315
+ senderTaggingStore: this.senderTaggingStore,
316
+ recipientTaggingStore: this.recipientTaggingStore,
317
+ senderAddressBookStore: this.senderAddressBookStore,
318
+ capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
319
+ privateEventStore: this.privateEventStore,
320
+ contractSyncService: this.stateMachine.contractSyncService,
321
+ l2TipsStore: this.stateMachine.l2TipsProvider,
322
+ jobId: this.currentJobId,
323
+ scopes: await this.keyStore.getAccounts(),
324
+ messageContextService: this.stateMachine.messageContextService,
325
+ simulator: new WASMSimulator()
326
+ });
187
327
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
188
328
  // data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
189
329
  // difference resides in that the simulator has all information needed in order to run the simulation, while ours
@@ -196,39 +336,71 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
196
336
  taggingIndexCache
197
337
  };
198
338
  this.logger.debug(`Entered state ${this.state.name}`);
339
+ // Record the *resolved* anchor's timestamp — if the caller pinned the anchor to a past block
340
+ // via `anchorBlockNumber`, "latest" would be the wrong anchor for offchain-message semantics.
341
+ this.setLastCallContext(Fr.ZERO, anchorBlock.globalVariables.timestamp);
199
342
  return this.oracleHandler.getPrivateContextInputs();
200
343
  }
201
- async enterPublicState(contractAddress) {
344
+ async enterPublicState(contractAddressOpt) {
345
+ const contractAddress = contractAddressOpt?.value ?? DEFAULT_ADDRESS;
202
346
  this.exitTopLevelState();
347
+ this.resetLastCall();
203
348
  // The PublicContext will create a block with a single transaction in it, containing the effects of what was done in
204
349
  // the test. The block therefore gets the *next* block number and timestamp.
205
- const latestBlockNumber = (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.blockNumber;
350
+ const latestHeader = (await this.stateMachine.node.getBlockData('latest')).header;
206
351
  const globalVariables = makeGlobalVariables(undefined, {
207
- blockNumber: BlockNumber(latestBlockNumber + 1),
352
+ blockNumber: BlockNumber(latestHeader.globalVariables.blockNumber + 1),
208
353
  timestamp: this.nextBlockTimestamp,
209
354
  version: this.version,
210
355
  chainId: this.chainId
211
356
  });
212
- this.oracleHandler = new TXEOraclePublicContext(contractAddress ?? DEFAULT_ADDRESS, await this.stateMachine.synchronizer.nativeWorldStateService.fork(), getSingleTxBlockRequestHash(globalVariables.blockNumber), globalVariables);
357
+ this.oracleHandler = new TXEOraclePublicContext(contractAddress, await this.stateMachine.synchronizer.nativeWorldStateService.fork(), getSingleTxBlockRequestHash(globalVariables.blockNumber), globalVariables, this.contractStore);
213
358
  this.state = {
214
359
  name: 'PUBLIC'
215
360
  };
216
361
  this.logger.debug(`Entered state ${this.state.name}`);
362
+ // Public state is anchored at the latest block.
363
+ this.setLastCallContext(Fr.ZERO, latestHeader.globalVariables.timestamp);
217
364
  }
218
- async enterUtilityState(contractAddress = DEFAULT_ADDRESS) {
365
+ async enterUtilityState(contractAddressOpt) {
366
+ const contractAddress = contractAddressOpt?.value ?? DEFAULT_ADDRESS;
219
367
  this.exitTopLevelState();
368
+ this.resetLastCall();
220
369
  const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
221
370
  // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
222
371
  // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
223
372
  // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
224
373
  // be removed from the database.
225
374
  // TODO(#12553): make the synchronizer sync here instead and remove this
226
- await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress);
227
- this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
375
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress, await this.keyStore.getAccounts());
376
+ this.oracleHandler = new UtilityExecutionOracle({
377
+ contractAddress,
378
+ authWitnesses: [],
379
+ capsules: [],
380
+ anchorBlockHeader,
381
+ contractStore: this.contractStore,
382
+ noteStore: this.noteStore,
383
+ keyStore: this.keyStore,
384
+ addressStore: this.addressStore,
385
+ aztecNode: this.stateMachine.node,
386
+ recipientTaggingStore: this.recipientTaggingStore,
387
+ senderAddressBookStore: this.senderAddressBookStore,
388
+ capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
389
+ privateEventStore: this.privateEventStore,
390
+ messageContextService: this.stateMachine.messageContextService,
391
+ contractSyncService: this.stateMachine.contractSyncService,
392
+ l2TipsStore: this.stateMachine.l2TipsProvider,
393
+ jobId: this.currentJobId,
394
+ scopes: await this.keyStore.getAccounts(),
395
+ simulator: new WASMSimulator(),
396
+ utilityExecutor: this.utilityExecutorForContractSync(anchorBlockHeader)
397
+ });
228
398
  this.state = {
229
399
  name: 'UTILITY'
230
400
  };
231
401
  this.logger.debug(`Entered state ${this.state.name}`);
402
+ // Utility state anchors at whatever the anchor block store is pointing to (tracked as latest).
403
+ this.setLastCallContext(Fr.ZERO, anchorBlockHeader.globalVariables.timestamp);
232
404
  }
233
405
  exitTopLevelState() {
234
406
  if (this.state.name != 'TOP_LEVEL') {
@@ -236,8 +408,8 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
236
408
  }
237
409
  // Note that while all public and private contexts do is build a single block that we then process when exiting
238
410
  // those, the top level context performs a large number of actions not captured in the following 'close' call. Among
239
- // others, it will create empty blocks (via `txeAdvanceBlocksBy` and `deploy`), create blocks with transactions via
240
- // `txePrivateCallNewFlow` and `txePublicCallNewFlow`, add accounts to PXE via `txeAddAccount`, etc. This is a
411
+ // others, it will create empty blocks (via `advanceBlocksBy` and `deploy`), create blocks with transactions via
412
+ // `privateCallNewFlow` and `publicCallNewFlow`, add accounts to PXE via `addAccount`, etc. This is a
241
413
  // slight inconsistency in the working model of this class, but is not too bad.
242
414
  // TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
243
415
  // level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset
@@ -281,14 +453,36 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
281
453
  }
282
454
  }
283
455
  utilityExecutorForContractSync(anchorBlock) {
284
- return async (call)=>{
456
+ return async (call, scopes)=>{
285
457
  const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
286
458
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
287
459
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
288
460
  }
289
461
  try {
290
- const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlock, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
291
- await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
462
+ const simulator = new WASMSimulator();
463
+ const oracle = new UtilityExecutionOracle({
464
+ contractAddress: call.to,
465
+ authWitnesses: [],
466
+ capsules: [],
467
+ anchorBlockHeader: anchorBlock,
468
+ contractStore: this.contractStore,
469
+ noteStore: this.noteStore,
470
+ keyStore: this.keyStore,
471
+ addressStore: this.addressStore,
472
+ aztecNode: this.stateMachine.node,
473
+ recipientTaggingStore: this.recipientTaggingStore,
474
+ senderAddressBookStore: this.senderAddressBookStore,
475
+ capsuleService: new CapsuleService(this.capsuleStore, scopes),
476
+ privateEventStore: this.privateEventStore,
477
+ messageContextService: this.stateMachine.messageContextService,
478
+ contractSyncService: this.stateMachine.contractSyncService,
479
+ l2TipsStore: this.stateMachine.l2TipsProvider,
480
+ jobId: this.currentJobId,
481
+ scopes,
482
+ simulator,
483
+ utilityExecutor: this.utilityExecutorForContractSync(anchorBlock)
484
+ });
485
+ await simulator.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
292
486
  err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
293
487
  throw new ExecutionError(err.message, {
294
488
  contractAddress: call.to,
@@ -0,0 +1,191 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { type ContractArtifact } from '@aztec/stdlib/abi';
4
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import { BlockHash } from '@aztec/stdlib/block';
6
+ import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
7
+ import { z } from 'zod';
8
+ export type ForeignCallSingle = string;
9
+ export type ForeignCallArray = string[];
10
+ export type ForeignCallArgs = (ForeignCallSingle | ForeignCallArray | ContractArtifact | ContractInstanceWithAddress)[];
11
+ export type ForeignCallResult = {
12
+ values: (ForeignCallSingle | ForeignCallArray)[];
13
+ };
14
+ export declare function fromSingle(obj: ForeignCallSingle): Fr;
15
+ export declare function addressFromSingle(obj: ForeignCallSingle): AztecAddress;
16
+ export declare function blockHashFromSingle(obj: ForeignCallSingle): BlockHash;
17
+ export declare function fromArray(obj: ForeignCallArray): Fr[];
18
+ /**
19
+ * Converts an array of Noir unsigned integers to a single tightly-packed buffer.
20
+ * @param uintBitSize If it's an array of Noir u8's, put `8`, etc.
21
+ * @returns A buffer where each byte is correctly represented as a single byte in the buffer.
22
+ */
23
+ export declare function fromUintArray(obj: ForeignCallArray, uintBitSize: number): Buffer;
24
+ /**
25
+ * Converts a Noir BoundedVec of unsigned integers into a Buffer. Note that BoundedVecs are structs, and therefore
26
+ * translated as two separate ForeignCallArray and ForeignCallSingle values (an array and a single field).
27
+ *
28
+ * @param storage The array with the BoundedVec's storage (i.e. BoundedVec::storage())
29
+ * @param length The length of the BoundedVec (i.e. BoundedVec::len())
30
+ * @param uintBitSize If it's an array of Noir u8's, put `8`, etc.
31
+ * @returns A buffer containing the unsigned integers tightly packed
32
+ */
33
+ export declare function fromUintBoundedVec(storage: ForeignCallArray, length: ForeignCallSingle, uintBitSize: number): Buffer;
34
+ export declare function toSingle(value: AztecAddress | EthAddress | Fr | Buffer | boolean | number | bigint): ForeignCallSingle;
35
+ export declare function toArray(objs: Fr[]): ForeignCallArray;
36
+ export declare function toSingleOrArray(value: Fr | Fr[]): string | string[];
37
+ export declare function bufferToU8Array(buffer: Buffer): ForeignCallArray;
38
+ /**
39
+ * Converts a ForeignCallArray into a tuple which represents a nr BoundedVec.
40
+ * If the input array is shorter than the maxLen, it pads the result with zeros,
41
+ * so that nr can correctly coerce this result into a BoundedVec.
42
+ * @param bVecStorage - The array underlying the BoundedVec.
43
+ * @param maxLen - the max length of the BoundedVec.
44
+ * @returns a tuple representing a BoundedVec.
45
+ */
46
+ export declare function arrayToBoundedVec(bVecStorage: ForeignCallArray, maxLen: number): [ForeignCallArray, ForeignCallSingle];
47
+ /**
48
+ * Converts an array of arrays representing Noir BoundedVec of nested arrays into its Noir serialized form.
49
+ * @param bVecStorage - The array underlying the BoundedVec.
50
+ * @param maxLen - The max length of the BoundedVec (max num of the nested arrays in the BoundedVec).
51
+ * @param nestedArrayLength - The length of the nested arrays (each nested array has to have the same length).
52
+ * @returns Serialized BoundedVec following Noir intrinsic serialization.
53
+ */
54
+ export declare function arrayOfArraysToBoundedVecOfArrays(bVecStorage: ForeignCallArray[], maxLen: number, nestedArrayLength: number): [ForeignCallArray, ForeignCallSingle];
55
+ export declare function toForeignCallResult(obj: (ForeignCallSingle | ForeignCallArray)[]): {
56
+ values: (string | ForeignCallArray)[];
57
+ };
58
+ export declare const ForeignCallSingleSchema: z.ZodString;
59
+ export declare const ForeignCallArraySchema: z.ZodArray<z.ZodString>;
60
+ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodObject<{
61
+ name: z.ZodString;
62
+ aztecVersion: z.ZodDefault<z.ZodString>;
63
+ functions: z.ZodArray<z.ZodIntersection<z.ZodObject<{
64
+ name: z.ZodString;
65
+ functionType: z.ZodEnum<typeof import("@aztec/stdlib/abi").FunctionType>;
66
+ isOnlySelf: z.ZodBoolean;
67
+ isStatic: z.ZodBoolean;
68
+ isInitializer: z.ZodBoolean;
69
+ parameters: z.ZodArray<z.ZodObject<{
70
+ name: z.ZodString;
71
+ type: z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>;
72
+ visibility: z.ZodEnum<{
73
+ databus: "databus";
74
+ private: "private";
75
+ public: "public";
76
+ }>;
77
+ }, z.core.$strip>>;
78
+ returnTypes: z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>;
79
+ errorTypes: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
80
+ error_kind: z.ZodLiteral<"string">;
81
+ string: z.ZodString;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ error_kind: z.ZodLiteral<"fmtstring">;
84
+ length: z.ZodNumber;
85
+ item_types: z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>;
86
+ }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
87
+ error_kind: z.ZodLiteral<"custom">;
88
+ }, z.core.$strip>, z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>]>>>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ bytecode: import("@aztec/foundation/schemas").ZodFor<Buffer<ArrayBufferLike>>;
91
+ verificationKey: z.ZodOptional<z.ZodString>;
92
+ debugSymbols: z.ZodString;
93
+ debug: z.ZodOptional<z.ZodObject<{
94
+ debugSymbols: z.ZodObject<{
95
+ location_tree: z.ZodObject<{
96
+ locations: z.ZodArray<z.ZodObject<{
97
+ parent: z.ZodNullable<z.ZodNumber>;
98
+ value: z.ZodObject<{
99
+ span: z.ZodObject<{
100
+ start: z.ZodNumber;
101
+ end: z.ZodNumber;
102
+ }, z.core.$strip>;
103
+ file: z.ZodNumber;
104
+ }, z.core.$strip>;
105
+ }, z.core.$strip>>;
106
+ }, z.core.$strip>;
107
+ acir_locations: z.ZodRecord<z.ZodString, z.ZodNumber>;
108
+ brillig_locations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
109
+ }, z.core.$strip>;
110
+ files: z.ZodRecord<z.ZodString, z.ZodObject<{
111
+ source: z.ZodString;
112
+ path: z.ZodString;
113
+ function_locations: z.ZodArray<z.ZodObject<{
114
+ start: z.ZodNumber;
115
+ name: z.ZodString;
116
+ }, z.core.$strip>>;
117
+ }, z.core.$strip>>;
118
+ }, z.core.$strip>>;
119
+ }, z.core.$strip>>>;
120
+ nonDispatchPublicFunctions: z.ZodArray<z.ZodObject<{
121
+ name: z.ZodString;
122
+ functionType: z.ZodEnum<typeof import("@aztec/stdlib/abi").FunctionType>;
123
+ isOnlySelf: z.ZodBoolean;
124
+ isStatic: z.ZodBoolean;
125
+ isInitializer: z.ZodBoolean;
126
+ parameters: z.ZodArray<z.ZodObject<{
127
+ name: z.ZodString;
128
+ type: z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>;
129
+ visibility: z.ZodEnum<{
130
+ databus: "databus";
131
+ private: "private";
132
+ public: "public";
133
+ }>;
134
+ }, z.core.$strip>>;
135
+ returnTypes: z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>;
136
+ errorTypes: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
137
+ error_kind: z.ZodLiteral<"string">;
138
+ string: z.ZodString;
139
+ }, z.core.$strip>, z.ZodObject<{
140
+ error_kind: z.ZodLiteral<"fmtstring">;
141
+ length: z.ZodNumber;
142
+ item_types: z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>;
143
+ }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
144
+ error_kind: z.ZodLiteral<"custom">;
145
+ }, z.core.$strip>, z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>]>>>;
146
+ }, z.core.$strip>>;
147
+ outputs: z.ZodObject<{
148
+ structs: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiType, unknown>>>>, z.ZodTransform<Record<string, import("@aztec/stdlib/abi").AbiType[]>, Record<string, import("@aztec/stdlib/abi").AbiType[]>>>;
149
+ globals: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiValue, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiValue, unknown>>>>;
150
+ }, z.core.$strip>;
151
+ storageLayout: z.ZodRecord<z.ZodString, z.ZodObject<{
152
+ slot: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
153
+ }, z.core.$strip>>;
154
+ fileMap: z.ZodRecord<z.ZodCoercedNumber<unknown>, z.ZodObject<{
155
+ source: z.ZodString;
156
+ path: z.ZodString;
157
+ function_locations: z.ZodArray<z.ZodObject<{
158
+ start: z.ZodNumber;
159
+ name: z.ZodString;
160
+ }, z.core.$strip>>;
161
+ }, z.core.$strip>>;
162
+ }, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
163
+ version: z.ZodLiteral<2>;
164
+ salt: import("@aztec/foundation/schemas").ZodFor<Fr>;
165
+ deployer: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
166
+ currentContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
167
+ originalContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
168
+ initializationHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
169
+ immutablesHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
170
+ publicKeys: z.ZodPipe<z.ZodObject<{
171
+ npkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
172
+ ivpkM: z.ZodType<import("@aztec/foundation/schemas").Point, string, z.core.$ZodTypeInternals<import("@aztec/foundation/schemas").Point, string>>;
173
+ ovpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
174
+ tpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
175
+ mspkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
176
+ fbpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
177
+ }, z.core.$strip>, z.ZodTransform<import("@aztec/stdlib/keys").PublicKeys, {
178
+ npkMHash: Fr;
179
+ ivpkM: import("@aztec/foundation/schemas").Point;
180
+ ovpkMHash: Fr;
181
+ tpkMHash: Fr;
182
+ mspkMHash: Fr;
183
+ fbpkMHash: Fr;
184
+ }>>;
185
+ }, z.core.$strip>, z.ZodObject<{
186
+ address: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
187
+ }, z.core.$strip>>]>>;
188
+ export declare const ForeignCallResultSchema: z.ZodObject<{
189
+ values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
190
+ }, z.core.$strip>;
191
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5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