@lodestar/beacon-node 1.51.0-dev.5e25b73306 → 1.51.0-dev.6375077e13
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/lib/api/impl/api.js +1 -1
- package/lib/api/impl/api.js.map +1 -1
- package/lib/api/impl/beacon/blocks/index.d.ts +2 -1
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +48 -95
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/index.d.ts +2 -1
- package/lib/api/impl/beacon/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/index.js +2 -2
- package/lib/api/impl/beacon/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +22 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/index.d.ts +6 -0
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +49 -31
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/options.d.ts +2 -0
- package/lib/api/options.d.ts.map +1 -1
- package/lib/api/options.js +1 -0
- package/lib/api/options.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +13 -2
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +69 -35
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +4 -4
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +4 -0
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +61 -97
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +9 -2
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +12 -4
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +11 -56
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +5 -241
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/errors.d.ts +2 -4
- package/lib/chain/blocks/blockInput/errors.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/errors.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +2 -18
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +0 -1
- package/lib/chain/blocks/blockInput/types.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +40 -56
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +10 -11
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +34 -19
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +4 -4
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +12 -9
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +24 -19
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +4 -20
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js +0 -24
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +18 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +14 -2
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +7 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +10 -5
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +3 -3
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +11 -6
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts +0 -2
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +6 -24
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/bls/interface.d.ts +2 -0
- package/lib/chain/bls/interface.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +1 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +50 -22
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/types.d.ts +1 -1
- package/lib/chain/bls/multithread/types.d.ts.map +1 -1
- package/lib/chain/bls/multithread/worker.js +1 -1
- package/lib/chain/bls/multithread/worker.js.map +1 -1
- package/lib/chain/bls/singleThread.js +1 -1
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.js +1 -1
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +25 -4
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +124 -43
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +7 -7
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -5
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +1 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +1 -1
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/errors/index.d.ts +0 -1
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +0 -1
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +11 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +11 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.d.ts +51 -0
- package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
- package/lib/chain/forkChoiceExecutionEngine.js +117 -0
- package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
- package/lib/chain/interface.d.ts +9 -7
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +17 -4
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +199 -46
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +1 -1
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +15 -4
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
- package/lib/chain/opPools/inclusionListStore.js +2 -2
- package/lib/chain/opPools/inclusionListStore.js.map +1 -1
- package/lib/chain/opPools/index.d.ts +1 -0
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +1 -0
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +17 -7
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/opPools/singleAttestationPool.d.ts +77 -0
- package/lib/chain/opPools/singleAttestationPool.d.ts.map +1 -0
- package/lib/chain/opPools/singleAttestationPool.js +209 -0
- package/lib/chain/opPools/singleAttestationPool.js.map +1 -0
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +1 -1
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +5 -3
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +3 -3
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/proposerTracker.d.ts +31 -0
- package/lib/chain/proposerTracker.d.ts.map +1 -0
- package/lib/chain/proposerTracker.js +75 -0
- package/lib/chain/proposerTracker.js.map +1 -0
- package/lib/chain/regen/interface.d.ts +1 -2
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +0 -1
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +1 -1
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +5 -3
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -14
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +6 -65
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +1 -1
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.js +1 -1
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +0 -15
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +13 -166
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/inclusionList.d.ts.map +1 -1
- package/lib/chain/validation/inclusionList.js +11 -2
- package/lib/chain/validation/inclusionList.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +16 -10
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +11 -0
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +1 -2
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +0 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/beacon.d.ts +7 -0
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +34 -0
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/dataColumnStore.d.ts +1 -1
- package/lib/db/dataColumnStore.d.ts.map +1 -1
- package/lib/db/dataColumnStore.js +1 -4
- package/lib/db/dataColumnStore.js.map +1 -1
- package/lib/db/flatFileStore/flatFileStore.js +5 -5
- package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
- package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
- package/lib/db/flatFileStore/slotIndex.js +2 -2
- package/lib/db/flatFileStore/slotIndex.js.map +1 -1
- package/lib/db/interface.d.ts +1 -0
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blobSidecars.d.ts +0 -1
- package/lib/db/repositories/blobSidecars.d.ts.map +1 -1
- package/lib/db/repositories/blobSidecars.js +0 -1
- package/lib/db/repositories/blobSidecars.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +6 -0
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +19 -0
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/execution/builder/apiClient.d.ts +14 -8
- package/lib/execution/builder/apiClient.d.ts.map +1 -1
- package/lib/execution/builder/apiClient.js +12 -10
- package/lib/execution/builder/apiClient.js.map +1 -1
- package/lib/execution/builder/http.d.ts +2 -0
- package/lib/execution/builder/http.d.ts.map +1 -1
- package/lib/execution/builder/http.js +2 -0
- package/lib/execution/builder/http.js.map +1 -1
- package/lib/execution/engine/blobVersionedHashes.d.ts +1 -1
- package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -1
- package/lib/execution/engine/blobVersionedHashes.js.map +1 -1
- package/lib/execution/engine/http.d.ts +4 -6
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +8 -11
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts +1 -1
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +1 -1
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +18 -6
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +2 -4
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.js +2 -12
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +0 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -8
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +1 -2
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +3 -3
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/restTransport.d.ts +2 -4
- package/lib/execution/engine/restTransport.d.ts.map +1 -1
- package/lib/execution/engine/restTransport.js +1 -15
- package/lib/execution/engine/restTransport.js.map +1 -1
- package/lib/execution/engine/sszTypes.d.ts +38 -47
- package/lib/execution/engine/sszTypes.d.ts.map +1 -1
- package/lib/execution/engine/sszTypes.js +0 -5
- package/lib/execution/engine/sszTypes.js.map +1 -1
- package/lib/execution/engine/transport.d.ts +1 -14
- package/lib/execution/engine/transport.d.ts.map +1 -1
- package/lib/execution/engine/types.d.ts +1 -9
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +9 -16
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js +3 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +0 -9
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +0 -30
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +33 -8
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +84 -18
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/server/http.js +5 -5
- package/lib/metrics/server/http.js.map +1 -1
- package/lib/monitoring/service.js +1 -1
- package/lib/monitoring/service.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +4 -1
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +7 -0
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorker.js +2 -0
- package/lib/network/core/networkCoreWorker.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +4 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +6 -0
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/core/types.d.ts +6 -1
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +1 -0
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +10 -0
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +1 -8
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +0 -1
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +6 -22
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +0 -23
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +4 -5
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +5 -1
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +8 -7
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +53 -35
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts +2 -0
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +2 -0
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +2 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +28 -1
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
- package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
- package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
- package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.js +8 -16
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/peers/utils/subnetMap.d.ts +5 -2
- package/lib/network/peers/utils/subnetMap.d.ts.map +1 -1
- package/lib/network/peers/utils/subnetMap.js +6 -3
- package/lib/network/peers/utils/subnetMap.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
- package/lib/network/processor/extractSlotRootFns.js +1 -8
- package/lib/network/processor/extractSlotRootFns.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +79 -149
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/index.js +0 -6
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +1 -5
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts +6 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +55 -29
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js +0 -3
- package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByHead.js +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +1 -12
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts +0 -2
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +0 -10
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
- package/lib/network/reqresp/rateLimit.js +1 -17
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +2 -8
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +1 -7
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/network/subnets/attnetsService.d.ts +35 -5
- package/lib/network/subnets/attnetsService.d.ts.map +1 -1
- package/lib/network/subnets/attnetsService.js +84 -6
- package/lib/network/subnets/attnetsService.js.map +1 -1
- package/lib/network/subnets/interface.d.ts +7 -0
- package/lib/network/subnets/interface.d.ts.map +1 -1
- package/lib/network/subnets/interface.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +47 -21
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/options.d.ts +3 -1
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +4 -2
- package/lib/node/options.js.map +1 -1
- package/lib/sync/interface.d.ts.map +1 -1
- package/lib/sync/interface.js.map +1 -1
- package/lib/sync/range/batch.d.ts +2 -3
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +9 -22
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +2 -15
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/sync.d.ts +15 -0
- package/lib/sync/sync.d.ts.map +1 -1
- package/lib/sync/sync.js +103 -25
- package/lib/sync/sync.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +43 -25
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +6 -34
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +24 -128
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +2 -18
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +14 -99
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/bitArray.d.ts +6 -6
- package/lib/util/bitArray.d.ts.map +1 -1
- package/lib/util/bitArray.js +25 -50
- package/lib/util/bitArray.js.map +1 -1
- package/lib/util/blobs.d.ts +1 -7
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js +0 -19
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/execution.d.ts +3 -4
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +1 -73
- package/lib/util/execution.js.map +1 -1
- package/lib/util/file.d.ts.map +1 -1
- package/lib/util/file.js +8 -9
- package/lib/util/file.js.map +1 -1
- package/lib/util/queue/itemQueue.js +1 -1
- package/lib/util/queue/itemQueue.js.map +1 -1
- package/lib/util/sszBytes.d.ts +5 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +36 -19
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/types.d.ts +0 -5
- package/lib/util/types.d.ts.map +1 -1
- package/lib/util/types.js +1 -2
- package/lib/util/types.js.map +1 -1
- package/package.json +32 -33
- package/src/api/impl/api.ts +1 -1
- package/src/api/impl/beacon/blocks/index.ts +81 -126
- package/src/api/impl/beacon/index.ts +3 -1
- package/src/api/impl/beacon/pool/index.ts +31 -1
- package/src/api/impl/beacon/state/utils.ts +1 -1
- package/src/api/impl/validator/index.ts +54 -37
- package/src/api/options.ts +3 -0
- package/src/chain/GetBlobsTracker.ts +82 -52
- package/src/chain/archiveStore/archiveStore.ts +6 -4
- package/src/chain/archiveStore/utils/archiveBlocks.ts +76 -130
- package/src/chain/archiveStore/utils/pruneHistory.ts +16 -6
- package/src/chain/blocks/blockInput/blockInput.ts +11 -343
- package/src/chain/blocks/blockInput/errors.ts +1 -2
- package/src/chain/blocks/blockInput/types.ts +2 -20
- package/src/chain/blocks/importBlock.ts +61 -76
- package/src/chain/blocks/importExecutionPayload.ts +57 -35
- package/src/chain/blocks/index.ts +11 -4
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +35 -24
- package/src/chain/blocks/types.ts +5 -31
- package/src/chain/blocks/verifyBlock.ts +31 -16
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +16 -2
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -6
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +10 -5
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +14 -6
- package/src/chain/blocks/writeBlockInputToDb.ts +6 -29
- package/src/chain/bls/interface.ts +2 -0
- package/src/chain/bls/multithread/index.ts +48 -24
- package/src/chain/bls/multithread/types.ts +1 -1
- package/src/chain/bls/multithread/worker.ts +1 -5
- package/src/chain/bls/singleThread.ts +1 -1
- package/src/chain/bls/utils.ts +1 -1
- package/src/chain/chain.ts +140 -42
- package/src/chain/emitter.ts +8 -8
- package/src/chain/errors/blockError.ts +1 -1
- package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
- package/src/chain/errors/index.ts +0 -1
- package/src/chain/forkChoice/index.ts +11 -0
- package/src/chain/forkChoiceExecutionEngine.ts +183 -0
- package/src/chain/interface.ts +9 -6
- package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
- package/src/chain/opPools/attestationPool.ts +16 -4
- package/src/chain/opPools/inclusionListStore.ts +3 -3
- package/src/chain/opPools/index.ts +1 -0
- package/src/chain/opPools/payloadAttestationPool.ts +18 -7
- package/src/chain/opPools/singleAttestationPool.ts +287 -0
- package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
- package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
- package/src/chain/opPools/utils.ts +1 -1
- package/src/chain/options.ts +5 -4
- package/src/chain/produceBlock/produceBlockBody.ts +7 -4
- package/src/chain/proposerTracker.ts +94 -0
- package/src/chain/regen/interface.ts +1 -2
- package/src/chain/regen/queued.ts +6 -4
- package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
- package/src/chain/validation/aggregateAndProof.ts +1 -1
- package/src/chain/validation/attestation.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +14 -193
- package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
- package/src/chain/validation/inclusionList.ts +11 -2
- package/src/chain/validation/syncCommittee.ts +31 -15
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +13 -0
- package/src/chain/validatorMonitor.ts +0 -6
- package/src/db/beacon.ts +44 -0
- package/src/db/dataColumnStore.ts +2 -4
- package/src/db/flatFileStore/flatFileStore.ts +7 -7
- package/src/db/flatFileStore/slotIndex.ts +4 -3
- package/src/db/interface.ts +2 -0
- package/src/db/repositories/blobSidecars.ts +0 -1
- package/src/db/repositories/dataColumnSidecarArchive.ts +20 -0
- package/src/execution/builder/apiClient.ts +16 -13
- package/src/execution/builder/http.ts +4 -0
- package/src/execution/engine/blobVersionedHashes.ts +1 -1
- package/src/execution/engine/http.ts +19 -43
- package/src/execution/engine/index.ts +1 -1
- package/src/execution/engine/interface.ts +19 -10
- package/src/execution/engine/jsonRpcTransport.ts +10 -22
- package/src/execution/engine/mock.ts +6 -11
- package/src/execution/engine/payloadIdCache.ts +6 -7
- package/src/execution/engine/restTransport.ts +3 -22
- package/src/execution/engine/sszTypes.ts +0 -9
- package/src/execution/engine/transport.ts +8 -17
- package/src/execution/engine/types.ts +11 -26
- package/src/execution/engine/utils.ts +4 -2
- package/src/index.ts +2 -0
- package/src/metrics/metrics/beacon.ts +0 -30
- package/src/metrics/metrics/lodestar.ts +85 -18
- package/src/metrics/server/http.ts +5 -5
- package/src/monitoring/service.ts +1 -1
- package/src/network/core/networkCore.ts +11 -1
- package/src/network/core/networkCoreWorker.ts +2 -0
- package/src/network/core/networkCoreWorkerHandler.ts +8 -1
- package/src/network/core/types.ts +6 -1
- package/src/network/gossip/gossipsub.ts +11 -0
- package/src/network/gossip/interface.ts +0 -5
- package/src/network/gossip/topic.ts +0 -25
- package/src/network/interface.ts +2 -5
- package/src/network/libp2p/index.ts +5 -1
- package/src/network/network.ts +55 -58
- package/src/network/options.ts +4 -0
- package/src/network/peers/peerManager.ts +28 -3
- package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
- package/src/network/peers/utils/prioritizePeers.ts +14 -22
- package/src/network/peers/utils/subnetMap.ts +6 -3
- package/src/network/processor/extractSlotRootFns.ts +0 -9
- package/src/network/processor/gossipHandlers.ts +99 -183
- package/src/network/processor/gossipQueues/index.ts +0 -6
- package/src/network/processor/gossipValidatorFn.ts +0 -5
- package/src/network/processor/index.ts +47 -27
- package/src/network/processor/types.ts +1 -1
- package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
- package/src/network/reqresp/handlers/beaconBlocksByHead.ts +1 -1
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -2
- package/src/network/reqresp/handlers/index.ts +0 -17
- package/src/network/reqresp/protocols.ts +0 -12
- package/src/network/reqresp/rateLimit.ts +1 -17
- package/src/network/reqresp/types.ts +0 -13
- package/src/network/subnets/attnetsService.ts +94 -6
- package/src/network/subnets/interface.ts +7 -0
- package/src/node/nodejs.ts +58 -22
- package/src/node/options.ts +9 -6
- package/src/sync/interface.ts +1 -0
- package/src/sync/range/batch.ts +9 -21
- package/src/sync/range/chain.ts +2 -14
- package/src/sync/sync.ts +108 -26
- package/src/sync/unknownBlock.ts +48 -36
- package/src/sync/utils/downloadByRange.ts +31 -230
- package/src/sync/utils/downloadByRoot.ts +15 -142
- package/src/util/bitArray.ts +22 -43
- package/src/util/blobs.ts +0 -34
- package/src/util/execution.ts +8 -102
- package/src/util/file.ts +8 -9
- package/src/util/queue/itemQueue.ts +1 -1
- package/src/util/sszBytes.ts +42 -24
- package/src/util/types.ts +1 -8
- package/lib/chain/errors/blobSidecarError.d.ts +0 -108
- package/lib/chain/errors/blobSidecarError.d.ts.map +0 -1
- package/lib/chain/errors/blobSidecarError.js +0 -38
- package/lib/chain/errors/blobSidecarError.js.map +0 -1
- package/lib/chain/validation/blobSidecar.d.ts +0 -16
- package/lib/chain/validation/blobSidecar.d.ts.map +0 -1
- package/lib/chain/validation/blobSidecar.js +0 -276
- package/lib/chain/validation/blobSidecar.js.map +0 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +0 -9
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +0 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +0 -91
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +0 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +0 -5
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +0 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +0 -46
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +0 -1
- package/src/chain/errors/blobSidecarError.ts +0 -70
- package/src/chain/validation/blobSidecar.ts +0 -357
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +0 -133
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +0 -69
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ForkPostFulu,
|
|
6
|
-
ForkPostGloas,
|
|
7
|
-
ForkPreFulu,
|
|
8
|
-
isForkPostDeneb,
|
|
9
|
-
isForkPostFulu,
|
|
10
|
-
isForkPostGloas,
|
|
11
|
-
} from "@lodestar/params";
|
|
12
|
-
import {BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
|
|
3
|
+
import {ForkPostFulu, ForkPostGloas, isForkPostFulu, isForkPostGloas} from "@lodestar/params";
|
|
4
|
+
import {ColumnIndex, SignedBeaconBlock, Slot, fulu} from "@lodestar/types";
|
|
13
5
|
import {LodestarError, byteArrayEquals, fromHex, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
|
|
14
|
-
import {
|
|
6
|
+
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
15
7
|
import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
16
8
|
import {PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
17
9
|
import {ChainEventEmitter} from "../../chain/emitter.js";
|
|
18
10
|
import {IBeaconChain} from "../../chain/interface.js";
|
|
19
|
-
import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
|
|
20
11
|
import {validateFuluBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
|
|
21
12
|
import {INetwork} from "../../network/interface.js";
|
|
22
13
|
import {PeerSyncMeta} from "../../network/peers/peersData.js";
|
|
@@ -46,12 +37,6 @@ export type FetchByRootAndValidateBlockProps = Omit<FetchByRootCoreProps, "peerM
|
|
|
46
37
|
peerIdStr: PeerIdStr;
|
|
47
38
|
blockRoot: Uint8Array;
|
|
48
39
|
};
|
|
49
|
-
export type FetchByRootAndValidateBlobsProps = FetchByRootAndValidateBlockProps & {
|
|
50
|
-
forkName: ForkPreFulu;
|
|
51
|
-
block: SignedBeaconBlock<ForkPostDeneb>;
|
|
52
|
-
blockRoot: Uint8Array;
|
|
53
|
-
missing: BlobIndex[];
|
|
54
|
-
};
|
|
55
40
|
export type FetchByRootAndValidateColumnsProps = FetchByRootCoreProps & {
|
|
56
41
|
blockRoot: Uint8Array;
|
|
57
42
|
forkName: ForkPostFulu;
|
|
@@ -60,7 +45,6 @@ export type FetchByRootAndValidateColumnsProps = FetchByRootCoreProps & {
|
|
|
60
45
|
};
|
|
61
46
|
export type FetchByRootResponses = {
|
|
62
47
|
block: SignedBeaconBlock;
|
|
63
|
-
blobSidecars?: deneb.BlobSidecars;
|
|
64
48
|
columnSidecars?: fulu.DataColumnSidecar[];
|
|
65
49
|
};
|
|
66
50
|
|
|
@@ -83,7 +67,7 @@ export async function downloadByRoot({
|
|
|
83
67
|
const {peerId: peerIdStr} = peerMeta;
|
|
84
68
|
|
|
85
69
|
const {
|
|
86
|
-
result: {block,
|
|
70
|
+
result: {block, columnSidecars},
|
|
87
71
|
warnings,
|
|
88
72
|
} = await fetchByRoot({
|
|
89
73
|
config,
|
|
@@ -130,44 +114,6 @@ export async function downloadByRoot({
|
|
|
130
114
|
|
|
131
115
|
const hasAllDataPreDownload = blockInput.hasBlockAndAllData();
|
|
132
116
|
|
|
133
|
-
if (isBlockInputBlobs(blockInput) && !hasAllDataPreDownload) {
|
|
134
|
-
// blobSidecars could be undefined if gossip resulted in full block+blobs so we don't download any
|
|
135
|
-
if (!blobSidecars) {
|
|
136
|
-
throw new DownloadByRootError({
|
|
137
|
-
code: DownloadByRootErrorCode.MISSING_BLOB_RESPONSE,
|
|
138
|
-
blockRoot: rootHex,
|
|
139
|
-
peer: peerIdStr,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
for (const blobSidecar of blobSidecars) {
|
|
143
|
-
if (blockInput.hasBlob(blobSidecar.index)) {
|
|
144
|
-
// the same BlobSidecar may be added by gossip while waiting for fetchByRoot
|
|
145
|
-
// TODO(fulu): add metric here to track this
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
blockInput.addBlob({
|
|
150
|
-
blobSidecar,
|
|
151
|
-
blockRootHex: rootHex,
|
|
152
|
-
seenTimestampSec: Date.now() / 1000,
|
|
153
|
-
source: BlockInputSource.byRoot,
|
|
154
|
-
peerIdStr,
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
if (emitter.listenerCount(routes.events.EventType.blobSidecar)) {
|
|
158
|
-
const versionedHashes = blockInput.getVersionedHashes();
|
|
159
|
-
|
|
160
|
-
emitter.emit(routes.events.EventType.blobSidecar, {
|
|
161
|
-
blockRoot: rootHex,
|
|
162
|
-
slot: blockInput.slot,
|
|
163
|
-
index: blobSidecar.index,
|
|
164
|
-
kzgCommitment: toHex(blobSidecar.kzgCommitment),
|
|
165
|
-
versionedHash: toHex(versionedHashes[blobSidecar.index]),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
117
|
if (isBlockInputColumns(blockInput) && !hasAllDataPreDownload) {
|
|
172
118
|
// columnSidecars could be undefined if gossip resulted in full block+columns so we don't download any
|
|
173
119
|
if (!columnSidecars) {
|
|
@@ -233,7 +179,6 @@ export async function fetchByRoot({
|
|
|
233
179
|
cacheItem,
|
|
234
180
|
}: FetchByRootProps): Promise<WarnResult<FetchByRootResponses, DownloadByRootError>> {
|
|
235
181
|
let block: SignedBeaconBlock;
|
|
236
|
-
let blobSidecars: deneb.BlobSidecars | undefined;
|
|
237
182
|
let columnSidecarResult: WarnResult<fulu.DataColumnSidecar[], DownloadByRootError> | undefined;
|
|
238
183
|
const {peerId: peerIdStr} = peerMeta;
|
|
239
184
|
|
|
@@ -250,31 +195,17 @@ export async function fetchByRoot({
|
|
|
250
195
|
}
|
|
251
196
|
|
|
252
197
|
const forkName = config.getForkName(block.message.slot);
|
|
253
|
-
if (!cacheItem.blockInput.hasAllData()) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
if (isBlockInputColumns(cacheItem.blockInput)) {
|
|
267
|
-
columnSidecarResult = await fetchAndValidateColumns({
|
|
268
|
-
config,
|
|
269
|
-
chain,
|
|
270
|
-
network,
|
|
271
|
-
peerMeta,
|
|
272
|
-
forkName: forkName as ForkPostFulu,
|
|
273
|
-
block: block as SignedBeaconBlock<ForkPostFulu>,
|
|
274
|
-
blockRoot,
|
|
275
|
-
missing: cacheItem.blockInput.getMissingSampledColumnMeta().missing,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
198
|
+
if (!cacheItem.blockInput.hasAllData() && isBlockInputColumns(cacheItem.blockInput)) {
|
|
199
|
+
columnSidecarResult = await fetchAndValidateColumns({
|
|
200
|
+
config,
|
|
201
|
+
chain,
|
|
202
|
+
network,
|
|
203
|
+
peerMeta,
|
|
204
|
+
forkName: forkName as ForkPostFulu,
|
|
205
|
+
block: block as SignedBeaconBlock<ForkPostFulu>,
|
|
206
|
+
blockRoot,
|
|
207
|
+
missing: cacheItem.blockInput.getMissingSampledColumnMeta().missing,
|
|
208
|
+
});
|
|
278
209
|
}
|
|
279
210
|
} else {
|
|
280
211
|
block = await fetchAndValidateBlock({
|
|
@@ -298,26 +229,12 @@ export async function fetchByRoot({
|
|
|
298
229
|
block: block as SignedBeaconBlock<ForkPostFulu>,
|
|
299
230
|
missing: network.custodyConfig.sampledColumns,
|
|
300
231
|
});
|
|
301
|
-
} else if (isForkPostDeneb(forkName)) {
|
|
302
|
-
const commitments = (block as SignedBeaconBlock<ForkPostDeneb & ForkPreFulu>).message.body.blobKzgCommitments;
|
|
303
|
-
const blobCount = commitments.length;
|
|
304
|
-
blobSidecars = await fetchAndValidateBlobs({
|
|
305
|
-
config,
|
|
306
|
-
chain,
|
|
307
|
-
network,
|
|
308
|
-
peerIdStr,
|
|
309
|
-
forkName: forkName as ForkPreFulu,
|
|
310
|
-
blockRoot,
|
|
311
|
-
block: block as SignedBeaconBlock<ForkPostDeneb>,
|
|
312
|
-
missing: Array.from({length: blobCount}, (_, i) => i),
|
|
313
|
-
});
|
|
314
232
|
}
|
|
315
233
|
}
|
|
316
234
|
|
|
317
235
|
return {
|
|
318
236
|
result: {
|
|
319
237
|
block,
|
|
320
|
-
blobSidecars,
|
|
321
238
|
columnSidecars: columnSidecarResult?.result,
|
|
322
239
|
},
|
|
323
240
|
warnings: columnSidecarResult?.warnings ?? null,
|
|
@@ -354,44 +271,6 @@ export async function fetchAndValidateBlock({
|
|
|
354
271
|
return block;
|
|
355
272
|
}
|
|
356
273
|
|
|
357
|
-
export async function fetchAndValidateBlobs({
|
|
358
|
-
chain,
|
|
359
|
-
network,
|
|
360
|
-
peerIdStr,
|
|
361
|
-
blockRoot,
|
|
362
|
-
block,
|
|
363
|
-
missing,
|
|
364
|
-
}: FetchByRootAndValidateBlobsProps): Promise<deneb.BlobSidecars> {
|
|
365
|
-
const blobSidecars: deneb.BlobSidecars = await fetchBlobsByRoot({
|
|
366
|
-
network,
|
|
367
|
-
peerIdStr,
|
|
368
|
-
blockRoot,
|
|
369
|
-
missing,
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
await validateBlockBlobSidecars(chain, block.message.slot, blockRoot, missing.length, blobSidecars);
|
|
373
|
-
|
|
374
|
-
return blobSidecars;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export async function fetchBlobsByRoot({
|
|
378
|
-
network,
|
|
379
|
-
peerIdStr,
|
|
380
|
-
blockRoot,
|
|
381
|
-
missing,
|
|
382
|
-
indicesInPossession = [],
|
|
383
|
-
}: Pick<FetchByRootAndValidateBlobsProps, "network" | "peerIdStr" | "blockRoot" | "missing"> & {
|
|
384
|
-
indicesInPossession?: number[];
|
|
385
|
-
}): Promise<deneb.BlobSidecars> {
|
|
386
|
-
const blobsRequest = missing
|
|
387
|
-
.filter((index) => !indicesInPossession.includes(index))
|
|
388
|
-
.map((index) => ({blockRoot, index}));
|
|
389
|
-
if (!blobsRequest.length) {
|
|
390
|
-
return [];
|
|
391
|
-
}
|
|
392
|
-
return await network.sendBlobSidecarsByRoot(peerIdStr, blobsRequest);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
274
|
export async function fetchAndValidateColumns({
|
|
396
275
|
chain,
|
|
397
276
|
network,
|
|
@@ -494,7 +373,6 @@ export enum DownloadByRootErrorCode {
|
|
|
494
373
|
INVALID_INCLUSION_PROOF = "DOWNLOAD_BY_ROOT_ERROR_INVALID_INCLUSION_PROOF",
|
|
495
374
|
INVALID_KZG_PROOF = "DOWNLOAD_BY_ROOT_ERROR_INVALID_KZG_PROOF",
|
|
496
375
|
MISSING_BLOCK_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_BLOCK_RESPONSE",
|
|
497
|
-
MISSING_BLOB_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_BLOB_RESPONSE",
|
|
498
376
|
MISSING_COLUMN_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_COLUMN_RESPONSE",
|
|
499
377
|
Z = "DOWNLOAD_BY_ROOT_ERROR_Z",
|
|
500
378
|
}
|
|
@@ -541,11 +419,6 @@ export type DownloadByRootErrorType =
|
|
|
541
419
|
peer: string;
|
|
542
420
|
blockRoot: string;
|
|
543
421
|
}
|
|
544
|
-
| {
|
|
545
|
-
code: DownloadByRootErrorCode.MISSING_BLOB_RESPONSE;
|
|
546
|
-
peer: string;
|
|
547
|
-
blockRoot: string;
|
|
548
|
-
}
|
|
549
422
|
| {
|
|
550
423
|
code: DownloadByRootErrorCode.MISSING_COLUMN_RESPONSE;
|
|
551
424
|
peer: string;
|
package/src/util/bitArray.ts
CHANGED
|
@@ -22,63 +22,42 @@ export enum IntersectResult {
|
|
|
22
22
|
* | 11110000 | 00001111 | A exclude B |
|
|
23
23
|
* | 11111100 | 00111111 | A intersect B |
|
|
24
24
|
*
|
|
25
|
-
* For all bytes in BitArray:
|
|
26
|
-
* - equals =
|
|
27
|
-
* -
|
|
28
|
-
* -
|
|
29
|
-
* -
|
|
30
|
-
* - intersect =
|
|
25
|
+
* For all bytes in BitArray, bytes missing from the shorter array count as zero:
|
|
26
|
+
* - equals = neither has a bit the other lacks
|
|
27
|
+
* - superset = only A has bits B lacks
|
|
28
|
+
* - subset = only B has bits A lacks
|
|
29
|
+
* - exclude = both have bits the other lacks, none shared
|
|
30
|
+
* - intersect = both have bits the other lacks, some shared
|
|
31
31
|
*/
|
|
32
32
|
export function intersectUint8Arrays(aUA: Uint8Array, bUA: Uint8Array): IntersectResult {
|
|
33
|
-
const len = aUA.length;
|
|
33
|
+
const len = Math.max(aUA.length, bUA.length);
|
|
34
34
|
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
let
|
|
38
|
-
let someSubset = false;
|
|
35
|
+
let aHasExtra = false;
|
|
36
|
+
let bHasExtra = false;
|
|
37
|
+
let hasShared = false;
|
|
39
38
|
|
|
40
39
|
for (let i = 0; i < len; i++) {
|
|
41
|
-
const a = aUA[i];
|
|
42
|
-
const b = bUA[i];
|
|
40
|
+
const a = aUA[i] ?? 0;
|
|
41
|
+
const b = bUA[i] ?? 0;
|
|
43
42
|
|
|
44
|
-
if (a
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else if ((a & b) === 0) {
|
|
50
|
-
// A excludes B
|
|
51
|
-
someExcludes = true;
|
|
52
|
-
} else if ((a & b) === b) {
|
|
53
|
-
// A superset B
|
|
54
|
-
if (someSubset) return IntersectResult.Intersect;
|
|
55
|
-
someSuperset = true;
|
|
56
|
-
} else if ((a & b) === a) {
|
|
57
|
-
// A subset B
|
|
58
|
-
if (someSuperset) return IntersectResult.Intersect;
|
|
59
|
-
someSubset = true;
|
|
60
|
-
} else {
|
|
61
|
-
// A diff B
|
|
62
|
-
return IntersectResult.Intersect;
|
|
63
|
-
}
|
|
43
|
+
if ((a & b) !== 0) hasShared = true;
|
|
44
|
+
if ((a & ~b) !== 0) aHasExtra = true;
|
|
45
|
+
if ((b & ~a) !== 0) bHasExtra = true;
|
|
46
|
+
|
|
47
|
+
if (aHasExtra && bHasExtra && hasShared) return IntersectResult.Intersect;
|
|
64
48
|
}
|
|
65
49
|
|
|
66
|
-
|
|
67
|
-
if (!
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// superset = MUST superset MAYBE equal
|
|
71
|
-
if (!someExcludes && someSuperset && !someSubset) return IntersectResult.Superset;
|
|
72
|
-
// subset = MUST subset MAYBE equal
|
|
73
|
-
if (!someExcludes && !someSuperset && someSubset) return IntersectResult.Subset;
|
|
74
|
-
// intersect = any other condition
|
|
75
|
-
return IntersectResult.Intersect;
|
|
50
|
+
if (!aHasExtra && !bHasExtra) return IntersectResult.Equal;
|
|
51
|
+
if (!bHasExtra) return IntersectResult.Superset;
|
|
52
|
+
if (!aHasExtra) return IntersectResult.Subset;
|
|
53
|
+
return hasShared ? IntersectResult.Intersect : IntersectResult.Exclusive;
|
|
76
54
|
}
|
|
77
55
|
|
|
78
56
|
/**
|
|
79
57
|
* Check if first BitArray is equal to or superset of the second
|
|
80
58
|
*/
|
|
81
59
|
export function isSuperSetOrEqual(superSet: BitArray, toCheck: BitArray): boolean {
|
|
60
|
+
if (superSet.bitLen !== toCheck.bitLen) return false;
|
|
82
61
|
const intersectionResult = intersectUint8Arrays(superSet.uint8Array, toCheck.uint8Array);
|
|
83
62
|
return intersectionResult === IntersectResult.Superset || intersectionResult === IntersectResult.Equal;
|
|
84
63
|
}
|
package/src/util/blobs.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {digest as sha256Digest} from "@chainsafe/as-sha256";
|
|
2
2
|
import {Tree} from "@chainsafe/persistent-merkle-tree";
|
|
3
|
-
import {ChainForkConfig} from "@lodestar/config";
|
|
4
3
|
import {
|
|
5
4
|
BYTES_PER_CELL,
|
|
6
5
|
BYTES_PER_FIELD_ELEMENT,
|
|
@@ -12,12 +11,10 @@ import {
|
|
|
12
11
|
NUMBER_OF_COLUMNS,
|
|
13
12
|
VERSIONED_HASH_VERSION_KZG,
|
|
14
13
|
} from "@lodestar/params";
|
|
15
|
-
import {signedBlockToSignedHeader} from "@lodestar/state-transition";
|
|
16
14
|
import {
|
|
17
15
|
BeaconBlockBody,
|
|
18
16
|
DataColumnSidecar,
|
|
19
17
|
SSZTypesFor,
|
|
20
|
-
SignedBeaconBlock,
|
|
21
18
|
deneb,
|
|
22
19
|
fulu,
|
|
23
20
|
gloas,
|
|
@@ -45,37 +42,6 @@ export function computePreFuluKzgCommitmentsInclusionProof(
|
|
|
45
42
|
return new Tree(bodyView.node).getSingleProof(BigInt(commitmentGindex));
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
/**
|
|
49
|
-
* SPEC FUNCTION get_blob_sidecars
|
|
50
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/deneb/validator.md#sidecar
|
|
51
|
-
*/
|
|
52
|
-
export function getBlobSidecars(
|
|
53
|
-
config: ChainForkConfig,
|
|
54
|
-
signedBlock: SignedBeaconBlock,
|
|
55
|
-
blobs: deneb.Blobs,
|
|
56
|
-
proofs: deneb.KZGProofs
|
|
57
|
-
): deneb.BlobSidecars {
|
|
58
|
-
const blobKzgCommitments = (signedBlock as deneb.SignedBeaconBlock).message.body.blobKzgCommitments;
|
|
59
|
-
if (blobKzgCommitments === undefined) {
|
|
60
|
-
throw Error("Invalid block with missing blobKzgCommitments for computeBlobSidecars");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const signedBlockHeader = signedBlockToSignedHeader(config, signedBlock);
|
|
64
|
-
const fork = config.getForkName(signedBlockHeader.message.slot);
|
|
65
|
-
|
|
66
|
-
return blobKzgCommitments.map((kzgCommitment, index) => {
|
|
67
|
-
const blob = blobs[index];
|
|
68
|
-
const kzgProof = proofs[index];
|
|
69
|
-
const kzgCommitmentInclusionProof = computePreFuluKzgCommitmentsInclusionProof(
|
|
70
|
-
fork,
|
|
71
|
-
signedBlock.message.body,
|
|
72
|
-
index
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return {index, blob, kzgCommitment, kzgProof, signedBlockHeader, kzgCommitmentInclusionProof};
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
45
|
/**
|
|
80
46
|
* If the node obtains 50%+ of all the columns, it SHOULD reconstruct the full data matrix via the recover_matrix helper
|
|
81
47
|
* See https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/das-core.md#recover_matrix
|
package/src/util/execution.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {ForkPostFulu
|
|
4
|
-
import {
|
|
5
|
-
import {DataColumnSidecar, SignedBeaconBlock, Slot, deneb, gloas, isGloasDataColumnSidecar, ssz} from "@lodestar/types";
|
|
3
|
+
import {ForkPostFulu} from "@lodestar/params";
|
|
4
|
+
import {DataColumnSidecar, SignedBeaconBlock, Slot, gloas, isGloasDataColumnSidecar, ssz} from "@lodestar/types";
|
|
6
5
|
import {Logger, fromHex, toHex, toRootHex} from "@lodestar/utils";
|
|
7
|
-
import {
|
|
6
|
+
import {isBlockInputColumns} from "../chain/blocks/blockInput/blockInput.js";
|
|
8
7
|
import {BlockInputSource, IBlockInput} from "../chain/blocks/blockInput/types.js";
|
|
9
8
|
import {PayloadEnvelopeInput, PayloadEnvelopeInputSource} from "../chain/blocks/payloadEnvelopeInput/index.js";
|
|
10
9
|
import {ChainEvent, ChainEventEmitter} from "../chain/emitter.js";
|
|
@@ -16,7 +15,6 @@ import {IBeaconDb} from "../db/index.js";
|
|
|
16
15
|
import {ArchivedEnvelope, decodeArchivedEnvelope} from "../db/repositories/index.js";
|
|
17
16
|
import {IExecutionEngine} from "../execution/index.js";
|
|
18
17
|
import {Metrics} from "../metrics/index.js";
|
|
19
|
-
import {computePreFuluKzgCommitmentsInclusionProof} from "./blobs.js";
|
|
20
18
|
import {
|
|
21
19
|
getCellsAndProofs,
|
|
22
20
|
getDataColumnSidecarsFromBlock,
|
|
@@ -40,98 +38,6 @@ export enum DataColumnEngineResult {
|
|
|
40
38
|
Failed = "failed",
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
export async function getBlobSidecarsFromExecution(
|
|
44
|
-
config: ChainForkConfig,
|
|
45
|
-
executionEngine: IExecutionEngine,
|
|
46
|
-
metrics: Metrics | null,
|
|
47
|
-
emitter: ChainEventEmitter,
|
|
48
|
-
blockInput: IBlockInput
|
|
49
|
-
) {
|
|
50
|
-
if (!isBlockInputBlobs(blockInput)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (blockInput.hasAllData()) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const forkName = blockInput.forkName as ForkPreFulu;
|
|
59
|
-
const blobMeta = blockInput.getMissingBlobMeta();
|
|
60
|
-
|
|
61
|
-
metrics?.blobs.getBlobsV1Requests.inc();
|
|
62
|
-
metrics?.blobs.getBlobsV1RequestedBlobCount.inc(blobMeta.length);
|
|
63
|
-
const enginedResponse = await executionEngine
|
|
64
|
-
.getBlobs(
|
|
65
|
-
forkName,
|
|
66
|
-
blobMeta.map(({versionedHash}) => versionedHash)
|
|
67
|
-
)
|
|
68
|
-
.catch((_e) => {
|
|
69
|
-
// TODO(fulu): this should only count as a single error? need to update the promql to reflect this
|
|
70
|
-
metrics?.blobs.getBlobsV1Error.inc(blobMeta.length);
|
|
71
|
-
return null;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
if (enginedResponse === null) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const block = blockInput.getBlock();
|
|
79
|
-
|
|
80
|
-
const blobSidecars: deneb.BlobSidecars = [];
|
|
81
|
-
// response.length should always match blobMeta.length and they should be in the same order
|
|
82
|
-
for (let i = 0; i < blobMeta.length; i++) {
|
|
83
|
-
const blobAndProof = enginedResponse[i];
|
|
84
|
-
|
|
85
|
-
if (!blobAndProof) {
|
|
86
|
-
metrics?.blobs.getBlobsV1Miss.inc();
|
|
87
|
-
} else {
|
|
88
|
-
metrics?.blobs.getBlobsV1Hit.inc();
|
|
89
|
-
|
|
90
|
-
if (blockInput.hasBlob(blobMeta[i].index)) {
|
|
91
|
-
// blob arrived and was cached while waiting for API response
|
|
92
|
-
metrics?.blobs.getBlobsV1HitButArrivedWhileWaiting.inc();
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
metrics?.blobs.getBlobsV1HitUseful.inc();
|
|
97
|
-
const {blob, proof} = blobAndProof;
|
|
98
|
-
const index = blobMeta[i].index;
|
|
99
|
-
const kzgCommitment = block.message.body.blobKzgCommitments[index];
|
|
100
|
-
const blobSidecar: deneb.BlobSidecar = {
|
|
101
|
-
index,
|
|
102
|
-
blob,
|
|
103
|
-
kzgProof: proof,
|
|
104
|
-
kzgCommitment,
|
|
105
|
-
// TODO(fulu): refactor this to only calculate the root inside these following two functions once
|
|
106
|
-
kzgCommitmentInclusionProof: computePreFuluKzgCommitmentsInclusionProof(forkName, block.message.body, index),
|
|
107
|
-
signedBlockHeader: signedBlockToSignedHeader(config, block),
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
blockInput.addBlob({
|
|
111
|
-
blobSidecar,
|
|
112
|
-
blockRootHex: blockInput.blockRootHex,
|
|
113
|
-
seenTimestampSec: Date.now() / 1000,
|
|
114
|
-
source: BlockInputSource.engine,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
if (emitter.listenerCount(routes.events.EventType.blobSidecar)) {
|
|
118
|
-
emitter.emit(routes.events.EventType.blobSidecar, {
|
|
119
|
-
blockRoot: blockInput.blockRootHex,
|
|
120
|
-
slot: blockInput.slot,
|
|
121
|
-
index,
|
|
122
|
-
kzgCommitment: toHex(kzgCommitment),
|
|
123
|
-
versionedHash: toHex(blobMeta[i].versionedHash),
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
blobSidecars.push(blobSidecar);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
emitter.emit(ChainEvent.publishBlobSidecars, blobSidecars);
|
|
132
|
-
metrics?.gossipBlob.publishedFromEngine.inc(blobSidecars.length);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
41
|
/**
|
|
136
42
|
* Call getBlobsV2 from execution engine once per slot to fetch blobs and compute data columns.
|
|
137
43
|
*
|
|
@@ -140,7 +46,7 @@ export async function getBlobSidecarsFromExecution(
|
|
|
140
46
|
*/
|
|
141
47
|
export async function getDataColumnSidecarsFromExecution(
|
|
142
48
|
config: ChainForkConfig,
|
|
143
|
-
executionEngine: IExecutionEngine,
|
|
49
|
+
executionEngine: Pick<IExecutionEngine, "getBlobs">,
|
|
144
50
|
emitter: ChainEventEmitter,
|
|
145
51
|
input: IBlockInput | PayloadEnvelopeInput,
|
|
146
52
|
metrics: Metrics | null,
|
|
@@ -289,7 +195,7 @@ export type RebuildMiss = {slot: Slot; reason: "unavailable" | "mismatch"; error
|
|
|
289
195
|
*/
|
|
290
196
|
export async function* reconstructExecutionPayloadEnvelopesByRange(
|
|
291
197
|
db: IBeaconDb,
|
|
292
|
-
executionEngine: IExecutionEngine,
|
|
198
|
+
executionEngine: Pick<IExecutionEngine, "getPayloadBodiesByHashV2">,
|
|
293
199
|
logger: Logger,
|
|
294
200
|
metrics: Metrics | null,
|
|
295
201
|
startSlot: Slot,
|
|
@@ -315,7 +221,7 @@ export async function* reconstructExecutionPayloadEnvelopesByRange(
|
|
|
315
221
|
* RANGE_UNSERVABLE for it
|
|
316
222
|
*/
|
|
317
223
|
async function* reconstructBatch(
|
|
318
|
-
executionEngine: IExecutionEngine,
|
|
224
|
+
executionEngine: Pick<IExecutionEngine, "getPayloadBodiesByHashV2">,
|
|
319
225
|
logger: Logger,
|
|
320
226
|
metrics: Metrics | null,
|
|
321
227
|
batch: RangeEntry[]
|
|
@@ -355,7 +261,7 @@ async function* reconstructBatch(
|
|
|
355
261
|
* on its path. Throws ENGINE_UNAVAILABLE only.
|
|
356
262
|
*/
|
|
357
263
|
export async function reconstructExecutionPayloadEnvelopes(
|
|
358
|
-
executionEngine: IExecutionEngine,
|
|
264
|
+
executionEngine: Pick<IExecutionEngine, "getPayloadBodiesByHashV2">,
|
|
359
265
|
metrics: Metrics | null,
|
|
360
266
|
headerEnvelopes: gloas.SignedExecutionPayloadHeaderEnvelope[]
|
|
361
267
|
): Promise<(gloas.SignedExecutionPayloadEnvelope | RebuildMiss)[]> {
|
|
@@ -382,7 +288,7 @@ export function isRebuildMiss(result: gloas.SignedExecutionPayloadEnvelope | Reb
|
|
|
382
288
|
* incremented once, in this function.
|
|
383
289
|
*/
|
|
384
290
|
async function reconstructEnvelopesBatch(
|
|
385
|
-
executionEngine: IExecutionEngine,
|
|
291
|
+
executionEngine: Pick<IExecutionEngine, "getPayloadBodiesByHashV2">,
|
|
386
292
|
metrics: Metrics | null,
|
|
387
293
|
headerEnvelopes: gloas.SignedExecutionPayloadHeaderEnvelope[]
|
|
388
294
|
): Promise<(gloas.SignedExecutionPayloadEnvelope | RebuildMiss)[]> {
|
package/src/util/file.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {promisify} from "node:util";
|
|
1
|
+
import {readFile as fsReadFile, mkdir, readdir, stat, unlink, writeFile} from "node:fs/promises";
|
|
3
2
|
|
|
4
3
|
/** Ensure a directory exists */
|
|
5
4
|
export async function ensureDir(path: string): Promise<void> {
|
|
6
5
|
try {
|
|
7
|
-
await
|
|
6
|
+
await stat(path);
|
|
8
7
|
} catch (_) {
|
|
9
8
|
// not exists
|
|
10
|
-
await
|
|
9
|
+
await mkdir(path, {recursive: true});
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
/** Write data to a file if it does not exist */
|
|
15
14
|
export async function writeIfNotExist(filepath: string, bytes: Uint8Array): Promise<boolean> {
|
|
16
15
|
try {
|
|
17
|
-
await
|
|
16
|
+
await stat(filepath);
|
|
18
17
|
return false;
|
|
19
18
|
// file exists, do nothing
|
|
20
19
|
} catch (_) {
|
|
21
20
|
// not exists
|
|
22
|
-
await
|
|
21
|
+
await writeFile(filepath, bytes);
|
|
23
22
|
return true;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
@@ -27,7 +26,7 @@ export async function writeIfNotExist(filepath: string, bytes: Uint8Array): Prom
|
|
|
27
26
|
/** Remove a file if it exists */
|
|
28
27
|
export async function removeFile(path: string): Promise<boolean> {
|
|
29
28
|
try {
|
|
30
|
-
await
|
|
29
|
+
await unlink(path);
|
|
31
30
|
return true;
|
|
32
31
|
} catch (_) {
|
|
33
32
|
// may not exists
|
|
@@ -37,7 +36,7 @@ export async function removeFile(path: string): Promise<boolean> {
|
|
|
37
36
|
|
|
38
37
|
export async function readFile(path: string): Promise<Uint8Array | null> {
|
|
39
38
|
try {
|
|
40
|
-
return await
|
|
39
|
+
return await fsReadFile(path);
|
|
41
40
|
} catch (_) {
|
|
42
41
|
return null;
|
|
43
42
|
}
|
|
@@ -45,7 +44,7 @@ export async function readFile(path: string): Promise<Uint8Array | null> {
|
|
|
45
44
|
|
|
46
45
|
export async function readFileNames(folderPath: string): Promise<string[]> {
|
|
47
46
|
try {
|
|
48
|
-
return await
|
|
47
|
+
return await readdir(folderPath);
|
|
49
48
|
} catch (_) {
|
|
50
49
|
return [];
|
|
51
50
|
}
|
|
@@ -69,7 +69,7 @@ export class JobItemQueue<Args extends any[], R> {
|
|
|
69
69
|
if (this.jobs.length === 1 && this.opts.noYieldIfOneItem) {
|
|
70
70
|
void this.runJob();
|
|
71
71
|
} else if (this.runningJobs < this.opts.maxConcurrency) {
|
|
72
|
-
callInNextEventLoop(this.runJob);
|
|
72
|
+
callInNextEventLoop(() => void this.runJob());
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|