@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
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.41.0-dev.
|
|
14
|
+
"version": "1.41.0-dev.e6c853da0e",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -110,10 +110,9 @@
|
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@chainsafe/as-sha256": "^1.2.0",
|
|
112
112
|
"@chainsafe/blst": "^2.2.0",
|
|
113
|
-
"@chainsafe/discv5": "^
|
|
114
|
-
"@chainsafe/enr": "^
|
|
115
|
-
"@chainsafe/libp2p-
|
|
116
|
-
"@chainsafe/libp2p-noise": "^16.1.5",
|
|
113
|
+
"@chainsafe/discv5": "^12.0.0",
|
|
114
|
+
"@chainsafe/enr": "^6.0.0",
|
|
115
|
+
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
117
116
|
"@chainsafe/persistent-merkle-tree": "^1.2.1",
|
|
118
117
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
119
118
|
"@chainsafe/pubkey-index-map": "^3.0.0",
|
|
@@ -125,39 +124,38 @@
|
|
|
125
124
|
"@fastify/cors": "^10.0.1",
|
|
126
125
|
"@fastify/swagger": "^9.0.0",
|
|
127
126
|
"@fastify/swagger-ui": "^5.0.1",
|
|
128
|
-
"@libp2p/bootstrap": "^
|
|
129
|
-
"@libp2p/crypto": "^5.
|
|
130
|
-
"@libp2p/
|
|
131
|
-
"@libp2p/
|
|
132
|
-
"@libp2p/
|
|
133
|
-
"@libp2p/
|
|
134
|
-
"@libp2p/
|
|
135
|
-
"@libp2p/
|
|
136
|
-
"@libp2p/
|
|
137
|
-
"@
|
|
138
|
-
"@lodestar/
|
|
139
|
-
"@lodestar/
|
|
140
|
-
"@lodestar/
|
|
141
|
-
"@lodestar/
|
|
142
|
-
"@lodestar/
|
|
143
|
-
"@lodestar/
|
|
144
|
-
"@lodestar/
|
|
145
|
-
"@lodestar/
|
|
146
|
-
"@lodestar/
|
|
147
|
-
"@lodestar/
|
|
148
|
-
"@lodestar/
|
|
149
|
-
"@
|
|
150
|
-
"
|
|
151
|
-
"datastore-
|
|
152
|
-
"datastore-
|
|
127
|
+
"@libp2p/bootstrap": "^12.0.13",
|
|
128
|
+
"@libp2p/crypto": "^5.1.13",
|
|
129
|
+
"@libp2p/gossipsub": "^15.0.14",
|
|
130
|
+
"@libp2p/identify": "^4.0.12",
|
|
131
|
+
"@libp2p/interface": "^3.1.0",
|
|
132
|
+
"@libp2p/mdns": "^12.0.13",
|
|
133
|
+
"@libp2p/mplex": "^12.0.13",
|
|
134
|
+
"@libp2p/peer-id": "^6.0.4",
|
|
135
|
+
"@libp2p/prometheus-metrics": "^5.0.13",
|
|
136
|
+
"@libp2p/tcp": "^11.0.12",
|
|
137
|
+
"@lodestar/api": "^1.41.0-dev.e6c853da0e",
|
|
138
|
+
"@lodestar/config": "^1.41.0-dev.e6c853da0e",
|
|
139
|
+
"@lodestar/db": "^1.41.0-dev.e6c853da0e",
|
|
140
|
+
"@lodestar/fork-choice": "^1.41.0-dev.e6c853da0e",
|
|
141
|
+
"@lodestar/light-client": "^1.41.0-dev.e6c853da0e",
|
|
142
|
+
"@lodestar/logger": "^1.41.0-dev.e6c853da0e",
|
|
143
|
+
"@lodestar/params": "^1.41.0-dev.e6c853da0e",
|
|
144
|
+
"@lodestar/reqresp": "^1.41.0-dev.e6c853da0e",
|
|
145
|
+
"@lodestar/state-transition": "^1.41.0-dev.e6c853da0e",
|
|
146
|
+
"@lodestar/types": "^1.41.0-dev.e6c853da0e",
|
|
147
|
+
"@lodestar/utils": "^1.41.0-dev.e6c853da0e",
|
|
148
|
+
"@lodestar/validator": "^1.41.0-dev.e6c853da0e",
|
|
149
|
+
"@multiformats/multiaddr": "^13.0.1",
|
|
150
|
+
"datastore-core": "^11.0.2",
|
|
151
|
+
"datastore-fs": "^11.0.2",
|
|
152
|
+
"datastore-level": "^12.0.2",
|
|
153
153
|
"deepmerge": "^4.3.1",
|
|
154
|
-
"fastify": "^5.
|
|
155
|
-
"interface-datastore": "^
|
|
156
|
-
"it-all": "^3.0.4",
|
|
157
|
-
"it-pipe": "^3.0.1",
|
|
154
|
+
"fastify": "^5.8.1",
|
|
155
|
+
"interface-datastore": "^9.0.2",
|
|
158
156
|
"jwt-simple": "0.5.6",
|
|
159
|
-
"libp2p": "
|
|
160
|
-
"multiformats": "^
|
|
157
|
+
"libp2p": "3.1.5",
|
|
158
|
+
"multiformats": "^13.4.2",
|
|
161
159
|
"prom-client": "^15.1.0",
|
|
162
160
|
"qs": "^6.11.1",
|
|
163
161
|
"strict-event-emitter-types": "^2.0.0",
|
|
@@ -167,14 +165,13 @@
|
|
|
167
165
|
},
|
|
168
166
|
"devDependencies": {
|
|
169
167
|
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
170
|
-
"@libp2p/interface-internal": "^
|
|
171
|
-
"@libp2p/logger": "^
|
|
172
|
-
"@
|
|
168
|
+
"@libp2p/interface-internal": "^3.0.12",
|
|
169
|
+
"@libp2p/logger": "^6.2.2",
|
|
170
|
+
"@libp2p/utils": "^7.0.12",
|
|
171
|
+
"@lodestar/spec-test-util": "^1.41.0-dev.e6c853da0e",
|
|
173
172
|
"@types/js-yaml": "^4.0.5",
|
|
174
173
|
"@types/qs": "^6.9.7",
|
|
175
174
|
"@types/tmp": "^0.2.3",
|
|
176
|
-
"it-drain": "^3.0.3",
|
|
177
|
-
"it-pair": "^2.0.6",
|
|
178
175
|
"js-yaml": "^4.1.0",
|
|
179
176
|
"rewiremock": "^3.14.5",
|
|
180
177
|
"rimraf": "^4.4.1",
|
|
@@ -188,5 +185,5 @@
|
|
|
188
185
|
"beacon",
|
|
189
186
|
"blockchain"
|
|
190
187
|
],
|
|
191
|
-
"gitHead": "
|
|
188
|
+
"gitHead": "d5e94a7618eff50c0c78b35bc423ae4fa481ff0e"
|
|
192
189
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApiError, ApplicationMethods} from "@lodestar/api/server";
|
|
3
|
+
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
3
4
|
import {
|
|
5
|
+
BUILDER_INDEX_SELF_BUILD,
|
|
4
6
|
ForkPostBellatrix,
|
|
5
7
|
ForkPostFulu,
|
|
6
8
|
ForkPreGloas,
|
|
@@ -27,6 +29,7 @@ import {
|
|
|
27
29
|
WithOptionalBytes,
|
|
28
30
|
deneb,
|
|
29
31
|
fulu,
|
|
32
|
+
gloas,
|
|
30
33
|
isDenebBlockContents,
|
|
31
34
|
sszTypesFor,
|
|
32
35
|
} from "@lodestar/types";
|
|
@@ -42,6 +45,7 @@ import {
|
|
|
42
45
|
ProduceFullBellatrix,
|
|
43
46
|
ProduceFullDeneb,
|
|
44
47
|
ProduceFullFulu,
|
|
48
|
+
ProduceFullGloas,
|
|
45
49
|
} from "../../../../chain/produceBlock/index.js";
|
|
46
50
|
import {validateGossipBlock} from "../../../../chain/validation/block.js";
|
|
47
51
|
import {OpSource} from "../../../../chain/validatorMonitor.js";
|
|
@@ -51,7 +55,7 @@ import {
|
|
|
51
55
|
kzgCommitmentToVersionedHash,
|
|
52
56
|
reconstructBlobs,
|
|
53
57
|
} from "../../../../util/blobs.js";
|
|
54
|
-
import {getDataColumnSidecarsFromBlock} from "../../../../util/dataColumns.js";
|
|
58
|
+
import {getDataColumnSidecarsForGloas, getDataColumnSidecarsFromBlock} from "../../../../util/dataColumns.js";
|
|
55
59
|
import {isOptimisticBlock} from "../../../../util/forkChoice.js";
|
|
56
60
|
import {kzg} from "../../../../util/kzg.js";
|
|
57
61
|
import {promiseAllMaybeAsync} from "../../../../util/promises.js";
|
|
@@ -93,6 +97,7 @@ export function getBeaconBlockApi({
|
|
|
93
97
|
const fork = config.getForkName(slot);
|
|
94
98
|
const blockRoot = toRootHex(chain.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(signedBlock.message));
|
|
95
99
|
|
|
100
|
+
// TODO GLOAS: handle new BlockInput type
|
|
96
101
|
const blockForImport = chain.seenBlockInputCache.getByBlock({
|
|
97
102
|
block: signedBlock,
|
|
98
103
|
source: BlockInputSource.api,
|
|
@@ -201,7 +206,7 @@ export function getBeaconBlockApi({
|
|
|
201
206
|
case routes.beacon.BroadcastValidation.consensus: {
|
|
202
207
|
// check if this beacon node produced the block else run validations
|
|
203
208
|
if (!blockLocallyProduced) {
|
|
204
|
-
const parentBlock = chain.forkChoice.
|
|
209
|
+
const parentBlock = chain.forkChoice.getBlockDefaultStatus(signedBlock.message.parentRoot);
|
|
205
210
|
if (parentBlock === null) {
|
|
206
211
|
chain.emitter.emit(ChainEvent.unknownParent, {
|
|
207
212
|
blockInput: blockForImport,
|
|
@@ -309,7 +314,9 @@ export function getBeaconBlockApi({
|
|
|
309
314
|
];
|
|
310
315
|
const sentPeersArr = await promiseAllMaybeAsync<number | void>(publishPromises);
|
|
311
316
|
|
|
312
|
-
if (
|
|
317
|
+
if (isForkPostGloas(fork)) {
|
|
318
|
+
// After gloas, data columns are not published with the block but when publishing the execution payload envelope
|
|
319
|
+
} else if (isForkPostFulu(fork)) {
|
|
313
320
|
let columnsPublishedWithZeroPeers = 0;
|
|
314
321
|
// sent peers per topic are logged in network.publishGossip(), here we only track metrics for it
|
|
315
322
|
// starting from fulu, we have to push to 128 subnets so need to make sure we have enough sent peers per topic
|
|
@@ -632,6 +639,143 @@ export function getBeaconBlockApi({
|
|
|
632
639
|
await publishBlock(args, context, opts);
|
|
633
640
|
},
|
|
634
641
|
|
|
642
|
+
async publishExecutionPayloadEnvelope({signedExecutionPayloadEnvelope}) {
|
|
643
|
+
const seenTimestampSec = Date.now() / 1000;
|
|
644
|
+
const envelope = signedExecutionPayloadEnvelope.message;
|
|
645
|
+
const slot = envelope.slot;
|
|
646
|
+
const fork = config.getForkName(slot);
|
|
647
|
+
const blockRootHex = toRootHex(envelope.beaconBlockRoot);
|
|
648
|
+
|
|
649
|
+
if (!isForkPostGloas(fork)) {
|
|
650
|
+
throw new ApiError(400, `publishExecutionPayloadEnvelope not supported for pre-gloas fork=${fork}`);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// TODO GLOAS: review checks, do we want to implement `broadcast_validation`?
|
|
654
|
+
const block = chain.forkChoice.getBlockHex(blockRootHex, PayloadStatus.EMPTY);
|
|
655
|
+
if (block === null) {
|
|
656
|
+
throw new ApiError(404, `Block not found for beacon block root ${blockRootHex}`);
|
|
657
|
+
}
|
|
658
|
+
if (block.slot !== slot) {
|
|
659
|
+
throw new ApiError(400, `Envelope slot ${slot} does not match block slot ${block.slot}`);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const isSelfBuild = envelope.builderIndex === BUILDER_INDEX_SELF_BUILD;
|
|
663
|
+
let dataColumnSidecars: gloas.DataColumnSidecars = [];
|
|
664
|
+
|
|
665
|
+
if (isSelfBuild) {
|
|
666
|
+
// For self-builds, construct and publish data column sidecars from cached block production data
|
|
667
|
+
const cachedResult = chain.blockProductionCache.get(blockRootHex) as ProduceFullGloas | undefined;
|
|
668
|
+
if (cachedResult === undefined) {
|
|
669
|
+
throw new ApiError(404, `No cached block production result found for block root ${blockRootHex}`);
|
|
670
|
+
}
|
|
671
|
+
if (!isForkPostGloas(cachedResult.fork)) {
|
|
672
|
+
throw new ApiError(400, `Cached block production result is for pre-gloas fork=${cachedResult.fork}`);
|
|
673
|
+
}
|
|
674
|
+
if (cachedResult.type !== BlockType.Full) {
|
|
675
|
+
throw new ApiError(400, "Cached block production result is not full block");
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
if (cachedResult.cells && cachedResult.blobsBundle.commitments.length > 0) {
|
|
679
|
+
const cellsAndProofs = cachedResult.cells.map((rowCells, rowIndex) => ({
|
|
680
|
+
cells: rowCells,
|
|
681
|
+
proofs: cachedResult.blobsBundle.proofs.slice(
|
|
682
|
+
rowIndex * NUMBER_OF_COLUMNS,
|
|
683
|
+
(rowIndex + 1) * NUMBER_OF_COLUMNS
|
|
684
|
+
),
|
|
685
|
+
}));
|
|
686
|
+
|
|
687
|
+
dataColumnSidecars = getDataColumnSidecarsForGloas(slot, envelope.beaconBlockRoot, cellsAndProofs);
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
// TODO GLOAS: will this api be used by builders or only for self-building?
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// TODO GLOAS: Verify execution payload envelope signature
|
|
694
|
+
// For self-builds, the proposer signs with their own validator key
|
|
695
|
+
// For external builders, verify using the builder's registered pubkey
|
|
696
|
+
// Use verify_execution_payload_envelope_signature(state, signed_envelope)
|
|
697
|
+
|
|
698
|
+
// TODO GLOAS: Process execution payload via state transition
|
|
699
|
+
// Call process_execution_payload(state, signed_envelope, execution_engine)
|
|
700
|
+
|
|
701
|
+
// TODO GLOAS: Update fork choice with the execution payload
|
|
702
|
+
// Call on_execution_payload(store, signed_envelope) to update fork choice state
|
|
703
|
+
|
|
704
|
+
// TODO GLOAS: Add envelope and data columns to block input via seenBlockInputCache
|
|
705
|
+
// and trigger block import (Gloas block import requires both beacon block and envelope)
|
|
706
|
+
|
|
707
|
+
const valLogMeta = {
|
|
708
|
+
slot,
|
|
709
|
+
blockRoot: blockRootHex,
|
|
710
|
+
builderIndex: envelope.builderIndex,
|
|
711
|
+
isSelfBuild,
|
|
712
|
+
dataColumns: dataColumnSidecars.length,
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
// If called near a slot boundary (e.g. late in slot N-1), hold briefly so gossip aligns with slot N.
|
|
716
|
+
const msToBlockSlot = computeTimeAtSlot(config, slot, chain.genesisTime) * 1000 - Date.now();
|
|
717
|
+
if (msToBlockSlot <= MAX_API_CLOCK_DISPARITY_MS && msToBlockSlot > 0) {
|
|
718
|
+
await sleep(msToBlockSlot);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
722
|
+
metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.api}, delaySec);
|
|
723
|
+
|
|
724
|
+
chain.logger.info("Publishing execution payload envelope", valLogMeta);
|
|
725
|
+
|
|
726
|
+
// Publish envelope and data columns
|
|
727
|
+
const publishPromises = [
|
|
728
|
+
// Gossip the signed execution payload envelope first
|
|
729
|
+
() => network.publishSignedExecutionPayloadEnvelope(signedExecutionPayloadEnvelope),
|
|
730
|
+
// For self-builds, publish all data column sidecars
|
|
731
|
+
...dataColumnSidecars.map((dataColumnSidecar) => () => network.publishDataColumnSidecar(dataColumnSidecar)),
|
|
732
|
+
];
|
|
733
|
+
|
|
734
|
+
const sentPeersArr = await promiseAllMaybeAsync<number | void>(publishPromises);
|
|
735
|
+
|
|
736
|
+
// Track metrics for data column publishing
|
|
737
|
+
if (dataColumnSidecars.length > 0) {
|
|
738
|
+
let columnsPublishedWithZeroPeers = 0;
|
|
739
|
+
// Skip first entry (envelope), track data columns
|
|
740
|
+
for (let i = 1; i < sentPeersArr.length; i++) {
|
|
741
|
+
const sentPeers = sentPeersArr[i] as number;
|
|
742
|
+
metrics?.dataColumns.sentPeersPerSubnet.observe(sentPeers);
|
|
743
|
+
if (sentPeers === 0) {
|
|
744
|
+
columnsPublishedWithZeroPeers++;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
if (columnsPublishedWithZeroPeers > 0) {
|
|
748
|
+
chain.logger.warn("Published data columns to 0 peers, increased risk of reorg", {
|
|
749
|
+
slot,
|
|
750
|
+
blockRoot: blockRootHex,
|
|
751
|
+
columns: columnsPublishedWithZeroPeers,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
metrics?.dataColumns.bySource.inc({source: BlockInputSource.api}, dataColumnSidecars.length);
|
|
756
|
+
|
|
757
|
+
if (chain.emitter.listenerCount(routes.events.EventType.dataColumnSidecar)) {
|
|
758
|
+
// TODO GLOAS: revisit this, we likely don't wanna emit KZG commitments anymore
|
|
759
|
+
const cachedResult = chain.blockProductionCache.get(blockRootHex) as ProduceFullGloas | undefined;
|
|
760
|
+
const kzgCommitments = cachedResult?.blobsBundle.commitments.map(toHex) ?? [];
|
|
761
|
+
for (const dataColumnSidecar of dataColumnSidecars) {
|
|
762
|
+
chain.emitter.emit(routes.events.EventType.dataColumnSidecar, {
|
|
763
|
+
blockRoot: blockRootHex,
|
|
764
|
+
slot,
|
|
765
|
+
index: dataColumnSidecar.index,
|
|
766
|
+
kzgCommitments,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
chain.logger.info("Published execution payload envelope", {
|
|
773
|
+
...valLogMeta,
|
|
774
|
+
delaySec,
|
|
775
|
+
sentPeers: (sentPeersArr[0] as number) ?? 0,
|
|
776
|
+
});
|
|
777
|
+
},
|
|
778
|
+
|
|
635
779
|
async getBlobSidecars({blockId, indices}) {
|
|
636
780
|
assertUniqueItems(indices, "Duplicate indices provided");
|
|
637
781
|
|
|
@@ -95,14 +95,14 @@ export function getBeaconStateApi({
|
|
|
95
95
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
96
96
|
const currentEpoch = getCurrentEpoch(state);
|
|
97
97
|
const {validators, balances} = state; // Get the validators sub tree once for all the loop
|
|
98
|
-
const {
|
|
98
|
+
const {pubkeyCache} = chain;
|
|
99
99
|
|
|
100
100
|
const validatorResponses: routes.beacon.ValidatorResponse[] = [];
|
|
101
101
|
if (validatorIds.length) {
|
|
102
102
|
assertUniqueItems(validatorIds, "Duplicate validator IDs provided");
|
|
103
103
|
|
|
104
104
|
for (const id of validatorIds) {
|
|
105
|
-
const resp = getStateValidatorIndex(id, state,
|
|
105
|
+
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
106
106
|
if (resp.valid) {
|
|
107
107
|
const validatorIndex = resp.validatorIndex;
|
|
108
108
|
const validator = validators.getReadonly(validatorIndex);
|
|
@@ -127,7 +127,7 @@ export function getBeaconStateApi({
|
|
|
127
127
|
if (statuses.length) {
|
|
128
128
|
assertUniqueItems(statuses, "Duplicate statuses provided");
|
|
129
129
|
|
|
130
|
-
const validatorsByStatus = filterStateValidatorsByStatus(statuses, state,
|
|
130
|
+
const validatorsByStatus = filterStateValidatorsByStatus(statuses, state, pubkeyCache, currentEpoch);
|
|
131
131
|
return {
|
|
132
132
|
data: validatorsByStatus,
|
|
133
133
|
meta: {executionOptimistic, finalized},
|
|
@@ -154,7 +154,7 @@ export function getBeaconStateApi({
|
|
|
154
154
|
|
|
155
155
|
async postStateValidatorIdentities({stateId, validatorIds = []}) {
|
|
156
156
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
157
|
-
const {
|
|
157
|
+
const {pubkeyCache} = chain;
|
|
158
158
|
|
|
159
159
|
let validatorIdentities: routes.beacon.ValidatorIdentities;
|
|
160
160
|
|
|
@@ -163,7 +163,7 @@ export function getBeaconStateApi({
|
|
|
163
163
|
|
|
164
164
|
validatorIdentities = [];
|
|
165
165
|
for (const id of validatorIds) {
|
|
166
|
-
const resp = getStateValidatorIndex(id, state,
|
|
166
|
+
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
167
167
|
if (resp.valid) {
|
|
168
168
|
const index = resp.validatorIndex;
|
|
169
169
|
const {pubkey, activationEpoch} = state.validators.getReadonly(index);
|
|
@@ -187,9 +187,9 @@ export function getBeaconStateApi({
|
|
|
187
187
|
|
|
188
188
|
async getStateValidator({stateId, validatorId}) {
|
|
189
189
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
190
|
-
const {
|
|
190
|
+
const {pubkeyCache} = chain;
|
|
191
191
|
|
|
192
|
-
const resp = getStateValidatorIndex(validatorId, state,
|
|
192
|
+
const resp = getStateValidatorIndex(validatorId, state, pubkeyCache);
|
|
193
193
|
if (!resp.valid) {
|
|
194
194
|
throw new ApiError(resp.code, resp.reason);
|
|
195
195
|
}
|
|
@@ -214,7 +214,7 @@ export function getBeaconStateApi({
|
|
|
214
214
|
|
|
215
215
|
const balances: routes.beacon.ValidatorBalance[] = [];
|
|
216
216
|
for (const id of validatorIds) {
|
|
217
|
-
const resp = getStateValidatorIndex(id, state, chain.
|
|
217
|
+
const resp = getStateValidatorIndex(id, state, chain.pubkeyCache);
|
|
218
218
|
|
|
219
219
|
if (resp.valid) {
|
|
220
220
|
balances.push({
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
2
1
|
import {routes} from "@lodestar/api";
|
|
3
2
|
import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
|
|
4
3
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
5
|
-
import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
6
|
-
import {
|
|
4
|
+
import {BeaconStateAllForks, CachedBeaconStateAllForks, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
+
import {
|
|
6
|
+
BLSPubkey,
|
|
7
|
+
Epoch,
|
|
8
|
+
RootHex,
|
|
9
|
+
Slot,
|
|
10
|
+
ValidatorIndex,
|
|
11
|
+
getValidatorStatus,
|
|
12
|
+
mapToGeneralStatus,
|
|
13
|
+
phase0,
|
|
14
|
+
} from "@lodestar/types";
|
|
7
15
|
import {fromHex} from "@lodestar/utils";
|
|
8
16
|
import {IBeaconChain} from "../../../../chain/index.js";
|
|
9
17
|
import {ApiError, ValidationError} from "../../errors.js";
|
|
@@ -65,28 +73,6 @@ export async function getStateResponseWithRegen(
|
|
|
65
73
|
return res;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
type GeneralValidatorStatus = "active" | "pending" | "exited" | "withdrawal";
|
|
69
|
-
|
|
70
|
-
function mapToGeneralStatus(subStatus: routes.beacon.ValidatorStatus): GeneralValidatorStatus {
|
|
71
|
-
switch (subStatus) {
|
|
72
|
-
case "active_ongoing":
|
|
73
|
-
case "active_exiting":
|
|
74
|
-
case "active_slashed":
|
|
75
|
-
return "active";
|
|
76
|
-
case "pending_initialized":
|
|
77
|
-
case "pending_queued":
|
|
78
|
-
return "pending";
|
|
79
|
-
case "exited_slashed":
|
|
80
|
-
case "exited_unslashed":
|
|
81
|
-
return "exited";
|
|
82
|
-
case "withdrawal_possible":
|
|
83
|
-
case "withdrawal_done":
|
|
84
|
-
return "withdrawal";
|
|
85
|
-
default:
|
|
86
|
-
throw new Error(`Unknown substatus: ${subStatus}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
76
|
export function toValidatorResponse(
|
|
91
77
|
index: ValidatorIndex,
|
|
92
78
|
validator: phase0.Validator,
|
|
@@ -104,7 +90,7 @@ export function toValidatorResponse(
|
|
|
104
90
|
export function filterStateValidatorsByStatus(
|
|
105
91
|
statuses: string[],
|
|
106
92
|
state: BeaconStateAllForks,
|
|
107
|
-
|
|
93
|
+
pubkeyCache: PubkeyCache,
|
|
108
94
|
currentEpoch: Epoch
|
|
109
95
|
): routes.beacon.ValidatorResponse[] {
|
|
110
96
|
const responses: routes.beacon.ValidatorResponse[] = [];
|
|
@@ -115,7 +101,7 @@ export function filterStateValidatorsByStatus(
|
|
|
115
101
|
const validatorStatus = getValidatorStatus(validator, currentEpoch);
|
|
116
102
|
const generalStatus = mapToGeneralStatus(validatorStatus);
|
|
117
103
|
|
|
118
|
-
const resp = getStateValidatorIndex(validator.pubkey, state,
|
|
104
|
+
const resp = getStateValidatorIndex(validator.pubkey, state, pubkeyCache);
|
|
119
105
|
if (resp.valid && (statusSet.has(validatorStatus) || statusSet.has(generalStatus))) {
|
|
120
106
|
responses.push(
|
|
121
107
|
toValidatorResponse(resp.validatorIndex, validator, state.balances.get(resp.validatorIndex), currentEpoch)
|
|
@@ -132,7 +118,7 @@ type StateValidatorIndexResponse =
|
|
|
132
118
|
export function getStateValidatorIndex(
|
|
133
119
|
id: routes.beacon.ValidatorId | BLSPubkey,
|
|
134
120
|
state: BeaconStateAllForks,
|
|
135
|
-
|
|
121
|
+
pubkeyCache: PubkeyCache
|
|
136
122
|
): StateValidatorIndexResponse {
|
|
137
123
|
if (typeof id === "string") {
|
|
138
124
|
// mutate `id` and fallthrough to below
|
|
@@ -160,7 +146,7 @@ export function getStateValidatorIndex(
|
|
|
160
146
|
}
|
|
161
147
|
|
|
162
148
|
// typeof id === Uint8Array
|
|
163
|
-
const validatorIndex =
|
|
149
|
+
const validatorIndex = pubkeyCache.getIndex(id);
|
|
164
150
|
if (validatorIndex === null) {
|
|
165
151
|
return {valid: false, code: 404, reason: "Validator pubkey not found in state"};
|
|
166
152
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {ExecutionStatus} from "@lodestar/fork-choice";
|
|
4
|
-
import {ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
|
-
import {BeaconState,
|
|
4
|
+
import {ForkPostDeneb, ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
|
+
import {BeaconState, DataColumnSidecars, type SignedBeaconBlock, sszTypesFor} from "@lodestar/types";
|
|
6
6
|
import {toRootHex} from "@lodestar/utils";
|
|
7
|
+
import {getBlobKzgCommitments} from "../../../util/dataColumns.js";
|
|
7
8
|
import {isOptimisticBlock} from "../../../util/forkChoice.js";
|
|
8
9
|
import {getStateSlotFromBytes} from "../../../util/multifork.js";
|
|
9
10
|
import {getBlockResponse} from "../beacon/blocks/utils.js";
|
|
@@ -42,6 +43,7 @@ export function getDebugApi({
|
|
|
42
43
|
validity: (() => {
|
|
43
44
|
switch (node.executionStatus) {
|
|
44
45
|
case ExecutionStatus.Valid:
|
|
46
|
+
case ExecutionStatus.PayloadSeparated:
|
|
45
47
|
return "valid";
|
|
46
48
|
case ExecutionStatus.Invalid:
|
|
47
49
|
return "invalid";
|
|
@@ -96,10 +98,10 @@ export function getDebugApi({
|
|
|
96
98
|
const fork = config.getForkName(block.message.slot);
|
|
97
99
|
const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
|
|
98
100
|
|
|
99
|
-
let dataColumnSidecars:
|
|
101
|
+
let dataColumnSidecars: DataColumnSidecars;
|
|
100
102
|
|
|
101
103
|
const blobCount = isForkPostDeneb(fork)
|
|
102
|
-
? (block
|
|
104
|
+
? getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostDeneb>).length
|
|
103
105
|
: 0;
|
|
104
106
|
|
|
105
107
|
if (isForkPostFulu(fork) && blobCount > 0) {
|
|
@@ -115,7 +117,9 @@ export function getDebugApi({
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
return {
|
|
118
|
-
data:
|
|
120
|
+
data: (indices
|
|
121
|
+
? dataColumnSidecars.filter(({index}) => indices.includes(index))
|
|
122
|
+
: dataColumnSidecars) as DataColumnSidecars,
|
|
119
123
|
meta: {
|
|
120
124
|
executionOptimistic,
|
|
121
125
|
finalized,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Connection,
|
|
1
|
+
import type {Connection, ConnectionStatus} from "@libp2p/interface";
|
|
2
2
|
import {routes} from "@lodestar/api";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -24,7 +24,7 @@ export function formatNodePeer(peerIdStr: string, connections: Connection[]): ro
|
|
|
24
24
|
* - Otherwise, the first closed connection
|
|
25
25
|
*/
|
|
26
26
|
export function getRelevantConnection(connections: Connection[]): Connection | null {
|
|
27
|
-
const byStatus = new Map<
|
|
27
|
+
const byStatus = new Map<ConnectionStatus, Connection>();
|
|
28
28
|
for (const conn of connections) {
|
|
29
29
|
if (conn.status === "open") return conn;
|
|
30
30
|
if (!byStatus.has(conn.status)) byStatus.set(conn.status, conn);
|
|
@@ -37,7 +37,7 @@ export function getRelevantConnection(connections: Connection[]): Connection | n
|
|
|
37
37
|
* Map libp2p connection status to the API's peer state notation
|
|
38
38
|
* @param status
|
|
39
39
|
*/
|
|
40
|
-
function getPeerState(status:
|
|
40
|
+
function getPeerState(status: ConnectionStatus): routes.node.PeerState {
|
|
41
41
|
switch (status) {
|
|
42
42
|
case "open":
|
|
43
43
|
return "connected";
|