@lodestar/beacon-node 1.42.0-dev.4118b5b440 → 1.42.0-dev.4e640bd2f7
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 +14 -2
- 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 +26 -26
- 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/importBlock.d.ts +3 -3
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +21 -21
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +10 -8
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +78 -51
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- 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/types.d.ts +21 -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/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/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 +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 +3 -3
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +1 -1
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +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/network/interface.d.ts +3 -1
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +22 -11
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +3 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +7 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +7 -2
- package/lib/network/options.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +15 -8
- package/lib/network/processor/gossipHandlers.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/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 +16 -2
- 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 +28 -40
- 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/importBlock.ts +23 -25
- package/src/chain/blocks/importExecutionPayload.ts +89 -63
- package/src/chain/blocks/index.ts +3 -2
- package/src/chain/blocks/types.ts +26 -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/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/options.ts +2 -0
- 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 +6 -6
- 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/network/interface.ts +14 -1
- package/src/network/libp2p/index.ts +24 -13
- package/src/network/network.ts +30 -2
- package/src/network/options.ts +7 -2
- package/src/network/processor/gossipHandlers.ts +16 -8
- 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/util/types.ts +6 -0
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BeaconStateView,
|
|
3
|
-
VoluntaryExitValidity,
|
|
4
|
-
getVoluntaryExitSignatureSet,
|
|
5
|
-
getVoluntaryExitValidity,
|
|
6
|
-
} from "@lodestar/state-transition";
|
|
1
|
+
import {VoluntaryExitValidity, getVoluntaryExitSignatureSet} from "@lodestar/state-transition";
|
|
7
2
|
import {phase0} from "@lodestar/types";
|
|
8
3
|
import {
|
|
9
4
|
GossipAction,
|
|
@@ -53,14 +48,14 @@ async function validateVoluntaryExit(
|
|
|
53
48
|
|
|
54
49
|
// [REJECT] All of the conditions within process_voluntary_exit pass validation.
|
|
55
50
|
// verifySignature = false, verified in batch below
|
|
56
|
-
const validity = getVoluntaryExitValidity(
|
|
51
|
+
const validity = state.getVoluntaryExitValidity(voluntaryExit, false);
|
|
57
52
|
if (validity !== VoluntaryExitValidity.valid) {
|
|
58
53
|
throw new VoluntaryExitError(GossipAction.REJECT, {
|
|
59
54
|
code: voluntaryExitValidityToErrorCode(validity),
|
|
60
55
|
});
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
const signatureSet = getVoluntaryExitSignatureSet(chain.config,
|
|
58
|
+
const signatureSet = getVoluntaryExitSignatureSet(chain.config, state, voluntaryExit);
|
|
64
59
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
|
|
65
60
|
throw new VoluntaryExitError(GossipAction.REJECT, {
|
|
66
61
|
code: VoluntaryExitErrorCode.INVALID_SIGNATURE,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ForkSeq, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
CachedBeaconStateAltair,
|
|
4
|
+
IBeaconStateView,
|
|
6
5
|
ParticipationFlags,
|
|
7
6
|
computeEpochAtSlot,
|
|
8
7
|
computeStartSlotAtEpoch,
|
|
9
8
|
computeTimeAtSlot,
|
|
10
|
-
getBlockRootAtSlot,
|
|
11
9
|
getCurrentSlot,
|
|
12
10
|
parseAttesterFlags,
|
|
13
11
|
parseParticipationFlags,
|
|
@@ -102,7 +100,7 @@ export type ValidatorMonitor = {
|
|
|
102
100
|
syncAggregate: altair.SyncAggregate,
|
|
103
101
|
syncCommitteeIndices: Uint32Array
|
|
104
102
|
): void;
|
|
105
|
-
onceEveryEndOfEpoch(state:
|
|
103
|
+
onceEveryEndOfEpoch(state: IBeaconStateView): void;
|
|
106
104
|
scrapeMetrics(slotClock: Slot): void;
|
|
107
105
|
/** Returns the list of validator indices currently being monitored */
|
|
108
106
|
getMonitoredValidatorIndices(): ValidatorIndex[];
|
|
@@ -736,16 +734,19 @@ export function createValidatorMonitor(
|
|
|
736
734
|
return;
|
|
737
735
|
}
|
|
738
736
|
|
|
737
|
+
if (validators.size === 0) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
|
|
739
741
|
const rootCache = new RootHexCache(headState);
|
|
740
742
|
|
|
741
743
|
if (config.getForkSeq(headState.slot) >= ForkSeq.altair) {
|
|
742
|
-
const {previousEpochParticipation} = headState as CachedBeaconStateAltair;
|
|
743
744
|
const prevEpochStartSlot = computeStartSlotAtEpoch(prevEpoch);
|
|
744
|
-
const prevEpochTargetRoot = toRootHex(getBlockRootAtSlot(
|
|
745
|
+
const prevEpochTargetRoot = toRootHex(headState.getBlockRootAtSlot(prevEpochStartSlot));
|
|
745
746
|
|
|
746
747
|
// Check attestation performance
|
|
747
748
|
for (const [index, validator] of validators.entries()) {
|
|
748
|
-
const flags = parseParticipationFlags(
|
|
749
|
+
const flags = parseParticipationFlags(headState.getPreviousEpochParticipation(index));
|
|
749
750
|
const attestationSummary = validator.attestations.get(prevEpoch)?.get(prevEpochTargetRoot);
|
|
750
751
|
const summary = renderAttestationSummary(config, rootCache, attestationSummary, flags);
|
|
751
752
|
validatorMonitorMetrics?.prevEpochAttestationSummary.inc({summary});
|
|
@@ -757,9 +758,9 @@ export function createValidatorMonitor(
|
|
|
757
758
|
}
|
|
758
759
|
}
|
|
759
760
|
|
|
760
|
-
if (headState.
|
|
761
|
+
if (headState.previousProposers !== null) {
|
|
761
762
|
// proposersPrevEpoch is null on the first epoch of `headState` being generated
|
|
762
|
-
for (const [slotIndex, validatorIndex] of headState.
|
|
763
|
+
for (const [slotIndex, validatorIndex] of headState.previousProposers.entries()) {
|
|
763
764
|
const validator = validators.get(validatorIndex);
|
|
764
765
|
if (validator) {
|
|
765
766
|
// If expected proposer is a tracked validator
|
|
@@ -1139,12 +1140,12 @@ function renderBlockProposalSummary(
|
|
|
1139
1140
|
export class RootHexCache {
|
|
1140
1141
|
private readonly blockRootSlotCache = new Map<Slot, RootHex>();
|
|
1141
1142
|
|
|
1142
|
-
constructor(private readonly state:
|
|
1143
|
+
constructor(private readonly state: IBeaconStateView) {}
|
|
1143
1144
|
|
|
1144
1145
|
getBlockRootAtSlot(slot: Slot): RootHex {
|
|
1145
1146
|
let root = this.blockRootSlotCache.get(slot);
|
|
1146
1147
|
if (!root) {
|
|
1147
|
-
root = toRootHex(
|
|
1148
|
+
root = toRootHex(this.state.getBlockRootAtSlot(slot));
|
|
1148
1149
|
this.blockRootSlotCache.set(slot, root);
|
|
1149
1150
|
}
|
|
1150
1151
|
return root;
|
package/src/network/interface.ts
CHANGED
|
@@ -38,7 +38,12 @@ import {
|
|
|
38
38
|
import {BlockInputSource} from "../chain/blocks/blockInput/types.js";
|
|
39
39
|
import {CustodyConfig} from "../util/dataColumns.js";
|
|
40
40
|
import {PeerIdStr} from "../util/peerId.js";
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
BeaconBlocksByRootRequest,
|
|
43
|
+
BlobSidecarsByRootRequest,
|
|
44
|
+
DataColumnSidecarsByRootRequest,
|
|
45
|
+
ExecutionPayloadEnvelopesByRootRequest,
|
|
46
|
+
} from "../util/types.js";
|
|
42
47
|
import {INetworkCorePublic} from "./core/types.js";
|
|
43
48
|
import {INetworkEventBus} from "./events.js";
|
|
44
49
|
import {GossipType} from "./gossip/interface.js";
|
|
@@ -82,6 +87,14 @@ export interface INetwork extends INetworkCorePublic {
|
|
|
82
87
|
peerId: PeerIdStr,
|
|
83
88
|
request: DataColumnSidecarsByRootRequest
|
|
84
89
|
): Promise<fulu.DataColumnSidecar[]>;
|
|
90
|
+
sendExecutionPayloadEnvelopesByRange(
|
|
91
|
+
peerId: PeerIdStr,
|
|
92
|
+
request: gloas.ExecutionPayloadEnvelopesByRangeRequest
|
|
93
|
+
): Promise<gloas.SignedExecutionPayloadEnvelope[]>;
|
|
94
|
+
sendExecutionPayloadEnvelopesByRoot(
|
|
95
|
+
peerId: PeerIdStr,
|
|
96
|
+
request: ExecutionPayloadEnvelopesByRootRequest
|
|
97
|
+
): Promise<gloas.SignedExecutionPayloadEnvelope[]>;
|
|
85
98
|
|
|
86
99
|
// Gossip
|
|
87
100
|
publishBeaconBlock(signedBlock: SignedBeaconBlock): Promise<number>;
|
|
@@ -44,6 +44,8 @@ export async function createNodeJsLibp2p(
|
|
|
44
44
|
): Promise<Libp2p> {
|
|
45
45
|
const localMultiaddrs = networkOpts.localMultiaddrs || defaultNetworkOptions.localMultiaddrs;
|
|
46
46
|
const disconnectThreshold = networkOpts.disconnectThreshold ?? defaultNetworkOptions.disconnectThreshold;
|
|
47
|
+
const tcpEnabled = networkOpts.tcp ?? defaultNetworkOptions.tcp;
|
|
48
|
+
const quicEnabled = networkOpts.quic ?? defaultNetworkOptions.quic;
|
|
47
49
|
const {peerStoreDir, disablePeerDiscovery} = nodeJsLibp2pOpts;
|
|
48
50
|
|
|
49
51
|
let datastore: undefined | Eth2PeerDataStore = undefined;
|
|
@@ -58,7 +60,7 @@ export async function createNodeJsLibp2p(
|
|
|
58
60
|
...(networkOpts.bootMultiaddrs ?? defaultNetworkOptions.bootMultiaddrs ?? []),
|
|
59
61
|
// Append discv5.bootEnrs to bootMultiaddrs if requested
|
|
60
62
|
...(networkOpts.connectToDiscv5Bootnodes
|
|
61
|
-
? await getDiscv5Multiaddrs(networkOpts.discv5?.bootEnrs ?? [],
|
|
63
|
+
? await getDiscv5Multiaddrs(networkOpts.discv5?.bootEnrs ?? [], quicEnabled)
|
|
62
64
|
: []),
|
|
63
65
|
];
|
|
64
66
|
|
|
@@ -71,7 +73,7 @@ export async function createNodeJsLibp2p(
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
const transports: Libp2pInit["transports"] = [];
|
|
74
|
-
if (
|
|
76
|
+
if (tcpEnabled) {
|
|
75
77
|
transports.unshift(
|
|
76
78
|
tcp({
|
|
77
79
|
// Reject connections when the server's connection count gets high
|
|
@@ -87,17 +89,26 @@ export async function createNodeJsLibp2p(
|
|
|
87
89
|
})
|
|
88
90
|
);
|
|
89
91
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
if (quicEnabled) {
|
|
93
|
+
const quicMultiaddrs = localMultiaddrs.filter((ma) => ma.includes("/quic-v1"));
|
|
94
|
+
const hasIpv4Quic = quicMultiaddrs.some((ma) => ma.includes("/ip4/"));
|
|
95
|
+
const hasIpv6Quic = quicMultiaddrs.some((ma) => ma.includes("/ip6/"));
|
|
96
|
+
// Only add QUIC transport if at least one QUIC listen address is configured,
|
|
97
|
+
// otherwise the transport constructor will throw
|
|
98
|
+
if (hasIpv4Quic || hasIpv6Quic) {
|
|
99
|
+
transports.unshift(
|
|
100
|
+
quic({
|
|
101
|
+
handshakeTimeout: 5_000,
|
|
102
|
+
maxIdleTimeout: 10_000,
|
|
103
|
+
keepAliveInterval: 5_000,
|
|
104
|
+
maxConcurrentStreamLimit: 256,
|
|
105
|
+
maxStreamData: 10_000_000,
|
|
106
|
+
maxConnectionData: 15_000_000,
|
|
107
|
+
ipv4: hasIpv4Quic,
|
|
108
|
+
ipv6: hasIpv6Quic,
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
}
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
const noiseCrypto = {
|
package/src/network/network.ts
CHANGED
|
@@ -40,7 +40,12 @@ import {IClock} from "../util/clock.js";
|
|
|
40
40
|
import {CustodyConfig} from "../util/dataColumns.js";
|
|
41
41
|
import {PeerIdStr, peerIdToString} from "../util/peerId.js";
|
|
42
42
|
import {promiseAllMaybeAsync} from "../util/promises.js";
|
|
43
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
BeaconBlocksByRootRequest,
|
|
45
|
+
BlobSidecarsByRootRequest,
|
|
46
|
+
DataColumnSidecarsByRootRequest,
|
|
47
|
+
ExecutionPayloadEnvelopesByRootRequest,
|
|
48
|
+
} from "../util/types.js";
|
|
44
49
|
import {INetworkCore, NetworkCore, WorkerNetworkCore} from "./core/index.js";
|
|
45
50
|
import {INetworkEventBus, NetworkEvent, NetworkEventBus, NetworkEventData} from "./events.js";
|
|
46
51
|
import {getActiveForkBoundaries} from "./forks.js";
|
|
@@ -161,7 +166,7 @@ export class Network implements INetwork {
|
|
|
161
166
|
const events = new NetworkEventBus();
|
|
162
167
|
const aggregatorTracker = new AggregatorTracker();
|
|
163
168
|
|
|
164
|
-
const activeValidatorCount = chain.getHeadState().
|
|
169
|
+
const activeValidatorCount = chain.getHeadState().activeValidatorCount;
|
|
165
170
|
const initialStatus = chain.getStatus();
|
|
166
171
|
const initialCustodyGroupCount = chain.custodyConfig.targetCustodyGroupCount;
|
|
167
172
|
|
|
@@ -636,6 +641,29 @@ export class Network implements INetwork {
|
|
|
636
641
|
);
|
|
637
642
|
}
|
|
638
643
|
|
|
644
|
+
async sendExecutionPayloadEnvelopesByRange(
|
|
645
|
+
peerId: PeerIdStr,
|
|
646
|
+
request: gloas.ExecutionPayloadEnvelopesByRangeRequest
|
|
647
|
+
): Promise<gloas.SignedExecutionPayloadEnvelope[]> {
|
|
648
|
+
return collectMaxResponseTyped(
|
|
649
|
+
this.sendReqRespRequest(peerId, ReqRespMethod.ExecutionPayloadEnvelopesByRange, [Version.V1], request),
|
|
650
|
+
request.count,
|
|
651
|
+
responseSszTypeByMethod[ReqRespMethod.ExecutionPayloadEnvelopesByRange]
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
async sendExecutionPayloadEnvelopesByRoot(
|
|
656
|
+
peerId: PeerIdStr,
|
|
657
|
+
request: ExecutionPayloadEnvelopesByRootRequest
|
|
658
|
+
): Promise<gloas.SignedExecutionPayloadEnvelope[]> {
|
|
659
|
+
return collectMaxResponseTyped(
|
|
660
|
+
this.sendReqRespRequest(peerId, ReqRespMethod.ExecutionPayloadEnvelopesByRoot, [Version.V1], request),
|
|
661
|
+
request.length,
|
|
662
|
+
responseSszTypeByMethod[ReqRespMethod.ExecutionPayloadEnvelopesByRoot],
|
|
663
|
+
this.chain.serializedCache
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
|
|
639
667
|
private sendReqRespRequest<Req>(
|
|
640
668
|
peerId: PeerIdStr,
|
|
641
669
|
method: ReqRespMethod,
|
package/src/network/options.ts
CHANGED
|
@@ -55,7 +55,12 @@ export const defaultNetworkOptions: NetworkOptions = {
|
|
|
55
55
|
maxPeers: 210, // Allow some room above targetPeers for new inbound peers
|
|
56
56
|
targetPeers: 200,
|
|
57
57
|
// In CLI usage this is typically overridden; when unset it serves as a fallback default (e.g. programmatic usage/tests)
|
|
58
|
-
localMultiaddrs: [
|
|
58
|
+
localMultiaddrs: [
|
|
59
|
+
"/ip4/0.0.0.0/udp/9001/quic-v1",
|
|
60
|
+
"/ip6/::/udp/9001/quic-v1",
|
|
61
|
+
"/ip4/0.0.0.0/tcp/9000",
|
|
62
|
+
"/ip6/::/tcp/9000",
|
|
63
|
+
],
|
|
59
64
|
bootMultiaddrs: [],
|
|
60
65
|
/** disabled by default */
|
|
61
66
|
discv5: null,
|
|
@@ -69,7 +74,7 @@ export const defaultNetworkOptions: NetworkOptions = {
|
|
|
69
74
|
slotsToSubscribeBeforeAggregatorDuty: 2,
|
|
70
75
|
// This will enable the light client server by default
|
|
71
76
|
disableLightClientServer: false,
|
|
72
|
-
quic:
|
|
77
|
+
quic: true,
|
|
73
78
|
tcp: true,
|
|
74
79
|
// specific option for fulu
|
|
75
80
|
// - this is the same to TARGET_SUBNET_PEERS
|
|
@@ -841,16 +841,17 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
841
841
|
seenTimestampSec,
|
|
842
842
|
}: GossipHandlerParamGeneric<GossipType.execution_payload>) => {
|
|
843
843
|
const {serializedData} = gossipData;
|
|
844
|
-
const
|
|
844
|
+
const signedEnvelope = sszDeserialize(topic, serializedData);
|
|
845
|
+
const envelope = signedEnvelope.message;
|
|
845
846
|
// TODO GLOAS: handle BLOCK_ROOT_UNKNOWN error to trigger sync
|
|
846
|
-
await validateGossipExecutionPayloadEnvelope(chain,
|
|
847
|
+
await validateGossipExecutionPayloadEnvelope(chain, signedEnvelope);
|
|
847
848
|
|
|
848
|
-
const slot =
|
|
849
|
+
const slot = envelope.slot;
|
|
849
850
|
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
850
851
|
metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
|
|
851
|
-
chain.validatorMonitor?.registerExecutionPayloadEnvelope(OpSource.gossip, delaySec,
|
|
852
|
+
chain.validatorMonitor?.registerExecutionPayloadEnvelope(OpSource.gossip, delaySec, signedEnvelope);
|
|
852
853
|
|
|
853
|
-
const blockRootHex = toRootHex(
|
|
854
|
+
const blockRootHex = toRootHex(envelope.beaconBlockRoot);
|
|
854
855
|
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
855
856
|
|
|
856
857
|
if (!payloadInput) {
|
|
@@ -861,16 +862,23 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
861
862
|
});
|
|
862
863
|
}
|
|
863
864
|
|
|
864
|
-
chain.serializedCache.set(
|
|
865
|
+
chain.serializedCache.set(signedEnvelope, serializedData);
|
|
865
866
|
|
|
866
867
|
payloadInput.addPayloadEnvelope({
|
|
867
|
-
envelope:
|
|
868
|
+
envelope: signedEnvelope,
|
|
868
869
|
source: PayloadEnvelopeInputSource.gossip,
|
|
869
870
|
seenTimestampSec,
|
|
870
871
|
peerIdStr,
|
|
871
872
|
});
|
|
872
873
|
|
|
873
|
-
|
|
874
|
+
chain.emitter.emit(routes.events.EventType.executionPayloadGossip, {
|
|
875
|
+
slot,
|
|
876
|
+
builderIndex: envelope.builderIndex,
|
|
877
|
+
blockHash: toRootHex(envelope.payload.blockHash),
|
|
878
|
+
blockRoot: blockRootHex,
|
|
879
|
+
stateRoot: toRootHex(envelope.stateRoot),
|
|
880
|
+
});
|
|
881
|
+
|
|
874
882
|
chain.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
|
|
875
883
|
chain.logger.debug("Error processing execution payload from gossip", {slot, root: blockRootHex}, e as Error);
|
|
876
884
|
});
|
|
@@ -297,6 +297,19 @@ export class ReqRespBeaconNode extends ReqResp {
|
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
301
|
+
protocolsAtFork.push(
|
|
302
|
+
[
|
|
303
|
+
protocols.ExecutionPayloadEnvelopesByRoot(fork, this.config),
|
|
304
|
+
this.getHandler(ReqRespMethod.ExecutionPayloadEnvelopesByRoot),
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
protocols.ExecutionPayloadEnvelopesByRange(fork, this.config),
|
|
308
|
+
this.getHandler(ReqRespMethod.ExecutionPayloadEnvelopesByRange),
|
|
309
|
+
]
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
300
313
|
return protocolsAtFork;
|
|
301
314
|
}
|
|
302
315
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {ChainConfig} from "@lodestar/config";
|
|
2
|
+
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
3
|
+
import {GENESIS_SLOT} from "@lodestar/params";
|
|
4
|
+
import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
|
|
5
|
+
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
6
|
+
import {gloas} from "@lodestar/types";
|
|
7
|
+
import {IBeaconChain} from "../../../chain/index.js";
|
|
8
|
+
import {IBeaconDb} from "../../../db/index.js";
|
|
9
|
+
|
|
10
|
+
export async function* onExecutionPayloadEnvelopesByRange(
|
|
11
|
+
request: gloas.ExecutionPayloadEnvelopesByRangeRequest,
|
|
12
|
+
chain: IBeaconChain,
|
|
13
|
+
db: IBeaconDb
|
|
14
|
+
): AsyncIterable<ResponseOutgoing> {
|
|
15
|
+
const {startSlot, count} = validateExecutionPayloadEnvelopesByRangeRequest(chain.config, request);
|
|
16
|
+
const endSlot = startSlot + count;
|
|
17
|
+
|
|
18
|
+
if (startSlot < chain.earliestAvailableSlot) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const finalized = db.executionPayloadEnvelopeArchive;
|
|
23
|
+
const finalizedSlot = chain.forkChoice.getFinalizedCheckpointSlot();
|
|
24
|
+
|
|
25
|
+
// Finalized range of envelopes
|
|
26
|
+
if (startSlot <= finalizedSlot) {
|
|
27
|
+
for await (const {key, value: envelopeBytes} of finalized.binaryEntriesStream({
|
|
28
|
+
gte: startSlot,
|
|
29
|
+
lt: endSlot,
|
|
30
|
+
})) {
|
|
31
|
+
const slot = finalized.decodeKey(key);
|
|
32
|
+
yield {
|
|
33
|
+
data: envelopeBytes,
|
|
34
|
+
boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(slot)),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Non-finalized range of envelopes
|
|
40
|
+
if (endSlot > finalizedSlot) {
|
|
41
|
+
const headBlock = chain.forkChoice.getHead();
|
|
42
|
+
const headRoot = headBlock.blockRoot;
|
|
43
|
+
const headChain = chain.forkChoice.getAllAncestorBlocks(headRoot, headBlock.payloadStatus);
|
|
44
|
+
|
|
45
|
+
// Iterate head chain with ascending block numbers
|
|
46
|
+
for (let i = headChain.length - 1; i >= 0; i--) {
|
|
47
|
+
const block = headChain[i];
|
|
48
|
+
|
|
49
|
+
if (block.slot >= startSlot && block.slot < endSlot) {
|
|
50
|
+
// Skip EMPTY blocks
|
|
51
|
+
if (block.payloadStatus !== PayloadStatus.FULL) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const envelopeBytes = await chain.getSerializedExecutionPayloadEnvelope(block.slot, block.blockRoot);
|
|
56
|
+
if (!envelopeBytes) {
|
|
57
|
+
throw new ResponseError(
|
|
58
|
+
RespStatus.SERVER_ERROR,
|
|
59
|
+
`No envelope for root ${block.blockRoot} slot ${block.slot}, startSlot=${startSlot} endSlot=${endSlot} finalizedSlot=${finalizedSlot}`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
yield {
|
|
64
|
+
data: envelopeBytes,
|
|
65
|
+
boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(block.slot)),
|
|
66
|
+
};
|
|
67
|
+
} else if (block.slot >= endSlot) {
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function validateExecutionPayloadEnvelopesByRangeRequest(
|
|
75
|
+
config: ChainConfig,
|
|
76
|
+
request: gloas.ExecutionPayloadEnvelopesByRangeRequest
|
|
77
|
+
): gloas.ExecutionPayloadEnvelopesByRangeRequest {
|
|
78
|
+
const {startSlot} = request;
|
|
79
|
+
let {count} = request;
|
|
80
|
+
|
|
81
|
+
if (count < 1) {
|
|
82
|
+
throw new ResponseError(RespStatus.INVALID_REQUEST, "count < 1");
|
|
83
|
+
}
|
|
84
|
+
// TODO: validate against MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
85
|
+
if (startSlot < GENESIS_SLOT) {
|
|
86
|
+
throw new ResponseError(RespStatus.INVALID_REQUEST, "startSlot < genesis");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (count > config.MAX_REQUEST_BLOCKS_DENEB) {
|
|
90
|
+
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {startSlot, count};
|
|
94
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {ResponseOutgoing} from "@lodestar/reqresp";
|
|
2
|
+
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
3
|
+
import {toRootHex} from "@lodestar/utils";
|
|
4
|
+
import {IBeaconChain} from "../../../chain/index.js";
|
|
5
|
+
import {IBeaconDb} from "../../../db/index.js";
|
|
6
|
+
import {ExecutionPayloadEnvelopesByRootRequest} from "../../../util/types.js";
|
|
7
|
+
|
|
8
|
+
export async function* onExecutionPayloadEnvelopesByRoot(
|
|
9
|
+
requestBody: ExecutionPayloadEnvelopesByRootRequest,
|
|
10
|
+
chain: IBeaconChain,
|
|
11
|
+
db: IBeaconDb
|
|
12
|
+
): AsyncIterable<ResponseOutgoing> {
|
|
13
|
+
// Spec: [max(GLOAS_FORK_EPOCH, current_epoch - MIN_EPOCHS_FOR_BLOCK_REQUESTS), current_epoch]
|
|
14
|
+
const currentEpoch = chain.clock.currentEpoch;
|
|
15
|
+
const minimumRequestEpoch = Math.max(
|
|
16
|
+
currentEpoch - chain.config.MIN_EPOCHS_FOR_BLOCK_REQUESTS,
|
|
17
|
+
chain.config.GLOAS_FORK_EPOCH
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
for (const root of requestBody) {
|
|
21
|
+
const rootHex = toRootHex(root);
|
|
22
|
+
const block = chain.forkChoice.getBlockHexDefaultStatus(rootHex);
|
|
23
|
+
// If the block is not in fork choice, it may be finalized. Attempt to find its slot in block archive
|
|
24
|
+
const slot = block ? block.slot : await db.blockArchive.getSlotByRoot(root);
|
|
25
|
+
|
|
26
|
+
if (slot === null) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const requestedEpoch = computeEpochAtSlot(slot);
|
|
31
|
+
if (requestedEpoch < minimumRequestEpoch) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const envelopeBytes = await chain.getSerializedExecutionPayloadEnvelope(slot, rootHex);
|
|
36
|
+
if (envelopeBytes) {
|
|
37
|
+
yield {
|
|
38
|
+
data: envelopeBytes,
|
|
39
|
+
boundary: chain.config.getForkBoundaryAtEpoch(requestedEpoch),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
BeaconBlocksByRootRequestType,
|
|
7
7
|
BlobSidecarsByRootRequestType,
|
|
8
8
|
DataColumnSidecarsByRootRequestType,
|
|
9
|
+
ExecutionPayloadEnvelopesByRootRequestType,
|
|
9
10
|
} from "../../../util/types.js";
|
|
10
11
|
import {GetReqRespHandlerFn, ReqRespMethod} from "../types.js";
|
|
11
12
|
import {onBeaconBlocksByRange} from "./beaconBlocksByRange.js";
|
|
@@ -14,6 +15,8 @@ import {onBlobSidecarsByRange} from "./blobSidecarsByRange.js";
|
|
|
14
15
|
import {onBlobSidecarsByRoot} from "./blobSidecarsByRoot.js";
|
|
15
16
|
import {onDataColumnSidecarsByRange} from "./dataColumnSidecarsByRange.js";
|
|
16
17
|
import {onDataColumnSidecarsByRoot} from "./dataColumnSidecarsByRoot.js";
|
|
18
|
+
import {onExecutionPayloadEnvelopesByRange} from "./executionPayloadEnvelopesByRange.js";
|
|
19
|
+
import {onExecutionPayloadEnvelopesByRoot} from "./executionPayloadEnvelopesByRoot.js";
|
|
17
20
|
import {onLightClientBootstrap} from "./lightClientBootstrap.js";
|
|
18
21
|
import {onLightClientFinalityUpdate} from "./lightClientFinalityUpdate.js";
|
|
19
22
|
import {onLightClientOptimisticUpdate} from "./lightClientOptimisticUpdate.js";
|
|
@@ -62,6 +65,15 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
|
|
|
62
65
|
return onDataColumnSidecarsByRoot(body, chain, db, peerId, peerClient);
|
|
63
66
|
},
|
|
64
67
|
|
|
68
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: (req) => {
|
|
69
|
+
const body = ExecutionPayloadEnvelopesByRootRequestType(chain.config).deserialize(req.data);
|
|
70
|
+
return onExecutionPayloadEnvelopesByRoot(body, chain, db);
|
|
71
|
+
},
|
|
72
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: (req) => {
|
|
73
|
+
const body = ssz.gloas.ExecutionPayloadEnvelopesByRangeRequest.deserialize(req.data);
|
|
74
|
+
return onExecutionPayloadEnvelopesByRange(body, chain, db);
|
|
75
|
+
},
|
|
76
|
+
|
|
65
77
|
[ReqRespMethod.LightClientBootstrap]: (req) => {
|
|
66
78
|
const body = ssz.Root.deserialize(req.data);
|
|
67
79
|
return onLightClientBootstrap(body, chain);
|
|
@@ -94,6 +94,18 @@ export const DataColumnSidecarsByRoot = toProtocol({
|
|
|
94
94
|
contextBytesType: ContextBytesType.ForkDigest,
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
export const ExecutionPayloadEnvelopesByRoot = toProtocol({
|
|
98
|
+
method: ReqRespMethod.ExecutionPayloadEnvelopesByRoot,
|
|
99
|
+
version: Version.V1,
|
|
100
|
+
contextBytesType: ContextBytesType.ForkDigest,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const ExecutionPayloadEnvelopesByRange = toProtocol({
|
|
104
|
+
method: ReqRespMethod.ExecutionPayloadEnvelopesByRange,
|
|
105
|
+
version: Version.V1,
|
|
106
|
+
contextBytesType: ContextBytesType.ForkDigest,
|
|
107
|
+
});
|
|
108
|
+
|
|
97
109
|
export const LightClientBootstrap = toProtocol({
|
|
98
110
|
method: ReqRespMethod.LightClientBootstrap,
|
|
99
111
|
version: Version.V1,
|
|
@@ -73,6 +73,24 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record<R
|
|
|
73
73
|
req.reduce((total, item) => total + item.columns.length, 0)
|
|
74
74
|
),
|
|
75
75
|
},
|
|
76
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: {
|
|
77
|
+
byPeer: {quota: config.MAX_REQUEST_PAYLOADS, quotaTimeMs: 10_000},
|
|
78
|
+
getRequestCount: getRequestCountFn(
|
|
79
|
+
fork,
|
|
80
|
+
config,
|
|
81
|
+
ReqRespMethod.ExecutionPayloadEnvelopesByRoot,
|
|
82
|
+
(req) => req.length
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: {
|
|
86
|
+
byPeer: {quota: config.MAX_REQUEST_BLOCKS_DENEB, quotaTimeMs: 10_000},
|
|
87
|
+
getRequestCount: getRequestCountFn(
|
|
88
|
+
fork,
|
|
89
|
+
config,
|
|
90
|
+
ReqRespMethod.ExecutionPayloadEnvelopesByRange,
|
|
91
|
+
(req) => req.count
|
|
92
|
+
),
|
|
93
|
+
},
|
|
76
94
|
[ReqRespMethod.LightClientBootstrap]: {
|
|
77
95
|
// As similar in the nature of `Status` protocol so we use the same rate limits.
|
|
78
96
|
byPeer: {quota: 5, quotaTimeMs: 15_000},
|
|
@@ -46,6 +46,8 @@ export function onOutgoingReqRespError(e: RequestError, method: ReqRespMethod):
|
|
|
46
46
|
return PeerAction.LowToleranceError;
|
|
47
47
|
case ReqRespMethod.BeaconBlocksByRange:
|
|
48
48
|
case ReqRespMethod.BeaconBlocksByRoot:
|
|
49
|
+
case ReqRespMethod.ExecutionPayloadEnvelopesByRoot:
|
|
50
|
+
case ReqRespMethod.ExecutionPayloadEnvelopesByRange:
|
|
49
51
|
return PeerAction.MidToleranceError;
|
|
50
52
|
default:
|
|
51
53
|
return null;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
altair,
|
|
15
15
|
deneb,
|
|
16
16
|
fulu,
|
|
17
|
+
gloas,
|
|
17
18
|
phase0,
|
|
18
19
|
ssz,
|
|
19
20
|
sszTypesFor,
|
|
@@ -25,6 +26,8 @@ import {
|
|
|
25
26
|
BlobSidecarsByRootRequestType,
|
|
26
27
|
DataColumnSidecarsByRootRequest,
|
|
27
28
|
DataColumnSidecarsByRootRequestType,
|
|
29
|
+
ExecutionPayloadEnvelopesByRootRequest,
|
|
30
|
+
ExecutionPayloadEnvelopesByRootRequestType,
|
|
28
31
|
} from "../../util/types.js";
|
|
29
32
|
|
|
30
33
|
export type ProtocolNoHandler = Omit<Protocol, "handler">;
|
|
@@ -42,6 +45,8 @@ export enum ReqRespMethod {
|
|
|
42
45
|
BlobSidecarsByRoot = "blob_sidecars_by_root",
|
|
43
46
|
DataColumnSidecarsByRange = "data_column_sidecars_by_range",
|
|
44
47
|
DataColumnSidecarsByRoot = "data_column_sidecars_by_root",
|
|
48
|
+
ExecutionPayloadEnvelopesByRoot = "execution_payload_envelopes_by_root",
|
|
49
|
+
ExecutionPayloadEnvelopesByRange = "execution_payload_envelopes_by_range",
|
|
45
50
|
LightClientBootstrap = "light_client_bootstrap",
|
|
46
51
|
LightClientUpdatesByRange = "light_client_updates_by_range",
|
|
47
52
|
LightClientFinalityUpdate = "light_client_finality_update",
|
|
@@ -60,6 +65,8 @@ export type RequestBodyByMethod = {
|
|
|
60
65
|
[ReqRespMethod.BlobSidecarsByRoot]: BlobSidecarsByRootRequest;
|
|
61
66
|
[ReqRespMethod.DataColumnSidecarsByRange]: fulu.DataColumnSidecarsByRangeRequest;
|
|
62
67
|
[ReqRespMethod.DataColumnSidecarsByRoot]: DataColumnSidecarsByRootRequest;
|
|
68
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: ExecutionPayloadEnvelopesByRootRequest;
|
|
69
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: gloas.ExecutionPayloadEnvelopesByRangeRequest;
|
|
63
70
|
[ReqRespMethod.LightClientBootstrap]: Root;
|
|
64
71
|
[ReqRespMethod.LightClientUpdatesByRange]: altair.LightClientUpdatesByRange;
|
|
65
72
|
[ReqRespMethod.LightClientFinalityUpdate]: null;
|
|
@@ -78,6 +85,8 @@ type ResponseBodyByMethod = {
|
|
|
78
85
|
[ReqRespMethod.BlobSidecarsByRoot]: deneb.BlobSidecar;
|
|
79
86
|
[ReqRespMethod.DataColumnSidecarsByRange]: fulu.DataColumnSidecar;
|
|
80
87
|
[ReqRespMethod.DataColumnSidecarsByRoot]: fulu.DataColumnSidecar;
|
|
88
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: gloas.SignedExecutionPayloadEnvelope;
|
|
89
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: gloas.SignedExecutionPayloadEnvelope;
|
|
81
90
|
|
|
82
91
|
[ReqRespMethod.LightClientBootstrap]: LightClientBootstrap;
|
|
83
92
|
[ReqRespMethod.LightClientUpdatesByRange]: LightClientUpdate;
|
|
@@ -105,6 +114,8 @@ export const requestSszTypeByMethod: (
|
|
|
105
114
|
[ReqRespMethod.BlobSidecarsByRoot]: BlobSidecarsByRootRequestType(fork, config),
|
|
106
115
|
[ReqRespMethod.DataColumnSidecarsByRange]: ssz.fulu.DataColumnSidecarsByRangeRequest,
|
|
107
116
|
[ReqRespMethod.DataColumnSidecarsByRoot]: DataColumnSidecarsByRootRequestType(config),
|
|
117
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: ExecutionPayloadEnvelopesByRootRequestType(config),
|
|
118
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: ssz.gloas.ExecutionPayloadEnvelopesByRangeRequest,
|
|
108
119
|
|
|
109
120
|
[ReqRespMethod.LightClientBootstrap]: ssz.Root,
|
|
110
121
|
[ReqRespMethod.LightClientUpdatesByRange]: ssz.altair.LightClientUpdatesByRange,
|
|
@@ -137,6 +148,8 @@ export const responseSszTypeByMethod: {[K in ReqRespMethod]: ResponseTypeGetter<
|
|
|
137
148
|
[ReqRespMethod.LightClientFinalityUpdate]: (fork) => sszTypesFor(onlyPostAltairFork(fork)).LightClientFinalityUpdate,
|
|
138
149
|
[ReqRespMethod.DataColumnSidecarsByRange]: () => ssz.fulu.DataColumnSidecar,
|
|
139
150
|
[ReqRespMethod.DataColumnSidecarsByRoot]: () => ssz.fulu.DataColumnSidecar,
|
|
151
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
|
|
152
|
+
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
|
|
140
153
|
[ReqRespMethod.LightClientOptimisticUpdate]: (fork) =>
|
|
141
154
|
sszTypesFor(onlyPostAltairFork(fork)).LightClientOptimisticUpdate,
|
|
142
155
|
};
|
package/src/node/nodejs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {BeaconApiMethods} from "@lodestar/api/beacon/server";
|
|
|
6
6
|
import {BeaconConfig} from "@lodestar/config";
|
|
7
7
|
import type {LoggerNode} from "@lodestar/logger/node";
|
|
8
8
|
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
9
|
-
import {
|
|
9
|
+
import {IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
10
10
|
import {phase0} from "@lodestar/types";
|
|
11
11
|
import {sleep, toRootHex} from "@lodestar/utils";
|
|
12
12
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
@@ -53,7 +53,7 @@ export type BeaconNodeInitModules = {
|
|
|
53
53
|
privateKey: PrivateKey;
|
|
54
54
|
dataDir: string;
|
|
55
55
|
peerStoreDir?: string;
|
|
56
|
-
anchorState:
|
|
56
|
+
anchorState: IBeaconStateView;
|
|
57
57
|
isAnchorStateFinalized: boolean;
|
|
58
58
|
wsCheckpoint?: phase0.Checkpoint;
|
|
59
59
|
metricsRegistries?: Registry[];
|
|
@@ -221,9 +221,7 @@ export class BeaconNode {
|
|
|
221
221
|
|
|
222
222
|
let executionEngineOpts = opts.executionEngine;
|
|
223
223
|
if (opts.executionEngine.mode === "mock") {
|
|
224
|
-
const eth1BlockHash =
|
|
225
|
-
? toRootHex(anchorState.latestExecutionPayloadHeader.blockHash)
|
|
226
|
-
: undefined;
|
|
224
|
+
const eth1BlockHash = anchorState.isExecutionStateType ? toRootHex(anchorState.latestBlockHash) : undefined;
|
|
227
225
|
executionEngineOpts = {
|
|
228
226
|
...opts.executionEngine,
|
|
229
227
|
genesisBlockHash: ZERO_HASH_HEX,
|