@lodestar/beacon-node 1.39.0-dev.2fe8de2346 → 1.39.0-dev.375b1b3da7

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 (251) hide show
  1. package/README.md +1 -1
  2. package/lib/api/impl/beacon/state/utils.d.ts +2 -7
  3. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  4. package/lib/api/impl/beacon/state/utils.js +0 -12
  5. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  6. package/lib/api/impl/lodestar/index.js +1 -1
  7. package/lib/api/impl/lodestar/index.js.map +1 -1
  8. package/lib/api/impl/proof/index.d.ts.map +1 -1
  9. package/lib/api/impl/proof/index.js +1 -2
  10. package/lib/api/impl/proof/index.js.map +1 -1
  11. package/lib/api/impl/validator/index.d.ts.map +1 -1
  12. package/lib/api/impl/validator/index.js +1 -3
  13. package/lib/api/impl/validator/index.js.map +1 -1
  14. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  15. package/lib/chain/blocks/importBlock.js +12 -3
  16. package/lib/chain/blocks/importBlock.js.map +1 -1
  17. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  18. package/lib/chain/blocks/verifyBlock.js +9 -2
  19. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  20. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  21. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +4 -2
  22. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  23. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -1
  24. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  25. package/lib/chain/blocks/verifyBlocksSignatures.js +3 -2
  26. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  27. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  28. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
  29. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  30. package/lib/chain/chain.d.ts +11 -11
  31. package/lib/chain/chain.d.ts.map +1 -1
  32. package/lib/chain/chain.js +36 -40
  33. package/lib/chain/chain.js.map +1 -1
  34. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  35. package/lib/chain/forkChoice/index.js +3 -3
  36. package/lib/chain/forkChoice/index.js.map +1 -1
  37. package/lib/chain/interface.d.ts +6 -9
  38. package/lib/chain/interface.d.ts.map +1 -1
  39. package/lib/chain/interface.js.map +1 -1
  40. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  41. package/lib/chain/lightClient/proofs.js +0 -2
  42. package/lib/chain/lightClient/proofs.js.map +1 -1
  43. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +8 -12
  44. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  45. package/lib/chain/opPools/aggregatedAttestationPool.js +13 -142
  46. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  47. package/lib/chain/opPools/opPool.d.ts +3 -0
  48. package/lib/chain/opPools/opPool.d.ts.map +1 -1
  49. package/lib/chain/opPools/opPool.js +14 -16
  50. package/lib/chain/opPools/opPool.js.map +1 -1
  51. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  52. package/lib/chain/prepareNextSlot.js +4 -7
  53. package/lib/chain/prepareNextSlot.js.map +1 -1
  54. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  55. package/lib/chain/produceBlock/produceBlockBody.js +4 -4
  56. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  57. package/lib/chain/regen/interface.d.ts +1 -5
  58. package/lib/chain/regen/interface.d.ts.map +1 -1
  59. package/lib/chain/regen/queued.d.ts +4 -7
  60. package/lib/chain/regen/queued.d.ts.map +1 -1
  61. package/lib/chain/regen/queued.js +15 -25
  62. package/lib/chain/regen/queued.js.map +1 -1
  63. package/lib/chain/regen/regen.d.ts +1 -1
  64. package/lib/chain/regen/regen.d.ts.map +1 -1
  65. package/lib/chain/regen/regen.js +13 -17
  66. package/lib/chain/regen/regen.js.map +1 -1
  67. package/lib/chain/shufflingCache.d.ts +16 -11
  68. package/lib/chain/shufflingCache.d.ts.map +1 -1
  69. package/lib/chain/shufflingCache.js +47 -41
  70. package/lib/chain/shufflingCache.js.map +1 -1
  71. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
  72. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
  73. package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
  74. package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
  75. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
  76. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  77. package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
  78. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  79. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
  80. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
  81. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
  82. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
  83. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +9 -7
  84. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  85. package/lib/chain/stateCache/persistentCheckpointsCache.js +21 -19
  86. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  87. package/lib/chain/stateCache/types.d.ts +5 -6
  88. package/lib/chain/stateCache/types.d.ts.map +1 -1
  89. package/lib/chain/stateCache/types.js.map +1 -1
  90. package/lib/chain/validation/aggregateAndProof.js +9 -0
  91. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  92. package/lib/chain/validation/attestation.d.ts.map +1 -1
  93. package/lib/chain/validation/attestation.js +2 -2
  94. package/lib/chain/validation/attestation.js.map +1 -1
  95. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  96. package/lib/chain/validation/attesterSlashing.js +2 -2
  97. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  98. package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
  99. package/lib/chain/validation/blobSidecar.js +2 -3
  100. package/lib/chain/validation/blobSidecar.js.map +1 -1
  101. package/lib/chain/validation/block.d.ts.map +1 -1
  102. package/lib/chain/validation/block.js +5 -3
  103. package/lib/chain/validation/block.js.map +1 -1
  104. package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
  105. package/lib/chain/validation/blsToExecutionChange.js +10 -3
  106. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  107. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  108. package/lib/chain/validation/dataColumnSidecar.js +2 -3
  109. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  110. package/lib/chain/validation/proposerSlashing.js +3 -2
  111. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  112. package/lib/chain/validation/signatureSets/aggregateAndProof.js +1 -1
  113. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  114. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -1
  115. package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
  116. package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
  117. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  118. package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -1
  119. package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
  120. package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
  121. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  122. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -1
  123. package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
  124. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
  125. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  126. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -1
  127. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
  128. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -2
  129. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  130. package/lib/chain/validation/syncCommittee.js +1 -1
  131. package/lib/chain/validation/syncCommittee.js.map +1 -1
  132. package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
  133. package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -3
  134. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  135. package/lib/chain/validation/voluntaryExit.js +1 -1
  136. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  137. package/lib/db/beacon.d.ts +2 -0
  138. package/lib/db/beacon.d.ts.map +1 -1
  139. package/lib/db/beacon.js +32 -0
  140. package/lib/db/beacon.js.map +1 -1
  141. package/lib/db/buckets.d.ts +12 -0
  142. package/lib/db/buckets.d.ts.map +1 -1
  143. package/lib/db/buckets.js +12 -6
  144. package/lib/db/buckets.js.map +1 -1
  145. package/lib/db/interface.d.ts +1 -0
  146. package/lib/db/interface.d.ts.map +1 -1
  147. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  148. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  149. package/lib/db/repositories/stateArchive.d.ts +1 -1
  150. package/lib/db/repositories/stateArchive.d.ts.map +1 -1
  151. package/lib/db/repositories/stateArchive.js +2 -2
  152. package/lib/db/repositories/stateArchive.js.map +1 -1
  153. package/lib/execution/engine/mock.d.ts +9 -6
  154. package/lib/execution/engine/mock.d.ts.map +1 -1
  155. package/lib/execution/engine/mock.js +34 -7
  156. package/lib/execution/engine/mock.js.map +1 -1
  157. package/lib/metrics/metrics/lodestar.d.ts +1 -6
  158. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  159. package/lib/metrics/metrics/lodestar.js +3 -17
  160. package/lib/metrics/metrics/lodestar.js.map +1 -1
  161. package/lib/network/peers/discover.d.ts.map +1 -1
  162. package/lib/network/peers/discover.js.map +1 -1
  163. package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
  164. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  165. package/lib/node/nodejs.d.ts +6 -3
  166. package/lib/node/nodejs.d.ts.map +1 -1
  167. package/lib/node/nodejs.js +30 -3
  168. package/lib/node/nodejs.js.map +1 -1
  169. package/lib/node/notifier.d.ts.map +1 -1
  170. package/lib/node/notifier.js +9 -6
  171. package/lib/node/notifier.js.map +1 -1
  172. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  173. package/lib/sync/backfill/backfill.js +2 -4
  174. package/lib/sync/backfill/backfill.js.map +1 -1
  175. package/lib/sync/backfill/verify.d.ts +2 -2
  176. package/lib/sync/backfill/verify.d.ts.map +1 -1
  177. package/lib/sync/backfill/verify.js +3 -3
  178. package/lib/sync/backfill/verify.js.map +1 -1
  179. package/lib/util/sszBytes.js +1 -1
  180. package/lib/util/sszBytes.js.map +1 -1
  181. package/package.json +28 -20
  182. package/src/api/impl/beacon/state/utils.ts +2 -22
  183. package/src/api/impl/lodestar/index.ts +1 -1
  184. package/src/api/impl/proof/index.ts +1 -2
  185. package/src/api/impl/validator/index.ts +1 -3
  186. package/src/chain/blocks/importBlock.ts +13 -3
  187. package/src/chain/blocks/verifyBlock.ts +10 -3
  188. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -2
  189. package/src/chain/blocks/verifyBlocksSignatures.ts +13 -3
  190. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
  191. package/src/chain/chain.ts +50 -48
  192. package/src/chain/forkChoice/index.ts +3 -2
  193. package/src/chain/interface.ts +6 -8
  194. package/src/chain/lightClient/proofs.ts +0 -2
  195. package/src/chain/opPools/aggregatedAttestationPool.ts +23 -195
  196. package/src/chain/opPools/opPool.ts +13 -15
  197. package/src/chain/prepareNextSlot.ts +2 -6
  198. package/src/chain/produceBlock/produceBlockBody.ts +9 -4
  199. package/src/chain/regen/interface.ts +1 -5
  200. package/src/chain/regen/queued.ts +15 -34
  201. package/src/chain/regen/regen.ts +12 -18
  202. package/src/chain/shufflingCache.ts +67 -50
  203. package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
  204. package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
  205. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
  206. package/src/chain/stateCache/persistentCheckpointsCache.ts +32 -27
  207. package/src/chain/stateCache/types.ts +5 -10
  208. package/src/chain/validation/aggregateAndProof.ts +12 -0
  209. package/src/chain/validation/attestation.ts +3 -3
  210. package/src/chain/validation/attesterSlashing.ts +14 -2
  211. package/src/chain/validation/blobSidecar.ts +3 -3
  212. package/src/chain/validation/block.ts +6 -2
  213. package/src/chain/validation/blsToExecutionChange.ts +10 -8
  214. package/src/chain/validation/dataColumnSidecar.ts +3 -3
  215. package/src/chain/validation/proposerSlashing.ts +8 -2
  216. package/src/chain/validation/signatureSets/aggregateAndProof.ts +1 -1
  217. package/src/chain/validation/signatureSets/contributionAndProof.ts +3 -1
  218. package/src/chain/validation/signatureSets/syncCommittee.ts +3 -1
  219. package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +3 -1
  220. package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -1
  221. package/src/chain/validation/syncCommittee.ts +1 -1
  222. package/src/chain/validation/syncCommitteeContributionAndProof.ts +8 -3
  223. package/src/chain/validation/voluntaryExit.ts +1 -1
  224. package/src/db/beacon.ts +38 -1
  225. package/src/db/buckets.ts +12 -6
  226. package/src/db/interface.ts +2 -0
  227. package/src/db/repositories/stateArchive.ts +2 -2
  228. package/src/execution/engine/mock.ts +40 -13
  229. package/src/metrics/metrics/lodestar.ts +3 -17
  230. package/src/network/peers/discover.ts +3 -3
  231. package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
  232. package/src/node/nodejs.ts +37 -4
  233. package/src/node/notifier.ts +13 -7
  234. package/src/sync/backfill/backfill.ts +2 -9
  235. package/src/sync/backfill/verify.ts +3 -8
  236. package/src/util/sszBytes.ts +1 -1
  237. package/lib/chain/rewards/attestationsRewards.d.ts +0 -7
  238. package/lib/chain/rewards/attestationsRewards.d.ts.map +0 -1
  239. package/lib/chain/rewards/attestationsRewards.js +0 -112
  240. package/lib/chain/rewards/attestationsRewards.js.map +0 -1
  241. package/lib/chain/rewards/blockRewards.d.ts +0 -14
  242. package/lib/chain/rewards/blockRewards.d.ts.map +0 -1
  243. package/lib/chain/rewards/blockRewards.js +0 -94
  244. package/lib/chain/rewards/blockRewards.js.map +0 -1
  245. package/lib/chain/rewards/syncCommitteeRewards.d.ts +0 -6
  246. package/lib/chain/rewards/syncCommitteeRewards.d.ts.map +0 -1
  247. package/lib/chain/rewards/syncCommitteeRewards.js +0 -36
  248. package/lib/chain/rewards/syncCommitteeRewards.js.map +0 -1
  249. package/src/chain/rewards/attestationsRewards.ts +0 -197
  250. package/src/chain/rewards/blockRewards.ts +0 -150
  251. package/src/chain/rewards/syncCommitteeRewards.ts +0 -58
@@ -43,7 +43,14 @@ export async function validateAttesterSlashing(
43
43
  // [REJECT] All of the conditions within process_attester_slashing pass validation.
44
44
  try {
45
45
  // verifySignature = false, verified in batch below
46
- assertValidAttesterSlashing(chain.index2pubkey, state, attesterSlashing, false);
46
+ assertValidAttesterSlashing(
47
+ chain.config,
48
+ chain.index2pubkey,
49
+ state.slot,
50
+ state.validators.length,
51
+ attesterSlashing,
52
+ false
53
+ );
47
54
  } catch (e) {
48
55
  throw new AttesterSlashingError(GossipAction.REJECT, {
49
56
  code: AttesterSlashingErrorCode.INVALID,
@@ -51,7 +58,12 @@ export async function validateAttesterSlashing(
51
58
  });
52
59
  }
53
60
 
54
- const signatureSets = getAttesterSlashingSignatureSets(chain.index2pubkey, state, attesterSlashing);
61
+ const signatureSets = getAttesterSlashingSignatureSets(
62
+ chain.config,
63
+ chain.index2pubkey,
64
+ state.slot,
65
+ attesterSlashing
66
+ );
55
67
  if (!(await chain.bls.verifySignatureSets(signatureSets, {batchable: true, priority: prioritizeBls}))) {
56
68
  throw new AttesterSlashingError(GossipAction.REJECT, {
57
69
  code: AttesterSlashingErrorCode.INVALID,
@@ -138,8 +138,9 @@ export async function validateGossipBlobSidecar(
138
138
  const signature = blobSidecar.signedBlockHeader.signature;
139
139
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blobSlot, blockHex, signature)) {
140
140
  const signatureSet = getBlockHeaderProposerSignatureSetByParentStateSlot(
141
+ chain.config,
141
142
  chain.index2pubkey,
142
- blockState,
143
+ blockState.slot,
143
144
  blobSidecar.signedBlockHeader
144
145
  );
145
146
  // Don't batch so verification is not delayed
@@ -243,10 +244,9 @@ export async function validateBlockBlobSidecars(
243
244
  const blockRootHex = toRootHex(blockRoot);
244
245
  const signature = firstSidecarSignedBlockHeader.signature;
245
246
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRootHex, signature)) {
246
- const headState = await chain.getHeadState();
247
247
  const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(
248
+ chain.config,
248
249
  chain.index2pubkey,
249
- headState,
250
250
  firstSidecarSignedBlockHeader
251
251
  );
252
252
 
@@ -6,6 +6,7 @@ import {
6
6
  computeTimeAtSlot,
7
7
  getBlockProposerSignatureSet,
8
8
  isExecutionBlockBodyType,
9
+ isExecutionEnabled,
9
10
  isExecutionStateType,
10
11
  } from "@lodestar/state-transition";
11
12
  import {SignedBeaconBlock, deneb} from "@lodestar/types";
@@ -133,13 +134,16 @@ export async function validateGossipBlock(
133
134
  throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_UNKNOWN, parentRoot});
134
135
  });
135
136
 
137
+ // in forky condition, make sure to populate ShufflingCache with regened state
138
+ chain.shufflingCache.processState(blockState);
139
+
136
140
  // Extra conditions for merge fork blocks
137
141
  // [REJECT] The block's execution payload timestamp is correct with respect to the slot
138
142
  // -- i.e. execution_payload.timestamp == compute_timestamp_at_slot(state, block.slot).
139
143
  if (fork === ForkName.bellatrix) {
140
144
  if (!isExecutionBlockBodyType(block.body)) throw Error("Not merge block type");
141
145
  const executionPayload = block.body.executionPayload;
142
- if (isExecutionStateType(blockState)) {
146
+ if (isExecutionStateType(blockState) && isExecutionEnabled(blockState, block)) {
143
147
  const expectedTimestamp = computeTimeAtSlot(config, blockSlot, chain.genesisTime);
144
148
  if (executionPayload.timestamp !== computeTimeAtSlot(config, blockSlot, chain.genesisTime)) {
145
149
  throw new BlockGossipError(GossipAction.REJECT, {
@@ -153,7 +157,7 @@ export async function validateGossipBlock(
153
157
 
154
158
  // [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
155
159
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature)) {
156
- const signatureSet = getBlockProposerSignatureSet(chain.index2pubkey, blockState, signedBlock);
160
+ const signatureSet = getBlockProposerSignatureSet(chain.config, chain.index2pubkey, signedBlock);
157
161
  // Don't batch so verification is not delayed
158
162
  if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: true}))) {
159
163
  throw new BlockGossipError(GossipAction.REJECT, {
@@ -1,8 +1,4 @@
1
- import {
2
- CachedBeaconStateCapella,
3
- getBlsToExecutionChangeSignatureSet,
4
- isValidBlsToExecutionChange,
5
- } from "@lodestar/state-transition";
1
+ import {getBlsToExecutionChangeSignatureSet, isValidBlsToExecutionChange} from "@lodestar/state-transition";
6
2
  import {capella} from "@lodestar/types";
7
3
  import {BlsToExecutionChangeError, BlsToExecutionChangeErrorCode, GossipAction} from "../errors/index.js";
8
4
  import {IBeaconChain} from "../index.js";
@@ -41,11 +37,17 @@ async function validateBlsToExecutionChange(
41
37
  // NOTE: No need to advance head state since the signature's fork is handled with `broadcastedOnFork`,
42
38
  // and chanes relevant to `isValidBlsToExecutionChange()` happen only on processBlock(), not processEpoch()
43
39
  const state = chain.getHeadState();
44
- const {config} = state;
45
-
40
+ const {config} = chain;
41
+ const addressChange = blsToExecutionChange.message;
42
+ if (addressChange.validatorIndex >= state.validators.length) {
43
+ throw new BlsToExecutionChangeError(GossipAction.REJECT, {
44
+ code: BlsToExecutionChangeErrorCode.INVALID,
45
+ });
46
+ }
47
+ const validator = state.validators.getReadonly(addressChange.validatorIndex);
46
48
  // [REJECT] All of the conditions within process_bls_to_execution_change pass validation.
47
49
  // verifySignature = false, verified in batch below
48
- const {valid} = isValidBlsToExecutionChange(state as CachedBeaconStateCapella, blsToExecutionChange, false);
50
+ const {valid} = isValidBlsToExecutionChange(config, validator, blsToExecutionChange, false);
49
51
  if (!valid) {
50
52
  throw new BlsToExecutionChangeError(GossipAction.REJECT, {
51
53
  code: BlsToExecutionChangeErrorCode.INVALID,
@@ -135,8 +135,9 @@ export async function validateGossipDataColumnSidecar(
135
135
  const signature = dataColumnSidecar.signedBlockHeader.signature;
136
136
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockHeader.slot, blockRootHex, signature)) {
137
137
  const signatureSet = getBlockHeaderProposerSignatureSetByParentStateSlot(
138
+ chain.config,
138
139
  chain.index2pubkey,
139
- blockState,
140
+ blockState.slot,
140
141
  dataColumnSidecar.signedBlockHeader
141
142
  );
142
143
 
@@ -336,10 +337,9 @@ export async function validateBlockDataColumnSidecars(
336
337
  const slot = firstSidecarSignedBlockHeader.message.slot;
337
338
  const signature = firstSidecarSignedBlockHeader.signature;
338
339
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(slot, rootHex, signature)) {
339
- const headState = await chain.getHeadState();
340
340
  const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(
341
+ chain.config,
341
342
  chain.index2pubkey,
342
- headState,
343
343
  firstSidecarSignedBlockHeader
344
344
  );
345
345
 
@@ -35,8 +35,9 @@ async function validateProposerSlashing(
35
35
 
36
36
  // [REJECT] All of the conditions within process_proposer_slashing pass validation.
37
37
  try {
38
+ const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
38
39
  // verifySignature = false, verified in batch below
39
- assertValidProposerSlashing(state, proposerSlashing, false);
40
+ assertValidProposerSlashing(chain.config, chain.index2pubkey, state.slot, proposerSlashing, proposer, false);
40
41
  } catch (e) {
41
42
  throw new ProposerSlashingError(GossipAction.REJECT, {
42
43
  code: ProposerSlashingErrorCode.INVALID,
@@ -44,7 +45,12 @@ async function validateProposerSlashing(
44
45
  });
45
46
  }
46
47
 
47
- const signatureSets = getProposerSlashingSignatureSets(chain.index2pubkey, state, proposerSlashing);
48
+ const signatureSets = getProposerSlashingSignatureSets(
49
+ chain.config,
50
+ chain.index2pubkey,
51
+ state.slot,
52
+ proposerSlashing
53
+ );
48
54
  if (!(await chain.bls.verifySignatureSets(signatureSets, {batchable: true, priority: prioritizeBls}))) {
49
55
  throw new ProposerSlashingError(GossipAction.REJECT, {
50
56
  code: ProposerSlashingErrorCode.INVALID,
@@ -14,7 +14,7 @@ export function getAggregateAndProofSigningRoot(
14
14
  epoch: Epoch,
15
15
  aggregateAndProof: SignedAggregateAndProof
16
16
  ): Uint8Array {
17
- // previously, we call `const aggregatorDomain = state.config.getDomain(state.slot, DOMAIN_AGGREGATE_AND_PROOF, slot);`
17
+ // previously, we call `const aggregatorDomain = config.getDomain(state.slot, DOMAIN_AGGREGATE_AND_PROOF, slot);`
18
18
  // at fork boundary, it's required to dial to target epoch https://github.com/ChainSafe/lodestar/blob/v1.11.3/packages/beacon-node/src/chain/validation/attestation.ts#L573
19
19
  // instead of that, just use the fork of slot in the attestation data
20
20
  const slot = computeStartSlotAtEpoch(epoch);
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_CONTRIBUTION_AND_PROOF} from "@lodestar/params";
2
3
  import {
3
4
  CachedBeaconStateAllForks,
@@ -9,11 +10,12 @@ import {
9
10
  import {altair, ssz} from "@lodestar/types";
10
11
 
11
12
  export function getContributionAndProofSignatureSet(
13
+ config: BeaconConfig,
12
14
  index2pubkey: Index2PubkeyCache,
13
15
  state: CachedBeaconStateAllForks,
14
16
  signedContributionAndProof: altair.SignedContributionAndProof
15
17
  ): ISignatureSet {
16
- const domain = state.config.getDomain(
18
+ const domain = config.getDomain(
17
19
  state.slot,
18
20
  DOMAIN_CONTRIBUTION_AND_PROOF,
19
21
  signedContributionAndProof.message.contribution.slot
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params";
2
3
  import {
3
4
  CachedBeaconStateAllForks,
@@ -9,11 +10,12 @@ import {
9
10
  import {altair, ssz} from "@lodestar/types";
10
11
 
11
12
  export function getSyncCommitteeSignatureSet(
13
+ config: BeaconConfig,
12
14
  index2pubkey: Index2PubkeyCache,
13
15
  state: CachedBeaconStateAllForks,
14
16
  syncCommittee: altair.SyncCommitteeMessage
15
17
  ): ISignatureSet {
16
- const domain = state.config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, syncCommittee.slot);
18
+ const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, syncCommittee.slot);
17
19
 
18
20
  return {
19
21
  type: SignatureSetType.single,
@@ -1,14 +1,16 @@
1
1
  import {PublicKey} from "@chainsafe/blst";
2
+ import {BeaconConfig} from "@lodestar/config";
2
3
  import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params";
3
4
  import {CachedBeaconStateAltair, ISignatureSet, SignatureSetType, computeSigningRoot} from "@lodestar/state-transition";
4
5
  import {altair, ssz} from "@lodestar/types";
5
6
 
6
7
  export function getSyncCommitteeContributionSignatureSet(
8
+ config: BeaconConfig,
7
9
  state: CachedBeaconStateAltair,
8
10
  contribution: altair.SyncCommitteeContribution,
9
11
  pubkeys: PublicKey[]
10
12
  ): ISignatureSet {
11
- const domain = state.config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, contribution.slot);
13
+ const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, contribution.slot);
12
14
  return {
13
15
  type: SignatureSetType.aggregate,
14
16
  pubkeys,
@@ -1,3 +1,4 @@
1
+ import {BeaconConfig} from "@lodestar/config";
1
2
  import {DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF} from "@lodestar/params";
2
3
  import {
3
4
  CachedBeaconStateAllForks,
@@ -9,11 +10,11 @@ import {
9
10
  import {altair, ssz} from "@lodestar/types";
10
11
 
11
12
  export function getSyncCommitteeSelectionProofSignatureSet(
13
+ config: BeaconConfig,
12
14
  index2pubkey: Index2PubkeyCache,
13
15
  state: CachedBeaconStateAllForks,
14
16
  contributionAndProof: altair.ContributionAndProof
15
17
  ): ISignatureSet {
16
- const {config} = state;
17
18
  const slot = contributionAndProof.contribution.slot;
18
19
  const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF, slot);
19
20
  const signingData: altair.SyncAggregatorSelectionData = {
@@ -89,7 +89,7 @@ async function validateSyncCommitteeSigOnly(
89
89
  syncCommittee: altair.SyncCommitteeMessage,
90
90
  prioritizeBls = false
91
91
  ): Promise<void> {
92
- const signatureSet = getSyncCommitteeSignatureSet(chain.index2pubkey, headState, syncCommittee);
92
+ const signatureSet = getSyncCommitteeSignatureSet(chain.config, chain.index2pubkey, headState, syncCommittee);
93
93
  if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
94
94
  throw new SyncCommitteeError(GossipAction.REJECT, {
95
95
  code: SyncCommitteeErrorCode.INVALID_SIGNATURE,
@@ -78,14 +78,19 @@ export async function validateSyncCommitteeGossipContributionAndProof(
78
78
  const signatureSets = [
79
79
  // [REJECT] The contribution_and_proof.selection_proof is a valid signature of the SyncAggregatorSelectionData
80
80
  // derived from the contribution by the validator with index contribution_and_proof.aggregator_index.
81
- getSyncCommitteeSelectionProofSignatureSet(index2pubkey, headState, contributionAndProof),
81
+ getSyncCommitteeSelectionProofSignatureSet(chain.config, index2pubkey, headState, contributionAndProof),
82
82
 
83
83
  // [REJECT] The aggregator signature, signed_contribution_and_proof.signature, is valid.
84
- getContributionAndProofSignatureSet(index2pubkey, headState, signedContributionAndProof),
84
+ getContributionAndProofSignatureSet(chain.config, index2pubkey, headState, signedContributionAndProof),
85
85
 
86
86
  // [REJECT] The aggregate signature is valid for the message beacon_block_root and aggregate pubkey derived from
87
87
  // the participation info in aggregation_bits for the subcommittee specified by the contribution.subcommittee_index.
88
- getSyncCommitteeContributionSignatureSet(headState as CachedBeaconStateAltair, contribution, participantPubkeys),
88
+ getSyncCommitteeContributionSignatureSet(
89
+ chain.config,
90
+ headState as CachedBeaconStateAltair,
91
+ contribution,
92
+ participantPubkeys
93
+ ),
89
94
  ];
90
95
 
91
96
  if (!(await chain.bls.verifySignatureSets(signatureSets, {batchable: true}))) {
@@ -59,7 +59,7 @@ async function validateVoluntaryExit(
59
59
  });
60
60
  }
61
61
 
62
- const signatureSet = getVoluntaryExitSignatureSet(chain.index2pubkey, state, voluntaryExit);
62
+ const signatureSet = getVoluntaryExitSignatureSet(chain.config, chain.index2pubkey, state.slot, voluntaryExit);
63
63
  if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
64
64
  throw new VoluntaryExitError(GossipAction.REJECT, {
65
65
  code: VoluntaryExitErrorCode.INVALID_SIGNATURE,
package/src/db/beacon.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
- import {Db, LevelDbControllerMetrics} from "@lodestar/db";
2
+ import {Db, LevelDbControllerMetrics, encodeKey} from "@lodestar/db";
3
+ import {Bucket} from "./buckets.js";
3
4
  import {IBeaconDb} from "./interface.js";
4
5
  import {CheckpointStateRepository} from "./repositories/checkpointState.js";
5
6
  import {
@@ -95,4 +96,40 @@ export class BeaconDb implements IBeaconDb {
95
96
  // TODO: Enable once it's deemed safe
96
97
  // await this.block.batchDelete(await this.block.keys());
97
98
  }
99
+
100
+ async deleteDeprecatedEth1Data(): Promise<void> {
101
+ const deprecatedBuckets = [
102
+ Bucket.phase0_eth1Data,
103
+ Bucket.index_depositDataRoot,
104
+ Bucket.phase0_depositData,
105
+ Bucket.phase0_depositEvent,
106
+ Bucket.phase0_preGenesisState,
107
+ Bucket.phase0_preGenesisStateLastProcessedBlock,
108
+ ];
109
+
110
+ for (const bucket of deprecatedBuckets) {
111
+ await this.deleteBucketData(bucket);
112
+ }
113
+ }
114
+
115
+ private async deleteBucketData(bucket: Bucket): Promise<void> {
116
+ const minKey = encodeKey(bucket, Buffer.alloc(0));
117
+ const maxKey = encodeKey(bucket + 1, Buffer.alloc(0));
118
+
119
+ // Batch delete to avoid loading all keys into memory at once
120
+ const BATCH_DELETE_SIZE = 1000;
121
+ let keysBatch: Uint8Array[] = [];
122
+
123
+ for await (const key of this.db.keysStream({gte: minKey, lt: maxKey})) {
124
+ keysBatch.push(key);
125
+ if (keysBatch.length >= BATCH_DELETE_SIZE) {
126
+ await this.db.batchDelete(keysBatch);
127
+ keysBatch = [];
128
+ }
129
+ }
130
+
131
+ if (keysBatch.length > 0) {
132
+ await this.db.batchDelete(keysBatch);
133
+ }
134
+ }
98
135
  }
package/src/db/buckets.ts CHANGED
@@ -16,13 +16,16 @@ export enum Bucket {
16
16
  index_mainChain = 6, // Slot -> Root<BeaconBlock>
17
17
  // justified, finalized state and block hashes
18
18
  index_chainInfo = 7, // Key -> Number64 | stateHash | blockHash
19
- // phase0_eth1Data = 8, // DEPRECATED - eth1 deposit tracking is not required since electra
20
- // index_depositDataRoot = 9, // DEPRECATED - eth1 deposit tracking is not required since electra
19
+ /** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
20
+ phase0_eth1Data = 8,
21
+ /** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
22
+ index_depositDataRoot = 9,
21
23
 
22
24
  // op pool
23
25
  // phase0_attestation = 10, // DEPRECATED on v0.25.0
24
26
  // phase0_aggregateAndProof = 11, // Root -> AggregateAndProof, DEPRECATED on v.27.0
25
- // phase0_depositData = 12, // DEPRECATED - eth1 deposit tracking is not required since electra
27
+ /** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
28
+ phase0_depositData = 12,
26
29
  phase0_exit = 13, // ValidatorIndex -> VoluntaryExit
27
30
  phase0_proposerSlashing = 14, // ValidatorIndex -> ProposerSlashing
28
31
  allForks_attesterSlashing = 15, // Root -> AttesterSlashing
@@ -31,15 +34,18 @@ export enum Bucket {
31
34
  allForks_checkpointState = 17, // Root -> BeaconState
32
35
 
33
36
  // allForks_pendingBlock = 25, // Root -> SignedBeaconBlock // DEPRECATED on v0.30.0
34
- // phase0_depositEvent = 19, // DEPRECATED - eth1 deposit tracking is not required since electra
37
+ /** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
38
+ phase0_depositEvent = 19,
35
39
 
36
40
  index_stateArchiveRootIndex = 26, // State Root -> slot
37
41
 
38
42
  deneb_blobSidecars = 27, // DENEB BeaconBlockRoot -> BlobSidecars
39
43
  deneb_blobSidecarsArchive = 28, // DENEB BeaconBlockSlot -> BlobSidecars
40
44
 
41
- // phase0_preGenesisState = 30, // DEPRECATED - genesis from eth1 is no longer supported
42
- // phase0_preGenesisStateLastProcessedBlock = 31, // DEPRECATED - genesis from eth1 is no longer supported
45
+ /** @deprecated Genesis from eth1 is no longer supported, only kept around to delete data from existing databases */
46
+ phase0_preGenesisState = 30,
47
+ /** @deprecated Genesis from eth1 is no longer supported, only kept around to delete data from existing databases */
48
+ phase0_preGenesisStateLastProcessedBlock = 31,
43
49
 
44
50
  // Lightclient server
45
51
  // altair_bestUpdatePerCommitteePeriod = 30, // DEPRECATED on v0.32.0
@@ -56,6 +56,8 @@ export interface IBeaconDb {
56
56
 
57
57
  pruneHotDb(): Promise<void>;
58
58
 
59
+ deleteDeprecatedEth1Data(): Promise<void>;
60
+
59
61
  /** Close the connection to the db instance and close the db store. */
60
62
  close(): Promise<void>;
61
63
  /** To inject metrics after CLI initialization */
@@ -42,10 +42,10 @@ export class StateArchiveRepository extends Repository<Slot, BeaconStateAllForks
42
42
 
43
43
  // Index Root -> Slot
44
44
 
45
- async getByRoot(stateRoot: Root): Promise<BeaconStateAllForks | null> {
45
+ async getBinaryByRoot(stateRoot: Root): Promise<Uint8Array | null> {
46
46
  const slot = await this.getSlotByRoot(stateRoot);
47
47
  if (slot !== null && Number.isInteger(slot)) {
48
- return this.get(slot);
48
+ return this.getBinary(slot);
49
49
  }
50
50
  return null;
51
51
  }
@@ -1,4 +1,5 @@
1
1
  import crypto from "node:crypto";
2
+ import {ChainConfig} from "@lodestar/config";
2
3
  import {
3
4
  BLOB_TX_TYPE,
4
5
  BYTES_PER_FIELD_ELEMENT,
@@ -7,7 +8,9 @@ import {
7
8
  ForkPostBellatrix,
8
9
  ForkPostCapella,
9
10
  ForkSeq,
11
+ SLOTS_PER_EPOCH,
10
12
  } from "@lodestar/params";
13
+ import {computeTimeAtSlot} from "@lodestar/state-transition";
11
14
  import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
12
15
  import {fromHex, toRootHex} from "@lodestar/utils";
13
16
  import {ZERO_HASH_HEX} from "../../constants/index.js";
@@ -34,14 +37,11 @@ const INTEROP_GAS_LIMIT = 30e6;
34
37
  const PRUNE_PAYLOAD_ID_AFTER_MS = 5000;
35
38
 
36
39
  export type ExecutionEngineMockOpts = {
37
- genesisBlockHash: string;
40
+ genesisBlockHash?: string;
38
41
  eth1BlockHash?: string;
39
42
  onlyPredefinedResponses?: boolean;
40
- capellaForkTimestamp?: number;
41
- denebForkTimestamp?: number;
42
- electraForkTimestamp?: number;
43
- fuluForkTimestamp?: number;
44
- gloasForkTimestamp?: number;
43
+ genesisTime?: number;
44
+ config?: ChainConfig;
45
45
  };
46
46
 
47
47
  type ExecutionBlock = {
@@ -74,17 +74,21 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
74
74
  /** Preparing payloads to be retrieved via engine_getPayloadV1 */
75
75
  private readonly preparingPayloads = new Map<number, PreparedPayload>();
76
76
  private readonly payloadsForDeletion = new Map<number, number>();
77
-
78
77
  private readonly predefinedPayloadStatuses = new Map<RootHex, PayloadStatus>();
79
78
 
80
79
  private payloadId = 0;
80
+ private capellaForkTimestamp: number;
81
+ private denebForkTimestamp: number;
82
+ private electraForkTimestamp: number;
83
+ private fuluForkTimestamp: number;
84
+ private gloasForkTimestamp: number;
81
85
 
82
86
  readonly handlers: {
83
87
  [K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
84
88
  };
85
89
 
86
90
  constructor(private readonly opts: ExecutionEngineMockOpts) {
87
- this.validBlocks.set(opts.genesisBlockHash, {
91
+ this.validBlocks.set(opts.genesisBlockHash ?? ZERO_HASH_HEX, {
88
92
  parentHash: ZERO_HASH_HEX,
89
93
  blockHash: ZERO_HASH_HEX,
90
94
  timestamp: 0,
@@ -100,6 +104,29 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
100
104
  blockNumber: 1,
101
105
  });
102
106
 
107
+ const {config} = opts;
108
+
109
+ this.capellaForkTimestamp =
110
+ opts.genesisTime && config
111
+ ? computeTimeAtSlot(config, config.CAPELLA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
112
+ : Infinity;
113
+ this.denebForkTimestamp =
114
+ opts.genesisTime && config
115
+ ? computeTimeAtSlot(config, config.DENEB_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
116
+ : Infinity;
117
+ this.electraForkTimestamp =
118
+ opts.genesisTime && config
119
+ ? computeTimeAtSlot(config, config.ELECTRA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
120
+ : Infinity;
121
+ this.fuluForkTimestamp =
122
+ opts.genesisTime && config
123
+ ? computeTimeAtSlot(config, config.FULU_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
124
+ : Infinity;
125
+ this.gloasForkTimestamp =
126
+ opts.genesisTime && config
127
+ ? computeTimeAtSlot(config, config.GLOAS_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
128
+ : Infinity;
129
+
103
130
  this.handlers = {
104
131
  engine_newPayloadV1: this.notifyNewPayload.bind(this),
105
132
  engine_newPayloadV2: this.notifyNewPayload.bind(this),
@@ -448,11 +475,11 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
448
475
  }
449
476
 
450
477
  private timestampToFork(timestamp: number): ForkPostBellatrix {
451
- if (timestamp >= (this.opts.gloasForkTimestamp ?? Infinity)) return ForkName.gloas;
452
- if (timestamp >= (this.opts.fuluForkTimestamp ?? Infinity)) return ForkName.fulu;
453
- if (timestamp >= (this.opts.electraForkTimestamp ?? Infinity)) return ForkName.electra;
454
- if (timestamp >= (this.opts.denebForkTimestamp ?? Infinity)) return ForkName.deneb;
455
- if (timestamp >= (this.opts.capellaForkTimestamp ?? Infinity)) return ForkName.capella;
478
+ if (timestamp >= this.gloasForkTimestamp) return ForkName.gloas;
479
+ if (timestamp >= this.fuluForkTimestamp) return ForkName.fulu;
480
+ if (timestamp >= this.electraForkTimestamp) return ForkName.electra;
481
+ if (timestamp >= this.denebForkTimestamp) return ForkName.deneb;
482
+ if (timestamp >= this.capellaForkTimestamp) return ForkName.capella;
456
483
  return ForkName.bellatrix;
457
484
  }
458
485
  }
@@ -1308,33 +1308,19 @@ export function createLodestarMetrics(
1308
1308
  name: "lodestar_shuffling_cache_miss_count",
1309
1309
  help: "Count of shuffling cache miss",
1310
1310
  }),
1311
- shufflingBuiltMultipleTimes: register.gauge({
1312
- name: "lodestar_shuffling_cache_recalculated_shuffling_count",
1313
- help: "Count of shuffling that were build multiple times",
1314
- }),
1315
- shufflingPromiseNotResolvedAndThrownAway: register.gauge({
1316
- name: "lodestar_shuffling_cache_promise_not_resolved_and_thrown_away_count",
1317
- help: "Count of shuffling cache promises that were discarded and the shuffling was built synchronously",
1311
+ shufflingSetMultipleTimes: register.gauge({
1312
+ name: "lodestar_shuffling_cache_set_multiple_times_count",
1313
+ help: "Count of shuffling that were set multiple times",
1318
1314
  }),
1319
1315
  shufflingPromiseNotResolved: register.gauge({
1320
1316
  name: "lodestar_shuffling_cache_promise_not_resolved_count",
1321
1317
  help: "Count of shuffling cache promises that were requested before the promise was resolved",
1322
1318
  }),
1323
- nextShufflingNotOnEpochCache: register.gauge({
1324
- name: "lodestar_shuffling_cache_next_shuffling_not_on_epoch_cache",
1325
- help: "The next shuffling was not on the epoch cache before the epoch transition",
1326
- }),
1327
1319
  shufflingPromiseResolutionTime: register.histogram({
1328
1320
  name: "lodestar_shuffling_cache_promise_resolution_time_seconds",
1329
1321
  help: "Time from promise insertion until promise resolution when shuffling was ready in seconds",
1330
1322
  buckets: [0.5, 1, 1.5, 2],
1331
1323
  }),
1332
- shufflingCalculationTime: register.histogram<{source: "build" | "getSync"}>({
1333
- name: "lodestar_shuffling_cache_shuffling_calculation_time_seconds",
1334
- help: "Run time of shuffling calculation",
1335
- buckets: [0.5, 0.75, 1, 1.25, 1.5],
1336
- labelNames: ["source"],
1337
- }),
1338
1324
  },
1339
1325
 
1340
1326
  seenCache: {
@@ -1,4 +1,4 @@
1
- import type {PeerId, PeerInfo, PrivateKey} from "@libp2p/interface";
1
+ import type {PeerId, PeerInfo, PendingDial, PrivateKey} from "@libp2p/interface";
2
2
  import {Multiaddr} from "@multiformats/multiaddr";
3
3
  import {ENR} from "@chainsafe/enr";
4
4
  import {BeaconConfig} from "@lodestar/config";
@@ -217,7 +217,7 @@ export class PeerDiscovery {
217
217
  const pendingDials = new Set(
218
218
  this.libp2p.services.components.connectionManager
219
219
  .getDialQueue()
220
- .map((pendingDial) => pendingDial.peerId?.toString())
220
+ .map((pendingDial: PendingDial) => pendingDial.peerId?.toString())
221
221
  );
222
222
  for (const [id, cachedENR] of this.cachedENRs.entries()) {
223
223
  if (
@@ -458,7 +458,7 @@ export class PeerDiscovery {
458
458
  if (
459
459
  this.libp2p.services.components.connectionManager
460
460
  .getDialQueue()
461
- .find((pendingDial) => pendingDial.peerId?.equals(peerId))
461
+ .find((pendingDial: PendingDial) => pendingDial.peerId?.equals(peerId))
462
462
  ) {
463
463
  return DiscoveredPeerStatus.already_dialing;
464
464
  }
@@ -55,7 +55,7 @@ export async function handleColumnSidecarUnavailability({
55
55
  const blobsCount = getBlobKzgCommitmentsCountFromSignedBeaconBlockSerialized(chain.config, blockBytes);
56
56
 
57
57
  // There are zero blobs for that column index, so we can safely return without any error
58
- if (blobsCount > 0) return;
58
+ if (blobsCount === 0) return;
59
59
 
60
60
  // There are blobs for that column index so we should have synced for it
61
61
  // We need to inform to peers that we don't have that expected data