@lodestar/beacon-node 2.1.0-dev.475f7d67bc → 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 +6 -3
- 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 -3
- 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/seenGossipBlockInput.js +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- 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 +85 -57
- 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/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +6 -4
- package/lib/util/sszBytes.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 +9 -3
- 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 -3
- 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/seenGossipBlockInput.ts +1 -1
- 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 +147 -76
- 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/src/util/sszBytes.ts +7 -8
- 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
|
@@ -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
|
|
|
@@ -35,6 +35,7 @@ export enum DataColumnSidecarErrorCode {
|
|
|
35
35
|
|
|
36
36
|
// following errors are adapted from the block errors
|
|
37
37
|
ALREADY_KNOWN = "DATA_COLUMN_SIDECAR_ERROR_ALREADY_KNOWN",
|
|
38
|
+
REPEAT_PROPOSAL = "DATA_COLUMN_SIDECAR_ERROR_REPEAT_PROPOSAL",
|
|
38
39
|
FUTURE_SLOT = "DATA_COLUMN_SIDECAR_ERROR_FUTURE_SLOT",
|
|
39
40
|
WOULD_REVERT_FINALIZED_SLOT = "DATA_COLUMN_SIDECAR_ERROR_WOULD_REVERT_FINALIZED_SLOT",
|
|
40
41
|
PARENT_UNKNOWN = "DATA_COLUMN_SIDECAR_ERROR_PARENT_UNKNOWN",
|
|
@@ -79,6 +80,13 @@ export type DataColumnSidecarErrorType =
|
|
|
79
80
|
limit: number;
|
|
80
81
|
}
|
|
81
82
|
| {code: DataColumnSidecarErrorCode.ALREADY_KNOWN; columnIndex: number; slot: Slot}
|
|
83
|
+
| {
|
|
84
|
+
code: DataColumnSidecarErrorCode.REPEAT_PROPOSAL;
|
|
85
|
+
slot: Slot;
|
|
86
|
+
proposerIndex: number;
|
|
87
|
+
columnIndex: number;
|
|
88
|
+
root: RootHex;
|
|
89
|
+
}
|
|
82
90
|
| {code: DataColumnSidecarErrorCode.FUTURE_SLOT; blockSlot: Slot; currentSlot: Slot}
|
|
83
91
|
| {code: DataColumnSidecarErrorCode.WOULD_REVERT_FINALIZED_SLOT; blockSlot: Slot; finalizedSlot: Slot}
|
|
84
92
|
| {
|
|
@@ -21,9 +21,6 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
21
21
|
NO_MATCHING_PROPOSER_PREFERENCES = "EXECUTION_PAYLOAD_BID_ERROR_NO_MATCHING_PROPOSER_PREFERENCES",
|
|
22
22
|
PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH",
|
|
23
23
|
PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH",
|
|
24
|
-
INCLUSION_LIST_BITS_NOT_INCLUSIVE = "EXECUTION_PAYLOAD_BID_ERROR_INCLUSION_LIST_BITS_NOT_INCLUSIVE",
|
|
25
|
-
UNKNOWN_INCLUSION_LIST_DEPENDENT_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_INCLUSION_LIST_DEPENDENT_ROOT",
|
|
26
|
-
BEFORE_INCLUSION_LIST_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_INCLUSION_LIST_DEADLINE",
|
|
27
24
|
BEFORE_PAYLOAD_ATTESTATION_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_PAYLOAD_ATTESTATION_DEADLINE",
|
|
28
25
|
}
|
|
29
26
|
|
|
@@ -91,21 +88,6 @@ export type ExecutionPayloadBidErrorType =
|
|
|
91
88
|
bidFeeRecipient: string;
|
|
92
89
|
expectedFeeRecipient: string;
|
|
93
90
|
}
|
|
94
|
-
| {
|
|
95
|
-
code: ExecutionPayloadBidErrorCode.INCLUSION_LIST_BITS_NOT_INCLUSIVE;
|
|
96
|
-
builderIndex: BuilderIndex;
|
|
97
|
-
slot: Slot;
|
|
98
|
-
}
|
|
99
|
-
| {
|
|
100
|
-
code: ExecutionPayloadBidErrorCode.UNKNOWN_INCLUSION_LIST_DEPENDENT_ROOT;
|
|
101
|
-
slot: Slot;
|
|
102
|
-
parentBlockRoot: RootHex;
|
|
103
|
-
}
|
|
104
|
-
| {
|
|
105
|
-
code: ExecutionPayloadBidErrorCode.BEFORE_INCLUSION_LIST_DEADLINE;
|
|
106
|
-
builderIndex: BuilderIndex;
|
|
107
|
-
slot: Slot;
|
|
108
|
-
}
|
|
109
91
|
| {
|
|
110
92
|
code: ExecutionPayloadBidErrorCode.BEFORE_PAYLOAD_ATTESTATION_DEADLINE;
|
|
111
93
|
builderIndex: BuilderIndex;
|
|
@@ -7,7 +7,6 @@ export * from "./envelopeReconstructionError.js";
|
|
|
7
7
|
export * from "./executionPayloadBid.js";
|
|
8
8
|
export * from "./executionPayloadEnvelope.js";
|
|
9
9
|
export * from "./gossipValidation.js";
|
|
10
|
-
export * from "./inclusionList.js";
|
|
11
10
|
export * from "./payloadAttestation.js";
|
|
12
11
|
export * from "./proposerPreferences.js";
|
|
13
12
|
export * from "./proposerSlashingError.js";
|
|
@@ -5,28 +5,33 @@ import {
|
|
|
5
5
|
ForkChoice,
|
|
6
6
|
ForkChoiceStateGetter,
|
|
7
7
|
ForkChoiceStore,
|
|
8
|
+
IForkChoice,
|
|
8
9
|
JustifiedBalancesGetter,
|
|
10
|
+
NativeForkChoice,
|
|
9
11
|
PayloadStatus,
|
|
10
12
|
ProtoArray,
|
|
11
13
|
ProtoBlock,
|
|
12
14
|
ForkChoiceOpts as RawForkChoiceOpts,
|
|
13
15
|
} from "@lodestar/fork-choice";
|
|
14
|
-
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
16
|
+
import {ForkSeq, SLOTS_PER_HISTORICAL_ROOT, ZERO_HASH_HEX, isForkPostGloas} from "@lodestar/params";
|
|
15
17
|
import {
|
|
16
18
|
DataAvailabilityStatus,
|
|
17
19
|
IBeaconStateView,
|
|
20
|
+
ZERO_HASH,
|
|
18
21
|
computeEpochAtSlot,
|
|
19
22
|
computeStartSlotAtEpoch,
|
|
20
23
|
isStatePostBellatrix,
|
|
21
24
|
isStatePostGloas,
|
|
22
25
|
} from "@lodestar/state-transition";
|
|
23
|
-
import {Slot, ssz} from "@lodestar/types";
|
|
24
|
-
import {Logger, toRootHex} from "@lodestar/utils";
|
|
26
|
+
import {Slot, phase0, ssz} from "@lodestar/types";
|
|
27
|
+
import {Logger, fromHex, toRootHex} from "@lodestar/utils";
|
|
25
28
|
import {GENESIS_SLOT} from "../../constants/index.js";
|
|
26
29
|
import {Metrics} from "../../metrics/index.js";
|
|
27
30
|
import {ChainEvent, ChainEventEmitter} from "../emitter.js";
|
|
28
31
|
|
|
29
32
|
export type ForkChoiceOpts = RawForkChoiceOpts & {
|
|
33
|
+
/** Use the native (Zig) fork choice store instead of the proto-array */
|
|
34
|
+
nativeForkChoice?: boolean;
|
|
30
35
|
// for testing only
|
|
31
36
|
forkchoiceConstructor?: typeof ForkChoice;
|
|
32
37
|
};
|
|
@@ -58,7 +63,22 @@ export function initializeForkChoice(
|
|
|
58
63
|
stateGetter: ForkChoiceStateGetter,
|
|
59
64
|
metrics: Metrics | null,
|
|
60
65
|
logger?: Logger
|
|
61
|
-
):
|
|
66
|
+
): IForkChoice {
|
|
67
|
+
if (opts.nativeForkChoice) {
|
|
68
|
+
return initializeNativeForkChoice(
|
|
69
|
+
config,
|
|
70
|
+
emitter,
|
|
71
|
+
currentSlot,
|
|
72
|
+
state,
|
|
73
|
+
isFinalizedState,
|
|
74
|
+
opts,
|
|
75
|
+
justifiedBalancesGetter,
|
|
76
|
+
stateGetter,
|
|
77
|
+
metrics,
|
|
78
|
+
logger
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
62
82
|
return isFinalizedState
|
|
63
83
|
? initializeForkChoiceFromFinalizedState(
|
|
64
84
|
config,
|
|
@@ -115,7 +135,7 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
115
135
|
// production code use ForkChoice constructor directly
|
|
116
136
|
const forkchoiceConstructor = opts.forkchoiceConstructor ?? ForkChoice;
|
|
117
137
|
|
|
118
|
-
const
|
|
138
|
+
const isPostGloasAnchor = isStatePostGloas(state) && isForkPostGloas(config.getForkName(blockHeader.slot));
|
|
119
139
|
|
|
120
140
|
return new forkchoiceConstructor(
|
|
121
141
|
config,
|
|
@@ -164,15 +184,20 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
164
184
|
// TODO GLOAS: executionPayloadNumber/GasLimit are not tracked in BeaconState post-gloas
|
|
165
185
|
// (EIP-7732 removed latestExecutionPayloadHeader). Using 0 as unavailable fallback —
|
|
166
186
|
// see initializeForkChoiceFromUnfinalizedState for the same caveat on validation.
|
|
187
|
+
// A pre-Gloas anchor's gas limit is kept in the state's bid by the upgrade.
|
|
167
188
|
executionPayloadNumber: isStatePostGloas(state) ? 0 : state.payloadBlockNumber,
|
|
168
|
-
executionPayloadGasLimit:
|
|
189
|
+
executionPayloadGasLimit: isPostGloasAnchor
|
|
190
|
+
? 0
|
|
191
|
+
: isStatePostGloas(state)
|
|
192
|
+
? Number(state.latestExecutionPayloadBid.gasLimit)
|
|
193
|
+
: state.latestExecutionPayloadHeader.gasLimit,
|
|
169
194
|
executionStatus: blockHeader.slot === GENESIS_SLOT ? ExecutionStatus.Valid : ExecutionStatus.Syncing,
|
|
170
195
|
}
|
|
171
196
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
172
197
|
|
|
173
198
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
174
|
-
payloadStatus:
|
|
175
|
-
parentBlockHash:
|
|
199
|
+
payloadStatus: isPostGloasAnchor ? PayloadStatus.PENDING : PayloadStatus.FULL,
|
|
200
|
+
parentBlockHash: isPostGloasAnchor ? toRootHex(state.latestBlockHash) : null,
|
|
176
201
|
},
|
|
177
202
|
currentSlot
|
|
178
203
|
),
|
|
@@ -183,6 +208,198 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
183
208
|
);
|
|
184
209
|
}
|
|
185
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Initialize the native fork choice. A finalized anchor is both the justified and the finalized
|
|
213
|
+
* checkpoint, as in the spec's `get_forkchoice_store`. An unfinalized one keeps its state's
|
|
214
|
+
* checkpoints, with stand-ins for the ancestors that connect it to them: nothing is reported as
|
|
215
|
+
* finalized that the chain has not finalized.
|
|
216
|
+
*/
|
|
217
|
+
export function initializeNativeForkChoice(
|
|
218
|
+
config: ChainForkConfig,
|
|
219
|
+
emitter: ChainEventEmitter,
|
|
220
|
+
currentSlot: Slot,
|
|
221
|
+
state: IBeaconStateView,
|
|
222
|
+
isFinalizedState: boolean,
|
|
223
|
+
opts: ForkChoiceOpts,
|
|
224
|
+
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
225
|
+
stateGetter: ForkChoiceStateGetter,
|
|
226
|
+
metrics: Metrics | null,
|
|
227
|
+
logger?: Logger
|
|
228
|
+
): NativeForkChoice {
|
|
229
|
+
const {blockHeader, checkpoint} = state.computeAnchorCheckpoint();
|
|
230
|
+
const anchorRoot = toRootHex(checkpoint.root);
|
|
231
|
+
const isPostGloas = isStatePostGloas(state);
|
|
232
|
+
// A state upgraded to Gloas through skipped slots still holds a pre-Gloas block, which carried its own payload
|
|
233
|
+
const isPostGloasAnchor = isPostGloas && config.getForkSeq(blockHeader.slot) >= ForkSeq.gloas;
|
|
234
|
+
const bid = isPostGloasAnchor ? state.latestExecutionPayloadBid : null;
|
|
235
|
+
const hasPayload = isStatePostBellatrix(state) && state.isExecutionStateType && state.isMergeTransitionComplete;
|
|
236
|
+
// The state caches the bid of its latest block, except at genesis: the genesis block carries no bid
|
|
237
|
+
const anchorBid = blockHeader.slot === GENESIS_SLOT ? null : bid;
|
|
238
|
+
|
|
239
|
+
// The store aliases no root to genesis, so a checkpoint the chain never moved off genesis is
|
|
240
|
+
// given the genesis block root. Only possible while that root is still in the state's history.
|
|
241
|
+
const withGenesisRoot = (cp: phase0.Checkpoint): phase0.Checkpoint => {
|
|
242
|
+
if (!ssz.Root.equals(cp.root, ZERO_HASH)) return cp;
|
|
243
|
+
if (state.slot > GENESIS_SLOT + SLOTS_PER_HISTORICAL_ROOT) {
|
|
244
|
+
throw Error(
|
|
245
|
+
`The native fork choice cannot start from an unfinalized state at slot ${state.slot} of a chain that never justified a checkpoint: the genesis block root has left the state's block roots. Start without --chain.nativeForkChoice`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
return {epoch: cp.epoch, root: state.getBlockRootAtSlot(GENESIS_SLOT)};
|
|
249
|
+
};
|
|
250
|
+
const justifiedCheckpoint = isFinalizedState ? checkpoint : withGenesisRoot(state.currentJustifiedCheckpoint);
|
|
251
|
+
const finalizedCheckpoint = isFinalizedState ? checkpoint : withGenesisRoot(state.finalizedCheckpoint);
|
|
252
|
+
const justifiedRoot = toRootHex(justifiedCheckpoint.root);
|
|
253
|
+
const finalizedRoot = toRootHex(finalizedCheckpoint.root);
|
|
254
|
+
|
|
255
|
+
if (!isFinalizedState) {
|
|
256
|
+
logger?.warn("Initializing fork choice from unfinalized state", {
|
|
257
|
+
currentSlot,
|
|
258
|
+
stateSlot: state.slot,
|
|
259
|
+
headSlot: blockHeader.slot,
|
|
260
|
+
headRoot: anchorRoot,
|
|
261
|
+
finalizedEpoch: finalizedCheckpoint.epoch,
|
|
262
|
+
finalizedRoot,
|
|
263
|
+
justifiedEpoch: justifiedCheckpoint.epoch,
|
|
264
|
+
justifiedRoot,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const store = new ForkChoiceStore(
|
|
269
|
+
currentSlot,
|
|
270
|
+
justifiedCheckpoint,
|
|
271
|
+
finalizedCheckpoint,
|
|
272
|
+
// For an unfinalized anchor this is not the justified state, but no other state is at hand
|
|
273
|
+
state.getEffectiveBalanceIncrementsZeroInactive(),
|
|
274
|
+
justifiedBalancesGetter,
|
|
275
|
+
stateGetter,
|
|
276
|
+
{
|
|
277
|
+
onJustified: (cp) => emitter.emit(ChainEvent.forkChoiceJustified, cp),
|
|
278
|
+
onFinalized: (cp) => emitter.emit(ChainEvent.forkChoiceFinalized, cp),
|
|
279
|
+
onFastConfirmation: ({block, slot, currentSlot}) =>
|
|
280
|
+
emitter.emit(routes.events.EventType.fastConfirmation, {block, slot, currentSlot}),
|
|
281
|
+
onPtcQuorum: (data) => emitter.emit(ChainEvent.forkChoicePtcQuorum, data),
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
const checkpoints = {
|
|
286
|
+
justifiedEpoch: justifiedCheckpoint.epoch,
|
|
287
|
+
justifiedRoot,
|
|
288
|
+
finalizedEpoch: finalizedCheckpoint.epoch,
|
|
289
|
+
finalizedRoot,
|
|
290
|
+
unrealizedJustifiedEpoch: justifiedCheckpoint.epoch,
|
|
291
|
+
unrealizedJustifiedRoot: justifiedRoot,
|
|
292
|
+
unrealizedFinalizedEpoch: finalizedCheckpoint.epoch,
|
|
293
|
+
unrealizedFinalizedRoot: finalizedRoot,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const block: ProtoBlock = {
|
|
297
|
+
slot: blockHeader.slot,
|
|
298
|
+
parentRoot: toRootHex(blockHeader.parentRoot),
|
|
299
|
+
stateRoot: toRootHex(blockHeader.stateRoot),
|
|
300
|
+
blockRoot: anchorRoot,
|
|
301
|
+
targetRoot: anchorRoot,
|
|
302
|
+
timeliness: true,
|
|
303
|
+
ptcTimeliness: true,
|
|
304
|
+
importedTimely: true,
|
|
305
|
+
proposerIndex: blockHeader.proposerIndex,
|
|
306
|
+
...checkpoints,
|
|
307
|
+
|
|
308
|
+
...(hasPayload
|
|
309
|
+
? {
|
|
310
|
+
executionPayloadBlockHash: isPostGloas
|
|
311
|
+
? toRootHex(state.latestBlockHash)
|
|
312
|
+
: toRootHex(state.latestExecutionPayloadHeader.blockHash),
|
|
313
|
+
// TODO GLOAS: not tracked in BeaconState post-gloas, see initializeForkChoiceFromFinalizedState
|
|
314
|
+
executionPayloadNumber: isPostGloas ? 0 : state.payloadBlockNumber,
|
|
315
|
+
// The upgrade to Gloas keeps a pre-Gloas block's payload gas limit in the state's bid
|
|
316
|
+
executionPayloadGasLimit: isPostGloasAnchor
|
|
317
|
+
? 0
|
|
318
|
+
: isPostGloas
|
|
319
|
+
? Number(state.latestExecutionPayloadBid.gasLimit)
|
|
320
|
+
: state.latestExecutionPayloadHeader.gasLimit,
|
|
321
|
+
executionStatus: blockHeader.slot === GENESIS_SLOT ? ExecutionStatus.Valid : ExecutionStatus.Syncing,
|
|
322
|
+
}
|
|
323
|
+
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
324
|
+
|
|
325
|
+
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
326
|
+
payloadStatus: isPostGloasAnchor ? PayloadStatus.PENDING : PayloadStatus.FULL,
|
|
327
|
+
parentBlockHash: bid === null ? null : toRootHex(bid.parentBlockHash),
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// Ancestors of the anchor known by root only: the finalized block, the justified block, the
|
|
331
|
+
// anchor's parent, and for the anchor's epoch and the one before the checkpoint block, which the
|
|
332
|
+
// chain can still justify and which current votes target, and the block before it, the
|
|
333
|
+
// dependent root of the next epoch's duties. Their slots are upper bounds and their payloads
|
|
334
|
+
// unknown, so they carry none.
|
|
335
|
+
const unfinalizedAncestors: ProtoBlock[] = [];
|
|
336
|
+
if (!isFinalizedState) {
|
|
337
|
+
const finalizedSlot = computeStartSlotAtEpoch(finalizedCheckpoint.epoch);
|
|
338
|
+
const candidates: [string, Slot][] = [
|
|
339
|
+
[finalizedRoot, finalizedSlot],
|
|
340
|
+
[justifiedRoot, computeStartSlotAtEpoch(justifiedCheckpoint.epoch)],
|
|
341
|
+
[block.parentRoot, blockHeader.slot - 1],
|
|
342
|
+
];
|
|
343
|
+
const anchorEpoch = computeEpochAtSlot(state.slot);
|
|
344
|
+
for (const epoch of [anchorEpoch - 1, anchorEpoch]) {
|
|
345
|
+
const checkpointSlot = computeStartSlotAtEpoch(epoch);
|
|
346
|
+
for (const slot of [checkpointSlot - 1, checkpointSlot]) {
|
|
347
|
+
if (slot > finalizedSlot && slot < blockHeader.slot) {
|
|
348
|
+
candidates.push([toRootHex(state.getBlockRootAtSlot(slot)), slot]);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// Roots repeat over skipped slots: a block keeps the lowest slot it is known at
|
|
353
|
+
candidates.sort((a, b) => a[1] - b[1]);
|
|
354
|
+
for (const [blockRoot, slot] of candidates) {
|
|
355
|
+
const isKnown = blockRoot === anchorRoot || unfinalizedAncestors.some((b) => b.blockRoot === blockRoot);
|
|
356
|
+
if (isKnown || blockRoot === ZERO_HASH_HEX) continue;
|
|
357
|
+
const isGloas = config.getForkSeq(slot) >= ForkSeq.gloas;
|
|
358
|
+
const targetSlot = computeStartSlotAtEpoch(computeEpochAtSlot(slot));
|
|
359
|
+
unfinalizedAncestors.push({
|
|
360
|
+
slot,
|
|
361
|
+
blockRoot,
|
|
362
|
+
parentRoot: unfinalizedAncestors.at(-1)?.blockRoot ?? ZERO_HASH_HEX,
|
|
363
|
+
stateRoot: ZERO_HASH_HEX,
|
|
364
|
+
targetRoot: targetSlot === slot ? blockRoot : toRootHex(state.getBlockRootAtSlot(targetSlot)),
|
|
365
|
+
timeliness: false,
|
|
366
|
+
ptcTimeliness: false,
|
|
367
|
+
importedTimely: false,
|
|
368
|
+
proposerIndex: 0,
|
|
369
|
+
...checkpoints,
|
|
370
|
+
executionPayloadBlockHash: null,
|
|
371
|
+
executionStatus: ExecutionStatus.PreMerge,
|
|
372
|
+
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
373
|
+
payloadStatus: isGloas ? PayloadStatus.PENDING : PayloadStatus.FULL,
|
|
374
|
+
parentBlockHash: isGloas ? ZERO_HASH_HEX : null,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return new NativeForkChoice(
|
|
380
|
+
config,
|
|
381
|
+
store,
|
|
382
|
+
{
|
|
383
|
+
block,
|
|
384
|
+
stateSlot: state.slot,
|
|
385
|
+
genesisTime: state.genesisTime,
|
|
386
|
+
genesisValidatorsRoot: state.genesisValidatorsRoot,
|
|
387
|
+
justifiedCheckpoint: isFinalizedState ? state.currentJustifiedCheckpoint : justifiedCheckpoint,
|
|
388
|
+
finalizedCheckpoint: isFinalizedState ? state.finalizedCheckpoint : finalizedCheckpoint,
|
|
389
|
+
unfinalizedAncestors: isFinalizedState ? undefined : unfinalizedAncestors,
|
|
390
|
+
payloadBlockHash: isPostGloasAnchor
|
|
391
|
+
? (anchorBid?.blockHash ?? null)
|
|
392
|
+
: block.executionPayloadBlockHash === null
|
|
393
|
+
? null
|
|
394
|
+
: fromHex(block.executionPayloadBlockHash),
|
|
395
|
+
bidParentBlockHash: anchorBid?.parentBlockHash ?? null,
|
|
396
|
+
},
|
|
397
|
+
metrics,
|
|
398
|
+
opts,
|
|
399
|
+
logger
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
186
403
|
/**
|
|
187
404
|
* Initialize forkchoice from an unfinalized state.
|
|
188
405
|
*/
|
|
@@ -217,7 +434,7 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
217
434
|
// this is not the justified state, but there is no other ways to get justified balances
|
|
218
435
|
const justifiedBalances = unfinalizedState.getEffectiveBalanceIncrementsZeroInactive();
|
|
219
436
|
|
|
220
|
-
const
|
|
437
|
+
const isPostGloasAnchor = isStatePostGloas(unfinalizedState) && isForkPostGloas(config.getForkName(blockHeader.slot));
|
|
221
438
|
|
|
222
439
|
const store = new ForkChoiceStore(
|
|
223
440
|
currentSlot,
|
|
@@ -270,17 +487,20 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
270
487
|
// PENDING/EMPTY convention), so gossip bids that reference the head's *own* payload
|
|
271
488
|
// hash won't match this variant anyway and will IGNORE until `onExecutionPayload`
|
|
272
489
|
// upgrades the head to FULL with real values.
|
|
490
|
+
// A pre-Gloas anchor's gas limit is kept in the state's bid by the upgrade.
|
|
273
491
|
executionPayloadNumber: isStatePostGloas(unfinalizedState) ? 0 : unfinalizedState.payloadBlockNumber,
|
|
274
|
-
executionPayloadGasLimit:
|
|
492
|
+
executionPayloadGasLimit: isPostGloasAnchor
|
|
275
493
|
? 0
|
|
276
|
-
: unfinalizedState
|
|
494
|
+
: isStatePostGloas(unfinalizedState)
|
|
495
|
+
? Number(unfinalizedState.latestExecutionPayloadBid.gasLimit)
|
|
496
|
+
: unfinalizedState.latestExecutionPayloadHeader.gasLimit,
|
|
277
497
|
executionStatus: blockHeader.slot === GENESIS_SLOT ? ExecutionStatus.Valid : ExecutionStatus.Syncing,
|
|
278
498
|
}
|
|
279
499
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
280
500
|
|
|
281
501
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
282
|
-
payloadStatus:
|
|
283
|
-
parentBlockHash:
|
|
502
|
+
payloadStatus: isPostGloasAnchor ? PayloadStatus.PENDING : PayloadStatus.FULL,
|
|
503
|
+
parentBlockHash: isPostGloasAnchor ? toRootHex(unfinalizedState.latestBlockHash) : null,
|
|
284
504
|
};
|
|
285
505
|
|
|
286
506
|
const parentSlot = blockHeader.slot - 1;
|