@aztec/prover-client 0.0.0-test.1 → 0.0.1-commit.b655e406
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/index.d.ts +2 -0
- package/dest/block-factory/index.d.ts.map +1 -0
- package/dest/block-factory/light.d.ts +38 -0
- package/dest/block-factory/light.d.ts.map +1 -0
- package/dest/block-factory/light.js +94 -0
- package/dest/config.d.ts +6 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +11 -1
- package/dest/mocks/fixtures.d.ts +7 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +32 -4
- package/dest/mocks/test_context.d.ts +43 -15
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +110 -48
- package/dest/orchestrator/block-building-helpers.d.ts +37 -28
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +156 -150
- package/dest/orchestrator/block-proving-state.d.ts +62 -46
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +223 -179
- package/dest/orchestrator/checkpoint-proving-state.d.ts +63 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-proving-state.js +211 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +37 -24
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +143 -73
- package/dest/orchestrator/orchestrator.d.ts +34 -31
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +392 -234
- package/dest/orchestrator/orchestrator_metrics.d.ts +2 -0
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +9 -0
- package/dest/orchestrator/tx-proving-state.d.ts +12 -10
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +30 -38
- package/dest/prover-client/prover-client.d.ts +3 -3
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +5 -4
- package/dest/prover-client/server-epoch-prover.d.ts +13 -10
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +11 -11
- package/dest/proving_broker/broker_prover_facade.d.ts +22 -15
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +64 -39
- package/dest/proving_broker/config.d.ts +9 -4
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +15 -4
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/factory.d.ts.map +1 -1
- package/dest/proving_broker/factory.js +5 -1
- package/dest/proving_broker/fixtures.js +1 -1
- package/dest/proving_broker/proof_store/factory.js +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +1 -0
- package/dest/proving_broker/proof_store/index.d.ts +1 -0
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -0
- package/dest/proving_broker/proving_agent.d.ts +3 -3
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +83 -47
- package/dest/proving_broker/proving_broker.d.ts +11 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +34 -22
- package/dest/proving_broker/proving_broker_database/memory.js +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +9 -8
- package/dest/proving_broker/proving_job_controller.d.ts +7 -8
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +89 -61
- package/dest/proving_broker/rpc.d.ts +3 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +1 -4
- package/dest/test/mock_proof_store.d.ts +9 -0
- package/dest/test/mock_proof_store.d.ts.map +1 -0
- package/dest/test/mock_proof_store.js +10 -0
- package/dest/test/mock_prover.d.ts +23 -16
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +38 -20
- package/package.json +29 -29
- package/src/block-factory/index.ts +1 -0
- package/src/block-factory/light.ts +140 -0
- package/src/config.ts +24 -8
- package/src/mocks/fixtures.ts +43 -15
- package/src/mocks/test_context.ts +201 -75
- package/src/orchestrator/block-building-helpers.ts +247 -243
- package/src/orchestrator/block-proving-state.ts +247 -231
- package/src/orchestrator/checkpoint-proving-state.ts +299 -0
- package/src/orchestrator/epoch-proving-state.ts +187 -111
- package/src/orchestrator/orchestrator.ts +590 -289
- package/src/orchestrator/orchestrator_metrics.ts +20 -1
- package/src/orchestrator/tx-proving-state.ts +60 -61
- package/src/prover-client/prover-client.ts +16 -14
- package/src/prover-client/server-epoch-prover.ts +40 -21
- package/src/proving_broker/broker_prover_facade.ts +200 -113
- package/src/proving_broker/config.ts +17 -6
- package/src/proving_broker/factory.ts +2 -1
- package/src/proving_broker/fixtures.ts +1 -1
- package/src/proving_broker/proof_store/factory.ts +1 -1
- package/src/proving_broker/proof_store/gcs_proof_store.ts +5 -1
- package/src/proving_broker/proof_store/index.ts +1 -0
- package/src/proving_broker/proof_store/inline_proof_store.ts +1 -1
- package/src/proving_broker/proving_agent.ts +89 -47
- package/src/proving_broker/proving_broker.ts +51 -32
- package/src/proving_broker/proving_broker_database/memory.ts +1 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +9 -8
- package/src/proving_broker/proving_job_controller.ts +92 -81
- package/src/proving_broker/rpc.ts +1 -6
- package/src/test/mock_proof_store.ts +14 -0
- package/src/test/mock_prover.ts +164 -60
- package/dest/bin/get-proof-inputs.d.ts +0 -2
- package/dest/bin/get-proof-inputs.d.ts.map +0 -1
- package/dest/bin/get-proof-inputs.js +0 -51
- package/dest/block_builder/index.d.ts +0 -6
- package/dest/block_builder/index.d.ts.map +0 -1
- package/dest/block_builder/light.d.ts +0 -33
- package/dest/block_builder/light.d.ts.map +0 -1
- package/dest/block_builder/light.js +0 -82
- package/src/bin/get-proof-inputs.ts +0 -59
- package/src/block_builder/index.ts +0 -6
- package/src/block_builder/light.ts +0 -101
- /package/dest/{block_builder → block-factory}/index.js +0 -0
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestCircuitProver } from '@aztec/bb-prover';
|
|
2
|
+
import { SpongeBlob } from '@aztec/blob-lib';
|
|
3
|
+
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
4
|
+
import { padArrayEnd, times, timesParallel } from '@aztec/foundation/collection';
|
|
2
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
6
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
4
7
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
5
|
-
import {
|
|
8
|
+
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
6
9
|
import { computeFeePayerBalanceLeafSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
7
|
-
import {
|
|
10
|
+
import { SimpleContractDataSource } from '@aztec/simulator/public/fixtures';
|
|
11
|
+
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
8
12
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
9
13
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
+
import { EthAddress } from '@aztec/stdlib/block';
|
|
15
|
+
import { getCheckpointBlobFields } from '@aztec/stdlib/checkpoint';
|
|
10
16
|
import { makeBloatedProcessedTx } from '@aztec/stdlib/testing';
|
|
11
|
-
import { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
17
|
+
import { MerkleTreeId, PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
12
18
|
import { TreeSnapshots } from '@aztec/stdlib/tx';
|
|
13
19
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
14
20
|
import { promises as fs } from 'fs';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
21
|
+
import { buildBlockWithCleanDB } from '../block-factory/light.js';
|
|
22
|
+
import { getTreeSnapshot } from '../orchestrator/block-building-helpers.js';
|
|
17
23
|
import { ProvingOrchestrator } from '../orchestrator/index.js';
|
|
18
24
|
import { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
19
25
|
import { TestBroker } from '../test/mock_prover.js';
|
|
20
|
-
import { getEnvironmentConfig,
|
|
26
|
+
import { getEnvironmentConfig, getSimulator, makeCheckpointConstants, makeGlobals, updateExpectedTreesFromTxs } from './fixtures.js';
|
|
21
27
|
export class TestContext {
|
|
22
|
-
publicTxSimulator;
|
|
23
28
|
worldState;
|
|
24
|
-
|
|
29
|
+
firstCheckpointNumber;
|
|
25
30
|
globalVariables;
|
|
26
31
|
prover;
|
|
27
32
|
broker;
|
|
@@ -30,14 +35,12 @@ export class TestContext {
|
|
|
30
35
|
blockNumber;
|
|
31
36
|
feePayer;
|
|
32
37
|
directoriesToCleanup;
|
|
33
|
-
tester;
|
|
34
38
|
logger;
|
|
35
39
|
headers;
|
|
36
40
|
feePayerBalance;
|
|
37
|
-
constructor(
|
|
38
|
-
this.publicTxSimulator = publicTxSimulator;
|
|
41
|
+
constructor(worldState, firstCheckpointNumber, globalVariables, prover, broker, brokerProverFacade, orchestrator, blockNumber, feePayer, initialFeePayerBalance, directoriesToCleanup, logger){
|
|
39
42
|
this.worldState = worldState;
|
|
40
|
-
this.
|
|
43
|
+
this.firstCheckpointNumber = firstCheckpointNumber;
|
|
41
44
|
this.globalVariables = globalVariables;
|
|
42
45
|
this.prover = prover;
|
|
43
46
|
this.broker = broker;
|
|
@@ -46,7 +49,6 @@ export class TestContext {
|
|
|
46
49
|
this.blockNumber = blockNumber;
|
|
47
50
|
this.feePayer = feePayer;
|
|
48
51
|
this.directoriesToCleanup = directoriesToCleanup;
|
|
49
|
-
this.tester = tester;
|
|
50
52
|
this.logger = logger;
|
|
51
53
|
this.headers = new Map();
|
|
52
54
|
this.feePayerBalance = initialFeePayerBalance;
|
|
@@ -54,9 +56,13 @@ export class TestContext {
|
|
|
54
56
|
get epochProver() {
|
|
55
57
|
return this.orchestrator;
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
getCheckpointConstants(checkpointIndex = 0) {
|
|
60
|
+
return makeCheckpointConstants(this.firstCheckpointNumber.toNumber() + checkpointIndex);
|
|
61
|
+
}
|
|
62
|
+
static async new(logger, { proverCount = 4, createProver = async (bbConfig)=>new TestCircuitProver(await getSimulator(bbConfig, logger)), slotNumber = 1, blockNumber = 1 } = {}) {
|
|
58
63
|
const directoriesToCleanup = [];
|
|
59
|
-
const
|
|
64
|
+
const firstCheckpointNumber = new Fr(slotNumber);
|
|
65
|
+
const globalVariables = makeGlobals(blockNumber, slotNumber);
|
|
60
66
|
const feePayer = AztecAddress.fromNumber(42222);
|
|
61
67
|
const initialFeePayerBalance = new Fr(10n ** 20n);
|
|
62
68
|
const feePayerSlot = await computeFeePayerBalanceLeafSlot(feePayer);
|
|
@@ -64,13 +70,7 @@ export class TestContext {
|
|
|
64
70
|
new PublicDataTreeLeaf(feePayerSlot, initialFeePayerBalance)
|
|
65
71
|
];
|
|
66
72
|
// Separated dbs for public processor and prover - see public_processor for context
|
|
67
|
-
const ws = await NativeWorldStateService.tmp(
|
|
68
|
-
const publicDb = await ws.fork();
|
|
69
|
-
const contractDataSource = new SimpleContractDataSource();
|
|
70
|
-
const worldStateDB = new WorldStateDB(publicDb, contractDataSource);
|
|
71
|
-
const tester = new PublicTxSimulationTester(worldStateDB, contractDataSource, publicDb);
|
|
72
|
-
const publicTxSimulator = new PublicTxSimulator(publicDb, worldStateDB, globalVariables, true);
|
|
73
|
-
const processor = new PublicProcessor(publicDb, globalVariables, worldStateDB, publicTxSimulator, new TestDateProvider());
|
|
73
|
+
const ws = await NativeWorldStateService.tmp(/*rollupAddress=*/ undefined, /*cleanupTmpDir=*/ true, prefilledPublicData);
|
|
74
74
|
let localProver;
|
|
75
75
|
const config = await getEnvironmentConfig(logger);
|
|
76
76
|
if (!config) {
|
|
@@ -81,7 +81,9 @@ export class TestContext {
|
|
|
81
81
|
acvmWorkingDirectory: config.acvmWorkingDirectory,
|
|
82
82
|
bbBinaryPath: config.expectedBBPath,
|
|
83
83
|
bbWorkingDirectory: config.bbWorkingDirectory,
|
|
84
|
-
bbSkipCleanup: config.bbSkipCleanup
|
|
84
|
+
bbSkipCleanup: config.bbSkipCleanup,
|
|
85
|
+
numConcurrentIVCVerifiers: 2,
|
|
86
|
+
bbIVCConcurrency: 1
|
|
85
87
|
};
|
|
86
88
|
localProver = await createProver(bbConfig);
|
|
87
89
|
}
|
|
@@ -90,10 +92,10 @@ export class TestContext {
|
|
|
90
92
|
}
|
|
91
93
|
const broker = new TestBroker(proverCount, localProver);
|
|
92
94
|
const facade = new BrokerCircuitProverFacade(broker);
|
|
93
|
-
const orchestrator = new TestProvingOrchestrator(ws, facade,
|
|
95
|
+
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO);
|
|
94
96
|
await broker.start();
|
|
95
97
|
facade.start();
|
|
96
|
-
return new this(
|
|
98
|
+
return new this(ws, firstCheckpointNumber, globalVariables, localProver, broker, facade, orchestrator, blockNumber, feePayer, initialFeePayerBalance, directoriesToCleanup, logger);
|
|
97
99
|
}
|
|
98
100
|
getFork() {
|
|
99
101
|
return this.worldState.fork();
|
|
@@ -119,17 +121,15 @@ export class TestContext {
|
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
|
-
async makeProcessedTx(
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const blockNum = (opts?.globalVariables ?? this.globalVariables).blockNumber.toNumber();
|
|
127
|
-
const header = this.getBlockHeader(blockNum - 1);
|
|
124
|
+
async makeProcessedTx(opts) {
|
|
125
|
+
const globalVariables = opts?.globalVariables ?? this.globalVariables;
|
|
126
|
+
const blockNumber = globalVariables.blockNumber;
|
|
127
|
+
const header = opts?.header ?? this.getBlockHeader(blockNumber - 1);
|
|
128
128
|
const tx = await makeBloatedProcessedTx({
|
|
129
129
|
header,
|
|
130
130
|
vkTreeRoot: getVKTreeRoot(),
|
|
131
|
-
|
|
132
|
-
globalVariables
|
|
131
|
+
protocolContracts: ProtocolContractsList,
|
|
132
|
+
globalVariables,
|
|
133
133
|
feePayer: this.feePayer,
|
|
134
134
|
...opts
|
|
135
135
|
});
|
|
@@ -140,28 +140,89 @@ export class TestContext {
|
|
|
140
140
|
}
|
|
141
141
|
return tx;
|
|
142
142
|
}
|
|
143
|
-
/** Creates a block with the given number of txs and adds it to world-state */ async makePendingBlock(numTxs,
|
|
144
|
-
const
|
|
145
|
-
const
|
|
143
|
+
/** Creates a block with the given number of txs and adds it to world-state */ async makePendingBlock(numTxs, { checkpointIndex = 0, numL1ToL2Messages = 0, blockNumber = this.blockNumber, makeProcessedTxOpts = ()=>({}) } = {}) {
|
|
144
|
+
const slotNumber = this.firstCheckpointNumber.toNumber() + checkpointIndex;
|
|
145
|
+
const globalVariables = makeGlobals(blockNumber, slotNumber);
|
|
146
|
+
const blockNum = globalVariables.blockNumber;
|
|
146
147
|
const db = await this.worldState.fork();
|
|
147
|
-
const
|
|
148
|
+
const l1ToL2Messages = times(numL1ToL2Messages, (i)=>new Fr(blockNum * 100 + i));
|
|
149
|
+
const merkleTrees = await this.worldState.fork();
|
|
150
|
+
await merkleTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
151
|
+
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
148
152
|
const txs = await timesParallel(numTxs, (i)=>this.makeProcessedTx({
|
|
149
153
|
seed: i + blockNum * 1000,
|
|
150
154
|
globalVariables,
|
|
155
|
+
newL1ToL2Snapshot,
|
|
151
156
|
...makeProcessedTxOpts(i)
|
|
152
157
|
}));
|
|
153
158
|
await this.setTreeRoots(txs);
|
|
154
|
-
const block = await
|
|
155
|
-
this.headers.set(blockNum, block.
|
|
156
|
-
await this.worldState.handleL2BlockAndMessages(block,
|
|
159
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, l1ToL2Messages, db);
|
|
160
|
+
this.headers.set(blockNum, block.getBlockHeader());
|
|
161
|
+
await this.worldState.handleL2BlockAndMessages(block, l1ToL2Messages);
|
|
157
162
|
return {
|
|
158
163
|
block,
|
|
159
164
|
txs,
|
|
160
|
-
|
|
165
|
+
l1ToL2Messages
|
|
161
166
|
};
|
|
162
167
|
}
|
|
163
|
-
async
|
|
164
|
-
|
|
168
|
+
async makePendingBlocksInCheckpoint(numBlocks, { checkpointIndex = 0, numTxsPerBlock = 1, numL1ToL2Messages = 0, firstBlockNumber = this.blockNumber + checkpointIndex * numBlocks, makeGlobalVariablesOpts = ()=>({}), makeProcessedTxOpts = ()=>({}) } = {}) {
|
|
169
|
+
const slotNumber = this.firstCheckpointNumber.toNumber() + checkpointIndex;
|
|
170
|
+
const l1ToL2Messages = times(numL1ToL2Messages, (i)=>new Fr(slotNumber * 100 + i));
|
|
171
|
+
const merkleTrees = await this.worldState.fork();
|
|
172
|
+
await merkleTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
173
|
+
const newL1ToL2Snapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, merkleTrees);
|
|
174
|
+
const blockGlobalVariables = times(numBlocks, (i)=>makeGlobals(firstBlockNumber + i, slotNumber, makeGlobalVariablesOpts(firstBlockNumber + i, checkpointIndex)));
|
|
175
|
+
let totalTxs = 0;
|
|
176
|
+
const blockTxs = await timesParallel(numBlocks, (blockIndex)=>{
|
|
177
|
+
const txIndexOffset = totalTxs;
|
|
178
|
+
const numTxs = typeof numTxsPerBlock === 'number' ? numTxsPerBlock : numTxsPerBlock[blockIndex];
|
|
179
|
+
totalTxs += numTxs;
|
|
180
|
+
return timesParallel(numTxs, (txIndex)=>this.makeProcessedTx({
|
|
181
|
+
seed: (txIndexOffset + txIndex + 1) * 321 + (checkpointIndex + 1) * 123456,
|
|
182
|
+
globalVariables: blockGlobalVariables[blockIndex],
|
|
183
|
+
header: this.getBlockHeader(firstBlockNumber - 1),
|
|
184
|
+
newL1ToL2Snapshot,
|
|
185
|
+
...makeProcessedTxOpts(blockGlobalVariables[blockIndex], txIndexOffset + txIndex)
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
const blobFields = getCheckpointBlobFields(blockTxs.map((txs)=>txs.map((tx)=>tx.txEffect)));
|
|
189
|
+
const spongeBlobState = await SpongeBlob.init(blobFields.length);
|
|
190
|
+
const blocks = [];
|
|
191
|
+
for(let i = 0; i < numBlocks; i++){
|
|
192
|
+
const isFirstBlock = i === 0;
|
|
193
|
+
const blockNumber = firstBlockNumber + i;
|
|
194
|
+
const globalVariables = blockGlobalVariables[i];
|
|
195
|
+
const txs = blockTxs[i];
|
|
196
|
+
await this.setTreeRoots(txs);
|
|
197
|
+
const fork = await this.worldState.fork();
|
|
198
|
+
const blockMsgs = isFirstBlock ? l1ToL2Messages : [];
|
|
199
|
+
const block = await buildBlockWithCleanDB(txs, globalVariables, blockMsgs, fork, spongeBlobState, isFirstBlock);
|
|
200
|
+
const header = block.getBlockHeader();
|
|
201
|
+
this.headers.set(blockNumber, header);
|
|
202
|
+
await this.worldState.handleL2BlockAndMessages(block, blockMsgs, isFirstBlock);
|
|
203
|
+
const blockBlobFields = block.body.toBlobFields();
|
|
204
|
+
await spongeBlobState.absorb(blockBlobFields);
|
|
205
|
+
blocks.push({
|
|
206
|
+
header,
|
|
207
|
+
txs
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
blocks,
|
|
212
|
+
l1ToL2Messages,
|
|
213
|
+
blobFields
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
async processPublicFunctions(txs, { maxTransactions = txs.length, numL1ToL2Messages = 0, contractDataSource } = {}) {
|
|
217
|
+
const l1ToL2Messages = times(numL1ToL2Messages, (i)=>new Fr(this.blockNumber * 100 + i));
|
|
218
|
+
const merkleTrees = await this.worldState.fork();
|
|
219
|
+
await merkleTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
220
|
+
const processorFactory = new PublicProcessorFactory(contractDataSource ?? new SimpleContractDataSource(), new TestDateProvider());
|
|
221
|
+
const publicProcessor = processorFactory.create(merkleTrees, this.globalVariables, {
|
|
222
|
+
skipFeeEnforcement: false,
|
|
223
|
+
clientInitiatedSimulation: false
|
|
224
|
+
});
|
|
225
|
+
return await publicProcessor.process(txs, {
|
|
165
226
|
maxTransactions
|
|
166
227
|
});
|
|
167
228
|
}
|
|
@@ -174,8 +235,9 @@ export class TestContext {
|
|
|
174
235
|
]);
|
|
175
236
|
const endStateReference = await db.getStateReference();
|
|
176
237
|
if (tx.avmProvingRequest) {
|
|
177
|
-
tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots
|
|
178
|
-
tx.avmProvingRequest.inputs.publicInputs.
|
|
238
|
+
const l1ToL2MessageTree = tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots.l1ToL2MessageTree;
|
|
239
|
+
tx.avmProvingRequest.inputs.publicInputs.startTreeSnapshots = new TreeSnapshots(l1ToL2MessageTree, startStateReference.partial.noteHashTree, startStateReference.partial.nullifierTree, startStateReference.partial.publicDataTree);
|
|
240
|
+
tx.avmProvingRequest.inputs.publicInputs.endTreeSnapshots = new TreeSnapshots(l1ToL2MessageTree, endStateReference.partial.noteHashTree, endStateReference.partial.nullifierTree, endStateReference.partial.publicDataTree);
|
|
179
241
|
}
|
|
180
242
|
}
|
|
181
243
|
}
|
|
@@ -184,9 +246,9 @@ class TestProvingOrchestrator extends ProvingOrchestrator {
|
|
|
184
246
|
isVerifyBuiltBlockAgainstSyncedStateEnabled = false;
|
|
185
247
|
// Disable this check by default, since it requires seeding world state with the block being built
|
|
186
248
|
// This is only enabled in some tests with multiple blocks that populate the pending chain via makePendingBlock
|
|
187
|
-
verifyBuiltBlockAgainstSyncedState(
|
|
249
|
+
verifyBuiltBlockAgainstSyncedState(provingState) {
|
|
188
250
|
if (this.isVerifyBuiltBlockAgainstSyncedStateEnabled) {
|
|
189
|
-
return super.verifyBuiltBlockAgainstSyncedState(
|
|
251
|
+
return super.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
190
252
|
}
|
|
191
253
|
return Promise.resolve();
|
|
192
254
|
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { Blob, type SpongeBlob } from '@aztec/blob-lib';
|
|
1
|
+
import { BatchedBlobAccumulator, SpongeBlob } from '@aztec/blob-lib';
|
|
4
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import type
|
|
6
|
-
import { type Tuple } from '@aztec/foundation/serialize';
|
|
3
|
+
import { type Bufferable, type Tuple } from '@aztec/foundation/serialize';
|
|
7
4
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { type BaseOrMergeRollupPublicInputs, type BlockRootOrBlockMergePublicInputs, ConstantRollupData, PrivateBaseRollupHints, PublicBaseRollupHints } from '@aztec/stdlib/rollup';
|
|
5
|
+
import { Body, L2BlockHeader } from '@aztec/stdlib/block';
|
|
6
|
+
import type { MerkleTreeWriteOperations, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
7
|
+
import { ProofData, RecursiveProof } from '@aztec/stdlib/proofs';
|
|
8
|
+
import { BlockRollupPublicInputs, PrivateBaseRollupHints, PublicBaseRollupHints, PublicChonkVerifierPrivateInputs } from '@aztec/stdlib/rollup';
|
|
13
9
|
import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
14
|
-
import { BlockHeader,
|
|
10
|
+
import { BlockHeader, GlobalVariables, PartialStateReference, type ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
15
11
|
import type { MerkleTreeReadOperations } from '@aztec/world-state';
|
|
16
12
|
/**
|
|
17
13
|
* Type representing the names of the trees for the base rollup.
|
|
@@ -21,35 +17,48 @@ type BaseTreeNames = 'NoteHashTree' | 'ContractTree' | 'NullifierTree' | 'Public
|
|
|
21
17
|
* Type representing the names of the trees.
|
|
22
18
|
*/
|
|
23
19
|
export type TreeNames = BaseTreeNames | 'L1ToL2MessageTree' | 'Archive';
|
|
24
|
-
export declare const
|
|
25
|
-
export declare function
|
|
26
|
-
export declare
|
|
27
|
-
|
|
28
|
-
blobCommitments: [
|
|
29
|
-
blobs: Blob[];
|
|
20
|
+
export declare const insertSideEffectsAndBuildBaseRollupHints: (tx: ProcessedTx, lastArchive: AppendOnlyTreeSnapshot, newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot, startSpongeBlob: SpongeBlob, proverId: Fr, db: MerkleTreeWriteOperations) => Promise<PublicBaseRollupHints | PrivateBaseRollupHints>;
|
|
21
|
+
export declare function getChonkProofFromTx(tx: Tx | ProcessedTx): RecursiveProof<2084>;
|
|
22
|
+
export declare function getPublicChonkVerifierPrivateInputsFromTx(tx: Tx | ProcessedTx, proverId: Fr): PublicChonkVerifierPrivateInputs;
|
|
23
|
+
export declare const buildBlobHints: (blobFields: Fr[]) => {
|
|
24
|
+
blobCommitments: import("@aztec/foundation/fields").BLS12Point[];
|
|
25
|
+
blobs: import("@aztec/blob-lib").Blob[];
|
|
30
26
|
blobsHash: Fr;
|
|
27
|
+
};
|
|
28
|
+
export declare const buildBlobDataFromTxs: (txsPerCheckpoint: ProcessedTx[][]) => Promise<{
|
|
29
|
+
blobFieldsLengths: number[];
|
|
30
|
+
finalBlobChallenges: import("@aztec/blob-lib").FinalBlobBatchingChallenges;
|
|
31
31
|
}>;
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
|
|
32
|
+
export declare const buildFinalBlobChallenges: (blobFieldsPerCheckpoint: Fr[][]) => Promise<import("@aztec/blob-lib").FinalBlobBatchingChallenges>;
|
|
33
|
+
export declare const accumulateBlobs: (blobFields: Fr[], startBlobAccumulator: BatchedBlobAccumulator) => Promise<BatchedBlobAccumulator>;
|
|
34
|
+
export declare const buildHeaderFromCircuitOutputs: (blockRootRollupOutput: BlockRollupPublicInputs) => Promise<BlockHeader>;
|
|
35
|
+
export declare const buildHeaderAndBodyFromTxs: (txs: ProcessedTx[], globalVariables: GlobalVariables, l1ToL2Messages: Fr[], db: MerkleTreeReadOperations, startSpongeBlob?: SpongeBlob | undefined) => Promise<{
|
|
36
|
+
header: L2BlockHeader;
|
|
35
37
|
body: Body;
|
|
36
38
|
}>;
|
|
37
|
-
export declare
|
|
38
|
-
|
|
39
|
-
export declare
|
|
39
|
+
export declare const buildBlockHeaderFromTxs: (txs: ProcessedTx[], globalVariables: GlobalVariables, startSpongeBlob: SpongeBlob, db: MerkleTreeReadOperations) => Promise<BlockHeader>;
|
|
40
|
+
/** Computes the inHash for a block's ContentCommitment given its l1 to l2 messages. */
|
|
41
|
+
export declare function computeInHashFromL1ToL2Messages(unpaddedL1ToL2Messages: Fr[]): Promise<Fr>;
|
|
42
|
+
export declare function getLastSiblingPath<TID extends MerkleTreeId>(treeId: TID, db: MerkleTreeReadOperations): Promise<Tuple<Fr, {
|
|
43
|
+
readonly 1: 42;
|
|
44
|
+
readonly 4: 30;
|
|
45
|
+
readonly 3: 36;
|
|
46
|
+
readonly 0: 42;
|
|
47
|
+
readonly 2: 40;
|
|
48
|
+
}[TID]>>;
|
|
40
49
|
export declare function getRootTreeSiblingPath<TID extends MerkleTreeId>(treeId: TID, db: MerkleTreeReadOperations): Promise<Tuple<Fr, {
|
|
41
|
-
readonly 1:
|
|
42
|
-
readonly 4:
|
|
43
|
-
readonly 3:
|
|
44
|
-
readonly 0:
|
|
50
|
+
readonly 1: 42;
|
|
51
|
+
readonly 4: 30;
|
|
52
|
+
readonly 3: 36;
|
|
53
|
+
readonly 0: 42;
|
|
45
54
|
readonly 2: 40;
|
|
46
55
|
}[TID]>>;
|
|
47
|
-
export declare const getConstantRollupData: (globalVariables: GlobalVariables, db: MerkleTreeReadOperations) => Promise<ConstantRollupData>;
|
|
48
56
|
export declare function getTreeSnapshot(id: MerkleTreeId, db: MerkleTreeReadOperations): Promise<AppendOnlyTreeSnapshot>;
|
|
49
57
|
export declare function makeEmptyMembershipWitness<N extends number>(height: N): MembershipWitness<N>;
|
|
50
58
|
export declare function getSubtreeSiblingPath(treeId: MerkleTreeId, subtreeHeight: number, db: MerkleTreeReadOperations): Promise<Fr[]>;
|
|
51
59
|
export declare function getMembershipWitnessFor<N extends number>(value: Fr, treeId: MerkleTreeId, height: N, db: MerkleTreeReadOperations): Promise<MembershipWitness<N>>;
|
|
52
60
|
export declare function validatePartialState(partialState: PartialStateReference, treeSnapshots: Map<MerkleTreeId, AppendOnlyTreeSnapshot>): void;
|
|
53
61
|
export declare function validateTx(tx: ProcessedTx): void;
|
|
62
|
+
export declare function toProofData<T extends Bufferable, PROOF_LENGTH extends number>({ inputs, proof, verificationKey }: PublicInputsAndRecursiveProof<T, PROOF_LENGTH>, vkIndex?: number): ProofData<T, PROOF_LENGTH>;
|
|
54
63
|
export {};
|
|
55
64
|
//# sourceMappingURL=block-building-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block-building-helpers.d.ts","sourceRoot":"","sources":["../../src/orchestrator/block-building-helpers.ts"],"names":[],"mappings":"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"}
|