@lodestar/beacon-node 1.42.0-dev.7b5ce3932d → 1.42.0-dev.83dedda569
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.js +1 -1
- 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/historicalState/getHistoricalState.d.ts +2 -6
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +3 -23
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -0
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/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 +1 -0
- 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 +9 -9
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +4 -5
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.js +1 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +2 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.d.ts +2 -2
- package/lib/chain/blocks/utils/checkpoint.d.ts.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +2 -2
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +4 -4
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +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/chain.d.ts +12 -12
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +47 -39
- 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/forkChoice/index.d.ts +4 -4
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +27 -23
- 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 +11 -12
- 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 +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +2 -2
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +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 +3 -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 +12 -16
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +13 -13
- package/lib/chain/regen/interface.d.ts.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/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 +2 -3
- package/lib/chain/validation/executionPayloadEnvelope.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 +3 -3
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +9 -7
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +12 -4
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +19 -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/gossip/topic.d.ts +2 -729
- package/lib/network/gossip/topic.d.ts.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 +9 -3
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts +1 -1
- package/lib/network/processor/extractSlotRootFns.js +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +9 -7
- 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.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 +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 +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 +8 -41
- package/lib/sync/unknownBlock.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 +1 -1
- 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/historicalState/getHistoricalState.ts +6 -36
- package/src/chain/archiveStore/historicalState/worker.ts +1 -0
- package/src/chain/balancesCache.ts +5 -11
- package/src/chain/blocks/blockInput/types.ts +1 -0
- package/src/chain/blocks/importBlock.ts +11 -14
- package/src/chain/blocks/importExecutionPayload.ts +6 -11
- package/src/chain/blocks/index.ts +1 -1
- package/src/chain/blocks/types.ts +2 -2
- package/src/chain/blocks/utils/checkpoint.ts +2 -2
- package/src/chain/blocks/verifyBlock.ts +5 -10
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +5 -10
- package/src/chain/blocks/verifyBlocksSignatures.ts +3 -3
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
- package/src/chain/chain.ts +75 -67
- package/src/chain/emitter.ts +2 -2
- package/src/chain/errors/blockError.ts +4 -4
- package/src/chain/forkChoice/index.ts +33 -42
- package/src/chain/initState.ts +7 -2
- package/src/chain/interface.ts +12 -13
- 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 +3 -3
- package/src/chain/prepareNextSlot.ts +6 -8
- package/src/chain/produceBlock/computeNewStateRoot.ts +6 -10
- package/src/chain/produceBlock/produceBlockBody.ts +22 -49
- package/src/chain/regen/interface.ts +13 -17
- package/src/chain/regen/queued.ts +16 -20
- package/src/chain/regen/regen.ts +16 -17
- 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 +2 -8
- 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 +12 -11
- package/src/metrics/metrics/lodestar.ts +23 -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 +32 -4
- package/src/network/processor/extractSlotRootFns.ts +1 -1
- package/src/network/processor/gossipHandlers.ts +9 -8
- package/src/network/processor/index.ts +110 -89
- 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 +13 -0
- package/src/node/nodejs.ts +3 -5
- package/src/node/notifier.ts +4 -10
- package/src/sync/backfill/backfill.ts +3 -3
- package/src/sync/unknownBlock.ts +10 -50
- package/src/util/types.ts +6 -0
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,
|
|
@@ -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<{
|
|
@@ -261,14 +262,12 @@ export interface IBeaconChain {
|
|
|
261
262
|
|
|
262
263
|
persistBlock(data: BeaconBlock | BlindedBeaconBlock, suffix?: string): void;
|
|
263
264
|
persistInvalidStateRoot(
|
|
264
|
-
preState:
|
|
265
|
-
postState:
|
|
265
|
+
preState: IBeaconStateView,
|
|
266
|
+
postState: IBeaconStateView,
|
|
266
267
|
block: SignedBeaconBlock
|
|
267
268
|
): Promise<void>;
|
|
268
269
|
persistInvalidSszValue<T>(type: Type<T>, sszObject: T | Uint8Array, suffix?: string): void;
|
|
269
270
|
persistInvalidSszBytes(type: string, sszBytes: Uint8Array, suffix?: string): void;
|
|
270
|
-
/** Persist bad items to persistInvalidSszObjectsDir dir, for example invalid state, attestations etc. */
|
|
271
|
-
persistInvalidSszView(view: TreeView<CompositeTypeAny>, suffix?: string): void;
|
|
272
271
|
regenStateForAttestationVerification(
|
|
273
272
|
attEpoch: Epoch,
|
|
274
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
|
|
@@ -11,11 +11,10 @@ import {
|
|
|
11
11
|
MAX_VOLUNTARY_EXITS,
|
|
12
12
|
} from "@lodestar/params";
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
IBeaconStateView,
|
|
15
15
|
computeEpochAtSlot,
|
|
16
16
|
computeStartSlotAtEpoch,
|
|
17
17
|
getAttesterSlashableIndices,
|
|
18
|
-
isValidVoluntaryExit,
|
|
19
18
|
} from "@lodestar/state-transition";
|
|
20
19
|
import {
|
|
21
20
|
AttesterSlashing,
|
|
@@ -185,7 +184,7 @@ export class OpPool {
|
|
|
185
184
|
* slashings included earlier in the block.
|
|
186
185
|
*/
|
|
187
186
|
getSlashingsAndExits(
|
|
188
|
-
state:
|
|
187
|
+
state: IBeaconStateView,
|
|
189
188
|
blockType: BlockType,
|
|
190
189
|
metrics: Metrics | null
|
|
191
190
|
): [
|
|
@@ -207,7 +206,7 @@ export class OpPool {
|
|
|
207
206
|
const endProposerSlashing = stepsMetrics?.startTimer();
|
|
208
207
|
for (const proposerSlashing of this.proposerSlashings.values()) {
|
|
209
208
|
const index = proposerSlashing.signedHeader1.message.proposerIndex;
|
|
210
|
-
const validator = state.
|
|
209
|
+
const validator = state.getValidator(index);
|
|
211
210
|
if (!validator.slashed && validator.activationEpoch <= stateEpoch && stateEpoch < validator.withdrawableEpoch) {
|
|
212
211
|
proposerSlashings.push(proposerSlashing);
|
|
213
212
|
// Set of validators to be slashed, so we don't attempt to construct invalid attester slashings.
|
|
@@ -234,7 +233,7 @@ export class OpPool {
|
|
|
234
233
|
continue attesterSlashing;
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
const validator = state.
|
|
236
|
+
const validator = state.getValidator(index);
|
|
238
237
|
if (isSlashableAtEpoch(validator, stateEpoch)) {
|
|
239
238
|
slashableIndices.add(index);
|
|
240
239
|
}
|
|
@@ -261,7 +260,7 @@ export class OpPool {
|
|
|
261
260
|
for (const voluntaryExit of this.voluntaryExits.values()) {
|
|
262
261
|
if (
|
|
263
262
|
!toBeSlashedIndices.has(voluntaryExit.message.validatorIndex) &&
|
|
264
|
-
isValidVoluntaryExit(
|
|
263
|
+
state.isValidVoluntaryExit(voluntaryExit, false) &&
|
|
265
264
|
// Signature validation is skipped in `isValidVoluntaryExit(,,false)` since it was already validated in gossip
|
|
266
265
|
// However we must make sure that the signature fork is the same, or it will become invalid if included through
|
|
267
266
|
// a future fork.
|
|
@@ -320,7 +319,7 @@ export class OpPool {
|
|
|
320
319
|
/**
|
|
321
320
|
* Prune all types of transactions given the latest head state
|
|
322
321
|
*/
|
|
323
|
-
pruneAll(headBlock: SignedBeaconBlock, headState:
|
|
322
|
+
pruneAll(headBlock: SignedBeaconBlock, headState: IBeaconStateView): void {
|
|
324
323
|
this.pruneAttesterSlashings(headState);
|
|
325
324
|
this.pruneProposerSlashings(headState);
|
|
326
325
|
this.pruneVoluntaryExits(headState);
|
|
@@ -330,7 +329,7 @@ export class OpPool {
|
|
|
330
329
|
/**
|
|
331
330
|
* Prune attester slashings for all slashed or withdrawn validators.
|
|
332
331
|
*/
|
|
333
|
-
private pruneAttesterSlashings(headState:
|
|
332
|
+
private pruneAttesterSlashings(headState: IBeaconStateView): void {
|
|
334
333
|
const finalizedEpoch = headState.finalizedCheckpoint.epoch;
|
|
335
334
|
attesterSlashing: for (const [key, attesterSlashing] of this.attesterSlashings.entries()) {
|
|
336
335
|
// Slashings that don't slash any validators can be dropped
|
|
@@ -342,7 +341,7 @@ export class OpPool {
|
|
|
342
341
|
//
|
|
343
342
|
// We cannot check the `slashed` field since the `head` is not finalized and
|
|
344
343
|
// a fork could un-slash someone.
|
|
345
|
-
if (headState.
|
|
344
|
+
if (headState.getValidator(index).exitEpoch > finalizedEpoch) {
|
|
346
345
|
continue attesterSlashing;
|
|
347
346
|
}
|
|
348
347
|
}
|
|
@@ -355,11 +354,11 @@ export class OpPool {
|
|
|
355
354
|
/**
|
|
356
355
|
* Prune proposer slashings for validators which are exited in the finalized epoch.
|
|
357
356
|
*/
|
|
358
|
-
private pruneProposerSlashings(headState:
|
|
357
|
+
private pruneProposerSlashings(headState: IBeaconStateView): void {
|
|
359
358
|
const finalizedEpoch = headState.finalizedCheckpoint.epoch;
|
|
360
359
|
for (const [key, proposerSlashing] of this.proposerSlashings.entries()) {
|
|
361
360
|
const index = proposerSlashing.signedHeader1.message.proposerIndex;
|
|
362
|
-
if (headState.
|
|
361
|
+
if (headState.getValidator(index).exitEpoch <= finalizedEpoch) {
|
|
363
362
|
this.proposerSlashings.delete(key);
|
|
364
363
|
}
|
|
365
364
|
}
|
|
@@ -369,7 +368,7 @@ export class OpPool {
|
|
|
369
368
|
* Call after finalizing
|
|
370
369
|
* Prune if validator has already exited at or before the finalized checkpoint of the head.
|
|
371
370
|
*/
|
|
372
|
-
private pruneVoluntaryExits(headState:
|
|
371
|
+
private pruneVoluntaryExits(headState: IBeaconStateView): void {
|
|
373
372
|
const headStateFork = this.config.getForkSeq(headState.slot);
|
|
374
373
|
const finalizedEpoch = headState.finalizedCheckpoint.epoch;
|
|
375
374
|
|
|
@@ -392,7 +391,7 @@ export class OpPool {
|
|
|
392
391
|
* In the worse case where head block is reorged, the same BlsToExecutionChange message can be re-added
|
|
393
392
|
* to opPool once gossipsub seen cache TTL passes.
|
|
394
393
|
*/
|
|
395
|
-
private pruneBlsToExecutionChanges(headBlock: SignedBeaconBlock, headState:
|
|
394
|
+
private pruneBlsToExecutionChanges(headBlock: SignedBeaconBlock, headState: IBeaconStateView): void {
|
|
396
395
|
const recentBlsToExecutionChanges =
|
|
397
396
|
this.config.getForkSeq(headBlock.message.slot) >= ForkSeq.capella
|
|
398
397
|
? (headBlock as capella.SignedBeaconBlock).message.body.blsToExecutionChanges
|
|
@@ -405,7 +404,7 @@ export class OpPool {
|
|
|
405
404
|
for (const [key, blsToExecutionChange] of this.blsToExecutionChanges.entries()) {
|
|
406
405
|
const {validatorIndex} = blsToExecutionChange.data.message;
|
|
407
406
|
if (!recentBlsToExecutionChangeIndexes.has(validatorIndex)) {
|
|
408
|
-
const validator = headState.
|
|
407
|
+
const validator = headState.getValidator(validatorIndex);
|
|
409
408
|
if (validator.withdrawalCredentials[0] !== BLS_WITHDRAWAL_PREFIX) {
|
|
410
409
|
this.blsToExecutionChanges.delete(key);
|
|
411
410
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Signature} from "@chainsafe/blst";
|
|
2
2
|
import {BLS_WITHDRAWAL_PREFIX} from "@lodestar/params";
|
|
3
|
-
import {
|
|
3
|
+
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
4
4
|
import {Slot, capella} from "@lodestar/types";
|
|
5
5
|
import {AggregateFast, AggregateFastElectra} from "./attestationPool.js";
|
|
6
6
|
|
|
@@ -38,7 +38,7 @@ export function signatureFromBytesNoCheck(signature: Uint8Array): Signature {
|
|
|
38
38
|
* can become invalid for certain forks.
|
|
39
39
|
*/
|
|
40
40
|
export function isValidBlsToExecutionChangeForBlockInclusion(
|
|
41
|
-
state:
|
|
41
|
+
state: IBeaconStateView,
|
|
42
42
|
signedBLSToExecutionChange: capella.SignedBLSToExecutionChange
|
|
43
43
|
): boolean {
|
|
44
44
|
// For each condition from https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/capella/beacon-chain.md#new-process_bls_to_execution_change
|
|
@@ -48,7 +48,7 @@ export function isValidBlsToExecutionChangeForBlockInclusion(
|
|
|
48
48
|
//
|
|
49
49
|
// 2. assert validator.withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX:
|
|
50
50
|
// Must be checked again, since it can already be changed by now.
|
|
51
|
-
const validator = state.
|
|
51
|
+
const validator = state.getValidator(signedBLSToExecutionChange.message.validatorIndex);
|
|
52
52
|
const {withdrawalCredentials} = validator;
|
|
53
53
|
if (withdrawalCredentials[0] !== BLS_WITHDRAWAL_PREFIX) {
|
|
54
54
|
return false;
|
|
@@ -3,9 +3,7 @@ import {ChainForkConfig} from "@lodestar/config";
|
|
|
3
3
|
import {PayloadStatus, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
4
4
|
import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix} from "@lodestar/params";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
CachedBeaconStateExecutions,
|
|
8
|
-
CachedBeaconStateGloas,
|
|
6
|
+
IBeaconStateView,
|
|
9
7
|
StateHashTreeRootSource,
|
|
10
8
|
computeEpochAtSlot,
|
|
11
9
|
computeTimeAtSlot,
|
|
@@ -121,9 +119,9 @@ export class PrepareNextSlotScheduler {
|
|
|
121
119
|
);
|
|
122
120
|
|
|
123
121
|
if (isForkPostBellatrix(fork)) {
|
|
124
|
-
const proposerIndex = prepareState.
|
|
122
|
+
const proposerIndex = prepareState.getBeaconProposer(prepareSlot);
|
|
125
123
|
const feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
|
|
126
|
-
let updatedPrepareState = prepareState
|
|
124
|
+
let updatedPrepareState = prepareState;
|
|
127
125
|
let updatedHeadRoot = headRoot;
|
|
128
126
|
|
|
129
127
|
if (feeRecipient) {
|
|
@@ -140,13 +138,13 @@ export class PrepareNextSlotScheduler {
|
|
|
140
138
|
headRoot,
|
|
141
139
|
});
|
|
142
140
|
this.metrics?.weakHeadDetected.inc();
|
|
143
|
-
updatedPrepareState =
|
|
141
|
+
updatedPrepareState = await this.chain.regen.getBlockSlotState(
|
|
144
142
|
proposerHead,
|
|
145
143
|
prepareSlot,
|
|
146
144
|
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
147
145
|
{dontTransferCache: !isEpochTransition},
|
|
148
146
|
RegenCaller.predictProposerHead
|
|
149
|
-
)
|
|
147
|
+
);
|
|
150
148
|
updatedHeadRoot = proposerHeadRoot;
|
|
151
149
|
}
|
|
152
150
|
|
|
@@ -239,7 +237,7 @@ export class PrepareNextSlotScheduler {
|
|
|
239
237
|
}
|
|
240
238
|
};
|
|
241
239
|
|
|
242
|
-
computeStateHashTreeRoot(state:
|
|
240
|
+
computeStateHashTreeRoot(state: IBeaconStateView, isEpochTransition: boolean): void {
|
|
243
241
|
// cache HashObjects for faster hashTreeRoot() later, especially for computeNewStateRoot() if we need to produce a block at slot 0 of epoch
|
|
244
242
|
// see https://github.com/ChainSafe/lodestar/issues/6194
|
|
245
243
|
const hashTreeRootTimer = this.metrics?.stateHashTreeRootTime.startTimer({
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CachedBeaconStateAllForks,
|
|
3
|
-
CachedBeaconStateGloas,
|
|
4
2
|
DataAvailabilityStatus,
|
|
5
3
|
ExecutionPayloadStatus,
|
|
6
4
|
G2_POINT_AT_INFINITY,
|
|
5
|
+
IBeaconStateView,
|
|
7
6
|
StateHashTreeRootSource,
|
|
8
|
-
stateTransition,
|
|
9
7
|
} from "@lodestar/state-transition";
|
|
10
|
-
import {processExecutionPayloadEnvelope} from "@lodestar/state-transition/block";
|
|
11
8
|
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root, gloas} from "@lodestar/types";
|
|
12
9
|
import {ZERO_HASH} from "../../constants/index.js";
|
|
13
10
|
import {Metrics} from "../../metrics/index.js";
|
|
@@ -19,14 +16,13 @@ import {Metrics} from "../../metrics/index.js";
|
|
|
19
16
|
*/
|
|
20
17
|
export function computeNewStateRoot(
|
|
21
18
|
metrics: Metrics | null,
|
|
22
|
-
state:
|
|
19
|
+
state: IBeaconStateView,
|
|
23
20
|
block: BeaconBlock | BlindedBeaconBlock
|
|
24
|
-
): {newStateRoot: Root; proposerReward: Gwei; postState:
|
|
21
|
+
): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
|
|
25
22
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
26
23
|
const blockEmptySig = {message: block, signature: ZERO_HASH};
|
|
27
24
|
|
|
28
|
-
const postState = stateTransition(
|
|
29
|
-
state,
|
|
25
|
+
const postState = state.stateTransition(
|
|
30
26
|
blockEmptySig,
|
|
31
27
|
{
|
|
32
28
|
// ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL
|
|
@@ -64,7 +60,7 @@ export function computeNewStateRoot(
|
|
|
64
60
|
*/
|
|
65
61
|
export function computeEnvelopeStateRoot(
|
|
66
62
|
metrics: Metrics | null,
|
|
67
|
-
postBlockState:
|
|
63
|
+
postBlockState: IBeaconStateView,
|
|
68
64
|
envelope: gloas.ExecutionPayloadEnvelope
|
|
69
65
|
): Root {
|
|
70
66
|
const signedEnvelope: gloas.SignedExecutionPayloadEnvelope = {
|
|
@@ -73,7 +69,7 @@ export function computeEnvelopeStateRoot(
|
|
|
73
69
|
};
|
|
74
70
|
|
|
75
71
|
const processEnvelopeTimer = metrics?.blockPayload.executionPayloadEnvelopeProcessingTime.startTimer();
|
|
76
|
-
const postEnvelopeState = processExecutionPayloadEnvelope(
|
|
72
|
+
const postEnvelopeState = postBlockState.processExecutionPayloadEnvelope(signedEnvelope, {
|
|
77
73
|
// Signature is zero-ed (G2_POINT_AT_INFINITY), skip verification
|
|
78
74
|
verifySignature: false,
|
|
79
75
|
// State root is being computed here, the envelope doesn't have it yet
|