@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
|
@@ -8,12 +8,12 @@ import {ChainEventEmitter} from "./emitter.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Minimum time to wait before attempting reconstruction
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
11
|
+
const RECONSTRUCTION_DELAY_MIN_BPS = 667;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Maximum time to wait before attempting reconstruction
|
|
15
15
|
*/
|
|
16
|
-
const
|
|
16
|
+
const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
|
|
17
17
|
|
|
18
18
|
export type ColumnReconstructionTrackerInit = {
|
|
19
19
|
logger: Logger;
|
|
@@ -41,11 +41,16 @@ export class ColumnReconstructionTracker {
|
|
|
41
41
|
/** Track if a reconstruction attempt is in-flight */
|
|
42
42
|
running = false;
|
|
43
43
|
|
|
44
|
+
private readonly minDelayMs: number;
|
|
45
|
+
private readonly maxDelayMs: number;
|
|
46
|
+
|
|
44
47
|
constructor(init: ColumnReconstructionTrackerInit) {
|
|
45
48
|
this.logger = init.logger;
|
|
46
49
|
this.emitter = init.emitter;
|
|
47
50
|
this.metrics = init.metrics;
|
|
48
51
|
this.config = init.config;
|
|
52
|
+
this.minDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MIN_BPS);
|
|
53
|
+
this.maxDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MAX_BPS);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
triggerColumnReconstruction(blockInput: BlockInputColumns): void {
|
|
@@ -61,8 +66,7 @@ export class ColumnReconstructionTracker {
|
|
|
61
66
|
// just that it has been triggered for this block root.
|
|
62
67
|
this.running = true;
|
|
63
68
|
this.lastBlockRootHex = blockInput.blockRootHex;
|
|
64
|
-
const delay =
|
|
65
|
-
RECONSTRUCTION_DELAY_MIN_MS + Math.random() * (RECONSTRUCTION_DELAY_MAX_MS - RECONSTRUCTION_DELAY_MIN_MS);
|
|
69
|
+
const delay = this.minDelayMs + Math.random() * (this.maxDelayMs - this.minDelayMs);
|
|
66
70
|
sleep(delay)
|
|
67
71
|
.then(() => {
|
|
68
72
|
const logCtx = {slot: blockInput.slot, root: blockInput.blockRootHex};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
stateTransition,
|
|
10
10
|
} from "@lodestar/state-transition";
|
|
11
11
|
import {IBeaconDb} from "../../../db/index.js";
|
|
12
|
+
import {getStateTypeFromBytes} from "../../../util/multifork.js";
|
|
12
13
|
import {HistoricalStateRegenMetrics} from "./metrics.js";
|
|
13
14
|
import {RegenErrorType} from "./types.js";
|
|
14
15
|
|
|
@@ -35,12 +36,13 @@ export async function getNearestState(
|
|
|
35
36
|
db: IBeaconDb,
|
|
36
37
|
pubkey2index: PubkeyIndexMap
|
|
37
38
|
): Promise<CachedBeaconStateAllForks> {
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
39
|
+
const stateBytesArr = await db.stateArchive.binaries({limit: 1, lte: slot, reverse: true});
|
|
40
|
+
if (!stateBytesArr.length) {
|
|
40
41
|
throw new Error("No near state found in the database");
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
const
|
|
44
|
+
const stateBytes = stateBytesArr[0];
|
|
45
|
+
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
44
46
|
syncPubkeyCache(state, pubkey2index);
|
|
45
47
|
|
|
46
48
|
return createCachedBeaconState(
|
|
@@ -73,9 +73,12 @@ export async function archiveBlocks(
|
|
|
73
73
|
root: fromHex(block.blockRoot),
|
|
74
74
|
}));
|
|
75
75
|
|
|
76
|
+
const logCtx = {currentEpoch, finalizedEpoch: finalizedCheckpoint.epoch, finalizedRoot: finalizedCheckpoint.rootHex};
|
|
77
|
+
|
|
76
78
|
if (finalizedCanonicalBlockRoots.length > 0) {
|
|
77
79
|
await migrateBlocksFromHotToColdDb(db, finalizedCanonicalBlockRoots);
|
|
78
80
|
logger.verbose("Migrated blocks from hot DB to cold DB", {
|
|
81
|
+
...logCtx,
|
|
79
82
|
fromSlot: finalizedCanonicalBlockRoots[0].slot,
|
|
80
83
|
toSlot: finalizedCanonicalBlockRoots.at(-1)?.slot,
|
|
81
84
|
size: finalizedCanonicalBlockRoots.length,
|
|
@@ -88,7 +91,7 @@ export async function archiveBlocks(
|
|
|
88
91
|
finalizedCanonicalBlockRoots,
|
|
89
92
|
currentEpoch
|
|
90
93
|
);
|
|
91
|
-
logger.verbose("Migrated blobSidecars from hot DB to cold DB", {migratedEntries});
|
|
94
|
+
logger.verbose("Migrated blobSidecars from hot DB to cold DB", {...logCtx, migratedEntries});
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
if (finalizedPostFulu) {
|
|
@@ -99,7 +102,7 @@ export async function archiveBlocks(
|
|
|
99
102
|
finalizedCanonicalBlockRoots,
|
|
100
103
|
currentEpoch
|
|
101
104
|
);
|
|
102
|
-
logger.verbose("Migrated dataColumnSidecars from hot DB to cold DB", {migratedEntries});
|
|
105
|
+
logger.verbose("Migrated dataColumnSidecars from hot DB to cold DB", {...logCtx, migratedEntries});
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
@@ -114,14 +117,14 @@ export async function archiveBlocks(
|
|
|
114
117
|
nonCanonicalBlockRoots.map(async (root, index) => {
|
|
115
118
|
const block = finalizedNonCanonicalBlocks[index];
|
|
116
119
|
const blockBytes = await db.block.getBinary(root);
|
|
117
|
-
const
|
|
120
|
+
const blockLogCtx = {slot: block.slot, root: block.blockRoot};
|
|
118
121
|
if (blockBytes) {
|
|
119
122
|
await persistOrphanedBlock(block.slot, block.blockRoot, blockBytes, {
|
|
120
123
|
persistOrphanedBlocksDir: persistOrphanedBlocksDir ?? "orphaned_blocks",
|
|
121
124
|
});
|
|
122
|
-
logger.verbose("Persisted orphaned block", logCtx);
|
|
125
|
+
logger.verbose("Persisted orphaned block", {...logCtx, ...blockLogCtx});
|
|
123
126
|
} else {
|
|
124
|
-
logger.warn("Tried to persist orphaned block but no block found", logCtx);
|
|
127
|
+
logger.warn("Tried to persist orphaned block but no block found", {...logCtx, ...blockLogCtx});
|
|
125
128
|
}
|
|
126
129
|
})
|
|
127
130
|
);
|
|
@@ -129,17 +132,18 @@ export async function archiveBlocks(
|
|
|
129
132
|
|
|
130
133
|
await db.block.batchDelete(nonCanonicalBlockRoots);
|
|
131
134
|
logger.verbose("Deleted non canonical blocks from hot DB", {
|
|
135
|
+
...logCtx,
|
|
132
136
|
slots: finalizedNonCanonicalBlocks.map((summary) => summary.slot).join(","),
|
|
133
137
|
});
|
|
134
138
|
|
|
135
139
|
if (finalizedPostDeneb) {
|
|
136
140
|
await db.blobSidecars.batchDelete(nonCanonicalBlockRoots);
|
|
137
|
-
logger.verbose("Deleted non canonical blobSidecars from hot DB");
|
|
141
|
+
logger.verbose("Deleted non canonical blobSidecars from hot DB", logCtx);
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
if (finalizedPostFulu) {
|
|
141
145
|
await db.dataColumnSidecar.deleteMany(nonCanonicalBlockRoots);
|
|
142
|
-
logger.verbose("Deleted non canonical dataColumnSidecars from hot DB");
|
|
146
|
+
logger.verbose("Deleted non canonical dataColumnSidecars from hot DB", logCtx);
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -154,13 +158,13 @@ export async function archiveBlocks(
|
|
|
154
158
|
const slotsToDelete = await db.blobSidecarsArchive.keys({lt: computeStartSlotAtEpoch(blobSidecarsMinEpoch)});
|
|
155
159
|
if (slotsToDelete.length > 0) {
|
|
156
160
|
await db.blobSidecarsArchive.batchDelete(slotsToDelete);
|
|
157
|
-
logger.verbose(`blobSidecars prune: batchDelete range ${slotsToDelete[0]}..${slotsToDelete.at(-1)}
|
|
161
|
+
logger.verbose(`blobSidecars prune: batchDelete range ${slotsToDelete[0]}..${slotsToDelete.at(-1)}`, logCtx);
|
|
158
162
|
} else {
|
|
159
|
-
logger.verbose(`blobSidecars prune: no entries before epoch ${blobSidecarsMinEpoch}
|
|
163
|
+
logger.verbose(`blobSidecars prune: no entries before epoch ${blobSidecarsMinEpoch}`, logCtx);
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
} else {
|
|
163
|
-
logger.verbose("blobSidecars pruning skipped: archiveDataEpochs set to Infinity");
|
|
167
|
+
logger.verbose("blobSidecars pruning skipped: archiveDataEpochs set to Infinity", logCtx);
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
|
|
@@ -184,20 +188,22 @@ export async function archiveBlocks(
|
|
|
184
188
|
if (slotsToDelete.length > 0) {
|
|
185
189
|
await db.dataColumnSidecarArchive.deleteMany(slotsToDelete);
|
|
186
190
|
logger.verbose("dataColumnSidecars prune", {
|
|
191
|
+
...logCtx,
|
|
187
192
|
slotRange: prettyPrintIndices(slotsToDelete),
|
|
188
193
|
numOfSlots: slotsToDelete.length,
|
|
189
194
|
totalNumOfSidecars: prefixedKeys.length,
|
|
190
195
|
});
|
|
191
196
|
} else {
|
|
192
|
-
logger.verbose(`dataColumnSidecars prune: no entries before epoch ${dataColumnSidecarsMinEpoch}
|
|
197
|
+
logger.verbose(`dataColumnSidecars prune: no entries before epoch ${dataColumnSidecarsMinEpoch}`, logCtx);
|
|
193
198
|
}
|
|
194
199
|
} else {
|
|
195
200
|
logger.verbose(
|
|
196
|
-
`dataColumnSidecars pruning skipped: ${dataColumnSidecarsMinEpoch} is before fulu fork epoch ${config.FULU_FORK_EPOCH}
|
|
201
|
+
`dataColumnSidecars pruning skipped: ${dataColumnSidecarsMinEpoch} is before fulu fork epoch ${config.FULU_FORK_EPOCH}`,
|
|
202
|
+
logCtx
|
|
197
203
|
);
|
|
198
204
|
}
|
|
199
205
|
} else {
|
|
200
|
-
logger.verbose("dataColumnSidecars pruning skipped: archiveDataEpochs set to Infinity");
|
|
206
|
+
logger.verbose("dataColumnSidecars pruning skipped: archiveDataEpochs set to Infinity", logCtx);
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
|
|
@@ -213,8 +219,8 @@ export async function archiveBlocks(
|
|
|
213
219
|
}
|
|
214
220
|
|
|
215
221
|
logger.verbose("Archiving of finalized blocks complete", {
|
|
222
|
+
...logCtx,
|
|
216
223
|
totalArchived: finalizedCanonicalBlocks.length,
|
|
217
|
-
finalizedEpoch: finalizedCheckpoint.epoch,
|
|
218
224
|
});
|
|
219
225
|
}
|
|
220
226
|
|
|
@@ -232,6 +238,7 @@ async function migrateBlocksFromHotToColdDb(db: IBeaconDb, blocks: BlockRootSlot
|
|
|
232
238
|
// load Buffer instead of SignedBeaconBlock to improve performance
|
|
233
239
|
const canonicalBlockEntries: BlockArchiveBatchPutBinaryItem[] = await Promise.all(
|
|
234
240
|
canonicalBlocks.map(async (block) => {
|
|
241
|
+
// Here we assume the blocks are already in the hot db
|
|
235
242
|
const blockBuffer = await db.block.getBinary(block.root);
|
|
236
243
|
if (!blockBuffer) {
|
|
237
244
|
throw Error(`Block not found for slot ${block.slot} root ${toRootHex(block.root)}`);
|
|
@@ -288,6 +295,8 @@ async function migrateBlobSidecarsFromHotToColdDb(
|
|
|
288
295
|
);
|
|
289
296
|
})
|
|
290
297
|
.map(async (block) => {
|
|
298
|
+
// Here we assume the blob sidecars are already in the hot db
|
|
299
|
+
// instead of checking first the block input cache
|
|
291
300
|
const bytes = await db.blobSidecars.getBinary(block.root);
|
|
292
301
|
if (!bytes) {
|
|
293
302
|
throw Error(`No blobSidecars found for slot ${block.slot} root ${toRootHex(block.root)}`);
|
|
@@ -337,9 +346,11 @@ async function migrateDataColumnSidecarsFromHotToColdDb(
|
|
|
337
346
|
continue;
|
|
338
347
|
}
|
|
339
348
|
|
|
349
|
+
// Here we assume the data column sidecars are already in the hot db
|
|
340
350
|
const dataColumnSidecarBytes = await fromAsync(db.dataColumnSidecar.valuesStreamBinary(block.root));
|
|
341
351
|
// there could be 0 dataColumnSidecarBytes if block has no blob
|
|
342
352
|
logger.verbose("migrateDataColumnSidecarsFromHotToColdDb", {
|
|
353
|
+
currentEpoch,
|
|
343
354
|
slot: block.slot,
|
|
344
355
|
root: toRootHex(block.root),
|
|
345
356
|
numSidecars: dataColumnSidecarBytes.length,
|
|
@@ -412,6 +412,10 @@ export class BlockInputBlobs extends AbstractBlockInput<ForkBlobsDA, deneb.BlobS
|
|
|
412
412
|
return this.blobsCache.has(blobIndex);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
getBlob(blobIndex: BlobIndex): deneb.BlobSidecar | undefined {
|
|
416
|
+
return this.blobsCache.get(blobIndex)?.blobSidecar;
|
|
417
|
+
}
|
|
418
|
+
|
|
415
419
|
addBlob(
|
|
416
420
|
{blockRootHex, blobSidecar, source, peerIdStr, seenTimestampSec}: AddBlob,
|
|
417
421
|
opts = {throwOnDuplicateAdd: true}
|
|
@@ -787,6 +791,10 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
787
791
|
return this.columnsCache.has(columnIndex);
|
|
788
792
|
}
|
|
789
793
|
|
|
794
|
+
getColumn(columnIndex: number): fulu.DataColumnSidecar | undefined {
|
|
795
|
+
return this.columnsCache.get(columnIndex)?.columnSidecar;
|
|
796
|
+
}
|
|
797
|
+
|
|
790
798
|
getVersionedHashes(): VersionedHashes {
|
|
791
799
|
return this.state.versionedHashes;
|
|
792
800
|
}
|
|
@@ -34,7 +34,6 @@ import {toCheckpointHex} from "../stateCache/index.js";
|
|
|
34
34
|
import {isBlockInputBlobs, isBlockInputColumns} from "./blockInput/blockInput.js";
|
|
35
35
|
import {AttestationImportOpt, FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
|
|
36
36
|
import {getCheckpointFromState} from "./utils/checkpoint.js";
|
|
37
|
-
import {writeBlockInputToDb} from "./writeBlockInputToDb.js";
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* Fork-choice allows to import attestations from current (0) or past (1) epoch.
|
|
@@ -91,11 +90,8 @@ export async function importBlock(
|
|
|
91
90
|
throw Error("Unavailable block can not be imported in forkchoice");
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
// 1. Persist block to hot DB (
|
|
95
|
-
|
|
96
|
-
if (!opts.eagerPersistBlock) {
|
|
97
|
-
await writeBlockInputToDb.call(this, [blockInput]);
|
|
98
|
-
}
|
|
93
|
+
// 1. Persist block to hot DB (performed asynchronously to avoid blocking head selection)
|
|
94
|
+
void this.unfinalizedBlockWrites.push([blockInput]);
|
|
99
95
|
|
|
100
96
|
// Without forcefully clearing this cache, we would rely on WeakMap to evict memory which is not reliable
|
|
101
97
|
this.serializedCache.clear();
|
|
@@ -418,13 +414,20 @@ export async function importBlock(
|
|
|
418
414
|
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot: postState.slot});
|
|
419
415
|
}
|
|
420
416
|
|
|
417
|
+
// Cache shufflings when crossing an epoch boundary
|
|
418
|
+
const parentEpoch = computeEpochAtSlot(parentBlockSlot);
|
|
419
|
+
if (parentEpoch < blockEpoch) {
|
|
420
|
+
this.shufflingCache.processState(postState);
|
|
421
|
+
this.logger.verbose("Processed shuffling for next epoch", {parentEpoch, blockEpoch, slot: blockSlot});
|
|
422
|
+
}
|
|
423
|
+
|
|
421
424
|
if (blockSlot % SLOTS_PER_EPOCH === 0) {
|
|
422
425
|
// Cache state to preserve epoch transition work
|
|
423
426
|
const checkpointState = postState;
|
|
424
427
|
const cp = getCheckpointFromState(checkpointState);
|
|
425
428
|
this.regen.addCheckpointState(cp, checkpointState);
|
|
426
|
-
// consumers should not mutate
|
|
427
|
-
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState
|
|
429
|
+
// consumers should not mutate state ever
|
|
430
|
+
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState);
|
|
428
431
|
|
|
429
432
|
// Note: in-lined code from previos handler of ChainEvent.checkpoint
|
|
430
433
|
this.logger.verbose("Checkpoint processed", toCheckpointHex(cp));
|
|
@@ -584,7 +587,10 @@ export function addAttestationPostElectra(
|
|
|
584
587
|
true
|
|
585
588
|
);
|
|
586
589
|
} else {
|
|
587
|
-
const
|
|
590
|
+
const attSlot = attestation.data.slot;
|
|
591
|
+
const attEpoch = computeEpochAtSlot(attSlot);
|
|
592
|
+
const decisionRoot = epochCtx.getShufflingDecisionRoot(attEpoch);
|
|
593
|
+
const committees = this.shufflingCache.getBeaconCommittees(attEpoch, decisionRoot, attSlot, committeeIndices);
|
|
588
594
|
const aggregationBools = attestation.aggregationBits.toBoolArray();
|
|
589
595
|
let offset = 0;
|
|
590
596
|
for (let i = 0; i < committees.length; i++) {
|
|
@@ -11,7 +11,6 @@ import {FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
|
|
|
11
11
|
import {assertLinearChainSegment} from "./utils/chainSegment.js";
|
|
12
12
|
import {verifyBlocksInEpoch} from "./verifyBlock.js";
|
|
13
13
|
import {verifyBlocksSanityChecks} from "./verifyBlocksSanityChecks.js";
|
|
14
|
-
import {removeEagerlyPersistedBlockInputs} from "./writeBlockInputToDb.js";
|
|
15
14
|
|
|
16
15
|
export {AttestationImportOpt, type ImportBlockOpts} from "./types.js";
|
|
17
16
|
|
|
@@ -143,24 +142,6 @@ export async function processBlocks(
|
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
|
|
146
|
-
// Clean db if we don't have blocks in forkchoice but already persisted them to db
|
|
147
|
-
//
|
|
148
|
-
// NOTE: this function is awaited to ensure that DB size remains constant, otherwise an attacker may bloat the
|
|
149
|
-
// disk with big malicious payloads. Our sequential block importer will wait for this promise before importing
|
|
150
|
-
// another block. The removal call error is not propagated since that would halt the chain.
|
|
151
|
-
//
|
|
152
|
-
// LOG: Because the error is not propagated and there's a risk of db bloat, the error is logged at warn level
|
|
153
|
-
// to alert the user of potential db bloat. This error _should_ never happen user must act and report to us
|
|
154
|
-
if (opts.eagerPersistBlock) {
|
|
155
|
-
await removeEagerlyPersistedBlockInputs.call(this, blocks).catch((e) => {
|
|
156
|
-
this.logger.warn(
|
|
157
|
-
"Error pruning eagerly imported block inputs, DB may grow in size if this error happens frequently",
|
|
158
|
-
{slot: blocks.map((block) => block.getBlock().message.slot).join(",")},
|
|
159
|
-
e
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
145
|
throw err;
|
|
165
146
|
}
|
|
166
147
|
}
|
|
@@ -21,7 +21,6 @@ import {verifyBlocksDataAvailability} from "./verifyBlocksDataAvailability.js";
|
|
|
21
21
|
import {SegmentExecStatus, verifyBlocksExecutionPayload} from "./verifyBlocksExecutionPayloads.js";
|
|
22
22
|
import {verifyBlocksSignatures} from "./verifyBlocksSignatures.js";
|
|
23
23
|
import {verifyBlocksStateTransitionOnly} from "./verifyBlocksStateTransitionOnly.js";
|
|
24
|
-
import {writeBlockInputToDb} from "./writeBlockInputToDb.js";
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Verifies 1 or more blocks are fully valid; from a linear sequence of blocks.
|
|
@@ -75,6 +74,10 @@ export async function verifyBlocksInEpoch(
|
|
|
75
74
|
throw new BlockError(block0, {code: BlockErrorCode.PRESTATE_MISSING, error: e as Error});
|
|
76
75
|
});
|
|
77
76
|
|
|
77
|
+
// in forky condition, make sure to populate ShufflingCache with regened state
|
|
78
|
+
// otherwise it may fail to get indexed attestations from shuffling cache later
|
|
79
|
+
this.shufflingCache.processState(preState0);
|
|
80
|
+
|
|
78
81
|
if (!isStateValidatorsNodesPopulated(preState0)) {
|
|
79
82
|
this.logger.verbose("verifyBlocksInEpoch preState0 SSZ cache stats", {
|
|
80
83
|
slot: preState0.slot,
|
|
@@ -105,9 +108,11 @@ export async function verifyBlocksInEpoch(
|
|
|
105
108
|
// Store indexed attestations for each block to avoid recomputing them during import
|
|
106
109
|
const indexedAttestationsByBlock: IndexedAttestation[][] = [];
|
|
107
110
|
for (const [i, block] of blocks.entries()) {
|
|
108
|
-
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) =>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) => {
|
|
112
|
+
const attEpoch = computeEpochAtSlot(attestation.data.slot);
|
|
113
|
+
const decisionRoot = preState0.epochCtx.getShufflingDecisionRoot(attEpoch);
|
|
114
|
+
return this.shufflingCache.getIndexedAttestation(attEpoch, decisionRoot, fork, attestation);
|
|
115
|
+
});
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
// batch all I/O operations to reduce overhead
|
|
@@ -140,7 +145,6 @@ export async function verifyBlocksInEpoch(
|
|
|
140
145
|
opts.skipVerifyBlockSignatures !== true
|
|
141
146
|
? verifyBlocksSignatures(
|
|
142
147
|
this.config,
|
|
143
|
-
this.index2pubkey,
|
|
144
148
|
this.bls,
|
|
145
149
|
this.logger,
|
|
146
150
|
this.metrics,
|
|
@@ -150,13 +154,6 @@ export async function verifyBlocksInEpoch(
|
|
|
150
154
|
opts
|
|
151
155
|
)
|
|
152
156
|
: Promise.resolve({verifySignaturesTime: Date.now()}),
|
|
153
|
-
|
|
154
|
-
// ideally we want to only persist blocks after verifying them however the reality is there are
|
|
155
|
-
// rarely invalid blocks we'll batch all I/O operation here to reduce the overhead if there's
|
|
156
|
-
// an error, we'll remove blocks not in forkchoice
|
|
157
|
-
opts.verifyOnly !== true && opts.eagerPersistBlock
|
|
158
|
-
? writeBlockInputToDb.call(this, blockInputs)
|
|
159
|
-
: Promise.resolve(),
|
|
160
157
|
]);
|
|
161
158
|
|
|
162
159
|
if (opts.verifyOnly !== true) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {CachedBeaconStateAllForks,
|
|
2
|
+
import {CachedBeaconStateAllForks, getBlockSignatureSets} from "@lodestar/state-transition";
|
|
3
3
|
import {IndexedAttestation, SignedBeaconBlock} from "@lodestar/types";
|
|
4
4
|
import {Logger} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -17,7 +17,6 @@ import {ImportBlockOpts} from "./types.js";
|
|
|
17
17
|
*/
|
|
18
18
|
export async function verifyBlocksSignatures(
|
|
19
19
|
config: BeaconConfig,
|
|
20
|
-
index2pubkey: Index2PubkeyCache,
|
|
21
20
|
bls: IBlsVerifier,
|
|
22
21
|
logger: Logger,
|
|
23
22
|
metrics: Metrics | null,
|
|
@@ -42,16 +41,9 @@ export async function verifyBlocksSignatures(
|
|
|
42
41
|
: //
|
|
43
42
|
// Verify signatures per block to track which block is invalid
|
|
44
43
|
bls.verifySignatureSets(
|
|
45
|
-
getBlockSignatureSets(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
currentSyncCommitteeIndexed,
|
|
49
|
-
block,
|
|
50
|
-
indexedAttestationsByBlock[i],
|
|
51
|
-
{
|
|
52
|
-
skipProposerSignature: opts.validProposerSignature,
|
|
53
|
-
}
|
|
54
|
-
)
|
|
44
|
+
getBlockSignatureSets(config, currentSyncCommitteeIndexed, block, indexedAttestationsByBlock[i], {
|
|
45
|
+
skipProposerSignature: opts.validProposerSignature,
|
|
46
|
+
})
|
|
55
47
|
);
|
|
56
48
|
|
|
57
49
|
// getBlockSignatureSets() takes 45ms in benchmarks for 2022Q2 mainnet blocks (100 sigs). When syncing a 32 blocks
|
|
@@ -59,6 +59,7 @@ export async function verifyBlocksStateTransitionOnly(
|
|
|
59
59
|
// if block is trusted don't verify proposer or op signature
|
|
60
60
|
verifyProposer: !useBlsBatchVerify && !validSignatures && !validProposerSignature,
|
|
61
61
|
verifySignatures: !useBlsBatchVerify && !validSignatures,
|
|
62
|
+
dontTransferCache: false,
|
|
62
63
|
},
|
|
63
64
|
{metrics, validatorMonitor}
|
|
64
65
|
);
|
|
@@ -98,35 +98,29 @@ export async function writeBlockInputToDb(this: BeaconChain, blocksInputs: IBloc
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
dataColumnsToRemove.push(blockRoot);
|
|
119
|
-
} else if (isBlockInputBlobs(blockInput)) {
|
|
120
|
-
const blobSidecars = blockInput.getBlobs();
|
|
121
|
-
blobsToRemove.push({blockRoot, slot, blobSidecars});
|
|
101
|
+
export async function persistBlockInputs(this: BeaconChain, blockInputs: IBlockInput[]): Promise<void> {
|
|
102
|
+
await writeBlockInputToDb
|
|
103
|
+
.call(this, blockInputs)
|
|
104
|
+
.catch((e) => {
|
|
105
|
+
this.logger.debug(
|
|
106
|
+
"Error persisting block input in hot db",
|
|
107
|
+
{
|
|
108
|
+
count: blockInputs.length,
|
|
109
|
+
slot: blockInputs[0].slot,
|
|
110
|
+
root: blockInputs[0].blockRootHex,
|
|
111
|
+
},
|
|
112
|
+
e
|
|
113
|
+
);
|
|
114
|
+
})
|
|
115
|
+
.finally(() => {
|
|
116
|
+
for (const blockInput of blockInputs) {
|
|
117
|
+
this.seenBlockInputCache.prune(blockInput.blockRootHex);
|
|
122
118
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.db.dataColumnSidecar.deleteMany(dataColumnsToRemove),
|
|
131
|
-
]);
|
|
119
|
+
if (blockInputs.length === 1) {
|
|
120
|
+
this.logger.debug("Pruned block input", {
|
|
121
|
+
slot: blockInputs[0].slot,
|
|
122
|
+
root: blockInputs[0].blockRootHex,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
132
126
|
}
|
|
@@ -7,7 +7,7 @@ import {Worker, spawn} from "@chainsafe/threads";
|
|
|
7
7
|
self = undefined;
|
|
8
8
|
|
|
9
9
|
import {PublicKey} from "@chainsafe/blst";
|
|
10
|
-
import {ISignatureSet} from "@lodestar/state-transition";
|
|
10
|
+
import {ISignatureSet, Index2PubkeyCache} from "@lodestar/state-transition";
|
|
11
11
|
import {Logger} from "@lodestar/utils";
|
|
12
12
|
import {Metrics} from "../../../metrics/index.js";
|
|
13
13
|
import {LinkedList} from "../../../util/array.js";
|
|
@@ -34,6 +34,7 @@ const workerDir = process.env.NODE_ENV === "test" ? "../../../../lib/chain/bls/m
|
|
|
34
34
|
export type BlsMultiThreadWorkerPoolModules = {
|
|
35
35
|
logger: Logger;
|
|
36
36
|
metrics: Metrics | null;
|
|
37
|
+
index2pubkey: Index2PubkeyCache;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export type BlsMultiThreadWorkerPoolOptions = {
|
|
@@ -113,6 +114,7 @@ type WorkerDescriptor = {
|
|
|
113
114
|
export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
114
115
|
private readonly logger: Logger;
|
|
115
116
|
private readonly metrics: Metrics | null;
|
|
117
|
+
private readonly index2pubkey: Index2PubkeyCache;
|
|
116
118
|
|
|
117
119
|
private readonly workers: WorkerDescriptor[];
|
|
118
120
|
private readonly jobs = new LinkedList<JobQueueItem>();
|
|
@@ -128,9 +130,10 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
128
130
|
private workersBusy = 0;
|
|
129
131
|
|
|
130
132
|
constructor(options: BlsMultiThreadWorkerPoolOptions, modules: BlsMultiThreadWorkerPoolModules) {
|
|
131
|
-
const {logger, metrics} = modules;
|
|
133
|
+
const {logger, metrics, index2pubkey} = modules;
|
|
132
134
|
this.logger = logger;
|
|
133
135
|
this.metrics = metrics;
|
|
136
|
+
this.index2pubkey = index2pubkey;
|
|
134
137
|
this.blsVerifyAllMultiThread = options.blsVerifyAllMultiThread ?? false;
|
|
135
138
|
|
|
136
139
|
// Use compressed for herumi for now.
|
|
@@ -170,7 +173,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
170
173
|
try {
|
|
171
174
|
return verifySignatureSetsMaybeBatch(
|
|
172
175
|
sets.map((set) => ({
|
|
173
|
-
publicKey: getAggregatedPubkey(set),
|
|
176
|
+
publicKey: getAggregatedPubkey(set, this.index2pubkey),
|
|
174
177
|
message: set.signingRoot.valueOf(),
|
|
175
178
|
signature: set.signature,
|
|
176
179
|
}))
|
|
@@ -395,7 +398,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
395
398
|
try {
|
|
396
399
|
// Note: This can throw, must be handled per-job.
|
|
397
400
|
// Pubkey and signature aggregation is defered here
|
|
398
|
-
workReq = await jobItemWorkReq(job, this.metrics);
|
|
401
|
+
workReq = await jobItemWorkReq(job, this.index2pubkey, this.metrics);
|
|
399
402
|
} catch (e) {
|
|
400
403
|
this.metrics?.blsThreadPool.errorAggregateSignatureSetsCount.inc({type: job.type});
|
|
401
404
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, asyncAggregateWithRandomness} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../../metrics/metrics.js";
|
|
4
4
|
import {LinkedList} from "../../../util/array.js";
|
|
5
5
|
import {VerifySignatureOpts} from "../interface.js";
|
|
@@ -48,14 +48,18 @@ export function jobItemSigSets(job: JobQueueItem): number {
|
|
|
48
48
|
* Prepare BlsWorkReq from JobQueueItem
|
|
49
49
|
* WARNING: May throw with untrusted user input
|
|
50
50
|
*/
|
|
51
|
-
export async function jobItemWorkReq(
|
|
51
|
+
export async function jobItemWorkReq(
|
|
52
|
+
job: JobQueueItem,
|
|
53
|
+
index2pubkey: Index2PubkeyCache,
|
|
54
|
+
metrics: Metrics | null
|
|
55
|
+
): Promise<BlsWorkReq> {
|
|
52
56
|
switch (job.type) {
|
|
53
57
|
case JobQueueItemType.default:
|
|
54
58
|
return {
|
|
55
59
|
opts: job.opts,
|
|
56
60
|
sets: job.sets.map((set) => ({
|
|
57
61
|
// this can throw, handled in the consumer code
|
|
58
|
-
publicKey: getAggregatedPubkey(set, metrics).toBytes(),
|
|
62
|
+
publicKey: getAggregatedPubkey(set, index2pubkey, metrics).toBytes(),
|
|
59
63
|
signature: set.signature,
|
|
60
64
|
message: set.signingRoot,
|
|
61
65
|
})),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, Signature, aggregatePublicKeys, aggregateSignatures, verify} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
import {IBlsVerifier} from "./interface.js";
|
|
5
5
|
import {verifySignatureSetsMaybeBatch} from "./maybeBatch.js";
|
|
@@ -7,16 +7,18 @@ import {getAggregatedPubkey, getAggregatedPubkeysCount} from "./utils.js";
|
|
|
7
7
|
|
|
8
8
|
export class BlsSingleThreadVerifier implements IBlsVerifier {
|
|
9
9
|
private readonly metrics: Metrics | null;
|
|
10
|
+
private readonly index2pubkey: Index2PubkeyCache;
|
|
10
11
|
|
|
11
|
-
constructor({metrics = null}: {metrics: Metrics | null}) {
|
|
12
|
+
constructor({metrics = null, index2pubkey}: {metrics: Metrics | null; index2pubkey: Index2PubkeyCache}) {
|
|
12
13
|
this.metrics = metrics;
|
|
14
|
+
this.index2pubkey = index2pubkey;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
async verifySignatureSets(sets: ISignatureSet[]): Promise<boolean> {
|
|
16
18
|
this.metrics?.bls.aggregatedPubkeys.inc(getAggregatedPubkeysCount(sets));
|
|
17
19
|
|
|
18
20
|
const setsAggregated = sets.map((set) => ({
|
|
19
|
-
publicKey: getAggregatedPubkey(set),
|
|
21
|
+
publicKey: getAggregatedPubkey(set, this.index2pubkey, this.metrics),
|
|
20
22
|
message: set.signingRoot,
|
|
21
23
|
signature: set.signature,
|
|
22
24
|
}));
|
package/src/chain/bls/utils.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import {PublicKey, aggregatePublicKeys} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/metrics.js";
|
|
4
4
|
|
|
5
|
-
export function getAggregatedPubkey(
|
|
5
|
+
export function getAggregatedPubkey(
|
|
6
|
+
signatureSet: ISignatureSet,
|
|
7
|
+
index2pubkey: Index2PubkeyCache,
|
|
8
|
+
metrics: Metrics | null = null
|
|
9
|
+
): PublicKey {
|
|
6
10
|
switch (signatureSet.type) {
|
|
7
11
|
case SignatureSetType.single:
|
|
8
12
|
return signatureSet.pubkey;
|
|
9
13
|
|
|
14
|
+
case SignatureSetType.indexed:
|
|
15
|
+
return index2pubkey[signatureSet.index];
|
|
16
|
+
|
|
10
17
|
case SignatureSetType.aggregate: {
|
|
11
18
|
const timer = metrics?.blsThreadPool.pubkeysAggregationMainThreadDuration.startTimer();
|
|
12
|
-
const pubkeys =
|
|
19
|
+
const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
|
|
20
|
+
const aggregated = aggregatePublicKeys(pubkeys);
|
|
13
21
|
timer?.();
|
|
14
|
-
return
|
|
22
|
+
return aggregated;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
default:
|
|
@@ -20,11 +28,11 @@ export function getAggregatedPubkey(signatureSet: ISignatureSet, metrics: Metric
|
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
export function getAggregatedPubkeysCount(signatureSets: ISignatureSet[]): number {
|
|
23
|
-
let
|
|
31
|
+
let pubkeysCount = 0;
|
|
24
32
|
for (const set of signatureSets) {
|
|
25
33
|
if (set.type === SignatureSetType.aggregate) {
|
|
26
|
-
|
|
34
|
+
pubkeysCount += set.indices.length;
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
return
|
|
37
|
+
return pubkeysCount;
|
|
30
38
|
}
|