@lodestar/beacon-node 1.51.0 → 1.52.0-dev.03eb33e6f1
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/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +99 -127
- package/lib/api/impl/beacon/blocks/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 +25 -3
- 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/beacon/state/utils.js +2 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +6 -2
- package/lib/api/impl/debug/index.js.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 +55 -32
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +4 -0
- package/lib/chain/ColumnReconstructionTracker.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/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +12 -0
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +17 -2
- 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 +19 -7
- 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 +8 -242
- 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 +36 -53
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +11 -12
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +56 -22
- 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 +5 -19
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +10 -7
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +22 -17
- 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 +29 -14
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +17 -5
- 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 +14 -8
- 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 +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +12 -6
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +2 -2
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +12 -7
- 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 +2 -2
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +31 -9
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +193 -64
- 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/attestationError.d.ts +15 -1
- package/lib/chain/errors/attestationError.d.ts.map +1 -1
- package/lib/chain/errors/attestationError.js +8 -0
- package/lib/chain/errors/attestationError.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/executionPayloadBid.d.ts +3 -2
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -1
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +55 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +8 -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 +8 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +8 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.d.ts +53 -0
- package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
- package/lib/chain/forkChoiceExecutionEngine.js +140 -0
- package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
- package/lib/chain/interface.d.ts +10 -8
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts +13 -6
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +95 -115
- package/lib/chain/lightClient/index.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 +4 -1
- package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
- package/lib/chain/opPools/inclusionListStore.js +5 -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/opPool.js +6 -6
- package/lib/chain/opPools/opPool.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 +2 -3
- 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 -2
- 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 -1
- package/lib/chain/regen/interface.d.ts.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/seenAttesters.d.ts +1 -0
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +1 -1
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
- package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
- package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
- package/lib/chain/seenCache/seenExecutionPayloadBids.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/shufflingCache.d.ts +5 -0
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +39 -1
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +38 -10
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +33 -17
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +9 -1
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +8 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +36 -46
- 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 +132 -4
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +9 -0
- package/lib/chain/validation/payloadAttestationMessage.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/dataColumnStore.d.ts +3 -2
- package/lib/db/dataColumnStore.d.ts.map +1 -1
- package/lib/db/dataColumnStore.js +3 -3
- package/lib/db/dataColumnStore.js.map +1 -1
- package/lib/db/flatFileStore/flatFileStore.d.ts +1 -1
- package/lib/db/flatFileStore/flatFileStore.d.ts.map +1 -1
- package/lib/db/flatFileStore/flatFileStore.js +10 -9
- package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
- package/lib/db/flatFileStore/interface.d.ts +2 -1
- package/lib/db/flatFileStore/interface.d.ts.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/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 +2 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +14 -4
- 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/http.d.ts +4 -6
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +8 -10
- 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 +0 -4
- package/lib/execution/engine/mock.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 +0 -9
- 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 +0 -8
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +2 -10
- 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 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +4 -9
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +11 -32
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +32 -8
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +116 -46
- 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 +23 -6
- 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 +1 -23
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +0 -36
- 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 +9 -7
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +73 -46
- 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 +72 -138
- 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 +4 -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 +33 -6
- 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/reqresp/utils/collect.d.ts +4 -4
- package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
- package/lib/network/reqresp/utils/collect.js +9 -8
- package/lib/network/reqresp/utils/collect.js.map +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.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 +38 -20
- 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 +8 -3
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +26 -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 +10 -16
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +43 -3
- package/lib/sync/range/range.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/types.d.ts +12 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +2 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +28 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +257 -31
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +20 -35
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +36 -130
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +23 -17
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +57 -100
- 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/eventLoop.d.ts +5 -0
- package/lib/util/eventLoop.d.ts.map +1 -1
- package/lib/util/eventLoop.js +7 -0
- package/lib/util/eventLoop.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 +27 -28
- package/src/api/impl/beacon/blocks/index.ts +133 -156
- package/src/api/impl/beacon/pool/index.ts +40 -8
- package/src/api/impl/beacon/state/utils.ts +3 -2
- package/src/api/impl/debug/index.ts +6 -2
- package/src/api/impl/validator/index.ts +62 -36
- package/src/chain/ColumnReconstructionTracker.ts +5 -0
- package/src/chain/GetBlobsTracker.ts +82 -52
- package/src/chain/archiveStore/archiveStore.ts +6 -4
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
- package/src/chain/archiveStore/utils/archiveBlocks.ts +21 -2
- package/src/chain/archiveStore/utils/pruneHistory.ts +24 -9
- package/src/chain/blocks/blockInput/blockInput.ts +15 -344
- package/src/chain/blocks/blockInput/errors.ts +1 -2
- package/src/chain/blocks/blockInput/types.ts +2 -20
- package/src/chain/blocks/importBlock.ts +56 -72
- package/src/chain/blocks/importExecutionPayload.ts +85 -38
- package/src/chain/blocks/index.ts +8 -33
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +33 -22
- package/src/chain/blocks/types.ts +5 -31
- package/src/chain/blocks/verifyBlock.ts +47 -26
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +20 -6
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +16 -10
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +13 -5
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +16 -8
- 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 +2 -2
- package/src/chain/chain.ts +243 -81
- package/src/chain/emitter.ts +8 -8
- package/src/chain/errors/attestationError.ts +11 -1
- package/src/chain/errors/blockError.ts +1 -1
- package/src/chain/errors/executionPayloadBid.ts +3 -2
- package/src/chain/errors/executionPayloadEnvelope.ts +58 -0
- package/src/chain/errors/index.ts +0 -1
- package/src/chain/forkChoice/index.ts +8 -0
- package/src/chain/forkChoiceExecutionEngine.ts +216 -0
- package/src/chain/interface.ts +10 -7
- package/src/chain/lightClient/index.ts +108 -142
- package/src/chain/opPools/aggregatedAttestationPool.ts +246 -43
- package/src/chain/opPools/attestationPool.ts +16 -4
- package/src/chain/opPools/inclusionListStore.ts +5 -2
- package/src/chain/opPools/index.ts +1 -0
- package/src/chain/opPools/opPool.ts +6 -6
- 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 +7 -6
- package/src/chain/produceBlock/produceBlockBody.ts +7 -3
- package/src/chain/proposerTracker.ts +94 -0
- package/src/chain/regen/interface.ts +1 -1
- package/src/chain/regen/queued.ts +6 -4
- package/src/chain/seenCache/seenAttesters.ts +1 -1
- package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
- package/src/chain/seenCache/seenGossipBlockInput.ts +9 -93
- package/src/chain/shufflingCache.ts +40 -1
- package/src/chain/validation/aggregateAndProof.ts +44 -15
- package/src/chain/validation/attestation.ts +32 -21
- package/src/chain/validation/block.ts +9 -1
- package/src/chain/validation/dataColumnSidecar.ts +7 -1
- package/src/chain/validation/executionPayloadBid.ts +47 -48
- package/src/chain/validation/executionPayloadEnvelope.ts +155 -4
- package/src/chain/validation/payloadAttestationMessage.ts +10 -0
- 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/dataColumnStore.ts +5 -4
- package/src/db/flatFileStore/flatFileStore.ts +12 -11
- package/src/db/flatFileStore/interface.ts +2 -1
- package/src/db/flatFileStore/slotIndex.ts +4 -3
- package/src/db/repositories/blobSidecars.ts +0 -1
- package/src/db/repositories/dataColumnSidecarArchive.ts +14 -4
- package/src/execution/builder/apiClient.ts +16 -13
- package/src/execution/builder/http.ts +4 -0
- package/src/execution/engine/http.ts +19 -42
- 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 +0 -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 +3 -18
- package/src/execution/engine/utils.ts +4 -2
- package/src/index.ts +1 -1
- package/src/metrics/metrics/beacon.ts +11 -32
- package/src/metrics/metrics/lodestar.ts +117 -46
- 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 +24 -6
- package/src/network/gossip/interface.ts +0 -5
- package/src/network/gossip/topic.ts +1 -39
- package/src/network/interface.ts +2 -5
- package/src/network/libp2p/index.ts +5 -1
- package/src/network/network.ts +88 -69
- 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 +91 -178
- package/src/network/processor/gossipQueues/index.ts +0 -6
- package/src/network/processor/gossipValidatorFn.ts +4 -5
- package/src/network/processor/index.ts +32 -6
- 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/reqresp/utils/collect.ts +16 -8
- package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
- package/src/network/subnets/attnetsService.ts +94 -6
- package/src/network/subnets/interface.ts +7 -0
- package/src/node/nodejs.ts +40 -21
- package/src/node/options.ts +9 -6
- package/src/sync/interface.ts +1 -0
- package/src/sync/range/batch.ts +29 -21
- package/src/sync/range/chain.ts +10 -14
- package/src/sync/range/range.ts +56 -3
- package/src/sync/sync.ts +108 -26
- package/src/sync/types.ts +11 -0
- package/src/sync/unknownBlock.ts +296 -32
- package/src/sync/utils/downloadByRange.ts +60 -233
- package/src/sync/utils/downloadByRoot.ts +78 -139
- package/src/util/bitArray.ts +22 -43
- package/src/util/blobs.ts +0 -34
- package/src/util/eventLoop.ts +8 -0
- 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,14 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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 {getBlockProposerSignatureSet} from "@lodestar/state-transition";
|
|
5
|
+
import {ColumnIndex, SignedBeaconBlock, Slot, ValidatorIndex, fulu} from "@lodestar/types";
|
|
13
6
|
import {LodestarError, byteArrayEquals, fromHex, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
|
|
14
|
-
import {
|
|
7
|
+
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
15
8
|
import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
16
9
|
import {PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
17
10
|
import {ChainEventEmitter} from "../../chain/emitter.js";
|
|
18
11
|
import {IBeaconChain} from "../../chain/interface.js";
|
|
19
|
-
import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
|
|
20
12
|
import {validateFuluBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
|
|
21
13
|
import {INetwork} from "../../network/interface.js";
|
|
22
14
|
import {PeerSyncMeta} from "../../network/peers/peersData.js";
|
|
@@ -39,19 +31,15 @@ export type FetchByRootCoreProps = {
|
|
|
39
31
|
peerMeta: PeerSyncMeta;
|
|
40
32
|
};
|
|
41
33
|
export type FetchByRootProps = FetchByRootCoreProps & {
|
|
34
|
+
chain: IBeaconChain;
|
|
42
35
|
cacheItem: BlockInputSyncCacheItem;
|
|
43
36
|
blockRoot: Uint8Array;
|
|
44
37
|
};
|
|
45
38
|
export type FetchByRootAndValidateBlockProps = Omit<FetchByRootCoreProps, "peerMeta"> & {
|
|
39
|
+
chain: IBeaconChain;
|
|
46
40
|
peerIdStr: PeerIdStr;
|
|
47
41
|
blockRoot: Uint8Array;
|
|
48
42
|
};
|
|
49
|
-
export type FetchByRootAndValidateBlobsProps = FetchByRootAndValidateBlockProps & {
|
|
50
|
-
forkName: ForkPreFulu;
|
|
51
|
-
block: SignedBeaconBlock<ForkPostDeneb>;
|
|
52
|
-
blockRoot: Uint8Array;
|
|
53
|
-
missing: BlobIndex[];
|
|
54
|
-
};
|
|
55
43
|
export type FetchByRootAndValidateColumnsProps = FetchByRootCoreProps & {
|
|
56
44
|
blockRoot: Uint8Array;
|
|
57
45
|
forkName: ForkPostFulu;
|
|
@@ -60,7 +48,6 @@ export type FetchByRootAndValidateColumnsProps = FetchByRootCoreProps & {
|
|
|
60
48
|
};
|
|
61
49
|
export type FetchByRootResponses = {
|
|
62
50
|
block: SignedBeaconBlock;
|
|
63
|
-
blobSidecars?: deneb.BlobSidecars;
|
|
64
51
|
columnSidecars?: fulu.DataColumnSidecar[];
|
|
65
52
|
};
|
|
66
53
|
|
|
@@ -83,7 +70,7 @@ export async function downloadByRoot({
|
|
|
83
70
|
const {peerId: peerIdStr} = peerMeta;
|
|
84
71
|
|
|
85
72
|
const {
|
|
86
|
-
result: {block,
|
|
73
|
+
result: {block, columnSidecars},
|
|
87
74
|
warnings,
|
|
88
75
|
} = await fetchByRoot({
|
|
89
76
|
config,
|
|
@@ -130,44 +117,6 @@ export async function downloadByRoot({
|
|
|
130
117
|
|
|
131
118
|
const hasAllDataPreDownload = blockInput.hasBlockAndAllData();
|
|
132
119
|
|
|
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
120
|
if (isBlockInputColumns(blockInput) && !hasAllDataPreDownload) {
|
|
172
121
|
// columnSidecars could be undefined if gossip resulted in full block+columns so we don't download any
|
|
173
122
|
if (!columnSidecars) {
|
|
@@ -219,6 +168,8 @@ export async function downloadByRoot({
|
|
|
219
168
|
timeSyncedSec,
|
|
220
169
|
timeAddedSec: cacheItem.timeAddedSec,
|
|
221
170
|
peerIdStrings: cacheItem.peerIdStrings,
|
|
171
|
+
retainedBy: isPendingBlockInput(cacheItem) ? cacheItem.retainedBy : undefined,
|
|
172
|
+
retainedBytes: isPendingBlockInput(cacheItem) ? cacheItem.retainedBytes : undefined,
|
|
222
173
|
},
|
|
223
174
|
warnings,
|
|
224
175
|
};
|
|
@@ -233,7 +184,6 @@ export async function fetchByRoot({
|
|
|
233
184
|
cacheItem,
|
|
234
185
|
}: FetchByRootProps): Promise<WarnResult<FetchByRootResponses, DownloadByRootError>> {
|
|
235
186
|
let block: SignedBeaconBlock;
|
|
236
|
-
let blobSidecars: deneb.BlobSidecars | undefined;
|
|
237
187
|
let columnSidecarResult: WarnResult<fulu.DataColumnSidecar[], DownloadByRootError> | undefined;
|
|
238
188
|
const {peerId: peerIdStr} = peerMeta;
|
|
239
189
|
|
|
@@ -243,6 +193,7 @@ export async function fetchByRoot({
|
|
|
243
193
|
} else {
|
|
244
194
|
block = await fetchAndValidateBlock({
|
|
245
195
|
config,
|
|
196
|
+
chain,
|
|
246
197
|
network,
|
|
247
198
|
peerIdStr,
|
|
248
199
|
blockRoot,
|
|
@@ -250,35 +201,22 @@ export async function fetchByRoot({
|
|
|
250
201
|
}
|
|
251
202
|
|
|
252
203
|
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
|
-
}
|
|
204
|
+
if (!cacheItem.blockInput.hasAllData() && isBlockInputColumns(cacheItem.blockInput)) {
|
|
205
|
+
columnSidecarResult = await fetchAndValidateColumns({
|
|
206
|
+
config,
|
|
207
|
+
chain,
|
|
208
|
+
network,
|
|
209
|
+
peerMeta,
|
|
210
|
+
forkName: forkName as ForkPostFulu,
|
|
211
|
+
block: block as SignedBeaconBlock<ForkPostFulu>,
|
|
212
|
+
blockRoot,
|
|
213
|
+
missing: cacheItem.blockInput.getMissingSampledColumnMeta().missing,
|
|
214
|
+
});
|
|
278
215
|
}
|
|
279
216
|
} else {
|
|
280
217
|
block = await fetchAndValidateBlock({
|
|
281
218
|
config,
|
|
219
|
+
chain,
|
|
282
220
|
network,
|
|
283
221
|
peerIdStr,
|
|
284
222
|
blockRoot,
|
|
@@ -298,26 +236,12 @@ export async function fetchByRoot({
|
|
|
298
236
|
block: block as SignedBeaconBlock<ForkPostFulu>,
|
|
299
237
|
missing: network.custodyConfig.sampledColumns,
|
|
300
238
|
});
|
|
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
239
|
}
|
|
315
240
|
}
|
|
316
241
|
|
|
317
242
|
return {
|
|
318
243
|
result: {
|
|
319
244
|
block,
|
|
320
|
-
blobSidecars,
|
|
321
245
|
columnSidecars: columnSidecarResult?.result,
|
|
322
246
|
},
|
|
323
247
|
warnings: columnSidecarResult?.warnings ?? null,
|
|
@@ -326,10 +250,11 @@ export async function fetchByRoot({
|
|
|
326
250
|
|
|
327
251
|
export async function fetchAndValidateBlock({
|
|
328
252
|
config,
|
|
253
|
+
chain,
|
|
329
254
|
network,
|
|
330
255
|
peerIdStr,
|
|
331
256
|
blockRoot,
|
|
332
|
-
}:
|
|
257
|
+
}: FetchByRootAndValidateBlockProps): Promise<SignedBeaconBlock> {
|
|
333
258
|
const response = await network.sendBeaconBlocksByRoot(peerIdStr, [blockRoot]);
|
|
334
259
|
const block = response.at(0);
|
|
335
260
|
if (!block) {
|
|
@@ -351,45 +276,42 @@ export async function fetchAndValidateBlock({
|
|
|
351
276
|
"block does not match requested root"
|
|
352
277
|
);
|
|
353
278
|
}
|
|
354
|
-
return block;
|
|
355
|
-
}
|
|
356
279
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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 [];
|
|
280
|
+
const blockRootHex = toRootHex(blockRoot);
|
|
281
|
+
const {slot, proposerIndex} = block.message;
|
|
282
|
+
// Before the signature check, honest peers serve the genesis block unsigned
|
|
283
|
+
const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
|
|
284
|
+
if (slot < finalizedSlot) {
|
|
285
|
+
throw new DownloadByRootError({
|
|
286
|
+
code: DownloadByRootErrorCode.BELOW_FINALIZED_SLOT,
|
|
287
|
+
peer: prettyPrintPeerIdStr(peerIdStr),
|
|
288
|
+
slot,
|
|
289
|
+
finalizedSlot,
|
|
290
|
+
blockRoot: blockRootHex,
|
|
291
|
+
});
|
|
391
292
|
}
|
|
392
|
-
|
|
293
|
+
if (proposerIndex >= chain.pubkeyCache.size) {
|
|
294
|
+
throw new DownloadByRootError({
|
|
295
|
+
code: DownloadByRootErrorCode.UNKNOWN_PROPOSER,
|
|
296
|
+
peer: prettyPrintPeerIdStr(peerIdStr),
|
|
297
|
+
slot,
|
|
298
|
+
blockRoot: blockRootHex,
|
|
299
|
+
proposerIndex,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
// Not marked as verified, the block has not passed proposer or ancestry checks yet
|
|
303
|
+
if (!chain.seenBlockInputCache.isVerifiedProposerSignature(slot, blockRootHex, block.signature)) {
|
|
304
|
+
const signatureSet = getBlockProposerSignatureSet(chain.config, block);
|
|
305
|
+
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: false}))) {
|
|
306
|
+
throw new DownloadByRootError({
|
|
307
|
+
code: DownloadByRootErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
308
|
+
peer: prettyPrintPeerIdStr(peerIdStr),
|
|
309
|
+
slot,
|
|
310
|
+
blockRoot: blockRootHex,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return block;
|
|
393
315
|
}
|
|
394
316
|
|
|
395
317
|
export async function fetchAndValidateColumns({
|
|
@@ -494,8 +416,10 @@ export enum DownloadByRootErrorCode {
|
|
|
494
416
|
INVALID_INCLUSION_PROOF = "DOWNLOAD_BY_ROOT_ERROR_INVALID_INCLUSION_PROOF",
|
|
495
417
|
INVALID_KZG_PROOF = "DOWNLOAD_BY_ROOT_ERROR_INVALID_KZG_PROOF",
|
|
496
418
|
MISSING_BLOCK_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_BLOCK_RESPONSE",
|
|
497
|
-
MISSING_BLOB_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_BLOB_RESPONSE",
|
|
498
419
|
MISSING_COLUMN_RESPONSE = "DOWNLOAD_BY_ROOT_ERROR_MISSING_COLUMN_RESPONSE",
|
|
420
|
+
BELOW_FINALIZED_SLOT = "DOWNLOAD_BY_ROOT_ERROR_BELOW_FINALIZED_SLOT",
|
|
421
|
+
UNKNOWN_PROPOSER = "DOWNLOAD_BY_ROOT_ERROR_UNKNOWN_PROPOSER",
|
|
422
|
+
PROPOSAL_SIGNATURE_INVALID = "DOWNLOAD_BY_ROOT_ERROR_PROPOSAL_SIGNATURE_INVALID",
|
|
499
423
|
Z = "DOWNLOAD_BY_ROOT_ERROR_Z",
|
|
500
424
|
}
|
|
501
425
|
export type DownloadByRootErrorType =
|
|
@@ -542,13 +466,28 @@ export type DownloadByRootErrorType =
|
|
|
542
466
|
blockRoot: string;
|
|
543
467
|
}
|
|
544
468
|
| {
|
|
545
|
-
code: DownloadByRootErrorCode.
|
|
469
|
+
code: DownloadByRootErrorCode.MISSING_COLUMN_RESPONSE;
|
|
470
|
+
peer: string;
|
|
471
|
+
blockRoot: string;
|
|
472
|
+
}
|
|
473
|
+
| {
|
|
474
|
+
code: DownloadByRootErrorCode.BELOW_FINALIZED_SLOT;
|
|
546
475
|
peer: string;
|
|
476
|
+
slot: Slot;
|
|
477
|
+
finalizedSlot: Slot;
|
|
547
478
|
blockRoot: string;
|
|
548
479
|
}
|
|
549
480
|
| {
|
|
550
|
-
code: DownloadByRootErrorCode.
|
|
481
|
+
code: DownloadByRootErrorCode.UNKNOWN_PROPOSER;
|
|
551
482
|
peer: string;
|
|
483
|
+
slot: Slot;
|
|
484
|
+
blockRoot: string;
|
|
485
|
+
proposerIndex: ValidatorIndex;
|
|
486
|
+
}
|
|
487
|
+
| {
|
|
488
|
+
code: DownloadByRootErrorCode.PROPOSAL_SIGNATURE_INVALID;
|
|
489
|
+
peer: string;
|
|
490
|
+
slot: Slot;
|
|
552
491
|
blockRoot: string;
|
|
553
492
|
};
|
|
554
493
|
|
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/eventLoop.ts
CHANGED
|
@@ -20,3 +20,11 @@ export function callInNextEventLoop(callback: () => void): void {
|
|
|
20
20
|
// Say https://nodejs.org/api/timers.html#settimeoutcallback-delay-args
|
|
21
21
|
setTimeout(callback, 0);
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Schedules a callback for the `check` phase, after the `poll` phase handles ready I/O.
|
|
26
|
+
* Pending promise continuations run first, and there is no 1ms timer delay.
|
|
27
|
+
*/
|
|
28
|
+
export function callAfterIO(callback: () => void): void {
|
|
29
|
+
setImmediate(callback);
|
|
30
|
+
}
|
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)[]> {
|