@lodestar/beacon-node 1.51.0-dev.e22f67e7bc → 1.51.0-dev.e2bf489dd3
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/api.js +1 -1
- package/lib/api/impl/api.js.map +1 -1
- package/lib/api/impl/beacon/blocks/index.d.ts +2 -1
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +29 -34
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/index.d.ts +2 -1
- package/lib/api/impl/beacon/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/index.js +2 -2
- package/lib/api/impl/beacon/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +5 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/index.d.ts +6 -0
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +42 -26
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/options.d.ts +2 -0
- package/lib/api/options.d.ts.map +1 -1
- package/lib/api/options.js +1 -0
- package/lib/api/options.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +13 -2
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +85 -27
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +1 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +4 -0
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +61 -97
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +21 -50
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +10 -11
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +34 -19
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +4 -4
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +12 -9
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +24 -19
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +4 -1
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +18 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +8 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js +4 -0
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +7 -5
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +3 -3
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +11 -6
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
- package/lib/chain/bls/interface.d.ts +2 -0
- package/lib/chain/bls/interface.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +13 -11
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/types.d.ts +1 -1
- package/lib/chain/bls/multithread/types.d.ts.map +1 -1
- package/lib/chain/bls/multithread/worker.js +1 -1
- package/lib/chain/bls/multithread/worker.js.map +1 -1
- package/lib/chain/bls/singleThread.js +1 -1
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.js +1 -1
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +8 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +57 -7
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +1 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +1 -1
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +7 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +11 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +11 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.d.ts +53 -0
- package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -0
- package/lib/chain/forkChoiceExecutionEngine.js +121 -0
- package/lib/chain/forkChoiceExecutionEngine.js.map +1 -0
- package/lib/chain/interface.d.ts +5 -5
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +23 -10
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +1 -1
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +15 -4
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
- package/lib/chain/opPools/inclusionListStore.js +2 -2
- package/lib/chain/opPools/inclusionListStore.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +17 -7
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +9 -3
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.d.ts.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js +11 -3
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +1 -1
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +0 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +1 -2
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +1 -2
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +0 -1
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +1 -1
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +5 -3
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +0 -15
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +13 -166
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts +6 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +53 -0
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/inclusionList.d.ts.map +1 -1
- package/lib/chain/validation/inclusionList.js +11 -2
- package/lib/chain/validation/inclusionList.js.map +1 -1
- package/lib/db/beacon.d.ts +7 -0
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +34 -0
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/dataColumnStore.d.ts +1 -1
- package/lib/db/dataColumnStore.d.ts.map +1 -1
- package/lib/db/dataColumnStore.js +1 -4
- package/lib/db/dataColumnStore.js.map +1 -1
- package/lib/db/flatFileStore/flatFileStore.js +5 -5
- package/lib/db/flatFileStore/flatFileStore.js.map +1 -1
- package/lib/db/flatFileStore/slotIndex.d.ts.map +1 -1
- package/lib/db/flatFileStore/slotIndex.js +2 -2
- package/lib/db/flatFileStore/slotIndex.js.map +1 -1
- package/lib/db/interface.d.ts +1 -0
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +6 -0
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +19 -0
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/execution/builder/apiClient.d.ts +14 -8
- package/lib/execution/builder/apiClient.d.ts.map +1 -1
- package/lib/execution/builder/apiClient.js +12 -10
- package/lib/execution/builder/apiClient.js.map +1 -1
- package/lib/execution/builder/http.d.ts +2 -0
- package/lib/execution/builder/http.d.ts.map +1 -1
- package/lib/execution/builder/http.js +2 -0
- package/lib/execution/builder/http.js.map +1 -1
- package/lib/execution/engine/blobVersionedHashes.d.ts +1 -1
- package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -1
- package/lib/execution/engine/blobVersionedHashes.js.map +1 -1
- package/lib/execution/engine/http.d.ts +2 -2
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +5 -5
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts +1 -1
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +1 -1
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +17 -3
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +2 -2
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.js +1 -1
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -4
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +1 -2
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +3 -3
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/restTransport.d.ts +2 -2
- package/lib/execution/engine/restTransport.d.ts.map +1 -1
- package/lib/execution/engine/restTransport.js.map +1 -1
- package/lib/execution/engine/sszTypes.d.ts +38 -38
- package/lib/execution/engine/transport.d.ts +1 -12
- package/lib/execution/engine/transport.d.ts.map +1 -1
- package/lib/execution/engine/types.d.ts +1 -1
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +9 -8
- 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 +3 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +7 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +15 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/server/http.js +5 -5
- package/lib/metrics/server/http.js.map +1 -1
- package/lib/monitoring/service.js +1 -1
- package/lib/monitoring/service.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +2 -0
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +3 -0
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorker.js +1 -0
- package/lib/network/core/networkCoreWorker.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +2 -0
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +3 -0
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/core/types.d.ts +2 -0
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +1 -0
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +10 -0
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +6 -6
- package/lib/network/interface.d.ts +2 -0
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +5 -1
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +4 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +45 -15
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts +2 -0
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +2 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +28 -1
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/assertPeerRelevance.d.ts +9 -1
- package/lib/network/peers/utils/assertPeerRelevance.d.ts.map +1 -1
- package/lib/network/peers/utils/assertPeerRelevance.js +32 -21
- package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +4 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.js +8 -16
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +60 -37
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +6 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +29 -3
- package/lib/network/processor/index.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 +47 -21
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/options.d.ts +3 -1
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +4 -2
- package/lib/node/options.js.map +1 -1
- package/lib/sync/interface.d.ts.map +1 -1
- package/lib/sync/interface.js.map +1 -1
- package/lib/sync/sync.d.ts +7 -0
- package/lib/sync/sync.d.ts.map +1 -1
- package/lib/sync/sync.js +61 -3
- package/lib/sync/sync.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +42 -18
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/execution.d.ts +4 -4
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js.map +1 -1
- package/lib/util/file.d.ts.map +1 -1
- package/lib/util/file.js +8 -9
- package/lib/util/file.js.map +1 -1
- package/lib/util/queue/itemQueue.js +1 -1
- package/lib/util/queue/itemQueue.js.map +1 -1
- package/lib/util/sszBytes.d.ts +5 -0
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +35 -2
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +31 -32
- package/src/api/impl/api.ts +1 -1
- package/src/api/impl/beacon/blocks/index.ts +57 -62
- package/src/api/impl/beacon/index.ts +3 -1
- package/src/api/impl/beacon/pool/index.ts +5 -1
- package/src/api/impl/beacon/state/utils.ts +1 -1
- package/src/api/impl/validator/index.ts +47 -30
- package/src/api/options.ts +3 -0
- package/src/chain/GetBlobsTracker.ts +99 -40
- package/src/chain/archiveStore/archiveStore.ts +1 -0
- package/src/chain/archiveStore/utils/archiveBlocks.ts +76 -130
- package/src/chain/blocks/importBlock.ts +40 -71
- package/src/chain/blocks/importExecutionPayload.ts +57 -35
- package/src/chain/blocks/index.ts +11 -4
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +35 -24
- package/src/chain/blocks/types.ts +4 -1
- package/src/chain/blocks/verifyBlock.ts +31 -16
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +10 -1
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +1 -1
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +4 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +7 -5
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +14 -6
- package/src/chain/bls/interface.ts +2 -0
- package/src/chain/bls/multithread/index.ts +14 -10
- package/src/chain/bls/multithread/types.ts +1 -1
- package/src/chain/bls/multithread/worker.ts +1 -5
- package/src/chain/bls/singleThread.ts +1 -1
- package/src/chain/bls/utils.ts +1 -1
- package/src/chain/chain.ts +67 -8
- package/src/chain/errors/blockError.ts +1 -1
- package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
- package/src/chain/forkChoice/index.ts +11 -0
- package/src/chain/forkChoiceExecutionEngine.ts +197 -0
- package/src/chain/interface.ts +5 -5
- package/src/chain/opPools/aggregatedAttestationPool.ts +25 -9
- package/src/chain/opPools/attestationPool.ts +16 -4
- package/src/chain/opPools/inclusionListStore.ts +3 -3
- package/src/chain/opPools/payloadAttestationPool.ts +18 -7
- package/src/chain/opPools/syncCommitteeMessagePool.ts +10 -3
- package/src/chain/opPools/syncContributionAndProofPool.ts +13 -3
- package/src/chain/opPools/utils.ts +1 -1
- package/src/chain/options.ts +0 -2
- package/src/chain/produceBlock/produceBlockBody.ts +4 -3
- package/src/chain/regen/interface.ts +1 -2
- package/src/chain/regen/queued.ts +6 -4
- package/src/chain/validation/executionPayloadBid.ts +14 -193
- package/src/chain/validation/executionPayloadEnvelope.ts +68 -1
- package/src/chain/validation/inclusionList.ts +11 -2
- package/src/db/beacon.ts +44 -0
- package/src/db/dataColumnStore.ts +2 -4
- package/src/db/flatFileStore/flatFileStore.ts +7 -7
- package/src/db/flatFileStore/slotIndex.ts +4 -3
- package/src/db/interface.ts +2 -0
- package/src/db/repositories/dataColumnSidecarArchive.ts +20 -0
- package/src/execution/builder/apiClient.ts +16 -13
- package/src/execution/builder/http.ts +4 -0
- package/src/execution/engine/blobVersionedHashes.ts +1 -1
- package/src/execution/engine/http.ts +12 -14
- package/src/execution/engine/index.ts +1 -1
- package/src/execution/engine/interface.ts +19 -3
- package/src/execution/engine/jsonRpcTransport.ts +10 -2
- package/src/execution/engine/mock.ts +6 -4
- package/src/execution/engine/payloadIdCache.ts +6 -7
- package/src/execution/engine/restTransport.ts +3 -1
- package/src/execution/engine/transport.ts +8 -14
- package/src/execution/engine/types.ts +11 -9
- package/src/execution/engine/utils.ts +4 -2
- package/src/index.ts +2 -0
- package/src/metrics/metrics/lodestar.ts +15 -0
- package/src/metrics/server/http.ts +5 -5
- package/src/monitoring/service.ts +1 -1
- package/src/network/core/networkCore.ts +5 -0
- package/src/network/core/networkCoreWorker.ts +1 -0
- package/src/network/core/networkCoreWorkerHandler.ts +4 -0
- package/src/network/core/types.ts +2 -0
- package/src/network/gossip/gossipsub.ts +11 -0
- package/src/network/interface.ts +2 -0
- package/src/network/libp2p/index.ts +5 -1
- package/src/network/network.ts +45 -19
- package/src/network/options.ts +2 -0
- package/src/network/peers/peerManager.ts +28 -3
- package/src/network/peers/utils/assertPeerRelevance.ts +39 -23
- package/src/network/peers/utils/prioritizePeers.ts +14 -22
- package/src/network/processor/gossipHandlers.ts +72 -40
- package/src/network/processor/index.ts +25 -3
- package/src/node/nodejs.ts +58 -22
- package/src/node/options.ts +9 -6
- package/src/sync/interface.ts +1 -0
- package/src/sync/sync.ts +65 -4
- package/src/sync/unknownBlock.ts +47 -28
- package/src/util/execution.ts +6 -6
- package/src/util/file.ts +8 -9
- package/src/util/queue/itemQueue.ts +1 -1
- package/src/util/sszBytes.ts +42 -2
|
@@ -36,10 +36,9 @@ export async function verifyBlocksSignatures(
|
|
|
36
36
|
? preState0.currentSyncCommitteeIndexed
|
|
37
37
|
: new SyncCommitteeCacheEmpty();
|
|
38
38
|
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
// so the attester and proposer shufflings are correct.
|
|
39
|
+
// Runs concurrently with the state transition. Signature sets are built from preState0, which
|
|
40
|
+
// verifyBlocksInEpoch() guarantees is in the same epoch as every block, so the proposer and attester shufflings
|
|
41
|
+
// and the sync committee are the ones the blocks were signed under.
|
|
43
42
|
for (const [i, block] of blocks.entries()) {
|
|
44
43
|
// Use [i] to make clear that the index has to be correct to blame the right block below on BlockError()
|
|
45
44
|
isValidPromises[i] = opts.validSignatures
|
|
@@ -50,7 +49,10 @@ export async function verifyBlocksSignatures(
|
|
|
50
49
|
bls.verifySignatureSets(
|
|
51
50
|
getBlockSignatureSets(config, currentSyncCommitteeIndexed, preState0, block, indexedAttestationsByBlock[i], {
|
|
52
51
|
skipProposerSignature: opts.validProposerSignature,
|
|
53
|
-
})
|
|
52
|
+
}),
|
|
53
|
+
// Prioritize block verification over attestations, since
|
|
54
|
+
// attestations already buffer up to `MAX_BUFFER_WAIT_MS`
|
|
55
|
+
{priority: true}
|
|
54
56
|
);
|
|
55
57
|
|
|
56
58
|
// getBlockSignatureSets() takes 45ms in benchmarks for 2022Q2 mainnet blocks (100 sigs). When syncing a 32 blocks
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
1
2
|
import {DataAvailabilityStatus} from "@lodestar/state-transition";
|
|
2
3
|
import {gloas} from "@lodestar/types";
|
|
4
|
+
import {TimeoutError} from "@lodestar/utils";
|
|
3
5
|
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
4
|
-
|
|
5
|
-
// we can now wait for full 12 seconds because sync and reconstruction will try pulling
|
|
6
|
-
// the data columns from the network anyway while the envelope is being processed
|
|
7
|
-
export const PAYLOAD_DATA_AVAILABILITY_TIMEOUT = 12_000;
|
|
6
|
+
import {PayloadError, PayloadErrorCode} from "./importExecutionPayload.js";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Verifies that all payload envelope inputs have their data columns available.
|
|
11
|
-
* - Waits a max of
|
|
10
|
+
* - Waits a max of one slot duration of the payload's fork for all data to be available
|
|
12
11
|
* - Returns the time at which all data was available
|
|
13
12
|
* - Returns the data availability status for each payload input
|
|
14
13
|
*/
|
|
15
14
|
export async function verifyPayloadsDataAvailability(
|
|
15
|
+
config: ChainForkConfig,
|
|
16
16
|
payloadInputs: PayloadEnvelopeInput[],
|
|
17
17
|
signal: AbortSignal
|
|
18
18
|
): Promise<{
|
|
@@ -22,7 +22,15 @@ export async function verifyPayloadsDataAvailability(
|
|
|
22
22
|
const promises: Promise<gloas.DataColumnSidecar[]>[] = [];
|
|
23
23
|
for (const payloadInput of payloadInputs) {
|
|
24
24
|
if (!payloadInput.hasAllData()) {
|
|
25
|
-
|
|
25
|
+
// Sync and reconstruction keep pulling the data columns from the network while we wait
|
|
26
|
+
promises.push(
|
|
27
|
+
payloadInput.waitForAllData(config.getSlotDurationMs(payloadInput.forkName), signal).catch((e) => {
|
|
28
|
+
if (e instanceof TimeoutError) {
|
|
29
|
+
throw new PayloadError(payloadInput, {code: PayloadErrorCode.DATA_UNAVAILABLE});
|
|
30
|
+
}
|
|
31
|
+
throw e;
|
|
32
|
+
})
|
|
33
|
+
);
|
|
26
34
|
}
|
|
27
35
|
}
|
|
28
36
|
await Promise.all(promises);
|
|
@@ -22,6 +22,8 @@ export type VerifySignatureOpts = {
|
|
|
22
22
|
verifyOnMainThread?: boolean;
|
|
23
23
|
/**
|
|
24
24
|
* Some signature sets are more important than others, and should be verified first.
|
|
25
|
+
* Non-batchable priority jobs are posted to an idle worker before this call returns, so the caller
|
|
26
|
+
* can run synchronous work right after without delaying the verification.
|
|
25
27
|
*/
|
|
26
28
|
priority?: boolean;
|
|
27
29
|
};
|
|
@@ -333,16 +333,20 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
// First hand work to an idle worker before returning to the caller.
|
|
337
|
+
// Deferring the post to the next macrotask would make the worker
|
|
338
|
+
// sit idle while waiting for the next synchronous work
|
|
339
|
+
else if (job.opts.priority) {
|
|
340
|
+
this.jobs.unshift(job);
|
|
341
|
+
void this.runJob();
|
|
342
|
+
}
|
|
343
|
+
|
|
336
344
|
// Push job and schedule to call `runJob` in the next macro event loop cycle.
|
|
337
345
|
// This is useful to allow batching job submitted from a synchronous for loop,
|
|
338
346
|
// and to prevent large stacks since runJob may be called recursively.
|
|
339
347
|
else {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
} else {
|
|
343
|
-
this.jobs.push(job);
|
|
344
|
-
}
|
|
345
|
-
callInNextEventLoop(this.runJob);
|
|
348
|
+
this.jobs.push(job);
|
|
349
|
+
callInNextEventLoop(() => void this.runJob());
|
|
346
350
|
}
|
|
347
351
|
}
|
|
348
352
|
|
|
@@ -377,7 +381,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
377
381
|
let completedJobsCount = 0;
|
|
378
382
|
|
|
379
383
|
if (this.jobs.length > 0) {
|
|
380
|
-
callInNextEventLoop(this.runJob);
|
|
384
|
+
callInNextEventLoop(() => void this.runJob());
|
|
381
385
|
}
|
|
382
386
|
|
|
383
387
|
try {
|
|
@@ -423,7 +427,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
423
427
|
if (workReqs.length === 0) {
|
|
424
428
|
worker.status = {code: WorkerStatusCode.idle, workerApi};
|
|
425
429
|
this.workersBusy--;
|
|
426
|
-
callInNextEventLoop(this.runJob);
|
|
430
|
+
callInNextEventLoop(() => void this.runJob());
|
|
427
431
|
return;
|
|
428
432
|
}
|
|
429
433
|
|
|
@@ -499,7 +503,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
499
503
|
this.workersBusy--;
|
|
500
504
|
|
|
501
505
|
// Potentially run a new job
|
|
502
|
-
callInNextEventLoop(this.runJob);
|
|
506
|
+
callInNextEventLoop(() => void this.runJob());
|
|
503
507
|
};
|
|
504
508
|
|
|
505
509
|
/**
|
|
@@ -542,7 +546,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
542
546
|
this.jobs.unshift(job);
|
|
543
547
|
}
|
|
544
548
|
this.bufferedJobs = null;
|
|
545
|
-
callInNextEventLoop(this.runJob);
|
|
549
|
+
callInNextEventLoop(() => void this.runJob());
|
|
546
550
|
}
|
|
547
551
|
};
|
|
548
552
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import worker from "node:worker_threads";
|
|
2
|
-
import {
|
|
3
|
-
type BlsSignatureSet,
|
|
4
|
-
verifySignatureSets,
|
|
5
|
-
verifySignatureSetsSameMessage,
|
|
6
|
-
} from "@chainsafe/lodestar-z/bls-verifier";
|
|
7
2
|
import {expose} from "@chainsafe/threads/worker";
|
|
3
|
+
import {type BlsSignatureSet, verifySignatureSets, verifySignatureSetsSameMessage} from "@lodestar/native/bls-verifier";
|
|
8
4
|
import {
|
|
9
5
|
BlsWorkReq,
|
|
10
6
|
BlsWorkResult,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {verifySignatureSetsSameMessage} from "@
|
|
1
|
+
import {verifySignatureSetsSameMessage} from "@lodestar/native/bls-verifier";
|
|
2
2
|
import {ISignatureSet} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
import {IBlsVerifier, SameMessageSignatureSet} from "./interface.js";
|
package/src/chain/bls/utils.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
BLS_VERIFIER_MAX_BATCH_SIZE,
|
|
3
3
|
BLS_VERIFIER_MAX_SAME_MESSAGE_BATCH_SIZE,
|
|
4
4
|
verifySignatureSets,
|
|
5
|
-
} from "@
|
|
5
|
+
} from "@lodestar/native/bls-verifier";
|
|
6
6
|
import {ISignatureSet, SignatureSetType, toBlsSignatureSet} from "@lodestar/state-transition";
|
|
7
7
|
import {SameMessageSignatureSet} from "./interface.js";
|
|
8
8
|
|
package/src/chain/chain.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {PrivateKey} from "@libp2p/interface";
|
|
3
|
-
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
4
3
|
import {Type} from "@chainsafe/ssz";
|
|
5
4
|
import {routes} from "@lodestar/api";
|
|
6
5
|
import {BeaconConfig} from "@lodestar/config";
|
|
7
6
|
import {
|
|
7
|
+
AncestorStatus,
|
|
8
8
|
CheckpointWithHex,
|
|
9
9
|
EpochDifference,
|
|
10
10
|
ForkChoiceStateGetter,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
UpdateHeadOpt,
|
|
15
15
|
} from "@lodestar/fork-choice";
|
|
16
16
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
17
|
+
import {type PubkeyCache} from "@lodestar/native/pubkeys";
|
|
17
18
|
import {
|
|
18
19
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
19
20
|
type ForkPostFulu,
|
|
@@ -90,8 +91,9 @@ import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToD
|
|
|
90
91
|
import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
|
|
91
92
|
import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
|
|
92
93
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
93
|
-
import {ChainEvent, ChainEventEmitter} from "./emitter.js";
|
|
94
|
+
import {ChainEvent, ChainEventEmitter, ReorgEventData} from "./emitter.js";
|
|
94
95
|
import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js";
|
|
96
|
+
import {ForkChoiceExecutionEngine} from "./forkChoiceExecutionEngine.js";
|
|
95
97
|
import {GetBlobsTracker} from "./GetBlobsTracker.js";
|
|
96
98
|
import {CommonBlockBody, FindHeadFnName, IBeaconChain, ProposerPreparationData, StateGetOpts} from "./interface.js";
|
|
97
99
|
import {LightClientServer} from "./lightClient/index.js";
|
|
@@ -166,7 +168,7 @@ const DEFAULT_MAX_PENDING_UNFINALIZED_PAYLOAD_ENVELOPE_WRITES = 16;
|
|
|
166
168
|
export class BeaconChain implements IBeaconChain {
|
|
167
169
|
readonly genesisTime: UintNum64;
|
|
168
170
|
readonly genesisValidatorsRoot: Root;
|
|
169
|
-
readonly executionEngine:
|
|
171
|
+
readonly executionEngine: ForkChoiceExecutionEngine;
|
|
170
172
|
readonly executionBuilder?: IExecutionBuilder;
|
|
171
173
|
readonly builderCircuitBreaker: BuilderCircuitBreaker;
|
|
172
174
|
readonly builderApiClient: BuilderApiClient;
|
|
@@ -317,7 +319,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
317
319
|
this.genesisTime = anchorState.genesisTime;
|
|
318
320
|
this.anchorStateLatestBlockSlot = anchorState.latestBlockHeader.slot;
|
|
319
321
|
this.genesisValidatorsRoot = anchorState.genesisValidatorsRoot;
|
|
320
|
-
this.executionEngine = executionEngine;
|
|
321
322
|
this.executionBuilder = executionBuilder;
|
|
322
323
|
const signal = this.abortController.signal;
|
|
323
324
|
const emitter = new ChainEventEmitter();
|
|
@@ -457,6 +458,12 @@ export class BeaconChain implements IBeaconChain {
|
|
|
457
458
|
this.payloadEnvelopeProcessor = new PayloadEnvelopeProcessor(this, metrics, signal);
|
|
458
459
|
|
|
459
460
|
this.forkChoice = forkChoice;
|
|
461
|
+
this.executionEngine = new ForkChoiceExecutionEngine(executionEngine, {
|
|
462
|
+
forkChoice,
|
|
463
|
+
recomputeHeadAfterELInvalidResponse: () => this.recomputeHeadAfterELInvalidResponse(),
|
|
464
|
+
logger,
|
|
465
|
+
metrics,
|
|
466
|
+
});
|
|
460
467
|
|
|
461
468
|
this.builderCircuitBreaker = new BuilderCircuitBreaker(
|
|
462
469
|
{faultInspectionWindow: opts.faultInspectionWindow, allowedFaults: opts.allowedFaults},
|
|
@@ -1430,6 +1437,58 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1430
1437
|
}
|
|
1431
1438
|
}
|
|
1432
1439
|
|
|
1440
|
+
/**
|
|
1441
|
+
* Apply chain side effects of a fork choice head change: head state, head metrics, and reorg detection
|
|
1442
|
+
*/
|
|
1443
|
+
onHeadChanged(oldHead: ProtoBlock, newHead: ProtoBlock, maybeHeadState?: IBeaconStateView): void {
|
|
1444
|
+
// Set head state as strong reference
|
|
1445
|
+
this.regen.updateHeadState(newHead, maybeHeadState);
|
|
1446
|
+
|
|
1447
|
+
const delaySec = this.clock.secFromSlot(newHead.slot);
|
|
1448
|
+
this.logger.verbose("New chain head", {
|
|
1449
|
+
slot: newHead.slot,
|
|
1450
|
+
root: newHead.blockRoot,
|
|
1451
|
+
payloadStatus: newHead.payloadStatus,
|
|
1452
|
+
delaySec,
|
|
1453
|
+
});
|
|
1454
|
+
this.metrics?.headSlot.set(newHead.slot);
|
|
1455
|
+
|
|
1456
|
+
this.onNewHead(newHead);
|
|
1457
|
+
this.metrics?.forkChoice.changedHead.inc();
|
|
1458
|
+
|
|
1459
|
+
const ancestorResult = this.forkChoice.getCommonAncestorDepth(oldHead, newHead);
|
|
1460
|
+
if (ancestorResult.code === AncestorStatus.CommonAncestor) {
|
|
1461
|
+
// CommonAncestor = chain reorg, old head and new head not direct descendants
|
|
1462
|
+
|
|
1463
|
+
const forkChoiceReorgEventData: ReorgEventData = {
|
|
1464
|
+
depth: ancestorResult.depth,
|
|
1465
|
+
epoch: computeEpochAtSlot(newHead.slot),
|
|
1466
|
+
slot: newHead.slot,
|
|
1467
|
+
newHeadBlock: newHead.blockRoot,
|
|
1468
|
+
oldHeadBlock: oldHead.blockRoot,
|
|
1469
|
+
newHeadState: newHead.stateRoot,
|
|
1470
|
+
oldHeadState: oldHead.stateRoot,
|
|
1471
|
+
executionOptimistic: isOptimisticBlock(newHead),
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
this.emitter.emit(routes.events.EventType.chainReorg, forkChoiceReorgEventData);
|
|
1475
|
+
this.logger.verbose("Chain reorg", forkChoiceReorgEventData);
|
|
1476
|
+
|
|
1477
|
+
this.metrics?.forkChoice.reorg.inc();
|
|
1478
|
+
this.metrics?.forkChoice.reorgDistance.observe(ancestorResult.depth);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
private recomputeHeadAfterELInvalidResponse(): void {
|
|
1483
|
+
// validateLatestHash only re-scores proto-array, the cached head is still the old one
|
|
1484
|
+
const oldHead = this.forkChoice.getHead();
|
|
1485
|
+
const newHead = this.recomputeForkChoiceHead(ForkchoiceCaller.executionInvalid);
|
|
1486
|
+
if (newHead.blockRoot === oldHead.blockRoot && newHead.payloadStatus === oldHead.payloadStatus) {
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
this.onHeadChanged(oldHead, newHead);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1433
1492
|
/**
|
|
1434
1493
|
* Emit `head` and `head_v2` when the fork choice head differs between two observations. Every caller that
|
|
1435
1494
|
* can move the head, `updateAndGetHead()` and `updateTime()`, must capture the head before and pass both.
|
|
@@ -1486,10 +1545,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1486
1545
|
this.metrics?.forkChoice.requests.inc();
|
|
1487
1546
|
const timer = this.metrics?.forkChoice.findHead.startTimer({caller: FindHeadFnName.predictProposerHead});
|
|
1488
1547
|
const slot = this.clock.currentSlot;
|
|
1489
|
-
const
|
|
1548
|
+
const msFromSlot = this.clock.msFromSlot(slot);
|
|
1490
1549
|
|
|
1491
1550
|
try {
|
|
1492
|
-
return this.forkChoice.updateAndGetHead({mode: UpdateHeadOpt.GetPredictedProposerHead,
|
|
1551
|
+
return this.forkChoice.updateAndGetHead({mode: UpdateHeadOpt.GetPredictedProposerHead, msFromSlot, slot}).head;
|
|
1493
1552
|
} catch (e) {
|
|
1494
1553
|
this.metrics?.forkChoice.errors.inc({entrypoint: UpdateHeadOpt.GetPredictedProposerHead});
|
|
1495
1554
|
throw e;
|
|
@@ -1501,13 +1560,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1501
1560
|
getProposerHead(slot: Slot): ProtoBlock {
|
|
1502
1561
|
this.metrics?.forkChoice.requests.inc();
|
|
1503
1562
|
const timer = this.metrics?.forkChoice.findHead.startTimer({caller: FindHeadFnName.getProposerHead});
|
|
1504
|
-
const
|
|
1563
|
+
const msFromSlot = this.clock.msFromSlot(slot);
|
|
1505
1564
|
|
|
1506
1565
|
try {
|
|
1507
1566
|
// Do not emit head event here, when proposing we rely on the one emitted when importing our own block
|
|
1508
1567
|
const {head, isHeadTimely, notReorgedReason} = this.forkChoice.updateAndGetHead({
|
|
1509
1568
|
mode: UpdateHeadOpt.GetProposerHead,
|
|
1510
|
-
|
|
1569
|
+
msFromSlot,
|
|
1511
1570
|
slot,
|
|
1512
1571
|
});
|
|
1513
1572
|
|
|
@@ -72,7 +72,7 @@ export enum BlockErrorCode {
|
|
|
72
72
|
* whoever served the block MAY be downscored. Mirrors PayloadErrorCode.EXECUTION_ENGINE_INVALID.
|
|
73
73
|
*/
|
|
74
74
|
EXECUTION_ENGINE_INVALID = "BLOCK_ERROR_EXECUTION_INVALID",
|
|
75
|
-
/** The
|
|
75
|
+
/** The blob or column data did not arrive within the availability wait */
|
|
76
76
|
DATA_UNAVAILABLE = "BLOCK_ERROR_DATA_UNAVAILABLE",
|
|
77
77
|
/** Block contains too many kzg commitments */
|
|
78
78
|
TOO_MANY_KZG_COMMITMENTS = "BLOCK_ERROR_TOO_MANY_KZG_COMMITMENTS",
|
|
@@ -12,6 +12,7 @@ export enum ExecutionPayloadEnvelopeErrorCode {
|
|
|
12
12
|
BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
|
|
13
13
|
BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
|
|
14
14
|
EXECUTION_REQUESTS_ROOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EXECUTION_REQUESTS_ROOT_MISMATCH",
|
|
15
|
+
TOO_MANY_TRANSACTIONS = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_TOO_MANY_TRANSACTIONS",
|
|
15
16
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
|
|
16
17
|
PAYLOAD_ENVELOPE_INPUT_MISSING = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PAYLOAD_ENVELOPE_INPUT_MISSING",
|
|
17
18
|
}
|
|
@@ -54,6 +55,13 @@ export type ExecutionPayloadEnvelopeErrorType =
|
|
|
54
55
|
envelopeRequestsRoot: RootHex;
|
|
55
56
|
bidRequestsRoot: RootHex;
|
|
56
57
|
}
|
|
58
|
+
| {
|
|
59
|
+
code: ExecutionPayloadEnvelopeErrorCode.TOO_MANY_TRANSACTIONS;
|
|
60
|
+
slot: Slot;
|
|
61
|
+
root: RootHex;
|
|
62
|
+
transactionCount: number;
|
|
63
|
+
maxTransactionCount: number;
|
|
64
|
+
}
|
|
57
65
|
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE; slot: Slot; root: RootHex}
|
|
58
66
|
| {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
|
|
59
67
|
|
|
@@ -34,6 +34,17 @@ export type ForkChoiceOpts = RawForkChoiceOpts & {
|
|
|
34
34
|
export enum ForkchoiceCaller {
|
|
35
35
|
prepareNextSlot = "prepare_next_slot",
|
|
36
36
|
importBlock = "import_block",
|
|
37
|
+
executionInvalid = "execution_invalid",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Where an execution engine INVALID verdict comes from. Only `blockSegment` verdicts are about the payload the engine
|
|
42
|
+
* just processed and keep the consensus failure semantics in fork choice, the others are applied leniently.
|
|
43
|
+
*/
|
|
44
|
+
export enum ExecutionInvalidSource {
|
|
45
|
+
forkchoiceUpdated = "forkchoice_updated",
|
|
46
|
+
newPayload = "new_payload",
|
|
47
|
+
blockSegment = "block_segment",
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
/**
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import {ExecutionStatus, IForkChoice, LVHInvalidResponse} from "@lodestar/fork-choice";
|
|
2
|
+
import {ForkName, ForkPostFulu, ForkPreFulu, isForkPostFulu} from "@lodestar/params";
|
|
3
|
+
import {RootHex, bellatrix} from "@lodestar/types";
|
|
4
|
+
import {BlobAndProof} from "@lodestar/types/deneb";
|
|
5
|
+
import {BlobAndProofV2} from "@lodestar/types/fulu";
|
|
6
|
+
import {Logger} from "@lodestar/utils";
|
|
7
|
+
import {ExecutionPayloadBodyV2} from "../execution/engine/types.js";
|
|
8
|
+
import {DATA} from "../execution/engine/utils.js";
|
|
9
|
+
import {
|
|
10
|
+
ClientVersion,
|
|
11
|
+
ExecutionEngineState,
|
|
12
|
+
ExecutionPayloadStatus,
|
|
13
|
+
ForkchoiceUpdatedResult,
|
|
14
|
+
IExecutionEngine,
|
|
15
|
+
PayloadAttributes,
|
|
16
|
+
PayloadId,
|
|
17
|
+
PayloadIdCache,
|
|
18
|
+
VersionedHashes,
|
|
19
|
+
} from "../execution/index.js";
|
|
20
|
+
import {Metrics} from "../metrics/index.js";
|
|
21
|
+
import {ExecutionInvalidSource} from "./forkChoice/index.js";
|
|
22
|
+
|
|
23
|
+
export type ForkChoiceExecutionEngineModules = {
|
|
24
|
+
forkChoice: IForkChoice;
|
|
25
|
+
/** Recompute and switch the chain head, fork choice is already updated when this runs */
|
|
26
|
+
recomputeHeadAfterELInvalidResponse: () => void;
|
|
27
|
+
logger: Logger;
|
|
28
|
+
metrics: Metrics | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The only handle on the execution engine. Payloads are imported optimistically, so every engine verdict that can
|
|
33
|
+
* change fork choice is applied here.
|
|
34
|
+
*/
|
|
35
|
+
export class ForkChoiceExecutionEngine {
|
|
36
|
+
private readonly forkChoice: IForkChoice;
|
|
37
|
+
private readonly recomputeHeadAfterELInvalidResponse: () => void;
|
|
38
|
+
private readonly logger: Logger;
|
|
39
|
+
private readonly metrics: Metrics | null;
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly engine: IExecutionEngine,
|
|
43
|
+
modules: ForkChoiceExecutionEngineModules
|
|
44
|
+
) {
|
|
45
|
+
this.forkChoice = modules.forkChoice;
|
|
46
|
+
this.recomputeHeadAfterELInvalidResponse = modules.recomputeHeadAfterELInvalidResponse;
|
|
47
|
+
this.logger = modules.logger;
|
|
48
|
+
this.metrics = modules.metrics;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get state(): ExecutionEngineState {
|
|
52
|
+
return this.engine.state;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get clientVersion(): ClientVersion | null | undefined {
|
|
56
|
+
return this.engine.clientVersion;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get payloadIdCache(): PayloadIdCache {
|
|
60
|
+
return this.engine.payloadIdCache;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
notifyNewPayload(
|
|
64
|
+
...args: Parameters<IExecutionEngine["notifyNewPayload"]>
|
|
65
|
+
): ReturnType<IExecutionEngine["notifyNewPayload"]> {
|
|
66
|
+
return this.engine.notifyNewPayload(...args);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* `headBlockRoot` is the root of the node whose payload hash is sent as `headBlockHash`, captured by the caller
|
|
71
|
+
* before the call: root and hash identify the exact fork choice node, gloas variant included.
|
|
72
|
+
*
|
|
73
|
+
* The verdict is applied to fork choice before returning. An INVALID verdict throws when preparing a payload so
|
|
74
|
+
* block production fails, otherwise it resolves to null.
|
|
75
|
+
*/
|
|
76
|
+
async notifyForkchoiceUpdate(
|
|
77
|
+
fork: ForkName,
|
|
78
|
+
headBlockRoot: RootHex,
|
|
79
|
+
headBlockHash: RootHex,
|
|
80
|
+
safeBlockHash: RootHex,
|
|
81
|
+
finalizedBlockHash: RootHex,
|
|
82
|
+
payloadAttributes?: PayloadAttributes
|
|
83
|
+
): Promise<PayloadId | null> {
|
|
84
|
+
const result = await this.engine.notifyForkchoiceUpdate(
|
|
85
|
+
fork,
|
|
86
|
+
headBlockHash,
|
|
87
|
+
safeBlockHash,
|
|
88
|
+
finalizedBlockHash,
|
|
89
|
+
payloadAttributes
|
|
90
|
+
);
|
|
91
|
+
this.applyForkchoiceUpdatedResult(headBlockRoot, headBlockHash, result);
|
|
92
|
+
|
|
93
|
+
if (result.payloadStatus.status === ExecutionPayloadStatus.INVALID) {
|
|
94
|
+
if (payloadAttributes) {
|
|
95
|
+
throw Error(`Invalid prepare payload, validationError=${result.payloadStatus.validationError ?? ""}`);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return result.payloadId;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
getPayload(...args: Parameters<IExecutionEngine["getPayload"]>): ReturnType<IExecutionEngine["getPayload"]> {
|
|
103
|
+
return this.engine.getPayload(...args);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getInclusionList(): Promise<bellatrix.Transactions> {
|
|
107
|
+
return this.engine.getInclusionList();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getPayloadBodiesByHashV2(blockHashes: DATA[]): Promise<(ExecutionPayloadBodyV2 | null)[]> {
|
|
111
|
+
return this.engine.getPayloadBodiesByHashV2(blockHashes);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getBlobs(
|
|
115
|
+
fork: ForkPostFulu,
|
|
116
|
+
versionedHashes: VersionedHashes,
|
|
117
|
+
buffers?: Uint8Array[]
|
|
118
|
+
): Promise<BlobAndProofV2[] | null>;
|
|
119
|
+
getBlobs(
|
|
120
|
+
fork: ForkPreFulu,
|
|
121
|
+
versionedHashes: VersionedHashes,
|
|
122
|
+
buffers?: Uint8Array[]
|
|
123
|
+
): Promise<(BlobAndProof | null)[]>;
|
|
124
|
+
getBlobs(
|
|
125
|
+
fork: ForkName,
|
|
126
|
+
versionedHashes: VersionedHashes,
|
|
127
|
+
buffers?: Uint8Array[]
|
|
128
|
+
): Promise<BlobAndProofV2[] | (BlobAndProof | null)[] | null> {
|
|
129
|
+
if (isForkPostFulu(fork)) {
|
|
130
|
+
return this.engine.getBlobs(fork, versionedHashes, buffers);
|
|
131
|
+
}
|
|
132
|
+
return this.engine.getBlobs(fork as ForkPreFulu, versionedHashes, buffers);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Apply an execution engine INVALID verdict to fork choice and move the chain head off the invalid chain
|
|
137
|
+
*/
|
|
138
|
+
invalidateExecutionPayloads(lvh: LVHInvalidResponse, source: ExecutionInvalidSource): void {
|
|
139
|
+
const logCtx = {
|
|
140
|
+
source,
|
|
141
|
+
blockRoot: lvh.invalidateFromParentBlockRoot,
|
|
142
|
+
blockHash: lvh.invalidateFromParentBlockHash,
|
|
143
|
+
latestValidHash: lvh.latestValidExecHash ?? "null",
|
|
144
|
+
};
|
|
145
|
+
const applied = this.forkChoice.validateLatestHash(lvh, {strict: source === ExecutionInvalidSource.blockSegment});
|
|
146
|
+
if (!applied) {
|
|
147
|
+
this.logger.warn("Execution engine INVALID verdict not applied to fork choice", logCtx);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.metrics?.forkChoice.executionInvalidations.inc({source});
|
|
151
|
+
this.logger.warn("Invalidated execution payloads in fork choice", logCtx);
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
this.recomputeHeadAfterELInvalidResponse();
|
|
155
|
+
} catch (e) {
|
|
156
|
+
this.logger.error("Error recomputing head after execution payload invalidation", logCtx, e as Error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private applyForkchoiceUpdatedResult(
|
|
161
|
+
headBlockRoot: RootHex,
|
|
162
|
+
headBlockHash: RootHex,
|
|
163
|
+
result: ForkchoiceUpdatedResult
|
|
164
|
+
): void {
|
|
165
|
+
const {status, latestValidHash, validationError} = result.payloadStatus;
|
|
166
|
+
const executionStatus = this.forkChoice.getBlockHexAndBlockHash(headBlockRoot, headBlockHash)?.executionStatus;
|
|
167
|
+
try {
|
|
168
|
+
if (status === ExecutionPayloadStatus.INVALID) {
|
|
169
|
+
if (executionStatus === ExecutionStatus.Invalid) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this.logger.error("Execution engine reported INVALID forkchoice head", {
|
|
173
|
+
headBlockRoot,
|
|
174
|
+
headBlockHash,
|
|
175
|
+
latestValidHash: latestValidHash ?? "null",
|
|
176
|
+
validationError: validationError ?? "",
|
|
177
|
+
});
|
|
178
|
+
this.invalidateExecutionPayloads(
|
|
179
|
+
{
|
|
180
|
+
executionStatus: ExecutionStatus.Invalid,
|
|
181
|
+
latestValidExecHash: latestValidHash,
|
|
182
|
+
invalidateFromParentBlockRoot: headBlockRoot,
|
|
183
|
+
invalidateFromParentBlockHash: headBlockHash,
|
|
184
|
+
},
|
|
185
|
+
ExecutionInvalidSource.forkchoiceUpdated
|
|
186
|
+
);
|
|
187
|
+
} else if (status === ExecutionPayloadStatus.VALID && executionStatus === ExecutionStatus.Syncing) {
|
|
188
|
+
this.forkChoice.validateLatestHash(
|
|
189
|
+
{executionStatus: ExecutionStatus.Valid, latestValidExecHash: headBlockHash, blockRoot: headBlockRoot},
|
|
190
|
+
{strict: false}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
} catch (e) {
|
|
194
|
+
this.logger.error("Error applying forkchoice update result", {headBlockRoot, headBlockHash, status}, e as Error);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
package/src/chain/interface.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
2
1
|
import {Type} from "@chainsafe/ssz";
|
|
3
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
3
|
import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
4
|
+
import {type PubkeyCache} from "@lodestar/native/pubkeys";
|
|
5
5
|
import {EpochShuffling, IBeaconStateView} from "@lodestar/state-transition";
|
|
6
6
|
import {
|
|
7
7
|
BeaconBlock,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "@lodestar/types";
|
|
26
26
|
import {Logger} from "@lodestar/utils";
|
|
27
27
|
import {BuilderApiClient} from "../execution/builder/apiClient.js";
|
|
28
|
-
import {IExecutionBuilder
|
|
28
|
+
import {IExecutionBuilder} from "../execution/index.js";
|
|
29
29
|
import {Metrics} from "../metrics/metrics.js";
|
|
30
30
|
import {BufferPool} from "../util/bufferPool.js";
|
|
31
31
|
import {IClock} from "../util/clock.js";
|
|
@@ -42,6 +42,7 @@ import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
|
|
|
42
42
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
43
43
|
import {ChainEventEmitter} from "./emitter.js";
|
|
44
44
|
import {ForkchoiceCaller} from "./forkChoice/index.js";
|
|
45
|
+
import {ForkChoiceExecutionEngine} from "./forkChoiceExecutionEngine.js";
|
|
45
46
|
import {GetBlobsTracker} from "./GetBlobsTracker.js";
|
|
46
47
|
import {LightClientServer} from "./lightClient/index.js";
|
|
47
48
|
import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js";
|
|
@@ -77,8 +78,7 @@ import {PayloadEnvelopeInput, SeenPayloadEnvelopeInput} from "./seenCache/seenPa
|
|
|
77
78
|
import {ShufflingCache} from "./shufflingCache.js";
|
|
78
79
|
import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
79
80
|
|
|
80
|
-
export {BlockType, type
|
|
81
|
-
export {type ProposerPreparationData};
|
|
81
|
+
export {type AssembledBlockType, BlockType, type ProposerPreparationData};
|
|
82
82
|
export type BlockHash = RootHex;
|
|
83
83
|
|
|
84
84
|
export type StateGetOpts = {
|
|
@@ -99,7 +99,7 @@ export interface IBeaconChain {
|
|
|
99
99
|
readonly genesisTime: UintNum64;
|
|
100
100
|
readonly genesisValidatorsRoot: Root;
|
|
101
101
|
earliestAvailableSlot: Slot;
|
|
102
|
-
readonly executionEngine:
|
|
102
|
+
readonly executionEngine: ForkChoiceExecutionEngine;
|
|
103
103
|
readonly executionBuilder?: IExecutionBuilder;
|
|
104
104
|
readonly builderCircuitBreaker: BuilderCircuitBreaker;
|
|
105
105
|
readonly builderApiClient: BuilderApiClient;
|