@lodestar/beacon-node 1.40.0 → 1.41.0-dev.0087e7a664
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 +123 -4
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.js +8 -8
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +3 -4
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +5 -24
- 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/lightclient/index.d.ts.map +1 -1
- package/lib/api/impl/lightclient/index.js +19 -2
- package/lib/api/impl/lightclient/index.js.map +1 -1
- package/lib/api/impl/node/index.d.ts +1 -1
- package/lib/api/impl/node/index.d.ts.map +1 -1
- package/lib/api/impl/node/index.js +18 -1
- package/lib/api/impl/node/index.js.map +1 -1
- package/lib/api/impl/node/utils.d.ts +1 -1
- package/lib/api/impl/node/utils.d.ts.map +1 -1
- package/lib/api/impl/node/utils.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +130 -16
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +9 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +5 -6
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +9 -10
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +3 -3
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +3 -8
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts +7 -0
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts.map +1 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js +10 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js.map +1 -0
- package/lib/chain/archiveStore/utils/updateBackfillRange.js +1 -1
- package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +25 -2
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +71 -0
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +18 -1
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +1 -0
- 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 +27 -6
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +2 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +3 -0
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +4 -0
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -1
- 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 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts +12 -3
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +92 -95
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +3 -3
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +5 -5
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +2 -2
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -4
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +4 -4
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +2 -2
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +7 -4
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +8 -11
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +45 -28
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +5 -5
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/errors/blockError.d.ts +7 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +2 -2
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.d.ts +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +30 -24
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +4 -6
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +1 -1
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +3 -3
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +9 -2
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +25 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +22 -7
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +109 -10
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +4 -1
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +6 -2
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +5 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +36 -15
- 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.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +7 -4
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +9 -2
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +2 -2
- package/lib/chain/validation/blobSidecar.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +33 -6
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts +2 -2
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +1 -2
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +6 -5
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +9 -3
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
- package/lib/db/beacon.d.ts +3 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +5 -1
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +3 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -0
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/index.d.ts +1 -0
- package/lib/db/index.d.ts.map +1 -1
- package/lib/db/index.js +1 -0
- package/lib/db/index.js.map +1 -1
- package/lib/db/interface.d.ts +3 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +1 -2
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js +14 -1
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +14 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelope.d.ts +19 -0
- package/lib/db/repositories/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelope.js +22 -0
- package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +18 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +28 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -0
- package/lib/db/repositories/index.d.ts +2 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +2 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/http.d.ts +1 -0
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +3 -0
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +3 -25
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js +2 -20
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +1 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +9 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +18 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +8 -3
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/monitoring/service.d.ts +2 -2
- package/lib/monitoring/service.d.ts.map +1 -1
- package/lib/monitoring/service.js +3 -2
- package/lib/monitoring/service.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +3 -3
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -3
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/types.d.ts +2 -2
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/events.d.ts +2 -1
- package/lib/network/events.d.ts.map +1 -1
- package/lib/network/events.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts +3 -3
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +13 -4
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +47 -20
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +6 -6
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +1 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +114 -65
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +2 -2
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +6 -5
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +7 -2
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +5 -4
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +11 -2
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +3 -0
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +7 -5
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js +10 -10
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +3 -0
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +103 -53
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +3 -3
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +9 -2
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +1 -1
- package/lib/network/processor/types.d.ts +1 -1
- package/lib/network/processor/types.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +3 -2
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +3 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +3 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +7 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +0 -1
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/reqresp/utils/collect.d.ts +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
- package/lib/network/util.js +2 -2
- package/lib/network/util.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -5
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +6 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +3 -9
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +2 -2
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +4 -4
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/remoteSyncType.d.ts +1 -1
- package/lib/util/blobs.d.ts +2 -2
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/clock.d.ts +6 -0
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +9 -3
- package/lib/util/clock.js.map +1 -1
- package/lib/util/dataColumns.d.ts +15 -2
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +40 -5
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/multifork.d.ts +8 -0
- package/lib/util/multifork.d.ts.map +1 -1
- package/lib/util/multifork.js +37 -0
- package/lib/util/multifork.js.map +1 -1
- package/lib/util/serializedCache.d.ts +7 -2
- package/lib/util/serializedCache.d.ts.map +1 -1
- package/lib/util/serializedCache.js +9 -2
- package/lib/util/serializedCache.js.map +1 -1
- package/package.json +39 -42
- package/src/api/impl/beacon/blocks/index.ts +147 -3
- package/src/api/impl/beacon/state/index.ts +8 -8
- package/src/api/impl/beacon/state/utils.ts +15 -29
- package/src/api/impl/debug/index.ts +9 -5
- package/src/api/impl/lightclient/index.ts +19 -2
- package/src/api/impl/node/index.ts +22 -1
- package/src/api/impl/node/utils.ts +3 -3
- package/src/api/impl/validator/index.ts +153 -17
- package/src/chain/archiveStore/archiveStore.ts +15 -5
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -11
- package/src/chain/archiveStore/historicalState/worker.ts +3 -3
- package/src/chain/archiveStore/utils/archiveBlocks.ts +4 -5
- package/src/chain/archiveStore/utils/archivePayloads.ts +15 -0
- package/src/chain/archiveStore/utils/updateBackfillRange.ts +1 -1
- package/src/chain/blocks/blockInput/blockInput.ts +103 -3
- package/src/chain/blocks/blockInput/types.ts +18 -0
- package/src/chain/blocks/importBlock.ts +35 -7
- package/src/chain/blocks/index.ts +2 -1
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +3 -0
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -2
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +7 -2
- package/src/chain/blocks/writeBlockInputToDb.ts +105 -101
- package/src/chain/bls/multithread/index.ts +7 -7
- package/src/chain/bls/multithread/jobItem.ts +3 -3
- package/src/chain/bls/singleThread.ts +5 -5
- package/src/chain/bls/utils.ts +8 -5
- package/src/chain/chain.ts +82 -45
- package/src/chain/emitter.ts +5 -5
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/errors/executionPayloadBid.ts +1 -1
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -2
- package/src/chain/errors/payloadAttestation.ts +1 -1
- package/src/chain/forkChoice/index.ts +39 -21
- package/src/chain/interface.ts +4 -11
- package/src/chain/lightClient/index.ts +4 -1
- package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
- package/src/chain/options.ts +1 -0
- package/src/chain/prepareNextSlot.ts +5 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +36 -3
- package/src/chain/produceBlock/produceBlockBody.ts +162 -13
- package/src/chain/regen/queued.ts +7 -2
- package/src/chain/regen/regen.ts +9 -3
- package/src/chain/seenCache/seenGossipBlockInput.ts +54 -17
- package/src/chain/validation/aggregateAndProof.ts +1 -1
- package/src/chain/validation/attestation.ts +7 -4
- package/src/chain/validation/attesterSlashing.ts +10 -1
- package/src/chain/validation/blobSidecar.ts +2 -2
- package/src/chain/validation/block.ts +40 -7
- package/src/chain/validation/dataColumnSidecar.ts +3 -6
- package/src/chain/validation/executionPayloadBid.ts +1 -2
- package/src/chain/validation/executionPayloadEnvelope.ts +6 -5
- package/src/chain/validation/payloadAttestationMessage.ts +11 -4
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +1 -1
- package/src/db/beacon.ts +8 -0
- package/src/db/buckets.ts +3 -0
- package/src/db/index.ts +1 -0
- package/src/db/interface.ts +5 -0
- package/src/db/repositories/blockArchive.ts +1 -2
- package/src/db/repositories/dataColumnSidecar.ts +18 -3
- package/src/db/repositories/dataColumnSidecarArchive.ts +18 -3
- package/src/db/repositories/executionPayloadEnvelope.ts +26 -0
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +32 -0
- package/src/db/repositories/index.ts +2 -0
- package/src/execution/engine/http.ts +3 -0
- package/src/execution/engine/interface.ts +3 -27
- package/src/metrics/metrics/beacon.ts +5 -0
- package/src/metrics/metrics/lodestar.ts +18 -0
- package/src/metrics/metrics.ts +8 -3
- package/src/monitoring/service.ts +3 -2
- package/src/network/core/networkCore.ts +3 -3
- package/src/network/core/networkCoreWorkerHandler.ts +3 -3
- package/src/network/core/types.ts +2 -2
- package/src/network/events.ts +2 -1
- package/src/network/gossip/encoding.ts +3 -3
- package/src/network/gossip/gossipsub.ts +86 -25
- package/src/network/gossip/interface.ts +6 -6
- package/src/network/gossip/scoringParameters.ts +4 -4
- package/src/network/gossip/topic.ts +2 -1
- package/src/network/interface.ts +7 -4
- package/src/network/libp2p/index.ts +8 -3
- package/src/network/network.ts +26 -7
- package/src/network/options.ts +3 -0
- package/src/network/peers/datastore.ts +13 -10
- package/src/network/peers/peerManager.ts +118 -54
- package/src/network/peers/utils/prioritizePeers.ts +3 -3
- package/src/network/processor/gossipHandlers.ts +19 -4
- package/src/network/processor/gossipValidatorFn.ts +2 -2
- package/src/network/processor/types.ts +1 -1
- package/src/network/reqresp/ReqRespBeaconNode.ts +1 -1
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +4 -3
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +3 -2
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +1 -1
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -3
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +2 -2
- package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +6 -1
- package/src/network/reqresp/score.ts +0 -1
- package/src/network/reqresp/utils/collect.ts +1 -1
- package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +1 -1
- package/src/network/util.ts +2 -2
- package/src/node/nodejs.ts +8 -9
- package/src/sync/utils/downloadByRange.ts +3 -15
- package/src/sync/utils/downloadByRoot.ts +6 -12
- package/src/sync/utils/remoteSyncType.ts +1 -1
- package/src/util/blobs.ts +3 -3
- package/src/util/clock.ts +9 -4
- package/src/util/dataColumns.ts +54 -5
- package/src/util/multifork.ts +45 -0
- package/src/util/serializedCache.ts +10 -3
- package/src/util/workerEvents.ts +1 -1
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isStartSlotOfEpoch,
|
|
21
21
|
isStateValidatorsNodesPopulated,
|
|
22
22
|
} from "@lodestar/state-transition";
|
|
23
|
-
import {Attestation, BeaconBlock, altair, capella, electra, phase0, ssz} from "@lodestar/types";
|
|
23
|
+
import {Attestation, BeaconBlock, altair, capella, electra, isGloasBeaconBlock, phase0, ssz} from "@lodestar/types";
|
|
24
24
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
25
25
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
26
26
|
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
@@ -95,15 +95,12 @@ export async function importBlock(
|
|
|
95
95
|
// Without this, a supernode syncing from behind can accumulate many blocks worth of column
|
|
96
96
|
// data in memory (up to 128 columns per block) causing OOM before persistence catches up.
|
|
97
97
|
await this.unfinalizedBlockWrites.waitForSpace();
|
|
98
|
-
this.unfinalizedBlockWrites.push(
|
|
98
|
+
this.unfinalizedBlockWrites.push(blockInput).catch((e) => {
|
|
99
99
|
if (!isQueueErrorAborted(e)) {
|
|
100
100
|
this.logger.error("Error pushing block to unfinalized write queue", {slot: blockSlot}, e as Error);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
// Without forcefully clearing this cache, we would rely on WeakMap to evict memory which is not reliable
|
|
105
|
-
this.serializedCache.clear();
|
|
106
|
-
|
|
107
104
|
// 2. Import block to fork choice
|
|
108
105
|
|
|
109
106
|
// Should compute checkpoint balances before forkchoice.onBlock
|
|
@@ -233,6 +230,32 @@ export async function importBlock(
|
|
|
233
230
|
}
|
|
234
231
|
}
|
|
235
232
|
|
|
233
|
+
// 4.5. Import payload attestations to fork choice (Gloas)
|
|
234
|
+
//
|
|
235
|
+
if (isGloasBeaconBlock(block.message)) {
|
|
236
|
+
for (const payloadAttestation of block.message.body.payloadAttestations) {
|
|
237
|
+
try {
|
|
238
|
+
// Extract PTC indices from aggregation bits
|
|
239
|
+
const ptcIndices: number[] = [];
|
|
240
|
+
for (let i = 0; i < payloadAttestation.aggregationBits.bitLen; i++) {
|
|
241
|
+
if (payloadAttestation.aggregationBits.get(i)) {
|
|
242
|
+
ptcIndices.push(i);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (ptcIndices.length > 0) {
|
|
247
|
+
this.forkChoice.notifyPtcMessages(
|
|
248
|
+
toRootHex(payloadAttestation.data.beaconBlockRoot),
|
|
249
|
+
ptcIndices,
|
|
250
|
+
payloadAttestation.data.payloadPresent
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
} catch (e) {
|
|
254
|
+
this.logger.warn("Error processing PayloadAttestation from block", {slot: blockSlot}, e as Error);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
236
259
|
// 5. Compute head. If new head, immediately stateCache.setHeadState()
|
|
237
260
|
|
|
238
261
|
const oldHead = this.forkChoice.getHead();
|
|
@@ -348,7 +371,7 @@ export async function importBlock(
|
|
|
348
371
|
// 3) Proposer boost reorg related flag is turned on (this is checked inside the function)
|
|
349
372
|
// 4) Block meets the criteria of being re-orged out (this is also checked inside the function)
|
|
350
373
|
const result = this.forkChoice.shouldOverrideForkChoiceUpdate(
|
|
351
|
-
blockSummary
|
|
374
|
+
blockSummary,
|
|
352
375
|
this.clock.secFromSlot(currentSlot),
|
|
353
376
|
currentSlot
|
|
354
377
|
);
|
|
@@ -444,7 +467,12 @@ export async function importBlock(
|
|
|
444
467
|
this.metrics?.currentActiveValidators.set(activeValidatorsCount);
|
|
445
468
|
this.metrics?.currentValidators.set({status: "active"}, activeValidatorsCount);
|
|
446
469
|
|
|
447
|
-
const parentBlockSummary =
|
|
470
|
+
const parentBlockSummary = isGloasBeaconBlock(block.message)
|
|
471
|
+
? this.forkChoice.getBlockHexAndBlockHash(
|
|
472
|
+
toRootHex(checkpointState.latestBlockHeader.parentRoot),
|
|
473
|
+
toRootHex(block.message.body.signedExecutionPayloadBid.message.parentBlockHash)
|
|
474
|
+
)
|
|
475
|
+
: this.forkChoice.getBlockDefaultStatus(checkpointState.latestBlockHeader.parentRoot);
|
|
448
476
|
|
|
449
477
|
if (parentBlockSummary) {
|
|
450
478
|
const justifiedCheckpoint = checkpointState.currentJustifiedCheckpoint;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SignedBeaconBlock} from "@lodestar/types";
|
|
2
2
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
3
3
|
import {Metrics} from "../../metrics/metrics.js";
|
|
4
|
+
import {nextEventLoop} from "../../util/eventLoop.js";
|
|
4
5
|
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
|
|
5
6
|
import type {BeaconChain} from "../chain.js";
|
|
6
7
|
import {BlockError, BlockErrorCode, isBlockErrorAborted} from "../errors/index.js";
|
|
@@ -100,9 +101,9 @@ export async function processBlocks(
|
|
|
100
101
|
);
|
|
101
102
|
|
|
102
103
|
for (const fullyVerifiedBlock of fullyVerifiedBlocks) {
|
|
103
|
-
// No need to sleep(0) here since `importBlock` includes a disk write
|
|
104
104
|
// TODO: Consider batching importBlock too if it takes significant time
|
|
105
105
|
await importBlock.call(this, fullyVerifiedBlock, opts);
|
|
106
|
+
await nextEventLoop();
|
|
106
107
|
}
|
|
107
108
|
} catch (e) {
|
|
108
109
|
if (isErrorAborted(e) || isQueueErrorAborted(e) || isBlockErrorAborted(e)) {
|
|
@@ -29,6 +29,9 @@ export async function verifyBlocksDataAvailability(
|
|
|
29
29
|
|
|
30
30
|
const availableTime = Math.max(0, Math.max(...blocks.map((blockInput) => blockInput.getTimeComplete())));
|
|
31
31
|
const dataAvailabilityStatuses: DataAvailabilityStatus[] = blocks.map((blockInput) => {
|
|
32
|
+
if (blockInput.type === DAType.NoData) {
|
|
33
|
+
return DataAvailabilityStatus.NotRequired;
|
|
34
|
+
}
|
|
32
35
|
if (blockInput.type === DAType.PreData) {
|
|
33
36
|
return DataAvailabilityStatus.PreData;
|
|
34
37
|
}
|
|
@@ -21,7 +21,7 @@ import {Metrics} from "../../metrics/metrics.js";
|
|
|
21
21
|
import {IClock} from "../../util/clock.js";
|
|
22
22
|
import {BlockError, BlockErrorCode} from "../errors/index.js";
|
|
23
23
|
import {BlockProcessOpts} from "../options.js";
|
|
24
|
-
import {isBlockInputBlobs, isBlockInputColumns} from "./blockInput/blockInput.js";
|
|
24
|
+
import {isBlockInputBlobs, isBlockInputColumns, isBlockInputNoData} from "./blockInput/blockInput.js";
|
|
25
25
|
import {IBlockInput} from "./blockInput/types.js";
|
|
26
26
|
import {ImportBlockOpts} from "./types.js";
|
|
27
27
|
|
|
@@ -51,7 +51,8 @@ type VerifyBlockExecutionResponse =
|
|
|
51
51
|
| VerifyExecutionErrorResponse
|
|
52
52
|
| {executionStatus: ExecutionStatus.Valid; lvhResponse: LVHValidResponse; execError: null}
|
|
53
53
|
| {executionStatus: ExecutionStatus.Syncing; lvhResponse?: LVHValidResponse; execError: null}
|
|
54
|
-
| {executionStatus: ExecutionStatus.PreMerge; lvhResponse: undefined; execError: null}
|
|
54
|
+
| {executionStatus: ExecutionStatus.PreMerge; lvhResponse: undefined; execError: null}
|
|
55
|
+
| {executionStatus: ExecutionStatus.PayloadSeparated; lvhResponse: undefined; execError: null};
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* Verifies 1 or more execution payloads from a linear sequence of blocks.
|
|
@@ -148,6 +149,12 @@ export async function verifyBlockExecutionPayload(
|
|
|
148
149
|
preState0: CachedBeaconStateAllForks
|
|
149
150
|
): Promise<VerifyBlockExecutionResponse> {
|
|
150
151
|
const block = blockInput.getBlock();
|
|
152
|
+
|
|
153
|
+
// Gloas block doesn't have execution payload. Return right away
|
|
154
|
+
if (isBlockInputNoData(blockInput)) {
|
|
155
|
+
return {executionStatus: ExecutionStatus.PayloadSeparated, lvhResponse: undefined, execError: null};
|
|
156
|
+
}
|
|
157
|
+
|
|
151
158
|
/** Not null if execution is enabled */
|
|
152
159
|
const executionPayloadEnabled =
|
|
153
160
|
isExecutionStateType(preState0) &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
3
3
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
4
|
-
import {RootHex, Slot} from "@lodestar/types";
|
|
4
|
+
import {RootHex, Slot, isGloasBeaconBlock} from "@lodestar/types";
|
|
5
5
|
import {toRootHex} from "@lodestar/utils";
|
|
6
6
|
import {IClock} from "../../util/clock.js";
|
|
7
7
|
import {BlockError, BlockErrorCode} from "../errors/index.js";
|
|
@@ -90,7 +90,12 @@ export function verifyBlocksSanityChecks(
|
|
|
90
90
|
} else {
|
|
91
91
|
// When importing a block segment, only the first NON-IGNORED block must be known to the fork-choice.
|
|
92
92
|
const parentRoot = toRootHex(block.message.parentRoot);
|
|
93
|
-
parentBlock =
|
|
93
|
+
parentBlock = isGloasBeaconBlock(block.message)
|
|
94
|
+
? chain.forkChoice.getBlockHexAndBlockHash(
|
|
95
|
+
parentRoot,
|
|
96
|
+
toRootHex(block.message.body.signedExecutionPayloadBid.message.parentBlockHash)
|
|
97
|
+
)
|
|
98
|
+
: chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
|
|
94
99
|
if (!parentBlock) {
|
|
95
100
|
throw new BlockError(block, {code: BlockErrorCode.PARENT_UNKNOWN, parentRoot});
|
|
96
101
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {ForkPostDeneb, isForkPostDeneb} from "@lodestar/params";
|
|
2
|
+
import {SignedBeaconBlock} from "@lodestar/types";
|
|
3
|
+
import {fromHex, toRootHex} from "@lodestar/utils";
|
|
4
|
+
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
3
5
|
import {BeaconChain} from "../chain.js";
|
|
4
|
-
import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blockInput/index.js";
|
|
6
|
+
import {IBlockInput, IDataColumnsInput, isBlockInputBlobs, isBlockInputColumns} from "./blockInput/index.js";
|
|
5
7
|
import {BLOB_AVAILABILITY_TIMEOUT} from "./verifyBlocksDataAvailability.js";
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -10,126 +12,128 @@ import {BLOB_AVAILABILITY_TIMEOUT} from "./verifyBlocksDataAvailability.js";
|
|
|
10
12
|
*
|
|
11
13
|
* This operation may be performed before, during or after importing to the fork-choice. As long as errors
|
|
12
14
|
* are handled properly for eventual consistency.
|
|
15
|
+
*
|
|
16
|
+
* Block+blobs (pre-fulu) and data columns (fulu+) are written in parallel.
|
|
13
17
|
*/
|
|
14
|
-
export async function writeBlockInputToDb(this: BeaconChain,
|
|
15
|
-
const
|
|
16
|
-
// track slots for logging
|
|
17
|
-
const slots: number[] = [];
|
|
18
|
-
|
|
19
|
-
for (const blockInput of blocksInputs) {
|
|
20
|
-
const block = blockInput.getBlock();
|
|
21
|
-
const slot = block.message.slot;
|
|
22
|
-
slots.push(slot);
|
|
23
|
-
const blockRoot = this.config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message);
|
|
24
|
-
const blockRootHex = toRootHex(blockRoot);
|
|
25
|
-
const blockBytes = this.serializedCache.get(block);
|
|
26
|
-
if (blockBytes) {
|
|
27
|
-
// skip serializing data if we already have it
|
|
28
|
-
this.metrics?.importBlock.persistBlockWithSerializedDataCount.inc();
|
|
29
|
-
fnPromises.push(this.db.block.putBinary(this.db.block.getId(block), blockBytes));
|
|
30
|
-
} else {
|
|
31
|
-
this.metrics?.importBlock.persistBlockNoSerializedDataCount.inc();
|
|
32
|
-
fnPromises.push(this.db.block.add(block));
|
|
33
|
-
}
|
|
18
|
+
export async function writeBlockInputToDb(this: BeaconChain, blockInput: IBlockInput): Promise<void> {
|
|
19
|
+
const promises: Promise<void>[] = [writeBlockAndBlobsToDb.call(this, blockInput)];
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
inputType: blockInput.type,
|
|
39
|
-
});
|
|
21
|
+
if (isBlockInputColumns(blockInput)) {
|
|
22
|
+
promises.push(writeDataColumnsToDb.call(this, blockInput));
|
|
23
|
+
}
|
|
40
24
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
await Promise.all(promises);
|
|
26
|
+
this.logger.debug("Persisted blockInput to db", {slot: blockInput.slot, root: blockInput.blockRootHex});
|
|
27
|
+
}
|
|
44
28
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
29
|
+
async function writeBlockAndBlobsToDb(this: BeaconChain, blockInput: IBlockInput): Promise<void> {
|
|
30
|
+
const block = blockInput.getBlock();
|
|
31
|
+
const slot = block.message.slot;
|
|
32
|
+
const blockRoot = this.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block.message);
|
|
33
|
+
const blockRootHex = toRootHex(blockRoot);
|
|
34
|
+
const numBlobs = isForkPostDeneb(blockInput.forkName)
|
|
35
|
+
? getBlobKzgCommitments(blockInput.forkName, block as SignedBeaconBlock<ForkPostDeneb>).length
|
|
36
|
+
: undefined;
|
|
37
|
+
const fnPromises: Promise<void>[] = [];
|
|
55
38
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
const blockBytes = this.serializedCache.get(block);
|
|
40
|
+
if (blockBytes) {
|
|
41
|
+
// skip serializing data if we already have it
|
|
42
|
+
this.metrics?.importBlock.persistBlockWithSerializedDataCount.inc();
|
|
43
|
+
fnPromises.push(this.db.block.putBinary(this.db.block.getId(block), blockBytes));
|
|
44
|
+
} else {
|
|
45
|
+
this.metrics?.importBlock.persistBlockNoSerializedDataCount.inc();
|
|
46
|
+
fnPromises.push(this.db.block.add(block));
|
|
47
|
+
}
|
|
64
48
|
|
|
65
|
-
|
|
66
|
-
if (dataColumnSidecars.length !== dataColumnsLen) {
|
|
67
|
-
this.logger.debug(
|
|
68
|
-
`Invalid dataColumnSidecars=${dataColumnSidecars.length} for custody expected custodyColumnsLen=${dataColumnsLen}`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
49
|
+
this.logger.debug("Persist block to hot DB", {slot, root: blockRootHex, inputType: blockInput.type, numBlobs});
|
|
71
50
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (serialized) {
|
|
78
|
-
binaryPuts.push({key: dataColumnSidecar.index, value: serialized});
|
|
79
|
-
} else {
|
|
80
|
-
nonbinaryPuts.push(dataColumnSidecar);
|
|
51
|
+
if (isBlockInputBlobs(blockInput)) {
|
|
52
|
+
fnPromises.push(
|
|
53
|
+
(async () => {
|
|
54
|
+
if (!blockInput.hasAllData()) {
|
|
55
|
+
await blockInput.waitForAllData(BLOB_AVAILABILITY_TIMEOUT);
|
|
81
56
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
57
|
+
const blobSidecars = blockInput.getBlobs();
|
|
58
|
+
await this.db.blobSidecars.add({blockRoot, slot, blobSidecars});
|
|
59
|
+
this.logger.debug("Persisted blobSidecars to hot DB", {
|
|
60
|
+
slot,
|
|
61
|
+
root: blockRootHex,
|
|
62
|
+
numBlobs: blobSidecars.length,
|
|
63
|
+
});
|
|
64
|
+
})()
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await Promise.all(fnPromises);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Persists data columns to DB for a given block. Accepts a narrow sub-interface of IBlockInput
|
|
73
|
+
* so it can be reused across forks (e.g. Fulu, Gloas).
|
|
74
|
+
*
|
|
75
|
+
* NOTE: Old data is pruned on archive.
|
|
76
|
+
*/
|
|
77
|
+
export async function writeDataColumnsToDb(this: BeaconChain, blockInput: IDataColumnsInput): Promise<void> {
|
|
78
|
+
const {slot, blockRootHex} = blockInput;
|
|
79
|
+
const blockRoot = fromHex(blockRootHex);
|
|
101
80
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
81
|
+
if (!blockInput.hasComputedAllData()) {
|
|
82
|
+
// Supernodes may only have a subset of the data columns by the time the block begins to be imported
|
|
83
|
+
// because full data availability can be assumed after NUMBER_OF_COLUMNS / 2 columns are available.
|
|
84
|
+
// Here, however, all data columns must be fully available/reconstructed before persisting to the DB.
|
|
85
|
+
await blockInput.waitForComputedAllData(BLOB_AVAILABILITY_TIMEOUT).catch(() => {
|
|
86
|
+
this.logger.debug("Failed to wait for computed all data", {slot, blockRoot: blockRootHex});
|
|
106
87
|
});
|
|
107
88
|
}
|
|
89
|
+
|
|
90
|
+
const {custodyColumns} = this.custodyConfig;
|
|
91
|
+
const dataColumnSidecars = blockInput.getCustodyColumns();
|
|
92
|
+
|
|
93
|
+
const binaryPuts: {key: number; value: Uint8Array}[] = [];
|
|
94
|
+
const nonbinaryPuts = [];
|
|
95
|
+
for (const dataColumnSidecar of dataColumnSidecars) {
|
|
96
|
+
// skip reserializing column if we already have it
|
|
97
|
+
const serialized = this.serializedCache.get(dataColumnSidecar);
|
|
98
|
+
if (serialized) {
|
|
99
|
+
binaryPuts.push({key: dataColumnSidecar.index, value: serialized});
|
|
100
|
+
} else {
|
|
101
|
+
nonbinaryPuts.push(dataColumnSidecar);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await Promise.all([
|
|
106
|
+
this.db.dataColumnSidecar.putManyBinary(blockRoot, binaryPuts),
|
|
107
|
+
this.db.dataColumnSidecar.putMany(blockRoot, nonbinaryPuts),
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
this.logger.debug("Persisted dataColumnSidecars to hot DB", {
|
|
111
|
+
slot,
|
|
112
|
+
root: blockRootHex,
|
|
113
|
+
dataColumnSidecars: dataColumnSidecars.length,
|
|
114
|
+
custodyColumns: custodyColumns.length,
|
|
115
|
+
numBlobs: dataColumnSidecars[0]?.column.length,
|
|
116
|
+
});
|
|
108
117
|
}
|
|
109
118
|
|
|
110
|
-
export async function
|
|
119
|
+
export async function persistBlockInput(this: BeaconChain, blockInput: IBlockInput): Promise<void> {
|
|
111
120
|
await writeBlockInputToDb
|
|
112
|
-
.call(this,
|
|
121
|
+
.call(this, blockInput)
|
|
113
122
|
.catch((e) => {
|
|
114
123
|
this.logger.debug(
|
|
115
124
|
"Error persisting block input in hot db",
|
|
116
125
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
root: blockInputs[0].blockRootHex,
|
|
126
|
+
slot: blockInput.slot,
|
|
127
|
+
root: blockInput.blockRootHex,
|
|
120
128
|
},
|
|
121
129
|
e
|
|
122
130
|
);
|
|
123
131
|
})
|
|
124
132
|
.finally(() => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
slot: blockInputs[0].slot,
|
|
131
|
-
root: blockInputs[0].blockRootHex,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
133
|
+
this.seenBlockInputCache.prune(blockInput.blockRootHex);
|
|
134
|
+
this.logger.debug("Pruned block input", {
|
|
135
|
+
slot: blockInput.slot,
|
|
136
|
+
root: blockInput.blockRootHex,
|
|
137
|
+
});
|
|
134
138
|
});
|
|
135
139
|
}
|
|
@@ -7,7 +7,7 @@ import {Worker, spawn} from "@chainsafe/threads";
|
|
|
7
7
|
self = undefined;
|
|
8
8
|
|
|
9
9
|
import {PublicKey} from "@chainsafe/blst";
|
|
10
|
-
import {ISignatureSet,
|
|
10
|
+
import {ISignatureSet, PubkeyCache} from "@lodestar/state-transition";
|
|
11
11
|
import {Logger} from "@lodestar/utils";
|
|
12
12
|
import {Metrics} from "../../../metrics/index.js";
|
|
13
13
|
import {LinkedList} from "../../../util/array.js";
|
|
@@ -34,7 +34,7 @@ const workerDir = process.env.NODE_ENV === "test" ? "../../../../lib/chain/bls/m
|
|
|
34
34
|
export type BlsMultiThreadWorkerPoolModules = {
|
|
35
35
|
logger: Logger;
|
|
36
36
|
metrics: Metrics | null;
|
|
37
|
-
|
|
37
|
+
pubkeyCache: PubkeyCache;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export type BlsMultiThreadWorkerPoolOptions = {
|
|
@@ -114,7 +114,7 @@ type WorkerDescriptor = {
|
|
|
114
114
|
export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
115
115
|
private readonly logger: Logger;
|
|
116
116
|
private readonly metrics: Metrics | null;
|
|
117
|
-
private readonly
|
|
117
|
+
private readonly pubkeyCache: PubkeyCache;
|
|
118
118
|
|
|
119
119
|
private readonly workers: WorkerDescriptor[];
|
|
120
120
|
private readonly jobs = new LinkedList<JobQueueItem>();
|
|
@@ -130,10 +130,10 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
130
130
|
private workersBusy = 0;
|
|
131
131
|
|
|
132
132
|
constructor(options: BlsMultiThreadWorkerPoolOptions, modules: BlsMultiThreadWorkerPoolModules) {
|
|
133
|
-
const {logger, metrics,
|
|
133
|
+
const {logger, metrics, pubkeyCache} = modules;
|
|
134
134
|
this.logger = logger;
|
|
135
135
|
this.metrics = metrics;
|
|
136
|
-
this.
|
|
136
|
+
this.pubkeyCache = pubkeyCache;
|
|
137
137
|
this.blsVerifyAllMultiThread = options.blsVerifyAllMultiThread ?? false;
|
|
138
138
|
|
|
139
139
|
// Use compressed for herumi for now.
|
|
@@ -173,7 +173,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
173
173
|
try {
|
|
174
174
|
return verifySignatureSetsMaybeBatch(
|
|
175
175
|
sets.map((set) => ({
|
|
176
|
-
publicKey: getAggregatedPubkey(set, this.
|
|
176
|
+
publicKey: getAggregatedPubkey(set, this.pubkeyCache),
|
|
177
177
|
message: set.signingRoot.valueOf(),
|
|
178
178
|
signature: set.signature,
|
|
179
179
|
}))
|
|
@@ -398,7 +398,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
398
398
|
try {
|
|
399
399
|
// Note: This can throw, must be handled per-job.
|
|
400
400
|
// Pubkey and signature aggregation is defered here
|
|
401
|
-
workReq = await jobItemWorkReq(job, this.
|
|
401
|
+
workReq = await jobItemWorkReq(job, this.pubkeyCache, this.metrics);
|
|
402
402
|
} catch (e) {
|
|
403
403
|
this.metrics?.blsThreadPool.errorAggregateSignatureSetsCount.inc({type: job.type});
|
|
404
404
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, asyncAggregateWithRandomness} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet,
|
|
2
|
+
import {ISignatureSet, PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../../metrics/metrics.js";
|
|
4
4
|
import {LinkedList} from "../../../util/array.js";
|
|
5
5
|
import {VerifySignatureOpts} from "../interface.js";
|
|
@@ -50,7 +50,7 @@ export function jobItemSigSets(job: JobQueueItem): number {
|
|
|
50
50
|
*/
|
|
51
51
|
export async function jobItemWorkReq(
|
|
52
52
|
job: JobQueueItem,
|
|
53
|
-
|
|
53
|
+
pubkeyCache: PubkeyCache,
|
|
54
54
|
metrics: Metrics | null
|
|
55
55
|
): Promise<BlsWorkReq> {
|
|
56
56
|
switch (job.type) {
|
|
@@ -59,7 +59,7 @@ export async function jobItemWorkReq(
|
|
|
59
59
|
opts: job.opts,
|
|
60
60
|
sets: job.sets.map((set) => ({
|
|
61
61
|
// this can throw, handled in the consumer code
|
|
62
|
-
publicKey: getAggregatedPubkey(set,
|
|
62
|
+
publicKey: getAggregatedPubkey(set, pubkeyCache, metrics).toBytes(),
|
|
63
63
|
signature: set.signature,
|
|
64
64
|
message: set.signingRoot,
|
|
65
65
|
})),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, Signature, aggregatePublicKeys, aggregateSignatures, verify} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet,
|
|
2
|
+
import {ISignatureSet, PubkeyCache} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
import {IBlsVerifier} from "./interface.js";
|
|
5
5
|
import {verifySignatureSetsMaybeBatch} from "./maybeBatch.js";
|
|
@@ -7,18 +7,18 @@ import {getAggregatedPubkey, getAggregatedPubkeysCount} from "./utils.js";
|
|
|
7
7
|
|
|
8
8
|
export class BlsSingleThreadVerifier implements IBlsVerifier {
|
|
9
9
|
private readonly metrics: Metrics | null;
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly pubkeyCache: PubkeyCache;
|
|
11
11
|
|
|
12
|
-
constructor({metrics = null,
|
|
12
|
+
constructor({metrics = null, pubkeyCache}: {metrics: Metrics | null; pubkeyCache: PubkeyCache}) {
|
|
13
13
|
this.metrics = metrics;
|
|
14
|
-
this.
|
|
14
|
+
this.pubkeyCache = pubkeyCache;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async verifySignatureSets(sets: ISignatureSet[]): Promise<boolean> {
|
|
18
18
|
this.metrics?.bls.aggregatedPubkeys.inc(getAggregatedPubkeysCount(sets));
|
|
19
19
|
|
|
20
20
|
const setsAggregated = sets.map((set) => ({
|
|
21
|
-
publicKey: getAggregatedPubkey(set, this.
|
|
21
|
+
publicKey: getAggregatedPubkey(set, this.pubkeyCache, this.metrics),
|
|
22
22
|
message: set.signingRoot,
|
|
23
23
|
signature: set.signature,
|
|
24
24
|
}));
|
package/src/chain/bls/utils.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import {PublicKey, aggregatePublicKeys} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet,
|
|
2
|
+
import {ISignatureSet, PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/metrics.js";
|
|
4
4
|
|
|
5
5
|
export function getAggregatedPubkey(
|
|
6
6
|
signatureSet: ISignatureSet,
|
|
7
|
-
|
|
7
|
+
pubkeyCache: PubkeyCache,
|
|
8
8
|
metrics: Metrics | null = null
|
|
9
9
|
): PublicKey {
|
|
10
10
|
switch (signatureSet.type) {
|
|
11
11
|
case SignatureSetType.single:
|
|
12
12
|
return signatureSet.pubkey;
|
|
13
13
|
|
|
14
|
-
case SignatureSetType.indexed:
|
|
15
|
-
return
|
|
14
|
+
case SignatureSetType.indexed: {
|
|
15
|
+
return pubkeyCache.getOrThrow(signatureSet.index);
|
|
16
|
+
}
|
|
16
17
|
|
|
17
18
|
case SignatureSetType.aggregate: {
|
|
18
19
|
const timer = metrics?.blsThreadPool.pubkeysAggregationMainThreadDuration.startTimer();
|
|
19
|
-
const pubkeys = signatureSet.indices.map((i) =>
|
|
20
|
+
const pubkeys = signatureSet.indices.map((i) => {
|
|
21
|
+
return pubkeyCache.getOrThrow(i);
|
|
22
|
+
});
|
|
20
23
|
const aggregated = aggregatePublicKeys(pubkeys);
|
|
21
24
|
timer?.();
|
|
22
25
|
return aggregated;
|