@aztec/prover-client 2.0.0-nightly.20250902 → 3.0.0-nightly.20250904
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/block-factory/light.js +2 -2
- package/dest/mocks/test_context.d.ts +16 -12
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +28 -28
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +2 -4
- package/dest/orchestrator/block-proving-state.d.ts +1 -1
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +1 -1
- package/dest/orchestrator/orchestrator.js +1 -1
- package/package.json +15 -15
- package/src/block-factory/light.ts +2 -2
- package/src/mocks/test_context.ts +63 -36
- package/src/orchestrator/block-building-helpers.ts +2 -4
- package/src/orchestrator/block-proving-state.ts +2 -2
- package/src/orchestrator/orchestrator.ts +1 -1
|
@@ -76,12 +76,12 @@ import { buildHeaderAndBodyFromTxs, getTreeSnapshot, insertSideEffectsAndBuildBa
|
|
|
76
76
|
* @param db - A db fork to use for block building which WILL BE MODIFIED.
|
|
77
77
|
*/ export async function buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db, telemetry = getTelemetryClient()) {
|
|
78
78
|
const spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
79
|
+
const builder = new LightweightBlockFactory(db, telemetry);
|
|
80
|
+
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
79
81
|
const l1ToL2MessageTree = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
80
82
|
for (const tx of txs){
|
|
81
83
|
await insertSideEffectsAndBuildBaseRollupHints(tx, globalVariables, l1ToL2MessageTree, db, spongeBlobState);
|
|
82
84
|
}
|
|
83
|
-
const builder = new LightweightBlockFactory(db, telemetry);
|
|
84
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
85
85
|
await builder.addTxs(txs);
|
|
86
86
|
return await builder.setBlockCompleted();
|
|
87
87
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { BBProverConfig } from '@aztec/bb-prover';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
5
|
-
import { PublicProcessor } from '@aztec/simulator/server';
|
|
4
|
+
import { SimpleContractDataSource } from '@aztec/simulator/public/fixtures';
|
|
6
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
6
|
import { type L2Block } from '@aztec/stdlib/block';
|
|
8
7
|
import type { ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
@@ -15,7 +14,6 @@ import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facad
|
|
|
15
14
|
import { TestBroker } from '../test/mock_prover.js';
|
|
16
15
|
export declare class TestContext {
|
|
17
16
|
worldState: MerkleTreeAdminDatabase;
|
|
18
|
-
publicProcessor: PublicProcessor;
|
|
19
17
|
globalVariables: GlobalVariables;
|
|
20
18
|
prover: ServerCircuitProver;
|
|
21
19
|
broker: TestBroker;
|
|
@@ -24,29 +22,35 @@ export declare class TestContext {
|
|
|
24
22
|
blockNumber: number;
|
|
25
23
|
feePayer: AztecAddress;
|
|
26
24
|
directoriesToCleanup: string[];
|
|
27
|
-
tester: PublicTxSimulationTester;
|
|
28
25
|
logger: Logger;
|
|
29
26
|
private headers;
|
|
30
27
|
private feePayerBalance;
|
|
31
|
-
constructor(worldState: MerkleTreeAdminDatabase,
|
|
28
|
+
constructor(worldState: MerkleTreeAdminDatabase, globalVariables: GlobalVariables, prover: ServerCircuitProver, broker: TestBroker, brokerProverFacade: BrokerCircuitProverFacade, orchestrator: TestProvingOrchestrator, blockNumber: number, feePayer: AztecAddress, initialFeePayerBalance: Fr, directoriesToCleanup: string[], logger: Logger);
|
|
32
29
|
get epochProver(): TestProvingOrchestrator;
|
|
33
|
-
static new(logger: Logger, proverCount
|
|
30
|
+
static new(logger: Logger, { proverCount, createProver, blockNumber, }?: {
|
|
31
|
+
proverCount?: number;
|
|
32
|
+
createProver?: (bbConfig: BBProverConfig) => Promise<ServerCircuitProver>;
|
|
33
|
+
blockNumber?: number;
|
|
34
|
+
}): Promise<TestContext>;
|
|
34
35
|
getFork(): Promise<import("@aztec/stdlib/trees").MerkleTreeWriteOperations>;
|
|
35
36
|
getBlockHeader(blockNumber: 0): BlockHeader;
|
|
36
37
|
getBlockHeader(blockNumber: number): BlockHeader | undefined;
|
|
37
38
|
setBlockHeader(header: BlockHeader, blockNumber: number): void;
|
|
38
39
|
getPreviousBlockHeader(currentBlockNumber?: number): BlockHeader;
|
|
39
40
|
cleanup(): Promise<void>;
|
|
40
|
-
makeProcessedTx
|
|
41
|
-
makeProcessedTx(seed?: number): Promise<ProcessedTx>;
|
|
41
|
+
private makeProcessedTx;
|
|
42
42
|
/** Creates a block with the given number of txs and adds it to world-state */
|
|
43
|
-
makePendingBlock(numTxs: number,
|
|
43
|
+
makePendingBlock(numTxs: number, numL1ToL2Messages?: number, blockNumOrGlobals?: GlobalVariables | number, makeProcessedTxOpts?: (index: number) => Partial<Parameters<typeof makeBloatedProcessedTx>[0]>): Promise<{
|
|
44
44
|
block: L2Block;
|
|
45
45
|
txs: ProcessedTx[];
|
|
46
|
-
|
|
46
|
+
l1ToL2Messages: Fr[];
|
|
47
47
|
}>;
|
|
48
|
-
processPublicFunctions(txs: Tx[], maxTransactions
|
|
49
|
-
|
|
48
|
+
processPublicFunctions(txs: Tx[], { maxTransactions, numL1ToL2Messages, contractDataSource, }?: {
|
|
49
|
+
maxTransactions?: number;
|
|
50
|
+
numL1ToL2Messages?: number;
|
|
51
|
+
contractDataSource?: SimpleContractDataSource;
|
|
52
|
+
}): Promise<[ProcessedTx[], import("@aztec/stdlib/tx").FailedTx[], Tx[], import("@aztec/stdlib/tx").NestedProcessReturnValues[]]>;
|
|
53
|
+
private setTreeRoots;
|
|
50
54
|
}
|
|
51
55
|
declare class TestProvingOrchestrator extends ProvingOrchestrator {
|
|
52
56
|
isVerifyBuiltBlockAgainstSyncedStateEnabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_context.d.ts","sourceRoot":"","sources":["../../src/mocks/test_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"test_context.d.ts","sourceRoot":"","sources":["../../src/mocks/test_context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAKpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,KAAK,sBAAsB,EAAoC,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAiB,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACpH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAUlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAG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MAAM,EACd,iBAAiB,GAAE,MAAU,EAC7B,iBAAiB,GAAE,eAAe,GAAG,MAA6B,EAClE,mBAAmB,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAc;;;;;IA4B/F,sBAAsB,CACjC,GAAG,EAAE,EAAE,EAAE,EACT,EACE,eAA4B,EAC5B,iBAAqB,EACrB,kBAAkB,GACnB,GAAE;QACD,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;KAC1C;YAkBM,YAAY;CAuB3B;AAED,cAAM,uBAAwB,SAAQ,mBAAmB;IAChD,2CAA2C,UAAS;cAIxC,kCAAkC,CACnD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,IAAI,CAAC;CAMjB"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
|
+
import { padArrayEnd, times, timesParallel } from '@aztec/foundation/collection';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
4
5
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
5
6
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
6
7
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
7
|
-
import {
|
|
8
|
+
import { SimpleContractDataSource } from '@aztec/simulator/public/fixtures';
|
|
8
9
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
9
10
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
10
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
11
12
|
import { EthAddress } from '@aztec/stdlib/block';
|
|
12
13
|
import { makeBloatedProcessedTx } from '@aztec/stdlib/testing';
|
|
13
|
-
import { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
14
|
+
import { MerkleTreeId, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
14
15
|
import { TreeSnapshots } from '@aztec/stdlib/tx';
|
|
15
16
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
16
17
|
import { promises as fs } from 'fs';
|
|
@@ -18,13 +19,13 @@ import { promises as fs } from 'fs';
|
|
|
18
19
|
// eslint-disable-next-line import/no-relative-packages
|
|
19
20
|
import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prover.js';
|
|
20
21
|
import { buildBlockWithCleanDB } from '../block-factory/light.js';
|
|
22
|
+
import { getTreeSnapshot } from '../orchestrator/block-building-helpers.js';
|
|
21
23
|
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
22
24
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
23
25
|
import { TestBroker } from '../test/mock_prover.js';
|
|
24
26
|
import { getEnvironmentConfig, getSimulator, makeGlobals, updateExpectedTreesFromTxs } from './fixtures.js';
|
|
25
27
|
export class TestContext {
|
|
26
28
|
worldState;
|
|
27
|
-
publicProcessor;
|
|
28
29
|
globalVariables;
|
|
29
30
|
prover;
|
|
30
31
|
broker;
|
|
@@ -33,13 +34,11 @@ export class TestContext {
|
|
|
33
34
|
blockNumber;
|
|
34
35
|
feePayer;
|
|
35
36
|
directoriesToCleanup;
|
|
36
|
-
tester;
|
|
37
37
|
logger;
|
|
38
38
|
headers;
|
|
39
39
|
feePayerBalance;
|
|
40
|
-
constructor(worldState,
|
|
40
|
+
constructor(worldState, globalVariables, prover, broker, brokerProverFacade, orchestrator, blockNumber, feePayer, initialFeePayerBalance, directoriesToCleanup, logger){
|
|
41
41
|
this.worldState = worldState;
|
|
42
|
-
this.publicProcessor = publicProcessor;
|
|
43
42
|
this.globalVariables = globalVariables;
|
|
44
43
|
this.prover = prover;
|
|
45
44
|
this.broker = broker;
|
|
@@ -48,7 +47,6 @@ export class TestContext {
|
|
|
48
47
|
this.blockNumber = blockNumber;
|
|
49
48
|
this.feePayer = feePayer;
|
|
50
49
|
this.directoriesToCleanup = directoriesToCleanup;
|
|
51
|
-
this.tester = tester;
|
|
52
50
|
this.logger = logger;
|
|
53
51
|
this.headers = new Map();
|
|
54
52
|
this.feePayerBalance = initialFeePayerBalance;
|
|
@@ -56,7 +54,7 @@ export class TestContext {
|
|
|
56
54
|
get epochProver() {
|
|
57
55
|
return this.orchestrator;
|
|
58
56
|
}
|
|
59
|
-
static async new(logger, proverCount = 4, createProver = async (bbConfig)=>new TestCircuitProver(await getSimulator(bbConfig, logger)), blockNumber = 1) {
|
|
57
|
+
static async new(logger, { proverCount = 4, createProver = async (bbConfig)=>new TestCircuitProver(await getSimulator(bbConfig, logger)), blockNumber = 1 } = {}) {
|
|
60
58
|
const directoriesToCleanup = [];
|
|
61
59
|
const globalVariables = makeGlobals(blockNumber);
|
|
62
60
|
const feePayer = AztecAddress.fromNumber(42222);
|
|
@@ -67,11 +65,6 @@ export class TestContext {
|
|
|
67
65
|
];
|
|
68
66
|
// Separated dbs for public processor and prover - see public_processor for context
|
|
69
67
|
const ws = await NativeWorldStateService.tmp(/*rollupAddress=*/ undefined, /*cleanupTmpDir=*/ true, prefilledPublicData);
|
|
70
|
-
const merkleTrees = await ws.fork();
|
|
71
|
-
const contractDataSource = new SimpleContractDataSource();
|
|
72
|
-
const tester = new PublicTxSimulationTester(merkleTrees, contractDataSource);
|
|
73
|
-
const processorFactory = new PublicProcessorFactory(contractDataSource, new TestDateProvider());
|
|
74
|
-
const processor = processorFactory.create(merkleTrees, globalVariables, /*skipFeeEnforcement=*/ false);
|
|
75
68
|
let localProver;
|
|
76
69
|
const config = await getEnvironmentConfig(logger);
|
|
77
70
|
if (!config) {
|
|
@@ -96,7 +89,7 @@ export class TestContext {
|
|
|
96
89
|
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO);
|
|
97
90
|
await broker.start();
|
|
98
91
|
facade.start();
|
|
99
|
-
return new this(ws,
|
|
92
|
+
return new this(ws, globalVariables, localProver, broker, facade, orchestrator, blockNumber, feePayer, initialFeePayerBalance, directoriesToCleanup, logger);
|
|
100
93
|
}
|
|
101
94
|
getFork() {
|
|
102
95
|
return this.worldState.fork();
|
|
@@ -125,10 +118,7 @@ export class TestContext {
|
|
|
125
118
|
}
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
|
-
async makeProcessedTx(
|
|
129
|
-
const opts = typeof seedOrOpts === 'number' ? {
|
|
130
|
-
seed: seedOrOpts
|
|
131
|
-
} : seedOrOpts;
|
|
121
|
+
async makeProcessedTx(opts) {
|
|
132
122
|
const blockNum = (opts?.globalVariables ?? this.globalVariables).blockNumber;
|
|
133
123
|
const header = this.getBlockHeader(blockNum - 1);
|
|
134
124
|
const tx = await makeBloatedProcessedTx({
|
|
@@ -146,28 +136,37 @@ export class TestContext {
|
|
|
146
136
|
}
|
|
147
137
|
return tx;
|
|
148
138
|
}
|
|
149
|
-
/** Creates a block with the given number of txs and adds it to world-state */ async makePendingBlock(numTxs,
|
|
139
|
+
/** Creates a block with the given number of txs and adds it to world-state */ async makePendingBlock(numTxs, numL1ToL2Messages = 0, blockNumOrGlobals = this.globalVariables, makeProcessedTxOpts = ()=>({})) {
|
|
150
140
|
const globalVariables = typeof blockNumOrGlobals === 'number' ? makeGlobals(blockNumOrGlobals) : blockNumOrGlobals;
|
|
151
141
|
const blockNum = globalVariables.blockNumber;
|
|
152
142
|
const db = await this.worldState.fork();
|
|
153
|
-
const
|
|
143
|
+
const l1ToL2Messages = times(numL1ToL2Messages, (i)=>new Fr(blockNum * 100 + i));
|
|
144
|
+
const merkleTrees = await this.worldState.fork();
|
|
145
|
+
await merkleTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
146
|
+
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
154
147
|
const txs = await timesParallel(numTxs, (i)=>this.makeProcessedTx({
|
|
155
148
|
seed: i + blockNum * 1000,
|
|
156
149
|
globalVariables,
|
|
150
|
+
newL1ToL2Snapshot,
|
|
157
151
|
...makeProcessedTxOpts(i)
|
|
158
152
|
}));
|
|
159
153
|
await this.setTreeRoots(txs);
|
|
160
|
-
const block = await buildBlockWithCleanDB(txs, globalVariables,
|
|
154
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db);
|
|
161
155
|
this.headers.set(blockNum, block.header);
|
|
162
|
-
await this.worldState.handleL2BlockAndMessages(block,
|
|
156
|
+
await this.worldState.handleL2BlockAndMessages(block, l1ToL2Messages);
|
|
163
157
|
return {
|
|
164
158
|
block,
|
|
165
159
|
txs,
|
|
166
|
-
|
|
160
|
+
l1ToL2Messages
|
|
167
161
|
};
|
|
168
162
|
}
|
|
169
|
-
async processPublicFunctions(txs, maxTransactions) {
|
|
170
|
-
|
|
163
|
+
async processPublicFunctions(txs, { maxTransactions = txs.length, numL1ToL2Messages = 0, contractDataSource } = {}) {
|
|
164
|
+
const l1ToL2Messages = times(numL1ToL2Messages, (i)=>new Fr(this.blockNumber * 100 + i));
|
|
165
|
+
const merkleTrees = await this.worldState.fork();
|
|
166
|
+
await merkleTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
167
|
+
const processorFactory = new PublicProcessorFactory(contractDataSource ?? new SimpleContractDataSource(), new TestDateProvider());
|
|
168
|
+
const publicProcessor = processorFactory.create(merkleTrees, this.globalVariables, /*skipFeeEnforcement=*/ false);
|
|
169
|
+
return await publicProcessor.process(txs, {
|
|
171
170
|
maxTransactions
|
|
172
171
|
});
|
|
173
172
|
}
|
|
@@ -180,8 +179,9 @@ export class TestContext {
|
|
|
180
179
|
]);
|
|
181
180
|
const endStateReference = await db.getStateReference();
|
|
182
181
|
if (tx.avmProvingRequest) {
|
|
183
|
-
tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots
|
|
184
|
-
tx.avmProvingRequest.inputs.publicInputs.
|
|
182
|
+
const l1ToL2MessageTree = tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots.l1ToL2MessageTree;
|
|
183
|
+
tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots = new TreeSnapshots(l1ToL2MessageTree, startStateReference.partial.noteHashTree, startStateReference.partial.nullifierTree, startStateReference.partial.publicDataTree);
|
|
184
|
+
tx.avmProvingRequest.inputs.publicInputs.endTreeSnapshots = new TreeSnapshots(l1ToL2MessageTree, endStateReference.partial.noteHashTree, endStateReference.partial.nullifierTree, endStateReference.partial.publicDataTree);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -18,7 +18,7 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public
|
|
|
18
18
|
* Type representing the names of the trees.
|
|
19
19
|
*/
|
|
20
20
|
export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive';
|
|
21
|
-
export declare const insertSideEffectsAndBuildBaseRollupHints: (tx: ProcessedTx, globalVariables: GlobalVariables,
|
|
21
|
+
export declare const insertSideEffectsAndBuildBaseRollupHints: (tx: ProcessedTx, globalVariables: GlobalVariables, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, db: MerkleTreeWriteOperations, startSpongeBlob: SpongeBlob) => Promise<PublicBaseRollupHints | PrivateBaseRollupHints>;
|
|
22
22
|
export declare function getPublicDataHint(db: MerkleTreeWriteOperations, leafSlot: bigint): Promise<PublicDataHint>;
|
|
23
23
|
export declare const buildBlobHints: (txEffects: TxEffect[]) => Promise<{
|
|
24
24
|
blobFields: Fr[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAiBhF,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,KAAK,KAAK,EAAgC,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAyD,MAAM,yBAAyB,CAAC;AAInH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,KAAK,6BAA6B,EAElC,KAAK,iCAAiC,EACtC,sBAAsB,EAEtB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAEX,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,WAAW,EAChB,cAAc,EACd,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,KAAK,aAAa,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAC1F;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,mBAAmB,GAAG,SAAS,CAAC;AAGxE,eAAO,MAAM,wCAAwC
|
|
1
|
+
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["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C,CAAC,CAY/B;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,qBAAqB,EACnC,aAAa,EAAE,GAAG,CAAC,YAAY,EAAE,sBAAsB,CAAC,QASzD;AAqBD,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,QAczC"}
|
|
@@ -17,9 +17,7 @@ import { AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeafPreimage, PublicData
|
|
|
17
17
|
import { BlockHeader, ContentCommitment, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
|
|
18
18
|
import { Attributes, runInSpan } from '@aztec/telemetry-client';
|
|
19
19
|
// Builds the hints for base rollup. Updating the contract, nullifier, and data trees in the process.
|
|
20
|
-
export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderHelpers', 'buildBaseRollupHints', async (span, tx, globalVariables,
|
|
21
|
-
// when base parity proof is being generated.
|
|
22
|
-
l1ToL2MessageTreeSnapshot, db, startSpongeBlob)=>{
|
|
20
|
+
export const insertSideEffectsAndBuildBaseRollupHints = runInSpan('BlockBuilderHelpers', 'buildBaseRollupHints', async (span, tx, globalVariables, newL1ToL2MessageTreeSnapshot, db, startSpongeBlob)=>{
|
|
23
21
|
span.setAttribute(Attributes.TX_HASH, tx.hash.toString());
|
|
24
22
|
// Get trees info before any changes hit
|
|
25
23
|
const lastArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, db);
|
|
@@ -81,7 +79,7 @@ l1ToL2MessageTreeSnapshot, db, startSpongeBlob)=>{
|
|
|
81
79
|
const archiveRootMembershipWitness = await getMembershipWitnessFor(blockHash, MerkleTreeId.ARCHIVE, ARCHIVE_HEIGHT, db);
|
|
82
80
|
const constants = BlockConstantData.from({
|
|
83
81
|
lastArchive,
|
|
84
|
-
|
|
82
|
+
newL1ToL2: newL1ToL2MessageTreeSnapshot,
|
|
85
83
|
vkTreeRoot: getVKTreeRoot(),
|
|
86
84
|
protocolContractTreeRoot,
|
|
87
85
|
globalVariables
|
|
@@ -23,7 +23,7 @@ export declare class BlockProvingState {
|
|
|
23
23
|
readonly newL1ToL2Messages: Fr[];
|
|
24
24
|
readonly l1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot;
|
|
25
25
|
private readonly l1ToL2MessageSubtreeSiblingPath;
|
|
26
|
-
|
|
26
|
+
readonly l1ToL2MessageTreeSnapshotAfterInsertion: AppendOnlyTreeSnapshot;
|
|
27
27
|
private readonly lastArchiveSnapshot;
|
|
28
28
|
private readonly lastArchiveSiblingPath;
|
|
29
29
|
private readonly newArchiveSiblingPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-proving-state.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-proving-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA+B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EACL,KAAK,cAAc,EAGnB,KAAK,wCAAwC,EAC7C,KAAK,yCAAyC,EAG/C,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAc,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,yBAAyB,CAAC;AAGrF,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,KAAK,kBAAkB,EAAmB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EACL,KAAK,6BAA6B,EAElC,KAAK,iCAAiC,EAGtC,qBAAqB,EACrB,0BAA0B,EAE1B,iBAAiB,EACjB,4BAA4B,EAE5B,6BAA6B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChF,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IAAW,MAAM,qBAEhB;IAED,yFAAyF;IACzF,IAAW,WAAW,IAAI,MAAM,CAE/B;IAEM,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB;IAI5C,oBAAoB,CAAC,aAAa,EAAE,gBAAgB;IAS9C,+BAA+B;;;;;;;;;;IAsDrC,yBAAyB;IAYzB,mBAAmB;IAYnB,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAI3B,6BAA6B;IA0BnC,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB;IAKhD,yBAAyB;IAWzB,oBAAoB;IAIpB,UAAU;IAKV,WAAW;IAIX,MAAM,CAAC,MAAM,EAAE,MAAM;CA0D7B"}
|
|
@@ -154,7 +154,7 @@ import { accumulateBlobs, buildBlobHints, buildHeaderFromCircuitOutputs, getEmpt
|
|
|
154
154
|
if (this.totalNumTxs === 0) {
|
|
155
155
|
const constants = BlockConstantData.from({
|
|
156
156
|
lastArchive: this.lastArchiveSnapshot,
|
|
157
|
-
|
|
157
|
+
newL1ToL2: this.l1ToL2MessageTreeSnapshotAfterInsertion,
|
|
158
158
|
globalVariables: this.globalVariables,
|
|
159
159
|
vkTreeRoot: getVKTreeRoot(),
|
|
160
160
|
protocolContractTreeRoot
|
|
@@ -347,7 +347,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
347
347
|
const db = this.dbs.get(provingState.blockNumber);
|
|
348
348
|
// We build the base rollup inputs using a mock proof and verification key.
|
|
349
349
|
// These will be overwritten later once we have proven the tube circuit and any public kernels
|
|
350
|
-
const [ms, hints] = await elapsed(insertSideEffectsAndBuildBaseRollupHints(tx, provingState.globalVariables, provingState.
|
|
350
|
+
const [ms, hints] = await elapsed(insertSideEffectsAndBuildBaseRollupHints(tx, provingState.globalVariables, provingState.l1ToL2MessageTreeSnapshotAfterInsertion, db, provingState.spongeBlobState));
|
|
351
351
|
this.metrics.recordBaseRollupInputs(ms);
|
|
352
352
|
const promises = [
|
|
353
353
|
MerkleTreeId.NOTE_HASH_TREE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-nightly.20250904",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -68,19 +68,19 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb-prover": "
|
|
72
|
-
"@aztec/blob-lib": "
|
|
73
|
-
"@aztec/constants": "
|
|
74
|
-
"@aztec/ethereum": "
|
|
75
|
-
"@aztec/foundation": "
|
|
76
|
-
"@aztec/kv-store": "
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "
|
|
78
|
-
"@aztec/noir-types": "
|
|
79
|
-
"@aztec/protocol-contracts": "
|
|
80
|
-
"@aztec/simulator": "
|
|
81
|
-
"@aztec/stdlib": "
|
|
82
|
-
"@aztec/telemetry-client": "
|
|
83
|
-
"@aztec/world-state": "
|
|
71
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250904",
|
|
72
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250904",
|
|
73
|
+
"@aztec/constants": "3.0.0-nightly.20250904",
|
|
74
|
+
"@aztec/ethereum": "3.0.0-nightly.20250904",
|
|
75
|
+
"@aztec/foundation": "3.0.0-nightly.20250904",
|
|
76
|
+
"@aztec/kv-store": "3.0.0-nightly.20250904",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250904",
|
|
78
|
+
"@aztec/noir-types": "3.0.0-nightly.20250904",
|
|
79
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250904",
|
|
80
|
+
"@aztec/simulator": "3.0.0-nightly.20250904",
|
|
81
|
+
"@aztec/stdlib": "3.0.0-nightly.20250904",
|
|
82
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250904",
|
|
83
|
+
"@aztec/world-state": "3.0.0-nightly.20250904",
|
|
84
84
|
"@google-cloud/storage": "^7.15.0",
|
|
85
85
|
"@iarna/toml": "^2.2.5",
|
|
86
86
|
"commander": "^12.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"zod": "^3.23.8"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@aztec/noir-contracts.js": "
|
|
93
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250904",
|
|
94
94
|
"@jest/globals": "^30.0.0",
|
|
95
95
|
"@types/jest": "^30.0.0",
|
|
96
96
|
"@types/node": "^22.15.17",
|
|
@@ -103,12 +103,12 @@ export async function buildBlockWithCleanDB(
|
|
|
103
103
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
104
104
|
) {
|
|
105
105
|
const spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
|
|
106
|
+
const builder = new LightweightBlockFactory(db, telemetry);
|
|
107
|
+
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
106
108
|
const l1ToL2MessageTree = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
107
109
|
for (const tx of txs) {
|
|
108
110
|
await insertSideEffectsAndBuildBaseRollupHints(tx, globalVariables, l1ToL2MessageTree, db, spongeBlobState);
|
|
109
111
|
}
|
|
110
|
-
const builder = new LightweightBlockFactory(db, telemetry);
|
|
111
|
-
await builder.startNewBlock(globalVariables, l1ToL2Messages);
|
|
112
112
|
await builder.addTxs(txs);
|
|
113
113
|
return await builder.setBlockCompleted();
|
|
114
114
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { BBProverConfig } from '@aztec/bb-prover';
|
|
2
|
-
import {
|
|
2
|
+
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
3
|
+
import { padArrayEnd, times, timesParallel } from '@aztec/foundation/collection';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
6
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
6
7
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
7
8
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
8
9
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
10
|
+
import { SimpleContractDataSource } from '@aztec/simulator/public/fixtures';
|
|
11
|
+
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
11
12
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
12
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
14
|
import { EthAddress, type L2Block } from '@aztec/stdlib/block';
|
|
14
15
|
import type { ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
15
16
|
import { makeBloatedProcessedTx } from '@aztec/stdlib/testing';
|
|
16
|
-
import { type AppendOnlyTreeSnapshot, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
17
|
+
import { type AppendOnlyTreeSnapshot, MerkleTreeId, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
17
18
|
import { type BlockHeader, type GlobalVariables, type ProcessedTx, TreeSnapshots, type Tx } from '@aztec/stdlib/tx';
|
|
18
19
|
import type { MerkleTreeAdminDatabase } from '@aztec/world-state';
|
|
19
20
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
@@ -24,6 +25,7 @@ import { promises as fs } from 'fs';
|
|
|
24
25
|
// eslint-disable-next-line import/no-relative-packages
|
|
25
26
|
import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prover.js';
|
|
26
27
|
import { buildBlockWithCleanDB } from '../block-factory/light.js';
|
|
28
|
+
import { getTreeSnapshot } from '../orchestrator/block-building-helpers.js';
|
|
27
29
|
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
28
30
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
29
31
|
import { TestBroker } from '../test/mock_prover.js';
|
|
@@ -35,7 +37,6 @@ export class TestContext {
|
|
|
35
37
|
|
|
36
38
|
constructor(
|
|
37
39
|
public worldState: MerkleTreeAdminDatabase,
|
|
38
|
-
public publicProcessor: PublicProcessor,
|
|
39
40
|
public globalVariables: GlobalVariables,
|
|
40
41
|
public prover: ServerCircuitProver,
|
|
41
42
|
public broker: TestBroker,
|
|
@@ -45,7 +46,6 @@ export class TestContext {
|
|
|
45
46
|
public feePayer: AztecAddress,
|
|
46
47
|
initialFeePayerBalance: Fr,
|
|
47
48
|
public directoriesToCleanup: string[],
|
|
48
|
-
public tester: PublicTxSimulationTester,
|
|
49
49
|
public logger: Logger,
|
|
50
50
|
) {
|
|
51
51
|
this.feePayerBalance = initialFeePayerBalance;
|
|
@@ -57,10 +57,15 @@ export class TestContext {
|
|
|
57
57
|
|
|
58
58
|
static async new(
|
|
59
59
|
logger: Logger,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
new TestCircuitProver(await getSimulator(bbConfig, logger)),
|
|
63
|
-
|
|
60
|
+
{
|
|
61
|
+
proverCount = 4,
|
|
62
|
+
createProver = async (bbConfig: BBProverConfig) => new TestCircuitProver(await getSimulator(bbConfig, logger)),
|
|
63
|
+
blockNumber = 1,
|
|
64
|
+
}: {
|
|
65
|
+
proverCount?: number;
|
|
66
|
+
createProver?: (bbConfig: BBProverConfig) => Promise<ServerCircuitProver>;
|
|
67
|
+
blockNumber?: number;
|
|
68
|
+
} = {},
|
|
64
69
|
) {
|
|
65
70
|
const directoriesToCleanup: string[] = [];
|
|
66
71
|
const globalVariables = makeGlobals(blockNumber);
|
|
@@ -76,13 +81,6 @@ export class TestContext {
|
|
|
76
81
|
/*cleanupTmpDir=*/ true,
|
|
77
82
|
prefilledPublicData,
|
|
78
83
|
);
|
|
79
|
-
const merkleTrees = await ws.fork();
|
|
80
|
-
|
|
81
|
-
const contractDataSource = new SimpleContractDataSource();
|
|
82
|
-
const tester = new PublicTxSimulationTester(merkleTrees, contractDataSource);
|
|
83
|
-
|
|
84
|
-
const processorFactory = new PublicProcessorFactory(contractDataSource, new TestDateProvider());
|
|
85
|
-
const processor = processorFactory.create(merkleTrees, globalVariables, /*skipFeeEnforcement=*/ false);
|
|
86
84
|
|
|
87
85
|
let localProver: ServerCircuitProver;
|
|
88
86
|
const config = await getEnvironmentConfig(logger);
|
|
@@ -114,7 +112,6 @@ export class TestContext {
|
|
|
114
112
|
|
|
115
113
|
return new this(
|
|
116
114
|
ws,
|
|
117
|
-
processor,
|
|
118
115
|
globalVariables,
|
|
119
116
|
localProver,
|
|
120
117
|
broker,
|
|
@@ -124,7 +121,6 @@ export class TestContext {
|
|
|
124
121
|
feePayer,
|
|
125
122
|
initialFeePayerBalance,
|
|
126
123
|
directoriesToCleanup,
|
|
127
|
-
tester,
|
|
128
124
|
logger,
|
|
129
125
|
);
|
|
130
126
|
}
|
|
@@ -159,12 +155,7 @@ export class TestContext {
|
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
|
|
163
|
-
public async makeProcessedTx(seed?: number): Promise<ProcessedTx>;
|
|
164
|
-
public async makeProcessedTx(
|
|
165
|
-
seedOrOpts?: Parameters<typeof makeBloatedProcessedTx>[0] | number,
|
|
166
|
-
): Promise<ProcessedTx> {
|
|
167
|
-
const opts = typeof seedOrOpts === 'number' ? { seed: seedOrOpts } : seedOrOpts;
|
|
158
|
+
private async makeProcessedTx(opts?: Parameters<typeof makeBloatedProcessedTx>[0]): Promise<ProcessedTx> {
|
|
168
159
|
const blockNum = (opts?.globalVariables ?? this.globalVariables).blockNumber;
|
|
169
160
|
const header = this.getBlockHeader(blockNum - 1);
|
|
170
161
|
const tx = await makeBloatedProcessedTx({
|
|
@@ -186,44 +177,80 @@ export class TestContext {
|
|
|
186
177
|
/** Creates a block with the given number of txs and adds it to world-state */
|
|
187
178
|
public async makePendingBlock(
|
|
188
179
|
numTxs: number,
|
|
189
|
-
|
|
180
|
+
numL1ToL2Messages: number = 0,
|
|
190
181
|
blockNumOrGlobals: GlobalVariables | number = this.globalVariables,
|
|
191
182
|
makeProcessedTxOpts: (index: number) => Partial<Parameters<typeof makeBloatedProcessedTx>[0]> = () => ({}),
|
|
192
183
|
) {
|
|
193
184
|
const globalVariables = typeof blockNumOrGlobals === 'number' ? makeGlobals(blockNumOrGlobals) : blockNumOrGlobals;
|
|
194
185
|
const blockNum = globalVariables.blockNumber;
|
|
195
186
|
const db = await this.worldState.fork();
|
|
196
|
-
const
|
|
187
|
+
const l1ToL2Messages = times(numL1ToL2Messages, i => new Fr(blockNum * 100 + i));
|
|
188
|
+
const merkleTrees = await this.worldState.fork();
|
|
189
|
+
await merkleTrees.appendLeaves(
|
|
190
|
+
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
191
|
+
padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
192
|
+
);
|
|
193
|
+
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
197
194
|
const txs = await timesParallel(numTxs, i =>
|
|
198
|
-
this.makeProcessedTx({
|
|
195
|
+
this.makeProcessedTx({
|
|
196
|
+
seed: i + blockNum * 1000,
|
|
197
|
+
globalVariables,
|
|
198
|
+
newL1ToL2Snapshot,
|
|
199
|
+
...makeProcessedTxOpts(i),
|
|
200
|
+
}),
|
|
199
201
|
);
|
|
200
202
|
await this.setTreeRoots(txs);
|
|
201
203
|
|
|
202
|
-
const block = await buildBlockWithCleanDB(txs, globalVariables,
|
|
204
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db);
|
|
203
205
|
this.headers.set(blockNum, block.header);
|
|
204
|
-
await this.worldState.handleL2BlockAndMessages(block,
|
|
205
|
-
return { block, txs,
|
|
206
|
+
await this.worldState.handleL2BlockAndMessages(block, l1ToL2Messages);
|
|
207
|
+
return { block, txs, l1ToL2Messages };
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
public async processPublicFunctions(
|
|
209
|
-
|
|
210
|
+
public async processPublicFunctions(
|
|
211
|
+
txs: Tx[],
|
|
212
|
+
{
|
|
213
|
+
maxTransactions = txs.length,
|
|
214
|
+
numL1ToL2Messages = 0,
|
|
215
|
+
contractDataSource,
|
|
216
|
+
}: {
|
|
217
|
+
maxTransactions?: number;
|
|
218
|
+
numL1ToL2Messages?: number;
|
|
219
|
+
contractDataSource?: SimpleContractDataSource;
|
|
220
|
+
} = {},
|
|
221
|
+
) {
|
|
222
|
+
const l1ToL2Messages = times(numL1ToL2Messages, i => new Fr(this.blockNumber * 100 + i));
|
|
223
|
+
const merkleTrees = await this.worldState.fork();
|
|
224
|
+
await merkleTrees.appendLeaves(
|
|
225
|
+
MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
|
|
226
|
+
padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
const processorFactory = new PublicProcessorFactory(
|
|
230
|
+
contractDataSource ?? new SimpleContractDataSource(),
|
|
231
|
+
new TestDateProvider(),
|
|
232
|
+
);
|
|
233
|
+
const publicProcessor = processorFactory.create(merkleTrees, this.globalVariables, /*skipFeeEnforcement=*/ false);
|
|
234
|
+
|
|
235
|
+
return await publicProcessor.process(txs, { maxTransactions });
|
|
210
236
|
}
|
|
211
237
|
|
|
212
|
-
|
|
238
|
+
private async setTreeRoots(txs: ProcessedTx[]) {
|
|
213
239
|
const db = await this.worldState.fork();
|
|
214
240
|
for (const tx of txs) {
|
|
215
241
|
const startStateReference = await db.getStateReference();
|
|
216
242
|
await updateExpectedTreesFromTxs(db, [tx]);
|
|
217
243
|
const endStateReference = await db.getStateReference();
|
|
218
244
|
if (tx.avmProvingRequest) {
|
|
245
|
+
const l1ToL2MessageTree = tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots.l1ToL2MessageTree;
|
|
219
246
|
tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots = new TreeSnapshots(
|
|
220
|
-
|
|
247
|
+
l1ToL2MessageTree,
|
|
221
248
|
startStateReference.partial.noteHashTree,
|
|
222
249
|
startStateReference.partial.nullifierTree,
|
|
223
250
|
startStateReference.partial.publicDataTree,
|
|
224
251
|
);
|
|
225
252
|
tx.avmProvingRequest.inputs.publicInputs.endTreeSnapshots = new TreeSnapshots(
|
|
226
|
-
|
|
253
|
+
l1ToL2MessageTree,
|
|
227
254
|
endStateReference.partial.noteHashTree,
|
|
228
255
|
endStateReference.partial.nullifierTree,
|
|
229
256
|
endStateReference.partial.publicDataTree,
|
|
@@ -71,9 +71,7 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
71
71
|
span: Span,
|
|
72
72
|
tx: ProcessedTx,
|
|
73
73
|
globalVariables: GlobalVariables,
|
|
74
|
-
|
|
75
|
-
// when base parity proof is being generated.
|
|
76
|
-
l1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
74
|
+
newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
77
75
|
db: MerkleTreeWriteOperations,
|
|
78
76
|
startSpongeBlob: SpongeBlob,
|
|
79
77
|
) => {
|
|
@@ -209,7 +207,7 @@ export const insertSideEffectsAndBuildBaseRollupHints = runInSpan(
|
|
|
209
207
|
|
|
210
208
|
const constants = BlockConstantData.from({
|
|
211
209
|
lastArchive,
|
|
212
|
-
|
|
210
|
+
newL1ToL2: newL1ToL2MessageTreeSnapshot,
|
|
213
211
|
vkTreeRoot: getVKTreeRoot(),
|
|
214
212
|
protocolContractTreeRoot,
|
|
215
213
|
globalVariables,
|
|
@@ -76,7 +76,7 @@ export class BlockProvingState {
|
|
|
76
76
|
public readonly newL1ToL2Messages: Fr[],
|
|
77
77
|
public readonly l1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
78
78
|
private readonly l1ToL2MessageSubtreeSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH>,
|
|
79
|
-
|
|
79
|
+
public readonly l1ToL2MessageTreeSnapshotAfterInsertion: AppendOnlyTreeSnapshot,
|
|
80
80
|
private readonly lastArchiveSnapshot: AppendOnlyTreeSnapshot,
|
|
81
81
|
private readonly lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
82
82
|
private readonly newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
@@ -223,7 +223,7 @@ export class BlockProvingState {
|
|
|
223
223
|
if (this.totalNumTxs === 0) {
|
|
224
224
|
const constants = BlockConstantData.from({
|
|
225
225
|
lastArchive: this.lastArchiveSnapshot,
|
|
226
|
-
|
|
226
|
+
newL1ToL2: this.l1ToL2MessageTreeSnapshotAfterInsertion,
|
|
227
227
|
globalVariables: this.globalVariables,
|
|
228
228
|
vkTreeRoot: getVKTreeRoot(),
|
|
229
229
|
protocolContractTreeRoot,
|
|
@@ -525,7 +525,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
525
525
|
insertSideEffectsAndBuildBaseRollupHints(
|
|
526
526
|
tx,
|
|
527
527
|
provingState.globalVariables,
|
|
528
|
-
provingState.
|
|
528
|
+
provingState.l1ToL2MessageTreeSnapshotAfterInsertion,
|
|
529
529
|
db,
|
|
530
530
|
provingState.spongeBlobState,
|
|
531
531
|
),
|