@lodestar/beacon-node 1.50.0-dev.fef46df5ba → 1.50.0-rc.0
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 +6 -1
- 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/pool/index.js +4 -4
- 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 +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 +49 -1
- package/lib/api/impl/validator/index.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/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +18 -8
- 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 -36
- 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 +3 -1
- package/lib/chain/errors/gossipValidation.d.ts.map +1 -1
- package/lib/chain/errors/gossipValidation.js +2 -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 +5 -2
- 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 +5 -4
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +60 -38
- 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 +15 -1
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +33 -1
- 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 +16 -5
- package/lib/chain/prepareNextSlot.js.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 +46 -30
- 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/seenCache/seenGossipBlockInput.d.ts +7 -0
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +21 -0
- 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/validation/attesterSlashing.d.ts +4 -4
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +3 -0
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.d.ts +3 -3
- package/lib/chain/validation/proposerSlashing.d.ts.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +3 -0
- package/lib/chain/validation/proposerSlashing.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 +64 -54
- package/lib/chain/validatorMonitor.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/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.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/db/repositories/proposerSlashing.d.ts +1 -0
- package/lib/db/repositories/proposerSlashing.d.ts.map +1 -1
- package/lib/db/repositories/proposerSlashing.js +5 -1
- package/lib/db/repositories/proposerSlashing.js.map +1 -1
- 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/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 +46 -0
- package/lib/execution/engine/restTransport.d.ts.map +1 -0
- package/lib/execution/engine/restTransport.js +399 -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/types.d.ts +2 -8
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +24 -57
- 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 +10 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +22 -0
- 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/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +67 -68
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts +7 -3
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +7 -3
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts +9 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +77 -10
- 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/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/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 +49 -24
- 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/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/package.json +18 -17
- package/src/api/impl/beacon/blocks/index.ts +7 -4
- package/src/api/impl/beacon/index.ts +15 -0
- package/src/api/impl/beacon/pool/index.ts +4 -4
- 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 +61 -2
- 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/importBlock.ts +21 -7
- 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 -38
- package/src/chain/emitter.ts +7 -1
- package/src/chain/errors/envelopeReconstructionError.ts +3 -0
- package/src/chain/errors/gossipValidation.ts +2 -0
- package/src/chain/forkChoice/index.ts +2 -0
- package/src/chain/interface.ts +5 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +34 -10
- package/src/chain/opPools/opPool.ts +89 -46
- package/src/chain/opPools/proposerPreferencesPool.ts +34 -11
- package/src/chain/opPools/utils.ts +62 -3
- package/src/chain/options.ts +3 -3
- package/src/chain/prepareNextSlot.ts +21 -6
- package/src/chain/produceBlock/computeNewStateRoot.ts +1 -1
- package/src/chain/produceBlock/produceBlockBody.ts +76 -35
- package/src/chain/regen/regen.ts +12 -4
- package/src/chain/seenCache/seenGossipBlockInput.ts +23 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +31 -13
- package/src/chain/shufflingCache.ts +84 -22
- package/src/chain/validation/attesterSlashing.ts +7 -4
- package/src/chain/validation/proposerSlashing.ts +7 -4
- package/src/chain/validatorMonitor.ts +75 -57
- 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/earliestAvailableSlot.ts +19 -0
- package/src/db/repositories/index.ts +1 -0
- package/src/db/repositories/proposerPreferences.ts +23 -0
- package/src/db/repositories/proposerSlashing.ts +6 -1
- 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 +41 -7
- package/src/execution/engine/interface.ts +2 -6
- 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 +544 -0
- package/src/execution/engine/sszTypes.ts +354 -0
- package/src/execution/engine/transport.ts +61 -0
- package/src/execution/engine/types.ts +34 -84
- package/src/execution/engine/utils.ts +12 -2
- package/src/metrics/metrics/lodestar.ts +23 -0
- package/src/metrics/metrics.ts +21 -6
- package/src/network/core/events.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +98 -81
- package/src/network/processor/gossipValidatorFn.ts +13 -3
- package/src/network/processor/index.ts +89 -10
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +1 -1
- package/src/node/nodejs.ts +35 -3
- 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 +62 -25
- package/src/sync/utils/downloadByRange.ts +123 -58
- package/src/util/asyncIterableToEvents.ts +44 -5
- package/src/util/execution.ts +16 -8
- package/src/util/metadata.ts +2 -1
|
@@ -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
|
+
}
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
bellatrix,
|
|
21
21
|
capella,
|
|
22
22
|
deneb,
|
|
23
|
-
electra,
|
|
24
23
|
gloas,
|
|
25
24
|
ssz,
|
|
26
25
|
} from "@lodestar/types";
|
|
@@ -88,15 +87,8 @@ export type EngineApiRpcParamTypes = {
|
|
|
88
87
|
/**
|
|
89
88
|
* 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
|
|
90
89
|
* */
|
|
91
|
-
engine_getPayloadBodiesByHashV1: DATA[][];
|
|
92
90
|
engine_getPayloadBodiesByHashV2: DATA[][];
|
|
93
91
|
|
|
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
92
|
/**
|
|
101
93
|
* Object - Instance of ClientVersion
|
|
102
94
|
*/
|
|
@@ -148,11 +140,8 @@ export type EngineApiRpcReturnTypes = {
|
|
|
148
140
|
engine_getPayloadV5: ExecutionPayloadResponse;
|
|
149
141
|
engine_getPayloadV6: ExecutionPayloadResponse;
|
|
150
142
|
|
|
151
|
-
engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
|
|
152
143
|
engine_getPayloadBodiesByHashV2: (ExecutionPayloadBodyV2Rpc | null)[];
|
|
153
144
|
|
|
154
|
-
engine_getPayloadBodiesByRangeV1: (ExecutionPayloadBodyRpc | null)[];
|
|
155
|
-
|
|
156
145
|
engine_getClientVersionV1: ClientVersionRpc[];
|
|
157
146
|
|
|
158
147
|
engine_getBlobsV1: (BlobAndProofRpc | null)[];
|
|
@@ -521,55 +510,6 @@ function prefixRequests(requestsBytes: Uint8Array, requestType: ExecutionRequest
|
|
|
521
510
|
return prefixedRequests;
|
|
522
511
|
}
|
|
523
512
|
|
|
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
|
-
}
|
|
552
|
-
|
|
553
|
-
function serializeBuilderDepositRequests(
|
|
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));
|
|
571
|
-
}
|
|
572
|
-
|
|
573
513
|
/**
|
|
574
514
|
* This is identical to get_execution_requests_list in
|
|
575
515
|
* https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/electra/beacon-chain.md#new-get_execution_requests_list
|
|
@@ -577,62 +517,65 @@ function deserializeBuilderExitRequests(serialized: BuilderExitRequestsRpc): glo
|
|
|
577
517
|
* Gloas extends the list with builder deposits (0x03) and builder exits (0x04) per
|
|
578
518
|
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#modified-get_execution_requests_list
|
|
579
519
|
*/
|
|
580
|
-
export function
|
|
520
|
+
export function serializeExecutionRequestsToBytes(fork: ForkName, executionRequests: ExecutionRequests): Uint8Array[] {
|
|
581
521
|
const {deposits, withdrawals, consolidations} = executionRequests;
|
|
582
|
-
const result:
|
|
522
|
+
const result: Uint8Array[] = [];
|
|
583
523
|
|
|
584
524
|
if (deposits.length !== 0) {
|
|
585
|
-
result.push(
|
|
525
|
+
result.push(prefixRequests(ssz.electra.DepositRequests.serialize(deposits), DEPOSIT_REQUEST_TYPE));
|
|
586
526
|
}
|
|
587
527
|
|
|
588
528
|
if (withdrawals.length !== 0) {
|
|
589
|
-
result.push(
|
|
529
|
+
result.push(prefixRequests(ssz.electra.WithdrawalRequests.serialize(withdrawals), WITHDRAWAL_REQUEST_TYPE));
|
|
590
530
|
}
|
|
591
531
|
|
|
592
532
|
if (consolidations.length !== 0) {
|
|
593
|
-
result.push(
|
|
533
|
+
result.push(
|
|
534
|
+
prefixRequests(ssz.electra.ConsolidationRequests.serialize(consolidations), CONSOLIDATION_REQUEST_TYPE)
|
|
535
|
+
);
|
|
594
536
|
}
|
|
595
537
|
|
|
596
538
|
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
597
539
|
const {builderDeposits, builderExits} = executionRequests as gloas.ExecutionRequests;
|
|
598
540
|
|
|
599
541
|
if (builderDeposits.length !== 0) {
|
|
600
|
-
result.push(
|
|
542
|
+
result.push(
|
|
543
|
+
prefixRequests(ssz.gloas.BuilderDepositRequests.serialize(builderDeposits), BUILDER_DEPOSIT_REQUEST_TYPE)
|
|
544
|
+
);
|
|
601
545
|
}
|
|
602
546
|
|
|
603
547
|
if (builderExits.length !== 0) {
|
|
604
|
-
result.push(
|
|
548
|
+
result.push(prefixRequests(ssz.gloas.BuilderExitRequests.serialize(builderExits), BUILDER_EXIT_REQUEST_TYPE));
|
|
605
549
|
}
|
|
606
550
|
}
|
|
607
551
|
|
|
608
552
|
return result;
|
|
609
553
|
}
|
|
610
554
|
|
|
611
|
-
export function
|
|
555
|
+
export function serializeExecutionRequests(fork: ForkName, executionRequests: ExecutionRequests): ExecutionRequestsRpc {
|
|
556
|
+
return serializeExecutionRequestsToBytes(fork, executionRequests).map(bytesToData);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export function deserializeExecutionRequestsFromBytes(fork: ForkName, serialized: Uint8Array[]): ExecutionRequests {
|
|
612
560
|
const result: ExecutionRequests =
|
|
613
561
|
ForkSeq[fork] >= ForkSeq.gloas
|
|
614
562
|
? {deposits: [], withdrawals: [], consolidations: [], builderDeposits: [], builderExits: []}
|
|
615
563
|
: {deposits: [], withdrawals: [], consolidations: []};
|
|
616
564
|
|
|
617
|
-
if (serialized.length === 0) {
|
|
618
|
-
return result;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
565
|
let prevRequestType: ExecutionRequestType | undefined;
|
|
622
566
|
|
|
623
|
-
for (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
prefixedRequests = prefixedRequests.slice(2);
|
|
567
|
+
for (const prefixedRequests of serialized) {
|
|
568
|
+
if (prefixedRequests.length === 0) {
|
|
569
|
+
throw Error("Invalid request type, request must be prefixed with its type");
|
|
627
570
|
}
|
|
628
571
|
|
|
629
|
-
const currentRequestType =
|
|
572
|
+
const currentRequestType = prefixedRequests[0];
|
|
630
573
|
|
|
631
574
|
if (!isExecutionRequestType(currentRequestType)) {
|
|
632
|
-
throw Error(`Invalid request type currentRequestType=${
|
|
575
|
+
throw Error(`Invalid request type currentRequestType=${currentRequestType}`);
|
|
633
576
|
}
|
|
634
577
|
|
|
635
|
-
const requests = prefixedRequests.
|
|
578
|
+
const requests = prefixedRequests.subarray(1);
|
|
636
579
|
|
|
637
580
|
if (requests.length === 0) {
|
|
638
581
|
throw Error(
|
|
@@ -648,29 +591,29 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
|
|
|
648
591
|
|
|
649
592
|
switch (currentRequestType) {
|
|
650
593
|
case DEPOSIT_REQUEST_TYPE: {
|
|
651
|
-
result.deposits =
|
|
594
|
+
result.deposits = ssz.electra.DepositRequests.deserialize(requests);
|
|
652
595
|
break;
|
|
653
596
|
}
|
|
654
597
|
case WITHDRAWAL_REQUEST_TYPE: {
|
|
655
|
-
result.withdrawals =
|
|
598
|
+
result.withdrawals = ssz.electra.WithdrawalRequests.deserialize(requests);
|
|
656
599
|
break;
|
|
657
600
|
}
|
|
658
601
|
case CONSOLIDATION_REQUEST_TYPE: {
|
|
659
|
-
result.consolidations =
|
|
602
|
+
result.consolidations = ssz.electra.ConsolidationRequests.deserialize(requests);
|
|
660
603
|
break;
|
|
661
604
|
}
|
|
662
605
|
case BUILDER_DEPOSIT_REQUEST_TYPE: {
|
|
663
606
|
if (ForkSeq[fork] < ForkSeq.gloas) {
|
|
664
607
|
throw Error(`Builder deposit request is not supported pre-gloas fork=${fork}`);
|
|
665
608
|
}
|
|
666
|
-
(result as gloas.ExecutionRequests).builderDeposits =
|
|
609
|
+
(result as gloas.ExecutionRequests).builderDeposits = ssz.gloas.BuilderDepositRequests.deserialize(requests);
|
|
667
610
|
break;
|
|
668
611
|
}
|
|
669
612
|
case BUILDER_EXIT_REQUEST_TYPE: {
|
|
670
613
|
if (ForkSeq[fork] < ForkSeq.gloas) {
|
|
671
614
|
throw Error(`Builder exit request is not supported pre-gloas fork=${fork}`);
|
|
672
615
|
}
|
|
673
|
-
(result as gloas.ExecutionRequests).builderExits =
|
|
616
|
+
(result as gloas.ExecutionRequests).builderExits = ssz.gloas.BuilderExitRequests.deserialize(requests);
|
|
674
617
|
break;
|
|
675
618
|
}
|
|
676
619
|
}
|
|
@@ -680,6 +623,13 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
|
|
|
680
623
|
return result;
|
|
681
624
|
}
|
|
682
625
|
|
|
626
|
+
export function deserializeExecutionRequests(fork: ForkName, serialized: ExecutionRequestsRpc): ExecutionRequests {
|
|
627
|
+
return deserializeExecutionRequestsFromBytes(
|
|
628
|
+
fork,
|
|
629
|
+
serialized.map((data) => dataToBytes(data, null))
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
683
633
|
export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc | null): ExecutionPayloadBody | null {
|
|
684
634
|
return data
|
|
685
635
|
? {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
JsonRpcHttpClientEvent,
|
|
9
9
|
JsonRpcHttpClientEventEmitter,
|
|
10
10
|
} from "./jsonRpcHttpClient.js";
|
|
11
|
+
import {EngineRestError, EngineRestResponseError} from "./restHttpClient.js";
|
|
11
12
|
|
|
12
13
|
/** QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
|
|
13
14
|
export type QUANTITY = string;
|
|
@@ -191,12 +192,21 @@ function getExecutionEngineStateForPayloadError(
|
|
|
191
192
|
return oldState;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
if (payloadError instanceof EngineRestError && (payloadError.status === 401 || payloadError.status === 403)) {
|
|
196
|
+
return ExecutionEngineState.AUTH_FAILED;
|
|
197
|
+
}
|
|
198
|
+
|
|
194
199
|
// Originally this case was handled with {status: ExecutePayloadStatus.ELERROR}
|
|
195
|
-
if (
|
|
200
|
+
if (
|
|
201
|
+
payloadError instanceof HttpRpcError ||
|
|
202
|
+
payloadError instanceof ErrorJsonRpcResponse ||
|
|
203
|
+
payloadError instanceof EngineRestError ||
|
|
204
|
+
payloadError instanceof EngineRestResponseError
|
|
205
|
+
) {
|
|
196
206
|
return ExecutionEngineState.SYNCING;
|
|
197
207
|
}
|
|
198
208
|
|
|
199
|
-
if (
|
|
209
|
+
if (isFetchError(payloadError) && HTTP_FATAL_ERROR_CODES.includes(payloadError.code)) {
|
|
200
210
|
return ExecutionEngineState.OFFLINE;
|
|
201
211
|
}
|
|
202
212
|
|