@aztec-labs/slasher 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 +8 -6
- package/dest/slasher_client_facade.d.ts +6 -1
- package/dest/slasher_client_facade.d.ts.map +1 -1
- package/dest/slasher_client_facade.js +5 -0
- package/dest/watchers/attested_invalid_proposal_watcher.d.ts +2 -2
- package/dest/watchers/attested_invalid_proposal_watcher.d.ts.map +1 -1
- package/dest/watchers/attested_invalid_proposal_watcher.js +23 -7
- package/package.json +7 -7
- package/src/slasher_client_facade.ts +5 -0
- package/src/watchers/attested_invalid_proposal_watcher.ts +24 -10
package/README.md
CHANGED
|
@@ -129,9 +129,9 @@ List of all slashable offenses in the system:
|
|
|
129
129
|
**Time Unit**: Slot-based offense.
|
|
130
130
|
|
|
131
131
|
### ATTESTED_TO_INVALID_CHECKPOINT_PROPOSAL
|
|
132
|
-
**Description**: A committee member attested to a checkpoint proposal
|
|
133
|
-
**Detection**:
|
|
134
|
-
**Target**: Committee members who attested
|
|
132
|
+
**Description**: A committee member attested to a checkpoint proposal that this node found invalid. The attester is slashed only for the payload it signed, not for other invalid proposals in the same slot.
|
|
133
|
+
**Detection**: The proposal handler records the signed-payload hash of each checkpoint proposal it rejects as invalid. When it cannot find the checkpoint's last block, it also records the hash if the checkpoint commits to a block it rejected for a reason bound to the block header. A checkpoint rejected only because it leaves later blocks of its slot out is not recorded, since an attester that had not yet received those blocks would rightly find it valid; its proposer is still slashed. AttestedInvalidProposalWatcher slashes the attesters whose signed payload hash was recorded, and skips slots with proposal equivocation.
|
|
134
|
+
**Target**: Committee members who attested to the invalid checkpoint payload.
|
|
135
135
|
**Time Unit**: Slot-based offense.
|
|
136
136
|
|
|
137
137
|
### BROADCASTED_INVALID_CHECKPOINT_PROPOSAL
|
|
@@ -202,7 +202,9 @@ Inactivity slashing is one of the most critical, since it allows purging validat
|
|
|
202
202
|
Inactivity slashing is handled by the `Sentinel` (in `aztec-node/src/sentinel/`), which monitors performance of all validators slot-by-slot. With the multiple-blocks-per-slot model, block proposals and checkpoints are distinct concepts: proposers build multiple blocks per slot, but attestations are only for checkpoints. After each slot, the sentinel assigns one of the following to the proposer for the slot, in highest-confidence order:
|
|
203
203
|
|
|
204
204
|
- `checkpoint-mined` — a checkpoint covering this slot has landed on L1
|
|
205
|
-
- `checkpoint-
|
|
205
|
+
- `checkpoint-unpublished` — a valid checkpoint proposal built on a parent that is on L1 reached quorum, yet the proposer did not land it
|
|
206
|
+
- `checkpoint-orphaned` — a valid checkpoint proposal could not land because the parent it built on never landed on L1, or because an earlier slot landed its checkpoint number after it had reached quorum
|
|
207
|
+
- `checkpoint-valid` — the local node re-executed a checkpoint proposal for this slot successfully, and it could not be classified as unpublished or orphaned
|
|
206
208
|
- `checkpoint-invalid` — the local node re-executed a checkpoint proposal for this slot and rejected it (header / archive / out-hash mismatch, limit breach, etc.). Proposer-fault
|
|
207
209
|
- `checkpoint-unvalidated` — a checkpoint proposal arrived but the local node could not validate it (missing blocks/txs, timeout). Treated as proposer-fault
|
|
208
210
|
- `checkpoint-missed` — block proposals seen on P2P but no checkpoint proposal at all
|
|
@@ -212,10 +214,10 @@ Re-execution outcomes are read from the `CheckpointReexecutionTracker`, which th
|
|
|
212
214
|
|
|
213
215
|
Each non-proposer committee member is assigned one of:
|
|
214
216
|
- `attestation-sent` if their checkpoint attestation was seen on L1 or on the P2P network
|
|
215
|
-
- `attestation-missed` if the proposer status was `checkpoint-mined` or `checkpoint-valid` but no checkpoint attestation was seen
|
|
217
|
+
- `attestation-missed` if the proposer status was `checkpoint-mined`, `checkpoint-unpublished`, `checkpoint-orphaned` or `checkpoint-valid` but no checkpoint attestation was seen, unless a different checkpoint landed in the parent's position or an earlier slot landed the proposal's checkpoint number
|
|
216
218
|
- none in any other case
|
|
217
219
|
|
|
218
|
-
`blocks-missed`, `checkpoint-missed`, `checkpoint-invalid`, and `checkpoint-unvalidated` all count as proposer inactivity for the slot.
|
|
220
|
+
`blocks-missed`, `checkpoint-missed`, `checkpoint-invalid`, and `checkpoint-unvalidated` all count as proposer inactivity for the slot. `checkpoint-unpublished` and `checkpoint-orphaned` do not count toward inactivity yet: they are recorded in the sentinel's history and stats only.
|
|
219
221
|
|
|
220
222
|
The sentinel evaluates an epoch once `sentinelEpochEndBufferSlots` (default 2) L2 slots have elapsed past the epoch's last slot AND the per-slot recorder has covered that last slot. Epoch evaluation does not wait for an L1 proof — it relies on local-state evidence (the re-execution tracker plus L1 checkpoint landings) — so inactive validators are slashed promptly regardless of prover availability.
|
|
221
223
|
|
|
@@ -14,6 +14,11 @@ import type { Watcher } from './watcher.js';
|
|
|
14
14
|
* Facade for the Slasher client. This class forwards all requests to the actual Slasher client implementation.
|
|
15
15
|
* This class also monitors via the rollup contract when the underlying slasher proposer contract changes, and when it
|
|
16
16
|
* does, it stops the current slasher client, recreates a new one with the new contract address, and starts it again.
|
|
17
|
+
*
|
|
18
|
+
* A replacement slashing proposer must keep the same round size and slash offset as the one it replaces. The offenses
|
|
19
|
+
* store persists across the swap with each offense filed under its round at the old round size, and the two
|
|
20
|
+
* proposers' voting windows only line up when both values match. A larger round size makes the new proposer re-vote
|
|
21
|
+
* slots the old one already slashed, so validators get slashed twice; a smaller one skips a range of slots entirely.
|
|
17
22
|
*/
|
|
18
23
|
export declare class SlasherClientFacade implements SlasherClientInterface {
|
|
19
24
|
private config;
|
|
@@ -41,4 +46,4 @@ export declare class SlasherClientFacade implements SlasherClientInterface {
|
|
|
41
46
|
private createSlasherClient;
|
|
42
47
|
private handleSlasherChange;
|
|
43
48
|
}
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xhc2hlcl9jbGllbnRfZmFjYWRlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2xhc2hlcl9jbGllbnRfZmFj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ELE9BQU8sQ0FBQyxtQkFBbUI7WUFlYixtQkFBbUI7Q0FNbEMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slasher_client_facade.d.ts","sourceRoot":"","sources":["../src/slasher_client_facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"slasher_client_facade.d.ts","sourceRoot":"","sources":["../src/slasher_client_facade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,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AM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAIxD;IAEM,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhE;IAEM,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAEvC;IAEM,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAEhF;IAED,OAAO,CAAC,mBAAmB;YAeb,mBAAmB;CAMlC"}
|
|
@@ -4,6 +4,11 @@ import { createSlasherImplementation } from './factory/create_implementation.js'
|
|
|
4
4
|
* Facade for the Slasher client. This class forwards all requests to the actual Slasher client implementation.
|
|
5
5
|
* This class also monitors via the rollup contract when the underlying slasher proposer contract changes, and when it
|
|
6
6
|
* does, it stops the current slasher client, recreates a new one with the new contract address, and starts it again.
|
|
7
|
+
*
|
|
8
|
+
* A replacement slashing proposer must keep the same round size and slash offset as the one it replaces. The offenses
|
|
9
|
+
* store persists across the swap with each offense filed under its round at the old round size, and the two
|
|
10
|
+
* proposers' voting windows only line up when both values match. A larger round size makes the new proposer re-vote
|
|
11
|
+
* slots the old one already slashed, so validators get slashed twice; a smaller one skips a range of slots entirely.
|
|
7
12
|
*/ export class SlasherClientFacade {
|
|
8
13
|
config;
|
|
9
14
|
rollup;
|
|
@@ -34,10 +34,10 @@ export declare class AttestedInvalidProposalWatcher extends AttestedInvalidPropo
|
|
|
34
34
|
stop(): Promise<void>;
|
|
35
35
|
scan(): Promise<void>;
|
|
36
36
|
/** Scans a single invalid-proposal slot. */
|
|
37
|
-
scanSlot(slot: SlotNumber): Promise<
|
|
37
|
+
scanSlot(slot: SlotNumber): Promise<boolean>;
|
|
38
38
|
private getSlashArgs;
|
|
39
39
|
private getSlashArgsForAttester;
|
|
40
40
|
private markAsNewOffense;
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
43
|
+
//# s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FBMEMsRUFXcEQ7SUFFTSxZQUFZLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxhQUFhLENBQUMsR0FBRyxJQUFJLENBR3hEO0lBRU0sS0FBSyxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FHNUI7SUFFTSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtJQUVZLElBQUksSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBa0NqQztJQUVELDRDQUE0QztJQUMvQixRQUFRLENBQUMsSUFBSSxFQUFFLFVBQVUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBNEN4RDtJQUVELE9BQU8sQ0FBQyxZQUFZO0lBYXBCLE9BQU8sQ0FBQyx1QkFBdUI7SUFTL0IsT0FBTyxDQUFDLGdCQUFnQjtDQUl6QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attested_invalid_proposal_watcher.d.ts","sourceRoot":"","sources":["../../src/watchers/attested_invalid_proposal_watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAI/F,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAKrF,OAAO,EAA6C,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE7G,QAAA,MAAM,wCAAwC,0DAA2D,CAAC;AAM1G,KAAK,oCAAoC,GAAG,IAAI,CAC9C,aAAa,EACb,CAAC,OAAO,wCAAwC,CAAC,CAAC,MAAM,CAAC,CAC1D,CAAC;AAEF,KAAK,8BAA8B,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C1B,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAX7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2D;IAC3F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,eAAe,CAAyB;IAEhD,YACmB,SAAS,EAAE,8BAA8B,EACzC,yBAAyB,EAAE,yBAAyB,EACpD,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,uBAAuB,CAAC,EAC3D,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,gBAAgB,CAAC,EACvF,MAAM,EAAE,oCAAoC,EAC5C,OAAO,GAAE,qCAA0C,EAWpD;IAEM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAGxD;IAEM,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG5B;IAEM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAEY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAkCjC;IAED,4CAA4C;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA4CxD;IAED,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,gBAAgB;CAIzB"}
|
|
@@ -53,18 +53,33 @@ export class AttestedInvalidProposalWatcher extends EventEmitter {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
const newestSlotToConsider = SlotNumber(currentSlot - SCAN_SLOT_LAG);
|
|
56
|
-
|
|
56
|
+
// Never look back further than the lookback window, so a slot whose attestations can no longer be read
|
|
57
|
+
// (the attestation pool is pruned on finalization) is abandoned rather than stalling the scan on a retry.
|
|
58
|
+
const windowFloor = SlotNumber(Math.max(0, newestSlotToConsider - this.scanSlotLookback + 1));
|
|
59
|
+
const oldestSlot = this.lastScannedSlot === undefined ? windowFloor : SlotNumber(Math.max(windowFloor, this.lastScannedSlot + 1));
|
|
57
60
|
if (oldestSlot > newestSlotToConsider) {
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
63
|
+
// Advance only across the leading run of completed slots. If a slot's attestation-pool read fails, hold
|
|
64
|
+
// just before it so the next scan retries it (bounded by windowFloor), instead of marking it scanned and
|
|
65
|
+
// never slashing its attesters. This watcher is the only checkpoint-attester slashing path.
|
|
66
|
+
let advanceTo;
|
|
67
|
+
let blocked = false;
|
|
60
68
|
for(let slot = oldestSlot; slot <= newestSlotToConsider; slot++){
|
|
61
|
-
await this.scanSlot(slot);
|
|
69
|
+
const completed = await this.scanSlot(slot);
|
|
70
|
+
if (!completed) {
|
|
71
|
+
blocked = true;
|
|
72
|
+
} else if (!blocked) {
|
|
73
|
+
advanceTo = SlotNumber(slot);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (advanceTo !== undefined) {
|
|
77
|
+
this.lastScannedSlot = advanceTo;
|
|
62
78
|
}
|
|
63
|
-
this.lastScannedSlot = newestSlotToConsider;
|
|
64
79
|
}
|
|
65
80
|
/** Scans a single invalid-proposal slot. */ async scanSlot(slot) {
|
|
66
81
|
if (this.invalidProposalSlotSource.hasProposalEquivocation(slot) || !this.invalidProposalSlotSource.hasInvalidProposals(slot)) {
|
|
67
|
-
return;
|
|
82
|
+
return true;
|
|
68
83
|
}
|
|
69
84
|
let attestations;
|
|
70
85
|
try {
|
|
@@ -74,17 +89,17 @@ export class AttestedInvalidProposalWatcher extends EventEmitter {
|
|
|
74
89
|
err,
|
|
75
90
|
slot
|
|
76
91
|
});
|
|
77
|
-
return;
|
|
92
|
+
return false;
|
|
78
93
|
}
|
|
79
94
|
// Slash only attesters whose signed payload matches an invalid checkpoint proposal
|
|
80
95
|
// (see invalidCheckpointProposalHashesBySlot for why block-invalid slots are excluded).
|
|
81
96
|
const invalidHashes = new Set(this.invalidProposalSlotSource.getInvalidCheckpointProposalHashes(slot));
|
|
82
97
|
if (invalidHashes.size === 0) {
|
|
83
|
-
return;
|
|
98
|
+
return true;
|
|
84
99
|
}
|
|
85
100
|
const slashArgs = attestations.filter((attestation)=>invalidHashes.has(attestation.getPayloadHash())).map((attestation)=>this.getSlashArgs(slot, attestation)).filter((args)=>args !== undefined).filter((args)=>this.markAsNewOffense(args));
|
|
86
101
|
if (slashArgs.length === 0) {
|
|
87
|
-
return;
|
|
102
|
+
return true;
|
|
88
103
|
}
|
|
89
104
|
this.log.info('Detected attestations to invalid checkpoint proposal', {
|
|
90
105
|
slot,
|
|
@@ -96,6 +111,7 @@ export class AttestedInvalidProposalWatcher extends EventEmitter {
|
|
|
96
111
|
}))
|
|
97
112
|
});
|
|
98
113
|
this.emit(WANT_TO_SLASH_EVENT, slashArgs);
|
|
114
|
+
return true;
|
|
99
115
|
}
|
|
100
116
|
getSlashArgs(slot, attestation) {
|
|
101
117
|
const attester = attestation.getSender();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec-labs/slasher",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-nightly.20261024",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@aztec-labs/epoch-cache": "6.0.
|
|
59
|
-
"@aztec-labs/ethereum": "6.0.
|
|
60
|
-
"@aztec-labs/foundation": "6.0.
|
|
61
|
-
"@aztec-labs/kv-store": "6.0.
|
|
62
|
-
"@aztec-labs/stdlib": "6.0.
|
|
63
|
-
"@aztec-labs/telemetry-client": "6.0.
|
|
58
|
+
"@aztec-labs/epoch-cache": "6.1.0-nightly.20261024",
|
|
59
|
+
"@aztec-labs/ethereum": "6.1.0-nightly.20261024",
|
|
60
|
+
"@aztec-labs/foundation": "6.1.0-nightly.20261024",
|
|
61
|
+
"@aztec-labs/kv-store": "6.1.0-nightly.20261024",
|
|
62
|
+
"@aztec-labs/stdlib": "6.1.0-nightly.20261024",
|
|
63
|
+
"@aztec-labs/telemetry-client": "6.1.0-nightly.20261024",
|
|
64
64
|
"source-map-support": "^0.5.21",
|
|
65
65
|
"tslib": "^2.4.0",
|
|
66
66
|
"viem": "2.57.1",
|
|
@@ -18,6 +18,11 @@ import type { Watcher } from './watcher.js';
|
|
|
18
18
|
* Facade for the Slasher client. This class forwards all requests to the actual Slasher client implementation.
|
|
19
19
|
* This class also monitors via the rollup contract when the underlying slasher proposer contract changes, and when it
|
|
20
20
|
* does, it stops the current slasher client, recreates a new one with the new contract address, and starts it again.
|
|
21
|
+
*
|
|
22
|
+
* A replacement slashing proposer must keep the same round size and slash offset as the one it replaces. The offenses
|
|
23
|
+
* store persists across the swap with each offense filed under its round at the old round size, and the two
|
|
24
|
+
* proposers' voting windows only line up when both values match. A larger round size makes the new proposer re-vote
|
|
25
|
+
* slots the old one already slashed, so validators get slashed twice; a smaller one skips a range of slots entirely.
|
|
21
26
|
*/
|
|
22
27
|
export class SlasherClientFacade implements SlasherClientInterface {
|
|
23
28
|
private client: SlasherClientInterface | undefined;
|
|
@@ -86,28 +86,41 @@ export class AttestedInvalidProposalWatcher extends (EventEmitter as new () => W
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const newestSlotToConsider = SlotNumber(currentSlot - SCAN_SLOT_LAG);
|
|
89
|
+
// Never look back further than the lookback window, so a slot whose attestations can no longer be read
|
|
90
|
+
// (the attestation pool is pruned on finalization) is abandoned rather than stalling the scan on a retry.
|
|
91
|
+
const windowFloor = SlotNumber(Math.max(0, newestSlotToConsider - this.scanSlotLookback + 1));
|
|
89
92
|
const oldestSlot =
|
|
90
|
-
this.lastScannedSlot === undefined
|
|
91
|
-
? SlotNumber(Math.max(0, newestSlotToConsider - this.scanSlotLookback + 1))
|
|
92
|
-
: SlotNumber(this.lastScannedSlot + 1);
|
|
93
|
+
this.lastScannedSlot === undefined ? windowFloor : SlotNumber(Math.max(windowFloor, this.lastScannedSlot + 1));
|
|
93
94
|
if (oldestSlot > newestSlotToConsider) {
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
// Advance only across the leading run of completed slots. If a slot's attestation-pool read fails, hold
|
|
99
|
+
// just before it so the next scan retries it (bounded by windowFloor), instead of marking it scanned and
|
|
100
|
+
// never slashing its attesters. This watcher is the only checkpoint-attester slashing path.
|
|
101
|
+
let advanceTo: SlotNumber | undefined;
|
|
102
|
+
let blocked = false;
|
|
97
103
|
for (let slot = oldestSlot; slot <= newestSlotToConsider; slot++) {
|
|
98
|
-
await this.scanSlot(slot);
|
|
104
|
+
const completed = await this.scanSlot(slot);
|
|
105
|
+
if (!completed) {
|
|
106
|
+
blocked = true;
|
|
107
|
+
} else if (!blocked) {
|
|
108
|
+
advanceTo = SlotNumber(slot);
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
|
|
101
|
-
|
|
112
|
+
if (advanceTo !== undefined) {
|
|
113
|
+
this.lastScannedSlot = advanceTo;
|
|
114
|
+
}
|
|
102
115
|
}
|
|
103
116
|
|
|
104
117
|
/** Scans a single invalid-proposal slot. */
|
|
105
|
-
public async scanSlot(slot: SlotNumber): Promise<
|
|
118
|
+
public async scanSlot(slot: SlotNumber): Promise<boolean> {
|
|
106
119
|
if (
|
|
107
120
|
this.invalidProposalSlotSource.hasProposalEquivocation(slot) ||
|
|
108
121
|
!this.invalidProposalSlotSource.hasInvalidProposals(slot)
|
|
109
122
|
) {
|
|
110
|
-
return;
|
|
123
|
+
return true;
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
let attestations: CheckpointAttestation[];
|
|
@@ -115,14 +128,14 @@ export class AttestedInvalidProposalWatcher extends (EventEmitter as new () => W
|
|
|
115
128
|
attestations = await this.p2pClient.getCheckpointAttestationsForSlot(slot);
|
|
116
129
|
} catch (err) {
|
|
117
130
|
this.log.warn('Error getting checkpoint attestations for invalid proposal slot', { err, slot });
|
|
118
|
-
return;
|
|
131
|
+
return false;
|
|
119
132
|
}
|
|
120
133
|
|
|
121
134
|
// Slash only attesters whose signed payload matches an invalid checkpoint proposal
|
|
122
135
|
// (see invalidCheckpointProposalHashesBySlot for why block-invalid slots are excluded).
|
|
123
136
|
const invalidHashes = new Set(this.invalidProposalSlotSource.getInvalidCheckpointProposalHashes(slot));
|
|
124
137
|
if (invalidHashes.size === 0) {
|
|
125
|
-
return;
|
|
138
|
+
return true;
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
const slashArgs = attestations
|
|
@@ -132,7 +145,7 @@ export class AttestedInvalidProposalWatcher extends (EventEmitter as new () => W
|
|
|
132
145
|
.filter(args => this.markAsNewOffense(args));
|
|
133
146
|
|
|
134
147
|
if (slashArgs.length === 0) {
|
|
135
|
-
return;
|
|
148
|
+
return true;
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
this.log.info('Detected attestations to invalid checkpoint proposal', {
|
|
@@ -145,6 +158,7 @@ export class AttestedInvalidProposalWatcher extends (EventEmitter as new () => W
|
|
|
145
158
|
})),
|
|
146
159
|
});
|
|
147
160
|
this.emit(WANT_TO_SLASH_EVENT, slashArgs);
|
|
161
|
+
return true;
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
private getSlashArgs(slot: SlotNumber, attestation: CheckpointAttestation): WantToSlashArgs | undefined {
|