@lodestar/beacon-node 1.41.0 → 1.42.0-dev.2fd27cd2f6
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 +36 -17
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +1 -1
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +27 -32
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +6 -6
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +7 -10
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +4 -6
- 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 +2 -6
- 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 +32 -28
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.d.ts +2 -2
- package/lib/api/impl/validator/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/utils.js +3 -3
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +0 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +0 -9
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +2 -6
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +3 -23
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -0
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +4 -4
- package/lib/chain/archiveStore/interface.d.ts.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +4 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +38 -0
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/balancesCache.d.ts +2 -2
- package/lib/chain/balancesCache.d.ts.map +1 -1
- package/lib/chain/balancesCache.js +4 -4
- package/lib/chain/balancesCache.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +4 -3
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +1 -0
- package/lib/chain/blocks/blockInput/types.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts +3 -3
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +38 -18
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +48 -0
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -0
- package/lib/chain/blocks/importExecutionPayload.js +158 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -0
- package/lib/chain/blocks/index.js +1 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/index.d.ts +3 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.js +3 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +80 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +248 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +29 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js +11 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +15 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +46 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -0
- package/lib/chain/blocks/types.d.ts +9 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.d.ts +2 -2
- package/lib/chain/blocks/utils/checkpoint.d.ts.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +2 -2
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +4 -4
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.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 +3 -3
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +3 -3
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +12 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +40 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -0
- package/lib/chain/chain.d.ts +22 -17
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +90 -48
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -2
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/errors/blockError.d.ts +4 -4
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +12 -2
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +3 -1
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +4 -4
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +27 -33
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +2 -2
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +1 -1
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +19 -17
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/lightClient/index.d.ts +2 -2
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +4 -4
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +6 -6
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +10 -13
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +3 -3
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +7 -7
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +2 -2
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +2 -2
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +2 -2
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +9 -5
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +4 -4
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +8 -4
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +5 -5
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +13 -17
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/errors.d.ts +11 -1
- package/lib/chain/regen/errors.d.ts.map +1 -1
- package/lib/chain/regen/errors.js +2 -0
- package/lib/chain/regen/errors.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +22 -14
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +2 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +20 -15
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +40 -8
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +11 -5
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +38 -11
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +1 -1
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +1 -1
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +2 -2
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +38 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +76 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -0
- package/lib/chain/serializeState.d.ts +2 -2
- package/lib/chain/serializeState.d.ts.map +1 -1
- package/lib/chain/serializeState.js +1 -1
- package/lib/chain/serializeState.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +2 -2
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +3 -4
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/datastore/db.d.ts +4 -5
- package/lib/chain/stateCache/datastore/db.d.ts.map +1 -1
- package/lib/chain/stateCache/datastore/db.js +32 -10
- package/lib/chain/stateCache/datastore/db.js.map +1 -1
- package/lib/chain/stateCache/datastore/file.d.ts +1 -1
- package/lib/chain/stateCache/datastore/file.d.ts.map +1 -1
- package/lib/chain/stateCache/datastore/file.js +5 -5
- package/lib/chain/stateCache/datastore/file.js.map +1 -1
- package/lib/chain/stateCache/datastore/types.d.ts +1 -1
- package/lib/chain/stateCache/datastore/types.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +13 -10
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +8 -3
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +36 -17
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +228 -134
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +23 -16
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +3 -3
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- 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 +3 -3
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.js +2 -2
- package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +4 -4
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +29 -19
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.js +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.js +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +1 -2
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.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 +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
- 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 +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts +4 -4
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +13 -12
- 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 +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +3 -3
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +5 -4
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +13 -8
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -2
- package/lib/metrics/metrics/lodestar.d.ts +40 -4
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +93 -15
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js +15 -0
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/interface.d.ts +4 -2
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/network.d.ts +4 -2
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +11 -5
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
- package/lib/network/processor/extractSlotRootFns.js +15 -5
- package/lib/network/processor/extractSlotRootFns.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +39 -9
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +12 -7
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +99 -78
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js +10 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts +8 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +69 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts +6 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +28 -0
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -0
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +11 -1
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts +2 -0
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +10 -0
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
- package/lib/network/reqresp/rateLimit.js +8 -0
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +2 -0
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +8 -2
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +7 -1
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/node/nodejs.d.ts +2 -2
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +1 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +3 -3
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/backfill/backfill.d.ts +3 -3
- package/lib/sync/backfill/backfill.d.ts.map +1 -1
- package/lib/sync/backfill/backfill.js +3 -3
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/constants.d.ts +1 -1
- package/lib/sync/constants.js +1 -1
- package/lib/sync/unknownBlock.d.ts +3 -9
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +8 -41
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/sszBytes.d.ts +4 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +69 -12
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/types.d.ts +2 -0
- package/lib/util/types.d.ts.map +1 -1
- package/lib/util/types.js +1 -0
- package/lib/util/types.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +37 -18
- package/src/api/impl/beacon/pool/index.ts +1 -1
- package/src/api/impl/beacon/state/index.ts +29 -41
- package/src/api/impl/beacon/state/utils.ts +13 -27
- package/src/api/impl/lodestar/index.ts +4 -8
- package/src/api/impl/proof/index.ts +2 -9
- package/src/api/impl/validator/index.ts +35 -43
- package/src/api/impl/validator/utils.ts +4 -7
- package/src/chain/archiveStore/archiveStore.ts +0 -10
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +6 -36
- package/src/chain/archiveStore/historicalState/worker.ts +1 -0
- package/src/chain/archiveStore/interface.ts +4 -4
- package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +8 -5
- package/src/chain/archiveStore/utils/archiveBlocks.ts +59 -1
- package/src/chain/balancesCache.ts +5 -11
- package/src/chain/blocks/blockInput/types.ts +4 -3
- package/src/chain/blocks/importBlock.ts +58 -22
- package/src/chain/blocks/importExecutionPayload.ts +236 -0
- package/src/chain/blocks/index.ts +1 -1
- package/src/chain/blocks/payloadEnvelopeInput/index.ts +2 -0
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +336 -0
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +33 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +61 -0
- package/src/chain/blocks/types.ts +10 -2
- package/src/chain/blocks/utils/checkpoint.ts +2 -2
- package/src/chain/blocks/verifyBlock.ts +5 -10
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +5 -10
- package/src/chain/blocks/verifyBlocksSignatures.ts +4 -4
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +55 -0
- package/src/chain/chain.ts +134 -81
- package/src/chain/emitter.ts +2 -2
- package/src/chain/errors/blockError.ts +4 -4
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -2
- package/src/chain/forkChoice/index.ts +33 -52
- package/src/chain/initState.ts +7 -2
- package/src/chain/interface.ts +20 -18
- package/src/chain/lightClient/index.ts +9 -22
- package/src/chain/opPools/aggregatedAttestationPool.ts +15 -21
- package/src/chain/opPools/opPool.ts +13 -14
- package/src/chain/opPools/utils.ts +4 -4
- package/src/chain/prepareNextSlot.ts +12 -10
- package/src/chain/produceBlock/computeNewStateRoot.ts +11 -10
- package/src/chain/produceBlock/produceBlockBody.ts +23 -50
- package/src/chain/regen/errors.ts +6 -1
- package/src/chain/regen/interface.ts +22 -18
- package/src/chain/regen/queued.ts +59 -27
- package/src/chain/regen/regen.ts +52 -23
- package/src/chain/seenCache/index.ts +1 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +2 -2
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +106 -0
- package/src/chain/serializeState.ts +3 -3
- package/src/chain/shufflingCache.ts +5 -7
- package/src/chain/stateCache/datastore/db.ts +33 -10
- package/src/chain/stateCache/datastore/file.ts +6 -5
- package/src/chain/stateCache/datastore/types.ts +3 -2
- package/src/chain/stateCache/fifoBlockStateCache.ts +17 -11
- package/src/chain/stateCache/persistentCheckpointsCache.ts +266 -172
- package/src/chain/stateCache/types.ts +22 -16
- package/src/chain/validation/attesterSlashing.ts +3 -3
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/block.ts +2 -4
- package/src/chain/validation/blsToExecutionChange.ts +2 -2
- package/src/chain/validation/dataColumnSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +3 -7
- package/src/chain/validation/executionPayloadEnvelope.ts +36 -29
- package/src/chain/validation/lightClientFinalityUpdate.ts +1 -1
- package/src/chain/validation/lightClientOptimisticUpdate.ts +1 -1
- package/src/chain/validation/payloadAttestationMessage.ts +2 -4
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -7
- package/src/chain/validation/signatureSets/syncCommittee.ts +2 -7
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -2
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -7
- package/src/chain/validation/syncCommittee.ts +21 -20
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -10
- package/src/chain/validation/voluntaryExit.ts +3 -7
- package/src/chain/validatorMonitor.ts +23 -12
- package/src/execution/engine/interface.ts +2 -2
- package/src/metrics/metrics/lodestar.ts +100 -19
- package/src/network/gossip/encoding.ts +16 -0
- package/src/network/interface.ts +15 -2
- package/src/network/network.ts +34 -6
- package/src/network/processor/extractSlotRootFns.ts +19 -6
- package/src/network/processor/gossipHandlers.ts +45 -8
- package/src/network/processor/index.ts +110 -89
- package/src/network/reqresp/ReqRespBeaconNode.ts +14 -1
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +94 -0
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +43 -0
- package/src/network/reqresp/handlers/index.ts +12 -0
- package/src/network/reqresp/protocols.ts +12 -0
- package/src/network/reqresp/rateLimit.ts +18 -0
- package/src/network/reqresp/score.ts +2 -0
- package/src/network/reqresp/types.ts +13 -0
- package/src/node/nodejs.ts +3 -5
- package/src/node/notifier.ts +4 -10
- package/src/sync/backfill/backfill.ts +4 -4
- package/src/sync/constants.ts +1 -1
- package/src/sync/unknownBlock.ts +10 -50
- package/src/util/sszBytes.ts +90 -10
- package/src/util/types.ts +6 -0
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts +0 -7
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts.map +0 -1
- package/lib/chain/archiveStore/utils/archivePayloads.js +0 -10
- package/lib/chain/archiveStore/utils/archivePayloads.js.map +0 -1
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +0 -15
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +0 -1
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +0 -28
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +0 -1
- package/src/chain/archiveStore/utils/archivePayloads.ts +0 -15
- package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +0 -34
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {BeaconChain} from "../chain.js";
|
|
2
|
+
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
3
|
+
import {writeDataColumnsToDb} from "./writeBlockInputToDb.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Persists payload envelope data to DB. This operation must be eventually completed if a payload is imported.
|
|
7
|
+
*
|
|
8
|
+
* TODO GLOAS: Persist envelope metadata (stateRoot, executionRequests, builderIndex, etc.) without the full
|
|
9
|
+
* execution payload body — only keep the blockHash reference. The EL already stores the payload.
|
|
10
|
+
* See https://github.com/ChainSafe/lodestar/issues/5671
|
|
11
|
+
*/
|
|
12
|
+
export async function writePayloadEnvelopeInputToDb(
|
|
13
|
+
this: BeaconChain,
|
|
14
|
+
payloadInput: PayloadEnvelopeInput
|
|
15
|
+
): Promise<void> {
|
|
16
|
+
const envelope = payloadInput.getPayloadEnvelope();
|
|
17
|
+
const blockRootHex = payloadInput.blockRootHex;
|
|
18
|
+
|
|
19
|
+
const envelopeBytes = this.serializedCache.get(envelope);
|
|
20
|
+
const envelopePromise = envelopeBytes
|
|
21
|
+
? this.db.executionPayloadEnvelope.putBinary(this.db.executionPayloadEnvelope.getId(envelope), envelopeBytes)
|
|
22
|
+
: this.db.executionPayloadEnvelope.add(envelope);
|
|
23
|
+
|
|
24
|
+
// Write envelope and data columns in parallel (reuses shared column writing logic)
|
|
25
|
+
await Promise.all([envelopePromise, writeDataColumnsToDb.call(this, payloadInput)]);
|
|
26
|
+
this.logger.debug("Persisted payload envelope to db", {
|
|
27
|
+
slot: payloadInput.slot,
|
|
28
|
+
root: blockRootHex,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function persistPayloadEnvelopeInput(
|
|
33
|
+
this: BeaconChain,
|
|
34
|
+
payloadInput: PayloadEnvelopeInput
|
|
35
|
+
): Promise<void> {
|
|
36
|
+
await writePayloadEnvelopeInputToDb
|
|
37
|
+
.call(this, payloadInput)
|
|
38
|
+
.catch((e) => {
|
|
39
|
+
this.logger.error(
|
|
40
|
+
"Error persisting payload envelope in hot db",
|
|
41
|
+
{
|
|
42
|
+
slot: payloadInput.slot,
|
|
43
|
+
root: payloadInput.blockRootHex,
|
|
44
|
+
},
|
|
45
|
+
e
|
|
46
|
+
);
|
|
47
|
+
})
|
|
48
|
+
.finally(() => {
|
|
49
|
+
this.seenPayloadEnvelopeInputCache.prune(payloadInput.blockRootHex);
|
|
50
|
+
this.logger.debug("Pruned payload envelope input", {
|
|
51
|
+
slot: payloadInput.slot,
|
|
52
|
+
root: payloadInput.blockRootHex,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
package/src/chain/chain.ts
CHANGED
|
@@ -1,42 +1,34 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {PrivateKey} from "@libp2p/interface";
|
|
3
|
-
import {
|
|
3
|
+
import {Type} from "@chainsafe/ssz";
|
|
4
4
|
import {BeaconConfig} from "@lodestar/config";
|
|
5
5
|
import {
|
|
6
|
-
CheckpointWithHex,
|
|
7
6
|
CheckpointWithPayloadStatus,
|
|
8
7
|
IForkChoice,
|
|
8
|
+
PayloadStatus,
|
|
9
9
|
ProtoBlock,
|
|
10
10
|
UpdateHeadOpt,
|
|
11
|
+
getCheckpointPayloadStatus,
|
|
11
12
|
} from "@lodestar/fork-choice";
|
|
12
13
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
13
14
|
import {
|
|
14
15
|
BUILDER_INDEX_SELF_BUILD,
|
|
15
16
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
16
|
-
ForkPostFulu,
|
|
17
|
+
type ForkPostFulu,
|
|
17
18
|
GENESIS_SLOT,
|
|
18
19
|
SLOTS_PER_EPOCH,
|
|
19
20
|
isForkPostElectra,
|
|
20
21
|
isForkPostGloas,
|
|
21
22
|
} from "@lodestar/params";
|
|
22
23
|
import {
|
|
23
|
-
BeaconStateAllForks,
|
|
24
|
-
BeaconStateElectra,
|
|
25
|
-
CachedBeaconStateAllForks,
|
|
26
|
-
CachedBeaconStateGloas,
|
|
27
24
|
EffectiveBalanceIncrements,
|
|
28
25
|
EpochShuffling,
|
|
26
|
+
IBeaconStateView,
|
|
29
27
|
PubkeyCache,
|
|
30
|
-
computeAnchorCheckpoint,
|
|
31
|
-
computeAttestationsRewards,
|
|
32
|
-
computeBlockRewards,
|
|
33
28
|
computeEndSlotAtEpoch,
|
|
34
29
|
computeEpochAtSlot,
|
|
35
30
|
computeStartSlotAtEpoch,
|
|
36
|
-
computeSyncCommitteeRewards,
|
|
37
|
-
getEffectiveBalanceIncrementsZeroInactive,
|
|
38
31
|
getEffectiveBalancesFromStateBytes,
|
|
39
|
-
processSlots,
|
|
40
32
|
} from "@lodestar/state-transition";
|
|
41
33
|
import {
|
|
42
34
|
BeaconBlock,
|
|
@@ -83,7 +75,10 @@ import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
|
83
75
|
import {BeaconProposerCache} from "./beaconProposerCache.js";
|
|
84
76
|
import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
|
|
85
77
|
import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
|
|
78
|
+
import {PayloadEnvelopeProcessor} from "./blocks/payloadEnvelopeProcessor.js";
|
|
79
|
+
import {ImportPayloadOpts} from "./blocks/types.js";
|
|
86
80
|
import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
|
|
81
|
+
import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToDb.js";
|
|
87
82
|
import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
|
|
88
83
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
89
84
|
import {ChainEvent, ChainEventEmitter} from "./emitter.js";
|
|
@@ -108,13 +103,14 @@ import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produ
|
|
|
108
103
|
import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js";
|
|
109
104
|
import {ReprocessController} from "./reprocess.js";
|
|
110
105
|
import {
|
|
106
|
+
PayloadEnvelopeInput,
|
|
111
107
|
SeenAggregators,
|
|
112
108
|
SeenAttesters,
|
|
113
109
|
SeenBlockProposers,
|
|
114
110
|
SeenContributionAndProof,
|
|
115
111
|
SeenExecutionPayloadBids,
|
|
116
|
-
SeenExecutionPayloadEnvelopes,
|
|
117
112
|
SeenPayloadAttesters,
|
|
113
|
+
SeenPayloadEnvelopeInput,
|
|
118
114
|
SeenSyncCommitteeMessages,
|
|
119
115
|
} from "./seenCache/index.js";
|
|
120
116
|
import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
@@ -126,7 +122,7 @@ import {DbCPStateDatastore, checkpointToDatastoreKey} from "./stateCache/datasto
|
|
|
126
122
|
import {FileCPStateDatastore} from "./stateCache/datastore/file.js";
|
|
127
123
|
import {CPStateDatastore} from "./stateCache/datastore/types.js";
|
|
128
124
|
import {FIFOBlockStateCache} from "./stateCache/fifoBlockStateCache.js";
|
|
129
|
-
import {PersistentCheckpointStateCache} from "./stateCache/persistentCheckpointsCache.js";
|
|
125
|
+
import {PersistentCheckpointStateCache, fcCheckpointToHexPayload} from "./stateCache/persistentCheckpointsCache.js";
|
|
130
126
|
import {CheckpointStateCache} from "./stateCache/types.js";
|
|
131
127
|
import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
132
128
|
|
|
@@ -147,6 +143,13 @@ const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
|
|
|
147
143
|
*/
|
|
148
144
|
const DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES = 16;
|
|
149
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The maximum number of pending unfinalized payload envelope writes to the database before backpressure is applied.
|
|
148
|
+
* Payload envelope write queue entries hold references to payload inputs (including columns),
|
|
149
|
+
* keeping them in memory. Keep moderate to avoid OOM during sync.
|
|
150
|
+
*/
|
|
151
|
+
const DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES = 16;
|
|
152
|
+
|
|
150
153
|
export class BeaconChain implements IBeaconChain {
|
|
151
154
|
readonly genesisTime: UintNum64;
|
|
152
155
|
readonly genesisValidatorsRoot: Root;
|
|
@@ -171,6 +174,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
171
174
|
readonly reprocessController: ReprocessController;
|
|
172
175
|
readonly archiveStore: ArchiveStore;
|
|
173
176
|
readonly unfinalizedBlockWrites: JobItemQueue<[IBlockInput], void>;
|
|
177
|
+
readonly unfinalizedPayloadEnvelopeWrites: JobItemQueue<[PayloadEnvelopeInput], void>;
|
|
174
178
|
|
|
175
179
|
// Ops pool
|
|
176
180
|
readonly attestationPool: AttestationPool;
|
|
@@ -186,13 +190,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
186
190
|
readonly seenAggregators = new SeenAggregators();
|
|
187
191
|
readonly seenPayloadAttesters = new SeenPayloadAttesters();
|
|
188
192
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
189
|
-
readonly seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
|
|
190
193
|
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
191
194
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
192
195
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
193
196
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
194
197
|
readonly seenAttestationDatas: SeenAttestationDatas;
|
|
195
198
|
readonly seenBlockInputCache: SeenBlockInput;
|
|
199
|
+
readonly seenPayloadEnvelopeInputCache: SeenPayloadEnvelopeInput;
|
|
196
200
|
// Seen cache for liveness checks
|
|
197
201
|
readonly seenBlockAttesters = new SeenBlockAttesters();
|
|
198
202
|
|
|
@@ -220,6 +224,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
220
224
|
readonly opts: IChainOptions;
|
|
221
225
|
|
|
222
226
|
protected readonly blockProcessor: BlockProcessor;
|
|
227
|
+
protected readonly payloadEnvelopeProcessor: PayloadEnvelopeProcessor;
|
|
223
228
|
protected readonly db: IBeaconDb;
|
|
224
229
|
// this is only available if nHistoricalStates is enabled
|
|
225
230
|
private readonly cpStateDatastore?: CPStateDatastore;
|
|
@@ -269,7 +274,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
269
274
|
clock?: IClock;
|
|
270
275
|
metrics: Metrics | null;
|
|
271
276
|
validatorMonitor: ValidatorMonitor | null;
|
|
272
|
-
anchorState:
|
|
277
|
+
anchorState: IBeaconStateView;
|
|
273
278
|
isAnchorStateFinalized: boolean;
|
|
274
279
|
executionEngine: IExecutionEngine;
|
|
275
280
|
executionBuilder?: IExecutionBuilder;
|
|
@@ -333,21 +338,28 @@ export class BeaconChain implements IBeaconChain {
|
|
|
333
338
|
metrics,
|
|
334
339
|
logger,
|
|
335
340
|
});
|
|
341
|
+
this.seenPayloadEnvelopeInputCache = new SeenPayloadEnvelopeInput({
|
|
342
|
+
chainEvents: emitter,
|
|
343
|
+
signal,
|
|
344
|
+
serializedCache: this.serializedCache,
|
|
345
|
+
metrics,
|
|
346
|
+
logger,
|
|
347
|
+
});
|
|
336
348
|
|
|
337
349
|
this._earliestAvailableSlot = anchorState.slot;
|
|
338
350
|
|
|
339
351
|
this.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
340
352
|
{
|
|
341
|
-
shuffling: anchorState.
|
|
342
|
-
decisionRoot: anchorState.
|
|
353
|
+
shuffling: anchorState.getPreviousShuffling(),
|
|
354
|
+
decisionRoot: anchorState.previousDecisionRoot,
|
|
343
355
|
},
|
|
344
356
|
{
|
|
345
|
-
shuffling: anchorState.
|
|
346
|
-
decisionRoot: anchorState.
|
|
357
|
+
shuffling: anchorState.getCurrentShuffling(),
|
|
358
|
+
decisionRoot: anchorState.currentDecisionRoot,
|
|
347
359
|
},
|
|
348
360
|
{
|
|
349
|
-
shuffling: anchorState.
|
|
350
|
-
decisionRoot: anchorState.
|
|
361
|
+
shuffling: anchorState.getNextShuffling(),
|
|
362
|
+
decisionRoot: anchorState.nextDecisionRoot,
|
|
351
363
|
},
|
|
352
364
|
]);
|
|
353
365
|
|
|
@@ -356,7 +368,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
356
368
|
|
|
357
369
|
const fileDataStore = opts.nHistoricalStatesFileDataStore ?? true;
|
|
358
370
|
const blockStateCache = new FIFOBlockStateCache(this.opts, {metrics});
|
|
359
|
-
this.bufferPool = new BufferPool(anchorState.
|
|
371
|
+
this.bufferPool = new BufferPool(anchorState.serializedSize(), metrics);
|
|
360
372
|
|
|
361
373
|
this.cpStateDatastore = fileDataStore ? new FileCPStateDatastore(dataDir) : new DbCPStateDatastore(this.db);
|
|
362
374
|
const checkpointStateCache: CheckpointStateCache = new PersistentCheckpointStateCache(
|
|
@@ -372,10 +384,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
372
384
|
this.opts
|
|
373
385
|
);
|
|
374
386
|
|
|
375
|
-
const {checkpoint} = computeAnchorCheckpoint(
|
|
387
|
+
const {checkpoint} = anchorState.computeAnchorCheckpoint();
|
|
376
388
|
blockStateCache.add(anchorState);
|
|
377
389
|
blockStateCache.setHeadState(anchorState);
|
|
378
|
-
|
|
390
|
+
const payloadPresent = getCheckpointPayloadStatus(config, anchorState, checkpoint.epoch) === PayloadStatus.FULL;
|
|
391
|
+
checkpointStateCache.add(checkpoint, anchorState, payloadPresent);
|
|
379
392
|
|
|
380
393
|
const forkChoice = initializeForkChoice(
|
|
381
394
|
config,
|
|
@@ -409,6 +422,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
409
422
|
this.reprocessController = new ReprocessController(this.metrics);
|
|
410
423
|
|
|
411
424
|
this.blockProcessor = new BlockProcessor(this, metrics, opts, signal);
|
|
425
|
+
this.payloadEnvelopeProcessor = new PayloadEnvelopeProcessor(this, metrics, signal);
|
|
412
426
|
|
|
413
427
|
this.forkChoice = forkChoice;
|
|
414
428
|
this.clock = clock;
|
|
@@ -445,6 +459,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
445
459
|
metrics?.unfinalizedBlockWritesQueue
|
|
446
460
|
);
|
|
447
461
|
|
|
462
|
+
this.unfinalizedPayloadEnvelopeWrites = new JobItemQueue(
|
|
463
|
+
persistPayloadEnvelopeInput.bind(this),
|
|
464
|
+
{
|
|
465
|
+
maxLength: DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES,
|
|
466
|
+
signal,
|
|
467
|
+
},
|
|
468
|
+
metrics?.unfinalizedPayloadEnvelopeWritesQueue
|
|
469
|
+
);
|
|
470
|
+
|
|
448
471
|
// always run PrepareNextSlotScheduler except for fork_choice spec tests
|
|
449
472
|
if (!opts?.disablePrepareNextSlot) {
|
|
450
473
|
new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
|
|
@@ -475,6 +498,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
475
498
|
// we can abort any ongoing unfinalized block writes.
|
|
476
499
|
// TODO: persist fork choice to disk and allow unfinalized block writes to complete.
|
|
477
500
|
this.unfinalizedBlockWrites.dropAllJobs();
|
|
501
|
+
this.unfinalizedPayloadEnvelopeWrites.dropAllJobs();
|
|
478
502
|
|
|
479
503
|
this.abortController.abort();
|
|
480
504
|
}
|
|
@@ -524,7 +548,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
524
548
|
await this.opPool.toPersisted(this.db);
|
|
525
549
|
}
|
|
526
550
|
|
|
527
|
-
getHeadState():
|
|
551
|
+
getHeadState(): IBeaconStateView {
|
|
528
552
|
// head state should always exist
|
|
529
553
|
const head = this.forkChoice.getHead();
|
|
530
554
|
const headState = this.regen.getClosestHeadState(head);
|
|
@@ -534,11 +558,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
534
558
|
return headState;
|
|
535
559
|
}
|
|
536
560
|
|
|
537
|
-
async getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<
|
|
561
|
+
async getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<IBeaconStateView> {
|
|
538
562
|
return this.getHeadStateAtEpoch(this.clock.currentEpoch, regenCaller);
|
|
539
563
|
}
|
|
540
564
|
|
|
541
|
-
async getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<
|
|
565
|
+
async getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<IBeaconStateView> {
|
|
542
566
|
// using getHeadState() means we'll use checkpointStateCache if it's available
|
|
543
567
|
const headState = this.getHeadState();
|
|
544
568
|
// head state is in the same epoch, or we pulled up head state already from past epoch
|
|
@@ -555,7 +579,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
555
579
|
async getStateBySlot(
|
|
556
580
|
slot: Slot,
|
|
557
581
|
opts?: StateGetOpts
|
|
558
|
-
): Promise<{state:
|
|
582
|
+
): Promise<{state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
559
583
|
const finalizedBlock = this.forkChoice.getFinalizedBlock();
|
|
560
584
|
|
|
561
585
|
if (slot < finalizedBlock.slot) {
|
|
@@ -605,15 +629,17 @@ export class BeaconChain implements IBeaconChain {
|
|
|
605
629
|
async getStateByStateRoot(
|
|
606
630
|
stateRoot: RootHex,
|
|
607
631
|
opts?: StateGetOpts
|
|
608
|
-
): Promise<{state:
|
|
632
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
609
633
|
if (opts?.allowRegen) {
|
|
610
634
|
const state = await this.regen.getState(stateRoot, RegenCaller.restApi);
|
|
611
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
635
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
636
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(state.latestBlockHeader)
|
|
637
|
+
);
|
|
612
638
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
613
639
|
return {
|
|
614
640
|
state,
|
|
615
641
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
616
|
-
finalized: state.
|
|
642
|
+
finalized: state.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
617
643
|
};
|
|
618
644
|
}
|
|
619
645
|
|
|
@@ -624,12 +650,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
624
650
|
// TODO: This is very inneficient for debug requests of serialized content, since it deserializes to serialize again
|
|
625
651
|
const cachedStateCtx = this.regen.getStateSync(stateRoot);
|
|
626
652
|
if (cachedStateCtx) {
|
|
627
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
653
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
654
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(cachedStateCtx.latestBlockHeader)
|
|
655
|
+
);
|
|
628
656
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
629
657
|
return {
|
|
630
658
|
state: cachedStateCtx,
|
|
631
659
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
632
|
-
finalized: cachedStateCtx.
|
|
660
|
+
finalized: cachedStateCtx.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
633
661
|
};
|
|
634
662
|
}
|
|
635
663
|
|
|
@@ -648,22 +676,27 @@ export class BeaconChain implements IBeaconChain {
|
|
|
648
676
|
return this.cpStateDatastore.readLatestSafe();
|
|
649
677
|
}
|
|
650
678
|
|
|
651
|
-
|
|
679
|
+
// TODO GLOAS: Need to revisit the design of this api. Currently we just retrieve FULL state of the checkpoint for backwards compatibility.
|
|
680
|
+
// because pre-gloas we always store FULL checkpoint state.
|
|
681
|
+
const persistedKey = checkpointToDatastoreKey(checkpoint, true);
|
|
652
682
|
return this.cpStateDatastore.read(persistedKey);
|
|
653
683
|
}
|
|
654
684
|
|
|
655
685
|
getStateByCheckpoint(
|
|
656
|
-
checkpoint:
|
|
657
|
-
): {state:
|
|
686
|
+
checkpoint: CheckpointWithPayloadStatus
|
|
687
|
+
): {state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null {
|
|
658
688
|
// finalized or justified checkpoint states maynot be available with PersistentCheckpointStateCache, use getCheckpointStateOrBytes() api to get Uint8Array
|
|
659
|
-
const
|
|
689
|
+
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
690
|
+
const cachedStateCtx = this.regen.getCheckpointStateSync(checkpointHexPayload);
|
|
660
691
|
if (cachedStateCtx) {
|
|
661
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
692
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
693
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(cachedStateCtx.latestBlockHeader)
|
|
694
|
+
);
|
|
662
695
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
663
696
|
return {
|
|
664
697
|
state: cachedStateCtx,
|
|
665
698
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
666
|
-
finalized: cachedStateCtx.
|
|
699
|
+
finalized: cachedStateCtx.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
667
700
|
};
|
|
668
701
|
}
|
|
669
702
|
|
|
@@ -671,9 +704,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
671
704
|
}
|
|
672
705
|
|
|
673
706
|
async getStateOrBytesByCheckpoint(
|
|
674
|
-
checkpoint:
|
|
675
|
-
): Promise<{state:
|
|
676
|
-
const
|
|
707
|
+
checkpoint: CheckpointWithPayloadStatus
|
|
708
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
709
|
+
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
710
|
+
const cachedStateCtx = await this.regen.getCheckpointStateOrBytes(checkpointHexPayload);
|
|
677
711
|
if (cachedStateCtx) {
|
|
678
712
|
const block = this.forkChoice.getBlockDefaultStatus(checkpoint.root);
|
|
679
713
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
@@ -821,6 +855,24 @@ export class BeaconChain implements IBeaconChain {
|
|
|
821
855
|
return null;
|
|
822
856
|
}
|
|
823
857
|
|
|
858
|
+
async getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
|
|
859
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
860
|
+
if (payloadInput?.hasPayloadEnvelope()) {
|
|
861
|
+
const envelope = payloadInput.getPayloadEnvelope();
|
|
862
|
+
const serialized = this.serializedCache.get(envelope);
|
|
863
|
+
if (serialized) {
|
|
864
|
+
return serialized;
|
|
865
|
+
}
|
|
866
|
+
return ssz.gloas.SignedExecutionPayloadEnvelope.serialize(envelope);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
return (
|
|
870
|
+
(await this.db.executionPayloadEnvelope.getBinary(fromHex(blockRootHex))) ??
|
|
871
|
+
(await this.db.executionPayloadEnvelopeArchive.getBinary(blockSlot)) ??
|
|
872
|
+
null
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
|
|
824
876
|
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<DataColumnSidecars> {
|
|
825
877
|
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
826
878
|
if (blockInput) {
|
|
@@ -915,14 +967,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
915
967
|
consensusBlockValue: Wei;
|
|
916
968
|
shouldOverrideBuilder?: boolean;
|
|
917
969
|
}> {
|
|
918
|
-
const fork = this.config.getForkName(slot);
|
|
919
970
|
const state = await this.regen.getBlockSlotState(
|
|
920
971
|
parentBlock,
|
|
921
972
|
slot,
|
|
922
973
|
{dontTransferCache: true},
|
|
923
974
|
RegenCaller.produceBlock
|
|
924
975
|
);
|
|
925
|
-
const proposerIndex = state.
|
|
976
|
+
const proposerIndex = state.getBeaconProposer(slot);
|
|
926
977
|
const proposerPubKey = this.pubkeyCache.getOrThrow(proposerIndex).toBytes();
|
|
927
978
|
|
|
928
979
|
const {body, produceResult, executionPayloadValue, shouldOverrideBuilder} = await produceBlockBody.call(
|
|
@@ -944,7 +995,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
944
995
|
// The hashtree root computed here for debug log will get cached and hence won't introduce additional delays
|
|
945
996
|
const bodyRoot =
|
|
946
997
|
produceResult.type === BlockType.Full
|
|
947
|
-
?
|
|
998
|
+
? this.config.getForkTypes(slot).BeaconBlockBody.hashTreeRoot(body)
|
|
948
999
|
: this.config
|
|
949
1000
|
.getPostBellatrixForkTypes(slot)
|
|
950
1001
|
.BlindedBeaconBlockBody.hashTreeRoot(body as BlindedBeaconBlockBody);
|
|
@@ -966,10 +1017,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
966
1017
|
block.stateRoot = newStateRoot;
|
|
967
1018
|
const blockRoot =
|
|
968
1019
|
produceResult.type === BlockType.Full
|
|
969
|
-
?
|
|
1020
|
+
? this.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block)
|
|
970
1021
|
: this.config.getPostBellatrixForkTypes(slot).BlindedBeaconBlock.hashTreeRoot(block as BlindedBeaconBlock);
|
|
971
1022
|
const blockRootHex = toRootHex(blockRoot);
|
|
972
1023
|
|
|
1024
|
+
const fork = this.config.getForkName(slot);
|
|
973
1025
|
if (isForkPostGloas(fork)) {
|
|
974
1026
|
// TODO GLOAS: we should retire BlockType post-gloas, may need a new enum for self vs non-self built
|
|
975
1027
|
if (produceResult.type !== BlockType.Full) {
|
|
@@ -985,7 +1037,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
985
1037
|
slot,
|
|
986
1038
|
stateRoot: ZERO_HASH,
|
|
987
1039
|
};
|
|
988
|
-
const envelopeStateRoot = computeEnvelopeStateRoot(this.metrics, postState
|
|
1040
|
+
const envelopeStateRoot = computeEnvelopeStateRoot(this.metrics, postState, envelope);
|
|
989
1041
|
gloasResult.envelopeStateRoot = envelopeStateRoot;
|
|
990
1042
|
}
|
|
991
1043
|
|
|
@@ -1004,6 +1056,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1004
1056
|
return this.blockProcessor.processBlocksJob(blocks, opts);
|
|
1005
1057
|
}
|
|
1006
1058
|
|
|
1059
|
+
async processExecutionPayload(payloadInput: PayloadEnvelopeInput, opts?: ImportPayloadOpts): Promise<void> {
|
|
1060
|
+
return this.payloadEnvelopeProcessor.processPayloadEnvelopeJob(payloadInput, opts);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1007
1063
|
getStatus(): Status {
|
|
1008
1064
|
const head = this.forkChoice.getHead();
|
|
1009
1065
|
const finalizedCheckpoint = this.forkChoice.getFinalizedCheckpoint();
|
|
@@ -1102,8 +1158,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1102
1158
|
* persist preState, postState and block for further investigation.
|
|
1103
1159
|
*/
|
|
1104
1160
|
async persistInvalidStateRoot(
|
|
1105
|
-
preState:
|
|
1106
|
-
postState:
|
|
1161
|
+
preState: IBeaconStateView,
|
|
1162
|
+
postState: IBeaconStateView,
|
|
1107
1163
|
block: SignedBeaconBlock
|
|
1108
1164
|
): Promise<void> {
|
|
1109
1165
|
const blockSlot = block.message.slot;
|
|
@@ -1118,13 +1174,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1118
1174
|
`${logStr}_block`
|
|
1119
1175
|
),
|
|
1120
1176
|
this.persistSszObject(
|
|
1121
|
-
`preState_slot_${preState.slot}
|
|
1177
|
+
`preState_slot_${preState.slot}_BeaconState`,
|
|
1122
1178
|
preState.serialize(),
|
|
1123
1179
|
preState.hashTreeRoot(),
|
|
1124
1180
|
`${logStr}_pre_state`
|
|
1125
1181
|
),
|
|
1126
1182
|
this.persistSszObject(
|
|
1127
|
-
`postState_slot_${postState.slot}
|
|
1183
|
+
`postState_slot_${postState.slot}_BeaconState`,
|
|
1128
1184
|
postState.serialize(),
|
|
1129
1185
|
postState.hashTreeRoot(),
|
|
1130
1186
|
`${logStr}_post_state`
|
|
@@ -1144,12 +1200,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1144
1200
|
}
|
|
1145
1201
|
}
|
|
1146
1202
|
|
|
1147
|
-
persistInvalidSszView(view: TreeView<CompositeTypeAny>, suffix?: string): void {
|
|
1148
|
-
if (this.opts.persistInvalidSszObjects) {
|
|
1149
|
-
void this.persistSszObject(view.type.typeName, view.serialize(), view.hashTreeRoot(), suffix);
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
1203
|
/**
|
|
1154
1204
|
* Regenerate state for attestation verification, this does not happen with default chain option of maxSkipSlots = 32 .
|
|
1155
1205
|
* However, need to handle just in case. Lodestar doesn't support multiple regen state requests for attestation verification
|
|
@@ -1167,7 +1217,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1167
1217
|
this.shufflingCache.insertPromise(attEpoch, shufflingDependentRoot);
|
|
1168
1218
|
const blockEpoch = computeEpochAtSlot(attHeadBlock.slot);
|
|
1169
1219
|
|
|
1170
|
-
let state:
|
|
1220
|
+
let state: IBeaconStateView;
|
|
1171
1221
|
if (blockEpoch < attEpoch - 1) {
|
|
1172
1222
|
// thanks to one epoch look ahead, we don't need to dial up to attEpoch
|
|
1173
1223
|
const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
|
|
@@ -1185,7 +1235,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1185
1235
|
}
|
|
1186
1236
|
// resolve the promise to unblock other calls of the same epoch and dependent root
|
|
1187
1237
|
this.shufflingCache.processState(state);
|
|
1188
|
-
return state.
|
|
1238
|
+
return state.getShufflingAtEpoch(attEpoch);
|
|
1189
1239
|
}
|
|
1190
1240
|
|
|
1191
1241
|
/**
|
|
@@ -1195,7 +1245,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1195
1245
|
*/
|
|
1196
1246
|
private justifiedBalancesGetter(
|
|
1197
1247
|
checkpoint: CheckpointWithPayloadStatus,
|
|
1198
|
-
blockState:
|
|
1248
|
+
blockState: IBeaconStateView
|
|
1199
1249
|
): EffectiveBalanceIncrements {
|
|
1200
1250
|
this.metrics?.balancesCache.requests.inc();
|
|
1201
1251
|
|
|
@@ -1222,7 +1272,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1222
1272
|
});
|
|
1223
1273
|
}
|
|
1224
1274
|
|
|
1225
|
-
return getEffectiveBalanceIncrementsZeroInactive(
|
|
1275
|
+
return state.getEffectiveBalanceIncrementsZeroInactive();
|
|
1226
1276
|
}
|
|
1227
1277
|
|
|
1228
1278
|
/**
|
|
@@ -1234,9 +1284,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1234
1284
|
*/
|
|
1235
1285
|
private closestJustifiedBalancesStateToCheckpoint(
|
|
1236
1286
|
checkpoint: CheckpointWithPayloadStatus,
|
|
1237
|
-
blockState:
|
|
1238
|
-
): {state:
|
|
1239
|
-
const
|
|
1287
|
+
blockState: IBeaconStateView
|
|
1288
|
+
): {state: IBeaconStateView; stateId: string; shouldWarn: boolean} {
|
|
1289
|
+
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
1290
|
+
const state = this.regen.getCheckpointStateSync(checkpointHexPayload);
|
|
1240
1291
|
if (state) {
|
|
1241
1292
|
return {state, stateId: "checkpoint_state", shouldWarn: false};
|
|
1242
1293
|
}
|
|
@@ -1317,10 +1368,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1317
1368
|
const fork = this.config.getForkName(headState.slot);
|
|
1318
1369
|
|
|
1319
1370
|
if (isForkPostElectra(fork)) {
|
|
1320
|
-
|
|
1321
|
-
metrics.
|
|
1322
|
-
metrics.
|
|
1323
|
-
metrics.pendingConsolidations.set(headStateElectra.pendingConsolidations.length);
|
|
1371
|
+
metrics.pendingDeposits.set(headState.pendingDepositsCount);
|
|
1372
|
+
metrics.pendingPartialWithdrawals.set(headState.pendingPartialWithdrawalsCount);
|
|
1373
|
+
metrics.pendingConsolidations.set(headState.pendingConsolidationsCount);
|
|
1324
1374
|
}
|
|
1325
1375
|
}
|
|
1326
1376
|
|
|
@@ -1363,6 +1413,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1363
1413
|
private onClockEpoch(epoch: Epoch): void {
|
|
1364
1414
|
this.metrics?.clockEpoch.set(epoch);
|
|
1365
1415
|
|
|
1416
|
+
if (epoch === this.config.GLOAS_FORK_EPOCH) {
|
|
1417
|
+
this.regen.upgradeForGloas(epoch);
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1366
1420
|
this.seenAttesters.prune(epoch);
|
|
1367
1421
|
this.seenAggregators.prune(epoch);
|
|
1368
1422
|
this.seenPayloadAttesters.prune(epoch);
|
|
@@ -1376,22 +1430,21 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1376
1430
|
this.seenContributionAndProof.prune(head.slot);
|
|
1377
1431
|
}
|
|
1378
1432
|
|
|
1379
|
-
private onForkChoiceJustified(this: BeaconChain, cp:
|
|
1433
|
+
private onForkChoiceJustified(this: BeaconChain, cp: CheckpointWithPayloadStatus): void {
|
|
1380
1434
|
this.logger.verbose("Fork choice justified", {epoch: cp.epoch, root: cp.rootHex});
|
|
1381
1435
|
}
|
|
1382
1436
|
|
|
1383
|
-
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state:
|
|
1437
|
+
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state: IBeaconStateView): void {
|
|
1384
1438
|
// Defer to not block other checkpoint event handlers, which can cause lightclient update delays
|
|
1385
1439
|
callInNextEventLoop(() => {
|
|
1386
1440
|
this.shufflingCache.processState(state);
|
|
1387
1441
|
});
|
|
1388
1442
|
}
|
|
1389
1443
|
|
|
1390
|
-
private async onForkChoiceFinalized(this: BeaconChain, cp:
|
|
1444
|
+
private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithPayloadStatus): Promise<void> {
|
|
1391
1445
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1392
1446
|
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1393
1447
|
this.seenBlockProposers.prune(finalizedSlot);
|
|
1394
|
-
this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
|
|
1395
1448
|
|
|
1396
1449
|
// Update validator custody to account for effective balance changes
|
|
1397
1450
|
await this.updateValidatorsCustodyRequirement(cp);
|
|
@@ -1429,7 +1482,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1429
1482
|
}
|
|
1430
1483
|
}
|
|
1431
1484
|
|
|
1432
|
-
private async updateValidatorsCustodyRequirement(finalizedCheckpoint:
|
|
1485
|
+
private async updateValidatorsCustodyRequirement(finalizedCheckpoint: CheckpointWithPayloadStatus): Promise<void> {
|
|
1433
1486
|
if (this.custodyConfig.targetCustodyGroupCount === this.config.NUMBER_OF_CUSTODY_GROUPS) {
|
|
1434
1487
|
// Custody requirements can only be increased, we can disable dynamic custody updates
|
|
1435
1488
|
// if the node already maintains custody of all custody groups in case it is configured
|
|
@@ -1467,7 +1520,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1467
1520
|
if (stateOrBytes instanceof Uint8Array) {
|
|
1468
1521
|
effectiveBalances = getEffectiveBalancesFromStateBytes(this.config, stateOrBytes, validatorIndices);
|
|
1469
1522
|
} else {
|
|
1470
|
-
effectiveBalances = validatorIndices.map((index) => stateOrBytes.
|
|
1523
|
+
effectiveBalances = validatorIndices.map((index) => stateOrBytes.getValidator(index).effectiveBalance ?? 0);
|
|
1471
1524
|
}
|
|
1472
1525
|
}
|
|
1473
1526
|
|
|
@@ -1517,11 +1570,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1517
1570
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
1518
1571
|
}
|
|
1519
1572
|
|
|
1520
|
-
preState = processSlots(
|
|
1573
|
+
preState = preState.processSlots(block.slot); // Dial preState's slot to block.slot
|
|
1521
1574
|
|
|
1522
1575
|
const proposerRewards = this.regen.getStateSync(toRootHex(block.stateRoot))?.proposerRewards ?? undefined;
|
|
1523
1576
|
|
|
1524
|
-
return computeBlockRewards(
|
|
1577
|
+
return preState.computeBlockRewards(block, proposerRewards);
|
|
1525
1578
|
}
|
|
1526
1579
|
|
|
1527
1580
|
async getAttestationsRewards(
|
|
@@ -1545,7 +1598,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1545
1598
|
throw Error(`State is not in cache for slot ${slot}`);
|
|
1546
1599
|
}
|
|
1547
1600
|
|
|
1548
|
-
const rewards = await computeAttestationsRewards(
|
|
1601
|
+
const rewards = await cachedState.computeAttestationsRewards(validatorIds);
|
|
1549
1602
|
|
|
1550
1603
|
return {rewards, executionOptimistic, finalized};
|
|
1551
1604
|
}
|
|
@@ -1560,8 +1613,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1560
1613
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
1561
1614
|
}
|
|
1562
1615
|
|
|
1563
|
-
preState = processSlots(
|
|
1616
|
+
preState = preState.processSlots(block.slot); // Dial preState's slot to block.slot
|
|
1564
1617
|
|
|
1565
|
-
return computeSyncCommitteeRewards(
|
|
1618
|
+
return preState.computeSyncCommitteeRewards(block, validatorIds ?? []);
|
|
1566
1619
|
}
|
|
1567
1620
|
}
|