@aztec/aztec-node 5.0.0-private.20260319 → 5.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dest/aztec-node/block_response_helpers.d.ts +25 -0
  2. package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
  3. package/dest/aztec-node/block_response_helpers.js +112 -0
  4. package/dest/aztec-node/config.d.ts +16 -4
  5. package/dest/aztec-node/config.d.ts.map +1 -1
  6. package/dest/aztec-node/config.js +15 -5
  7. package/dest/aztec-node/node_public_calls_simulator.d.ts +90 -0
  8. package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
  9. package/dest/aztec-node/node_public_calls_simulator.js +346 -0
  10. package/dest/aztec-node/public_data_overrides.d.ts +13 -0
  11. package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
  12. package/dest/aztec-node/public_data_overrides.js +21 -0
  13. package/dest/aztec-node/register_node_rpc_handlers.d.ts +10 -0
  14. package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
  15. package/dest/aztec-node/register_node_rpc_handlers.js +31 -0
  16. package/dest/aztec-node/server.d.ts +128 -134
  17. package/dest/aztec-node/server.d.ts.map +1 -1
  18. package/dest/aztec-node/server.js +393 -820
  19. package/dest/bin/index.js +15 -10
  20. package/dest/factory.d.ts +33 -0
  21. package/dest/factory.d.ts.map +1 -0
  22. package/dest/factory.js +496 -0
  23. package/dest/index.d.ts +3 -1
  24. package/dest/index.d.ts.map +1 -1
  25. package/dest/index.js +2 -0
  26. package/dest/modules/block_parameter.d.ts +25 -0
  27. package/dest/modules/block_parameter.d.ts.map +1 -0
  28. package/dest/modules/block_parameter.js +100 -0
  29. package/dest/modules/node_block_provider.d.ts +19 -0
  30. package/dest/modules/node_block_provider.d.ts.map +1 -0
  31. package/dest/modules/node_block_provider.js +112 -0
  32. package/dest/modules/node_tx_receipt.d.ts +24 -0
  33. package/dest/modules/node_tx_receipt.d.ts.map +1 -0
  34. package/dest/modules/node_tx_receipt.js +70 -0
  35. package/dest/modules/node_world_state_queries.d.ts +61 -0
  36. package/dest/modules/node_world_state_queries.d.ts.map +1 -0
  37. package/dest/modules/node_world_state_queries.js +257 -0
  38. package/dest/sentinel/config.d.ts +3 -2
  39. package/dest/sentinel/config.d.ts.map +1 -1
  40. package/dest/sentinel/config.js +15 -5
  41. package/dest/sentinel/factory.d.ts +5 -3
  42. package/dest/sentinel/factory.d.ts.map +1 -1
  43. package/dest/sentinel/factory.js +12 -5
  44. package/dest/sentinel/sentinel.d.ts +145 -21
  45. package/dest/sentinel/sentinel.d.ts.map +1 -1
  46. package/dest/sentinel/sentinel.js +227 -105
  47. package/dest/sentinel/store.d.ts +8 -8
  48. package/dest/sentinel/store.d.ts.map +1 -1
  49. package/dest/sentinel/store.js +25 -17
  50. package/dest/test/index.d.ts +3 -3
  51. package/dest/test/index.d.ts.map +1 -1
  52. package/package.json +28 -26
  53. package/src/aztec-node/block_response_helpers.ts +161 -0
  54. package/src/aztec-node/config.ts +30 -7
  55. package/src/aztec-node/node_public_calls_simulator.ts +383 -0
  56. package/src/aztec-node/public_data_overrides.ts +35 -0
  57. package/src/aztec-node/register_node_rpc_handlers.ts +29 -0
  58. package/src/aztec-node/server.ts +514 -1070
  59. package/src/bin/index.ts +19 -12
  60. package/src/factory.ts +656 -0
  61. package/src/index.ts +2 -0
  62. package/src/modules/block_parameter.ts +93 -0
  63. package/src/modules/node_block_provider.ts +149 -0
  64. package/src/modules/node_tx_receipt.ts +115 -0
  65. package/src/modules/node_world_state_queries.ts +360 -0
  66. package/src/sentinel/README.md +103 -0
  67. package/src/sentinel/config.ts +18 -6
  68. package/src/sentinel/factory.ts +21 -6
  69. package/src/sentinel/sentinel.ts +277 -130
  70. package/src/sentinel/store.ts +26 -18
  71. package/src/test/index.ts +2 -2
@@ -0,0 +1,346 @@
1
+ function _ts_add_disposable_resource(env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() {
16
+ try {
17
+ inner.call(this);
18
+ } catch (e) {
19
+ return Promise.reject(e);
20
+ }
21
+ };
22
+ env.stack.push({
23
+ value: value,
24
+ dispose: dispose,
25
+ async: async
26
+ });
27
+ } else if (async) {
28
+ env.stack.push({
29
+ async: true
30
+ });
31
+ }
32
+ return value;
33
+ }
34
+ function _ts_dispose_resources(env) {
35
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
39
+ return (_ts_dispose_resources = function _ts_dispose_resources(env) {
40
+ function fail(e) {
41
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
42
+ env.hasError = true;
43
+ }
44
+ var r, s = 0;
45
+ function next() {
46
+ while(r = env.stack.pop()){
47
+ try {
48
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
49
+ if (r.dispose) {
50
+ var result = r.dispose.call(r.value);
51
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
52
+ fail(e);
53
+ return next();
54
+ });
55
+ } else s |= 1;
56
+ } catch (e) {
57
+ fail(e);
58
+ }
59
+ }
60
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
61
+ if (env.hasError) throw env.error;
62
+ }
63
+ return next();
64
+ })(env);
65
+ }
66
+ import { L1ToL2MessagesNotReadyError } from '@aztec/archiver';
67
+ import { PROPOSER_PIPELINING_SLOT_OFFSET } from '@aztec/epoch-cache';
68
+ import { SimulationOverridesBuilder } from '@aztec/ethereum/contracts';
69
+ import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
70
+ import { compactArray } from '@aztec/foundation/collection';
71
+ import { EthAddress } from '@aztec/foundation/eth-address';
72
+ import { BadRequestError } from '@aztec/foundation/json-rpc';
73
+ import { createLogger } from '@aztec/foundation/log';
74
+ import { DateProvider } from '@aztec/foundation/timer';
75
+ import { isErrorClass } from '@aztec/foundation/types';
76
+ import { PublicContractsDB, PublicProcessorFactory } from '@aztec/simulator/server';
77
+ import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
78
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
79
+ import { buildCheckpointSimulationOverridesPlan } from '@aztec/stdlib/checkpoint';
80
+ import { appendL1ToL2MessagesToTree } from '@aztec/stdlib/messaging';
81
+ import { GlobalVariables, PublicSimulationOutput } from '@aztec/stdlib/tx';
82
+ import { getTelemetryClient } from '@aztec/telemetry-client';
83
+ import { applyPublicDataOverrides } from './public_data_overrides.js';
84
+ /**
85
+ * Simulates the public part of a transaction against a fresh world-state fork.
86
+ *
87
+ * Extracted from `AztecNodeService` so the slot/globals selection can be unit-tested without
88
+ * standing up the whole node, and to keep `server.ts` smaller.
89
+ *
90
+ * The simulator picks globals in one of two ways, mirroring how the sequencer builds the next block:
91
+ * - **When the next block continues an in-progress checkpoint** (the latest proposed block is ahead of
92
+ * the proposed-checkpoint frontier): every block in a checkpoint shares the same
93
+ * `CheckpointGlobalVariables`, so we copy the latest proposed block's globals verbatim and only
94
+ * bump the block number. No L1 calls, no L1-to-L2 message insertion.
95
+ * - **When the next block opens a new checkpoint** (the latest proposed block coincides with the
96
+ * proposed-checkpoint frontier): we compute fresh globals for the slot the next block will land in,
97
+ * applying the same `SimulationOverridesPlan` the sequencer applies so the simulated mana min fee
98
+ * matches what the sequencer will write into the block header.
99
+ */ export class NodePublicCallsSimulator {
100
+ blockSource;
101
+ worldStateSynchronizer;
102
+ l1ToL2MessageSource;
103
+ contractDataSource;
104
+ globalVariableBuilder;
105
+ rollupContract;
106
+ epochCache;
107
+ signatureContext;
108
+ config;
109
+ telemetry;
110
+ log;
111
+ constructor(deps){
112
+ this.blockSource = deps.blockSource;
113
+ this.worldStateSynchronizer = deps.worldStateSynchronizer;
114
+ this.l1ToL2MessageSource = deps.l1ToL2MessageSource;
115
+ this.contractDataSource = deps.contractDataSource;
116
+ this.globalVariableBuilder = deps.globalVariableBuilder;
117
+ this.rollupContract = deps.rollupContract;
118
+ this.epochCache = deps.epochCache;
119
+ this.signatureContext = deps.signatureContext;
120
+ this.config = deps.config;
121
+ this.telemetry = deps.telemetry ?? getTelemetryClient();
122
+ this.log = deps.log ?? createLogger('node:public-calls-simulator');
123
+ }
124
+ /**
125
+ * Simulates the public part of a transaction with the current state.
126
+ * @param tx - The transaction to simulate.
127
+ * @param skipFeeEnforcement - If true, fee enforcement is skipped.
128
+ * @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
129
+ */ async simulate(tx, skipFeeEnforcement = false, overrides) {
130
+ const env = {
131
+ stack: [],
132
+ error: void 0,
133
+ hasError: false
134
+ };
135
+ try {
136
+ // Check total gas limit for simulation
137
+ const gasSettings = tx.data.constants.txContext.gasSettings;
138
+ const txGasLimit = gasSettings.gasLimits.l2Gas;
139
+ const teardownGasLimit = gasSettings.teardownGasLimits.l2Gas;
140
+ if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
141
+ throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
142
+ }
143
+ const txHash = tx.getTxHash();
144
+ const [l2Tips, proposedCheckpointData] = await Promise.all([
145
+ this.blockSource.getL2Tips(),
146
+ this.blockSource.getProposedCheckpointData()
147
+ ]);
148
+ const latestBlockNumber = l2Tips.proposed.number;
149
+ const blockNumber = BlockNumber.add(latestBlockNumber, 1);
150
+ // Terminating block of the proposed-checkpoint frontier. `getProposedCheckpointData()` returns the
151
+ // leading proposed (not-yet-L1-confirmed) checkpoint, whose last block is `startBlock + blockCount
152
+ // - 1`; with no proposed checkpoint the frontier coincides with the checkpointed tip.
153
+ const proposedCheckpointLastBlock = proposedCheckpointData ? BlockNumber.add(proposedCheckpointData.startBlock, proposedCheckpointData.blockCount - 1) : l2Tips.checkpointed.block.number;
154
+ // The next block continues the in-progress checkpoint when the latest proposed block is ahead of
155
+ // the proposed-checkpoint terminating block; it opens a new checkpoint when they coincide.
156
+ const atCheckpointBoundary = proposedCheckpointLastBlock === l2Tips.proposed.number;
157
+ // `targetCheckpoint` is the checkpoint whose L1-to-L2 messages must be inserted into the fork
158
+ // before simulation. Only set when opening a new checkpoint, where the next block is its first block.
159
+ const { globalVariables: newGlobalVariables, targetCheckpoint } = atCheckpointBoundary ? await this.buildGlobalVariablesForNewCheckpoint(l2Tips, proposedCheckpointData, blockNumber) : {
160
+ globalVariables: await this.copyGlobalVariablesFromLatestProposedBlock(latestBlockNumber, blockNumber)
161
+ };
162
+ const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry, this.log.getBindings());
163
+ this.log.verbose(`Simulating public calls for tx ${txHash}`, {
164
+ globalVariables: newGlobalVariables.toInspect(),
165
+ txHash,
166
+ blockNumber,
167
+ atCheckpointBoundary
168
+ });
169
+ // Ensure world-state has caught up with the latest block we loaded from the archiver
170
+ await this.worldStateSynchronizer.syncImmediate(latestBlockNumber);
171
+ const nextCheckpointMessages = await this.getNextCheckpointMessages(targetCheckpoint);
172
+ const merkleTreeFork = _ts_add_disposable_resource(env, await this.worldStateSynchronizer.fork(latestBlockNumber), true);
173
+ if (nextCheckpointMessages !== undefined) {
174
+ this.log.debug(`Appending ${nextCheckpointMessages.length} L1-to-L2 messages to the world state tree for the next checkpoint`, {
175
+ checkpointNumber: targetCheckpoint
176
+ });
177
+ await appendL1ToL2MessagesToTree(merkleTreeFork, nextCheckpointMessages);
178
+ }
179
+ await applyPublicDataOverrides(merkleTreeFork, overrides?.publicStorage);
180
+ const config = PublicSimulatorConfig.from({
181
+ skipFeeEnforcement,
182
+ collectDebugLogs: true,
183
+ collectHints: false,
184
+ collectCallMetadata: true,
185
+ collectStatistics: false,
186
+ collectionLimits: CollectionLimitsConfig.from({
187
+ maxDebugLogMemoryReads: this.config.rpcSimulatePublicMaxDebugLogMemoryReads
188
+ })
189
+ });
190
+ const contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
191
+ if (overrides?.contracts) {
192
+ contractsDB.addContracts(Object.values(overrides.contracts).map(({ instance })=>instance));
193
+ }
194
+ const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config, contractsDB);
195
+ // REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
196
+ const [processedTxs, failedTxs, _usedTxs, returns, debugLogs] = await processor.process([
197
+ tx
198
+ ]);
199
+ // REFACTOR: Consider returning the error rather than throwing
200
+ if (failedTxs.length) {
201
+ this.log.warn(`Simulated tx ${txHash} fails: ${failedTxs[0].error}`, {
202
+ txHash
203
+ });
204
+ throw failedTxs[0].error;
205
+ }
206
+ const [processedTx] = processedTxs;
207
+ return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed, debugLogs);
208
+ } catch (e) {
209
+ env.error = e;
210
+ env.hasError = true;
211
+ } finally{
212
+ const result = _ts_dispose_resources(env);
213
+ if (result) await result;
214
+ }
215
+ }
216
+ /**
217
+ * Fetches the next checkpoint's L1-to-L2 messages to insert into the fork before simulation. Only set
218
+ * when opening a new checkpoint; when continuing an in-progress checkpoint the ongoing checkpoint's
219
+ * messages were already applied when its first block synced, so inserting here would double-count them
220
+ * — which is why a missing header for the latest proposed block throws rather than falling through to
221
+ * this path. A not-ready or failed fetch degrades to simulating without the messages rather than
222
+ * failing the request.
223
+ */ async getNextCheckpointMessages(targetCheckpoint) {
224
+ if (targetCheckpoint === undefined) {
225
+ return undefined;
226
+ }
227
+ try {
228
+ return await this.l1ToL2MessageSource.getL1ToL2Messages(targetCheckpoint);
229
+ } catch (err) {
230
+ if (isErrorClass(err, L1ToL2MessagesNotReadyError)) {
231
+ this.log.warn(`L1-to-L2 messages for checkpoint ${targetCheckpoint} are not ready yet (simulating without them)`, {
232
+ checkpointNumber: targetCheckpoint
233
+ });
234
+ } else {
235
+ this.log.error(`Failed to get L1-to-L2 messages for checkpoint ${targetCheckpoint} (simulating without them)`, err, {
236
+ checkpointNumber: targetCheckpoint
237
+ });
238
+ }
239
+ return undefined;
240
+ }
241
+ }
242
+ /**
243
+ * Continues an in-progress checkpoint: the next block extends the checkpoint the latest proposed
244
+ * block belongs to. Every block in a checkpoint shares the same `CheckpointGlobalVariables`, so the
245
+ * next block's globals are the latest proposed block's globals with only the block number bumped —
246
+ * including the proposer's real coinbase/feeRecipient. No L1 reads and no L1-to-L2 message insertion
247
+ * happen here.
248
+ *
249
+ * A missing header means the archiver reported a proposed tip via `getL2Tips` but no longer has its
250
+ * data (a torn snapshot). We throw a transient/retryable error rather than treating the next block as
251
+ * opening a new checkpoint: the fork at `latestBlockNumber` already contains the ongoing checkpoint's
252
+ * L1-to-L2 messages, so inserting the next checkpoint's messages would append them a second time.
253
+ */ async copyGlobalVariablesFromLatestProposedBlock(latestBlockNumber, blockNumber) {
254
+ const latestBlockData = await this.blockSource.getBlockData({
255
+ number: latestBlockNumber
256
+ });
257
+ if (!latestBlockData) {
258
+ throw new Error(`Cannot simulate public calls: latest proposed block ${latestBlockNumber} has no header on this node ` + `(torn archiver snapshot); retry`);
259
+ }
260
+ return GlobalVariables.from({
261
+ ...latestBlockData.header.globalVariables,
262
+ blockNumber
263
+ });
264
+ }
265
+ /**
266
+ * Opens a new checkpoint: the next block is the first of a fresh checkpoint. Picks the slot the next
267
+ * block will land in, mirroring the sequencer, and builds the same `SimulationOverridesPlan` the
268
+ * sequencer applies so the simulated mana min fee matches what the sequencer will write into the
269
+ * block header. Coinbase and fee recipient stay zero (we cannot know the future proposer's payout
270
+ * addresses), unlike continuing an in-progress checkpoint which inherits the real ones from the
271
+ * proposed header. Returns the target checkpoint so the caller inserts that checkpoint's L1-to-L2
272
+ * messages into the fork.
273
+ */ async buildGlobalVariablesForNewCheckpoint(l2Tips, proposedCheckpointData, blockNumber) {
274
+ const checkpointedCheckpointNumber = l2Tips.checkpointed.checkpoint.number;
275
+ // The new checkpoint sits on top of the proposed one when pipelining, otherwise on the
276
+ // checkpointed tip. The target slot and the overrides plan both derive from the single
277
+ // `proposedCheckpointData` read, so they cannot disagree about the proposed parent.
278
+ const proposedCheckpointNumber = proposedCheckpointData?.checkpointNumber ?? checkpointedCheckpointNumber;
279
+ const targetSlot = this.computeTargetSlot(proposedCheckpointData);
280
+ const plan = await this.buildSimulationOverridesPlan(proposedCheckpointData, checkpointedCheckpointNumber);
281
+ const checkpointGlobalVariables = await this.globalVariableBuilder.buildCheckpointGlobalVariables(EthAddress.ZERO, AztecAddress.ZERO, targetSlot, plan);
282
+ return {
283
+ globalVariables: GlobalVariables.from({
284
+ blockNumber,
285
+ ...checkpointGlobalVariables
286
+ }),
287
+ targetCheckpoint: CheckpointNumber(proposedCheckpointNumber + 1)
288
+ };
289
+ }
290
+ /**
291
+ * Slot the next block will land in. The first term is the sequencer's exact formula
292
+ * (`getEpochAndSlotInNextL1Slot().slot + PROPOSER_PIPELINING_SLOT_OFFSET`). The `max` with
293
+ * `proposedCheckpointSlot + 1` is an RPC-side approximation of the next build: when a proposed
294
+ * checkpoint is gossiped before its L1 slot starts, the next build (once its wall clock arrives)
295
+ * will target `parentSlot + 1`. The sequencer never advances its own target past wall clock — it
296
+ * just declines to build — so this is a prediction of inclusion globals, not literal sequencer
297
+ * behavior. The parent slot comes from the proposed checkpoint header so the slot and the
298
+ * overrides plan cannot derive from different snapshots.
299
+ */ computeTargetSlot(proposedCheckpointData) {
300
+ const slotFromNextL1Timestamp = this.epochCache.getEpochAndSlotInNextL1Slot().slot + PROPOSER_PIPELINING_SLOT_OFFSET;
301
+ const slotAfterProposedCheckpoint = proposedCheckpointData ? proposedCheckpointData.header.slotNumber + 1 : undefined;
302
+ return SlotNumber(Math.max(...compactArray([
303
+ slotFromNextL1Timestamp,
304
+ slotAfterProposedCheckpoint
305
+ ])));
306
+ }
307
+ /**
308
+ * Builds the chain-state overrides plan the simulator passes to `buildCheckpointGlobalVariables`,
309
+ * mirroring the sequencer (which always pins tips to neutralize prunes). When pipelining, the plan
310
+ * carries the proposed parent's archive, temp-checkpoint-log cell, and locally-derived fee header.
311
+ *
312
+ * Both the pipelining and invalid-pending-chain paths need a rollup contract for the L1 fee reads.
313
+ * Environments that omit it (e.g. TXE, which never has a proposed checkpoint and whose pending chain
314
+ * is always valid) fall back to pinning both pending and proven tips to the checkpointed tip, which
315
+ * neutralizes prunes in fee computation at the cost of non-pipelined fees.
316
+ */ async buildSimulationOverridesPlan(proposedCheckpointData, checkpointedCheckpointNumber) {
317
+ const rollup = this.rollupContract;
318
+ if (rollup) {
319
+ if (proposedCheckpointData) {
320
+ return buildCheckpointSimulationOverridesPlan({
321
+ checkpointNumber: CheckpointNumber(proposedCheckpointData.checkpointNumber + 1),
322
+ proposedCheckpointData,
323
+ checkpointedCheckpointNumber,
324
+ rollup,
325
+ signatureContext: this.signatureContext,
326
+ log: this.log
327
+ });
328
+ }
329
+ const validationStatus = await this.blockSource.getPendingChainValidationStatus();
330
+ if (!validationStatus.valid) {
331
+ return buildCheckpointSimulationOverridesPlan({
332
+ checkpointNumber: CheckpointNumber(checkpointedCheckpointNumber + 1),
333
+ invalidateToPendingCheckpointNumber: CheckpointNumber(validationStatus.checkpoint.checkpointNumber - 1),
334
+ checkpointedCheckpointNumber,
335
+ rollup,
336
+ signatureContext: this.signatureContext,
337
+ log: this.log
338
+ });
339
+ }
340
+ }
341
+ return new SimulationOverridesBuilder().withChainTips({
342
+ pending: checkpointedCheckpointNumber,
343
+ proven: checkpointedCheckpointNumber
344
+ }).build();
345
+ }
346
+ }
@@ -0,0 +1,13 @@
1
+ import type { PublicStorageOverride } from '@aztec/stdlib/interfaces/client';
2
+ import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
3
+ /**
4
+ * Injects public-state overrides into an (ephemeral) world-state fork before simulation.
5
+ *
6
+ * Each override is written via the same `sequentialInsert` path the public processor
7
+ * uses during real transaction execution, so low-leaf updates and root coherence are
8
+ * handled identically for both simulation and proof generation.
9
+ *
10
+ * Writes never reach committed world state — the fork is thrown away after simulation.
11
+ */
12
+ export declare function applyPublicDataOverrides(fork: MerkleTreeWriteOperations, publicStorage: PublicStorageOverride[] | undefined): Promise<void>;
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2RhdGFfb3ZlcnJpZGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXp0ZWMtbm9kZS9wdWJsaWNfZGF0YV9vdmVycmlkZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM3RSxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR2pGOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxJQUFJLEVBQUUseUJBQXlCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFBRSxHQUFHLFNBQVMsR0FDakQsT0FBTyxDQUFDLElBQUksQ0FBQyxDQWdCZiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_data_overrides.d.ts","sourceRoot":"","sources":["../../src/aztec-node/public_data_overrides.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAGjF;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,yBAAyB,EAC/B,aAAa,EAAE,qBAAqB,EAAE,GAAG,SAAS,GACjD,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -0,0 +1,21 @@
1
+ import { PublicDataWrite } from '@aztec/stdlib/avm';
2
+ import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
3
+ import { MerkleTreeId } from '@aztec/stdlib/trees';
4
+ /**
5
+ * Injects public-state overrides into an (ephemeral) world-state fork before simulation.
6
+ *
7
+ * Each override is written via the same `sequentialInsert` path the public processor
8
+ * uses during real transaction execution, so low-leaf updates and root coherence are
9
+ * handled identically for both simulation and proof generation.
10
+ *
11
+ * Writes never reach committed world state — the fork is thrown away after simulation.
12
+ */ export async function applyPublicDataOverrides(fork, publicStorage) {
13
+ if (!publicStorage?.length) {
14
+ return;
15
+ }
16
+ const writes = await Promise.all(publicStorage.map(async (o)=>{
17
+ const leafSlot = await computePublicDataTreeLeafSlot(o.contract, o.slot);
18
+ return new PublicDataWrite(leafSlot, o.value);
19
+ }));
20
+ await fork.sequentialInsert(MerkleTreeId.PUBLIC_DATA_TREE, writes.map((w)=>w.toBuffer()));
21
+ }
@@ -0,0 +1,10 @@
1
+ import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
+ import type { AztecNodeService } from './server.js';
3
+ /**
4
+ * Registers the Aztec node RPC handlers (`aztec_*`, `aztecAdmin_*`, and optionally `aztecDebug_*`), along with the
5
+ * legacy pre-v5 namespaces (`node_*`, `nodeAdmin_*`, `nodeDebug_*`, `p2p_*`) for backwards compatibility.
6
+ */
7
+ export declare function registerAztecNodeRpcHandlers(node: AztecNodeService, services: NamespacedApiHandlers, adminServices?: NamespacedApiHandlers, options?: {
8
+ debug?: boolean;
9
+ }): void;
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnaXN0ZXJfbm9kZV9ycGNfaGFuZGxlcnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9henRlYy1ub2RlL3JlZ2lzdGVyX25vZGVfcnBjX2hhbmRsZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFJL0UsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFcEQ7OztHQUdHO0FBRUgsd0JBQWdCLDRCQUE0QixDQUMxQyxJQUFJLEVBQUUsZ0JBQWdCLEVBQ3RCLFFBQVEsRUFBRSxxQkFBcUIsRUFDL0IsYUFBYSxDQUFDLEVBQUUscUJBQXFCLEVBQ3JDLE9BQU8sR0FBRTtJQUFFLEtBQUssQ0FBQyxFQUFFLE9BQU8sQ0FBQTtDQUFPLEdBQ2hDLElBQUksQ0FZTiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register_node_rpc_handlers.d.ts","sourceRoot":"","sources":["../../src/aztec-node/register_node_rpc_handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAI/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;GAGG;AAEH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,CAAC,EAAE,qBAAqB,EACrC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,IAAI,CAYN"}
@@ -0,0 +1,31 @@
1
+ import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
2
+ import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
3
+ /**
4
+ * Registers the Aztec node RPC handlers (`aztec_*`, `aztecAdmin_*`, and optionally `aztecDebug_*`), along with the
5
+ * legacy pre-v5 namespaces (`node_*`, `nodeAdmin_*`, `nodeDebug_*`, `p2p_*`) for backwards compatibility.
6
+ */ // TODO: Legacy support for node, nodeAdmin, nodeDebug, p2p namespaces. New namespaces introduced in v5. Remove on future release. A-1169
7
+ export function registerAztecNodeRpcHandlers(node, services, adminServices, options = {}) {
8
+ services.aztec = [
9
+ node,
10
+ AztecNodeApiSchema
11
+ ];
12
+ services.node = services.aztec;
13
+ services.p2p = [
14
+ node.getP2P(),
15
+ P2PApiSchema
16
+ ];
17
+ if (adminServices) {
18
+ adminServices.aztecAdmin = [
19
+ node,
20
+ AztecNodeAdminApiSchema
21
+ ];
22
+ adminServices.nodeAdmin = adminServices.aztecAdmin;
23
+ }
24
+ if (options.debug) {
25
+ services.aztecDebug = [
26
+ node,
27
+ AztecNodeDebugApiSchema
28
+ ];
29
+ services.nodeDebug = services.aztecDebug;
30
+ }
31
+ }