@aztec/validator-client 2.0.0-nightly.20250821 → 2.0.0-nightly.20250823
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/factory.d.ts +1 -1
- package/dest/factory.d.ts.map +1 -1
- package/dest/validator.d.ts +4 -4
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +10 -9
- package/package.json +11 -11
- package/src/factory.ts +6 -1
- package/src/validator.ts +31 -13
package/dest/factory.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
|
7
7
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
8
8
|
import type { ValidatorClientConfig } from './config.js';
|
|
9
9
|
import { ValidatorClient } from './validator.js';
|
|
10
|
-
export declare function createValidatorClient(config: ValidatorClientConfig & Pick<SlasherConfig, '
|
|
10
|
+
export declare function createValidatorClient(config: ValidatorClientConfig & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockEnabled' | 'slashBroadcastedInvalidBlockPenalty' | 'slashBroadcastedInvalidBlockMaxPenalty'>, deps: {
|
|
11
11
|
blockBuilder: IFullNodeBlockBuilder;
|
|
12
12
|
p2pClient: P2PClient;
|
|
13
13
|
blockSource: L2BlockSource;
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OA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,CAAC;CACxB,+BAwBF"}
|
package/dest/validator.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
4
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
5
|
import type { P2P, PeerId } from '@aztec/p2p';
|
|
6
6
|
import { TxProvider } from '@aztec/p2p';
|
|
7
|
-
import { type SlasherConfig, type WantToSlashArgs, type Watcher, type WatcherEmitter } from '@aztec/slasher
|
|
7
|
+
import { type SlasherConfig, type WantToSlashArgs, type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
8
8
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
9
|
import type { IFullNodeBlockBuilder, SequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
10
10
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
@@ -46,12 +46,12 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
46
46
|
private epochCacheUpdateLoop;
|
|
47
47
|
private blockProposalValidator;
|
|
48
48
|
private proposersOfInvalidBlocks;
|
|
49
|
-
protected constructor(blockBuilder: IFullNodeBlockBuilder, keyStore: ValidatorKeyStore, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, config: ValidatorClientConfig & Pick<SequencerConfig, 'txPublicSetupAllowList'> & Pick<SlasherConfig, '
|
|
49
|
+
protected constructor(blockBuilder: IFullNodeBlockBuilder, keyStore: ValidatorKeyStore, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, config: ValidatorClientConfig & Pick<SequencerConfig, 'txPublicSetupAllowList'> & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockEnabled' | 'slashBroadcastedInvalidBlockPenalty' | 'slashBroadcastedInvalidBlockMaxPenalty'>, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
50
50
|
private handleEpochCommitteeUpdate;
|
|
51
|
-
static new(config: ValidatorClientConfig & Pick<SlasherConfig, '
|
|
51
|
+
static new(config: ValidatorClientConfig & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockEnabled' | 'slashBroadcastedInvalidBlockPenalty' | 'slashBroadcastedInvalidBlockMaxPenalty'>, blockBuilder: IFullNodeBlockBuilder, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, dateProvider?: DateProvider, telemetry?: TelemetryClient): ValidatorClient;
|
|
52
52
|
getValidatorAddresses(): EthAddress[];
|
|
53
53
|
signWithAddress(addr: EthAddress, msg: TypedDataDefinition): Promise<import("@aztec/stdlib/block").Signature>;
|
|
54
|
-
configureSlashing(config: Partial<Pick<SlasherConfig, '
|
|
54
|
+
configureSlashing(config: Partial<Pick<SlasherConfig, 'slashBroadcastedInvalidBlockEnabled' | 'slashBroadcastedInvalidBlockPenalty' | 'slashBroadcastedInvalidBlockMaxPenalty'>>): void;
|
|
55
55
|
start(): Promise<void>;
|
|
56
56
|
stop(): Promise<void>;
|
|
57
57
|
registerBlockProposalHandler(): void;
|
package/dest/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAiD,UAAU,EAAE,MAAM,YAAY,CAAC;AAIvF,OAAO,EACL,KAAK,aAAa,EAElB,KA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S9B;;;OAGG;IACG,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqDpG,OAAO,CAAC,iBAAiB;IAqBzB;;;;;;;;;;;OAWG;IACI,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrD,mBAAmB,CACvB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,eAAe,EAAE,UAAU,GAAG,SAAS,EACvC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAmB/B,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAO5E,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;YA+CnG,kBAAkB;YAMlB,iBAAiB;CAsBhC"}
|
package/dest/validator.js
CHANGED
|
@@ -8,8 +8,8 @@ import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
|
8
8
|
import { AuthRequest, AuthResponse, ReqRespSubProtocol } from '@aztec/p2p';
|
|
9
9
|
import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
|
|
10
10
|
import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
|
|
11
|
-
import {
|
|
12
|
-
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher
|
|
11
|
+
import { OffenseType } from '@aztec/slasher';
|
|
12
|
+
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
13
13
|
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
14
14
|
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
15
15
|
import { AttestationTimeoutError, InvalidValidatorPrivateKeyError, ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
|
|
@@ -107,9 +107,9 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
|
|
|
107
107
|
return this.keyStore.signTypedDataWithAddress(addr, msg);
|
|
108
108
|
}
|
|
109
109
|
configureSlashing(config) {
|
|
110
|
-
this.config.
|
|
111
|
-
this.config.
|
|
112
|
-
this.config.
|
|
110
|
+
this.config.slashBroadcastedInvalidBlockEnabled = config.slashBroadcastedInvalidBlockEnabled ?? this.config.slashBroadcastedInvalidBlockEnabled;
|
|
111
|
+
this.config.slashBroadcastedInvalidBlockPenalty = config.slashBroadcastedInvalidBlockPenalty ?? this.config.slashBroadcastedInvalidBlockPenalty;
|
|
112
|
+
this.config.slashBroadcastedInvalidBlockMaxPenalty = config.slashBroadcastedInvalidBlockMaxPenalty ?? this.config.slashBroadcastedInvalidBlockMaxPenalty;
|
|
113
113
|
}
|
|
114
114
|
async start() {
|
|
115
115
|
// Sync the committee from the smart contract
|
|
@@ -243,7 +243,7 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
|
|
|
243
243
|
} catch (error) {
|
|
244
244
|
this.metrics.incFailedAttestations(1, error instanceof Error ? error.name : 'unknown');
|
|
245
245
|
this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
|
|
246
|
-
if (error instanceof ReExStateMismatchError && this.config.
|
|
246
|
+
if (error instanceof ReExStateMismatchError && this.config.slashBroadcastedInvalidBlockEnabled) {
|
|
247
247
|
this.log.warn(`Slashing proposer for invalid block proposal`, proposalInfo);
|
|
248
248
|
this.slashInvalidBlock(proposal);
|
|
249
249
|
}
|
|
@@ -313,8 +313,9 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
|
|
|
313
313
|
this.emit(WANT_TO_SLASH_EVENT, [
|
|
314
314
|
{
|
|
315
315
|
validator: proposer,
|
|
316
|
-
amount: this.config.
|
|
317
|
-
|
|
316
|
+
amount: this.config.slashBroadcastedInvalidBlockPenalty,
|
|
317
|
+
offenseType: OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL,
|
|
318
|
+
epochOrSlot: proposal.slotNumber.toBigInt()
|
|
318
319
|
}
|
|
319
320
|
]);
|
|
320
321
|
}
|
|
@@ -331,7 +332,7 @@ const MAX_PROPOSERS_OF_INVALID_BLOCKS = 1000;
|
|
|
331
332
|
* i.e. either we just created the slashing payload, or someone else did and we saw the event on L1.
|
|
332
333
|
*/ shouldSlash(args) {
|
|
333
334
|
// note we don't check the offence here: we know this person is bad and we're willing to slash up to the max penalty.
|
|
334
|
-
return Promise.resolve(args.amount <= this.config.
|
|
335
|
+
return Promise.resolve(args.amount <= this.config.slashBroadcastedInvalidBlockMaxPenalty && this.proposersOfInvalidBlocks.has(args.validator.toString()));
|
|
335
336
|
}
|
|
336
337
|
async createBlockProposal(blockNumber, header, archive, stateReference, txs, proposerAddress, options) {
|
|
337
338
|
if (this.previousProposal?.slotNumber.equals(header.slotNumber)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.20250823",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "2.0.0-nightly.
|
|
68
|
-
"@aztec/epoch-cache": "2.0.0-nightly.
|
|
69
|
-
"@aztec/ethereum": "2.0.0-nightly.
|
|
70
|
-
"@aztec/foundation": "2.0.0-nightly.
|
|
71
|
-
"@aztec/node-keystore": "2.0.0-nightly.
|
|
72
|
-
"@aztec/p2p": "2.0.0-nightly.
|
|
73
|
-
"@aztec/prover-client": "2.0.0-nightly.
|
|
74
|
-
"@aztec/slasher": "2.0.0-nightly.
|
|
75
|
-
"@aztec/stdlib": "2.0.0-nightly.
|
|
76
|
-
"@aztec/telemetry-client": "2.0.0-nightly.
|
|
67
|
+
"@aztec/constants": "2.0.0-nightly.20250823",
|
|
68
|
+
"@aztec/epoch-cache": "2.0.0-nightly.20250823",
|
|
69
|
+
"@aztec/ethereum": "2.0.0-nightly.20250823",
|
|
70
|
+
"@aztec/foundation": "2.0.0-nightly.20250823",
|
|
71
|
+
"@aztec/node-keystore": "2.0.0-nightly.20250823",
|
|
72
|
+
"@aztec/p2p": "2.0.0-nightly.20250823",
|
|
73
|
+
"@aztec/prover-client": "2.0.0-nightly.20250823",
|
|
74
|
+
"@aztec/slasher": "2.0.0-nightly.20250823",
|
|
75
|
+
"@aztec/stdlib": "2.0.0-nightly.20250823",
|
|
76
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250823",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^12.0.0",
|
|
79
79
|
"tslib": "^2.4.0",
|
package/src/factory.ts
CHANGED
|
@@ -14,7 +14,12 @@ import { ValidatorClient } from './validator.js';
|
|
|
14
14
|
|
|
15
15
|
export function createValidatorClient(
|
|
16
16
|
config: ValidatorClientConfig &
|
|
17
|
-
Pick<
|
|
17
|
+
Pick<
|
|
18
|
+
SlasherConfig,
|
|
19
|
+
| 'slashBroadcastedInvalidBlockEnabled'
|
|
20
|
+
| 'slashBroadcastedInvalidBlockPenalty'
|
|
21
|
+
| 'slashBroadcastedInvalidBlockMaxPenalty'
|
|
22
|
+
>,
|
|
18
23
|
deps: {
|
|
19
24
|
blockBuilder: IFullNodeBlockBuilder;
|
|
20
25
|
p2pClient: P2PClient;
|
package/src/validator.ts
CHANGED
|
@@ -11,14 +11,14 @@ import type { P2P, PeerId } from '@aztec/p2p';
|
|
|
11
11
|
import { AuthRequest, AuthResponse, ReqRespSubProtocol, TxProvider } from '@aztec/p2p';
|
|
12
12
|
import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
|
|
13
13
|
import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
|
|
14
|
-
import {
|
|
14
|
+
import { OffenseType } from '@aztec/slasher';
|
|
15
15
|
import {
|
|
16
16
|
type SlasherConfig,
|
|
17
17
|
WANT_TO_SLASH_EVENT,
|
|
18
18
|
type WantToSlashArgs,
|
|
19
19
|
type Watcher,
|
|
20
20
|
type WatcherEmitter,
|
|
21
|
-
} from '@aztec/slasher
|
|
21
|
+
} from '@aztec/slasher';
|
|
22
22
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
23
23
|
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
24
24
|
import type { IFullNodeBlockBuilder, SequencerConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -99,7 +99,12 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
99
99
|
private txProvider: TxProvider,
|
|
100
100
|
private config: ValidatorClientConfig &
|
|
101
101
|
Pick<SequencerConfig, 'txPublicSetupAllowList'> &
|
|
102
|
-
Pick<
|
|
102
|
+
Pick<
|
|
103
|
+
SlasherConfig,
|
|
104
|
+
| 'slashBroadcastedInvalidBlockEnabled'
|
|
105
|
+
| 'slashBroadcastedInvalidBlockPenalty'
|
|
106
|
+
| 'slashBroadcastedInvalidBlockMaxPenalty'
|
|
107
|
+
>,
|
|
103
108
|
private dateProvider: DateProvider = new DateProvider(),
|
|
104
109
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
105
110
|
private log = createLogger('validator'),
|
|
@@ -148,7 +153,12 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
148
153
|
|
|
149
154
|
static new(
|
|
150
155
|
config: ValidatorClientConfig &
|
|
151
|
-
Pick<
|
|
156
|
+
Pick<
|
|
157
|
+
SlasherConfig,
|
|
158
|
+
| 'slashBroadcastedInvalidBlockEnabled'
|
|
159
|
+
| 'slashBroadcastedInvalidBlockPenalty'
|
|
160
|
+
| 'slashBroadcastedInvalidBlockMaxPenalty'
|
|
161
|
+
>,
|
|
152
162
|
blockBuilder: IFullNodeBlockBuilder,
|
|
153
163
|
epochCache: EpochCache,
|
|
154
164
|
p2pClient: P2P,
|
|
@@ -205,13 +215,20 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
205
215
|
|
|
206
216
|
public configureSlashing(
|
|
207
217
|
config: Partial<
|
|
208
|
-
Pick<
|
|
218
|
+
Pick<
|
|
219
|
+
SlasherConfig,
|
|
220
|
+
| 'slashBroadcastedInvalidBlockEnabled'
|
|
221
|
+
| 'slashBroadcastedInvalidBlockPenalty'
|
|
222
|
+
| 'slashBroadcastedInvalidBlockMaxPenalty'
|
|
223
|
+
>
|
|
209
224
|
>,
|
|
210
225
|
) {
|
|
211
|
-
this.config.
|
|
212
|
-
|
|
213
|
-
this.config.
|
|
214
|
-
config.
|
|
226
|
+
this.config.slashBroadcastedInvalidBlockEnabled =
|
|
227
|
+
config.slashBroadcastedInvalidBlockEnabled ?? this.config.slashBroadcastedInvalidBlockEnabled;
|
|
228
|
+
this.config.slashBroadcastedInvalidBlockPenalty =
|
|
229
|
+
config.slashBroadcastedInvalidBlockPenalty ?? this.config.slashBroadcastedInvalidBlockPenalty;
|
|
230
|
+
this.config.slashBroadcastedInvalidBlockMaxPenalty =
|
|
231
|
+
config.slashBroadcastedInvalidBlockMaxPenalty ?? this.config.slashBroadcastedInvalidBlockMaxPenalty;
|
|
215
232
|
}
|
|
216
233
|
|
|
217
234
|
public async start() {
|
|
@@ -375,7 +392,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
375
392
|
} catch (error: any) {
|
|
376
393
|
this.metrics.incFailedAttestations(1, error instanceof Error ? error.name : 'unknown');
|
|
377
394
|
this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
|
|
378
|
-
if (error instanceof ReExStateMismatchError && this.config.
|
|
395
|
+
if (error instanceof ReExStateMismatchError && this.config.slashBroadcastedInvalidBlockEnabled) {
|
|
379
396
|
this.log.warn(`Slashing proposer for invalid block proposal`, proposalInfo);
|
|
380
397
|
this.slashInvalidBlock(proposal);
|
|
381
398
|
}
|
|
@@ -470,8 +487,9 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
470
487
|
this.emit(WANT_TO_SLASH_EVENT, [
|
|
471
488
|
{
|
|
472
489
|
validator: proposer,
|
|
473
|
-
amount: this.config.
|
|
474
|
-
|
|
490
|
+
amount: this.config.slashBroadcastedInvalidBlockPenalty,
|
|
491
|
+
offenseType: OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL,
|
|
492
|
+
epochOrSlot: proposal.slotNumber.toBigInt(),
|
|
475
493
|
},
|
|
476
494
|
]);
|
|
477
495
|
}
|
|
@@ -491,7 +509,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
491
509
|
public shouldSlash(args: WantToSlashArgs): Promise<boolean> {
|
|
492
510
|
// note we don't check the offence here: we know this person is bad and we're willing to slash up to the max penalty.
|
|
493
511
|
return Promise.resolve(
|
|
494
|
-
args.amount <= this.config.
|
|
512
|
+
args.amount <= this.config.slashBroadcastedInvalidBlockMaxPenalty &&
|
|
495
513
|
this.proposersOfInvalidBlocks.has(args.validator.toString()),
|
|
496
514
|
);
|
|
497
515
|
}
|