@lodestar/fork-choice 1.45.0-dev.d7859e978b → 1.45.0-dev.e10fb5e991
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/fastConfirmation/data.d.ts.map +1 -1
- package/lib/forkChoice/fastConfirmation/data.js +1 -0
- package/lib/forkChoice/fastConfirmation/data.js.map +1 -1
- package/lib/forkChoice/fastConfirmation/types.d.ts +3 -0
- package/lib/forkChoice/fastConfirmation/types.d.ts.map +1 -1
- package/lib/forkChoice/fastConfirmation/types.js.map +1 -1
- package/lib/forkChoice/fastConfirmation/utils.d.ts +3 -3
- package/lib/forkChoice/fastConfirmation/utils.d.ts.map +1 -1
- package/lib/forkChoice/fastConfirmation/utils.js +27 -19
- package/lib/forkChoice/fastConfirmation/utils.js.map +1 -1
- package/lib/forkChoice/forkChoice.d.ts.map +1 -1
- package/lib/forkChoice/forkChoice.js +39 -29
- package/lib/forkChoice/forkChoice.js.map +1 -1
- package/lib/forkChoice/interface.d.ts +4 -4
- package/lib/forkChoice/interface.d.ts.map +1 -1
- package/lib/forkChoice/interface.js +1 -1
- package/lib/forkChoice/interface.js.map +1 -1
- package/lib/protoArray/computeDeltas.d.ts.map +1 -1
- package/lib/protoArray/computeDeltas.js +19 -15
- package/lib/protoArray/computeDeltas.js.map +1 -1
- package/lib/protoArray/protoArray.d.ts +6 -1
- package/lib/protoArray/protoArray.d.ts.map +1 -1
- package/lib/protoArray/protoArray.js +13 -5
- package/lib/protoArray/protoArray.js.map +1 -1
- package/package.json +7 -7
- package/src/forkChoice/fastConfirmation/data.ts +1 -0
- package/src/forkChoice/fastConfirmation/types.ts +4 -0
- package/src/forkChoice/fastConfirmation/utils.ts +39 -16
- package/src/forkChoice/forkChoice.ts +50 -41
- package/src/forkChoice/interface.ts +4 -4
- package/src/protoArray/computeDeltas.ts +21 -17
- package/src/protoArray/protoArray.ts +15 -5
|
@@ -1584,7 +1584,7 @@ export class ProtoArray {
|
|
|
1584
1584
|
* ### Specification
|
|
1585
1585
|
*
|
|
1586
1586
|
* Modified for Gloas to return node identifier instead of just root:
|
|
1587
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.
|
|
1587
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/fork-choice.md#modified-get_ancestor
|
|
1588
1588
|
*
|
|
1589
1589
|
* Pre-Gloas: Returns (root, PAYLOAD_STATUS_FULL)
|
|
1590
1590
|
* Gloas: Returns (root, payloadStatus) based on actual node state
|
|
@@ -1941,6 +1941,11 @@ export class ProtoArray {
|
|
|
1941
1941
|
* Returns `true` if the `descendantRoot` has an ancestor with `ancestorRoot`.
|
|
1942
1942
|
* Always returns `false` if either input roots are unknown.
|
|
1943
1943
|
* Still returns `true` if `ancestorRoot` === `descendantRoot` and payload statuses match.
|
|
1944
|
+
*
|
|
1945
|
+
* Gloas payload-status matching: a `PENDING` ancestor matches any payload variant
|
|
1946
|
+
* (PENDING/EMPTY/FULL) of the same block, so this can also return `true` for the same
|
|
1947
|
+
* root when statuses differ (e.g. ancestor `PENDING`, descendant `EMPTY`/`FULL`).
|
|
1948
|
+
* `EMPTY` and `FULL` are mutually exclusive siblings and never match each other.
|
|
1944
1949
|
*/
|
|
1945
1950
|
isDescendant(
|
|
1946
1951
|
ancestorRoot: RootHex,
|
|
@@ -1958,11 +1963,16 @@ export class ProtoArray {
|
|
|
1958
1963
|
}
|
|
1959
1964
|
|
|
1960
1965
|
for (const node of this.iterateAncestorNodes(descendantRoot, descendantPayloadStatus)) {
|
|
1961
|
-
if (node.
|
|
1962
|
-
|
|
1966
|
+
if (node.blockRoot === ancestorNode.blockRoot) {
|
|
1967
|
+
// Gloas is_ancestor: a PENDING ancestor matches any payload variant of the same block.
|
|
1968
|
+
return (
|
|
1969
|
+
node.payloadStatus === ancestorNode.payloadStatus || ancestorNode.payloadStatus === PayloadStatus.PENDING
|
|
1970
|
+
);
|
|
1963
1971
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1972
|
+
// Ancestors are iterated in decreasing slot, so once we reach the ancestor's slot
|
|
1973
|
+
// without a root match it cannot be in this chain.
|
|
1974
|
+
if (node.slot <= ancestorNode.slot) {
|
|
1975
|
+
return false;
|
|
1966
1976
|
}
|
|
1967
1977
|
}
|
|
1968
1978
|
return false;
|