@lodestar/beacon-node 2.1.0-dev.48a9458cd6 → 2.1.0-dev.4b0199a2eb
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 +1 -3
- 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 +8 -0
- 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 +3 -2
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/config/constants.d.ts +0 -1
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +1 -3
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +0 -3
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/errors.d.ts +7 -0
- package/lib/api/impl/errors.d.ts.map +1 -1
- package/lib/api/impl/errors.js +9 -0
- package/lib/api/impl/errors.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +4 -94
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/rest/base.d.ts.map +1 -1
- package/lib/api/rest/base.js +5 -2
- package/lib/api/rest/base.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +3 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +3 -1
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +3 -0
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +3 -1
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -5
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +7 -56
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.d.ts +0 -4
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js +0 -5
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/chain.d.ts +3 -3
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +30 -10
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts +7 -0
- package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js +1 -0
- package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +0 -15
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +0 -3
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/index.d.ts +0 -1
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +0 -1
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +11 -2
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +180 -13
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.d.ts +1 -2
- package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -1
- package/lib/chain/forkChoiceExecutionEngine.js +0 -3
- package/lib/chain/forkChoiceExecutionEngine.js.map +1 -1
- package/lib/chain/interface.d.ts +3 -3
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/index.d.ts +0 -1
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +0 -1
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +9 -3
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +22 -16
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -2
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -3
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +3 -33
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +0 -1
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +0 -1
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/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/seenBlockProposers.d.ts +3 -0
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +6 -2
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/seenCache/seenDataColumnSidecars.d.ts +17 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.d.ts.map +1 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.js +61 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.js.map +1 -0
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +11 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +28 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +4 -2
- 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 +20 -7
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +1 -34
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/index.d.ts +0 -1
- package/lib/chain/validation/index.d.ts.map +1 -1
- package/lib/chain/validation/index.js +0 -1
- package/lib/chain/validation/index.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +5 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +2 -2
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/execution/builder/validateBid.d.ts.map +1 -1
- package/lib/execution/builder/validateBid.js +1 -14
- package/lib/execution/builder/validateBid.js.map +1 -1
- package/lib/execution/engine/disabled.d.ts +0 -1
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +0 -3
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +2 -8
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +4 -27
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -13
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +2 -3
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.js +9 -33
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +0 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +3 -25
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +1 -4
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +2 -16
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/restTransport.d.ts +1 -2
- package/lib/execution/engine/restTransport.d.ts.map +1 -1
- package/lib/execution/engine/restTransport.js +0 -3
- package/lib/execution/engine/restTransport.js.map +1 -1
- package/lib/execution/engine/transport.d.ts +2 -3
- package/lib/execution/engine/transport.d.ts.map +1 -1
- package/lib/execution/engine/types.d.ts +0 -24
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +0 -12
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +0 -16
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +0 -35
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +0 -9
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +0 -20
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +1 -3
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +1 -3
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/forks.d.ts +2 -2
- package/lib/network/forks.d.ts.map +1 -1
- package/lib/network/forks.js +3 -3
- package/lib/network/forks.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +2 -8
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +0 -1
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/scoringParameters.js +19 -14
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +17 -29
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +1 -13
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +1 -2
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/network.d.ts +2 -8
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +16 -45
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts +0 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +0 -1
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/discover.d.ts +1 -0
- package/lib/network/peers/discover.d.ts.map +1 -1
- package/lib/network/peers/discover.js +44 -48
- package/lib/network/peers/discover.js.map +1 -1
- package/lib/network/peers/score/store.d.ts.map +1 -1
- package/lib/network/peers/score/store.js +1 -2
- package/lib/network/peers/score/store.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +76 -50
- 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 +0 -6
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +1 -5
- 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 +0 -1
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
- package/lib/network/reqresp/ReqRespBeaconNode.js +0 -6
- package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +3 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +0 -5
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts +0 -1
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +0 -5
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
- package/lib/network/reqresp/rateLimit.js +0 -4
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +2 -5
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +0 -3
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +1 -0
- 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 +5 -1
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +14 -1
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +6 -0
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +17 -8
- 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 +1 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js +6 -1
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/lib/util/dataColumns.d.ts +2 -1
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +7 -2
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/execution.d.ts +2 -1
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +7 -2
- package/lib/util/execution.js.map +1 -1
- package/package.json +18 -21
- package/src/api/impl/beacon/blocks/index.ts +1 -5
- package/src/api/impl/beacon/pool/index.ts +11 -0
- package/src/api/impl/beacon/state/index.ts +3 -7
- package/src/api/impl/beacon/state/utils.ts +1 -1
- package/src/api/impl/config/constants.ts +0 -4
- package/src/api/impl/debug/index.ts +0 -4
- package/src/api/impl/errors.ts +10 -0
- package/src/api/impl/validator/index.ts +2 -123
- package/src/api/rest/base.ts +4 -2
- package/src/chain/ColumnReconstructionTracker.ts +5 -1
- package/src/chain/GetBlobsTracker.ts +5 -0
- package/src/chain/blocks/importBlock.ts +14 -7
- package/src/chain/blocks/importExecutionPayload.ts +7 -74
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +8 -1
- package/src/chain/blocks/types.ts +0 -5
- package/src/chain/chain.ts +34 -9
- package/src/chain/errors/dataColumnSidecarError.ts +8 -0
- package/src/chain/errors/executionPayloadBid.ts +0 -18
- package/src/chain/errors/index.ts +0 -1
- package/src/chain/forkChoice/index.ts +233 -13
- package/src/chain/forkChoiceExecutionEngine.ts +1 -5
- package/src/chain/interface.ts +2 -2
- package/src/chain/opPools/index.ts +0 -1
- package/src/chain/opPools/opPool.ts +27 -16
- package/src/chain/options.ts +1 -2
- package/src/chain/produceBlock/produceBlockBody.ts +12 -66
- package/src/chain/regen/interface.ts +0 -1
- package/src/chain/seenCache/index.ts +1 -0
- package/src/chain/seenCache/seenBlockProposers.ts +12 -2
- package/src/chain/seenCache/seenDataColumnSidecars.ts +69 -0
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +28 -2
- package/src/chain/validation/attestation.ts +4 -2
- package/src/chain/validation/block.ts +19 -7
- package/src/chain/validation/dataColumnSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +2 -49
- package/src/chain/validation/index.ts +0 -1
- package/src/chain/validation/proposerSlashing.ts +5 -1
- package/src/chain/validation/voluntaryExit.ts +2 -2
- package/src/execution/builder/validateBid.ts +2 -23
- package/src/execution/engine/disabled.ts +0 -4
- package/src/execution/engine/http.ts +5 -40
- package/src/execution/engine/interface.ts +2 -24
- package/src/execution/engine/jsonRpcTransport.ts +9 -46
- package/src/execution/engine/mock.ts +3 -26
- package/src/execution/engine/payloadIdCache.ts +4 -25
- package/src/execution/engine/restTransport.ts +1 -15
- package/src/execution/engine/transport.ts +2 -5
- package/src/execution/engine/types.ts +0 -35
- package/src/index.ts +1 -0
- package/src/metrics/metrics/beacon.ts +0 -37
- package/src/metrics/metrics/lodestar.ts +0 -21
- package/src/network/core/networkCore.ts +1 -3
- package/src/network/forks.ts +7 -3
- package/src/network/gossip/interface.ts +0 -5
- package/src/network/gossip/scoringParameters.ts +23 -14
- package/src/network/gossip/topic.ts +0 -14
- package/src/network/interface.ts +0 -2
- package/src/network/network.ts +20 -55
- package/src/network/options.ts +0 -2
- package/src/network/peers/discover.ts +42 -52
- package/src/network/peers/score/store.ts +1 -2
- package/src/network/processor/gossipHandlers.ts +135 -69
- package/src/network/processor/gossipQueues/index.ts +0 -6
- package/src/network/processor/gossipValidatorFn.ts +0 -5
- package/src/network/processor/index.ts +0 -1
- package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -1
- package/src/network/reqresp/handlers/index.ts +0 -5
- package/src/network/reqresp/protocols.ts +0 -6
- package/src/network/reqresp/rateLimit.ts +0 -4
- package/src/network/reqresp/types.ts +0 -6
- package/src/sync/range/chain.ts +1 -0
- package/src/sync/range/range.ts +7 -1
- package/src/sync/unknownBlock.ts +20 -1
- package/src/sync/utils/downloadByRange.ts +30 -7
- package/src/sync/utils/downloadByRoot.ts +12 -9
- package/src/sync/utils/pendingBlocksTree.ts +6 -1
- package/src/util/dataColumns.ts +13 -1
- package/src/util/execution.ts +16 -1
- package/lib/chain/errors/inclusionList.d.ts +0 -60
- package/lib/chain/errors/inclusionList.d.ts.map +0 -1
- package/lib/chain/errors/inclusionList.js +0 -19
- package/lib/chain/errors/inclusionList.js.map +0 -1
- package/lib/chain/opPools/inclusionListStore.d.ts +0 -66
- package/lib/chain/opPools/inclusionListStore.d.ts.map +0 -1
- package/lib/chain/opPools/inclusionListStore.js +0 -174
- package/lib/chain/opPools/inclusionListStore.js.map +0 -1
- package/lib/chain/validation/inclusionList.d.ts +0 -14
- package/lib/chain/validation/inclusionList.d.ts.map +0 -1
- package/lib/chain/validation/inclusionList.js +0 -150
- package/lib/chain/validation/inclusionList.js.map +0 -1
- package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +0 -10
- package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +0 -1
- package/lib/network/reqresp/handlers/inclusionListsByIndices.js +0 -30
- package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +0 -1
- package/src/chain/errors/inclusionList.ts +0 -38
- package/src/chain/opPools/inclusionListStore.ts +0 -211
- package/src/chain/validation/inclusionList.ts +0 -192
- package/src/network/reqresp/handlers/inclusionListsByIndices.ts +0 -44
|
@@ -12,7 +12,11 @@ import {
|
|
|
12
12
|
isForkPostElectra,
|
|
13
13
|
isForkPostGloas,
|
|
14
14
|
} from "@lodestar/params";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
computeTimeAtSlot,
|
|
17
|
+
getBlockHeaderProposerSignatureSetByHeaderSlot,
|
|
18
|
+
signedBlockToSignedHeader,
|
|
19
|
+
} from "@lodestar/state-transition";
|
|
16
20
|
import {
|
|
17
21
|
Root,
|
|
18
22
|
RootHex,
|
|
@@ -25,6 +29,7 @@ import {
|
|
|
25
29
|
gloas,
|
|
26
30
|
isGloasBeaconBlock,
|
|
27
31
|
isGloasDataColumnSidecar,
|
|
32
|
+
phase0,
|
|
28
33
|
ssz,
|
|
29
34
|
sszTypesFor,
|
|
30
35
|
} from "@lodestar/types";
|
|
@@ -38,7 +43,6 @@ import {
|
|
|
38
43
|
} from "../../chain/blocks/blockInput/index.js";
|
|
39
44
|
import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
40
45
|
import {PayloadEnvelopeInput, PayloadEnvelopeInputSource} from "../../chain/blocks/payloadEnvelopeInput/index.js";
|
|
41
|
-
import {InclusionListSource} from "../../chain/blocks/types.js";
|
|
42
46
|
import {ChainEvent} from "../../chain/emitter.js";
|
|
43
47
|
import {
|
|
44
48
|
AttestationError,
|
|
@@ -66,7 +70,6 @@ import {
|
|
|
66
70
|
validateGossipExecutionPayloadEnvelope,
|
|
67
71
|
validateGossipExecutionPayloadEnvelopeSerialized,
|
|
68
72
|
} from "../../chain/validation/executionPayloadEnvelope.js";
|
|
69
|
-
import {InclusionListValidationResult, validateGossipInclusionList} from "../../chain/validation/inclusionList.js";
|
|
70
73
|
import {
|
|
71
74
|
AggregateAndProofValidationResult,
|
|
72
75
|
GossipAttestation,
|
|
@@ -183,7 +186,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
183
186
|
blockRootHex: RootHex,
|
|
184
187
|
fork: ForkName,
|
|
185
188
|
peerIdStr: string,
|
|
186
|
-
seenTimestampSec: number
|
|
189
|
+
seenTimestampSec: number,
|
|
190
|
+
opts?: {unvalidated?: boolean}
|
|
187
191
|
): BlockInput {
|
|
188
192
|
const blockInput = chain.seenBlockInputCache.getByBlock({
|
|
189
193
|
block: signedBlock,
|
|
@@ -196,15 +200,18 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
196
200
|
// Also seed the payload-envelope cache, so we have PayloadEnvelopeInput even through "PARENT_BLOCK_UNKNOWN" error
|
|
197
201
|
// see https://github.com/ChainSafe/lodestar/issues/9475
|
|
198
202
|
if (isForkPostGloas(fork)) {
|
|
199
|
-
chain.seenPayloadEnvelopeInputCache.add(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
chain.seenPayloadEnvelopeInputCache.add(
|
|
204
|
+
{
|
|
205
|
+
blockRootHex,
|
|
206
|
+
block: signedBlock as SignedBeaconBlock<ForkPostGloas>,
|
|
207
|
+
forkName: fork,
|
|
208
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
209
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
210
|
+
seenTimestampSec,
|
|
211
|
+
source: PayloadEnvelopeInputSource.gossip,
|
|
212
|
+
},
|
|
213
|
+
opts
|
|
214
|
+
);
|
|
208
215
|
}
|
|
209
216
|
|
|
210
217
|
return blockInput;
|
|
@@ -300,7 +307,9 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
300
307
|
}
|
|
301
308
|
chain.seenBlockProposers.add(slot, proposerIndex, blockRootHex);
|
|
302
309
|
|
|
303
|
-
const blockInput = cacheSignatureVerifiedBlock(signedBlock, blockRootHex, fork, peerIdStr, seenTimestampSec
|
|
310
|
+
const blockInput = cacheSignatureVerifiedBlock(signedBlock, blockRootHex, fork, peerIdStr, seenTimestampSec, {
|
|
311
|
+
unvalidated: true,
|
|
312
|
+
});
|
|
304
313
|
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
305
314
|
blockInput,
|
|
306
315
|
peer: peerIdStr,
|
|
@@ -374,6 +383,28 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
374
383
|
}
|
|
375
384
|
}
|
|
376
385
|
|
|
386
|
+
// The block input may have been pruned before the block was imported
|
|
387
|
+
if (
|
|
388
|
+
chain.seenDataColumnSidecars.isKnown(
|
|
389
|
+
slot,
|
|
390
|
+
dataColumnBlockHeader.proposerIndex,
|
|
391
|
+
dataColumnSidecar.index,
|
|
392
|
+
blockRootHex
|
|
393
|
+
)
|
|
394
|
+
) {
|
|
395
|
+
metrics?.peerDas.dataColumnSidecarProcessingSkip.inc();
|
|
396
|
+
throw new DataColumnSidecarGossipError(GossipAction.IGNORE, {
|
|
397
|
+
code: DataColumnSidecarErrorCode.ALREADY_KNOWN,
|
|
398
|
+
columnIndex: dataColumnSidecar.index,
|
|
399
|
+
slot,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (isRepeatColumnProposal(chain, dataColumnSidecar, blockRootHex)) {
|
|
404
|
+
await observeRepeatColumnProposal(chain, dataColumnSidecar, blockRootHex);
|
|
405
|
+
throw repeatColumnProposalError(dataColumnSidecar, blockRootHex);
|
|
406
|
+
}
|
|
407
|
+
|
|
377
408
|
const verificationTimer = metrics?.peerDas.dataColumnSidecarGossipVerificationTime.startTimer();
|
|
378
409
|
|
|
379
410
|
const delaySec = chain.clock.secFromSlot(slot, seenTimestampSec);
|
|
@@ -382,6 +413,17 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
382
413
|
|
|
383
414
|
try {
|
|
384
415
|
await validateGossipFuluDataColumnSidecar(chain, dataColumnSidecar, gossipSubnet, metrics);
|
|
416
|
+
observeColumnBlockHeader(chain, dataColumnSidecar.signedBlockHeader, blockRootHex);
|
|
417
|
+
// Another block root may have been seen for the same tuple while validating
|
|
418
|
+
if (isRepeatColumnProposal(chain, dataColumnSidecar, blockRootHex)) {
|
|
419
|
+
throw repeatColumnProposalError(dataColumnSidecar, blockRootHex);
|
|
420
|
+
}
|
|
421
|
+
chain.seenDataColumnSidecars.add(
|
|
422
|
+
slot,
|
|
423
|
+
dataColumnBlockHeader.proposerIndex,
|
|
424
|
+
dataColumnSidecar.index,
|
|
425
|
+
blockRootHex
|
|
426
|
+
);
|
|
385
427
|
const blockInput = chain.seenBlockInputCache.getByColumn({
|
|
386
428
|
blockRootHex,
|
|
387
429
|
columnSidecar: dataColumnSidecar,
|
|
@@ -575,7 +617,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
575
617
|
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
576
618
|
metrics?.gossipBlock.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
|
|
577
619
|
chain.validatorMonitor?.registerBeaconBlock(OpSource.gossip, delaySec, signedBlock.message);
|
|
578
|
-
|
|
620
|
+
const missingData = !blockInput.hasBlockAndAllData();
|
|
621
|
+
if (missingData) {
|
|
579
622
|
chain.logger.debug("Received gossip block, attempting fetch of unavailable data", blockInput.getLogMeta());
|
|
580
623
|
// The data is not yet fully available, immediately trigger an aggressive pull via unknown block sync
|
|
581
624
|
chain.emitter.emit(ChainEvent.incompleteBlockInput, {
|
|
@@ -668,8 +711,13 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
668
711
|
}
|
|
669
712
|
metrics?.gossipBlock.processBlockErrors.inc({error: e instanceof BlockError ? e.type.code : "NOT_BLOCK_ERROR"});
|
|
670
713
|
logger[logLevel]("Error processing block", {slot, root: blockInput.blockRootHex, peer: peerIdStr}, e as Error);
|
|
671
|
-
//
|
|
672
|
-
|
|
714
|
+
// BlockInputSync retries the import of a block with missing data from this same BlockInput, pruning it here
|
|
715
|
+
// would put later gossip columns into a new BlockInput that is never imported. The entry is released once the
|
|
716
|
+
// block is persisted, BlockInputSync removes it, on finalization or by the cache size limit
|
|
717
|
+
if (!missingData) {
|
|
718
|
+
// TODO(fulu): Revisit when we prune block inputs
|
|
719
|
+
chain.seenBlockInputCache.prune(blockInput.blockRootHex);
|
|
720
|
+
}
|
|
673
721
|
});
|
|
674
722
|
}
|
|
675
723
|
|
|
@@ -685,7 +733,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
685
733
|
const signedBlock = sszDeserialize(topic, serializedData);
|
|
686
734
|
try {
|
|
687
735
|
const blockInput = await validateBeaconBlock(signedBlock, topic.boundary.fork, peerIdStr, seenTimestampSec);
|
|
688
|
-
// Runs after the validation result is reported
|
|
736
|
+
// Runs after the validation result is reported
|
|
689
737
|
callAfterIO(() => {
|
|
690
738
|
try {
|
|
691
739
|
chain.serializedCache.set(signedBlock, serializedData);
|
|
@@ -707,7 +755,12 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
707
755
|
e.type.code === BlockErrorCode.REPEAT_PROPOSAL &&
|
|
708
756
|
// Only a signature-verified sibling recorded in the seen cache is imported. The cache holds at most two
|
|
709
757
|
// roots per proposer and slot, which bounds full imports over gossip to one alternate
|
|
710
|
-
chain.seenBlockProposers.
|
|
758
|
+
chain.seenBlockProposers.hasBlockSignature(
|
|
759
|
+
signedBlock.message.slot,
|
|
760
|
+
e.type.proposerIndex,
|
|
761
|
+
e.type.root,
|
|
762
|
+
signedBlock.signature
|
|
763
|
+
) &&
|
|
711
764
|
// A sibling with an unknown parent cannot be imported, sync fetches it if its branch becomes relevant
|
|
712
765
|
chain.forkChoice.getBlockHexDefaultStatus(toRootHex(signedBlock.message.parentRoot)) !== null &&
|
|
713
766
|
(!isGloasBeaconBlock(signedBlock.message) ||
|
|
@@ -721,7 +774,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
721
774
|
e.type.root,
|
|
722
775
|
topic.boundary.fork,
|
|
723
776
|
peerIdStr,
|
|
724
|
-
seenTimestampSec
|
|
777
|
+
seenTimestampSec,
|
|
778
|
+
{unvalidated: false}
|
|
725
779
|
);
|
|
726
780
|
// We're returning IGNORE (thrown below), so this block is not forwarded to peers. Unlike the
|
|
727
781
|
// happy path there is no rush to forward, so we don't need to wrap in callInNextEventLoop.
|
|
@@ -1410,55 +1464,6 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1410
1464
|
}
|
|
1411
1465
|
});
|
|
1412
1466
|
},
|
|
1413
|
-
|
|
1414
|
-
[GossipType.inclusion_list]: async ({
|
|
1415
|
-
gossipData,
|
|
1416
|
-
topic,
|
|
1417
|
-
seenTimestampSec,
|
|
1418
|
-
}: GossipHandlerParamGeneric<GossipType.inclusion_list>) => {
|
|
1419
|
-
const {serializedData} = gossipData;
|
|
1420
|
-
const signedInclusionList = sszDeserialize(topic, serializedData);
|
|
1421
|
-
const {slot} = signedInclusionList.message;
|
|
1422
|
-
|
|
1423
|
-
metrics?.inclusionListsReceived.inc({source: InclusionListSource.gossip});
|
|
1424
|
-
metrics?.inclusionListTransactionsReceived.inc(
|
|
1425
|
-
{source: InclusionListSource.gossip},
|
|
1426
|
-
signedInclusionList.message.transactions.length
|
|
1427
|
-
);
|
|
1428
|
-
|
|
1429
|
-
const timer = metrics?.inclusionListsValidationTime.startTimer();
|
|
1430
|
-
let validationResult: InclusionListValidationResult;
|
|
1431
|
-
try {
|
|
1432
|
-
validationResult = await validateGossipInclusionList(chain, signedInclusionList);
|
|
1433
|
-
} finally {
|
|
1434
|
-
timer?.({source: InclusionListSource.gossip});
|
|
1435
|
-
}
|
|
1436
|
-
const {committeeIndices, totalBytes} = validationResult;
|
|
1437
|
-
|
|
1438
|
-
// Handler - deferred to next event loop so the validation result propagates first
|
|
1439
|
-
callInNextEventLoop(() => {
|
|
1440
|
-
try {
|
|
1441
|
-
metrics?.inclusionListsValid.inc({source: InclusionListSource.gossip});
|
|
1442
|
-
metrics?.inclusionListsValidSize.inc(totalBytes);
|
|
1443
|
-
// A list received before its slot is timely, the spec delays it until the slot starts. Only gossip
|
|
1444
|
-
// validation bounds how early a list can be. Late lists are still stored, marked untimely
|
|
1445
|
-
const secFromSlot = chain.clock.secFromSlot(slot, seenTimestampSec);
|
|
1446
|
-
metrics?.inclusionListArrivalTime.observe(secFromSlot);
|
|
1447
|
-
const isTimely = secFromSlot * 1000 < config.getInclusionListDueMs(config.getForkName(slot));
|
|
1448
|
-
|
|
1449
|
-
const insertOutcome = chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
|
|
1450
|
-
metrics?.inclusionListStore.insertOutcome.inc({insertOutcome});
|
|
1451
|
-
metrics?.inclusionListStore.size.set(chain.inclusionListStore.size);
|
|
1452
|
-
|
|
1453
|
-
chain.emitter.emit(routes.events.EventType.inclusionList, {
|
|
1454
|
-
version: config.getForkName(slot),
|
|
1455
|
-
data: signedInclusionList,
|
|
1456
|
-
});
|
|
1457
|
-
} catch (e) {
|
|
1458
|
-
logger.debug("Error handling gossip inclusion list", {slot}, e as Error);
|
|
1459
|
-
}
|
|
1460
|
-
});
|
|
1461
|
-
},
|
|
1462
1467
|
};
|
|
1463
1468
|
}
|
|
1464
1469
|
|
|
@@ -1650,3 +1655,64 @@ function getCutoffTimeMs(
|
|
|
1650
1655
|
0
|
|
1651
1656
|
);
|
|
1652
1657
|
}
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* [IGNORE] The sidecar is the first sidecar for the tuple (block_header.slot, block_header.proposer_index, sidecar.index)
|
|
1661
|
+
* with valid header signature, sidecar inclusion proof, and kzg proof
|
|
1662
|
+
*/
|
|
1663
|
+
function isRepeatColumnProposal(
|
|
1664
|
+
chain: IBeaconChain,
|
|
1665
|
+
dataColumnSidecar: fulu.DataColumnSidecar,
|
|
1666
|
+
blockRootHex: RootHex
|
|
1667
|
+
): boolean {
|
|
1668
|
+
const {slot, proposerIndex} = dataColumnSidecar.signedBlockHeader.message;
|
|
1669
|
+
return chain.seenDataColumnSidecars.isRepeatProposal(slot, proposerIndex, dataColumnSidecar.index, blockRootHex);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
function repeatColumnProposalError(
|
|
1673
|
+
dataColumnSidecar: fulu.DataColumnSidecar,
|
|
1674
|
+
blockRootHex: RootHex
|
|
1675
|
+
): DataColumnSidecarGossipError {
|
|
1676
|
+
const {slot, proposerIndex} = dataColumnSidecar.signedBlockHeader.message;
|
|
1677
|
+
return new DataColumnSidecarGossipError(GossipAction.IGNORE, {
|
|
1678
|
+
code: DataColumnSidecarErrorCode.REPEAT_PROPOSAL,
|
|
1679
|
+
slot,
|
|
1680
|
+
proposerIndex,
|
|
1681
|
+
columnIndex: dataColumnSidecar.index,
|
|
1682
|
+
root: blockRootHex,
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
function observeColumnBlockHeader(
|
|
1687
|
+
chain: IBeaconChain,
|
|
1688
|
+
signedBlockHeader: phase0.SignedBeaconBlockHeader,
|
|
1689
|
+
blockRootHex: RootHex
|
|
1690
|
+
): void {
|
|
1691
|
+
const {slot, proposerIndex} = signedBlockHeader.message;
|
|
1692
|
+
chain.seenBlockProposers.observeBlockRoot(slot, proposerIndex, blockRootHex, signedBlockHeader);
|
|
1693
|
+
if (chain.seenBlockProposers.isEquivocating(slot, proposerIndex)) {
|
|
1694
|
+
chain.processProposerEquivocation(slot, proposerIndex);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
async function observeRepeatColumnProposal(
|
|
1699
|
+
chain: IBeaconChain,
|
|
1700
|
+
dataColumnSidecar: fulu.DataColumnSidecar,
|
|
1701
|
+
blockRootHex: RootHex
|
|
1702
|
+
): Promise<void> {
|
|
1703
|
+
const {signedBlockHeader} = dataColumnSidecar;
|
|
1704
|
+
const {slot, proposerIndex} = signedBlockHeader.message;
|
|
1705
|
+
// Only needed as slashing evidence, so verify at most one conflicting header per slot and proposer
|
|
1706
|
+
if (
|
|
1707
|
+
chain.seenBlockProposers.hasBlockRoot(slot, proposerIndex, blockRootHex) ||
|
|
1708
|
+
chain.seenBlockProposers.isEquivocating(slot, proposerIndex) ||
|
|
1709
|
+
!chain.seenDataColumnSidecars.markEvidenceCheck(slot, proposerIndex)
|
|
1710
|
+
) {
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(chain.config, signedBlockHeader);
|
|
1715
|
+
if (await chain.bls.verifySignatureSets([signatureSet])) {
|
|
1716
|
+
observeColumnBlockHeader(chain, signedBlockHeader, blockRootHex);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
@@ -82,12 +82,6 @@ const linearGossipQueueOpts: {
|
|
|
82
82
|
type: QueueType.FIFO,
|
|
83
83
|
dropOpts: {type: DropType.count, count: 1},
|
|
84
84
|
},
|
|
85
|
-
[GossipType.inclusion_list]: {
|
|
86
|
-
// 16 committee members, two lists each under the first-or-second-message rule, 32 per slot
|
|
87
|
-
maxLength: 1024,
|
|
88
|
-
type: QueueType.FIFO,
|
|
89
|
-
dropOpts: {type: DropType.count, count: 1},
|
|
90
|
-
},
|
|
91
85
|
};
|
|
92
86
|
|
|
93
87
|
const indexedGossipQueueOpts: {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
GossipAction,
|
|
14
14
|
GossipActionError,
|
|
15
15
|
GossipErrorCode,
|
|
16
|
-
InclusionListErrorCode,
|
|
17
16
|
PayloadAttestationErrorCode,
|
|
18
17
|
ProposerPreferencesErrorCode,
|
|
19
18
|
ProposerSlashingErrorCode,
|
|
@@ -83,10 +82,6 @@ const gossipRejectPeerAction: Record<GossipType, RejectPeerActionRule> = {
|
|
|
83
82
|
default: PeerAction.MidToleranceError,
|
|
84
83
|
byCode: {[PayloadAttestationErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
|
|
85
84
|
},
|
|
86
|
-
[GossipType.inclusion_list]: {
|
|
87
|
-
default: PeerAction.MidToleranceError,
|
|
88
|
-
byCode: {[InclusionListErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
|
|
89
|
-
},
|
|
90
85
|
[GossipType.execution_payload_bid]: {
|
|
91
86
|
default: PeerAction.HighToleranceError,
|
|
92
87
|
byCode: {[ExecutionPayloadBidErrorCode.INVALID_SIGNATURE]: PeerAction.Fatal},
|
|
@@ -139,7 +139,6 @@ const executeGossipWorkOrderObj: Record<GossipType, WorkOpts> = {
|
|
|
139
139
|
[GossipType.payload_attestation_message]: {},
|
|
140
140
|
[GossipType.execution_payload_bid]: {},
|
|
141
141
|
[GossipType.proposer_preferences]: {},
|
|
142
|
-
[GossipType.inclusion_list]: {},
|
|
143
142
|
};
|
|
144
143
|
const executeGossipWorkOrder = Object.keys(executeGossipWorkOrderObj) as (keyof typeof executeGossipWorkOrderObj)[];
|
|
145
144
|
|
|
@@ -304,13 +304,6 @@ export class ReqRespBeaconNode extends ReqResp {
|
|
|
304
304
|
);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
if (ForkSeq[fork] >= ForkSeq.heze) {
|
|
308
|
-
protocolsAtFork.push([
|
|
309
|
-
protocols.InclusionListsByIndices(fork, this.config),
|
|
310
|
-
this.getHandler(ReqRespMethod.InclusionListsByIndices),
|
|
311
|
-
]);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
307
|
return protocolsAtFork;
|
|
315
308
|
}
|
|
316
309
|
|
|
@@ -226,5 +226,8 @@ export function validateDataColumnSidecarsByRangeRequest(
|
|
|
226
226
|
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
// Spec: sidecars MUST be sent in (slot, column_index) order, so serve each requested column once, ascending
|
|
230
|
+
const sortedColumns = Array.from(new Set(columns)).sort((a, b) => a - b);
|
|
231
|
+
|
|
232
|
+
return {startSlot, count, columns: sortedColumns};
|
|
230
233
|
}
|
|
@@ -16,7 +16,6 @@ import {onDataColumnSidecarsByRange} from "./dataColumnSidecarsByRange.js";
|
|
|
16
16
|
import {onDataColumnSidecarsByRoot} from "./dataColumnSidecarsByRoot.js";
|
|
17
17
|
import {onExecutionPayloadEnvelopesByRange} from "./executionPayloadEnvelopesByRange.js";
|
|
18
18
|
import {onExecutionPayloadEnvelopesByRoot} from "./executionPayloadEnvelopesByRoot.js";
|
|
19
|
-
import {onInclusionListsByIndices} from "./inclusionListsByIndices.js";
|
|
20
19
|
import {onLightClientBootstrap} from "./lightClientBootstrap.js";
|
|
21
20
|
import {onLightClientFinalityUpdate} from "./lightClientFinalityUpdate.js";
|
|
22
21
|
import {onLightClientOptimisticUpdate} from "./lightClientOptimisticUpdate.js";
|
|
@@ -126,10 +125,6 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
|
|
|
126
125
|
},
|
|
127
126
|
[ReqRespMethod.LightClientFinalityUpdate]: () => onLightClientFinalityUpdate(chain),
|
|
128
127
|
[ReqRespMethod.LightClientOptimisticUpdate]: () => onLightClientOptimisticUpdate(chain),
|
|
129
|
-
[ReqRespMethod.InclusionListsByIndices]: (req, peerId, peerClient) => {
|
|
130
|
-
const body = deserializeRequestBody(ssz.heze.InclusionListsByIndicesRequest, req.data);
|
|
131
|
-
return onInclusionListsByIndices(body, chain, peerId, peerClient);
|
|
132
|
-
},
|
|
133
128
|
};
|
|
134
129
|
|
|
135
130
|
return (method) => handlers[method];
|
|
@@ -101,12 +101,6 @@ export const ExecutionPayloadEnvelopesByRange = toProtocol({
|
|
|
101
101
|
contextBytesType: ContextBytesType.ForkDigest,
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
export const InclusionListsByIndices = toProtocol({
|
|
105
|
-
method: ReqRespMethod.InclusionListsByIndices,
|
|
106
|
-
version: Version.V1,
|
|
107
|
-
contextBytesType: ContextBytesType.ForkDigest,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
104
|
export const LightClientBootstrap = toProtocol({
|
|
111
105
|
method: ReqRespMethod.LightClientBootstrap,
|
|
112
106
|
version: Version.V1,
|
|
@@ -93,10 +93,6 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record<R
|
|
|
93
93
|
// Allow 2 per slot and a very safe bound until there's more testing of real usage.
|
|
94
94
|
byPeer: {quota: 2, quotaTimeMs: config.getSlotDurationMs(fork)},
|
|
95
95
|
},
|
|
96
|
-
[ReqRespMethod.InclusionListsByIndices]: {
|
|
97
|
-
// Peers only backfill what gossip missed, so a small per-slot allowance is enough
|
|
98
|
-
byPeer: {quota: 5, quotaTimeMs: config.getSlotDurationMs(fork)},
|
|
99
|
-
},
|
|
100
96
|
[ReqRespMethod.LightClientOptimisticUpdate]: {
|
|
101
97
|
// Optimistic updates should not be requested more than once per slot.
|
|
102
98
|
// Allow 2 per slot and a very safe bound until there's more testing of real usage.
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
altair,
|
|
16
16
|
fulu,
|
|
17
17
|
gloas,
|
|
18
|
-
heze,
|
|
19
18
|
phase0,
|
|
20
19
|
ssz,
|
|
21
20
|
sszTypesFor,
|
|
@@ -49,7 +48,6 @@ export enum ReqRespMethod {
|
|
|
49
48
|
LightClientUpdatesByRange = "light_client_updates_by_range",
|
|
50
49
|
LightClientFinalityUpdate = "light_client_finality_update",
|
|
51
50
|
LightClientOptimisticUpdate = "light_client_optimistic_update",
|
|
52
|
-
InclusionListsByIndices = "inclusion_lists_by_indices",
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
// To typesafe events to network
|
|
@@ -69,7 +67,6 @@ export type RequestBodyByMethod = {
|
|
|
69
67
|
[ReqRespMethod.LightClientUpdatesByRange]: altair.LightClientUpdatesByRange;
|
|
70
68
|
[ReqRespMethod.LightClientFinalityUpdate]: null;
|
|
71
69
|
[ReqRespMethod.LightClientOptimisticUpdate]: null;
|
|
72
|
-
[ReqRespMethod.InclusionListsByIndices]: heze.InclusionListsByIndicesRequest;
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
type ResponseBodyByMethod = {
|
|
@@ -90,7 +87,6 @@ type ResponseBodyByMethod = {
|
|
|
90
87
|
[ReqRespMethod.LightClientUpdatesByRange]: LightClientUpdate;
|
|
91
88
|
[ReqRespMethod.LightClientFinalityUpdate]: LightClientFinalityUpdate;
|
|
92
89
|
[ReqRespMethod.LightClientOptimisticUpdate]: LightClientOptimisticUpdate;
|
|
93
|
-
[ReqRespMethod.InclusionListsByIndices]: heze.SignedInclusionList;
|
|
94
90
|
};
|
|
95
91
|
|
|
96
92
|
/** Request SSZ type for each method and ForkName */
|
|
@@ -119,7 +115,6 @@ export const requestSszTypeByMethod: (
|
|
|
119
115
|
[ReqRespMethod.LightClientUpdatesByRange]: ssz.altair.LightClientUpdatesByRange,
|
|
120
116
|
[ReqRespMethod.LightClientFinalityUpdate]: null,
|
|
121
117
|
[ReqRespMethod.LightClientOptimisticUpdate]: null,
|
|
122
|
-
[ReqRespMethod.InclusionListsByIndices]: ssz.heze.InclusionListsByIndicesRequest,
|
|
123
118
|
});
|
|
124
119
|
|
|
125
120
|
export type ResponseTypeGetter<T> = (fork: ForkName, version: number) => Type<T>;
|
|
@@ -150,7 +145,6 @@ export const responseSszTypeByMethod: {[K in ReqRespMethod]: ResponseTypeGetter<
|
|
|
150
145
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
|
|
151
146
|
[ReqRespMethod.LightClientOptimisticUpdate]: (fork) =>
|
|
152
147
|
sszTypesFor(onlyPostAltairFork(fork)).LightClientOptimisticUpdate,
|
|
153
|
-
[ReqRespMethod.InclusionListsByIndices]: () => ssz.heze.SignedInclusionList,
|
|
154
148
|
};
|
|
155
149
|
|
|
156
150
|
function onlyPostAltairFork(fork: ForkName): ForkPostAltair {
|
package/src/sync/range/chain.ts
CHANGED
|
@@ -627,6 +627,7 @@ export class SyncChain {
|
|
|
627
627
|
case DownloadByRangeErrorCode.INVALID_ENVELOPE_BLOCK_HASH:
|
|
628
628
|
case DownloadByRangeErrorCode.INVALID_ENVELOPE_SLOT:
|
|
629
629
|
case DownloadByRangeErrorCode.INVALID_CHAIN_SEGMENT:
|
|
630
|
+
case DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS:
|
|
630
631
|
case DataColumnSidecarErrorCode.INCORRECT_KZG_COMMITMENTS_COUNT:
|
|
631
632
|
case DataColumnSidecarErrorCode.INCORRECT_KZG_PROOF_COUNT:
|
|
632
633
|
case DataColumnSidecarErrorCode.INVALID_KZG_PROOF_BATCH:
|
package/src/sync/range/range.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {EventEmitter} from "node:events";
|
|
2
2
|
import {StrictEventEmitter} from "strict-event-emitter-types";
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
|
+
import {isForkPostGloas} from "@lodestar/params";
|
|
4
5
|
import {IBeaconStateViewGloas, computeStartSlotAtEpoch, isStatePostGloas} from "@lodestar/state-transition";
|
|
5
6
|
import {Epoch, Status, fulu, ssz} from "@lodestar/types";
|
|
6
7
|
import {Logger, byteArrayEquals, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
|
|
@@ -434,7 +435,12 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
|
|
|
434
435
|
// the batch then downloads the head's payload as dangling parent and validates it against the bid
|
|
435
436
|
const headState = this.chain.getHeadState();
|
|
436
437
|
let parentPayload: ParentPayload | undefined;
|
|
437
|
-
|
|
438
|
+
// A pre-Gloas head block in a state upgraded to Gloas carried its own payload, no envelope follows it
|
|
439
|
+
if (
|
|
440
|
+
isStatePostGloas(headState) &&
|
|
441
|
+
headState.latestBlockHeader.slot > 0 &&
|
|
442
|
+
isForkPostGloas(this.config.getForkName(headState.latestBlockHeader.slot))
|
|
443
|
+
) {
|
|
438
444
|
const header = ssz.phase0.BeaconBlockHeader.clone(headState.latestBlockHeader);
|
|
439
445
|
if (byteArrayEquals(header.stateRoot, ssz.Root.defaultValue())) {
|
|
440
446
|
header.stateRoot = headState.hashTreeRoot();
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -928,6 +928,19 @@ export class BlockInputSync {
|
|
|
928
928
|
const connectedPeers = this.network.getConnectedPeers();
|
|
929
929
|
const hasConnectedPeers = connectedPeers.length > 0;
|
|
930
930
|
|
|
931
|
+
// Gossip, getBlobs or column reconstruction can complete a pending block's data through the shared BlockInput.
|
|
932
|
+
// With only half the columns the block stays pending, its fetch asks a peer for the rest before reconstructing
|
|
933
|
+
for (const block of this.pendingBlocks.values()) {
|
|
934
|
+
if (
|
|
935
|
+
isPendingBlockInput(block) &&
|
|
936
|
+
block.status === PendingBlockInputStatus.pending &&
|
|
937
|
+
block.blockInput.hasBlockAndAllData() &&
|
|
938
|
+
(!isBlockInputColumns(block.blockInput) || block.blockInput.hasComputedAllData())
|
|
939
|
+
) {
|
|
940
|
+
block.status = PendingBlockInputStatus.downloaded;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
931
944
|
const {unknowns, ancestors} = getUnknownAndAncestorBlocks(this.pendingBlocks);
|
|
932
945
|
let processedBlocks = 0;
|
|
933
946
|
let shouldRerunBlockSearch = false;
|
|
@@ -2201,7 +2214,13 @@ export class BlockInputSync {
|
|
|
2201
2214
|
const cacheItemRootHex = getBlockInputSyncCacheItemRootHex(cacheItem);
|
|
2202
2215
|
// pruning may have dropped it mid-fetch
|
|
2203
2216
|
if (this.pendingBlocks.has(cacheItemRootHex)) {
|
|
2204
|
-
|
|
2217
|
+
// A partial download stays fetching while the next peer is asked, a pending entry would be fetched again
|
|
2218
|
+
this.pendingBlocks.set(
|
|
2219
|
+
cacheItemRootHex,
|
|
2220
|
+
cacheItem.status === PendingBlockInputStatus.pending
|
|
2221
|
+
? {...cacheItem, status: PendingBlockInputStatus.fetching}
|
|
2222
|
+
: cacheItem
|
|
2223
|
+
);
|
|
2205
2224
|
}
|
|
2206
2225
|
|
|
2207
2226
|
if (cacheItem.status === PendingBlockInputStatus.downloaded) {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ForkName,
|
|
4
|
+
ForkPostDeneb,
|
|
5
|
+
ForkPostFulu,
|
|
6
|
+
ForkPostGloas,
|
|
7
|
+
isForkPostDeneb,
|
|
8
|
+
isForkPostFulu,
|
|
9
|
+
isForkPostGloas,
|
|
10
|
+
} from "@lodestar/params";
|
|
11
|
+
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
3
12
|
import {
|
|
4
13
|
ColumnIndex,
|
|
5
14
|
DataColumnSidecar,
|
|
@@ -28,6 +37,7 @@ import {INetwork} from "../../network/index.js";
|
|
|
28
37
|
import {CustodyConfig, getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
29
38
|
import {PeerIdStr} from "../../util/peerId.js";
|
|
30
39
|
import {WarnResult} from "../../util/wrapError.js";
|
|
40
|
+
import {getRateLimitedUntilMs} from "./rateLimit.js";
|
|
31
41
|
|
|
32
42
|
export type DownloadByRangeRequests = {
|
|
33
43
|
blocksRequest?: phase0.BeaconBlocksByRangeRequest;
|
|
@@ -327,6 +337,8 @@ export async function downloadByRange({
|
|
|
327
337
|
parentPayloadRequest,
|
|
328
338
|
});
|
|
329
339
|
} catch (err) {
|
|
340
|
+
// Rethrow rate limit errors as is, so range sync can back off from the peer instead of counting a failed download
|
|
341
|
+
if (getRateLimitedUntilMs(err) !== null) throw err;
|
|
330
342
|
throw new DownloadByRangeError({
|
|
331
343
|
code: DownloadByRangeErrorCode.REQ_RESP_ERROR,
|
|
332
344
|
reason: (err as Error).message,
|
|
@@ -697,6 +709,15 @@ export function validateBlockByRangeResponse(
|
|
|
697
709
|
|
|
698
710
|
for (let i = 0; i < blocks.length; i++) {
|
|
699
711
|
const block = blocks[i];
|
|
712
|
+
const slot = block.message.slot;
|
|
713
|
+
const fork = config.getForkName(slot);
|
|
714
|
+
if (isForkPostDeneb(fork)) {
|
|
715
|
+
const count = getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostDeneb>).length;
|
|
716
|
+
const limit = config.getMaxBlobsPerBlock(computeEpochAtSlot(slot));
|
|
717
|
+
if (count > limit) {
|
|
718
|
+
throw new DownloadByRangeError({code: DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS, slot, count, limit});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
700
721
|
const blockRoot = type.hashTreeRoot(block.message);
|
|
701
722
|
response.push({block, blockRoot});
|
|
702
723
|
|
|
@@ -825,12 +846,7 @@ export async function validateColumnsByRangeResponse(
|
|
|
825
846
|
}
|
|
826
847
|
|
|
827
848
|
seenSlotColumns.set(columnSidecar.index, columnSidecar);
|
|
828
|
-
|
|
829
|
-
// a new slot has started, reset index
|
|
830
|
-
currentIndex = -1;
|
|
831
|
-
} else {
|
|
832
|
-
currentIndex = columnSidecar.index;
|
|
833
|
-
}
|
|
849
|
+
currentIndex = columnSidecar.index;
|
|
834
850
|
currentSlot = slot;
|
|
835
851
|
}
|
|
836
852
|
|
|
@@ -1030,6 +1046,7 @@ export enum DownloadByRangeErrorCode {
|
|
|
1030
1046
|
|
|
1031
1047
|
PARENT_ROOT_MISMATCH = "DOWNLOAD_BY_RANGE_ERROR_PARENT_ROOT_MISMATCH",
|
|
1032
1048
|
EXTRA_BLOCKS = "DOWNLOAD_BY_RANGE_ERROR_EXTRA_BLOCKS",
|
|
1049
|
+
TOO_MANY_KZG_COMMITMENTS = "DOWNLOAD_BY_RANGE_ERROR_TOO_MANY_KZG_COMMITMENTS",
|
|
1033
1050
|
OUT_OF_RANGE_BLOCKS = "DOWNLOAD_BY_RANGE_OUT_OF_RANGE_BLOCKS",
|
|
1034
1051
|
OUT_OF_ORDER_BLOCKS = "DOWNLOAD_BY_RANGE_OUT_OF_ORDER_BLOCKS",
|
|
1035
1052
|
|
|
@@ -1072,6 +1089,12 @@ export type DownloadByRangeErrorType =
|
|
|
1072
1089
|
columnSidecarCount: number;
|
|
1073
1090
|
payloadEnvelopeCount: number;
|
|
1074
1091
|
}
|
|
1092
|
+
| {
|
|
1093
|
+
code: DownloadByRangeErrorCode.TOO_MANY_KZG_COMMITMENTS;
|
|
1094
|
+
slot: Slot;
|
|
1095
|
+
count: number;
|
|
1096
|
+
limit: number;
|
|
1097
|
+
}
|
|
1075
1098
|
| {
|
|
1076
1099
|
code: DownloadByRangeErrorCode.OUT_OF_RANGE_BLOCKS;
|
|
1077
1100
|
slot: number;
|
|
@@ -104,15 +104,18 @@ export async function downloadByRoot({
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (isForkPostGloas(blockInput.forkName)) {
|
|
107
|
-
chain.seenPayloadEnvelopeInputCache.add(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
chain.seenPayloadEnvelopeInputCache.add(
|
|
108
|
+
{
|
|
109
|
+
blockRootHex: rootHex,
|
|
110
|
+
block: blockInput.getBlock() as SignedBeaconBlock<ForkPostGloas>,
|
|
111
|
+
forkName: blockInput.forkName,
|
|
112
|
+
sampledColumns: chain.custodyConfig.sampledColumns,
|
|
113
|
+
custodyColumns: chain.custodyConfig.custodyColumns,
|
|
114
|
+
seenTimestampSec: Date.now() / 1000,
|
|
115
|
+
source: PayloadEnvelopeInputSource.byRoot,
|
|
116
|
+
},
|
|
117
|
+
{unvalidated: true}
|
|
118
|
+
);
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
// Like range sync, download every sampled column, half of them only counts as available for reconstruction
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {RootHex} from "@lodestar/types";
|
|
2
2
|
import {MapDef} from "@lodestar/utils";
|
|
3
|
+
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
3
4
|
import {
|
|
4
5
|
BlockInputSyncCacheItem,
|
|
5
6
|
PendingBlockInput,
|
|
@@ -61,9 +62,13 @@ export function getUnknownAndAncestorBlocks(blocks: Map<RootHex, BlockInputSyncC
|
|
|
61
62
|
const ancestors = new Map<RootHex, PendingBlockInput>();
|
|
62
63
|
|
|
63
64
|
for (const block of blocks.values()) {
|
|
65
|
+
// Half the columns counts as all data, but a pending block is only complete with all sampled columns
|
|
64
66
|
if (
|
|
65
67
|
block.status === PendingBlockInputStatus.pending &&
|
|
66
|
-
(isPendingBlockInput(block)
|
|
68
|
+
(isPendingBlockInput(block)
|
|
69
|
+
? !block.blockInput.hasBlockAndAllData() ||
|
|
70
|
+
(isBlockInputColumns(block.blockInput) && !block.blockInput.hasComputedAllData())
|
|
71
|
+
: true)
|
|
67
72
|
) {
|
|
68
73
|
unknowns.set(getBlockInputSyncCacheItemRootHex(block), block);
|
|
69
74
|
} else if (
|