@aztec/simulator 0.0.1-commit.ffe5b04ea → 0.0.1-commit.fff30aa
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/fixtures/public_tx_simulation_tester.d.ts +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +3 -30
- package/dest/public/fixtures/utils.d.ts +1 -1
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +5 -5
- package/dest/public/hinting_db_sources.d.ts +4 -4
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +6 -5
- package/dest/public/public_db_sources.d.ts +3 -3
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +9 -9
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +4 -4
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +4 -4
- package/dest/public/public_processor/public_processor.d.ts +1 -1
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +10 -12
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +2 -1
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +1 -1
- 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 -8
- package/dest/public/public_tx_simulator/public_tx_simulator.js +2 -2
- package/dest/public/test_executor_metrics.d.ts +1 -6
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +0 -22
- package/package.json +16 -16
- package/src/public/fixtures/public_tx_simulation_tester.ts +4 -32
- package/src/public/fixtures/utils.ts +12 -8
- package/src/public/hinting_db_sources.ts +8 -6
- package/src/public/public_db_sources.ts +11 -13
- package/src/public/public_processor/guarded_merkle_tree.ts +5 -5
- package/src/public/public_processor/public_processor.ts +11 -13
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +2 -1
- package/src/public/public_tx_simulator/public_tx_context.ts +2 -8
- package/src/public/public_tx_simulator/public_tx_simulator.ts +2 -2
- package/src/public/test_executor_metrics.ts +0 -24
|
@@ -106,14 +106,8 @@ import { getCallRequestsWithCalldataByPhase } from '../utils.js';
|
|
|
106
106
|
}
|
|
107
107
|
if (phase === TxExecutionPhase.SETUP) {
|
|
108
108
|
this.log.warn(`Setup phase reverted! The transaction will be thrown out.`);
|
|
109
|
-
} else if (phase === TxExecutionPhase.APP_LOGIC) {
|
|
110
|
-
this.revertCode = RevertCode.
|
|
111
|
-
} else if (phase === TxExecutionPhase.TEARDOWN) {
|
|
112
|
-
if (this.revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
113
|
-
this.revertCode = RevertCode.BOTH_REVERTED;
|
|
114
|
-
} else {
|
|
115
|
-
this.revertCode = RevertCode.TEARDOWN_REVERTED;
|
|
116
|
-
}
|
|
109
|
+
} else if (phase === TxExecutionPhase.APP_LOGIC || phase === TxExecutionPhase.TEARDOWN) {
|
|
110
|
+
this.revertCode = RevertCode.REVERTED;
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
/**
|
|
@@ -255,7 +255,7 @@ export class PublicTxSimulator {
|
|
|
255
255
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
256
256
|
// will pick up the new contracts and will generate the necessary hints.
|
|
257
257
|
// So, a consumer of the hints will always see the new contracts.
|
|
258
|
-
|
|
258
|
+
this.contractsDB.addContracts(context.nonRevertibleContractDeploymentData);
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Insert the revertible accumulated data from private into the public state.
|
|
@@ -316,7 +316,7 @@ export class PublicTxSimulator {
|
|
|
316
316
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
317
317
|
// will pick up the new contracts and will generate the necessary hints.
|
|
318
318
|
// So, a consumer of the hints will always see the new contracts.
|
|
319
|
-
|
|
319
|
+
this.contractsDB.addContracts(context.revertibleContractDeploymentData);
|
|
320
320
|
}
|
|
321
321
|
async payFee(context) {
|
|
322
322
|
const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
|
|
@@ -13,10 +13,6 @@ export interface PublicTxMetrics {
|
|
|
13
13
|
totalDurationMs: number;
|
|
14
14
|
manaUsed: number | undefined;
|
|
15
15
|
totalInstructionsExecuted: number;
|
|
16
|
-
bytecodeSizes: {
|
|
17
|
-
contractName: string;
|
|
18
|
-
sizeBytes: number;
|
|
19
|
-
}[];
|
|
20
16
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
21
17
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
22
18
|
enqueuedCalls: PublicEnqueuedCallMetrics[];
|
|
@@ -51,11 +47,10 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
51
47
|
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
52
48
|
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
53
49
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
54
|
-
recordBytecodeSize(txLabel: string, contractName: string, sizeBytes: number): void;
|
|
55
50
|
recordProverMetrics(txLabel: string, metrics: Partial<PublicTxMetrics>): void;
|
|
56
51
|
prettyPrint(filter?: PublicTxMetricsFilter): void;
|
|
57
52
|
toPrettyString(filter?: PublicTxMetricsFilter): string;
|
|
58
53
|
toJSON(indent?: number): string;
|
|
59
54
|
toGithubActionBenchmarkJSON(indent?: number): string;
|
|
60
55
|
}
|
|
61
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
56
|
+
//# sourceMappingURL=data:application/json;base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M,SAAI,UAEhB;IAED,2BAA2B,CAAC,MAAM,SAAI,UA4FrC;CACF"}
|
|
@@ -24,7 +24,6 @@ function createEmptyTxMetrics() {
|
|
|
24
24
|
totalDurationMs: 0,
|
|
25
25
|
manaUsed: 0,
|
|
26
26
|
totalInstructionsExecuted: 0,
|
|
27
|
-
bytecodeSizes: [],
|
|
28
27
|
nonRevertiblePrivateInsertionsUs: undefined,
|
|
29
28
|
revertiblePrivateInsertionsUs: undefined,
|
|
30
29
|
enqueuedCalls: [],
|
|
@@ -100,14 +99,6 @@ export class TestExecutorMetrics {
|
|
|
100
99
|
txMetrics.nonRevertiblePrivateInsertionsUs = durationUs;
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
recordBytecodeSize(txLabel, contractName, sizeBytes) {
|
|
104
|
-
const txMetrics = this.txMetrics.get(txLabel);
|
|
105
|
-
assert(txMetrics, `Cannot record bytecode size for unknown tx label: ${txLabel}`);
|
|
106
|
-
txMetrics.bytecodeSizes.push({
|
|
107
|
-
contractName,
|
|
108
|
-
sizeBytes
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
102
|
recordProverMetrics(txLabel, metrics) {
|
|
112
103
|
if (!this.txMetrics.has(txLabel)) {
|
|
113
104
|
this.txMetrics.set(txLabel, createEmptyTxMetrics());
|
|
@@ -141,12 +132,6 @@ export class TestExecutorMetrics {
|
|
|
141
132
|
if (filter === 3 || filter === 1 || filter === 0) {
|
|
142
133
|
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.totalInstructionsExecuted)}\n`;
|
|
143
134
|
}
|
|
144
|
-
if ((filter === 1 || filter === 0) && txMetrics.bytecodeSizes.length > 0) {
|
|
145
|
-
pretty += `${INDENT0}Bytecode sizes:\n`;
|
|
146
|
-
for (const { contractName, sizeBytes } of txMetrics.bytecodeSizes){
|
|
147
|
-
pretty += `${INDENT1}${contractName}: ${fmtNum(sizeBytes, 'bytes')}\n`;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
135
|
if (filter === 2 || filter === 0) {
|
|
151
136
|
pretty += `${INDENT0}Private insertions:\n`;
|
|
152
137
|
pretty += `${INDENT1}Non-revertible: ${fmtNum(txMetrics.nonRevertiblePrivateInsertionsUs / 1_000, 'ms')}\n`;
|
|
@@ -313,13 +298,6 @@ export class TestExecutorMetrics {
|
|
|
313
298
|
});
|
|
314
299
|
}
|
|
315
300
|
}
|
|
316
|
-
for (const { contractName, sizeBytes } of txMetrics.bytecodeSizes){
|
|
317
|
-
data.push({
|
|
318
|
-
name: `${txLabel}/bytecodeSizeBytes/${contractName}`,
|
|
319
|
-
value: sizeBytes,
|
|
320
|
-
unit: 'bytes'
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
301
|
}
|
|
324
302
|
return JSON.stringify(data, null, indent);
|
|
325
303
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.fff30aa",
|
|
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": "0.0.1-commit.
|
|
68
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
69
|
-
"@aztec/native": "0.0.1-commit.
|
|
70
|
-
"@aztec/noir-acvm_js": "0.0.1-commit.
|
|
71
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
73
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
74
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
75
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
76
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
67
|
+
"@aztec/constants": "0.0.1-commit.fff30aa",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.fff30aa",
|
|
69
|
+
"@aztec/native": "0.0.1-commit.fff30aa",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.fff30aa",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.fff30aa",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.fff30aa",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.fff30aa",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.fff30aa",
|
|
75
|
+
"@aztec/stdlib": "0.0.1-commit.fff30aa",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.1-commit.fff30aa",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.fff30aa",
|
|
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": "0.0.1-commit.
|
|
84
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
85
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
83
|
+
"@aztec/kv-store": "0.0.1-commit.fff30aa",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.1-commit.fff30aa",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.fff30aa",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.fff30aa",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_TEARDOWN_DA_GAS_LIMIT,
|
|
3
|
-
DEFAULT_TEARDOWN_L2_GAS_LIMIT,
|
|
4
|
-
PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
5
|
-
TX_DA_GAS_OVERHEAD,
|
|
6
|
-
} from '@aztec/constants';
|
|
1
|
+
import { PUBLIC_TX_L2_GAS_OVERHEAD, TX_DA_GAS_OVERHEAD } from '@aztec/constants';
|
|
7
2
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
8
3
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
9
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
5
|
import { type ContractArtifact, encodeArguments } from '@aztec/stdlib/abi';
|
|
11
6
|
import { PublicSimulatorConfig, type PublicTxResult } from '@aztec/stdlib/avm';
|
|
12
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import { Gas, GasFees } from '@aztec/stdlib/gas';
|
|
8
|
+
import { FALLBACK_TEARDOWN_DA_GAS_LIMIT, FALLBACK_TEARDOWN_L2_GAS_LIMIT, Gas, GasFees } from '@aztec/stdlib/gas';
|
|
14
9
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
15
10
|
import { PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
16
11
|
import { GlobalVariables, PublicCallRequestWithCalldata, type Tx } from '@aztec/stdlib/tx';
|
|
@@ -138,8 +133,8 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
138
133
|
feePayer,
|
|
139
134
|
/*gasUsedByPrivate*/ teardownCall
|
|
140
135
|
? new Gas(
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
FALLBACK_TEARDOWN_DA_GAS_LIMIT + TX_DA_GAS_OVERHEAD,
|
|
137
|
+
FALLBACK_TEARDOWN_L2_GAS_LIMIT + PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
143
138
|
)
|
|
144
139
|
: new Gas(TX_DA_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD),
|
|
145
140
|
defaultGlobals(),
|
|
@@ -172,8 +167,6 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
172
167
|
}
|
|
173
168
|
const avmResult = await this.simulator.simulate(tx, fullTxLabel);
|
|
174
169
|
|
|
175
|
-
await this.#recordBytecodeSizes(fullTxLabel, [...setupCalls, ...appCalls, ...(teardownCall ? [teardownCall] : [])]);
|
|
176
|
-
|
|
177
170
|
// Something like this is often useful for debugging:
|
|
178
171
|
//if (avmResult.revertReason) {
|
|
179
172
|
// // resolve / enrich revert reason
|
|
@@ -302,27 +295,6 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
302
295
|
|
|
303
296
|
return new PublicCallRequestWithCalldata(request, calldata);
|
|
304
297
|
}
|
|
305
|
-
|
|
306
|
-
// WARNING: Deduplicates by artifact name, so two different artifacts with the same name
|
|
307
|
-
// in a single tx would only record the first one's bytecode size.
|
|
308
|
-
async #recordBytecodeSizes(txLabel: string, calls: TestEnqueuedCall[]) {
|
|
309
|
-
const seenArtifactNames = new Set<string>();
|
|
310
|
-
for (const call of calls) {
|
|
311
|
-
const artifact = await this.contractDataSource.getContractArtifact(call.address);
|
|
312
|
-
if (!artifact || seenArtifactNames.has(artifact.name)) {
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
seenArtifactNames.add(artifact.name);
|
|
316
|
-
const instance = await this.contractDataSource.getContract(call.address);
|
|
317
|
-
if (!instance) {
|
|
318
|
-
continue;
|
|
319
|
-
}
|
|
320
|
-
const contractClass = await this.contractDataSource.getContractClass(instance.currentContractClassId);
|
|
321
|
-
if (contractClass) {
|
|
322
|
-
this.metrics.recordBytecodeSize(txLabel, artifact.name, contractClass.packedBytecode.length);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
298
|
}
|
|
327
299
|
|
|
328
300
|
export function defaultGlobals() {
|
|
@@ -2,10 +2,8 @@ import {
|
|
|
2
2
|
CONTRACT_CLASS_PUBLISHED_MAGIC_VALUE,
|
|
3
3
|
CONTRACT_CLASS_REGISTRY_CONTRACT_ADDRESS,
|
|
4
4
|
CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DEFAULT_TEARDOWN_DA_GAS_LIMIT,
|
|
8
|
-
DEFAULT_TEARDOWN_L2_GAS_LIMIT,
|
|
5
|
+
MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT,
|
|
6
|
+
MAX_PROCESSABLE_L2_GAS,
|
|
9
7
|
PRIVATE_LOG_SIZE_IN_FIELDS,
|
|
10
8
|
} from '@aztec/constants';
|
|
11
9
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
@@ -14,7 +12,13 @@ import { CONTRACT_INSTANCE_PUBLISHED_EVENT_TAG } from '@aztec/protocol-contracts
|
|
|
14
12
|
import { bufferAsFields } from '@aztec/stdlib/abi';
|
|
15
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
16
14
|
import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
17
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
FALLBACK_TEARDOWN_DA_GAS_LIMIT,
|
|
17
|
+
FALLBACK_TEARDOWN_L2_GAS_LIMIT,
|
|
18
|
+
Gas,
|
|
19
|
+
GasFees,
|
|
20
|
+
GasSettings,
|
|
21
|
+
} from '@aztec/stdlib/gas';
|
|
18
22
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
19
23
|
import {
|
|
20
24
|
LogHash,
|
|
@@ -69,7 +73,7 @@ export async function createTxForPublicCalls(
|
|
|
69
73
|
"Can't create public tx with no enqueued calls",
|
|
70
74
|
);
|
|
71
75
|
// use max limits
|
|
72
|
-
gasLimits = gasLimits ?? new Gas(
|
|
76
|
+
gasLimits = gasLimits ?? new Gas(MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT, MAX_PROCESSABLE_L2_GAS);
|
|
73
77
|
|
|
74
78
|
const forPublic = PartialPrivateTailPublicInputsForPublic.empty();
|
|
75
79
|
|
|
@@ -129,7 +133,7 @@ export async function createTxForPublicCalls(
|
|
|
129
133
|
|
|
130
134
|
const maxFeesPerGas = feePayer.isZero() ? GasFees.empty() : new GasFees(10, 10);
|
|
131
135
|
const teardownGasLimits = teardownCallRequest
|
|
132
|
-
? new Gas(
|
|
136
|
+
? new Gas(FALLBACK_TEARDOWN_DA_GAS_LIMIT, FALLBACK_TEARDOWN_L2_GAS_LIMIT)
|
|
133
137
|
: Gas.empty();
|
|
134
138
|
const gasSettings = new GasSettings(gasLimits, teardownGasLimits, maxFeesPerGas, GasFees.empty());
|
|
135
139
|
const txContext = new TxContext(Fr.zero(), Fr.zero(), gasSettings);
|
|
@@ -164,7 +168,7 @@ export async function createTxForPrivateOnly(
|
|
|
164
168
|
gasUsedByPrivate: Gas = new Gas(10, 10),
|
|
165
169
|
): Promise<Tx> {
|
|
166
170
|
// use max limits
|
|
167
|
-
const gasLimits = new Gas(
|
|
171
|
+
const gasLimits = new Gas(MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT, MAX_PROCESSABLE_L2_GAS);
|
|
168
172
|
|
|
169
173
|
const forRollup = PartialPrivateTailPublicInputsForRollup.empty();
|
|
170
174
|
|
|
@@ -410,12 +410,12 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
public async createCheckpoint(): Promise<
|
|
413
|
+
public async createCheckpoint(): Promise<number> {
|
|
414
414
|
const actionCounter = this.checkpointActionCounter++;
|
|
415
415
|
const oldCheckpointId = this.getCurrentCheckpointId();
|
|
416
416
|
const treesStateHash = await this.getTreesStateHash();
|
|
417
417
|
|
|
418
|
-
await this.db.createCheckpoint();
|
|
418
|
+
const depth = await this.db.createCheckpoint();
|
|
419
419
|
this.checkpointStack.push(this.nextCheckpointId++);
|
|
420
420
|
const newCheckpointId = this.getCurrentCheckpointId();
|
|
421
421
|
|
|
@@ -424,14 +424,16 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
424
424
|
HintingMerkleWriteOperations.log.trace(
|
|
425
425
|
`[createCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`,
|
|
426
426
|
);
|
|
427
|
+
|
|
428
|
+
return depth;
|
|
427
429
|
}
|
|
428
430
|
|
|
429
|
-
public
|
|
430
|
-
throw new Error('
|
|
431
|
+
public commitAllCheckpointsTo(_depth: number): Promise<void> {
|
|
432
|
+
throw new Error('commitAllCheckpointsTo is not supported in HintingMerkleWriteOperations.');
|
|
431
433
|
}
|
|
432
434
|
|
|
433
|
-
public
|
|
434
|
-
throw new Error('
|
|
435
|
+
public revertAllCheckpointsTo(_depth: number): Promise<void> {
|
|
436
|
+
throw new Error('revertAllCheckpointsTo is not supported in HintingMerkleWriteOperations.');
|
|
435
437
|
}
|
|
436
438
|
|
|
437
439
|
public async commitCheckpoint(): Promise<void> {
|
|
@@ -55,10 +55,10 @@ export class PublicContractsDB implements PublicContractsDBInterface {
|
|
|
55
55
|
this.log = createLogger('simulator:contracts-data-source', bindings);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
public
|
|
58
|
+
public addContracts(contractDeploymentData: ContractDeploymentData): void {
|
|
59
59
|
const currentState = this.getCurrentState();
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
this.addContractClassesFromEvents(
|
|
62
62
|
ContractClassPublishedEvent.extractContractClassEvents(contractDeploymentData.getContractClassLogs()),
|
|
63
63
|
currentState,
|
|
64
64
|
);
|
|
@@ -69,10 +69,10 @@ export class PublicContractsDB implements PublicContractsDBInterface {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
public
|
|
72
|
+
public addNewContracts(tx: Tx): void {
|
|
73
73
|
const contractDeploymentData = AllContractDeploymentData.fromTx(tx);
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
this.addContracts(contractDeploymentData.getNonRevertibleContractDeploymentData());
|
|
75
|
+
this.addContracts(contractDeploymentData.getRevertibleContractDeploymentData());
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
@@ -174,17 +174,15 @@ export class PublicContractsDB implements PublicContractsDBInterface {
|
|
|
174
174
|
return await this.dataSource.getDebugFunctionName(address, selector);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
private
|
|
177
|
+
private addContractClassesFromEvents(
|
|
178
178
|
contractClassEvents: ContractClassPublishedEvent[],
|
|
179
179
|
state: ContractsDbCheckpoint,
|
|
180
180
|
) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}),
|
|
187
|
-
);
|
|
181
|
+
for (const event of contractClassEvents) {
|
|
182
|
+
this.log.debug(`Adding class ${event.contractClassId.toString()} to contract state`);
|
|
183
|
+
const contractClass = event.toContractClassPublic();
|
|
184
|
+
state.addClass(event.contractClassId, contractClass);
|
|
185
|
+
}
|
|
188
186
|
}
|
|
189
187
|
|
|
190
188
|
private addContractInstancesFromEvents(
|
|
@@ -134,7 +134,7 @@ export class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
|
|
|
134
134
|
): Promise<(BlockNumber | undefined)[]> {
|
|
135
135
|
return this.guardAndPush(() => this.target.getBlockNumbersForLeafIndices(treeId, leafIndices));
|
|
136
136
|
}
|
|
137
|
-
createCheckpoint(): Promise<
|
|
137
|
+
createCheckpoint(): Promise<number> {
|
|
138
138
|
return this.guardAndPush(() => this.target.createCheckpoint());
|
|
139
139
|
}
|
|
140
140
|
commitCheckpoint(): Promise<void> {
|
|
@@ -143,11 +143,11 @@ export class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
|
|
|
143
143
|
revertCheckpoint(): Promise<void> {
|
|
144
144
|
return this.guardAndPush(() => this.target.revertCheckpoint());
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
return this.guardAndPush(() => this.target.
|
|
146
|
+
commitAllCheckpointsTo(depth: number): Promise<void> {
|
|
147
|
+
return this.guardAndPush(() => this.target.commitAllCheckpointsTo(depth));
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
return this.guardAndPush(() => this.target.
|
|
149
|
+
revertAllCheckpointsTo(depth: number): Promise<void> {
|
|
150
|
+
return this.guardAndPush(() => this.target.revertAllCheckpointsTo(depth));
|
|
151
151
|
}
|
|
152
152
|
findSiblingPaths<ID extends MerkleTreeId>(
|
|
153
153
|
treeId: ID,
|
|
@@ -306,6 +306,9 @@ export class PublicProcessor implements Traceable {
|
|
|
306
306
|
totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
|
|
307
307
|
totalSizeInBytes += txSize;
|
|
308
308
|
totalBlobFields += txBlobFields;
|
|
309
|
+
|
|
310
|
+
// Commit the tx-level contracts checkpoint on success
|
|
311
|
+
this.contractsDB.commitCheckpoint();
|
|
309
312
|
} catch (err: any) {
|
|
310
313
|
if (err?.name === 'PublicProcessorTimeoutError') {
|
|
311
314
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
@@ -325,14 +328,10 @@ export class PublicProcessor implements Traceable {
|
|
|
325
328
|
// 1. At least one outstanding checkpoint that has not been committed (the one created before we processed the tx).
|
|
326
329
|
// 2. Possible state updates on that checkpoint or any others created during execution.
|
|
327
330
|
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
await checkpoint.
|
|
332
|
-
|
|
333
|
-
// Now we want to revert any/all remaining checkpoints, destroying any outstanding state updates.
|
|
334
|
-
// This needs to be done directly on the underlying fork as the guarded fork has been stopped.
|
|
335
|
-
await this.guardedMerkleTree.getUnderlyingFork().revertAllCheckpoints();
|
|
331
|
+
// Revert all checkpoints at or above this checkpoint's depth (inclusive), destroying any outstanding state
|
|
332
|
+
// updates from this tx and any nested checkpoints created during execution. This preserves any checkpoints
|
|
333
|
+
// created by callers below our depth.
|
|
334
|
+
await checkpoint.revertToCheckpoint();
|
|
336
335
|
|
|
337
336
|
// Revert any contracts added to the DB for the tx.
|
|
338
337
|
this.contractsDB.revertCheckpoint();
|
|
@@ -344,9 +343,9 @@ export class PublicProcessor implements Traceable {
|
|
|
344
343
|
break;
|
|
345
344
|
}
|
|
346
345
|
|
|
347
|
-
// Roll back state to start of TX before proceeding to next TX
|
|
348
|
-
|
|
349
|
-
await
|
|
346
|
+
// Roll back state to start of TX before proceeding to next TX.
|
|
347
|
+
// Reverts all checkpoints at or above this checkpoint's depth, preserving any caller checkpoints below.
|
|
348
|
+
await checkpoint.revertToCheckpoint();
|
|
350
349
|
this.contractsDB.revertCheckpoint();
|
|
351
350
|
const errorMessage = err instanceof Error || err instanceof AssertionError ? err.message : 'Unknown error';
|
|
352
351
|
this.log.warn(`Failed to process tx ${txHash.toString()}: ${errorMessage} ${err?.stack}`);
|
|
@@ -358,7 +357,6 @@ export class PublicProcessor implements Traceable {
|
|
|
358
357
|
} finally {
|
|
359
358
|
// Base case is we always commit the checkpoint. Using the ForkCheckpoint means this has no effect if the tx was previously reverted
|
|
360
359
|
await checkpoint.commit();
|
|
361
|
-
this.contractsDB.commitCheckpointOkIfNone();
|
|
362
360
|
}
|
|
363
361
|
}
|
|
364
362
|
|
|
@@ -550,7 +548,7 @@ export class PublicProcessor implements Traceable {
|
|
|
550
548
|
// Fee payment insertion has already been done. Do the rest.
|
|
551
549
|
await this.doTreeInsertionsForPrivateOnlyTx(processedTx);
|
|
552
550
|
|
|
553
|
-
|
|
551
|
+
this.contractsDB.addNewContracts(tx);
|
|
554
552
|
|
|
555
553
|
return [processedTx, undefined, []];
|
|
556
554
|
}
|
|
@@ -52,6 +52,7 @@ export class ContractProviderForCpp implements ContractProvider {
|
|
|
52
52
|
return serializeWithMessagePack(contractClass);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
// eslint-disable-next-line require-await
|
|
55
56
|
public addContracts = async (contractDeploymentDataBuffer: Buffer): Promise<void> => {
|
|
56
57
|
this.log.trace(`Contract provider callback: addContracts`);
|
|
57
58
|
|
|
@@ -62,7 +63,7 @@ export class ContractProviderForCpp implements ContractProvider {
|
|
|
62
63
|
|
|
63
64
|
// Add contracts to the contracts DB
|
|
64
65
|
this.log.trace(`Calling contractsDB.addContracts`);
|
|
65
|
-
|
|
66
|
+
this.contractsDB.addContracts(contractDeploymentData);
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
public getBytecodeCommitment = async (classId: string): Promise<Buffer | undefined> => {
|
|
@@ -174,14 +174,8 @@ export class PublicTxContext {
|
|
|
174
174
|
}
|
|
175
175
|
if (phase === TxExecutionPhase.SETUP) {
|
|
176
176
|
this.log.warn(`Setup phase reverted! The transaction will be thrown out.`);
|
|
177
|
-
} else if (phase === TxExecutionPhase.APP_LOGIC) {
|
|
178
|
-
this.revertCode = RevertCode.
|
|
179
|
-
} else if (phase === TxExecutionPhase.TEARDOWN) {
|
|
180
|
-
if (this.revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
181
|
-
this.revertCode = RevertCode.BOTH_REVERTED;
|
|
182
|
-
} else {
|
|
183
|
-
this.revertCode = RevertCode.TEARDOWN_REVERTED;
|
|
184
|
-
}
|
|
177
|
+
} else if (phase === TxExecutionPhase.APP_LOGIC || phase === TxExecutionPhase.TEARDOWN) {
|
|
178
|
+
this.revertCode = RevertCode.REVERTED;
|
|
185
179
|
}
|
|
186
180
|
}
|
|
187
181
|
|
|
@@ -401,7 +401,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
|
401
401
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
402
402
|
// will pick up the new contracts and will generate the necessary hints.
|
|
403
403
|
// So, a consumer of the hints will always see the new contracts.
|
|
404
|
-
|
|
404
|
+
this.contractsDB.addContracts(context.nonRevertibleContractDeploymentData);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
/**
|
|
@@ -486,7 +486,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
|
486
486
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
487
487
|
// will pick up the new contracts and will generate the necessary hints.
|
|
488
488
|
// So, a consumer of the hints will always see the new contracts.
|
|
489
|
-
|
|
489
|
+
this.contractsDB.addContracts(context.revertibleContractDeploymentData);
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
private async payFee(context: PublicTxContext) {
|
|
@@ -21,7 +21,6 @@ export interface PublicTxMetrics {
|
|
|
21
21
|
totalDurationMs: number;
|
|
22
22
|
manaUsed: number | undefined;
|
|
23
23
|
totalInstructionsExecuted: number;
|
|
24
|
-
bytecodeSizes: { contractName: string; sizeBytes: number }[];
|
|
25
24
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
26
25
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
27
26
|
enqueuedCalls: PublicEnqueuedCallMetrics[];
|
|
@@ -63,7 +62,6 @@ function createEmptyTxMetrics(): PublicTxMetrics {
|
|
|
63
62
|
totalDurationMs: 0,
|
|
64
63
|
manaUsed: 0,
|
|
65
64
|
totalInstructionsExecuted: 0,
|
|
66
|
-
bytecodeSizes: [],
|
|
67
65
|
nonRevertiblePrivateInsertionsUs: undefined,
|
|
68
66
|
revertiblePrivateInsertionsUs: undefined,
|
|
69
67
|
enqueuedCalls: [],
|
|
@@ -174,12 +172,6 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
recordBytecodeSize(txLabel: string, contractName: string, sizeBytes: number) {
|
|
178
|
-
const txMetrics = this.txMetrics.get(txLabel);
|
|
179
|
-
assert(txMetrics, `Cannot record bytecode size for unknown tx label: ${txLabel}`);
|
|
180
|
-
txMetrics.bytecodeSizes.push({ contractName, sizeBytes });
|
|
181
|
-
}
|
|
182
|
-
|
|
183
175
|
recordProverMetrics(txLabel: string, metrics: Partial<PublicTxMetrics>) {
|
|
184
176
|
if (!this.txMetrics.has(txLabel)) {
|
|
185
177
|
this.txMetrics.set(txLabel, createEmptyTxMetrics());
|
|
@@ -224,15 +216,6 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
224
216
|
) {
|
|
225
217
|
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.totalInstructionsExecuted)}\n`;
|
|
226
218
|
}
|
|
227
|
-
if (
|
|
228
|
-
(filter === PublicTxMetricsFilter.TOTALS || filter === PublicTxMetricsFilter.ALL) &&
|
|
229
|
-
txMetrics.bytecodeSizes.length > 0
|
|
230
|
-
) {
|
|
231
|
-
pretty += `${INDENT0}Bytecode sizes:\n`;
|
|
232
|
-
for (const { contractName, sizeBytes } of txMetrics.bytecodeSizes) {
|
|
233
|
-
pretty += `${INDENT1}${contractName}: ${fmtNum(sizeBytes, 'bytes')}\n`;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
219
|
if (filter === PublicTxMetricsFilter.DURATIONS || filter === PublicTxMetricsFilter.ALL) {
|
|
237
220
|
pretty += `${INDENT0}Private insertions:\n`;
|
|
238
221
|
pretty += `${INDENT1}Non-revertible: ${fmtNum(txMetrics.nonRevertiblePrivateInsertionsUs! / 1_000, 'ms')}\n`;
|
|
@@ -404,13 +387,6 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
404
387
|
});
|
|
405
388
|
}
|
|
406
389
|
}
|
|
407
|
-
for (const { contractName, sizeBytes } of txMetrics.bytecodeSizes) {
|
|
408
|
-
data.push({
|
|
409
|
-
name: `${txLabel}/bytecodeSizeBytes/${contractName}`,
|
|
410
|
-
value: sizeBytes,
|
|
411
|
-
unit: 'bytes',
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
390
|
}
|
|
415
391
|
return JSON.stringify(data, null, indent);
|
|
416
392
|
}
|