@lodestar/beacon-node 1.50.0-dev.456b75a81e → 1.50.0-dev.4b00f7bf39
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 +13 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/index.js +13 -0
- package/lib/api/impl/beacon/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 +28 -6
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +26 -18
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts +1 -0
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +80 -18
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +0 -2
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +4 -5
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +5 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +14 -24
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -7
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +1 -1
- package/lib/chain/archiveStore/interface.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +2 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/beaconProposerCache.d.ts +6 -0
- package/lib/chain/beaconProposerCache.d.ts.map +1 -1
- package/lib/chain/beaconProposerCache.js +16 -0
- package/lib/chain/beaconProposerCache.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +21 -12
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +7 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +5 -4
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -5
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +105 -35
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +7 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -0
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.d.ts +5 -0
- package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.js +2 -0
- package/lib/chain/errors/envelopeReconstructionError.js.map +1 -1
- package/lib/chain/errors/gossipValidation.d.ts +1 -0
- package/lib/chain/errors/gossipValidation.d.ts.map +1 -1
- package/lib/chain/errors/gossipValidation.js +1 -0
- package/lib/chain/errors/gossipValidation.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +2 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -3
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +4 -2
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +30 -8
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +1 -23
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.d.ts +8 -4
- package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.js +27 -12
- package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +11 -0
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +22 -0
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +2 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +20 -8
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +11 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +54 -36
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +2 -0
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +10 -4
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/reprocess.d.ts +2 -1
- package/lib/chain/reprocess.d.ts.map +1 -1
- package/lib/chain/reprocess.js +2 -1
- package/lib/chain/reprocess.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -0
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +22 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +9 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +23 -13
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +18 -8
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +72 -18
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +5 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +70 -58
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/constants/constants.d.ts +1 -0
- package/lib/constants/constants.d.ts.map +1 -1
- package/lib/constants/constants.js +1 -0
- package/lib/constants/constants.js.map +1 -1
- package/lib/db/beacon.d.ts +4 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +6 -1
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +3 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -0
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +4 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +2 -2
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +3 -3
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.js +1 -2
- package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
- package/lib/db/repositories/earliestAvailableSlot.d.ts +11 -0
- package/lib/db/repositories/earliestAvailableSlot.d.ts.map +1 -0
- package/lib/db/repositories/earliestAvailableSlot.js +19 -0
- package/lib/db/repositories/earliestAvailableSlot.js.map +1 -0
- package/lib/db/repositories/index.d.ts +1 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/db/repositories/proposerPreferences.d.ts +14 -0
- package/lib/db/repositories/proposerPreferences.d.ts.map +1 -0
- package/lib/db/repositories/proposerPreferences.js +21 -0
- package/lib/db/repositories/proposerPreferences.js.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts +9 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.js +74 -0
- package/lib/execution/engine/blobVersionedHashes.js.map +1 -0
- package/lib/execution/engine/disabled.d.ts +0 -2
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +0 -6
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +46 -16
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +236 -213
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts +3 -2
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +33 -8
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -4
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.js +14 -4
- package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +25 -0
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -0
- package/lib/execution/engine/jsonRpcTransport.js +158 -0
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -0
- package/lib/execution/engine/mock.d.ts +0 -2
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +0 -8
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/restHttpClient.d.ts +71 -0
- package/lib/execution/engine/restHttpClient.d.ts.map +1 -0
- package/lib/execution/engine/restHttpClient.js +201 -0
- package/lib/execution/engine/restHttpClient.js.map +1 -0
- package/lib/execution/engine/restTransport.d.ts +48 -0
- package/lib/execution/engine/restTransport.d.ts.map +1 -0
- package/lib/execution/engine/restTransport.js +411 -0
- package/lib/execution/engine/restTransport.js.map +1 -0
- package/lib/execution/engine/sszTypes.d.ts +1261 -0
- package/lib/execution/engine/sszTypes.d.ts.map +1 -0
- package/lib/execution/engine/sszTypes.js +216 -0
- package/lib/execution/engine/sszTypes.js.map +1 -0
- package/lib/execution/engine/transport.d.ts +39 -0
- package/lib/execution/engine/transport.d.ts.map +1 -0
- package/lib/execution/engine/transport.js +2 -0
- package/lib/execution/engine/transport.js.map +1 -0
- package/lib/execution/engine/transportMetrics.d.ts +5 -1
- package/lib/execution/engine/transportMetrics.d.ts.map +1 -1
- package/lib/execution/engine/types.d.ts +2 -8
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +31 -63
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js +9 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +14 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +29 -1
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts +7 -3
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +4 -4
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/core/events.d.ts +5 -1
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +8 -0
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +0 -14
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +63 -64
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts +4 -2
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +6 -2
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts +8 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +52 -5
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/rateLimit.js +2 -2
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/subnets/attnetsService.d.ts.map +1 -1
- package/lib/network/subnets/attnetsService.js +3 -1
- package/lib/network/subnets/attnetsService.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +27 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +12 -13
- package/lib/node/notifier.js.map +1 -1
- package/lib/node/options.d.ts +3 -2
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +2 -2
- package/lib/node/options.js.map +1 -1
- package/lib/sync/range/batch.d.ts +11 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +21 -17
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +4 -4
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +12 -6
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +75 -29
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +5 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +52 -26
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +38 -14
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +84 -39
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/util/asyncIterableToEvents.d.ts +10 -2
- package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
- package/lib/util/asyncIterableToEvents.js +29 -3
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +3 -4
- package/lib/util/clock.js.map +1 -1
- package/lib/util/execution.d.ts +9 -11
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +5 -1
- package/lib/util/execution.js.map +1 -1
- package/lib/util/metadata.d.ts.map +1 -1
- package/lib/util/metadata.js +2 -1
- package/lib/util/metadata.js.map +1 -1
- package/lib/util/sszBytes.d.ts +2 -2
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +22 -14
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +18 -17
- package/src/api/impl/beacon/blocks/index.ts +17 -7
- package/src/api/impl/beacon/index.ts +15 -0
- package/src/api/impl/beacon/state/index.ts +43 -6
- package/src/api/impl/debug/index.ts +28 -19
- package/src/api/impl/validator/index.ts +102 -21
- package/src/chain/ColumnReconstructionTracker.ts +4 -6
- package/src/chain/archiveStore/archiveStore.ts +19 -25
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -7
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +1 -1
- package/src/chain/archiveStore/historicalState/types.ts +2 -2
- package/src/chain/archiveStore/historicalState/worker.ts +1 -2
- package/src/chain/archiveStore/interface.ts +1 -1
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -1
- package/src/chain/beaconProposerCache.ts +19 -1
- package/src/chain/blocks/blockInput/blockInput.ts +1 -1
- package/src/chain/blocks/importBlock.ts +25 -11
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +2 -1
- package/src/chain/blocks/verifyBlock.ts +8 -6
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -3
- package/src/chain/chain.ts +135 -37
- package/src/chain/emitter.ts +7 -1
- package/src/chain/errors/envelopeReconstructionError.ts +3 -0
- package/src/chain/errors/gossipValidation.ts +1 -0
- package/src/chain/forkChoice/index.ts +2 -0
- package/src/chain/interface.ts +7 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +34 -10
- package/src/chain/opPools/opPool.ts +1 -31
- package/src/chain/opPools/proposerPreferencesPool.ts +34 -11
- package/src/chain/opPools/utils.ts +31 -0
- package/src/chain/options.ts +3 -3
- package/src/chain/prepareNextSlot.ts +28 -9
- package/src/chain/produceBlock/computeNewStateRoot.ts +10 -3
- package/src/chain/produceBlock/produceBlockBody.ts +86 -40
- package/src/chain/regen/regen.ts +12 -4
- package/src/chain/reprocess.ts +2 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +25 -1
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +31 -13
- package/src/chain/shufflingCache.ts +84 -22
- package/src/chain/stateCache/persistentCheckpointsCache.ts +4 -1
- package/src/chain/validatorMonitor.ts +82 -61
- package/src/constants/constants.ts +1 -0
- package/src/db/beacon.ts +6 -0
- package/src/db/buckets.ts +2 -0
- package/src/db/interface.ts +4 -0
- package/src/db/repositories/blockArchive.ts +2 -2
- package/src/db/repositories/blockArchiveIndex.ts +2 -3
- package/src/db/repositories/earliestAvailableSlot.ts +19 -0
- package/src/db/repositories/index.ts +1 -0
- package/src/db/repositories/proposerPreferences.ts +23 -0
- package/src/execution/engine/blobVersionedHashes.ts +72 -0
- package/src/execution/engine/disabled.ts +0 -8
- package/src/execution/engine/http.ts +304 -300
- package/src/execution/engine/index.ts +42 -7
- package/src/execution/engine/interface.ts +2 -6
- package/src/execution/engine/jsonRpcHttpClient.ts +12 -5
- package/src/execution/engine/jsonRpcTransport.ts +247 -0
- package/src/execution/engine/mock.ts +1 -19
- package/src/execution/engine/restHttpClient.ts +269 -0
- package/src/execution/engine/restTransport.ts +575 -0
- package/src/execution/engine/sszTypes.ts +354 -0
- package/src/execution/engine/transport.ts +61 -0
- package/src/execution/engine/transportMetrics.ts +2 -1
- package/src/execution/engine/types.ts +42 -90
- package/src/execution/engine/utils.ts +12 -2
- package/src/metrics/metrics/lodestar.ts +30 -1
- package/src/metrics/metrics.ts +21 -6
- package/src/network/core/events.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +94 -77
- package/src/network/processor/gossipValidatorFn.ts +12 -2
- package/src/network/processor/index.ts +58 -5
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +1 -1
- package/src/network/reqresp/rateLimit.ts +2 -2
- package/src/network/subnets/attnetsService.ts +8 -3
- package/src/node/nodejs.ts +35 -3
- package/src/node/notifier.ts +14 -13
- package/src/node/options.ts +10 -1
- package/src/sync/range/batch.ts +25 -19
- package/src/sync/range/chain.ts +15 -8
- package/src/sync/range/range.ts +76 -30
- package/src/sync/unknownBlock.ts +65 -27
- package/src/sync/utils/downloadByRange.ts +123 -58
- package/src/util/asyncIterableToEvents.ts +44 -5
- package/src/util/clock.ts +3 -4
- package/src/util/execution.ts +16 -8
- package/src/util/metadata.ts +2 -1
- package/src/util/sszBytes.ts +25 -12
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BitVectorType,
|
|
3
|
+
ByteListType,
|
|
4
|
+
CompositeType,
|
|
5
|
+
CompositeView,
|
|
6
|
+
CompositeViewDU,
|
|
7
|
+
ContainerType,
|
|
8
|
+
ListCompositeType,
|
|
9
|
+
ValueOf,
|
|
10
|
+
} from "@chainsafe/ssz";
|
|
11
|
+
import {CELLS_PER_EXT_BLOB, ForkName, ForkPostBellatrix, MAX_BYTES_PER_TRANSACTION} from "@lodestar/params";
|
|
12
|
+
import {ssz} from "@lodestar/types";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SSZ containers of the REST engine API, per execution-apis `src/engine/refactor-ssz.md`
|
|
16
|
+
* at 5bcdc34a477b10af278c079525374e6a4046f291.
|
|
17
|
+
*
|
|
18
|
+
* Execution payloads, withdrawals and blobs bundles are shared with the consensus types since
|
|
19
|
+
* they serialize identically. Everything else is transport-only and therefore defined here.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const MAX_EXECUTION_REQUESTS_PER_PAYLOAD = 256;
|
|
23
|
+
const MAX_BYTES_PER_EXECUTION_REQUEST = MAX_BYTES_PER_TRANSACTION;
|
|
24
|
+
const MAX_BAL_BYTES = MAX_BYTES_PER_TRANSACTION;
|
|
25
|
+
const MAX_ERROR_BYTES = 1024;
|
|
26
|
+
export const MAX_BODIES_REQUEST = 32;
|
|
27
|
+
export const MAX_BLOBS_REQUEST = 128;
|
|
28
|
+
|
|
29
|
+
/** `Optional[T]` is `List[T, 1]` on the wire, the ssz library's `OptionalType` is a different encoding */
|
|
30
|
+
function Optional<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(
|
|
31
|
+
type: T
|
|
32
|
+
): ListCompositeType<T> {
|
|
33
|
+
return new ListCompositeType(type, 1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const {Bytes8, Bytes32, Bytes48, ExecutionAddress, Root, Uint8, UintBn64, UintBn256, UintNum64} = ssz;
|
|
37
|
+
|
|
38
|
+
const ExecutionRequestsList = new ListCompositeType(
|
|
39
|
+
new ByteListType(MAX_BYTES_PER_EXECUTION_REQUEST),
|
|
40
|
+
MAX_EXECUTION_REQUESTS_PER_PAYLOAD
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const PayloadStatus = new ContainerType(
|
|
44
|
+
{
|
|
45
|
+
status: Uint8,
|
|
46
|
+
latestValidHash: Optional(Bytes32),
|
|
47
|
+
validationError: Optional(new ByteListType(MAX_ERROR_BYTES)),
|
|
48
|
+
},
|
|
49
|
+
{typeName: "PayloadStatus"}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const ForkchoiceState = new ContainerType(
|
|
53
|
+
{
|
|
54
|
+
headBlockHash: Bytes32,
|
|
55
|
+
safeBlockHash: Bytes32,
|
|
56
|
+
finalizedBlockHash: Bytes32,
|
|
57
|
+
},
|
|
58
|
+
{typeName: "ForkchoiceState"}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export const ForkchoiceUpdateResponse = new ContainerType(
|
|
62
|
+
{
|
|
63
|
+
payloadStatus: PayloadStatus,
|
|
64
|
+
payloadId: Optional(Bytes8),
|
|
65
|
+
},
|
|
66
|
+
{typeName: "ForkchoiceUpdateResponse"}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
export const PayloadAttributesBellatrix = new ContainerType(
|
|
70
|
+
{
|
|
71
|
+
timestamp: UintNum64,
|
|
72
|
+
prevRandao: Bytes32,
|
|
73
|
+
suggestedFeeRecipient: ExecutionAddress,
|
|
74
|
+
},
|
|
75
|
+
{typeName: "PayloadAttributes"}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const PayloadAttributesCapella = new ContainerType(
|
|
79
|
+
{
|
|
80
|
+
...PayloadAttributesBellatrix.fields,
|
|
81
|
+
withdrawals: ssz.capella.Withdrawals,
|
|
82
|
+
},
|
|
83
|
+
{typeName: "PayloadAttributes"}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export const PayloadAttributesDeneb = new ContainerType(
|
|
87
|
+
{
|
|
88
|
+
...PayloadAttributesCapella.fields,
|
|
89
|
+
parentBeaconBlockRoot: Root,
|
|
90
|
+
},
|
|
91
|
+
{typeName: "PayloadAttributes"}
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export const PayloadAttributesGloas = new ContainerType(
|
|
95
|
+
{
|
|
96
|
+
...PayloadAttributesDeneb.fields,
|
|
97
|
+
slotNumber: UintNum64,
|
|
98
|
+
targetGasLimit: UintBn64,
|
|
99
|
+
},
|
|
100
|
+
{typeName: "PayloadAttributes"}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const CustodyColumns = new BitVectorType(CELLS_PER_EXT_BLOB);
|
|
104
|
+
|
|
105
|
+
function ForkchoiceUpdateType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(
|
|
106
|
+
payloadAttributes: T
|
|
107
|
+
) {
|
|
108
|
+
return new ContainerType(
|
|
109
|
+
{
|
|
110
|
+
forkchoiceState: ForkchoiceState,
|
|
111
|
+
payloadAttributes: Optional(payloadAttributes),
|
|
112
|
+
},
|
|
113
|
+
{typeName: "ForkchoiceUpdate"}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const ForkchoiceUpdateBellatrix = ForkchoiceUpdateType(PayloadAttributesBellatrix);
|
|
118
|
+
export const ForkchoiceUpdateCapella = ForkchoiceUpdateType(PayloadAttributesCapella);
|
|
119
|
+
export const ForkchoiceUpdateDeneb = ForkchoiceUpdateType(PayloadAttributesDeneb);
|
|
120
|
+
export const ForkchoiceUpdateGloas = new ContainerType(
|
|
121
|
+
{
|
|
122
|
+
...ForkchoiceUpdateType(PayloadAttributesGloas).fields,
|
|
123
|
+
custodyColumns: Optional(CustodyColumns),
|
|
124
|
+
},
|
|
125
|
+
{typeName: "ForkchoiceUpdate"}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export const ExecutionPayloadEnvelopeBellatrix = new ContainerType(
|
|
129
|
+
{payload: ssz.bellatrix.ExecutionPayload},
|
|
130
|
+
{typeName: "ExecutionPayloadEnvelope"}
|
|
131
|
+
);
|
|
132
|
+
export const ExecutionPayloadEnvelopeCapella = new ContainerType(
|
|
133
|
+
{payload: ssz.capella.ExecutionPayload},
|
|
134
|
+
{typeName: "ExecutionPayloadEnvelope"}
|
|
135
|
+
);
|
|
136
|
+
export const ExecutionPayloadEnvelopeDeneb = new ContainerType(
|
|
137
|
+
{
|
|
138
|
+
payload: ssz.deneb.ExecutionPayload,
|
|
139
|
+
parentBeaconBlockRoot: Root,
|
|
140
|
+
},
|
|
141
|
+
{typeName: "ExecutionPayloadEnvelope"}
|
|
142
|
+
);
|
|
143
|
+
export const ExecutionPayloadEnvelopeElectra = new ContainerType(
|
|
144
|
+
{
|
|
145
|
+
payload: ssz.electra.ExecutionPayload,
|
|
146
|
+
parentBeaconBlockRoot: Root,
|
|
147
|
+
executionRequests: ExecutionRequestsList,
|
|
148
|
+
},
|
|
149
|
+
{typeName: "ExecutionPayloadEnvelope"}
|
|
150
|
+
);
|
|
151
|
+
export const ExecutionPayloadEnvelopeGloas = new ContainerType(
|
|
152
|
+
{
|
|
153
|
+
payload: ssz.gloas.ExecutionPayload,
|
|
154
|
+
parentBeaconBlockRoot: Root,
|
|
155
|
+
executionRequests: ExecutionRequestsList,
|
|
156
|
+
},
|
|
157
|
+
{typeName: "ExecutionPayloadEnvelope"}
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
export const BuiltPayloadBellatrix = new ContainerType(
|
|
161
|
+
{
|
|
162
|
+
payload: ssz.bellatrix.ExecutionPayload,
|
|
163
|
+
blockValue: UintBn256,
|
|
164
|
+
},
|
|
165
|
+
{typeName: "BuiltPayload"}
|
|
166
|
+
);
|
|
167
|
+
export const BuiltPayloadCapella = new ContainerType(
|
|
168
|
+
{
|
|
169
|
+
payload: ssz.capella.ExecutionPayload,
|
|
170
|
+
blockValue: UintBn256,
|
|
171
|
+
},
|
|
172
|
+
{typeName: "BuiltPayload"}
|
|
173
|
+
);
|
|
174
|
+
export const BuiltPayloadDeneb = new ContainerType(
|
|
175
|
+
{
|
|
176
|
+
payload: ssz.deneb.ExecutionPayload,
|
|
177
|
+
blockValue: UintBn256,
|
|
178
|
+
blobsBundle: ssz.deneb.BlobsBundle,
|
|
179
|
+
shouldOverrideBuilder: ssz.Boolean,
|
|
180
|
+
},
|
|
181
|
+
{typeName: "BuiltPayload"}
|
|
182
|
+
);
|
|
183
|
+
export const BuiltPayloadElectra = new ContainerType(
|
|
184
|
+
{
|
|
185
|
+
payload: ssz.electra.ExecutionPayload,
|
|
186
|
+
blockValue: UintBn256,
|
|
187
|
+
blobsBundle: ssz.deneb.BlobsBundle,
|
|
188
|
+
executionRequests: ExecutionRequestsList,
|
|
189
|
+
shouldOverrideBuilder: ssz.Boolean,
|
|
190
|
+
},
|
|
191
|
+
{typeName: "BuiltPayload"}
|
|
192
|
+
);
|
|
193
|
+
export const BuiltPayloadFulu = new ContainerType(
|
|
194
|
+
{
|
|
195
|
+
payload: ssz.fulu.ExecutionPayload,
|
|
196
|
+
blockValue: UintBn256,
|
|
197
|
+
blobsBundle: ssz.fulu.BlobsBundle,
|
|
198
|
+
executionRequests: ExecutionRequestsList,
|
|
199
|
+
shouldOverrideBuilder: ssz.Boolean,
|
|
200
|
+
},
|
|
201
|
+
{typeName: "BuiltPayload"}
|
|
202
|
+
);
|
|
203
|
+
export const BuiltPayloadGloas = new ContainerType(
|
|
204
|
+
{
|
|
205
|
+
payload: ssz.gloas.ExecutionPayload,
|
|
206
|
+
blockValue: UintBn256,
|
|
207
|
+
blobsBundle: ssz.fulu.BlobsBundle,
|
|
208
|
+
executionRequests: ExecutionRequestsList,
|
|
209
|
+
shouldOverrideBuilder: ssz.Boolean,
|
|
210
|
+
},
|
|
211
|
+
{typeName: "BuiltPayload"}
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
export const ExecutionPayloadBodyBellatrix = new ContainerType(
|
|
215
|
+
{transactions: ssz.bellatrix.Transactions},
|
|
216
|
+
{typeName: "ExecutionPayloadBody"}
|
|
217
|
+
);
|
|
218
|
+
export const ExecutionPayloadBodyCapella = new ContainerType(
|
|
219
|
+
{
|
|
220
|
+
transactions: ssz.bellatrix.Transactions,
|
|
221
|
+
withdrawals: ssz.capella.Withdrawals,
|
|
222
|
+
},
|
|
223
|
+
{typeName: "ExecutionPayloadBody"}
|
|
224
|
+
);
|
|
225
|
+
export const ExecutionPayloadBodyGloas = new ContainerType(
|
|
226
|
+
{
|
|
227
|
+
transactions: ssz.bellatrix.Transactions,
|
|
228
|
+
withdrawals: ssz.capella.Withdrawals,
|
|
229
|
+
blockAccessList: new ByteListType(MAX_BAL_BYTES),
|
|
230
|
+
},
|
|
231
|
+
{typeName: "ExecutionPayloadBody"}
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
function BodiesResponseType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(body: T) {
|
|
235
|
+
const BodyEntry = new ContainerType({available: ssz.Boolean, body}, {typeName: "BodyEntry"});
|
|
236
|
+
return new ContainerType(
|
|
237
|
+
{entries: new ListCompositeType(BodyEntry, MAX_BODIES_REQUEST)},
|
|
238
|
+
{typeName: "BodiesResponse"}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export const BodiesResponseBellatrix = BodiesResponseType(ExecutionPayloadBodyBellatrix);
|
|
243
|
+
export const BodiesResponseCapella = BodiesResponseType(ExecutionPayloadBodyCapella);
|
|
244
|
+
export const BodiesResponseGloas = BodiesResponseType(ExecutionPayloadBodyGloas);
|
|
245
|
+
|
|
246
|
+
export const BodiesByHashRequest = new ContainerType(
|
|
247
|
+
{blockHashes: new ListCompositeType(Bytes32, MAX_BODIES_REQUEST)},
|
|
248
|
+
{typeName: "BodiesByHashRequest"}
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
export const BlobsRequest = new ContainerType(
|
|
252
|
+
{versionedHashes: new ListCompositeType(Bytes32, MAX_BLOBS_REQUEST)},
|
|
253
|
+
{typeName: "BlobsRequest"}
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const BlobAndProofV1 = new ContainerType(
|
|
257
|
+
{
|
|
258
|
+
blob: ssz.deneb.Blob,
|
|
259
|
+
proof: Bytes48,
|
|
260
|
+
},
|
|
261
|
+
{typeName: "BlobAndProofV1"}
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const BlobAndProofV2 = new ContainerType(
|
|
265
|
+
{
|
|
266
|
+
blob: ssz.deneb.Blob,
|
|
267
|
+
proofs: new ListCompositeType(Bytes48, CELLS_PER_EXT_BLOB),
|
|
268
|
+
},
|
|
269
|
+
{typeName: "BlobAndProofV2"}
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
function BlobsResponseType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(contents: T) {
|
|
273
|
+
const BlobEntry = new ContainerType({available: ssz.Boolean, contents}, {typeName: "BlobEntry"});
|
|
274
|
+
return new ContainerType({entries: new ListCompositeType(BlobEntry, MAX_BLOBS_REQUEST)}, {typeName: "BlobsResponse"});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export const BlobsV1Response = BlobsResponseType(BlobAndProofV1);
|
|
278
|
+
export const BlobsV2Response = BlobsResponseType(BlobAndProofV2);
|
|
279
|
+
|
|
280
|
+
const bellatrix = {
|
|
281
|
+
PayloadAttributes: PayloadAttributesBellatrix,
|
|
282
|
+
ForkchoiceUpdate: ForkchoiceUpdateBellatrix,
|
|
283
|
+
ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeBellatrix,
|
|
284
|
+
BuiltPayload: BuiltPayloadBellatrix,
|
|
285
|
+
BodiesResponse: BodiesResponseBellatrix,
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const capella = {
|
|
289
|
+
PayloadAttributes: PayloadAttributesCapella,
|
|
290
|
+
ForkchoiceUpdate: ForkchoiceUpdateCapella,
|
|
291
|
+
ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeCapella,
|
|
292
|
+
BuiltPayload: BuiltPayloadCapella,
|
|
293
|
+
BodiesResponse: BodiesResponseCapella,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const deneb = {
|
|
297
|
+
PayloadAttributes: PayloadAttributesDeneb,
|
|
298
|
+
ForkchoiceUpdate: ForkchoiceUpdateDeneb,
|
|
299
|
+
ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeDeneb,
|
|
300
|
+
BuiltPayload: BuiltPayloadDeneb,
|
|
301
|
+
BodiesResponse: BodiesResponseCapella,
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
const electra = {
|
|
305
|
+
...deneb,
|
|
306
|
+
ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeElectra,
|
|
307
|
+
BuiltPayload: BuiltPayloadElectra,
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const fulu = {
|
|
311
|
+
...electra,
|
|
312
|
+
BuiltPayload: BuiltPayloadFulu,
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const gloas = {
|
|
316
|
+
PayloadAttributes: PayloadAttributesGloas,
|
|
317
|
+
ForkchoiceUpdate: ForkchoiceUpdateGloas,
|
|
318
|
+
ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeGloas,
|
|
319
|
+
BuiltPayload: BuiltPayloadGloas,
|
|
320
|
+
BodiesResponse: BodiesResponseGloas,
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export const engineSszTypes = {
|
|
324
|
+
[ForkName.bellatrix]: bellatrix,
|
|
325
|
+
[ForkName.capella]: capella,
|
|
326
|
+
[ForkName.deneb]: deneb,
|
|
327
|
+
[ForkName.electra]: electra,
|
|
328
|
+
[ForkName.fulu]: fulu,
|
|
329
|
+
[ForkName.gloas]: gloas,
|
|
330
|
+
[ForkName.heze]: gloas,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export type PayloadStatusSsz = ValueOf<typeof PayloadStatus>;
|
|
334
|
+
|
|
335
|
+
/** Fork names accepted in the `Eth-Execution-Version` header */
|
|
336
|
+
export type ExecutionForkName = "paris" | "shanghai" | "cancun" | "prague" | "osaka" | "amsterdam";
|
|
337
|
+
|
|
338
|
+
/** Heze has no execution fork name in the spec yet, auto mode serves it over JSON-RPC and ssz mode fails the call */
|
|
339
|
+
export const executionForkName: Record<ForkPostBellatrix, ExecutionForkName | null> = {
|
|
340
|
+
[ForkName.bellatrix]: "paris",
|
|
341
|
+
[ForkName.capella]: "shanghai",
|
|
342
|
+
[ForkName.deneb]: "cancun",
|
|
343
|
+
[ForkName.electra]: "prague",
|
|
344
|
+
[ForkName.fulu]: "osaka",
|
|
345
|
+
[ForkName.gloas]: "amsterdam",
|
|
346
|
+
[ForkName.heze]: null,
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export enum PayloadStatusCode {
|
|
350
|
+
VALID = 0,
|
|
351
|
+
INVALID = 1,
|
|
352
|
+
SYNCING = 2,
|
|
353
|
+
ACCEPTED = 3,
|
|
354
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {ForkName} from "@lodestar/params";
|
|
2
|
+
import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types";
|
|
3
|
+
import {BlobAndProof} from "@lodestar/types/deneb";
|
|
4
|
+
import {BlobAndProofV2} from "@lodestar/types/fulu";
|
|
5
|
+
import {ClientVersion, ExecutionPayloadStatus, PayloadAttributes, PayloadId, VersionedHashes} from "./interface.js";
|
|
6
|
+
import {JsonRpcHttpClientEventEmitter} from "./jsonRpcHttpClient.js";
|
|
7
|
+
import {ExecutionPayloadBodyV2} from "./types.js";
|
|
8
|
+
|
|
9
|
+
export type PayloadStatusResult = {
|
|
10
|
+
status: ExecutionPayloadStatus;
|
|
11
|
+
latestValidHash: RootHex | null;
|
|
12
|
+
validationError: string | null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ForkchoiceUpdatedResult = {
|
|
16
|
+
payloadStatus: PayloadStatusResult;
|
|
17
|
+
payloadId: PayloadId | null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type GetPayloadResult = {
|
|
21
|
+
executionPayload: ExecutionPayload;
|
|
22
|
+
executionPayloadValue: Wei;
|
|
23
|
+
blobsBundle?: BlobsBundle;
|
|
24
|
+
executionRequests?: ExecutionRequests;
|
|
25
|
+
shouldOverrideBuilder?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Wire-level access to the engine API of the execution client. Implementations only translate
|
|
30
|
+
* between Lodestar types and the encoding of their transport, `ExecutionEngineHttp` owns request
|
|
31
|
+
* ordering, engine state and result interpretation.
|
|
32
|
+
*/
|
|
33
|
+
export interface IEngineTransport {
|
|
34
|
+
readonly emitter: JsonRpcHttpClientEventEmitter;
|
|
35
|
+
|
|
36
|
+
newPayload(
|
|
37
|
+
fork: ForkName,
|
|
38
|
+
executionPayload: ExecutionPayload,
|
|
39
|
+
versionedHashes?: VersionedHashes,
|
|
40
|
+
parentBeaconBlockRoot?: Root,
|
|
41
|
+
executionRequests?: ExecutionRequests
|
|
42
|
+
): Promise<PayloadStatusResult>;
|
|
43
|
+
|
|
44
|
+
forkchoiceUpdated(
|
|
45
|
+
fork: ForkName,
|
|
46
|
+
headBlockHash: RootHex,
|
|
47
|
+
safeBlockHash: RootHex,
|
|
48
|
+
finalizedBlockHash: RootHex,
|
|
49
|
+
payloadAttributes?: PayloadAttributes
|
|
50
|
+
): Promise<ForkchoiceUpdatedResult>;
|
|
51
|
+
|
|
52
|
+
getPayload(fork: ForkName, payloadId: PayloadId): Promise<GetPayloadResult>;
|
|
53
|
+
|
|
54
|
+
getPayloadBodiesByHashV2(blockHashes: RootHex[]): Promise<(ExecutionPayloadBodyV2 | null)[]>;
|
|
55
|
+
|
|
56
|
+
getBlobsV1(versionedHashes: VersionedHashes): Promise<(BlobAndProof | null)[]>;
|
|
57
|
+
|
|
58
|
+
getBlobsV2(versionedHashes: VersionedHashes, buffers?: Uint8Array[]): Promise<BlobAndProofV2[] | null>;
|
|
59
|
+
|
|
60
|
+
getClientVersion(clientVersion: ClientVersion): Promise<ClientVersion[]>;
|
|
61
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Counter} from "@lodestar/utils";
|
|
1
|
+
import {Counter, Histogram} from "@lodestar/utils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Common metrics type for both json rpc and ssz transport.
|
|
@@ -6,4 +6,5 @@ import {Counter} from "@lodestar/utils";
|
|
|
6
6
|
export type EngineTransportMetrics = {
|
|
7
7
|
requestBytes: Counter<{routeId: string}>;
|
|
8
8
|
responseBytes: Counter<{routeId: string}>;
|
|
9
|
+
responseParseTime: Histogram<{routeId: string; encoding: "json" | "ssz"}>;
|
|
9
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Type} from "@chainsafe/ssz";
|
|
1
2
|
import {
|
|
2
3
|
BUILDER_DEPOSIT_REQUEST_TYPE,
|
|
3
4
|
BUILDER_EXIT_REQUEST_TYPE,
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
bellatrix,
|
|
21
22
|
capella,
|
|
22
23
|
deneb,
|
|
23
|
-
electra,
|
|
24
24
|
gloas,
|
|
25
25
|
ssz,
|
|
26
26
|
} from "@lodestar/types";
|
|
@@ -88,15 +88,8 @@ export type EngineApiRpcParamTypes = {
|
|
|
88
88
|
/**
|
|
89
89
|
* 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
|
|
90
90
|
* */
|
|
91
|
-
engine_getPayloadBodiesByHashV1: DATA[][];
|
|
92
91
|
engine_getPayloadBodiesByHashV2: DATA[][];
|
|
93
92
|
|
|
94
|
-
/**
|
|
95
|
-
* 1. start: QUANTITY, 64 bits - Starting block number
|
|
96
|
-
* 2. count: QUANTITY, 64 bits - Number of blocks to return
|
|
97
|
-
*/
|
|
98
|
-
engine_getPayloadBodiesByRangeV1: [start: QUANTITY, count: QUANTITY];
|
|
99
|
-
|
|
100
93
|
/**
|
|
101
94
|
* Object - Instance of ClientVersion
|
|
102
95
|
*/
|
|
@@ -148,11 +141,8 @@ export type EngineApiRpcReturnTypes = {
|
|
|
148
141
|
engine_getPayloadV5: ExecutionPayloadResponse;
|
|
149
142
|
engine_getPayloadV6: ExecutionPayloadResponse;
|
|
150
143
|
|
|
151
|
-
engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
|
|
152
144
|
engine_getPayloadBodiesByHashV2: (ExecutionPayloadBodyV2Rpc | null)[];
|
|
153
145
|
|
|
154
|
-
engine_getPayloadBodiesByRangeV1: (ExecutionPayloadBodyRpc | null)[];
|
|
155
|
-
|
|
156
146
|
engine_getClientVersionV1: ClientVersionRpc[];
|
|
157
147
|
|
|
158
148
|
engine_getBlobsV1: (BlobAndProofRpc | null)[];
|
|
@@ -511,63 +501,15 @@ export function deserializeWithdrawal(serialized: WithdrawalRpc): capella.Withdr
|
|
|
511
501
|
}
|
|
512
502
|
|
|
513
503
|
/**
|
|
514
|
-
*
|
|
504
|
+
* Serialize requests prefixed with a single-byte requestType in one allocation
|
|
515
505
|
*/
|
|
516
|
-
function
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
return prefixedRequests;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function serializeDepositRequests(depositRequests: electra.DepositRequests): DepositRequestsRpc {
|
|
525
|
-
const requestsBytes = ssz.electra.DepositRequests.serialize(depositRequests);
|
|
526
|
-
return bytesToData(prefixRequests(requestsBytes, DEPOSIT_REQUEST_TYPE));
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
function deserializeDepositRequests(serialized: DepositRequestsRpc): electra.DepositRequests {
|
|
530
|
-
return ssz.electra.DepositRequests.deserialize(dataToBytes(serialized, null));
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
function serializeWithdrawalRequests(withdrawalRequests: electra.WithdrawalRequests): WithdrawalRequestsRpc {
|
|
534
|
-
const requestsBytes = ssz.electra.WithdrawalRequests.serialize(withdrawalRequests);
|
|
535
|
-
return bytesToData(prefixRequests(requestsBytes, WITHDRAWAL_REQUEST_TYPE));
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function deserializeWithdrawalRequests(serialized: WithdrawalRequestsRpc): electra.WithdrawalRequests {
|
|
539
|
-
return ssz.electra.WithdrawalRequests.deserialize(dataToBytes(serialized, null));
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function serializeConsolidationRequests(
|
|
543
|
-
consolidationRequests: electra.ConsolidationRequests
|
|
544
|
-
): ConsolidationRequestsRpc {
|
|
545
|
-
const requestsBytes = ssz.electra.ConsolidationRequests.serialize(consolidationRequests);
|
|
546
|
-
return bytesToData(prefixRequests(requestsBytes, CONSOLIDATION_REQUEST_TYPE));
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
function deserializeConsolidationRequests(serialized: ConsolidationRequestsRpc): electra.ConsolidationRequests {
|
|
550
|
-
return ssz.electra.ConsolidationRequests.deserialize(dataToBytes(serialized, null));
|
|
551
|
-
}
|
|
506
|
+
function serializePrefixedRequests<T>(type: Type<T>, requests: T, requestType: ExecutionRequestType): Uint8Array {
|
|
507
|
+
const uint8Array = new Uint8Array(1 + type.value_serializedSize(requests));
|
|
508
|
+
const dataView = new DataView(uint8Array.buffer, uint8Array.byteOffset, uint8Array.byteLength);
|
|
509
|
+
uint8Array[0] = requestType;
|
|
510
|
+
type.value_serializeToBytes({uint8Array, dataView}, 1, requests);
|
|
552
511
|
|
|
553
|
-
|
|
554
|
-
builderDepositRequests: gloas.BuilderDepositRequests
|
|
555
|
-
): BuilderDepositRequestsRpc {
|
|
556
|
-
const requestsBytes = ssz.gloas.BuilderDepositRequests.serialize(builderDepositRequests);
|
|
557
|
-
return bytesToData(prefixRequests(requestsBytes, BUILDER_DEPOSIT_REQUEST_TYPE));
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
function deserializeBuilderDepositRequests(serialized: BuilderDepositRequestsRpc): gloas.BuilderDepositRequests {
|
|
561
|
-
return ssz.gloas.BuilderDepositRequests.deserialize(dataToBytes(serialized, null));
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function serializeBuilderExitRequests(builderExitRequests: gloas.BuilderExitRequests): BuilderExitRequestsRpc {
|
|
565
|
-
const requestsBytes = ssz.gloas.BuilderExitRequests.serialize(builderExitRequests);
|
|
566
|
-
return bytesToData(prefixRequests(requestsBytes, BUILDER_EXIT_REQUEST_TYPE));
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
function deserializeBuilderExitRequests(serialized: BuilderExitRequestsRpc): gloas.BuilderExitRequests {
|
|
570
|
-
return ssz.gloas.BuilderExitRequests.deserialize(dataToBytes(serialized, null));
|
|
512
|
+
return uint8Array;
|
|
571
513
|
}
|
|
572
514
|
|
|
573
515
|
/**
|
|
@@ -577,62 +519,65 @@ function deserializeBuilderExitRequests(serialized: BuilderExitRequestsRpc): glo
|
|
|
577
519
|
* Gloas extends the list with builder deposits (0x03) and builder exits (0x04) per
|
|
578
520
|
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#modified-get_execution_requests_list
|
|
579
521
|
*/
|
|
580
|
-
export function
|
|
522
|
+
export function serializeExecutionRequestsToBytes(fork: ForkName, executionRequests: ExecutionRequests): Uint8Array[] {
|
|
581
523
|
const {deposits, withdrawals, consolidations} = executionRequests;
|
|
582
|
-
const result:
|
|
524
|
+
const result: Uint8Array[] = [];
|
|
583
525
|
|
|
584
526
|
if (deposits.length !== 0) {
|
|
585
|
-
result.push(
|
|
527
|
+
result.push(serializePrefixedRequests(ssz.electra.DepositRequests, deposits, DEPOSIT_REQUEST_TYPE));
|
|
586
528
|
}
|
|
587
529
|
|
|
588
530
|
if (withdrawals.length !== 0) {
|
|
589
|
-
result.push(
|
|
531
|
+
result.push(serializePrefixedRequests(ssz.electra.WithdrawalRequests, withdrawals, WITHDRAWAL_REQUEST_TYPE));
|
|
590
532
|
}
|
|
591
533
|
|
|
592
534
|
if (consolidations.length !== 0) {
|
|
593
|
-
result.push(
|
|
535
|
+
result.push(
|
|
536
|
+
serializePrefixedRequests(ssz.electra.ConsolidationRequests, consolidations, CONSOLIDATION_REQUEST_TYPE)
|
|
537
|
+
);
|
|
594
538
|
}
|
|
595
539
|
|
|
596
540
|
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
597
541
|
const {builderDeposits, builderExits} = executionRequests as gloas.ExecutionRequests;
|
|
598
542
|
|
|
599
543
|
if (builderDeposits.length !== 0) {
|
|
600
|
-
result.push(
|
|
544
|
+
result.push(
|
|
545
|
+
serializePrefixedRequests(ssz.gloas.BuilderDepositRequests, builderDeposits, BUILDER_DEPOSIT_REQUEST_TYPE)
|
|
546
|
+
);
|
|
601
547
|
}
|
|
602
548
|
|
|
603
549
|
if (builderExits.length !== 0) {
|
|
604
|
-
result.push(
|
|
550
|
+
result.push(serializePrefixedRequests(ssz.gloas.BuilderExitRequests, builderExits, BUILDER_EXIT_REQUEST_TYPE));
|
|
605
551
|
}
|
|
606
552
|
}
|
|
607
553
|
|
|
608
554
|
return result;
|
|
609
555
|
}
|
|
610
556
|
|
|
611
|
-
export function
|
|
557
|
+
export function serializeExecutionRequests(fork: ForkName, executionRequests: ExecutionRequests): ExecutionRequestsRpc {
|
|
558
|
+
return serializeExecutionRequestsToBytes(fork, executionRequests).map(bytesToData);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export function deserializeExecutionRequestsFromBytes(fork: ForkName, serialized: Uint8Array[]): ExecutionRequests {
|
|
612
562
|
const result: ExecutionRequests =
|
|
613
563
|
ForkSeq[fork] >= ForkSeq.gloas
|
|
614
564
|
? {deposits: [], withdrawals: [], consolidations: [], builderDeposits: [], builderExits: []}
|
|
615
565
|
: {deposits: [], withdrawals: [], consolidations: []};
|
|
616
566
|
|
|
617
|
-
if (serialized.length === 0) {
|
|
618
|
-
return result;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
567
|
let prevRequestType: ExecutionRequestType | undefined;
|
|
622
568
|
|
|
623
|
-
for (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
prefixedRequests = prefixedRequests.slice(2);
|
|
569
|
+
for (const prefixedRequests of serialized) {
|
|
570
|
+
if (prefixedRequests.length === 0) {
|
|
571
|
+
throw Error("Invalid request type, request must be prefixed with its type");
|
|
627
572
|
}
|
|
628
573
|
|
|
629
|
-
const currentRequestType =
|
|
574
|
+
const currentRequestType = prefixedRequests[0];
|
|
630
575
|
|
|
631
576
|
if (!isExecutionRequestType(currentRequestType)) {
|
|
632
|
-
throw Error(`Invalid request type currentRequestType=${
|
|
577
|
+
throw Error(`Invalid request type currentRequestType=${currentRequestType}`);
|
|
633
578
|
}
|
|
634
579
|
|
|
635
|
-
const requests = prefixedRequests.
|
|
580
|
+
const requests = prefixedRequests.subarray(1);
|
|
636
581
|
|
|
637
582
|
if (requests.length === 0) {
|
|
638
583
|
throw Error(
|
|
@@ -648,29 +593,29 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
|
|
|
648
593
|
|
|
649
594
|
switch (currentRequestType) {
|
|
650
595
|
case DEPOSIT_REQUEST_TYPE: {
|
|
651
|
-
result.deposits =
|
|
596
|
+
result.deposits = ssz.electra.DepositRequests.deserialize(requests);
|
|
652
597
|
break;
|
|
653
598
|
}
|
|
654
599
|
case WITHDRAWAL_REQUEST_TYPE: {
|
|
655
|
-
result.withdrawals =
|
|
600
|
+
result.withdrawals = ssz.electra.WithdrawalRequests.deserialize(requests);
|
|
656
601
|
break;
|
|
657
602
|
}
|
|
658
603
|
case CONSOLIDATION_REQUEST_TYPE: {
|
|
659
|
-
result.consolidations =
|
|
604
|
+
result.consolidations = ssz.electra.ConsolidationRequests.deserialize(requests);
|
|
660
605
|
break;
|
|
661
606
|
}
|
|
662
607
|
case BUILDER_DEPOSIT_REQUEST_TYPE: {
|
|
663
608
|
if (ForkSeq[fork] < ForkSeq.gloas) {
|
|
664
609
|
throw Error(`Builder deposit request is not supported pre-gloas fork=${fork}`);
|
|
665
610
|
}
|
|
666
|
-
(result as gloas.ExecutionRequests).builderDeposits =
|
|
611
|
+
(result as gloas.ExecutionRequests).builderDeposits = ssz.gloas.BuilderDepositRequests.deserialize(requests);
|
|
667
612
|
break;
|
|
668
613
|
}
|
|
669
614
|
case BUILDER_EXIT_REQUEST_TYPE: {
|
|
670
615
|
if (ForkSeq[fork] < ForkSeq.gloas) {
|
|
671
616
|
throw Error(`Builder exit request is not supported pre-gloas fork=${fork}`);
|
|
672
617
|
}
|
|
673
|
-
(result as gloas.ExecutionRequests).builderExits =
|
|
618
|
+
(result as gloas.ExecutionRequests).builderExits = ssz.gloas.BuilderExitRequests.deserialize(requests);
|
|
674
619
|
break;
|
|
675
620
|
}
|
|
676
621
|
}
|
|
@@ -680,6 +625,13 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
|
|
|
680
625
|
return result;
|
|
681
626
|
}
|
|
682
627
|
|
|
628
|
+
export function deserializeExecutionRequests(fork: ForkName, serialized: ExecutionRequestsRpc): ExecutionRequests {
|
|
629
|
+
return deserializeExecutionRequestsFromBytes(
|
|
630
|
+
fork,
|
|
631
|
+
serialized.map((data) => dataToBytes(data, null))
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
683
635
|
export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc | null): ExecutionPayloadBody | null {
|
|
684
636
|
return data
|
|
685
637
|
? {
|