@lodestar/beacon-node 1.39.1 → 1.40.0-dev.193b2e2047
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 +8 -18
- 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 +6 -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/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 +196 -21
- 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 +4 -8
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +16 -33
- 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/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 +42 -3
- 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 +8 -18
- 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 +7 -4
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +13 -14
- 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 +225 -32
- 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 +16 -42
- 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/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 +52 -3
- 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
|
@@ -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
|
}
|
package/src/chain/chain.ts
CHANGED
|
@@ -37,14 +37,19 @@ import {
|
|
|
37
37
|
UintNum64,
|
|
38
38
|
ValidatorIndex,
|
|
39
39
|
Wei,
|
|
40
|
+
deneb,
|
|
41
|
+
fulu,
|
|
40
42
|
isBlindedBeaconBlock,
|
|
41
43
|
phase0,
|
|
42
44
|
rewards,
|
|
45
|
+
ssz,
|
|
46
|
+
sszTypesFor,
|
|
43
47
|
} from "@lodestar/types";
|
|
44
48
|
import {Logger, fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRootHex} from "@lodestar/utils";
|
|
45
49
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
46
50
|
import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
|
|
47
51
|
import {IBeaconDb} from "../db/index.js";
|
|
52
|
+
import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../db/repositories/blobSidecars.ts";
|
|
48
53
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
49
54
|
import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
|
|
50
55
|
import {Metrics} from "../metrics/index.js";
|
|
@@ -52,14 +57,18 @@ import {computeNodeIdFromPrivateKey} from "../network/subnets/interface.js";
|
|
|
52
57
|
import {BufferPool} from "../util/bufferPool.js";
|
|
53
58
|
import {Clock, ClockEvent, IClock} from "../util/clock.js";
|
|
54
59
|
import {CustodyConfig, getValidatorsCustodyRequirement} from "../util/dataColumns.js";
|
|
60
|
+
import {callInNextEventLoop} from "../util/eventLoop.js";
|
|
55
61
|
import {ensureDir, writeIfNotExist} from "../util/file.js";
|
|
56
62
|
import {isOptimisticBlock} from "../util/forkChoice.js";
|
|
63
|
+
import {JobItemQueue} from "../util/queue/itemQueue.ts";
|
|
57
64
|
import {SerializedCache} from "../util/serializedCache.js";
|
|
65
|
+
import {getSlotFromSignedBeaconBlockSerialized} from "../util/sszBytes.ts";
|
|
58
66
|
import {ArchiveStore} from "./archiveStore/archiveStore.js";
|
|
59
67
|
import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
60
68
|
import {BeaconProposerCache} from "./beaconProposerCache.js";
|
|
61
|
-
import {IBlockInput} from "./blocks/blockInput/index.js";
|
|
69
|
+
import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
|
|
62
70
|
import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
|
|
71
|
+
import {persistBlockInputs} from "./blocks/writeBlockInputToDb.ts";
|
|
63
72
|
import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
|
|
64
73
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
65
74
|
import {ChainEvent, ChainEventEmitter} from "./emitter.js";
|
|
@@ -70,7 +79,9 @@ import {LightClientServer} from "./lightClient/index.js";
|
|
|
70
79
|
import {
|
|
71
80
|
AggregatedAttestationPool,
|
|
72
81
|
AttestationPool,
|
|
82
|
+
ExecutionPayloadBidPool,
|
|
73
83
|
OpPool,
|
|
84
|
+
PayloadAttestationPool,
|
|
74
85
|
SyncCommitteeMessagePool,
|
|
75
86
|
SyncContributionAndProofPool,
|
|
76
87
|
} from "./opPools/index.js";
|
|
@@ -86,6 +97,9 @@ import {
|
|
|
86
97
|
SeenAttesters,
|
|
87
98
|
SeenBlockProposers,
|
|
88
99
|
SeenContributionAndProof,
|
|
100
|
+
SeenExecutionPayloadBids,
|
|
101
|
+
SeenExecutionPayloadEnvelopes,
|
|
102
|
+
SeenPayloadAttesters,
|
|
89
103
|
SeenSyncCommitteeMessages,
|
|
90
104
|
} from "./seenCache/index.js";
|
|
91
105
|
import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
@@ -112,6 +126,11 @@ import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
|
112
126
|
*/
|
|
113
127
|
const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
|
|
114
128
|
|
|
129
|
+
/**
|
|
130
|
+
* The maximum number of pending unfinalized block writes to the database before backpressure is applied.
|
|
131
|
+
*/
|
|
132
|
+
const DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES = 32;
|
|
133
|
+
|
|
115
134
|
export class BeaconChain implements IBeaconChain {
|
|
116
135
|
readonly genesisTime: UintNum64;
|
|
117
136
|
readonly genesisValidatorsRoot: Root;
|
|
@@ -135,18 +154,24 @@ export class BeaconChain implements IBeaconChain {
|
|
|
135
154
|
readonly lightClientServer?: LightClientServer;
|
|
136
155
|
readonly reprocessController: ReprocessController;
|
|
137
156
|
readonly archiveStore: ArchiveStore;
|
|
157
|
+
readonly unfinalizedBlockWrites: JobItemQueue<[IBlockInput[]], void>;
|
|
138
158
|
|
|
139
159
|
// Ops pool
|
|
140
160
|
readonly attestationPool: AttestationPool;
|
|
141
161
|
readonly aggregatedAttestationPool: AggregatedAttestationPool;
|
|
142
162
|
readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
|
|
143
163
|
readonly syncContributionAndProofPool;
|
|
164
|
+
readonly executionPayloadBidPool: ExecutionPayloadBidPool;
|
|
165
|
+
readonly payloadAttestationPool: PayloadAttestationPool;
|
|
144
166
|
readonly opPool: OpPool;
|
|
145
167
|
|
|
146
168
|
// Gossip seen cache
|
|
147
169
|
readonly seenAttesters = new SeenAttesters();
|
|
148
170
|
readonly seenAggregators = new SeenAggregators();
|
|
171
|
+
readonly seenPayloadAttesters = new SeenPayloadAttesters();
|
|
149
172
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
173
|
+
readonly seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
|
|
174
|
+
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
150
175
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
151
176
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
152
177
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
@@ -253,8 +278,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
253
278
|
const emitter = new ChainEventEmitter();
|
|
254
279
|
// by default, verify signatures on both main threads and worker threads
|
|
255
280
|
const bls = opts.blsVerifyAllMainThread
|
|
256
|
-
? new BlsSingleThreadVerifier({metrics})
|
|
257
|
-
: new BlsMultiThreadWorkerPool(opts, {logger, metrics});
|
|
281
|
+
? new BlsSingleThreadVerifier({metrics, index2pubkey})
|
|
282
|
+
: new BlsMultiThreadWorkerPool(opts, {logger, metrics, index2pubkey});
|
|
258
283
|
|
|
259
284
|
if (!clock) clock = new Clock({config, genesisTime: this.genesisTime, signal});
|
|
260
285
|
|
|
@@ -263,6 +288,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
263
288
|
this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
|
|
264
289
|
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
|
|
265
290
|
this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
|
|
291
|
+
this.executionPayloadBidPool = new ExecutionPayloadBidPool();
|
|
292
|
+
this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
|
|
266
293
|
this.opPool = new OpPool(config);
|
|
267
294
|
|
|
268
295
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
@@ -291,7 +318,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
291
318
|
});
|
|
292
319
|
|
|
293
320
|
this._earliestAvailableSlot = anchorState.slot;
|
|
294
|
-
|
|
321
|
+
|
|
322
|
+
this.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
295
323
|
{
|
|
296
324
|
shuffling: anchorState.epochCtx.previousShuffling,
|
|
297
325
|
decisionRoot: anchorState.epochCtx.previousDecisionRoot,
|
|
@@ -403,6 +431,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
403
431
|
signal
|
|
404
432
|
);
|
|
405
433
|
|
|
434
|
+
this.unfinalizedBlockWrites = new JobItemQueue(
|
|
435
|
+
persistBlockInputs.bind(this),
|
|
436
|
+
{
|
|
437
|
+
maxLength: DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES,
|
|
438
|
+
signal,
|
|
439
|
+
},
|
|
440
|
+
metrics?.unfinalizedBlockWritesQueue
|
|
441
|
+
);
|
|
442
|
+
|
|
406
443
|
// always run PrepareNextSlotScheduler except for fork_choice spec tests
|
|
407
444
|
if (!opts?.disablePrepareNextSlot) {
|
|
408
445
|
new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
|
|
@@ -417,6 +454,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
417
454
|
clock.addListener(ClockEvent.epoch, this.onClockEpoch.bind(this));
|
|
418
455
|
emitter.addListener(ChainEvent.forkChoiceFinalized, this.onForkChoiceFinalized.bind(this));
|
|
419
456
|
emitter.addListener(ChainEvent.forkChoiceJustified, this.onForkChoiceJustified.bind(this));
|
|
457
|
+
emitter.addListener(ChainEvent.checkpoint, this.onCheckpoint.bind(this));
|
|
420
458
|
}
|
|
421
459
|
|
|
422
460
|
async init(): Promise<void> {
|
|
@@ -427,6 +465,12 @@ export class BeaconChain implements IBeaconChain {
|
|
|
427
465
|
async close(): Promise<void> {
|
|
428
466
|
await this.archiveStore.close();
|
|
429
467
|
await this.bls.close();
|
|
468
|
+
|
|
469
|
+
// Since we don't persist unfinalized fork-choice,
|
|
470
|
+
// we can abort any ongoing unfinalized block writes.
|
|
471
|
+
// TODO: persist fork choice to disk and allow unfinalized block writes to complete.
|
|
472
|
+
this.unfinalizedBlockWrites.dropAllJobs();
|
|
473
|
+
|
|
430
474
|
this.abortController.abort();
|
|
431
475
|
}
|
|
432
476
|
|
|
@@ -456,6 +500,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
456
500
|
this.seenAttesters.isKnown(epoch, index) ||
|
|
457
501
|
// seenAggregators = single aggregator index, not participants of the aggregate
|
|
458
502
|
this.seenAggregators.isKnown(epoch, index) ||
|
|
503
|
+
// seenPayloadAttesters = single signer of payload attestation message
|
|
504
|
+
this.seenPayloadAttesters.isKnown(epoch, index) ||
|
|
459
505
|
// seenBlockProposers = single block proposer
|
|
460
506
|
this.seenBlockProposers.seenAtEpoch(epoch, index)
|
|
461
507
|
);
|
|
@@ -498,13 +544,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
498
544
|
// only use regen queue if necessary, it'll cache in checkpointStateCache if regen gets through epoch transition
|
|
499
545
|
const head = this.forkChoice.getHead();
|
|
500
546
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
501
|
-
return this.regen.getBlockSlotState(head
|
|
547
|
+
return this.regen.getBlockSlotState(head, startSlot, {dontTransferCache: true}, regenCaller);
|
|
502
548
|
}
|
|
503
549
|
|
|
504
550
|
async getStateBySlot(
|
|
505
551
|
slot: Slot,
|
|
506
552
|
opts?: StateGetOpts
|
|
507
|
-
): Promise<{state:
|
|
553
|
+
): Promise<{state: CachedBeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
508
554
|
const finalizedBlock = this.forkChoice.getFinalizedBlock();
|
|
509
555
|
|
|
510
556
|
if (slot < finalizedBlock.slot) {
|
|
@@ -516,12 +562,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
516
562
|
if (opts?.allowRegen) {
|
|
517
563
|
// Find closest canonical block to slot, then trigger regen
|
|
518
564
|
const block = this.forkChoice.getCanonicalBlockClosestLteSlot(slot) ?? finalizedBlock;
|
|
519
|
-
const state = await this.regen.getBlockSlotState(
|
|
520
|
-
block.blockRoot,
|
|
521
|
-
slot,
|
|
522
|
-
{dontTransferCache: true},
|
|
523
|
-
RegenCaller.restApi
|
|
524
|
-
);
|
|
565
|
+
const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
|
|
525
566
|
return {
|
|
526
567
|
state,
|
|
527
568
|
executionOptimistic: isOptimisticBlock(block),
|
|
@@ -559,7 +600,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
559
600
|
async getStateByStateRoot(
|
|
560
601
|
stateRoot: RootHex,
|
|
561
602
|
opts?: StateGetOpts
|
|
562
|
-
): Promise<{state:
|
|
603
|
+
): Promise<{state: CachedBeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
563
604
|
if (opts?.allowRegen) {
|
|
564
605
|
const state = await this.regen.getState(stateRoot, RegenCaller.restApi);
|
|
565
606
|
const block = this.forkChoice.getBlock(state.latestBlockHeader.hashTreeRoot());
|
|
@@ -587,7 +628,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
587
628
|
};
|
|
588
629
|
}
|
|
589
630
|
|
|
590
|
-
|
|
631
|
+
// this is mostly useful for a node with `--chain.archiveStateEpochFrequency 1`
|
|
632
|
+
const data = await this.db.stateArchive.getBinaryByRoot(fromHex(stateRoot));
|
|
591
633
|
return data && {state: data, executionOptimistic: false, finalized: true};
|
|
592
634
|
}
|
|
593
635
|
|
|
@@ -648,6 +690,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
648
690
|
// Unfinalized slot, attempt to find in fork-choice
|
|
649
691
|
const block = this.forkChoice.getCanonicalBlockAtSlot(slot);
|
|
650
692
|
if (block) {
|
|
693
|
+
// Block found in fork-choice.
|
|
694
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
695
|
+
// Otherwise (most likely), check the hot db
|
|
696
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
697
|
+
if (blockInput?.hasBlock()) {
|
|
698
|
+
return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false};
|
|
699
|
+
}
|
|
651
700
|
const data = await this.db.block.get(fromHex(block.blockRoot));
|
|
652
701
|
if (data) {
|
|
653
702
|
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false};
|
|
@@ -667,6 +716,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
667
716
|
): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
668
717
|
const block = this.forkChoice.getBlockHex(root);
|
|
669
718
|
if (block) {
|
|
719
|
+
// Block found in fork-choice.
|
|
720
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
721
|
+
// Otherwise (most likely), check the hot db
|
|
722
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
723
|
+
if (blockInput?.hasBlock()) {
|
|
724
|
+
return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized: false};
|
|
725
|
+
}
|
|
670
726
|
const data = await this.db.block.get(fromHex(root));
|
|
671
727
|
if (data) {
|
|
672
728
|
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false};
|
|
@@ -679,10 +735,137 @@ export class BeaconChain implements IBeaconChain {
|
|
|
679
735
|
return data && {block: data, executionOptimistic: false, finalized: true};
|
|
680
736
|
}
|
|
681
737
|
|
|
738
|
+
async getSerializedBlockByRoot(
|
|
739
|
+
root: string
|
|
740
|
+
): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null> {
|
|
741
|
+
const block = this.forkChoice.getBlockHex(root);
|
|
742
|
+
if (block) {
|
|
743
|
+
// Block found in fork-choice.
|
|
744
|
+
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
745
|
+
// Otherwise (most likely), check the hot db
|
|
746
|
+
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
747
|
+
if (blockInput?.hasBlock()) {
|
|
748
|
+
const signedBlock = blockInput.getBlock();
|
|
749
|
+
const serialized = this.serializedCache.get(signedBlock);
|
|
750
|
+
if (serialized) {
|
|
751
|
+
return {
|
|
752
|
+
block: serialized,
|
|
753
|
+
executionOptimistic: isOptimisticBlock(block),
|
|
754
|
+
finalized: false,
|
|
755
|
+
slot: blockInput.slot,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
return {
|
|
759
|
+
block: sszTypesFor(blockInput.forkName).SignedBeaconBlock.serialize(signedBlock),
|
|
760
|
+
executionOptimistic: isOptimisticBlock(block),
|
|
761
|
+
finalized: false,
|
|
762
|
+
slot: blockInput.slot,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
const data = await this.db.block.getBinary(fromHex(root));
|
|
766
|
+
if (data) {
|
|
767
|
+
const slot = getSlotFromSignedBeaconBlockSerialized(data);
|
|
768
|
+
if (slot === null) throw new Error(`Invalid block data stored in DB for root: ${root}`);
|
|
769
|
+
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized: false, slot};
|
|
770
|
+
}
|
|
771
|
+
// If block is not found in hot db, try cold db since there could be an archive cycle happening
|
|
772
|
+
// TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
const data = await this.db.blockArchive.getBinaryEntryByRoot(fromHex(root));
|
|
776
|
+
return data && {block: data.value, executionOptimistic: false, finalized: true, slot: data.key};
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
async getBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<deneb.BlobSidecars | null> {
|
|
780
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
781
|
+
if (blockInput) {
|
|
782
|
+
if (!isBlockInputBlobs(blockInput)) {
|
|
783
|
+
throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
|
|
784
|
+
}
|
|
785
|
+
if (!blockInput.hasAllData()) {
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
return blockInput.getBlobs();
|
|
789
|
+
}
|
|
790
|
+
const unfinalizedBlobSidecars = (await this.db.blobSidecars.get(fromHex(blockRootHex)))?.blobSidecars ?? null;
|
|
791
|
+
if (unfinalizedBlobSidecars) {
|
|
792
|
+
return unfinalizedBlobSidecars;
|
|
793
|
+
}
|
|
794
|
+
return (await this.db.blobSidecarsArchive.get(blockSlot))?.blobSidecars ?? null;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
async getSerializedBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
|
|
798
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
799
|
+
if (blockInput) {
|
|
800
|
+
if (!isBlockInputBlobs(blockInput)) {
|
|
801
|
+
throw new Error(`Expected block input to have blobs: slot=${blockSlot} root=${blockRootHex}`);
|
|
802
|
+
}
|
|
803
|
+
if (!blockInput.hasAllData()) {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
806
|
+
return ssz.deneb.BlobSidecars.serialize(blockInput.getBlobs());
|
|
807
|
+
}
|
|
808
|
+
const unfinalizedBlobSidecarsWrapper = await this.db.blobSidecars.getBinary(fromHex(blockRootHex));
|
|
809
|
+
if (unfinalizedBlobSidecarsWrapper) {
|
|
810
|
+
return unfinalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
|
|
811
|
+
}
|
|
812
|
+
const finalizedBlobSidecarsWrapper = await this.db.blobSidecarsArchive.getBinary(blockSlot);
|
|
813
|
+
if (finalizedBlobSidecarsWrapper) {
|
|
814
|
+
return finalizedBlobSidecarsWrapper.slice(BLOB_SIDECARS_IN_WRAPPER_INDEX);
|
|
815
|
+
}
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<fulu.DataColumnSidecars> {
|
|
820
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
821
|
+
if (blockInput) {
|
|
822
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
823
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
824
|
+
}
|
|
825
|
+
return blockInput.getAllColumns();
|
|
826
|
+
}
|
|
827
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
|
|
828
|
+
if (sidecarsUnfinalized.length > 0) {
|
|
829
|
+
return sidecarsUnfinalized;
|
|
830
|
+
}
|
|
831
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
|
|
832
|
+
return sidecarsFinalized;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
async getSerializedDataColumnSidecars(
|
|
836
|
+
blockSlot: Slot,
|
|
837
|
+
blockRootHex: string,
|
|
838
|
+
indices: number[]
|
|
839
|
+
): Promise<(Uint8Array | undefined)[]> {
|
|
840
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
841
|
+
if (blockInput) {
|
|
842
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
843
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
844
|
+
}
|
|
845
|
+
return indices.map((index) => {
|
|
846
|
+
const sidecar = blockInput.getColumn(index);
|
|
847
|
+
if (!sidecar) {
|
|
848
|
+
return undefined;
|
|
849
|
+
}
|
|
850
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
851
|
+
if (serialized) {
|
|
852
|
+
return serialized;
|
|
853
|
+
}
|
|
854
|
+
return ssz.fulu.DataColumnSidecar.serialize(sidecar);
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
|
|
858
|
+
if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
|
|
859
|
+
return sidecarsUnfinalized;
|
|
860
|
+
}
|
|
861
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.getManyBinary(blockSlot, indices);
|
|
862
|
+
return sidecarsFinalized;
|
|
863
|
+
}
|
|
864
|
+
|
|
682
865
|
async produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody> {
|
|
683
|
-
const {slot,
|
|
866
|
+
const {slot, parentBlock} = blockAttributes;
|
|
684
867
|
const state = await this.regen.getBlockSlotState(
|
|
685
|
-
|
|
868
|
+
parentBlock,
|
|
686
869
|
slot,
|
|
687
870
|
{dontTransferCache: true},
|
|
688
871
|
RegenCaller.produceBlock
|
|
@@ -719,7 +902,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
719
902
|
slot,
|
|
720
903
|
feeRecipient,
|
|
721
904
|
commonBlockBodyPromise,
|
|
722
|
-
|
|
905
|
+
parentBlock,
|
|
723
906
|
}: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}
|
|
724
907
|
): Promise<{
|
|
725
908
|
block: AssembledBlockType<T>;
|
|
@@ -728,7 +911,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
728
911
|
shouldOverrideBuilder?: boolean;
|
|
729
912
|
}> {
|
|
730
913
|
const state = await this.regen.getBlockSlotState(
|
|
731
|
-
|
|
914
|
+
parentBlock,
|
|
732
915
|
slot,
|
|
733
916
|
{dontTransferCache: true},
|
|
734
917
|
RegenCaller.produceBlock
|
|
@@ -745,7 +928,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
745
928
|
graffiti,
|
|
746
929
|
slot,
|
|
747
930
|
feeRecipient,
|
|
748
|
-
|
|
931
|
+
parentBlock,
|
|
749
932
|
proposerIndex,
|
|
750
933
|
proposerPubKey,
|
|
751
934
|
commonBlockBodyPromise,
|
|
@@ -768,7 +951,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
768
951
|
const block = {
|
|
769
952
|
slot,
|
|
770
953
|
proposerIndex,
|
|
771
|
-
parentRoot:
|
|
954
|
+
parentRoot: fromHex(parentBlock.blockRoot),
|
|
772
955
|
stateRoot: ZERO_HASH,
|
|
773
956
|
body,
|
|
774
957
|
} as AssembledBlockType<T>;
|
|
@@ -964,12 +1147,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
964
1147
|
// thanks to one epoch look ahead, we don't need to dial up to attEpoch
|
|
965
1148
|
const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
|
|
966
1149
|
this.metrics?.gossipAttestation.useHeadBlockStateDialedToTargetEpoch.inc({caller: regenCaller});
|
|
967
|
-
state = await this.regen.getBlockSlotState(
|
|
968
|
-
attHeadBlock.blockRoot,
|
|
969
|
-
targetSlot,
|
|
970
|
-
{dontTransferCache: true},
|
|
971
|
-
regenCaller
|
|
972
|
-
);
|
|
1150
|
+
state = await this.regen.getBlockSlotState(attHeadBlock, targetSlot, {dontTransferCache: true}, regenCaller);
|
|
973
1151
|
} else if (blockEpoch > attEpoch) {
|
|
974
1152
|
// should not happen, handled inside attestation verification code
|
|
975
1153
|
throw Error(`Block epoch ${blockEpoch} is after attestation epoch ${attEpoch}`);
|
|
@@ -980,8 +1158,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
980
1158
|
this.metrics?.gossipAttestation.useHeadBlockState.inc({caller: regenCaller});
|
|
981
1159
|
state = await this.regen.getState(attHeadBlock.stateRoot, regenCaller);
|
|
982
1160
|
}
|
|
983
|
-
|
|
984
|
-
|
|
1161
|
+
// resolve the promise to unblock other calls of the same epoch and dependent root
|
|
1162
|
+
this.shufflingCache.processState(state);
|
|
985
1163
|
return state.epochCtx.getShufflingAtEpoch(attEpoch);
|
|
986
1164
|
}
|
|
987
1165
|
|
|
@@ -1098,6 +1276,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1098
1276
|
metrics.opPool.proposerSlashingPoolSize.set(this.opPool.proposerSlashingsSize);
|
|
1099
1277
|
metrics.opPool.voluntaryExitPoolSize.set(this.opPool.voluntaryExitsSize);
|
|
1100
1278
|
metrics.opPool.syncCommitteeMessagePoolSize.set(this.syncCommitteeMessagePool.size);
|
|
1279
|
+
metrics.opPool.payloadAttestationPool.size.set(this.payloadAttestationPool.size);
|
|
1280
|
+
metrics.opPool.executionPayloadBidPool.size.set(this.executionPayloadBidPool.size);
|
|
1101
1281
|
// syncContributionAndProofPool tracks metrics on its own
|
|
1102
1282
|
metrics.opPool.blsToExecutionChangePoolSize.set(this.opPool.blsToExecutionChangeSize);
|
|
1103
1283
|
metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
|
|
@@ -1128,6 +1308,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1128
1308
|
this.aggregatedAttestationPool.prune(slot);
|
|
1129
1309
|
this.syncCommitteeMessagePool.prune(slot);
|
|
1130
1310
|
this.seenSyncCommitteeMessages.prune(slot);
|
|
1311
|
+
this.payloadAttestationPool.prune(slot);
|
|
1312
|
+
this.executionPayloadBidPool.prune(slot);
|
|
1313
|
+
this.seenExecutionPayloadBids.prune(slot);
|
|
1131
1314
|
this.seenAttestationDatas.onSlot(slot);
|
|
1132
1315
|
this.reprocessController.onSlot(slot);
|
|
1133
1316
|
|
|
@@ -1151,6 +1334,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1151
1334
|
|
|
1152
1335
|
this.seenAttesters.prune(epoch);
|
|
1153
1336
|
this.seenAggregators.prune(epoch);
|
|
1337
|
+
this.seenPayloadAttesters.prune(epoch);
|
|
1154
1338
|
this.seenAggregatedAttestations.prune(epoch);
|
|
1155
1339
|
this.seenBlockAttesters.prune(epoch);
|
|
1156
1340
|
this.beaconProposerCache.prune(epoch);
|
|
@@ -1165,9 +1349,18 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1165
1349
|
this.logger.verbose("Fork choice justified", {epoch: cp.epoch, root: cp.rootHex});
|
|
1166
1350
|
}
|
|
1167
1351
|
|
|
1352
|
+
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state: CachedBeaconStateAllForks): void {
|
|
1353
|
+
// Defer to not block other checkpoint event handlers, which can cause lightclient update delays
|
|
1354
|
+
callInNextEventLoop(() => {
|
|
1355
|
+
this.shufflingCache.processState(state);
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1168
1359
|
private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithHex): Promise<void> {
|
|
1169
1360
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1170
|
-
|
|
1361
|
+
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1362
|
+
this.seenBlockProposers.prune(finalizedSlot);
|
|
1363
|
+
this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
|
|
1171
1364
|
|
|
1172
1365
|
// Update validator custody to account for effective balance changes
|
|
1173
1366
|
await this.updateValidatorsCustodyRequirement(cp);
|
|
@@ -1295,9 +1488,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1295
1488
|
|
|
1296
1489
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
1297
1490
|
|
|
1298
|
-
const
|
|
1491
|
+
const proposerRewards = this.regen.getStateSync(toRootHex(block.stateRoot))?.proposerRewards ?? undefined;
|
|
1299
1492
|
|
|
1300
|
-
return computeBlockRewards(this.config, block, preState
|
|
1493
|
+
return computeBlockRewards(this.config, block, preState, proposerRewards);
|
|
1301
1494
|
}
|
|
1302
1495
|
|
|
1303
1496
|
async getAttestationsRewards(
|
|
@@ -1338,6 +1531,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1338
1531
|
|
|
1339
1532
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
1340
1533
|
|
|
1341
|
-
return computeSyncCommitteeRewards(this.config, this.index2pubkey, block, preState
|
|
1534
|
+
return computeSyncCommitteeRewards(this.config, this.index2pubkey, block, preState, validatorIds);
|
|
1342
1535
|
}
|
|
1343
1536
|
}
|