@lodestar/beacon-node 1.42.0 → 1.43.0-dev.05a33e512f
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/blockInput/blockInput.d.ts +3 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +4 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +40 -58
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +32 -14
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +107 -87
- 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 +58 -26
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +15 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +48 -2
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +17 -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 +80 -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 +73 -49
- 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 +40 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -0
- package/lib/chain/errors/proposerPreferences.js +14 -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/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +6 -1
- package/lib/chain/initState.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 +24 -7
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +69 -17
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/seenCache/seenProposerPreferences.d.ts +16 -0
- package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +1 -0
- package/lib/chain/seenCache/seenProposerPreferences.js +26 -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 +30 -12
- 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 +91 -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 +32 -748
- 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 +64 -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/constants.d.ts +3 -1
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +3 -4
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/range/batch.d.ts +35 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +240 -59
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +19 -4
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +64 -11
- 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 +31 -9
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/sync.d.ts.map +1 -1
- package/lib/sync/sync.js +13 -0
- package/lib/sync/sync.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 +29 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +738 -61
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +67 -10
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +211 -26
- 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/blockInput/blockInput.ts +4 -1
- package/src/chain/blocks/importBlock.ts +45 -86
- package/src/chain/blocks/importExecutionPayload.ts +133 -103
- package/src/chain/blocks/index.ts +72 -24
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +64 -3
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +18 -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 +137 -0
- package/src/chain/blocks/verifyPayloadsDataAvailability.ts +41 -0
- package/src/chain/blocks/writePayloadEnvelopeInputToDb.ts +9 -18
- package/src/chain/chain.ts +102 -72
- 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 +47 -0
- package/src/chain/forkChoice/index.ts +19 -28
- package/src/chain/initState.ts +9 -1
- 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 +89 -21
- package/src/chain/seenCache/seenProposerPreferences.ts +32 -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 +32 -11
- package/src/chain/validation/executionPayloadEnvelope.ts +32 -13
- package/src/chain/validation/payloadAttestationMessage.ts +9 -3
- package/src/chain/validation/proposerPreferences.ts +110 -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 +84 -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/constants.ts +4 -4
- package/src/sync/range/batch.ts +320 -67
- package/src/sync/range/chain.ts +89 -14
- package/src/sync/range/range.ts +34 -9
- package/src/sync/sync.ts +13 -1
- package/src/sync/types.ts +72 -0
- package/src/sync/unknownBlock.ts +928 -65
- package/src/sync/utils/downloadByRange.ts +378 -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,57 +104,30 @@ 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
|
-
// Post-Gloas: blockSummary.payloadStatus is always PENDING, so payloadPresent = false (block state only, no payload processing yet)
|
|
137
|
-
const payloadPresent = !isGloasBlock(blockSummary);
|
|
138
|
-
// processState manages both block state and payload state variants together for memory/disk management
|
|
139
|
-
this.regen.processBlockState(blockRootHex, postBlockState);
|
|
140
|
-
|
|
141
|
-
// For Gloas blocks, create PayloadEnvelopeInput so it's available for later payload import
|
|
142
|
-
if (fork >= ForkSeq.gloas) {
|
|
143
|
-
const payloadInput = this.seenPayloadEnvelopeInputCache.add({
|
|
144
|
-
blockRootHex,
|
|
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
|
-
});
|
|
157
|
-
|
|
158
|
-
// Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
|
|
159
|
-
// which is all the information we need so there is no reason to delay until execution payload arrives
|
|
160
|
-
// TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
|
|
161
|
-
// (for example later in the slot). Do not couple retries to incoming gossip columns.
|
|
162
|
-
this.getBlobsTracker.triggerGetBlobs(payloadInput, () => {
|
|
163
|
-
// TODO GLOAS: come up with a better mechanism to trigger processExecutionPayload after data becomes available,
|
|
164
|
-
// similar to how pre-gloas uses waitForBlockAndAllData with a cutoff timeout and incompleteBlockInput event
|
|
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
|
-
});
|
|
173
|
-
}
|
|
130
|
+
this.regen.processState(blockRootHex, postState);
|
|
174
131
|
|
|
175
132
|
this.metrics?.importBlock.bySource.inc({source: source.source});
|
|
176
133
|
this.logger.verbose("Added block to forkchoice and state cache", {slot: blockSlot, root: blockRootHex});
|
|
@@ -189,7 +146,7 @@ export async function importBlock(
|
|
|
189
146
|
(opts.importAttestations !== AttestationImportOpt.Skip && blockEpoch >= currentEpoch - FORK_CHOICE_ATT_EPOCH_LIMIT)
|
|
190
147
|
) {
|
|
191
148
|
const attestations = block.message.body.attestations;
|
|
192
|
-
const rootCache = new RootCache(
|
|
149
|
+
const rootCache = new RootCache(postState);
|
|
193
150
|
const invalidAttestationErrorsByCode = new Map<string, {error: Error; count: number}>();
|
|
194
151
|
|
|
195
152
|
const addAttestation = fork >= ForkSeq.electra ? addAttestationPostElectra : addAttestationPreElectra;
|
|
@@ -203,7 +160,7 @@ export async function importBlock(
|
|
|
203
160
|
const attDataRoot = toRootHex(ssz.phase0.AttestationData.hashTreeRoot(indexedAttestation.data));
|
|
204
161
|
addAttestation.call(
|
|
205
162
|
this,
|
|
206
|
-
|
|
163
|
+
postState,
|
|
207
164
|
target,
|
|
208
165
|
attDataRoot,
|
|
209
166
|
attestation as Attestation<ForkPostElectra>,
|
|
@@ -318,7 +275,7 @@ export async function importBlock(
|
|
|
318
275
|
|
|
319
276
|
if (newHead.blockRoot !== oldHead.blockRoot) {
|
|
320
277
|
// Set head state as strong reference
|
|
321
|
-
this.regen.updateHeadState(newHead,
|
|
278
|
+
this.regen.updateHeadState(newHead, postState);
|
|
322
279
|
|
|
323
280
|
try {
|
|
324
281
|
this.emitter.emit(routes.events.EventType.head, {
|
|
@@ -388,11 +345,13 @@ export async function importBlock(
|
|
|
388
345
|
// we want to import block asap so do this in the next event loop
|
|
389
346
|
callInNextEventLoop(() => {
|
|
390
347
|
try {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
348
|
+
if (isStatePostAltair(postState)) {
|
|
349
|
+
this.lightClientServer?.onImportBlockHead(
|
|
350
|
+
block.message as BeaconBlock<ForkPostAltair>,
|
|
351
|
+
postState,
|
|
352
|
+
parentBlockSlot
|
|
353
|
+
);
|
|
354
|
+
}
|
|
396
355
|
} catch (e) {
|
|
397
356
|
this.logger.verbose("Error lightClientServer.onImportBlock", {slot: blockSlot}, e as Error);
|
|
398
357
|
}
|
|
@@ -411,11 +370,11 @@ export async function importBlock(
|
|
|
411
370
|
// and the block is weak and can potentially be reorged out.
|
|
412
371
|
let shouldOverrideFcu = false;
|
|
413
372
|
|
|
414
|
-
if (blockSlot >= currentSlot &&
|
|
373
|
+
if (blockSlot >= currentSlot && isStatePostBellatrix(postState) && postState.isExecutionStateType) {
|
|
415
374
|
let notOverrideFcuReason = NotReorgedReason.Unknown;
|
|
416
375
|
const proposalSlot = blockSlot + 1;
|
|
417
376
|
try {
|
|
418
|
-
const proposerIndex =
|
|
377
|
+
const proposerIndex = postState.getBeaconProposer(proposalSlot);
|
|
419
378
|
const feeRecipient = this.beaconProposerCache.get(proposerIndex);
|
|
420
379
|
|
|
421
380
|
if (feeRecipient) {
|
|
@@ -495,27 +454,27 @@ export async function importBlock(
|
|
|
495
454
|
}
|
|
496
455
|
}
|
|
497
456
|
|
|
498
|
-
if (!
|
|
499
|
-
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot:
|
|
457
|
+
if (!postState.isStateValidatorsNodesPopulated()) {
|
|
458
|
+
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot: postState.slot});
|
|
500
459
|
}
|
|
501
460
|
|
|
502
461
|
// Cache shufflings when crossing an epoch boundary
|
|
503
462
|
const parentEpoch = computeEpochAtSlot(parentBlockSlot);
|
|
504
463
|
if (parentEpoch < blockEpoch) {
|
|
505
|
-
this.shufflingCache.processState(
|
|
464
|
+
this.shufflingCache.processState(postState);
|
|
506
465
|
this.logger.verbose("Processed shuffling for next epoch", {parentEpoch, blockEpoch, slot: blockSlot});
|
|
507
466
|
}
|
|
508
467
|
|
|
509
468
|
if (blockSlot % SLOTS_PER_EPOCH === 0) {
|
|
510
469
|
// Cache state to preserve epoch transition work
|
|
511
|
-
const checkpointState =
|
|
470
|
+
const checkpointState = postState;
|
|
512
471
|
const cp = getCheckpointFromState(checkpointState);
|
|
513
|
-
this.regen.addCheckpointState(cp, checkpointState
|
|
472
|
+
this.regen.addCheckpointState(cp, checkpointState);
|
|
514
473
|
// consumers should not mutate state ever
|
|
515
474
|
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState);
|
|
516
475
|
|
|
517
476
|
// Note: in-lined code from previos handler of ChainEvent.checkpoint
|
|
518
|
-
this.logger.verbose("Checkpoint processed",
|
|
477
|
+
this.logger.verbose("Checkpoint processed", toCheckpointHex(cp));
|
|
519
478
|
|
|
520
479
|
const activeValidatorsCount = checkpointState.activeValidatorCount;
|
|
521
480
|
this.metrics?.currentActiveValidators.set(activeValidatorsCount);
|
|
@@ -533,7 +492,7 @@ export async function importBlock(
|
|
|
533
492
|
const justifiedEpoch = justifiedCheckpoint.epoch;
|
|
534
493
|
const preJustifiedEpoch = parentBlockSummary.justifiedEpoch;
|
|
535
494
|
if (justifiedEpoch > preJustifiedEpoch) {
|
|
536
|
-
this.logger.verbose("Checkpoint justified",
|
|
495
|
+
this.logger.verbose("Checkpoint justified", toCheckpointHex(justifiedCheckpoint));
|
|
537
496
|
this.metrics?.previousJustifiedEpoch.set(checkpointState.previousJustifiedCheckpoint.epoch);
|
|
538
497
|
this.metrics?.currentJustifiedEpoch.set(justifiedCheckpoint.epoch);
|
|
539
498
|
}
|
|
@@ -547,7 +506,7 @@ export async function importBlock(
|
|
|
547
506
|
state: toRootHex(checkpointState.hashTreeRoot()),
|
|
548
507
|
executionOptimistic: false,
|
|
549
508
|
});
|
|
550
|
-
this.logger.verbose("Checkpoint finalized",
|
|
509
|
+
this.logger.verbose("Checkpoint finalized", toCheckpointHex(finalizedCheckpoint));
|
|
551
510
|
this.metrics?.finalizedEpoch.set(finalizedCheckpoint.epoch);
|
|
552
511
|
}
|
|
553
512
|
}
|
|
@@ -598,11 +557,11 @@ export async function importBlock(
|
|
|
598
557
|
this.metrics?.parentBlockDistance.observe(blockSlot - parentBlockSlot);
|
|
599
558
|
this.metrics?.proposerBalanceDeltaAny.observe(fullyVerifiedBlock.proposerBalanceDelta);
|
|
600
559
|
this.validatorMonitor?.registerImportedBlock(block.message, fullyVerifiedBlock);
|
|
601
|
-
if (
|
|
560
|
+
if (isStatePostAltair(fullyVerifiedBlock.postState)) {
|
|
602
561
|
this.validatorMonitor?.registerSyncAggregateInBlock(
|
|
603
562
|
blockEpoch,
|
|
604
563
|
(block as altair.SignedBeaconBlock).message.body.syncAggregate,
|
|
605
|
-
fullyVerifiedBlock.
|
|
564
|
+
fullyVerifiedBlock.postState.currentSyncCommitteeIndexed.validatorIndices
|
|
606
565
|
);
|
|
607
566
|
}
|
|
608
567
|
|
|
@@ -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,8 @@ 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
|
+
MISS_BLOCK_STATE = "PAYLOAD_ERROR_MISS_BLOCK_STATE",
|
|
25
|
+
ENVELOPE_VERIFICATION_ERROR = "PAYLOAD_ERROR_ENVELOPE_VERIFICATION_ERROR",
|
|
20
26
|
INVALID_SIGNATURE = "PAYLOAD_ERROR_INVALID_SIGNATURE",
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -36,7 +42,11 @@ export type PayloadErrorType =
|
|
|
36
42
|
blockRootHex: string;
|
|
37
43
|
}
|
|
38
44
|
| {
|
|
39
|
-
code: PayloadErrorCode.
|
|
45
|
+
code: PayloadErrorCode.MISS_BLOCK_STATE;
|
|
46
|
+
blockRootHex: string;
|
|
47
|
+
}
|
|
48
|
+
| {
|
|
49
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR;
|
|
40
50
|
message: string;
|
|
41
51
|
}
|
|
42
52
|
| {
|
|
@@ -56,7 +66,6 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
56
66
|
switch (status) {
|
|
57
67
|
case ExecutionPayloadStatus.VALID:
|
|
58
68
|
return ExecutionStatus.Valid;
|
|
59
|
-
// TODO GLOAS: Handle optimistic import for payload
|
|
60
69
|
case ExecutionPayloadStatus.SYNCING:
|
|
61
70
|
case ExecutionPayloadStatus.ACCEPTED:
|
|
62
71
|
return ExecutionStatus.Syncing;
|
|
@@ -68,37 +77,43 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
68
77
|
/**
|
|
69
78
|
* Import an execution payload envelope after all data is available.
|
|
70
79
|
*
|
|
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
|
|
80
|
+
* The envelope is only verified here, no state mutation. State effects from the payload
|
|
81
|
+
* are applied on the next block via processParentExecutionPayload.
|
|
82
82
|
*
|
|
83
|
+
* The DA wait must have run upstream (range sync awaits DA in `verifyBlocksInEpoch` for the
|
|
84
|
+
* whole segment; gossip / API path uses the `processExecutionPayload` wrapper below).
|
|
85
|
+
*
|
|
86
|
+
* Steps:
|
|
87
|
+
* 1. Emit `execution_payload_available` event for payload attestation
|
|
88
|
+
* 2. Get the ProtoBlock from fork choice
|
|
89
|
+
* 3. Regenerate state for envelope verification
|
|
90
|
+
* 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
|
|
91
|
+
* 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
|
|
92
|
+
* 6. Update fork choice (transitions the block's PENDING variant to FULL)
|
|
93
|
+
* 7. Queue notifyForkchoiceUpdate to engine api
|
|
94
|
+
* 8. Record metrics for payload envelope and column sources
|
|
95
|
+
* 9. Emit `execution_payload` event
|
|
83
96
|
*/
|
|
84
97
|
export async function importExecutionPayload(
|
|
85
98
|
this: BeaconChain,
|
|
86
99
|
payloadInput: PayloadEnvelopeInput,
|
|
100
|
+
dataAvailabilityStatus: DataAvailabilityStatus,
|
|
87
101
|
opts: ImportPayloadOpts = {}
|
|
88
102
|
): Promise<void> {
|
|
89
103
|
const signedEnvelope = payloadInput.getPayloadEnvelope();
|
|
90
104
|
const envelope = signedEnvelope.message;
|
|
105
|
+
const slot = envelope.payload.slotNumber;
|
|
91
106
|
const blockRootHex = payloadInput.blockRootHex;
|
|
92
107
|
const blockHashHex = payloadInput.getBlockHashHex();
|
|
93
|
-
const fork = this.config.getForkName(
|
|
108
|
+
const fork = this.config.getForkName(slot);
|
|
94
109
|
|
|
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
|
|
110
|
+
// 1. Emit `execution_payload_available` event at the start of import. At this point the
|
|
111
|
+
// payload input is already complete, so the payload and required data are available for
|
|
112
|
+
// payload attestation. This event only signals availability (not validity), so we can emit
|
|
113
|
+
// it before getting a response from the EL on whether the payload is valid or not.
|
|
114
|
+
if (this.clock.currentSlot - slot < EVENTSTREAM_EMIT_RECENT_EXECUTION_PAYLOAD_SLOTS) {
|
|
100
115
|
this.emitter.emit(routes.events.EventType.executionPayloadAvailable, {
|
|
101
|
-
slot
|
|
116
|
+
slot,
|
|
102
117
|
blockRoot: blockRootHex,
|
|
103
118
|
});
|
|
104
119
|
}
|
|
@@ -112,72 +127,72 @@ export async function importExecutionPayload(
|
|
|
112
127
|
});
|
|
113
128
|
}
|
|
114
129
|
|
|
115
|
-
// 3.
|
|
116
|
-
|
|
117
|
-
|
|
130
|
+
// 3. Regenerate state for envelope verification
|
|
131
|
+
const blockState = await this.regen
|
|
132
|
+
.getBlockSlotState(protoBlock, protoBlock.slot, {dontTransferCache: true}, RegenCaller.processBlock)
|
|
133
|
+
.catch(() =>
|
|
134
|
+
// only happen at the 1st batch of skipped slot checkpoint sync
|
|
135
|
+
this.regen.getClosestHeadState(protoBlock)
|
|
136
|
+
);
|
|
118
137
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
if (blockState == null) {
|
|
139
|
+
throw new PayloadError({
|
|
140
|
+
code: PayloadErrorCode.MISS_BLOCK_STATE,
|
|
141
|
+
blockRootHex: protoBlock.blockRoot,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (!isStatePostGloas(blockState)) {
|
|
145
|
+
throw new PayloadError({
|
|
146
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR,
|
|
147
|
+
message: `Expected gloas+ state for payload import, got fork=${blockState.forkName}`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 4. Verify envelope fields against state first to fail fast before the EL + BLS work.
|
|
152
|
+
// When validSignature is true, gossip/API has already verified both the signature and the
|
|
153
|
+
// executionRequestsRoot, so we skip those checks here.
|
|
154
|
+
try {
|
|
155
|
+
verifyExecutionPayloadEnvelope(this.config, blockState, envelope, {
|
|
156
|
+
verifyExecutionRequestsRoot: !opts.validSignature,
|
|
157
|
+
});
|
|
158
|
+
} catch (e) {
|
|
159
|
+
throw new PayloadError(
|
|
160
|
+
{
|
|
161
|
+
code: PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR,
|
|
162
|
+
message: (e as Error).message,
|
|
163
|
+
},
|
|
164
|
+
`Envelope verification error: ${(e as Error).message}`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
127
167
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
// called when payloadInput.isComplete() is true, so all data is already available.
|
|
131
|
-
const [execResult, signatureValid, postPayloadResult] = await Promise.all([
|
|
168
|
+
// 4a. Run EL and signature verification in parallel
|
|
169
|
+
const [execResult, signatureValid] = await Promise.all([
|
|
132
170
|
this.executionEngine.notifyNewPayload(
|
|
133
171
|
fork,
|
|
134
172
|
envelope.payload,
|
|
135
173
|
payloadInput.getVersionedHashes(),
|
|
136
|
-
|
|
174
|
+
envelope.parentBeaconBlockRoot,
|
|
137
175
|
envelope.executionRequests
|
|
138
176
|
),
|
|
139
177
|
|
|
140
178
|
opts.validSignature === true
|
|
141
179
|
? 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
|
-
})(),
|
|
180
|
+
: verifyExecutionPayloadEnvelopeSignature(
|
|
181
|
+
this.config,
|
|
182
|
+
blockState,
|
|
183
|
+
this.pubkeyCache,
|
|
184
|
+
signedEnvelope,
|
|
185
|
+
payloadInput.proposerIndex,
|
|
186
|
+
this.bls
|
|
187
|
+
),
|
|
173
188
|
]);
|
|
174
189
|
|
|
175
|
-
//
|
|
190
|
+
// 4b. Check signature verification result
|
|
176
191
|
if (!signatureValid) {
|
|
177
192
|
throw new PayloadError({code: PayloadErrorCode.INVALID_SIGNATURE});
|
|
178
193
|
}
|
|
179
194
|
|
|
180
|
-
//
|
|
195
|
+
// 4c. Handle EL response
|
|
181
196
|
switch (execResult.status) {
|
|
182
197
|
case ExecutionPayloadStatus.VALID:
|
|
183
198
|
break;
|
|
@@ -203,65 +218,80 @@ export async function importExecutionPayload(
|
|
|
203
218
|
});
|
|
204
219
|
}
|
|
205
220
|
|
|
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)
|
|
221
|
+
// 5. Persist payload envelope to hot DB. Wait for write-queue space here to apply backpressure
|
|
222
|
+
// on the import pipeline during sync, then perform the write asynchronously to avoid blocking.
|
|
223
|
+
await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
|
|
217
224
|
this.unfinalizedPayloadEnvelopeWrites.push(payloadInput).catch((e) => {
|
|
218
225
|
if (!isQueueErrorAborted(e)) {
|
|
219
226
|
this.logger.error(
|
|
220
227
|
"Error pushing payload envelope to unfinalized write queue",
|
|
221
|
-
{slot
|
|
228
|
+
{slot, blockRoot: blockRootHex},
|
|
222
229
|
e as Error
|
|
223
230
|
);
|
|
224
231
|
}
|
|
225
232
|
});
|
|
226
233
|
|
|
227
|
-
//
|
|
234
|
+
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
235
|
+
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
228
236
|
this.forkChoice.onExecutionPayload(
|
|
229
237
|
blockRootHex,
|
|
230
238
|
blockHashHex,
|
|
231
239
|
envelope.payload.blockNumber,
|
|
232
|
-
|
|
233
|
-
|
|
240
|
+
execStatus,
|
|
241
|
+
dataAvailabilityStatus
|
|
234
242
|
);
|
|
235
243
|
|
|
236
|
-
//
|
|
237
|
-
this.
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
this.
|
|
244
|
+
// 7. Queue notifyForkchoiceUpdate to engine api
|
|
245
|
+
const head = this.forkChoice.getHead();
|
|
246
|
+
if (!this.opts.disableImportExecutionFcU && blockRootHex === head.blockRoot) {
|
|
247
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
248
|
+
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
249
|
+
this.executionEngine.notifyForkchoiceUpdate(fork, blockHashHex, safeBlockHash, finalizedBlockHash).catch((e) => {
|
|
250
|
+
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
|
|
251
|
+
this.logger.error("Error pushing notifyForkchoiceUpdate()", {blockHashHex, finalizedBlockHash}, e);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
241
254
|
}
|
|
242
255
|
|
|
243
|
-
//
|
|
256
|
+
// 8. Record metrics for payload envelope and column sources
|
|
244
257
|
this.metrics?.importPayload.bySource.inc({source: payloadInput.getPayloadEnvelopeSource().source});
|
|
245
258
|
for (const {source} of payloadInput.getSampledColumnsWithSource()) {
|
|
246
259
|
this.metrics?.importPayload.columnsBySource.inc({source});
|
|
247
260
|
}
|
|
248
261
|
|
|
249
|
-
//
|
|
250
|
-
if (this.clock.currentSlot -
|
|
262
|
+
// 9. Emit event after payload is fully verified and imported to fork choice, only for recent enough payloads
|
|
263
|
+
if (this.clock.currentSlot - slot < EVENTSTREAM_EMIT_RECENT_EXECUTION_PAYLOAD_SLOTS) {
|
|
251
264
|
this.emitter.emit(routes.events.EventType.executionPayload, {
|
|
252
|
-
slot
|
|
265
|
+
slot,
|
|
253
266
|
builderIndex: envelope.builderIndex,
|
|
254
267
|
blockHash: blockHashHex,
|
|
255
268
|
blockRoot: blockRootHex,
|
|
256
|
-
|
|
257
|
-
// TODO GLOAS: revisit once we support optimistic import
|
|
258
|
-
executionOptimistic: false,
|
|
269
|
+
executionOptimistic: execStatus === ExecutionStatus.Syncing,
|
|
259
270
|
});
|
|
260
271
|
}
|
|
261
272
|
|
|
262
273
|
this.logger.verbose("Execution payload imported", {
|
|
263
|
-
slot
|
|
264
|
-
|
|
274
|
+
slot,
|
|
275
|
+
builderIndex: envelope.builderIndex,
|
|
276
|
+
blockRoot: blockRootHex,
|
|
265
277
|
blockHash: blockHashHex,
|
|
266
278
|
});
|
|
267
279
|
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Process an execution payload envelope end-to-end: wait for DA, then import.
|
|
283
|
+
*
|
|
284
|
+
* Used by the PayloadEnvelopeProcessor queue (gossip / API / unknown-payload sync) — i.e.
|
|
285
|
+
* callers that have NOT already awaited DA themselves. Range sync's inline dispatch in
|
|
286
|
+
* processBlocks skips this wrapper and calls `importExecutionPayload` directly, since
|
|
287
|
+
* `verifyBlocksInEpoch` already awaited DA for the segment.
|
|
288
|
+
*/
|
|
289
|
+
export async function processExecutionPayload(
|
|
290
|
+
this: BeaconChain,
|
|
291
|
+
payloadInput: PayloadEnvelopeInput,
|
|
292
|
+
signal: AbortSignal,
|
|
293
|
+
opts: ImportPayloadOpts = {}
|
|
294
|
+
): Promise<void> {
|
|
295
|
+
const {dataAvailabilityStatuses} = await verifyPayloadsDataAvailability([payloadInput], signal);
|
|
296
|
+
await importExecutionPayload.call(this, payloadInput, dataAvailabilityStatuses[0], opts);
|
|
297
|
+
}
|