@lodestar/beacon-node 1.42.0-dev.4411584fd8 → 1.42.0-dev.47afaa6bb7
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 +60 -29
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +5 -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 +38 -40
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +4 -4
- 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/debug/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +8 -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 +35 -29
- 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/ColumnReconstructionTracker.d.ts +2 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +5 -5
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +2 -1
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +14 -12
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +1 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +3 -7
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +8 -26
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -0
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -0
- package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -3
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +1 -0
- package/lib/chain/archiveStore/interface.d.ts.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/blockInput.d.ts +5 -5
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +5 -4
- 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 +54 -24
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +50 -0
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -0
- package/lib/chain/blocks/importExecutionPayload.js +195 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -0
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +3 -2
- 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 +88 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +279 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +30 -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 +28 -15
- 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 +5 -5
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -4
- 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 +4 -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 -16
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +142 -69
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +31 -9
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +12 -3
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +10 -5
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts +31 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js +7 -0
- package/lib/chain/errors/dataColumnSidecarError.js.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 +30 -34
- 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 +21 -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 +11 -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 +13 -13
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.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 +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +1 -0
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -0
- package/lib/chain/options.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 +10 -4
- 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 +14 -10
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +7 -7
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +32 -17
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +15 -13
- 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 +14 -14
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +6 -5
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +6 -6
- 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.d.ts +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +4 -4
- 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/fifoBlockStateCache.d.ts +6 -6
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +11 -11
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +12 -16
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +14 -14
- 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 +15 -6
- 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.d.ts +11 -4
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +185 -6
- 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 +10 -7
- 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 +34 -19
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +5 -3
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/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 +17 -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 +5 -2
- 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 +14 -9
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/buckets.d.ts +2 -2
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -2
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js +4 -2
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +4 -2
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +60 -4
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +126 -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 +7 -4
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +22 -11
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +7 -4
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +12 -3
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +7 -2
- package/lib/network/options.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 +34 -4
- 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 +287 -70
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +22 -7
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +313 -80
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js +9 -0
- 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 +10 -4
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +16 -4
- 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 +3 -3
- 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 +2 -2
- package/lib/sync/backfill/backfill.d.ts.map +1 -1
- package/lib/sync/backfill/backfill.js +2 -2
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +3 -9
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +10 -43
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +3 -3
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +4 -2
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +3 -3
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +10 -5
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/blobs.d.ts +3 -3
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js +21 -10
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/dataColumns.d.ts +18 -11
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +51 -17
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/execution.d.ts +6 -2
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +49 -25
- package/lib/util/execution.js.map +1 -1
- package/lib/util/sszBytes.d.ts +29 -2
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +258 -14
- 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 +16 -16
- package/src/api/impl/beacon/blocks/index.ts +69 -33
- package/src/api/impl/beacon/pool/index.ts +5 -1
- package/src/api/impl/beacon/state/index.ts +43 -55
- package/src/api/impl/beacon/state/utils.ts +11 -25
- package/src/api/impl/debug/index.ts +2 -2
- package/src/api/impl/lodestar/index.ts +8 -8
- package/src/api/impl/proof/index.ts +2 -9
- package/src/api/impl/validator/index.ts +38 -43
- package/src/api/impl/validator/utils.ts +4 -7
- package/src/chain/ColumnReconstructionTracker.ts +6 -5
- package/src/chain/GetBlobsTracker.ts +14 -12
- package/src/chain/archiveStore/archiveStore.ts +1 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -39
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +2 -1
- package/src/chain/archiveStore/historicalState/types.ts +2 -0
- package/src/chain/archiveStore/historicalState/worker.ts +1 -4
- package/src/chain/archiveStore/interface.ts +1 -0
- package/src/chain/balancesCache.ts +5 -11
- package/src/chain/blocks/blockInput/blockInput.ts +8 -8
- package/src/chain/blocks/blockInput/types.ts +5 -4
- package/src/chain/blocks/importBlock.ts +85 -32
- package/src/chain/blocks/importExecutionPayload.ts +277 -0
- package/src/chain/blocks/index.ts +3 -2
- package/src/chain/blocks/payloadEnvelopeInput/index.ts +2 -0
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +377 -0
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +34 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +61 -0
- package/src/chain/blocks/types.ts +34 -15
- package/src/chain/blocks/utils/checkpoint.ts +2 -2
- package/src/chain/blocks/verifyBlock.ts +5 -10
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +10 -14
- package/src/chain/blocks/verifyBlocksSignatures.ts +10 -3
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +55 -0
- package/src/chain/chain.ts +188 -101
- package/src/chain/emitter.ts +27 -9
- package/src/chain/errors/blockError.ts +8 -5
- package/src/chain/errors/dataColumnSidecarError.ts +32 -1
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -2
- package/src/chain/forkChoice/index.ts +35 -51
- package/src/chain/initState.ts +7 -2
- package/src/chain/interface.ts +22 -18
- package/src/chain/lightClient/index.ts +17 -18
- package/src/chain/opPools/aggregatedAttestationPool.ts +20 -21
- package/src/chain/opPools/executionPayloadBidPool.ts +3 -3
- package/src/chain/opPools/opPool.ts +13 -14
- package/src/chain/opPools/utils.ts +3 -3
- package/src/chain/options.ts +2 -0
- package/src/chain/prepareNextSlot.ts +14 -8
- package/src/chain/produceBlock/computeNewStateRoot.ts +18 -16
- package/src/chain/produceBlock/produceBlockBody.ts +51 -48
- package/src/chain/regen/interface.ts +15 -17
- package/src/chain/regen/queued.ts +16 -20
- package/src/chain/regen/regen.ts +16 -17
- package/src/chain/seenCache/index.ts +1 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +4 -4
- 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/fifoBlockStateCache.ts +7 -7
- package/src/chain/stateCache/persistentCheckpointsCache.ts +27 -42
- package/src/chain/stateCache/types.ts +14 -18
- package/src/chain/validation/attesterSlashing.ts +3 -3
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/block.ts +16 -10
- package/src/chain/validation/blsToExecutionChange.ts +2 -2
- package/src/chain/validation/dataColumnSidecar.ts +231 -8
- package/src/chain/validation/executionPayloadBid.ts +10 -10
- package/src/chain/validation/executionPayloadEnvelope.ts +42 -26
- package/src/chain/validation/payloadAttestationMessage.ts +6 -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 +25 -20
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +9 -10
- package/src/chain/validation/voluntaryExit.ts +3 -8
- package/src/chain/validatorMonitor.ts +25 -13
- package/src/db/buckets.ts +2 -2
- package/src/db/repositories/dataColumnSidecar.ts +4 -2
- package/src/db/repositories/dataColumnSidecarArchive.ts +4 -2
- package/src/metrics/metrics/lodestar.ts +134 -19
- package/src/network/gossip/encoding.ts +16 -0
- package/src/network/interface.ts +18 -4
- package/src/network/libp2p/index.ts +24 -13
- package/src/network/network.ts +39 -8
- package/src/network/options.ts +7 -2
- package/src/network/processor/extractSlotRootFns.ts +43 -4
- package/src/network/processor/gossipHandlers.ts +356 -80
- package/src/network/processor/index.ts +395 -92
- package/src/network/reqresp/ReqRespBeaconNode.ts +13 -0
- 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 +26 -5
- package/src/node/nodejs.ts +6 -5
- package/src/node/notifier.ts +5 -6
- package/src/sync/backfill/backfill.ts +3 -3
- package/src/sync/unknownBlock.ts +13 -53
- package/src/sync/utils/downloadByRange.ts +9 -7
- package/src/sync/utils/downloadByRoot.ts +16 -12
- package/src/util/blobs.ts +35 -15
- package/src/util/dataColumns.ts +69 -25
- package/src/util/execution.ts +49 -30
- package/src/util/sszBytes.ts +335 -13
- package/src/util/types.ts +6 -0
- 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/seenCache/seenExecutionPayloadEnvelope.ts +0 -34
package/src/chain/chain.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
6
|
CheckpointWithPayloadStatus,
|
|
@@ -14,36 +14,30 @@ import {LoggerNode} from "@lodestar/logger/node";
|
|
|
14
14
|
import {
|
|
15
15
|
BUILDER_INDEX_SELF_BUILD,
|
|
16
16
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
17
|
-
ForkPostFulu,
|
|
17
|
+
type ForkPostFulu,
|
|
18
|
+
type ForkPostGloas,
|
|
18
19
|
GENESIS_SLOT,
|
|
19
20
|
SLOTS_PER_EPOCH,
|
|
20
|
-
isForkPostElectra,
|
|
21
21
|
isForkPostGloas,
|
|
22
22
|
} from "@lodestar/params";
|
|
23
23
|
import {
|
|
24
|
-
BeaconStateAllForks,
|
|
25
|
-
BeaconStateElectra,
|
|
26
|
-
CachedBeaconStateAllForks,
|
|
27
|
-
CachedBeaconStateGloas,
|
|
28
24
|
EffectiveBalanceIncrements,
|
|
29
25
|
EpochShuffling,
|
|
26
|
+
IBeaconStateView,
|
|
30
27
|
PubkeyCache,
|
|
31
|
-
computeAnchorCheckpoint,
|
|
32
|
-
computeAttestationsRewards,
|
|
33
|
-
computeBlockRewards,
|
|
34
28
|
computeEndSlotAtEpoch,
|
|
35
29
|
computeEpochAtSlot,
|
|
36
30
|
computeStartSlotAtEpoch,
|
|
37
|
-
computeSyncCommitteeRewards,
|
|
38
|
-
getEffectiveBalanceIncrementsZeroInactive,
|
|
39
31
|
getEffectiveBalancesFromStateBytes,
|
|
40
|
-
|
|
32
|
+
isStatePostAltair,
|
|
33
|
+
isStatePostElectra,
|
|
34
|
+
isStatePostGloas,
|
|
41
35
|
} from "@lodestar/state-transition";
|
|
42
36
|
import {
|
|
43
37
|
BeaconBlock,
|
|
44
38
|
BlindedBeaconBlock,
|
|
45
39
|
BlindedBeaconBlockBody,
|
|
46
|
-
|
|
40
|
+
DataColumnSidecar,
|
|
47
41
|
Epoch,
|
|
48
42
|
Root,
|
|
49
43
|
RootHex,
|
|
@@ -84,7 +78,10 @@ import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
|
84
78
|
import {BeaconProposerCache} from "./beaconProposerCache.js";
|
|
85
79
|
import {IBlockInput, isBlockInputBlobs, isBlockInputColumns} from "./blocks/blockInput/index.js";
|
|
86
80
|
import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js";
|
|
81
|
+
import {PayloadEnvelopeProcessor} from "./blocks/payloadEnvelopeProcessor.js";
|
|
82
|
+
import {ImportPayloadOpts} from "./blocks/types.js";
|
|
87
83
|
import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
|
|
84
|
+
import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToDb.js";
|
|
88
85
|
import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
|
|
89
86
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
90
87
|
import {ChainEvent, ChainEventEmitter} from "./emitter.js";
|
|
@@ -103,19 +100,20 @@ import {
|
|
|
103
100
|
} from "./opPools/index.js";
|
|
104
101
|
import {IChainOptions} from "./options.js";
|
|
105
102
|
import {PrepareNextSlotScheduler} from "./prepareNextSlot.js";
|
|
106
|
-
import {
|
|
103
|
+
import {computeNewStateRoot, computePayloadEnvelopeStateRoot} from "./produceBlock/computeNewStateRoot.js";
|
|
107
104
|
import {AssembledBlockType, BlockType, ProduceFullGloas, ProduceResult} from "./produceBlock/index.js";
|
|
108
105
|
import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produceBlock/produceBlockBody.js";
|
|
109
106
|
import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js";
|
|
110
107
|
import {ReprocessController} from "./reprocess.js";
|
|
111
108
|
import {
|
|
109
|
+
PayloadEnvelopeInput,
|
|
112
110
|
SeenAggregators,
|
|
113
111
|
SeenAttesters,
|
|
114
112
|
SeenBlockProposers,
|
|
115
113
|
SeenContributionAndProof,
|
|
116
114
|
SeenExecutionPayloadBids,
|
|
117
|
-
SeenExecutionPayloadEnvelopes,
|
|
118
115
|
SeenPayloadAttesters,
|
|
116
|
+
SeenPayloadEnvelopeInput,
|
|
119
117
|
SeenSyncCommitteeMessages,
|
|
120
118
|
} from "./seenCache/index.js";
|
|
121
119
|
import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
@@ -148,6 +146,13 @@ const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
|
|
|
148
146
|
*/
|
|
149
147
|
const DEFAULT_MAX_PENDING_UNFINALIZED_BLOCK_WRITES = 16;
|
|
150
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The maximum number of pending unfinalized payload envelope writes to the database before backpressure is applied.
|
|
151
|
+
* Payload envelope write queue entries hold references to payload inputs (including columns),
|
|
152
|
+
* keeping them in memory. Keep moderate to avoid OOM during sync.
|
|
153
|
+
*/
|
|
154
|
+
const DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES = 16;
|
|
155
|
+
|
|
151
156
|
export class BeaconChain implements IBeaconChain {
|
|
152
157
|
readonly genesisTime: UintNum64;
|
|
153
158
|
readonly genesisValidatorsRoot: Root;
|
|
@@ -172,6 +177,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
172
177
|
readonly reprocessController: ReprocessController;
|
|
173
178
|
readonly archiveStore: ArchiveStore;
|
|
174
179
|
readonly unfinalizedBlockWrites: JobItemQueue<[IBlockInput], void>;
|
|
180
|
+
readonly unfinalizedPayloadEnvelopeWrites: JobItemQueue<[PayloadEnvelopeInput], void>;
|
|
175
181
|
|
|
176
182
|
// Ops pool
|
|
177
183
|
readonly attestationPool: AttestationPool;
|
|
@@ -187,13 +193,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
187
193
|
readonly seenAggregators = new SeenAggregators();
|
|
188
194
|
readonly seenPayloadAttesters = new SeenPayloadAttesters();
|
|
189
195
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
190
|
-
readonly seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
|
|
191
196
|
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
192
197
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
193
198
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
194
199
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
195
200
|
readonly seenAttestationDatas: SeenAttestationDatas;
|
|
196
201
|
readonly seenBlockInputCache: SeenBlockInput;
|
|
202
|
+
readonly seenPayloadEnvelopeInputCache: SeenPayloadEnvelopeInput;
|
|
197
203
|
// Seen cache for liveness checks
|
|
198
204
|
readonly seenBlockAttesters = new SeenBlockAttesters();
|
|
199
205
|
|
|
@@ -221,6 +227,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
221
227
|
readonly opts: IChainOptions;
|
|
222
228
|
|
|
223
229
|
protected readonly blockProcessor: BlockProcessor;
|
|
230
|
+
protected readonly payloadEnvelopeProcessor: PayloadEnvelopeProcessor;
|
|
224
231
|
protected readonly db: IBeaconDb;
|
|
225
232
|
// this is only available if nHistoricalStates is enabled
|
|
226
233
|
private readonly cpStateDatastore?: CPStateDatastore;
|
|
@@ -270,7 +277,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
270
277
|
clock?: IClock;
|
|
271
278
|
metrics: Metrics | null;
|
|
272
279
|
validatorMonitor: ValidatorMonitor | null;
|
|
273
|
-
anchorState:
|
|
280
|
+
anchorState: IBeaconStateView;
|
|
274
281
|
isAnchorStateFinalized: boolean;
|
|
275
282
|
executionEngine: IExecutionEngine;
|
|
276
283
|
executionBuilder?: IExecutionBuilder;
|
|
@@ -334,21 +341,28 @@ export class BeaconChain implements IBeaconChain {
|
|
|
334
341
|
metrics,
|
|
335
342
|
logger,
|
|
336
343
|
});
|
|
344
|
+
this.seenPayloadEnvelopeInputCache = new SeenPayloadEnvelopeInput({
|
|
345
|
+
chainEvents: emitter,
|
|
346
|
+
signal,
|
|
347
|
+
serializedCache: this.serializedCache,
|
|
348
|
+
metrics,
|
|
349
|
+
logger,
|
|
350
|
+
});
|
|
337
351
|
|
|
338
352
|
this._earliestAvailableSlot = anchorState.slot;
|
|
339
353
|
|
|
340
354
|
this.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
341
355
|
{
|
|
342
|
-
shuffling: anchorState.
|
|
343
|
-
decisionRoot: anchorState.
|
|
356
|
+
shuffling: anchorState.getPreviousShuffling(),
|
|
357
|
+
decisionRoot: anchorState.previousDecisionRoot,
|
|
344
358
|
},
|
|
345
359
|
{
|
|
346
|
-
shuffling: anchorState.
|
|
347
|
-
decisionRoot: anchorState.
|
|
360
|
+
shuffling: anchorState.getCurrentShuffling(),
|
|
361
|
+
decisionRoot: anchorState.currentDecisionRoot,
|
|
348
362
|
},
|
|
349
363
|
{
|
|
350
|
-
shuffling: anchorState.
|
|
351
|
-
decisionRoot: anchorState.
|
|
364
|
+
shuffling: anchorState.getNextShuffling(),
|
|
365
|
+
decisionRoot: anchorState.nextDecisionRoot,
|
|
352
366
|
},
|
|
353
367
|
]);
|
|
354
368
|
|
|
@@ -357,7 +371,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
357
371
|
|
|
358
372
|
const fileDataStore = opts.nHistoricalStatesFileDataStore ?? true;
|
|
359
373
|
const blockStateCache = new FIFOBlockStateCache(this.opts, {metrics});
|
|
360
|
-
this.bufferPool = new BufferPool(anchorState.
|
|
374
|
+
this.bufferPool = new BufferPool(anchorState.serializedSize(), metrics);
|
|
361
375
|
|
|
362
376
|
this.cpStateDatastore = fileDataStore ? new FileCPStateDatastore(dataDir) : new DbCPStateDatastore(this.db);
|
|
363
377
|
const checkpointStateCache: CheckpointStateCache = new PersistentCheckpointStateCache(
|
|
@@ -373,10 +387,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
373
387
|
this.opts
|
|
374
388
|
);
|
|
375
389
|
|
|
376
|
-
const {checkpoint} = computeAnchorCheckpoint(
|
|
390
|
+
const {checkpoint} = anchorState.computeAnchorCheckpoint();
|
|
377
391
|
blockStateCache.add(anchorState);
|
|
378
392
|
blockStateCache.setHeadState(anchorState);
|
|
379
|
-
const payloadPresent = getCheckpointPayloadStatus(anchorState, checkpoint.epoch) === PayloadStatus.FULL;
|
|
393
|
+
const payloadPresent = getCheckpointPayloadStatus(config, anchorState, checkpoint.epoch) === PayloadStatus.FULL;
|
|
380
394
|
checkpointStateCache.add(checkpoint, anchorState, payloadPresent);
|
|
381
395
|
|
|
382
396
|
const forkChoice = initializeForkChoice(
|
|
@@ -411,6 +425,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
411
425
|
this.reprocessController = new ReprocessController(this.metrics);
|
|
412
426
|
|
|
413
427
|
this.blockProcessor = new BlockProcessor(this, metrics, opts, signal);
|
|
428
|
+
this.payloadEnvelopeProcessor = new PayloadEnvelopeProcessor(this, metrics, signal);
|
|
414
429
|
|
|
415
430
|
this.forkChoice = forkChoice;
|
|
416
431
|
this.clock = clock;
|
|
@@ -447,6 +462,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
447
462
|
metrics?.unfinalizedBlockWritesQueue
|
|
448
463
|
);
|
|
449
464
|
|
|
465
|
+
this.unfinalizedPayloadEnvelopeWrites = new JobItemQueue(
|
|
466
|
+
persistPayloadEnvelopeInput.bind(this),
|
|
467
|
+
{
|
|
468
|
+
maxLength: DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES,
|
|
469
|
+
signal,
|
|
470
|
+
},
|
|
471
|
+
metrics?.unfinalizedPayloadEnvelopeWritesQueue
|
|
472
|
+
);
|
|
473
|
+
|
|
450
474
|
// always run PrepareNextSlotScheduler except for fork_choice spec tests
|
|
451
475
|
if (!opts?.disablePrepareNextSlot) {
|
|
452
476
|
new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
|
|
@@ -477,12 +501,17 @@ export class BeaconChain implements IBeaconChain {
|
|
|
477
501
|
// we can abort any ongoing unfinalized block writes.
|
|
478
502
|
// TODO: persist fork choice to disk and allow unfinalized block writes to complete.
|
|
479
503
|
this.unfinalizedBlockWrites.dropAllJobs();
|
|
504
|
+
this.unfinalizedPayloadEnvelopeWrites.dropAllJobs();
|
|
480
505
|
|
|
481
506
|
this.abortController.abort();
|
|
482
507
|
}
|
|
483
508
|
|
|
484
509
|
seenBlock(blockRoot: RootHex): boolean {
|
|
485
|
-
return this.seenBlockInputCache.
|
|
510
|
+
return this.seenBlockInputCache.hasBlock(blockRoot) || this.forkChoice.hasBlockHexUnsafe(blockRoot);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
seenPayloadEnvelope(blockRoot: RootHex): boolean {
|
|
514
|
+
return this.seenPayloadEnvelopeInputCache.hasPayload(blockRoot) || this.forkChoice.hasPayloadHexUnsafe(blockRoot);
|
|
486
515
|
}
|
|
487
516
|
|
|
488
517
|
regenCanAcceptWork(): boolean {
|
|
@@ -526,7 +555,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
526
555
|
await this.opPool.toPersisted(this.db);
|
|
527
556
|
}
|
|
528
557
|
|
|
529
|
-
getHeadState():
|
|
558
|
+
getHeadState(): IBeaconStateView {
|
|
530
559
|
// head state should always exist
|
|
531
560
|
const head = this.forkChoice.getHead();
|
|
532
561
|
const headState = this.regen.getClosestHeadState(head);
|
|
@@ -536,11 +565,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
536
565
|
return headState;
|
|
537
566
|
}
|
|
538
567
|
|
|
539
|
-
async getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<
|
|
568
|
+
async getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<IBeaconStateView> {
|
|
540
569
|
return this.getHeadStateAtEpoch(this.clock.currentEpoch, regenCaller);
|
|
541
570
|
}
|
|
542
571
|
|
|
543
|
-
async getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<
|
|
572
|
+
async getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<IBeaconStateView> {
|
|
544
573
|
// using getHeadState() means we'll use checkpointStateCache if it's available
|
|
545
574
|
const headState = this.getHeadState();
|
|
546
575
|
// head state is in the same epoch, or we pulled up head state already from past epoch
|
|
@@ -557,7 +586,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
557
586
|
async getStateBySlot(
|
|
558
587
|
slot: Slot,
|
|
559
588
|
opts?: StateGetOpts
|
|
560
|
-
): Promise<{state:
|
|
589
|
+
): Promise<{state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
561
590
|
const finalizedBlock = this.forkChoice.getFinalizedBlock();
|
|
562
591
|
|
|
563
592
|
if (slot < finalizedBlock.slot) {
|
|
@@ -607,15 +636,17 @@ export class BeaconChain implements IBeaconChain {
|
|
|
607
636
|
async getStateByStateRoot(
|
|
608
637
|
stateRoot: RootHex,
|
|
609
638
|
opts?: StateGetOpts
|
|
610
|
-
): Promise<{state:
|
|
639
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
611
640
|
if (opts?.allowRegen) {
|
|
612
641
|
const state = await this.regen.getState(stateRoot, RegenCaller.restApi);
|
|
613
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
642
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
643
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(state.latestBlockHeader)
|
|
644
|
+
);
|
|
614
645
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
615
646
|
return {
|
|
616
647
|
state,
|
|
617
648
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
618
|
-
finalized: state.
|
|
649
|
+
finalized: state.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
619
650
|
};
|
|
620
651
|
}
|
|
621
652
|
|
|
@@ -626,12 +657,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
626
657
|
// TODO: This is very inneficient for debug requests of serialized content, since it deserializes to serialize again
|
|
627
658
|
const cachedStateCtx = this.regen.getStateSync(stateRoot);
|
|
628
659
|
if (cachedStateCtx) {
|
|
629
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
660
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
661
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(cachedStateCtx.latestBlockHeader)
|
|
662
|
+
);
|
|
630
663
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
631
664
|
return {
|
|
632
665
|
state: cachedStateCtx,
|
|
633
666
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
634
|
-
finalized: cachedStateCtx.
|
|
667
|
+
finalized: cachedStateCtx.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
635
668
|
};
|
|
636
669
|
}
|
|
637
670
|
|
|
@@ -658,17 +691,19 @@ export class BeaconChain implements IBeaconChain {
|
|
|
658
691
|
|
|
659
692
|
getStateByCheckpoint(
|
|
660
693
|
checkpoint: CheckpointWithPayloadStatus
|
|
661
|
-
): {state:
|
|
694
|
+
): {state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null {
|
|
662
695
|
// finalized or justified checkpoint states maynot be available with PersistentCheckpointStateCache, use getCheckpointStateOrBytes() api to get Uint8Array
|
|
663
696
|
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
664
697
|
const cachedStateCtx = this.regen.getCheckpointStateSync(checkpointHexPayload);
|
|
665
698
|
if (cachedStateCtx) {
|
|
666
|
-
const block = this.forkChoice.getBlockDefaultStatus(
|
|
699
|
+
const block = this.forkChoice.getBlockDefaultStatus(
|
|
700
|
+
ssz.phase0.BeaconBlockHeader.hashTreeRoot(cachedStateCtx.latestBlockHeader)
|
|
701
|
+
);
|
|
667
702
|
const finalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
668
703
|
return {
|
|
669
704
|
state: cachedStateCtx,
|
|
670
705
|
executionOptimistic: block != null && isOptimisticBlock(block),
|
|
671
|
-
finalized: cachedStateCtx.
|
|
706
|
+
finalized: cachedStateCtx.epoch <= finalizedEpoch && finalizedEpoch !== GENESIS_EPOCH,
|
|
672
707
|
};
|
|
673
708
|
}
|
|
674
709
|
|
|
@@ -677,7 +712,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
677
712
|
|
|
678
713
|
async getStateOrBytesByCheckpoint(
|
|
679
714
|
checkpoint: CheckpointWithPayloadStatus
|
|
680
|
-
): Promise<{state:
|
|
715
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
681
716
|
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
682
717
|
const cachedStateCtx = await this.regen.getCheckpointStateOrBytes(checkpointHexPayload);
|
|
683
718
|
if (cachedStateCtx) {
|
|
@@ -827,20 +862,50 @@ export class BeaconChain implements IBeaconChain {
|
|
|
827
862
|
return null;
|
|
828
863
|
}
|
|
829
864
|
|
|
830
|
-
async
|
|
831
|
-
const
|
|
832
|
-
if (
|
|
833
|
-
|
|
834
|
-
|
|
865
|
+
async getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
|
|
866
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
867
|
+
if (payloadInput?.hasPayloadEnvelope()) {
|
|
868
|
+
const envelope = payloadInput.getPayloadEnvelope();
|
|
869
|
+
const serialized = this.serializedCache.get(envelope);
|
|
870
|
+
if (serialized) {
|
|
871
|
+
return serialized;
|
|
835
872
|
}
|
|
836
|
-
return
|
|
873
|
+
return ssz.gloas.SignedExecutionPayloadEnvelope.serialize(envelope);
|
|
837
874
|
}
|
|
875
|
+
|
|
876
|
+
return (
|
|
877
|
+
(await this.db.executionPayloadEnvelope.getBinary(fromHex(blockRootHex))) ??
|
|
878
|
+
(await this.db.executionPayloadEnvelopeArchive.getBinary(blockSlot)) ??
|
|
879
|
+
null
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<DataColumnSidecar[]> {
|
|
884
|
+
const fork = this.config.getForkName(blockSlot);
|
|
885
|
+
|
|
886
|
+
if (isForkPostGloas(fork)) {
|
|
887
|
+
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
888
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
889
|
+
if (payloadInput) {
|
|
890
|
+
return payloadInput.getAllColumns();
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
// Before gloas, columns are tracked in BlockInput
|
|
894
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
895
|
+
if (blockInput) {
|
|
896
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
897
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
898
|
+
}
|
|
899
|
+
return blockInput.getAllColumns();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
838
903
|
const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
|
|
839
904
|
if (sidecarsUnfinalized.length > 0) {
|
|
840
|
-
return sidecarsUnfinalized
|
|
905
|
+
return sidecarsUnfinalized;
|
|
841
906
|
}
|
|
842
907
|
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
|
|
843
|
-
return sidecarsFinalized
|
|
908
|
+
return sidecarsFinalized;
|
|
844
909
|
}
|
|
845
910
|
|
|
846
911
|
async getSerializedDataColumnSidecars(
|
|
@@ -848,23 +913,45 @@ export class BeaconChain implements IBeaconChain {
|
|
|
848
913
|
blockRootHex: string,
|
|
849
914
|
indices: number[]
|
|
850
915
|
): Promise<(Uint8Array | undefined)[]> {
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
916
|
+
const fork = this.config.getForkName(blockSlot);
|
|
917
|
+
|
|
918
|
+
if (isForkPostGloas(fork)) {
|
|
919
|
+
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
920
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
921
|
+
if (payloadInput) {
|
|
922
|
+
return indices.map((index) => {
|
|
923
|
+
const sidecar = payloadInput.getColumn(index);
|
|
924
|
+
if (!sidecar) {
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
928
|
+
if (serialized) {
|
|
929
|
+
return serialized;
|
|
930
|
+
}
|
|
931
|
+
return sszTypesFor(fork as ForkPostGloas).DataColumnSidecar.serialize(sidecar);
|
|
932
|
+
});
|
|
855
933
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (serialized) {
|
|
863
|
-
return serialized;
|
|
934
|
+
} else {
|
|
935
|
+
// Before gloas, columns are tracked in BlockInput
|
|
936
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
937
|
+
if (blockInput) {
|
|
938
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
939
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
864
940
|
}
|
|
865
|
-
return
|
|
866
|
-
|
|
941
|
+
return indices.map((index) => {
|
|
942
|
+
const sidecar = blockInput.getColumn(index);
|
|
943
|
+
if (!sidecar) {
|
|
944
|
+
return undefined;
|
|
945
|
+
}
|
|
946
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
947
|
+
if (serialized) {
|
|
948
|
+
return serialized;
|
|
949
|
+
}
|
|
950
|
+
return sszTypesFor(blockInput.forkName as ForkPostFulu).DataColumnSidecar.serialize(sidecar);
|
|
951
|
+
});
|
|
952
|
+
}
|
|
867
953
|
}
|
|
954
|
+
|
|
868
955
|
const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
|
|
869
956
|
if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
|
|
870
957
|
return sidecarsUnfinalized;
|
|
@@ -921,14 +1008,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
921
1008
|
consensusBlockValue: Wei;
|
|
922
1009
|
shouldOverrideBuilder?: boolean;
|
|
923
1010
|
}> {
|
|
924
|
-
const fork = this.config.getForkName(slot);
|
|
925
1011
|
const state = await this.regen.getBlockSlotState(
|
|
926
1012
|
parentBlock,
|
|
927
1013
|
slot,
|
|
928
1014
|
{dontTransferCache: true},
|
|
929
1015
|
RegenCaller.produceBlock
|
|
930
1016
|
);
|
|
931
|
-
const proposerIndex = state.
|
|
1017
|
+
const proposerIndex = state.getBeaconProposer(slot);
|
|
932
1018
|
const proposerPubKey = this.pubkeyCache.getOrThrow(proposerIndex).toBytes();
|
|
933
1019
|
|
|
934
1020
|
const {body, produceResult, executionPayloadValue, shouldOverrideBuilder} = await produceBlockBody.call(
|
|
@@ -950,7 +1036,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
950
1036
|
// The hashtree root computed here for debug log will get cached and hence won't introduce additional delays
|
|
951
1037
|
const bodyRoot =
|
|
952
1038
|
produceResult.type === BlockType.Full
|
|
953
|
-
?
|
|
1039
|
+
? this.config.getForkTypes(slot).BeaconBlockBody.hashTreeRoot(body)
|
|
954
1040
|
: this.config
|
|
955
1041
|
.getPostBellatrixForkTypes(slot)
|
|
956
1042
|
.BlindedBeaconBlockBody.hashTreeRoot(body as BlindedBeaconBlockBody);
|
|
@@ -968,14 +1054,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
968
1054
|
body,
|
|
969
1055
|
} as AssembledBlockType<T>;
|
|
970
1056
|
|
|
971
|
-
const {newStateRoot, proposerReward,
|
|
1057
|
+
const {newStateRoot, proposerReward, postBlockState} = computeNewStateRoot(this.metrics, state, block);
|
|
972
1058
|
block.stateRoot = newStateRoot;
|
|
973
1059
|
const blockRoot =
|
|
974
1060
|
produceResult.type === BlockType.Full
|
|
975
|
-
?
|
|
1061
|
+
? this.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block)
|
|
976
1062
|
: this.config.getPostBellatrixForkTypes(slot).BlindedBeaconBlock.hashTreeRoot(block as BlindedBeaconBlock);
|
|
977
1063
|
const blockRootHex = toRootHex(blockRoot);
|
|
978
1064
|
|
|
1065
|
+
const fork = this.config.getForkName(slot);
|
|
979
1066
|
if (isForkPostGloas(fork)) {
|
|
980
1067
|
// TODO GLOAS: we should retire BlockType post-gloas, may need a new enum for self vs non-self built
|
|
981
1068
|
if (produceResult.type !== BlockType.Full) {
|
|
@@ -991,8 +1078,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
991
1078
|
slot,
|
|
992
1079
|
stateRoot: ZERO_HASH,
|
|
993
1080
|
};
|
|
994
|
-
|
|
995
|
-
|
|
1081
|
+
if (!isStatePostGloas(postBlockState)) {
|
|
1082
|
+
throw Error(`Expected gloas+ post-state for execution payload envelope, got fork=${postBlockState.forkName}`);
|
|
1083
|
+
}
|
|
1084
|
+
const payloadEnvelopeStateRoot = computePayloadEnvelopeStateRoot(this.metrics, postBlockState, envelope);
|
|
1085
|
+
gloasResult.payloadEnvelopeStateRoot = payloadEnvelopeStateRoot;
|
|
996
1086
|
}
|
|
997
1087
|
|
|
998
1088
|
// Track the produced block for consensus broadcast validations, later validation, etc.
|
|
@@ -1010,6 +1100,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1010
1100
|
return this.blockProcessor.processBlocksJob(blocks, opts);
|
|
1011
1101
|
}
|
|
1012
1102
|
|
|
1103
|
+
async processExecutionPayload(payloadInput: PayloadEnvelopeInput, opts?: ImportPayloadOpts): Promise<void> {
|
|
1104
|
+
return this.payloadEnvelopeProcessor.processPayloadEnvelopeJob(payloadInput, opts);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1013
1107
|
getStatus(): Status {
|
|
1014
1108
|
const head = this.forkChoice.getHead();
|
|
1015
1109
|
const finalizedCheckpoint = this.forkChoice.getFinalizedCheckpoint();
|
|
@@ -1108,8 +1202,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1108
1202
|
* persist preState, postState and block for further investigation.
|
|
1109
1203
|
*/
|
|
1110
1204
|
async persistInvalidStateRoot(
|
|
1111
|
-
preState:
|
|
1112
|
-
postState:
|
|
1205
|
+
preState: IBeaconStateView,
|
|
1206
|
+
postState: IBeaconStateView,
|
|
1113
1207
|
block: SignedBeaconBlock
|
|
1114
1208
|
): Promise<void> {
|
|
1115
1209
|
const blockSlot = block.message.slot;
|
|
@@ -1124,13 +1218,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1124
1218
|
`${logStr}_block`
|
|
1125
1219
|
),
|
|
1126
1220
|
this.persistSszObject(
|
|
1127
|
-
`preState_slot_${preState.slot}
|
|
1221
|
+
`preState_slot_${preState.slot}_BeaconState`,
|
|
1128
1222
|
preState.serialize(),
|
|
1129
1223
|
preState.hashTreeRoot(),
|
|
1130
1224
|
`${logStr}_pre_state`
|
|
1131
1225
|
),
|
|
1132
1226
|
this.persistSszObject(
|
|
1133
|
-
`postState_slot_${postState.slot}
|
|
1227
|
+
`postState_slot_${postState.slot}_BeaconState`,
|
|
1134
1228
|
postState.serialize(),
|
|
1135
1229
|
postState.hashTreeRoot(),
|
|
1136
1230
|
`${logStr}_post_state`
|
|
@@ -1150,12 +1244,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1150
1244
|
}
|
|
1151
1245
|
}
|
|
1152
1246
|
|
|
1153
|
-
persistInvalidSszView(view: TreeView<CompositeTypeAny>, suffix?: string): void {
|
|
1154
|
-
if (this.opts.persistInvalidSszObjects) {
|
|
1155
|
-
void this.persistSszObject(view.type.typeName, view.serialize(), view.hashTreeRoot(), suffix);
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
1247
|
/**
|
|
1160
1248
|
* Regenerate state for attestation verification, this does not happen with default chain option of maxSkipSlots = 32 .
|
|
1161
1249
|
* However, need to handle just in case. Lodestar doesn't support multiple regen state requests for attestation verification
|
|
@@ -1173,7 +1261,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1173
1261
|
this.shufflingCache.insertPromise(attEpoch, shufflingDependentRoot);
|
|
1174
1262
|
const blockEpoch = computeEpochAtSlot(attHeadBlock.slot);
|
|
1175
1263
|
|
|
1176
|
-
let state:
|
|
1264
|
+
let state: IBeaconStateView;
|
|
1177
1265
|
if (blockEpoch < attEpoch - 1) {
|
|
1178
1266
|
// thanks to one epoch look ahead, we don't need to dial up to attEpoch
|
|
1179
1267
|
const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
|
|
@@ -1191,7 +1279,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1191
1279
|
}
|
|
1192
1280
|
// resolve the promise to unblock other calls of the same epoch and dependent root
|
|
1193
1281
|
this.shufflingCache.processState(state);
|
|
1194
|
-
return state.
|
|
1282
|
+
return state.getShufflingAtEpoch(attEpoch);
|
|
1195
1283
|
}
|
|
1196
1284
|
|
|
1197
1285
|
/**
|
|
@@ -1201,7 +1289,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1201
1289
|
*/
|
|
1202
1290
|
private justifiedBalancesGetter(
|
|
1203
1291
|
checkpoint: CheckpointWithPayloadStatus,
|
|
1204
|
-
blockState:
|
|
1292
|
+
blockState: IBeaconStateView
|
|
1205
1293
|
): EffectiveBalanceIncrements {
|
|
1206
1294
|
this.metrics?.balancesCache.requests.inc();
|
|
1207
1295
|
|
|
@@ -1228,7 +1316,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1228
1316
|
});
|
|
1229
1317
|
}
|
|
1230
1318
|
|
|
1231
|
-
return getEffectiveBalanceIncrementsZeroInactive(
|
|
1319
|
+
return state.getEffectiveBalanceIncrementsZeroInactive();
|
|
1232
1320
|
}
|
|
1233
1321
|
|
|
1234
1322
|
/**
|
|
@@ -1240,8 +1328,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1240
1328
|
*/
|
|
1241
1329
|
private closestJustifiedBalancesStateToCheckpoint(
|
|
1242
1330
|
checkpoint: CheckpointWithPayloadStatus,
|
|
1243
|
-
blockState:
|
|
1244
|
-
): {state:
|
|
1331
|
+
blockState: IBeaconStateView
|
|
1332
|
+
): {state: IBeaconStateView; stateId: string; shouldWarn: boolean} {
|
|
1245
1333
|
const checkpointHexPayload = fcCheckpointToHexPayload(checkpoint);
|
|
1246
1334
|
const state = this.regen.getCheckpointStateSync(checkpointHexPayload);
|
|
1247
1335
|
if (state) {
|
|
@@ -1321,13 +1409,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1321
1409
|
metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
|
|
1322
1410
|
|
|
1323
1411
|
const headState = this.getHeadState();
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
metrics.pendingDeposits.set(headStateElectra.pendingDeposits.length);
|
|
1329
|
-
metrics.pendingPartialWithdrawals.set(headStateElectra.pendingPartialWithdrawals.length);
|
|
1330
|
-
metrics.pendingConsolidations.set(headStateElectra.pendingConsolidations.length);
|
|
1412
|
+
if (isStatePostElectra(headState)) {
|
|
1413
|
+
metrics.pendingDeposits.set(headState.pendingDepositsCount);
|
|
1414
|
+
metrics.pendingPartialWithdrawals.set(headState.pendingPartialWithdrawalsCount);
|
|
1415
|
+
metrics.pendingConsolidations.set(headState.pendingConsolidationsCount);
|
|
1331
1416
|
}
|
|
1332
1417
|
}
|
|
1333
1418
|
|
|
@@ -1391,7 +1476,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1391
1476
|
this.logger.verbose("Fork choice justified", {epoch: cp.epoch, root: cp.rootHex});
|
|
1392
1477
|
}
|
|
1393
1478
|
|
|
1394
|
-
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state:
|
|
1479
|
+
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state: IBeaconStateView): void {
|
|
1395
1480
|
// Defer to not block other checkpoint event handlers, which can cause lightclient update delays
|
|
1396
1481
|
callInNextEventLoop(() => {
|
|
1397
1482
|
this.shufflingCache.processState(state);
|
|
@@ -1402,7 +1487,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1402
1487
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1403
1488
|
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1404
1489
|
this.seenBlockProposers.prune(finalizedSlot);
|
|
1405
|
-
this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
|
|
1406
1490
|
|
|
1407
1491
|
// Update validator custody to account for effective balance changes
|
|
1408
1492
|
await this.updateValidatorsCustodyRequirement(cp);
|
|
@@ -1478,7 +1562,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1478
1562
|
if (stateOrBytes instanceof Uint8Array) {
|
|
1479
1563
|
effectiveBalances = getEffectiveBalancesFromStateBytes(this.config, stateOrBytes, validatorIndices);
|
|
1480
1564
|
} else {
|
|
1481
|
-
effectiveBalances = validatorIndices.map((index) => stateOrBytes.
|
|
1565
|
+
effectiveBalances = validatorIndices.map((index) => stateOrBytes.getValidator(index).effectiveBalance ?? 0);
|
|
1482
1566
|
}
|
|
1483
1567
|
}
|
|
1484
1568
|
|
|
@@ -1528,11 +1612,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1528
1612
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
1529
1613
|
}
|
|
1530
1614
|
|
|
1531
|
-
preState = processSlots(
|
|
1615
|
+
preState = preState.processSlots(block.slot); // Dial preState's slot to block.slot
|
|
1532
1616
|
|
|
1533
1617
|
const proposerRewards = this.regen.getStateSync(toRootHex(block.stateRoot))?.proposerRewards ?? undefined;
|
|
1534
1618
|
|
|
1535
|
-
return computeBlockRewards(
|
|
1619
|
+
return preState.computeBlockRewards(block, proposerRewards);
|
|
1536
1620
|
}
|
|
1537
1621
|
|
|
1538
1622
|
async getAttestationsRewards(
|
|
@@ -1556,7 +1640,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1556
1640
|
throw Error(`State is not in cache for slot ${slot}`);
|
|
1557
1641
|
}
|
|
1558
1642
|
|
|
1559
|
-
const rewards = await computeAttestationsRewards(
|
|
1643
|
+
const rewards = await cachedState.computeAttestationsRewards(validatorIds);
|
|
1560
1644
|
|
|
1561
1645
|
return {rewards, executionOptimistic, finalized};
|
|
1562
1646
|
}
|
|
@@ -1571,8 +1655,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1571
1655
|
throw Error(`Pre-state is unavailable given block's parent root ${toRootHex(block.parentRoot)}`);
|
|
1572
1656
|
}
|
|
1573
1657
|
|
|
1574
|
-
preState = processSlots(
|
|
1658
|
+
preState = preState.processSlots(block.slot); // Dial preState's slot to block.slot
|
|
1659
|
+
if (!isStatePostAltair(preState)) {
|
|
1660
|
+
throw new Error("Sync committee rewards are not supported before Altair");
|
|
1661
|
+
}
|
|
1575
1662
|
|
|
1576
|
-
return computeSyncCommitteeRewards(
|
|
1663
|
+
return preState.computeSyncCommitteeRewards(block, validatorIds ?? []);
|
|
1577
1664
|
}
|
|
1578
1665
|
}
|