@lodestar/fork-choice 1.41.0-dev.afd446235e → 1.41.0-dev.b90dff673d
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/lib/forkChoice/errors.d.ts +9 -1
- package/lib/forkChoice/errors.d.ts.map +1 -1
- package/lib/forkChoice/errors.js +10 -3
- package/lib/forkChoice/errors.js.map +1 -1
- package/lib/forkChoice/forkChoice.d.ts +76 -20
- package/lib/forkChoice/forkChoice.d.ts.map +1 -1
- package/lib/forkChoice/forkChoice.js +304 -118
- package/lib/forkChoice/forkChoice.js.map +1 -1
- package/lib/forkChoice/interface.d.ts +54 -21
- package/lib/forkChoice/interface.d.ts.map +1 -1
- package/lib/forkChoice/interface.js +6 -3
- package/lib/forkChoice/interface.js.map +1 -1
- package/lib/forkChoice/safeBlocks.js.map +1 -1
- package/lib/forkChoice/store.d.ts +40 -16
- package/lib/forkChoice/store.d.ts.map +1 -1
- package/lib/forkChoice/store.js +22 -4
- package/lib/forkChoice/store.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/metrics.d.ts.map +1 -1
- package/lib/metrics.js.map +1 -1
- package/lib/protoArray/computeDeltas.d.ts.map +1 -1
- package/lib/protoArray/computeDeltas.js +3 -0
- package/lib/protoArray/computeDeltas.js.map +1 -1
- package/lib/protoArray/errors.d.ts +15 -2
- package/lib/protoArray/errors.d.ts.map +1 -1
- package/lib/protoArray/errors.js +7 -2
- package/lib/protoArray/errors.js.map +1 -1
- package/lib/protoArray/interface.d.ts +33 -3
- package/lib/protoArray/interface.d.ts.map +1 -1
- package/lib/protoArray/interface.js +31 -1
- package/lib/protoArray/interface.js.map +1 -1
- package/lib/protoArray/protoArray.d.ts +225 -24
- package/lib/protoArray/protoArray.d.ts.map +1 -1
- package/lib/protoArray/protoArray.js +763 -134
- package/lib/protoArray/protoArray.js.map +1 -1
- package/package.json +9 -9
- package/src/forkChoice/errors.ts +7 -2
- package/src/forkChoice/forkChoice.ts +387 -127
- package/src/forkChoice/interface.ts +72 -20
- package/src/forkChoice/store.ts +52 -20
- package/src/index.ts +10 -2
- package/src/protoArray/computeDeltas.ts +6 -0
- package/src/protoArray/errors.ts +7 -1
- package/src/protoArray/interface.ts +48 -3
- package/src/protoArray/protoArray.ts +896 -135
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { ForkChoiceError, ForkChoiceErrorCode, InvalidAttestationCode, InvalidBlockCode, } from "./forkChoice/errors.js";
|
|
2
|
-
export { ForkChoice, UpdateHeadOpt } from "./forkChoice/forkChoice.js";
|
|
2
|
+
export { ForkChoice, UpdateHeadOpt, getCheckpointPayloadStatus, } from "./forkChoice/forkChoice.js";
|
|
3
3
|
export { AncestorStatus, EpochDifference, NotReorgedReason, } from "./forkChoice/interface.js";
|
|
4
4
|
export * from "./forkChoice/safeBlocks.js";
|
|
5
5
|
export { ForkChoiceStore, } from "./forkChoice/store.js";
|
|
6
6
|
export { getForkChoiceMetrics } from "./metrics.js";
|
|
7
|
-
export { ExecutionStatus } from "./protoArray/interface.js";
|
|
7
|
+
export { ExecutionStatus, PayloadStatus } from "./protoArray/interface.js";
|
|
8
8
|
export { ProtoArray } from "./protoArray/protoArray.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EAEnB,sBAAsB,EAEtB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EAEnB,sBAAsB,EAEtB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,UAAU,EAEV,aAAa,EACb,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,cAAc,EAGd,eAAe,EAEf,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAGL,eAAe,GAGhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAyB,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAS1E,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC"}
|
package/lib/metrics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmGlE"}
|
package/lib/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,oBAAoB,CAAC,QAA8B;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,oBAAoB,CAAC,QAA8B,EAAE;IACnE,OAAO;QACL,UAAU,EAAE;YACV,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAmB;gBAC7C,IAAI,EAAE,sCAAsC;gBAC5C,IAAI,EAAE,oCAAoC;gBAC1C,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrB,UAAU,EAAE,CAAC,QAAQ,CAAC;aACvB,CAAC;YACF,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;gBACvB,IAAI,EAAE,mCAAmC;gBACzC,IAAI,EAAE,+DAA+D;aACtE,CAAC;YACF,MAAM,EAAE,QAAQ,CAAC,KAAK,CAA8B;gBAClD,IAAI,EAAE,iCAAiC;gBACvC,IAAI,EAAE,uFAAuF;gBAC7F,UAAU,EAAE,CAAC,YAAY,CAAC;aAC3B,CAAC;YACF,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC;gBAC1B,IAAI,EAAE,uCAAuC;gBAC7C,IAAI,EAAE,qDAAqD;aAC5D,CAAC;YACF,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;gBACpB,IAAI,EAAE,gCAAgC;gBACtC,IAAI,EAAE,kEAAkE;aACzE,CAAC;YACF,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC;gBAChC,IAAI,EAAE,mCAAmC;gBACzC,IAAI,EAAE,8BAA8B;gBACpC,yFAAyF;gBACzF,8FAA8F;gBAC9F,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EA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aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,SAAS,EAAE,EAC/B,eAAe,EAAE,SAAS,EAAE,EAC5B,WAAW,EAAE,0BAA0B,EACvC,WAAW,EAAE,0BAA0B,EACvC,mBAAmB,EAAE,GAAG,CAAC,cAAc,CAAC,GACvC,YAAY,
|
|
1
|
+
{"version":3,"file":"computeDeltas.d.ts","sourceRoot":"","sources":["../../src/protoArray/computeDeltas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAkB,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAK1D,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sBAAsB,EAAE,MAAM,CAAC;IAE/B,qBAAqB,EAAE,MAAM,CAAC;IAE9B,qBAAqB,EAAE,MAAM,CAAC;IAE9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,SAAS,EAAE,EAC/B,eAAe,EAAE,SAAS,EAAE,EAC5B,WAAW,EAAE,0BAA0B,EACvC,WAAW,EAAE,0BAA0B,EACvC,mBAAmB,EAAE,GAAG,CAAC,cAAc,CAAC,GACvC,YAAY,CA0Hd"}
|
|
@@ -71,6 +71,9 @@ export function computeDeltas(numProtoNodes, voteCurrentIndices, voteNextIndices
|
|
|
71
71
|
newInactiveValidators++;
|
|
72
72
|
continue;
|
|
73
73
|
}
|
|
74
|
+
// Deduct old balance from current index, add new balance to next index
|
|
75
|
+
// currentIndex and nextIndex already point to the correct node variants
|
|
76
|
+
// Note: If a validator changes from EMPTY to FULL variant of the same block, indexChanged will be true
|
|
74
77
|
if (currentIndex !== nextIndex || oldBalance !== newBalance) {
|
|
75
78
|
// We ignore the vote if it is not known in `indices .
|
|
76
79
|
// We assume that it is outside of our tree (ie: pre-finalization) and therefore not interesting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeDeltas.js","sourceRoot":"","sources":["../../src/protoArray/computeDeltas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AACjE,OAAO,EAAC,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAE1D,mDAAmD;AACnD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAU,CAAC;AAcnC;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,aAAqB,EACrB,kBAA+B,EAC/B,eAA4B,EAC5B,WAAuC,EACvC,WAAuC,EACvC,mBAAwC;
|
|
1
|
+
{"version":3,"file":"computeDeltas.js","sourceRoot":"","sources":["../../src/protoArray/computeDeltas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AACjE,OAAO,EAAC,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAE1D,mDAAmD;AACnD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAU,CAAC;AAcnC;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,aAAqB,EACrB,kBAA+B,EAC/B,eAA4B,EAC5B,WAAuC,EACvC,WAAuC,EACvC,mBAAwC,EAC1B;IACd,IAAI,kBAAkB,CAAC,MAAM,KAAK,eAAe,CAAC,MAAM,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CACb,qEAAqE,kBAAkB,CAAC,MAAM,QAAQ,eAAe,CAAC,MAAM,EAAE,CAC/H,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,IAAI,eAAe,EAAE,CAAC;QACrC,yDAAyD;QACzD,MAAM,IAAI,KAAK,CAAC,oDAAoD,aAAa,OAAO,eAAe,EAAE,CAAC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AAC;oBAC/B,MAAM,IAAI,eAAe,CAAC;wBACxB,IAAI,EAAE,mBAAmB,CAAC,kBAAkB;wBAC5C,KAAK,EAAE,SAAS;qBACjB,CAAC,CAAC;gBACL,CAAC;gBAED,MAAM,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC;YAClC,CAAC;YACD,kBAAkB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;YACvC,iBAAiB,EAAE,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,uBAAuB,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC,qBAAqB;IAEvB,IAAI,MAAM,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;QACpC,0HAA0H;QAC1H,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO;QACL,MAAM;QACN,sBAAsB;QACtB,qBAAqB;QACrB,qBAAqB;QACrB,uBAAuB;QACvB,iBAAiB;KAClB,CAAC;AAAA,CACH"}
|
|
@@ -13,6 +13,8 @@ export type LVHExecError = {
|
|
|
13
13
|
export declare enum ProtoArrayErrorCode {
|
|
14
14
|
FINALIZED_NODE_UNKNOWN = "PROTO_ARRAY_ERROR_FINALIZED_NODE_UNKNOWN",
|
|
15
15
|
JUSTIFIED_NODE_UNKNOWN = "PROTO_ARRAY_ERROR_JUSTIFIED_NODE_UNKNOWN",
|
|
16
|
+
UNKNOWN_BLOCK = "PROTO_ARRAY_ERROR_UNKNOWN_BLOCK",
|
|
17
|
+
UNKNOWN_PARENT_BLOCK = "PROTO_ARRAY_ERROR_UNKNOWN_PARENT_BLOCK",
|
|
16
18
|
INVALID_FINALIZED_ROOT_CHANGE = "PROTO_ARRAY_ERROR_INVALID_FINALIZED_ROOT_CHANGE",
|
|
17
19
|
INVALID_NODE_INDEX = "PROTO_ARRAY_ERROR_INVALID_NODE_INDEX",
|
|
18
20
|
INVALID_PARENT_INDEX = "PROTO_ARRAY_ERROR_INVALID_PARENT_INDEX",
|
|
@@ -27,7 +29,8 @@ export declare enum ProtoArrayErrorCode {
|
|
|
27
29
|
INVALID_BEST_NODE = "PROTO_ARRAY_ERROR_INVALID_BEST_NODE",
|
|
28
30
|
INVALID_BLOCK_EXECUTION_STATUS = "PROTO_ARRAY_INVALID_BLOCK_EXECUTION_STATUS",
|
|
29
31
|
INVALID_JUSTIFIED_EXECUTION_STATUS = "PROTO_ARRAY_INVALID_JUSTIFIED_EXECUTION_STATUS",
|
|
30
|
-
INVALID_LVH_EXECUTION_RESPONSE = "PROTO_ARRAY_INVALID_LVH_EXECUTION_RESPONSE"
|
|
32
|
+
INVALID_LVH_EXECUTION_RESPONSE = "PROTO_ARRAY_INVALID_LVH_EXECUTION_RESPONSE",
|
|
33
|
+
PRE_GLOAS_BLOCK = "PROTO_ARRAY_ERROR_PRE_GLOAS_BLOCK"
|
|
31
34
|
}
|
|
32
35
|
export type ProtoArrayErrorType = {
|
|
33
36
|
code: ProtoArrayErrorCode.FINALIZED_NODE_UNKNOWN;
|
|
@@ -35,6 +38,13 @@ export type ProtoArrayErrorType = {
|
|
|
35
38
|
} | {
|
|
36
39
|
code: ProtoArrayErrorCode.JUSTIFIED_NODE_UNKNOWN;
|
|
37
40
|
root: RootHex;
|
|
41
|
+
} | {
|
|
42
|
+
code: ProtoArrayErrorCode.UNKNOWN_BLOCK;
|
|
43
|
+
root: RootHex;
|
|
44
|
+
} | {
|
|
45
|
+
code: ProtoArrayErrorCode.UNKNOWN_PARENT_BLOCK;
|
|
46
|
+
parentRoot: RootHex;
|
|
47
|
+
parentHash: RootHex | null;
|
|
38
48
|
} | {
|
|
39
49
|
code: ProtoArrayErrorCode.INVALID_FINALIZED_ROOT_CHANGE;
|
|
40
50
|
} | {
|
|
@@ -85,7 +95,10 @@ export type ProtoArrayErrorType = {
|
|
|
85
95
|
root: RootHex;
|
|
86
96
|
} | ({
|
|
87
97
|
code: ProtoArrayErrorCode.INVALID_LVH_EXECUTION_RESPONSE;
|
|
88
|
-
} & LVHExecError)
|
|
98
|
+
} & LVHExecError) | {
|
|
99
|
+
code: ProtoArrayErrorCode.PRE_GLOAS_BLOCK;
|
|
100
|
+
root: RootHex;
|
|
101
|
+
};
|
|
89
102
|
export declare class ProtoArrayError extends LodestarError<ProtoArrayErrorType> {
|
|
90
103
|
}
|
|
91
104
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/protoArray/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,oBAAY,gBAAgB;IAC1B,iBAAiB,sBAAsB;IACvC,cAAc,mBAAmB;IACjC,cAAc,mBAAmB;CAClC;AAED,MAAM,MAAM,YAAY,GAAG;IAAC,OAAO,EAAE,gBAAgB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,CAAC;AAE9F,oBAAY,mBAAmB;IAC7B,sBAAsB,6CAA6C;IACnE,sBAAsB,6CAA6C;IACnE,6BAA6B,oDAAoD;IACjF,kBAAkB,yCAAyC;IAC3D,oBAAoB,2CAA2C;IAC/D,wBAAwB,+CAA+C;IACvE,uBAAuB,8CAA8C;IACrE,6BAA6B,oDAAoD;IACjF,oBAAoB,2CAA2C;IAC/D,kBAAkB,yCAAyC;IAC3D,cAAc,qCAAqC;IACnD,iBAAiB,wCAAwC;IACzD,wBAAwB,+CAA+C;IACvE,iBAAiB,wCAAwC;IACzD,8BAA8B,+CAA+C;IAC7E,kCAAkC,mDAAmD;IACrF,8BAA8B,+CAA+C;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/protoArray/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OA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AAE,KAAK,CAAC;CAC3B,GACD;IAAC,IAAI,EAAE,mBAAmB,CAAC,8BAA8B,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,GACzE;IAAC,IAAI,EAAE,mBAAmB,CAAC,kCAAkC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,GAC7E,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAC,8BAA8B,CAAA;CAAC,GAAG,YAAY,CAAC,GAC3E;IAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,CAAC;AAE/D,qBAAa,eAAgB,SAAQ,aAAa,CAAC,mBAAmB,CAAC;CAAG"}
|
package/lib/protoArray/errors.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { LodestarError } from "@lodestar/utils";
|
|
2
|
-
export
|
|
2
|
+
export { LVHExecErrorCode };
|
|
3
|
+
var LVHExecErrorCode;
|
|
3
4
|
(function (LVHExecErrorCode) {
|
|
4
5
|
LVHExecErrorCode["PreMergeToInvalid"] = "PreMergeToInvalid";
|
|
5
6
|
LVHExecErrorCode["ValidToInvalid"] = "ValidToInvalid";
|
|
6
7
|
LVHExecErrorCode["InvalidToValid"] = "InvalidToValid";
|
|
7
8
|
})(LVHExecErrorCode || (LVHExecErrorCode = {}));
|
|
8
|
-
export
|
|
9
|
+
export { ProtoArrayErrorCode };
|
|
10
|
+
var ProtoArrayErrorCode;
|
|
9
11
|
(function (ProtoArrayErrorCode) {
|
|
10
12
|
ProtoArrayErrorCode["FINALIZED_NODE_UNKNOWN"] = "PROTO_ARRAY_ERROR_FINALIZED_NODE_UNKNOWN";
|
|
11
13
|
ProtoArrayErrorCode["JUSTIFIED_NODE_UNKNOWN"] = "PROTO_ARRAY_ERROR_JUSTIFIED_NODE_UNKNOWN";
|
|
14
|
+
ProtoArrayErrorCode["UNKNOWN_BLOCK"] = "PROTO_ARRAY_ERROR_UNKNOWN_BLOCK";
|
|
15
|
+
ProtoArrayErrorCode["UNKNOWN_PARENT_BLOCK"] = "PROTO_ARRAY_ERROR_UNKNOWN_PARENT_BLOCK";
|
|
12
16
|
ProtoArrayErrorCode["INVALID_FINALIZED_ROOT_CHANGE"] = "PROTO_ARRAY_ERROR_INVALID_FINALIZED_ROOT_CHANGE";
|
|
13
17
|
ProtoArrayErrorCode["INVALID_NODE_INDEX"] = "PROTO_ARRAY_ERROR_INVALID_NODE_INDEX";
|
|
14
18
|
ProtoArrayErrorCode["INVALID_PARENT_INDEX"] = "PROTO_ARRAY_ERROR_INVALID_PARENT_INDEX";
|
|
@@ -24,6 +28,7 @@ export var ProtoArrayErrorCode;
|
|
|
24
28
|
ProtoArrayErrorCode["INVALID_BLOCK_EXECUTION_STATUS"] = "PROTO_ARRAY_INVALID_BLOCK_EXECUTION_STATUS";
|
|
25
29
|
ProtoArrayErrorCode["INVALID_JUSTIFIED_EXECUTION_STATUS"] = "PROTO_ARRAY_INVALID_JUSTIFIED_EXECUTION_STATUS";
|
|
26
30
|
ProtoArrayErrorCode["INVALID_LVH_EXECUTION_RESPONSE"] = "PROTO_ARRAY_INVALID_LVH_EXECUTION_RESPONSE";
|
|
31
|
+
ProtoArrayErrorCode["PRE_GLOAS_BLOCK"] = "PROTO_ARRAY_ERROR_PRE_GLOAS_BLOCK";
|
|
27
32
|
})(ProtoArrayErrorCode || (ProtoArrayErrorCode = {}));
|
|
28
33
|
export class ProtoArrayError extends LodestarError {
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/protoArray/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/protoArray/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;SAElC,gBAAgB;AAA5B,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,2DAAuC,CAAA;IACvC,qDAAiC,CAAA;IACjC,qDAAiC,CAAA;AAAC,CACpC,EAJY,gBAAgB,KAAhB,gBAAgB,QAI3B;SAIW,mBAAmB;AAA/B,IAAY,mBAqBX;AArBD,WAAY,mBAAmB;IAC7B,0FAAmE,CAAA;IACnE,0FAAmE,CAAA;IACnE,wEAAiD,CAAA;IACjD,sFAA+D,CAAA;IAC/D,wGAAiF,CAAA;IACjF,kFAA2D,CAAA;IAC3D,sFAA+D,CAAA;IAC/D,8FAAuE,CAAA;IACvE,4FAAqE,CAAA;IACrE,wGAAiF,CAAA;IACjF,sFAA+D,CAAA;IAC/D,kFAA2D,CAAA;IAC3D,0EAAmD,CAAA;IACnD,gFAAyD,CAAA;IACzD,8FAAuE,CAAA;IACvE,gFAAyD,CAAA;IACzD,oGAA6E,CAAA;IAC7E,4GAAqF,CAAA;IACrF,oGAA6E,CAAA;IAC7E,4EAAqD,CAAA;AAAC,CACxD,EArBY,mBAAmB,KAAnB,mBAAmB,QAqB9B;AAgCD,MAAM,OAAO,eAAgB,SAAQ,aAAkC;CAAG"}
|
|
@@ -11,12 +11,37 @@ export declare const NULL_VOTE_INDEX = 4294967295;
|
|
|
11
11
|
* A vote index is a non-negative integer from 0 to NULL_VOTE_INDEX inclusive, and it will never be undefined.
|
|
12
12
|
*/
|
|
13
13
|
export type VoteIndex = number;
|
|
14
|
+
/**
|
|
15
|
+
* Execution status of a block in fork choice.
|
|
16
|
+
*
|
|
17
|
+
* - Valid: Execution payload verified as valid by the EL
|
|
18
|
+
* - Syncing: EL is syncing, payload validity unknown (optimistic sync)
|
|
19
|
+
* - PreMerge: Block is from before The Merge, no execution payload exists
|
|
20
|
+
* - Invalid: Execution payload was invalidated by the EL (post-import status)
|
|
21
|
+
* - PayloadSeparated: Gloas beacon block without embedded execution payload.
|
|
22
|
+
* The execution payload arrives separately via SignedExecutionPayloadEnvelope.
|
|
23
|
+
* Gloas blocks WITH execution payload (FULL variant) use Valid/Invalid/Syncing.
|
|
24
|
+
*/
|
|
14
25
|
export declare enum ExecutionStatus {
|
|
15
26
|
Valid = "Valid",
|
|
16
27
|
Syncing = "Syncing",
|
|
17
28
|
PreMerge = "PreMerge",
|
|
18
|
-
Invalid = "Invalid"
|
|
29
|
+
Invalid = "Invalid",
|
|
30
|
+
PayloadSeparated = "PayloadSeparated"
|
|
19
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Payload status for ePBS (Gloas fork)
|
|
34
|
+
* Spec: gloas/fork-choice.md#constants
|
|
35
|
+
*/
|
|
36
|
+
export declare enum PayloadStatus {
|
|
37
|
+
PENDING = 0,
|
|
38
|
+
EMPTY = 1,
|
|
39
|
+
FULL = 2
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if a block is in the Gloas fork (ePBS enabled)
|
|
43
|
+
*/
|
|
44
|
+
export declare function isGloasBlock(block: ProtoBlock): boolean;
|
|
20
45
|
export type LVHValidResponse = {
|
|
21
46
|
executionStatus: ExecutionStatus.Valid;
|
|
22
47
|
latestValidExecHash: RootHex;
|
|
@@ -73,12 +98,17 @@ export type ProtoBlock = BlockExtraMeta & {
|
|
|
73
98
|
unrealizedFinalizedEpoch: Epoch;
|
|
74
99
|
unrealizedFinalizedRoot: RootHex;
|
|
75
100
|
timeliness: boolean;
|
|
76
|
-
|
|
77
|
-
|
|
101
|
+
/** Payload status for this node (Gloas fork). Always FULL in pre-gloas */
|
|
102
|
+
payloadStatus: PayloadStatus;
|
|
103
|
+
builderIndex: number | null;
|
|
104
|
+
blockHashFromBid: RootHex | null;
|
|
105
|
+
parentBlockHash: RootHex | null;
|
|
78
106
|
};
|
|
79
107
|
/**
|
|
80
108
|
* A block root with additional metadata required to form a DAG
|
|
81
109
|
* with vote weights and best blocks stored as metadata
|
|
110
|
+
*
|
|
111
|
+
* It is also used as ForkChoiceNode in fork choice spec
|
|
82
112
|
*/
|
|
83
113
|
export type ProtoNode = ProtoBlock & {
|
|
84
114
|
parent?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/protoArray/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAIhE,eAAO,MAAM,aAAa,uEAAuE,CAAC;AAElG;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/protoArray/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAIhE,eAAO,MAAM,aAAa,uEAAuE,CAAC;AAElG;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,gBAAgB,qBAAqB;CACtC;AAED;;;GAGG;AACH,oBAAY,aAAa;IACvB,OAAO,IAAI;IACX,KAAK,IAAI;IACT,IAAI,IAAI;CACT;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAEvD;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,EAAE,eAA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,UAAU,EAAE,OAAO,CAAC;IAEpB,0EAA0E;IAC1E,aAAa,EAAE,aAAa,CAAC;IAI7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IAIjC,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
|
@@ -7,11 +7,41 @@ export const HEX_ZERO_HASH = "0x000000000000000000000000000000000000000000000000
|
|
|
7
7
|
* The number of proto nodes will never exceed this value because it represents (0xffffffff / 365 / 24 / 60 / 5), ie > 1634 years of non-finalized network.
|
|
8
8
|
*/
|
|
9
9
|
export const NULL_VOTE_INDEX = 0xffffffff;
|
|
10
|
-
export
|
|
10
|
+
export { ExecutionStatus };
|
|
11
|
+
/**
|
|
12
|
+
* Execution status of a block in fork choice.
|
|
13
|
+
*
|
|
14
|
+
* - Valid: Execution payload verified as valid by the EL
|
|
15
|
+
* - Syncing: EL is syncing, payload validity unknown (optimistic sync)
|
|
16
|
+
* - PreMerge: Block is from before The Merge, no execution payload exists
|
|
17
|
+
* - Invalid: Execution payload was invalidated by the EL (post-import status)
|
|
18
|
+
* - PayloadSeparated: Gloas beacon block without embedded execution payload.
|
|
19
|
+
* The execution payload arrives separately via SignedExecutionPayloadEnvelope.
|
|
20
|
+
* Gloas blocks WITH execution payload (FULL variant) use Valid/Invalid/Syncing.
|
|
21
|
+
*/
|
|
22
|
+
var ExecutionStatus;
|
|
11
23
|
(function (ExecutionStatus) {
|
|
12
24
|
ExecutionStatus["Valid"] = "Valid";
|
|
13
25
|
ExecutionStatus["Syncing"] = "Syncing";
|
|
14
26
|
ExecutionStatus["PreMerge"] = "PreMerge";
|
|
15
27
|
ExecutionStatus["Invalid"] = "Invalid";
|
|
28
|
+
ExecutionStatus["PayloadSeparated"] = "PayloadSeparated";
|
|
16
29
|
})(ExecutionStatus || (ExecutionStatus = {}));
|
|
30
|
+
export { PayloadStatus };
|
|
31
|
+
/**
|
|
32
|
+
* Payload status for ePBS (Gloas fork)
|
|
33
|
+
* Spec: gloas/fork-choice.md#constants
|
|
34
|
+
*/
|
|
35
|
+
var PayloadStatus;
|
|
36
|
+
(function (PayloadStatus) {
|
|
37
|
+
PayloadStatus[PayloadStatus["PENDING"] = 0] = "PENDING";
|
|
38
|
+
PayloadStatus[PayloadStatus["EMPTY"] = 1] = "EMPTY";
|
|
39
|
+
PayloadStatus[PayloadStatus["FULL"] = 2] = "FULL";
|
|
40
|
+
})(PayloadStatus || (PayloadStatus = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Check if a block is in the Gloas fork (ePBS enabled)
|
|
43
|
+
*/
|
|
44
|
+
export function isGloasBlock(block) {
|
|
45
|
+
return block.parentBlockHash !== null;
|
|
46
|
+
}
|
|
17
47
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/protoArray/interface.ts"],"names":[],"mappings":"AAGA,oCAAoC;AACpC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,oEAAoE,CAAC;AAElG;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/protoArray/interface.ts"],"names":[],"mappings":"AAGA,oCAAoC;AACpC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,oEAAoE,CAAC;AAElG;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;SAkB9B,eAAe;AAX3B;;;;;;;;;;GAUG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,wDAAqC,CAAA;AAAC,CACxC,EANY,eAAe,KAAf,eAAe,QAM1B;SAMW,aAAa;AAJzB;;;GAGG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,mDAAS,CAAA;IACT,iDAAQ,CAAA;AAAC,CACX,EAJY,aAAa,KAAb,aAAa,QAIxB;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB,EAAW;IACvD,OAAO,KAAK,CAAC,eAAe,KAAK,IAAI,CAAC;AAAA,CACvC"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { Epoch, RootHex, Slot } from "@lodestar/types";
|
|
2
2
|
import { LVHExecError } from "./errors.js";
|
|
3
|
-
import { LVHExecResponse, ProtoBlock, ProtoNode } from "./interface.js";
|
|
3
|
+
import { LVHExecResponse, PayloadStatus, ProtoBlock, ProtoNode } from "./interface.js";
|
|
4
4
|
export declare const DEFAULT_PRUNE_THRESHOLD = 0;
|
|
5
5
|
type ProposerBoost = {
|
|
6
6
|
root: RootHex;
|
|
7
7
|
score: number;
|
|
8
8
|
};
|
|
9
|
+
/** Pre-Gloas: single element, FULL index (for backward compatibility) */
|
|
10
|
+
type PreGloasVariantIndex = number;
|
|
11
|
+
/**
|
|
12
|
+
* Post-Gloas: array length is 2 or 3
|
|
13
|
+
* - Length 2: [PENDING_INDEX, EMPTY_INDEX] when payload hasn't arrived yet
|
|
14
|
+
* - Length 3: [PENDING_INDEX, EMPTY_INDEX, FULL_INDEX] when payload has arrived
|
|
15
|
+
*/
|
|
16
|
+
type GloasVariantIndices = [number, number] | [number, number, number];
|
|
17
|
+
type VariantIndices = PreGloasVariantIndex | GloasVariantIndices;
|
|
9
18
|
export declare class ProtoArray {
|
|
10
19
|
pruneThreshold: number;
|
|
11
20
|
justifiedEpoch: Epoch;
|
|
@@ -13,10 +22,29 @@ export declare class ProtoArray {
|
|
|
13
22
|
finalizedEpoch: Epoch;
|
|
14
23
|
finalizedRoot: RootHex;
|
|
15
24
|
nodes: ProtoNode[];
|
|
16
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Maps block root to array of node indices for each payload status variant
|
|
27
|
+
*
|
|
28
|
+
* Array structure: [PENDING, EMPTY, FULL] where indices correspond to PayloadStatus enum values
|
|
29
|
+
* - number[0] = PENDING variant index (PayloadStatus.PENDING = 0)
|
|
30
|
+
* - number[1] = EMPTY variant index (PayloadStatus.EMPTY = 1)
|
|
31
|
+
* - number[2] = FULL variant index (PayloadStatus.FULL = 2)
|
|
32
|
+
*
|
|
33
|
+
* Note: undefined array elements indicate that variant doesn't exist for this block
|
|
34
|
+
*/
|
|
35
|
+
indices: Map<string, VariantIndices>;
|
|
17
36
|
lvhError?: LVHExecError;
|
|
18
37
|
private previousProposerBoost;
|
|
19
|
-
|
|
38
|
+
/**
|
|
39
|
+
* PTC (Payload Timeliness Committee) votes per block as bitvectors
|
|
40
|
+
* Maps block root to BitArray of PTC_SIZE bits (512 mainnet, 2 minimal)
|
|
41
|
+
* Spec: gloas/fork-choice.md#modified-store (line 148)
|
|
42
|
+
*
|
|
43
|
+
* Bit i is set if PTC member i voted payload_present=true
|
|
44
|
+
* Used by is_payload_timely() to determine if payload is timely
|
|
45
|
+
*/
|
|
46
|
+
private ptcVotes;
|
|
47
|
+
constructor({ pruneThreshold, justifiedEpoch, justifiedRoot, finalizedEpoch, finalizedRoot }: {
|
|
20
48
|
pruneThreshold: number;
|
|
21
49
|
justifiedEpoch: Epoch;
|
|
22
50
|
justifiedRoot: RootHex;
|
|
@@ -24,6 +52,60 @@ export declare class ProtoArray {
|
|
|
24
52
|
finalizedRoot: RootHex;
|
|
25
53
|
});
|
|
26
54
|
static initialize(block: Omit<ProtoBlock, "targetRoot">, currentSlot: Slot): ProtoArray;
|
|
55
|
+
/**
|
|
56
|
+
* Get node index for a block root and payload status
|
|
57
|
+
*
|
|
58
|
+
* @param root - The block root to look up
|
|
59
|
+
* @param payloadStatus - The specific payload status variant (PENDING/EMPTY/FULL)
|
|
60
|
+
* @returns The node index for the specified variant, or undefined if not found
|
|
61
|
+
*
|
|
62
|
+
* Behavior:
|
|
63
|
+
* - Pre-Gloas blocks: only FULL is valid, PENDING/EMPTY throw error
|
|
64
|
+
* - Gloas blocks: returns the specified variant index, or undefined if that variant doesn't exist
|
|
65
|
+
*
|
|
66
|
+
* Note: payloadStatus is required. Use getDefaultVariant() to get the canonical variant.
|
|
67
|
+
*/
|
|
68
|
+
getNodeIndexByRootAndStatus(root: RootHex, payloadStatus: PayloadStatus): number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Get the default/canonical payload status for a block root
|
|
71
|
+
* - Pre-Gloas blocks: Returns FULL (payload embedded in block)
|
|
72
|
+
* - Gloas blocks: Returns PENDING (canonical variant)
|
|
73
|
+
*
|
|
74
|
+
* @param blockRoot - The block root to check
|
|
75
|
+
* @returns PayloadStatus.FULL for pre-Gloas, PayloadStatus.PENDING for Gloas, undefined if block not found
|
|
76
|
+
*/
|
|
77
|
+
getDefaultVariant(blockRoot: RootHex): PayloadStatus | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Get the node index for the default/canonical variant in a single hash lookup.
|
|
80
|
+
* - Pre-Gloas blocks: returns the FULL variant index
|
|
81
|
+
* - Gloas blocks: returns the PENDING variant index
|
|
82
|
+
*/
|
|
83
|
+
getDefaultNodeIndex(blockRoot: RootHex): number | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Determine which parent payload status a block extends
|
|
86
|
+
* Spec: gloas/fork-choice.md#new-get_parent_payload_status
|
|
87
|
+
* def get_parent_payload_status(store: Store, block: BeaconBlock) -> PayloadStatus:
|
|
88
|
+
* parent = store.blocks[block.parent_root]
|
|
89
|
+
* parent_block_hash = block.body.signed_execution_payload_bid.message.parent_block_hash
|
|
90
|
+
* message_block_hash = parent.body.signed_execution_payload_bid.message.block_hash
|
|
91
|
+
* return PAYLOAD_STATUS_FULL if parent_block_hash == message_block_hash else PAYLOAD_STATUS_EMPTY
|
|
92
|
+
*
|
|
93
|
+
* In lodestar forkchoice, we don't store the full bid, so we compares parent_block_hash in child's bid with executionPayloadBlockHash in parent:
|
|
94
|
+
* - If it matches EMPTY variant, return EMPTY
|
|
95
|
+
* - If it matches FULL variant, return FULL
|
|
96
|
+
* - If no match, throw UNKNOWN_PARENT_BLOCK error
|
|
97
|
+
*
|
|
98
|
+
* For pre-Gloas blocks: always returns FULL
|
|
99
|
+
*/
|
|
100
|
+
getParentPayloadStatus(block: ProtoBlock): PayloadStatus;
|
|
101
|
+
/**
|
|
102
|
+
* Return the parent `ProtoBlock` given its root and block hash.
|
|
103
|
+
*/
|
|
104
|
+
getParent(parentRoot: RootHex, parentBlockHash: RootHex | null): ProtoBlock | null;
|
|
105
|
+
/**
|
|
106
|
+
* Returns an EMPTY or FULL `ProtoBlock` that has matching block root and block hash
|
|
107
|
+
*/
|
|
108
|
+
getBlockHexAndBlockHash(blockRoot: RootHex, blockHash: RootHex): ProtoBlock | null;
|
|
27
109
|
/**
|
|
28
110
|
* Iterate backwards through the array, touching all nodes and their parents and potentially
|
|
29
111
|
* the best-child of each parent.
|
|
@@ -39,7 +121,7 @@ export declare class ProtoArray {
|
|
|
39
121
|
* should become the best child.
|
|
40
122
|
* - If required, update the parents best-descendant with the current node or its best-descendant.
|
|
41
123
|
*/
|
|
42
|
-
applyScoreChanges({ deltas, proposerBoost, justifiedEpoch, justifiedRoot, finalizedEpoch, finalizedRoot, currentSlot
|
|
124
|
+
applyScoreChanges({ deltas, proposerBoost, justifiedEpoch, justifiedRoot, finalizedEpoch, finalizedRoot, currentSlot }: {
|
|
43
125
|
deltas: number[];
|
|
44
126
|
proposerBoost: ProposerBoost | null;
|
|
45
127
|
justifiedEpoch: Epoch;
|
|
@@ -53,7 +135,57 @@ export declare class ProtoArray {
|
|
|
53
135
|
*
|
|
54
136
|
* It is only sane to supply an undefined parent for the genesis block
|
|
55
137
|
*/
|
|
56
|
-
onBlock(block: ProtoBlock, currentSlot: Slot): void;
|
|
138
|
+
onBlock(block: ProtoBlock, currentSlot: Slot, proposerBoostRoot: RootHex | null): void;
|
|
139
|
+
/**
|
|
140
|
+
* Called when an execution payload is received for a block (Gloas only)
|
|
141
|
+
* Creates a FULL variant node as a sibling to the existing EMPTY variant
|
|
142
|
+
* Both EMPTY and FULL have parent = own PENDING node
|
|
143
|
+
*
|
|
144
|
+
* Spec: gloas/fork-choice.md (on_execution_payload event)
|
|
145
|
+
*/
|
|
146
|
+
onExecutionPayload(blockRoot: RootHex, currentSlot: Slot, executionPayloadBlockHash: RootHex, executionPayloadNumber: number, executionPayloadStateRoot: RootHex, proposerBoostRoot: RootHex | null): void;
|
|
147
|
+
/**
|
|
148
|
+
* Update PTC votes for multiple validators attesting to a block
|
|
149
|
+
* Spec: gloas/fork-choice.md#new-on_payload_attestation_message
|
|
150
|
+
*
|
|
151
|
+
* @param blockRoot - The beacon block root being attested
|
|
152
|
+
* @param ptcIndices - Array of PTC committee indices that voted (0..PTC_SIZE-1)
|
|
153
|
+
* @param payloadPresent - Whether the validators attest the payload is present
|
|
154
|
+
*/
|
|
155
|
+
notifyPtcMessages(blockRoot: RootHex, ptcIndices: number[], payloadPresent: boolean): void;
|
|
156
|
+
/**
|
|
157
|
+
* Check if execution payload for a block is timely
|
|
158
|
+
* Spec: gloas/fork-choice.md#new-is_payload_timely
|
|
159
|
+
*
|
|
160
|
+
* Returns true if:
|
|
161
|
+
* 1. Block has PTC votes tracked
|
|
162
|
+
* 2. Payload is locally available (FULL variant exists in proto array)
|
|
163
|
+
* 3. More than PAYLOAD_TIMELY_THRESHOLD (>50% of PTC) members voted payload_present=true
|
|
164
|
+
*
|
|
165
|
+
* @param blockRoot - The beacon block root to check
|
|
166
|
+
*/
|
|
167
|
+
isPayloadTimely(blockRoot: RootHex): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Check if parent node is FULL
|
|
170
|
+
* Spec: gloas/fork-choice.md#new-is_parent_node_full
|
|
171
|
+
*
|
|
172
|
+
* Returns true if the parent payload status (determined by block.parentBlockHash) is FULL
|
|
173
|
+
*/
|
|
174
|
+
isParentNodeFull(block: ProtoBlock): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Determine if we should extend the payload (prefer FULL over EMPTY)
|
|
177
|
+
* Spec: gloas/fork-choice.md#new-should_extend_payload
|
|
178
|
+
*
|
|
179
|
+
* Returns true if:
|
|
180
|
+
* 1. Payload is timely, OR
|
|
181
|
+
* 2. No proposer boost root (empty/zero hash), OR
|
|
182
|
+
* 3. Proposer boost root's parent is not this block, OR
|
|
183
|
+
* 4. Proposer boost root extends FULL parent
|
|
184
|
+
*
|
|
185
|
+
* @param blockRoot - The block root to check
|
|
186
|
+
* @param proposerBoostRoot - Current proposer boost root (from ForkChoice)
|
|
187
|
+
*/
|
|
188
|
+
shouldExtendPayload(blockRoot: RootHex, proposerBoostRoot: RootHex | null): boolean;
|
|
57
189
|
/**
|
|
58
190
|
* Optimistic sync validate till validated latest hash, invalidate any descendant branch
|
|
59
191
|
* if invalidate till hash provided. If consensus fails, this will invalidate entire
|
|
@@ -74,10 +206,25 @@ export declare class ProtoArray {
|
|
|
74
206
|
private getNodeIndexFromLVH;
|
|
75
207
|
private invalidateNodeByIndex;
|
|
76
208
|
private validateNodeByIndex;
|
|
209
|
+
/**
|
|
210
|
+
* Get payload status tiebreaker for fork choice comparison
|
|
211
|
+
* Spec: gloas/fork-choice.md#new-get_payload_status_tiebreaker
|
|
212
|
+
*
|
|
213
|
+
* For PENDING nodes: always returns 0
|
|
214
|
+
* For EMPTY/FULL variants from slot n-1: implements tiebreaker logic based on should_extend_payload
|
|
215
|
+
* For older blocks: returns node.payloadStatus
|
|
216
|
+
*
|
|
217
|
+
* Note: pre-gloas logic won't reach here. Pre-Gloas blocks have different roots, so they are always resolved by the weight and root tiebreaker before reaching here.
|
|
218
|
+
*/
|
|
219
|
+
private getPayloadStatusTiebreaker;
|
|
77
220
|
/**
|
|
78
221
|
* Follows the best-descendant links to find the best-block (i.e., head-block).
|
|
222
|
+
*
|
|
223
|
+
* Returns the ProtoNode representing the head.
|
|
224
|
+
* For pre-Gloas forks, only FULL variants exist (payload embedded).
|
|
225
|
+
* For Gloas, may return PENDING/EMPTY/FULL variants.
|
|
79
226
|
*/
|
|
80
|
-
findHead(justifiedRoot: RootHex, currentSlot: Slot):
|
|
227
|
+
findHead(justifiedRoot: RootHex, currentSlot: Slot): ProtoNode;
|
|
81
228
|
/**
|
|
82
229
|
* Update the tree with new finalization information. The tree is only actually pruned if both
|
|
83
230
|
* of the two following criteria are met:
|
|
@@ -108,7 +255,7 @@ export declare class ProtoArray {
|
|
|
108
255
|
* - The child is not the best child but becomes the best child.
|
|
109
256
|
* - The child is not the best child and does not become the best child.
|
|
110
257
|
*/
|
|
111
|
-
maybeUpdateBestChildAndDescendant(parentIndex: number, childIndex: number, currentSlot: Slot): void;
|
|
258
|
+
maybeUpdateBestChildAndDescendant(parentIndex: number, childIndex: number, currentSlot: Slot, proposerBoostRoot: RootHex | null): void;
|
|
112
259
|
/**
|
|
113
260
|
* Indicates if the node itself is viable for the head, or if it's best descendant is viable
|
|
114
261
|
* for the head.
|
|
@@ -132,57 +279,111 @@ export declare class ProtoArray {
|
|
|
132
279
|
/**
|
|
133
280
|
* Same to getAncestor but it may return null instead of throwing error
|
|
134
281
|
*/
|
|
135
|
-
getAncestorOrNull(blockRoot: RootHex, ancestorSlot: Slot):
|
|
282
|
+
getAncestorOrNull(blockRoot: RootHex, ancestorSlot: Slot): ProtoNode | null;
|
|
136
283
|
/**
|
|
137
|
-
* Returns the
|
|
284
|
+
* Returns the node identifier of an ancestor of `blockRoot` at the given `slot`.
|
|
138
285
|
* (Note: `slot` refers to the block that is *returned*, not the one that is supplied.)
|
|
139
286
|
*
|
|
140
287
|
* NOTE: May be expensive: potentially walks through the entire fork of head to finalized block
|
|
141
288
|
*
|
|
142
289
|
* ### Specification
|
|
143
290
|
*
|
|
144
|
-
*
|
|
291
|
+
* Modified for Gloas to return node identifier instead of just root:
|
|
292
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/fork-choice.md#modified-get_ancestor
|
|
145
293
|
*
|
|
146
|
-
*
|
|
294
|
+
* Pre-Gloas: Returns (root, PAYLOAD_STATUS_FULL)
|
|
295
|
+
* Gloas: Returns (root, payloadStatus) based on actual node state
|
|
147
296
|
*/
|
|
148
|
-
getAncestor(blockRoot: RootHex, ancestorSlot: Slot):
|
|
297
|
+
getAncestor(blockRoot: RootHex, ancestorSlot: Slot): ProtoNode;
|
|
149
298
|
/**
|
|
150
|
-
*
|
|
299
|
+
* Get the parent node index for traversal
|
|
300
|
+
* For Gloas blocks: returns the correct EMPTY/FULL variant based on parent payload status
|
|
301
|
+
* For pre-Gloas blocks: returns the simple parent index
|
|
302
|
+
* Returns undefined if parent doesn't exist or can't be found
|
|
151
303
|
*/
|
|
152
|
-
|
|
304
|
+
private getParentNodeIndex;
|
|
153
305
|
/**
|
|
154
306
|
* Iterate from a block root backwards over nodes
|
|
307
|
+
* For Gloas blocks: returns EMPTY/FULL variants (not PENDING) based on parent payload status
|
|
308
|
+
* For pre-Gloas blocks: returns FULL variants
|
|
309
|
+
*/
|
|
310
|
+
iterateAncestorNodes(blockRoot: RootHex, payloadStatus: PayloadStatus): IterableIterator<ProtoNode>;
|
|
311
|
+
/**
|
|
312
|
+
* Iterate from a node backwards over ancestor nodes
|
|
313
|
+
* For Gloas blocks: returns EMPTY/FULL variants (not PENDING) based on parent payload status
|
|
314
|
+
* For pre-Gloas blocks: returns FULL variants
|
|
315
|
+
* Handles fork transition from Gloas to pre-Gloas blocks
|
|
155
316
|
*/
|
|
156
317
|
iterateAncestorNodesFromNode(node: ProtoNode): IterableIterator<ProtoNode>;
|
|
157
318
|
/**
|
|
158
319
|
* Get all nodes from a block root backwards
|
|
320
|
+
* For Gloas blocks: returns EMPTY/FULL variants (not PENDING) based on parent payload status
|
|
321
|
+
* For pre-Gloas blocks: returns FULL variants
|
|
159
322
|
*/
|
|
160
|
-
getAllAncestorNodes(blockRoot: RootHex): ProtoNode[];
|
|
323
|
+
getAllAncestorNodes(blockRoot: RootHex, payloadStatus: PayloadStatus): ProtoNode[];
|
|
161
324
|
/**
|
|
162
325
|
* The opposite of iterateNodes.
|
|
163
326
|
* iterateNodes is to find ancestor nodes of a blockRoot.
|
|
164
327
|
* this is to find non-ancestor nodes of a blockRoot.
|
|
328
|
+
*
|
|
329
|
+
* For Gloas blocks: returns EMPTY/FULL variants (not PENDING) based on parent payload status
|
|
330
|
+
* For pre-Gloas blocks: returns FULL variants
|
|
165
331
|
*/
|
|
166
|
-
getAllNonAncestorNodes(blockRoot: RootHex): ProtoNode[];
|
|
332
|
+
getAllNonAncestorNodes(blockRoot: RootHex, payloadStatus: PayloadStatus): ProtoNode[];
|
|
167
333
|
/**
|
|
168
334
|
* Returns both ancestor and non-ancestor nodes in a single traversal.
|
|
335
|
+
* For Gloas blocks: returns EMPTY/FULL variants (not PENDING) based on parent payload status
|
|
336
|
+
* For pre-Gloas blocks: returns FULL variants
|
|
169
337
|
*/
|
|
170
|
-
getAllAncestorAndNonAncestorNodes(blockRoot: RootHex): {
|
|
338
|
+
getAllAncestorAndNonAncestorNodes(blockRoot: RootHex, payloadStatus: PayloadStatus): {
|
|
171
339
|
ancestors: ProtoNode[];
|
|
172
340
|
nonAncestors: ProtoNode[];
|
|
173
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* Check if a block exists in the proto array
|
|
344
|
+
* Uses default variant (PENDING for Gloas, FULL for pre-Gloas)
|
|
345
|
+
*/
|
|
174
346
|
hasBlock(blockRoot: RootHex): boolean;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Return ProtoNode for blockRoot with explicit payload status
|
|
349
|
+
*
|
|
350
|
+
* @param blockRoot - The block root to look up
|
|
351
|
+
* @param payloadStatus - The specific payload status variant (PENDING/EMPTY/FULL)
|
|
352
|
+
* @returns The ProtoNode for the specified variant, or undefined if not found
|
|
353
|
+
*
|
|
354
|
+
* Note: Callers must explicitly specify which variant they need.
|
|
355
|
+
* Use getDefaultVariant() to get the canonical variant for a block.
|
|
356
|
+
*/
|
|
357
|
+
getNode(blockRoot: RootHex, payloadStatus: PayloadStatus): ProtoNode | undefined;
|
|
358
|
+
/**
|
|
359
|
+
* Return MUTABLE ProtoBlock for blockRoot with explicit payload status
|
|
360
|
+
*
|
|
361
|
+
* @param blockRoot - The block root to look up
|
|
362
|
+
* @param payloadStatus - The specific payload status variant (PENDING/EMPTY/FULL)
|
|
363
|
+
* @returns The ProtoBlock for the specified variant (spreads properties), or undefined if not found
|
|
364
|
+
*
|
|
365
|
+
* Note: Callers must explicitly specify which variant they need.
|
|
366
|
+
* Use getDefaultVariant() to get the canonical variant for a block.
|
|
367
|
+
*/
|
|
368
|
+
getBlock(blockRoot: RootHex, payloadStatus: PayloadStatus): ProtoBlock | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* Return NON-MUTABLE ProtoBlock for blockRoot with explicit payload status
|
|
371
|
+
*
|
|
372
|
+
* @param blockRoot - The block root to look up
|
|
373
|
+
* @param payloadStatus - The specific payload status variant (PENDING/EMPTY/FULL)
|
|
374
|
+
* @returns The ProtoBlock for the specified variant (does not spread properties)
|
|
375
|
+
* @throws Error if block not found
|
|
376
|
+
*
|
|
377
|
+
* Note: Callers must explicitly specify which variant they need.
|
|
378
|
+
* Use getDefaultVariant() to get the canonical variant for a block.
|
|
379
|
+
*/
|
|
380
|
+
getBlockReadonly(blockRoot: RootHex, payloadStatus: PayloadStatus): ProtoBlock;
|
|
180
381
|
/**
|
|
181
382
|
* Returns `true` if the `descendantRoot` has an ancestor with `ancestorRoot`.
|
|
182
383
|
* Always returns `false` if either input roots are unknown.
|
|
183
|
-
* Still returns `true` if `ancestorRoot` === `descendantRoot`
|
|
384
|
+
* Still returns `true` if `ancestorRoot` === `descendantRoot` and payload statuses match.
|
|
184
385
|
*/
|
|
185
|
-
isDescendant(ancestorRoot: RootHex, descendantRoot: RootHex): boolean;
|
|
386
|
+
isDescendant(ancestorRoot: RootHex, ancestorPayloadStatus: PayloadStatus, descendantRoot: RootHex, descendantPayloadStatus: PayloadStatus): boolean;
|
|
186
387
|
/**
|
|
187
388
|
* Returns a common ancestor for nodeA or nodeB or null if there's none
|
|
188
389
|
*/
|