@aztec-labs/validator-client 6.0.0 → 6.1.0-nightly.20261024
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 +3 -3
- package/dest/checkpoint_builder.d.ts +8 -3
- package/dest/checkpoint_builder.d.ts.map +1 -1
- package/dest/checkpoint_builder.js +12 -5
- package/dest/invalid_checkpoint_evidence.d.ts +30 -0
- package/dest/invalid_checkpoint_evidence.d.ts.map +1 -0
- package/dest/invalid_checkpoint_evidence.js +51 -0
- package/dest/metrics.d.ts +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +1 -0
- package/dest/proposal_handler.d.ts +37 -3
- package/dest/proposal_handler.d.ts.map +1 -1
- package/dest/proposal_handler.js +217 -37
- package/dest/validator.d.ts +1 -4
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +4 -44
- package/package.json +19 -19
- package/src/checkpoint_builder.ts +11 -2
- package/src/invalid_checkpoint_evidence.ts +77 -0
- package/src/metrics.ts +1 -0
- package/src/proposal_handler.ts +254 -40
- package/src/validator.ts +9 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec-labs/validator-client",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-nightly.20261024",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -62,30 +62,30 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec-labs/archiver": "6.0.
|
|
66
|
-
"@aztec-labs/blob-client": "6.0.
|
|
67
|
-
"@aztec-labs/blob-lib": "6.0.
|
|
68
|
-
"@aztec-labs/constants": "6.0.
|
|
69
|
-
"@aztec-labs/epoch-cache": "6.0.
|
|
70
|
-
"@aztec-labs/ethereum": "6.0.
|
|
71
|
-
"@aztec-labs/foundation": "6.0.
|
|
72
|
-
"@aztec-labs/node-keystore": "6.0.
|
|
73
|
-
"@aztec-labs/p2p": "6.0.
|
|
74
|
-
"@aztec-labs/prover-client": "6.0.
|
|
75
|
-
"@aztec-labs/simulator": "6.0.
|
|
76
|
-
"@aztec-labs/slasher": "6.0.
|
|
77
|
-
"@aztec-labs/stdlib": "6.0.
|
|
78
|
-
"@aztec-labs/telemetry-client": "6.0.
|
|
79
|
-
"@aztec-labs/validator-ha-signer": "6.0.
|
|
80
|
-
"@aztec-labs/world-state": "6.0.
|
|
65
|
+
"@aztec-labs/archiver": "6.1.0-nightly.20261024",
|
|
66
|
+
"@aztec-labs/blob-client": "6.1.0-nightly.20261024",
|
|
67
|
+
"@aztec-labs/blob-lib": "6.1.0-nightly.20261024",
|
|
68
|
+
"@aztec-labs/constants": "6.1.0-nightly.20261024",
|
|
69
|
+
"@aztec-labs/epoch-cache": "6.1.0-nightly.20261024",
|
|
70
|
+
"@aztec-labs/ethereum": "6.1.0-nightly.20261024",
|
|
71
|
+
"@aztec-labs/foundation": "6.1.0-nightly.20261024",
|
|
72
|
+
"@aztec-labs/node-keystore": "6.1.0-nightly.20261024",
|
|
73
|
+
"@aztec-labs/p2p": "6.1.0-nightly.20261024",
|
|
74
|
+
"@aztec-labs/prover-client": "6.1.0-nightly.20261024",
|
|
75
|
+
"@aztec-labs/simulator": "6.1.0-nightly.20261024",
|
|
76
|
+
"@aztec-labs/slasher": "6.1.0-nightly.20261024",
|
|
77
|
+
"@aztec-labs/stdlib": "6.1.0-nightly.20261024",
|
|
78
|
+
"@aztec-labs/telemetry-client": "6.1.0-nightly.20261024",
|
|
79
|
+
"@aztec-labs/validator-ha-signer": "6.1.0-nightly.20261024",
|
|
80
|
+
"@aztec-labs/world-state": "6.1.0-nightly.20261024",
|
|
81
81
|
"koa": "^2.16.1",
|
|
82
82
|
"koa-router": "^13.1.1",
|
|
83
83
|
"tslib": "^2.4.0",
|
|
84
84
|
"viem": "2.57.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@aztec-labs/noir-protocol-circuits-types": "6.0.
|
|
88
|
-
"@aztec-labs/protocol-contracts": "6.0.
|
|
87
|
+
"@aztec-labs/noir-protocol-circuits-types": "6.1.0-nightly.20261024",
|
|
88
|
+
"@aztec-labs/protocol-contracts": "6.1.0-nightly.20261024",
|
|
89
89
|
"@electric-sql/pglite": "^0.3.14",
|
|
90
90
|
"@jest/globals": "^30.0.0",
|
|
91
91
|
"@types/jest": "^30.0.0",
|
|
@@ -19,7 +19,7 @@ import { type BlockHash, L2Block } from '@aztec-labs/stdlib/block';
|
|
|
19
19
|
import { Checkpoint } from '@aztec-labs/stdlib/checkpoint';
|
|
20
20
|
import type { ContractDataSource } from '@aztec-labs/stdlib/contract';
|
|
21
21
|
import type { L1RollupConstants } from '@aztec-labs/stdlib/epoch-helpers';
|
|
22
|
-
import { Gas } from '@aztec-labs/stdlib/gas';
|
|
22
|
+
import { Gas, type RollupFeeConfigProvider } from '@aztec-labs/stdlib/gas';
|
|
23
23
|
import {
|
|
24
24
|
type BlockBuilderOptions,
|
|
25
25
|
type BuildBlockInCheckpointResult,
|
|
@@ -56,6 +56,7 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
56
56
|
private checkpointBuilder: LightweightCheckpointBuilder,
|
|
57
57
|
private fork: MerkleTreeWriteOperations,
|
|
58
58
|
private config: FullNodeBlockBuilderConfig,
|
|
59
|
+
private feeConfigProvider: RollupFeeConfigProvider,
|
|
59
60
|
private contractDataSource: ContractDataSource,
|
|
60
61
|
private dateProvider: DateProvider,
|
|
61
62
|
private telemetryClient: TelemetryClient,
|
|
@@ -203,7 +204,7 @@ export class CheckpointBuilder implements ICheckpointBlockBuilder {
|
|
|
203
204
|
// IMPORTANT: This assumes mana is computed solely based on L2 gas used in transactions.
|
|
204
205
|
// This may change in the future.
|
|
205
206
|
const usedMana = sum(existingBlocks.map(b => b.header.totalManaUsed.toNumber()));
|
|
206
|
-
const remainingMana = this.
|
|
207
|
+
const remainingMana = Number(this.feeConfigProvider.getFeeConfig().manaLimit) - usedMana;
|
|
207
208
|
|
|
208
209
|
// Remaining DA gas
|
|
209
210
|
const usedDAGas = sum(existingBlocks.map(b => b.computeDAGasUsed())) ?? 0;
|
|
@@ -317,6 +318,7 @@ export class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
317
318
|
private contractDataSource: ContractDataSource,
|
|
318
319
|
private dateProvider: DateProvider,
|
|
319
320
|
private avmSimulator: AvmSimulator,
|
|
321
|
+
private feeConfigProvider: RollupFeeConfigProvider,
|
|
320
322
|
private telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
321
323
|
private debugLogStore: DebugLogStore = new NullDebugLogStore(),
|
|
322
324
|
) {
|
|
@@ -327,6 +329,11 @@ export class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
327
329
|
return this.config;
|
|
328
330
|
}
|
|
329
331
|
|
|
332
|
+
/** Live rollup fee settings, including the mana limit checkpoints are built and validated against. */
|
|
333
|
+
public getFeeConfigProvider(): RollupFeeConfigProvider {
|
|
334
|
+
return this.feeConfigProvider;
|
|
335
|
+
}
|
|
336
|
+
|
|
330
337
|
public updateConfig(config: Partial<FullNodeBlockBuilderConfig>) {
|
|
331
338
|
this.config = merge(this.config, pick(config, ...FullNodeBlockBuilderConfigKeys));
|
|
332
339
|
}
|
|
@@ -368,6 +375,7 @@ export class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
368
375
|
lightweightBuilder,
|
|
369
376
|
fork,
|
|
370
377
|
this.config,
|
|
378
|
+
this.feeConfigProvider,
|
|
371
379
|
this.contractDataSource,
|
|
372
380
|
this.dateProvider,
|
|
373
381
|
this.telemetryClient,
|
|
@@ -441,6 +449,7 @@ export class FullNodeCheckpointsBuilder implements ICheckpointsBuilder {
|
|
|
441
449
|
lightweightBuilder,
|
|
442
450
|
fork,
|
|
443
451
|
this.config,
|
|
452
|
+
this.feeConfigProvider,
|
|
444
453
|
this.contractDataSource,
|
|
445
454
|
this.dateProvider,
|
|
446
455
|
this.telemetryClient,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import type { BlockProposal, CheckpointProposalCore } from '@aztec-labs/stdlib/p2p';
|
|
3
|
+
import { computeBlockHeadersHash } from '@aztec-labs/stdlib/rollup';
|
|
4
|
+
import type { BlockHeader } from '@aztec-labs/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A block proposal this node rejected, with the facts needed to decide whether that rejection is bound to a
|
|
8
|
+
* checkpoint's signed payload. `headerMismatch`: the block was rejected for a reason that follows from its signed
|
|
9
|
+
* header and parent alone, and the checkpoint's blockHeadersHash commits to the header, so a header this node rejected
|
|
10
|
+
* that sits in the committed sequence is proven invalid. `archiveMismatch`: the re-executed header matched but the
|
|
11
|
+
* proposer's claimed resulting archive did not; it only binds to a checkpoint when it equals the checkpoint's signed
|
|
12
|
+
* archive.
|
|
13
|
+
*/
|
|
14
|
+
export type InvalidBlockVerdict = {
|
|
15
|
+
blockHeader: BlockHeader;
|
|
16
|
+
archiveRoot: Fr;
|
|
17
|
+
headerMismatch: boolean;
|
|
18
|
+
archiveMismatch: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether `checkpoint` provably commits, in the payload its attesters signed, to a block this node rejected for a
|
|
23
|
+
* reason the payload commits to.
|
|
24
|
+
*
|
|
25
|
+
* Missing evidence is never guilt: the committed block-header sequence is reconstructed from the slot's `retained`
|
|
26
|
+
* block proposals and only trusted when `computeBlockHeadersHash` over it equals the signed `blockHeadersHash`. If
|
|
27
|
+
* the sequence cannot be reconstructed (a committed proposal is not retained, or the prefix is not contiguous) or
|
|
28
|
+
* the recomputed hash does not match, this returns false. A rejected block then binds only when its header is in
|
|
29
|
+
* that verified sequence (header mismatch), or its claimed archive equals the checkpoint's signed archive (archive
|
|
30
|
+
* mismatch). A wrong claim for an archive the checkpoint does not sign proves nothing about the checkpoint.
|
|
31
|
+
*/
|
|
32
|
+
export async function checkpointCommitsToRejectedBlock(
|
|
33
|
+
checkpoint: CheckpointProposalCore,
|
|
34
|
+
retained: BlockProposal[],
|
|
35
|
+
verdicts: InvalidBlockVerdict[],
|
|
36
|
+
): Promise<boolean> {
|
|
37
|
+
if (verdicts.length === 0) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const byIndex = [...retained].sort((a, b) => Number(a.indexWithinCheckpoint) - Number(b.indexWithinCheckpoint));
|
|
41
|
+
const sequence: BlockProposal[] = [];
|
|
42
|
+
for (let i = 0; i < byIndex.length; i++) {
|
|
43
|
+
if (Number(byIndex[i].indexWithinCheckpoint) !== i) {
|
|
44
|
+
// A gap in the committed prefix: the sequence cannot be reconstructed, so no evidence.
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
sequence.push(byIndex[i]);
|
|
48
|
+
if (byIndex[i].archiveRoot.equals(checkpoint.archive)) {
|
|
49
|
+
const headers = sequence.map(p => p.blockHeader);
|
|
50
|
+
const reconstructed = await computeBlockHeadersHash(headers);
|
|
51
|
+
if (!reconstructed.equals(checkpoint.checkpointHeader.blockHeadersHash)) {
|
|
52
|
+
// The retained proposals do not reconstruct the signed sequence, so the evidence is not bound.
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// The signed archive is the resulting archive of the last block in the committed sequence, so a wrong archive
|
|
56
|
+
// claim only invalidates the checkpoint when the rejected block is that last block. Binding on any slot block
|
|
57
|
+
// whose claimed archive happens to equal the signed one would slash honest signers off a stale verdict for a
|
|
58
|
+
// block that is not in, or is no longer the end of, this sequence.
|
|
59
|
+
const lastBlock = sequence[sequence.length - 1];
|
|
60
|
+
for (const v of verdicts) {
|
|
61
|
+
if (v.headerMismatch && sequence.some(p => p.blockHeader.equals(v.blockHeader))) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (
|
|
65
|
+
v.archiveMismatch &&
|
|
66
|
+
v.archiveRoot.equals(checkpoint.archive) &&
|
|
67
|
+
lastBlock.blockHeader.equals(v.blockHeader)
|
|
68
|
+
) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// The signed archive names no block in the contiguous retained prefix, so the sequence is not reconstructed.
|
|
76
|
+
return false;
|
|
77
|
+
}
|