@lodestar/beacon-node 1.42.0-dev.4411584fd8 → 1.42.0-dev.5007abf468
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +36 -17
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +1 -1
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +27 -32
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +4 -4
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +7 -10
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +4 -6
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/proof/index.d.ts.map +1 -1
- package/lib/api/impl/proof/index.js +2 -6
- package/lib/api/impl/proof/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +27 -27
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.d.ts +2 -2
- package/lib/api/impl/validator/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/utils.js +3 -3
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/chain/archiveStore/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 +4 -3
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +1 -0
- package/lib/chain/blocks/blockInput/types.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts +3 -3
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +27 -11
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +48 -0
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -0
- package/lib/chain/blocks/importExecutionPayload.js +158 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -0
- package/lib/chain/blocks/index.js +1 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/index.d.ts +3 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.js +3 -0
- package/lib/chain/blocks/payloadEnvelopeInput/index.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +80 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +248 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +29 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js +11 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +15 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +46 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -0
- package/lib/chain/blocks/types.d.ts +9 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.d.ts +2 -2
- package/lib/chain/blocks/utils/checkpoint.d.ts.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +2 -2
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +4 -4
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +3 -3
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts +3 -3
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +3 -3
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +12 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +40 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -0
- package/lib/chain/chain.d.ts +19 -14
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +75 -42
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -2
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/errors/blockError.d.ts +4 -4
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +12 -2
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +3 -1
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +4 -4
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +27 -33
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +2 -2
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +1 -1
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +17 -15
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/lightClient/index.d.ts +2 -2
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +4 -4
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +6 -6
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +10 -13
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +3 -3
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +7 -7
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +2 -2
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +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 +8 -4
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +5 -5
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +12 -16
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +15 -13
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +2 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +14 -14
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +6 -5
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +6 -6
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +1 -1
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +1 -1
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +2 -2
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +38 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +76 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -0
- package/lib/chain/serializeState.d.ts +2 -2
- package/lib/chain/serializeState.d.ts.map +1 -1
- package/lib/chain/serializeState.js +1 -1
- package/lib/chain/serializeState.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +2 -2
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +3 -4
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +6 -6
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +11 -11
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +12 -16
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +14 -14
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +3 -3
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/blobSidecar.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +3 -3
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.js +2 -2
- package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +4 -4
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +29 -19
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +1 -2
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts +4 -4
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +13 -12
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +3 -3
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +5 -4
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +12 -7
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +40 -4
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +93 -15
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js +15 -0
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/interface.d.ts +4 -2
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +5 -0
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +4 -2
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +9 -3
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
- package/lib/network/processor/extractSlotRootFns.js +15 -5
- package/lib/network/processor/extractSlotRootFns.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +39 -9
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +12 -7
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +99 -78
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.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/sszBytes.d.ts +4 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +69 -12
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/types.d.ts +2 -0
- package/lib/util/types.d.ts.map +1 -1
- package/lib/util/types.js +1 -0
- package/lib/util/types.js.map +1 -1
- package/package.json +16 -16
- package/src/api/impl/beacon/blocks/index.ts +37 -18
- package/src/api/impl/beacon/pool/index.ts +1 -1
- package/src/api/impl/beacon/state/index.ts +29 -41
- package/src/api/impl/beacon/state/utils.ts +11 -25
- package/src/api/impl/lodestar/index.ts +4 -8
- package/src/api/impl/proof/index.ts +2 -9
- package/src/api/impl/validator/index.ts +29 -41
- package/src/api/impl/validator/utils.ts +4 -7
- package/src/chain/archiveStore/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 +4 -3
- package/src/chain/blocks/importBlock.ts +47 -16
- package/src/chain/blocks/importExecutionPayload.ts +236 -0
- package/src/chain/blocks/index.ts +1 -1
- package/src/chain/blocks/payloadEnvelopeInput/index.ts +2 -0
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +336 -0
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +33 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +61 -0
- package/src/chain/blocks/types.ts +10 -2
- package/src/chain/blocks/utils/checkpoint.ts +2 -2
- package/src/chain/blocks/verifyBlock.ts +5 -10
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +5 -10
- package/src/chain/blocks/verifyBlocksSignatures.ts +3 -3
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -8
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +55 -0
- package/src/chain/chain.ts +112 -70
- package/src/chain/emitter.ts +2 -2
- package/src/chain/errors/blockError.ts +4 -4
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -2
- package/src/chain/forkChoice/index.ts +33 -52
- package/src/chain/initState.ts +7 -2
- package/src/chain/interface.ts +18 -16
- package/src/chain/lightClient/index.ts +9 -22
- package/src/chain/opPools/aggregatedAttestationPool.ts +15 -21
- package/src/chain/opPools/opPool.ts +13 -14
- package/src/chain/opPools/utils.ts +3 -3
- package/src/chain/prepareNextSlot.ts +6 -8
- package/src/chain/produceBlock/computeNewStateRoot.ts +11 -10
- package/src/chain/produceBlock/produceBlockBody.ts +22 -49
- package/src/chain/regen/interface.ts +15 -17
- package/src/chain/regen/queued.ts +16 -20
- package/src/chain/regen/regen.ts +16 -17
- package/src/chain/seenCache/index.ts +1 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +2 -2
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +106 -0
- package/src/chain/serializeState.ts +3 -3
- package/src/chain/shufflingCache.ts +5 -7
- package/src/chain/stateCache/fifoBlockStateCache.ts +7 -7
- package/src/chain/stateCache/persistentCheckpointsCache.ts +27 -42
- package/src/chain/stateCache/types.ts +14 -18
- package/src/chain/validation/attesterSlashing.ts +3 -3
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/block.ts +2 -4
- package/src/chain/validation/blsToExecutionChange.ts +2 -2
- package/src/chain/validation/dataColumnSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +3 -7
- package/src/chain/validation/executionPayloadEnvelope.ts +36 -29
- package/src/chain/validation/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 +22 -11
- package/src/metrics/metrics/lodestar.ts +100 -19
- package/src/network/gossip/encoding.ts +16 -0
- package/src/network/interface.ts +15 -2
- package/src/network/libp2p/index.ts +5 -0
- package/src/network/network.ts +32 -4
- package/src/network/processor/extractSlotRootFns.ts +19 -6
- package/src/network/processor/gossipHandlers.ts +45 -8
- package/src/network/processor/index.ts +110 -89
- package/src/network/reqresp/ReqRespBeaconNode.ts +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/sszBytes.ts +90 -10
- package/src/util/types.ts +6 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +0 -15
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +0 -1
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +0 -28
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +0 -1
- package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +0 -34
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.42.0-dev.
|
|
14
|
+
"version": "1.42.0-dev.5007abf468",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@chainsafe/discv5": "^12.0.1",
|
|
114
114
|
"@chainsafe/enr": "^6.0.1",
|
|
115
115
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
116
|
-
"@chainsafe/libp2p-quic": "^2.0.
|
|
116
|
+
"@chainsafe/libp2p-quic": "^2.0.1",
|
|
117
117
|
"@chainsafe/persistent-merkle-tree": "^1.2.1",
|
|
118
118
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
119
119
|
"@chainsafe/pubkey-index-map": "^3.0.0",
|
|
@@ -135,18 +135,18 @@
|
|
|
135
135
|
"@libp2p/peer-id": "^6.0.4",
|
|
136
136
|
"@libp2p/prometheus-metrics": "^5.0.14",
|
|
137
137
|
"@libp2p/tcp": "^11.0.13",
|
|
138
|
-
"@lodestar/api": "^1.42.0-dev.
|
|
139
|
-
"@lodestar/config": "^1.42.0-dev.
|
|
140
|
-
"@lodestar/db": "^1.42.0-dev.
|
|
141
|
-
"@lodestar/fork-choice": "^1.42.0-dev.
|
|
142
|
-
"@lodestar/light-client": "^1.42.0-dev.
|
|
143
|
-
"@lodestar/logger": "^1.42.0-dev.
|
|
144
|
-
"@lodestar/params": "^1.42.0-dev.
|
|
145
|
-
"@lodestar/reqresp": "^1.42.0-dev.
|
|
146
|
-
"@lodestar/state-transition": "^1.42.0-dev.
|
|
147
|
-
"@lodestar/types": "^1.42.0-dev.
|
|
148
|
-
"@lodestar/utils": "^1.42.0-dev.
|
|
149
|
-
"@lodestar/validator": "^1.42.0-dev.
|
|
138
|
+
"@lodestar/api": "^1.42.0-dev.5007abf468",
|
|
139
|
+
"@lodestar/config": "^1.42.0-dev.5007abf468",
|
|
140
|
+
"@lodestar/db": "^1.42.0-dev.5007abf468",
|
|
141
|
+
"@lodestar/fork-choice": "^1.42.0-dev.5007abf468",
|
|
142
|
+
"@lodestar/light-client": "^1.42.0-dev.5007abf468",
|
|
143
|
+
"@lodestar/logger": "^1.42.0-dev.5007abf468",
|
|
144
|
+
"@lodestar/params": "^1.42.0-dev.5007abf468",
|
|
145
|
+
"@lodestar/reqresp": "^1.42.0-dev.5007abf468",
|
|
146
|
+
"@lodestar/state-transition": "^1.42.0-dev.5007abf468",
|
|
147
|
+
"@lodestar/types": "^1.42.0-dev.5007abf468",
|
|
148
|
+
"@lodestar/utils": "^1.42.0-dev.5007abf468",
|
|
149
|
+
"@lodestar/validator": "^1.42.0-dev.5007abf468",
|
|
150
150
|
"@multiformats/multiaddr": "^13.0.1",
|
|
151
151
|
"datastore-core": "^11.0.2",
|
|
152
152
|
"datastore-fs": "^11.0.2",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"@libp2p/interface-internal": "^3.0.13",
|
|
170
170
|
"@libp2p/logger": "^6.2.2",
|
|
171
171
|
"@libp2p/utils": "^7.0.13",
|
|
172
|
-
"@lodestar/spec-test-util": "^1.42.0-dev.
|
|
172
|
+
"@lodestar/spec-test-util": "^1.42.0-dev.5007abf468",
|
|
173
173
|
"@types/js-yaml": "^4.0.5",
|
|
174
174
|
"@types/qs": "^6.9.7",
|
|
175
175
|
"@types/tmp": "^0.2.3",
|
|
@@ -186,5 +186,5 @@
|
|
|
186
186
|
"beacon",
|
|
187
187
|
"blockchain"
|
|
188
188
|
],
|
|
189
|
-
"gitHead": "
|
|
189
|
+
"gitHead": "9a62b72e27a4b67ccef5cbd0f61eaebc1b4d81fa"
|
|
190
190
|
}
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
} from "@lodestar/types";
|
|
36
36
|
import {fromHex, sleep, toHex, toRootHex} from "@lodestar/utils";
|
|
37
37
|
import {BlockInputSource, isBlockInputBlobs, isBlockInputColumns} from "../../../../chain/blocks/blockInput/index.js";
|
|
38
|
+
import {PayloadEnvelopeInputSource} from "../../../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
38
39
|
import {ImportBlockOpts} from "../../../../chain/blocks/types.js";
|
|
39
40
|
import {verifyBlocksInEpoch} from "../../../../chain/blocks/verifyBlock.js";
|
|
40
41
|
import {BeaconChain} from "../../../../chain/chain.js";
|
|
@@ -48,6 +49,7 @@ import {
|
|
|
48
49
|
ProduceFullGloas,
|
|
49
50
|
} from "../../../../chain/produceBlock/index.js";
|
|
50
51
|
import {validateGossipBlock} from "../../../../chain/validation/block.js";
|
|
52
|
+
import {validateApiExecutionPayloadEnvelope} from "../../../../chain/validation/executionPayloadEnvelope.js";
|
|
51
53
|
import {OpSource} from "../../../../chain/validatorMonitor.js";
|
|
52
54
|
import {
|
|
53
55
|
computePreFuluKzgCommitmentsInclusionProof,
|
|
@@ -605,7 +607,7 @@ export function getBeaconBlockApi({
|
|
|
605
607
|
if (slot < head.slot && head.slot <= slot + SLOTS_PER_HISTORICAL_ROOT) {
|
|
606
608
|
const state = chain.getHeadState();
|
|
607
609
|
return {
|
|
608
|
-
data: {root: state.
|
|
610
|
+
data: {root: state.getBlockRootAtSlot(slot)},
|
|
609
611
|
meta: {
|
|
610
612
|
executionOptimistic: isOptimisticBlock(head),
|
|
611
613
|
finalized: computeEpochAtSlot(slot) <= chain.forkChoice.getFinalizedCheckpoint().epoch,
|
|
@@ -659,6 +661,8 @@ export function getBeaconBlockApi({
|
|
|
659
661
|
throw new ApiError(400, `Envelope slot ${slot} does not match block slot ${block.slot}`);
|
|
660
662
|
}
|
|
661
663
|
|
|
664
|
+
await validateApiExecutionPayloadEnvelope(chain, signedExecutionPayloadEnvelope);
|
|
665
|
+
|
|
662
666
|
const isSelfBuild = envelope.builderIndex === BUILDER_INDEX_SELF_BUILD;
|
|
663
667
|
let dataColumnSidecars: gloas.DataColumnSidecars = [];
|
|
664
668
|
|
|
@@ -676,6 +680,7 @@ export function getBeaconBlockApi({
|
|
|
676
680
|
}
|
|
677
681
|
|
|
678
682
|
if (cachedResult.cells && cachedResult.blobsBundle.commitments.length > 0) {
|
|
683
|
+
const timer = metrics?.peerDas.dataColumnSidecarComputationTime.startTimer();
|
|
679
684
|
const cellsAndProofs = cachedResult.cells.map((rowCells, rowIndex) => ({
|
|
680
685
|
cells: rowCells,
|
|
681
686
|
proofs: cachedResult.blobsBundle.proofs.slice(
|
|
@@ -685,24 +690,42 @@ export function getBeaconBlockApi({
|
|
|
685
690
|
}));
|
|
686
691
|
|
|
687
692
|
dataColumnSidecars = getDataColumnSidecarsForGloas(slot, envelope.beaconBlockRoot, cellsAndProofs);
|
|
693
|
+
timer?.();
|
|
688
694
|
}
|
|
689
695
|
} else {
|
|
690
696
|
// TODO GLOAS: will this api be used by builders or only for self-building?
|
|
691
697
|
}
|
|
692
698
|
|
|
693
|
-
//
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
699
|
+
// If called near a slot boundary (e.g. late in slot N-1), hold briefly so gossip aligns with slot N.
|
|
700
|
+
const msToBlockSlot = computeTimeAtSlot(config, slot, chain.genesisTime) * 1000 - Date.now();
|
|
701
|
+
if (msToBlockSlot <= MAX_API_CLOCK_DISPARITY_MS && msToBlockSlot > 0) {
|
|
702
|
+
await sleep(msToBlockSlot);
|
|
703
|
+
}
|
|
697
704
|
|
|
698
|
-
// TODO GLOAS:
|
|
699
|
-
//
|
|
705
|
+
// TODO GLOAS: if block and payload are submitted in parallel, payloadInput may not yet exist.
|
|
706
|
+
// A queuing mechanism is needed to handle this case. See https://github.com/ChainSafe/lodestar/issues/8915
|
|
707
|
+
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
708
|
+
if (!payloadInput) {
|
|
709
|
+
throw new ApiError(404, `PayloadEnvelopeInput not found for block root ${blockRootHex}`);
|
|
710
|
+
}
|
|
700
711
|
|
|
701
|
-
|
|
702
|
-
|
|
712
|
+
payloadInput.addPayloadEnvelope({
|
|
713
|
+
envelope: signedExecutionPayloadEnvelope,
|
|
714
|
+
source: PayloadEnvelopeInputSource.api,
|
|
715
|
+
seenTimestampSec,
|
|
716
|
+
peerIdStr: undefined,
|
|
717
|
+
});
|
|
703
718
|
|
|
704
|
-
|
|
705
|
-
|
|
719
|
+
if (dataColumnSidecars.length > 0) {
|
|
720
|
+
for (const columnSidecar of dataColumnSidecars) {
|
|
721
|
+
payloadInput.addColumn({
|
|
722
|
+
columnSidecar,
|
|
723
|
+
source: PayloadEnvelopeInputSource.api,
|
|
724
|
+
seenTimestampSec,
|
|
725
|
+
peerIdStr: undefined,
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
}
|
|
706
729
|
|
|
707
730
|
const valLogMeta = {
|
|
708
731
|
slot,
|
|
@@ -712,23 +735,19 @@ export function getBeaconBlockApi({
|
|
|
712
735
|
dataColumns: dataColumnSidecars.length,
|
|
713
736
|
};
|
|
714
737
|
|
|
715
|
-
// If called near a slot boundary (e.g. late in slot N-1), hold briefly so gossip aligns with slot N.
|
|
716
|
-
const msToBlockSlot = computeTimeAtSlot(config, slot, chain.genesisTime) * 1000 - Date.now();
|
|
717
|
-
if (msToBlockSlot <= MAX_API_CLOCK_DISPARITY_MS && msToBlockSlot > 0) {
|
|
718
|
-
await sleep(msToBlockSlot);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
738
|
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
722
739
|
metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.api}, delaySec);
|
|
740
|
+
chain.validatorMonitor?.registerExecutionPayloadEnvelope(OpSource.api, delaySec, signedExecutionPayloadEnvelope);
|
|
723
741
|
|
|
724
742
|
chain.logger.info("Publishing execution payload envelope", valLogMeta);
|
|
725
743
|
|
|
726
|
-
// Publish envelope and data columns
|
|
727
744
|
const publishPromises = [
|
|
728
745
|
// Gossip the signed execution payload envelope first
|
|
729
746
|
() => network.publishSignedExecutionPayloadEnvelope(signedExecutionPayloadEnvelope),
|
|
730
747
|
// For self-builds, publish all data column sidecars
|
|
731
748
|
...dataColumnSidecars.map((dataColumnSidecar) => () => network.publishDataColumnSidecar(dataColumnSidecar)),
|
|
749
|
+
// Import execution payload. Signature already verified above
|
|
750
|
+
() => chain.processExecutionPayload(payloadInput, {validSignature: true}),
|
|
732
751
|
];
|
|
733
752
|
|
|
734
753
|
const sentPeersArr = await promiseAllMaybeAsync<number | void>(publishPromises);
|
|
@@ -255,7 +255,7 @@ export function getBeaconPoolApi({
|
|
|
255
255
|
await Promise.all(
|
|
256
256
|
signatures.map(async (signature, i) => {
|
|
257
257
|
try {
|
|
258
|
-
const synCommittee = state.
|
|
258
|
+
const synCommittee = state.getIndexedSyncCommittee(signature.slot);
|
|
259
259
|
const indexesInCommittee = synCommittee.validatorIndexMap.get(signature.validatorIndex);
|
|
260
260
|
if (indexesInCommittee === undefined || indexesInCommittee.length === 0) {
|
|
261
261
|
return; // Not a sync committee member
|
|
@@ -8,17 +8,12 @@ import {
|
|
|
8
8
|
isForkPostFulu,
|
|
9
9
|
} from "@lodestar/params";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
BeaconStateElectra,
|
|
13
|
-
BeaconStateFulu,
|
|
14
|
-
CachedBeaconStateAltair,
|
|
11
|
+
IBeaconStateView,
|
|
15
12
|
computeEpochAtSlot,
|
|
16
13
|
computeStartSlotAtEpoch,
|
|
17
14
|
getCurrentEpoch,
|
|
18
|
-
getRandaoMix,
|
|
19
|
-
loadState,
|
|
20
15
|
} from "@lodestar/state-transition";
|
|
21
|
-
import {ValidatorIndex, getValidatorStatus} from "@lodestar/types";
|
|
16
|
+
import {ValidatorIndex, getValidatorStatus, ssz} from "@lodestar/types";
|
|
22
17
|
import {ApiError} from "../../errors.js";
|
|
23
18
|
import {ApiModules} from "../../types.js";
|
|
24
19
|
import {assertUniqueItems} from "../../utils.js";
|
|
@@ -35,11 +30,11 @@ export function getBeaconStateApi({
|
|
|
35
30
|
}: Pick<ApiModules, "chain" | "config">): ApplicationMethods<routes.beacon.state.Endpoints> {
|
|
36
31
|
async function getState(
|
|
37
32
|
stateId: routes.beacon.StateId
|
|
38
|
-
): Promise<{state:
|
|
33
|
+
): Promise<{state: IBeaconStateView; executionOptimistic: boolean; finalized: boolean}> {
|
|
39
34
|
const {state, executionOptimistic, finalized} = await getStateResponseWithRegen(chain, stateId);
|
|
40
35
|
|
|
41
36
|
return {
|
|
42
|
-
state: state instanceof Uint8Array ?
|
|
37
|
+
state: state instanceof Uint8Array ? chain.getHeadState().loadOtherState(state) : state,
|
|
43
38
|
executionOptimistic,
|
|
44
39
|
finalized,
|
|
45
40
|
};
|
|
@@ -71,7 +66,7 @@ export function getBeaconStateApi({
|
|
|
71
66
|
throw new ApiError(400, "Requested epoch is out of range");
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
const randao = getRandaoMix(
|
|
69
|
+
const randao = state.getRandaoMix(usedEpoch);
|
|
75
70
|
|
|
76
71
|
return {
|
|
77
72
|
data: {randao},
|
|
@@ -94,7 +89,6 @@ export function getBeaconStateApi({
|
|
|
94
89
|
async getStateValidators({stateId, validatorIds = [], statuses = []}) {
|
|
95
90
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
96
91
|
const currentEpoch = getCurrentEpoch(state);
|
|
97
|
-
const {validators, balances} = state; // Get the validators sub tree once for all the loop
|
|
98
92
|
const {pubkeyCache} = chain;
|
|
99
93
|
|
|
100
94
|
const validatorResponses: routes.beacon.ValidatorResponse[] = [];
|
|
@@ -105,14 +99,14 @@ export function getBeaconStateApi({
|
|
|
105
99
|
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
106
100
|
if (resp.valid) {
|
|
107
101
|
const validatorIndex = resp.validatorIndex;
|
|
108
|
-
const validator =
|
|
102
|
+
const validator = state.getValidator(validatorIndex);
|
|
109
103
|
if (statuses.length && !statuses.includes(getValidatorStatus(validator, currentEpoch))) {
|
|
110
104
|
continue;
|
|
111
105
|
}
|
|
112
106
|
const validatorResponse = toValidatorResponse(
|
|
113
107
|
validatorIndex,
|
|
114
108
|
validator,
|
|
115
|
-
|
|
109
|
+
state.getBalance(validatorIndex),
|
|
116
110
|
currentEpoch
|
|
117
111
|
);
|
|
118
112
|
validatorResponses.push(validatorResponse);
|
|
@@ -135,8 +129,8 @@ export function getBeaconStateApi({
|
|
|
135
129
|
}
|
|
136
130
|
|
|
137
131
|
// TODO: This loops over the entire state, it's a DOS vector
|
|
138
|
-
const validatorsArr = state.
|
|
139
|
-
const balancesArr = state.
|
|
132
|
+
const validatorsArr = state.getAllValidators();
|
|
133
|
+
const balancesArr = state.getAllBalances();
|
|
140
134
|
const resp: routes.beacon.ValidatorResponse[] = [];
|
|
141
135
|
for (let i = 0; i < validatorsArr.length; i++) {
|
|
142
136
|
resp.push(toValidatorResponse(i, validatorsArr[i], balancesArr[i], currentEpoch));
|
|
@@ -166,12 +160,12 @@ export function getBeaconStateApi({
|
|
|
166
160
|
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
167
161
|
if (resp.valid) {
|
|
168
162
|
const index = resp.validatorIndex;
|
|
169
|
-
const {pubkey, activationEpoch} = state.
|
|
163
|
+
const {pubkey, activationEpoch} = state.getValidator(index);
|
|
170
164
|
validatorIdentities.push({index, pubkey, activationEpoch});
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
167
|
} else {
|
|
174
|
-
const validatorsArr = state.
|
|
168
|
+
const validatorsArr = state.getAllValidators();
|
|
175
169
|
validatorIdentities = new Array(validatorsArr.length) as routes.beacon.ValidatorIdentities;
|
|
176
170
|
for (let i = 0; i < validatorsArr.length; i++) {
|
|
177
171
|
const {pubkey, activationEpoch} = validatorsArr[i];
|
|
@@ -198,8 +192,8 @@ export function getBeaconStateApi({
|
|
|
198
192
|
return {
|
|
199
193
|
data: toValidatorResponse(
|
|
200
194
|
validatorIndex,
|
|
201
|
-
state.
|
|
202
|
-
state.
|
|
195
|
+
state.getValidator(validatorIndex),
|
|
196
|
+
state.getBalance(validatorIndex),
|
|
203
197
|
getCurrentEpoch(state)
|
|
204
198
|
),
|
|
205
199
|
meta: {executionOptimistic, finalized},
|
|
@@ -219,7 +213,7 @@ export function getBeaconStateApi({
|
|
|
219
213
|
if (resp.valid) {
|
|
220
214
|
balances.push({
|
|
221
215
|
index: resp.validatorIndex,
|
|
222
|
-
balance: state.
|
|
216
|
+
balance: state.getBalance(resp.validatorIndex),
|
|
223
217
|
});
|
|
224
218
|
}
|
|
225
219
|
}
|
|
@@ -230,7 +224,7 @@ export function getBeaconStateApi({
|
|
|
230
224
|
}
|
|
231
225
|
|
|
232
226
|
// TODO: This loops over the entire state, it's a DOS vector
|
|
233
|
-
const balancesArr = state.
|
|
227
|
+
const balancesArr = state.getAllBalances();
|
|
234
228
|
const resp: routes.beacon.ValidatorBalance[] = [];
|
|
235
229
|
for (let i = 0; i < balancesArr.length; i++) {
|
|
236
230
|
resp.push({index: i, balance: balancesArr[i]});
|
|
@@ -248,11 +242,6 @@ export function getBeaconStateApi({
|
|
|
248
242
|
async getEpochCommittees({stateId, ...filters}) {
|
|
249
243
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
250
244
|
|
|
251
|
-
const stateCached = state as CachedBeaconStateAltair;
|
|
252
|
-
if (stateCached.epochCtx === undefined) {
|
|
253
|
-
throw new ApiError(400, `No cached state available for stateId: ${stateId}`);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
245
|
const stateEpoch = computeEpochAtSlot(state.slot);
|
|
257
246
|
const epoch = filters.epoch ?? stateEpoch;
|
|
258
247
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
@@ -266,7 +255,7 @@ export function getBeaconStateApi({
|
|
|
266
255
|
throw new ApiError(400, `Slot ${filters.slot} is not in epoch ${epoch}`);
|
|
267
256
|
}
|
|
268
257
|
|
|
269
|
-
const decisionRoot =
|
|
258
|
+
const decisionRoot = state.getShufflingDecisionRoot(epoch);
|
|
270
259
|
const shuffling = await chain.shufflingCache.get(epoch, decisionRoot);
|
|
271
260
|
if (!shuffling) {
|
|
272
261
|
throw new ApiError(
|
|
@@ -315,12 +304,7 @@ export function getBeaconStateApi({
|
|
|
315
304
|
throw new ApiError(400, "Requested state before ALTAIR_FORK_EPOCH");
|
|
316
305
|
}
|
|
317
306
|
|
|
318
|
-
const
|
|
319
|
-
if (stateCached.epochCtx === undefined) {
|
|
320
|
-
throw new ApiError(400, `No cached state available for stateId: ${stateId}`);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const syncCommitteeCache = stateCached.epochCtx.getIndexedSyncCommitteeAtEpoch(epoch ?? stateEpoch);
|
|
307
|
+
const syncCommitteeCache = state.getIndexedSyncCommitteeAtEpoch(epoch ?? stateEpoch);
|
|
324
308
|
const validatorIndices = new Array<ValidatorIndex>(...syncCommitteeCache.validatorIndices);
|
|
325
309
|
|
|
326
310
|
// Subcommittee assignments of the current sync committee
|
|
@@ -346,10 +330,10 @@ export function getBeaconStateApi({
|
|
|
346
330
|
throw new ApiError(400, `Cannot retrieve pending deposits for pre-electra state fork=${fork}`);
|
|
347
331
|
}
|
|
348
332
|
|
|
349
|
-
const
|
|
333
|
+
const pendingDeposits = state.pendingDeposits;
|
|
350
334
|
|
|
351
335
|
return {
|
|
352
|
-
data: context?.returnBytes ?
|
|
336
|
+
data: context?.returnBytes ? ssz.electra.PendingDeposits.serialize(pendingDeposits) : pendingDeposits,
|
|
353
337
|
meta: {executionOptimistic, finalized, version: fork},
|
|
354
338
|
};
|
|
355
339
|
},
|
|
@@ -362,10 +346,12 @@ export function getBeaconStateApi({
|
|
|
362
346
|
throw new ApiError(400, `Cannot retrieve pending partial withdrawals for pre-electra state fork=${fork}`);
|
|
363
347
|
}
|
|
364
348
|
|
|
365
|
-
const
|
|
349
|
+
const pendingPartialWithdrawals = state.pendingPartialWithdrawals;
|
|
366
350
|
|
|
367
351
|
return {
|
|
368
|
-
data: context?.returnBytes
|
|
352
|
+
data: context?.returnBytes
|
|
353
|
+
? ssz.electra.PendingPartialWithdrawals.serialize(pendingPartialWithdrawals)
|
|
354
|
+
: pendingPartialWithdrawals,
|
|
369
355
|
meta: {executionOptimistic, finalized, version: fork},
|
|
370
356
|
};
|
|
371
357
|
},
|
|
@@ -378,10 +364,12 @@ export function getBeaconStateApi({
|
|
|
378
364
|
throw new ApiError(400, `Cannot retrieve pending consolidations for pre-electra state fork=${fork}`);
|
|
379
365
|
}
|
|
380
366
|
|
|
381
|
-
const
|
|
367
|
+
const pendingConsolidations = state.pendingConsolidations;
|
|
382
368
|
|
|
383
369
|
return {
|
|
384
|
-
data: context?.returnBytes
|
|
370
|
+
data: context?.returnBytes
|
|
371
|
+
? ssz.electra.PendingConsolidations.serialize(pendingConsolidations)
|
|
372
|
+
: pendingConsolidations,
|
|
385
373
|
meta: {executionOptimistic, finalized, version: fork},
|
|
386
374
|
};
|
|
387
375
|
},
|
|
@@ -394,10 +382,10 @@ export function getBeaconStateApi({
|
|
|
394
382
|
throw new ApiError(400, `Cannot retrieve proposer lookahead for pre-fulu state fork=${fork}`);
|
|
395
383
|
}
|
|
396
384
|
|
|
397
|
-
const
|
|
385
|
+
const proposerLookahead = state.proposerLookahead;
|
|
398
386
|
|
|
399
387
|
return {
|
|
400
|
-
data: context?.returnBytes ?
|
|
388
|
+
data: context?.returnBytes ? ssz.fulu.ProposerLookahead.serialize(proposerLookahead) : proposerLookahead,
|
|
401
389
|
meta: {executionOptimistic, finalized, version: fork},
|
|
402
390
|
};
|
|
403
391
|
},
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {CheckpointWithPayloadStatus, IForkChoice} from "@lodestar/fork-choice";
|
|
3
3
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
BLSPubkey,
|
|
7
|
-
Epoch,
|
|
8
|
-
RootHex,
|
|
9
|
-
Slot,
|
|
10
|
-
ValidatorIndex,
|
|
11
|
-
getValidatorStatus,
|
|
12
|
-
mapToGeneralStatus,
|
|
13
|
-
phase0,
|
|
14
|
-
} from "@lodestar/types";
|
|
4
|
+
import {IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
+
import {BLSPubkey, Epoch, RootHex, Slot, ValidatorIndex, getValidatorStatus, phase0} from "@lodestar/types";
|
|
15
6
|
import {fromHex} from "@lodestar/utils";
|
|
16
7
|
import {IBeaconChain} from "../../../../chain/index.js";
|
|
17
8
|
import {ApiError, ValidationError} from "../../errors.js";
|
|
@@ -52,7 +43,7 @@ export function resolveStateId(
|
|
|
52
43
|
export async function getStateResponseWithRegen(
|
|
53
44
|
chain: IBeaconChain,
|
|
54
45
|
inStateId: routes.beacon.StateId
|
|
55
|
-
): Promise<{state:
|
|
46
|
+
): Promise<{state: IBeaconStateView | Uint8Array; executionOptimistic: boolean; finalized: boolean}> {
|
|
56
47
|
const stateId = resolveStateId(chain.forkChoice, inStateId);
|
|
57
48
|
|
|
58
49
|
const res =
|
|
@@ -89,22 +80,17 @@ export function toValidatorResponse(
|
|
|
89
80
|
|
|
90
81
|
export function filterStateValidatorsByStatus(
|
|
91
82
|
statuses: string[],
|
|
92
|
-
state:
|
|
83
|
+
state: IBeaconStateView,
|
|
93
84
|
pubkeyCache: PubkeyCache,
|
|
94
85
|
currentEpoch: Epoch
|
|
95
86
|
): routes.beacon.ValidatorResponse[] {
|
|
96
87
|
const responses: routes.beacon.ValidatorResponse[] = [];
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
for (const validator of validatorsArr) {
|
|
101
|
-
const validatorStatus = getValidatorStatus(validator, currentEpoch);
|
|
102
|
-
const generalStatus = mapToGeneralStatus(validatorStatus);
|
|
103
|
-
|
|
88
|
+
const validators = state.getValidatorsByStatus(new Set(statuses), currentEpoch);
|
|
89
|
+
for (const validator of validators) {
|
|
104
90
|
const resp = getStateValidatorIndex(validator.pubkey, state, pubkeyCache);
|
|
105
|
-
if (resp.valid
|
|
91
|
+
if (resp.valid) {
|
|
106
92
|
responses.push(
|
|
107
|
-
toValidatorResponse(resp.validatorIndex, validator, state.
|
|
93
|
+
toValidatorResponse(resp.validatorIndex, validator, state.getBalance(resp.validatorIndex), currentEpoch)
|
|
108
94
|
);
|
|
109
95
|
}
|
|
110
96
|
}
|
|
@@ -117,7 +103,7 @@ type StateValidatorIndexResponse =
|
|
|
117
103
|
|
|
118
104
|
export function getStateValidatorIndex(
|
|
119
105
|
id: routes.beacon.ValidatorId | BLSPubkey,
|
|
120
|
-
state:
|
|
106
|
+
state: IBeaconStateView,
|
|
121
107
|
pubkeyCache: PubkeyCache
|
|
122
108
|
): StateValidatorIndexResponse {
|
|
123
109
|
if (typeof id === "string") {
|
|
@@ -139,7 +125,7 @@ export function getStateValidatorIndex(
|
|
|
139
125
|
if (!Number.isSafeInteger(validatorIndex)) {
|
|
140
126
|
return {valid: false, code: 400, reason: "Invalid validator index"};
|
|
141
127
|
}
|
|
142
|
-
if (validatorIndex >= state.
|
|
128
|
+
if (validatorIndex >= state.validatorCount) {
|
|
143
129
|
return {valid: false, code: 404, reason: "Validator index from future state"};
|
|
144
130
|
}
|
|
145
131
|
return {valid: true, validatorIndex};
|
|
@@ -150,7 +136,7 @@ export function getStateValidatorIndex(
|
|
|
150
136
|
if (validatorIndex === null) {
|
|
151
137
|
return {valid: false, code: 404, reason: "Validator pubkey not found in state"};
|
|
152
138
|
}
|
|
153
|
-
if (validatorIndex >= state.
|
|
139
|
+
if (validatorIndex >= state.validatorCount) {
|
|
154
140
|
return {valid: false, code: 404, reason: "Validator pubkey from future state"};
|
|
155
141
|
}
|
|
156
142
|
return {valid: true, validatorIndex};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {Tree} from "@chainsafe/persistent-merkle-tree";
|
|
2
1
|
import {routes} from "@lodestar/api";
|
|
3
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
4
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
5
4
|
import {Repository} from "@lodestar/db";
|
|
6
5
|
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
7
|
-
import {BeaconStateCapella, getLatestWeakSubjectivityCheckpointEpoch, loadState} from "@lodestar/state-transition";
|
|
8
6
|
import {ssz} from "@lodestar/types";
|
|
9
7
|
import {Checkpoint} from "@lodestar/types/phase0";
|
|
10
8
|
import {fromHex, toHex, toRootHex} from "@lodestar/utils";
|
|
@@ -86,7 +84,7 @@ export function getLodestarApi({
|
|
|
86
84
|
|
|
87
85
|
async getLatestWeakSubjectivityCheckpointEpoch() {
|
|
88
86
|
const state = chain.getHeadState();
|
|
89
|
-
return {data: getLatestWeakSubjectivityCheckpointEpoch(
|
|
87
|
+
return {data: state.getLatestWeakSubjectivityCheckpointEpoch()};
|
|
90
88
|
},
|
|
91
89
|
|
|
92
90
|
async getSyncChainsDebugState() {
|
|
@@ -214,9 +212,7 @@ export function getLodestarApi({
|
|
|
214
212
|
async getHistoricalSummaries({stateId}) {
|
|
215
213
|
const {state, executionOptimistic, finalized} = await getStateResponseWithRegen(chain, stateId);
|
|
216
214
|
|
|
217
|
-
const stateView = (
|
|
218
|
-
state instanceof Uint8Array ? loadState(config, chain.getHeadState(), state).state : state
|
|
219
|
-
) as BeaconStateCapella;
|
|
215
|
+
const stateView = state instanceof Uint8Array ? chain.getHeadState().loadOtherState(state) : state;
|
|
220
216
|
|
|
221
217
|
const fork = config.getForkName(stateView.slot);
|
|
222
218
|
if (ForkSeq[fork] < ForkSeq.capella) {
|
|
@@ -224,12 +220,12 @@ export function getLodestarApi({
|
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
const {gindex} = ssz[fork].BeaconState.getPathInfo(["historicalSummaries"]);
|
|
227
|
-
const proof =
|
|
223
|
+
const proof = stateView.getSingleProof(gindex);
|
|
228
224
|
|
|
229
225
|
return {
|
|
230
226
|
data: {
|
|
231
227
|
slot: stateView.slot,
|
|
232
|
-
historicalSummaries: stateView.historicalSummaries
|
|
228
|
+
historicalSummaries: stateView.historicalSummaries,
|
|
233
229
|
proof: proof,
|
|
234
230
|
},
|
|
235
231
|
meta: {executionOptimistic, finalized, version: fork},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {CompactMultiProof, ProofType, createProof} from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import {routes} from "@lodestar/api";
|
|
3
3
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
4
|
-
import {loadState} from "@lodestar/state-transition";
|
|
5
4
|
import {ApiOptions} from "../../options.js";
|
|
6
5
|
import {getBlockResponse} from "../beacon/blocks/utils.js";
|
|
7
6
|
import {getStateResponseWithRegen} from "../beacon/state/utils.js";
|
|
@@ -24,16 +23,10 @@ export function getProofApi(
|
|
|
24
23
|
|
|
25
24
|
const res = await getStateResponseWithRegen(chain, stateId);
|
|
26
25
|
|
|
27
|
-
const state =
|
|
28
|
-
res.state instanceof Uint8Array ? loadState(config, chain.getHeadState(), res.state).state : res.state;
|
|
29
|
-
|
|
30
|
-
// there should be no state changes in beacon-node so no need to commit() here
|
|
31
|
-
const stateNode = state.node;
|
|
32
|
-
|
|
33
|
-
const proof = createProof(stateNode, {type: ProofType.compactMulti, descriptor});
|
|
26
|
+
const state = res.state instanceof Uint8Array ? chain.getHeadState().loadOtherState(res.state) : res.state;
|
|
34
27
|
|
|
35
28
|
return {
|
|
36
|
-
data:
|
|
29
|
+
data: state.createMultiProof(descriptor),
|
|
37
30
|
meta: {version: config.getForkName(state.slot)},
|
|
38
31
|
};
|
|
39
32
|
},
|