@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa
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/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -3
- package/dest/index.d.ts +1 -1
- package/dest/light/index.d.ts +2 -0
- package/dest/light/index.d.ts.map +1 -0
- package/dest/light/index.js +1 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +233 -0
- package/dest/mocks/fixtures.d.ts +1 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +9 -18
- package/dest/mocks/test_context.d.ts +38 -55
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +143 -142
- package/dest/orchestrator/block-building-helpers.d.ts +18 -20
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +90 -115
- package/dest/orchestrator/block-proving-state.d.ts +20 -11
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +87 -19
- package/dest/orchestrator/checkpoint-proving-state.d.ts +24 -27
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +28 -94
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +161 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +1066 -0
- package/dest/orchestrator/chonk-cache.d.ts +39 -0
- package/dest/orchestrator/chonk-cache.d.ts.map +1 -0
- package/dest/orchestrator/chonk-cache.js +80 -0
- package/dest/orchestrator/index.d.ts +4 -2
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +3 -1
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -15
- package/dest/orchestrator/proving-scheduler.d.ts +81 -0
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/proving-scheduler.js +120 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts +88 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-orchestrator.js +232 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-proving-state.js +185 -0
- package/dest/orchestrator/tx-proving-state.d.ts +7 -6
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +7 -16
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +65 -8
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +66 -14
- package/dest/proving_broker/broker_prover_facade.d.ts +26 -24
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +21 -33
- package/dest/proving_broker/config.d.ts +14 -62
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +29 -6
- package/dest/proving_broker/factory.d.ts +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 +2 -1
- package/dest/proving_broker/index.d.ts.map +1 -1
- package/dest/proving_broker/index.js +1 -0
- package/dest/proving_broker/proof_store/factory.d.ts +2 -5
- package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/factory.js +7 -30
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
- package/dest/proving_broker/proof_store/index.d.ts +2 -2
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -1
- 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 +5 -9
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +4 -19
- package/dest/proving_broker/proving_broker.d.ts +8 -5
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +74 -22
- 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 +5 -3
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +394 -5
- 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 +3 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +22 -35
- package/dest/proving_broker/proving_job_controller.d.ts +5 -3
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +8 -6
- package/dest/proving_broker/rpc.d.ts +9 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +87 -23
- package/dest/test/epoch_settlement.d.ts +36 -0
- package/dest/test/epoch_settlement.d.ts.map +1 -0
- package/dest/test/epoch_settlement.js +52 -0
- package/dest/test/index.d.ts +2 -0
- package/dest/test/index.d.ts.map +1 -0
- package/dest/test/index.js +1 -0
- package/dest/test/mock_proof_store.d.ts +1 -1
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +5 -6
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +4 -4
- package/package.json +25 -23
- package/src/config.ts +19 -3
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +322 -0
- package/src/mocks/fixtures.ts +9 -31
- package/src/mocks/test_context.ts +182 -217
- package/src/orchestrator/block-building-helpers.ts +129 -209
- package/src/orchestrator/block-proving-state.ts +109 -22
- package/src/orchestrator/checkpoint-proving-state.ts +32 -123
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +1044 -0
- package/src/orchestrator/chonk-cache.ts +99 -0
- package/src/orchestrator/index.ts +8 -1
- package/src/orchestrator/orchestrator_metrics.ts +2 -25
- package/src/orchestrator/proving-scheduler.ts +160 -0
- package/src/orchestrator/top-tree-orchestrator.ts +384 -0
- package/src/orchestrator/top-tree-proving-state.ts +219 -0
- package/src/orchestrator/tx-proving-state.ts +10 -27
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +148 -29
- package/src/proving_broker/broker_prover_facade.ts +47 -56
- package/src/proving_broker/config.ts +33 -3
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/index.ts +1 -0
- package/src/proving_broker/proof_store/factory.ts +10 -32
- package/src/proving_broker/proof_store/file_store_proof_store.ts +78 -0
- package/src/proving_broker/proof_store/index.ts +1 -1
- package/src/proving_broker/proving_agent.ts +6 -19
- package/src/proving_broker/proving_broker.ts +70 -17
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +22 -7
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
- package/src/proving_broker/proving_job_controller.ts +13 -7
- package/src/proving_broker/rpc.ts +46 -20
- package/src/test/epoch_settlement.ts +82 -0
- package/src/test/index.ts +1 -0
- package/src/test/mock_prover.ts +3 -15
- package/dest/block-factory/index.d.ts +0 -2
- package/dest/block-factory/index.d.ts.map +0 -1
- package/dest/block-factory/index.js +0 -1
- package/dest/block-factory/light.d.ts +0 -38
- package/dest/block-factory/light.d.ts.map +0 -1
- package/dest/block-factory/light.js +0 -94
- package/dest/orchestrator/epoch-proving-state.d.ts +0 -73
- package/dest/orchestrator/epoch-proving-state.d.ts.map +0 -1
- package/dest/orchestrator/epoch-proving-state.js +0 -233
- package/dest/orchestrator/orchestrator.d.ts +0 -113
- package/dest/orchestrator/orchestrator.d.ts.map +0 -1
- package/dest/orchestrator/orchestrator.js +0 -848
- package/dest/prover-client/server-epoch-prover.d.ts +0 -31
- package/dest/prover-client/server-epoch-prover.d.ts.map +0 -1
- package/dest/prover-client/server-epoch-prover.js +0 -40
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -52
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/block-factory/index.ts +0 -1
- package/src/block-factory/light.ts +0 -140
- package/src/orchestrator/epoch-proving-state.ts +0 -328
- package/src/orchestrator/orchestrator.ts +0 -1272
- package/src/prover-client/server-epoch-prover.ts +0 -70
- package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -1,57 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SpongeBlob } from '@aztec/blob-lib';
|
|
2
2
|
import {
|
|
3
3
|
type ARCHIVE_HEIGHT,
|
|
4
|
-
BLOBS_PER_BLOCK,
|
|
5
|
-
FIELDS_PER_BLOB,
|
|
6
4
|
type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
7
5
|
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
8
6
|
NUM_MSGS_PER_BASE_PARITY,
|
|
9
7
|
} from '@aztec/constants';
|
|
8
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
10
9
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
11
|
-
import {
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
12
11
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
13
12
|
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
14
|
-
import { getCheckpointBlobFields } from '@aztec/stdlib/checkpoint';
|
|
15
13
|
import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
16
14
|
import { ParityBasePrivateInputs } from '@aztec/stdlib/parity';
|
|
17
|
-
import {
|
|
18
|
-
BlockMergeRollupPrivateInputs,
|
|
19
|
-
BlockRollupPublicInputs,
|
|
20
|
-
CheckpointConstantData,
|
|
21
|
-
CheckpointRollupPublicInputs,
|
|
22
|
-
CheckpointRootRollupHints,
|
|
23
|
-
CheckpointRootRollupPrivateInputs,
|
|
24
|
-
CheckpointRootSingleBlockRollupPrivateInputs,
|
|
25
|
-
} from '@aztec/stdlib/rollup';
|
|
26
|
-
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
15
|
+
import { BlockMergeRollupPrivateInputs, BlockRollupPublicInputs, CheckpointConstantData } from '@aztec/stdlib/rollup';
|
|
27
16
|
import type { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
28
17
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
29
18
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
30
19
|
|
|
31
|
-
import {
|
|
20
|
+
import { toProofData } from './block-building-helpers.js';
|
|
32
21
|
import { BlockProvingState, type ProofState } from './block-proving-state.js';
|
|
33
|
-
import type { EpochProvingState } from './epoch-proving-state.js';
|
|
34
22
|
|
|
35
23
|
export class CheckpointProvingState {
|
|
36
24
|
private blockProofs: UnbalancedTreeStore<
|
|
37
25
|
ProofState<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
38
26
|
>;
|
|
39
|
-
private checkpointRootProof:
|
|
40
|
-
| ProofState<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
41
|
-
| undefined;
|
|
42
27
|
private blocks: (BlockProvingState | undefined)[] = [];
|
|
43
|
-
private startBlobAccumulator: BatchedBlobAccumulator | undefined;
|
|
44
|
-
private endBlobAccumulator: BatchedBlobAccumulator | undefined;
|
|
45
|
-
private blobFields: Fr[] | undefined;
|
|
46
28
|
private error: string | undefined;
|
|
47
|
-
public readonly firstBlockNumber:
|
|
29
|
+
public readonly firstBlockNumber: BlockNumber;
|
|
48
30
|
|
|
49
31
|
constructor(
|
|
50
32
|
public readonly index: number,
|
|
51
33
|
public readonly constants: CheckpointConstantData,
|
|
52
34
|
public readonly totalNumBlocks: number,
|
|
53
|
-
private readonly totalNumBlobFields: number,
|
|
54
|
-
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
55
35
|
private readonly headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
56
36
|
private readonly lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
57
37
|
private readonly l1ToL2Messages: Fr[],
|
|
@@ -67,25 +47,24 @@ export class CheckpointProvingState {
|
|
|
67
47
|
Fr,
|
|
68
48
|
typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH
|
|
69
49
|
>,
|
|
70
|
-
public
|
|
71
|
-
|
|
50
|
+
public readonly epochNumber: number,
|
|
51
|
+
/** Owner's liveness check. `verifyState()` returns false once this returns false. */
|
|
52
|
+
private readonly isAlive: () => boolean,
|
|
53
|
+
/** Owner's failure callback. Invoked from `reject` to surface the error upward. */
|
|
54
|
+
private readonly onReject: (reason: string) => void,
|
|
72
55
|
) {
|
|
73
56
|
this.blockProofs = new UnbalancedTreeStore(totalNumBlocks);
|
|
74
|
-
this.firstBlockNumber = headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public get epochNumber(): number {
|
|
78
|
-
return this.parentEpoch.epochNumber;
|
|
57
|
+
this.firstBlockNumber = BlockNumber(headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1);
|
|
79
58
|
}
|
|
80
59
|
|
|
81
|
-
public
|
|
82
|
-
blockNumber:
|
|
60
|
+
public startNewBlock(
|
|
61
|
+
blockNumber: BlockNumber,
|
|
83
62
|
timestamp: UInt64,
|
|
84
63
|
totalNumTxs: number,
|
|
85
64
|
lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
86
65
|
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
87
|
-
):
|
|
88
|
-
const index = blockNumber - this.firstBlockNumber;
|
|
66
|
+
): BlockProvingState {
|
|
67
|
+
const index = Number(blockNumber) - Number(this.firstBlockNumber);
|
|
89
68
|
if (index >= this.totalNumBlocks) {
|
|
90
69
|
throw new Error(`Unable to start a new block at index ${index}. Expected at most ${this.totalNumBlocks} blocks.`);
|
|
91
70
|
}
|
|
@@ -98,8 +77,7 @@ export class CheckpointProvingState {
|
|
|
98
77
|
const lastL1ToL2MessageSubtreeRootSiblingPath =
|
|
99
78
|
index === 0 ? this.lastL1ToL2MessageSubtreeRootSiblingPath : this.newL1ToL2MessageSubtreeRootSiblingPath;
|
|
100
79
|
|
|
101
|
-
const startSpongeBlob =
|
|
102
|
-
index === 0 ? await SpongeBlob.init(this.totalNumBlobFields) : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
80
|
+
const startSpongeBlob = index === 0 ? SpongeBlob.init() : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
103
81
|
if (!startSpongeBlob) {
|
|
104
82
|
throw new Error(
|
|
105
83
|
'Cannot start a new block before the trees have progressed from the tx effects in the previous block.',
|
|
@@ -160,25 +138,6 @@ export class CheckpointProvingState {
|
|
|
160
138
|
this.blockProofs.setNode(location, { provingOutput });
|
|
161
139
|
}
|
|
162
140
|
|
|
163
|
-
public tryStartProvingCheckpointRoot() {
|
|
164
|
-
if (this.checkpointRootProof?.isProving) {
|
|
165
|
-
return false;
|
|
166
|
-
} else {
|
|
167
|
-
this.checkpointRootProof = { isProving: true };
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public setCheckpointRootRollupProof(
|
|
173
|
-
provingOutput: PublicInputsAndRecursiveProof<
|
|
174
|
-
CheckpointRollupPublicInputs,
|
|
175
|
-
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
176
|
-
>,
|
|
177
|
-
): TreeNodeLocation {
|
|
178
|
-
this.checkpointRootProof = { provingOutput };
|
|
179
|
-
return this.parentEpoch.setCheckpointRootRollupProof(this.index, provingOutput);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
141
|
public getBaseParityInputs(baseParityIndex: number) {
|
|
183
142
|
const messages = padArrayEnd(
|
|
184
143
|
this.l1ToL2Messages.slice(
|
|
@@ -188,25 +147,7 @@ export class CheckpointProvingState {
|
|
|
188
147
|
Fr.ZERO,
|
|
189
148
|
NUM_MSGS_PER_BASE_PARITY,
|
|
190
149
|
);
|
|
191
|
-
return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public async accumulateBlobs(startBlobAccumulator: BatchedBlobAccumulator) {
|
|
195
|
-
if (this.isAcceptingBlocks() || this.blocks.some(b => b!.isAcceptingTxs())) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
this.blobFields = getCheckpointBlobFields(this.blocks.map(b => b!.getTxEffects()));
|
|
200
|
-
this.endBlobAccumulator = await accumulateBlobs(this.blobFields, startBlobAccumulator);
|
|
201
|
-
this.startBlobAccumulator = startBlobAccumulator;
|
|
202
|
-
|
|
203
|
-
this.onBlobAccumulatorSet(this);
|
|
204
|
-
|
|
205
|
-
return this.endBlobAccumulator;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
public getEndBlobAccumulator() {
|
|
209
|
-
return this.endBlobAccumulator;
|
|
150
|
+
return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot, this.constants.proverId);
|
|
210
151
|
}
|
|
211
152
|
|
|
212
153
|
public getParentLocation(location: TreeNodeLocation) {
|
|
@@ -222,44 +163,8 @@ export class CheckpointProvingState {
|
|
|
222
163
|
return new BlockMergeRollupPrivateInputs([toProofData(left), toProofData(right)]);
|
|
223
164
|
}
|
|
224
165
|
|
|
225
|
-
public
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
public getCheckpointRootRollupInputs() {
|
|
230
|
-
const proofs = this.#getChildProofsForRoot();
|
|
231
|
-
const nonEmptyProofs = proofs.filter(p => !!p);
|
|
232
|
-
if (proofs.length !== nonEmptyProofs.length) {
|
|
233
|
-
throw new Error('At least one child is not ready for the checkpoint root rollup.');
|
|
234
|
-
}
|
|
235
|
-
if (!this.startBlobAccumulator) {
|
|
236
|
-
throw new Error('Start blob accumulator is not set.');
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// `blobFields` must've been set if `startBlobAccumulator` is set (in `accumulateBlobs`).
|
|
240
|
-
const blobFields = this.blobFields!;
|
|
241
|
-
|
|
242
|
-
const { blobCommitments, blobsHash } = buildBlobHints(blobFields);
|
|
243
|
-
|
|
244
|
-
const hints = CheckpointRootRollupHints.from({
|
|
245
|
-
previousBlockHeader: this.headerOfLastBlockInPreviousCheckpoint,
|
|
246
|
-
previousArchiveSiblingPath: this.lastArchiveSiblingPath,
|
|
247
|
-
startBlobAccumulator: this.startBlobAccumulator.toBlobAccumulator(),
|
|
248
|
-
finalBlobChallenges: this.finalBlobBatchingChallenges,
|
|
249
|
-
blobFields: padArrayEnd(blobFields, Fr.ZERO, FIELDS_PER_BLOB * BLOBS_PER_BLOCK),
|
|
250
|
-
blobCommitments: padArrayEnd(blobCommitments, BLS12Point.ZERO, BLOBS_PER_BLOCK),
|
|
251
|
-
blobsHash,
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
const [left, right] = nonEmptyProofs.map(p => toProofData(p));
|
|
255
|
-
|
|
256
|
-
return !right
|
|
257
|
-
? new CheckpointRootSingleBlockRollupPrivateInputs(left, hints)
|
|
258
|
-
: new CheckpointRootRollupPrivateInputs([left, right], hints);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
public getBlockProvingStateByBlockNumber(blockNumber: number) {
|
|
262
|
-
const index = blockNumber - this.firstBlockNumber;
|
|
166
|
+
public getBlockProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
167
|
+
const index = Number(blockNumber) - Number(this.firstBlockNumber);
|
|
263
168
|
return this.blocks[index];
|
|
264
169
|
}
|
|
265
170
|
|
|
@@ -267,13 +172,8 @@ export class CheckpointProvingState {
|
|
|
267
172
|
return !!this.blockProofs.getSibling(location)?.provingOutput;
|
|
268
173
|
}
|
|
269
174
|
|
|
270
|
-
public isReadyForCheckpointRoot() {
|
|
271
|
-
const allChildProofsReady = this.#getChildProofsForRoot().every(p => !!p);
|
|
272
|
-
return allChildProofsReady && !!this.startBlobAccumulator;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
175
|
public verifyState() {
|
|
276
|
-
return this.
|
|
176
|
+
return this.isAlive();
|
|
277
177
|
}
|
|
278
178
|
|
|
279
179
|
public getError() {
|
|
@@ -287,13 +187,22 @@ export class CheckpointProvingState {
|
|
|
287
187
|
|
|
288
188
|
public reject(reason: string) {
|
|
289
189
|
this.error = reason;
|
|
290
|
-
this.
|
|
190
|
+
this.onReject(reason);
|
|
291
191
|
}
|
|
292
192
|
|
|
293
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Returns the block-level proof outputs that feed into the checkpoint root rollup.
|
|
195
|
+
* Used by `CheckpointSubTreeOrchestrator` to surface its sub-tree result.
|
|
196
|
+
*/
|
|
197
|
+
public getSubTreeOutputProofs() {
|
|
294
198
|
const rootLocation = { level: 0, index: 0 };
|
|
295
199
|
return this.totalNumBlocks === 1
|
|
296
200
|
? [this.blockProofs.getNode(rootLocation)?.provingOutput] // If there's only 1 block, its proof will be stored at the root.
|
|
297
201
|
: this.blockProofs.getChildren(rootLocation).map(c => c?.provingOutput);
|
|
298
202
|
}
|
|
203
|
+
|
|
204
|
+
/** Sibling path of the archive tree captured before any block in this checkpoint landed. */
|
|
205
|
+
public getLastArchiveSiblingPath() {
|
|
206
|
+
return this.lastArchiveSiblingPath;
|
|
207
|
+
}
|
|
299
208
|
}
|