@lodestar/beacon-node 1.41.0-dev.e1d339886d → 1.41.0-dev.e6c853da0e
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/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 +20 -2
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +47 -0
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +13 -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 -4
- 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 +101 -96
- 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 +7 -10
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +43 -27
- 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/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/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/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 +10 -2
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +24 -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.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +15 -7
- 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 +6 -3
- 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 +4 -4
- 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/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/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 +8 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +14 -0
- package/lib/metrics/metrics/lodestar.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 +113 -63
- 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 +10 -1
- 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/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/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/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 +11 -3
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +27 -0
- 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/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/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 +68 -3
- package/src/chain/blocks/blockInput/types.ts +13 -0
- package/src/chain/blocks/importBlock.ts +35 -4
- 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 +119 -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 +77 -40
- package/src/chain/emitter.ts +5 -5
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -2
- package/src/chain/forkChoice/index.ts +39 -21
- package/src/chain/interface.ts +4 -11
- 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 +35 -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 +16 -7
- 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 +9 -4
- package/src/chain/validation/dataColumnSidecar.ts +3 -6
- package/src/chain/validation/executionPayloadBid.ts +1 -2
- package/src/chain/validation/executionPayloadEnvelope.ts +4 -4
- package/src/chain/validation/payloadAttestationMessage.ts +10 -3
- 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/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/metrics/metrics/beacon.ts +5 -0
- package/src/metrics/metrics/lodestar.ts +14 -0
- 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 +24 -6
- 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 +1 -1
- package/src/network/processor/types.ts +1 -1
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +3 -2
- 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 +3 -2
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
- package/src/network/reqresp/score.ts +0 -1
- package/src/network/util.ts +2 -2
- package/src/node/nodejs.ts +8 -9
- package/src/util/blobs.ts +3 -3
- package/src/util/clock.ts +9 -4
- package/src/util/dataColumns.ts +37 -1
- package/src/util/multifork.ts +45 -0
- package/src/util/workerEvents.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
2
1
|
import {routes} from "@lodestar/api";
|
|
3
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
4
|
-
import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
3
|
+
import {ExecutionStatus, PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
5
4
|
import {
|
|
5
|
+
BUILDER_INDEX_SELF_BUILD,
|
|
6
6
|
ForkName,
|
|
7
7
|
ForkPostBellatrix,
|
|
8
8
|
ForkPreGloas,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
isForkPostBellatrix,
|
|
15
15
|
isForkPostDeneb,
|
|
16
16
|
isForkPostElectra,
|
|
17
|
+
isForkPostGloas,
|
|
17
18
|
} from "@lodestar/params";
|
|
18
19
|
import {
|
|
19
20
|
CachedBeaconStateAllForks,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
computeStartSlotAtEpoch,
|
|
26
27
|
computeTimeAtSlot,
|
|
27
28
|
createCachedBeaconState,
|
|
29
|
+
createPubkeyCache,
|
|
28
30
|
getBlockRootAtSlot,
|
|
29
31
|
getCurrentSlot,
|
|
30
32
|
loadState,
|
|
@@ -45,6 +47,7 @@ import {
|
|
|
45
47
|
Wei,
|
|
46
48
|
bellatrix,
|
|
47
49
|
getValidatorStatus,
|
|
50
|
+
gloas,
|
|
48
51
|
phase0,
|
|
49
52
|
ssz,
|
|
50
53
|
} from "@lodestar/types";
|
|
@@ -69,7 +72,7 @@ import {
|
|
|
69
72
|
} from "../../../chain/errors/index.js";
|
|
70
73
|
import {ChainEvent, CommonBlockBody} from "../../../chain/index.js";
|
|
71
74
|
import {PREPARE_NEXT_SLOT_BPS} from "../../../chain/prepareNextSlot.js";
|
|
72
|
-
import {BlockType, ProduceFullDeneb} from "../../../chain/produceBlock/index.js";
|
|
75
|
+
import {BlockType, ProduceFullDeneb, ProduceFullGloas} from "../../../chain/produceBlock/index.js";
|
|
73
76
|
import {RegenCaller} from "../../../chain/regen/index.js";
|
|
74
77
|
import {CheckpointHex} from "../../../chain/stateCache/types.js";
|
|
75
78
|
import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
|
|
@@ -386,7 +389,7 @@ export function getValidatorApi(
|
|
|
386
389
|
*/
|
|
387
390
|
|
|
388
391
|
function notOnOptimisticBlockRoot(beaconBlockRoot: Root): void {
|
|
389
|
-
const protoBeaconBlock = chain.forkChoice.
|
|
392
|
+
const protoBeaconBlock = chain.forkChoice.getBlockDefaultStatus(beaconBlockRoot);
|
|
390
393
|
if (!protoBeaconBlock) {
|
|
391
394
|
throw new ApiError(404, `Block not in forkChoice, beaconBlockRoot=${toRootHex(beaconBlockRoot)}`);
|
|
392
395
|
}
|
|
@@ -398,7 +401,7 @@ export function getValidatorApi(
|
|
|
398
401
|
}
|
|
399
402
|
|
|
400
403
|
function notOnOutOfRangeData(beaconBlockRoot: Root): void {
|
|
401
|
-
const protoBeaconBlock = chain.forkChoice.
|
|
404
|
+
const protoBeaconBlock = chain.forkChoice.getBlockDefaultStatus(beaconBlockRoot);
|
|
402
405
|
if (!protoBeaconBlock) {
|
|
403
406
|
throw new ApiError(404, `Block not in forkChoice, beaconBlockRoot=${toRootHex(beaconBlockRoot)}`);
|
|
404
407
|
}
|
|
@@ -901,6 +904,77 @@ export function getValidatorApi(
|
|
|
901
904
|
return {data, meta};
|
|
902
905
|
},
|
|
903
906
|
|
|
907
|
+
async produceBlockV4({slot, randaoReveal, graffiti, feeRecipient}) {
|
|
908
|
+
const fork = config.getForkName(slot);
|
|
909
|
+
|
|
910
|
+
if (!isForkPostGloas(fork)) {
|
|
911
|
+
throw new ApiError(400, `produceBlockV4 not supported for pre-gloas fork=${fork}`);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
notWhileSyncing();
|
|
915
|
+
await waitForSlot(slot);
|
|
916
|
+
|
|
917
|
+
// TODO GLOAS: support producing blocks from builder bids
|
|
918
|
+
const source = ProducedBlockSource.engine;
|
|
919
|
+
|
|
920
|
+
// TODO GLOAS: needs to be updated after fork choice changes are merged
|
|
921
|
+
const parentBlock = chain.getProposerHead(slot);
|
|
922
|
+
const {blockRoot: parentBlockRootHex, slot: parentSlot} = parentBlock;
|
|
923
|
+
const parentBlockRoot = fromHex(parentBlockRootHex);
|
|
924
|
+
notOnOutOfRangeData(parentBlockRoot);
|
|
925
|
+
metrics?.blockProductionSlotDelta.set(slot - parentSlot);
|
|
926
|
+
metrics?.blockProductionRequests.inc({source});
|
|
927
|
+
|
|
928
|
+
const graffitiBytes = toGraffitiBytes(
|
|
929
|
+
graffiti ?? getDefaultGraffiti(getLodestarClientVersion(), chain.executionEngine.clientVersion, {})
|
|
930
|
+
);
|
|
931
|
+
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
932
|
+
slot,
|
|
933
|
+
parentBlock,
|
|
934
|
+
randaoReveal,
|
|
935
|
+
graffiti: graffitiBytes,
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
let timer: undefined | ((opts: {source: ProducedBlockSource}) => number);
|
|
939
|
+
try {
|
|
940
|
+
timer = metrics?.blockProductionTime.startTimer();
|
|
941
|
+
const {block, executionPayloadValue, consensusBlockValue} = await chain.produceBlock({
|
|
942
|
+
slot,
|
|
943
|
+
parentBlock,
|
|
944
|
+
randaoReveal,
|
|
945
|
+
graffiti: graffitiBytes,
|
|
946
|
+
feeRecipient,
|
|
947
|
+
commonBlockBodyPromise,
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
metrics?.blockProductionSuccess.inc({source});
|
|
951
|
+
metrics?.blockProductionNumAggregated.observe({source}, block.body.attestations.length);
|
|
952
|
+
metrics?.blockProductionConsensusBlockValue.observe({source}, Number(formatWeiToEth(consensusBlockValue)));
|
|
953
|
+
metrics?.blockProductionExecutionPayloadValue.observe({source}, Number(formatWeiToEth(executionPayloadValue)));
|
|
954
|
+
|
|
955
|
+
const blockRoot = toRootHex(config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block));
|
|
956
|
+
logger.verbose("Produced block", {
|
|
957
|
+
slot,
|
|
958
|
+
executionPayloadValue,
|
|
959
|
+
consensusBlockValue,
|
|
960
|
+
root: blockRoot,
|
|
961
|
+
});
|
|
962
|
+
if (chain.opts.persistProducedBlocks) {
|
|
963
|
+
void chain.persistBlock(block, "produced_engine_block");
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
return {
|
|
967
|
+
data: block as gloas.BeaconBlock,
|
|
968
|
+
meta: {
|
|
969
|
+
version: fork,
|
|
970
|
+
consensusBlockValue,
|
|
971
|
+
},
|
|
972
|
+
};
|
|
973
|
+
} finally {
|
|
974
|
+
timer?.({source});
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
|
|
904
978
|
async produceAttestationData({committeeIndex, slot}) {
|
|
905
979
|
notWhileSyncing();
|
|
906
980
|
|
|
@@ -915,8 +989,30 @@ export function getValidatorApi(
|
|
|
915
989
|
const headBlockRoot = fromHex(headBlockRootHex);
|
|
916
990
|
const fork = config.getForkName(slot);
|
|
917
991
|
|
|
992
|
+
const beaconBlockRoot =
|
|
993
|
+
slot >= headSlot
|
|
994
|
+
? // When attesting to the head slot or later, always use the head of the chain.
|
|
995
|
+
headBlockRoot
|
|
996
|
+
: // Permit attesting to slots *prior* to the current head. This is desirable when
|
|
997
|
+
// the VC and BN are out-of-sync due to time issues or overloading.
|
|
998
|
+
getBlockRootAtSlot(headState, slot);
|
|
999
|
+
|
|
918
1000
|
let index: CommitteeIndex;
|
|
919
|
-
if (
|
|
1001
|
+
if (isForkPostGloas(fork)) {
|
|
1002
|
+
const canonicalBlock = chain.forkChoice.getCanonicalBlockByRoot(beaconBlockRoot);
|
|
1003
|
+
if (!canonicalBlock) {
|
|
1004
|
+
// This should never happen
|
|
1005
|
+
throw Error(`Block not found in fork choice for slot=${slot}, root=${toRootHex(beaconBlockRoot)}`);
|
|
1006
|
+
}
|
|
1007
|
+
// After Gloas, attestation.data.index signals payload status in fork-choice:
|
|
1008
|
+
// - 0 = EMPTY / not present, 1 = FULL / present
|
|
1009
|
+
// - same-slot attestations must always use index = 0
|
|
1010
|
+
if (canonicalBlock.slot !== slot) {
|
|
1011
|
+
index = canonicalBlock.payloadStatus === PayloadStatus.FULL ? 1 : 0;
|
|
1012
|
+
} else {
|
|
1013
|
+
index = 0;
|
|
1014
|
+
}
|
|
1015
|
+
} else if (isForkPostElectra(fork)) {
|
|
920
1016
|
index = 0;
|
|
921
1017
|
} else {
|
|
922
1018
|
if (committeeIndex === undefined) {
|
|
@@ -925,14 +1021,6 @@ export function getValidatorApi(
|
|
|
925
1021
|
index = committeeIndex;
|
|
926
1022
|
}
|
|
927
1023
|
|
|
928
|
-
const beaconBlockRoot =
|
|
929
|
-
slot >= headSlot
|
|
930
|
-
? // When attesting to the head slot or later, always use the head of the chain.
|
|
931
|
-
headBlockRoot
|
|
932
|
-
: // Permit attesting to slots *prior* to the current head. This is desirable when
|
|
933
|
-
// the VC and BN are out-of-sync due to time issues or overloading.
|
|
934
|
-
getBlockRootAtSlot(headState, slot);
|
|
935
|
-
|
|
936
1024
|
const targetSlot = computeStartSlotAtEpoch(attEpoch);
|
|
937
1025
|
const targetRoot =
|
|
938
1026
|
targetSlot >= headSlot
|
|
@@ -1049,8 +1137,7 @@ export function getValidatorApi(
|
|
|
1049
1137
|
{
|
|
1050
1138
|
config: chain.config,
|
|
1051
1139
|
// Not required to compute proposers
|
|
1052
|
-
|
|
1053
|
-
index2pubkey: [],
|
|
1140
|
+
pubkeyCache: createPubkeyCache(),
|
|
1054
1141
|
},
|
|
1055
1142
|
{skipSyncPubkeys: true, skipSyncCommitteeCache: true}
|
|
1056
1143
|
);
|
|
@@ -1511,7 +1598,7 @@ export function getValidatorApi(
|
|
|
1511
1598
|
|
|
1512
1599
|
const filteredRegistrations = registrations.filter((registration) => {
|
|
1513
1600
|
const {pubkey} = registration.message;
|
|
1514
|
-
const validatorIndex = chain.
|
|
1601
|
+
const validatorIndex = chain.pubkeyCache.getIndex(pubkey);
|
|
1515
1602
|
if (validatorIndex === null) return false;
|
|
1516
1603
|
|
|
1517
1604
|
const validator = headState.validators.getReadonly(validatorIndex);
|
|
@@ -1532,5 +1619,54 @@ export function getValidatorApi(
|
|
|
1532
1619
|
count: filteredRegistrations.length,
|
|
1533
1620
|
});
|
|
1534
1621
|
},
|
|
1622
|
+
|
|
1623
|
+
async getExecutionPayloadEnvelope({slot, beaconBlockRoot}) {
|
|
1624
|
+
const fork = config.getForkName(slot);
|
|
1625
|
+
|
|
1626
|
+
if (!isForkPostGloas(fork)) {
|
|
1627
|
+
throw new ApiError(400, `getExecutionPayloadEnvelope not supported for pre-gloas fork=${fork}`);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
notWhileSyncing();
|
|
1631
|
+
await waitForSlot(slot);
|
|
1632
|
+
|
|
1633
|
+
const blockRootHex = toRootHex(beaconBlockRoot);
|
|
1634
|
+
const produceResult = chain.blockProductionCache.get(blockRootHex);
|
|
1635
|
+
|
|
1636
|
+
if (produceResult === undefined) {
|
|
1637
|
+
throw new ApiError(404, `No cached block production result found for block root ${blockRootHex}`);
|
|
1638
|
+
}
|
|
1639
|
+
if (!isForkPostGloas(produceResult.fork)) {
|
|
1640
|
+
throw Error(`Cached block production result is for pre-gloas fork=${produceResult.fork}`);
|
|
1641
|
+
}
|
|
1642
|
+
if (produceResult.type !== BlockType.Full) {
|
|
1643
|
+
throw Error("Cached block production result is not full block");
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
const {executionPayload, executionRequests, envelopeStateRoot} = produceResult as ProduceFullGloas;
|
|
1647
|
+
|
|
1648
|
+
const envelope: gloas.ExecutionPayloadEnvelope = {
|
|
1649
|
+
payload: executionPayload,
|
|
1650
|
+
executionRequests: executionRequests,
|
|
1651
|
+
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
1652
|
+
beaconBlockRoot,
|
|
1653
|
+
slot,
|
|
1654
|
+
stateRoot: envelopeStateRoot,
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
logger.info("Produced execution payload envelope", {
|
|
1658
|
+
slot,
|
|
1659
|
+
blockRoot: blockRootHex,
|
|
1660
|
+
transactions: executionPayload.transactions.length,
|
|
1661
|
+
blockHash: toRootHex(executionPayload.blockHash),
|
|
1662
|
+
});
|
|
1663
|
+
|
|
1664
|
+
return {
|
|
1665
|
+
data: envelope,
|
|
1666
|
+
meta: {
|
|
1667
|
+
version: fork,
|
|
1668
|
+
},
|
|
1669
|
+
};
|
|
1670
|
+
},
|
|
1535
1671
|
};
|
|
1536
1672
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {CheckpointWithPayloadStatus} from "@lodestar/fork-choice";
|
|
2
2
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
3
|
+
import {ForkSeq} from "@lodestar/params";
|
|
3
4
|
import {Checkpoint} from "@lodestar/types/phase0";
|
|
4
5
|
import {callFnWhenAwait} from "@lodestar/utils";
|
|
5
6
|
import {IBeaconDb} from "../../db/index.js";
|
|
@@ -13,6 +14,7 @@ import {HistoricalStateRegen} from "./historicalState/historicalStateRegen.js";
|
|
|
13
14
|
import {ArchiveMode, ArchiveStoreOpts, StateArchiveStrategy} from "./interface.js";
|
|
14
15
|
import {FrequencyStateArchiveStrategy} from "./strategies/frequencyStateArchiveStrategy.js";
|
|
15
16
|
import {archiveBlocks} from "./utils/archiveBlocks.js";
|
|
17
|
+
import {archiveExecutionPayloadEnvelopes} from "./utils/archivePayloads.js";
|
|
16
18
|
import {pruneHistory} from "./utils/pruneHistory.js";
|
|
17
19
|
import {updateBackfillRange} from "./utils/updateBackfillRange.js";
|
|
18
20
|
|
|
@@ -27,6 +29,7 @@ type ArchiveStoreInitOpts = ArchiveStoreOpts & {dbName: string; anchorState: {fi
|
|
|
27
29
|
|
|
28
30
|
export enum ArchiveStoreTask {
|
|
29
31
|
ArchiveBlocks = "archive_blocks",
|
|
32
|
+
ArchivePayloads = "archive_payloads",
|
|
30
33
|
PruneHistory = "prune_history",
|
|
31
34
|
OnFinalizedCheckpoint = "on_finalized_checkpoint",
|
|
32
35
|
MaybeArchiveState = "maybe_archive_state",
|
|
@@ -41,7 +44,7 @@ export enum ArchiveStoreTask {
|
|
|
41
44
|
*/
|
|
42
45
|
export class ArchiveStore {
|
|
43
46
|
private archiveMode: ArchiveMode;
|
|
44
|
-
private jobQueue: JobItemQueue<[
|
|
47
|
+
private jobQueue: JobItemQueue<[CheckpointWithPayloadStatus], void>;
|
|
45
48
|
|
|
46
49
|
private archiveDataEpochs?: number;
|
|
47
50
|
private readonly statesArchiverStrategy: StateArchiveStrategy;
|
|
@@ -64,7 +67,7 @@ export class ArchiveStore {
|
|
|
64
67
|
this.archiveMode = opts.archiveMode;
|
|
65
68
|
this.archiveDataEpochs = opts.archiveDataEpochs;
|
|
66
69
|
|
|
67
|
-
this.jobQueue = new JobItemQueue<[
|
|
70
|
+
this.jobQueue = new JobItemQueue<[CheckpointWithPayloadStatus], void>(this.processFinalizedCheckpoint, {
|
|
68
71
|
maxLength: PROCESS_FINALIZED_CHECKPOINT_QUEUE_LENGTH,
|
|
69
72
|
signal,
|
|
70
73
|
});
|
|
@@ -165,7 +168,7 @@ export class ArchiveStore {
|
|
|
165
168
|
//-------------------------------------------------------------------------
|
|
166
169
|
// Event handlers
|
|
167
170
|
//-------------------------------------------------------------------------
|
|
168
|
-
private onFinalizedCheckpoint = (finalized:
|
|
171
|
+
private onFinalizedCheckpoint = (finalized: CheckpointWithPayloadStatus): void => {
|
|
169
172
|
this.jobQueue.push(finalized).catch((e) => {
|
|
170
173
|
if (!isQueueErrorAborted(e)) {
|
|
171
174
|
this.logger.error("Error queuing finalized checkpoint", {epoch: finalized.epoch}, e as Error);
|
|
@@ -186,9 +189,10 @@ export class ArchiveStore {
|
|
|
186
189
|
});
|
|
187
190
|
};
|
|
188
191
|
|
|
189
|
-
private processFinalizedCheckpoint = async (finalized:
|
|
192
|
+
private processFinalizedCheckpoint = async (finalized: CheckpointWithPayloadStatus): Promise<void> => {
|
|
190
193
|
try {
|
|
191
194
|
const finalizedEpoch = finalized.epoch;
|
|
195
|
+
const finalizedFork = this.chain.config.getForkSeqAtEpoch(finalizedEpoch);
|
|
192
196
|
this.logger.verbose("Start processing finalized checkpoint", {epoch: finalizedEpoch, rootHex: finalized.rootHex});
|
|
193
197
|
|
|
194
198
|
let timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
@@ -206,6 +210,12 @@ export class ArchiveStore {
|
|
|
206
210
|
);
|
|
207
211
|
timer?.({source: ArchiveStoreTask.ArchiveBlocks});
|
|
208
212
|
|
|
213
|
+
if (finalizedFork >= ForkSeq.gloas) {
|
|
214
|
+
timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
215
|
+
await archiveExecutionPayloadEnvelopes(this.chain, finalized);
|
|
216
|
+
timer?.({source: ArchiveStoreTask.ArchivePayloads});
|
|
217
|
+
}
|
|
218
|
+
|
|
209
219
|
if (this.opts.pruneHistory) {
|
|
210
220
|
timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
211
221
|
await pruneHistory(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
2
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
2
|
import {
|
|
4
3
|
BeaconStateAllForks,
|
|
5
4
|
CachedBeaconStateAllForks,
|
|
6
5
|
DataAvailabilityStatus,
|
|
7
6
|
ExecutionPayloadStatus,
|
|
7
|
+
PubkeyCache,
|
|
8
8
|
createCachedBeaconState,
|
|
9
9
|
stateTransition,
|
|
10
10
|
} from "@lodestar/state-transition";
|
|
@@ -15,16 +15,16 @@ import {HistoricalStateRegenMetrics} from "./metrics.js";
|
|
|
15
15
|
import {RegenErrorType} from "./types.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Populate a
|
|
18
|
+
* Populate a PubkeyCache with any new entries based on a BeaconState
|
|
19
19
|
*/
|
|
20
|
-
export function syncPubkeyCache(state: BeaconStateAllForks,
|
|
20
|
+
export function syncPubkeyCache(state: BeaconStateAllForks, pubkeyCache: PubkeyCache): void {
|
|
21
21
|
// Get the validators sub tree once for all the loop
|
|
22
22
|
const validators = state.validators;
|
|
23
23
|
|
|
24
24
|
const newCount = state.validators.length;
|
|
25
|
-
for (let i =
|
|
25
|
+
for (let i = pubkeyCache.size; i < newCount; i++) {
|
|
26
26
|
const pubkey = validators.getReadonly(i).pubkey;
|
|
27
|
-
|
|
27
|
+
pubkeyCache.set(i, pubkey);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ export async function getNearestState(
|
|
|
35
35
|
slot: number,
|
|
36
36
|
config: BeaconConfig,
|
|
37
37
|
db: IBeaconDb,
|
|
38
|
-
|
|
38
|
+
pubkeyCache: PubkeyCache
|
|
39
39
|
): Promise<CachedBeaconStateAllForks> {
|
|
40
40
|
const stateBytesArr = await db.stateArchive.binaries({limit: 1, lte: slot, reverse: true});
|
|
41
41
|
if (!stateBytesArr.length) {
|
|
@@ -44,14 +44,13 @@ export async function getNearestState(
|
|
|
44
44
|
|
|
45
45
|
const stateBytes = stateBytesArr[0];
|
|
46
46
|
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
47
|
-
syncPubkeyCache(state,
|
|
47
|
+
syncPubkeyCache(state, pubkeyCache);
|
|
48
48
|
|
|
49
49
|
return createCachedBeaconState(
|
|
50
50
|
state,
|
|
51
51
|
{
|
|
52
52
|
config,
|
|
53
|
-
|
|
54
|
-
index2pubkey: [],
|
|
53
|
+
pubkeyCache,
|
|
55
54
|
},
|
|
56
55
|
{
|
|
57
56
|
skipSyncPubkeys: true,
|
|
@@ -66,13 +65,13 @@ export async function getHistoricalState(
|
|
|
66
65
|
slot: number,
|
|
67
66
|
config: BeaconConfig,
|
|
68
67
|
db: IBeaconDb,
|
|
69
|
-
|
|
68
|
+
pubkeyCache: PubkeyCache,
|
|
70
69
|
metrics?: HistoricalStateRegenMetrics
|
|
71
70
|
): Promise<Uint8Array> {
|
|
72
71
|
const regenTimer = metrics?.regenTime.startTimer();
|
|
73
72
|
|
|
74
73
|
const loadStateTimer = metrics?.loadStateTime.startTimer();
|
|
75
|
-
let state = await getNearestState(slot, config, db,
|
|
74
|
+
let state = await getNearestState(slot, config, db, pubkeyCache).catch((e) => {
|
|
76
75
|
metrics?.regenErrorCount.inc({reason: RegenErrorType.loadState});
|
|
77
76
|
throw e;
|
|
78
77
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import worker from "node:worker_threads";
|
|
2
|
-
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
3
2
|
import {Transfer, expose} from "@chainsafe/threads/worker";
|
|
4
3
|
import {chainConfigFromJson, createBeaconConfig} from "@lodestar/config";
|
|
5
4
|
import {LevelDbController} from "@lodestar/db/controller/level";
|
|
6
5
|
import {getNodeLogger} from "@lodestar/logger/node";
|
|
6
|
+
import {createPubkeyCache} from "@lodestar/state-transition";
|
|
7
7
|
import {BeaconDb} from "../../../db/index.js";
|
|
8
8
|
import {RegistryMetricCreator, collectNodeJSMetrics} from "../../../metrics/index.js";
|
|
9
9
|
import {JobFnQueue} from "../../../util/queue/fnQueue.js";
|
|
@@ -52,7 +52,7 @@ const queue = new JobFnQueue(
|
|
|
52
52
|
queueMetrics
|
|
53
53
|
);
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const pubkeyCache = createPubkeyCache();
|
|
56
56
|
|
|
57
57
|
const api: HistoricalStateWorkerApi = {
|
|
58
58
|
async close() {
|
|
@@ -65,7 +65,7 @@ const api: HistoricalStateWorkerApi = {
|
|
|
65
65
|
historicalStateRegenMetrics?.regenRequestCount.inc();
|
|
66
66
|
|
|
67
67
|
const stateBytes = await queue.push<Uint8Array>(() =>
|
|
68
|
-
getHistoricalState(slot, config, db,
|
|
68
|
+
getHistoricalState(slot, config, db, pubkeyCache, historicalStateRegenMetrics)
|
|
69
69
|
);
|
|
70
70
|
const result = Transfer(stateBytes, [stateBytes.buffer]) as unknown as Uint8Array;
|
|
71
71
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {KeyValue} from "@lodestar/db";
|
|
4
|
-
import {IForkChoice} from "@lodestar/fork-choice";
|
|
4
|
+
import {CheckpointWithPayloadStatus, IForkChoice} from "@lodestar/fork-choice";
|
|
5
5
|
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
6
6
|
import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
7
|
-
import {Epoch,
|
|
7
|
+
import {Epoch, Slot} from "@lodestar/types";
|
|
8
8
|
import {Logger, fromAsync, fromHex, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
9
9
|
import {IBeaconDb} from "../../../db/index.js";
|
|
10
10
|
import {BlockArchiveBatchPutBinaryItem} from "../../../db/repositories/index.js";
|
|
@@ -19,7 +19,6 @@ const BLOCK_BATCH_SIZE = 256;
|
|
|
19
19
|
const BLOB_SIDECAR_BATCH_SIZE = 32;
|
|
20
20
|
|
|
21
21
|
type BlockRootSlot = {slot: Slot; root: Uint8Array};
|
|
22
|
-
type CheckpointHex = {epoch: Epoch; rootHex: RootHex};
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* Persist orphaned block to disk
|
|
@@ -53,7 +52,7 @@ export async function archiveBlocks(
|
|
|
53
52
|
forkChoice: IForkChoice,
|
|
54
53
|
lightclientServer: LightClientServer | undefined,
|
|
55
54
|
logger: Logger,
|
|
56
|
-
finalizedCheckpoint:
|
|
55
|
+
finalizedCheckpoint: CheckpointWithPayloadStatus,
|
|
57
56
|
currentEpoch: Epoch,
|
|
58
57
|
archiveDataEpochs?: number,
|
|
59
58
|
persistOrphanedBlocks?: boolean,
|
|
@@ -62,7 +61,7 @@ export async function archiveBlocks(
|
|
|
62
61
|
// Use fork choice to determine the blocks to archive and delete
|
|
63
62
|
// getAllAncestorBlocks response includes the finalized block, so it's also moved to the cold db
|
|
64
63
|
const {ancestors: finalizedCanonicalBlocks, nonAncestors: finalizedNonCanonicalBlocks} =
|
|
65
|
-
forkChoice.getAllAncestorAndNonAncestorBlocks(finalizedCheckpoint.rootHex);
|
|
64
|
+
forkChoice.getAllAncestorAndNonAncestorBlocks(finalizedCheckpoint.rootHex, finalizedCheckpoint.payloadStatus);
|
|
66
65
|
|
|
67
66
|
// NOTE: The finalized block will be exactly the first block of `epoch` or previous
|
|
68
67
|
const finalizedPostDeneb = finalizedCheckpoint.epoch >= config.DENEB_FORK_EPOCH;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {CheckpointWithHex} from "@lodestar/fork-choice";
|
|
2
|
+
import {IBeaconChain} from "../../interface.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Archives execution payload envelopes from hot DB to archive DB after finalization.
|
|
6
|
+
*/
|
|
7
|
+
export async function archiveExecutionPayloadEnvelopes(
|
|
8
|
+
chain: IBeaconChain,
|
|
9
|
+
_finalized: CheckpointWithHex
|
|
10
|
+
): Promise<void> {
|
|
11
|
+
const finalizedBlock = chain.forkChoice.getFinalizedBlock();
|
|
12
|
+
if (!finalizedBlock) return;
|
|
13
|
+
|
|
14
|
+
// TODO GLOAS: Implement payload envelope archival after epbs fork choice changes are merged
|
|
15
|
+
}
|
|
@@ -20,7 +20,7 @@ export async function updateBackfillRange(
|
|
|
20
20
|
try {
|
|
21
21
|
// Mark the sequence in backfill db from finalized block's slot till anchor slot as
|
|
22
22
|
// filled.
|
|
23
|
-
const finalizedBlockFC = chain.forkChoice.
|
|
23
|
+
const finalizedBlockFC = chain.forkChoice.getBlockHexDefaultStatus(finalized.rootHex);
|
|
24
24
|
if (finalizedBlockFC && finalizedBlockFC.slot > chain.anchorStateLatestBlockSlot) {
|
|
25
25
|
await db.backfilledRanges.put(finalizedBlockFC.slot, chain.anchorStateLatestBlockSlot);
|
|
26
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ForkName, ForkPostFulu, ForkPreDeneb, ForkPreGloas, NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
2
|
-
import {BeaconBlockBody, BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
|
|
1
|
+
import {ForkName, ForkPostFulu, ForkPostGloas, ForkPreDeneb, ForkPreGloas, NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
2
|
+
import {BeaconBlockBody, BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu, gloas} from "@lodestar/types";
|
|
3
3
|
import {byteArrayEquals, fromHex, prettyBytes, toRootHex, withTimeout} from "@lodestar/utils";
|
|
4
4
|
import {VersionedHashes} from "../../../execution/index.js";
|
|
5
5
|
import {kzgCommitmentToVersionedHash} from "../../../util/blobs.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
SourceMeta,
|
|
25
25
|
} from "./types.js";
|
|
26
26
|
|
|
27
|
-
export type BlockInput = BlockInputPreData | BlockInputBlobs | BlockInputColumns;
|
|
27
|
+
export type BlockInput = BlockInputPreData | BlockInputBlobs | BlockInputColumns | BlockInputNoData;
|
|
28
28
|
|
|
29
29
|
export function isBlockInputPreDeneb(blockInput: IBlockInput): blockInput is BlockInputPreData {
|
|
30
30
|
return blockInput.type === DAType.PreData;
|
|
@@ -37,6 +37,10 @@ export function isBlockInputColumns(blockInput: IBlockInput): blockInput is Bloc
|
|
|
37
37
|
return blockInput.type === DAType.Columns;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export function isBlockInputNoData(blockInput: IBlockInput): blockInput is BlockInputNoData {
|
|
41
|
+
return blockInput.type === DAType.NoData;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
function createPromise<T>(): PromiseParts<T> {
|
|
41
45
|
let resolve!: (value: T) => void;
|
|
42
46
|
let reject!: (e: Error) => void;
|
|
@@ -903,3 +907,64 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
903
907
|
return Promise.resolve(this.getSampledColumns());
|
|
904
908
|
}
|
|
905
909
|
}
|
|
910
|
+
|
|
911
|
+
type BlockInputNoDataState = {
|
|
912
|
+
hasBlock: true;
|
|
913
|
+
hasAllData: true;
|
|
914
|
+
block: SignedBeaconBlock<ForkPostGloas>;
|
|
915
|
+
source: SourceMeta;
|
|
916
|
+
timeCompleteSec: number;
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
export class BlockInputNoData extends AbstractBlockInput<ForkPostGloas, null> {
|
|
920
|
+
type = DAType.NoData as const;
|
|
921
|
+
|
|
922
|
+
state: BlockInputNoDataState;
|
|
923
|
+
|
|
924
|
+
private constructor(init: BlockInputInit, state: BlockInputNoDataState) {
|
|
925
|
+
super(init);
|
|
926
|
+
this.state = state;
|
|
927
|
+
this.dataPromise.resolve(null);
|
|
928
|
+
this.blockPromise.resolve(state.block);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
static createFromBlock(props: AddBlock<ForkPostGloas> & CreateBlockInputMeta): BlockInputNoData {
|
|
932
|
+
const init: BlockInputInit = {
|
|
933
|
+
daOutOfRange: props.daOutOfRange,
|
|
934
|
+
timeCreated: props.seenTimestampSec,
|
|
935
|
+
forkName: props.forkName,
|
|
936
|
+
slot: props.block.message.slot,
|
|
937
|
+
blockRootHex: props.blockRootHex,
|
|
938
|
+
parentRootHex: toRootHex(props.block.message.parentRoot),
|
|
939
|
+
};
|
|
940
|
+
const state: BlockInputNoDataState = {
|
|
941
|
+
hasBlock: true,
|
|
942
|
+
hasAllData: true,
|
|
943
|
+
block: props.block,
|
|
944
|
+
source: {
|
|
945
|
+
source: props.source,
|
|
946
|
+
seenTimestampSec: props.seenTimestampSec,
|
|
947
|
+
peerIdStr: props.peerIdStr,
|
|
948
|
+
},
|
|
949
|
+
timeCompleteSec: props.seenTimestampSec,
|
|
950
|
+
};
|
|
951
|
+
return new BlockInputNoData(init, state);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
addBlock(_: AddBlock<ForkPostGloas>, opts = {throwOnDuplicateAdd: true}): void {
|
|
955
|
+
if (opts.throwOnDuplicateAdd) {
|
|
956
|
+
throw new BlockInputError(
|
|
957
|
+
{
|
|
958
|
+
code: BlockInputErrorCode.INVALID_CONSTRUCTION,
|
|
959
|
+
blockRoot: this.blockRootHex,
|
|
960
|
+
},
|
|
961
|
+
"Cannot addBlock to BlockInputNoData - block already exists"
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
getBlobKzgCommitments(): deneb.BlobKzgCommitments {
|
|
967
|
+
return (this.state.block.message.body as gloas.BeaconBlockBody).signedExecutionPayloadBid.message
|
|
968
|
+
.blobKzgCommitments;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
@@ -6,6 +6,7 @@ export enum DAType {
|
|
|
6
6
|
PreData = "pre-data",
|
|
7
7
|
Blobs = "blobs",
|
|
8
8
|
Columns = "columns",
|
|
9
|
+
NoData = "no-data",
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export type DAData = null | deneb.BlobSidecars | fulu.DataColumnSidecars;
|
|
@@ -99,6 +100,18 @@ export type MissingColumnMeta = {
|
|
|
99
100
|
versionedHashes: VersionedHashes;
|
|
100
101
|
};
|
|
101
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Minimal interface required to write data columns to the DB.
|
|
105
|
+
* Used by `writeDataColumnsToDb` and designed to be reusable across forks (e.g. Fulu, Gloas).
|
|
106
|
+
*/
|
|
107
|
+
export interface IDataColumnsInput {
|
|
108
|
+
readonly slot: Slot;
|
|
109
|
+
readonly blockRootHex: string;
|
|
110
|
+
getCustodyColumns(): fulu.DataColumnSidecars;
|
|
111
|
+
hasComputedAllData(): boolean;
|
|
112
|
+
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<fulu.DataColumnSidecars>;
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
/**
|
|
103
116
|
* This is used to validate that BlockInput implementations follow some minimal subset of operations
|
|
104
117
|
* and that adding a new implementation won't break consumers that rely on this subset.
|