@aztec/validator-client 0.0.1-commit.1142ef1 → 0.0.1-commit.11bf3dd6e

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 (73) hide show
  1. package/README.md +92 -24
  2. package/dest/checkpoint_builder.d.ts +35 -26
  3. package/dest/checkpoint_builder.d.ts.map +1 -1
  4. package/dest/checkpoint_builder.js +144 -48
  5. package/dest/config.d.ts +1 -1
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +33 -19
  8. package/dest/duties/validation_service.d.ts +21 -10
  9. package/dest/duties/validation_service.d.ts.map +1 -1
  10. package/dest/duties/validation_service.js +67 -32
  11. package/dest/factory.d.ts +8 -5
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +6 -5
  14. package/dest/index.d.ts +2 -3
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +1 -2
  17. package/dest/key_store/ha_key_store.d.ts +99 -0
  18. package/dest/key_store/ha_key_store.d.ts.map +1 -0
  19. package/dest/key_store/ha_key_store.js +208 -0
  20. package/dest/key_store/index.d.ts +2 -1
  21. package/dest/key_store/index.d.ts.map +1 -1
  22. package/dest/key_store/index.js +1 -0
  23. package/dest/key_store/interface.d.ts +36 -6
  24. package/dest/key_store/interface.d.ts.map +1 -1
  25. package/dest/key_store/local_key_store.d.ts +10 -5
  26. package/dest/key_store/local_key_store.d.ts.map +1 -1
  27. package/dest/key_store/local_key_store.js +8 -4
  28. package/dest/key_store/node_keystore_adapter.d.ts +18 -5
  29. package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
  30. package/dest/key_store/node_keystore_adapter.js +18 -4
  31. package/dest/key_store/web3signer_key_store.d.ts +10 -5
  32. package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
  33. package/dest/key_store/web3signer_key_store.js +8 -4
  34. package/dest/metrics.d.ts +16 -3
  35. package/dest/metrics.d.ts.map +1 -1
  36. package/dest/metrics.js +58 -5
  37. package/dest/proposal_handler.d.ts +108 -0
  38. package/dest/proposal_handler.d.ts.map +1 -0
  39. package/dest/proposal_handler.js +974 -0
  40. package/dest/validator.d.ts +47 -25
  41. package/dest/validator.d.ts.map +1 -1
  42. package/dest/validator.js +225 -229
  43. package/package.json +21 -17
  44. package/src/checkpoint_builder.ts +211 -61
  45. package/src/config.ts +32 -18
  46. package/src/duties/validation_service.ts +92 -36
  47. package/src/factory.ts +11 -3
  48. package/src/index.ts +1 -2
  49. package/src/key_store/ha_key_store.ts +269 -0
  50. package/src/key_store/index.ts +1 -0
  51. package/src/key_store/interface.ts +44 -5
  52. package/src/key_store/local_key_store.ts +13 -4
  53. package/src/key_store/node_keystore_adapter.ts +27 -4
  54. package/src/key_store/web3signer_key_store.ts +17 -4
  55. package/src/metrics.ts +81 -6
  56. package/src/proposal_handler.ts +1042 -0
  57. package/src/validator.ts +312 -265
  58. package/dest/block_proposal_handler.d.ts +0 -63
  59. package/dest/block_proposal_handler.d.ts.map +0 -1
  60. package/dest/block_proposal_handler.js +0 -551
  61. package/dest/tx_validator/index.d.ts +0 -3
  62. package/dest/tx_validator/index.d.ts.map +0 -1
  63. package/dest/tx_validator/index.js +0 -2
  64. package/dest/tx_validator/nullifier_cache.d.ts +0 -14
  65. package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
  66. package/dest/tx_validator/nullifier_cache.js +0 -24
  67. package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
  68. package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
  69. package/dest/tx_validator/tx_validator_factory.js +0 -53
  70. package/src/block_proposal_handler.ts +0 -556
  71. package/src/tx_validator/index.ts +0 -2
  72. package/src/tx_validator/nullifier_cache.ts +0 -30
  73. package/src/tx_validator/tx_validator_factory.ts +0 -133
package/README.md CHANGED
@@ -77,6 +77,8 @@ These rules must always hold:
77
77
  2. **Global variables match within checkpoint**: All blocks within the same checkpoint must have identical global variables (except `blockNumber`), which includes the slot number
78
78
  3. **inHash is constant**: All blocks in a checkpoint share the same L1-to-L2 messages hash
79
79
  4. **Sequential indexWithinCheckpoint**: Block N must have `indexWithinCheckpoint = parent.indexWithinCheckpoint + 1`
80
+ 5. **One proposer per slot**: Each slot has exactly one designated proposer. Sending multiple proposals for the same position (slot, indexWithinCheckpoint) with different content is equivocation and slashable
81
+ 6. **One attestation per slot**: Validators should only attest to one checkpoint per slot. Attesting to different proposals (different archives) for the same slot is equivocation and slashable
80
82
 
81
83
  ## Validation Flow
82
84
 
@@ -87,15 +89,14 @@ When a `BlockProposal` is received via P2P, the `BlockProposalHandler` performs:
87
89
  ```
88
90
  1. Verify proposer signature
89
91
  2. Check proposal is from current/next slot proposer (via BlockProposalValidator)
90
- 3. Find parent block by archive root (wait/retry if not synced)
91
- 4. Compute checkpoint number from parent
92
- 5. If indexWithinCheckpoint > 0:
93
- - Validate global variables match parent (chainId, version, slotNumber,
94
- timestamp, coinbase, feeRecipient, gasFees)
95
- 6. Verify inHash matches computed from L1-to-L2 messages
96
- 7. Collect transactions from pool/network/proposal
97
- 8. Re-execute transactions (if enabled)
98
- 9. Compare re-execution result with proposal
92
+ 3. Detect duplicate proposals (same slot + indexWithinCheckpoint, different archive) slashing proposer on equivocation
93
+ 4. Find parent block by archive root (wait/retry if not synced)
94
+ 5. Compute checkpoint number from parent
95
+ 6. If indexWithinCheckpoint > 0, then validate global variables match parent (chainId, version, slotNumber, timestamp, coinbase, feeRecipient, gasFees)
96
+ 7. Verify inHash matches computed from L1-to-L2 messages
97
+ 8. Collect transactions from pool/network/proposal
98
+ 9. Re-execute transactions (if enabled)
99
+ 10. Compare re-execution result with proposal
99
100
  ```
100
101
 
101
102
  ### Checkpoint Proposal Validation
@@ -155,19 +156,42 @@ Time | Proposer | Validator
155
156
 
156
157
  ## Configuration
157
158
 
158
- | Flag | Purpose |
159
- |------|---------|
160
- | `validatorReexecute` | Re-execute transactions to verify proposals |
161
- | `fishermanMode` | Validate proposals but don't broadcast attestations (monitoring only) |
162
- | `alwaysReexecuteBlockProposals` | Force re-execution even when not in committee |
163
- | `slashBroadcastedInvalidBlockPenalty` | Penalty amount for invalid proposals (0 = disabled) |
164
- | `validatorReexecuteDeadlineMs` | Time reserved at end of slot for propagation/publishing |
165
- | `attestationPollingIntervalMs` | How often to poll for attestations when collecting |
166
- | `disabledValidators` | Validator addresses to exclude from duties |
159
+ | Flag | Purpose |
160
+ | ------------------------------------- | -------------------------------------------------------------------------------------- |
161
+ | `fishermanMode` | Validate proposals but don't broadcast attestations (monitoring only) |
162
+ | `alwaysReexecuteBlockProposals` | Force re-execution even when not in committee |
163
+ | `slashBroadcastedInvalidBlockPenalty` | Penalty amount for invalid proposals (0 = disabled) |
164
+ | `slashDuplicateProposalPenalty` | Penalty amount for duplicate proposals (0 = disabled) |
165
+ | `slashDuplicateAttestationPenalty` | Penalty amount for duplicate attestations (0 = disabled) |
166
+ | `attestationPollingIntervalMs` | How often to poll for attestations when collecting |
167
+ | `disabledValidators` | Validator addresses to exclude from duties |
168
+
169
+ ### High Availability (HA) Keystore
170
+
171
+ When running multiple validator nodes with the same validator keys in a high-availability setup, enable HA signing to prevent double-signing:
172
+
173
+ | Environment Variable | Purpose |
174
+ | -------------------------------------- | ---------------------------------------------------------------------- |
175
+ | `VALIDATOR_HA_SIGNING_ENABLED` | Enable HA signing / slashing protection (default: false) |
176
+ | `VALIDATOR_HA_DATABASE_URL` | PostgreSQL connection string for coordination (required when enabled) |
177
+ | `VALIDATOR_HA_NODE_ID` | Unique identifier for this validator node (required when enabled) |
178
+ | `VALIDATOR_HA_POLLING_INTERVAL_MS` | How often to check duty status (default: 100) |
179
+ | `VALIDATOR_HA_SIGNING_TIMEOUT_MS` | Max wait for in-progress signing (default: 3000) |
180
+ | `VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS` | Max age of stuck duties before cleanup (default: 2\*aztecSlotDuration) |
181
+
182
+ When `VALIDATOR_HA_SIGNING_ENABLED=true`, the validator client automatically:
183
+
184
+ - Creates an HA signer using the provided configuration
185
+ - Wraps the base keystore with `HAKeyStore` for HA-protected signing
186
+ - Coordinates signing across nodes via PostgreSQL to prevent double-signing
187
+ - Provides slashing protection to block conflicting signatures
188
+
189
+ See [`@aztec/validator-ha-signer`](../validator-ha-signer/README.md) for more details.
167
190
 
168
191
  ### Fisherman Mode
169
192
 
170
193
  When `fishermanMode: true`, the validator:
194
+
171
195
  - Validates all proposals (block and checkpoint)
172
196
  - Re-executes transactions
173
197
  - Creates attestations internally for validation
@@ -179,6 +203,7 @@ This is useful for monitoring network health without participating in consensus.
179
203
  ### Key Methods
180
204
 
181
205
  **ValidatorClient** (`validator.ts`):
206
+
182
207
  - `validateBlockProposal(proposal, sender)` → `boolean`: Validates block, optionally re-executes, emits slash events
183
208
  - `attestToCheckpointProposal(proposal, sender)` → `CheckpointAttestation[]?`: Validates checkpoint and creates attestations
184
209
  - `collectAttestations(proposal, required, deadline)` → `CheckpointAttestation[]`: Waits for attestations from other validators
@@ -186,14 +211,57 @@ This is useful for monitoring network health without participating in consensus.
186
211
  - `createCheckpointProposal(...)` → `CheckpointProposal`: Creates and signs a checkpoint proposal
187
212
 
188
213
  **BlockProposalHandler** (`block_proposal_handler.ts`):
214
+
189
215
  - `handleBlockProposal(proposal, sender, shouldReexecute)` → `ValidationResult`: Full block validation pipeline
190
216
  - `reexecuteTransactions(proposal, blockNumber, txs, messages)` → `ReexecutionResult`: Re-runs transactions and compares state
191
217
 
192
218
  **ValidationService** (`duties/validation_service.ts`):
219
+
193
220
  - `createBlockProposal(...)` → `BlockProposal`: Signs block proposal with validator key
194
221
  - `createCheckpointProposal(...)` → `CheckpointProposal`: Signs checkpoint proposal
195
222
  - `attestToCheckpointProposal(proposal, attestors)` → `CheckpointAttestation[]`: Creates attestations for given addresses
196
223
 
224
+ ## Block Building Limits
225
+
226
+ L1 enforces gas and blob capacity per checkpoint. The node enforces these during block building to avoid L1 rejection. Three dimensions are metered: L2 gas (mana), DA gas, and blob fields. DA gas maps to blob fields today (`daGas = blobFields * 32`) but both are tracked independently.
227
+
228
+ ### Checkpoint limits
229
+
230
+ | Dimension | Source | Budget |
231
+ | --- | --- | --- |
232
+ | L2 gas (mana) | `rollup.getManaLimit()` | Fetched from L1 at startup |
233
+ | DA gas | `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT` | 786,432 (6 blobs × 4096 fields × 32 gas/field) |
234
+ | Blob fields | `BLOBS_PER_CHECKPOINT × FIELDS_PER_BLOB` | 24,576 minus checkpoint/block-end overhead |
235
+
236
+ ### Per-block budgets
237
+
238
+ Per-block budgets prevent one block from consuming the entire checkpoint budget. The checkpoint builder dynamically computes per-block limits before each block based on the remaining checkpoint budget and the number of remaining blocks.
239
+
240
+ **Proposer**: When building a proposal (`isBuildingProposal: true`), the `CheckpointProposalJob` passes `maxBlocksPerCheckpoint` (from the timetable) and `perBlockAllocationMultiplier` (default 1.2) via opts to `CheckpointBuilder.buildBlock`. The builder computes a fair share as `min(perBlockLimit, ceil(remainingBudget / remainingBlocks * multiplier), remainingBudget)`. The multiplier greater than 1 allows early blocks to use more than their even share, since different blocks hit different limit dimensions (L2 gas, DA gas, blob fields) — a strict even split would waste capacity. As prior blocks consume budget, later blocks see tightened limits. This applies to all four dimensions (L2 gas, DA gas, blob fields, transaction count). Operators can set hard per-block caps via `SEQ_MAX_L2_BLOCK_GAS` / `SEQ_MAX_DA_BLOCK_GAS` / `SEQ_MAX_TX_PER_BLOCK` (capped at checkpoint limits at startup); these act as additional upper bounds alongside the redistribution.
241
+
242
+ **Validator**: When re-executing a proposal (`isBuildingProposal` unset), `capLimitsByCheckpointBudgets` only caps by the per-block limit and the total remaining checkpoint budget — no redistribution or multiplier is applied. This avoids false rejections due to differences between proposer and validator fair-share calculations. Validators can optionally set hard per-block limits via `VALIDATOR_MAX_L2_BLOCK_GAS`, `VALIDATOR_MAX_DA_BLOCK_GAS`, and `VALIDATOR_MAX_TX_PER_BLOCK`. When unset, no per-block limit is enforced (checkpoint-level protocol limits still apply). These are independent of the `SEQ_` vars so operators can tune proposer and validation limits separately.
243
+
244
+ ### Per-transaction enforcement
245
+
246
+ **Mempool entry** (`GasLimitsValidator`): L2 gas must be ≤ `MAX_PROCESSABLE_L2_GAS` (6,540,000) and ≥ fixed minimums.
247
+
248
+ **Block building** (`PublicProcessor.process`): Before processing, txs are skipped if their estimated blob fields or gas limits would exceed the block budget. After processing, actual values are checked and the tx is reverted if limits are exceeded.
249
+
250
+ ### Gas limit configuration
251
+
252
+ | Variable | Default | Description |
253
+ | --- | --- | --- |
254
+ | `SEQ_MAX_L2_BLOCK_GAS` | *none* | Hard per-block L2 gas cap. Capped at `rollupManaLimit` at startup. When unset, redistribution dynamically computes per-block limits. |
255
+ | `SEQ_MAX_DA_BLOCK_GAS` | *none* | Hard per-block DA gas cap. Capped at `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT` at startup. When unset, redistribution handles it. |
256
+ | `SEQ_MAX_TX_PER_BLOCK` | *none* | Hard per-block tx count cap. Capped at `SEQ_MAX_TX_PER_CHECKPOINT` at startup (if set). |
257
+ | `SEQ_MAX_TX_PER_CHECKPOINT` | *none* | Total txs across all blocks in a checkpoint. When set, checkpoint-level capping and redistribution are enforced for tx count. |
258
+ | `SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER` | 1.2 | Multiplier for per-block budget redistribution. Passed via opts to the checkpoint builder during proposal building. |
259
+ | `SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET` | true | Legacy flag; redistribution is now always active during proposal building and inactive during validation. |
260
+ | `VALIDATOR_MAX_L2_BLOCK_GAS` | *none* | Per-block L2 gas limit for validation. Proposals exceeding this are rejected. |
261
+ | `VALIDATOR_MAX_DA_BLOCK_GAS` | *none* | Per-block DA gas limit for validation. Proposals exceeding this are rejected. |
262
+ | `VALIDATOR_MAX_TX_PER_BLOCK` | *none* | Per-block tx count limit for validation. Proposals exceeding this are rejected. |
263
+ | `VALIDATOR_MAX_TX_PER_CHECKPOINT` | *none* | Per-checkpoint tx count limit for validation. Proposals exceeding this are rejected. |
264
+
197
265
  ## Testing Patterns
198
266
 
199
267
  ### Common Mocks
@@ -204,7 +272,7 @@ Tests typically mock these dependencies:
204
272
  let epochCache: MockProxy<EpochCache>;
205
273
  let blockSource: MockProxy<L2BlockSource>;
206
274
  let txProvider: MockProxy<TxProvider>;
207
- let blockBuilder: MockProxy<IFullNodeBlockBuilder>;
275
+ let checkpointsBuilder: MockProxy<FullNodeCheckpointsBuilder>;
208
276
  let p2pClient: MockProxy<P2P>;
209
277
 
210
278
  beforeEach(() => {
@@ -219,19 +287,19 @@ beforeEach(() => {
219
287
  Use factory functions from `@aztec/stdlib/testing`:
220
288
 
221
289
  ```typescript
222
- import { makeBlockProposal, makeCheckpointProposal, makeL2BlockHeader } from '@aztec/stdlib/testing';
290
+ import { makeBlockHeader, makeBlockProposal, makeCheckpointHeader, makeCheckpointProposal } from '@aztec/stdlib/testing';
223
291
 
224
292
  // These are async - always await
225
293
  const blockProposal = await makeBlockProposal({
226
- blockHeader: makeL2BlockHeader(1, 100, 100), // epoch, block, slot
294
+ blockHeader: makeBlockHeader(1, { blockNumber: BlockNumber(100), slotNumber: SlotNumber(100) }),
227
295
  indexWithinCheckpoint: 0,
228
296
  signer: Secp256k1Signer.random(),
229
297
  });
230
298
 
231
299
  const checkpointProposal = await makeCheckpointProposal({
232
- checkpointHeader: makeL2BlockHeader(1, 100, 100).toCheckpointHeader(),
300
+ checkpointHeader: makeCheckpointHeader(1, { slotNumber: SlotNumber(100) }),
233
301
  signer: proposer,
234
- lastBlock: { blockHeader, txs },
302
+ lastBlock: { blockHeader: makeBlockHeader(1), txs },
235
303
  });
236
304
  ```
237
305
 
@@ -242,7 +310,7 @@ For tests that exercise re-execution:
242
310
  ```typescript
243
311
  // Mock parent block lookup
244
312
  blockSource.getBlockHeaderByArchive.mockResolvedValue(parentBlockHeader);
245
- blockSource.getL2BlockNew.mockResolvedValue({
313
+ blockSource.getL2Block.mockResolvedValue({
246
314
  checkpointNumber: CheckpointNumber(1),
247
315
  indexWithinCheckpoint: 0,
248
316
  header: { globalVariables: parentGlobalVariables },
@@ -1,70 +1,79 @@
1
1
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { DateProvider, Timer } from '@aztec/foundation/timer';
3
+ import { type LoggerBindings } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
4
5
  import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
5
- import { PublicProcessor } from '@aztec/simulator/server';
6
- import { L2BlockNew } from '@aztec/stdlib/block';
6
+ import { PublicContractsDB, PublicProcessor } from '@aztec/simulator/server';
7
+ import { L2Block } from '@aztec/stdlib/block';
7
8
  import { Checkpoint } from '@aztec/stdlib/checkpoint';
8
9
  import type { ContractDataSource } from '@aztec/stdlib/contract';
9
- import { Gas } from '@aztec/stdlib/gas';
10
- import { type FullNodeBlockBuilderConfig, type MerkleTreeWriteOperations, type PublicProcessorLimits } from '@aztec/stdlib/interfaces/server';
11
- import { type CheckpointGlobalVariables, type FailedTx, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
10
+ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
11
+ import { type BlockBuilderOptions, type BuildBlockInCheckpointResult, type FullNodeBlockBuilderConfig, type ICheckpointBlockBuilder, type ICheckpointsBuilder, type MerkleTreeWriteOperations, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
12
+ import { type DebugLogStore } from '@aztec/stdlib/logs';
13
+ import { type CheckpointGlobalVariables, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
12
14
  import { type TelemetryClient } from '@aztec/telemetry-client';
13
- export interface BuildBlockInCheckpointResult {
14
- block: L2BlockNew;
15
- publicGas: Gas;
16
- publicProcessorDuration: number;
17
- numTxs: number;
18
- failedTxs: FailedTx[];
19
- blockBuildingTimer: Timer;
20
- usedTxs: Tx[];
21
- }
15
+ export type { BuildBlockInCheckpointResult } from '@aztec/stdlib/interfaces/server';
22
16
  /**
23
17
  * Builder for a single checkpoint. Handles building blocks within the checkpoint
24
18
  * and completing it.
25
19
  */
26
- export declare class CheckpointBuilder {
20
+ export declare class CheckpointBuilder implements ICheckpointBlockBuilder {
27
21
  private checkpointBuilder;
28
22
  private fork;
29
23
  private config;
30
24
  private contractDataSource;
31
25
  private dateProvider;
32
26
  private telemetryClient;
33
- constructor(checkpointBuilder: LightweightCheckpointBuilder, fork: MerkleTreeWriteOperations, config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient: TelemetryClient);
27
+ private debugLogStore;
28
+ private log;
29
+ /** Persistent contracts DB shared across all blocks in this checkpoint. */
30
+ protected contractsDB: PublicContractsDB;
31
+ constructor(checkpointBuilder: LightweightCheckpointBuilder, fork: MerkleTreeWriteOperations, config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient: TelemetryClient, bindings?: LoggerBindings, debugLogStore?: DebugLogStore);
34
32
  getConstantData(): CheckpointGlobalVariables;
35
33
  /**
36
34
  * Builds a single block within this checkpoint.
35
+ * Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
37
36
  */
38
- buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: PublicProcessorLimits & {
37
+ buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: BlockBuilderOptions & {
39
38
  expectedEndState?: StateReference;
40
39
  }): Promise<BuildBlockInCheckpointResult>;
41
40
  /** Completes the checkpoint and returns it. */
42
41
  completeCheckpoint(): Promise<Checkpoint>;
43
42
  /** Gets the checkpoint currently in progress. */
44
43
  getCheckpoint(): Promise<Checkpoint>;
44
+ /**
45
+ * Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
46
+ * When building a proposal (isBuildingProposal=true), computes a fair share of remaining budget
47
+ * across remaining blocks scaled by the multiplier. When validating, only caps by per-block limit
48
+ * and remaining checkpoint budget (no redistribution or multiplier).
49
+ */
50
+ protected capLimitsByCheckpointBudgets(opts: BlockBuilderOptions): Pick<PublicProcessorLimits, 'maxBlockGas' | 'maxBlobFields' | 'maxTransactions'>;
45
51
  protected makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations): Promise<{
46
52
  processor: PublicProcessor;
47
53
  validator: import("@aztec/stdlib/interfaces/server").PublicProcessorValidator;
48
54
  }>;
49
55
  }
50
- /**
51
- * Factory for creating checkpoint builders.
52
- */
53
- export declare class FullNodeCheckpointsBuilder {
56
+ /** Factory for creating checkpoint builders. */
57
+ export declare class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
54
58
  private config;
59
+ private worldState;
55
60
  private contractDataSource;
56
61
  private dateProvider;
57
62
  private telemetryClient;
58
- constructor(config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient?: TelemetryClient);
63
+ private debugLogStore;
64
+ private log;
65
+ constructor(config: FullNodeBlockBuilderConfig & Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>, worldState: WorldStateSynchronizer, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient?: TelemetryClient, debugLogStore?: DebugLogStore);
59
66
  getConfig(): FullNodeBlockBuilderConfig;
60
67
  updateConfig(config: Partial<FullNodeBlockBuilderConfig>): void;
61
68
  /**
62
69
  * Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
63
70
  */
64
- startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], fork: MerkleTreeWriteOperations): Promise<CheckpointBuilder>;
71
+ startCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, feeAssetPriceModifier: bigint, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, bindings?: LoggerBindings): Promise<CheckpointBuilder>;
65
72
  /**
66
73
  * Opens a checkpoint, either starting fresh or resuming from existing blocks.
67
74
  */
68
- openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, l1ToL2Messages: Fr[], fork: MerkleTreeWriteOperations, existingBlocks?: L2BlockNew[]): Promise<CheckpointBuilder>;
75
+ openCheckpoint(checkpointNumber: CheckpointNumber, constants: CheckpointGlobalVariables, feeAssetPriceModifier: bigint, l1ToL2Messages: Fr[], previousCheckpointOutHashes: Fr[], fork: MerkleTreeWriteOperations, existingBlocks?: L2Block[], bindings?: LoggerBindings): Promise<CheckpointBuilder>;
76
+ /** Returns a fork of the world state at the given block number. */
77
+ getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
69
78
  }
70
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF9idWlsZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVoRixPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFHcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQVcsTUFBTSx5QkFBeUIsQ0FBQztBQUV2RSxPQUFPLEVBQUUsNEJBQTRCLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUMxRSxPQUFPLEVBR0wsZUFBZSxFQUVoQixNQUFNLHlCQUF5QixDQUFDO0FBQ2pDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNqRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDdEQsT0FBTyxLQUFLL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ACnB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,yBAAyB,EACpC,qBAAqB,EAAE,MAAM,EAC7B,cAAc,EAAE,EAAE,EAAE,EACpB,2BAA2B,EAAE,EAAE,EAAE,EACjC,IAAI,EAAE,yBAAyB,EAC/B,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAiC5B;IAED;;OAEG;IACG,cAAc,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,yBAAyB,EACpC,qBAAqB,EAAE,MAAM,EAC7B,cAAc,EAAE,EAAE,EAAE,EACpB,2BAA2B,EAAE,EAAE,EAAE,EACjC,IAAI,EAAE,yBAAyB,EAC/B,cAAc,GAAE,OAAO,EAAO,EAC9B,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA+C5B;IAED,mEAAmE;IACnE,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAEpE;CACF"}
@@ -1,17 +1,19 @@
1
- import { merge, pick } from '@aztec/foundation/collection';
1
+ import { NUM_CHECKPOINT_END_MARKER_FIELDS, getNumBlockEndBlobFields } from '@aztec/blob-lib/encoding';
2
+ import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB, MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT } from '@aztec/constants';
3
+ import { merge, pick, sum } from '@aztec/foundation/collection';
2
4
  import { createLogger } from '@aztec/foundation/log';
3
5
  import { bufferToHex } from '@aztec/foundation/string';
4
- import { Timer, elapsed } from '@aztec/foundation/timer';
5
- import { getDefaultAllowedSetupFunctions } from '@aztec/p2p/msg_validators';
6
+ import { elapsed } from '@aztec/foundation/timer';
7
+ import { createTxValidatorForBlockBuilding, getDefaultAllowedSetupFunctions } from '@aztec/p2p/msg_validators';
6
8
  import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
7
9
  import { GuardedMerkleTreeOperations, PublicContractsDB, PublicProcessor, createPublicTxSimulatorForBlockBuilding } from '@aztec/simulator/server';
8
10
  import { Gas } from '@aztec/stdlib/gas';
9
- import { FullNodeBlockBuilderConfigKeys } from '@aztec/stdlib/interfaces/server';
11
+ import { FullNodeBlockBuilderConfigKeys, InsufficientValidTxsError } from '@aztec/stdlib/interfaces/server';
12
+ import { NullDebugLogStore } from '@aztec/stdlib/logs';
10
13
  import { MerkleTreeId } from '@aztec/stdlib/trees';
11
14
  import { GlobalVariables } from '@aztec/stdlib/tx';
12
15
  import { getTelemetryClient } from '@aztec/telemetry-client';
13
- import { createValidatorForBlockBuilding } from './tx_validator/tx_validator_factory.js';
14
- const log = createLogger('checkpoint-builder');
16
+ import { ForkCheckpoint } from '@aztec/world-state';
15
17
  /**
16
18
  * Builder for a single checkpoint. Handles building blocks within the checkpoint
17
19
  * and completing it.
@@ -22,26 +24,36 @@ const log = createLogger('checkpoint-builder');
22
24
  contractDataSource;
23
25
  dateProvider;
24
26
  telemetryClient;
25
- constructor(checkpointBuilder, fork, config, contractDataSource, dateProvider, telemetryClient){
27
+ debugLogStore;
28
+ log;
29
+ /** Persistent contracts DB shared across all blocks in this checkpoint. */ contractsDB;
30
+ constructor(checkpointBuilder, fork, config, contractDataSource, dateProvider, telemetryClient, bindings, debugLogStore = new NullDebugLogStore()){
26
31
  this.checkpointBuilder = checkpointBuilder;
27
32
  this.fork = fork;
28
33
  this.config = config;
29
34
  this.contractDataSource = contractDataSource;
30
35
  this.dateProvider = dateProvider;
31
36
  this.telemetryClient = telemetryClient;
37
+ this.debugLogStore = debugLogStore;
38
+ this.log = createLogger('checkpoint-builder', {
39
+ ...bindings,
40
+ instanceId: `checkpoint-${checkpointBuilder.checkpointNumber}`
41
+ });
42
+ this.contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
32
43
  }
33
44
  getConstantData() {
34
45
  return this.checkpointBuilder.constants;
35
46
  }
36
47
  /**
37
48
  * Builds a single block within this checkpoint.
49
+ * Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
38
50
  */ async buildBlock(pendingTxs, blockNumber, timestamp, opts) {
39
- const blockBuildingTimer = new Timer();
40
51
  const slot = this.checkpointBuilder.constants.slotNumber;
41
- log.verbose(`Building block ${blockNumber} for slot ${slot} within checkpoint`, {
52
+ this.log.verbose(`Building block ${blockNumber} for slot ${slot} within checkpoint`, {
42
53
  slot,
43
54
  blockNumber,
44
- ...opts
55
+ ...opts,
56
+ currentTime: new Date(this.dateProvider.now())
45
57
  });
46
58
  const constants = this.checkpointBuilder.constants;
47
59
  const globalVariables = GlobalVariables.from({
@@ -55,28 +67,54 @@ const log = createLogger('checkpoint-builder');
55
67
  gasFees: constants.gasFees
56
68
  });
57
69
  const { processor, validator } = await this.makeBlockBuilderDeps(globalVariables, this.fork);
58
- const [publicProcessorDuration, [processedTxs, failedTxs, usedTxs]] = await elapsed(()=>processor.process(pendingTxs, opts, validator));
59
- // Add block to checkpoint
60
- const block = await this.checkpointBuilder.addBlock(globalVariables, processedTxs, {
61
- expectedEndState: opts.expectedEndState
62
- });
63
- // How much public gas was processed
64
- const publicGas = processedTxs.reduce((acc, tx)=>acc.add(tx.gasUsed.publicGas), Gas.empty());
65
- const res = {
66
- block,
67
- publicGas,
68
- publicProcessorDuration,
69
- numTxs: processedTxs.length,
70
- failedTxs,
71
- blockBuildingTimer,
72
- usedTxs
70
+ // Cap gas limits amd available blob fields by remaining checkpoint-level budgets
71
+ const cappedOpts = {
72
+ ...opts,
73
+ ...this.capLimitsByCheckpointBudgets(opts)
73
74
  };
74
- log.debug('Built block within checkpoint', res.block.header);
75
- return res;
75
+ // Create a block-level checkpoint on the contracts DB so we can roll back on failure
76
+ this.contractsDB.createCheckpoint();
77
+ // We execute all merkle tree operations on a world state fork checkpoint
78
+ // This enables us to discard all modifications in the event that we fail to successfully process sufficient transactions
79
+ const forkCheckpoint = await ForkCheckpoint.new(this.fork);
80
+ try {
81
+ const [publicProcessorDuration, [processedTxs, failedTxs, usedTxs]] = await elapsed(()=>processor.process(pendingTxs, cappedOpts, validator));
82
+ // Throw before updating state if we don't have enough valid txs
83
+ const minValidTxs = opts.minValidTxs ?? 0;
84
+ if (processedTxs.length < minValidTxs) {
85
+ throw new InsufficientValidTxsError(processedTxs.length, minValidTxs, failedTxs);
86
+ }
87
+ // Commit the fork checkpoint
88
+ await forkCheckpoint.commit();
89
+ // Add block to checkpoint
90
+ const { block } = await this.checkpointBuilder.addBlock(globalVariables, processedTxs, {
91
+ expectedEndState: opts.expectedEndState
92
+ });
93
+ this.contractsDB.commitCheckpoint();
94
+ this.log.debug('Built block within checkpoint', {
95
+ header: block.header.toInspect(),
96
+ processedTxs: processedTxs.map((tx)=>tx.hash.toString()),
97
+ failedTxs: failedTxs.map((tx)=>tx.tx.txHash.toString())
98
+ });
99
+ return {
100
+ block,
101
+ publicProcessorDuration,
102
+ numTxs: processedTxs.length,
103
+ failedTxs,
104
+ usedTxs
105
+ };
106
+ } catch (err) {
107
+ // Revert all changes to contracts db
108
+ this.contractsDB.revertCheckpoint();
109
+ // If we reached the point of committing the checkpoint, this does nothing
110
+ // Otherwise it reverts any changes made to the fork for this failed block
111
+ await forkCheckpoint.revert();
112
+ throw err;
113
+ }
76
114
  }
77
115
  /** Completes the checkpoint and returns it. */ async completeCheckpoint() {
78
116
  const checkpoint = await this.checkpointBuilder.completeCheckpoint();
79
- log.verbose(`Completed checkpoint ${checkpoint.number}`, {
117
+ this.log.verbose(`Completed checkpoint ${checkpoint.number}`, {
80
118
  checkpointNumber: checkpoint.number,
81
119
  numBlocks: checkpoint.blocks.length,
82
120
  archiveRoot: checkpoint.archive.root.toString()
@@ -86,31 +124,84 @@ const log = createLogger('checkpoint-builder');
86
124
  /** Gets the checkpoint currently in progress. */ getCheckpoint() {
87
125
  return this.checkpointBuilder.clone().completeCheckpoint();
88
126
  }
127
+ /**
128
+ * Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
129
+ * When building a proposal (isBuildingProposal=true), computes a fair share of remaining budget
130
+ * across remaining blocks scaled by the multiplier. When validating, only caps by per-block limit
131
+ * and remaining checkpoint budget (no redistribution or multiplier).
132
+ */ capLimitsByCheckpointBudgets(opts) {
133
+ const existingBlocks = this.checkpointBuilder.getBlocks();
134
+ // Remaining L2 gas (mana)
135
+ // IMPORTANT: This assumes mana is computed solely based on L2 gas used in transactions.
136
+ // This may change in the future.
137
+ const usedMana = sum(existingBlocks.map((b)=>b.header.totalManaUsed.toNumber()));
138
+ const remainingMana = this.config.rollupManaLimit - usedMana;
139
+ // Remaining DA gas
140
+ const usedDAGas = sum(existingBlocks.map((b)=>b.computeDAGasUsed())) ?? 0;
141
+ const remainingDAGas = MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT - usedDAGas;
142
+ // Remaining blob fields (block blob fields include both tx data and block-end overhead)
143
+ const usedBlobFields = sum(existingBlocks.map((b)=>b.toBlobFields().length));
144
+ const totalBlobCapacity = BLOBS_PER_CHECKPOINT * FIELDS_PER_BLOB - NUM_CHECKPOINT_END_MARKER_FIELDS;
145
+ const isFirstBlock = existingBlocks.length === 0;
146
+ const blockEndOverhead = getNumBlockEndBlobFields(isFirstBlock);
147
+ const maxBlobFieldsForTxs = totalBlobCapacity - usedBlobFields - blockEndOverhead;
148
+ // Remaining txs
149
+ const usedTxs = sum(existingBlocks.map((b)=>b.body.txEffects.length));
150
+ const remainingTxs = Math.max(0, (this.config.maxTxsPerCheckpoint ?? Infinity) - usedTxs);
151
+ // Cap by per-block limit + remaining checkpoint budget
152
+ let cappedL2Gas = Math.min(opts.maxBlockGas?.l2Gas ?? Infinity, remainingMana);
153
+ let cappedDAGas = Math.min(opts.maxBlockGas?.daGas ?? Infinity, remainingDAGas);
154
+ let cappedBlobFields = Math.min(opts.maxBlobFields ?? Infinity, maxBlobFieldsForTxs);
155
+ let cappedMaxTransactions = Math.min(opts.maxTransactions ?? Infinity, remainingTxs);
156
+ // Proposer mode: further cap by fair share of remaining budget across remaining blocks
157
+ if (opts.isBuildingProposal) {
158
+ const remainingBlocks = Math.max(1, opts.maxBlocksPerCheckpoint - existingBlocks.length);
159
+ const multiplier = opts.perBlockAllocationMultiplier;
160
+ cappedL2Gas = Math.min(cappedL2Gas, Math.ceil(remainingMana / remainingBlocks * multiplier));
161
+ cappedDAGas = Math.min(cappedDAGas, Math.ceil(remainingDAGas / remainingBlocks * multiplier));
162
+ cappedBlobFields = Math.min(cappedBlobFields, Math.ceil(maxBlobFieldsForTxs / remainingBlocks * multiplier));
163
+ cappedMaxTransactions = Math.min(cappedMaxTransactions, Math.ceil(remainingTxs / remainingBlocks * multiplier));
164
+ }
165
+ return {
166
+ maxBlockGas: new Gas(cappedDAGas, cappedL2Gas),
167
+ maxBlobFields: cappedBlobFields,
168
+ maxTransactions: Number.isFinite(cappedMaxTransactions) ? cappedMaxTransactions : undefined
169
+ };
170
+ }
89
171
  async makeBlockBuilderDeps(globalVariables, fork) {
90
- const txPublicSetupAllowList = this.config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
91
- const contractsDB = new PublicContractsDB(this.contractDataSource);
172
+ const txPublicSetupAllowList = [
173
+ ...await getDefaultAllowedSetupFunctions(),
174
+ ...this.config.txPublicSetupAllowListExtend ?? []
175
+ ];
176
+ const contractsDB = this.contractsDB;
92
177
  const guardedFork = new GuardedMerkleTreeOperations(fork);
93
- const publicTxSimulator = createPublicTxSimulatorForBlockBuilding(guardedFork, contractsDB, globalVariables, this.telemetryClient);
94
- const processor = new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient, undefined, this.config);
95
- const validator = createValidatorForBlockBuilding(fork, this.contractDataSource, globalVariables, txPublicSetupAllowList);
178
+ const collectDebugLogs = this.debugLogStore.isEnabled;
179
+ const bindings = this.log.getBindings();
180
+ const publicTxSimulator = createPublicTxSimulatorForBlockBuilding(guardedFork, contractsDB, globalVariables, this.telemetryClient, bindings, collectDebugLogs);
181
+ const processor = new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient, createLogger('simulator:public-processor', bindings), this.config, this.debugLogStore);
182
+ const validator = createTxValidatorForBlockBuilding(fork, this.contractDataSource, globalVariables, txPublicSetupAllowList, this.log.getBindings());
96
183
  return {
97
184
  processor,
98
185
  validator
99
186
  };
100
187
  }
101
188
  }
102
- /**
103
- * Factory for creating checkpoint builders.
104
- */ export class FullNodeCheckpointsBuilder {
189
+ /** Factory for creating checkpoint builders. */ export class FullNodeCheckpointsBuilder {
105
190
  config;
191
+ worldState;
106
192
  contractDataSource;
107
193
  dateProvider;
108
194
  telemetryClient;
109
- constructor(config, contractDataSource, dateProvider, telemetryClient = getTelemetryClient()){
195
+ debugLogStore;
196
+ log;
197
+ constructor(config, worldState, contractDataSource, dateProvider, telemetryClient = getTelemetryClient(), debugLogStore = new NullDebugLogStore()){
110
198
  this.config = config;
199
+ this.worldState = worldState;
111
200
  this.contractDataSource = contractDataSource;
112
201
  this.dateProvider = dateProvider;
113
202
  this.telemetryClient = telemetryClient;
203
+ this.debugLogStore = debugLogStore;
204
+ this.log = createLogger('checkpoint-builder');
114
205
  }
115
206
  getConfig() {
116
207
  return this.config;
@@ -120,36 +211,41 @@ const log = createLogger('checkpoint-builder');
120
211
  }
121
212
  /**
122
213
  * Starts a new checkpoint and returns a CheckpointBuilder to build blocks within it.
123
- */ async startCheckpoint(checkpointNumber, constants, l1ToL2Messages, fork) {
214
+ */ async startCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings) {
124
215
  const stateReference = await fork.getStateReference();
125
216
  const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
126
- log.verbose(`Building new checkpoint ${checkpointNumber}`, {
217
+ this.log.verbose(`Building new checkpoint ${checkpointNumber}`, {
127
218
  checkpointNumber,
128
219
  msgCount: l1ToL2Messages.length,
129
220
  initialStateReference: stateReference.toInspect(),
130
221
  initialArchiveRoot: bufferToHex(archiveTree.root),
131
- constants
222
+ constants,
223
+ feeAssetPriceModifier
132
224
  });
133
- const lightweightBuilder = await LightweightCheckpointBuilder.startNewCheckpoint(checkpointNumber, constants, l1ToL2Messages, fork);
134
- return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient);
225
+ const lightweightBuilder = await LightweightCheckpointBuilder.startNewCheckpoint(checkpointNumber, constants, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings, feeAssetPriceModifier);
226
+ return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient, bindings, this.debugLogStore);
135
227
  }
136
228
  /**
137
229
  * Opens a checkpoint, either starting fresh or resuming from existing blocks.
138
- */ async openCheckpoint(checkpointNumber, constants, l1ToL2Messages, fork, existingBlocks = []) {
230
+ */ async openCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, existingBlocks = [], bindings) {
139
231
  const stateReference = await fork.getStateReference();
140
232
  const archiveTree = await fork.getTreeInfo(MerkleTreeId.ARCHIVE);
141
233
  if (existingBlocks.length === 0) {
142
- return this.startCheckpoint(checkpointNumber, constants, l1ToL2Messages, fork);
234
+ return this.startCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, bindings);
143
235
  }
144
- log.verbose(`Resuming checkpoint ${checkpointNumber} with ${existingBlocks.length} existing blocks`, {
236
+ this.log.verbose(`Resuming checkpoint ${checkpointNumber} with ${existingBlocks.length} existing blocks`, {
145
237
  checkpointNumber,
146
238
  msgCount: l1ToL2Messages.length,
147
239
  existingBlockCount: existingBlocks.length,
148
240
  initialStateReference: stateReference.toInspect(),
149
241
  initialArchiveRoot: bufferToHex(archiveTree.root),
150
- constants
242
+ constants,
243
+ feeAssetPriceModifier
151
244
  });
152
- const lightweightBuilder = await LightweightCheckpointBuilder.resumeCheckpoint(checkpointNumber, constants, l1ToL2Messages, fork, existingBlocks);
153
- return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient);
245
+ const lightweightBuilder = await LightweightCheckpointBuilder.resumeCheckpoint(checkpointNumber, constants, feeAssetPriceModifier, l1ToL2Messages, previousCheckpointOutHashes, fork, existingBlocks, bindings);
246
+ return new CheckpointBuilder(lightweightBuilder, fork, this.config, this.contractDataSource, this.dateProvider, this.telemetryClient, bindings, this.debugLogStore);
247
+ }
248
+ /** Returns a fork of the world state at the given block number. */ getFork(blockNumber) {
249
+ return this.worldState.fork(blockNumber);
154
250
  }
155
251
  }
package/dest/config.d.ts CHANGED
@@ -8,4 +8,4 @@ export declare const validatorClientConfigMappings: ConfigMappingsType<Validator
8
8
  * @returns The validator configuration.
9
9
  */
10
10
  export declare function getProverEnvVars(): ValidatorClientConfig;
11
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUt4QixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0UsWUFBWSxFQUFFLHFCQUFxQixFQUFFLENBQUM7QUFFdEMsZUFBTyxNQUFNLDZCQUE2QixFQUFFLGtCQUFrQixDQUFDLHFCQUFxQixDQXNFbkYsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBZ0IsZ0JBQWdCLElBQUkscUJBQXFCLENBRXhEIn0=
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUt4QixNQUFNLDBCQUEwQixDQUFDO0FBR2xDLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0UsWUFBWSxFQUFFLHFCQUFxQixFQUFFLENBQUM7QUFFdEMsZUFBTyxNQUFNLDZCQUE2QixFQUFFLGtCQUFrQixDQUFDLHFCQUFxQixDQW1GbkYsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBZ0IsZ0JBQWdCLElBQUkscUJBQXFCLENBRXhEIn0=