@lodestar/beacon-node 1.41.0-dev.bb273175f2 → 1.41.0-dev.be5acbb8f7

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 (64) hide show
  1. package/lib/chain/blocks/blockInput/blockInput.d.ts +5 -0
  2. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  3. package/lib/chain/blocks/blockInput/blockInput.js +24 -0
  4. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  5. package/lib/chain/blocks/blockInput/types.d.ts +5 -0
  6. package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
  7. package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
  8. package/lib/chain/blocks/writeBlockInputToDb.js +1 -12
  9. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  10. package/lib/chain/chain.d.ts +1 -1
  11. package/lib/chain/chain.js +2 -1
  12. package/lib/chain/chain.js.map +1 -1
  13. package/lib/chain/errors/executionPayloadBid.d.ts +1 -1
  14. package/lib/chain/errors/payloadAttestation.d.ts +1 -1
  15. package/lib/chain/produceBlock/computeNewStateRoot.d.ts +0 -1
  16. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  17. package/lib/chain/produceBlock/computeNewStateRoot.js +4 -3
  18. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  19. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +5 -1
  20. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  21. package/lib/chain/seenCache/seenGossipBlockInput.js +21 -8
  22. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  23. package/lib/db/index.d.ts +1 -0
  24. package/lib/db/index.d.ts.map +1 -1
  25. package/lib/db/index.js +1 -0
  26. package/lib/db/index.js.map +1 -1
  27. package/lib/metrics/metrics/lodestar.d.ts +1 -0
  28. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  29. package/lib/metrics/metrics/lodestar.js +4 -0
  30. package/lib/metrics/metrics/lodestar.js.map +1 -1
  31. package/lib/network/network.d.ts.map +1 -1
  32. package/lib/network/network.js +1 -1
  33. package/lib/network/network.js.map +1 -1
  34. package/lib/network/reqresp/utils/collect.d.ts +1 -1
  35. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  36. package/lib/sync/utils/downloadByRoot.d.ts +1 -1
  37. package/lib/sync/utils/remoteSyncType.d.ts +1 -1
  38. package/lib/util/serializedCache.d.ts +4 -4
  39. package/lib/util/serializedCache.d.ts.map +1 -1
  40. package/lib/util/serializedCache.js +6 -4
  41. package/lib/util/serializedCache.js.map +1 -1
  42. package/package.json +15 -15
  43. package/src/chain/blocks/blockInput/blockInput.ts +35 -0
  44. package/src/chain/blocks/blockInput/types.ts +5 -0
  45. package/src/chain/blocks/writeBlockInputToDb.ts +1 -18
  46. package/src/chain/chain.ts +6 -6
  47. package/src/chain/errors/executionPayloadBid.ts +1 -1
  48. package/src/chain/errors/payloadAttestation.ts +1 -1
  49. package/src/chain/produceBlock/computeNewStateRoot.ts +4 -3
  50. package/src/chain/seenCache/seenGossipBlockInput.ts +38 -10
  51. package/src/db/index.ts +1 -0
  52. package/src/metrics/metrics/lodestar.ts +4 -0
  53. package/src/network/network.ts +2 -1
  54. package/src/network/processor/gossipHandlers.ts +1 -1
  55. package/src/network/processor/gossipValidatorFn.ts +1 -1
  56. package/src/network/reqresp/ReqRespBeaconNode.ts +1 -1
  57. package/src/network/reqresp/handlers/beaconBlocksByRange.ts +1 -1
  58. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +1 -1
  59. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
  60. package/src/network/reqresp/utils/collect.ts +1 -1
  61. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +1 -1
  62. package/src/sync/utils/downloadByRoot.ts +1 -1
  63. package/src/sync/utils/remoteSyncType.ts +1 -1
  64. package/src/util/serializedCache.ts +7 -5
@@ -6,7 +6,7 @@ import {computeEpochAtSlot} from "@lodestar/state-transition";
6
6
  import {deneb, phase0} from "@lodestar/types";
7
7
  import {IBeaconChain} from "../../../chain/index.js";
8
8
  import {IBeaconDb} from "../../../db/index.js";
9
- import {prettyPrintPeerId} from "../../util.ts";
9
+ import {prettyPrintPeerId} from "../../util.js";
10
10
 
11
11
  // TODO: Unit test
12
12
 
@@ -7,7 +7,7 @@ import {ColumnIndex, fulu} from "@lodestar/types";
7
7
  import {fromHex} from "@lodestar/utils";
8
8
  import {IBeaconChain} from "../../../chain/index.js";
9
9
  import {IBeaconDb} from "../../../db/index.js";
10
- import {prettyPrintPeerId} from "../../util.ts";
10
+ import {prettyPrintPeerId} from "../../util.js";
11
11
  import {
12
12
  handleColumnSidecarUnavailability,
13
13
  validateRequestedDataColumns,
@@ -6,7 +6,7 @@ import {toRootHex} from "@lodestar/utils";
6
6
  import {IBeaconChain} from "../../../chain/index.js";
7
7
  import {IBeaconDb} from "../../../db/index.js";
8
8
  import {DataColumnSidecarsByRootRequest} from "../../../util/types.js";
9
- import {prettyPrintPeerId} from "../../util.ts";
9
+ import {prettyPrintPeerId} from "../../util.js";
10
10
  import {
11
11
  handleColumnSidecarUnavailability,
12
12
  validateRequestedDataColumns,
@@ -1,6 +1,6 @@
1
1
  import {Type} from "@chainsafe/ssz";
2
2
  import {RequestError, RequestErrorCode, ResponseIncoming} from "@lodestar/reqresp";
3
- import {SerializedCache} from "../../../util/serializedCache.ts";
3
+ import {SerializedCache} from "../../../util/serializedCache.js";
4
4
  import {ResponseTypeGetter} from "../types.js";
5
5
 
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import {ResponseIncoming} from "@lodestar/reqresp";
2
2
  import {SignedBeaconBlock, phase0} from "@lodestar/types";
3
3
  import {LodestarError} from "@lodestar/utils";
4
- import {SerializedCache} from "../../../util/serializedCache.ts";
4
+ import {SerializedCache} from "../../../util/serializedCache.js";
5
5
  import {ReqRespMethod, responseSszTypeByMethod} from "../types.js";
6
6
  import {sszDeserializeResponse} from "./collect.js";
7
7
 
@@ -6,7 +6,7 @@ import {LodestarError, byteArrayEquals, fromHex, prettyPrintIndices, toHex, toRo
6
6
  import {isBlockInputBlobs, isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
7
7
  import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types.js";
8
8
  import {ChainEventEmitter} from "../../chain/emitter.js";
9
- import {IBeaconChain} from "../../chain/interface.ts";
9
+ import {IBeaconChain} from "../../chain/interface.js";
10
10
  import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
11
11
  import {validateBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
12
12
  import {INetwork} from "../../network/interface.js";
@@ -1,7 +1,7 @@
1
1
  import {IForkChoice} from "@lodestar/fork-choice";
2
2
  import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
3
3
  import {Slot, Status} from "@lodestar/types";
4
- import {IBeaconChain} from "../../chain/interface.ts";
4
+ import {IBeaconChain} from "../../chain/interface.js";
5
5
  import {ChainTarget} from "../range/utils/index.js";
6
6
 
7
7
  /** The type of peer relative to our current state */
@@ -4,7 +4,7 @@
4
4
  * This is a thin wrapper around WeakMap
5
5
  */
6
6
  export class SerializedCache {
7
- map: WeakMap<object, Uint8Array> = new WeakMap();
7
+ private map: WeakMap<object, Uint8Array> = new WeakMap();
8
8
 
9
9
  get(obj: object): Uint8Array | undefined {
10
10
  return this.map.get(obj);
@@ -15,11 +15,13 @@ export class SerializedCache {
15
15
  }
16
16
 
17
17
  /**
18
- * Replace the internal WeakMap to force GC of all cached entries.
19
- * Must only be called after all DB writes that may read from this cache have completed,
18
+ * Delete cached serialized entries for the provided object references.
19
+ * Must only be called after all DB writes that read from this cache for these objects have completed,
20
20
  * otherwise cached serialized bytes will be unavailable and data will be re-serialized unnecessarily.
21
21
  */
22
- clear(): void {
23
- this.map = new WeakMap();
22
+ delete(objs: object[]): void {
23
+ for (const obj of objs) {
24
+ this.map.delete(obj);
25
+ }
24
26
  }
25
27
  }