@lodestar/beacon-node 1.52.0-dev.9b9a5136ef → 1.52.0-dev.a3cc0e0e58
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 +47 -26
- 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 +4 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +2 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +6 -2
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +87 -48
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +4 -0
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +8 -4
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +9 -3
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +3 -17
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/chain.d.ts +7 -6
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +80 -41
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/attestationError.d.ts +15 -1
- package/lib/chain/errors/attestationError.d.ts.map +1 -1
- package/lib/chain/errors/attestationError.js +8 -0
- package/lib/chain/errors/attestationError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +9 -3
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +2 -1
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +55 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +8 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/interface.d.ts +1 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/lightClient/index.d.ts +13 -6
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +95 -115
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/opPool.js +6 -6
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +45 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +265 -69
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +6 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +54 -64
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +1 -1
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
- package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
- package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +24 -7
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +32 -16
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +4 -2
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +9 -1
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +47 -42
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +100 -9
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +9 -0
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +4 -2
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts +1 -1
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +5 -5
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -3
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +39 -6
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.js +43 -43
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/blockHash.d.ts +12 -0
- package/lib/execution/engine/blockHash.d.ts.map +1 -0
- package/lib/execution/engine/blockHash.js +17 -0
- package/lib/execution/engine/blockHash.js.map +1 -0
- package/lib/execution/engine/http.d.ts +2 -2
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +13 -7
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +16 -3
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js +11 -0
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.d.ts +2 -0
- package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.js +14 -6
- package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +2 -2
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.js +4 -4
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -6
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +6 -1
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +7 -2
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/restHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/restHttpClient.js +9 -5
- package/lib/execution/engine/restHttpClient.js.map +1 -1
- package/lib/execution/engine/restTransport.d.ts +2 -2
- package/lib/execution/engine/restTransport.d.ts.map +1 -1
- package/lib/execution/engine/restTransport.js +4 -4
- package/lib/execution/engine/restTransport.js.map +1 -1
- package/lib/execution/engine/signal.d.ts +6 -0
- package/lib/execution/engine/signal.d.ts.map +1 -0
- package/lib/execution/engine/signal.js +24 -0
- package/lib/execution/engine/signal.js.map +1 -0
- package/lib/execution/engine/transport.d.ts +2 -2
- package/lib/execution/engine/transport.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +5 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +5 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/events.d.ts +6 -2
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +9 -0
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +3 -2
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +1 -0
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +5 -2
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +1 -7
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +0 -13
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +12 -7
- package/lib/network/network.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +22 -2
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +2 -0
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.js +11 -2
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +19 -6
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +4 -2
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/sync/range/batch.d.ts +10 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +29 -0
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +17 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +60 -20
- 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 +44 -3
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +20 -4
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +31 -13
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
- package/lib/sync/range/utils/peerBalancer.js +5 -2
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/types.d.ts +14 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +2 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +28 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +340 -27
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +22 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +55 -25
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +24 -2
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +48 -5
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/asyncIterableToEvents.d.ts +20 -3
- package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
- package/lib/util/asyncIterableToEvents.js +76 -20
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/dataColumns.d.ts +1 -1
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +4 -1
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/eventLoop.d.ts +3 -3
- package/lib/util/eventLoop.d.ts.map +1 -1
- package/lib/util/eventLoop.js +3 -3
- package/lib/util/eventLoop.js.map +1 -1
- package/package.json +27 -27
- package/src/api/impl/beacon/blocks/index.ts +53 -28
- package/src/api/impl/beacon/pool/index.ts +10 -8
- package/src/api/impl/beacon/state/utils.ts +2 -1
- package/src/api/impl/debug/index.ts +6 -2
- package/src/api/impl/validator/index.ts +122 -66
- package/src/chain/ColumnReconstructionTracker.ts +5 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
- package/src/chain/archiveStore/utils/archiveBlocks.ts +1 -1
- package/src/chain/archiveStore/utils/pruneHistory.ts +9 -4
- package/src/chain/blocks/importExecutionPayload.ts +9 -2
- package/src/chain/blocks/index.ts +3 -31
- package/src/chain/chain.ts +112 -78
- package/src/chain/errors/attestationError.ts +11 -1
- package/src/chain/errors/executionPayloadBid.ts +9 -2
- package/src/chain/errors/executionPayloadEnvelope.ts +58 -0
- package/src/chain/interface.ts +1 -1
- package/src/chain/lightClient/index.ts +108 -142
- package/src/chain/opPools/opPool.ts +6 -6
- package/src/chain/prepareNextSlot.ts +347 -89
- package/src/chain/produceBlock/produceBlockBody.ts +69 -80
- package/src/chain/seenCache/seenAttesters.ts +1 -1
- package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
- package/src/chain/validation/aggregateAndProof.ts +24 -9
- package/src/chain/validation/attestation.ts +31 -20
- package/src/chain/validation/attesterSlashing.ts +4 -2
- package/src/chain/validation/block.ts +9 -1
- package/src/chain/validation/executionPayloadBid.ts +60 -44
- package/src/chain/validation/executionPayloadEnvelope.ts +115 -8
- package/src/chain/validation/payloadAttestationMessage.ts +10 -0
- package/src/chain/validation/proposerSlashing.ts +4 -2
- package/src/chain/validation/signatureSets/contributionAndProof.ts +4 -6
- package/src/chain/validation/signatureSets/syncCommittee.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -3
- package/src/chain/validation/syncCommittee.ts +3 -5
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -3
- package/src/chain/validation/voluntaryExit.ts +44 -6
- package/src/chain/validatorMonitor.ts +43 -43
- package/src/execution/engine/blockHash.ts +27 -0
- package/src/execution/engine/http.ts +18 -10
- package/src/execution/engine/interface.ts +18 -3
- package/src/execution/engine/jsonRpcHttpClient.ts +26 -14
- package/src/execution/engine/jsonRpcTransport.ts +8 -4
- package/src/execution/engine/mock.ts +13 -8
- package/src/execution/engine/payloadIdCache.ts +12 -4
- package/src/execution/engine/restHttpClient.ts +17 -11
- package/src/execution/engine/restTransport.ts +5 -4
- package/src/execution/engine/signal.ts +28 -0
- package/src/execution/engine/transport.ts +3 -2
- package/src/index.ts +6 -1
- package/src/metrics/metrics/beacon.ts +9 -0
- package/src/metrics/metrics/lodestar.ts +5 -0
- package/src/network/core/events.ts +12 -0
- package/src/network/core/networkCoreWorkerHandler.ts +6 -2
- package/src/network/gossip/gossipsub.ts +6 -2
- package/src/network/gossip/topic.ts +1 -14
- package/src/network/network.ts +12 -8
- package/src/network/peers/peerManager.ts +26 -2
- package/src/network/peers/utils/prioritizePeers.ts +14 -1
- package/src/network/processor/gossipHandlers.ts +25 -13
- package/src/network/processor/index.ts +7 -2
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +1 -1
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
- package/src/sync/range/batch.ts +33 -0
- package/src/sync/range/chain.ts +72 -17
- package/src/sync/range/range.ts +57 -3
- package/src/sync/range/utils/batches.ts +38 -13
- package/src/sync/range/utils/peerBalancer.ts +4 -1
- package/src/sync/types.ts +13 -0
- package/src/sync/unknownBlock.ts +389 -29
- package/src/sync/utils/downloadByRange.ts +89 -29
- package/src/sync/utils/downloadByRoot.ts +75 -7
- package/src/util/asyncIterableToEvents.ts +100 -21
- package/src/util/dataColumns.ts +4 -1
- package/src/util/eventLoop.ts +3 -3
|
@@ -132,8 +132,6 @@ const BLOCK_PRODUCTION_RACE_CUTOFF_BPS = 1667;
|
|
|
132
132
|
* TODO GLOAS: revisit, the block propagates faster as it only commits to a bid and the attestation deadline changed
|
|
133
133
|
*/
|
|
134
134
|
export const BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS = 1667;
|
|
135
|
-
/** Rejection message of the bid block branch when there is no viable bid to commit to */
|
|
136
|
-
const NO_BID_AVAILABLE = "No builder bid available";
|
|
137
135
|
|
|
138
136
|
type BidCandidate = {
|
|
139
137
|
signedBid: gloas.SignedExecutionPayloadBid;
|
|
@@ -179,6 +177,8 @@ function compareBidCandidates(a: BidCandidate, b: BidCandidate): number {
|
|
|
179
177
|
return a.receivedMs - b.receivedMs;
|
|
180
178
|
}
|
|
181
179
|
|
|
180
|
+
type ParentStates = {parentState: IBeaconStateView; parentStateWithPayload: IBeaconStateView};
|
|
181
|
+
|
|
182
182
|
type ProduceBlockContentsRes = {executionPayloadValue: Wei; consensusBlockValue: Wei} & {
|
|
183
183
|
data: BlockContents<ForkPreGloas>;
|
|
184
184
|
version: ForkPreGloas;
|
|
@@ -409,7 +409,7 @@ export function getValidatorApi(
|
|
|
409
409
|
* Both the above scenarios could be problematic and hence validator shouldn't participate
|
|
410
410
|
* or weigh its vote on a head till it resolves to a Valid execution status.
|
|
411
411
|
* Following activities should be skipped on an Optimistic head (with Syncing status):
|
|
412
|
-
* 1. Attestation if targetRoot is optimistic
|
|
412
|
+
* 1. Attestation if the head block voted for (post-gloas the variant voted for) or the targetRoot is optimistic
|
|
413
413
|
* 2. SyncCommitteeContribution if if the root for which to produce contribution is Optimistic.
|
|
414
414
|
* 3. ProduceBlock if the parentRoot (chain's current head) is optimistic. Must be checked
|
|
415
415
|
* explicitly as only local payload production consults the EL, blinded blocks from an
|
|
@@ -450,9 +450,11 @@ export function getValidatorApi(
|
|
|
450
450
|
{
|
|
451
451
|
commonBlockBodyPromise,
|
|
452
452
|
parentBlock,
|
|
453
|
+
parentStatesPromise,
|
|
453
454
|
}: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
|
|
454
455
|
commonBlockBodyPromise: Promise<CommonBlockBody>;
|
|
455
456
|
parentBlock: ProtoBlock;
|
|
457
|
+
parentStatesPromise: Promise<ParentStates>;
|
|
456
458
|
}
|
|
457
459
|
): Promise<ProduceBlindedBlockRes> {
|
|
458
460
|
const version = config.getForkName(slot);
|
|
@@ -487,6 +489,7 @@ export function getValidatorApi(
|
|
|
487
489
|
randaoReveal,
|
|
488
490
|
graffiti,
|
|
489
491
|
commonBlockBodyPromise,
|
|
492
|
+
...(await parentStatesPromise),
|
|
490
493
|
});
|
|
491
494
|
|
|
492
495
|
metrics?.blockProductionSuccess.inc({source});
|
|
@@ -519,9 +522,11 @@ export function getValidatorApi(
|
|
|
519
522
|
strictFeeRecipientCheck,
|
|
520
523
|
commonBlockBodyPromise,
|
|
521
524
|
parentBlock,
|
|
525
|
+
parentStatesPromise,
|
|
522
526
|
}: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
|
|
523
527
|
commonBlockBodyPromise: Promise<CommonBlockBody>;
|
|
524
528
|
parentBlock: ProtoBlock;
|
|
529
|
+
parentStatesPromise: Promise<ParentStates>;
|
|
525
530
|
}
|
|
526
531
|
): Promise<ProduceBlockContentsRes & {shouldOverrideBuilder?: boolean}> {
|
|
527
532
|
const version = config.getForkName(slot);
|
|
@@ -541,6 +546,7 @@ export function getValidatorApi(
|
|
|
541
546
|
graffiti,
|
|
542
547
|
feeRecipient,
|
|
543
548
|
commonBlockBodyPromise,
|
|
549
|
+
...(await parentStatesPromise),
|
|
544
550
|
});
|
|
545
551
|
if (strictFeeRecipientCheck && feeRecipient && isForkPostBellatrix(version)) {
|
|
546
552
|
const blockFeeRecipient = toHex((block as bellatrix.BeaconBlock).body.executionPayload.feeRecipient);
|
|
@@ -636,6 +642,13 @@ export function getValidatorApi(
|
|
|
636
642
|
notOnOutOfRangeData(parentBlockRoot);
|
|
637
643
|
metrics?.blockProductionSlotDelta.set(slot - parentSlot);
|
|
638
644
|
|
|
645
|
+
// Fetch the production state once and thread it to all downstream production calls, not awaited so each
|
|
646
|
+
// block source includes it in its production time. Only reached for pre-gloas slots (produceBlockV3 rejects
|
|
647
|
+
// post-gloas forks), the execution payload is part of the parent block so its state already includes it
|
|
648
|
+
const parentStatesPromise: Promise<ParentStates> = chain.regen
|
|
649
|
+
.getBlockSlotState(parentBlock, slot, {dontTransferCache: true}, RegenCaller.produceBlock)
|
|
650
|
+
.then((parentState) => ({parentState, parentStateWithPayload: parentState}));
|
|
651
|
+
|
|
639
652
|
const fork = config.getForkName(slot);
|
|
640
653
|
|
|
641
654
|
const isBuilderEnabled =
|
|
@@ -678,6 +691,7 @@ export function getValidatorApi(
|
|
|
678
691
|
strictFeeRecipientCheck: false,
|
|
679
692
|
commonBlockBodyPromise,
|
|
680
693
|
parentBlock,
|
|
694
|
+
parentStatesPromise,
|
|
681
695
|
})
|
|
682
696
|
: Promise.reject(new Error("Builder disabled"));
|
|
683
697
|
|
|
@@ -686,6 +700,7 @@ export function getValidatorApi(
|
|
|
686
700
|
strictFeeRecipientCheck,
|
|
687
701
|
commonBlockBodyPromise,
|
|
688
702
|
parentBlock,
|
|
703
|
+
parentStatesPromise,
|
|
689
704
|
}).then((engineBlock) => {
|
|
690
705
|
// Once the engine returns a block, in the event of either:
|
|
691
706
|
// - suspected builder censorship
|
|
@@ -721,28 +736,28 @@ export function getValidatorApi(
|
|
|
721
736
|
});
|
|
722
737
|
|
|
723
738
|
// Ensure builder and engine HTTP requests are sent before starting common block body production
|
|
724
|
-
// by deferring the call to next event loop iteration, allowing pending
|
|
725
|
-
// HTTP requests to be processed first and sent out early in slot.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
739
|
+
// by deferring the call to next event loop iteration once the state is available, allowing pending
|
|
740
|
+
// I/O operations like HTTP requests to be processed first and sent out early in slot.
|
|
741
|
+
parentStatesPromise.then(
|
|
742
|
+
(parentStates) =>
|
|
743
|
+
callInNextEventLoop(() => {
|
|
744
|
+
logger.verbose("Producing common block body", loggerContext);
|
|
745
|
+
const commonBlockBodyStartedAt = Date.now();
|
|
746
|
+
|
|
747
|
+
chain
|
|
748
|
+
.produceCommonBlockBody({slot, parentBlock, randaoReveal, graffiti: graffitiBytes, ...parentStates})
|
|
749
|
+
.then((commonBlockBody) => {
|
|
750
|
+
deferredCommonBlockBody.resolve(commonBlockBody);
|
|
751
|
+
logger.verbose("Produced common block body", {
|
|
752
|
+
...loggerContext,
|
|
753
|
+
durationMs: Date.now() - commonBlockBodyStartedAt,
|
|
754
|
+
});
|
|
755
|
+
})
|
|
756
|
+
.catch(deferredCommonBlockBody.reject);
|
|
757
|
+
}),
|
|
758
|
+
// Both block sources fail on the state themselves and do not await the common block body
|
|
759
|
+
() => {}
|
|
760
|
+
);
|
|
746
761
|
|
|
747
762
|
const [builder, engine] = await blockProductionRacePromise;
|
|
748
763
|
|
|
@@ -1010,19 +1025,23 @@ export function getValidatorApi(
|
|
|
1010
1025
|
(!circuitBreakerActive &&
|
|
1011
1026
|
chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex) !== null);
|
|
1012
1027
|
|
|
1013
|
-
//
|
|
1014
|
-
//
|
|
1015
|
-
const cutoffMs =
|
|
1016
|
-
|
|
1017
|
-
config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS) - chain.clock.msFromSlot(slot)
|
|
1018
|
-
);
|
|
1028
|
+
// Cutoff time into the slot, ensures a slow local payload build does not delay the proposal when a
|
|
1029
|
+
// builder bid block is available (and vice versa). Each timer waits for the time left until the cutoff
|
|
1030
|
+
const cutoffMs = config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS);
|
|
1031
|
+
const msToCutoff = (): number => Math.max(0, cutoffMs - chain.clock.msFromSlot(slot));
|
|
1019
1032
|
|
|
1020
1033
|
// Give p2p bids the same time to bid up as granted to builder API bid requests via the advertised
|
|
1021
1034
|
// deadline, the pool is read once the deadline passed and the bid requests settled. A late request
|
|
1022
1035
|
// does not wait past the race cutoff, a pooled bid is still the fastest fallback if the local block fails
|
|
1023
1036
|
const bidDeadlinePromise = circuitBreakerActive
|
|
1024
1037
|
? Promise.resolve()
|
|
1025
|
-
: sleep(Math.min(chain.builderApiClient.bidDeadline,
|
|
1038
|
+
: sleep(Math.min(chain.builderApiClient.bidDeadline, msToCutoff()));
|
|
1039
|
+
|
|
1040
|
+
let parentExecutionRequestsPromise: Promise<gloas.ExecutionRequests> | null = null;
|
|
1041
|
+
const getParentExecutionRequests = (): Promise<gloas.ExecutionRequests> => {
|
|
1042
|
+
parentExecutionRequestsPromise ??= chain.getParentExecutionRequests(parentSlot, parentBlockRootHex);
|
|
1043
|
+
return parentExecutionRequestsPromise;
|
|
1044
|
+
};
|
|
1026
1045
|
|
|
1027
1046
|
// Candidates are ranked by their boosted counted total payment, the p2p bid is governed
|
|
1028
1047
|
// by the top-level factors and each builder API bid by its own entry. Ties prefer the
|
|
@@ -1032,10 +1051,9 @@ export function getValidatorApi(
|
|
|
1032
1051
|
// Past the race cutoff a pooled p2p bid is used right away rather than waiting for pending
|
|
1033
1052
|
// builder API requests, the local block is selected at the cutoff anyway if it is ready
|
|
1034
1053
|
let [builderApiBids] = await Promise.all([
|
|
1035
|
-
Promise.race([builderApiBidsPromise, sleep(
|
|
1054
|
+
Promise.race([builderApiBidsPromise, sleep(msToCutoff()).then(() => null)]),
|
|
1036
1055
|
bidDeadlinePromise,
|
|
1037
1056
|
]);
|
|
1038
|
-
let parentExecutionRequestsPromise: Promise<gloas.ExecutionRequests> | null = null;
|
|
1039
1057
|
|
|
1040
1058
|
let p2pBid: PooledExecutionPayloadBid | null = circuitBreakerActive
|
|
1041
1059
|
? null
|
|
@@ -1064,10 +1082,7 @@ export function getValidatorApi(
|
|
|
1064
1082
|
parentBlockHash: bidParentBlockHash,
|
|
1065
1083
|
parentBlockRoot: parentBlockRootHex,
|
|
1066
1084
|
entry,
|
|
1067
|
-
getParentExecutionRequests
|
|
1068
|
-
parentExecutionRequestsPromise ??= chain.getParentExecutionRequests(parentSlot, parentBlockRootHex);
|
|
1069
|
-
return parentExecutionRequestsPromise;
|
|
1070
|
-
},
|
|
1085
|
+
getParentExecutionRequests,
|
|
1071
1086
|
});
|
|
1072
1087
|
return {
|
|
1073
1088
|
signedBid,
|
|
@@ -1116,23 +1131,6 @@ export function getValidatorApi(
|
|
|
1116
1131
|
return rankedCandidates[0];
|
|
1117
1132
|
})();
|
|
1118
1133
|
|
|
1119
|
-
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
1120
|
-
slot,
|
|
1121
|
-
parentBlock,
|
|
1122
|
-
randaoReveal,
|
|
1123
|
-
graffiti: graffitiBytes,
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
const baseAttrs = {
|
|
1127
|
-
slot,
|
|
1128
|
-
parentBlock,
|
|
1129
|
-
randaoReveal,
|
|
1130
|
-
graffiti: graffitiBytes,
|
|
1131
|
-
feeRecipient,
|
|
1132
|
-
strictFeeRecipientCheck,
|
|
1133
|
-
commonBlockBodyPromise,
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
1134
|
metrics?.blockProductionRequests.inc({source: ProducedBlockSource.engine});
|
|
1137
1135
|
|
|
1138
1136
|
const timed = <T>(source: ProducedBlockSource, fn: () => Promise<T>): Promise<T> => {
|
|
@@ -1140,11 +1138,59 @@ export function getValidatorApi(
|
|
|
1140
1138
|
return fn().finally(() => t?.({source}));
|
|
1141
1139
|
};
|
|
1142
1140
|
|
|
1141
|
+
// Fetch the production state once and apply the parent execution payload once here, so all
|
|
1142
|
+
// downstream consumers share a single state: the un-applied `parentState` (for `computeNewStateRoot`)
|
|
1143
|
+
// and the applied `parentStateWithPayload` (for attestation scoring and execution-payload prep).
|
|
1144
|
+
// Not awaited, the race below covers it and both blocks are produced from it
|
|
1145
|
+
const baseAttrsPromise = (async () => {
|
|
1146
|
+
const parentState = await chain.regen.getBlockSlotState(
|
|
1147
|
+
parentBlock,
|
|
1148
|
+
slot,
|
|
1149
|
+
{dontTransferCache: true},
|
|
1150
|
+
RegenCaller.produceBlock
|
|
1151
|
+
);
|
|
1152
|
+
// Fetch the parent's execution requests once here and thread them via blockAttributes: they are
|
|
1153
|
+
// used both to apply the parent payload below and as the block's `parentExecutionRequests` field
|
|
1154
|
+
// (so both are guaranteed consistent). Only needed when building on FULL; empty parent has none.
|
|
1155
|
+
const parentExecutionRequests =
|
|
1156
|
+
isBuildingOnFull && isStatePostGloas(parentState)
|
|
1157
|
+
? await getParentExecutionRequests()
|
|
1158
|
+
: ssz.gloas.ExecutionRequests.defaultValue();
|
|
1159
|
+
// When building on EMPTY there is nothing to apply, so it stays the same view as parentState
|
|
1160
|
+
// (the availability bit for parentSlot stays false, which is correct).
|
|
1161
|
+
const parentStateWithPayload =
|
|
1162
|
+
isBuildingOnFull && isStatePostGloas(parentState)
|
|
1163
|
+
? parentState.withParentPayloadApplied(parentExecutionRequests)
|
|
1164
|
+
: parentState;
|
|
1165
|
+
|
|
1166
|
+
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
1167
|
+
slot,
|
|
1168
|
+
parentBlock,
|
|
1169
|
+
randaoReveal,
|
|
1170
|
+
graffiti: graffitiBytes,
|
|
1171
|
+
parentState,
|
|
1172
|
+
parentStateWithPayload,
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
return {
|
|
1176
|
+
slot,
|
|
1177
|
+
parentBlock,
|
|
1178
|
+
randaoReveal,
|
|
1179
|
+
graffiti: graffitiBytes,
|
|
1180
|
+
feeRecipient,
|
|
1181
|
+
strictFeeRecipientCheck,
|
|
1182
|
+
commonBlockBodyPromise,
|
|
1183
|
+
parentState,
|
|
1184
|
+
parentStateWithPayload,
|
|
1185
|
+
parentExecutionRequests,
|
|
1186
|
+
};
|
|
1187
|
+
})();
|
|
1188
|
+
|
|
1143
1189
|
// use abort controller to stop waiting for the bid block if the engine block will be selected
|
|
1144
1190
|
const controller = new AbortController();
|
|
1145
1191
|
|
|
1146
|
-
const enginePromise: ReturnType<typeof chain.produceBlock> = timed(ProducedBlockSource.engine, () =>
|
|
1147
|
-
chain.produceBlock(
|
|
1192
|
+
const enginePromise: ReturnType<typeof chain.produceBlock> = timed(ProducedBlockSource.engine, async () =>
|
|
1193
|
+
chain.produceBlock(await baseAttrsPromise)
|
|
1148
1194
|
).then((engineBlock) => {
|
|
1149
1195
|
// No need to wait for the bid block if the engine block will always be selected, either
|
|
1150
1196
|
// due to suspected builder censorship, or because no builders are configured and the
|
|
@@ -1156,16 +1202,16 @@ export function getValidatorApi(
|
|
|
1156
1202
|
});
|
|
1157
1203
|
const bidBlockPromise: ReturnType<typeof chain.produceBlock> = bestBidPromise.then((candidate) => {
|
|
1158
1204
|
if (candidate === null) {
|
|
1159
|
-
throw new
|
|
1205
|
+
throw new NoBidReceived();
|
|
1160
1206
|
}
|
|
1161
1207
|
metrics?.blockProductionRequests.inc({source: ProducedBlockSource.builder});
|
|
1162
|
-
return timed(ProducedBlockSource.builder, () =>
|
|
1163
|
-
chain.produceBlock({...
|
|
1208
|
+
return timed(ProducedBlockSource.builder, async () =>
|
|
1209
|
+
chain.produceBlock({...(await baseAttrsPromise), builderBid: candidate.signedBid})
|
|
1164
1210
|
);
|
|
1165
1211
|
});
|
|
1166
1212
|
|
|
1167
1213
|
const [engineResult, bidBlockResult] = await resolveOrRacePromises([enginePromise, bidBlockPromise], {
|
|
1168
|
-
resolveTimeoutMs:
|
|
1214
|
+
resolveTimeoutMs: msToCutoff(),
|
|
1169
1215
|
raceTimeoutMs: config.getSlotDurationMs(fork),
|
|
1170
1216
|
signal: controller.signal,
|
|
1171
1217
|
});
|
|
@@ -1270,7 +1316,7 @@ export function getValidatorApi(
|
|
|
1270
1316
|
source = ProducedBlockSource.engine;
|
|
1271
1317
|
bestResult = engineResult;
|
|
1272
1318
|
const reason =
|
|
1273
|
-
bidBlockResult.status === "rejected" &&
|
|
1319
|
+
bidBlockResult.status === "rejected" && bidBlockResult.reason instanceof NoBidReceived
|
|
1274
1320
|
? EngineBlockSelectionReason.BuilderNoBid
|
|
1275
1321
|
: bidBlockResult.status === "pending"
|
|
1276
1322
|
? EngineBlockSelectionReason.BuilderPending
|
|
@@ -1397,10 +1443,18 @@ export function getValidatorApi(
|
|
|
1397
1443
|
// After Gloas, attestation.data.index signals payload status in fork-choice:
|
|
1398
1444
|
// - 0 = EMPTY / not present, 1 = FULL / present
|
|
1399
1445
|
// - same-slot attestations must always use index = 0
|
|
1446
|
+
// Validator shouldn't vote on an optimistic head, post-gloas that is the variant voted for
|
|
1400
1447
|
if (canonicalBlock.slot !== slot) {
|
|
1401
1448
|
index = canonicalBlock.payloadStatus === PayloadStatus.FULL ? 1 : 0;
|
|
1449
|
+
if (isOptimisticBlock(canonicalBlock)) {
|
|
1450
|
+
throw new NodeIsSyncing(
|
|
1451
|
+
`Head block's execution payload not yet validated, executionPayloadBlockHash=${canonicalBlock.executionPayloadBlockHash}`
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1402
1454
|
} else {
|
|
1403
1455
|
index = 0;
|
|
1456
|
+
// Same-slot votes support the PENDING variant, which does not depend on the block's own payload
|
|
1457
|
+
notOnOptimisticBlockRoot(beaconBlockRoot);
|
|
1404
1458
|
}
|
|
1405
1459
|
} else if (isForkPostElectra(fork)) {
|
|
1406
1460
|
index = 0;
|
|
@@ -1418,8 +1472,11 @@ export function getValidatorApi(
|
|
|
1418
1472
|
headBlockRoot
|
|
1419
1473
|
: headState.getBlockRootAtSlot(targetSlot);
|
|
1420
1474
|
|
|
1421
|
-
// Check the execution status as validator shouldn't vote on an optimistic head
|
|
1422
|
-
//
|
|
1475
|
+
// Check the execution status as validator shouldn't vote on an optimistic head, post-gloas the
|
|
1476
|
+
// variant voted for is checked above. Check on target is sufficient for a valid source
|
|
1477
|
+
if (!isForkPostGloas(fork)) {
|
|
1478
|
+
notOnOptimisticBlockRoot(beaconBlockRoot);
|
|
1479
|
+
}
|
|
1423
1480
|
notOnOptimisticBlockRoot(targetRoot);
|
|
1424
1481
|
notOnOutOfRangeData(targetRoot);
|
|
1425
1482
|
|
|
@@ -2326,8 +2383,7 @@ export function getValidatorApi(
|
|
|
2326
2383
|
metrics?.inclusionListsValid.inc({source: InclusionListSource.api});
|
|
2327
2384
|
metrics?.inclusionListsValidSize.inc(totalBytes);
|
|
2328
2385
|
|
|
2329
|
-
const isTimely =
|
|
2330
|
-
secFromSlot >= 0 && secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
|
|
2386
|
+
const isTimely = secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
|
|
2331
2387
|
chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
|
|
2332
2388
|
|
|
2333
2389
|
chain.emitter.emit(routes.events.EventType.inclusionList, {
|
|
@@ -19,6 +19,11 @@ const RECONSTRUCTION_DELAY_MIN_BPS = 667;
|
|
|
19
19
|
*/
|
|
20
20
|
const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Maximum time a column request waits for a pending reconstruction, covers the delay and the recovery itself
|
|
24
|
+
*/
|
|
25
|
+
export const RECONSTRUCTED_COLUMNS_WAIT_BPS = 2500;
|
|
26
|
+
|
|
22
27
|
const QUEUE_MAX_LENGTH = 16;
|
|
23
28
|
|
|
24
29
|
export type ColumnReconstructionInput = BlockInputColumns | PayloadEnvelopeInput;
|
|
@@ -50,6 +50,15 @@ export async function getHistoricalState(
|
|
|
50
50
|
const transitionTimer = metrics?.stateTransitionTime.startTimer();
|
|
51
51
|
let blockCount = 0;
|
|
52
52
|
for await (const block of db.blockArchive.valuesStream({gt: state.slot, lte: slot})) {
|
|
53
|
+
// Pruned history keeps the genesis state but not the blocks after it, without this check the
|
|
54
|
+
// first block would only be rejected after processing every slot in between
|
|
55
|
+
if (
|
|
56
|
+
blockCount === 0 &&
|
|
57
|
+
!byteArrayEquals(block.message.parentRoot, state.computeAnchorCheckpoint().checkpoint.root)
|
|
58
|
+
) {
|
|
59
|
+
metrics?.regenErrorCount.inc({reason: RegenErrorType.blockProcessing});
|
|
60
|
+
throw Error(`Archived blocks do not extend nearest state slot=${state.slot} blockSlot=${block.message.slot}`);
|
|
61
|
+
}
|
|
53
62
|
try {
|
|
54
63
|
state = state.stateTransition(
|
|
55
64
|
{block},
|
|
@@ -284,7 +284,7 @@ export async function archiveBlocks(
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// Delete expired data column sidecars
|
|
287
|
-
// Keep only `[
|
|
287
|
+
// Keep only `[current_epoch - max(MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS, archiveDataEpochs)]`
|
|
288
288
|
if (finalizedPostFulu) {
|
|
289
289
|
if (archiveDataEpochs !== Infinity) {
|
|
290
290
|
const dataColumnSidecarsMinEpoch = getDataColumnSidecarsMinEpoch(config, currentEpoch, archiveDataEpochs);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {GENESIS_SLOT} from "@lodestar/params";
|
|
2
3
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
3
4
|
import {Epoch, Slot} from "@lodestar/types";
|
|
4
5
|
import {Logger, prettyPrintIndices} from "@lodestar/utils";
|
|
@@ -13,6 +14,9 @@ import {Metrics} from "../../../metrics/index.js";
|
|
|
13
14
|
*/
|
|
14
15
|
export const MAX_PRUNE_BLOCK_SLOTS_PER_RUN = 4096;
|
|
15
16
|
|
|
17
|
+
// Genesis is kept so the block and state stay available via the API, e.g. for checkpoint providers
|
|
18
|
+
const FIRST_PRUNABLE_SLOT = GENESIS_SLOT + 1;
|
|
19
|
+
|
|
16
20
|
export async function pruneHistory(
|
|
17
21
|
config: ChainForkConfig,
|
|
18
22
|
db: IBeaconDb,
|
|
@@ -30,11 +34,12 @@ export async function pruneHistory(
|
|
|
30
34
|
// ensure that during (extremely lol) long periods of non-finality we don't delete unfinalized epoch data
|
|
31
35
|
finalizedEpoch
|
|
32
36
|
);
|
|
33
|
-
const firstBlockSlot =
|
|
37
|
+
const [firstBlockSlot = FIRST_PRUNABLE_SLOT] = await db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, limit: 1});
|
|
34
38
|
const blockCutoffSlot = Math.min(computeStartSlotAtEpoch(blockCutoffEpoch), firstBlockSlot + maxBlockSlots);
|
|
35
39
|
// The latest archived state is the anchor on restart and can trail finalization by a few epochs
|
|
36
40
|
const lastArchivedStateSlot = (await db.stateArchive.lastKey()) ?? 0;
|
|
37
41
|
const stateCutoffSlot = Math.min(computeStartSlotAtEpoch(finalizedEpoch), lastArchivedStateSlot);
|
|
42
|
+
const stateStartSlot = Math.max(statePruneFromSlot, FIRST_PRUNABLE_SLOT);
|
|
38
43
|
|
|
39
44
|
logger.debug("Preparing to prune history", {
|
|
40
45
|
currentEpoch,
|
|
@@ -46,9 +51,9 @@ export async function pruneHistory(
|
|
|
46
51
|
|
|
47
52
|
const step0 = metrics?.pruneHistory.fetchKeys.startTimer();
|
|
48
53
|
const [blocks, envelopes, states] = await Promise.all([
|
|
49
|
-
db.blockArchive.keys({gte:
|
|
50
|
-
db.executionPayloadEnvelopeArchive.keys({gte:
|
|
51
|
-
stateCutoffSlot >
|
|
54
|
+
db.blockArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
|
|
55
|
+
db.executionPayloadEnvelopeArchive.keys({gte: FIRST_PRUNABLE_SLOT, lt: blockCutoffSlot}),
|
|
56
|
+
stateCutoffSlot > stateStartSlot ? db.stateArchive.keys({gte: stateStartSlot, lt: stateCutoffSlot}) : [],
|
|
52
57
|
]);
|
|
53
58
|
step0?.();
|
|
54
59
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
InvalidBlockCode,
|
|
8
8
|
LVHInvalidJudged,
|
|
9
9
|
PayloadExecutionStatus,
|
|
10
|
+
PayloadStatus,
|
|
10
11
|
getFinalizedExecutionBlockHash,
|
|
11
12
|
getSafeExecutionBlockHash,
|
|
12
13
|
} from "@lodestar/fork-choice";
|
|
@@ -117,7 +118,7 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
|
|
|
117
118
|
* 3. Regenerate state for envelope verification
|
|
118
119
|
* 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
|
|
119
120
|
* 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
|
|
120
|
-
* 6. Update fork choice (transitions the block's PENDING variant to FULL)
|
|
121
|
+
* 6. Update fork choice (transitions the block's PENDING variant to FULL) and emit head events if the head changed
|
|
121
122
|
* 7. Queue notifyForkchoiceUpdate to engine api
|
|
122
123
|
* 8. Record metrics for payload envelope and column sources
|
|
123
124
|
* 9. Emit `execution_payload` event
|
|
@@ -356,6 +357,7 @@ export async function importExecutionPayload(
|
|
|
356
357
|
|
|
357
358
|
// 6. Update fork choice, transitions the block's PENDING variant to FULL
|
|
358
359
|
const execStatus = toForkChoiceExecutionStatus(execResult.status);
|
|
360
|
+
const prevHead = this.forkChoice.getHead();
|
|
359
361
|
try {
|
|
360
362
|
this.forkChoice.onExecutionPayload(
|
|
361
363
|
blockRootHex,
|
|
@@ -376,12 +378,17 @@ export async function importExecutionPayload(
|
|
|
376
378
|
}
|
|
377
379
|
throw e;
|
|
378
380
|
}
|
|
381
|
+
const head = this.forkChoice.getHead();
|
|
382
|
+
this.emitHeadEvents(prevHead, head);
|
|
383
|
+
if (head.blockRoot !== prevHead.blockRoot) {
|
|
384
|
+
this.onHeadChanged(prevHead, head);
|
|
385
|
+
}
|
|
379
386
|
|
|
380
387
|
// 7. Queue notifyForkchoiceUpdate to engine api
|
|
381
|
-
const head = this.forkChoice.getHead();
|
|
382
388
|
if (
|
|
383
389
|
!this.opts.disableImportExecutionFcU &&
|
|
384
390
|
blockRootHex === head.blockRoot &&
|
|
391
|
+
head.payloadStatus === PayloadStatus.FULL &&
|
|
385
392
|
// Skip a payload that does not satisfy the inclusion list constraints, fork choice keeps the EMPTY
|
|
386
393
|
// variant as head and the next prepare fcU keeps the engine on the parent payload
|
|
387
394
|
this.forkChoice.isPayloadInclusionListSatisfied(blockRootHex)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
2
2
|
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
3
3
|
import {SignedBeaconBlock, Slot} from "@lodestar/types";
|
|
4
|
-
import {isErrorAborted
|
|
4
|
+
import {isErrorAborted} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/metrics.js";
|
|
6
6
|
import {nextEventLoop} from "../../util/eventLoop.js";
|
|
7
7
|
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
|
|
@@ -208,36 +208,9 @@ export async function processBlocks(
|
|
|
208
208
|
this.logger.debug("Block error", {slot: err.signedBlock.message.slot}, err);
|
|
209
209
|
|
|
210
210
|
if (err.type.code === BlockErrorCode.INVALID_SIGNATURE) {
|
|
211
|
-
|
|
212
|
-
const blockSlot = signedBlock.message.slot;
|
|
213
|
-
const {state} = err.type;
|
|
214
|
-
const forkTypes = this.config.getForkTypes(blockSlot);
|
|
215
|
-
const blockRootHex = toRootHex(forkTypes.BeaconBlock.hashTreeRoot(signedBlock.message));
|
|
216
|
-
this.persistInvalidSszValue(
|
|
217
|
-
forkTypes.SignedBeaconBlock,
|
|
218
|
-
signedBlock,
|
|
219
|
-
`${blockSlot}_invalid_signature`,
|
|
220
|
-
blockRootHex
|
|
221
|
-
);
|
|
222
|
-
this.persistInvalidSszBytes(
|
|
223
|
-
"BeaconState",
|
|
224
|
-
state.serialize(),
|
|
225
|
-
toRootHex(state.hashTreeRoot()),
|
|
226
|
-
`${state.slot}_invalid_signature`
|
|
227
|
-
);
|
|
211
|
+
void this.persistInvalidSignature(err.type.state, err.signedBlock);
|
|
228
212
|
} else if (err.type.code === BlockErrorCode.INVALID_STATE_ROOT) {
|
|
229
|
-
|
|
230
|
-
const blockSlot = signedBlock.message.slot;
|
|
231
|
-
const {preState, postState} = err.type;
|
|
232
|
-
const preRoot = preState.hashTreeRoot();
|
|
233
|
-
const postRoot = postState.hashTreeRoot();
|
|
234
|
-
this.persistInvalidStateRoot(preState, postState, signedBlock).catch((e) => {
|
|
235
|
-
this.logger.error(
|
|
236
|
-
"Error persisting invalid state root objects",
|
|
237
|
-
{slot: blockSlot, preStateRoot: toRootHex(preRoot), postStateRoot: toRootHex(postRoot)},
|
|
238
|
-
e
|
|
239
|
-
);
|
|
240
|
-
});
|
|
213
|
+
void this.persistInvalidStateRoot(err.type.preState, err.type.postState, err.signedBlock);
|
|
241
214
|
}
|
|
242
215
|
}
|
|
243
216
|
|
|
@@ -307,7 +280,6 @@ async function importPayloadEnvelopesOfKnownBlocks(
|
|
|
307
280
|
});
|
|
308
281
|
await importExecutionPayload.call(this, payloadInputs[i], dataAvailabilityStatuses[i], {validSignature: false});
|
|
309
282
|
}
|
|
310
|
-
// the new FULL variants are not seen by the head cached from the last block import
|
|
311
283
|
this.recomputeForkChoiceHead(ForkchoiceCaller.importBlock);
|
|
312
284
|
|
|
313
285
|
return result;
|