@aztec/simulator 0.0.1-commit.643667a5cb → 0.0.1-commit.684755437
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/private/circuit_recording/circuit_recorder.js +2 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +6 -5
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +8 -8
- package/dest/public/fixtures/utils.d.ts +2 -2
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +2 -2
- package/dest/public/public_processor/public_processor.d.ts +5 -4
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +32 -26
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +2 -3
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +2 -2
- package/dest/public/public_tx_simulator/factories.d.ts +2 -2
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/factories.js +2 -2
- package/package.json +16 -16
- package/src/private/circuit_recording/circuit_recorder.ts +2 -2
- package/src/public/fixtures/public_tx_simulation_tester.ts +17 -2
- package/src/public/fixtures/utils.ts +2 -1
- package/src/public/public_processor/public_processor.ts +39 -30
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +2 -3
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +2 -2
- package/src/public/public_tx_simulator/factories.ts +2 -1
|
@@ -120,10 +120,10 @@ export class CircuitRecording {
|
|
|
120
120
|
if (!fn || typeof fn !== 'function') {
|
|
121
121
|
throw new Error(`Oracle method ${name} not found when setting up recording callback`);
|
|
122
122
|
}
|
|
123
|
-
const isExternalCall = name === '
|
|
123
|
+
const isExternalCall = name === 'aztec_prv_callPrivateFunction';
|
|
124
124
|
recordingCallback[name] = (...args)=>{
|
|
125
125
|
const timer = new Timer();
|
|
126
|
-
// If we're entering another circuit via `
|
|
126
|
+
// If we're entering another circuit via `aztec_prv_callPrivateFunction`, we increase the stack depth and set the
|
|
127
127
|
// newCircuit variable to ensure we are creating a new recording object.
|
|
128
128
|
if (isExternalCall) {
|
|
129
129
|
this.stackDepth++;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
2
|
import { PublicSimulatorConfig, type PublicTxResult } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
4
5
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
6
|
import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
6
7
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
@@ -36,15 +37,15 @@ export declare class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
36
37
|
constructor(merkleTree: MerkleTreeWriteOperations, contractDataSource: SimpleContractDataSource, globals?: GlobalVariables, metrics?: TestExecutorMetrics, simulatorFactory?: MeasuredSimulatorFactory, config?: PublicSimulatorConfig);
|
|
37
38
|
static create(worldStateService: NativeWorldStateService, globals?: GlobalVariables, metrics?: TestExecutorMetrics, useCppSimulator?: boolean, config?: PublicSimulatorConfig): Promise<PublicTxSimulationTester>;
|
|
38
39
|
setMetricsPrefix(prefix: string): void;
|
|
39
|
-
createTx(sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions): Promise<Tx>;
|
|
40
|
-
simulateTx(sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, txLabel?: string): Promise<PublicTxResult>;
|
|
40
|
+
createTx(sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, gasLimits?: Gas): Promise<Tx>;
|
|
41
|
+
simulateTx(sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, txLabel?: string, gasLimits?: Gas): Promise<PublicTxResult>;
|
|
41
42
|
/**
|
|
42
43
|
* Just simulate the transaction and return the result.
|
|
43
44
|
*
|
|
44
45
|
* This wrapper around simulation allows for easy labeling of a TX
|
|
45
46
|
* which is especially useful when reporting benchmarks or metrics.
|
|
46
47
|
*/
|
|
47
|
-
simulateTxWithLabel(txLabel: string, sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions): Promise<PublicTxResult>;
|
|
48
|
+
simulateTxWithLabel(txLabel: string, sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, gasLimits?: Gas): Promise<PublicTxResult>;
|
|
48
49
|
/**
|
|
49
50
|
* Execute a transaction and return the result.
|
|
50
51
|
*
|
|
@@ -52,7 +53,7 @@ export declare class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
52
53
|
* to do more work (like prove and verify) while still reusing existing
|
|
53
54
|
* test fixtures (like amm_test). That is why it is not named "simulate*".
|
|
54
55
|
*/
|
|
55
|
-
executeTxWithLabel(txLabel: string, sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions): Promise<PublicTxResult>;
|
|
56
|
+
executeTxWithLabel(txLabel: string, sender: AztecAddress, setupCalls?: TestEnqueuedCall[], appCalls?: TestEnqueuedCall[], teardownCall?: TestEnqueuedCall, feePayer?: AztecAddress, privateInsertions?: TestPrivateInsertions, gasLimits?: Gas): Promise<PublicTxResult>;
|
|
56
57
|
prettyPrintMetrics(): void;
|
|
57
58
|
/**
|
|
58
59
|
* Cancel the current simulation if one is in progress.
|
|
@@ -69,4 +70,4 @@ export declare class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
69
70
|
getSimulator(): MeasuredPublicTxSimulatorInterface;
|
|
70
71
|
}
|
|
71
72
|
export declare function defaultGlobals(): GlobalVariables;
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3R4X3NpbXVsYXRpb25fdGVzdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL2ZpeHR1cmVzL3B1YmxpY190eF9zaW11bGF0aW9uX3Rlc3Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBbUIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzRSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsS0FBSyxjQUFjLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsR0FBRyx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EdBQ2QsT0FBTyxDQUFDLGNBQWMsQ0FBQyxDQVd6QjtJQUVNLGtCQUFrQixTQUV4QjtJQUVEOzs7Ozs7T0FNRztJQUNVLE1BQU0sQ0FBQyxhQUFhLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUV6RDtJQUVEOzs7T0FHRztJQUNJLFlBQVksSUFBSSxrQ0FBa0MsQ0FFeEQ7Q0F3REY7QUFFRCx3QkFBZ0IsY0FBYyxvQkFNN0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,GAAG,EAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAiC,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;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C,EAAE,qBAAqB,EACzC,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CAWzB;IAEM,kBAAkB,SAExB;IAED;;;;;;OAMG;IACU,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzD;IAED;;;OAGG;IACI,YAAY,IAAI,kCAAkC,CAExD;CAwDF;AAED,wBAAgB,cAAc,oBAM7B"}
|
|
@@ -57,15 +57,15 @@ const defaultConfig = PublicSimulatorConfig.from({
|
|
|
57
57
|
new Fr(420000 + this.txCount)
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
|
-
}) {
|
|
60
|
+
}, gasLimits) {
|
|
61
61
|
const setupCallRequests = await asyncMap(setupCalls, (call)=>this.#createPubicCallRequestForCall(call, call.sender ?? sender));
|
|
62
62
|
const appCallRequests = await asyncMap(appCalls, (call)=>this.#createPubicCallRequestForCall(call, call.sender ?? sender));
|
|
63
63
|
const teardownCallRequest = teardownCall ? await this.#createPubicCallRequestForCall(teardownCall, teardownCall.sender ?? sender) : undefined;
|
|
64
64
|
this.txCount++;
|
|
65
|
-
return createTxForPublicCalls(privateInsertions, setupCallRequests, appCallRequests, teardownCallRequest, feePayer, /*gasUsedByPrivate*/ teardownCall ? new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT + TX_DA_GAS_OVERHEAD, DEFAULT_TEARDOWN_L2_GAS_LIMIT + PUBLIC_TX_L2_GAS_OVERHEAD) : new Gas(TX_DA_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD), defaultGlobals());
|
|
65
|
+
return createTxForPublicCalls(privateInsertions, setupCallRequests, appCallRequests, teardownCallRequest, feePayer, /*gasUsedByPrivate*/ teardownCall ? new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT + TX_DA_GAS_OVERHEAD, DEFAULT_TEARDOWN_L2_GAS_LIMIT + PUBLIC_TX_L2_GAS_OVERHEAD) : new Gas(TX_DA_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD), defaultGlobals(), gasLimits);
|
|
66
66
|
}
|
|
67
|
-
async simulateTx(sender, setupCalls = [], appCalls = [], teardownCall, feePayer = sender, /* need some unique first nullifier for note-nonce computations */ privateInsertions, txLabel = 'unlabeledTx') {
|
|
68
|
-
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions);
|
|
67
|
+
async simulateTx(sender, setupCalls = [], appCalls = [], teardownCall, feePayer = sender, /* need some unique first nullifier for note-nonce computations */ privateInsertions, txLabel = 'unlabeledTx', gasLimits) {
|
|
68
|
+
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits);
|
|
69
69
|
await this.setFeePayerBalance(feePayer);
|
|
70
70
|
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
71
71
|
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}/${txLabelWithCount}` : txLabelWithCount;
|
|
@@ -97,8 +97,8 @@ const defaultConfig = PublicSimulatorConfig.from({
|
|
|
97
97
|
*
|
|
98
98
|
* This wrapper around simulation allows for easy labeling of a TX
|
|
99
99
|
* which is especially useful when reporting benchmarks or metrics.
|
|
100
|
-
*/ async simulateTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions) {
|
|
101
|
-
return await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, txLabel);
|
|
100
|
+
*/ async simulateTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits) {
|
|
101
|
+
return await this.simulateTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, txLabel, gasLimits);
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Execute a transaction and return the result.
|
|
@@ -106,8 +106,8 @@ const defaultConfig = PublicSimulatorConfig.from({
|
|
|
106
106
|
* This function can be (it is) overridden by a subclass (AvmProvingTester)
|
|
107
107
|
* to do more work (like prove and verify) while still reusing existing
|
|
108
108
|
* test fixtures (like amm_test). That is why it is not named "simulate*".
|
|
109
|
-
*/ async executeTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions) {
|
|
110
|
-
return await this.simulateTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions);
|
|
109
|
+
*/ async executeTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits) {
|
|
110
|
+
return await this.simulateTxWithLabel(txLabel, sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits);
|
|
111
111
|
}
|
|
112
112
|
prettyPrintMetrics() {
|
|
113
113
|
this.metrics.prettyPrint();
|
|
@@ -19,8 +19,8 @@ export type TestPrivateInsertions = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Craft a carrier transaction for some public calls for simulation by PublicTxSimulator.
|
|
21
21
|
*/
|
|
22
|
-
export declare function createTxForPublicCalls(privateInsertions: TestPrivateInsertions, setupCallRequests: PublicCallRequestWithCalldata[], appCallRequests: PublicCallRequestWithCalldata[], teardownCallRequest?: PublicCallRequestWithCalldata, feePayer?: AztecAddress, gasUsedByPrivate?: Gas, globals?: GlobalVariables): Promise<Tx>;
|
|
22
|
+
export declare function createTxForPublicCalls(privateInsertions: TestPrivateInsertions, setupCallRequests: PublicCallRequestWithCalldata[], appCallRequests: PublicCallRequestWithCalldata[], teardownCallRequest?: PublicCallRequestWithCalldata, feePayer?: AztecAddress, gasUsedByPrivate?: Gas, globals?: GlobalVariables, gasLimits?: Gas): Promise<Tx>;
|
|
23
23
|
export declare function createTxForPrivateOnly(feePayer?: AztecAddress, gasUsedByPrivate?: Gas): Promise<Tx>;
|
|
24
24
|
export declare function addNewContractClassToTx(tx: Tx, contractClass: ContractClassPublic, skipNullifierInsertion?: boolean): Promise<void>;
|
|
25
25
|
export declare function addNewContractInstanceToTx(tx: Tx, contractInstance: ContractInstanceWithAddress, skipNullifierInsert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AClC,UAAU,CAAC,EAAE;QACX,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;KACpC,CAAC;IACF,aAAa,CAAC,EAAE;QACd,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,iBAAiB,EAAE,qBAAqB,EACxC,iBAAiB,EAAE,6BAA6B,EAAE,EAClD,eAAe,EAAE,6BAA6B,EAAE,EAChD,mBAAmB,CAAC,EAAE,6BAA6B,EACnD,QAAQ,eAAsB,EAC9B,gBAAgB,GAAE,GAAiB,EACnC,OAAO,GAAE,eAAyC,EAClD,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,EAAE,CAAC,CA8Fb;AAED,wBAAsB,sBAAsB,CAC1C,QAAQ,eAAsB,EAC9B,gBAAgB,GAAE,GAAqB,GACtC,OAAO,CAAC,EAAE,CAAC,CA0Bb;AAED,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,EAAE,EACN,aAAa,EAAE,mBAAmB,EAClC,sBAAsB,UAAQ,iBA6B/B;AAED,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,EAAE,EACN,gBAAgB,EAAE,2BAA2B,EAC7C,sBAAsB,UAAQ,iBA0C/B"}
|
|
@@ -13,10 +13,10 @@ import { BlockHeader, GlobalVariables, HashedValues, Tx, TxConstantData, TxConte
|
|
|
13
13
|
import { strict as assert } from 'assert';
|
|
14
14
|
/**
|
|
15
15
|
* Craft a carrier transaction for some public calls for simulation by PublicTxSimulator.
|
|
16
|
-
*/ export async function createTxForPublicCalls(privateInsertions, setupCallRequests, appCallRequests, teardownCallRequest, feePayer = AztecAddress.zero(), gasUsedByPrivate = Gas.empty(), globals = GlobalVariables.empty()) {
|
|
16
|
+
*/ export async function createTxForPublicCalls(privateInsertions, setupCallRequests, appCallRequests, teardownCallRequest, feePayer = AztecAddress.zero(), gasUsedByPrivate = Gas.empty(), globals = GlobalVariables.empty(), gasLimits) {
|
|
17
17
|
assert(setupCallRequests.length > 0 || appCallRequests.length > 0 || teardownCallRequest !== undefined, "Can't create public tx with no enqueued calls");
|
|
18
18
|
// use max limits
|
|
19
|
-
|
|
19
|
+
gasLimits = gasLimits ?? new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
20
20
|
const forPublic = PartialPrivateTailPublicInputsForPublic.empty();
|
|
21
21
|
// Non revertible private insertions
|
|
22
22
|
if (!privateInsertions.nonRevertible?.nullifiers?.length) {
|
|
@@ -3,7 +3,7 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
3
3
|
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
4
4
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
5
5
|
import type { MerkleTreeWriteOperations, PublicProcessorLimits, PublicProcessorValidator, SequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import type
|
|
6
|
+
import { type DebugLog, type DebugLogStore } from '@aztec/stdlib/logs';
|
|
7
7
|
import { type FailedTx, GlobalVariables, NestedProcessReturnValues, type ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
8
8
|
import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
9
9
|
import { PublicContractsDB } from '../public_db_sources.js';
|
|
@@ -39,8 +39,9 @@ export declare class PublicProcessor implements Traceable {
|
|
|
39
39
|
private dateProvider;
|
|
40
40
|
private log;
|
|
41
41
|
private opts;
|
|
42
|
+
private debugLogStore;
|
|
42
43
|
private metrics;
|
|
43
|
-
constructor(globalVariables: GlobalVariables, guardedMerkleTree: GuardedMerkleTreeOperations, contractsDB: PublicContractsDB, publicTxSimulator: PublicTxSimulatorInterface, dateProvider: DateProvider, telemetryClient: TelemetryClient | undefined, log: Logger, opts?: Pick<SequencerConfig, 'fakeProcessingDelayPerTxMs' | 'fakeThrowAfterProcessingTxCount'
|
|
44
|
+
constructor(globalVariables: GlobalVariables, guardedMerkleTree: GuardedMerkleTreeOperations, contractsDB: PublicContractsDB, publicTxSimulator: PublicTxSimulatorInterface, dateProvider: DateProvider, telemetryClient: TelemetryClient | undefined, log: Logger, opts?: Pick<SequencerConfig, 'fakeProcessingDelayPerTxMs' | 'fakeThrowAfterProcessingTxCount'>, debugLogStore?: DebugLogStore);
|
|
44
45
|
get tracer(): Tracer;
|
|
45
46
|
/**
|
|
46
47
|
* Run each tx through the public circuit and the public kernel circuit if needed.
|
|
@@ -49,7 +50,7 @@ export declare class PublicProcessor implements Traceable {
|
|
|
49
50
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
50
51
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
51
52
|
*/
|
|
52
|
-
process(txs: Iterable<Tx> | AsyncIterable<Tx>, limits?: PublicProcessorLimits, validator?: PublicProcessorValidator): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[],
|
|
53
|
+
process(txs: Iterable<Tx> | AsyncIterable<Tx>, limits?: PublicProcessorLimits, validator?: PublicProcessorValidator): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[], DebugLog[]]>;
|
|
53
54
|
private checkWorldStateUnchanged;
|
|
54
55
|
private processTx;
|
|
55
56
|
private doTreeInsertionsForPrivateOnlyTx;
|
|
@@ -62,4 +63,4 @@ export declare class PublicProcessor implements Traceable {
|
|
|
62
63
|
*/
|
|
63
64
|
private static generateProvingRequest;
|
|
64
65
|
}
|
|
65
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3Byb2Nlc3Nvci5kLnRzIiwic291cmNlUm9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,uBAAuB,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAkC,MAAM,yBAAyB,CAAC;AAIvF,OAAO,EAML,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"public_processor.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAkC,MAAM,yBAAyB,CAAC;AAIvF,OAAO,EAML,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAG1F,OAAO,EACL,KAAK,QAAQ,EACb,eAAe,EACf,yBAAyB,EACzB,KAAK,WAAW,EAEhB,EAAE,EAGH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAEhC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAGvE;;GAEG;AACH,qBAAa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AClB,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EACrC,MAAM,GAAE,qBAA0B,EAClC,SAAS,GAAE,wBAA6B,GACvC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAuNrF;YAEa,wBAAwB;YAiBxB,SAAS;YAgCT,gCAAgC;YA4BhC,uBAAuB;YA+CvB,gCAAgC;YA0BhC,oBAAoB;YA+BpB,wBAAwB;IAyCtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAStC"}
|
|
@@ -383,6 +383,7 @@ import { computeFeePayerBalanceLeafSlot, computeFeePayerBalanceStorageSlot } fro
|
|
|
383
383
|
import { AvmCircuitInputs, AvmExecutionHints, PublicDataWrite } from '@aztec/stdlib/avm';
|
|
384
384
|
import { computeTransactionFee } from '@aztec/stdlib/fees';
|
|
385
385
|
import { Gas } from '@aztec/stdlib/gas';
|
|
386
|
+
import { NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
386
387
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
387
388
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
388
389
|
import { NestedProcessReturnValues, makeProcessedTxFromPrivateOnlyTx, makeProcessedTxFromTxWithPublicCalls } from '@aztec/stdlib/tx';
|
|
@@ -446,6 +447,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
446
447
|
dateProvider;
|
|
447
448
|
log;
|
|
448
449
|
opts;
|
|
450
|
+
debugLogStore;
|
|
449
451
|
static{
|
|
450
452
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
451
453
|
[
|
|
@@ -466,7 +468,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
466
468
|
], []));
|
|
467
469
|
}
|
|
468
470
|
metrics;
|
|
469
|
-
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log, opts = {}){
|
|
471
|
+
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log, opts = {}, debugLogStore = new NullDebugLogStore()){
|
|
470
472
|
this.globalVariables = globalVariables;
|
|
471
473
|
this.guardedMerkleTree = guardedMerkleTree;
|
|
472
474
|
this.contractsDB = contractsDB;
|
|
@@ -474,6 +476,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
474
476
|
this.dateProvider = dateProvider;
|
|
475
477
|
this.log = log;
|
|
476
478
|
this.opts = opts;
|
|
479
|
+
this.debugLogStore = debugLogStore;
|
|
477
480
|
_initProto(this);
|
|
478
481
|
this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
|
|
479
482
|
}
|
|
@@ -487,7 +490,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
487
490
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
488
491
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
489
492
|
*/ async process(txs, limits = {}, validator = {}) {
|
|
490
|
-
const { maxTransactions,
|
|
493
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
491
494
|
const { preprocessValidator, nullifierCache } = validator;
|
|
492
495
|
const result = [];
|
|
493
496
|
const usedTxs = [];
|
|
@@ -510,21 +513,23 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
510
513
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
511
514
|
break;
|
|
512
515
|
}
|
|
513
|
-
// Skip this tx if it'd exceed max block size
|
|
514
516
|
const txHash = tx.getTxHash().toString();
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
// Skip this tx if its estimated blob fields would exceed the limit.
|
|
518
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
519
|
+
const txBlobFields = tx.getPrivateTxEffectsSizeInFields();
|
|
520
|
+
if (isBuildingProposal && maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
521
|
+
this.log.warn(`Skipping tx ${txHash} with ${txBlobFields} fields from private side effects due to blob fields limit`, {
|
|
518
522
|
txHash,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
523
|
+
txBlobFields,
|
|
524
|
+
totalBlobFields,
|
|
525
|
+
maxBlobFields
|
|
522
526
|
});
|
|
523
527
|
continue;
|
|
524
528
|
}
|
|
525
|
-
// Skip this tx if its gas limit would exceed the block gas limit
|
|
529
|
+
// Skip this tx if its gas limit would exceed the block gas limit (either da or l2).
|
|
530
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
526
531
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
527
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
532
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
528
533
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
529
534
|
txHash,
|
|
530
535
|
txGasLimit,
|
|
@@ -571,21 +576,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
571
576
|
throw new Error(`Fake error after processing ${fakeThrowAfter} txs`);
|
|
572
577
|
}
|
|
573
578
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
574
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
575
579
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
576
|
-
|
|
577
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
578
|
-
txHash,
|
|
579
|
-
sizeInBytes: txSize,
|
|
580
|
-
totalSizeInBytes,
|
|
581
|
-
maxBlockSize
|
|
582
|
-
});
|
|
583
|
-
// Need to revert the checkpoint here and don't go any further
|
|
584
|
-
await checkpoint.revert();
|
|
585
|
-
this.contractsDB.revertCheckpoint();
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
// If the actual blob fields of this tx would exceed the limit, skip it
|
|
580
|
+
// If the actual blob fields of this tx would exceed the limit, skip it.
|
|
589
581
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
590
582
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
591
583
|
this.log.debug(`Skipping processed tx ${txHash} with ${txBlobFields} blob fields due to max blob fields limit.`, {
|
|
@@ -599,6 +591,20 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
599
591
|
this.contractsDB.revertCheckpoint();
|
|
600
592
|
continue;
|
|
601
593
|
}
|
|
594
|
+
// During re-execution, check if the actual gas used by this tx would push the block over the gas limit.
|
|
595
|
+
// Unlike the proposal-building check (which uses declared gas limits pessimistically before processing),
|
|
596
|
+
// this uses actual gas and stops processing when the limit is exceeded.
|
|
597
|
+
if (!isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(processedTx.gasUsed.totalGas).gtAny(maxBlockGas)) {
|
|
598
|
+
this.log.warn(`Stopping re-execution since tx ${txHash} would push block gas over limit`, {
|
|
599
|
+
txHash,
|
|
600
|
+
txGas: processedTx.gasUsed.totalGas,
|
|
601
|
+
totalBlockGas,
|
|
602
|
+
maxBlockGas
|
|
603
|
+
});
|
|
604
|
+
await checkpoint.revert();
|
|
605
|
+
this.contractsDB.revertCheckpoint();
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
602
608
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
603
609
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
604
610
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map((n)=>n.toBuffer()));
|
|
@@ -606,6 +612,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
606
612
|
usedTxs.push(tx);
|
|
607
613
|
returns = returns.concat(returnValues);
|
|
608
614
|
debugLogs.push(...txDebugLogs);
|
|
615
|
+
this.debugLogStore.storeLogs(processedTx.hash.toString(), txDebugLogs);
|
|
609
616
|
totalPublicGas = totalPublicGas.add(processedTx.gasUsed.publicGas);
|
|
610
617
|
totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
|
|
611
618
|
totalSizeInBytes += txSize;
|
|
@@ -673,7 +680,6 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
673
680
|
failed,
|
|
674
681
|
usedTxs,
|
|
675
682
|
returns,
|
|
676
|
-
totalBlobFields,
|
|
677
683
|
debugLogs
|
|
678
684
|
];
|
|
679
685
|
}
|
|
@@ -50,4 +50,4 @@ export declare class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSi
|
|
|
50
50
|
readonly tracer: Tracer;
|
|
51
51
|
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9jcHBfcHVibGljX3R4X3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQUUsS0FBSyxjQUFjLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFJdkYsT0FBTyxFQUdMLEtBQUsscUJBQXFCLEVBQzFCL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public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,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,KAAK,MAAM,EAAE,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAIvF,OAAO,EAGL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAsB,MAAM,yBAAyB,CAAC;AAKhG,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;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,iBAAkB,YAAW,0BAA0B;IAC/F,UAAmB,GAAG,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,OAAO,CAAC,iBAAiB,CAAC,CAAoB;IAC9C,kFAAkF;IAClF,OAAO,CAAC,iBAAiB,CAAC,CAAkB;IAE5C,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAI1B;IAED;;;;;OAKG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA8E9D;IAED;;;;;;;;;OASG;IACU,MAAM,CAAC,aAAa,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9D;CACF;AAED,qBAAa,4BAA6B,SAAQ,oBAAqB,YAAW,kCAAkC;IAKhH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB;IAJtD,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACb,OAAO,EAAE,wBAAwB,EACpD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEqB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,4BAA4B;IAE7E,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,GAAE,eAAsC,EACvD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAK1B;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { sleep } from '@aztec/foundation/sleep';
|
|
3
3
|
import { avmSimulate, cancelSimulation, createCancellationToken } from '@aztec/native';
|
|
4
4
|
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
@@ -51,8 +51,7 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
51
51
|
this.cancellationToken = createCancellationToken();
|
|
52
52
|
// Store the promise so cancel() can wait for it
|
|
53
53
|
this.log.debug(`Calling C++ simulator for tx ${txHash}`);
|
|
54
|
-
this.simulationPromise = avmSimulate(inputBuffer, contractProvider, wsCppHandle,
|
|
55
|
-
undefined, this.cancellationToken);
|
|
54
|
+
this.simulationPromise = avmSimulate(inputBuffer, contractProvider, wsCppHandle, this.log.level, undefined, this.cancellationToken);
|
|
56
55
|
let resultBuffer;
|
|
57
56
|
try {
|
|
58
57
|
resultBuffer = await this.simulationPromise;
|
|
@@ -39,4 +39,4 @@ export declare class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSi
|
|
|
39
39
|
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
40
40
|
simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBRSxLQUFLLGNBQWMsRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUV2RixPQUFPLEVBRUwsS0FBSyxxQkFBcUIsRUFDMUIsY0FBYyxFQUVmLE1BQU0sbUJBQW1CLENBQUM7QUFFM0IsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxlQUFl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DQUFDLEVBQUUsT0FBTyxDQUFDLHFCQUFxQixDQUFDLEVBQ3ZDLFFBQVEsQ0FBQyxFQUFFLGNBQWMsRUFHMUI7SUFFcUIsUUFBUSxDQUFDLEVBQUUsRUFBRSxFQUFFLEVBQUUsT0FBTyxHQUFFLE1BQXNCLEdBQUcsT0FBTyxDQUFDLGNBQWMsQ0FBQyxDQVMvRjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpp_public_tx_simulator_with_hinted_dbs.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator_with_hinted_dbs.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAEL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAI5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,0BAA0B;IACxG,UAAmB,GAAG,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAI1B;IAED;;;;;;;;;OASG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA8C9D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCACX,SAAQ,6BACR,YAAW,kCAAkC;IAM3C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB;IAJtD,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACb,OAAO,EAAE,wBAAwB,EACpD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEqB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { avmSimulateWithHintedDbs } from '@aztec/native';
|
|
3
3
|
import { AvmCircuitInputs, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
|
|
4
4
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
@@ -43,7 +43,7 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
43
43
|
const inputBuffer = avmCircuitInputs.serializeWithMessagePack();
|
|
44
44
|
let resultBuffer;
|
|
45
45
|
try {
|
|
46
|
-
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer,
|
|
46
|
+
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer, this.log.level);
|
|
47
47
|
} catch (error) {
|
|
48
48
|
throw new SimulationError(`C++ hinted simulation failed: ${error.message}`, []);
|
|
49
49
|
}
|
|
@@ -10,5 +10,5 @@ import { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.j
|
|
|
10
10
|
* Uses DumpingCppPublicTxSimulator if DUMP_AVM_INPUTS_TO_DIR env var is set (for CI/testing avm circuit),
|
|
11
11
|
* otherwise uses TelemetryCppPublicTxSimulator (for production).
|
|
12
12
|
*/
|
|
13
|
-
export declare function createPublicTxSimulatorForBlockBuilding(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient: TelemetryClient, bindings?: LoggerBindings): DumpingCppPublicTxSimulator | TelemetryCppPublicTxSimulator;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function createPublicTxSimulatorForBlockBuilding(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient: TelemetryClient, bindings?: LoggerBindings, collectDebugLogs?: boolean): DumpingCppPublicTxSimulator | TelemetryCppPublicTxSimulator;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yaWVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvZmFjdG9yaWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTVELE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUM3RSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUVuRjs7OztHQUlHO0FBQ0gsd0JBQWdCLHVDQUF1QyxDQUNyRCxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsZUFBZSxFQUFFLGVBQWUsRUFDaEMsUUFBUSxDQUFDLEVBQUUsY0FBYyxFQUN6QixnQkFBZ0IsVUFBUSwrREFzQnpCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,QAAQ,CAAC,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,QAAQ,CAAC,EAAE,cAAc,EACzB,gBAAgB,UAAQ,+DAsBzB"}
|
|
@@ -5,10 +5,10 @@ import { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.j
|
|
|
5
5
|
* Creates a public tx simulator for block building.
|
|
6
6
|
* Uses DumpingCppPublicTxSimulator if DUMP_AVM_INPUTS_TO_DIR env var is set (for CI/testing avm circuit),
|
|
7
7
|
* otherwise uses TelemetryCppPublicTxSimulator (for production).
|
|
8
|
-
*/ export function createPublicTxSimulatorForBlockBuilding(merkleTree, contractsDB, globalVariables, telemetryClient, bindings) {
|
|
8
|
+
*/ export function createPublicTxSimulatorForBlockBuilding(merkleTree, contractsDB, globalVariables, telemetryClient, bindings, collectDebugLogs = false) {
|
|
9
9
|
const config = PublicSimulatorConfig.from({
|
|
10
10
|
skipFeeEnforcement: false,
|
|
11
|
-
collectDebugLogs
|
|
11
|
+
collectDebugLogs,
|
|
12
12
|
collectHints: false,
|
|
13
13
|
collectPublicInputs: false,
|
|
14
14
|
collectStatistics: false,
|
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.684755437",
|
|
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.684755437",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.684755437",
|
|
69
|
+
"@aztec/native": "0.0.1-commit.684755437",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.684755437",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.684755437",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.684755437",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.684755437",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.684755437",
|
|
75
|
+
"@aztec/stdlib": "0.0.1-commit.684755437",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.1-commit.684755437",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.684755437",
|
|
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.684755437",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.1-commit.684755437",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.684755437",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.684755437",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -161,11 +161,11 @@ export class CircuitRecorder {
|
|
|
161
161
|
throw new Error(`Oracle method ${name} not found when setting up recording callback`);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const isExternalCall = (name as keyof ACIRCallback) === '
|
|
164
|
+
const isExternalCall = (name as keyof ACIRCallback) === 'aztec_prv_callPrivateFunction';
|
|
165
165
|
|
|
166
166
|
recordingCallback[name as keyof ACIRCallback] = (...args: ForeignCallInput[]): ReturnType<typeof fn> => {
|
|
167
167
|
const timer = new Timer();
|
|
168
|
-
// If we're entering another circuit via `
|
|
168
|
+
// If we're entering another circuit via `aztec_prv_callPrivateFunction`, we increase the stack depth and set the
|
|
169
169
|
// newCircuit variable to ensure we are creating a new recording object.
|
|
170
170
|
if (isExternalCall) {
|
|
171
171
|
this.stackDepth++;
|
|
@@ -117,6 +117,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
117
117
|
feePayer: AztecAddress = sender,
|
|
118
118
|
/* need some unique first nullifier for note-nonce computations */
|
|
119
119
|
privateInsertions: TestPrivateInsertions = { nonRevertible: { nullifiers: [new Fr(420000 + this.txCount)] } },
|
|
120
|
+
gasLimits?: Gas,
|
|
120
121
|
): Promise<Tx> {
|
|
121
122
|
const setupCallRequests = await asyncMap(setupCalls, call =>
|
|
122
123
|
this.#createPubicCallRequestForCall(call, call.sender ?? sender),
|
|
@@ -142,6 +143,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
142
143
|
)
|
|
143
144
|
: new Gas(TX_DA_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD),
|
|
144
145
|
defaultGlobals(),
|
|
146
|
+
gasLimits,
|
|
145
147
|
);
|
|
146
148
|
}
|
|
147
149
|
|
|
@@ -154,8 +156,9 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
154
156
|
/* need some unique first nullifier for note-nonce computations */
|
|
155
157
|
privateInsertions?: TestPrivateInsertions,
|
|
156
158
|
txLabel: string = 'unlabeledTx',
|
|
159
|
+
gasLimits?: Gas,
|
|
157
160
|
): Promise<PublicTxResult> {
|
|
158
|
-
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions);
|
|
161
|
+
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits);
|
|
159
162
|
|
|
160
163
|
await this.setFeePayerBalance(feePayer);
|
|
161
164
|
|
|
@@ -200,8 +203,18 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
200
203
|
teardownCall?: TestEnqueuedCall,
|
|
201
204
|
feePayer?: AztecAddress,
|
|
202
205
|
privateInsertions?: TestPrivateInsertions,
|
|
206
|
+
gasLimits?: Gas,
|
|
203
207
|
): Promise<PublicTxResult> {
|
|
204
|
-
return await this.simulateTx(
|
|
208
|
+
return await this.simulateTx(
|
|
209
|
+
sender,
|
|
210
|
+
setupCalls,
|
|
211
|
+
appCalls,
|
|
212
|
+
teardownCall,
|
|
213
|
+
feePayer,
|
|
214
|
+
privateInsertions,
|
|
215
|
+
txLabel,
|
|
216
|
+
gasLimits,
|
|
217
|
+
);
|
|
205
218
|
}
|
|
206
219
|
|
|
207
220
|
/**
|
|
@@ -219,6 +232,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
219
232
|
teardownCall?: TestEnqueuedCall,
|
|
220
233
|
feePayer?: AztecAddress,
|
|
221
234
|
privateInsertions?: TestPrivateInsertions,
|
|
235
|
+
gasLimits?: Gas,
|
|
222
236
|
): Promise<PublicTxResult> {
|
|
223
237
|
return await this.simulateTxWithLabel(
|
|
224
238
|
txLabel,
|
|
@@ -228,6 +242,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
228
242
|
teardownCall,
|
|
229
243
|
feePayer,
|
|
230
244
|
privateInsertions,
|
|
245
|
+
gasLimits,
|
|
231
246
|
);
|
|
232
247
|
}
|
|
233
248
|
|
|
@@ -62,13 +62,14 @@ export async function createTxForPublicCalls(
|
|
|
62
62
|
feePayer = AztecAddress.zero(),
|
|
63
63
|
gasUsedByPrivate: Gas = Gas.empty(),
|
|
64
64
|
globals: GlobalVariables = GlobalVariables.empty(),
|
|
65
|
+
gasLimits?: Gas,
|
|
65
66
|
): Promise<Tx> {
|
|
66
67
|
assert(
|
|
67
68
|
setupCallRequests.length > 0 || appCallRequests.length > 0 || teardownCallRequest !== undefined,
|
|
68
69
|
"Can't create public tx with no enqueued calls",
|
|
69
70
|
);
|
|
70
71
|
// use max limits
|
|
71
|
-
|
|
72
|
+
gasLimits = gasLimits ?? new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
72
73
|
|
|
73
74
|
const forPublic = PartialPrivateTailPublicInputsForPublic.empty();
|
|
74
75
|
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
PublicProcessorValidator,
|
|
26
26
|
SequencerConfig,
|
|
27
27
|
} from '@aztec/stdlib/interfaces/server';
|
|
28
|
-
import type
|
|
28
|
+
import { type DebugLog, type DebugLogStore, NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
29
29
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
30
30
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
31
31
|
import {
|
|
@@ -140,6 +140,7 @@ export class PublicProcessor implements Traceable {
|
|
|
140
140
|
telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
141
141
|
private log: Logger,
|
|
142
142
|
private opts: Pick<SequencerConfig, 'fakeProcessingDelayPerTxMs' | 'fakeThrowAfterProcessingTxCount'> = {},
|
|
143
|
+
private debugLogStore: DebugLogStore = new NullDebugLogStore(),
|
|
143
144
|
) {
|
|
144
145
|
this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
|
|
145
146
|
}
|
|
@@ -159,8 +160,8 @@ export class PublicProcessor implements Traceable {
|
|
|
159
160
|
txs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
160
161
|
limits: PublicProcessorLimits = {},
|
|
161
162
|
validator: PublicProcessorValidator = {},
|
|
162
|
-
): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[],
|
|
163
|
-
const { maxTransactions,
|
|
163
|
+
): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[], DebugLog[]]> {
|
|
164
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
164
165
|
const { preprocessValidator, nullifierCache } = validator;
|
|
165
166
|
const result: ProcessedTx[] = [];
|
|
166
167
|
const usedTxs: Tx[] = [];
|
|
@@ -187,22 +188,23 @@ export class PublicProcessor implements Traceable {
|
|
|
187
188
|
break;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
// Skip this tx if it'd exceed max block size
|
|
191
191
|
const txHash = tx.getTxHash().toString();
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
192
|
+
|
|
193
|
+
// Skip this tx if its estimated blob fields would exceed the limit.
|
|
194
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
195
|
+
const txBlobFields = tx.getPrivateTxEffectsSizeInFields();
|
|
196
|
+
if (isBuildingProposal && maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
197
|
+
this.log.warn(
|
|
198
|
+
`Skipping tx ${txHash} with ${txBlobFields} fields from private side effects due to blob fields limit`,
|
|
199
|
+
{ txHash, txBlobFields, totalBlobFields, maxBlobFields },
|
|
200
|
+
);
|
|
200
201
|
continue;
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
// Skip this tx if its gas limit would exceed the block gas limit
|
|
204
|
+
// Skip this tx if its gas limit would exceed the block gas limit (either da or l2).
|
|
205
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
204
206
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
205
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
207
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
206
208
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
207
209
|
txHash,
|
|
208
210
|
txGasLimit,
|
|
@@ -251,23 +253,9 @@ export class PublicProcessor implements Traceable {
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
254
|
-
|
|
255
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
256
256
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
257
|
-
if (maxBlockSize !== undefined && totalSizeInBytes + txSize > maxBlockSize) {
|
|
258
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
259
|
-
txHash,
|
|
260
|
-
sizeInBytes: txSize,
|
|
261
|
-
totalSizeInBytes,
|
|
262
|
-
maxBlockSize,
|
|
263
|
-
});
|
|
264
|
-
// Need to revert the checkpoint here and don't go any further
|
|
265
|
-
await checkpoint.revert();
|
|
266
|
-
this.contractsDB.revertCheckpoint();
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
257
|
|
|
270
|
-
// If the actual blob fields of this tx would exceed the limit, skip it
|
|
258
|
+
// If the actual blob fields of this tx would exceed the limit, skip it.
|
|
271
259
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
272
260
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
273
261
|
this.log.debug(
|
|
@@ -285,6 +273,25 @@ export class PublicProcessor implements Traceable {
|
|
|
285
273
|
continue;
|
|
286
274
|
}
|
|
287
275
|
|
|
276
|
+
// During re-execution, check if the actual gas used by this tx would push the block over the gas limit.
|
|
277
|
+
// Unlike the proposal-building check (which uses declared gas limits pessimistically before processing),
|
|
278
|
+
// this uses actual gas and stops processing when the limit is exceeded.
|
|
279
|
+
if (
|
|
280
|
+
!isBuildingProposal &&
|
|
281
|
+
maxBlockGas !== undefined &&
|
|
282
|
+
totalBlockGas.add(processedTx.gasUsed.totalGas).gtAny(maxBlockGas)
|
|
283
|
+
) {
|
|
284
|
+
this.log.warn(`Stopping re-execution since tx ${txHash} would push block gas over limit`, {
|
|
285
|
+
txHash,
|
|
286
|
+
txGas: processedTx.gasUsed.totalGas,
|
|
287
|
+
totalBlockGas,
|
|
288
|
+
maxBlockGas,
|
|
289
|
+
});
|
|
290
|
+
await checkpoint.revert();
|
|
291
|
+
this.contractsDB.revertCheckpoint();
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
288
295
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
289
296
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
290
297
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map(n => n.toBuffer()));
|
|
@@ -293,6 +300,8 @@ export class PublicProcessor implements Traceable {
|
|
|
293
300
|
returns = returns.concat(returnValues);
|
|
294
301
|
debugLogs.push(...txDebugLogs);
|
|
295
302
|
|
|
303
|
+
this.debugLogStore.storeLogs(processedTx.hash.toString(), txDebugLogs);
|
|
304
|
+
|
|
296
305
|
totalPublicGas = totalPublicGas.add(processedTx.gasUsed.publicGas);
|
|
297
306
|
totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
|
|
298
307
|
totalSizeInBytes += txSize;
|
|
@@ -365,7 +374,7 @@ export class PublicProcessor implements Traceable {
|
|
|
365
374
|
totalSizeInBytes,
|
|
366
375
|
});
|
|
367
376
|
|
|
368
|
-
return [result, failed, usedTxs, returns,
|
|
377
|
+
return [result, failed, usedTxs, returns, debugLogs];
|
|
369
378
|
}
|
|
370
379
|
|
|
371
380
|
private async checkWorldStateUnchanged(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger, type LoggerBindings, createLogger
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { sleep } from '@aztec/foundation/sleep';
|
|
3
3
|
import { type CancellationToken, avmSimulate, cancelSimulation, createCancellationToken } from '@aztec/native';
|
|
4
4
|
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
@@ -100,8 +100,7 @@ export class CppPublicTxSimulator extends PublicTxSimulator implements PublicTxS
|
|
|
100
100
|
inputBuffer,
|
|
101
101
|
contractProvider,
|
|
102
102
|
wsCppHandle,
|
|
103
|
-
|
|
104
|
-
// TODO: re-enable logging
|
|
103
|
+
this.log.level,
|
|
105
104
|
undefined,
|
|
106
105
|
this.cancellationToken,
|
|
107
106
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger, type LoggerBindings, createLogger
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { avmSimulateWithHintedDbs } from '@aztec/native';
|
|
3
3
|
import {
|
|
4
4
|
AvmCircuitInputs,
|
|
@@ -75,7 +75,7 @@ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator implements
|
|
|
75
75
|
|
|
76
76
|
let resultBuffer: Buffer;
|
|
77
77
|
try {
|
|
78
|
-
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer,
|
|
78
|
+
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer, this.log.level);
|
|
79
79
|
} catch (error: any) {
|
|
80
80
|
throw new SimulationError(`C++ hinted simulation failed: ${error.message}`, []);
|
|
81
81
|
}
|
|
@@ -19,10 +19,11 @@ export function createPublicTxSimulatorForBlockBuilding(
|
|
|
19
19
|
globalVariables: GlobalVariables,
|
|
20
20
|
telemetryClient: TelemetryClient,
|
|
21
21
|
bindings?: LoggerBindings,
|
|
22
|
+
collectDebugLogs = false,
|
|
22
23
|
) {
|
|
23
24
|
const config = PublicSimulatorConfig.from({
|
|
24
25
|
skipFeeEnforcement: false,
|
|
25
|
-
collectDebugLogs
|
|
26
|
+
collectDebugLogs,
|
|
26
27
|
collectHints: false,
|
|
27
28
|
collectPublicInputs: false,
|
|
28
29
|
collectStatistics: false,
|