@lodestar/beacon-node 1.48.0-dev.b24dce51bf → 1.48.0-dev.b4a608e68f

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.
Files changed (96) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +0 -7
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/state/utils.js +14 -0
  6. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  7. package/lib/api/impl/config/index.d.ts.map +1 -1
  8. package/lib/api/impl/config/index.js +4 -1
  9. package/lib/api/impl/config/index.js.map +1 -1
  10. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  11. package/lib/chain/archiveStore/archiveStore.js +4 -1
  12. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  13. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +9 -1
  14. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  15. package/lib/chain/archiveStore/utils/archiveBlocks.js +37 -4
  16. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  17. package/lib/chain/blocks/importBlock.d.ts +5 -1
  18. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  19. package/lib/chain/blocks/importBlock.js +12 -5
  20. package/lib/chain/blocks/importBlock.js.map +1 -1
  21. package/lib/chain/blocks/index.d.ts +8 -4
  22. package/lib/chain/blocks/index.d.ts.map +1 -1
  23. package/lib/chain/blocks/index.js +80 -15
  24. package/lib/chain/blocks/index.js.map +1 -1
  25. package/lib/chain/blocks/types.d.ts +8 -0
  26. package/lib/chain/blocks/types.d.ts.map +1 -1
  27. package/lib/chain/blocks/types.js.map +1 -1
  28. package/lib/chain/blocks/utils/chainSegment.d.ts +1 -1
  29. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  30. package/lib/chain/blocks/utils/chainSegment.js +26 -11
  31. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  32. package/lib/chain/chain.d.ts +2 -2
  33. package/lib/chain/chain.d.ts.map +1 -1
  34. package/lib/chain/chain.js +2 -2
  35. package/lib/chain/chain.js.map +1 -1
  36. package/lib/chain/errors/executionPayloadBid.d.ts +4 -0
  37. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  38. package/lib/chain/errors/executionPayloadBid.js +1 -0
  39. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  40. package/lib/chain/errors/gossipValidation.d.ts +2 -1
  41. package/lib/chain/errors/gossipValidation.d.ts.map +1 -1
  42. package/lib/chain/errors/gossipValidation.js +1 -0
  43. package/lib/chain/errors/gossipValidation.js.map +1 -1
  44. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  45. package/lib/chain/forkChoice/index.js +2 -0
  46. package/lib/chain/forkChoice/index.js.map +1 -1
  47. package/lib/chain/interface.d.ts +2 -2
  48. package/lib/chain/interface.d.ts.map +1 -1
  49. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  50. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  51. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  52. package/lib/chain/validation/executionPayloadBid.js +16 -0
  53. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  54. package/lib/chain/validatorMonitor.d.ts +7 -1
  55. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  56. package/lib/chain/validatorMonitor.js +22 -5
  57. package/lib/chain/validatorMonitor.js.map +1 -1
  58. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  59. package/lib/execution/builder/validateBid.js +3 -0
  60. package/lib/execution/builder/validateBid.js.map +1 -1
  61. package/lib/metrics/metrics/lodestar.d.ts +4 -3
  62. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  63. package/lib/metrics/metrics/lodestar.js +5 -5
  64. package/lib/metrics/metrics/lodestar.js.map +1 -1
  65. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  66. package/lib/network/processor/gossipHandlers.js +378 -278
  67. package/lib/network/processor/gossipHandlers.js.map +1 -1
  68. package/lib/network/processor/index.d.ts.map +1 -1
  69. package/lib/network/processor/index.js +22 -16
  70. package/lib/network/processor/index.js.map +1 -1
  71. package/lib/sync/range/range.d.ts.map +1 -1
  72. package/lib/sync/range/range.js +24 -1
  73. package/lib/sync/range/range.js.map +1 -1
  74. package/package.json +14 -14
  75. package/src/api/impl/beacon/blocks/index.ts +0 -10
  76. package/src/api/impl/beacon/state/utils.ts +15 -0
  77. package/src/api/impl/config/index.ts +4 -1
  78. package/src/chain/archiveStore/archiveStore.ts +6 -0
  79. package/src/chain/archiveStore/utils/archiveBlocks.ts +39 -3
  80. package/src/chain/blocks/importBlock.ts +25 -7
  81. package/src/chain/blocks/index.ts +107 -21
  82. package/src/chain/blocks/types.ts +9 -0
  83. package/src/chain/blocks/utils/chainSegment.ts +26 -12
  84. package/src/chain/chain.ts +4 -4
  85. package/src/chain/errors/executionPayloadBid.ts +2 -0
  86. package/src/chain/errors/gossipValidation.ts +1 -0
  87. package/src/chain/forkChoice/index.ts +2 -0
  88. package/src/chain/interface.ts +2 -2
  89. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  90. package/src/chain/validation/executionPayloadBid.ts +18 -0
  91. package/src/chain/validatorMonitor.ts +24 -7
  92. package/src/execution/builder/validateBid.ts +4 -0
  93. package/src/metrics/metrics/lodestar.ts +6 -5
  94. package/src/network/processor/gossipHandlers.ts +487 -348
  95. package/src/network/processor/index.ts +24 -17
  96. package/src/sync/range/range.ts +23 -1
@@ -1,5 +1,5 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
- import {MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params";
2
+ import {MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
3
3
  import {
4
4
  IBeaconStateView,
5
5
  ParticipationFlags,
@@ -1117,7 +1117,11 @@ function isCanonical(rootCache: RootHexCache, block: AttestationBlockInclusion):
1117
1117
 
1118
1118
  /** Returns true if root at slot is the same at slot - 1 == there was no new block at slot */
1119
1119
  function isMissedSlot(rootCache: RootHexCache, slot: Slot): boolean {
1120
- return slot > 0 && rootCache.getBlockRootAtSlot(slot) === rootCache.getBlockRootAtSlot(slot - 1);
1120
+ if (slot <= 0) {
1121
+ return false;
1122
+ }
1123
+ const root = rootCache.getBlockRootAtSlot(slot);
1124
+ return root !== null && root === rootCache.getBlockRootAtSlot(slot - 1);
1121
1125
  }
1122
1126
 
1123
1127
  function renderBlockProposalSummary(
@@ -1131,7 +1135,11 @@ function renderBlockProposalSummary(
1131
1135
  return "not_submitted";
1132
1136
  }
1133
1137
 
1134
- if (rootCache.getBlockRootAtSlot(proposalSlot) === proposal.blockRoot) {
1138
+ const canonicalRoot = rootCache.getBlockRootAtSlot(proposalSlot);
1139
+ if (canonicalRoot === null) {
1140
+ return "unknown";
1141
+ }
1142
+ if (canonicalRoot === proposal.blockRoot) {
1135
1143
  // Canonical state includes our block
1136
1144
  return "canonical";
1137
1145
  }
@@ -1157,14 +1165,23 @@ function renderBlockProposalSummary(
1157
1165
  * In normal network conditions the same root is read multiple times, specially the target.
1158
1166
  */
1159
1167
  export class RootHexCache {
1160
- private readonly blockRootSlotCache = new Map<Slot, RootHex>();
1168
+ private readonly blockRootSlotCache = new Map<Slot, RootHex | null>();
1161
1169
 
1162
1170
  constructor(private readonly state: IBeaconStateView) {}
1163
1171
 
1164
- getBlockRootAtSlot(slot: Slot): RootHex {
1172
+ /**
1173
+ * Block root at `slot`, null if the state does not cover it: slots at or after the state's own slot (an inclusion
1174
+ * in a block the head state does not know yet, e.g. an orphaned block, or the slot after the last attestation of
1175
+ * the epoch) or slots older than `SLOTS_PER_HISTORICAL_ROOT`. Callers treat null as unknown instead of throwing
1176
+ * and aborting the summaries of all remaining validators.
1177
+ */
1178
+ getBlockRootAtSlot(slot: Slot): RootHex | null {
1165
1179
  let root = this.blockRootSlotCache.get(slot);
1166
- if (!root) {
1167
- root = toRootHex(this.state.getBlockRootAtSlot(slot));
1180
+ if (root === undefined) {
1181
+ root =
1182
+ slot < this.state.slot && slot >= this.state.slot - SLOTS_PER_HISTORICAL_ROOT
1183
+ ? toRootHex(this.state.getBlockRootAtSlot(slot))
1184
+ : null;
1168
1185
  this.blockRootSlotCache.set(slot, root);
1169
1186
  }
1170
1187
  return root;
@@ -56,6 +56,10 @@ export async function validateBuilderApiExecutionPayloadBid(
56
56
  );
57
57
  }
58
58
 
59
+ if (byteArrayEquals(bid.blockHash, bid.parentBlockHash)) {
60
+ throw Error(`Bid block hash ${toRootHex(bid.blockHash)} must not equal its parent block hash`);
61
+ }
62
+
59
63
  const blobKzgCommitmentsLen = bid.blobKzgCommitments.length;
60
64
  const maxBlobsPerBlock = chain.config.getMaxBlobsPerBlock(computeEpochAtSlot(bid.slot));
61
65
  if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
@@ -2,6 +2,7 @@
2
2
  import {NotReorgedReason} from "@lodestar/fork-choice";
3
3
  import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
4
4
  import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
5
+ import type {LateCanonicalBlockReason} from "../../chain/archiveStore/utils/archiveBlocks.js";
5
6
  import {BlockInputSource} from "../../chain/blocks/blockInput/index.js";
6
7
  import {PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
7
8
  import {
@@ -1047,6 +1048,11 @@ export function createLodestarMetrics(
1047
1048
  name: "lodestar_import_block_set_head_after_cutoff_total",
1048
1049
  help: "Total times an imported block is set as head after ATTESTATION_DUE_BPS of the slot",
1049
1050
  }),
1051
+ lateCanonicalBlock: register.counter<{reason: LateCanonicalBlockReason}>({
1052
+ name: "lodestar_import_block_late_canonical_total",
1053
+ help: "Total finalized-canonical blocks this node imported after the attestation cutoff; reason distinguishes this node's processing lag (slow_import) from late reception (late_receive)",
1054
+ labelNames: ["reason"],
1055
+ }),
1050
1056
  bySource: register.gauge<{source: BlockInputSource}>({
1051
1057
  name: "lodestar_import_block_by_source_total",
1052
1058
  help: "Total number of imported blocks by source",
@@ -1352,11 +1358,6 @@ export function createLodestarMetrics(
1352
1358
  help: "Total number of InsertOutcome as a result of adding an execution payload bid from gossip to the pool",
1353
1359
  labelNames: ["insertOutcome"],
1354
1360
  }),
1355
- apiInsertOutcome: register.counter<{insertOutcome: InsertOutcome}>({
1356
- name: "lodestar_oppool_execution_payload_bid_pool_api_insert_outcome_total",
1357
- help: "Total number of InsertOutcome as a result of adding an execution payload bid from api to the pool",
1358
- labelNames: ["insertOutcome"],
1359
- }),
1360
1361
  apiValidationTime: register.histogram({
1361
1362
  name: "lodestar_api_execution_payload_bid_validation_time_seconds",
1362
1363
  help: "Time elapsed for signed execution payload bid validation - api path",