@aztec/prover-client 0.0.1-commit.b9865e97 → 0.0.1-commit.be03c316
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/light/lightweight_checkpoint_builder.d.ts +1 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +3 -1
- package/dest/mocks/test_context.d.ts +9 -11
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +13 -22
- package/dest/orchestrator/block-building-helpers.d.ts +1 -1
- package/dest/orchestrator/checkpoint-proving-state.d.ts +13 -36
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +18 -125
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +116 -62
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +1005 -90
- 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 +2 -3
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +1 -2
- package/dest/orchestrator/proving-scheduler.d.ts +26 -17
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -1
- package/dest/orchestrator/proving-scheduler.js +28 -25
- package/dest/orchestrator/top-tree-orchestrator.d.ts +11 -6
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/top-tree-orchestrator.js +71 -21
- package/dest/orchestrator/top-tree-proving-state.d.ts +1 -1
- package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.d.ts +3 -3
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/prover-client/prover-client.d.ts +17 -19
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +24 -25
- package/dest/proving_broker/broker_prover_facade.d.ts +3 -3
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- 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_prover.d.ts +1 -1
- package/dest/test/mock_prover.js +2 -2
- package/package.json +17 -16
- package/src/light/lightweight_checkpoint_builder.ts +2 -0
- package/src/mocks/test_context.ts +14 -34
- package/src/orchestrator/checkpoint-proving-state.ts +14 -168
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +902 -129
- package/src/orchestrator/chonk-cache.ts +99 -0
- package/src/orchestrator/index.ts +1 -2
- package/src/orchestrator/proving-scheduler.ts +29 -25
- package/src/orchestrator/top-tree-orchestrator.ts +114 -44
- package/src/orchestrator/top-tree-proving-state.ts +0 -1
- package/src/orchestrator/tx-proving-state.ts +3 -3
- package/src/prover-client/prover-client.ts +35 -49
- package/src/proving_broker/broker_prover_facade.ts +2 -2
- package/src/test/epoch_settlement.ts +82 -0
- package/src/test/index.ts +1 -0
- package/src/test/mock_prover.ts +2 -2
- package/dest/orchestrator/epoch-proving-context.d.ts +0 -51
- package/dest/orchestrator/epoch-proving-context.d.ts.map +0 -1
- package/dest/orchestrator/epoch-proving-context.js +0 -81
- package/dest/orchestrator/epoch-proving-state.d.ts +0 -75
- package/dest/orchestrator/epoch-proving-state.d.ts.map +0 -1
- package/dest/orchestrator/epoch-proving-state.js +0 -269
- package/dest/orchestrator/orchestrator.d.ts +0 -118
- package/dest/orchestrator/orchestrator.d.ts.map +0 -1
- package/dest/orchestrator/orchestrator.js +0 -1113
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts +0 -62
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts.map +0 -1
- package/dest/orchestrator/top-tree-proving-scheduler.js +0 -73
- package/dest/prover-client/server-epoch-prover.d.ts +0 -32
- package/dest/prover-client/server-epoch-prover.d.ts.map +0 -1
- package/dest/prover-client/server-epoch-prover.js +0 -40
- package/src/orchestrator/epoch-proving-context.ts +0 -101
- package/src/orchestrator/epoch-proving-state.ts +0 -380
- package/src/orchestrator/orchestrator.ts +0 -1111
- package/src/orchestrator/top-tree-proving-scheduler.ts +0 -154
- package/src/prover-client/server-epoch-prover.ts +0 -69
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { NESTED_RECURSIVE_PROOF_LENGTH, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
4
|
-
import type { TreeNodeLocation } from '@aztec/foundation/trees';
|
|
5
|
-
import type { PublicInputsAndRecursiveProof, ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import type {
|
|
7
|
-
CheckpointMergeRollupPrivateInputs,
|
|
8
|
-
CheckpointPaddingRollupPrivateInputs,
|
|
9
|
-
CheckpointRollupPublicInputs,
|
|
10
|
-
RootRollupPrivateInputs,
|
|
11
|
-
RootRollupPublicInputs,
|
|
12
|
-
} from '@aztec/stdlib/rollup';
|
|
13
|
-
|
|
14
|
-
import { ProvingScheduler, type ProvingStateLike } from './proving-scheduler.js';
|
|
15
|
-
|
|
16
|
-
type CheckpointRollupProof = PublicInputsAndRecursiveProof<
|
|
17
|
-
CheckpointRollupPublicInputs,
|
|
18
|
-
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
type RootRollupProof = PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* State interface required by the top-tree proving drivers (checkpoint-merge → padding →
|
|
25
|
-
* root-rollup). Both `EpochProvingState` and `TopTreeProvingState` satisfy it structurally;
|
|
26
|
-
* the per-checkpoint state in `EpochProvingState` (block/tx proving, world-state forks)
|
|
27
|
-
* is owned outside this surface.
|
|
28
|
-
*/
|
|
29
|
-
export interface TopTreeStateLike extends ProvingStateLike {
|
|
30
|
-
readonly epochNumber: EpochNumber;
|
|
31
|
-
readonly totalNumCheckpoints: number;
|
|
32
|
-
|
|
33
|
-
tryStartProvingCheckpointMerge(location: TreeNodeLocation): boolean;
|
|
34
|
-
setCheckpointMergeRollupProof(location: TreeNodeLocation, provingOutput: CheckpointRollupProof): void;
|
|
35
|
-
isReadyForCheckpointMerge(location: TreeNodeLocation): boolean;
|
|
36
|
-
getParentLocation(location: TreeNodeLocation): TreeNodeLocation;
|
|
37
|
-
getCheckpointMergeRollupInputs(location: TreeNodeLocation): CheckpointMergeRollupPrivateInputs;
|
|
38
|
-
|
|
39
|
-
tryStartProvingPaddingCheckpoint(): boolean;
|
|
40
|
-
setCheckpointPaddingProof(provingOutput: CheckpointRollupProof): void;
|
|
41
|
-
getPaddingCheckpointInputs(): CheckpointPaddingRollupPrivateInputs;
|
|
42
|
-
|
|
43
|
-
tryStartProvingRootRollup(): boolean;
|
|
44
|
-
setRootRollupProof(provingOutput: RootRollupProof): void;
|
|
45
|
-
isReadyForRootRollup(): boolean;
|
|
46
|
-
getRootRollupInputs(): RootRollupPrivateInputs;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Shared scheduling for the top-tree section of epoch proving — checkpoint-merge,
|
|
51
|
-
* padding (single-checkpoint case), and root rollup. Both `ProvingOrchestrator` and
|
|
52
|
-
* `TopTreeOrchestrator` extend this; their per-checkpoint-root drivers diverge (one
|
|
53
|
-
* drains state-derived inputs once block-merge is done, the other builds inputs from
|
|
54
|
-
* caller-supplied checkpoint data), but the rest of the tree is identical.
|
|
55
|
-
*
|
|
56
|
-
* Subclasses provide a `wrapCircuitCall` hook for telemetry (the orchestrator wraps
|
|
57
|
-
* each call in a span; the top-tree leaves it as identity), and an
|
|
58
|
-
* `onRootRollupComplete` hook to invoke the right shape of `state.resolve()` —
|
|
59
|
-
* `EpochProvingState.resolve` takes a `ProvingResult`, `TopTreeProvingState.resolve`
|
|
60
|
-
* is no-arg.
|
|
61
|
-
*/
|
|
62
|
-
export abstract class TopTreeProvingScheduler extends ProvingScheduler {
|
|
63
|
-
constructor(
|
|
64
|
-
protected readonly prover: ServerCircuitProver,
|
|
65
|
-
enqueueConcurrency: number,
|
|
66
|
-
loggerName?: string,
|
|
67
|
-
bindings?: LoggerBindings,
|
|
68
|
-
) {
|
|
69
|
-
super(enqueueConcurrency, loggerName, bindings);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Wraps a circuit call for telemetry. Default is identity; the orchestrator overrides
|
|
74
|
-
* to wrap with `wrapCallbackInSpan`.
|
|
75
|
-
*/
|
|
76
|
-
protected wrapCircuitCall<T>(
|
|
77
|
-
_circuitName: string,
|
|
78
|
-
fn: (signal: AbortSignal) => Promise<T>,
|
|
79
|
-
): (signal: AbortSignal) => Promise<T> {
|
|
80
|
-
return fn;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** Called once the root rollup proof has been set; subclasses call `state.resolve(...)` with the right shape. */
|
|
84
|
-
protected abstract onRootRollupComplete(state: TopTreeStateLike): void;
|
|
85
|
-
|
|
86
|
-
protected enqueueCheckpointMergeRollup(state: TopTreeStateLike, location: TreeNodeLocation) {
|
|
87
|
-
if (!state.verifyState() || !state.tryStartProvingCheckpointMerge(location)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const inputs = state.getCheckpointMergeRollupInputs(location);
|
|
91
|
-
this.deferredProving(
|
|
92
|
-
state,
|
|
93
|
-
this.wrapCircuitCall('rollup-checkpoint-merge', signal =>
|
|
94
|
-
this.prover.getCheckpointMergeRollupProof(inputs, signal, state.epochNumber),
|
|
95
|
-
),
|
|
96
|
-
result => {
|
|
97
|
-
state.setCheckpointMergeRollupProof(location, result);
|
|
98
|
-
this.checkAndEnqueueNextCheckpointMergeRollup(state, location);
|
|
99
|
-
},
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
protected enqueueEpochPadding(state: TopTreeStateLike) {
|
|
104
|
-
if (!state.verifyState() || !state.tryStartProvingPaddingCheckpoint()) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const inputs = state.getPaddingCheckpointInputs();
|
|
108
|
-
this.deferredProving(
|
|
109
|
-
state,
|
|
110
|
-
this.wrapCircuitCall('rollup-checkpoint-padding', signal =>
|
|
111
|
-
this.prover.getCheckpointPaddingRollupProof(inputs, signal, state.epochNumber),
|
|
112
|
-
),
|
|
113
|
-
result => {
|
|
114
|
-
state.setCheckpointPaddingProof(result);
|
|
115
|
-
this.checkAndEnqueueRootRollup(state);
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected enqueueRootRollup(state: TopTreeStateLike) {
|
|
121
|
-
if (!state.verifyState() || !state.tryStartProvingRootRollup()) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const inputs = state.getRootRollupInputs();
|
|
125
|
-
this.deferredProving(
|
|
126
|
-
state,
|
|
127
|
-
this.wrapCircuitCall('rollup-root', signal => this.prover.getRootRollupProof(inputs, signal, state.epochNumber)),
|
|
128
|
-
result => {
|
|
129
|
-
this.logger.verbose(`Completed root rollup for epoch ${state.epochNumber}`);
|
|
130
|
-
state.setRootRollupProof(result);
|
|
131
|
-
this.onRootRollupComplete(state);
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
protected checkAndEnqueueNextCheckpointMergeRollup(state: TopTreeStateLike, currentLocation: TreeNodeLocation) {
|
|
137
|
-
if (!state.isReadyForCheckpointMerge(currentLocation)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const parentLocation = state.getParentLocation(currentLocation);
|
|
141
|
-
if (parentLocation.level === 0) {
|
|
142
|
-
this.checkAndEnqueueRootRollup(state);
|
|
143
|
-
} else {
|
|
144
|
-
this.enqueueCheckpointMergeRollup(state, parentLocation);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
protected checkAndEnqueueRootRollup(state: TopTreeStateLike) {
|
|
149
|
-
if (!state.isReadyForRootRollup()) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
this.enqueueRootRollup(state);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
|
|
2
|
-
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import type { EthAddress } from '@aztec/stdlib/block';
|
|
5
|
-
import type { EpochProver } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import type { Proof } from '@aztec/stdlib/proofs';
|
|
7
|
-
import type { CheckpointConstantData, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
8
|
-
import type { BlockHeader, ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
9
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
10
|
-
|
|
11
|
-
import type { ProvingOrchestrator } from '../orchestrator/orchestrator.js';
|
|
12
|
-
import type { BrokerCircuitProverFacade } from '../proving_broker/broker_prover_facade.js';
|
|
13
|
-
|
|
14
|
-
/** Encapsulates the proving orchestrator and the broker facade */
|
|
15
|
-
export class ServerEpochProver implements EpochProver {
|
|
16
|
-
constructor(
|
|
17
|
-
private facade: BrokerCircuitProverFacade,
|
|
18
|
-
private orchestrator: ProvingOrchestrator,
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
startNewEpoch(
|
|
22
|
-
epochNumber: EpochNumber,
|
|
23
|
-
totalNumCheckpoints: number,
|
|
24
|
-
finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
25
|
-
): void {
|
|
26
|
-
this.orchestrator.startNewEpoch(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges);
|
|
27
|
-
this.facade.start();
|
|
28
|
-
}
|
|
29
|
-
startNewCheckpoint(
|
|
30
|
-
checkpointIndex: number,
|
|
31
|
-
constants: CheckpointConstantData,
|
|
32
|
-
l1ToL2Messages: Fr[],
|
|
33
|
-
totalNumBlocks: number,
|
|
34
|
-
headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
35
|
-
): Promise<void> {
|
|
36
|
-
return this.orchestrator.startNewCheckpoint(
|
|
37
|
-
checkpointIndex,
|
|
38
|
-
constants,
|
|
39
|
-
l1ToL2Messages,
|
|
40
|
-
totalNumBlocks,
|
|
41
|
-
headerOfLastBlockInPreviousCheckpoint,
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
startChonkVerifierCircuits(txs: Tx[]): Promise<void> {
|
|
45
|
-
return this.orchestrator.startChonkVerifierCircuits(txs);
|
|
46
|
-
}
|
|
47
|
-
setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader> {
|
|
48
|
-
return this.orchestrator.setBlockCompleted(blockNumber, expectedBlockHeader);
|
|
49
|
-
}
|
|
50
|
-
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }> {
|
|
51
|
-
return this.orchestrator.finalizeEpoch();
|
|
52
|
-
}
|
|
53
|
-
cancel(): void {
|
|
54
|
-
this.orchestrator.cancel();
|
|
55
|
-
}
|
|
56
|
-
getProverId(): EthAddress {
|
|
57
|
-
return this.orchestrator.getProverId();
|
|
58
|
-
}
|
|
59
|
-
async stop(): Promise<void> {
|
|
60
|
-
await this.facade.stop();
|
|
61
|
-
await this.orchestrator.stop();
|
|
62
|
-
}
|
|
63
|
-
startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void> {
|
|
64
|
-
return this.orchestrator.startNewBlock(blockNumber, timestamp, totalNumTxs);
|
|
65
|
-
}
|
|
66
|
-
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
67
|
-
return this.orchestrator.addTxs(txs);
|
|
68
|
-
}
|
|
69
|
-
}
|