@aztec/prover-client 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1
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 +1 -1
- package/dest/block-factory/light.d.ts +5 -3
- package/dest/block-factory/light.d.ts.map +1 -1
- package/dest/block-factory/light.js +32 -11
- package/dest/config.d.ts +1 -1
- package/dest/config.js +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts +29 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +108 -0
- package/dest/mocks/fixtures.d.ts +5 -5
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +33 -15
- package/dest/mocks/test_context.d.ts +37 -33
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +124 -82
- package/dest/orchestrator/block-building-helpers.d.ts +35 -35
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +151 -187
- package/dest/orchestrator/block-proving-state.d.ts +68 -55
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +273 -185
- 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 +210 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +38 -31
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +128 -84
- package/dest/orchestrator/index.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +33 -32
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +369 -243
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -1
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- 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 +23 -29
- package/dest/prover-client/factory.d.ts +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.d.ts +13 -11
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +9 -9
- package/dest/proving_broker/broker_prover_facade.d.ts +23 -18
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +41 -25
- package/dest/proving_broker/config.d.ts +18 -14
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +13 -7
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/factory.js +1 -1
- package/dest/proving_broker/fixtures.d.ts +3 -2
- package/dest/proving_broker/fixtures.d.ts.map +1 -1
- package/dest/proving_broker/fixtures.js +3 -2
- package/dest/proving_broker/index.d.ts +1 -1
- package/dest/proving_broker/proof_store/factory.d.ts +2 -2
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.d.ts +2 -1
- 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/proof_store/inline_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +1 -1
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.d.ts +2 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +31 -19
- package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +8 -7
- package/dest/proving_broker/proving_broker_database.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.d.ts +3 -2
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +39 -19
- package/dest/proving_broker/rpc.d.ts +4 -4
- package/dest/test/mock_proof_store.d.ts +3 -3
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +23 -19
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +35 -20
- package/package.json +19 -19
- package/src/block-factory/light.ts +40 -17
- package/src/config.ts +1 -1
- package/src/light/lightweight_checkpoint_builder.ts +144 -0
- package/src/mocks/fixtures.ts +41 -36
- package/src/mocks/test_context.ts +188 -114
- package/src/orchestrator/block-building-helpers.ts +233 -313
- package/src/orchestrator/block-proving-state.ts +315 -247
- package/src/orchestrator/checkpoint-proving-state.ts +303 -0
- package/src/orchestrator/epoch-proving-state.ts +176 -129
- package/src/orchestrator/orchestrator.ts +554 -319
- package/src/orchestrator/tx-proving-state.ts +48 -55
- package/src/prover-client/server-epoch-prover.ts +30 -21
- package/src/proving_broker/broker_prover_facade.ts +175 -103
- package/src/proving_broker/config.ts +15 -8
- package/src/proving_broker/factory.ts +1 -1
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/proof_store/index.ts +1 -0
- package/src/proving_broker/proving_broker.ts +38 -19
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +10 -9
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_job_controller.ts +41 -20
- package/src/test/mock_prover.ts +142 -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/src/bin/get-proof-inputs.ts +0 -59
|
@@ -4,26 +4,22 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
4
4
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
}
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { padArrayEnd
|
|
7
|
+
import { L1_TO_L2_MSG_SUBTREE_HEIGHT, L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, NUM_BASE_PARITY_PER_ROOT_PARITY } from '@aztec/constants';
|
|
8
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
9
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
11
|
import { AbortError } from '@aztec/foundation/error';
|
|
11
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
12
12
|
import { createLogger } from '@aztec/foundation/log';
|
|
13
13
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
14
14
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
15
15
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
16
16
|
import { elapsed } from '@aztec/foundation/timer';
|
|
17
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
18
17
|
import { readAvmMinimalPublicTxInputsFromFile } from '@aztec/simulator/public/fixtures';
|
|
19
|
-
import {
|
|
20
|
-
import { BaseParityInputs } from '@aztec/stdlib/parity';
|
|
21
|
-
import { EmptyBlockRootRollupInputs, PrivateBaseRollupInputs, SingleTxBlockRootRollupInputs, TubeInputs } from '@aztec/stdlib/rollup';
|
|
18
|
+
import { BlockRootEmptyTxFirstRollupPrivateInputs, BlockRootFirstRollupPrivateInputs, BlockRootSingleTxFirstRollupPrivateInputs, BlockRootSingleTxRollupPrivateInputs, CheckpointRootSingleBlockRollupPrivateInputs, PrivateTxBaseRollupPrivateInputs } from '@aztec/stdlib/rollup';
|
|
22
19
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
23
|
-
import { toNumBlobFields } from '@aztec/stdlib/tx';
|
|
24
20
|
import { Attributes, getTelemetryClient, trackSpan, wrapCallbackInSpan } from '@aztec/telemetry-client';
|
|
25
21
|
import { inspect } from 'util';
|
|
26
|
-
import {
|
|
22
|
+
import { buildHeaderFromCircuitOutputs, getLastSiblingPath, getPublicChonkVerifierPrivateInputsFromTx, getRootTreeSiblingPath, getSubtreeSiblingPath, getTreeSnapshot, insertSideEffectsAndBuildBaseRollupHints, validatePartialState, validateTx } from './block-building-helpers.js';
|
|
27
23
|
import { EpochProvingState } from './epoch-proving-state.js';
|
|
28
24
|
import { ProvingOrchestratorMetrics } from './orchestrator_metrics.js';
|
|
29
25
|
import { TxProvingState } from './tx-proving-state.js';
|
|
@@ -47,6 +43,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
47
43
|
pendingProvingJobs;
|
|
48
44
|
provingPromise;
|
|
49
45
|
metrics;
|
|
46
|
+
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
50
47
|
dbs;
|
|
51
48
|
constructor(dbProvider, prover, proverId, telemetryClient = getTelemetryClient()){
|
|
52
49
|
this.dbProvider = dbProvider;
|
|
@@ -68,68 +65,115 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
68
65
|
this.cancel();
|
|
69
66
|
return Promise.resolve();
|
|
70
67
|
}
|
|
71
|
-
startNewEpoch(epochNumber,
|
|
68
|
+
startNewEpoch(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges) {
|
|
69
|
+
if (this.provingState?.verifyState()) {
|
|
70
|
+
throw new Error(`Cannot start epoch ${epochNumber} when epoch ${this.provingState.epochNumber} is still being processed.`);
|
|
71
|
+
}
|
|
72
72
|
const { promise: _promise, resolve, reject } = promiseWithResolvers();
|
|
73
73
|
const promise = _promise.catch((reason)=>({
|
|
74
74
|
status: 'failure',
|
|
75
75
|
reason
|
|
76
76
|
}));
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
logger.info(`Starting epoch ${epochNumber} with ${totalNumBlocks} blocks`);
|
|
81
|
-
this.provingState = new EpochProvingState(epochNumber, firstBlockNumber, totalNumBlocks, finalBlobBatchingChallenges, resolve, reject);
|
|
77
|
+
logger.info(`Starting epoch ${epochNumber} with ${totalNumCheckpoints} checkpoints.`);
|
|
78
|
+
this.provingState = new EpochProvingState(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges, (provingState)=>this.checkAndEnqueueCheckpointRootRollup(provingState), resolve, reject);
|
|
82
79
|
this.provingPromise = promise;
|
|
83
80
|
}
|
|
81
|
+
async startNewCheckpoint(checkpointIndex, constants, l1ToL2Messages, totalNumBlocks, headerOfLastBlockInPreviousCheckpoint) {
|
|
82
|
+
if (!this.provingState) {
|
|
83
|
+
throw new Error('Empty epoch proving state. Call startNewEpoch before starting a checkpoint.');
|
|
84
|
+
}
|
|
85
|
+
if (!this.provingState.isAcceptingCheckpoints()) {
|
|
86
|
+
throw new Error(`Epoch not accepting further checkpoints.`);
|
|
87
|
+
}
|
|
88
|
+
// Fork world state at the end of the immediately previous block.
|
|
89
|
+
const lastBlockNumber = headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber;
|
|
90
|
+
const db = await this.dbProvider.fork(lastBlockNumber);
|
|
91
|
+
const firstBlockNumber = BlockNumber(lastBlockNumber + 1);
|
|
92
|
+
this.dbs.set(firstBlockNumber, db);
|
|
93
|
+
// Get archive sibling path before any block in this checkpoint lands.
|
|
94
|
+
const lastArchiveSiblingPath = await getLastSiblingPath(MerkleTreeId.ARCHIVE, db);
|
|
95
|
+
// Insert all the l1 to l2 messages into the db. And get the states before and after the insertion.
|
|
96
|
+
const { lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath } = await this.updateL1ToL2MessageTree(l1ToL2Messages, db);
|
|
97
|
+
this.provingState.startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath);
|
|
98
|
+
}
|
|
84
99
|
/**
|
|
85
100
|
* Starts off a new block
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
*
|
|
89
|
-
|
|
101
|
+
* @param blockNumber - The block number
|
|
102
|
+
* @param timestamp - The timestamp of the block. This is only required for constructing the private inputs for the
|
|
103
|
+
* block that doesn't have any txs.
|
|
104
|
+
* @param totalNumTxs - The total number of txs in the block
|
|
105
|
+
*/ async startNewBlock(blockNumber, timestamp, totalNumTxs) {
|
|
90
106
|
if (!this.provingState) {
|
|
91
|
-
throw new Error(
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
throw new Error('Empty epoch proving state. Call startNewEpoch before starting a block.');
|
|
108
|
+
}
|
|
109
|
+
const checkpointProvingState = this.provingState.getCheckpointProvingStateByBlockNumber(blockNumber);
|
|
110
|
+
if (!checkpointProvingState) {
|
|
111
|
+
throw new Error(`Checkpoint not started. Call startNewCheckpoint first.`);
|
|
112
|
+
}
|
|
113
|
+
if (!checkpointProvingState.isAcceptingBlocks()) {
|
|
114
|
+
throw new Error(`Checkpoint not accepting further blocks.`);
|
|
115
|
+
}
|
|
116
|
+
const constants = checkpointProvingState.constants;
|
|
117
|
+
logger.info(`Starting block ${blockNumber} for slot ${constants.slotNumber}.`);
|
|
118
|
+
// Fork the db only when it's not already set. The db for the first block is set in `startNewCheckpoint`.
|
|
119
|
+
if (!this.dbs.has(blockNumber)) {
|
|
120
|
+
// Fork world state at the end of the immediately previous block
|
|
121
|
+
const db = await this.dbProvider.fork(BlockNumber(blockNumber - 1));
|
|
122
|
+
this.dbs.set(blockNumber, db);
|
|
123
|
+
}
|
|
124
|
+
const db = this.dbs.get(blockNumber);
|
|
125
|
+
// Get archive snapshot and sibling path before any txs in this block lands.
|
|
126
|
+
const lastArchiveTreeSnapshot = await getTreeSnapshot(MerkleTreeId.ARCHIVE, db);
|
|
127
|
+
const lastArchiveSiblingPath = await getRootTreeSiblingPath(MerkleTreeId.ARCHIVE, db);
|
|
128
|
+
const blockProvingState = checkpointProvingState.startNewBlock(blockNumber, timestamp, totalNumTxs, lastArchiveTreeSnapshot, lastArchiveSiblingPath);
|
|
129
|
+
// Enqueue base parity circuits for the first block in the checkpoint.
|
|
130
|
+
if (blockProvingState.index === 0) {
|
|
131
|
+
for(let i = 0; i < NUM_BASE_PARITY_PER_ROOT_PARITY; i++){
|
|
132
|
+
this.enqueueBaseParityCircuit(checkpointProvingState, blockProvingState, i);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Because `addTxs` won't be called for a block without txs, and that's where the sponge blob state is computed.
|
|
136
|
+
// We need to set its end sponge blob here, which will become the start sponge blob for the next block.
|
|
137
|
+
if (totalNumTxs === 0) {
|
|
138
|
+
const endState = await db.getStateReference();
|
|
139
|
+
blockProvingState.setEndState(endState);
|
|
140
|
+
const endSpongeBlob = blockProvingState.getStartSpongeBlob().clone();
|
|
141
|
+
const blockEndBlobFields = blockProvingState.getBlockEndBlobFields();
|
|
142
|
+
await endSpongeBlob.absorb(blockEndBlobFields);
|
|
143
|
+
blockProvingState.setEndSpongeBlob(endSpongeBlob);
|
|
144
|
+
// And also try to accumulate the blobs as far as we can:
|
|
145
|
+
await this.provingState.setBlobAccumulators();
|
|
110
146
|
}
|
|
111
147
|
}
|
|
112
148
|
/**
|
|
113
149
|
* The interface to add simulated transactions to the scheduler. This can only be called once per block.
|
|
114
150
|
* @param txs - The transactions to be proven
|
|
115
151
|
*/ async addTxs(txs) {
|
|
152
|
+
if (!this.provingState) {
|
|
153
|
+
throw new Error(`Empty epoch proving state. Call startNewEpoch before adding txs.`);
|
|
154
|
+
}
|
|
116
155
|
if (!txs.length) {
|
|
117
156
|
// To avoid an ugly throw below. If we require an empty block, we can just call setBlockCompleted
|
|
118
157
|
// on a block with no txs. We cannot do that here because we cannot find the blockNumber without any txs.
|
|
119
158
|
logger.warn(`Provided no txs to orchestrator addTxs.`);
|
|
120
159
|
return;
|
|
121
160
|
}
|
|
122
|
-
const blockNumber = txs[0].globalVariables.blockNumber;
|
|
123
|
-
const provingState = this.provingState
|
|
161
|
+
const blockNumber = BlockNumber(txs[0].globalVariables.blockNumber);
|
|
162
|
+
const provingState = this.provingState.getBlockProvingStateByBlockNumber(blockNumber);
|
|
124
163
|
if (!provingState) {
|
|
125
|
-
throw new Error(`
|
|
164
|
+
throw new Error(`Proving state for block ${blockNumber} not found. Call startNewBlock first.`);
|
|
126
165
|
}
|
|
127
|
-
if (provingState.totalNumTxs) {
|
|
166
|
+
if (provingState.totalNumTxs !== txs.length) {
|
|
167
|
+
throw new Error(`Block ${blockNumber} should be filled with ${provingState.totalNumTxs} txs. Received ${txs.length} txs.`);
|
|
168
|
+
}
|
|
169
|
+
if (!provingState.isAcceptingTxs()) {
|
|
128
170
|
throw new Error(`Block ${blockNumber} has been initialized with transactions.`);
|
|
129
171
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
172
|
+
logger.info(`Adding ${txs.length} transactions to block ${blockNumber}`);
|
|
173
|
+
const db = this.dbs.get(blockNumber);
|
|
174
|
+
const lastArchive = provingState.lastArchiveTreeSnapshot;
|
|
175
|
+
const newL1ToL2MessageTreeSnapshot = provingState.newL1ToL2MessageTreeSnapshot;
|
|
176
|
+
const spongeBlobState = provingState.getStartSpongeBlob().clone();
|
|
133
177
|
for (const tx of txs){
|
|
134
178
|
try {
|
|
135
179
|
if (!provingState.verifyState()) {
|
|
@@ -137,13 +181,21 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
137
181
|
}
|
|
138
182
|
validateTx(tx);
|
|
139
183
|
logger.info(`Received transaction: ${tx.hash}`);
|
|
140
|
-
const
|
|
141
|
-
const
|
|
184
|
+
const startSpongeBlob = spongeBlobState.clone();
|
|
185
|
+
const [hints, treeSnapshots] = await this.prepareBaseRollupInputs(tx, lastArchive, newL1ToL2MessageTreeSnapshot, startSpongeBlob, db);
|
|
186
|
+
if (!provingState.verifyState()) {
|
|
187
|
+
throw new Error(`Unable to add transaction, preparing base inputs failed`);
|
|
188
|
+
}
|
|
189
|
+
await spongeBlobState.absorb(tx.txEffect.toBlobFields());
|
|
190
|
+
const txProvingState = new TxProvingState(tx, hints, treeSnapshots, this.proverId.toField());
|
|
142
191
|
const txIndex = provingState.addNewTx(txProvingState);
|
|
143
|
-
this.getOrEnqueueTube(provingState, txIndex);
|
|
144
192
|
if (txProvingState.requireAvmProof) {
|
|
193
|
+
this.getOrEnqueueChonkVerifier(provingState, txIndex);
|
|
145
194
|
logger.debug(`Enqueueing public VM for tx ${txIndex}`);
|
|
146
195
|
this.enqueueVM(provingState, txIndex);
|
|
196
|
+
} else {
|
|
197
|
+
logger.debug(`Enqueueing base rollup for private-only tx ${txIndex}`);
|
|
198
|
+
this.enqueueBaseRollup(provingState, txIndex);
|
|
147
199
|
}
|
|
148
200
|
} catch (err) {
|
|
149
201
|
throw new Error(`Error adding transaction ${tx.hash.toString()} to block ${blockNumber}: ${err.message}`, {
|
|
@@ -151,21 +203,31 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
151
203
|
});
|
|
152
204
|
}
|
|
153
205
|
}
|
|
206
|
+
const endState = await db.getStateReference();
|
|
207
|
+
provingState.setEndState(endState);
|
|
208
|
+
const blockEndBlobFields = provingState.getBlockEndBlobFields();
|
|
209
|
+
await spongeBlobState.absorb(blockEndBlobFields);
|
|
210
|
+
provingState.setEndSpongeBlob(spongeBlobState);
|
|
211
|
+
// Txs have been added to the block. Now try to accumulate the blobs as far as we can:
|
|
212
|
+
await this.provingState.setBlobAccumulators();
|
|
154
213
|
}
|
|
155
214
|
/**
|
|
156
|
-
* Kickstarts
|
|
157
|
-
* Note that if the
|
|
158
|
-
*/
|
|
215
|
+
* Kickstarts chonk verifier circuits for the specified txs. These will be used during epoch proving.
|
|
216
|
+
* Note that if the chonk verifier circuits are not started this way, they will be started nontheless after processing.
|
|
217
|
+
*/ startChonkVerifierCircuits(txs) {
|
|
159
218
|
if (!this.provingState?.verifyState()) {
|
|
160
|
-
throw new Error(`
|
|
219
|
+
throw new Error(`Empty epoch proving state. call startNewEpoch before starting chonk verifier circuits.`);
|
|
161
220
|
}
|
|
162
|
-
|
|
221
|
+
const publicTxs = txs.filter((tx)=>tx.data.forPublic);
|
|
222
|
+
for (const tx of publicTxs){
|
|
163
223
|
const txHash = tx.getTxHash().toString();
|
|
164
|
-
const
|
|
224
|
+
const privateInputs = getPublicChonkVerifierPrivateInputsFromTx(tx, this.proverId.toField());
|
|
165
225
|
const tubeProof = promiseWithResolvers();
|
|
166
|
-
logger.debug(`Starting
|
|
167
|
-
this.
|
|
168
|
-
|
|
226
|
+
logger.debug(`Starting chonk verifier circuit for tx ${txHash}`);
|
|
227
|
+
this.doEnqueueChonkVerifier(txHash, privateInputs, (proof)=>{
|
|
228
|
+
tubeProof.resolve(proof);
|
|
229
|
+
});
|
|
230
|
+
this.provingState.cachedChonkVerifierProofs.set(txHash, tubeProof.promise);
|
|
169
231
|
}
|
|
170
232
|
return Promise.resolve();
|
|
171
233
|
}
|
|
@@ -177,57 +239,73 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
177
239
|
if (!provingState) {
|
|
178
240
|
throw new Error(`Block proving state for ${blockNumber} not found`);
|
|
179
241
|
}
|
|
180
|
-
if
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
242
|
+
// Abort with specific error for the block if there's one.
|
|
243
|
+
const error = provingState.getError();
|
|
244
|
+
if (error) {
|
|
245
|
+
throw new Error(`Block proving failed: ${error}`);
|
|
184
246
|
}
|
|
247
|
+
// Abort if the proving state is not valid due to errors occurred elsewhere.
|
|
185
248
|
if (!provingState.verifyState()) {
|
|
186
|
-
throw new Error(`
|
|
249
|
+
throw new Error(`Invalid proving state when completing block ${blockNumber}.`);
|
|
187
250
|
}
|
|
188
|
-
|
|
251
|
+
if (provingState.isAcceptingTxs()) {
|
|
252
|
+
throw new Error(`Block ${blockNumber} is still accepting txs. Call setBlockCompleted after all txs have been added.`);
|
|
253
|
+
}
|
|
254
|
+
// Given we've applied every change from this block, now assemble the block header:
|
|
189
255
|
logger.verbose(`Block ${blockNumber} completed. Assembling header.`);
|
|
190
|
-
await
|
|
191
|
-
logger.debug(`Accumulating blobs for ${blockNumber}`);
|
|
192
|
-
await this.provingState?.setBlobAccumulators(blockNumber);
|
|
193
|
-
// If the proofs were faster than the block building, then we need to try the block root rollup again here
|
|
194
|
-
await this.checkAndEnqueueBlockRootRollup(provingState);
|
|
195
|
-
return provingState.block;
|
|
196
|
-
}
|
|
197
|
-
/** Returns the block as built for a given index. */ getBlock(index) {
|
|
198
|
-
const block = this.provingState?.blocks[index]?.block;
|
|
199
|
-
if (!block) {
|
|
200
|
-
throw new Error(`Block at index ${index} not available`);
|
|
201
|
-
}
|
|
202
|
-
return block;
|
|
203
|
-
}
|
|
204
|
-
async buildBlock(provingState, expectedHeader) {
|
|
205
|
-
// Collect all new nullifiers, commitments, and contracts from all txs in this block to build body
|
|
206
|
-
const txs = provingState.allTxs.map((a)=>a.processedTx);
|
|
207
|
-
// Get db for this block
|
|
208
|
-
const db = this.dbs.get(provingState.blockNumber);
|
|
209
|
-
// Given we've applied every change from this block, now assemble the block header
|
|
210
|
-
// and update the archive tree, so we're ready to start processing the next block
|
|
211
|
-
const { header, body } = await buildHeaderAndBodyFromTxs(txs, provingState.globalVariables, provingState.newL1ToL2Messages, db);
|
|
256
|
+
const header = await provingState.buildBlockHeader();
|
|
212
257
|
if (expectedHeader && !header.equals(expectedHeader)) {
|
|
213
258
|
logger.error(`Block header mismatch: header=${header} expectedHeader=${expectedHeader}`);
|
|
214
259
|
throw new Error('Block header mismatch');
|
|
215
260
|
}
|
|
261
|
+
// Get db for this block
|
|
262
|
+
const db = this.dbs.get(provingState.blockNumber);
|
|
263
|
+
// Update the archive tree, so we're ready to start processing the next block:
|
|
216
264
|
logger.verbose(`Updating archive tree with block ${provingState.blockNumber} header ${(await header.hash()).toString()}`);
|
|
217
265
|
await db.updateArchive(header);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const l2Block = new L2Block(newArchive, header, body);
|
|
221
|
-
await this.verifyBuiltBlockAgainstSyncedState(l2Block, newArchive);
|
|
222
|
-
logger.verbose(`Orchestrator finalized block ${l2Block.number}`);
|
|
223
|
-
provingState.setBlock(l2Block);
|
|
266
|
+
await this.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
267
|
+
return header;
|
|
224
268
|
}
|
|
225
269
|
// Flagged as protected to disable in certain unit tests
|
|
226
|
-
async verifyBuiltBlockAgainstSyncedState(
|
|
227
|
-
const
|
|
270
|
+
async verifyBuiltBlockAgainstSyncedState(provingState) {
|
|
271
|
+
const builtBlockHeader = provingState.getBuiltBlockHeader();
|
|
272
|
+
if (!builtBlockHeader) {
|
|
273
|
+
logger.debug('Block header not built yet, skipping header check.');
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const output = provingState.getBlockRootRollupOutput();
|
|
277
|
+
if (!output) {
|
|
278
|
+
logger.debug('Block root rollup proof not built yet, skipping header check.');
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const header = await buildHeaderFromCircuitOutputs(output);
|
|
282
|
+
if (!(await header.hash()).equals(await builtBlockHeader.hash())) {
|
|
283
|
+
logger.error(`Block header mismatch.\nCircuit: ${inspect(header)}\nComputed: ${inspect(builtBlockHeader)}`);
|
|
284
|
+
provingState.reject(`Block header hash mismatch.`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
// Get db for this block
|
|
288
|
+
const blockNumber = provingState.blockNumber;
|
|
289
|
+
const db = this.dbs.get(blockNumber);
|
|
290
|
+
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, db);
|
|
291
|
+
const syncedArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.dbProvider.getSnapshot(blockNumber));
|
|
228
292
|
if (!syncedArchive.equals(newArchive)) {
|
|
229
|
-
|
|
293
|
+
logger.error(`Archive tree mismatch for block ${blockNumber}: world state synced to ${inspect(syncedArchive)} but built ${inspect(newArchive)}`);
|
|
294
|
+
provingState.reject(`Archive tree mismatch.`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const circuitArchive = output.newArchive;
|
|
298
|
+
if (!newArchive.equals(circuitArchive)) {
|
|
299
|
+
logger.error(`New archive mismatch.\nCircuit: ${output.newArchive}\nComputed: ${newArchive}`);
|
|
300
|
+
provingState.reject(`New archive mismatch.`);
|
|
301
|
+
return;
|
|
230
302
|
}
|
|
303
|
+
// TODO(palla/prover): This closes the fork only on the happy path. If this epoch orchestrator
|
|
304
|
+
// is aborted and never reaches this point, it will leak the fork. We need to add a global cleanup,
|
|
305
|
+
// but have to make sure it only runs once all operations are completed, otherwise some function here
|
|
306
|
+
// will attempt to access the fork after it was closed.
|
|
307
|
+
logger.debug(`Cleaning up world state fork for ${blockNumber}`);
|
|
308
|
+
void this.dbs.get(blockNumber)?.close().then(()=>this.dbs.delete(blockNumber)).catch((err)=>logger.error(`Error closing db for block ${blockNumber}`, err));
|
|
231
309
|
}
|
|
232
310
|
/**
|
|
233
311
|
* Cancel any further proving
|
|
@@ -247,14 +325,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
247
325
|
if (result.status === 'failure') {
|
|
248
326
|
throw new Error(`Epoch proving failed: ${result.reason}`);
|
|
249
327
|
}
|
|
250
|
-
|
|
251
|
-
// TODO(MW): EpochProvingState uses this.blocks.filter(b => !!b).length as total blocks, use this below:
|
|
252
|
-
const finalBlock = this.provingState.blocks[this.provingState.totalNumBlocks - 1];
|
|
253
|
-
if (!finalBlock || !finalBlock.endBlobAccumulator) {
|
|
254
|
-
throw new Error(`Epoch's final block not ready for finalize`);
|
|
255
|
-
}
|
|
256
|
-
const finalBatchedBlob = await finalBlock.endBlobAccumulator.finalize();
|
|
257
|
-
this.provingState.setFinalBatchedBlob(finalBatchedBlob);
|
|
328
|
+
await this.provingState.finalizeBatchedBlob();
|
|
258
329
|
const epochProofResult = this.provingState.getEpochProofResult();
|
|
259
330
|
pushTestData('epochProofResult', {
|
|
260
331
|
proof: epochProofResult.proof.toString(),
|
|
@@ -263,24 +334,12 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
263
334
|
return epochProofResult;
|
|
264
335
|
}
|
|
265
336
|
/**
|
|
266
|
-
* Starts the proving process for the given transaction and adds it to our state
|
|
267
|
-
* @param tx - The transaction whose proving we wish to commence
|
|
268
|
-
* @param provingState - The proving state being worked on
|
|
269
|
-
*/ async prepareTransaction(tx, provingState) {
|
|
270
|
-
const txInputs = await this.prepareBaseRollupInputs(provingState, tx);
|
|
271
|
-
if (!txInputs) {
|
|
272
|
-
// This should not be possible
|
|
273
|
-
throw new Error(`Unable to add transaction, preparing base inputs failed`);
|
|
274
|
-
}
|
|
275
|
-
return txInputs;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
337
|
* Enqueue a job to be scheduled
|
|
279
338
|
* @param provingState - The proving state object being operated on
|
|
280
339
|
* @param jobType - The type of job to be queued
|
|
281
340
|
* @param job - The actual job, returns a promise notifying of the job's completion
|
|
282
341
|
*/ deferredProving(provingState, request, callback) {
|
|
283
|
-
if (!provingState
|
|
342
|
+
if (!provingState.verifyState()) {
|
|
284
343
|
logger.debug(`Not enqueuing job, state no longer valid`);
|
|
285
344
|
return;
|
|
286
345
|
}
|
|
@@ -295,7 +354,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
295
354
|
return;
|
|
296
355
|
}
|
|
297
356
|
const result = await request(controller.signal);
|
|
298
|
-
if (!provingState
|
|
357
|
+
if (!provingState.verifyState()) {
|
|
299
358
|
logger.debug(`State no longer valid, discarding result`);
|
|
300
359
|
return;
|
|
301
360
|
}
|
|
@@ -323,31 +382,26 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
323
382
|
// let the callstack unwind before adding the job to the queue
|
|
324
383
|
setImmediate(()=>void safeJob());
|
|
325
384
|
}
|
|
326
|
-
async
|
|
385
|
+
async updateL1ToL2MessageTree(l1ToL2Messages, db) {
|
|
327
386
|
const l1ToL2MessagesPadded = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, 'Too many L1 to L2 messages');
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
const l1ToL2MessageSubtreeSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db), L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH);
|
|
387
|
+
const lastL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
388
|
+
const lastL1ToL2MessageSubtreeRootSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db), L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH);
|
|
331
389
|
// Update the local trees to include the new l1 to l2 messages
|
|
332
390
|
await db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
|
|
333
|
-
const
|
|
391
|
+
const newL1ToL2MessageTreeSnapshot = await getTreeSnapshot(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, db);
|
|
392
|
+
const newL1ToL2MessageSubtreeRootSiblingPath = assertLength(await getSubtreeSiblingPath(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, L1_TO_L2_MSG_SUBTREE_HEIGHT, db), L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH);
|
|
334
393
|
return {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
394
|
+
lastL1ToL2MessageTreeSnapshot,
|
|
395
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
396
|
+
newL1ToL2MessageTreeSnapshot,
|
|
397
|
+
newL1ToL2MessageSubtreeRootSiblingPath
|
|
339
398
|
};
|
|
340
399
|
}
|
|
341
400
|
// Updates the merkle trees for a transaction. The first enqueued job for a transaction
|
|
342
|
-
async prepareBaseRollupInputs(
|
|
343
|
-
if (!provingState.verifyState() || !provingState.spongeBlobState) {
|
|
344
|
-
logger.debug('Not preparing base rollup inputs, state invalid');
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const db = this.dbs.get(provingState.blockNumber);
|
|
401
|
+
async prepareBaseRollupInputs(tx, lastArchive, newL1ToL2MessageTreeSnapshot, startSpongeBlob, db) {
|
|
348
402
|
// We build the base rollup inputs using a mock proof and verification key.
|
|
349
|
-
// These will be overwritten later once we have proven the
|
|
350
|
-
const [ms, hints] = await elapsed(insertSideEffectsAndBuildBaseRollupHints(tx,
|
|
403
|
+
// These will be overwritten later once we have proven the chonk verifier circuit and any public kernels
|
|
404
|
+
const [ms, hints] = await elapsed(insertSideEffectsAndBuildBaseRollupHints(tx, lastArchive, newL1ToL2MessageTreeSnapshot, startSpongeBlob, this.proverId.toField(), db));
|
|
351
405
|
this.metrics.recordBaseRollupInputs(ms);
|
|
352
406
|
const promises = [
|
|
353
407
|
MerkleTreeId.NOTE_HASH_TREE,
|
|
@@ -363,10 +417,6 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
363
417
|
obj.key,
|
|
364
418
|
obj.value
|
|
365
419
|
]));
|
|
366
|
-
if (!provingState.verifyState()) {
|
|
367
|
-
logger.debug(`Discarding proving job, state no longer valid`);
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
420
|
return [
|
|
371
421
|
hints,
|
|
372
422
|
treeSnapshots
|
|
@@ -379,66 +429,71 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
379
429
|
logger.debug('Not running base rollup, state invalid');
|
|
380
430
|
return;
|
|
381
431
|
}
|
|
432
|
+
if (!provingState.tryStartProvingBase(txIndex)) {
|
|
433
|
+
logger.debug(`Base rollup for tx ${txIndex} already started.`);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
382
436
|
const txProvingState = provingState.getTxProvingState(txIndex);
|
|
383
437
|
const { processedTx } = txProvingState;
|
|
384
438
|
const { rollupType, inputs } = txProvingState.getBaseRollupTypeAndInputs();
|
|
385
439
|
logger.debug(`Enqueuing deferred proving base rollup for ${processedTx.hash.toString()}`);
|
|
386
|
-
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, `ProvingOrchestrator.prover.${inputs instanceof
|
|
440
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, `ProvingOrchestrator.prover.${inputs instanceof PrivateTxBaseRollupPrivateInputs ? 'getPrivateTxBaseRollupProof' : 'getPublicTxBaseRollupProof'}`, {
|
|
387
441
|
[Attributes.TX_HASH]: processedTx.hash.toString(),
|
|
388
442
|
[Attributes.PROTOCOL_CIRCUIT_NAME]: rollupType
|
|
389
443
|
}, (signal)=>{
|
|
390
|
-
if (inputs instanceof
|
|
391
|
-
return this.prover.
|
|
444
|
+
if (inputs instanceof PrivateTxBaseRollupPrivateInputs) {
|
|
445
|
+
return this.prover.getPrivateTxBaseRollupProof(inputs, signal, provingState.epochNumber);
|
|
392
446
|
} else {
|
|
393
|
-
return this.prover.
|
|
447
|
+
return this.prover.getPublicTxBaseRollupProof(inputs, signal, provingState.epochNumber);
|
|
394
448
|
}
|
|
395
|
-
}),
|
|
449
|
+
}), (result)=>{
|
|
396
450
|
logger.debug(`Completed proof for ${rollupType} for tx ${processedTx.hash.toString()}`);
|
|
397
|
-
validatePartialState(result.inputs.
|
|
451
|
+
validatePartialState(result.inputs.endTreeSnapshots, txProvingState.treeSnapshots);
|
|
398
452
|
const leafLocation = provingState.setBaseRollupProof(txIndex, result);
|
|
399
453
|
if (provingState.totalNumTxs === 1) {
|
|
400
|
-
|
|
454
|
+
this.checkAndEnqueueBlockRootRollup(provingState);
|
|
401
455
|
} else {
|
|
402
|
-
|
|
456
|
+
this.checkAndEnqueueNextMergeRollup(provingState, leafLocation);
|
|
403
457
|
}
|
|
404
458
|
});
|
|
405
459
|
}
|
|
406
|
-
// Enqueues the
|
|
407
|
-
// Once completed, will enqueue the
|
|
408
|
-
|
|
460
|
+
// Enqueues the public chonk verifier circuit for a given transaction index, or reuses the one already enqueued.
|
|
461
|
+
// Once completed, will enqueue the the public tx base rollup.
|
|
462
|
+
getOrEnqueueChonkVerifier(provingState, txIndex) {
|
|
409
463
|
if (!provingState.verifyState()) {
|
|
410
|
-
logger.debug('Not running
|
|
464
|
+
logger.debug('Not running chonk verifier circuit, state invalid');
|
|
411
465
|
return;
|
|
412
466
|
}
|
|
413
467
|
const txProvingState = provingState.getTxProvingState(txIndex);
|
|
414
468
|
const txHash = txProvingState.processedTx.hash.toString();
|
|
469
|
+
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH;
|
|
415
470
|
const handleResult = (result)=>{
|
|
416
|
-
logger.debug(`Got
|
|
471
|
+
logger.debug(`Got chonk verifier proof for tx index: ${txIndex}`, {
|
|
417
472
|
txHash
|
|
418
473
|
});
|
|
419
|
-
txProvingState.
|
|
420
|
-
this.provingState?.
|
|
421
|
-
this.
|
|
474
|
+
txProvingState.setPublicChonkVerifierProof(result);
|
|
475
|
+
this.provingState?.cachedChonkVerifierProofs.delete(txHash);
|
|
476
|
+
this.checkAndEnqueueBaseRollup(provingState, txIndex);
|
|
422
477
|
};
|
|
423
|
-
if (this.provingState?.
|
|
424
|
-
logger.debug(`
|
|
478
|
+
if (this.provingState?.cachedChonkVerifierProofs.has(txHash)) {
|
|
479
|
+
logger.debug(`Chonk verifier proof already enqueued for tx index: ${txIndex}`, {
|
|
425
480
|
txHash
|
|
426
481
|
});
|
|
427
|
-
void this.provingState.
|
|
482
|
+
void this.provingState.cachedChonkVerifierProofs.get(txHash).then(handleResult);
|
|
428
483
|
return;
|
|
429
484
|
}
|
|
430
|
-
logger.debug(`Enqueuing
|
|
431
|
-
this.
|
|
485
|
+
logger.debug(`Enqueuing chonk verifier circuit for tx index: ${txIndex}`);
|
|
486
|
+
this.doEnqueueChonkVerifier(txHash, txProvingState.getPublicChonkVerifierPrivateInputs(), handleResult);
|
|
432
487
|
}
|
|
433
|
-
|
|
434
|
-
if (!provingState
|
|
435
|
-
logger.debug('Not running
|
|
488
|
+
doEnqueueChonkVerifier(txHash, inputs, handler, provingState = this.provingState) {
|
|
489
|
+
if (!provingState.verifyState()) {
|
|
490
|
+
logger.debug('Not running chonk verifier circuit, state invalid');
|
|
436
491
|
return;
|
|
437
492
|
}
|
|
438
|
-
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.
|
|
493
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getPublicChonkVerifierProof', {
|
|
439
494
|
[Attributes.TX_HASH]: txHash,
|
|
440
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: '
|
|
441
|
-
}, (signal)=>this.prover.
|
|
495
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'chonk-verifier-public'
|
|
496
|
+
}, (signal)=>this.prover.getPublicChonkVerifierProof(inputs, signal, provingState.epochNumber)), handler);
|
|
442
497
|
}
|
|
443
498
|
// Executes the merge rollup circuit and stored the output as intermediate state for the parent merge/block root circuit
|
|
444
499
|
// Enqueues the next level of merge if all inputs are available
|
|
@@ -447,74 +502,73 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
447
502
|
logger.debug('Not running merge rollup. State no longer valid.');
|
|
448
503
|
return;
|
|
449
504
|
}
|
|
505
|
+
if (!provingState.tryStartProvingMerge(location)) {
|
|
506
|
+
logger.debug('Merge rollup already started.');
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
450
509
|
const inputs = provingState.getMergeRollupInputs(location);
|
|
451
|
-
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.
|
|
452
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'merge
|
|
453
|
-
}, (signal)=>this.prover.
|
|
510
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getTxMergeRollupProof', {
|
|
511
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'rollup-tx-merge'
|
|
512
|
+
}, (signal)=>this.prover.getTxMergeRollupProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
454
513
|
provingState.setMergeRollupProof(location, result);
|
|
455
|
-
|
|
514
|
+
this.checkAndEnqueueNextMergeRollup(provingState, location);
|
|
456
515
|
});
|
|
457
516
|
}
|
|
458
517
|
// Executes the block root rollup circuit
|
|
459
|
-
|
|
518
|
+
enqueueBlockRootRollup(provingState) {
|
|
460
519
|
if (!provingState.verifyState()) {
|
|
461
520
|
logger.debug('Not running block root rollup, state no longer valid');
|
|
462
521
|
return;
|
|
463
522
|
}
|
|
464
|
-
provingState.
|
|
465
|
-
|
|
466
|
-
|
|
523
|
+
if (!provingState.tryStartProvingBlockRoot()) {
|
|
524
|
+
logger.debug('Block root rollup already started.');
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const { rollupType, inputs } = provingState.getBlockRootRollupTypeAndInputs();
|
|
528
|
+
logger.debug(`Enqueuing ${rollupType} for block ${provingState.blockNumber}.`);
|
|
467
529
|
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getBlockRootRollupProof', {
|
|
468
530
|
[Attributes.PROTOCOL_CIRCUIT_NAME]: rollupType
|
|
469
531
|
}, (signal)=>{
|
|
470
|
-
if (inputs instanceof
|
|
471
|
-
return this.prover.
|
|
472
|
-
} else if (inputs instanceof
|
|
473
|
-
return this.prover.
|
|
532
|
+
if (inputs instanceof BlockRootFirstRollupPrivateInputs) {
|
|
533
|
+
return this.prover.getBlockRootFirstRollupProof(inputs, signal, provingState.epochNumber);
|
|
534
|
+
} else if (inputs instanceof BlockRootSingleTxFirstRollupPrivateInputs) {
|
|
535
|
+
return this.prover.getBlockRootSingleTxFirstRollupProof(inputs, signal, provingState.epochNumber);
|
|
536
|
+
} else if (inputs instanceof BlockRootEmptyTxFirstRollupPrivateInputs) {
|
|
537
|
+
return this.prover.getBlockRootEmptyTxFirstRollupProof(inputs, signal, provingState.epochNumber);
|
|
538
|
+
} else if (inputs instanceof BlockRootSingleTxRollupPrivateInputs) {
|
|
539
|
+
return this.prover.getBlockRootSingleTxRollupProof(inputs, signal, provingState.epochNumber);
|
|
474
540
|
} else {
|
|
475
541
|
return this.prover.getBlockRootRollupProof(inputs, signal, provingState.epochNumber);
|
|
476
542
|
}
|
|
477
543
|
}), async (result)=>{
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
const circuitArchiveRoot = result.inputs.newArchive.root;
|
|
486
|
-
if (!dbArchiveRoot.equals(circuitArchiveRoot)) {
|
|
487
|
-
logger.error(`New archive root mismatch.\nCircuit: ${result.inputs.newArchive.root}\nComputed: ${dbArchiveRoot}`);
|
|
488
|
-
provingState.reject(`New archive root mismatch.`);
|
|
489
|
-
}
|
|
490
|
-
const endBlobAccumulatorPublicInputs = BlobAccumulatorPublicInputs.fromBatchedBlobAccumulator(provingState.endBlobAccumulator);
|
|
491
|
-
const circuitEndBlobAccumulatorState = result.inputs.blobPublicInputs.endBlobAccumulator;
|
|
492
|
-
if (!circuitEndBlobAccumulatorState.equals(endBlobAccumulatorPublicInputs)) {
|
|
493
|
-
logger.error(`Blob accumulator state mismatch.\nCircuit: ${inspect(circuitEndBlobAccumulatorState)}\nComputed: ${inspect(endBlobAccumulatorPublicInputs)}`);
|
|
494
|
-
provingState.reject(`Blob accumulator state mismatch.`);
|
|
495
|
-
}
|
|
496
|
-
logger.debug(`Completed ${rollupType} proof for block ${provingState.block.number}`);
|
|
497
|
-
// validatePartialState(result.inputs.end, tx.treeSnapshots); // TODO(palla/prover)
|
|
498
|
-
const epochProvingState = this.provingState;
|
|
499
|
-
const leafLocation = epochProvingState.setBlockRootRollupProof(provingState.index, result);
|
|
500
|
-
if (epochProvingState.totalNumBlocks === 1) {
|
|
501
|
-
this.enqueueEpochPadding(epochProvingState);
|
|
544
|
+
// If the proofs were slower than the block header building, then we need to try validating the block header hashes here.
|
|
545
|
+
await this.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
546
|
+
logger.debug(`Completed ${rollupType} proof for block ${provingState.blockNumber}`);
|
|
547
|
+
const leafLocation = provingState.setBlockRootRollupProof(result);
|
|
548
|
+
const checkpointProvingState = provingState.parentCheckpoint;
|
|
549
|
+
if (checkpointProvingState.totalNumBlocks === 1) {
|
|
550
|
+
this.checkAndEnqueueCheckpointRootRollup(checkpointProvingState);
|
|
502
551
|
} else {
|
|
503
|
-
this.checkAndEnqueueNextBlockMergeRollup(
|
|
552
|
+
this.checkAndEnqueueNextBlockMergeRollup(checkpointProvingState, leafLocation);
|
|
504
553
|
}
|
|
505
554
|
});
|
|
506
555
|
}
|
|
507
556
|
// Executes the base parity circuit and stores the intermediate state for the root parity circuit
|
|
508
557
|
// Enqueues the root parity circuit if all inputs are available
|
|
509
|
-
enqueueBaseParityCircuit(
|
|
558
|
+
enqueueBaseParityCircuit(checkpointProvingState, provingState, baseParityIndex) {
|
|
510
559
|
if (!provingState.verifyState()) {
|
|
511
560
|
logger.debug('Not running base parity. State no longer valid.');
|
|
512
561
|
return;
|
|
513
562
|
}
|
|
563
|
+
if (!provingState.tryStartProvingBaseParity(baseParityIndex)) {
|
|
564
|
+
logger.warn(`Base parity ${baseParityIndex} already started.`);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const inputs = checkpointProvingState.getBaseParityInputs(baseParityIndex);
|
|
514
568
|
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getBaseParityProof', {
|
|
515
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'base
|
|
569
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-base'
|
|
516
570
|
}, (signal)=>this.prover.getBaseParityProof(inputs, signal, provingState.epochNumber)), (provingOutput)=>{
|
|
517
|
-
provingState.setBaseParityProof(
|
|
571
|
+
provingState.setBaseParityProof(baseParityIndex, provingOutput);
|
|
518
572
|
this.checkAndEnqueueRootParityCircuit(provingState);
|
|
519
573
|
});
|
|
520
574
|
}
|
|
@@ -531,12 +585,16 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
531
585
|
logger.debug('Not running root parity. State no longer valid.');
|
|
532
586
|
return;
|
|
533
587
|
}
|
|
534
|
-
|
|
588
|
+
if (!provingState.tryStartProvingRootParity()) {
|
|
589
|
+
logger.debug('Root parity already started.');
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const inputs = provingState.getParityRootInputs();
|
|
535
593
|
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getRootParityProof', {
|
|
536
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'root
|
|
537
|
-
}, (signal)=>this.prover.getRootParityProof(inputs, signal, provingState.epochNumber)),
|
|
594
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'parity-root'
|
|
595
|
+
}, (signal)=>this.prover.getRootParityProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
538
596
|
provingState.setRootParityProof(result);
|
|
539
|
-
|
|
597
|
+
this.checkAndEnqueueBlockRootRollup(provingState);
|
|
540
598
|
});
|
|
541
599
|
}
|
|
542
600
|
// Executes the block merge rollup circuit and stored the output as intermediate state for the parent merge/block root circuit
|
|
@@ -546,26 +604,90 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
546
604
|
logger.debug('Not running block merge rollup. State no longer valid.');
|
|
547
605
|
return;
|
|
548
606
|
}
|
|
607
|
+
if (!provingState.tryStartProvingBlockMerge(location)) {
|
|
608
|
+
logger.debug('Block merge rollup already started.');
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
549
611
|
const inputs = provingState.getBlockMergeRollupInputs(location);
|
|
550
612
|
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getBlockMergeRollupProof', {
|
|
551
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'block-merge
|
|
613
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'rollup-block-merge'
|
|
552
614
|
}, (signal)=>this.prover.getBlockMergeRollupProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
553
615
|
provingState.setBlockMergeRollupProof(location, result);
|
|
554
616
|
this.checkAndEnqueueNextBlockMergeRollup(provingState, location);
|
|
555
617
|
});
|
|
556
618
|
}
|
|
619
|
+
enqueueCheckpointRootRollup(provingState) {
|
|
620
|
+
if (!provingState.verifyState()) {
|
|
621
|
+
logger.debug('Not running checkpoint root rollup. State no longer valid.');
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (!provingState.tryStartProvingCheckpointRoot()) {
|
|
625
|
+
logger.debug('Checkpoint root rollup already started.');
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
const rollupType = provingState.getCheckpointRootRollupType();
|
|
629
|
+
logger.debug(`Enqueuing ${rollupType} for checkpoint ${provingState.index}.`);
|
|
630
|
+
const inputs = provingState.getCheckpointRootRollupInputs();
|
|
631
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getCheckpointRootRollupProof', {
|
|
632
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: rollupType
|
|
633
|
+
}, (signal)=>{
|
|
634
|
+
if (inputs instanceof CheckpointRootSingleBlockRollupPrivateInputs) {
|
|
635
|
+
return this.prover.getCheckpointRootSingleBlockRollupProof(inputs, signal, provingState.epochNumber);
|
|
636
|
+
} else {
|
|
637
|
+
return this.prover.getCheckpointRootRollupProof(inputs, signal, provingState.epochNumber);
|
|
638
|
+
}
|
|
639
|
+
}), (result)=>{
|
|
640
|
+
const computedEndBlobAccumulatorState = provingState.getEndBlobAccumulator().toBlobAccumulator();
|
|
641
|
+
const circuitEndBlobAccumulatorState = result.inputs.endBlobAccumulator;
|
|
642
|
+
if (!circuitEndBlobAccumulatorState.equals(computedEndBlobAccumulatorState)) {
|
|
643
|
+
logger.error(`Blob accumulator state mismatch.\nCircuit: ${inspect(circuitEndBlobAccumulatorState)}\nComputed: ${inspect(computedEndBlobAccumulatorState)}`);
|
|
644
|
+
provingState.reject(`Blob accumulator state mismatch.`);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
logger.debug(`Completed ${rollupType} proof for checkpoint ${provingState.index}.`);
|
|
648
|
+
const leafLocation = provingState.setCheckpointRootRollupProof(result);
|
|
649
|
+
const epochProvingState = provingState.parentEpoch;
|
|
650
|
+
if (epochProvingState.totalNumCheckpoints === 1) {
|
|
651
|
+
this.enqueueEpochPadding(epochProvingState);
|
|
652
|
+
} else {
|
|
653
|
+
this.checkAndEnqueueNextCheckpointMergeRollup(epochProvingState, leafLocation);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
enqueueCheckpointMergeRollup(provingState, location) {
|
|
658
|
+
if (!provingState.verifyState()) {
|
|
659
|
+
logger.debug('Not running checkpoint merge rollup. State no longer valid.');
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (!provingState.tryStartProvingCheckpointMerge(location)) {
|
|
663
|
+
logger.debug('Checkpoint merge rollup already started.');
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
const inputs = provingState.getCheckpointMergeRollupInputs(location);
|
|
667
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getCheckpointMergeRollupProof', {
|
|
668
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'rollup-checkpoint-merge'
|
|
669
|
+
}, (signal)=>this.prover.getCheckpointMergeRollupProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
670
|
+
logger.debug('Completed proof for checkpoint merge rollup.');
|
|
671
|
+
provingState.setCheckpointMergeRollupProof(location, result);
|
|
672
|
+
this.checkAndEnqueueNextCheckpointMergeRollup(provingState, location);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
557
675
|
enqueueEpochPadding(provingState) {
|
|
558
676
|
if (!provingState.verifyState()) {
|
|
559
677
|
logger.debug('Not running epoch padding. State no longer valid.');
|
|
560
678
|
return;
|
|
561
679
|
}
|
|
680
|
+
if (!provingState.tryStartProvingPaddingCheckpoint()) {
|
|
681
|
+
logger.debug('Padding checkpoint already started.');
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
562
684
|
logger.debug('Padding epoch proof with a padding block root proof.');
|
|
563
|
-
const inputs = provingState.
|
|
564
|
-
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.
|
|
565
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: '
|
|
566
|
-
}, (signal)=>this.prover.
|
|
567
|
-
logger.debug('Completed proof for padding
|
|
568
|
-
provingState.
|
|
685
|
+
const inputs = provingState.getPaddingCheckpointInputs();
|
|
686
|
+
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getCheckpointPaddingRollupProof', {
|
|
687
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'rollup-checkpoint-padding'
|
|
688
|
+
}, (signal)=>this.prover.getCheckpointPaddingRollupProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
689
|
+
logger.debug('Completed proof for padding checkpoint.');
|
|
690
|
+
provingState.setCheckpointPaddingProof(result);
|
|
569
691
|
this.checkAndEnqueueRootRollup(provingState);
|
|
570
692
|
});
|
|
571
693
|
}
|
|
@@ -578,7 +700,7 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
578
700
|
logger.debug(`Preparing root rollup`);
|
|
579
701
|
const inputs = provingState.getRootRollupInputs();
|
|
580
702
|
this.deferredProving(provingState, wrapCallbackInSpan(this.tracer, 'ProvingOrchestrator.prover.getRootRollupProof', {
|
|
581
|
-
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'root
|
|
703
|
+
[Attributes.PROTOCOL_CIRCUIT_NAME]: 'rollup-root'
|
|
582
704
|
}, (signal)=>this.prover.getRootRollupProof(inputs, signal, provingState.epochNumber)), (result)=>{
|
|
583
705
|
logger.verbose(`Orchestrator completed root rollup for epoch ${provingState.epochNumber}`);
|
|
584
706
|
provingState.setRootRollupProof(result);
|
|
@@ -587,36 +709,23 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
587
709
|
});
|
|
588
710
|
});
|
|
589
711
|
}
|
|
590
|
-
|
|
712
|
+
checkAndEnqueueNextMergeRollup(provingState, currentLocation) {
|
|
591
713
|
if (!provingState.isReadyForMergeRollup(currentLocation)) {
|
|
592
714
|
return;
|
|
593
715
|
}
|
|
594
716
|
const parentLocation = provingState.getParentLocation(currentLocation);
|
|
595
717
|
if (parentLocation.level === 0) {
|
|
596
|
-
|
|
718
|
+
this.checkAndEnqueueBlockRootRollup(provingState);
|
|
597
719
|
} else {
|
|
598
720
|
this.enqueueMergeRollup(provingState, parentLocation);
|
|
599
721
|
}
|
|
600
722
|
}
|
|
601
|
-
|
|
602
|
-
const blockNumber = provingState.blockNumber;
|
|
603
|
-
// Accumulate as far as we can, in case blocks came in out of order and we are behind:
|
|
604
|
-
await this.provingState?.setBlobAccumulators(blockNumber);
|
|
723
|
+
checkAndEnqueueBlockRootRollup(provingState) {
|
|
605
724
|
if (!provingState.isReadyForBlockRootRollup()) {
|
|
606
725
|
logger.debug('Not ready for block root rollup');
|
|
607
726
|
return;
|
|
608
727
|
}
|
|
609
|
-
|
|
610
|
-
logger.debug('Block root rollup already started');
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
// TODO(palla/prover): This closes the fork only on the happy path. If this epoch orchestrator
|
|
614
|
-
// is aborted and never reaches this point, it will leak the fork. We need to add a global cleanup,
|
|
615
|
-
// but have to make sure it only runs once all operations are completed, otherwise some function here
|
|
616
|
-
// will attempt to access the fork after it was closed.
|
|
617
|
-
logger.debug(`Cleaning up world state fork for ${blockNumber}`);
|
|
618
|
-
void this.dbs.get(blockNumber)?.close().then(()=>this.dbs.delete(blockNumber)).catch((err)=>logger.error(`Error closing db for block ${blockNumber}`, err));
|
|
619
|
-
await this.enqueueBlockRootRollup(provingState);
|
|
728
|
+
this.enqueueBlockRootRollup(provingState);
|
|
620
729
|
}
|
|
621
730
|
checkAndEnqueueNextBlockMergeRollup(provingState, currentLocation) {
|
|
622
731
|
if (!provingState.isReadyForBlockMerge(currentLocation)) {
|
|
@@ -624,11 +733,28 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
624
733
|
}
|
|
625
734
|
const parentLocation = provingState.getParentLocation(currentLocation);
|
|
626
735
|
if (parentLocation.level === 0) {
|
|
627
|
-
this.
|
|
736
|
+
this.checkAndEnqueueCheckpointRootRollup(provingState);
|
|
628
737
|
} else {
|
|
629
738
|
this.enqueueBlockMergeRollup(provingState, parentLocation);
|
|
630
739
|
}
|
|
631
740
|
}
|
|
741
|
+
checkAndEnqueueCheckpointRootRollup(provingState) {
|
|
742
|
+
if (!provingState.isReadyForCheckpointRoot()) {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
this.enqueueCheckpointRootRollup(provingState);
|
|
746
|
+
}
|
|
747
|
+
checkAndEnqueueNextCheckpointMergeRollup(provingState, currentLocation) {
|
|
748
|
+
if (!provingState.isReadyForCheckpointMerge(currentLocation)) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
const parentLocation = provingState.getParentLocation(currentLocation);
|
|
752
|
+
if (parentLocation.level === 0) {
|
|
753
|
+
this.checkAndEnqueueRootRollup(provingState);
|
|
754
|
+
} else {
|
|
755
|
+
this.enqueueCheckpointMergeRollup(provingState, parentLocation);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
632
758
|
checkAndEnqueueRootRollup(provingState) {
|
|
633
759
|
if (!provingState.isReadyForRootRollup()) {
|
|
634
760
|
logger.debug('Not ready for root rollup');
|
|
@@ -678,22 +804,22 @@ const logger = createLogger('prover-client:orchestrator');
|
|
|
678
804
|
this.deferredProving(provingState, doAvmProving, (proofAndVk)=>{
|
|
679
805
|
logger.debug(`Proven VM for tx index: ${txIndex}`);
|
|
680
806
|
txProvingState.setAvmProof(proofAndVk);
|
|
681
|
-
this.
|
|
807
|
+
this.checkAndEnqueueBaseRollup(provingState, txIndex);
|
|
682
808
|
});
|
|
683
809
|
}
|
|
684
|
-
|
|
810
|
+
checkAndEnqueueBaseRollup(provingState, txIndex) {
|
|
685
811
|
const txProvingState = provingState.getTxProvingState(txIndex);
|
|
686
812
|
if (!txProvingState.ready()) {
|
|
687
813
|
return;
|
|
688
814
|
}
|
|
689
|
-
// We must have completed all proving (
|
|
815
|
+
// We must have completed all proving (chonk verifier proof and (if required) vm proof are generated), we now move to the base rollup.
|
|
690
816
|
logger.debug(`Public functions completed for tx ${txIndex} enqueueing base rollup`);
|
|
691
817
|
this.enqueueBaseRollup(provingState, txIndex);
|
|
692
818
|
}
|
|
693
819
|
}
|
|
694
820
|
_ts_decorate([
|
|
695
|
-
trackSpan('ProvingOrchestrator.startNewBlock', (
|
|
696
|
-
[Attributes.BLOCK_NUMBER]:
|
|
821
|
+
trackSpan('ProvingOrchestrator.startNewBlock', (blockNumber)=>({
|
|
822
|
+
[Attributes.BLOCK_NUMBER]: blockNumber
|
|
697
823
|
}))
|
|
698
824
|
], ProvingOrchestrator.prototype, "startNewBlock", null);
|
|
699
825
|
_ts_decorate([
|
|
@@ -702,15 +828,15 @@ _ts_decorate([
|
|
|
702
828
|
}))
|
|
703
829
|
], ProvingOrchestrator.prototype, "addTxs", null);
|
|
704
830
|
_ts_decorate([
|
|
705
|
-
trackSpan('ProvingOrchestrator.
|
|
706
|
-
], ProvingOrchestrator.prototype, "
|
|
831
|
+
trackSpan('ProvingOrchestrator.startChonkVerifierCircuits')
|
|
832
|
+
], ProvingOrchestrator.prototype, "startChonkVerifierCircuits", null);
|
|
707
833
|
_ts_decorate([
|
|
708
834
|
trackSpan('ProvingOrchestrator.setBlockCompleted', (blockNumber)=>({
|
|
709
835
|
[Attributes.BLOCK_NUMBER]: blockNumber
|
|
710
836
|
}))
|
|
711
837
|
], ProvingOrchestrator.prototype, "setBlockCompleted", null);
|
|
712
838
|
_ts_decorate([
|
|
713
|
-
trackSpan('ProvingOrchestrator.prepareBaseRollupInputs', (
|
|
839
|
+
trackSpan('ProvingOrchestrator.prepareBaseRollupInputs', (tx)=>({
|
|
714
840
|
[Attributes.TX_HASH]: tx.hash.toString()
|
|
715
841
|
}))
|
|
716
842
|
], ProvingOrchestrator.prototype, "prepareBaseRollupInputs", null);
|