@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.
Files changed (178) hide show
  1. package/dest/config.d.ts +2 -2
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +17 -3
  4. package/dest/index.d.ts +1 -1
  5. package/dest/light/index.d.ts +2 -0
  6. package/dest/light/index.d.ts.map +1 -0
  7. package/dest/light/index.js +1 -0
  8. package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
  9. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
  10. package/dest/light/lightweight_checkpoint_builder.js +233 -0
  11. package/dest/mocks/fixtures.d.ts +1 -4
  12. package/dest/mocks/fixtures.d.ts.map +1 -1
  13. package/dest/mocks/fixtures.js +9 -18
  14. package/dest/mocks/test_context.d.ts +38 -55
  15. package/dest/mocks/test_context.d.ts.map +1 -1
  16. package/dest/mocks/test_context.js +143 -142
  17. package/dest/orchestrator/block-building-helpers.d.ts +18 -20
  18. package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
  19. package/dest/orchestrator/block-building-helpers.js +90 -115
  20. package/dest/orchestrator/block-proving-state.d.ts +20 -11
  21. package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
  22. package/dest/orchestrator/block-proving-state.js +87 -19
  23. package/dest/orchestrator/checkpoint-proving-state.d.ts +24 -27
  24. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
  25. package/dest/orchestrator/checkpoint-proving-state.js +28 -94
  26. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +161 -0
  27. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
  28. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +1066 -0
  29. package/dest/orchestrator/chonk-cache.d.ts +39 -0
  30. package/dest/orchestrator/chonk-cache.d.ts.map +1 -0
  31. package/dest/orchestrator/chonk-cache.js +80 -0
  32. package/dest/orchestrator/index.d.ts +4 -2
  33. package/dest/orchestrator/index.d.ts.map +1 -1
  34. package/dest/orchestrator/index.js +3 -1
  35. package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
  36. package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
  37. package/dest/orchestrator/orchestrator_metrics.js +2 -15
  38. package/dest/orchestrator/proving-scheduler.d.ts +81 -0
  39. package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
  40. package/dest/orchestrator/proving-scheduler.js +120 -0
  41. package/dest/orchestrator/top-tree-orchestrator.d.ts +88 -0
  42. package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
  43. package/dest/orchestrator/top-tree-orchestrator.js +232 -0
  44. package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
  45. package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
  46. package/dest/orchestrator/top-tree-proving-state.js +185 -0
  47. package/dest/orchestrator/tx-proving-state.d.ts +7 -6
  48. package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
  49. package/dest/orchestrator/tx-proving-state.js +7 -16
  50. package/dest/prover-client/factory.d.ts +3 -3
  51. package/dest/prover-client/factory.d.ts.map +1 -1
  52. package/dest/prover-client/index.d.ts +1 -1
  53. package/dest/prover-client/prover-client.d.ts +65 -8
  54. package/dest/prover-client/prover-client.d.ts.map +1 -1
  55. package/dest/prover-client/prover-client.js +66 -14
  56. package/dest/proving_broker/broker_prover_facade.d.ts +26 -24
  57. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  58. package/dest/proving_broker/broker_prover_facade.js +21 -33
  59. package/dest/proving_broker/config.d.ts +14 -62
  60. package/dest/proving_broker/config.d.ts.map +1 -1
  61. package/dest/proving_broker/config.js +29 -6
  62. package/dest/proving_broker/factory.d.ts +1 -1
  63. package/dest/proving_broker/fixtures.d.ts +3 -2
  64. package/dest/proving_broker/fixtures.d.ts.map +1 -1
  65. package/dest/proving_broker/fixtures.js +3 -2
  66. package/dest/proving_broker/index.d.ts +2 -1
  67. package/dest/proving_broker/index.d.ts.map +1 -1
  68. package/dest/proving_broker/index.js +1 -0
  69. package/dest/proving_broker/proof_store/factory.d.ts +2 -5
  70. package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
  71. package/dest/proving_broker/proof_store/factory.js +7 -30
  72. package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
  73. package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
  74. package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
  75. package/dest/proving_broker/proof_store/index.d.ts +2 -2
  76. package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
  77. package/dest/proving_broker/proof_store/index.js +1 -1
  78. package/dest/proving_broker/proof_store/inline_proof_store.d.ts +1 -1
  79. package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
  80. package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
  81. package/dest/proving_broker/proving_agent.d.ts +5 -9
  82. package/dest/proving_broker/proving_agent.d.ts.map +1 -1
  83. package/dest/proving_broker/proving_agent.js +4 -19
  84. package/dest/proving_broker/proving_broker.d.ts +8 -5
  85. package/dest/proving_broker/proving_broker.d.ts.map +1 -1
  86. package/dest/proving_broker/proving_broker.js +74 -22
  87. package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
  88. package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
  89. package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
  90. package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
  91. package/dest/proving_broker/proving_broker_database/persisted.js +394 -5
  92. package/dest/proving_broker/proving_broker_database.d.ts +3 -2
  93. package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
  94. package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
  95. package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
  96. package/dest/proving_broker/proving_broker_instrumentation.js +22 -35
  97. package/dest/proving_broker/proving_job_controller.d.ts +5 -3
  98. package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
  99. package/dest/proving_broker/proving_job_controller.js +8 -6
  100. package/dest/proving_broker/rpc.d.ts +9 -5
  101. package/dest/proving_broker/rpc.d.ts.map +1 -1
  102. package/dest/proving_broker/rpc.js +87 -23
  103. package/dest/test/epoch_settlement.d.ts +36 -0
  104. package/dest/test/epoch_settlement.d.ts.map +1 -0
  105. package/dest/test/epoch_settlement.js +52 -0
  106. package/dest/test/index.d.ts +2 -0
  107. package/dest/test/index.d.ts.map +1 -0
  108. package/dest/test/index.js +1 -0
  109. package/dest/test/mock_proof_store.d.ts +1 -1
  110. package/dest/test/mock_proof_store.d.ts.map +1 -1
  111. package/dest/test/mock_prover.d.ts +5 -6
  112. package/dest/test/mock_prover.d.ts.map +1 -1
  113. package/dest/test/mock_prover.js +4 -4
  114. package/package.json +25 -23
  115. package/src/config.ts +19 -3
  116. package/src/light/index.ts +1 -0
  117. package/src/light/lightweight_checkpoint_builder.ts +322 -0
  118. package/src/mocks/fixtures.ts +9 -31
  119. package/src/mocks/test_context.ts +182 -217
  120. package/src/orchestrator/block-building-helpers.ts +129 -209
  121. package/src/orchestrator/block-proving-state.ts +109 -22
  122. package/src/orchestrator/checkpoint-proving-state.ts +32 -123
  123. package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +1044 -0
  124. package/src/orchestrator/chonk-cache.ts +99 -0
  125. package/src/orchestrator/index.ts +8 -1
  126. package/src/orchestrator/orchestrator_metrics.ts +2 -25
  127. package/src/orchestrator/proving-scheduler.ts +160 -0
  128. package/src/orchestrator/top-tree-orchestrator.ts +384 -0
  129. package/src/orchestrator/top-tree-proving-state.ts +219 -0
  130. package/src/orchestrator/tx-proving-state.ts +10 -27
  131. package/src/prover-client/factory.ts +6 -2
  132. package/src/prover-client/prover-client.ts +148 -29
  133. package/src/proving_broker/broker_prover_facade.ts +47 -56
  134. package/src/proving_broker/config.ts +33 -3
  135. package/src/proving_broker/fixtures.ts +8 -3
  136. package/src/proving_broker/index.ts +1 -0
  137. package/src/proving_broker/proof_store/factory.ts +10 -32
  138. package/src/proving_broker/proof_store/file_store_proof_store.ts +78 -0
  139. package/src/proving_broker/proof_store/index.ts +1 -1
  140. package/src/proving_broker/proving_agent.ts +6 -19
  141. package/src/proving_broker/proving_broker.ts +70 -17
  142. package/src/proving_broker/proving_broker_database/memory.ts +2 -1
  143. package/src/proving_broker/proving_broker_database/persisted.ts +22 -7
  144. package/src/proving_broker/proving_broker_database.ts +2 -1
  145. package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
  146. package/src/proving_broker/proving_job_controller.ts +13 -7
  147. package/src/proving_broker/rpc.ts +46 -20
  148. package/src/test/epoch_settlement.ts +82 -0
  149. package/src/test/index.ts +1 -0
  150. package/src/test/mock_prover.ts +3 -15
  151. package/dest/block-factory/index.d.ts +0 -2
  152. package/dest/block-factory/index.d.ts.map +0 -1
  153. package/dest/block-factory/index.js +0 -1
  154. package/dest/block-factory/light.d.ts +0 -38
  155. package/dest/block-factory/light.d.ts.map +0 -1
  156. package/dest/block-factory/light.js +0 -94
  157. package/dest/orchestrator/epoch-proving-state.d.ts +0 -73
  158. package/dest/orchestrator/epoch-proving-state.d.ts.map +0 -1
  159. package/dest/orchestrator/epoch-proving-state.js +0 -233
  160. package/dest/orchestrator/orchestrator.d.ts +0 -113
  161. package/dest/orchestrator/orchestrator.d.ts.map +0 -1
  162. package/dest/orchestrator/orchestrator.js +0 -848
  163. package/dest/prover-client/server-epoch-prover.d.ts +0 -31
  164. package/dest/prover-client/server-epoch-prover.d.ts.map +0 -1
  165. package/dest/prover-client/server-epoch-prover.js +0 -40
  166. package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
  167. package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
  168. package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -52
  169. package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
  170. package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
  171. package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
  172. package/src/block-factory/index.ts +0 -1
  173. package/src/block-factory/light.ts +0 -140
  174. package/src/orchestrator/epoch-proving-state.ts +0 -328
  175. package/src/orchestrator/orchestrator.ts +0 -1272
  176. package/src/prover-client/server-epoch-prover.ts +0 -70
  177. package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
  178. package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
@@ -1,233 +0,0 @@
1
- import { BatchedBlobAccumulator } from '@aztec/blob-lib';
2
- import { UnbalancedTreeStore } from '@aztec/foundation/trees';
3
- import { CheckpointMergeRollupPrivateInputs, CheckpointPaddingRollupPrivateInputs, RootRollupPrivateInputs } from '@aztec/stdlib/rollup';
4
- import { toProofData } from './block-building-helpers.js';
5
- import { CheckpointProvingState } from './checkpoint-proving-state.js';
6
- var PROVING_STATE_LIFECYCLE = /*#__PURE__*/ function(PROVING_STATE_LIFECYCLE) {
7
- PROVING_STATE_LIFECYCLE[PROVING_STATE_LIFECYCLE["PROVING_STATE_CREATED"] = 0] = "PROVING_STATE_CREATED";
8
- PROVING_STATE_LIFECYCLE[PROVING_STATE_LIFECYCLE["PROVING_STATE_FULL"] = 1] = "PROVING_STATE_FULL";
9
- PROVING_STATE_LIFECYCLE[PROVING_STATE_LIFECYCLE["PROVING_STATE_RESOLVED"] = 2] = "PROVING_STATE_RESOLVED";
10
- PROVING_STATE_LIFECYCLE[PROVING_STATE_LIFECYCLE["PROVING_STATE_REJECTED"] = 3] = "PROVING_STATE_REJECTED";
11
- return PROVING_STATE_LIFECYCLE;
12
- }(PROVING_STATE_LIFECYCLE || {});
13
- /**
14
- * The current state of the proving schedule for an epoch.
15
- * Contains the raw inputs and intermediate state to generate every constituent proof in the tree.
16
- * Carries an identifier so we can identify if the proving state is discarded and a new one started.
17
- * Captures resolve and reject callbacks to provide a promise base interface to the consumer of our proving.
18
- */ export class EpochProvingState {
19
- epochNumber;
20
- totalNumCheckpoints;
21
- finalBlobBatchingChallenges;
22
- onCheckpointBlobAccumulatorSet;
23
- completionCallback;
24
- rejectionCallback;
25
- checkpointProofs;
26
- checkpointPaddingProof;
27
- rootRollupProof;
28
- checkpoints;
29
- startBlobAccumulator;
30
- endBlobAccumulator;
31
- finalBatchedBlob;
32
- provingStateLifecycle;
33
- // Map from tx hash to chonk verifier proof promise. Used when kickstarting chonk verifier proofs before tx processing.
34
- cachedChonkVerifierProofs;
35
- constructor(epochNumber, totalNumCheckpoints, finalBlobBatchingChallenges, onCheckpointBlobAccumulatorSet, completionCallback, rejectionCallback){
36
- this.epochNumber = epochNumber;
37
- this.totalNumCheckpoints = totalNumCheckpoints;
38
- this.finalBlobBatchingChallenges = finalBlobBatchingChallenges;
39
- this.onCheckpointBlobAccumulatorSet = onCheckpointBlobAccumulatorSet;
40
- this.completionCallback = completionCallback;
41
- this.rejectionCallback = rejectionCallback;
42
- this.checkpoints = [];
43
- this.provingStateLifecycle = 0;
44
- this.cachedChonkVerifierProofs = new Map();
45
- this.checkpointProofs = new UnbalancedTreeStore(totalNumCheckpoints);
46
- this.startBlobAccumulator = BatchedBlobAccumulator.newWithChallenges(finalBlobBatchingChallenges);
47
- }
48
- // Adds a block to the proving state, returns its index
49
- // Will update the proving life cycle if this is the last block
50
- startNewCheckpoint(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath) {
51
- if (checkpointIndex >= this.totalNumCheckpoints) {
52
- throw new Error(`Unable to start a new checkpoint at index ${checkpointIndex}. Expected at most ${this.totalNumCheckpoints} checkpoints.`);
53
- }
54
- const checkpoint = new CheckpointProvingState(checkpointIndex, constants, totalNumBlocks, totalNumBlobFields, this.finalBlobBatchingChallenges, previousBlockHeader, lastArchiveSiblingPath, l1ToL2Messages, lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath, this, this.onCheckpointBlobAccumulatorSet);
55
- this.checkpoints[checkpointIndex] = checkpoint;
56
- if (this.checkpoints.filter((c)=>!!c).length === this.totalNumCheckpoints) {
57
- this.provingStateLifecycle = 1;
58
- }
59
- return checkpoint;
60
- }
61
- getCheckpointProvingState(index) {
62
- return this.checkpoints[index];
63
- }
64
- getCheckpointProvingStateByBlockNumber(blockNumber) {
65
- return this.checkpoints.find((c)=>c && blockNumber >= c.firstBlockNumber && blockNumber < c.firstBlockNumber + c.totalNumBlocks);
66
- }
67
- getBlockProvingStateByBlockNumber(blockNumber) {
68
- return this.getCheckpointProvingStateByBlockNumber(blockNumber)?.getBlockProvingStateByBlockNumber(blockNumber);
69
- }
70
- // Returns true if this proving state is still valid, false otherwise
71
- verifyState() {
72
- return this.provingStateLifecycle === 0 || this.provingStateLifecycle === 1;
73
- }
74
- // Returns true if we are still able to accept checkpoints, false otherwise.
75
- isAcceptingCheckpoints() {
76
- return this.checkpoints.filter((c)=>!!c).length < this.totalNumCheckpoints;
77
- }
78
- setCheckpointRootRollupProof(checkpointIndex, provingOutput) {
79
- return this.checkpointProofs.setLeaf(checkpointIndex, {
80
- provingOutput
81
- });
82
- }
83
- tryStartProvingCheckpointMerge(location) {
84
- if (this.checkpointProofs.getNode(location)?.isProving) {
85
- return false;
86
- } else {
87
- this.checkpointProofs.setNode(location, {
88
- isProving: true
89
- });
90
- return true;
91
- }
92
- }
93
- setCheckpointMergeRollupProof(location, provingOutput) {
94
- this.checkpointProofs.setNode(location, {
95
- provingOutput
96
- });
97
- }
98
- tryStartProvingRootRollup() {
99
- if (this.rootRollupProof?.isProving) {
100
- return false;
101
- } else {
102
- this.rootRollupProof = {
103
- isProving: true
104
- };
105
- return true;
106
- }
107
- }
108
- setRootRollupProof(provingOutput) {
109
- this.rootRollupProof = {
110
- provingOutput
111
- };
112
- }
113
- tryStartProvingPaddingCheckpoint() {
114
- if (this.checkpointPaddingProof?.isProving) {
115
- return false;
116
- } else {
117
- this.checkpointPaddingProof = {
118
- isProving: true
119
- };
120
- return true;
121
- }
122
- }
123
- setCheckpointPaddingProof(provingOutput) {
124
- this.checkpointPaddingProof = {
125
- provingOutput
126
- };
127
- }
128
- async setBlobAccumulators() {
129
- let previousAccumulator = this.startBlobAccumulator;
130
- // Accumulate blobs as far as we can for this epoch.
131
- for(let i = 0; i < this.totalNumCheckpoints; i++){
132
- const checkpoint = this.checkpoints[i];
133
- if (!checkpoint) {
134
- break;
135
- }
136
- const endAccumulator = checkpoint.getEndBlobAccumulator() || await checkpoint.accumulateBlobs(previousAccumulator);
137
- if (!endAccumulator) {
138
- break;
139
- }
140
- previousAccumulator = endAccumulator;
141
- // If this is the last checkpoint, set the end blob accumulator.
142
- if (i === this.totalNumCheckpoints - 1) {
143
- this.endBlobAccumulator = endAccumulator;
144
- }
145
- }
146
- }
147
- async finalizeBatchedBlob() {
148
- if (!this.endBlobAccumulator) {
149
- throw new Error('End blob accumulator not ready.');
150
- }
151
- this.finalBatchedBlob = await this.endBlobAccumulator.finalize(true);
152
- }
153
- getParentLocation(location) {
154
- return this.checkpointProofs.getParentLocation(location);
155
- }
156
- getCheckpointMergeRollupInputs(mergeLocation) {
157
- const [left, right] = this.checkpointProofs.getChildren(mergeLocation).map((c)=>c?.provingOutput);
158
- if (!left || !right) {
159
- throw new Error('At least one child is not ready for the checkpoint merge rollup.');
160
- }
161
- return new CheckpointMergeRollupPrivateInputs([
162
- toProofData(left),
163
- toProofData(right)
164
- ]);
165
- }
166
- getRootRollupInputs() {
167
- const [left, right] = this.#getChildProofsForRoot();
168
- if (!left || !right) {
169
- throw new Error('At least one child is not ready for the root rollup.');
170
- }
171
- return RootRollupPrivateInputs.from({
172
- previousRollups: [
173
- toProofData(left),
174
- toProofData(right)
175
- ]
176
- });
177
- }
178
- getPaddingCheckpointInputs() {
179
- return new CheckpointPaddingRollupPrivateInputs();
180
- }
181
- getEpochProofResult() {
182
- const provingOutput = this.rootRollupProof?.provingOutput;
183
- if (!provingOutput || !this.finalBatchedBlob) {
184
- throw new Error('Unable to get epoch proof result. Root rollup is not ready.');
185
- }
186
- return {
187
- proof: provingOutput.proof.binaryProof,
188
- publicInputs: provingOutput.inputs,
189
- batchedBlobInputs: this.finalBatchedBlob
190
- };
191
- }
192
- isReadyForCheckpointMerge(location) {
193
- return !!this.checkpointProofs.getSibling(location)?.provingOutput;
194
- }
195
- // Returns true if we have sufficient inputs to execute the block root rollup
196
- isReadyForRootRollup() {
197
- const childProofs = this.#getChildProofsForRoot();
198
- return childProofs.every((p)=>!!p);
199
- }
200
- // Attempts to reject the proving state promise with a reason of 'cancelled'
201
- cancel() {
202
- this.reject('Proving cancelled');
203
- }
204
- // Attempts to reject the proving state promise with the given reason
205
- // Does nothing if not in a valid state
206
- reject(reason) {
207
- if (!this.verifyState()) {
208
- return;
209
- }
210
- this.provingStateLifecycle = 3;
211
- this.rejectionCallback(reason);
212
- }
213
- // Attempts to resolve the proving state promise with the given result
214
- // Does nothing if not in a valid state
215
- resolve(result) {
216
- if (!this.verifyState()) {
217
- return;
218
- }
219
- this.provingStateLifecycle = 2;
220
- this.completionCallback(result);
221
- }
222
- #getChildProofsForRoot() {
223
- const rootLocation = {
224
- level: 0,
225
- index: 0
226
- };
227
- // If there's only 1 block, its block root proof will be stored at the root.
228
- return this.totalNumCheckpoints === 1 ? [
229
- this.checkpointProofs.getNode(rootLocation)?.provingOutput,
230
- this.checkpointPaddingProof?.provingOutput
231
- ] : this.checkpointProofs.getChildren(rootLocation).map((c)=>c?.provingOutput);
232
- }
233
- }
@@ -1,113 +0,0 @@
1
- import { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
2
- import { Fr } from '@aztec/foundation/fields';
3
- import { EthAddress } from '@aztec/stdlib/block';
4
- import type { EpochProver, ForkMerkleTreeOperations, ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
5
- import type { Proof } from '@aztec/stdlib/proofs';
6
- import { CheckpointConstantData, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
7
- import type { BlockHeader, ProcessedTx, Tx } from '@aztec/stdlib/tx';
8
- import type { UInt64 } from '@aztec/stdlib/types';
9
- import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
10
- import type { BlockProvingState } from './block-proving-state.js';
11
- /**
12
- * Implements an event driven proving scheduler to build the recursive proof tree. The idea being:
13
- * 1. Transactions are provided to the scheduler post simulation.
14
- * 2. Tree insertions are performed as required to generate transaction specific proofs
15
- * 3. Those transaction specific proofs are generated in the necessary order accounting for dependencies
16
- * 4. Once a transaction is proven, it will be incorporated into a merge proof
17
- * 5. Merge proofs are produced at each level of the tree until the root proof is produced
18
- *
19
- * The proving implementation is determined by the provided prover. This could be for example a local prover or a remote prover pool.
20
- */
21
- /**
22
- * The orchestrator, managing the flow of recursive proving operations required to build the rollup proof tree.
23
- */
24
- export declare class ProvingOrchestrator implements EpochProver {
25
- private dbProvider;
26
- private prover;
27
- private readonly proverId;
28
- private provingState;
29
- private pendingProvingJobs;
30
- private provingPromise;
31
- private metrics;
32
- private dbs;
33
- constructor(dbProvider: ForkMerkleTreeOperations, prover: ServerCircuitProver, proverId: EthAddress, telemetryClient?: TelemetryClient);
34
- get tracer(): Tracer;
35
- getProverId(): EthAddress;
36
- stop(): Promise<void>;
37
- startNewEpoch(epochNumber: number, totalNumCheckpoints: number, finalBlobBatchingChallenges: FinalBlobBatchingChallenges): void;
38
- startNewCheckpoint(checkpointIndex: number, constants: CheckpointConstantData, l1ToL2Messages: Fr[], totalNumBlocks: number, totalNumBlobFields: number, headerOfLastBlockInPreviousCheckpoint: BlockHeader): Promise<void>;
39
- /**
40
- * Starts off a new block
41
- * @param blockNumber - The block number
42
- * @param timestamp - The timestamp of the block. This is only required for constructing the private inputs for the
43
- * block that doesn't have any txs.
44
- * @param totalNumTxs - The total number of txs in the block
45
- */
46
- startNewBlock(blockNumber: number, timestamp: UInt64, totalNumTxs: number): Promise<void>;
47
- /**
48
- * The interface to add simulated transactions to the scheduler. This can only be called once per block.
49
- * @param txs - The transactions to be proven
50
- */
51
- addTxs(txs: ProcessedTx[]): Promise<void>;
52
- /**
53
- * Kickstarts chonk verifier circuits for the specified txs. These will be used during epoch proving.
54
- * Note that if the chonk verifier circuits are not started this way, they will be started nontheless after processing.
55
- */
56
- startChonkVerifierCircuits(txs: Tx[]): Promise<void>;
57
- /**
58
- * Marks the block as completed.
59
- * Computes the block header and updates the archive tree.
60
- */
61
- setBlockCompleted(blockNumber: number, expectedHeader?: BlockHeader): Promise<BlockHeader>;
62
- private buildL2BlockHeader;
63
- protected verifyBuiltBlockAgainstSyncedState(provingState: BlockProvingState): Promise<void>;
64
- /**
65
- * Cancel any further proving
66
- */
67
- cancel(): void;
68
- /**
69
- * Returns the proof for the current epoch.
70
- */
71
- finalizeEpoch(): Promise<{
72
- publicInputs: RootRollupPublicInputs;
73
- proof: Proof;
74
- batchedBlobInputs: BatchedBlob;
75
- }>;
76
- /**
77
- * Enqueue a job to be scheduled
78
- * @param provingState - The proving state object being operated on
79
- * @param jobType - The type of job to be queued
80
- * @param job - The actual job, returns a promise notifying of the job's completion
81
- */
82
- private deferredProving;
83
- private updateL1ToL2MessageTree;
84
- private prepareBaseRollupInputs;
85
- private enqueueBaseRollup;
86
- private getOrEnqueueChonkVerifier;
87
- private doEnqueueChonkVerifier;
88
- private enqueueMergeRollup;
89
- private enqueueBlockRootRollup;
90
- private enqueueBaseParityCircuit;
91
- private checkAndEnqueueRootParityCircuit;
92
- private enqueueRootParityCircuit;
93
- private enqueueBlockMergeRollup;
94
- private enqueueCheckpointRootRollup;
95
- private enqueueCheckpointMergeRollup;
96
- private enqueueEpochPadding;
97
- private enqueueRootRollup;
98
- private checkAndEnqueueNextMergeRollup;
99
- private checkAndEnqueueBlockRootRollup;
100
- private checkAndEnqueueNextBlockMergeRollup;
101
- private checkAndEnqueueCheckpointRootRollup;
102
- private checkAndEnqueueNextCheckpointMergeRollup;
103
- private checkAndEnqueueRootRollup;
104
- /**
105
- * Executes the VM circuit for a public function, will enqueue the corresponding kernel if the
106
- * previous kernel is ready
107
- * @param provingState - The proving state being operated on
108
- * @param txIndex - The index of the transaction being proven
109
- */
110
- private enqueueVM;
111
- private checkAndEnqueueBaseRollup;
112
- }
113
- //# sourceMappingURL=orchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,2BAA2B,EAAc,MAAM,iBAAiB,CAAC;AAUvF,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAQ9C,OAAO,EAAE,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EAGxB,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAML,sBAAsB,EAKtB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,MAAM,EAIZ,MAAM,yBAAyB,CAAC;AAgBjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAQlE;;;;;;;;;GASG;AAEH;;GAEG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IASnD,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAV3B,OAAO,CAAC,YAAY,CAA4C;IA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