@aztec/simulator 0.83.0 → 0.83.1-nightly.20250404
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.
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +2 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +1 -5
- package/package.json +14 -14
- package/src/public/public_tx_simulator/public_tx_context.ts +8 -2
- package/src/public/public_tx_simulator/public_tx_simulator.ts +1 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_tx_context.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_context.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,
|
|
1
|
+
{"version":3,"file":"public_tx_context.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_context.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EACL,KAAK,sBAAsB,EAC3B,iBAAiB,EAGjB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,GAAG,EAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAGL,KAAK,8BAA8B,EAIpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,eAAe,EACpB,6BAA6B,EAG7B,KAAK,EAAE,EACP,gBAAgB,EAChB,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,aAA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AEG;IACH,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,GAAG,6BAA6B,EAAE;IAWjF;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG;IAS/C;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG;IAQ5C;;;OAGG;IACH,eAAe,IAAI,GAAG;IAItB;;;;;OAKG;IACH,gBAAgB,IAAI,GAAG;IAOvB;;;OAGG;IACH,sBAAsB,IAAI,GAAG;IAK7B;;;OAGG;IACH,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,EAAE;IAQ9C;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;OAEG;IACU,8BAA8B,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAqG/E;AAED;;;;;;;;;GASG;AACH,cAAM,iBAAiB;IAKT,OAAO,CAAC,QAAQ,CAAC,cAAc;IAJ3C,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO,CAAC,2BAA2B,CAA4C;gBAElD,cAAc,EAAE,6BAA6B;IAIpE,IAAI;IAMV,qBAAqB;IAIrB,QAAQ;IAIF,gBAAgB;IAQhB,kBAAkB;CAOzB"}
|
|
@@ -3,7 +3,7 @@ import { padArrayEnd } from '@aztec/foundation/collection';
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
6
|
-
import { AvmExecutionHints, PublicDataWrite, RevertCode } from '@aztec/stdlib/avm';
|
|
6
|
+
import { AvmExecutionHints, AvmTxHint, PublicDataWrite, RevertCode } from '@aztec/stdlib/avm';
|
|
7
7
|
import { computeTransactionFee } from '@aztec/stdlib/fees';
|
|
8
8
|
import { Gas } from '@aztec/stdlib/gas';
|
|
9
9
|
import { PrivateToAvmAccumulatedData, PrivateToAvmAccumulatedDataArrayLengths, PublicCallRequest, countAccumulatedItems, mergeAccumulatedData } from '@aztec/stdlib/kernel';
|
|
@@ -67,7 +67,7 @@ import { getCallRequestsWithCalldataByPhase } from '../utils.js';
|
|
|
67
67
|
const trace = new SideEffectTrace(/*startSideEffectCounter=*/ 0, previousAccumulatedDataArrayLengths);
|
|
68
68
|
const firstNullifier = nonRevertibleAccumulatedDataFromPrivate.nullifiers[0];
|
|
69
69
|
// We wrap the DB to collect AVM hints.
|
|
70
|
-
const hints = new AvmExecutionHints();
|
|
70
|
+
const hints = new AvmExecutionHints(AvmTxHint.fromTx(tx));
|
|
71
71
|
const hintingContractsDB = new HintingPublicContractsDB(contractsDB, hints);
|
|
72
72
|
const hintingTreesDB = new HintingPublicTreesDB(treesDB, hints);
|
|
73
73
|
// Transaction level state manager that will be forked for revertible phases.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,EAAE,E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IAIhC;;;;OAIG;YACW,qBAAqB;IAkBnC;;;;OAIG;YACW,qBAAqB;IAoBnC;;;;;OAKG;cACa,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAqCzG;;;;;;OAMG;cACa,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC,sBAAsB,CAAC;IA+BlC;;;;;;;;;;;;OAYG;cACa,4BAA4B,CAC1C,YAAY,EAAE,6BAA6B,EAC3C,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,6BAA6B,EACpD,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,EAAE,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC;IAsBlC;;OAEG;cACa,+BAA+B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE;IAuBhF;;;OAGG;cACa,4BAA4B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE,GAAgB,OAAO,CAAC,OAAO,CAAC;YAoC/F,MAAM;IAgCpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAStC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
3
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
4
|
-
import { AvmCircuitInputs
|
|
4
|
+
import { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
5
5
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
6
6
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
7
7
|
import { NestedProcessReturnValues, TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
@@ -183,11 +183,7 @@ export class PublicTxSimulator {
|
|
|
183
183
|
const contractAddress = callRequest.request.contractAddress;
|
|
184
184
|
const fnName = await getPublicFunctionDebugName(this.contractsDB, contractAddress, callRequest.calldata);
|
|
185
185
|
const allocatedGas = context.getGasLeftAtPhase(phase);
|
|
186
|
-
// The reason we need enqueued hints at all (and cannot just use the public inputs) is
|
|
187
|
-
// because they don't have the actual calldata, just the hash of it.
|
|
188
|
-
// If/when we pass the whole TX to C++, we can remove this class of hints.
|
|
189
186
|
stateManager.traceEnqueuedCall(callRequest.request);
|
|
190
|
-
context.hints.enqueuedCalls.push(new AvmEnqueuedCallHint(callRequest.request.msgSender, contractAddress, callRequest.calldata, callRequest.request.isStaticCall));
|
|
191
187
|
const result = await this.simulateEnqueuedCallInternal(context.state.getActiveStateManager(), callRequest, allocatedGas, /*transactionFee=*/ context.getTransactionFee(phase), fnName);
|
|
192
188
|
const gasUsed = allocatedGas.sub(result.gasLeft); // by enqueued call
|
|
193
189
|
context.consumeGas(phase, gasUsed);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.1-nightly.20250404",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -60,16 +60,16 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@aztec/constants": "0.83.
|
|
64
|
-
"@aztec/foundation": "0.83.
|
|
65
|
-
"@aztec/noir-acvm_js": "0.83.
|
|
66
|
-
"@aztec/noir-noirc_abi": "0.83.
|
|
67
|
-
"@aztec/noir-protocol-circuits-types": "0.83.
|
|
68
|
-
"@aztec/noir-types": "0.83.
|
|
69
|
-
"@aztec/protocol-contracts": "0.83.
|
|
70
|
-
"@aztec/stdlib": "0.83.
|
|
71
|
-
"@aztec/telemetry-client": "0.83.
|
|
72
|
-
"@aztec/world-state": "0.83.
|
|
63
|
+
"@aztec/constants": "0.83.1-nightly.20250404",
|
|
64
|
+
"@aztec/foundation": "0.83.1-nightly.20250404",
|
|
65
|
+
"@aztec/noir-acvm_js": "0.83.1-nightly.20250404",
|
|
66
|
+
"@aztec/noir-noirc_abi": "0.83.1-nightly.20250404",
|
|
67
|
+
"@aztec/noir-protocol-circuits-types": "0.83.1-nightly.20250404",
|
|
68
|
+
"@aztec/noir-types": "0.83.1-nightly.20250404",
|
|
69
|
+
"@aztec/protocol-contracts": "0.83.1-nightly.20250404",
|
|
70
|
+
"@aztec/stdlib": "0.83.1-nightly.20250404",
|
|
71
|
+
"@aztec/telemetry-client": "0.83.1-nightly.20250404",
|
|
72
|
+
"@aztec/world-state": "0.83.1-nightly.20250404",
|
|
73
73
|
"levelup": "^5.1.1",
|
|
74
74
|
"lodash.clonedeep": "^4.5.0",
|
|
75
75
|
"lodash.merge": "^4.6.2",
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
"tslib": "^2.4.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@aztec/kv-store": "0.83.
|
|
81
|
-
"@aztec/merkle-tree": "0.83.
|
|
82
|
-
"@aztec/noir-contracts.js": "0.83.
|
|
80
|
+
"@aztec/kv-store": "0.83.1-nightly.20250404",
|
|
81
|
+
"@aztec/merkle-tree": "0.83.1-nightly.20250404",
|
|
82
|
+
"@aztec/noir-contracts.js": "0.83.1-nightly.20250404",
|
|
83
83
|
"@jest/globals": "^29.5.0",
|
|
84
84
|
"@types/jest": "^29.5.0",
|
|
85
85
|
"@types/levelup": "^5.1.3",
|
|
@@ -10,7 +10,13 @@ import { padArrayEnd } from '@aztec/foundation/collection';
|
|
|
10
10
|
import { Fr } from '@aztec/foundation/fields';
|
|
11
11
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
12
12
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type AvmCircuitPublicInputs,
|
|
15
|
+
AvmExecutionHints,
|
|
16
|
+
AvmTxHint,
|
|
17
|
+
PublicDataWrite,
|
|
18
|
+
RevertCode,
|
|
19
|
+
} from '@aztec/stdlib/avm';
|
|
14
20
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
21
|
import type { SimulationError } from '@aztec/stdlib/errors';
|
|
16
22
|
import { computeTransactionFee } from '@aztec/stdlib/fees';
|
|
@@ -105,7 +111,7 @@ export class PublicTxContext {
|
|
|
105
111
|
const firstNullifier = nonRevertibleAccumulatedDataFromPrivate.nullifiers[0];
|
|
106
112
|
|
|
107
113
|
// We wrap the DB to collect AVM hints.
|
|
108
|
-
const hints = new AvmExecutionHints();
|
|
114
|
+
const hints = new AvmExecutionHints(AvmTxHint.fromTx(tx));
|
|
109
115
|
const hintingContractsDB = new HintingPublicContractsDB(contractsDB, hints);
|
|
110
116
|
const hintingTreesDB = new HintingPublicTreesDB(treesDB, hints);
|
|
111
117
|
|
|
@@ -5,7 +5,6 @@ import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee
|
|
|
5
5
|
import {
|
|
6
6
|
AvmCircuitInputs,
|
|
7
7
|
AvmCircuitPublicInputs,
|
|
8
|
-
AvmEnqueuedCallHint,
|
|
9
8
|
AvmExecutionHints,
|
|
10
9
|
type AvmProvingRequest,
|
|
11
10
|
type RevertCode,
|
|
@@ -72,6 +71,7 @@ export class PublicTxSimulator {
|
|
|
72
71
|
const txHash = await this.computeTxHash(tx);
|
|
73
72
|
|
|
74
73
|
this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, { txHash });
|
|
74
|
+
|
|
75
75
|
const context = await PublicTxContext.create(
|
|
76
76
|
this.treesDB,
|
|
77
77
|
this.contractsDB,
|
|
@@ -265,18 +265,7 @@ export class PublicTxSimulator {
|
|
|
265
265
|
|
|
266
266
|
const allocatedGas = context.getGasLeftAtPhase(phase);
|
|
267
267
|
|
|
268
|
-
// The reason we need enqueued hints at all (and cannot just use the public inputs) is
|
|
269
|
-
// because they don't have the actual calldata, just the hash of it.
|
|
270
|
-
// If/when we pass the whole TX to C++, we can remove this class of hints.
|
|
271
268
|
stateManager.traceEnqueuedCall(callRequest.request);
|
|
272
|
-
context.hints.enqueuedCalls.push(
|
|
273
|
-
new AvmEnqueuedCallHint(
|
|
274
|
-
callRequest.request.msgSender,
|
|
275
|
-
contractAddress,
|
|
276
|
-
callRequest.calldata,
|
|
277
|
-
callRequest.request.isStaticCall,
|
|
278
|
-
),
|
|
279
|
-
);
|
|
280
269
|
|
|
281
270
|
const result = await this.simulateEnqueuedCallInternal(
|
|
282
271
|
context.state.getActiveStateManager(),
|