@aztec/simulator 3.0.0-nightly.20251109 → 3.0.0-nightly.20251111
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAIL,cAAc,EACd,KAAK,uBAAuB,EAE7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAkB,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAK5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,iBAAkB,YAAW,0BAA0B;IAC/F,UAAmB,GAAG,EAAE,MAAM,CAAC;gBAG7B,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAM3C;;;;;OAKG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,K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kB,YAAW,0BAA0B;IACxG,UAAmB,GAAG,EAAE,MAAM,CAAC;gBAG7B,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAM3C;;;;;;;;;OASG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CA+ChE;AAED;;;;;;GAMG;AACH,qBAAa,qCACX,SAAQ,6BACR,YAAW,kCAAkC;IAM3C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB;gBAHpD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACb,OAAO,EAAE,wBAAwB,EACpD,MAAM,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAKrB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC;CAUjG"}
|
|
@@ -66,10 +66,11 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
66
66
|
// Create contract provider for callbacks to TypeScript PublicContractsDB from C++
|
|
67
67
|
const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables);
|
|
68
68
|
// Serialize to msgpack and call the C++ simulator
|
|
69
|
-
this.log.
|
|
69
|
+
this.log.verbose(`Serializing fast simulation inputs to msgpack...`);
|
|
70
70
|
const inputBuffer = fastSimInputs.serializeWithMessagePack();
|
|
71
71
|
let resultBuffer;
|
|
72
72
|
try {
|
|
73
|
+
this.log.verbose(`Calling C++ simulator for tx ${txHash}`);
|
|
73
74
|
resultBuffer = await avmSimulate(inputBuffer, contractProvider, wsCppHandle);
|
|
74
75
|
} catch (error) {
|
|
75
76
|
throw new SimulationError(`C++ simulation failed: ${error.message}`, []);
|
|
@@ -79,9 +80,12 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
79
80
|
assert(tsResult !== undefined, 'TS simulation should have succeeded if C++ succeeded');
|
|
80
81
|
assert(tsStateRef !== undefined, 'TS state reference should have been captured if C++ succeeded');
|
|
81
82
|
// Deserialize the msgpack result
|
|
82
|
-
|
|
83
|
+
this.log.verbose(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
|
|
83
84
|
const cppResultJSON = deserializeFromMessagePack(resultBuffer);
|
|
84
|
-
|
|
85
|
+
this.log.verbose(`Deserializing C++ result to PublicTxResult...`);
|
|
86
|
+
const cppResult = PublicTxResult.schema.parse(cppResultJSON);
|
|
87
|
+
this.log.verbose(`Done.`);
|
|
88
|
+
// TODO(fcarreiro): complete this.
|
|
85
89
|
assert(cppResult.revertCode.equals(tsResult.revertCode));
|
|
86
90
|
assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
|
|
87
91
|
// Confirm that tree roots match
|
|
@@ -158,7 +162,7 @@ export class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator {
|
|
|
158
162
|
}
|
|
159
163
|
// Deserialize the msgpack result
|
|
160
164
|
const cppResultJSON = deserializeFromMessagePack(resultBuffer);
|
|
161
|
-
const cppResult = PublicTxResult.
|
|
165
|
+
const cppResult = PublicTxResult.schema.parse(cppResultJSON);
|
|
162
166
|
assert(cppResult.revertCode.equals(tsResult.revertCode));
|
|
163
167
|
assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
|
|
164
168
|
this.log.debug(`C++ hinted simulation completed for tx ${txHash}`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251111",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -64,26 +64,26 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
68
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
69
|
-
"@aztec/native": "3.0.0-nightly.
|
|
70
|
-
"@aztec/noir-acvm_js": "3.0.0-nightly.
|
|
71
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
73
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
74
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
75
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
76
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
77
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
67
|
+
"@aztec/constants": "3.0.0-nightly.20251111",
|
|
68
|
+
"@aztec/foundation": "3.0.0-nightly.20251111",
|
|
69
|
+
"@aztec/native": "3.0.0-nightly.20251111",
|
|
70
|
+
"@aztec/noir-acvm_js": "3.0.0-nightly.20251111",
|
|
71
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251111",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251111",
|
|
73
|
+
"@aztec/noir-types": "3.0.0-nightly.20251111",
|
|
74
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251111",
|
|
75
|
+
"@aztec/stdlib": "3.0.0-nightly.20251111",
|
|
76
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251111",
|
|
77
|
+
"@aztec/world-state": "3.0.0-nightly.20251111",
|
|
78
78
|
"lodash.clonedeep": "^4.5.0",
|
|
79
79
|
"lodash.merge": "^4.6.2",
|
|
80
80
|
"tslib": "^2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
84
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
85
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
83
|
+
"@aztec/kv-store": "3.0.0-nightly.20251111",
|
|
84
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251111",
|
|
85
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251111",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251111",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -105,11 +105,12 @@ export class CppPublicTxSimulator extends PublicTxSimulator implements PublicTxS
|
|
|
105
105
|
const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables);
|
|
106
106
|
|
|
107
107
|
// Serialize to msgpack and call the C++ simulator
|
|
108
|
-
this.log.
|
|
108
|
+
this.log.verbose(`Serializing fast simulation inputs to msgpack...`);
|
|
109
109
|
const inputBuffer = fastSimInputs.serializeWithMessagePack();
|
|
110
110
|
|
|
111
111
|
let resultBuffer: Buffer;
|
|
112
112
|
try {
|
|
113
|
+
this.log.verbose(`Calling C++ simulator for tx ${txHash}`);
|
|
113
114
|
resultBuffer = await avmSimulate(inputBuffer, contractProvider, wsCppHandle);
|
|
114
115
|
} catch (error: any) {
|
|
115
116
|
throw new SimulationError(`C++ simulation failed: ${error.message}`, []);
|
|
@@ -121,9 +122,12 @@ export class CppPublicTxSimulator extends PublicTxSimulator implements PublicTxS
|
|
|
121
122
|
assert(tsStateRef !== undefined, 'TS state reference should have been captured if C++ succeeded');
|
|
122
123
|
|
|
123
124
|
// Deserialize the msgpack result
|
|
124
|
-
|
|
125
|
+
this.log.verbose(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
|
|
125
126
|
const cppResultJSON: object = deserializeFromMessagePack(resultBuffer);
|
|
126
|
-
|
|
127
|
+
this.log.verbose(`Deserializing C++ result to PublicTxResult...`);
|
|
128
|
+
const cppResult = PublicTxResult.schema.parse(cppResultJSON);
|
|
129
|
+
this.log.verbose(`Done.`);
|
|
130
|
+
// TODO(fcarreiro): complete this.
|
|
127
131
|
assert(cppResult.revertCode.equals(tsResult.revertCode));
|
|
128
132
|
assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
|
|
129
133
|
|
|
@@ -230,7 +234,7 @@ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator implements
|
|
|
230
234
|
|
|
231
235
|
// Deserialize the msgpack result
|
|
232
236
|
const cppResultJSON: object = deserializeFromMessagePack(resultBuffer);
|
|
233
|
-
const cppResult = PublicTxResult.
|
|
237
|
+
const cppResult = PublicTxResult.schema.parse(cppResultJSON);
|
|
234
238
|
|
|
235
239
|
assert(cppResult.revertCode.equals(tsResult.revertCode));
|
|
236
240
|
assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
|