@lodestar/fork-choice 1.35.0-dev.98d359db41 → 1.35.0-dev.b42a298a7c
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/package.json +12 -10
- package/lib/forkChoice/errors.d.ts.map +0 -1
- package/lib/forkChoice/forkChoice.d.ts.map +0 -1
- package/lib/forkChoice/interface.d.ts.map +0 -1
- package/lib/forkChoice/store.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/metrics.d.ts.map +0 -1
- package/lib/protoArray/computeDeltas.d.ts.map +0 -1
- package/lib/protoArray/errors.d.ts.map +0 -1
- package/lib/protoArray/interface.d.ts.map +0 -1
- package/lib/protoArray/protoArray.d.ts.map +0 -1
- package/src/forkChoice/errors.ts +0 -98
- package/src/forkChoice/forkChoice.ts +0 -1648
- package/src/forkChoice/interface.ts +0 -269
- package/src/forkChoice/store.ts +0 -124
- package/src/index.ts +0 -34
- package/src/metrics.ts +0 -71
- package/src/protoArray/computeDeltas.ts +0 -97
- package/src/protoArray/errors.ts +0 -59
- package/src/protoArray/interface.ts +0 -102
- package/src/protoArray/protoArray.ts +0 -1076
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {DataAvailabilityStatus} from "@lodestar/state-transition";
|
|
2
|
-
import {Epoch, RootHex, Slot, UintNum64} from "@lodestar/types";
|
|
3
|
-
|
|
4
|
-
// RootHex is a root as a hex string
|
|
5
|
-
// Used for lightweight and easy comparison
|
|
6
|
-
export const HEX_ZERO_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Simplified 'latest message' with previous message
|
|
10
|
-
* The index is relative to ProtoArray indices
|
|
11
|
-
*/
|
|
12
|
-
export type VoteTracker = {
|
|
13
|
-
currentIndex: number | null;
|
|
14
|
-
// if a vode is out of date (the voted index was in the past while proto array is pruned), it will be set to null
|
|
15
|
-
nextIndex: number | null;
|
|
16
|
-
nextEpoch: Epoch;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export enum ExecutionStatus {
|
|
20
|
-
Valid = "Valid",
|
|
21
|
-
Syncing = "Syncing",
|
|
22
|
-
PreMerge = "PreMerge",
|
|
23
|
-
Invalid = "Invalid",
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type LVHValidResponse = {
|
|
27
|
-
executionStatus: ExecutionStatus.Valid;
|
|
28
|
-
latestValidExecHash: RootHex;
|
|
29
|
-
};
|
|
30
|
-
export type LVHInvalidResponse = {
|
|
31
|
-
executionStatus: ExecutionStatus.Invalid;
|
|
32
|
-
latestValidExecHash: RootHex | null;
|
|
33
|
-
invalidateFromParentBlockRoot: RootHex;
|
|
34
|
-
};
|
|
35
|
-
export type LVHExecResponse = LVHValidResponse | LVHInvalidResponse;
|
|
36
|
-
|
|
37
|
-
export type MaybeValidExecutionStatus = Exclude<ExecutionStatus, ExecutionStatus.Invalid>;
|
|
38
|
-
|
|
39
|
-
export type BlockExtraMeta =
|
|
40
|
-
| {
|
|
41
|
-
executionPayloadBlockHash: RootHex;
|
|
42
|
-
executionPayloadNumber: UintNum64;
|
|
43
|
-
executionStatus: Exclude<ExecutionStatus, ExecutionStatus.PreMerge>;
|
|
44
|
-
dataAvailabilityStatus: DataAvailabilityStatus;
|
|
45
|
-
}
|
|
46
|
-
| {
|
|
47
|
-
executionPayloadBlockHash: null;
|
|
48
|
-
executionStatus: ExecutionStatus.PreMerge;
|
|
49
|
-
dataAvailabilityStatus: DataAvailabilityStatus.PreData;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* A block that is to be applied to the fork choice
|
|
54
|
-
*
|
|
55
|
-
* A simplified version of BeaconBlock
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
export type ProtoBlock = BlockExtraMeta & {
|
|
59
|
-
/**
|
|
60
|
-
* The slot is not necessary for ProtoArray,
|
|
61
|
-
* it just exists so external components can easily query the block slot.
|
|
62
|
-
* This is useful for upstream fork choice logic.
|
|
63
|
-
*/
|
|
64
|
-
slot: Slot;
|
|
65
|
-
blockRoot: RootHex;
|
|
66
|
-
parentRoot: RootHex;
|
|
67
|
-
/**
|
|
68
|
-
* The stateRoot is not necessary for ProtoArray either,
|
|
69
|
-
* it also just exists for upstream components (namely attestation verification)
|
|
70
|
-
*/
|
|
71
|
-
stateRoot: RootHex;
|
|
72
|
-
/**
|
|
73
|
-
* The root that would be used for the attestation.data.target.root if a LMD vote was cast for this block.
|
|
74
|
-
*
|
|
75
|
-
* The targetRoot is not necessary for ProtoArray either,
|
|
76
|
-
* it also just exists for upstream components (namely attestation verification)
|
|
77
|
-
*/
|
|
78
|
-
targetRoot: RootHex;
|
|
79
|
-
|
|
80
|
-
justifiedEpoch: Epoch;
|
|
81
|
-
justifiedRoot: RootHex;
|
|
82
|
-
finalizedEpoch: Epoch;
|
|
83
|
-
finalizedRoot: RootHex;
|
|
84
|
-
unrealizedJustifiedEpoch: Epoch;
|
|
85
|
-
unrealizedJustifiedRoot: RootHex;
|
|
86
|
-
unrealizedFinalizedEpoch: Epoch;
|
|
87
|
-
unrealizedFinalizedRoot: RootHex;
|
|
88
|
-
|
|
89
|
-
// Indicate whether block arrives in a timely manner ie. before the 4 second mark
|
|
90
|
-
timeliness: boolean;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* A block root with additional metadata required to form a DAG
|
|
95
|
-
* with vote weights and best blocks stored as metadata
|
|
96
|
-
*/
|
|
97
|
-
export type ProtoNode = ProtoBlock & {
|
|
98
|
-
parent?: number;
|
|
99
|
-
weight: number;
|
|
100
|
-
bestChild?: number;
|
|
101
|
-
bestDescendant?: number;
|
|
102
|
-
};
|