@lodestar/beacon-node 1.39.1 → 1.40.0-dev.1020f27ca9
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 +15 -25
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -7
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +0 -12
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/config/constants.d.ts +3 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +5 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +3 -6
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +16 -3
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/proof/index.d.ts.map +1 -1
- package/lib/api/impl/proof/index.js +1 -2
- package/lib/api/impl/proof/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +10 -11
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +2 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +7 -3
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -3
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +23 -14
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +2 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +6 -0
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -9
- 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 +0 -14
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +0 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +9 -9
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +20 -28
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +3 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +5 -3
- 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 -2
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +4 -2
- 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 +9 -6
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +24 -6
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +201 -25
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/attestationError.d.ts +14 -1
- package/lib/chain/errors/attestationError.d.ts.map +1 -1
- package/lib/chain/errors/attestationError.js +8 -0
- package/lib/chain/errors/attestationError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +48 -0
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
- package/lib/chain/errors/executionPayloadBid.js +15 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
- package/lib/chain/errors/index.d.ts +3 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +3 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.d.ts +34 -0
- package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
- package/lib/chain/errors/payloadAttestation.js +13 -0
- package/lib/chain/errors/payloadAttestation.js.map +1 -0
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +18 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +1 -1
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +5 -3
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +23 -5
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/proofs.d.ts.map +1 -1
- package/lib/chain/lightClient/proofs.js +0 -2
- package/lib/chain/lightClient/proofs.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +5 -9
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +12 -141
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
- package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
- package/lib/chain/opPools/index.d.ts +2 -0
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +2 -0
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/opPool.js +5 -8
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
- package/lib/chain/opPools/payloadAttestationPool.js +109 -0
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +9 -10
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +6 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +4 -13
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +1 -1
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +5 -9
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +16 -40
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +6 -8
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +20 -34
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +3 -1
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +3 -1
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +5 -0
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
- package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
- package/lib/chain/shufflingCache.d.ts +16 -11
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +47 -41
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
- package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -6
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +17 -17
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +5 -6
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +35 -14
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts +2 -2
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +28 -9
- 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 +2 -2
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
- package/lib/chain/validation/blobSidecar.js +3 -3
- 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 +7 -4
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.js +9 -2
- package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +3 -3
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
- package/lib/chain/validation/executionPayloadBid.js +104 -0
- package/lib/chain/validation/executionPayloadBid.js.map +1 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
- package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
- package/lib/chain/validation/payloadAttestationMessage.js +72 -0
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
- package/lib/chain/validation/proposerSlashing.js +3 -2
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
- package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
- package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +3 -3
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
- package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
- package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js +3 -3
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +3 -3
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.js +1 -1
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +1 -1
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +2 -0
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +49 -7
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/repositories/checkpointState.d.ts +2 -6
- package/lib/db/repositories/checkpointState.d.ts.map +1 -1
- package/lib/db/repositories/checkpointState.js +3 -16
- package/lib/db/repositories/checkpointState.js.map +1 -1
- package/lib/db/repositories/stateArchive.d.ts +9 -9
- package/lib/db/repositories/stateArchive.d.ts.map +1 -1
- package/lib/db/repositories/stateArchive.js +6 -21
- package/lib/db/repositories/stateArchive.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +9 -6
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +34 -7
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +28 -6
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +67 -17
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +20 -2
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +3 -0
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +38 -2
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +77 -1
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +20 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +34 -3
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/index.js +16 -0
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +3 -0
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
- 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 +1 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.js +2 -2
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +17 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/backfill/backfill.js +2 -2
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/backfill/verify.d.ts +1 -2
- package/lib/sync/backfill/verify.d.ts.map +1 -1
- package/lib/sync/backfill/verify.js +2 -2
- package/lib/sync/backfill/verify.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +0 -1
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +0 -3
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +0 -3
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +17 -25
- package/src/api/impl/beacon/state/utils.ts +2 -22
- package/src/api/impl/config/constants.ts +8 -0
- package/src/api/impl/debug/index.ts +2 -6
- package/src/api/impl/lodestar/index.ts +19 -4
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +13 -14
- package/src/chain/ColumnReconstructionTracker.ts +8 -4
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -3
- package/src/chain/archiveStore/utils/archiveBlocks.ts +25 -14
- package/src/chain/blocks/blockInput/blockInput.ts +8 -0
- package/src/chain/blocks/importBlock.ts +15 -9
- package/src/chain/blocks/index.ts +0 -19
- package/src/chain/blocks/types.ts +0 -2
- package/src/chain/blocks/verifyBlock.ts +9 -12
- package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
- package/src/chain/blocks/writeBlockInputToDb.ts +24 -30
- package/src/chain/bls/multithread/index.ts +7 -4
- package/src/chain/bls/multithread/jobItem.ts +7 -3
- package/src/chain/bls/singleThread.ts +5 -3
- package/src/chain/bls/utils.ts +15 -7
- package/src/chain/chain.ts +230 -36
- package/src/chain/errors/attestationError.ts +11 -1
- package/src/chain/errors/executionPayloadBid.ts +35 -0
- package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
- package/src/chain/errors/index.ts +3 -0
- package/src/chain/errors/payloadAttestation.ts +25 -0
- package/src/chain/forkChoice/index.ts +19 -0
- package/src/chain/initState.ts +5 -3
- package/src/chain/interface.ts +34 -3
- package/src/chain/lightClient/proofs.ts +0 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +19 -191
- package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
- package/src/chain/opPools/index.ts +2 -0
- package/src/chain/opPools/opPool.ts +5 -7
- package/src/chain/opPools/payloadAttestationPool.ts +157 -0
- package/src/chain/prepareNextSlot.ts +8 -12
- package/src/chain/produceBlock/produceBlockBody.ts +13 -6
- package/src/chain/regen/interface.ts +3 -17
- package/src/chain/regen/queued.ts +17 -56
- package/src/chain/regen/regen.ts +22 -43
- package/src/chain/seenCache/index.ts +3 -1
- package/src/chain/seenCache/seenAttesters.ts +5 -0
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
- package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
- package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
- package/src/chain/shufflingCache.ts +67 -50
- package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
- package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
- package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
- package/src/chain/stateCache/persistentCheckpointsCache.ts +17 -25
- package/src/chain/stateCache/types.ts +5 -10
- package/src/chain/validation/aggregateAndProof.ts +36 -14
- package/src/chain/validation/attestation.ts +36 -19
- package/src/chain/validation/attesterSlashing.ts +9 -7
- package/src/chain/validation/blobSidecar.ts +2 -7
- package/src/chain/validation/block.ts +8 -4
- package/src/chain/validation/blsToExecutionChange.ts +9 -7
- package/src/chain/validation/dataColumnSidecar.ts +2 -7
- package/src/chain/validation/executionPayloadBid.ts +141 -0
- package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
- package/src/chain/validation/payloadAttestationMessage.ts +109 -0
- package/src/chain/validation/proposerSlashing.ts +3 -7
- package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
- package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
- package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
- package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
- package/src/chain/validation/syncCommittee.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
- package/src/chain/validation/voluntaryExit.ts +1 -1
- package/src/chain/validatorMonitor.ts +62 -8
- package/src/db/repositories/checkpointState.ts +3 -19
- package/src/db/repositories/stateArchive.ts +13 -27
- package/src/execution/engine/mock.ts +40 -13
- package/src/index.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +68 -17
- package/src/network/gossip/interface.ts +17 -0
- package/src/network/gossip/scoringParameters.ts +44 -2
- package/src/network/gossip/topic.ts +21 -0
- package/src/network/processor/gossipHandlers.ts +48 -3
- package/src/network/processor/gossipQueues/index.ts +16 -0
- package/src/network/processor/index.ts +3 -0
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
- package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
- package/src/network/reqresp/handlers/index.ts +2 -2
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
- package/src/node/nodejs.ts +18 -3
- package/src/sync/backfill/backfill.ts +2 -2
- package/src/sync/backfill/verify.ts +2 -3
- package/src/sync/range/chain.ts +0 -1
- package/src/sync/range/range.ts +0 -3
- package/src/sync/unknownBlock.ts +0 -3
- package/src/util/sszBytes.ts +1 -1
package/lib/chain/chain.js
CHANGED
|
@@ -2,21 +2,27 @@ import path from "node:path";
|
|
|
2
2
|
import { UpdateHeadOpt } from "@lodestar/fork-choice";
|
|
3
3
|
import { EFFECTIVE_BALANCE_INCREMENT, GENESIS_SLOT, SLOTS_PER_EPOCH, isForkPostElectra } from "@lodestar/params";
|
|
4
4
|
import { computeAnchorCheckpoint, computeAttestationsRewards, computeBlockRewards, computeEndSlotAtEpoch, computeEpochAtSlot, computeStartSlotAtEpoch, computeSyncCommitteeRewards, getEffectiveBalanceIncrementsZeroInactive, getEffectiveBalancesFromStateBytes, processSlots, } from "@lodestar/state-transition";
|
|
5
|
-
import { isBlindedBeaconBlock, } from "@lodestar/types";
|
|
5
|
+
import { isBlindedBeaconBlock, ssz, sszTypesFor, } from "@lodestar/types";
|
|
6
6
|
import { fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRootHex } from "@lodestar/utils";
|
|
7
7
|
import { GENESIS_EPOCH, ZERO_HASH } from "../constants/index.js";
|
|
8
|
+
import { BLOB_SIDECARS_IN_WRAPPER_INDEX } from "../db/repositories/blobSidecars.js";
|
|
8
9
|
import { BuilderStatus } from "../execution/builder/http.js";
|
|
9
10
|
import { computeNodeIdFromPrivateKey } from "../network/subnets/interface.js";
|
|
10
11
|
import { BufferPool } from "../util/bufferPool.js";
|
|
11
12
|
import { Clock, ClockEvent } from "../util/clock.js";
|
|
12
13
|
import { CustodyConfig, getValidatorsCustodyRequirement } from "../util/dataColumns.js";
|
|
14
|
+
import { callInNextEventLoop } from "../util/eventLoop.js";
|
|
13
15
|
import { ensureDir, writeIfNotExist } from "../util/file.js";
|
|
14
16
|
import { isOptimisticBlock } from "../util/forkChoice.js";
|
|
17
|
+
import { JobItemQueue } from "../util/queue/itemQueue.js";
|
|
15
18
|
import { SerializedCache } from "../util/serializedCache.js";
|
|
19
|
+
import { getSlotFromSignedBeaconBlockSerialized } from "../util/sszBytes.js";
|
|
16
20
|
import { ArchiveStore } from "./archiveStore/archiveStore.js";
|
|
17
21
|
import { CheckpointBalancesCache } from "./balancesCache.js";
|
|
18
22
|
import { BeaconProposerCache } from "./beaconProposerCache.js";
|
|
23
|
+
import { isBlockInputBlobs, isBlockInputColumns } from "./blocks/blockInput/index.js";
|
|
19
24
|
import { BlockProcessor } from "./blocks/index.js";
|
|
25
|
+
import { persistBlockInputs } from "./blocks/writeBlockInputToDb.js";
|
|
20
26
|
import { BlsMultiThreadWorkerPool, BlsSingleThreadVerifier } from "./bls/index.js";
|
|
21
27
|
import { ColumnReconstructionTracker } from "./ColumnReconstructionTracker.js";
|
|
22
28
|
import { ChainEvent, ChainEventEmitter } from "./emitter.js";
|
|
@@ -24,14 +30,14 @@ import { initializeForkChoice } from "./forkChoice/index.js";
|
|
|
24
30
|
import { GetBlobsTracker } from "./GetBlobsTracker.js";
|
|
25
31
|
import { FindHeadFnName } from "./interface.js";
|
|
26
32
|
import { LightClientServer } from "./lightClient/index.js";
|
|
27
|
-
import { AggregatedAttestationPool, AttestationPool, OpPool, SyncCommitteeMessagePool, SyncContributionAndProofPool, } from "./opPools/index.js";
|
|
33
|
+
import { AggregatedAttestationPool, AttestationPool, ExecutionPayloadBidPool, OpPool, PayloadAttestationPool, SyncCommitteeMessagePool, SyncContributionAndProofPool, } from "./opPools/index.js";
|
|
28
34
|
import { PrepareNextSlotScheduler } from "./prepareNextSlot.js";
|
|
29
35
|
import { computeNewStateRoot } from "./produceBlock/computeNewStateRoot.js";
|
|
30
36
|
import { BlockType } from "./produceBlock/index.js";
|
|
31
37
|
import { produceBlockBody, produceCommonBlockBody } from "./produceBlock/produceBlockBody.js";
|
|
32
38
|
import { QueuedStateRegenerator, RegenCaller } from "./regen/index.js";
|
|
33
39
|
import { ReprocessController } from "./reprocess.js";
|
|
34
|
-
import { SeenAggregators, SeenAttesters, SeenBlockProposers, SeenContributionAndProof, SeenSyncCommitteeMessages, } from "./seenCache/index.js";
|
|
40
|
+
import { SeenAggregators, SeenAttesters, SeenBlockProposers, SeenContributionAndProof, SeenExecutionPayloadBids, SeenExecutionPayloadEnvelopes, SeenPayloadAttesters, SeenSyncCommitteeMessages, } from "./seenCache/index.js";
|
|
35
41
|
import { SeenAggregatedAttestations } from "./seenCache/seenAggregateAndProof.js";
|
|
36
42
|
import { SeenAttestationDatas } from "./seenCache/seenAttestationData.js";
|
|
37
43
|
import { SeenBlockAttesters } from "./seenCache/seenBlockAttesters.js";
|
|
@@ -51,6 +57,10 @@ import { PersistentCheckpointStateCache } from "./stateCache/persistentCheckpoin
|
|
|
51
57
|
* allow some margin if the node overloads.
|
|
52
58
|
*/
|
|
53
59
|
const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
|
|
60
|
+
/**
|
|
61
|
+
* The maximum number of pending unfinalized block writes to the database before backpressure is applied.
|
|
62
|
+
*/
|
|
63
|
+
const DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES = 32;
|
|
54
64
|
export class BeaconChain {
|
|
55
65
|
genesisTime;
|
|
56
66
|
genesisValidatorsRoot;
|
|
@@ -72,16 +82,22 @@ export class BeaconChain {
|
|
|
72
82
|
lightClientServer;
|
|
73
83
|
reprocessController;
|
|
74
84
|
archiveStore;
|
|
85
|
+
unfinalizedBlockWrites;
|
|
75
86
|
// Ops pool
|
|
76
87
|
attestationPool;
|
|
77
88
|
aggregatedAttestationPool;
|
|
78
89
|
syncCommitteeMessagePool;
|
|
79
90
|
syncContributionAndProofPool;
|
|
91
|
+
executionPayloadBidPool;
|
|
92
|
+
payloadAttestationPool;
|
|
80
93
|
opPool;
|
|
81
94
|
// Gossip seen cache
|
|
82
95
|
seenAttesters = new SeenAttesters();
|
|
83
96
|
seenAggregators = new SeenAggregators();
|
|
97
|
+
seenPayloadAttesters = new SeenPayloadAttesters();
|
|
84
98
|
seenAggregatedAttestations;
|
|
99
|
+
seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
|
|
100
|
+
seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
85
101
|
seenBlockProposers = new SeenBlockProposers();
|
|
86
102
|
seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
87
103
|
seenContributionAndProof;
|
|
@@ -139,8 +155,8 @@ export class BeaconChain {
|
|
|
139
155
|
const emitter = new ChainEventEmitter();
|
|
140
156
|
// by default, verify signatures on both main threads and worker threads
|
|
141
157
|
const bls = opts.blsVerifyAllMainThread
|
|
142
|
-
? new BlsSingleThreadVerifier({ metrics })
|
|
143
|
-
: new BlsMultiThreadWorkerPool(opts, { logger, metrics });
|
|
158
|
+
? new BlsSingleThreadVerifier({ metrics, index2pubkey })
|
|
159
|
+
: new BlsMultiThreadWorkerPool(opts, { logger, metrics, index2pubkey });
|
|
144
160
|
if (!clock)
|
|
145
161
|
clock = new Clock({ config, genesisTime: this.genesisTime, signal });
|
|
146
162
|
this.blacklistedBlocks = new Map((opts.blacklistedBlocks ?? []).map((hex) => [hex, null]));
|
|
@@ -148,6 +164,8 @@ export class BeaconChain {
|
|
|
148
164
|
this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
|
|
149
165
|
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
|
|
150
166
|
this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
|
|
167
|
+
this.executionPayloadBidPool = new ExecutionPayloadBidPool();
|
|
168
|
+
this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
|
|
151
169
|
this.opPool = new OpPool(config);
|
|
152
170
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
153
171
|
this.seenContributionAndProof = new SeenContributionAndProof(metrics);
|
|
@@ -172,7 +190,7 @@ export class BeaconChain {
|
|
|
172
190
|
logger,
|
|
173
191
|
});
|
|
174
192
|
this._earliestAvailableSlot = anchorState.slot;
|
|
175
|
-
this.shufflingCache =
|
|
193
|
+
this.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
176
194
|
{
|
|
177
195
|
shuffling: anchorState.epochCtx.previousShuffling,
|
|
178
196
|
decisionRoot: anchorState.epochCtx.previousDecisionRoot,
|
|
@@ -223,6 +241,7 @@ export class BeaconChain {
|
|
|
223
241
|
forkChoice,
|
|
224
242
|
blockStateCache,
|
|
225
243
|
checkpointStateCache,
|
|
244
|
+
seenBlockInputCache: this.seenBlockInputCache,
|
|
226
245
|
db,
|
|
227
246
|
metrics,
|
|
228
247
|
validatorMonitor,
|
|
@@ -255,6 +274,10 @@ export class BeaconChain {
|
|
|
255
274
|
config,
|
|
256
275
|
});
|
|
257
276
|
this.archiveStore = new ArchiveStore({ db, chain: this, logger: logger, metrics }, { ...opts, dbName, anchorState: { finalizedCheckpoint: anchorState.finalizedCheckpoint } }, signal);
|
|
277
|
+
this.unfinalizedBlockWrites = new JobItemQueue(persistBlockInputs.bind(this), {
|
|
278
|
+
maxLength: DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES,
|
|
279
|
+
signal,
|
|
280
|
+
}, metrics?.unfinalizedBlockWritesQueue);
|
|
258
281
|
// always run PrepareNextSlotScheduler except for fork_choice spec tests
|
|
259
282
|
if (!opts?.disablePrepareNextSlot) {
|
|
260
283
|
new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
|
|
@@ -267,6 +290,7 @@ export class BeaconChain {
|
|
|
267
290
|
clock.addListener(ClockEvent.epoch, this.onClockEpoch.bind(this));
|
|
268
291
|
emitter.addListener(ChainEvent.forkChoiceFinalized, this.onForkChoiceFinalized.bind(this));
|
|
269
292
|
emitter.addListener(ChainEvent.forkChoiceJustified, this.onForkChoiceJustified.bind(this));
|
|
293
|
+
emitter.addListener(ChainEvent.checkpoint, this.onCheckpoint.bind(this));
|
|
270
294
|
}
|
|
271
295
|
async init() {
|
|
272
296
|
await this.archiveStore.init();
|
|
@@ -275,6 +299,10 @@ export class BeaconChain {
|
|
|
275
299
|
async close() {
|
|
276
300
|
await this.archiveStore.close();
|
|
277
301
|
await this.bls.close();
|
|
302
|
+
// Since we don't persist unfinalized fork-choice,
|
|
303
|
+
// we can abort any ongoing unfinalized block writes.
|
|
304
|
+
// TODO: persist fork choice to disk and allow unfinalized block writes to complete.
|
|
305
|
+
this.unfinalizedBlockWrites.dropAllJobs();
|
|
278
306
|
this.abortController.abort();
|
|
279
307
|
}
|
|
280
308
|
seenBlock(blockRoot) {
|
|
@@ -299,6 +327,8 @@ export class BeaconChain {
|
|
|
299
327
|
this.seenAttesters.isKnown(epoch, index) ||
|
|
300
328
|
// seenAggregators = single aggregator index, not participants of the aggregate
|
|
301
329
|
this.seenAggregators.isKnown(epoch, index) ||
|
|
330
|
+
// seenPayloadAttesters = single signer of payload attestation message
|
|
331
|
+
this.seenPayloadAttesters.isKnown(epoch, index) ||
|
|
302
332
|
// seenBlockProposers = single block proposer
|
|
303
333
|
this.seenBlockProposers.seenAtEpoch(epoch, index));
|
|
304
334
|
}
|
|
@@ -335,7 +365,7 @@ export class BeaconChain {
|
|
|
335
365
|
// only use regen queue if necessary, it'll cache in checkpointStateCache if regen gets through epoch transition
|
|
336
366
|
const head = this.forkChoice.getHead();
|
|
337
367
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
338
|
-
return this.regen.getBlockSlotState(head
|
|
368
|
+
return this.regen.getBlockSlotState(head, startSlot, { dontTransferCache: true }, regenCaller);
|
|
339
369
|
}
|
|
340
370
|
async getStateBySlot(slot, opts) {
|
|
341
371
|
const finalizedBlock = this.forkChoice.getFinalizedBlock();
|
|
@@ -347,7 +377,7 @@ export class BeaconChain {
|
|
|
347
377
|
if (opts?.allowRegen) {
|
|
348
378
|
// Find closest canonical block to slot, then trigger regen
|
|
349
379
|
const block = this.forkChoice.getCanonicalBlockClosestLteSlot(slot) ?? finalizedBlock;
|
|
350
|
-
const state = await this.regen.getBlockSlotState(block
|
|
380
|
+
const state = await this.regen.getBlockSlotState(block, slot, { dontTransferCache: true }, RegenCaller.restApi);
|
|
351
381
|
return {
|
|
352
382
|
state,
|
|
353
383
|
executionOptimistic: isOptimisticBlock(block),
|
|
@@ -398,7 +428,8 @@ export class BeaconChain {
|
|
|
398
428
|
finalized: cachedStateCtx.epochCtx.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
399
429
|
};
|
|
400
430
|
}
|
|
401
|
-
|
|
431
|
+
// this is mostly useful for a node with `--chain.archiveStateEpochFrequency 1`
|
|
432
|
+
const data = await this.db.stateArchive.getBinaryByRoot(fromHex(stateRoot));
|
|
402
433
|
return data && { state: data, executionOptimistic: false, finalized: true };
|
|
403
434
|
}
|
|
404
435
|
async getPersistedCheckpointState(checkpoint) {
|
|
@@ -445,6 +476,13 @@ export class BeaconChain {
|
|
|
445
476
|
// Unfinalized slot, attempt to find in fork-choice
|
|
446
477
|
const block = this.forkChoice.getCanonicalBlockAtSlot(slot);
|
|
447
478
|
if (block) {
|
|
479
|
+
// Block found in fork-choice.
|
|
480
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
481
|
+
// Otherwise (most likely), check the hot db
|
|
482
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
483
|
+
if (blockInput?.hasBlock()) {
|
|
484
|
+
return { block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false };
|
|
485
|
+
}
|
|
448
486
|
const data = await this.db.block.get(fromHex(block.blockRoot));
|
|
449
487
|
if (data) {
|
|
450
488
|
return { block: data, executionOptimistic: isOptimisticBlock(block), finalized: false };
|
|
@@ -460,6 +498,13 @@ export class BeaconChain {
|
|
|
460
498
|
async getBlockByRoot(root) {
|
|
461
499
|
const block = this.forkChoice.getBlockHex(root);
|
|
462
500
|
if (block) {
|
|
501
|
+
// Block found in fork-choice.
|
|
502
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
503
|
+
// Otherwise (most likely), check the hot db
|
|
504
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
505
|
+
if (blockInput?.hasBlock()) {
|
|
506
|
+
return { block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false };
|
|
507
|
+
}
|
|
463
508
|
const data = await this.db.block.get(fromHex(root));
|
|
464
509
|
if (data) {
|
|
465
510
|
return { block: data, executionOptimistic: isOptimisticBlock(block), finalized: false };
|
|
@@ -470,9 +515,125 @@ export class BeaconChain {
|
|
|
470
515
|
const data = await this.db.blockArchive.getByRoot(fromHex(root));
|
|
471
516
|
return data && { block: data, executionOptimistic: false, finalized: true };
|
|
472
517
|
}
|
|
518
|
+
async getSerializedBlockByRoot(root) {
|
|
519
|
+
const block = this.forkChoice.getBlockHex(root);
|
|
520
|
+
if (block) {
|
|
521
|
+
// Block found in fork-choice.
|
|
522
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
523
|
+
// Otherwise (most likely), check the hot db
|
|
524
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
525
|
+
if (blockInput?.hasBlock()) {
|
|
526
|
+
const signedBlock = blockInput.getBlock();
|
|
527
|
+
const serialized = this.serializedCache.get(signedBlock);
|
|
528
|
+
if (serialized) {
|
|
529
|
+
return {
|
|
530
|
+
block: serialized,
|
|
531
|
+
executionOptimistic: isOptimisticBlock(block),
|
|
532
|
+
finalized: false,
|
|
533
|
+
slot: blockInput.slot,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
return {
|
|
537
|
+
block: sszTypesFor(blockInput.forkName).SignedBeaconBlock.serialize(signedBlock),
|
|
538
|
+
executionOptimistic: isOptimisticBlock(block),
|
|
539
|
+
finalized: false,
|
|
540
|
+
slot: blockInput.slot,
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
const data = await this.db.block.getBinary(fromHex(root));
|
|
544
|
+
if (data) {
|
|
545
|
+
const slot = getSlotFromSignedBeaconBlockSerialized(data);
|
|
546
|
+
if (slot === null)
|
|
547
|
+
throw new Error(`Invalid block data stored in DB for root: ${root}`);
|
|
548
|
+
return { block: data, executionOptimistic: isOptimisticBlock(block), finalized: false, slot };
|
|
549
|
+
}
|
|
550
|
+
// If block is not found in hot db, try cold db since there could be an archive cycle happening
|
|
551
|
+
// TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
|
|
552
|
+
}
|
|
553
|
+
const data = await this.db.blockArchive.getBinaryEntryByRoot(fromHex(root));
|
|
554
|
+
return data && { block: data.value, executionOptimistic: false, finalized: true, slot: data.key };
|
|
555
|
+
}
|
|
556
|
+
async getBlobSidecars(blockSlot, blockRootHex) {
|
|
557
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
558
|
+
if (blockInput) {
|
|
559
|
+
if (!isBlockInputBlobs(blockInput)) {
|
|
560
|
+
throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
|
|
561
|
+
}
|
|
562
|
+
if (!blockInput.hasAllData()) {
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
return blockInput.getBlobs();
|
|
566
|
+
}
|
|
567
|
+
const unfinalizedBlobSidecars = (await this.db.blobSidecars.get(fromHex(blockRootHex)))?.blobSidecars ?? null;
|
|
568
|
+
if (unfinalizedBlobSidecars) {
|
|
569
|
+
return unfinalizedBlobSidecars;
|
|
570
|
+
}
|
|
571
|
+
return (await this.db.blobSidecarsArchive.get(blockSlot))?.blobSidecars ?? null;
|
|
572
|
+
}
|
|
573
|
+
async getSerializedBlobSidecars(blockSlot, blockRootHex) {
|
|
574
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
575
|
+
if (blockInput) {
|
|
576
|
+
if (!isBlockInputBlobs(blockInput)) {
|
|
577
|
+
throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
|
|
578
|
+
}
|
|
579
|
+
if (!blockInput.hasAllData()) {
|
|
580
|
+
return null;
|
|
581
|
+
}
|
|
582
|
+
return ssz.deneb.BlobSidecars.serialize(blockInput.getBlobs());
|
|
583
|
+
}
|
|
584
|
+
const unfinalizedBlobSidecarsWrapper = await this.db.blobSidecars.getBinary(fromHex(blockRootHex));
|
|
585
|
+
if (unfinalizedBlobSidecarsWrapper) {
|
|
586
|
+
return unfinalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
|
|
587
|
+
}
|
|
588
|
+
const finalizedBlobSidecarsWrapper = await this.db.blobSidecarsArchive.getBinary(blockSlot);
|
|
589
|
+
if (finalizedBlobSidecarsWrapper) {
|
|
590
|
+
return finalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
|
|
591
|
+
}
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
async getDataColumnSidecars(blockSlot, blockRootHex) {
|
|
595
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
596
|
+
if (blockInput) {
|
|
597
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
598
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
599
|
+
}
|
|
600
|
+
return blockInput.getAllColumns();
|
|
601
|
+
}
|
|
602
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
|
|
603
|
+
if (sidecarsUnfinalized.length > 0) {
|
|
604
|
+
return sidecarsUnfinalized;
|
|
605
|
+
}
|
|
606
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
|
|
607
|
+
return sidecarsFinalized;
|
|
608
|
+
}
|
|
609
|
+
async getSerializedDataColumnSidecars(blockSlot, blockRootHex, indices) {
|
|
610
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
611
|
+
if (blockInput) {
|
|
612
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
613
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
614
|
+
}
|
|
615
|
+
return indices.map((index) => {
|
|
616
|
+
const sidecar = blockInput.getColumn(index);
|
|
617
|
+
if (!sidecar) {
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
621
|
+
if (serialized) {
|
|
622
|
+
return serialized;
|
|
623
|
+
}
|
|
624
|
+
return ssz.fulu.DataColumnSidecar.serialize(sidecar);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
|
|
628
|
+
if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
|
|
629
|
+
return sidecarsUnfinalized;
|
|
630
|
+
}
|
|
631
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.getManyBinary(blockSlot, indices);
|
|
632
|
+
return sidecarsFinalized;
|
|
633
|
+
}
|
|
473
634
|
async produceCommonBlockBody(blockAttributes) {
|
|
474
|
-
const { slot,
|
|
475
|
-
const state = await this.regen.getBlockSlotState(
|
|
635
|
+
const { slot, parentBlock } = blockAttributes;
|
|
636
|
+
const state = await this.regen.getBlockSlotState(parentBlock, slot, { dontTransferCache: true }, RegenCaller.produceBlock);
|
|
476
637
|
// TODO: To avoid breaking changes for metric define this attribute
|
|
477
638
|
const blockType = BlockType.Full;
|
|
478
639
|
return produceCommonBlockBody.call(this, blockType, state, blockAttributes);
|
|
@@ -483,8 +644,8 @@ export class BeaconChain {
|
|
|
483
644
|
produceBlindedBlock(blockAttributes) {
|
|
484
645
|
return this.produceBlockWrapper(BlockType.Blinded, blockAttributes);
|
|
485
646
|
}
|
|
486
|
-
async produceBlockWrapper(blockType, { randaoReveal, graffiti, slot, feeRecipient, commonBlockBodyPromise,
|
|
487
|
-
const state = await this.regen.getBlockSlotState(
|
|
647
|
+
async produceBlockWrapper(blockType, { randaoReveal, graffiti, slot, feeRecipient, commonBlockBodyPromise, parentBlock, }) {
|
|
648
|
+
const state = await this.regen.getBlockSlotState(parentBlock, slot, { dontTransferCache: true }, RegenCaller.produceBlock);
|
|
488
649
|
const proposerIndex = state.epochCtx.getBeaconProposer(slot);
|
|
489
650
|
const proposerPubKey = this.index2pubkey[proposerIndex].toBytes();
|
|
490
651
|
const { body, produceResult, executionPayloadValue, shouldOverrideBuilder } = await produceBlockBody.call(this, blockType, state, {
|
|
@@ -492,7 +653,7 @@ export class BeaconChain {
|
|
|
492
653
|
graffiti,
|
|
493
654
|
slot,
|
|
494
655
|
feeRecipient,
|
|
495
|
-
|
|
656
|
+
parentBlock,
|
|
496
657
|
proposerIndex,
|
|
497
658
|
proposerPubKey,
|
|
498
659
|
commonBlockBodyPromise,
|
|
@@ -511,7 +672,7 @@ export class BeaconChain {
|
|
|
511
672
|
const block = {
|
|
512
673
|
slot,
|
|
513
674
|
proposerIndex,
|
|
514
|
-
parentRoot:
|
|
675
|
+
parentRoot: fromHex(parentBlock.blockRoot),
|
|
515
676
|
stateRoot: ZERO_HASH,
|
|
516
677
|
body,
|
|
517
678
|
};
|
|
@@ -668,7 +829,7 @@ export class BeaconChain {
|
|
|
668
829
|
// thanks to one epoch look ahead, we don't need to dial up to attEpoch
|
|
669
830
|
const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
|
|
670
831
|
this.metrics?.gossipAttestation.useHeadBlockStateDialedToTargetEpoch.inc({ caller: regenCaller });
|
|
671
|
-
state = await this.regen.getBlockSlotState(attHeadBlock
|
|
832
|
+
state = await this.regen.getBlockSlotState(attHeadBlock, targetSlot, { dontTransferCache: true }, regenCaller);
|
|
672
833
|
}
|
|
673
834
|
else if (blockEpoch > attEpoch) {
|
|
674
835
|
// should not happen, handled inside attestation verification code
|
|
@@ -681,7 +842,8 @@ export class BeaconChain {
|
|
|
681
842
|
this.metrics?.gossipAttestation.useHeadBlockState.inc({ caller: regenCaller });
|
|
682
843
|
state = await this.regen.getState(attHeadBlock.stateRoot, regenCaller);
|
|
683
844
|
}
|
|
684
|
-
//
|
|
845
|
+
// resolve the promise to unblock other calls of the same epoch and dependent root
|
|
846
|
+
this.shufflingCache.processState(state);
|
|
685
847
|
return state.epochCtx.getShufflingAtEpoch(attEpoch);
|
|
686
848
|
}
|
|
687
849
|
/**
|
|
@@ -776,6 +938,8 @@ export class BeaconChain {
|
|
|
776
938
|
metrics.opPool.proposerSlashingPoolSize.set(this.opPool.proposerSlashingsSize);
|
|
777
939
|
metrics.opPool.voluntaryExitPoolSize.set(this.opPool.voluntaryExitsSize);
|
|
778
940
|
metrics.opPool.syncCommitteeMessagePoolSize.set(this.syncCommitteeMessagePool.size);
|
|
941
|
+
metrics.opPool.payloadAttestationPool.size.set(this.payloadAttestationPool.size);
|
|
942
|
+
metrics.opPool.executionPayloadBidPool.size.set(this.executionPayloadBidPool.size);
|
|
779
943
|
// syncContributionAndProofPool tracks metrics on its own
|
|
780
944
|
metrics.opPool.blsToExecutionChangePoolSize.set(this.opPool.blsToExecutionChangeSize);
|
|
781
945
|
metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
|
|
@@ -800,6 +964,9 @@ export class BeaconChain {
|
|
|
800
964
|
this.aggregatedAttestationPool.prune(slot);
|
|
801
965
|
this.syncCommitteeMessagePool.prune(slot);
|
|
802
966
|
this.seenSyncCommitteeMessages.prune(slot);
|
|
967
|
+
this.payloadAttestationPool.prune(slot);
|
|
968
|
+
this.executionPayloadBidPool.prune(slot);
|
|
969
|
+
this.seenExecutionPayloadBids.prune(slot);
|
|
803
970
|
this.seenAttestationDatas.onSlot(slot);
|
|
804
971
|
this.reprocessController.onSlot(slot);
|
|
805
972
|
// Prune old cached block production artifacts, those are only useful on their slot
|
|
@@ -820,6 +987,7 @@ export class BeaconChain {
|
|
|
820
987
|
this.metrics?.clockEpoch.set(epoch);
|
|
821
988
|
this.seenAttesters.prune(epoch);
|
|
822
989
|
this.seenAggregators.prune(epoch);
|
|
990
|
+
this.seenPayloadAttesters.prune(epoch);
|
|
823
991
|
this.seenAggregatedAttestations.prune(epoch);
|
|
824
992
|
this.seenBlockAttesters.prune(epoch);
|
|
825
993
|
this.beaconProposerCache.prune(epoch);
|
|
@@ -831,20 +999,28 @@ export class BeaconChain {
|
|
|
831
999
|
onForkChoiceJustified(cp) {
|
|
832
1000
|
this.logger.verbose("Fork choice justified", { epoch: cp.epoch, root: cp.rootHex });
|
|
833
1001
|
}
|
|
1002
|
+
onCheckpoint(_checkpoint, state) {
|
|
1003
|
+
// Defer to not block other checkpoint event handlers, which can cause lightclient update delays
|
|
1004
|
+
callInNextEventLoop(() => {
|
|
1005
|
+
this.shufflingCache.processState(state);
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
834
1008
|
async onForkChoiceFinalized(cp) {
|
|
835
1009
|
this.logger.verbose("Fork choice finalized", { epoch: cp.epoch, root: cp.rootHex });
|
|
836
|
-
|
|
1010
|
+
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1011
|
+
this.seenBlockProposers.prune(finalizedSlot);
|
|
1012
|
+
this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
|
|
837
1013
|
// Update validator custody to account for effective balance changes
|
|
838
1014
|
await this.updateValidatorsCustodyRequirement(cp);
|
|
839
1015
|
// TODO: Improve using regen here
|
|
840
1016
|
const { blockRoot, stateRoot, slot } = this.forkChoice.getHead();
|
|
841
1017
|
const headState = this.regen.getStateSync(stateRoot);
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
-
throw Error(`Head block ${slot}
|
|
1018
|
+
const blockResult = await this.getBlockByRoot(blockRoot);
|
|
1019
|
+
if (blockResult == null) {
|
|
1020
|
+
throw Error(`Head block for ${slot} is not available in cache or database`);
|
|
845
1021
|
}
|
|
846
1022
|
if (headState) {
|
|
847
|
-
this.opPool.pruneAll(
|
|
1023
|
+
this.opPool.pruneAll(blockResult.block, headState);
|
|
848
1024
|
}
|
|
849
1025
|
if (headState === null) {
|
|
850
1026
|
this.logger.verbose("Head state is null");
|
|
@@ -942,8 +1118,8 @@ export class BeaconChain {
|
|
|
942
1118
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
943
1119
|
}
|
|
944
1120
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
945
|
-
const
|
|
946
|
-
return computeBlockRewards(this.config, block, preState
|
|
1121
|
+
const proposerRewards = this.regen.getStateSync(toRootHex(block.stateRoot))?.proposerRewards ?? undefined;
|
|
1122
|
+
return computeBlockRewards(this.config, block, preState, proposerRewards);
|
|
947
1123
|
}
|
|
948
1124
|
async getAttestationsRewards(epoch, validatorIds) {
|
|
949
1125
|
// We use end slot of (epoch + 1) to ensure we have seen all attestations. On-time or late. Any late attestation beyond this slot is not considered
|
|
@@ -967,7 +1143,7 @@ export class BeaconChain {
|
|
|
967
1143
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
968
1144
|
}
|
|
969
1145
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
970
|
-
return computeSyncCommitteeRewards(this.config, this.index2pubkey, block, preState
|
|
1146
|
+
return computeSyncCommitteeRewards(this.config, this.index2pubkey, block, preState, validatorIds);
|
|
971
1147
|
}
|
|
972
1148
|
}
|
|
973
1149
|
//# sourceMappingURL=chain.js.map
|