@lodestar/fork-choice 1.51.0-dev.32db66b396 → 1.51.0-dev.3c46867203

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/src/metrics.ts CHANGED
@@ -19,6 +19,10 @@ export function getForkChoiceMetrics(register: MetricsRegisterExtra) {
19
19
  name: "beacon_fork_choice_requests_total",
20
20
  help: "Count of occasions where fork choice has tried to find a head",
21
21
  }),
22
+ unsatisfiedInclusionListBlocks: register.gauge({
23
+ name: "beacon_fork_choice_unsatisfied_inclusion_list_blocks_total",
24
+ help: "Count of payloads not extended because they did not satisfy the inclusion list constraints",
25
+ }),
22
26
  errors: register.gauge<{entrypoint: UpdateHeadOpt}>({
23
27
  name: "beacon_fork_choice_errors_total",
24
28
  help: "Count of occasions where fork choice has returned an error when trying to find a head",
@@ -122,6 +122,11 @@ export class ProtoArray {
122
122
  * when called with the negative parameter value.
123
123
  */
124
124
  private ptcAttested = new Map<RootHex, BitArray>();
125
+ /**
126
+ * Execution engine inclusion list verdict per block, recorded on payload import from heze.
127
+ * Spec: heze/fork-choice.md#modified-store (payload_inclusion_list_satisfaction)
128
+ */
129
+ private payloadInclusionListSatisfaction = new Map<RootHex, boolean>();
125
130
 
126
131
  constructor({
127
132
  pruneThreshold,
@@ -938,6 +943,27 @@ export class ProtoArray {
938
943
  return this.getParentPayloadStatus(block) === PayloadStatus.FULL;
939
944
  }
940
945
 
946
+ /** Spec: heze/fork-choice.md#new-record_payload_inclusion_list_satisfaction. Returns whether the verdict changed */
947
+ recordPayloadInclusionListSatisfaction(blockRoot: RootHex, satisfied: boolean): boolean {
948
+ const previous = this.payloadInclusionListSatisfaction.get(blockRoot);
949
+ this.payloadInclusionListSatisfaction.set(blockRoot, satisfied);
950
+ return previous !== satisfied;
951
+ }
952
+
953
+ /**
954
+ * Spec: heze/fork-choice.md#new-is_payload_inclusion_list_satisfied
955
+ *
956
+ * False until the payload is delivered. A delivered payload without a verdict is pre-heze, where
957
+ * no inclusion list constraints apply.
958
+ */
959
+ isPayloadInclusionListSatisfied(blockRoot: RootHex): boolean {
960
+ return this.hasPayload(blockRoot) && this.payloadInclusionListSatisfaction.get(blockRoot) !== false;
961
+ }
962
+
963
+ getPayloadInclusionListSatisfaction(blockRoot: RootHex): boolean | null {
964
+ return this.payloadInclusionListSatisfaction.get(blockRoot) ?? null;
965
+ }
966
+
941
967
  /**
942
968
  * Determine if we should extend the payload (prefer FULL over EMPTY)
943
969
  * Spec: gloas/fork-choice.md#new-should_extend_payload
@@ -956,6 +982,10 @@ export class ProtoArray {
956
982
  return false;
957
983
  }
958
984
 
985
+ if (this.payloadInclusionListSatisfaction.get(blockRoot) === false) {
986
+ return false;
987
+ }
988
+
959
989
  // Condition 1: Payload is timely AND data is available
960
990
  if (this.isPayloadTimely(blockRoot) && this.isPayloadDataAvailable(blockRoot)) {
961
991
  return true;
@@ -1399,6 +1429,7 @@ export class ProtoArray {
1399
1429
  this.payloadTimelinessVotes.delete(root);
1400
1430
  this.ptcAttested.delete(root);
1401
1431
  this.payloadDataAvailabilityVotes.delete(root);
1432
+ this.payloadInclusionListSatisfaction.delete(root);
1402
1433
  }
1403
1434
 
1404
1435
  // Store nodes prior to finalization