@lodestar/beacon-node 1.42.0-rc.0 → 1.43.0-dev.07452fe3b7
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 +37 -9
- package/lib/api/impl/beacon/blocks/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 +49 -2
- 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 +13 -10
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -2
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +0 -1
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/lodestar/attesterSlashing.d.ts +8 -0
- package/lib/api/impl/lodestar/attesterSlashing.d.ts.map +1 -0
- package/lib/api/impl/lodestar/attesterSlashing.js +29 -0
- package/lib/api/impl/lodestar/attesterSlashing.js.map +1 -0
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +40 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +74 -5
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +1 -1
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +1 -2
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +4 -4
- package/lib/chain/archiveStore/interface.d.ts.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts +4 -4
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +2 -4
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +2 -2
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +110 -58
- 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 +51 -53
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +28 -14
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +95 -86
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts +5 -3
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +59 -26
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +4 -0
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +25 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +5 -0
- package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js +7 -5
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +16 -21
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts +23 -2
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +89 -12
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts +5 -3
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +50 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +0 -4
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +8 -4
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js +25 -5
- 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 +4 -2
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +24 -0
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +79 -0
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -0
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +14 -0
- package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -0
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js +30 -0
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -0
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js +2 -11
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts +9 -6
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +51 -42
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +16 -15
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -4
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/attestationError.d.ts +8 -1
- package/lib/chain/errors/attestationError.d.ts.map +1 -1
- package/lib/chain/errors/attestationError.js +4 -0
- package/lib/chain/errors/attestationError.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +18 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +6 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +5 -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/errors/index.d.ts +1 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +1 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/proposerPreferences.d.ts +33 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/errors/proposerPreferences.js +13 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -0
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +21 -23
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +8 -5
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts +2 -2
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +7 -0
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +5 -2
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +3 -2
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +26 -4
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +48 -18
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +1 -7
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +1 -28
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +15 -10
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +83 -21
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/errors.d.ts +1 -11
- package/lib/chain/regen/errors.d.ts.map +1 -1
- package/lib/chain/regen/errors.js +0 -2
- package/lib/chain/regen/errors.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +7 -12
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +1 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +6 -11
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +9 -44
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +0 -5
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +8 -38
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +1 -0
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +1 -0
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +19 -6
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +40 -22
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.d.ts +15 -0
- package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
- package/lib/chain/seenCache/seenProposerPreferences.js +25 -0
- package/lib/chain/seenCache/seenProposerPreferences.js.map +1 -0
- package/lib/chain/stateCache/datastore/db.d.ts +5 -4
- package/lib/chain/stateCache/datastore/db.d.ts.map +1 -1
- package/lib/chain/stateCache/datastore/db.js +10 -32
- package/lib/chain/stateCache/datastore/db.js.map +1 -1
- package/lib/chain/stateCache/datastore/file.d.ts +1 -1
- package/lib/chain/stateCache/datastore/file.d.ts.map +1 -1
- package/lib/chain/stateCache/datastore/file.js +5 -5
- package/lib/chain/stateCache/datastore/file.js.map +1 -1
- package/lib/chain/stateCache/datastore/types.d.ts +1 -1
- package/lib/chain/stateCache/datastore/types.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -7
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +0 -8
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +13 -30
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +120 -216
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +8 -15
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +12 -0
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +12 -0
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +28 -5
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +19 -4
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +27 -12
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -4
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts +8 -0
- package/lib/chain/validation/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/validation/proposerPreferences.js +69 -0
- package/lib/chain/validation/proposerPreferences.js.map +1 -0
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +4 -0
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +4 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +3 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +21 -14
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -0
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -0
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +20 -0
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +18 -0
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +4 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +7 -1
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +1 -0
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +12 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +12 -2
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +6 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +1 -0
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/network.d.ts +1 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +6 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +50 -22
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/index.js +5 -0
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +6 -5
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +16 -7
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +2 -0
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +18 -8
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +6 -0
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +24 -8
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +9 -5
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +3 -8
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +7 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +2 -2
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/range/batch.d.ts +23 -2
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +84 -33
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +6 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +26 -7
- 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 +17 -6
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/types.d.ts +34 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +34 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +22 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +602 -53
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +46 -10
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +164 -24
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +16 -2
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts +0 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js +0 -9
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +20 -5
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +17 -16
- package/src/api/impl/beacon/blocks/index.ts +51 -9
- package/src/api/impl/beacon/pool/index.ts +87 -1
- package/src/api/impl/beacon/state/index.ts +15 -15
- package/src/api/impl/beacon/state/utils.ts +2 -2
- package/src/api/impl/debug/index.ts +0 -1
- package/src/api/impl/lodestar/attesterSlashing.ts +43 -0
- package/src/api/impl/lodestar/index.ts +52 -2
- package/src/api/impl/validator/index.ts +91 -6
- package/src/chain/GetBlobsTracker.ts +1 -2
- package/src/chain/archiveStore/archiveStore.ts +5 -5
- package/src/chain/archiveStore/interface.ts +4 -4
- package/src/chain/archiveStore/strategies/frequencyStateArchiveStrategy.ts +6 -8
- package/src/chain/archiveStore/utils/archiveBlocks.ts +153 -94
- package/src/chain/blocks/importBlock.ts +57 -80
- package/src/chain/blocks/importExecutionPayload.ts +116 -98
- package/src/chain/blocks/index.ts +74 -24
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +33 -1
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -0
- package/src/chain/blocks/payloadEnvelopeProcessor.ts +7 -6
- package/src/chain/blocks/types.ts +16 -26
- package/src/chain/blocks/utils/chainSegment.ts +114 -17
- package/src/chain/blocks/verifyBlock.ts +70 -9
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +8 -5
- package/src/chain/blocks/verifyBlocksSanityChecks.ts +26 -7
- package/src/chain/blocks/verifyBlocksSignatures.ts +9 -2
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +134 -0
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +41 -0
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
- package/src/chain/chain.ts +75 -65
- package/src/chain/emitter.ts +15 -14
- package/src/chain/errors/attestationError.ts +6 -1
- package/src/chain/errors/blockError.ts +10 -1
- package/src/chain/errors/executionPayloadBid.ts +6 -0
- package/src/chain/errors/executionPayloadEnvelope.ts +6 -0
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/proposerPreferences.ts +39 -0
- package/src/chain/forkChoice/index.ts +19 -28
- package/src/chain/interface.ts +16 -3
- package/src/chain/lightClient/index.ts +15 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +6 -1
- package/src/chain/opPools/executionPayloadBidPool.ts +3 -3
- package/src/chain/opPools/payloadAttestationPool.ts +29 -8
- package/src/chain/prepareNextSlot.ts +58 -19
- package/src/chain/produceBlock/computeNewStateRoot.ts +1 -37
- package/src/chain/produceBlock/produceBlockBody.ts +120 -26
- package/src/chain/regen/errors.ts +1 -6
- package/src/chain/regen/interface.ts +7 -12
- package/src/chain/regen/queued.ts +14 -55
- package/src/chain/regen/regen.ts +10 -43
- package/src/chain/seenCache/index.ts +1 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +47 -25
- package/src/chain/seenCache/seenProposerPreferences.ts +29 -0
- package/src/chain/stateCache/datastore/db.ts +10 -33
- package/src/chain/stateCache/datastore/file.ts +5 -6
- package/src/chain/stateCache/datastore/types.ts +2 -3
- package/src/chain/stateCache/fifoBlockStateCache.ts +1 -10
- package/src/chain/stateCache/persistentCheckpointsCache.ts +139 -247
- package/src/chain/stateCache/types.ts +8 -14
- package/src/chain/validation/aggregateAndProof.ts +13 -0
- package/src/chain/validation/attestation.ts +13 -0
- package/src/chain/validation/block.ts +31 -7
- package/src/chain/validation/executionPayloadBid.ts +21 -3
- package/src/chain/validation/executionPayloadEnvelope.ts +32 -13
- package/src/chain/validation/payloadAttestationMessage.ts +9 -3
- package/src/chain/validation/proposerPreferences.ts +91 -0
- package/src/chain/validation/syncCommittee.ts +5 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -1
- package/src/chain/validatorMonitor.ts +3 -2
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +1 -1
- package/src/execution/engine/http.ts +21 -14
- package/src/execution/engine/interface.ts +1 -0
- package/src/execution/engine/mock.ts +8 -1
- package/src/execution/engine/types.ts +41 -0
- package/src/metrics/metrics/lodestar.ts +4 -0
- package/src/network/gossip/interface.ts +6 -0
- package/src/network/gossip/scoringParameters.ts +14 -1
- package/src/network/gossip/topic.ts +6 -0
- package/src/network/interface.ts +1 -0
- package/src/network/network.ts +12 -1
- package/src/network/processor/gossipHandlers.ts +66 -27
- package/src/network/processor/gossipQueues/index.ts +5 -0
- package/src/network/processor/index.ts +6 -5
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +17 -7
- package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +3 -0
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +26 -8
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +11 -0
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +36 -8
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +10 -5
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +3 -12
- package/src/node/nodejs.ts +8 -3
- package/src/node/notifier.ts +7 -2
- package/src/sync/range/batch.ts +142 -38
- package/src/sync/range/chain.ts +37 -9
- package/src/sync/range/range.ts +18 -6
- package/src/sync/types.ts +72 -0
- package/src/sync/unknownBlock.ts +760 -57
- package/src/sync/utils/downloadByRange.ts +274 -39
- package/src/sync/utils/downloadByRoot.ts +24 -2
- package/src/sync/utils/pendingBlocksTree.ts +0 -15
- package/src/util/sszBytes.ts +25 -5
|
@@ -8,16 +8,8 @@ import {
|
|
|
8
8
|
ForkChoiceErrorCode,
|
|
9
9
|
NotReorgedReason,
|
|
10
10
|
getSafeExecutionBlockHash,
|
|
11
|
-
isGloasBlock,
|
|
12
11
|
} from "@lodestar/fork-choice";
|
|
13
|
-
import {
|
|
14
|
-
ForkPostAltair,
|
|
15
|
-
ForkPostElectra,
|
|
16
|
-
ForkPostGloas,
|
|
17
|
-
ForkSeq,
|
|
18
|
-
MAX_SEED_LOOKAHEAD,
|
|
19
|
-
SLOTS_PER_EPOCH,
|
|
20
|
-
} from "@lodestar/params";
|
|
12
|
+
import {ForkPostAltair, ForkPostElectra, ForkSeq, MAX_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
21
13
|
import {
|
|
22
14
|
IBeaconStateView,
|
|
23
15
|
RootCache,
|
|
@@ -25,18 +17,10 @@ import {
|
|
|
25
17
|
computeStartSlotAtEpoch,
|
|
26
18
|
computeTimeAtSlot,
|
|
27
19
|
isStartSlotOfEpoch,
|
|
20
|
+
isStatePostAltair,
|
|
21
|
+
isStatePostBellatrix,
|
|
28
22
|
} from "@lodestar/state-transition";
|
|
29
|
-
import {
|
|
30
|
-
Attestation,
|
|
31
|
-
BeaconBlock,
|
|
32
|
-
SignedBeaconBlock,
|
|
33
|
-
altair,
|
|
34
|
-
capella,
|
|
35
|
-
electra,
|
|
36
|
-
isGloasBeaconBlock,
|
|
37
|
-
phase0,
|
|
38
|
-
ssz,
|
|
39
|
-
} from "@lodestar/types";
|
|
23
|
+
import {Attestation, BeaconBlock, altair, capella, electra, isGloasBeaconBlock, phase0, ssz} from "@lodestar/types";
|
|
40
24
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
41
25
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
42
26
|
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
@@ -46,7 +30,7 @@ import type {BeaconChain} from "../chain.js";
|
|
|
46
30
|
import {ChainEvent, ReorgEventData} from "../emitter.js";
|
|
47
31
|
import {ForkchoiceCaller} from "../forkChoice/index.js";
|
|
48
32
|
import {REPROCESS_MIN_TIME_TO_NEXT_SLOT_SEC} from "../reprocess.js";
|
|
49
|
-
import {
|
|
33
|
+
import {toCheckpointHex} from "../stateCache/persistentCheckpointsCache.js";
|
|
50
34
|
import {isBlockInputBlobs, isBlockInputColumns} from "./blockInput/blockInput.js";
|
|
51
35
|
import {AttestationImportOpt, FullyVerifiedBlock, ImportBlockOpts} from "./types.js";
|
|
52
36
|
import {getCheckpointFromState} from "./utils/checkpoint.js";
|
|
@@ -85,8 +69,8 @@ export async function importBlock(
|
|
|
85
69
|
fullyVerifiedBlock: FullyVerifiedBlock,
|
|
86
70
|
opts: ImportBlockOpts
|
|
87
71
|
): Promise<void> {
|
|
88
|
-
const {blockInput,
|
|
89
|
-
|
|
72
|
+
const {blockInput, postState, parentBlockSlot, dataAvailabilityStatus, indexedAttestations} = fullyVerifiedBlock;
|
|
73
|
+
let {executionStatus} = fullyVerifiedBlock;
|
|
90
74
|
const block = blockInput.getBlock();
|
|
91
75
|
const source = blockInput.getBlockSource();
|
|
92
76
|
const {slot: blockSlot} = block.message;
|
|
@@ -97,7 +81,7 @@ export async function importBlock(
|
|
|
97
81
|
const blockEpoch = computeEpochAtSlot(blockSlot);
|
|
98
82
|
const prevFinalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
99
83
|
const blockDelaySec =
|
|
100
|
-
fullyVerifiedBlock.seenTimestampSec - computeTimeAtSlot(this.config, blockSlot,
|
|
84
|
+
fullyVerifiedBlock.seenTimestampSec - computeTimeAtSlot(this.config, blockSlot, postState.genesisTime);
|
|
101
85
|
const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
|
|
102
86
|
const fork = this.config.getForkSeq(blockSlot);
|
|
103
87
|
|
|
@@ -120,56 +104,47 @@ export async function importBlock(
|
|
|
120
104
|
// 2. Import block to fork choice
|
|
121
105
|
|
|
122
106
|
// Should compute checkpoint balances before forkchoice.onBlock
|
|
123
|
-
this.checkpointBalancesCache.processState(blockRootHex,
|
|
107
|
+
this.checkpointBalancesCache.processState(blockRootHex, postState);
|
|
108
|
+
if (fork >= ForkSeq.gloas) {
|
|
109
|
+
const parentRootHex = toRootHex(block.message.parentRoot);
|
|
110
|
+
const parentBlock = this.forkChoice.getBlockHexDefaultStatus(parentRootHex);
|
|
111
|
+
if (parentBlock === null) {
|
|
112
|
+
throw Error(`Parent block not found in forkChoice, parentRoot=${parentRootHex}`);
|
|
113
|
+
}
|
|
114
|
+
if (parentBlock.executionStatus === ExecutionStatus.Invalid) {
|
|
115
|
+
throw Error(`Parent block has invalid execution status, parentRoot=${parentRootHex}`);
|
|
116
|
+
}
|
|
117
|
+
executionStatus = parentBlock.executionStatus;
|
|
118
|
+
}
|
|
124
119
|
const blockSummary = this.forkChoice.onBlock(
|
|
125
120
|
block.message,
|
|
126
|
-
|
|
121
|
+
postState,
|
|
127
122
|
blockDelaySec,
|
|
128
123
|
currentSlot,
|
|
129
|
-
|
|
124
|
+
executionStatus,
|
|
130
125
|
dataAvailabilityStatus
|
|
131
126
|
);
|
|
132
127
|
|
|
133
128
|
// This adds the state necessary to process the next block
|
|
134
129
|
// Some block event handlers require state being in state cache so need to do this before emitting EventType.block
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
block: block as SignedBeaconBlock<ForkPostGloas>,
|
|
146
|
-
forkName: blockInput.forkName,
|
|
147
|
-
sampledColumns: this.custodyConfig.sampledColumns,
|
|
148
|
-
custodyColumns: this.custodyConfig.custodyColumns,
|
|
149
|
-
timeCreatedSec: fullyVerifiedBlock.seenTimestampSec,
|
|
150
|
-
});
|
|
151
|
-
this.logger.debug("Created PayloadEnvelopeInput for block", {
|
|
152
|
-
slot: blockSlot,
|
|
153
|
-
root: blockRootHex,
|
|
154
|
-
source: source.source,
|
|
155
|
-
...(opts.seenTimestampSec !== undefined ? {recvToImport: Date.now() / 1000 - opts.seenTimestampSec} : {}),
|
|
156
|
-
});
|
|
130
|
+
this.regen.processState(blockRootHex, postState);
|
|
131
|
+
|
|
132
|
+
// For range sync we skip triggerGetBlobs because column fetching is handled in the range path.
|
|
133
|
+
if (fork >= ForkSeq.gloas && !opts.fromRangeSync) {
|
|
134
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
135
|
+
// PayloadEnvelopeInput is supposed to have right after we have block
|
|
136
|
+
// there are 4 sources of them: gossip, by root, by range and api
|
|
137
|
+
if (!payloadInput) {
|
|
138
|
+
throw Error(`PayloadEnvelopeInput not seeded for block ${blockRootHex} before importBlock`);
|
|
139
|
+
}
|
|
157
140
|
|
|
158
141
|
// Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
|
|
159
142
|
// which is all the information we need so there is no reason to delay until execution payload arrives
|
|
160
143
|
// TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
|
|
161
144
|
// (for example later in the slot). Do not couple retries to incoming gossip columns.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
this.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
|
|
166
|
-
this.logger.debug(
|
|
167
|
-
"Error processing execution payload after getBlobs",
|
|
168
|
-
{slot: blockSlot, root: blockRootHex},
|
|
169
|
-
e as Error
|
|
170
|
-
);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
145
|
+
// Columns fetched here feed payloadInput.addColumn, which resolves waitForAllData for any
|
|
146
|
+
// in-flight importExecutionPayload. No processExecutionPayload trigger needed from this path.
|
|
147
|
+
this.getBlobsTracker.triggerGetBlobs(payloadInput);
|
|
173
148
|
}
|
|
174
149
|
|
|
175
150
|
this.metrics?.importBlock.bySource.inc({source: source.source});
|
|
@@ -189,7 +164,7 @@ export async function importBlock(
|
|
|
189
164
|
(opts.importAttestations !== AttestationImportOpt.Skip && blockEpoch >= currentEpoch - FORK_CHOICE_ATT_EPOCH_LIMIT)
|
|
190
165
|
) {
|
|
191
166
|
const attestations = block.message.body.attestations;
|
|
192
|
-
const rootCache = new RootCache(
|
|
167
|
+
const rootCache = new RootCache(postState);
|
|
193
168
|
const invalidAttestationErrorsByCode = new Map<string, {error: Error; count: number}>();
|
|
194
169
|
|
|
195
170
|
const addAttestation = fork >= ForkSeq.electra ? addAttestationPostElectra : addAttestationPreElectra;
|
|
@@ -203,7 +178,7 @@ export async function importBlock(
|
|
|
203
178
|
const attDataRoot = toRootHex(ssz.phase0.AttestationData.hashTreeRoot(indexedAttestation.data));
|
|
204
179
|
addAttestation.call(
|
|
205
180
|
this,
|
|
206
|
-
|
|
181
|
+
postState,
|
|
207
182
|
target,
|
|
208
183
|
attDataRoot,
|
|
209
184
|
attestation as Attestation<ForkPostElectra>,
|
|
@@ -318,7 +293,7 @@ export async function importBlock(
|
|
|
318
293
|
|
|
319
294
|
if (newHead.blockRoot !== oldHead.blockRoot) {
|
|
320
295
|
// Set head state as strong reference
|
|
321
|
-
this.regen.updateHeadState(newHead,
|
|
296
|
+
this.regen.updateHeadState(newHead, postState);
|
|
322
297
|
|
|
323
298
|
try {
|
|
324
299
|
this.emitter.emit(routes.events.EventType.head, {
|
|
@@ -388,11 +363,13 @@ export async function importBlock(
|
|
|
388
363
|
// we want to import block asap so do this in the next event loop
|
|
389
364
|
callInNextEventLoop(() => {
|
|
390
365
|
try {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
366
|
+
if (isStatePostAltair(postState)) {
|
|
367
|
+
this.lightClientServer?.onImportBlockHead(
|
|
368
|
+
block.message as BeaconBlock<ForkPostAltair>,
|
|
369
|
+
postState,
|
|
370
|
+
parentBlockSlot
|
|
371
|
+
);
|
|
372
|
+
}
|
|
396
373
|
} catch (e) {
|
|
397
374
|
this.logger.verbose("Error lightClientServer.onImportBlock", {slot: blockSlot}, e as Error);
|
|
398
375
|
}
|
|
@@ -411,11 +388,11 @@ export async function importBlock(
|
|
|
411
388
|
// and the block is weak and can potentially be reorged out.
|
|
412
389
|
let shouldOverrideFcu = false;
|
|
413
390
|
|
|
414
|
-
if (blockSlot >= currentSlot &&
|
|
391
|
+
if (blockSlot >= currentSlot && isStatePostBellatrix(postState) && postState.isExecutionStateType) {
|
|
415
392
|
let notOverrideFcuReason = NotReorgedReason.Unknown;
|
|
416
393
|
const proposalSlot = blockSlot + 1;
|
|
417
394
|
try {
|
|
418
|
-
const proposerIndex =
|
|
395
|
+
const proposerIndex = postState.getBeaconProposer(proposalSlot);
|
|
419
396
|
const feeRecipient = this.beaconProposerCache.get(proposerIndex);
|
|
420
397
|
|
|
421
398
|
if (feeRecipient) {
|
|
@@ -495,27 +472,27 @@ export async function importBlock(
|
|
|
495
472
|
}
|
|
496
473
|
}
|
|
497
474
|
|
|
498
|
-
if (!
|
|
499
|
-
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot:
|
|
475
|
+
if (!postState.isStateValidatorsNodesPopulated()) {
|
|
476
|
+
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot: postState.slot});
|
|
500
477
|
}
|
|
501
478
|
|
|
502
479
|
// Cache shufflings when crossing an epoch boundary
|
|
503
480
|
const parentEpoch = computeEpochAtSlot(parentBlockSlot);
|
|
504
481
|
if (parentEpoch < blockEpoch) {
|
|
505
|
-
this.shufflingCache.processState(
|
|
482
|
+
this.shufflingCache.processState(postState);
|
|
506
483
|
this.logger.verbose("Processed shuffling for next epoch", {parentEpoch, blockEpoch, slot: blockSlot});
|
|
507
484
|
}
|
|
508
485
|
|
|
509
486
|
if (blockSlot % SLOTS_PER_EPOCH === 0) {
|
|
510
487
|
// Cache state to preserve epoch transition work
|
|
511
|
-
const checkpointState =
|
|
488
|
+
const checkpointState = postState;
|
|
512
489
|
const cp = getCheckpointFromState(checkpointState);
|
|
513
|
-
this.regen.addCheckpointState(cp, checkpointState
|
|
490
|
+
this.regen.addCheckpointState(cp, checkpointState);
|
|
514
491
|
// consumers should not mutate state ever
|
|
515
492
|
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState);
|
|
516
493
|
|
|
517
494
|
// Note: in-lined code from previos handler of ChainEvent.checkpoint
|
|
518
|
-
this.logger.verbose("Checkpoint processed",
|
|
495
|
+
this.logger.verbose("Checkpoint processed", toCheckpointHex(cp));
|
|
519
496
|
|
|
520
497
|
const activeValidatorsCount = checkpointState.activeValidatorCount;
|
|
521
498
|
this.metrics?.currentActiveValidators.set(activeValidatorsCount);
|
|
@@ -533,7 +510,7 @@ export async function importBlock(
|
|
|
533
510
|
const justifiedEpoch = justifiedCheckpoint.epoch;
|
|
534
511
|
const preJustifiedEpoch = parentBlockSummary.justifiedEpoch;
|
|
535
512
|
if (justifiedEpoch > preJustifiedEpoch) {
|
|
536
|
-
this.logger.verbose("Checkpoint justified",
|
|
513
|
+
this.logger.verbose("Checkpoint justified", toCheckpointHex(justifiedCheckpoint));
|
|
537
514
|
this.metrics?.previousJustifiedEpoch.set(checkpointState.previousJustifiedCheckpoint.epoch);
|
|
538
515
|
this.metrics?.currentJustifiedEpoch.set(justifiedCheckpoint.epoch);
|
|
539
516
|
}
|
|
@@ -547,7 +524,7 @@ export async function importBlock(
|
|
|
547
524
|
state: toRootHex(checkpointState.hashTreeRoot()),
|
|
548
525
|
executionOptimistic: false,
|
|
549
526
|
});
|
|
550
|
-
this.logger.verbose("Checkpoint finalized",
|
|
527
|
+
this.logger.verbose("Checkpoint finalized", toCheckpointHex(finalizedCheckpoint));
|
|
551
528
|
this.metrics?.finalizedEpoch.set(finalizedCheckpoint.epoch);
|
|
552
529
|
}
|
|
553
530
|
}
|
|
@@ -598,11 +575,11 @@ export async function importBlock(
|
|
|
598
575
|
this.metrics?.parentBlockDistance.observe(blockSlot - parentBlockSlot);
|
|
599
576
|
this.metrics?.proposerBalanceDeltaAny.observe(fullyVerifiedBlock.proposerBalanceDelta);
|
|
600
577
|
this.validatorMonitor?.registerImportedBlock(block.message, fullyVerifiedBlock);
|
|
601
|
-
if (
|
|
578
|
+
if (isStatePostAltair(fullyVerifiedBlock.postState)) {
|
|
602
579
|
this.validatorMonitor?.registerSyncAggregateInBlock(
|
|
603
580
|
blockEpoch,
|
|
604
581
|
(block as altair.SignedBeaconBlock).message.body.syncAggregate,
|
|
605
|
-
fullyVerifiedBlock.
|
|
582
|
+
fullyVerifiedBlock.postState.currentSyncCommitteeIndexed.validatorIndices
|
|
606
583
|
);
|
|
607
584
|
}
|
|
608
585
|
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
|
-
import {ExecutionStatus, PayloadExecutionStatus} from "@lodestar/fork-choice";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import {ExecutionStatus, PayloadExecutionStatus, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
|
+
import {DataAvailabilityStatus, isStatePostGloas} from "@lodestar/state-transition";
|
|
4
|
+
import {isErrorAborted} from "@lodestar/utils";
|
|
5
|
+
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
6
6
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
7
7
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
8
8
|
import {BeaconChain} from "../chain.js";
|
|
9
9
|
import {RegenCaller} from "../regen/interface.js";
|
|
10
10
|
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
11
11
|
import {ImportPayloadOpts} from "./types.js";
|
|
12
|
+
import {
|
|
13
|
+
verifyExecutionPayloadEnvelope,
|
|
14
|
+
verifyExecutionPayloadEnvelopeSignature,
|
|
15
|
+
} from "./verifyExecutionPayloadEnvelope.js";
|
|
16
|
+
import {verifyPayloadsDataAvailability} from "./verifyPayloadsDataAvailability.js";
|
|
12
17
|
|
|
13
18
|
const EVENTSTREAM_EMIT_RECENT_EXECUTION_PAYLOAD_SLOTS = 64;
|
|
14
19
|
|
|
@@ -16,7 +21,7 @@ export enum PayloadErrorCode {
|
|
|
16
21
|
EXECUTION_ENGINE_INVALID = "PAYLOAD_ERROR_EXECUTION_ENGINE_INVALID",
|
|
17
22
|
EXECUTION_ENGINE_ERROR = "PAYLOAD_ERROR_EXECUTION_ENGINE_ERROR",
|
|
18
23
|
BLOCK_NOT_IN_FORK_CHOICE = "PAYLOAD_ERROR_BLOCK_NOT_IN_FORK_CHOICE",
|
|
19
|
-
|
|
24
|
+
ENVELOPE_VERIFICATION_ERROR = "PAYLOAD_ERROR_ENVELOPE_VERIFICATION_ERROR",
|
|
20
25
|
INVALID_SIGNATURE = "PAYLOAD_ERROR_INVALID_SIGNATURE",
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -36,7 +41,7 @@ export type PayloadErrorType =
|
|
|
36
41
|
blockRootHex: string;
|
|
37
42
|
}
|
|
38
43
|
| {
|
|
39
|
-
code: PayloadErrorCode.
|
|
44
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR;
|
|
40
45
|
message: string;
|
|
41
46
|
}
|
|
42
47
|
| {
|
|
@@ -56,7 +61,6 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
56
61
|
switch (status) {
|
|
57
62
|
case ExecutionPayloadStatus.VALID:
|
|
58
63
|
return ExecutionStatus.Valid;
|
|
59
|
-
// TODO GLOAS: Handle optimistic import for payload
|
|
60
64
|
case ExecutionPayloadStatus.SYNCING:
|
|
61
65
|
case ExecutionPayloadStatus.ACCEPTED:
|
|
62
66
|
return ExecutionStatus.Syncing;
|
|
@@ -68,37 +72,43 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
68
72
|
/**
|
|
69
73
|
* Import an execution payload envelope after all data is available.
|
|
70
74
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* 2. Gets the ProtoBlock from fork choice
|
|
74
|
-
* 3. Applies write-queue backpressure (waitForSpace) early, before verification
|
|
75
|
-
* 4. Regenerates the block state
|
|
76
|
-
* 5. Runs EL verification (notifyNewPayload) in parallel with signature verification and processExecutionPayloadEnvelope
|
|
77
|
-
* 6. Persists verified payload envelope to hot DB
|
|
78
|
-
* 7. Updates fork choice
|
|
79
|
-
* 8. Caches the post-execution payload state
|
|
80
|
-
* 9. Records metrics for column sources
|
|
81
|
-
* 10. Emits `execution_payload` for recent enough payloads after successful import
|
|
75
|
+
* The envelope is only verified here, no state mutation. State effects from the payload
|
|
76
|
+
* are applied on the next block via processParentExecutionPayload.
|
|
82
77
|
*
|
|
78
|
+
* The DA wait must have run upstream (range sync awaits DA in `verifyBlocksInEpoch` for the
|
|
79
|
+
* whole segment; gossip / API path uses the `processExecutionPayload` wrapper below).
|
|
80
|
+
*
|
|
81
|
+
* Steps:
|
|
82
|
+
* 1. Emit `execution_payload_available` event for payload attestation
|
|
83
|
+
* 2. Get the ProtoBlock from fork choice
|
|
84
|
+
* 3. Regenerate state for envelope verification
|
|
85
|
+
* 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
|
|
86
|
+
* 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
|
|
87
|
+
* 6. Update fork choice (transitions the block's PENDING variant to FULL)
|
|
88
|
+
* 7. Queue notifyForkchoiceUpdate to engine api
|
|
89
|
+
* 8. Record metrics for payload envelope and column sources
|
|
90
|
+
* 9. Emit `execution_payload` event
|
|
83
91
|
*/
|
|
84
92
|
export async function importExecutionPayload(
|
|
85
93
|
this: BeaconChain,
|
|
86
94
|
payloadInput: PayloadEnvelopeInput,
|
|
95
|
+
dataAvailabilityStatus: DataAvailabilityStatus,
|
|
87
96
|
opts: ImportPayloadOpts = {}
|
|
88
97
|
): Promise<void> {
|
|
89
98
|
const signedEnvelope = payloadInput.getPayloadEnvelope();
|
|
90
99
|
const envelope = signedEnvelope.message;
|
|
100
|
+
const slot = envelope.payload.slotNumber;
|
|
91
101
|
const blockRootHex = payloadInput.blockRootHex;
|
|
92
102
|
const blockHashHex = payloadInput.getBlockHashHex();
|
|
93
|
-
const fork = this.config.getForkName(
|
|
103
|
+
const fork = this.config.getForkName(slot);
|
|
94
104
|
|
|
95
|
-
// 1. Emit `execution_payload_available` event at the start of import. At this point the
|
|
96
|
-
// is already complete, so the payload and required data are available for
|
|
97
|
-
// This event
|
|
98
|
-
// it before getting a response from the
|
|
99
|
-
if (this.clock.currentSlot
|
|
105
|
+
// 1. Emit `execution_payload_available` event at the start of import. At this point the
|
|
106
|
+
// payload input is already complete, so the payload and required data are available for
|
|
107
|
+
// payload attestation. This event only signals availability (not validity), so we can emit
|
|
108
|
+
// it before getting a response from the EL on whether the payload is valid or not.
|
|
109
|
+
if (this.clock.currentSlot - slot < EVENTSTREAM_EMIT_RECENT_EXECUTION_PAYLOAD_SLOTS) {
|
|
100
110
|
this.emitter.emit(routes.events.EventType.executionPayloadAvailable, {
|
|
101
|
-
slot
|
|
111
|
+
slot,
|
|
102
112
|
blockRoot: blockRootHex,
|
|
103
113
|
});
|
|
104
114
|
}
|
|
@@ -112,72 +122,65 @@ export async function importExecutionPayload(
|
|
|
112
122
|
});
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
// 3.
|
|
116
|
-
// The actual DB write is deferred until after verification succeeds.
|
|
117
|
-
await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
|
|
118
|
-
|
|
119
|
-
// 4. Get pre-state for processExecutionPayloadEnvelope
|
|
120
|
-
// We need the block state (post-block, pre-payload) to process the envelope
|
|
125
|
+
// 3. Regenerate state for envelope verification
|
|
121
126
|
const blockState = await this.regen.getBlockSlotState(
|
|
122
127
|
protoBlock,
|
|
123
128
|
protoBlock.slot,
|
|
124
129
|
{dontTransferCache: true},
|
|
125
130
|
RegenCaller.processBlock
|
|
126
131
|
);
|
|
132
|
+
if (!isStatePostGloas(blockState)) {
|
|
133
|
+
throw new PayloadError({
|
|
134
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR,
|
|
135
|
+
message: `Expected gloas+ state for payload import, got fork=${blockState.forkName}`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 4. Verify envelope fields against state first to fail fast before the EL + BLS work.
|
|
140
|
+
// When validSignature is true, gossip/API has already verified both the signature and the
|
|
141
|
+
// executionRequestsRoot, so we skip those checks here.
|
|
142
|
+
try {
|
|
143
|
+
verifyExecutionPayloadEnvelope(this.config, blockState, envelope, {
|
|
144
|
+
verifyExecutionRequestsRoot: !opts.validSignature,
|
|
145
|
+
});
|
|
146
|
+
} catch (e) {
|
|
147
|
+
throw new PayloadError(
|
|
148
|
+
{
|
|
149
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR,
|
|
150
|
+
message: (e as Error).message,
|
|
151
|
+
},
|
|
152
|
+
`Envelope verification error: ${(e as Error).message}`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
127
155
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
// called when payloadInput.isComplete() is true, so all data is already available.
|
|
131
|
-
const [execResult, signatureValid, postPayloadResult] = await Promise.all([
|
|
156
|
+
// 4a. Run EL and signature verification in parallel
|
|
157
|
+
const [execResult, signatureValid] = await Promise.all([
|
|
132
158
|
this.executionEngine.notifyNewPayload(
|
|
133
159
|
fork,
|
|
134
160
|
envelope.payload,
|
|
135
161
|
payloadInput.getVersionedHashes(),
|
|
136
|
-
|
|
162
|
+
envelope.parentBeaconBlockRoot,
|
|
137
163
|
envelope.executionRequests
|
|
138
164
|
),
|
|
139
165
|
|
|
140
166
|
opts.validSignature === true
|
|
141
167
|
? Promise.resolve(true)
|
|
142
|
-
: (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return this.bls.verifySignatureSets([signatureSet]);
|
|
151
|
-
})(),
|
|
152
|
-
|
|
153
|
-
// Signature verified separately above.
|
|
154
|
-
// State root check is done separately below with better error typing (matching block pipeline pattern).
|
|
155
|
-
(async () => {
|
|
156
|
-
try {
|
|
157
|
-
return {
|
|
158
|
-
postPayloadState: blockState.processExecutionPayloadEnvelope(signedEnvelope, {
|
|
159
|
-
verifySignature: false,
|
|
160
|
-
verifyStateRoot: false,
|
|
161
|
-
}),
|
|
162
|
-
};
|
|
163
|
-
} catch (e) {
|
|
164
|
-
throw new PayloadError(
|
|
165
|
-
{
|
|
166
|
-
code: PayloadErrorCode.STATE_TRANSITION_ERROR,
|
|
167
|
-
message: (e as Error).message,
|
|
168
|
-
},
|
|
169
|
-
`State transition error: ${(e as Error).message}`
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
})(),
|
|
168
|
+
: verifyExecutionPayloadEnvelopeSignature(
|
|
169
|
+
this.config,
|
|
170
|
+
blockState,
|
|
171
|
+
this.pubkeyCache,
|
|
172
|
+
signedEnvelope,
|
|
173
|
+
payloadInput.proposerIndex,
|
|
174
|
+
this.bls
|
|
175
|
+
),
|
|
173
176
|
]);
|
|
174
177
|
|
|
175
|
-
//
|
|
178
|
+
// 4b. Check signature verification result
|
|
176
179
|
if (!signatureValid) {
|
|
177
180
|
throw new PayloadError({code: PayloadErrorCode.INVALID_SIGNATURE});
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
//
|
|
183
|
+
// 4c. Handle EL response
|
|
181
184
|
switch (execResult.status) {
|
|
182
185
|
case ExecutionPayloadStatus.VALID:
|
|
183
186
|
break;
|
|
@@ -203,65 +206,80 @@ export async function importExecutionPayload(
|
|
|
203
206
|
});
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (!byteArrayEquals(envelope.stateRoot, postPayloadStateRoot)) {
|
|
210
|
-
throw new PayloadError({
|
|
211
|
-
code: PayloadErrorCode.STATE_TRANSITION_ERROR,
|
|
212
|
-
message: `Envelope state root mismatch expected=${toRootHex(envelope.stateRoot)} actual=${toRootHex(postPayloadStateRoot)}`,
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// 6. Persist payload envelope to hot DB (performed asynchronously to avoid blocking)
|
|
209
|
+
// 5. Persist payload envelope to hot DB. Wait for write-queue space here to apply backpressure
|
|
210
|
+
// on the import pipeline during sync, then perform the write asynchronously to avoid blocking.
|
|
211
|
+
await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
|
|
217
212
|
this.unfinalizedPayloadEnvelopeWrites.push(payloadInput).catch((e) => {
|
|
218
213
|
if (!isQueueErrorAborted(e)) {
|
|
219
214
|
this.logger.error(
|
|
220
215
|
"Error pushing payload envelope to unfinalized write queue",
|
|
221
|
-
{slot
|
|
216
|
+
{slot, blockRoot: blockRootHex},
|
|
222
217
|
e as Error
|
|
223
218
|
);
|
|
224
219
|
}
|
|
225
220
|
});
|
|
226
221
|
|
|
227
|
-
//
|
|
222
|
+
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
223
|
+
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
228
224
|
this.forkChoice.onExecutionPayload(
|
|
229
225
|
blockRootHex,
|
|
230
226
|
blockHashHex,
|
|
231
227
|
envelope.payload.blockNumber,
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
execStatus,
|
|
229
|
+
dataAvailabilityStatus
|
|
234
230
|
);
|
|
235
231
|
|
|
236
|
-
//
|
|
237
|
-
this.
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
this.
|
|
232
|
+
// 7. Queue notifyForkchoiceUpdate to engine api
|
|
233
|
+
const head = this.forkChoice.getHead();
|
|
234
|
+
if (!this.opts.disableImportExecutionFcU && blockRootHex === head.blockRoot) {
|
|
235
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
236
|
+
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
237
|
+
this.executionEngine.notifyForkchoiceUpdate(fork, blockHashHex, safeBlockHash, finalizedBlockHash).catch((e) => {
|
|
238
|
+
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
|
|
239
|
+
this.logger.error("Error pushing notifyForkchoiceUpdate()", {blockHashHex, finalizedBlockHash}, e);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
241
242
|
}
|
|
242
243
|
|
|
243
|
-
//
|
|
244
|
+
// 8. Record metrics for payload envelope and column sources
|
|
244
245
|
this.metrics?.importPayload.bySource.inc({source: payloadInput.getPayloadEnvelopeSource().source});
|
|
245
246
|
for (const {source} of payloadInput.getSampledColumnsWithSource()) {
|
|
246
247
|
this.metrics?.importPayload.columnsBySource.inc({source});
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
//
|
|
250
|
-
if (this.clock.currentSlot -
|
|
250
|
+
// 9. Emit event after payload is fully verified and imported to fork choice, only for recent enough payloads
|
|
251
|
+
if (this.clock.currentSlot - slot < EVENTSTREAM_EMIT_RECENT_EXECUTION_PAYLOAD_SLOTS) {
|
|
251
252
|
this.emitter.emit(routes.events.EventType.executionPayload, {
|
|
252
|
-
slot
|
|
253
|
+
slot,
|
|
253
254
|
builderIndex: envelope.builderIndex,
|
|
254
255
|
blockHash: blockHashHex,
|
|
255
256
|
blockRoot: blockRootHex,
|
|
256
|
-
|
|
257
|
-
// TODO GLOAS: revisit once we support optimistic import
|
|
258
|
-
executionOptimistic: false,
|
|
257
|
+
executionOptimistic: execStatus === ExecutionStatus.Syncing,
|
|
259
258
|
});
|
|
260
259
|
}
|
|
261
260
|
|
|
262
261
|
this.logger.verbose("Execution payload imported", {
|
|
263
|
-
slot
|
|
264
|
-
|
|
262
|
+
slot,
|
|
263
|
+
builderIndex: envelope.builderIndex,
|
|
264
|
+
blockRoot: blockRootHex,
|
|
265
265
|
blockHash: blockHashHex,
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Process an execution payload envelope end-to-end: wait for DA, then import.
|
|
271
|
+
*
|
|
272
|
+
* Used by the PayloadEnvelopeProcessor queue (gossip / API / unknown-payload sync) — i.e.
|
|
273
|
+
* callers that have NOT already awaited DA themselves. Range sync's inline dispatch in
|
|
274
|
+
* processBlocks skips this wrapper and calls `importExecutionPayload` directly, since
|
|
275
|
+
* `verifyBlocksInEpoch` already awaited DA for the segment.
|
|
276
|
+
*/
|
|
277
|
+
export async function processExecutionPayload(
|
|
278
|
+
this: BeaconChain,
|
|
279
|
+
payloadInput: PayloadEnvelopeInput,
|
|
280
|
+
signal: AbortSignal,
|
|
281
|
+
opts: ImportPayloadOpts = {}
|
|
282
|
+
): Promise<void> {
|
|
283
|
+
const {dataAvailabilityStatuses} = await verifyPayloadsDataAvailability([payloadInput], signal);
|
|
284
|
+
await importExecutionPayload.call(this, payloadInput, dataAvailabilityStatuses[0], opts);
|
|
285
|
+
}
|