-
-
Notifications
You must be signed in to change notification settings - Fork 479
Expand file tree
/
Copy patherrors.ts
More file actions
76 lines (73 loc) 路 2.84 KB
/
Copy patherrors.ts
File metadata and controls
76 lines (73 loc) 路 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import {Epoch} from "@lodestar/types";
import {LodestarError} from "@lodestar/utils";
import {SlashingProtectionAttestation} from "../types.js";
export enum InvalidAttestationErrorCode {
/**
* The attestation has the same target epoch as an attestation from the DB
*/
DOUBLE_VOTE = "ERR_INVALID_ATTESTATION_DOUBLE_VOTE",
/**
* The attestation surrounds an existing attestation from the database `prev`
*/
NEW_SURROUNDS_PREV = "ERR_INVALID_ATTESTATION_NEW_SURROUNDS_PREV",
/**
* The attestation is surrounded by an existing attestation from the database `prev`
*/
PREV_SURROUNDS_NEW = "ERR_INVALID_ATTESTATION_PREV_SURROUNDS_NEW",
/**
* The attestation is invalid because its source epoch is greater than its target epoch
*/
SOURCE_EXCEEDS_TARGET = "ERR_INVALID_ATTESTATION_SOURCE_EXCEEDS_TARGET",
/**
* The attestation is invalid because its source epoch is less than the lower bound on source
* epochs for this validator.
*/
SOURCE_LESS_THAN_LOWER_BOUND = "ERR_INVALID_ATTESTATION_SOURCE_LESS_THAN_LOWER_BOUND",
/**
* The attestation is invalid because its target epoch is less than or equal to the lower
* bound on target epochs for this validator.
*/
TARGET_LESS_THAN_OR_EQ_LOWER_BOUND = "ERR_INVALID_ATTESTATION_TARGET_LESS_THAN_OR_EQ_LOWER_BOUND",
/**
* The attestation is invalid because its source epoch is below the min-max span lookback window of the
* latest attestation of this validator, where a surround vote could not be detected.
*/
SOURCE_BELOW_MIN_SPAN_LOOKBACK = "ERR_INVALID_ATTESTATION_SOURCE_BELOW_MIN_SPAN_LOOKBACK",
}
type InvalidAttestationErrorType =
| {
code: InvalidAttestationErrorCode.DOUBLE_VOTE;
attestation: SlashingProtectionAttestation;
prev: SlashingProtectionAttestation;
}
| {
code: InvalidAttestationErrorCode.NEW_SURROUNDS_PREV;
attestation: SlashingProtectionAttestation;
// Since using min-max surround, the actual attestation may not be available
prev: SlashingProtectionAttestation | null;
}
| {
code: InvalidAttestationErrorCode.PREV_SURROUNDS_NEW;
attestation: SlashingProtectionAttestation;
// Since using min-max surround, the actual attestation may not be available
prev: SlashingProtectionAttestation | null;
}
| {
code: InvalidAttestationErrorCode.SOURCE_EXCEEDS_TARGET;
}
| {
code: InvalidAttestationErrorCode.SOURCE_LESS_THAN_LOWER_BOUND;
sourceEpoch: Epoch;
minSourceEpoch: Epoch;
}
| {
code: InvalidAttestationErrorCode.TARGET_LESS_THAN_OR_EQ_LOWER_BOUND;
targetEpoch: Epoch;
minTargetEpoch: Epoch;
}
| {
code: InvalidAttestationErrorCode.SOURCE_BELOW_MIN_SPAN_LOOKBACK;
sourceEpoch: Epoch;
minSourceEpoch: Epoch;
};
export class InvalidAttestationError extends LodestarError<InvalidAttestationErrorType> {}