@lodestar/beacon-node 1.42.0-dev.5f2fffc2ce → 1.42.0-dev.687ecdc8cd
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 +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/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 +27 -27
- 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.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/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 +39 -23
- 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 +167 -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 +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 +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 +4 -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 +1 -1
- 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 +19 -14
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +75 -42
- 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 +17 -15
- 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/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 +3 -3
- 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/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.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/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 +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/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +5 -0
- package/lib/network/libp2p/index.js.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 +16 -16
- 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 +11 -25
- 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 +29 -41
- package/src/api/impl/validator/utils.ts +4 -7
- 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/types.ts +4 -3
- package/src/chain/blocks/importBlock.ts +59 -27
- package/src/chain/blocks/importExecutionPayload.ts +247 -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 +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 +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 +9 -14
- package/src/chain/blocks/verifyBlocksSignatures.ts +3 -3
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +55 -0
- package/src/chain/chain.ts +112 -70
- 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 +18 -16
- 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/options.ts +2 -0
- package/src/chain/prepareNextSlot.ts +6 -8
- package/src/chain/produceBlock/computeNewStateRoot.ts +11 -10
- package/src/chain/produceBlock/produceBlockBody.ts +23 -50
- 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 +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/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 +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 -8
- 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/libp2p/index.ts +5 -0
- 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/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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
2
2
|
import {RootHex, SignedBeaconBlock, Slot, ValidatorIndex} from "@lodestar/types";
|
|
3
3
|
import {LodestarError, toRootHex} from "@lodestar/utils";
|
|
4
4
|
import {ExecutionPayloadStatus} from "../../execution/engine/interface.js";
|
|
@@ -91,13 +91,13 @@ export type BlockErrorType =
|
|
|
91
91
|
| {code: BlockErrorCode.INCORRECT_PROPOSER; proposerIndex: ValidatorIndex}
|
|
92
92
|
| {code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID; blockSlot: Slot}
|
|
93
93
|
| {code: BlockErrorCode.UNKNOWN_PROPOSER; proposerIndex: ValidatorIndex}
|
|
94
|
-
| {code: BlockErrorCode.INVALID_SIGNATURE; state:
|
|
94
|
+
| {code: BlockErrorCode.INVALID_SIGNATURE; state: IBeaconStateView}
|
|
95
95
|
| {
|
|
96
96
|
code: BlockErrorCode.INVALID_STATE_ROOT;
|
|
97
97
|
root: Uint8Array;
|
|
98
98
|
expectedRoot: Uint8Array;
|
|
99
|
-
preState:
|
|
100
|
-
postState:
|
|
99
|
+
preState: IBeaconStateView;
|
|
100
|
+
postState: IBeaconStateView;
|
|
101
101
|
}
|
|
102
102
|
| {code: BlockErrorCode.NOT_FINALIZED_DESCENDANT; parentRoot: RootHex}
|
|
103
103
|
| {code: BlockErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot}
|
|
@@ -4,17 +4,21 @@ import {GossipActionError} from "./gossipValidation.js";
|
|
|
4
4
|
export enum ExecutionPayloadEnvelopeErrorCode {
|
|
5
5
|
BELONG_TO_FINALIZED_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BELONG_TO_FINALIZED_BLOCK",
|
|
6
6
|
BLOCK_ROOT_UNKNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_ROOT_UNKNOWN",
|
|
7
|
+
PARENT_UNKNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PARENT_UNKNOWN",
|
|
8
|
+
UNKNOWN_BLOCK_STATE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_UNKNOWN_BLOCK_STATE",
|
|
7
9
|
ENVELOPE_ALREADY_KNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_ALREADY_KNOWN",
|
|
8
10
|
INVALID_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK",
|
|
9
11
|
SLOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISMATCH",
|
|
10
12
|
BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
|
|
11
13
|
BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
|
|
12
14
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
|
|
13
|
-
|
|
15
|
+
PAYLOAD_ENVELOPE_INPUT_MISSING = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PAYLOAD_ENVELOPE_INPUT_MISSING",
|
|
14
16
|
}
|
|
15
17
|
export type ExecutionPayloadEnvelopeErrorType =
|
|
16
18
|
| {code: ExecutionPayloadEnvelopeErrorCode.BELONG_TO_FINALIZED_BLOCK; envelopeSlot: Slot; finalizedSlot: Slot}
|
|
17
19
|
| {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN; blockRoot: RootHex}
|
|
20
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.PARENT_UNKNOWN; parentRoot: RootHex; slot: Slot}
|
|
21
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.UNKNOWN_BLOCK_STATE; blockRoot: RootHex; slot: Slot}
|
|
18
22
|
| {
|
|
19
23
|
code: ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN;
|
|
20
24
|
blockRoot: RootHex;
|
|
@@ -33,6 +37,6 @@ export type ExecutionPayloadEnvelopeErrorType =
|
|
|
33
37
|
bidBlockHash: RootHex | null;
|
|
34
38
|
}
|
|
35
39
|
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE}
|
|
36
|
-
| {code: ExecutionPayloadEnvelopeErrorCode.
|
|
40
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
|
|
37
41
|
|
|
38
42
|
export class ExecutionPayloadEnvelopeError extends GossipActionError<ExecutionPayloadEnvelopeErrorType> {}
|
|
@@ -10,18 +10,12 @@ import {
|
|
|
10
10
|
ForkChoiceOpts as RawForkChoiceOpts,
|
|
11
11
|
getCheckpointPayloadStatus,
|
|
12
12
|
} from "@lodestar/fork-choice";
|
|
13
|
-
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
13
|
+
import {ForkSeq, ZERO_HASH_HEX} from "@lodestar/params";
|
|
14
14
|
import {
|
|
15
|
-
CachedBeaconStateAllForks,
|
|
16
|
-
CachedBeaconStateGloas,
|
|
17
15
|
DataAvailabilityStatus,
|
|
18
|
-
|
|
16
|
+
IBeaconStateView,
|
|
19
17
|
computeEpochAtSlot,
|
|
20
18
|
computeStartSlotAtEpoch,
|
|
21
|
-
getBlockRootAtSlot,
|
|
22
|
-
getEffectiveBalanceIncrementsZeroInactive,
|
|
23
|
-
isExecutionStateType,
|
|
24
|
-
isMergeTransitionComplete,
|
|
25
19
|
} from "@lodestar/state-transition";
|
|
26
20
|
import {Slot, ssz} from "@lodestar/types";
|
|
27
21
|
import {Logger, toRootHex} from "@lodestar/utils";
|
|
@@ -46,7 +40,7 @@ export function initializeForkChoice(
|
|
|
46
40
|
config: ChainForkConfig,
|
|
47
41
|
emitter: ChainEventEmitter,
|
|
48
42
|
currentSlot: Slot,
|
|
49
|
-
state:
|
|
43
|
+
state: IBeaconStateView,
|
|
50
44
|
isFinalizedState: boolean,
|
|
51
45
|
opts: ForkChoiceOpts,
|
|
52
46
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
@@ -83,13 +77,13 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
83
77
|
config: ChainForkConfig,
|
|
84
78
|
emitter: ChainEventEmitter,
|
|
85
79
|
currentSlot: Slot,
|
|
86
|
-
state:
|
|
80
|
+
state: IBeaconStateView,
|
|
87
81
|
opts: ForkChoiceOpts,
|
|
88
82
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
89
83
|
metrics: Metrics | null,
|
|
90
84
|
logger?: Logger
|
|
91
85
|
): ForkChoice {
|
|
92
|
-
const {blockHeader, checkpoint} = computeAnchorCheckpoint(
|
|
86
|
+
const {blockHeader, checkpoint} = state.computeAnchorCheckpoint();
|
|
93
87
|
const finalizedCheckpoint = {...checkpoint};
|
|
94
88
|
const justifiedCheckpoint = {
|
|
95
89
|
...checkpoint,
|
|
@@ -100,19 +94,19 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
100
94
|
epoch: checkpoint.epoch === 0 ? checkpoint.epoch : checkpoint.epoch + 1,
|
|
101
95
|
};
|
|
102
96
|
|
|
103
|
-
const justifiedBalances = getEffectiveBalanceIncrementsZeroInactive(
|
|
97
|
+
const justifiedBalances = state.getEffectiveBalanceIncrementsZeroInactive();
|
|
104
98
|
|
|
105
99
|
// forkchoiceConstructor is only used for some test cases
|
|
106
100
|
// production code use ForkChoice constructor directly
|
|
107
101
|
const forkchoiceConstructor = opts.forkchoiceConstructor ?? ForkChoice;
|
|
108
102
|
|
|
109
|
-
const isForkPostGloas = (state
|
|
103
|
+
const isForkPostGloas = computeEpochAtSlot(state.slot) >= config.GLOAS_FORK_EPOCH;
|
|
110
104
|
|
|
111
105
|
// Determine justified checkpoint payload status
|
|
112
|
-
const justifiedPayloadStatus = getCheckpointPayloadStatus(state, justifiedCheckpoint.epoch);
|
|
106
|
+
const justifiedPayloadStatus = getCheckpointPayloadStatus(config, state, justifiedCheckpoint.epoch);
|
|
113
107
|
|
|
114
108
|
// Determine finalized checkpoint payload status
|
|
115
|
-
const finalizedPayloadStatus = getCheckpointPayloadStatus(state, finalizedCheckpoint.epoch);
|
|
109
|
+
const finalizedPayloadStatus = getCheckpointPayloadStatus(config, state, finalizedCheckpoint.epoch);
|
|
116
110
|
|
|
117
111
|
return new forkchoiceConstructor(
|
|
118
112
|
config,
|
|
@@ -148,25 +142,23 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
148
142
|
unrealizedFinalizedEpoch: finalizedCheckpoint.epoch,
|
|
149
143
|
unrealizedFinalizedRoot: toRootHex(finalizedCheckpoint.root),
|
|
150
144
|
|
|
151
|
-
...(isExecutionStateType
|
|
145
|
+
...(state.isExecutionStateType && state.isMergeTransitionComplete
|
|
152
146
|
? {
|
|
153
|
-
executionPayloadBlockHash: toRootHex(state.
|
|
154
|
-
|
|
147
|
+
executionPayloadBlockHash: toRootHex(state.latestBlockHash),
|
|
148
|
+
// TODO GLOAS: executionPayloadNumber is not tracked in BeaconState post-gloas (EIP-7732 removed
|
|
149
|
+
// latestExecutionPayloadHeader). Using 0 as unavailable fallback until a solution is found.
|
|
150
|
+
executionPayloadNumber: config.getForkSeq(state.slot) >= ForkSeq.gloas ? 0 : state.payloadBlockNumber,
|
|
155
151
|
executionStatus: blockHeader.slot === GENESIS_SLOT ? ExecutionStatus.Valid : ExecutionStatus.Syncing,
|
|
156
152
|
}
|
|
157
153
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
158
154
|
|
|
159
155
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
160
156
|
payloadStatus: isForkPostGloas ? PayloadStatus.PENDING : PayloadStatus.FULL, // TODO GLOAS: Post-gloas how do we know if the checkpoint payload is FULL or EMPTY?
|
|
161
|
-
|
|
162
|
-
blockHashFromBid: isForkPostGloas
|
|
163
|
-
? toRootHex((state as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash)
|
|
164
|
-
: null,
|
|
165
|
-
parentBlockHash: isForkPostGloas ? toRootHex((state as CachedBeaconStateGloas).latestBlockHash) : null,
|
|
157
|
+
parentBlockHash: isForkPostGloas ? toRootHex(state.latestBlockHash) : null,
|
|
166
158
|
},
|
|
167
159
|
currentSlot
|
|
168
160
|
),
|
|
169
|
-
state.
|
|
161
|
+
state.validatorCount,
|
|
170
162
|
metrics,
|
|
171
163
|
opts,
|
|
172
164
|
logger
|
|
@@ -180,15 +172,15 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
180
172
|
config: ChainForkConfig,
|
|
181
173
|
emitter: ChainEventEmitter,
|
|
182
174
|
currentSlot: Slot,
|
|
183
|
-
unfinalizedState:
|
|
175
|
+
unfinalizedState: IBeaconStateView,
|
|
184
176
|
opts: ForkChoiceOpts,
|
|
185
177
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
186
178
|
metrics: Metrics | null,
|
|
187
179
|
logger?: Logger
|
|
188
180
|
): ForkChoice {
|
|
189
|
-
const {blockHeader} = computeAnchorCheckpoint(
|
|
190
|
-
const finalizedCheckpoint = unfinalizedState.finalizedCheckpoint
|
|
191
|
-
const justifiedCheckpoint = unfinalizedState.currentJustifiedCheckpoint
|
|
181
|
+
const {blockHeader} = unfinalizedState.computeAnchorCheckpoint();
|
|
182
|
+
const finalizedCheckpoint = unfinalizedState.finalizedCheckpoint;
|
|
183
|
+
const justifiedCheckpoint = unfinalizedState.currentJustifiedCheckpoint;
|
|
192
184
|
const headRoot = toRootHex(ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader));
|
|
193
185
|
|
|
194
186
|
const logCtx = {
|
|
@@ -204,14 +196,14 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
204
196
|
logger?.warn("Initializing fork choice from unfinalized state", logCtx);
|
|
205
197
|
|
|
206
198
|
// this is not the justified state, but there is no other ways to get justified balances
|
|
207
|
-
const justifiedBalances = getEffectiveBalanceIncrementsZeroInactive(
|
|
199
|
+
const justifiedBalances = unfinalizedState.getEffectiveBalanceIncrementsZeroInactive();
|
|
208
200
|
|
|
209
|
-
const isForkPostGloas = (unfinalizedState
|
|
201
|
+
const isForkPostGloas = computeEpochAtSlot(unfinalizedState.slot) >= config.GLOAS_FORK_EPOCH;
|
|
210
202
|
|
|
211
203
|
// For unfinalized state, use getCheckpointPayloadStatus to determine the correct status.
|
|
212
204
|
// It checks state.execution_payload_availability to determine EMPTY vs FULL.
|
|
213
|
-
const justifiedPayloadStatus = getCheckpointPayloadStatus(unfinalizedState, justifiedCheckpoint.epoch);
|
|
214
|
-
const finalizedPayloadStatus = getCheckpointPayloadStatus(unfinalizedState, finalizedCheckpoint.epoch);
|
|
205
|
+
const justifiedPayloadStatus = getCheckpointPayloadStatus(config, unfinalizedState, justifiedCheckpoint.epoch);
|
|
206
|
+
const finalizedPayloadStatus = getCheckpointPayloadStatus(config, unfinalizedState, finalizedCheckpoint.epoch);
|
|
215
207
|
|
|
216
208
|
const store = new ForkChoiceStore(
|
|
217
209
|
currentSlot,
|
|
@@ -245,23 +237,20 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
245
237
|
unrealizedFinalizedEpoch: finalizedCheckpoint.epoch,
|
|
246
238
|
unrealizedFinalizedRoot: toRootHex(finalizedCheckpoint.root),
|
|
247
239
|
|
|
248
|
-
...(isExecutionStateType
|
|
240
|
+
...(unfinalizedState.isExecutionStateType && unfinalizedState.isMergeTransitionComplete
|
|
249
241
|
? {
|
|
250
|
-
executionPayloadBlockHash: toRootHex(unfinalizedState.
|
|
251
|
-
|
|
242
|
+
executionPayloadBlockHash: toRootHex(unfinalizedState.latestBlockHash),
|
|
243
|
+
// TODO GLOAS: executionPayloadNumber is not tracked in BeaconState post-gloas (EIP-7732 removed
|
|
244
|
+
// latestExecutionPayloadHeader). Using 0 as unavailable fallback until a solution is found.
|
|
245
|
+
executionPayloadNumber:
|
|
246
|
+
config.getForkSeq(unfinalizedState.slot) >= ForkSeq.gloas ? 0 : unfinalizedState.payloadBlockNumber,
|
|
252
247
|
executionStatus: blockHeader.slot === GENESIS_SLOT ? ExecutionStatus.Valid : ExecutionStatus.Syncing,
|
|
253
248
|
}
|
|
254
249
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
255
250
|
|
|
256
251
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
257
252
|
payloadStatus: isForkPostGloas ? PayloadStatus.PENDING : PayloadStatus.FULL, // TODO GLOAS: Post-gloas how do we know if the checkpoint payload is FULL or EMPTY?
|
|
258
|
-
|
|
259
|
-
? (unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex
|
|
260
|
-
: null,
|
|
261
|
-
blockHashFromBid: isForkPostGloas
|
|
262
|
-
? toRootHex((unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash)
|
|
263
|
-
: null,
|
|
264
|
-
parentBlockHash: isForkPostGloas ? toRootHex((unfinalizedState as CachedBeaconStateGloas).latestBlockHash) : null,
|
|
253
|
+
parentBlockHash: isForkPostGloas ? toRootHex(unfinalizedState.latestBlockHash) : null,
|
|
265
254
|
};
|
|
266
255
|
|
|
267
256
|
const parentSlot = blockHeader.slot - 1;
|
|
@@ -275,7 +264,7 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
275
264
|
// dummy data, we're not able to regen state before headBlock
|
|
276
265
|
stateRoot: ZERO_HASH_HEX,
|
|
277
266
|
blockRoot: headBlock.parentRoot,
|
|
278
|
-
targetRoot: toRootHex(getBlockRootAtSlot(
|
|
267
|
+
targetRoot: toRootHex(unfinalizedState.getBlockRootAtSlot(computeStartSlotAtEpoch(parentEpoch))),
|
|
279
268
|
};
|
|
280
269
|
|
|
281
270
|
const justifiedBlock: ProtoBlock = {
|
|
@@ -313,13 +302,5 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
313
302
|
// production code use ForkChoice constructor directly
|
|
314
303
|
const forkchoiceConstructor = opts.forkchoiceConstructor ?? ForkChoice;
|
|
315
304
|
|
|
316
|
-
return new forkchoiceConstructor(
|
|
317
|
-
config,
|
|
318
|
-
store,
|
|
319
|
-
protoArray,
|
|
320
|
-
unfinalizedState.validators.length,
|
|
321
|
-
metrics,
|
|
322
|
-
opts,
|
|
323
|
-
logger
|
|
324
|
-
);
|
|
305
|
+
return new forkchoiceConstructor(config, store, protoArray, unfinalizedState.validatorCount, metrics, opts, logger);
|
|
325
306
|
}
|
package/src/chain/initState.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ZERO_HASH} from "@lodestar/params";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BeaconStateAllForks,
|
|
5
|
+
IBeaconStateView,
|
|
6
|
+
computeEpochAtSlot,
|
|
7
|
+
computeStartSlotAtEpoch,
|
|
8
|
+
} from "@lodestar/state-transition";
|
|
4
9
|
import {SignedBeaconBlock, ssz} from "@lodestar/types";
|
|
5
10
|
import {Logger, byteArrayEquals, toHex, toRootHex} from "@lodestar/utils";
|
|
6
11
|
import {GENESIS_SLOT} from "../constants/index.js";
|
|
@@ -119,7 +124,7 @@ export async function checkAndPersistAnchorState(
|
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
|
|
122
|
-
export function initBeaconMetrics(metrics: Metrics, state:
|
|
127
|
+
export function initBeaconMetrics(metrics: Metrics, state: IBeaconStateView): void {
|
|
123
128
|
metrics.headSlot.set(state.slot);
|
|
124
129
|
metrics.previousJustifiedEpoch.set(state.previousJustifiedCheckpoint.epoch);
|
|
125
130
|
metrics.currentJustifiedEpoch.set(state.currentJustifiedCheckpoint.epoch);
|
package/src/chain/interface.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Type} from "@chainsafe/ssz";
|
|
2
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
3
|
import {CheckpointWithHex, CheckpointWithPayloadStatus, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
4
|
-
import {
|
|
4
|
+
import {EpochShuffling, IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
5
5
|
import {
|
|
6
6
|
BeaconBlock,
|
|
7
7
|
BlindedBeaconBlock,
|
|
@@ -32,7 +32,7 @@ import {IArchiveStore} from "./archiveStore/interface.js";
|
|
|
32
32
|
import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
33
33
|
import {BeaconProposerCache, ProposerPreparationData} from "./beaconProposerCache.js";
|
|
34
34
|
import {IBlockInput} from "./blocks/blockInput/index.js";
|
|
35
|
-
import {ImportBlockOpts} from "./blocks/types.js";
|
|
35
|
+
import {ImportBlockOpts, ImportPayloadOpts} from "./blocks/types.js";
|
|
36
36
|
import {IBlsVerifier} from "./bls/index.js";
|
|
37
37
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
38
38
|
import {ChainEventEmitter} from "./emitter.js";
|
|
@@ -58,7 +58,6 @@ import {
|
|
|
58
58
|
SeenBlockProposers,
|
|
59
59
|
SeenContributionAndProof,
|
|
60
60
|
SeenExecutionPayloadBids,
|
|
61
|
-
SeenExecutionPayloadEnvelopes,
|
|
62
61
|
SeenPayloadAttesters,
|
|
63
62
|
SeenSyncCommitteeMessages,
|
|
64
63
|
} from "./seenCache/index.js";
|
|
@@ -66,6 +65,7 @@ import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
|
66
65
|
import {SeenAttestationDatas} from "./seenCache/seenAttestationData.js";
|
|
67
66
|
import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js";
|
|
68
67
|
import {SeenBlockInput} from "./seenCache/seenGossipBlockInput.js";
|
|
68
|
+
import {PayloadEnvelopeInput, SeenPayloadEnvelopeInput} from "./seenCache/seenPayloadEnvelopeInput.js";
|
|
69
69
|
import {ShufflingCache} from "./shufflingCache.js";
|
|
70
70
|
import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
71
71
|
|
|
@@ -128,13 +128,13 @@ export interface IBeaconChain {
|
|
|
128
128
|
readonly seenAggregators: SeenAggregators;
|
|
129
129
|
readonly seenPayloadAttesters: SeenPayloadAttesters;
|
|
130
130
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
131
|
-
readonly seenExecutionPayloadEnvelopes: SeenExecutionPayloadEnvelopes;
|
|
132
131
|
readonly seenExecutionPayloadBids: SeenExecutionPayloadBids;
|
|
133
132
|
readonly seenBlockProposers: SeenBlockProposers;
|
|
134
133
|
readonly seenSyncCommitteeMessages: SeenSyncCommitteeMessages;
|
|
135
134
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
136
135
|
readonly seenAttestationDatas: SeenAttestationDatas;
|
|
137
136
|
readonly seenBlockInputCache: SeenBlockInput;
|
|
137
|
+
readonly seenPayloadEnvelopeInputCache: SeenPayloadEnvelopeInput;
|
|
138
138
|
// Seen cache for liveness checks
|
|
139
139
|
readonly seenBlockAttesters: SeenBlockAttesters;
|
|
140
140
|
|
|
@@ -166,9 +166,9 @@ export interface IBeaconChain {
|
|
|
166
166
|
|
|
167
167
|
validatorSeenAtEpoch(index: ValidatorIndex, epoch: Epoch): boolean;
|
|
168
168
|
|
|
169
|
-
getHeadState():
|
|
170
|
-
getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<
|
|
171
|
-
getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<
|
|
169
|
+
getHeadState(): IBeaconStateView;
|
|
170
|
+
getHeadStateAtCurrentEpoch(regenCaller: RegenCaller): Promise<IBeaconStateView>;
|
|
171
|
+
getHeadStateAtEpoch(epoch: Epoch, regenCaller: RegenCaller): Promise<IBeaconStateView>;
|
|
172
172
|
|
|
173
173
|
getHistoricalStateBySlot(
|
|
174
174
|
slot: Slot
|
|
@@ -178,22 +178,22 @@ export interface IBeaconChain {
|
|
|
178
178
|
getStateBySlot(
|
|
179
179
|
slot: Slot,
|
|
180
180
|
opts?: StateGetOpts
|
|
181
|
-
): Promise<{state:
|
|
181
|
+
): Promise<{state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
182
182
|
/** Returns a local state by state root */
|
|
183
183
|
getStateByStateRoot(
|
|
184
184
|
stateRoot: RootHex,
|
|
185
185
|
opts?: StateGetOpts
|
|
186
|
-
): Promise<{state:
|
|
186
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
187
187
|
/** Return serialized bytes of a persisted checkpoint state */
|
|
188
188
|
getPersistedCheckpointState(checkpoint?: phase0.Checkpoint): Promise<Uint8Array | null>;
|
|
189
189
|
/** Returns a cached state by checkpoint */
|
|
190
190
|
getStateByCheckpoint(
|
|
191
191
|
checkpoint: CheckpointWithHex
|
|
192
|
-
): {state:
|
|
192
|
+
): {state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean} | null;
|
|
193
193
|
/** Return state bytes by checkpoint */
|
|
194
194
|
getStateOrBytesByCheckpoint(
|
|
195
195
|
checkpoint: CheckpointWithPayloadStatus
|
|
196
|
-
): Promise<{state:
|
|
196
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* Since we can have multiple parallel chains,
|
|
@@ -223,6 +223,7 @@ export interface IBeaconChain {
|
|
|
223
223
|
blockRootHex: string,
|
|
224
224
|
indices: number[]
|
|
225
225
|
): Promise<(Uint8Array | undefined)[]>;
|
|
226
|
+
getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null>;
|
|
226
227
|
|
|
227
228
|
produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody>;
|
|
228
229
|
produceBlock(blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}): Promise<{
|
|
@@ -242,6 +243,9 @@ export interface IBeaconChain {
|
|
|
242
243
|
/** Process a chain of blocks until complete */
|
|
243
244
|
processChainSegment(blocks: IBlockInput[], opts?: ImportBlockOpts): Promise<void>;
|
|
244
245
|
|
|
246
|
+
/** Process execution payload envelope: verify, import to fork choice, and persist to DB */
|
|
247
|
+
processExecutionPayload(payloadInput: PayloadEnvelopeInput, opts?: ImportPayloadOpts): Promise<void>;
|
|
248
|
+
|
|
245
249
|
getStatus(): Status;
|
|
246
250
|
|
|
247
251
|
recomputeForkChoiceHead(caller: ForkchoiceCaller): ProtoBlock;
|
|
@@ -258,14 +262,12 @@ export interface IBeaconChain {
|
|
|
258
262
|
|
|
259
263
|
persistBlock(data: BeaconBlock | BlindedBeaconBlock, suffix?: string): void;
|
|
260
264
|
persistInvalidStateRoot(
|
|
261
|
-
preState:
|
|
262
|
-
postState:
|
|
265
|
+
preState: IBeaconStateView,
|
|
266
|
+
postState: IBeaconStateView,
|
|
263
267
|
block: SignedBeaconBlock
|
|
264
268
|
): Promise<void>;
|
|
265
269
|
persistInvalidSszValue<T>(type: Type<T>, sszObject: T | Uint8Array, suffix?: string): void;
|
|
266
270
|
persistInvalidSszBytes(type: string, sszBytes: Uint8Array, suffix?: string): void;
|
|
267
|
-
/** Persist bad items to persistInvalidSszObjectsDir dir, for example invalid state, attestations etc. */
|
|
268
|
-
persistInvalidSszView(view: TreeView<CompositeTypeAny>, suffix?: string): void;
|
|
269
271
|
regenStateForAttestationVerification(
|
|
270
272
|
attEpoch: Epoch,
|
|
271
273
|
shufflingDependentRoot: RootHex,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BitArray
|
|
1
|
+
import {BitArray} from "@chainsafe/ssz";
|
|
2
2
|
import {routes} from "@lodestar/api";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isForkPostElectra,
|
|
22
22
|
} from "@lodestar/params";
|
|
23
23
|
import {
|
|
24
|
-
|
|
24
|
+
IBeaconStateView,
|
|
25
25
|
computeStartSlotAtEpoch,
|
|
26
26
|
computeSyncPeriodAtEpoch,
|
|
27
27
|
computeSyncPeriodAtSlot,
|
|
@@ -54,13 +54,7 @@ import {Metrics} from "../../metrics/index.js";
|
|
|
54
54
|
import {IClock} from "../../util/clock.js";
|
|
55
55
|
import {ChainEventEmitter} from "../emitter.js";
|
|
56
56
|
import {LightClientServerError, LightClientServerErrorCode} from "../errors/lightClientError.js";
|
|
57
|
-
import {
|
|
58
|
-
getBlockBodyExecutionHeaderProof,
|
|
59
|
-
getCurrentSyncCommitteeBranch,
|
|
60
|
-
getFinalizedRootProof,
|
|
61
|
-
getNextSyncCommitteeBranch,
|
|
62
|
-
getSyncCommitteesWitness,
|
|
63
|
-
} from "./proofs.js";
|
|
57
|
+
import {getBlockBodyExecutionHeaderProof, getCurrentSyncCommitteeBranch, getNextSyncCommitteeBranch} from "./proofs.js";
|
|
64
58
|
|
|
65
59
|
export type LightClientServerOpts = {
|
|
66
60
|
disableLightClientServerOnImportBlockHead?: boolean;
|
|
@@ -266,11 +260,7 @@ export class LightClientServer {
|
|
|
266
260
|
* - Persist state witness
|
|
267
261
|
* - Use block's syncAggregate
|
|
268
262
|
*/
|
|
269
|
-
onImportBlockHead(
|
|
270
|
-
block: BeaconBlock<ForkPostAltair>,
|
|
271
|
-
postState: CachedBeaconStateAltair,
|
|
272
|
-
parentBlockSlot: Slot
|
|
273
|
-
): void {
|
|
263
|
+
onImportBlockHead(block: BeaconBlock<ForkPostAltair>, postState: IBeaconStateView, parentBlockSlot: Slot): void {
|
|
274
264
|
// TEMP: To disable this functionality for fork_choice spec tests.
|
|
275
265
|
// Since the tests have deep-reorgs attested data is not available often printing lots of error logs.
|
|
276
266
|
// While this function is only called for head blocks, best to disable.
|
|
@@ -406,7 +396,7 @@ export class LightClientServer {
|
|
|
406
396
|
|
|
407
397
|
private async persistPostBlockImportData(
|
|
408
398
|
block: BeaconBlock<ForkPostAltair>,
|
|
409
|
-
postState:
|
|
399
|
+
postState: IBeaconStateView,
|
|
410
400
|
parentBlockSlot: Slot
|
|
411
401
|
): Promise<void> {
|
|
412
402
|
const blockSlot = block.slot;
|
|
@@ -416,7 +406,7 @@ export class LightClientServer {
|
|
|
416
406
|
const blockRoot = ssz.phase0.BeaconBlockHeader.hashTreeRoot(header.beacon);
|
|
417
407
|
const blockRootHex = toRootHex(blockRoot);
|
|
418
408
|
|
|
419
|
-
const syncCommitteeWitness = getSyncCommitteesWitness(
|
|
409
|
+
const syncCommitteeWitness = postState.getSyncCommitteesWitness();
|
|
420
410
|
|
|
421
411
|
// Only store current sync committee once per run
|
|
422
412
|
if (!this.storedCurrentSyncCommittee) {
|
|
@@ -466,7 +456,7 @@ export class LightClientServer {
|
|
|
466
456
|
isFinalized: true,
|
|
467
457
|
attestedHeader: header,
|
|
468
458
|
blockRoot,
|
|
469
|
-
finalityBranch: getFinalizedRootProof(
|
|
459
|
+
finalityBranch: postState.getFinalizedRootProof(),
|
|
470
460
|
finalizedCheckpoint,
|
|
471
461
|
}
|
|
472
462
|
: {
|
|
@@ -724,13 +714,10 @@ export class LightClientServer {
|
|
|
724
714
|
);
|
|
725
715
|
}
|
|
726
716
|
|
|
727
|
-
private async storeSyncCommittee(
|
|
728
|
-
syncCommittee: CompositeViewDU<typeof ssz.altair.SyncCommittee>,
|
|
729
|
-
syncCommitteeRoot: Uint8Array
|
|
730
|
-
): Promise<void> {
|
|
717
|
+
private async storeSyncCommittee(syncCommittee: altair.SyncCommittee, syncCommitteeRoot: Uint8Array): Promise<void> {
|
|
731
718
|
const isKnown = await this.db.syncCommittee.has(syncCommitteeRoot);
|
|
732
719
|
if (!isKnown) {
|
|
733
|
-
await this.db.syncCommittee.putBinary(syncCommitteeRoot,
|
|
720
|
+
await this.db.syncCommittee.putBinary(syncCommitteeRoot, ssz.altair.SyncCommittee.serialize(syncCommittee));
|
|
734
721
|
}
|
|
735
722
|
}
|
|
736
723
|
|
|
@@ -19,16 +19,13 @@ import {
|
|
|
19
19
|
isForkPostElectra,
|
|
20
20
|
} from "@lodestar/params";
|
|
21
21
|
import {
|
|
22
|
-
CachedBeaconStateAllForks,
|
|
23
|
-
CachedBeaconStateAltair,
|
|
24
|
-
CachedBeaconStateGloas,
|
|
25
22
|
EffectiveBalanceIncrements,
|
|
23
|
+
IBeaconStateView,
|
|
26
24
|
RootCache,
|
|
27
25
|
computeEpochAtSlot,
|
|
28
26
|
computeSlotsSinceEpochStart,
|
|
29
27
|
computeStartSlotAtEpoch,
|
|
30
28
|
getAttestationParticipationStatus,
|
|
31
|
-
getBlockRootAtSlot,
|
|
32
29
|
} from "@lodestar/state-transition";
|
|
33
30
|
import {Attestation, Epoch, RootHex, Slot, electra, isElectraAttestation, phase0, ssz} from "@lodestar/types";
|
|
34
31
|
import {MapDef, assert, toRootHex} from "@lodestar/utils";
|
|
@@ -212,7 +209,7 @@ export class AggregatedAttestationPool {
|
|
|
212
209
|
fork: ForkName,
|
|
213
210
|
forkChoice: IForkChoice,
|
|
214
211
|
shufflingCache: ShufflingCache,
|
|
215
|
-
state:
|
|
212
|
+
state: IBeaconStateView
|
|
216
213
|
): Attestation[] {
|
|
217
214
|
const forkSeq = ForkSeq[fork];
|
|
218
215
|
if (forkSeq < ForkSeq.electra) {
|
|
@@ -229,10 +226,10 @@ export class AggregatedAttestationPool {
|
|
|
229
226
|
fork: ForkName,
|
|
230
227
|
forkChoice: IForkChoice,
|
|
231
228
|
shufflingCache: ShufflingCache,
|
|
232
|
-
state:
|
|
229
|
+
state: IBeaconStateView
|
|
233
230
|
): electra.Attestation[] {
|
|
234
231
|
const stateSlot = state.slot;
|
|
235
|
-
const stateEpoch = state.
|
|
232
|
+
const stateEpoch = state.epoch;
|
|
236
233
|
const statePrevEpoch = stateEpoch - 1;
|
|
237
234
|
const rootCache = new RootCache(state);
|
|
238
235
|
|
|
@@ -312,7 +309,7 @@ export class AggregatedAttestationPool {
|
|
|
312
309
|
// The committeeCountPerSlot can be precomputed once per slot
|
|
313
310
|
const getAttestationGroupResult = attestationGroup.getAttestationsForBlock(
|
|
314
311
|
fork,
|
|
315
|
-
state.
|
|
312
|
+
state.effectiveBalanceIncrements,
|
|
316
313
|
notSeenCommitteeMembers,
|
|
317
314
|
MAX_ATTESTATIONS_PER_GROUP_ELECTRA
|
|
318
315
|
);
|
|
@@ -362,9 +359,7 @@ export class AggregatedAttestationPool {
|
|
|
362
359
|
inclusionDistance,
|
|
363
360
|
stateEpoch,
|
|
364
361
|
rootCache,
|
|
365
|
-
ForkSeq[fork] >= ForkSeq.gloas
|
|
366
|
-
? (state as CachedBeaconStateGloas).executionPayloadAvailability.toBoolArray()
|
|
367
|
-
: null
|
|
362
|
+
ForkSeq[fork] >= ForkSeq.gloas ? state.executionPayloadAvailability : null
|
|
368
363
|
);
|
|
369
364
|
|
|
370
365
|
const weight =
|
|
@@ -735,13 +730,13 @@ export function aggregateConsolidation({byCommittee, attData}: AttestationsConso
|
|
|
735
730
|
}
|
|
736
731
|
|
|
737
732
|
/**
|
|
738
|
-
* Pre-compute participation from a
|
|
733
|
+
* Pre-compute participation from a IBeaconStateView, for use to check if an attestation's committee
|
|
739
734
|
* has already attested or not.
|
|
740
735
|
*/
|
|
741
736
|
export function getNotSeenValidatorsFn(
|
|
742
737
|
config: BeaconConfig,
|
|
743
738
|
shufflingCache: ShufflingCache,
|
|
744
|
-
state:
|
|
739
|
+
state: IBeaconStateView
|
|
745
740
|
): GetNotSeenValidatorsFn {
|
|
746
741
|
const stateSlot = state.slot;
|
|
747
742
|
if (config.getForkName(stateSlot) === ForkName.phase0) {
|
|
@@ -753,9 +748,8 @@ export function getNotSeenValidatorsFn(
|
|
|
753
748
|
// Attestations are sorted by inclusion distance then number of attesters.
|
|
754
749
|
// Attestations should pass the validation when processing attestations in state-transition.
|
|
755
750
|
// check for altair block already
|
|
756
|
-
const
|
|
757
|
-
const
|
|
758
|
-
const currentParticipation = altairState.currentEpochParticipation.getAll();
|
|
751
|
+
const previousParticipation = state.previousEpochParticipation;
|
|
752
|
+
const currentParticipation = state.currentEpochParticipation;
|
|
759
753
|
const stateEpoch = computeEpochAtSlot(stateSlot);
|
|
760
754
|
// this function could be called multiple times with same slot + committeeIndex
|
|
761
755
|
const cachedNotSeenValidators = new Map<string, Set<number>>();
|
|
@@ -774,7 +768,7 @@ export function getNotSeenValidatorsFn(
|
|
|
774
768
|
return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
|
|
775
769
|
}
|
|
776
770
|
|
|
777
|
-
const decisionRoot = state.
|
|
771
|
+
const decisionRoot = state.getShufflingDecisionRoot(computeEpochAtSlot(slot));
|
|
778
772
|
const committee = shufflingCache.getBeaconCommittee(epoch, decisionRoot, slot, committeeIndex);
|
|
779
773
|
notSeenCommitteeMembers = new Set<number>();
|
|
780
774
|
for (const [i, validatorIndex] of committee.entries()) {
|
|
@@ -804,11 +798,11 @@ export function getNotSeenValidatorsFn(
|
|
|
804
798
|
*/
|
|
805
799
|
export function getValidateAttestationDataFn(
|
|
806
800
|
forkChoice: IForkChoice,
|
|
807
|
-
state:
|
|
801
|
+
state: IBeaconStateView
|
|
808
802
|
): ValidateAttestationDataFn {
|
|
809
803
|
const cachedValidatedAttestationData = new Map<string, InvalidAttestationData | null>();
|
|
810
804
|
const {previousJustifiedCheckpoint, currentJustifiedCheckpoint} = state;
|
|
811
|
-
const stateEpoch = state.
|
|
805
|
+
const stateEpoch = state.epoch;
|
|
812
806
|
return (attData: phase0.AttestationData) => {
|
|
813
807
|
const targetEpoch = attData.target.epoch;
|
|
814
808
|
let justifiedCheckpoint: phase0.Checkpoint;
|
|
@@ -850,14 +844,14 @@ export function getValidateAttestationDataFn(
|
|
|
850
844
|
*/
|
|
851
845
|
function isValidShuffling(
|
|
852
846
|
forkChoice: IForkChoice,
|
|
853
|
-
state:
|
|
847
|
+
state: IBeaconStateView,
|
|
854
848
|
blockRootHex: RootHex,
|
|
855
849
|
targetEpoch: Epoch
|
|
856
850
|
): InvalidAttestationData | null {
|
|
857
851
|
// Otherwise the shuffling is determined by the block at the end of the target epoch
|
|
858
852
|
// minus the shuffling lookahead (usually 2). We call this the "pivot".
|
|
859
853
|
const pivotSlot = computeStartSlotAtEpoch(targetEpoch - 1) - 1;
|
|
860
|
-
const stateDependentRoot = toRootHex(getBlockRootAtSlot(
|
|
854
|
+
const stateDependentRoot = toRootHex(state.getBlockRootAtSlot(pivotSlot));
|
|
861
855
|
|
|
862
856
|
// Use fork choice's view of the block DAG to quickly evaluate whether the attestation's
|
|
863
857
|
// pivot block is the same as the current state's pivot block. If it is, then the
|