@aztec/aztec-node 2.0.0-nightly.20250827 → 2.0.0-nightly.20250829
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.
|
@@ -3,7 +3,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
4
|
import { type L2TipsStore } from '@aztec/kv-store/stores';
|
|
5
5
|
import type { P2PClient } from '@aztec/p2p';
|
|
6
|
-
import { type
|
|
6
|
+
import { type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
7
7
|
import type { SlasherConfig } from '@aztec/slasher/config';
|
|
8
8
|
import { type L2BlockSource, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
9
9
|
import type { SingleValidatorStats, ValidatorStats, ValidatorStatusHistory, ValidatorStatusInSlot, ValidatorStatusType, ValidatorsEpochPerformance, ValidatorsStats } from '@aztec/stdlib/validators';
|
|
@@ -37,7 +37,6 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
|
|
|
37
37
|
protected computeProvenPerformance(epoch: bigint): Promise<ValidatorsEpochPerformance>;
|
|
38
38
|
protected updateProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance): Promise<void>;
|
|
39
39
|
protected handleProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance): void;
|
|
40
|
-
shouldSlash({ validator, amount }: WantToSlashArgs): Promise<boolean>;
|
|
41
40
|
/**
|
|
42
41
|
* Process data for two L2 slots ago.
|
|
43
42
|
* Note that we do not process historical data, since we rely on p2p data for processing,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/sentinel/sentinel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+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ACa,gBAAgB,CAAC,WAAW,EAAE,MAAM;IAkCpD;;;OAGG;cACa,WAAW,CAAC,IAAI,EAAE,MAAM;IAexC,0CAA0C;cAC1B,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE;;;IAwD1G,wDAAwD;IACxD,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAIxG,0DAA0D;IAC7C,YAAY,CAAC,EACxB,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,OAAO,GAChB,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IAkBzE,6CAA6C;IAChC,iBAAiB,CAC5B,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAoC5C,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,UAAU,EAAE,sBAAsB,EAClC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,cAAc;IAgBjB,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,mBAAmB,EACtC,MAAM,EAAE,qBAAqB;;;;;IAW/B,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;;;;;CAOnD"}
|
|
@@ -3,8 +3,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
import { L2TipsMemoryStore } from '@aztec/kv-store/stores';
|
|
6
|
-
import { OffenseType } from '@aztec/slasher';
|
|
7
|
-
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
6
|
+
import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
8
7
|
import { L2BlockStream, getAttestationsFromPublishedL2Block } from '@aztec/stdlib/block';
|
|
9
8
|
import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
10
9
|
import EventEmitter from 'node:events';
|
|
@@ -84,9 +83,9 @@ export class Sentinel extends EventEmitter {
|
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
86
85
|
const epoch = getEpochAtSlot(block.header.getSlot(), await this.archiver.getL1Constants());
|
|
87
|
-
this.logger.
|
|
86
|
+
this.logger.debug(`Computing proven performance for epoch ${epoch}`);
|
|
88
87
|
const performance = await this.computeProvenPerformance(epoch);
|
|
89
|
-
this.logger.info(`
|
|
88
|
+
this.logger.info(`Computed proven performance for epoch ${epoch}`, performance);
|
|
90
89
|
await this.updateProvenPerformance(epoch, performance);
|
|
91
90
|
this.handleProvenPerformance(epoch, performance);
|
|
92
91
|
}
|
|
@@ -143,33 +142,13 @@ export class Sentinel extends EventEmitter {
|
|
|
143
142
|
offenseType: OffenseType.INACTIVITY,
|
|
144
143
|
epochOrSlot: epoch
|
|
145
144
|
}));
|
|
146
|
-
this.logger.info(`Criminals: ${criminals.length}`, {
|
|
147
|
-
args
|
|
148
|
-
});
|
|
149
145
|
if (criminals.length > 0) {
|
|
146
|
+
this.logger.info(`Identified ${criminals.length} validators to slash due to inactivity`, {
|
|
147
|
+
args
|
|
148
|
+
});
|
|
150
149
|
this.emit(WANT_TO_SLASH_EVENT, args);
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
|
-
async shouldSlash({ validator, amount }) {
|
|
154
|
-
const l1Constants = this.epochCache.getL1Constants();
|
|
155
|
-
const ttlL2Slots = this.config.slashPayloadTtlSeconds / l1Constants.slotDuration;
|
|
156
|
-
const ttlEpochs = BigInt(Math.ceil(ttlL2Slots / l1Constants.epochDuration));
|
|
157
|
-
const currentEpoch = this.epochCache.getEpochAndSlotNow().epoch;
|
|
158
|
-
const performance = await this.store.getProvenPerformance(validator);
|
|
159
|
-
const isCriminal = performance.filter((p)=>p.epoch >= currentEpoch - ttlEpochs).findIndex((p)=>p.missed / p.total >= this.config.slashInactivitySignalTargetPercentage) !== -1;
|
|
160
|
-
if (isCriminal) {
|
|
161
|
-
if (amount <= this.config.slashInactivityMaxPenalty) {
|
|
162
|
-
return true;
|
|
163
|
-
} else {
|
|
164
|
-
this.logger.warn(`Validator ${validator} is a criminal but the penalty is too high`, {
|
|
165
|
-
amount,
|
|
166
|
-
maxPenalty: this.config.slashInactivityMaxPenalty
|
|
167
|
-
});
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
152
|
/**
|
|
174
153
|
* Process data for two L2 slots ago.
|
|
175
154
|
* Note that we do not process historical data, since we rely on p2p data for processing,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.20250829",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -66,29 +66,29 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/archiver": "2.0.0-nightly.
|
|
70
|
-
"@aztec/bb-prover": "2.0.0-nightly.
|
|
71
|
-
"@aztec/blob-sink": "2.0.0-nightly.
|
|
72
|
-
"@aztec/constants": "2.0.0-nightly.
|
|
73
|
-
"@aztec/epoch-cache": "2.0.0-nightly.
|
|
74
|
-
"@aztec/ethereum": "2.0.0-nightly.
|
|
75
|
-
"@aztec/foundation": "2.0.0-nightly.
|
|
76
|
-
"@aztec/kv-store": "2.0.0-nightly.
|
|
77
|
-
"@aztec/l1-artifacts": "2.0.0-nightly.
|
|
78
|
-
"@aztec/merkle-tree": "2.0.0-nightly.
|
|
79
|
-
"@aztec/node-keystore": "2.0.0-nightly.
|
|
80
|
-
"@aztec/node-lib": "2.0.0-nightly.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.
|
|
82
|
-
"@aztec/p2p": "2.0.0-nightly.
|
|
83
|
-
"@aztec/protocol-contracts": "2.0.0-nightly.
|
|
84
|
-
"@aztec/prover-client": "2.0.0-nightly.
|
|
85
|
-
"@aztec/sequencer-client": "2.0.0-nightly.
|
|
86
|
-
"@aztec/simulator": "2.0.0-nightly.
|
|
87
|
-
"@aztec/slasher": "2.0.0-nightly.
|
|
88
|
-
"@aztec/stdlib": "2.0.0-nightly.
|
|
89
|
-
"@aztec/telemetry-client": "2.0.0-nightly.
|
|
90
|
-
"@aztec/validator-client": "2.0.0-nightly.
|
|
91
|
-
"@aztec/world-state": "2.0.0-nightly.
|
|
69
|
+
"@aztec/archiver": "2.0.0-nightly.20250829",
|
|
70
|
+
"@aztec/bb-prover": "2.0.0-nightly.20250829",
|
|
71
|
+
"@aztec/blob-sink": "2.0.0-nightly.20250829",
|
|
72
|
+
"@aztec/constants": "2.0.0-nightly.20250829",
|
|
73
|
+
"@aztec/epoch-cache": "2.0.0-nightly.20250829",
|
|
74
|
+
"@aztec/ethereum": "2.0.0-nightly.20250829",
|
|
75
|
+
"@aztec/foundation": "2.0.0-nightly.20250829",
|
|
76
|
+
"@aztec/kv-store": "2.0.0-nightly.20250829",
|
|
77
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250829",
|
|
78
|
+
"@aztec/merkle-tree": "2.0.0-nightly.20250829",
|
|
79
|
+
"@aztec/node-keystore": "2.0.0-nightly.20250829",
|
|
80
|
+
"@aztec/node-lib": "2.0.0-nightly.20250829",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250829",
|
|
82
|
+
"@aztec/p2p": "2.0.0-nightly.20250829",
|
|
83
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250829",
|
|
84
|
+
"@aztec/prover-client": "2.0.0-nightly.20250829",
|
|
85
|
+
"@aztec/sequencer-client": "2.0.0-nightly.20250829",
|
|
86
|
+
"@aztec/simulator": "2.0.0-nightly.20250829",
|
|
87
|
+
"@aztec/slasher": "2.0.0-nightly.20250829",
|
|
88
|
+
"@aztec/stdlib": "2.0.0-nightly.20250829",
|
|
89
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250829",
|
|
90
|
+
"@aztec/validator-client": "2.0.0-nightly.20250829",
|
|
91
|
+
"@aztec/world-state": "2.0.0-nightly.20250829",
|
|
92
92
|
"koa": "^2.16.1",
|
|
93
93
|
"koa-router": "^12.0.0",
|
|
94
94
|
"tslib": "^2.4.0",
|
package/src/sentinel/sentinel.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
6
6
|
import { L2TipsMemoryStore, type L2TipsStore } from '@aztec/kv-store/stores';
|
|
7
7
|
import type { P2PClient } from '@aztec/p2p';
|
|
8
|
-
import { OffenseType } from '@aztec/slasher';
|
|
9
|
-
import { WANT_TO_SLASH_EVENT, type WantToSlashArgs, type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
8
|
+
import { OffenseType, WANT_TO_SLASH_EVENT, type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
10
9
|
import type { SlasherConfig } from '@aztec/slasher/config';
|
|
11
10
|
import {
|
|
12
11
|
type L2BlockSource,
|
|
@@ -121,9 +120,9 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
const epoch = getEpochAtSlot(block.header.getSlot(), await this.archiver.getL1Constants());
|
|
124
|
-
this.logger.
|
|
123
|
+
this.logger.debug(`Computing proven performance for epoch ${epoch}`);
|
|
125
124
|
const performance = await this.computeProvenPerformance(epoch);
|
|
126
|
-
this.logger.info(`
|
|
125
|
+
this.logger.info(`Computed proven performance for epoch ${epoch}`, performance);
|
|
127
126
|
|
|
128
127
|
await this.updateProvenPerformance(epoch, performance);
|
|
129
128
|
this.handleProvenPerformance(epoch, performance);
|
|
@@ -183,38 +182,12 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
183
182
|
epochOrSlot: epoch,
|
|
184
183
|
}));
|
|
185
184
|
|
|
186
|
-
this.logger.info(`Criminals: ${criminals.length}`, { args });
|
|
187
|
-
|
|
188
185
|
if (criminals.length > 0) {
|
|
186
|
+
this.logger.info(`Identified ${criminals.length} validators to slash due to inactivity`, { args });
|
|
189
187
|
this.emit(WANT_TO_SLASH_EVENT, args);
|
|
190
188
|
}
|
|
191
189
|
}
|
|
192
190
|
|
|
193
|
-
public async shouldSlash({ validator, amount }: WantToSlashArgs): Promise<boolean> {
|
|
194
|
-
const l1Constants = this.epochCache.getL1Constants();
|
|
195
|
-
const ttlL2Slots = this.config.slashPayloadTtlSeconds / l1Constants.slotDuration;
|
|
196
|
-
const ttlEpochs = BigInt(Math.ceil(ttlL2Slots / l1Constants.epochDuration));
|
|
197
|
-
|
|
198
|
-
const currentEpoch = this.epochCache.getEpochAndSlotNow().epoch;
|
|
199
|
-
const performance = await this.store.getProvenPerformance(validator);
|
|
200
|
-
const isCriminal =
|
|
201
|
-
performance
|
|
202
|
-
.filter(p => p.epoch >= currentEpoch - ttlEpochs)
|
|
203
|
-
.findIndex(p => p.missed / p.total >= this.config.slashInactivitySignalTargetPercentage) !== -1;
|
|
204
|
-
if (isCriminal) {
|
|
205
|
-
if (amount <= this.config.slashInactivityMaxPenalty) {
|
|
206
|
-
return true;
|
|
207
|
-
} else {
|
|
208
|
-
this.logger.warn(`Validator ${validator} is a criminal but the penalty is too high`, {
|
|
209
|
-
amount,
|
|
210
|
-
maxPenalty: this.config.slashInactivityMaxPenalty,
|
|
211
|
-
});
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
191
|
/**
|
|
219
192
|
* Process data for two L2 slots ago.
|
|
220
193
|
* Note that we do not process historical data, since we rely on p2p data for processing,
|