@aztec/simulator 0.0.1-commit.ec5f612 → 0.0.1-commit.ef17749e1
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 +2 -2
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +27 -25
- 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 +35 -29
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3R4X3NpbXVsYXRpb25fdGVzdGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL2ZpeHR1cmVzL3B1YmxpY190eF9zaW11bGF0aW9uX3Rlc3Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFTQSxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBbUIsTUFBTSxtQkFBbUIsQ0FBQztBQUMzRSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsS0FBSyxjQUFjLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsR0FBRyxFQUFXLE1BQU0sbUJBQW1CLENBQUM7QUFDakQsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRixPQUFPLEVBQUUsZUFBZSxFQUFpQyxLQUFLLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQzNGLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTdELE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLCtDQUErQyxDQUFDO0FBT3hGLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRzVELE9BQU8sS0FBSyxFQUFFLGtDQUFrQyxFQUFFLE1BQU0seURBQXlELENBQUM7QUFDbEgsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNkJBQTZCLENBQUM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AAE,qBAAqB,EACzC,OAAO,GAAE,MAAsB,EAC/B,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CA8BzB;IAED;;;;;OAKG;IACU,mBAAmB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,iBAAiB,CAAC,EAAE,qBAAqB,EACzC,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CAWzB;IAED;;;;;;OAMG;IACU,kBAAkB,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,iBAAiB,CAAC,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, skipNullifierInsertion?: boolean): Promise<void>;
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvZml4dHVyZXMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBV0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR3BELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSwyQkFBMkIsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQy9GLE9BQU8sRUFBRSxHQUFHLEVBQXdCLE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AAO,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) {
|
|
@@ -50,7 +50,7 @@ export declare class PublicProcessor implements Traceable {
|
|
|
50
50
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
51
51
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
52
52
|
*/
|
|
53
|
-
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[]]>;
|
|
54
54
|
private checkWorldStateUnchanged;
|
|
55
55
|
private processTx;
|
|
56
56
|
private doTreeInsertionsForPrivateOnlyTx;
|
|
@@ -63,4 +63,4 @@ export declare class PublicProcessor implements Traceable {
|
|
|
63
63
|
*/
|
|
64
64
|
private static generateProvingRequest;
|
|
65
65
|
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
66
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3Byb2Nlc3Nvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9wdWJsaWNfcHJvY2Vzc29yL3B1YmxpY19wcm9jZXNzb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFFLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBRXZGLE9BQU8sRUFBRSxZQUFZLEVBQWtDLE1BQU0seUJBQXlCLENBQUM7QUFJdkYsT0FBTyxFQU1MLHFCQUFxQixFQUN0QixNQUFNLG1CQUFtQixDQUFDO0FBRTNCLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFHakUsT0FBTyxLQUFLLEVBQ1YseUJBQXlCLEVBQ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9B,iBAAiB,EAAE,0BAA0B,EAC/C,YAAY,EAAE,YAAY,EAClC,eAAe,6BAAwC,EAC/C,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,IAAI,CAAC,eAAe,EAAE,4BAA4B,GAAG,iCAAiC,CAAM,EAClG,aAAa,GAAE,aAAuC,EAG/D;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;IACU,OAAO,CAClB,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,
|
|
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,iBAAi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C/C,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,IAAI,CAAC,eAAe,EAAE,4BAA4B,GAAG,iCAAiC,CAAM,EAClG,aAAa,GAAE,aAAuC,EAG/D;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;IACU,OAAO,CAClB,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"}
|
|
@@ -490,7 +490,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
490
490
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
491
491
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
492
492
|
*/ async process(txs, limits = {}, validator = {}) {
|
|
493
|
-
const { maxTransactions,
|
|
493
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
494
494
|
const { preprocessValidator, nullifierCache } = validator;
|
|
495
495
|
const result = [];
|
|
496
496
|
const usedTxs = [];
|
|
@@ -513,21 +513,23 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
513
513
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
514
514
|
break;
|
|
515
515
|
}
|
|
516
|
-
// Skip this tx if it'd exceed max block size
|
|
517
516
|
const txHash = tx.getTxHash().toString();
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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`, {
|
|
521
522
|
txHash,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
523
|
+
txBlobFields,
|
|
524
|
+
totalBlobFields,
|
|
525
|
+
maxBlobFields
|
|
525
526
|
});
|
|
526
527
|
continue;
|
|
527
528
|
}
|
|
528
|
-
// 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.
|
|
529
531
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
530
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
532
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
531
533
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
532
534
|
txHash,
|
|
533
535
|
txGasLimit,
|
|
@@ -574,21 +576,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
574
576
|
throw new Error(`Fake error after processing ${fakeThrowAfter} txs`);
|
|
575
577
|
}
|
|
576
578
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
577
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
578
579
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
579
|
-
|
|
580
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
581
|
-
txHash,
|
|
582
|
-
sizeInBytes: txSize,
|
|
583
|
-
totalSizeInBytes,
|
|
584
|
-
maxBlockSize
|
|
585
|
-
});
|
|
586
|
-
// Need to revert the checkpoint here and don't go any further
|
|
587
|
-
await checkpoint.revert();
|
|
588
|
-
this.contractsDB.revertCheckpoint();
|
|
589
|
-
continue;
|
|
590
|
-
}
|
|
591
|
-
// 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.
|
|
592
581
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
593
582
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
594
583
|
this.log.debug(`Skipping processed tx ${txHash} with ${txBlobFields} blob fields due to max blob fields limit.`, {
|
|
@@ -602,6 +591,20 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
602
591
|
this.contractsDB.revertCheckpoint();
|
|
603
592
|
continue;
|
|
604
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
|
+
}
|
|
605
608
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
606
609
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
607
610
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map((n)=>n.toBuffer()));
|
|
@@ -677,7 +680,6 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
677
680
|
failed,
|
|
678
681
|
usedTxs,
|
|
679
682
|
returns,
|
|
680
|
-
totalBlobFields,
|
|
681
683
|
debugLogs
|
|
682
684
|
];
|
|
683
685
|
}
|
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.ef17749e1",
|
|
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.ef17749e1",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.ef17749e1",
|
|
69
|
+
"@aztec/native": "0.0.1-commit.ef17749e1",
|
|
70
|
+
"@aztec/noir-acvm_js": "0.0.1-commit.ef17749e1",
|
|
71
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.ef17749e1",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.ef17749e1",
|
|
73
|
+
"@aztec/noir-types": "0.0.1-commit.ef17749e1",
|
|
74
|
+
"@aztec/protocol-contracts": "0.0.1-commit.ef17749e1",
|
|
75
|
+
"@aztec/stdlib": "0.0.1-commit.ef17749e1",
|
|
76
|
+
"@aztec/telemetry-client": "0.0.1-commit.ef17749e1",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.ef17749e1",
|
|
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.ef17749e1",
|
|
84
|
+
"@aztec/merkle-tree": "0.0.1-commit.ef17749e1",
|
|
85
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.ef17749e1",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.ef17749e1",
|
|
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
|
|
|
@@ -160,8 +160,8 @@ export class PublicProcessor implements Traceable {
|
|
|
160
160
|
txs: Iterable<Tx> | AsyncIterable<Tx>,
|
|
161
161
|
limits: PublicProcessorLimits = {},
|
|
162
162
|
validator: PublicProcessorValidator = {},
|
|
163
|
-
): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[],
|
|
164
|
-
const { maxTransactions,
|
|
163
|
+
): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[], DebugLog[]]> {
|
|
164
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
165
165
|
const { preprocessValidator, nullifierCache } = validator;
|
|
166
166
|
const result: ProcessedTx[] = [];
|
|
167
167
|
const usedTxs: Tx[] = [];
|
|
@@ -188,22 +188,23 @@ export class PublicProcessor implements Traceable {
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
// Skip this tx if it'd exceed max block size
|
|
192
191
|
const txHash = tx.getTxHash().toString();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
+
);
|
|
201
201
|
continue;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// 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.
|
|
205
206
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
206
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
207
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
207
208
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
208
209
|
txHash,
|
|
209
210
|
txGasLimit,
|
|
@@ -252,23 +253,9 @@ export class PublicProcessor implements Traceable {
|
|
|
252
253
|
}
|
|
253
254
|
|
|
254
255
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
255
|
-
|
|
256
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
257
256
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
258
|
-
if (maxBlockSize !== undefined && totalSizeInBytes + txSize > maxBlockSize) {
|
|
259
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
260
|
-
txHash,
|
|
261
|
-
sizeInBytes: txSize,
|
|
262
|
-
totalSizeInBytes,
|
|
263
|
-
maxBlockSize,
|
|
264
|
-
});
|
|
265
|
-
// Need to revert the checkpoint here and don't go any further
|
|
266
|
-
await checkpoint.revert();
|
|
267
|
-
this.contractsDB.revertCheckpoint();
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
257
|
|
|
271
|
-
// 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.
|
|
272
259
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
273
260
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
274
261
|
this.log.debug(
|
|
@@ -286,6 +273,25 @@ export class PublicProcessor implements Traceable {
|
|
|
286
273
|
continue;
|
|
287
274
|
}
|
|
288
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
|
+
|
|
289
295
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
290
296
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
291
297
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map(n => n.toBuffer()));
|
|
@@ -368,7 +374,7 @@ export class PublicProcessor implements Traceable {
|
|
|
368
374
|
totalSizeInBytes,
|
|
369
375
|
});
|
|
370
376
|
|
|
371
|
-
return [result, failed, usedTxs, returns,
|
|
377
|
+
return [result, failed, usedTxs, returns, debugLogs];
|
|
372
378
|
}
|
|
373
379
|
|
|
374
380
|
private async checkWorldStateUnchanged(
|