@aztec/validator-client 5.0.0-private.20260318 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -22
- package/dest/checkpoint_builder.d.ts +10 -8
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +31 -28
- package/dest/config.d.ts +9 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +23 -10
- package/dest/duties/validation_service.d.ts +12 -13
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +32 -38
- package/dest/factory.d.ts +10 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +18 -6
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/metrics.d.ts +6 -2
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +12 -0
- package/dest/proposal_handler.d.ts +142 -0
- package/dest/proposal_handler.d.ts.map +1 -0
- package/dest/proposal_handler.js +1081 -0
- package/dest/validator.d.ts +28 -20
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +241 -262
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +40 -33
- package/src/config.ts +31 -12
- package/src/duties/validation_service.ts +51 -47
- package/src/factory.ts +29 -5
- package/src/index.ts +1 -1
- package/src/metrics.ts +19 -1
- package/src/proposal_handler.ts +1160 -0
- package/src/validator.ts +313 -294
- package/dest/block_proposal_handler.d.ts +0 -64
- package/dest/block_proposal_handler.d.ts.map +0 -1
- package/dest/block_proposal_handler.js +0 -606
- package/src/block_proposal_handler.ts +0 -624
package/README.md
CHANGED
|
@@ -156,17 +156,16 @@ Time | Proposer | Validator
|
|
|
156
156
|
|
|
157
157
|
## Configuration
|
|
158
158
|
|
|
159
|
-
| Flag
|
|
160
|
-
|
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `slashDuplicateProposalPenalty`
|
|
166
|
-
| `slashDuplicateAttestationPenalty`
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `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
|
+
| `slashBroadcastedInvalidCheckpointProposalPenalty` | Penalty amount for invalid checkpoint proposals (0 = disabled) |
|
|
165
|
+
| `slashDuplicateProposalPenalty` | Penalty amount for duplicate proposals (0 = disabled) |
|
|
166
|
+
| `slashDuplicateAttestationPenalty` | Penalty amount for duplicate attestations (0 = disabled) |
|
|
167
|
+
| `attestationPollingIntervalMs` | How often to poll for attestations when collecting |
|
|
168
|
+
| `disabledValidators` | Validator addresses to exclude from duties |
|
|
170
169
|
|
|
171
170
|
### High Availability (HA) Keystore
|
|
172
171
|
|
|
@@ -227,6 +226,8 @@ This is useful for monitoring network health without participating in consensus.
|
|
|
227
226
|
|
|
228
227
|
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.
|
|
229
228
|
|
|
229
|
+
The full per-tx → per-block → per-checkpoint limits hierarchy, including how the per-block budgets relate to the network admission limits, is documented in [`stdlib/src/gas/README.md`](../stdlib/src/gas/README.md) under "Gas and Data Limits".
|
|
230
|
+
|
|
230
231
|
### Checkpoint limits
|
|
231
232
|
|
|
232
233
|
| Dimension | Source | Budget |
|
|
@@ -237,13 +238,11 @@ L1 enforces gas and blob capacity per checkpoint. The node enforces these during
|
|
|
237
238
|
|
|
238
239
|
### Per-block budgets
|
|
239
240
|
|
|
240
|
-
Per-block budgets prevent one block from consuming the entire checkpoint budget.
|
|
241
|
-
|
|
242
|
-
**Proposer**: `computeBlockLimits()` derives budgets at startup as `min(checkpointLimit, ceil(checkpointLimit / maxBlocks * multiplier))`, where `maxBlocks` comes from the timetable and `multiplier` defaults to 1.2. The multiplier greater than 1 allows early blocks to use more than their even share of the checkpoint budget, since different blocks hit different limit dimensions (L2 gas, DA gas, blob fields) — a strict even split would waste capacity. Operators can override via `SEQ_MAX_L2_BLOCK_GAS` / `SEQ_MAX_DA_BLOCK_GAS` / `SEQ_MAX_TX_PER_BLOCK` (capped at checkpoint limits). Per-block TX limits follow the same derivation pattern when `SEQ_MAX_TX_PER_CHECKPOINT` is set.
|
|
241
|
+
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.
|
|
243
242
|
|
|
244
|
-
**
|
|
243
|
+
**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.
|
|
245
244
|
|
|
246
|
-
**
|
|
245
|
+
**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.
|
|
247
246
|
|
|
248
247
|
### Per-transaction enforcement
|
|
249
248
|
|
|
@@ -255,12 +254,12 @@ Per-block budgets prevent one block from consuming the entire checkpoint budget.
|
|
|
255
254
|
|
|
256
255
|
| Variable | Default | Description |
|
|
257
256
|
| --- | --- | --- |
|
|
258
|
-
| `SEQ_MAX_L2_BLOCK_GAS` | *
|
|
259
|
-
| `SEQ_MAX_DA_BLOCK_GAS` | *
|
|
260
|
-
| `SEQ_MAX_TX_PER_BLOCK` | *none* |
|
|
261
|
-
| `SEQ_MAX_TX_PER_CHECKPOINT` | *none* | Total txs across all blocks in a checkpoint. When set,
|
|
262
|
-
| `SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER` | 1.2 | Multiplier for per-block budget
|
|
263
|
-
| `SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET` | true |
|
|
257
|
+
| `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. |
|
|
258
|
+
| `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. |
|
|
259
|
+
| `SEQ_MAX_TX_PER_BLOCK` | *none* | Hard per-block tx count cap. Capped at `SEQ_MAX_TX_PER_CHECKPOINT` at startup (if set). |
|
|
260
|
+
| `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. |
|
|
261
|
+
| `SEQ_PER_BLOCK_ALLOCATION_MULTIPLIER` | 1.2 | Multiplier for per-block budget redistribution. Passed via opts to the checkpoint builder during proposal building. |
|
|
262
|
+
| `SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET` | true | Legacy flag; redistribution is now always active during proposal building and inactive during validation. |
|
|
264
263
|
| `VALIDATOR_MAX_L2_BLOCK_GAS` | *none* | Per-block L2 gas limit for validation. Proposals exceeding this are rejected. |
|
|
265
264
|
| `VALIDATOR_MAX_DA_BLOCK_GAS` | *none* | Per-block DA gas limit for validation. Proposals exceeding this are rejected. |
|
|
266
265
|
| `VALIDATOR_MAX_TX_PER_BLOCK` | *none* | Per-block tx count limit for validation. Proposals exceeding this are rejected. |
|
|
@@ -3,12 +3,12 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
4
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
5
|
import { LightweightCheckpointBuilder } from '@aztec/prover-client/light';
|
|
6
|
-
import { PublicProcessor } from '@aztec/simulator/server';
|
|
6
|
+
import { PublicContractsDB, PublicProcessor } from '@aztec/simulator/server';
|
|
7
7
|
import { L2Block } from '@aztec/stdlib/block';
|
|
8
8
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
10
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
11
|
-
import { type BuildBlockInCheckpointResult, type FullNodeBlockBuilderConfig, type ICheckpointBlockBuilder, type ICheckpointsBuilder, type MerkleTreeWriteOperations, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import { type BlockBuilderOptions, type BuildBlockInCheckpointResult, type FullNodeBlockBuilderConfig, type ICheckpointBlockBuilder, type ICheckpointsBuilder, type MerkleTreeWriteOperations, type PublicProcessorLimits, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
12
12
|
import { type DebugLogStore } from '@aztec/stdlib/logs';
|
|
13
13
|
import { type CheckpointGlobalVariables, GlobalVariables, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
14
14
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -26,15 +26,16 @@ export declare class CheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
26
26
|
private telemetryClient;
|
|
27
27
|
private debugLogStore;
|
|
28
28
|
private log;
|
|
29
|
+
/** Persistent contracts DB shared across all blocks in this checkpoint. */
|
|
30
|
+
protected contractsDB: PublicContractsDB;
|
|
29
31
|
constructor(checkpointBuilder: LightweightCheckpointBuilder, fork: MerkleTreeWriteOperations, config: FullNodeBlockBuilderConfig, contractDataSource: ContractDataSource, dateProvider: DateProvider, telemetryClient: TelemetryClient, bindings?: LoggerBindings, debugLogStore?: DebugLogStore);
|
|
30
32
|
getConstantData(): CheckpointGlobalVariables;
|
|
31
33
|
/**
|
|
32
34
|
* Builds a single block within this checkpoint.
|
|
33
35
|
* Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
|
|
34
36
|
*/
|
|
35
|
-
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts
|
|
37
|
+
buildBlock(pendingTxs: Iterable<Tx> | AsyncIterable<Tx>, blockNumber: BlockNumber, timestamp: bigint, opts: BlockBuilderOptions & {
|
|
36
38
|
expectedEndState?: StateReference;
|
|
37
|
-
minValidTxs?: number;
|
|
38
39
|
}): Promise<BuildBlockInCheckpointResult>;
|
|
39
40
|
/** Completes the checkpoint and returns it. */
|
|
40
41
|
completeCheckpoint(): Promise<Checkpoint>;
|
|
@@ -42,10 +43,11 @@ export declare class CheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
42
43
|
getCheckpoint(): Promise<Checkpoint>;
|
|
43
44
|
/**
|
|
44
45
|
* Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
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).
|
|
47
49
|
*/
|
|
48
|
-
protected capLimitsByCheckpointBudgets(opts:
|
|
50
|
+
protected capLimitsByCheckpointBudgets(opts: BlockBuilderOptions): Pick<PublicProcessorLimits, 'maxBlockGas' | 'maxBlobFields' | 'maxTransactions'>;
|
|
49
51
|
protected makeBlockBuilderDeps(globalVariables: GlobalVariables, fork: MerkleTreeWriteOperations): Promise<{
|
|
50
52
|
processor: PublicProcessor;
|
|
51
53
|
validator: import("@aztec/stdlib/interfaces/server").PublicProcessorValidator;
|
|
@@ -74,4 +76,4 @@ export declare class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
74
76
|
/** Returns a fork of the world state at the given block number. */
|
|
75
77
|
getFork(blockNumber: BlockNumber): Promise<MerkleTreeWriteOperations>;
|
|
76
78
|
}
|
|
77
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludF9idWlsZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY2hlY2twb2ludF9idWlsZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVoRixPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBRXZGLE9BQU8sRUFBRSxZQUFZLEVBQVcsTUFBTSx5QkFBeUIsQ0FBQztBQUVoRSxPQUFPLEVBQUUsNEJBQTRCLEVBQUUs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RUFDL0IsUUFBUSxDQUFDLEVBQUUsY0FBYyxHQUN4QixPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FpQzVCO0lBRUQ7O09BRUc7SUFDRyxjQUFjLENBQ2xCLGdCQUFnQixFQUFFLGdCQUFnQixFQUNsQyxTQUFTLEVBQUUseUJBQXlCLEVBQ3BDLHFCQUFxQixFQUFFLE1BQU0sRUFDN0IsY0FBYyxFQUFFLEVBQUUsRUFBRSxFQUNwQiwyQkFBMkIsRUFBRSxFQUFFLEVBQUUsRUFDakMsSUFBSSxFQUFFLHlCQUF5QixFQUMvQixjQUFjLEdBQUUsT0FBTyxFQUFPLEVBQzlCLFFBQVEsQ0FBQyxFQUFFLGNBQWMsR0FDeEIsT0FBTyxDQUFDLGlCQUFpQixDQUFDLENBK0M1QjtJQUVELG1FQUFtRTtJQUNuRSxPQUFPLENBQUMsV0FBVyxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMseUJBQXlCLENBQUMsQ0FFcEU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint_builder.d.ts","sourceRoot":"","sources":["../src/checkpoint_builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAE,YAAY,EAAW,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"checkpoint_builder.d.ts","sourceRoot":"","sources":["../src/checkpoint_builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC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AU,EAAE,sBAAsB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,eAAe,GAAE,eAAsC,EACvD,aAAa,GAAE,aAAuC,EAG/D;IAEM,SAAS,IAAI,0BAA0B,CAE7C;IAEM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,0BAA0B,CAAC,QAE9D;IAED;;OAEG;IACG,eAAe,CACnB,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"}
|
|
@@ -26,6 +26,7 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
26
26
|
telemetryClient;
|
|
27
27
|
debugLogStore;
|
|
28
28
|
log;
|
|
29
|
+
/** Persistent contracts DB shared across all blocks in this checkpoint. */ contractsDB;
|
|
29
30
|
constructor(checkpointBuilder, fork, config, contractDataSource, dateProvider, telemetryClient, bindings, debugLogStore = new NullDebugLogStore()){
|
|
30
31
|
this.checkpointBuilder = checkpointBuilder;
|
|
31
32
|
this.fork = fork;
|
|
@@ -38,6 +39,7 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
38
39
|
...bindings,
|
|
39
40
|
instanceId: `checkpoint-${checkpointBuilder.checkpointNumber}`
|
|
40
41
|
});
|
|
42
|
+
this.contractsDB = new PublicContractsDB(this.contractDataSource, this.log.getBindings());
|
|
41
43
|
}
|
|
42
44
|
getConstantData() {
|
|
43
45
|
return this.checkpointBuilder.constants;
|
|
@@ -45,7 +47,7 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
45
47
|
/**
|
|
46
48
|
* Builds a single block within this checkpoint.
|
|
47
49
|
* Automatically caps gas and blob field limits based on checkpoint-level budgets and prior blocks.
|
|
48
|
-
*/ async buildBlock(pendingTxs, blockNumber, timestamp, opts
|
|
50
|
+
*/ async buildBlock(pendingTxs, blockNumber, timestamp, opts) {
|
|
49
51
|
const slot = this.checkpointBuilder.constants.slotNumber;
|
|
50
52
|
this.log.verbose(`Building block ${blockNumber} for slot ${slot} within checkpoint`, {
|
|
51
53
|
slot,
|
|
@@ -70,6 +72,8 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
70
72
|
...opts,
|
|
71
73
|
...this.capLimitsByCheckpointBudgets(opts)
|
|
72
74
|
};
|
|
75
|
+
// Create a block-level checkpoint on the contracts DB so we can roll back on failure
|
|
76
|
+
this.contractsDB.createCheckpoint();
|
|
73
77
|
// We execute all merkle tree operations on a world state fork checkpoint
|
|
74
78
|
// This enables us to discard all modifications in the event that we fail to successfully process sufficient transactions
|
|
75
79
|
const forkCheckpoint = await ForkCheckpoint.new(this.fork);
|
|
@@ -86,6 +90,7 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
86
90
|
const { block } = await this.checkpointBuilder.addBlock(globalVariables, processedTxs, {
|
|
87
91
|
expectedEndState: opts.expectedEndState
|
|
88
92
|
});
|
|
93
|
+
this.contractsDB.commitCheckpoint();
|
|
89
94
|
this.log.debug('Built block within checkpoint', {
|
|
90
95
|
header: block.header.toInspect(),
|
|
91
96
|
processedTxs: processedTxs.map((tx)=>tx.hash.toString()),
|
|
@@ -99,6 +104,8 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
99
104
|
usedTxs
|
|
100
105
|
};
|
|
101
106
|
} catch (err) {
|
|
107
|
+
// Revert all changes to contracts db
|
|
108
|
+
this.contractsDB.revertCheckpoint();
|
|
102
109
|
// If we reached the point of committing the checkpoint, this does nothing
|
|
103
110
|
// Otherwise it reverts any changes made to the fork for this failed block
|
|
104
111
|
await forkCheckpoint.revert();
|
|
@@ -119,8 +126,9 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
119
126
|
}
|
|
120
127
|
/**
|
|
121
128
|
* Caps per-block gas and blob field limits by remaining checkpoint-level budgets.
|
|
122
|
-
*
|
|
123
|
-
*
|
|
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).
|
|
124
132
|
*/ capLimitsByCheckpointBudgets(opts) {
|
|
125
133
|
const existingBlocks = this.checkpointBuilder.getBlocks();
|
|
126
134
|
// Remaining L2 gas (mana)
|
|
@@ -137,34 +145,29 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
137
145
|
const isFirstBlock = existingBlocks.length === 0;
|
|
138
146
|
const blockEndOverhead = getNumBlockEndBlobFields(isFirstBlock);
|
|
139
147
|
const maxBlobFieldsForTxs = totalBlobCapacity - usedBlobFields - blockEndOverhead;
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const remainingTxs = Math.max(0, this.config.maxTxsPerCheckpoint - usedTxs);
|
|
159
|
-
const fairShareTxs = redistribute ? Math.ceil(remainingTxs / remainingBlocks * multiplier) : Infinity;
|
|
160
|
-
cappedMaxTransactions = Math.min(opts.maxTransactions ?? Infinity, fairShareTxs, remainingTxs);
|
|
161
|
-
} else {
|
|
162
|
-
cappedMaxTransactions = opts.maxTransactions;
|
|
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
|
+
// DA gas and blob fields use a higher multiplier so the largest contract class deploy fits a block.
|
|
161
|
+
const daMultiplier = opts.perBlockDAAllocationMultiplier ?? multiplier;
|
|
162
|
+
cappedL2Gas = Math.min(cappedL2Gas, Math.ceil(remainingMana / remainingBlocks * multiplier));
|
|
163
|
+
cappedDAGas = Math.min(cappedDAGas, Math.ceil(remainingDAGas / remainingBlocks * daMultiplier));
|
|
164
|
+
cappedBlobFields = Math.min(cappedBlobFields, Math.ceil(maxBlobFieldsForTxs / remainingBlocks * daMultiplier));
|
|
165
|
+
cappedMaxTransactions = Math.min(cappedMaxTransactions, Math.ceil(remainingTxs / remainingBlocks * multiplier));
|
|
163
166
|
}
|
|
164
167
|
return {
|
|
165
168
|
maxBlockGas: new Gas(cappedDAGas, cappedL2Gas),
|
|
166
169
|
maxBlobFields: cappedBlobFields,
|
|
167
|
-
maxTransactions: cappedMaxTransactions
|
|
170
|
+
maxTransactions: Number.isFinite(cappedMaxTransactions) ? cappedMaxTransactions : undefined
|
|
168
171
|
};
|
|
169
172
|
}
|
|
170
173
|
async makeBlockBuilderDeps(globalVariables, fork) {
|
|
@@ -172,7 +175,7 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
172
175
|
...await getDefaultAllowedSetupFunctions(),
|
|
173
176
|
...this.config.txPublicSetupAllowListExtend ?? []
|
|
174
177
|
];
|
|
175
|
-
const contractsDB =
|
|
178
|
+
const contractsDB = this.contractsDB;
|
|
176
179
|
const guardedFork = new GuardedMerkleTreeOperations(fork);
|
|
177
180
|
const collectDebugLogs = this.debugLogStore.isEnabled;
|
|
178
181
|
const bindings = this.log.getBindings();
|
package/dest/config.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
|
+
import { type SequencerConfig } from '@aztec/stdlib/config';
|
|
2
3
|
import type { ValidatorClientConfig } from '@aztec/stdlib/interfaces/server';
|
|
3
4
|
export type { ValidatorClientConfig };
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Default clock-disparity tolerance (ms) for proposal/attestation receive windows, mirroring the p2p config
|
|
7
|
+
* default. Used by the validator-client validators when the merged node config does not carry the value.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_MAX_GOSSIP_CLOCK_DISPARITY_MS = 500;
|
|
10
|
+
export declare const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientConfig & Pick<SequencerConfig, 'blockDurationMs'>>;
|
|
5
11
|
/**
|
|
6
12
|
* Returns the prover configuration from the environment variables.
|
|
7
13
|
* Note: If an environment variable is not set, the default value is used.
|
|
8
14
|
* @returns The validator configuration.
|
|
9
15
|
*/
|
|
10
|
-
export declare function getProverEnvVars(): ValidatorClientConfig
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
export declare function getProverEnvVars(): ValidatorClientConfig & Pick<SequencerConfig, 'blockDurationMs'>;
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQU94QixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBaUMsTUFBTSxzQkFBc0IsQ0FBQztBQUUzRixPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRTdFLFlBQVksRUFBRSxxQkFBcUIsRUFBRSxDQUFDO0FBRXRDOzs7R0FHRztBQUNILGVBQU8sTUFBTSxxQ0FBcUMsTUFBTSxDQUFDO0FBRXpELGVBQU8sTUFBTSw2QkFBNkIsRUFBRSxrQkFBa0IsQ0FDNUQscUJBQXFCLEdBQUcsSUFBSSxDQUFDLGVBQWUsRUFBRSxpQkFBaUIsQ0FBQyxDQStGakUsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBZ0IsZ0JBQWdCLElBQUkscUJBQXFCLEdBQUcsSUFBSSxDQUFDLGVBQWUsRUFBRSxpQkFBaUIsQ0FBQyxDQUluRyJ9
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,eAAe,EAAiC,MAAM,sBAAsB,CAAC;AAE3F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,qCAAqC,MAAM,CAAC;AAEzD,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAC5D,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,CA+FjE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAInG"}
|
package/dest/config.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, secretValueConfigHelper } from '@aztec/foundation/config';
|
|
1
|
+
import { booleanConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper, pickConfigMappings, secretValueConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { sharedSequencerConfigMappings } from '@aztec/stdlib/config';
|
|
3
4
|
import { localSignerConfigMappings, validatorHASignerConfigMappings } from '@aztec/stdlib/ha-signing';
|
|
5
|
+
/**
|
|
6
|
+
* Default clock-disparity tolerance (ms) for proposal/attestation receive windows, mirroring the p2p config
|
|
7
|
+
* default. Used by the validator-client validators when the merged node config does not carry the value.
|
|
8
|
+
*/ export const DEFAULT_MAX_GOSSIP_CLOCK_DISPARITY_MS = 500;
|
|
4
9
|
export const validatorClientConfigMappings = {
|
|
10
|
+
...pickConfigMappings(sharedSequencerConfigMappings, [
|
|
11
|
+
'blockDurationMs'
|
|
12
|
+
]),
|
|
5
13
|
validatorPrivateKeys: {
|
|
6
14
|
env: 'VALIDATOR_PRIVATE_KEYS',
|
|
7
15
|
description: 'List of private keys of the validators participating in attestation duties',
|
|
@@ -16,6 +24,12 @@ export const validatorClientConfigMappings = {
|
|
|
16
24
|
parseEnv: (val)=>val.split(',').filter((address)=>address && address.trim().length > 0).map((address)=>EthAddress.fromString(address.trim())),
|
|
17
25
|
defaultValue: []
|
|
18
26
|
},
|
|
27
|
+
l1ChainId: {
|
|
28
|
+
env: 'L1_CHAIN_ID',
|
|
29
|
+
description: 'The chain ID of the ethereum host.',
|
|
30
|
+
parseEnv: (val)=>+val,
|
|
31
|
+
defaultValue: 31337
|
|
32
|
+
},
|
|
19
33
|
disableValidator: {
|
|
20
34
|
env: 'VALIDATOR_DISABLED',
|
|
21
35
|
description: 'Do not run the validator',
|
|
@@ -31,11 +45,6 @@ export const validatorClientConfigMappings = {
|
|
|
31
45
|
description: 'Interval between polling for new attestations',
|
|
32
46
|
...numberConfigHelper(200)
|
|
33
47
|
},
|
|
34
|
-
validatorReexecute: {
|
|
35
|
-
env: 'VALIDATOR_REEXECUTE',
|
|
36
|
-
description: 'Re-execute transactions before attesting',
|
|
37
|
-
...booleanConfigHelper(true)
|
|
38
|
-
},
|
|
39
48
|
alwaysReexecuteBlockProposals: {
|
|
40
49
|
description: 'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
|
|
41
50
|
defaultValue: true
|
|
@@ -57,25 +66,29 @@ export const validatorClientConfigMappings = {
|
|
|
57
66
|
description: 'Agree to attest to equivocated checkpoint proposals (for testing purposes only)',
|
|
58
67
|
...booleanConfigHelper(false)
|
|
59
68
|
},
|
|
69
|
+
skipProposalSlotValidation: {
|
|
70
|
+
description: 'Accept proposal validation regardless of slot timing (for testing only)',
|
|
71
|
+
...booleanConfigHelper(false)
|
|
72
|
+
},
|
|
60
73
|
validateMaxL2BlockGas: {
|
|
61
74
|
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
|
|
62
75
|
description: 'Maximum L2 block gas for validation. Proposals exceeding this limit are rejected.',
|
|
63
|
-
|
|
76
|
+
...optionalNumberConfigHelper()
|
|
64
77
|
},
|
|
65
78
|
validateMaxDABlockGas: {
|
|
66
79
|
env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
|
|
67
80
|
description: 'Maximum DA block gas for validation. Proposals exceeding this limit are rejected.',
|
|
68
|
-
|
|
81
|
+
...optionalNumberConfigHelper()
|
|
69
82
|
},
|
|
70
83
|
validateMaxTxsPerBlock: {
|
|
71
84
|
env: 'VALIDATOR_MAX_TX_PER_BLOCK',
|
|
72
85
|
description: 'Maximum transactions per block for validation. Proposals exceeding this limit are rejected.',
|
|
73
|
-
|
|
86
|
+
...optionalNumberConfigHelper()
|
|
74
87
|
},
|
|
75
88
|
validateMaxTxsPerCheckpoint: {
|
|
76
89
|
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
|
|
77
90
|
description: 'Maximum transactions per checkpoint for validation. Proposals exceeding this limit are rejected.',
|
|
78
|
-
|
|
91
|
+
...optionalNumberConfigHelper()
|
|
79
92
|
},
|
|
80
93
|
...localSignerConfigMappings,
|
|
81
94
|
...validatorHASignerConfigMappings
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type CheckpointNumber, IndexWithinCheckpoint, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
5
|
-
import
|
|
6
|
-
import type
|
|
7
|
-
import {
|
|
8
|
-
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
5
|
+
import { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
6
|
+
import { BlockProposal, type BlockProposalOptions, CheckpointAttestation, CheckpointProposal, type CheckpointProposalCore, type CheckpointProposalOptions, type CoordinationSignatureContext } from '@aztec/stdlib/p2p';
|
|
7
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
9
8
|
import type { BlockHeader, Tx } from '@aztec/stdlib/tx';
|
|
10
9
|
import type { ValidatorKeyStore } from '../key_store/interface.js';
|
|
11
10
|
export declare class ValidationService {
|
|
12
11
|
private keyStore;
|
|
12
|
+
private signatureContext;
|
|
13
13
|
private log;
|
|
14
|
-
constructor(keyStore: ValidatorKeyStore, log?: import("@aztec/foundation/log").Logger);
|
|
14
|
+
constructor(keyStore: ValidatorKeyStore, signatureContext: CoordinationSignatureContext, log?: import("@aztec/foundation/log").Logger);
|
|
15
15
|
/**
|
|
16
16
|
* Create a block proposal with the given header, archive, and transactions
|
|
17
17
|
*
|
|
@@ -27,19 +27,19 @@ export declare class ValidationService {
|
|
|
27
27
|
* @throws DutyAlreadySignedError if HA signer indicates duty already signed by another node
|
|
28
28
|
* @throws SlashingProtectionError if attempting to sign different data for same slot
|
|
29
29
|
*/
|
|
30
|
-
createBlockProposal(blockHeader: BlockHeader, blockIndexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
|
|
30
|
+
createBlockProposal(blockHeader: BlockHeader, checkpointNumber: CheckpointNumber, blockIndexWithinCheckpoint: IndexWithinCheckpoint, inHash: Fr, archive: Fr, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
|
|
31
31
|
/**
|
|
32
32
|
* Create a checkpoint proposal with the last block header and checkpoint header
|
|
33
33
|
*
|
|
34
34
|
* @param checkpointHeader - The checkpoint header containing aggregated data
|
|
35
35
|
* @param archive - The archive of the checkpoint
|
|
36
|
-
* @param
|
|
36
|
+
* @param lastBlockProposal - Signed block proposal for the last block in the checkpoint, or undefined
|
|
37
37
|
* @param proposerAttesterAddress - The address of the proposer
|
|
38
38
|
* @param options - Checkpoint proposal options
|
|
39
39
|
*
|
|
40
40
|
* @returns A checkpoint proposal signing the above information
|
|
41
41
|
*/
|
|
42
|
-
createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, feeAssetPriceModifier: bigint,
|
|
42
|
+
createCheckpointProposal(checkpointHeader: CheckpointHeader, archive: Fr, checkpointNumber: CheckpointNumber, feeAssetPriceModifier: bigint, lastBlockProposal: BlockProposal | undefined, proposerAttesterAddress: EthAddress | undefined, options: CheckpointProposalOptions): Promise<CheckpointProposal>;
|
|
43
43
|
/**
|
|
44
44
|
* Attest with selection of validators to the given checkpoint proposal
|
|
45
45
|
*
|
|
@@ -50,17 +50,16 @@ export declare class ValidationService {
|
|
|
50
50
|
* @param attestors - The validators to attest with
|
|
51
51
|
* @returns checkpoint attestations
|
|
52
52
|
*/
|
|
53
|
-
attestToCheckpointProposal(proposal: CheckpointProposalCore, attestors: EthAddress[]): Promise<CheckpointAttestation[]>;
|
|
53
|
+
attestToCheckpointProposal(proposal: CheckpointProposalCore, attestors: EthAddress[], checkpointNumber: CheckpointNumber): Promise<CheckpointAttestation[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Sign attestations and signers payload
|
|
56
56
|
* @param attestationsAndSigners - The attestations and signers to sign
|
|
57
57
|
* @param proposer - The proposer address to sign with
|
|
58
58
|
* @param slot - The slot number for HA signing context
|
|
59
|
-
* @param blockNumber - The block or checkpoint number for HA signing context
|
|
60
59
|
* @returns signature
|
|
61
60
|
* @throws DutyAlreadySignedError if already signed by another HA node
|
|
62
61
|
* @throws SlashingProtectionError if attempting to sign different data for same slot
|
|
63
62
|
*/
|
|
64
|
-
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber,
|
|
63
|
+
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress, slot: SlotNumber, checkpointNumber: CheckpointNumber): Promise<Signature>;
|
|
65
64
|
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
65
|
+
//# sourceMappingURL=data:application/json;base64,ey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c0JBQXNCLEVBQUUsK0JBQStCLEVBQ3ZELFFBQVEsRUFBRSxVQUFVLEVBQ3BCLElBQUksRUFBRSxVQUFVLEVBQ2hCLGdCQUFnQixFQUFFLGdCQUFnQixHQUNqQyxPQUFPLENBQUMsU0FBUyxDQUFDLENBU3BCO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAChH,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAE9B,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAIxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,GAAG;IAHb,YACU,QAAQ,EAAE,iBAAiB,EAC3B,gBAAgB,EAAE,4BAA4B,EAC9C,GAAG,y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