@lodestar/beacon-node 1.39.0-dev.95389042f8 → 1.39.0-dev.a2107436df

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 (152) hide show
  1. package/lib/api/impl/beacon/state/utils.d.ts +2 -7
  2. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  3. package/lib/api/impl/beacon/state/utils.js +0 -12
  4. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  5. package/lib/api/impl/lodestar/index.js +1 -1
  6. package/lib/api/impl/lodestar/index.js.map +1 -1
  7. package/lib/api/impl/proof/index.d.ts.map +1 -1
  8. package/lib/api/impl/proof/index.js +1 -2
  9. package/lib/api/impl/proof/index.js.map +1 -1
  10. package/lib/api/impl/validator/index.d.ts.map +1 -1
  11. package/lib/api/impl/validator/index.js +1 -3
  12. package/lib/api/impl/validator/index.js.map +1 -1
  13. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  14. package/lib/chain/blocks/importBlock.js +12 -3
  15. package/lib/chain/blocks/importBlock.js.map +1 -1
  16. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  17. package/lib/chain/blocks/verifyBlock.js +8 -1
  18. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  19. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
  20. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
  21. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  22. package/lib/chain/chain.d.ts +3 -2
  23. package/lib/chain/chain.d.ts.map +1 -1
  24. package/lib/chain/chain.js +16 -6
  25. package/lib/chain/chain.js.map +1 -1
  26. package/lib/chain/interface.d.ts +2 -2
  27. package/lib/chain/interface.d.ts.map +1 -1
  28. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  29. package/lib/chain/lightClient/proofs.js +0 -2
  30. package/lib/chain/lightClient/proofs.js.map +1 -1
  31. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +5 -9
  32. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  33. package/lib/chain/opPools/aggregatedAttestationPool.js +12 -141
  34. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  35. package/lib/chain/opPools/opPool.js +5 -8
  36. package/lib/chain/opPools/opPool.js.map +1 -1
  37. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  38. package/lib/chain/prepareNextSlot.js +4 -7
  39. package/lib/chain/prepareNextSlot.js.map +1 -1
  40. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  41. package/lib/chain/produceBlock/produceBlockBody.js +1 -1
  42. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  43. package/lib/chain/regen/interface.d.ts +1 -5
  44. package/lib/chain/regen/interface.d.ts.map +1 -1
  45. package/lib/chain/regen/queued.d.ts +4 -7
  46. package/lib/chain/regen/queued.d.ts.map +1 -1
  47. package/lib/chain/regen/queued.js +15 -25
  48. package/lib/chain/regen/queued.js.map +1 -1
  49. package/lib/chain/regen/regen.d.ts +1 -1
  50. package/lib/chain/regen/regen.d.ts.map +1 -1
  51. package/lib/chain/regen/regen.js +13 -17
  52. package/lib/chain/regen/regen.js.map +1 -1
  53. package/lib/chain/shufflingCache.d.ts +16 -11
  54. package/lib/chain/shufflingCache.d.ts.map +1 -1
  55. package/lib/chain/shufflingCache.js +47 -41
  56. package/lib/chain/shufflingCache.js.map +1 -1
  57. package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
  58. package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
  59. package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
  60. package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
  61. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
  62. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  63. package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
  64. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  65. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
  66. package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
  67. package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
  68. package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
  69. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -6
  70. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  71. package/lib/chain/stateCache/persistentCheckpointsCache.js +17 -17
  72. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  73. package/lib/chain/stateCache/types.d.ts +5 -6
  74. package/lib/chain/stateCache/types.d.ts.map +1 -1
  75. package/lib/chain/stateCache/types.js.map +1 -1
  76. package/lib/chain/validation/attestation.d.ts.map +1 -1
  77. package/lib/chain/validation/attestation.js +2 -2
  78. package/lib/chain/validation/attestation.js.map +1 -1
  79. package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
  80. package/lib/chain/validation/attesterSlashing.js +1 -1
  81. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  82. package/lib/chain/validation/block.d.ts.map +1 -1
  83. package/lib/chain/validation/block.js +2 -0
  84. package/lib/chain/validation/block.js.map +1 -1
  85. package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
  86. package/lib/chain/validation/blsToExecutionChange.js +9 -2
  87. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  88. package/lib/chain/validation/proposerSlashing.js +2 -1
  89. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  90. package/lib/db/repositories/stateArchive.d.ts +1 -1
  91. package/lib/db/repositories/stateArchive.d.ts.map +1 -1
  92. package/lib/db/repositories/stateArchive.js +2 -2
  93. package/lib/db/repositories/stateArchive.js.map +1 -1
  94. package/lib/execution/engine/mock.d.ts +9 -6
  95. package/lib/execution/engine/mock.d.ts.map +1 -1
  96. package/lib/execution/engine/mock.js +34 -7
  97. package/lib/execution/engine/mock.js.map +1 -1
  98. package/lib/metrics/metrics/lodestar.d.ts +1 -6
  99. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  100. package/lib/metrics/metrics/lodestar.js +3 -17
  101. package/lib/metrics/metrics/lodestar.js.map +1 -1
  102. package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
  103. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  104. package/lib/node/nodejs.d.ts.map +1 -1
  105. package/lib/node/nodejs.js +17 -2
  106. package/lib/node/nodejs.js.map +1 -1
  107. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  108. package/lib/sync/backfill/backfill.js +2 -2
  109. package/lib/sync/backfill/backfill.js.map +1 -1
  110. package/lib/sync/backfill/verify.d.ts +2 -2
  111. package/lib/sync/backfill/verify.d.ts.map +1 -1
  112. package/lib/sync/backfill/verify.js +2 -2
  113. package/lib/sync/backfill/verify.js.map +1 -1
  114. package/lib/util/sszBytes.js +1 -1
  115. package/lib/util/sszBytes.js.map +1 -1
  116. package/package.json +15 -15
  117. package/src/api/impl/beacon/state/utils.ts +2 -22
  118. package/src/api/impl/lodestar/index.ts +1 -1
  119. package/src/api/impl/proof/index.ts +1 -2
  120. package/src/api/impl/validator/index.ts +1 -3
  121. package/src/chain/blocks/importBlock.ts +13 -3
  122. package/src/chain/blocks/verifyBlock.ts +9 -3
  123. package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
  124. package/src/chain/chain.ts +20 -9
  125. package/src/chain/interface.ts +2 -2
  126. package/src/chain/lightClient/proofs.ts +0 -2
  127. package/src/chain/opPools/aggregatedAttestationPool.ts +19 -191
  128. package/src/chain/opPools/opPool.ts +5 -7
  129. package/src/chain/prepareNextSlot.ts +2 -6
  130. package/src/chain/produceBlock/produceBlockBody.ts +6 -1
  131. package/src/chain/regen/interface.ts +1 -5
  132. package/src/chain/regen/queued.ts +15 -34
  133. package/src/chain/regen/regen.ts +12 -18
  134. package/src/chain/shufflingCache.ts +67 -50
  135. package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
  136. package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
  137. package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
  138. package/src/chain/stateCache/persistentCheckpointsCache.ts +17 -25
  139. package/src/chain/stateCache/types.ts +5 -10
  140. package/src/chain/validation/attestation.ts +3 -3
  141. package/src/chain/validation/attesterSlashing.ts +8 -1
  142. package/src/chain/validation/block.ts +3 -0
  143. package/src/chain/validation/blsToExecutionChange.ts +9 -7
  144. package/src/chain/validation/proposerSlashing.ts +2 -1
  145. package/src/db/repositories/stateArchive.ts +2 -2
  146. package/src/execution/engine/mock.ts +40 -13
  147. package/src/metrics/metrics/lodestar.ts +3 -17
  148. package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
  149. package/src/node/nodejs.ts +18 -3
  150. package/src/sync/backfill/backfill.ts +2 -14
  151. package/src/sync/backfill/verify.ts +1 -7
  152. package/src/util/sszBytes.ts +1 -1
@@ -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: {
@@ -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
@@ -6,9 +6,10 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
6
6
  import {BeaconApiMethods} from "@lodestar/api/beacon/server";
7
7
  import {BeaconConfig} from "@lodestar/config";
8
8
  import type {LoggerNode} from "@lodestar/logger/node";
9
- import {CachedBeaconStateAllForks, Index2PubkeyCache} from "@lodestar/state-transition";
9
+ import {ZERO_HASH_HEX} from "@lodestar/params";
10
+ import {CachedBeaconStateAllForks, Index2PubkeyCache, isExecutionCachedStateType} from "@lodestar/state-transition";
10
11
  import {phase0} from "@lodestar/types";
11
- import {sleep} from "@lodestar/utils";
12
+ import {sleep, toRootHex} from "@lodestar/utils";
12
13
  import {ProcessShutdownCallback} from "@lodestar/validator";
13
14
  import {BeaconRestApiServer, getApi} from "../api/index.js";
14
15
  import {BeaconChain, IBeaconChain, initBeaconMetrics} from "../chain/index.js";
@@ -221,6 +222,20 @@ export class BeaconNode {
221
222
  )
222
223
  : null;
223
224
 
225
+ let executionEngineOpts = opts.executionEngine;
226
+ if (opts.executionEngine.mode === "mock") {
227
+ const eth1BlockHash = isExecutionCachedStateType(anchorState)
228
+ ? toRootHex(anchorState.latestExecutionPayloadHeader.blockHash)
229
+ : undefined;
230
+ executionEngineOpts = {
231
+ ...opts.executionEngine,
232
+ genesisBlockHash: ZERO_HASH_HEX,
233
+ eth1BlockHash,
234
+ genesisTime: anchorState.genesisTime,
235
+ config,
236
+ };
237
+ }
238
+
224
239
  const chain = new BeaconChain(opts.chain, {
225
240
  privateKey,
226
241
  config,
@@ -236,7 +251,7 @@ export class BeaconNode {
236
251
  validatorMonitor,
237
252
  anchorState,
238
253
  isAnchorStateFinalized,
239
- executionEngine: initializeExecutionEngine(opts.executionEngine, {
254
+ executionEngine: initializeExecutionEngine(executionEngineOpts, {
240
255
  metrics,
241
256
  signal,
242
257
  logger: logger.child({module: LoggerModule.execution}),
@@ -750,13 +750,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
750
750
 
751
751
  // GENESIS_SLOT doesn't has valid signature
752
752
  if (anchorBlock.message.slot === GENESIS_SLOT) return;
753
- await verifyBlockProposerSignature(
754
- this.chain.config,
755
- this.chain.index2pubkey,
756
- this.chain.bls,
757
- this.chain.getHeadState(),
758
- [anchorBlock]
759
- );
753
+ await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, [anchorBlock]);
760
754
 
761
755
  // We can write to the disk if this is ahead of prevFinalizedCheckpointBlock otherwise
762
756
  // we will need to go make checks on the top of sync loop before writing as it might
@@ -821,13 +815,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
821
815
 
822
816
  // If any of the block's proposer signature fail, we can't trust this peer at all
823
817
  if (verifiedBlocks.length > 0) {
824
- await verifyBlockProposerSignature(
825
- this.chain.config,
826
- this.chain.index2pubkey,
827
- this.chain.bls,
828
- this.chain.getHeadState(),
829
- verifiedBlocks
830
- );
818
+ await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, verifiedBlocks);
831
819
 
832
820
  // This is bad, like super bad. Abort the backfill
833
821
  if (!nextAnchor)
@@ -1,11 +1,6 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {GENESIS_SLOT} from "@lodestar/params";
3
- import {
4
- CachedBeaconStateAllForks,
5
- ISignatureSet,
6
- Index2PubkeyCache,
7
- getBlockProposerSignatureSet,
8
- } from "@lodestar/state-transition";
3
+ import {ISignatureSet, Index2PubkeyCache, getBlockProposerSignatureSet} from "@lodestar/state-transition";
9
4
  import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
10
5
  import {IBlsVerifier} from "../../chain/bls/index.js";
11
6
  import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js";
@@ -49,7 +44,6 @@ export async function verifyBlockProposerSignature(
49
44
  config: BeaconConfig,
50
45
  index2pubkey: Index2PubkeyCache,
51
46
  bls: IBlsVerifier,
52
- state: CachedBeaconStateAllForks,
53
47
  blocks: SignedBeaconBlock[]
54
48
  ): Promise<void> {
55
49
  if (blocks.length === 1 && blocks[0].message.slot === GENESIS_SLOT) return;
@@ -479,7 +479,7 @@ export function getBlobKzgCommitmentsCountFromSignedBeaconBlockSerialized(
479
479
  blockBytes: Uint8Array
480
480
  ): number {
481
481
  const slot = getSlotFromSignedBeaconBlockSerialized(blockBytes);
482
- if (!slot) throw new Error("Can not parse the slot from block bytes");
482
+ if (slot === null) throw new Error("Can not parse the slot from block bytes");
483
483
 
484
484
  if (config.getForkSeq(slot) < ForkSeq.deneb) return 0;
485
485