@lodestar/beacon-node 1.46.0-dev.4191d8e353 → 1.46.0-dev.49b1d65ffe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/impl/api.js.map +1 -1
- package/lib/api/impl/beacon/blocks/index.d.ts +1 -1
- package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +37 -15
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/blocks/utils.js.map +1 -1
- package/lib/api/impl/beacon/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/rewards/index.d.ts +1 -1
- package/lib/api/impl/beacon/rewards/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/rewards/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/config/constants.d.ts +2 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +4 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/config/index.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/errors.js.map +1 -1
- package/lib/api/impl/events/index.d.ts +1 -1
- package/lib/api/impl/events/index.d.ts.map +1 -1
- package/lib/api/impl/events/index.js.map +1 -1
- package/lib/api/impl/lightclient/index.d.ts +1 -1
- package/lib/api/impl/lightclient/index.d.ts.map +1 -1
- package/lib/api/impl/lightclient/index.js.map +1 -1
- package/lib/api/impl/lodestar/attesterSlashing.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/node/index.js.map +1 -1
- package/lib/api/impl/node/utils.js.map +1 -1
- package/lib/api/impl/proof/index.js.map +1 -1
- package/lib/api/impl/utils.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +18 -11
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.d.ts +1 -1
- package/lib/api/impl/validator/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/api/rest/activeSockets.js.map +1 -1
- package/lib/api/rest/base.js.map +1 -1
- package/lib/api/rest/index.js.map +1 -1
- package/lib/api/rest/swaggerUI.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +18 -5
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.js +1 -2
- package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.js +1 -2
- package/lib/chain/archiveStore/interface.js.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +1 -2
- package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +1 -1
- package/lib/chain/balancesCache.js.map +1 -1
- package/lib/chain/beaconProposerCache.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/errors.js +1 -2
- package/lib/chain/blocks/blockInput/errors.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +2 -4
- package/lib/chain/blocks/blockInput/types.js.map +1 -1
- package/lib/chain/blocks/blockInput/utils.js.map +1 -1
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +1 -2
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +6 -0
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.js +1 -2
- package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
- package/lib/chain/blocks/types.js +3 -6
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +31 -25
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
- package/lib/chain/blocks/utils/polarBearBanner.d.ts +2 -0
- package/lib/chain/blocks/utils/polarBearBanner.d.ts.map +1 -0
- package/lib/chain/blocks/utils/polarBearBanner.js +51 -0
- package/lib/chain/blocks/utils/polarBearBanner.js.map +1 -0
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +12 -0
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
- package/lib/chain/bls/maybeBatch.js.map +1 -1
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +1 -2
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/multithread/types.js +1 -2
- package/lib/chain/bls/multithread/types.js.map +1 -1
- package/lib/chain/bls/multithread/utils.js.map +1 -1
- package/lib/chain/bls/multithread/worker.js.map +1 -1
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/builderCircuitBreaker.js.map +1 -1
- package/lib/chain/chain.d.ts +2 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +1 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +1 -2
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/attestationError.js +1 -2
- package/lib/chain/errors/attestationError.js.map +1 -1
- package/lib/chain/errors/attesterSlashingError.js +1 -2
- package/lib/chain/errors/attesterSlashingError.js.map +1 -1
- package/lib/chain/errors/blobSidecarError.js +1 -2
- package/lib/chain/errors/blobSidecarError.js.map +1 -1
- package/lib/chain/errors/blockError.js +1 -2
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/blsToExecutionChangeError.js +1 -2
- package/lib/chain/errors/blsToExecutionChangeError.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js +1 -2
- package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +11 -4
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +2 -2
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +1 -2
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/errors/gossipValidation.js +2 -4
- package/lib/chain/errors/gossipValidation.js.map +1 -1
- package/lib/chain/errors/lightClientError.js +2 -4
- package/lib/chain/errors/lightClientError.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.js +1 -2
- package/lib/chain/errors/payloadAttestation.js.map +1 -1
- package/lib/chain/errors/proposerPreferences.js +1 -2
- package/lib/chain/errors/proposerPreferences.js.map +1 -1
- package/lib/chain/errors/proposerSlashingError.js +1 -2
- package/lib/chain/errors/proposerSlashingError.js.map +1 -1
- package/lib/chain/errors/syncCommitteeError.js +1 -2
- package/lib/chain/errors/syncCommitteeError.js.map +1 -1
- package/lib/chain/errors/voluntaryExitError.js +1 -2
- package/lib/chain/errors/voluntaryExitError.js.map +1 -1
- package/lib/chain/forkChoice/index.js +1 -2
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +1 -1
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.js +1 -2
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts +29 -0
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/lightClient/proofs.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +5 -6
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/types.js +2 -4
- package/lib/chain/opPools/types.js.map +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +2 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +104 -26
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +17 -11
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js.map +1 -1
- package/lib/chain/regen/errors.js +1 -2
- package/lib/chain/regen/errors.js.map +1 -1
- package/lib/chain/regen/interface.js +2 -4
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/reprocess.js +1 -2
- package/lib/chain/reprocess.js.map +1 -1
- package/lib/chain/seenCache/seenAggregateAndProof.js.map +1 -1
- package/lib/chain/seenCache/seenAttestationData.js +1 -2
- package/lib/chain/seenCache/seenAttestationData.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts +15 -4
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +35 -2
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/seenCache/seenCommittee.js.map +1 -1
- package/lib/chain/seenCache/seenCommitteeContribution.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +6 -5
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +16 -8
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +3 -3
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/serializeState.js.map +1 -1
- package/lib/chain/shufflingCache.js +1 -2
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/datastore/db.js.map +1 -1
- package/lib/chain/stateCache/datastore/file.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/mapMetrics.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +45 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.js +1 -2
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/blobSidecar.js.map +1 -1
- package/lib/chain/validation/block.d.ts +4 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +26 -15
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +21 -16
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +0 -5
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +74 -26
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +8 -8
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.js +2 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/constants/network.js +2 -4
- package/lib/constants/network.js.map +1 -1
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +23 -23
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +1 -2
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/repositories/attesterSlashing.js.map +1 -1
- package/lib/db/repositories/backfilledRanges.js.map +1 -1
- package/lib/db/repositories/blobSidecars.js.map +1 -1
- package/lib/db/repositories/blobSidecarsArchive.js.map +1 -1
- package/lib/db/repositories/block.js.map +1 -1
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
- package/lib/db/repositories/blsToExecutionChange.js.map +1 -1
- package/lib/db/repositories/checkpointState.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
- package/lib/db/repositories/lightclientBestUpdate.js.map +1 -1
- package/lib/db/repositories/lightclientCheckpointHeader.js.map +1 -1
- package/lib/db/repositories/lightclientSyncCommittee.js.map +1 -1
- package/lib/db/repositories/lightclientSyncCommitteeWitness.js.map +1 -1
- package/lib/db/repositories/proposerSlashing.js.map +1 -1
- package/lib/db/repositories/stateArchive.js.map +1 -1
- package/lib/db/repositories/stateArchiveIndex.js.map +1 -1
- package/lib/db/repositories/voluntaryExit.js.map +1 -1
- package/lib/execution/builder/cache.js.map +1 -1
- package/lib/execution/builder/http.js +1 -2
- package/lib/execution/builder/http.js.map +1 -1
- package/lib/execution/builder/index.js.map +1 -1
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -1
- package/lib/execution/engine/interface.js +2 -4
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.d.ts +13 -10
- package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.js +1 -2
- package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
- package/lib/execution/engine/jwt.js.map +1 -1
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/types.js +1 -1
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts +1 -1
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +15 -2
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +35 -1
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/metrics/nodeJsMetrics.js.map +1 -1
- package/lib/metrics/server/http.d.ts +1 -1
- package/lib/metrics/server/http.d.ts.map +1 -1
- package/lib/metrics/server/http.js.map +1 -1
- package/lib/metrics/utils/avgMinMax.js.map +1 -1
- package/lib/metrics/utils/gauge.js.map +1 -1
- package/lib/metrics/utils/registryMetricCreator.js.map +1 -1
- package/lib/monitoring/clientStats.js.map +1 -1
- package/lib/monitoring/properties.js.map +1 -1
- package/lib/monitoring/service.js.map +1 -1
- package/lib/monitoring/system.d.ts.map +1 -1
- package/lib/monitoring/system.js.map +1 -1
- package/lib/monitoring/types.js +2 -4
- package/lib/monitoring/types.js.map +1 -1
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +2 -4
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/core/metrics.d.ts +7 -6
- package/lib/network/core/metrics.d.ts.map +1 -1
- package/lib/network/core/metrics.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +1 -1
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorker.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/discv5/index.d.ts +1 -1
- package/lib/network/discv5/index.d.ts.map +1 -1
- package/lib/network/discv5/index.js.map +1 -1
- package/lib/network/discv5/utils.js +1 -2
- package/lib/network/discv5/utils.js.map +1 -1
- package/lib/network/discv5/worker.js.map +1 -1
- package/lib/network/events.d.ts.map +1 -1
- package/lib/network/events.js +2 -4
- package/lib/network/events.js.map +1 -1
- package/lib/network/forks.js.map +1 -1
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/errors.js.map +1 -1
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/interface.js +2 -4
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/metrics.d.ts +14 -12
- package/lib/network/gossip/metrics.d.ts.map +1 -1
- package/lib/network/gossip/metrics.js.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +671 -26
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +3 -3
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/libp2p/error.js +1 -2
- package/lib/network/libp2p/error.js.map +1 -1
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/metadata.js +2 -4
- package/lib/network/metadata.js.map +1 -1
- package/lib/network/network.d.ts +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/peers/client.js +1 -2
- package/lib/network/peers/client.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +3 -0
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/network/peers/discover.d.ts +7 -0
- package/lib/network/peers/discover.d.ts.map +1 -1
- package/lib/network/peers/discover.js +2 -4
- package/lib/network/peers/discover.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +1 -0
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/peersData.js +1 -2
- package/lib/network/peers/peersData.js.map +1 -1
- package/lib/network/peers/score/interface.js +2 -4
- package/lib/network/peers/score/interface.js.map +1 -1
- package/lib/network/peers/score/score.js.map +1 -1
- package/lib/network/peers/score/store.js.map +1 -1
- package/lib/network/peers/score/utils.js.map +1 -1
- package/lib/network/peers/utils/assertPeerRelevance.js +1 -2
- package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
- package/lib/network/peers/utils/enrSubnetsDeserialize.js.map +1 -1
- package/lib/network/peers/utils/getConnectedPeerIds.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.js +1 -2
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/peers/utils/subnetMap.js.map +1 -1
- package/lib/network/processor/aggregatorTracker.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
- package/lib/network/processor/gossipQueues/linear.js.map +1 -1
- package/lib/network/processor/gossipQueues/types.js +2 -4
- package/lib/network/processor/gossipQueues/types.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +4 -5
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientBootstrap.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js +1 -1
- package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js +1 -1
- package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +6 -2
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
- package/lib/network/reqresp/interface.js +1 -2
- package/lib/network/reqresp/interface.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +35 -9
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.js +1 -1
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +20 -3
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/reqresp/types.js +2 -4
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/network/reqresp/utils/collect.js.map +1 -1
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +1 -2
- package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/network/statusCache.js.map +1 -1
- package/lib/network/subnets/attnetsService.js +1 -2
- package/lib/network/subnets/attnetsService.js.map +1 -1
- package/lib/network/subnets/interface.js.map +1 -1
- package/lib/network/subnets/syncnetsService.d.ts.map +1 -1
- package/lib/network/subnets/syncnetsService.js.map +1 -1
- package/lib/network/subnets/util.js.map +1 -1
- package/lib/network/util.js.map +1 -1
- package/lib/node/nodejs.d.ts +2 -2
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +1 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.js.map +1 -1
- package/lib/node/utils/interop/deposits.js.map +1 -1
- package/lib/node/utils/interop/state.d.ts +1 -1
- package/lib/node/utils/interop/state.d.ts.map +1 -1
- package/lib/node/utils/interop/state.js.map +1 -1
- package/lib/node/utils/lightclient.js.map +1 -1
- package/lib/node/utils/state.js.map +1 -1
- package/lib/sync/backfill/backfill.d.ts +7 -0
- package/lib/sync/backfill/backfill.d.ts.map +1 -1
- package/lib/sync/backfill/backfill.js +3 -6
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/backfill/errors.js +1 -2
- package/lib/sync/backfill/errors.js.map +1 -1
- package/lib/sync/backfill/verify.js.map +1 -1
- package/lib/sync/constants.d.ts +6 -5
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +6 -5
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/interface.js +1 -2
- package/lib/sync/interface.js.map +1 -1
- package/lib/sync/range/batch.d.ts +10 -1
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +44 -16
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +10 -0
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +31 -17
- 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 +2 -4
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +18 -0
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +38 -0
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/sync/range/utils/chainTarget.js.map +1 -1
- package/lib/sync/range/utils/hashBlocks.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/range/utils/updateChains.js.map +1 -1
- package/lib/sync/sync.js.map +1 -1
- package/lib/sync/types.js +3 -6
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +23 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +4 -4
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +1 -2
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +7 -7
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +1 -2
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/lib/sync/utils/rateLimit.js.map +1 -1
- package/lib/sync/utils/remoteSyncType.d.ts.map +1 -1
- package/lib/sync/utils/remoteSyncType.js +2 -4
- package/lib/sync/utils/remoteSyncType.js.map +1 -1
- package/lib/util/address.js.map +1 -1
- package/lib/util/array.js.map +1 -1
- package/lib/util/asyncIterableToEvents.js +1 -2
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/binarySearch.js.map +1 -1
- package/lib/util/bitArray.js +1 -2
- package/lib/util/bitArray.js.map +1 -1
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/bufferPool.js +1 -2
- package/lib/util/bufferPool.js.map +1 -1
- package/lib/util/chunkify.js.map +1 -1
- package/lib/util/clock.d.ts +2 -7
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +3 -9
- package/lib/util/clock.js.map +1 -1
- package/lib/util/dataColumns.js +2 -4
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/dependentRoot.js.map +1 -1
- package/lib/util/enum.js.map +1 -1
- package/lib/util/error.js.map +1 -1
- package/lib/util/eventLoop.js.map +1 -1
- package/lib/util/execution.js +1 -2
- package/lib/util/execution.js.map +1 -1
- package/lib/util/file.js.map +1 -1
- package/lib/util/forkChoice.js.map +1 -1
- package/lib/util/forkName.js.map +1 -1
- package/lib/util/graffiti.js.map +1 -1
- package/lib/util/hex.js.map +1 -1
- package/lib/util/ip.js.map +1 -1
- package/lib/util/itTrigger.js.map +1 -1
- package/lib/util/map.js.map +1 -1
- package/lib/util/metadata.js.map +1 -1
- package/lib/util/multifork.js.map +1 -1
- package/lib/util/numpy.js.map +1 -1
- package/lib/util/peerId.js.map +1 -1
- package/lib/util/profile.js +1 -2
- package/lib/util/profile.js.map +1 -1
- package/lib/util/promises.js.map +1 -1
- package/lib/util/queue/errors.js +1 -2
- package/lib/util/queue/errors.js.map +1 -1
- package/lib/util/queue/fnQueue.js.map +1 -1
- package/lib/util/queue/itemQueue.d.ts.map +1 -1
- package/lib/util/queue/itemQueue.js.map +1 -1
- package/lib/util/queue/options.js +1 -2
- package/lib/util/queue/options.js.map +1 -1
- package/lib/util/serializedCache.js.map +1 -1
- package/lib/util/set.js.map +1 -1
- package/lib/util/shuffle.js.map +1 -1
- package/lib/util/sortBy.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/time.js.map +1 -1
- package/lib/util/timeSeries.js.map +1 -1
- package/lib/util/types.d.ts.map +1 -1
- package/lib/util/workerEvents.d.ts +1 -1
- package/lib/util/workerEvents.d.ts.map +1 -1
- package/lib/util/workerEvents.js.map +1 -1
- package/lib/util/wrapError.js.map +1 -1
- package/package.json +17 -17
- package/src/api/impl/beacon/blocks/index.ts +60 -16
- package/src/api/impl/config/constants.ts +6 -0
- package/src/api/impl/validator/index.ts +20 -7
- package/src/chain/archiveStore/archiveStore.ts +20 -3
- package/src/chain/blocks/index.ts +7 -0
- package/src/chain/blocks/utils/chainSegment.ts +35 -28
- package/src/chain/blocks/utils/polarBearBanner.ts +50 -0
- package/src/chain/blocks/verifyBlock.ts +16 -0
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -1
- package/src/chain/errors/executionPayloadBid.ts +12 -4
- package/src/chain/opPools/aggregatedAttestationPool.ts +4 -2
- package/src/chain/prepareNextSlot.ts +137 -35
- package/src/chain/produceBlock/produceBlockBody.ts +17 -5
- package/src/chain/seenCache/seenBlockProposers.ts +46 -5
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +22 -9
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/block.ts +36 -18
- package/src/chain/validation/dataColumnSidecar.ts +27 -17
- package/src/chain/validation/executionPayloadBid.ts +91 -27
- package/src/chain/validation/proposerPreferences.ts +8 -8
- package/src/chain/validatorMonitor.ts +1 -1
- package/src/execution/engine/interface.ts +1 -1
- package/src/execution/engine/types.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +36 -1
- package/src/network/gossip/topic.ts +4 -2
- package/src/network/processor/index.ts +2 -1
- package/src/network/reqresp/handlers/lightClientFinalityUpdate.ts +1 -1
- package/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts +1 -1
- package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +6 -2
- package/src/network/reqresp/protocols.ts +39 -11
- package/src/network/reqresp/rateLimit.ts +1 -1
- package/src/network/reqresp/score.ts +22 -3
- package/src/sync/constants.ts +6 -5
- package/src/sync/range/batch.ts +50 -12
- package/src/sync/range/chain.ts +36 -16
- package/src/sync/range/utils/batches.ts +44 -0
- package/src/util/clock.ts +2 -7
- package/src/util/sszBytes.ts +1 -1
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
4
|
-
import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix, isForkPostGloas} from "@lodestar/params";
|
|
5
4
|
import {
|
|
5
|
+
ForkPostBellatrix,
|
|
6
|
+
ForkSeq,
|
|
7
|
+
SLOTS_PER_EPOCH,
|
|
8
|
+
isForkPostBellatrix,
|
|
9
|
+
isForkPostFulu,
|
|
10
|
+
isForkPostGloas,
|
|
11
|
+
} from "@lodestar/params";
|
|
12
|
+
import {
|
|
13
|
+
GLOAS_PREVERIFY_WINDOW_EPOCHS,
|
|
6
14
|
IBeaconStateView,
|
|
7
15
|
IBeaconStateViewBellatrix,
|
|
16
|
+
MAX_BUILDER_DEPOSITS_PER_SLOT,
|
|
8
17
|
StateHashTreeRootSource,
|
|
9
18
|
computeEpochAtSlot,
|
|
10
19
|
computeTimeAtSlot,
|
|
11
20
|
isStatePostBellatrix,
|
|
21
|
+
isStatePostFulu,
|
|
12
22
|
isStatePostGloas,
|
|
13
23
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {Bytes32, Slot} from "@lodestar/types";
|
|
24
|
+
import {Bytes32, Slot, ValidatorIndex} from "@lodestar/types";
|
|
15
25
|
import {Logger, fromHex, isErrorAborted, sleep} from "@lodestar/utils";
|
|
16
26
|
import {GENESIS_SLOT, ZERO_HASH_HEX} from "../constants/constants.js";
|
|
17
27
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
@@ -30,6 +40,11 @@ export const PREPARE_NEXT_SLOT_BPS = 6667;
|
|
|
30
40
|
/* We don't want to do more epoch transition than this */
|
|
31
41
|
const PREPARE_EPOCH_LIMIT = 1;
|
|
32
42
|
|
|
43
|
+
/* Fraction of a slot (out of 10_000) the pre-Gloas builder-deposit pre-verify may spend per tick.
|
|
44
|
+
* 2000 = 20% of slot (2.4s on mainnet), within the spare window left after PREPARE_NEXT_SLOT_BPS.
|
|
45
|
+
* Expressed in bps so it scales with slot duration (mainnet vs minimal/devnet). */
|
|
46
|
+
const BUILDER_PREVERIFY_LIMIT_BPS = 2000;
|
|
47
|
+
|
|
33
48
|
/**
|
|
34
49
|
* At Bellatrix, if we are responsible for proposing in next slot, we want to prepare payload
|
|
35
50
|
* 4s before the start of next slot at PREPARE_NEXT_SLOT_BPS of the current slot.
|
|
@@ -110,30 +125,38 @@ export class PrepareNextSlotScheduler {
|
|
|
110
125
|
? this.metrics?.precomputeNextEpochTransition.duration.startTimer()
|
|
111
126
|
: null;
|
|
112
127
|
const start = Date.now();
|
|
128
|
+
let feeRecipient: string | undefined;
|
|
113
129
|
// No need to wait for this or the clock drift
|
|
114
|
-
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
|
|
115
|
-
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
|
|
116
|
-
const prepareState = await this.chain.regen.getBlockSlotState(
|
|
117
|
-
headBlock,
|
|
118
|
-
prepareSlot,
|
|
119
|
-
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
120
|
-
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
121
|
-
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
122
|
-
{dontTransferCache: !isEpochTransition},
|
|
123
|
-
RegenCaller.precomputeEpoch
|
|
124
|
-
);
|
|
125
|
-
|
|
126
130
|
if (isForkPostBellatrix(fork)) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
let preparedState: IBeaconStateView | undefined;
|
|
132
|
+
|
|
133
|
+
const getProposerIndex = async (): Promise<ValidatorIndex> => {
|
|
134
|
+
if (isForkPostFulu(fork)) {
|
|
135
|
+
// getBeaconProposer covers the current + next epoch; should not throw
|
|
136
|
+
// PROPOSER_EPOCH_MISMATCH here due to the PREPARE_EPOCH_LIMIT check above.
|
|
137
|
+
return this.chain.getHeadState().getBeaconProposer(prepareSlot);
|
|
138
|
+
}
|
|
139
|
+
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
140
|
+
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
141
|
+
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
142
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
143
|
+
headBlock,
|
|
144
|
+
prepareSlot,
|
|
145
|
+
{dontTransferCache: !isEpochTransition},
|
|
146
|
+
RegenCaller.precomputeEpoch
|
|
147
|
+
);
|
|
148
|
+
return preparedState.getBeaconProposer(prepareSlot);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const proposerIndex = await getProposerIndex();
|
|
152
|
+
feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
|
|
130
153
|
|
|
131
154
|
if (feeRecipient) {
|
|
132
155
|
// If we are proposing next slot, we need to predict if we can proposer-boost-reorg or not
|
|
133
156
|
const proposerHead = this.chain.predictProposerHead(clockSlot);
|
|
134
157
|
const {slot: proposerHeadSlot, blockRoot: proposerHeadRoot} = proposerHead;
|
|
135
158
|
|
|
136
|
-
// If we predict we can reorg,
|
|
159
|
+
// If we predict we can reorg, we build on the proposer head (parent) block instead
|
|
137
160
|
if (proposerHeadRoot !== headRoot || proposerHeadSlot !== headSlot) {
|
|
138
161
|
this.logger.verbose("Weak head detected. May build on parent block instead", {
|
|
139
162
|
proposerHeadSlot,
|
|
@@ -142,13 +165,6 @@ export class PrepareNextSlotScheduler {
|
|
|
142
165
|
headRoot,
|
|
143
166
|
});
|
|
144
167
|
this.metrics?.weakHeadDetected.inc();
|
|
145
|
-
updatedPrepareState = await this.chain.regen.getBlockSlotState(
|
|
146
|
-
proposerHead,
|
|
147
|
-
prepareSlot,
|
|
148
|
-
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
149
|
-
{dontTransferCache: !isEpochTransition},
|
|
150
|
-
RegenCaller.predictProposerHead
|
|
151
|
-
);
|
|
152
168
|
updatedHead = proposerHead;
|
|
153
169
|
}
|
|
154
170
|
|
|
@@ -165,30 +181,41 @@ export class PrepareNextSlotScheduler {
|
|
|
165
181
|
}
|
|
166
182
|
}
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
// post-fulu we'll always reach here because preparedState is undefined
|
|
185
|
+
if (preparedState === undefined || updatedHead !== headBlock) {
|
|
186
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
187
|
+
updatedHead,
|
|
188
|
+
prepareSlot,
|
|
189
|
+
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
190
|
+
{dontTransferCache: !isEpochTransition},
|
|
191
|
+
updatedHead === headBlock ? RegenCaller.precomputeEpoch : RegenCaller.predictProposerHead
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!isStatePostBellatrix(preparedState)) {
|
|
169
196
|
throw new Error("Expected Bellatrix state for payload attributes");
|
|
170
197
|
}
|
|
171
198
|
|
|
172
199
|
let parentBlockHash: Bytes32;
|
|
173
200
|
// Apply parent payload once here as it's reused by EL prep and SSE emit below
|
|
174
|
-
let stateAfterParentPayload: IBeaconStateViewBellatrix =
|
|
175
|
-
if (isStatePostGloas(
|
|
176
|
-
// Spec: should_build_on_full(store, head)
|
|
201
|
+
let stateAfterParentPayload: IBeaconStateViewBellatrix = preparedState;
|
|
202
|
+
if (isStatePostGloas(preparedState)) {
|
|
203
|
+
// Spec: should_build_on_full(store, head, slot) - see produceBlockBody.ts for context.
|
|
177
204
|
if (this.chain.forkChoice.shouldBuildOnFull(updatedHead, prepareSlot)) {
|
|
178
|
-
parentBlockHash =
|
|
205
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.blockHash;
|
|
179
206
|
// Skip applying parent payload unless we're proposing the next slot or have to emit payload_attributes events
|
|
180
207
|
if (feeRecipient !== undefined || this.chain.opts.emitPayloadAttributes === true) {
|
|
181
208
|
const parentExecutionRequests = await this.chain.getParentExecutionRequests(
|
|
182
209
|
updatedHead.slot,
|
|
183
210
|
updatedHead.blockRoot
|
|
184
211
|
);
|
|
185
|
-
stateAfterParentPayload =
|
|
212
|
+
stateAfterParentPayload = preparedState.withParentPayloadApplied(parentExecutionRequests);
|
|
186
213
|
}
|
|
187
214
|
} else {
|
|
188
|
-
parentBlockHash =
|
|
215
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.parentBlockHash;
|
|
189
216
|
}
|
|
190
217
|
} else {
|
|
191
|
-
parentBlockHash =
|
|
218
|
+
parentBlockHash = preparedState.latestExecutionPayloadHeader.blockHash;
|
|
192
219
|
}
|
|
193
220
|
|
|
194
221
|
if (feeRecipient) {
|
|
@@ -221,7 +248,7 @@ export class PrepareNextSlotScheduler {
|
|
|
221
248
|
});
|
|
222
249
|
}
|
|
223
250
|
|
|
224
|
-
this.computeStateHashTreeRoot(
|
|
251
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
225
252
|
|
|
226
253
|
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
227
254
|
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
@@ -239,7 +266,14 @@ export class PrepareNextSlotScheduler {
|
|
|
239
266
|
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
240
267
|
}
|
|
241
268
|
} else {
|
|
242
|
-
|
|
269
|
+
// Pre-bellatrix only reaches here at an epoch transition to precompute the next epoch state
|
|
270
|
+
const preparedState = await this.chain.regen.getBlockSlotState(
|
|
271
|
+
headBlock,
|
|
272
|
+
prepareSlot,
|
|
273
|
+
{dontTransferCache: !isEpochTransition},
|
|
274
|
+
RegenCaller.precomputeEpoch
|
|
275
|
+
);
|
|
276
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
243
277
|
}
|
|
244
278
|
|
|
245
279
|
// assuming there is no reorg, it caches the checkpoint state & helps avoid doing a full state transition in the next slot
|
|
@@ -262,6 +296,74 @@ export class PrepareNextSlotScheduler {
|
|
|
262
296
|
});
|
|
263
297
|
|
|
264
298
|
precomputeEpochTransitionTimer?.();
|
|
299
|
+
|
|
300
|
+
// Nothing more to do on an epoch-transition slot: that precompute already ran a full (>1s)
|
|
301
|
+
// epoch transition, so we don't pile the builder-deposit pre-verify (below) on top of it.
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Pre-verify builder-deposit signatures in the GLOAS_PREVERIFY_WINDOW_EPOCHS epochs leading
|
|
306
|
+
// up to the Gloas fork, off the block-import hot path, so onboardBuildersFromPendingDeposits
|
|
307
|
+
// at the transition is mostly cache hits. Reached only on non-epoch-transition slots (the
|
|
308
|
+
// epoch-transition branch returned above). Runs on the head state — its pendingDeposits are
|
|
309
|
+
// what the fork transition derives from, and its epochCtx holds the shared, app-wide
|
|
310
|
+
// builderDepositSignatureCache.
|
|
311
|
+
const headState = this.chain.getHeadState();
|
|
312
|
+
if (isStatePostFulu(headState)) {
|
|
313
|
+
const gloasEpoch = this.config.GLOAS_FORK_EPOCH;
|
|
314
|
+
const finalizedEpoch = this.chain.forkChoice.getFinalizedCheckpoint().epoch;
|
|
315
|
+
if (finalizedEpoch >= gloasEpoch) {
|
|
316
|
+
// Gloas is finalized — the pre-verify cache has served its purpose; release its memory.
|
|
317
|
+
headState.clearPreGloasBuilderDepositCache();
|
|
318
|
+
} else {
|
|
319
|
+
const clockEpoch = computeEpochAtSlot(clockSlot);
|
|
320
|
+
if (
|
|
321
|
+
ForkSeq[fork] < ForkSeq.gloas && // only before the fork
|
|
322
|
+
clockEpoch >= gloasEpoch - GLOAS_PREVERIFY_WINDOW_EPOCHS && // Infinity when Gloas unscheduled → skip
|
|
323
|
+
clockEpoch < gloasEpoch &&
|
|
324
|
+
// skip when we're the next-slot proposer — don't compete with block-production prep.
|
|
325
|
+
feeRecipient === undefined
|
|
326
|
+
) {
|
|
327
|
+
const maxDurationMs = this.config.getSlotComponentDurationMs(BUILDER_PREVERIFY_LIMIT_BPS);
|
|
328
|
+
const preVerifyTimer = this.metrics?.builderDepositPreVerify.duration.startTimer();
|
|
329
|
+
const result = headState.preVerifyBuilderDepositsPreGloas(MAX_BUILDER_DEPOSITS_PER_SLOT, maxDurationMs);
|
|
330
|
+
preVerifyTimer?.();
|
|
331
|
+
|
|
332
|
+
const preVerifyMetrics = this.metrics?.builderDepositPreVerify;
|
|
333
|
+
if (preVerifyMetrics) {
|
|
334
|
+
preVerifyMetrics.pendingDeposits.set(result.pendingDepositsCount);
|
|
335
|
+
preVerifyMetrics.cachedDeposits.set(result.totalCachedDeposits);
|
|
336
|
+
preVerifyMetrics.scannedDeposits.set(result.scannedPendingDeposits);
|
|
337
|
+
preVerifyMetrics.builderPubkeys.set(result.totalBuilderPubkeys);
|
|
338
|
+
if (result.validBuilderSignaturesCount > 0) {
|
|
339
|
+
preVerifyMetrics.validSignatures.inc({type: "builder"}, result.validBuilderSignaturesCount);
|
|
340
|
+
}
|
|
341
|
+
if (result.validValidatorSignaturesCount > 0) {
|
|
342
|
+
preVerifyMetrics.validSignatures.inc({type: "validator"}, result.validValidatorSignaturesCount);
|
|
343
|
+
}
|
|
344
|
+
if (result.invalidBuilderSignaturesCount > 0) {
|
|
345
|
+
preVerifyMetrics.invalidSignatures.inc({type: "builder"}, result.invalidBuilderSignaturesCount);
|
|
346
|
+
}
|
|
347
|
+
if (result.invalidValidatorSignaturesCount > 0) {
|
|
348
|
+
preVerifyMetrics.invalidSignatures.inc({type: "validator"}, result.invalidValidatorSignaturesCount);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Always log (once per slot, only within the pre-fork window) so devnets show the
|
|
353
|
+
// pre-verify draining even on all-cache-hit ticks.
|
|
354
|
+
this.logger.verbose("PrepareNextSlotScheduler pre-verified deposit signatures", {
|
|
355
|
+
clockSlot,
|
|
356
|
+
validBuilderSignaturesCount: result.validBuilderSignaturesCount,
|
|
357
|
+
invalidBuilderSignaturesCount: result.invalidBuilderSignaturesCount,
|
|
358
|
+
validValidatorSignaturesCount: result.validValidatorSignaturesCount,
|
|
359
|
+
invalidValidatorSignaturesCount: result.invalidValidatorSignaturesCount,
|
|
360
|
+
scannedPendingDeposits: result.scannedPendingDeposits,
|
|
361
|
+
totalCachedDeposits: result.totalCachedDeposits,
|
|
362
|
+
totalBuilderPubkeys: result.totalBuilderPubkeys,
|
|
363
|
+
pendingDepositsCount: result.pendingDepositsCount,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
265
367
|
}
|
|
266
368
|
} catch (e) {
|
|
267
369
|
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BitArray} from "@chainsafe/ssz";
|
|
1
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
3
|
import {IForkChoice, ProtoBlock, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
4
|
import {
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
ForkPostGloas,
|
|
11
12
|
ForkPreGloas,
|
|
12
13
|
ForkSeq,
|
|
14
|
+
INCLUSION_LIST_COMMITTEE_SIZE,
|
|
13
15
|
isForkPostAltair,
|
|
14
16
|
isForkPostBellatrix,
|
|
15
17
|
isForkPostGloas,
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
electra,
|
|
50
52
|
fulu,
|
|
51
53
|
gloas,
|
|
54
|
+
heze,
|
|
52
55
|
ssz,
|
|
53
56
|
} from "@lodestar/types";
|
|
54
57
|
import {GWEI_TO_WEI, Logger, byteArrayEquals, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
@@ -276,7 +279,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
276
279
|
let parentExecutionRequests: gloas.ExecutionRequests;
|
|
277
280
|
// Apply parent payload once here as it's reused by EL prep and voluntary exit filtering below
|
|
278
281
|
let stateAfterParentPayload: IBeaconStateViewBellatrix = currentState;
|
|
279
|
-
// Spec: should_build_on_full(store, head). `parentBlock` is the proposer's head
|
|
282
|
+
// Spec: should_build_on_full(store, head, slot). `parentBlock` is the proposer's head
|
|
280
283
|
// (set by chain.getProposerHead(slot)). Returns false when the PTC majority signalled
|
|
281
284
|
// the blob data is not available or the payload was not timely, forcing a build on EMPTY (reorg).
|
|
282
285
|
const isBuildingOnFull = this.forkChoice.shouldBuildOnFull(parentBlock, blockSlot);
|
|
@@ -345,14 +348,18 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
345
348
|
blockHash: executionPayload.blockHash,
|
|
346
349
|
prevRandao: currentState.getRandaoMix(currentState.epoch),
|
|
347
350
|
feeRecipient: executionPayload.feeRecipient,
|
|
348
|
-
gasLimit: executionPayload.gasLimit,
|
|
351
|
+
gasLimit: BigInt(executionPayload.gasLimit),
|
|
349
352
|
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
350
353
|
slot: blockSlot,
|
|
351
354
|
value: 0,
|
|
352
|
-
executionPayment:
|
|
355
|
+
executionPayment: 0n,
|
|
353
356
|
blobKzgCommitments: blobsBundle.commitments,
|
|
354
357
|
executionRequestsRoot: ssz.gloas.ExecutionRequests.hashTreeRoot(executionRequests as gloas.ExecutionRequests),
|
|
355
358
|
};
|
|
359
|
+
if (ForkSeq[fork] >= ForkSeq.heze) {
|
|
360
|
+
// TODO HEZE: populate from inclusion list pool once IL aggregation is wired up.
|
|
361
|
+
(bid as heze.ExecutionPayloadBid).inclusionListBits = BitArray.fromBitLen(INCLUSION_LIST_COMMITTEE_SIZE);
|
|
362
|
+
}
|
|
356
363
|
const signedBid: gloas.SignedExecutionPayloadBid = {
|
|
357
364
|
message: bid,
|
|
358
365
|
signature: G2_POINT_AT_INFINITY,
|
|
@@ -927,6 +934,11 @@ function preparePayloadAttributes(
|
|
|
927
934
|
);
|
|
928
935
|
}
|
|
929
936
|
|
|
937
|
+
if (ForkSeq[fork] >= ForkSeq.heze) {
|
|
938
|
+
// TODO HEZE: populate from inclusion list pool once IL aggregation is wired up.
|
|
939
|
+
(payloadAttributes as heze.SSEPayloadAttributes["payloadAttributes"]).inclusionListTransactions = [];
|
|
940
|
+
}
|
|
941
|
+
|
|
930
942
|
return payloadAttributes;
|
|
931
943
|
}
|
|
932
944
|
|
|
@@ -949,7 +961,7 @@ function getProposerTargetGasLimit(
|
|
|
949
961
|
prepareSlot: Slot,
|
|
950
962
|
parentBlockRoot: Root,
|
|
951
963
|
parentBlockHash: Bytes32
|
|
952
|
-
):
|
|
964
|
+
): bigint {
|
|
953
965
|
const parentBlockRootHex = toRootHex(parentBlockRoot);
|
|
954
966
|
const parentBlock = chain.forkChoice.getBlockHexDefaultStatus(parentBlockRootHex);
|
|
955
967
|
const dependentRootHex = (() => {
|
|
@@ -979,7 +991,7 @@ function getProposerTargetGasLimit(
|
|
|
979
991
|
`Cannot resolve parent payload gas_limit for proposer targetGasLimit fallback parentBlockRoot=${parentBlockRootHex} parentBlockHash=${toRootHex(parentBlockHash)}`
|
|
980
992
|
);
|
|
981
993
|
}
|
|
982
|
-
return parentPayloadVariant.executionPayloadGasLimit;
|
|
994
|
+
return BigInt(parentPayloadVariant.executionPayloadGasLimit);
|
|
983
995
|
}
|
|
984
996
|
|
|
985
997
|
export async function produceCommonBlockBody<T extends BlockType>(
|
|
@@ -1,21 +1,57 @@
|
|
|
1
1
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
2
|
-
import {Epoch, Slot, ValidatorIndex} from "@lodestar/types";
|
|
2
|
+
import {Epoch, RootHex, Slot, ValidatorIndex} from "@lodestar/types";
|
|
3
3
|
import {MapDef} from "@lodestar/utils";
|
|
4
4
|
|
|
5
|
+
/** Two distinct block roots signed by the same proposer for the same slot are sufficient to establish an equivocation */
|
|
6
|
+
const MAX_BLOCK_ROOTS_PER_PROPOSAL = 2;
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* Keeps a cache to filter block proposals from the same validator in the same slot.
|
|
7
10
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* Block roots with a signature verified against the block's proposer index are tracked separately from proposals
|
|
12
|
+
* accepted by gossip validation or block import. A root from a block signed by its declared proposer is potential
|
|
13
|
+
* equivocation evidence, but the block may still fail other validation. Such a block must not mark the proposal as
|
|
14
|
+
* known, since that would cause a later valid block for the same slot and proposer to be ignored as a repeat proposal.
|
|
15
|
+
*
|
|
16
|
+
* The cache is pruned on finalization and bounds the number of roots stored per proposer and slot
|
|
10
17
|
*/
|
|
11
18
|
export class SeenBlockProposers {
|
|
12
19
|
private readonly proposerIndexesBySlot = new MapDef<Slot, Set<ValidatorIndex>>(() => new Set<ValidatorIndex>());
|
|
13
|
-
private
|
|
20
|
+
private readonly blockRootsBySlot = new MapDef<Slot, MapDef<ValidatorIndex, Set<RootHex>>>(
|
|
21
|
+
() => new MapDef<ValidatorIndex, Set<RootHex>>(() => new Set<RootHex>())
|
|
22
|
+
);
|
|
23
|
+
private finalizedSlot: Slot = 0;
|
|
14
24
|
|
|
15
25
|
isKnown(blockSlot: Slot, proposerIndex: ValidatorIndex): boolean {
|
|
16
26
|
return this.proposerIndexesBySlot.get(blockSlot)?.has(proposerIndex) === true;
|
|
17
27
|
}
|
|
18
28
|
|
|
29
|
+
hasBlockRoot(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): boolean {
|
|
30
|
+
return this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex)?.has(blockRoot) === true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
isEquivocating(blockSlot: Slot, proposerIndex: ValidatorIndex): boolean {
|
|
34
|
+
return (this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex)?.size ?? 0) >= MAX_BLOCK_ROOTS_PER_PROPOSAL;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getConflictingBlockRoots(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): RootHex[] {
|
|
38
|
+
const roots = this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex);
|
|
39
|
+
return roots === undefined ? [] : Array.from(roots).filter((root) => root !== blockRoot);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Record a block only after its proposer signature has been verified */
|
|
43
|
+
observeBlockRoot(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): void {
|
|
44
|
+
if (blockSlot < this.finalizedSlot) {
|
|
45
|
+
throw Error(`blockSlot ${blockSlot} < finalizedSlot ${this.finalizedSlot}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const blockRoots = this.blockRootsBySlot.getOrDefault(blockSlot).getOrDefault(proposerIndex);
|
|
49
|
+
if (blockRoots.size < MAX_BLOCK_ROOTS_PER_PROPOSAL) {
|
|
50
|
+
blockRoots.add(blockRoot);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Mark a block as known from gossip or another block import path */
|
|
19
55
|
add(blockSlot: Slot, proposerIndex: ValidatorIndex): void {
|
|
20
56
|
if (blockSlot < this.finalizedSlot) {
|
|
21
57
|
throw Error(`blockSlot ${blockSlot} < finalizedSlot ${this.finalizedSlot}`);
|
|
@@ -31,9 +67,14 @@ export class SeenBlockProposers {
|
|
|
31
67
|
this.proposerIndexesBySlot.delete(slot);
|
|
32
68
|
}
|
|
33
69
|
}
|
|
70
|
+
for (const slot of this.blockRootsBySlot.keys()) {
|
|
71
|
+
if (slot < finalizedSlot) {
|
|
72
|
+
this.blockRootsBySlot.delete(slot);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
34
75
|
}
|
|
35
76
|
|
|
36
|
-
seenAtEpoch(epoch:
|
|
77
|
+
seenAtEpoch(epoch: Epoch, index: ValidatorIndex): boolean {
|
|
37
78
|
const fromSlot = computeStartSlotAtEpoch(epoch);
|
|
38
79
|
const toSlot = computeStartSlotAtEpoch(epoch + 1);
|
|
39
80
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BuilderIndex, Slot} from "@lodestar/types";
|
|
1
|
+
import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
|
|
2
2
|
import {MapDef} from "@lodestar/utils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,29 +7,42 @@ import {MapDef} from "@lodestar/utils";
|
|
|
7
7
|
const SLOTS_RETAINED = 2;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Tracks execution payload bids we've already seen per
|
|
10
|
+
* Tracks execution payload bids we've already seen per
|
|
11
|
+
* (slot, builder, parent block hash, parent block root).
|
|
11
12
|
*/
|
|
12
13
|
export class SeenExecutionPayloadBids {
|
|
13
|
-
private readonly
|
|
14
|
+
private readonly branchesByBuilderBySlot = new MapDef<Slot, MapDef<BuilderIndex, Set<string>>>(
|
|
15
|
+
() => new MapDef<BuilderIndex, Set<string>>(() => new Set<string>())
|
|
16
|
+
);
|
|
14
17
|
private lowestPermissibleSlot: Slot = 0;
|
|
15
18
|
|
|
16
|
-
isKnown(slot: Slot, builderIndex: BuilderIndex): boolean {
|
|
17
|
-
return
|
|
19
|
+
isKnown(slot: Slot, builderIndex: BuilderIndex, parentBlockHash: RootHex, parentBlockRoot: RootHex): boolean {
|
|
20
|
+
return (
|
|
21
|
+
this.branchesByBuilderBySlot.get(slot)?.get(builderIndex)?.has(branchKey(parentBlockHash, parentBlockRoot)) ===
|
|
22
|
+
true
|
|
23
|
+
);
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
add(slot: Slot, builderIndex: BuilderIndex): void {
|
|
26
|
+
add(slot: Slot, builderIndex: BuilderIndex, parentBlockHash: RootHex, parentBlockRoot: RootHex): void {
|
|
21
27
|
if (slot < this.lowestPermissibleSlot) {
|
|
22
28
|
throw Error(`slot ${slot} < lowestPermissibleSlot ${this.lowestPermissibleSlot}`);
|
|
23
29
|
}
|
|
24
|
-
this.
|
|
30
|
+
this.branchesByBuilderBySlot
|
|
31
|
+
.getOrDefault(slot)
|
|
32
|
+
.getOrDefault(builderIndex)
|
|
33
|
+
.add(branchKey(parentBlockHash, parentBlockRoot));
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
prune(currentSlot: Slot): void {
|
|
28
37
|
this.lowestPermissibleSlot = Math.max(currentSlot - SLOTS_RETAINED, 0);
|
|
29
|
-
for (const slot of this.
|
|
38
|
+
for (const slot of this.branchesByBuilderBySlot.keys()) {
|
|
30
39
|
if (slot < this.lowestPermissibleSlot) {
|
|
31
|
-
this.
|
|
40
|
+
this.branchesByBuilderBySlot.delete(slot);
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
45
|
+
|
|
46
|
+
function branchKey(parentBlockHash: RootHex, parentBlockRoot: RootHex): string {
|
|
47
|
+
return `${parentBlockHash}:${parentBlockRoot}`;
|
|
48
|
+
}
|
|
@@ -111,7 +111,7 @@ export async function validateGossipBlobSidecar(
|
|
|
111
111
|
|
|
112
112
|
// [REJECT] The blob is from a higher slot than its parent.
|
|
113
113
|
if (parentBlock.slot >= blobSlot) {
|
|
114
|
-
throw new BlobSidecarGossipError(GossipAction.
|
|
114
|
+
throw new BlobSidecarGossipError(GossipAction.REJECT, {
|
|
115
115
|
code: BlobSidecarErrorCode.NOT_LATER_THAN_PARENT,
|
|
116
116
|
parentSlot: parentBlock.slot,
|
|
117
117
|
slot: blobSlot,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
isExecutionBlockBodyType,
|
|
25
25
|
isStatePostBellatrix,
|
|
26
26
|
} from "@lodestar/state-transition";
|
|
27
|
-
import {SignedBeaconBlock, deneb, gloas, isGloasBeaconBlock} from "@lodestar/types";
|
|
27
|
+
import {RootHex, SignedBeaconBlock, deneb, gloas, isGloasBeaconBlock} from "@lodestar/types";
|
|
28
28
|
import {byteArrayEquals, sleep, toRootHex} from "@lodestar/utils";
|
|
29
29
|
import {BlockErrorCode, BlockGossipError, GossipAction} from "../errors/index.js";
|
|
30
30
|
import {IBeaconChain} from "../interface.js";
|
|
@@ -85,7 +85,12 @@ export async function validateGossipBlock(
|
|
|
85
85
|
|
|
86
86
|
// [IGNORE] The block is the first block with valid signature received for the proposer for the slot, signed_beacon_block.message.slot.
|
|
87
87
|
const proposerIndex = block.proposerIndex;
|
|
88
|
+
const hasBlockRoot = chain.seenBlockProposers.hasBlockRoot(blockSlot, proposerIndex, blockRoot);
|
|
88
89
|
if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
|
|
90
|
+
if (!hasBlockRoot && !chain.seenBlockProposers.isEquivocating(blockSlot, proposerIndex)) {
|
|
91
|
+
await verifyBlockProposerSignature(chain, signedBlock, blockRoot, {verifyOnMainThread: false});
|
|
92
|
+
chain.seenBlockProposers.observeBlockRoot(blockSlot, proposerIndex, blockRoot);
|
|
93
|
+
}
|
|
89
94
|
throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
|
|
90
95
|
}
|
|
91
96
|
|
|
@@ -270,18 +275,8 @@ export async function validateGossipBlock(
|
|
|
270
275
|
}
|
|
271
276
|
|
|
272
277
|
// [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
// Don't batch so verification is not delayed
|
|
276
|
-
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: true}))) {
|
|
277
|
-
throw new BlockGossipError(GossipAction.REJECT, {
|
|
278
|
-
code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
279
|
-
blockSlot,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
chain.seenBlockInputCache.markVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature);
|
|
284
|
-
}
|
|
278
|
+
await verifyBlockProposerSignature(chain, signedBlock, blockRoot);
|
|
279
|
+
chain.seenBlockProposers.observeBlockRoot(blockSlot, proposerIndex, blockRoot);
|
|
285
280
|
|
|
286
281
|
// [REJECT] The block is proposed by the expected proposer_index for the block's slot in the context of the current
|
|
287
282
|
// shuffling (defined by parent_root/slot). If the proposer_index cannot immediately be verified against the expected
|
|
@@ -291,11 +286,6 @@ export async function validateGossipBlock(
|
|
|
291
286
|
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.INCORRECT_PROPOSER, proposerIndex});
|
|
292
287
|
}
|
|
293
288
|
|
|
294
|
-
// Check again in case there two blocks are processed concurrently
|
|
295
|
-
if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
|
|
296
|
-
throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
289
|
// Simple implementation of a pending block queue. Keeping the block here recycles the queue logic, and keeps the
|
|
300
290
|
// gossip validation promise without any extra infrastructure.
|
|
301
291
|
// Do the sleep at the end, since regen and signature validation can already take longer than `msToBlockSlot`.
|
|
@@ -305,7 +295,35 @@ export async function validateGossipBlock(
|
|
|
305
295
|
await sleep(msToBlockSlot);
|
|
306
296
|
}
|
|
307
297
|
|
|
298
|
+
// Check again after all async validation and the early-block delay so concurrent proposals cannot both pass
|
|
299
|
+
if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
|
|
300
|
+
throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
|
|
301
|
+
}
|
|
302
|
+
|
|
308
303
|
chain.seenBlockProposers.add(blockSlot, proposerIndex);
|
|
309
304
|
|
|
310
305
|
return {skippedSlots};
|
|
311
306
|
}
|
|
307
|
+
|
|
308
|
+
export async function verifyBlockProposerSignature(
|
|
309
|
+
chain: IBeaconChain,
|
|
310
|
+
signedBlock: SignedBeaconBlock,
|
|
311
|
+
blockRoot: RootHex,
|
|
312
|
+
opts: {verifyOnMainThread?: boolean} = {}
|
|
313
|
+
): Promise<void> {
|
|
314
|
+
const blockSlot = signedBlock.message.slot;
|
|
315
|
+
if (chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature)) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const signatureSet = getBlockProposerSignatureSet(chain.config, signedBlock);
|
|
320
|
+
// Don't batch so verification is not delayed
|
|
321
|
+
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: opts.verifyOnMainThread ?? true}))) {
|
|
322
|
+
throw new BlockGossipError(GossipAction.REJECT, {
|
|
323
|
+
code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
324
|
+
blockSlot,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
chain.seenBlockInputCache.markVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature);
|
|
329
|
+
}
|
|
@@ -2,15 +2,16 @@ import {ChainConfig, ChainForkConfig} from "@lodestar/config";
|
|
|
2
2
|
import {
|
|
3
3
|
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH,
|
|
4
4
|
KZG_COMMITMENTS_SUBTREE_INDEX,
|
|
5
|
+
MIN_SEED_LOOKAHEAD,
|
|
5
6
|
NUMBER_OF_COLUMNS,
|
|
7
|
+
isForkPostFulu,
|
|
6
8
|
} from "@lodestar/params";
|
|
7
9
|
import {
|
|
8
10
|
computeEpochAtSlot,
|
|
9
11
|
computeStartSlotAtEpoch,
|
|
10
12
|
getBlockHeaderProposerSignatureSetByHeaderSlot,
|
|
11
|
-
getBlockHeaderProposerSignatureSetByParentStateSlot,
|
|
12
13
|
} from "@lodestar/state-transition";
|
|
13
|
-
import {DataColumnSidecar, Root, Slot, SubnetID, fulu, gloas, ssz} from "@lodestar/types";
|
|
14
|
+
import {DataColumnSidecar, Root, Slot, SubnetID, ValidatorIndex, fulu, gloas, ssz} from "@lodestar/types";
|
|
14
15
|
import {byteArrayEquals, toRootHex, verifyMerkleBranch} from "@lodestar/utils";
|
|
15
16
|
import {BeaconMetrics} from "../../metrics/metrics/beacon.js";
|
|
16
17
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -104,19 +105,23 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
// getBlockSlotState also checks for whether the current finalized checkpoint is an ancestor of the block.
|
|
108
|
-
// As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario).
|
|
109
|
-
// this is something we should change this in the future to make the code airtight to the spec.
|
|
110
108
|
// 7) [REJECT] The sidecar's block's parent passes validation.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
// Post-fulu, we can use parent state to get expected proposer index thanks to proposer lookahead
|
|
110
|
+
const parentEpoch = computeEpochAtSlot(parentBlock.slot);
|
|
111
|
+
const blockEpoch = computeEpochAtSlot(blockHeader.slot);
|
|
112
|
+
const getProposerIndex = async (): Promise<ValidatorIndex> => {
|
|
113
|
+
if (isForkPostFulu(chain.config.getForkName(parentBlock.slot)) && blockEpoch - parentEpoch <= MIN_SEED_LOOKAHEAD) {
|
|
114
|
+
const parentState = await chain.regen.getState(parentBlock.stateRoot, RegenCaller.validateGossipDataColumn);
|
|
115
|
+
return parentState.getBeaconProposer(blockHeader.slot);
|
|
116
|
+
}
|
|
117
|
+
const blockState = await chain.regen.getBlockSlotState(
|
|
118
|
+
parentBlock,
|
|
119
|
+
blockHeader.slot,
|
|
120
|
+
{dontTransferCache: true},
|
|
121
|
+
RegenCaller.validateGossipDataColumn
|
|
122
|
+
);
|
|
123
|
+
return blockState.getBeaconProposer(blockHeader.slot);
|
|
124
|
+
};
|
|
120
125
|
|
|
121
126
|
// 13) [REJECT] The sidecar is proposed by the expected proposer_index for the block's slot in the context of the current
|
|
122
127
|
// shuffling (defined by block_header.parent_root/block_header.slot). If the proposer_index cannot
|
|
@@ -124,7 +129,13 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
124
129
|
// while proposers for the block's branch are calculated -- in such a case do not REJECT, instead IGNORE
|
|
125
130
|
// this message.
|
|
126
131
|
const proposerIndex = blockHeader.proposerIndex;
|
|
127
|
-
const expectedProposerIndex =
|
|
132
|
+
const expectedProposerIndex = await getProposerIndex().catch(() => {
|
|
133
|
+
throw new DataColumnSidecarGossipError(GossipAction.IGNORE, {
|
|
134
|
+
code: DataColumnSidecarErrorCode.PARENT_UNKNOWN,
|
|
135
|
+
parentRoot,
|
|
136
|
+
slot: blockHeader.slot,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
128
139
|
|
|
129
140
|
if (proposerIndex !== expectedProposerIndex) {
|
|
130
141
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
@@ -137,9 +148,8 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
137
148
|
// 5) [REJECT] The proposer signature of sidecar.signed_block_header, is valid with respect to the block_header.proposer_index pubkey.
|
|
138
149
|
const signature = dataColumnSidecar.signedBlockHeader.signature;
|
|
139
150
|
if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockHeader.slot, blockRootHex, signature)) {
|
|
140
|
-
const signatureSet =
|
|
151
|
+
const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(
|
|
141
152
|
chain.config,
|
|
142
|
-
blockState.slot,
|
|
143
153
|
dataColumnSidecar.signedBlockHeader
|
|
144
154
|
);
|
|
145
155
|
|