@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
|
@@ -114,16 +114,12 @@ export function getBeaconStateApi({
|
|
|
114
114
|
if (resp.valid) {
|
|
115
115
|
const validatorIndex = resp.validatorIndex;
|
|
116
116
|
const validator = state.getValidator(validatorIndex);
|
|
117
|
-
const
|
|
117
|
+
const balance = state.getBalance(validatorIndex);
|
|
118
|
+
const status = getValidatorStatus(validator, balance, currentEpoch);
|
|
118
119
|
if (statuses.length && !statuses.includes(status) && !statuses.includes(mapToGeneralStatus(status))) {
|
|
119
120
|
continue;
|
|
120
121
|
}
|
|
121
|
-
const validatorResponse = toValidatorResponse(
|
|
122
|
-
validatorIndex,
|
|
123
|
-
validator,
|
|
124
|
-
state.getBalance(validatorIndex),
|
|
125
|
-
currentEpoch
|
|
126
|
-
);
|
|
122
|
+
const validatorResponse = toValidatorResponse(validatorIndex, validator, balance, currentEpoch);
|
|
127
123
|
validatorResponses.push(validatorResponse);
|
|
128
124
|
}
|
|
129
125
|
}
|
|
@@ -109,7 +109,7 @@ export function toValidatorResponse(
|
|
|
109
109
|
): routes.beacon.ValidatorResponse {
|
|
110
110
|
return {
|
|
111
111
|
index,
|
|
112
|
-
status: getValidatorStatus(validator, currentEpoch),
|
|
112
|
+
status: getValidatorStatus(validator, balance, currentEpoch),
|
|
113
113
|
balance,
|
|
114
114
|
validator,
|
|
115
115
|
};
|
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
DOMAIN_BUILDER_DEPOSIT,
|
|
28
28
|
DOMAIN_CONTRIBUTION_AND_PROOF,
|
|
29
29
|
DOMAIN_DEPOSIT,
|
|
30
|
-
DOMAIN_INCLUSION_LIST_COMMITTEE,
|
|
31
30
|
DOMAIN_PROPOSER_PREFERENCES,
|
|
32
31
|
DOMAIN_PTC_ATTESTER,
|
|
33
32
|
DOMAIN_RANDAO,
|
|
@@ -151,9 +150,6 @@ export const specConstants = {
|
|
|
151
150
|
DOMAIN_BUILDER_DEPOSIT,
|
|
152
151
|
BUILDER_DEPOSIT_REQUEST_TYPE: toHexByte(BUILDER_DEPOSIT_REQUEST_TYPE),
|
|
153
152
|
BUILDER_EXIT_REQUEST_TYPE: toHexByte(BUILDER_EXIT_REQUEST_TYPE),
|
|
154
|
-
|
|
155
|
-
// heze
|
|
156
|
-
DOMAIN_INCLUSION_LIST_COMMITTEE,
|
|
157
153
|
};
|
|
158
154
|
|
|
159
155
|
/** Convert single-byte numbers to hex strings for API spec compliance */
|
|
@@ -114,10 +114,6 @@ export function getDebugApi({
|
|
|
114
114
|
unrealizedJustifiedRoot: node.unrealizedJustifiedRoot,
|
|
115
115
|
unrealizedFinalizedEpoch: node.unrealizedFinalizedEpoch,
|
|
116
116
|
unrealizedFinalizedRoot: node.unrealizedFinalizedRoot,
|
|
117
|
-
inclusionListSatisfied:
|
|
118
|
-
node.payloadStatus === PayloadStatus.FULL
|
|
119
|
-
? forkChoice.getPayloadInclusionListSatisfaction(node.blockRoot)
|
|
120
|
-
: null,
|
|
121
117
|
},
|
|
122
118
|
};
|
|
123
119
|
}),
|
package/src/api/impl/errors.ts
CHANGED
|
@@ -28,6 +28,16 @@ export class NodeIsSyncing extends ApiError {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A service that is not ready to serve the request yet, e.g. while it is starting up. Expected to happen for every
|
|
33
|
+
* request until it is ready, the REST API server logs it at debug instead of as a warning
|
|
34
|
+
*/
|
|
35
|
+
export class ServiceNotReady extends ApiError {
|
|
36
|
+
constructor(message: string) {
|
|
37
|
+
super(503, message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
// Error thrown by beacon node APIs that are only supported by distributed validator middleware clients
|
|
32
42
|
// For example https://github.com/ethereum/beacon-APIs/blob/f087fbf2764e657578a6c29bdf0261b36ee8db1e/apis/validator/beacon_committee_selections.yaml
|
|
33
43
|
export class OnlySupportedByDVT extends ApiError {
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
isForkPostElectra,
|
|
20
20
|
isForkPostFulu,
|
|
21
21
|
isForkPostGloas,
|
|
22
|
-
isForkPostHeze,
|
|
23
22
|
} from "@lodestar/params";
|
|
24
23
|
import {
|
|
25
24
|
DataAvailabilityStatus,
|
|
@@ -30,7 +29,6 @@ import {
|
|
|
30
29
|
computeStartSlotAtEpoch,
|
|
31
30
|
computeTimeAtSlot,
|
|
32
31
|
getCurrentSlot,
|
|
33
|
-
getInclusionListCommittee,
|
|
34
32
|
isStatePostAltair,
|
|
35
33
|
isStatePostGloas,
|
|
36
34
|
proposerShufflingDecisionRoot,
|
|
@@ -71,7 +69,6 @@ import {
|
|
|
71
69
|
} from "@lodestar/utils";
|
|
72
70
|
import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator";
|
|
73
71
|
import {BlockInputSource} from "../../../chain/blocks/blockInput/types.js";
|
|
74
|
-
import {InclusionListSource} from "../../../chain/blocks/types.js";
|
|
75
72
|
import {
|
|
76
73
|
AttestationError,
|
|
77
74
|
AttestationErrorCode,
|
|
@@ -87,11 +84,7 @@ import {PREPARE_NEXT_SLOT_BPS} from "../../../chain/prepareNextSlot.js";
|
|
|
87
84
|
import {BlockType, ProduceFullDeneb, ProduceFullGloas} from "../../../chain/produceBlock/index.js";
|
|
88
85
|
import {RegenCaller} from "../../../chain/regen/index.js";
|
|
89
86
|
import {CheckpointHex} from "../../../chain/stateCache/types.js";
|
|
90
|
-
import {
|
|
91
|
-
InclusionListValidationResult,
|
|
92
|
-
validateApiAggregateAndProof,
|
|
93
|
-
validateGossipInclusionList,
|
|
94
|
-
} from "../../../chain/validation/index.js";
|
|
87
|
+
import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
|
|
95
88
|
import {validateGossipProposerPreferences} from "../../../chain/validation/proposerPreferences.js";
|
|
96
89
|
import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js";
|
|
97
90
|
import {ZERO_HASH} from "../../../constants/index.js";
|
|
@@ -2174,7 +2167,7 @@ export function getValidatorApi(
|
|
|
2174
2167
|
if (validatorIndex === null || validatorIndex >= headState.validatorCount) return false;
|
|
2175
2168
|
|
|
2176
2169
|
const validator = headState.getValidator(validatorIndex);
|
|
2177
|
-
const status = getValidatorStatus(validator, currentEpoch);
|
|
2170
|
+
const status = getValidatorStatus(validator, headState.getBalance(validatorIndex), currentEpoch);
|
|
2178
2171
|
return (
|
|
2179
2172
|
status === "active_exiting" ||
|
|
2180
2173
|
status === "active_ongoing" ||
|
|
@@ -2281,120 +2274,6 @@ export function getValidatorApi(
|
|
|
2281
2274
|
}
|
|
2282
2275
|
},
|
|
2283
2276
|
|
|
2284
|
-
async produceInclusionList({slot}) {
|
|
2285
|
-
notWhileSyncing(chain, sync.state);
|
|
2286
|
-
|
|
2287
|
-
if (!isForkPostHeze(chain.config.getForkName(slot))) {
|
|
2288
|
-
throw new ApiError(400, `Producing inclusion list for pre-heze slot: ${slot}`);
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
await waitForSlot(slot); // Must never request for a future slot > currentSlot
|
|
2292
|
-
|
|
2293
|
-
const timer = metrics?.getInclusionListV1RequestsDuration.startTimer();
|
|
2294
|
-
const transactions = await chain.executionEngine.getInclusionList();
|
|
2295
|
-
timer?.();
|
|
2296
|
-
metrics?.getInclusionListV1Requests.inc();
|
|
2297
|
-
|
|
2298
|
-
return {data: transactions, meta: {version: chain.config.getForkName(slot)}};
|
|
2299
|
-
},
|
|
2300
|
-
|
|
2301
|
-
async getInclusionListCommitteeDuties({epoch, indices}) {
|
|
2302
|
-
notWhileSyncing(chain, sync.state);
|
|
2303
|
-
|
|
2304
|
-
if (indices.length === 0) {
|
|
2305
|
-
throw new ApiError(400, "No validator to get inclusion list committee duties");
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
if (!isForkPostHeze(chain.config.getForkName(computeStartSlotAtEpoch(epoch)))) {
|
|
2309
|
-
throw new ApiError(400, `Requesting pre-heze inclusion list committee duties epoch: ${epoch}`);
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
// May request for an epoch that's in the future
|
|
2313
|
-
await waitForNextClosestEpoch();
|
|
2314
|
-
|
|
2315
|
-
if (epoch > chain.clock.currentEpoch + 1) {
|
|
2316
|
-
throw new ApiError(400, "Cannot get duties for epoch more than one ahead");
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
const head = chain.forkChoice.getHead();
|
|
2320
|
-
const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.getDuties);
|
|
2321
|
-
|
|
2322
|
-
const pubkeys = getPubkeysForIndices(state, indices);
|
|
2323
|
-
const requestedIndices = new Set(indices);
|
|
2324
|
-
const epochStartSlot = computeStartSlotAtEpoch(epoch);
|
|
2325
|
-
const shuffling = state.getShufflingAtEpoch(epoch);
|
|
2326
|
-
|
|
2327
|
-
// Validators set this as `dependent_root` on their inclusion lists
|
|
2328
|
-
const dependentRoot = fromHex(state.getShufflingDecisionRoot(epoch));
|
|
2329
|
-
|
|
2330
|
-
// A validator can be on several slots' committees in an epoch; report the earliest, as for attester duties
|
|
2331
|
-
const dutySlotByValidator = new Map<ValidatorIndex, Slot>();
|
|
2332
|
-
for (let i = 0; i < SLOTS_PER_EPOCH; i++) {
|
|
2333
|
-
const slot = epochStartSlot + i;
|
|
2334
|
-
for (const validatorIndex of getInclusionListCommittee(shuffling, slot).validatorIndices) {
|
|
2335
|
-
if (requestedIndices.has(validatorIndex) && !dutySlotByValidator.has(validatorIndex)) {
|
|
2336
|
-
dutySlotByValidator.set(validatorIndex, slot);
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
const duties: routes.validator.InclusionListDuty[] = [];
|
|
2342
|
-
for (let i = 0; i < indices.length; i++) {
|
|
2343
|
-
const validatorIndex = indices[i];
|
|
2344
|
-
const slot = dutySlotByValidator.get(validatorIndex);
|
|
2345
|
-
if (slot !== undefined) {
|
|
2346
|
-
duties.push({pubkey: pubkeys[i], validatorIndex, slot, dependentRoot});
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
return {
|
|
2351
|
-
data: duties,
|
|
2352
|
-
meta: {
|
|
2353
|
-
dependentRoot: toRootHex(dependentRoot),
|
|
2354
|
-
executionOptimistic: isOptimisticBlock(head),
|
|
2355
|
-
},
|
|
2356
|
-
};
|
|
2357
|
-
},
|
|
2358
|
-
|
|
2359
|
-
async publishInclusionList({signedInclusionList}) {
|
|
2360
|
-
notWhileSyncing(chain, sync.state);
|
|
2361
|
-
|
|
2362
|
-
const {slot} = signedInclusionList.message;
|
|
2363
|
-
if (!isForkPostHeze(chain.config.getForkName(slot))) {
|
|
2364
|
-
throw new ApiError(400, `Publishing pre-heze inclusion list slot: ${slot}`);
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
// Timeliness is judged on receipt, as for gossip, so a list submitted in time stays timely if validation is slow
|
|
2368
|
-
const secFromSlot = chain.clock.secFromSlot(slot, Date.now() / 1000);
|
|
2369
|
-
metrics?.inclusionListsReceived.inc({source: InclusionListSource.api});
|
|
2370
|
-
metrics?.inclusionListTransactionsReceived.inc(
|
|
2371
|
-
{source: InclusionListSource.api},
|
|
2372
|
-
signedInclusionList.message.transactions.length
|
|
2373
|
-
);
|
|
2374
|
-
|
|
2375
|
-
const timer = metrics?.inclusionListsValidationTime.startTimer();
|
|
2376
|
-
let validationResult: InclusionListValidationResult;
|
|
2377
|
-
try {
|
|
2378
|
-
validationResult = await validateGossipInclusionList(chain, signedInclusionList);
|
|
2379
|
-
} finally {
|
|
2380
|
-
timer?.({source: InclusionListSource.api});
|
|
2381
|
-
}
|
|
2382
|
-
const {committeeIndices, totalBytes} = validationResult;
|
|
2383
|
-
metrics?.inclusionListsValid.inc({source: InclusionListSource.api});
|
|
2384
|
-
metrics?.inclusionListsValidSize.inc(totalBytes);
|
|
2385
|
-
|
|
2386
|
-
const isTimely = secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
|
|
2387
|
-
chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
|
|
2388
|
-
|
|
2389
|
-
chain.emitter.emit(routes.events.EventType.inclusionList, {
|
|
2390
|
-
version: chain.config.getForkName(slot),
|
|
2391
|
-
data: signedInclusionList,
|
|
2392
|
-
});
|
|
2393
|
-
|
|
2394
|
-
await network.publishInclusionList(signedInclusionList);
|
|
2395
|
-
metrics?.inclusionListsPublished.inc();
|
|
2396
|
-
},
|
|
2397
|
-
|
|
2398
2277
|
async getExecutionPayloadEnvelope({slot, beaconBlockRoot}) {
|
|
2399
2278
|
const fork = config.getForkName(slot);
|
|
2400
2279
|
|
package/src/api/rest/base.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
|
7
7
|
import {ErrorAborted, Gauge, Histogram, Logger} from "@lodestar/utils";
|
|
8
8
|
import {GossipActionError} from "../../chain/errors/gossipValidation.js";
|
|
9
9
|
import {isLocalhostIP} from "../../util/ip.js";
|
|
10
|
-
import {ApiError, FailureList, IndexedError, NodeIsSyncing} from "../impl/errors.js";
|
|
10
|
+
import {ApiError, FailureList, IndexedError, NodeIsSyncing, ServiceNotReady} from "../impl/errors.js";
|
|
11
11
|
import {HttpActiveSocketsTracker, SocketMetrics} from "./activeSockets.js";
|
|
12
12
|
|
|
13
13
|
export type RestApiServerOpts = {
|
|
@@ -178,7 +178,9 @@ export class RestApiServer {
|
|
|
178
178
|
|
|
179
179
|
const operationId = getOperationId(req);
|
|
180
180
|
|
|
181
|
-
if (
|
|
181
|
+
if (err instanceof ServiceNotReady) {
|
|
182
|
+
this.logger.debug(`Req ${req.id} ${operationId} failed`, {reason: err.message});
|
|
183
|
+
} else if (
|
|
182
184
|
err instanceof ApiError ||
|
|
183
185
|
err instanceof GossipActionError ||
|
|
184
186
|
[INVALID_MEDIA_TYPE_CODE, SCHEMA_VALIDATION_ERROR_CODE].includes(err.code)
|
|
@@ -8,6 +8,7 @@ import {JobItemQueue} from "../util/queue/index.js";
|
|
|
8
8
|
import {BlockInputColumns} from "./blocks/blockInput/index.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
10
10
|
import {ChainEventEmitter} from "./emitter.js";
|
|
11
|
+
import {SeenDataColumnSidecars} from "./seenCache/seenDataColumnSidecars.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Minimum time to wait before attempting reconstruction
|
|
@@ -31,6 +32,7 @@ export type ColumnReconstructionInput = BlockInputColumns | PayloadEnvelopeInput
|
|
|
31
32
|
export type ColumnReconstructionTrackerInit = {
|
|
32
33
|
logger: Logger;
|
|
33
34
|
emitter: ChainEventEmitter;
|
|
35
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
34
36
|
metrics: Metrics | null;
|
|
35
37
|
config: ChainForkConfig;
|
|
36
38
|
signal: AbortSignal;
|
|
@@ -44,6 +46,7 @@ export type ColumnReconstructionTrackerInit = {
|
|
|
44
46
|
export class ColumnReconstructionTracker {
|
|
45
47
|
logger: Logger;
|
|
46
48
|
emitter: ChainEventEmitter;
|
|
49
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
47
50
|
metrics: Metrics | null;
|
|
48
51
|
config: ChainForkConfig;
|
|
49
52
|
|
|
@@ -54,6 +57,7 @@ export class ColumnReconstructionTracker {
|
|
|
54
57
|
constructor(init: ColumnReconstructionTrackerInit) {
|
|
55
58
|
this.logger = init.logger;
|
|
56
59
|
this.emitter = init.emitter;
|
|
60
|
+
this.seenDataColumnSidecars = init.seenDataColumnSidecars;
|
|
57
61
|
this.metrics = init.metrics;
|
|
58
62
|
this.config = init.config;
|
|
59
63
|
this.signal = init.signal;
|
|
@@ -104,7 +108,7 @@ export class ColumnReconstructionTracker {
|
|
|
104
108
|
const logCtx = {slot: input.slot, root: input.blockRootHex};
|
|
105
109
|
this.logger.debug("Attempting data column sidecar reconstruction", logCtx);
|
|
106
110
|
try {
|
|
107
|
-
const result = await recoverDataColumnSidecars(input, this.emitter, this.metrics);
|
|
111
|
+
const result = await recoverDataColumnSidecars(input, this.emitter, this.seenDataColumnSidecars, this.metrics);
|
|
108
112
|
this.metrics?.recoverDataColumnSidecars.reconstructionResult.inc({result});
|
|
109
113
|
this.logger.debug("Data column sidecar reconstruction complete", {...logCtx, result});
|
|
110
114
|
} catch (e) {
|
|
@@ -8,6 +8,7 @@ import {DataColumnEngineResult, getDataColumnSidecarsFromExecution} from "../uti
|
|
|
8
8
|
import {IBlockInput, isBlockInputColumns} from "./blocks/blockInput/index.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
10
10
|
import {ChainEventEmitter} from "./emitter.js";
|
|
11
|
+
import {SeenDataColumnSidecars} from "./seenCache/seenDataColumnSidecars.js";
|
|
11
12
|
|
|
12
13
|
/** A `null` answer only changes if the EL receives the transactions later, so retries are few and spaced out */
|
|
13
14
|
export const MAX_GET_BLOBS_ATTEMPTS = 3;
|
|
@@ -18,6 +19,7 @@ export type GetBlobsTrackerInit = {
|
|
|
18
19
|
logger: Logger;
|
|
19
20
|
executionEngine: Pick<IExecutionEngine, "getBlobs">;
|
|
20
21
|
emitter: ChainEventEmitter;
|
|
22
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
21
23
|
metrics: Metrics | null;
|
|
22
24
|
config: ChainForkConfig;
|
|
23
25
|
};
|
|
@@ -29,6 +31,7 @@ export class GetBlobsTracker {
|
|
|
29
31
|
logger: Logger;
|
|
30
32
|
executionEngine: Pick<IExecutionEngine, "getBlobs">;
|
|
31
33
|
emitter: ChainEventEmitter;
|
|
34
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
32
35
|
metrics: Metrics | null;
|
|
33
36
|
config: ChainForkConfig;
|
|
34
37
|
activeReconstructions = new Set<string>();
|
|
@@ -42,6 +45,7 @@ export class GetBlobsTracker {
|
|
|
42
45
|
this.logger = init.logger;
|
|
43
46
|
this.executionEngine = init.executionEngine;
|
|
44
47
|
this.emitter = init.emitter;
|
|
48
|
+
this.seenDataColumnSidecars = init.seenDataColumnSidecars;
|
|
45
49
|
this.metrics = init.metrics;
|
|
46
50
|
this.config = init.config;
|
|
47
51
|
}
|
|
@@ -101,6 +105,7 @@ export class GetBlobsTracker {
|
|
|
101
105
|
this.config,
|
|
102
106
|
this.executionEngine,
|
|
103
107
|
this.emitter,
|
|
108
|
+
this.seenDataColumnSidecars,
|
|
104
109
|
input,
|
|
105
110
|
this.metrics,
|
|
106
111
|
this.blobsAndProofsBuffers[freeIndex].buffers
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
} from "@lodestar/types";
|
|
40
40
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
41
41
|
import {GENESIS_SLOT, ZERO_HASH_HEX} from "../../constants/index.js";
|
|
42
|
+
import {ExecutionPayloadStatus} from "../../execution/engine/interface.js";
|
|
42
43
|
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
43
44
|
import {isOptimisticBlock} from "../../util/forkChoice.js";
|
|
44
45
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
@@ -146,13 +147,19 @@ export async function importBlock(
|
|
|
146
147
|
dataAvailabilityStatus
|
|
147
148
|
);
|
|
148
149
|
} catch (e) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
e
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
if (e instanceof ForkChoiceError && e.type.code === ForkChoiceErrorCode.INVALID_BLOCK) {
|
|
151
|
+
// The parent can be invalidated by a forkchoiceUpdated verdict after verifyBlocksSanityChecks passed
|
|
152
|
+
if (e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID) {
|
|
153
|
+
throw new BlockError(block, {code: BlockErrorCode.PARENT_EXECUTION_INVALID, parentRoot: e.type.err.root});
|
|
154
|
+
}
|
|
155
|
+
// A pre-Gloas block delivering a payload fork choice already invalidated
|
|
156
|
+
if (e.type.err.code === InvalidBlockCode.EXECUTION_INVALID) {
|
|
157
|
+
throw new BlockError(block, {
|
|
158
|
+
code: BlockErrorCode.EXECUTION_ENGINE_INVALID,
|
|
159
|
+
execStatus: ExecutionPayloadStatus.INVALID,
|
|
160
|
+
errorMessage: `payload ${e.type.err.hash} was invalidated in fork choice`,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
throw e;
|
|
158
165
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {SerializedList} from "@chainsafe/ssz";
|
|
2
1
|
import {routes} from "@lodestar/api";
|
|
3
2
|
import {
|
|
4
3
|
ExecutionStatus,
|
|
@@ -11,16 +10,9 @@ import {
|
|
|
11
10
|
getFinalizedExecutionBlockHash,
|
|
12
11
|
getSafeExecutionBlockHash,
|
|
13
12
|
} from "@lodestar/fork-choice";
|
|
14
|
-
import {
|
|
15
|
-
DataAvailabilityStatus,
|
|
16
|
-
computeEpochAtSlot,
|
|
17
|
-
isStatePostGloas,
|
|
18
|
-
isStatePostHeze,
|
|
19
|
-
} from "@lodestar/state-transition";
|
|
20
|
-
import {RootHex, bellatrix} from "@lodestar/types";
|
|
13
|
+
import {DataAvailabilityStatus, isStatePostGloas} from "@lodestar/state-transition";
|
|
21
14
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
22
15
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
23
|
-
import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
|
|
24
16
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
25
17
|
import {BeaconChain} from "../chain.js";
|
|
26
18
|
import {ExecutionInvalidSource} from "../forkChoice/index.js";
|
|
@@ -202,37 +194,6 @@ export async function importExecutionPayload(
|
|
|
202
194
|
);
|
|
203
195
|
}
|
|
204
196
|
|
|
205
|
-
// Timely inclusion lists of the preceding slot, keyed by that slot's dependent root on the block's branch and
|
|
206
|
-
// resolved from the parent, which is at or before that slot. Gossip validation only accepts lists whose dependent
|
|
207
|
-
// block is in fork choice, so a dependent root fork choice cannot resolve (below the anchor after checkpoint sync)
|
|
208
|
-
// keys no stored list
|
|
209
|
-
let inclusionListTransactions: bellatrix.Transactions | undefined;
|
|
210
|
-
if (isStatePostHeze(blockState)) {
|
|
211
|
-
const inclusionListSlot = protoBlock.slot - 1;
|
|
212
|
-
let dependentRoot: RootHex | null = null;
|
|
213
|
-
const parentBlock = this.forkChoice.getBlockHexDefaultStatus(protoBlock.parentRoot);
|
|
214
|
-
if (parentBlock !== null) {
|
|
215
|
-
try {
|
|
216
|
-
dependentRoot = getShufflingDependentRoot(
|
|
217
|
-
this.forkChoice,
|
|
218
|
-
computeEpochAtSlot(inclusionListSlot),
|
|
219
|
-
computeEpochAtSlot(parentBlock.slot),
|
|
220
|
-
parentBlock
|
|
221
|
-
);
|
|
222
|
-
} catch (e) {
|
|
223
|
-
this.logger.debug(
|
|
224
|
-
"Inclusion list dependent root not in fork choice, importing payload without lists",
|
|
225
|
-
{slot, root: blockRootHex},
|
|
226
|
-
e as Error
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
inclusionListTransactions =
|
|
231
|
-
dependentRoot === null
|
|
232
|
-
? SerializedList.empty()
|
|
233
|
-
: this.inclusionListStore.getInclusionListTransactions(inclusionListSlot, dependentRoot, true);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
197
|
// 4a. Run EL and signature verification in parallel
|
|
237
198
|
const logCtx = {slot, root: blockRootHex, executionBlock: envelope.payload.blockNumber};
|
|
238
199
|
this.logger.debug("Call engine api newPayload", logCtx);
|
|
@@ -243,8 +204,7 @@ export async function importExecutionPayload(
|
|
|
243
204
|
envelope.payload,
|
|
244
205
|
payloadInput.getVersionedHashes(),
|
|
245
206
|
envelope.parentBeaconBlockRoot,
|
|
246
|
-
envelope.executionRequests
|
|
247
|
-
inclusionListTransactions
|
|
207
|
+
envelope.executionRequests
|
|
248
208
|
),
|
|
249
209
|
|
|
250
210
|
opts.validSignature === true
|
|
@@ -329,32 +289,6 @@ export async function importExecutionPayload(
|
|
|
329
289
|
}
|
|
330
290
|
});
|
|
331
291
|
|
|
332
|
-
// A VALID payload that does not satisfy the inclusion list constraints is still imported, fork choice
|
|
333
|
-
// only records the verdict so should_extend_payload moves the head to the EMPTY variant, which the next
|
|
334
|
-
// proposer builds on.
|
|
335
|
-
// Recorded before the payload enters fork choice. A VALID response must carry a verdict, an
|
|
336
|
-
// optimistically imported payload counts as satisfied until the engine validates it, anything else as
|
|
337
|
-
// unsatisfied. A VALID response without a verdict violates the engine API, it is logged and treated as
|
|
338
|
-
// satisfied so a non-compliant engine does not orphan every payload
|
|
339
|
-
if (inclusionListTransactions !== undefined) {
|
|
340
|
-
if (execResult.status === ExecutionPayloadStatus.VALID && execResult.inclusionListSatisfied == null) {
|
|
341
|
-
this.logger.warn("Execution engine reported no inclusion list verdict, not enforcing inclusion lists", logCtx);
|
|
342
|
-
}
|
|
343
|
-
const satisfied =
|
|
344
|
-
execResult.status === ExecutionPayloadStatus.VALID
|
|
345
|
-
? (execResult.inclusionListSatisfied ?? true)
|
|
346
|
-
: execResult.status === ExecutionPayloadStatus.SYNCING || execResult.status === ExecutionPayloadStatus.ACCEPTED;
|
|
347
|
-
this.forkChoice.recordPayloadInclusionListSatisfaction(blockRootHex, satisfied);
|
|
348
|
-
if (!satisfied) {
|
|
349
|
-
this.logger.verbose("Payload did not satisfy inclusion list constraints", {
|
|
350
|
-
...logCtx,
|
|
351
|
-
blockHash: blockHashHex,
|
|
352
|
-
status: execResult.status,
|
|
353
|
-
inclusionListTransactions: inclusionListTransactions.length,
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
292
|
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
359
293
|
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
360
294
|
const prevHead = this.forkChoice.getHead();
|
|
@@ -368,11 +302,13 @@ export async function importExecutionPayload(
|
|
|
368
302
|
dataAvailabilityStatus
|
|
369
303
|
);
|
|
370
304
|
} catch (e) {
|
|
371
|
-
// The payload chain can be invalidated by a forkchoiceUpdated verdict while the engine was awaited
|
|
305
|
+
// The payload chain can be invalidated by a forkchoiceUpdated verdict while the engine was awaited, and the
|
|
306
|
+
// payload itself may already be invalidated through another block delivering it
|
|
372
307
|
if (
|
|
373
308
|
e instanceof ForkChoiceError &&
|
|
374
309
|
e.type.code === ForkChoiceErrorCode.INVALID_BLOCK &&
|
|
375
|
-
e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID
|
|
310
|
+
(e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID ||
|
|
311
|
+
e.type.err.code === InvalidBlockCode.EXECUTION_INVALID)
|
|
376
312
|
) {
|
|
377
313
|
throw new PayloadError(payloadInput, {code: PayloadErrorCode.BLOCK_EXECUTION_INVALID, blockRootHex});
|
|
378
314
|
}
|
|
@@ -388,10 +324,7 @@ export async function importExecutionPayload(
|
|
|
388
324
|
if (
|
|
389
325
|
!this.opts.disableImportExecutionFcU &&
|
|
390
326
|
blockRootHex === head.blockRoot &&
|
|
391
|
-
head.payloadStatus === PayloadStatus.FULL
|
|
392
|
-
// Skip a payload that does not satisfy the inclusion list constraints, fork choice keeps the EMPTY
|
|
393
|
-
// variant as head and the next prepare fcU keeps the engine on the parent payload
|
|
394
|
-
this.forkChoice.isPayloadInclusionListSatisfied(blockRootHex)
|
|
327
|
+
head.payloadStatus === PayloadStatus.FULL
|
|
395
328
|
) {
|
|
396
329
|
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice, this.logger);
|
|
397
330
|
const finalizedBlockHash = getFinalizedExecutionBlockHash(this.forkChoice);
|
|
@@ -22,9 +22,16 @@ export enum PayloadEnvelopeInputSource {
|
|
|
22
22
|
* - finalized: below the finalized slot
|
|
23
23
|
* - prune: explicit prune by root
|
|
24
24
|
* - cap: insertion-order backstop cap (MAX_PAYLOAD_ENVELOPE_INPUT_CACHE_SIZE)
|
|
25
|
+
* - capUnvalidated: cap eviction of an entry whose block is not validated and imported yet, evicted before the rest
|
|
25
26
|
* - invalid: the cached envelope failed import with a definitive invalid verdict
|
|
26
27
|
*/
|
|
27
|
-
export type PayloadEnvelopeInputPruneReason =
|
|
28
|
+
export type PayloadEnvelopeInputPruneReason =
|
|
29
|
+
| "belowParent"
|
|
30
|
+
| "finalized"
|
|
31
|
+
| "remove"
|
|
32
|
+
| "cap"
|
|
33
|
+
| "capUnvalidated"
|
|
34
|
+
| "invalid";
|
|
28
35
|
|
|
29
36
|
export type SourceMeta = {
|
|
30
37
|
source: PayloadEnvelopeInputSource;
|
|
@@ -4,11 +4,6 @@ import type {IndexedAttestation, Slot, fulu} from "@lodestar/types";
|
|
|
4
4
|
import {IBlockInput} from "./blockInput/types.js";
|
|
5
5
|
import {OrphanedPayloadEnvelope} from "./utils/chainSegment.js";
|
|
6
6
|
|
|
7
|
-
export enum InclusionListSource {
|
|
8
|
-
gossip = "gossip",
|
|
9
|
-
api = "api",
|
|
10
|
-
}
|
|
11
|
-
|
|
12
7
|
type DataColumnData = {
|
|
13
8
|
dataColumn: fulu.DataColumnSidecar;
|
|
14
9
|
dataColumnBytes: Uint8Array | null;
|
package/src/chain/chain.ts
CHANGED
|
@@ -105,7 +105,6 @@ import {
|
|
|
105
105
|
AttestationPool,
|
|
106
106
|
DeferredVoluntaryExitPool,
|
|
107
107
|
ExecutionPayloadBidPool,
|
|
108
|
-
InclusionListStore,
|
|
109
108
|
OpPool,
|
|
110
109
|
PayloadAttestationPool,
|
|
111
110
|
ProposerPreferencesPool,
|
|
@@ -127,6 +126,7 @@ import {
|
|
|
127
126
|
SeenAttesters,
|
|
128
127
|
SeenBlockProposers,
|
|
129
128
|
SeenContributionAndProof,
|
|
129
|
+
SeenDataColumnSidecars,
|
|
130
130
|
SeenExecutionPayloadBids,
|
|
131
131
|
SeenPayloadAttesters,
|
|
132
132
|
SeenPayloadEnvelopeInput,
|
|
@@ -213,7 +213,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
213
213
|
readonly executionPayloadBidPool: ExecutionPayloadBidPool;
|
|
214
214
|
readonly payloadAttestationPool: PayloadAttestationPool;
|
|
215
215
|
readonly proposerPreferencesPool = new ProposerPreferencesPool();
|
|
216
|
-
readonly inclusionListStore: InclusionListStore;
|
|
217
216
|
readonly opPool: OpPool;
|
|
218
217
|
readonly deferredVoluntaryExitPool: DeferredVoluntaryExitPool;
|
|
219
218
|
|
|
@@ -224,6 +223,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
224
223
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
225
224
|
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
226
225
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
226
|
+
readonly seenDataColumnSidecars = new SeenDataColumnSidecars();
|
|
227
227
|
/** Proposer indexes with an in-flight proposer slashing production */
|
|
228
228
|
private readonly producingProposerSlashing = new Set<ValidatorIndex>();
|
|
229
229
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
@@ -352,7 +352,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
352
352
|
this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
|
|
353
353
|
this.opPool = new OpPool(config);
|
|
354
354
|
this.deferredVoluntaryExitPool = new DeferredVoluntaryExitPool(logger);
|
|
355
|
-
this.inclusionListStore = new InclusionListStore(config);
|
|
356
355
|
|
|
357
356
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
358
357
|
this.seenContributionAndProof = new SeenContributionAndProof(metrics);
|
|
@@ -501,12 +500,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
501
500
|
});
|
|
502
501
|
|
|
503
502
|
const anchorBlockSlot = anchorState.latestBlockHeader.slot;
|
|
504
|
-
|
|
503
|
+
const anchorBlockFork = config.getForkName(anchorBlockSlot);
|
|
504
|
+
// A pre-Gloas anchor in a state upgraded to Gloas carried its own payload, no envelope follows it
|
|
505
|
+
if (isStatePostGloas(anchorState) && anchorBlockSlot > 0 && isForkPostGloas(anchorBlockFork)) {
|
|
505
506
|
const anchorBid = anchorState.latestExecutionPayloadBid;
|
|
506
507
|
this.seenPayloadEnvelopeInputCache.addFromBid({
|
|
507
508
|
blockRootHex: toRootHex(checkpoint.root),
|
|
508
509
|
slot: anchorBlockSlot,
|
|
509
|
-
forkName:
|
|
510
|
+
forkName: anchorBlockFork,
|
|
510
511
|
proposerIndex: anchorState.latestBlockHeader.proposerIndex,
|
|
511
512
|
bid: anchorBid,
|
|
512
513
|
sampledColumns: this.custodyConfig.sampledColumns,
|
|
@@ -525,12 +526,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
525
526
|
logger,
|
|
526
527
|
executionEngine: this.executionEngine,
|
|
527
528
|
emitter,
|
|
529
|
+
seenDataColumnSidecars: this.seenDataColumnSidecars,
|
|
528
530
|
metrics,
|
|
529
531
|
config,
|
|
530
532
|
});
|
|
531
533
|
this.columnReconstructionTracker = new ColumnReconstructionTracker({
|
|
532
534
|
logger,
|
|
533
535
|
emitter,
|
|
536
|
+
seenDataColumnSidecars: this.seenDataColumnSidecars,
|
|
534
537
|
metrics,
|
|
535
538
|
config,
|
|
536
539
|
signal,
|
|
@@ -1916,7 +1919,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1916
1919
|
this.executionPayloadBidPool.prune(slot);
|
|
1917
1920
|
this.seenExecutionPayloadBids.prune(slot);
|
|
1918
1921
|
this.proposerPreferencesPool.prune(slot);
|
|
1919
|
-
this.inclusionListStore.prune(slot);
|
|
1920
1922
|
this.seenAttestationDatas.onSlot(slot);
|
|
1921
1923
|
this.reprocessController.onSlot(slot);
|
|
1922
1924
|
|
|
@@ -2037,9 +2039,18 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2037
2039
|
|
|
2038
2040
|
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
2039
2041
|
this.seenBlockProposers.prune(finalizedSlot);
|
|
2042
|
+
this.seenDataColumnSidecars.prune(finalizedSlot);
|
|
2040
2043
|
|
|
2041
2044
|
// Update validator custody to account for effective balance changes
|
|
2042
|
-
|
|
2045
|
+
try {
|
|
2046
|
+
await this.updateValidatorsCustodyRequirement(cp);
|
|
2047
|
+
} catch (e) {
|
|
2048
|
+
this.logger.warn(
|
|
2049
|
+
"Error updating validators custody requirement",
|
|
2050
|
+
{epoch: cp.epoch, root: cp.rootHex},
|
|
2051
|
+
e as Error
|
|
2052
|
+
);
|
|
2053
|
+
}
|
|
2043
2054
|
|
|
2044
2055
|
// TODO: Improve using regen here
|
|
2045
2056
|
const {blockRoot, stateRoot, slot} = this.forkChoice.getHead();
|
|
@@ -2050,7 +2061,19 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2050
2061
|
}
|
|
2051
2062
|
|
|
2052
2063
|
if (headState) {
|
|
2053
|
-
|
|
2064
|
+
// The finalized checkpoint state may be loaded from disk, it is only needed to prune voluntary exits
|
|
2065
|
+
let finalizedState: IBeaconStateView | Uint8Array | null = null;
|
|
2066
|
+
if (this.opPool.voluntaryExitsSize > 0) {
|
|
2067
|
+
finalizedState = await this.regen.getCheckpointStateOrBytes({epoch: cp.epoch, rootHex: cp.rootHex});
|
|
2068
|
+
if (finalizedState === null) {
|
|
2069
|
+
// A newer finalization can prune this checkpoint state while this handler awaits, its handler prunes exits
|
|
2070
|
+
this.logger.debug("Finalized checkpoint state not available, skip pruning voluntary exits", {
|
|
2071
|
+
epoch: cp.epoch,
|
|
2072
|
+
root: cp.rootHex,
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
this.opPool.pruneAll(blockResult.block, headState, finalizedState);
|
|
2054
2077
|
}
|
|
2055
2078
|
|
|
2056
2079
|
if (headState === null) {
|
|
@@ -2133,7 +2156,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2133
2156
|
if (stateOrBytes instanceof Uint8Array) {
|
|
2134
2157
|
effectiveBalances = getEffectiveBalancesFromStateBytes(this.config, stateOrBytes, validatorIndices);
|
|
2135
2158
|
} else {
|
|
2136
|
-
effectiveBalances = validatorIndices.map((index) =>
|
|
2159
|
+
effectiveBalances = validatorIndices.map((index) =>
|
|
2160
|
+
index < stateOrBytes.validatorCount ? stateOrBytes.getValidator(index).effectiveBalance : 0
|
|
2161
|
+
);
|
|
2137
2162
|
}
|
|
2138
2163
|
}
|
|
2139
2164
|
|