@lodestar/beacon-node 1.47.0-dev.d2f4b96574 → 1.47.0-dev.d79d81f994
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 -18
- 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 +25 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -1
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/events/index.d.ts +1 -1
- package/lib/api/impl/events/index.d.ts.map +1 -1
- package/lib/api/impl/events/index.js +12 -3
- package/lib/api/impl/events/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +12 -13
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +238 -65
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/impl/validator/utils.d.ts +5 -0
- package/lib/api/impl/validator/utils.d.ts.map +1 -1
- package/lib/api/impl/validator/utils.js +18 -12
- package/lib/api/impl/validator/utils.js.map +1 -1
- package/lib/api/rest/base.d.ts.map +1 -1
- package/lib/api/rest/base.js +7 -0
- package/lib/api/rest/base.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +1 -1
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +21 -0
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +2 -7
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +3 -2
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +11 -9
- 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 +15 -7
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +6 -2
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +14 -5
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.js +5 -0
- package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +22 -12
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/bls/index.d.ts +1 -1
- package/lib/chain/bls/index.d.ts.map +1 -1
- package/lib/chain/bls/interface.d.ts +5 -5
- package/lib/chain/bls/interface.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +5 -11
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +116 -101
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +5 -19
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +10 -65
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/multithread/types.d.ts +29 -8
- package/lib/chain/bls/multithread/types.d.ts.map +1 -1
- package/lib/chain/bls/multithread/types.js +12 -0
- package/lib/chain/bls/multithread/types.js.map +1 -1
- package/lib/chain/bls/multithread/utils.d.ts +4 -0
- package/lib/chain/bls/multithread/utils.d.ts.map +1 -1
- package/lib/chain/bls/multithread/utils.js +10 -0
- package/lib/chain/bls/multithread/utils.js.map +1 -1
- package/lib/chain/bls/multithread/worker.js +49 -23
- package/lib/chain/bls/multithread/worker.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -10
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +8 -45
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +4 -4
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +18 -19
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/builderCircuitBreaker.d.ts +6 -5
- package/lib/chain/builderCircuitBreaker.d.ts.map +1 -1
- package/lib/chain/builderCircuitBreaker.js +28 -15
- package/lib/chain/builderCircuitBreaker.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -5
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +24 -9
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +2 -0
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +6 -1
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/proposerPreferences.d.ts +6 -0
- package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/errors/proposerPreferences.js +1 -0
- package/lib/chain/errors/proposerPreferences.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +4 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +8 -4
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +1 -1
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +1 -1
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts +16 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.d.ts.map +1 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.js +57 -0
- package/lib/chain/opPools/deferredVoluntaryExitPool.js.map +1 -0
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +7 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +4 -4
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/opPools/index.d.ts +2 -1
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +1 -0
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.js +3 -3
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +1 -1
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +1 -1
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +25 -7
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +3 -25
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +2 -0
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +7 -2
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +5 -2
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +3 -0
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +2 -2
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +5 -5
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +9 -5
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +25 -4
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts +5 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +10 -3
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +28 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +121 -13
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +5 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +6 -0
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +47 -5
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +117 -7
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +3 -3
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +1 -4
- 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 +1 -1
- 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 +21 -7
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +13 -3
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +147 -12
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +5 -14
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts +1 -1
- package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +13 -4
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts +9 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +46 -1
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/execution/builder/apiClient.d.ts +64 -0
- package/lib/execution/builder/apiClient.d.ts.map +1 -0
- package/lib/execution/builder/apiClient.js +184 -0
- package/lib/execution/builder/apiClient.js.map +1 -0
- package/lib/execution/builder/http.d.ts +10 -7
- package/lib/execution/builder/http.d.ts.map +1 -1
- package/lib/execution/builder/http.js +11 -8
- package/lib/execution/builder/http.js.map +1 -1
- package/lib/execution/builder/validateBid.d.ts +22 -0
- package/lib/execution/builder/validateBid.d.ts.map +1 -0
- package/lib/execution/builder/validateBid.js +111 -0
- package/lib/execution/builder/validateBid.js.map +1 -0
- package/lib/metrics/metrics/beacon.d.ts +3 -3
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +9 -9
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +88 -23
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +164 -52
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +13 -0
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +37 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +10 -2
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +23 -43
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/constants.d.ts +7 -0
- package/lib/network/processor/constants.d.ts.map +1 -0
- package/lib/network/processor/constants.js +7 -0
- package/lib/network/processor/constants.js.map +1 -0
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +38 -7
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/indexed.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/indexed.js +0 -1
- package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
- package/lib/network/processor/index.d.ts +3 -0
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +41 -17
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +5 -11
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/util.d.ts +0 -1
- package/lib/network/util.d.ts.map +1 -1
- package/lib/network/util.js +0 -4
- package/lib/network/util.js.map +1 -1
- package/lib/node/deferredVoluntaryExitPublisher.d.ts +15 -0
- package/lib/node/deferredVoluntaryExitPublisher.d.ts.map +1 -0
- package/lib/node/deferredVoluntaryExitPublisher.js +38 -0
- package/lib/node/deferredVoluntaryExitPublisher.js.map +1 -0
- package/lib/node/nodejs.d.ts +2 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +7 -0
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/range/batch.d.ts +23 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +61 -22
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +2 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +23 -10
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/types.d.ts +32 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +33 -0
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +15 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +234 -63
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +16 -11
- 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 +3 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/package.json +35 -35
- package/src/api/impl/beacon/blocks/index.ts +55 -21
- package/src/api/impl/beacon/pool/index.ts +27 -2
- package/src/api/impl/beacon/state/utils.ts +2 -1
- package/src/api/impl/events/index.ts +12 -4
- package/src/api/impl/lodestar/index.ts +12 -13
- package/src/api/impl/validator/index.ts +300 -69
- package/src/api/impl/validator/utils.ts +30 -15
- package/src/api/rest/base.ts +7 -0
- package/src/chain/archiveStore/archiveStore.ts +1 -1
- package/src/chain/archiveStore/historicalState/metrics.ts +22 -0
- package/src/chain/blocks/importBlock.ts +1 -6
- package/src/chain/blocks/importExecutionPayload.ts +12 -11
- package/src/chain/blocks/index.ts +19 -7
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +8 -2
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +17 -4
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +25 -16
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -9
- package/src/chain/bls/index.ts +1 -1
- package/src/chain/bls/interface.ts +7 -3
- package/src/chain/bls/multithread/index.ts +148 -120
- package/src/chain/bls/multithread/jobItem.ts +12 -82
- package/src/chain/bls/multithread/types.ts +33 -8
- package/src/chain/bls/multithread/utils.ts +11 -0
- package/src/chain/bls/multithread/worker.ts +85 -27
- package/src/chain/bls/singleThread.ts +11 -55
- package/src/chain/bls/utils.ts +23 -24
- package/src/chain/builderCircuitBreaker.ts +31 -17
- package/src/chain/chain.ts +27 -7
- package/src/chain/errors/blockError.ts +9 -3
- package/src/chain/errors/proposerPreferences.ts +7 -0
- package/src/chain/forkChoice/index.ts +4 -0
- package/src/chain/interface.ts +8 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
- package/src/chain/opPools/attestationPool.ts +1 -1
- package/src/chain/opPools/deferredVoluntaryExitPool.ts +65 -0
- package/src/chain/opPools/executionPayloadBidPool.ts +13 -7
- package/src/chain/opPools/index.ts +2 -1
- package/src/chain/opPools/payloadAttestationPool.ts +3 -3
- package/src/chain/opPools/syncCommitteeMessagePool.ts +1 -1
- package/src/chain/opPools/syncContributionAndProofPool.ts +1 -1
- package/src/chain/opPools/utils.ts +1 -1
- package/src/chain/options.ts +1 -1
- package/src/chain/prepareNextSlot.ts +25 -7
- package/src/chain/produceBlock/computeNewStateRoot.ts +3 -38
- package/src/chain/produceBlock/produceBlockBody.ts +14 -1
- package/src/chain/regen/interface.ts +5 -2
- package/src/chain/regen/queued.ts +5 -5
- package/src/chain/seenCache/seenAttesters.ts +31 -5
- package/src/chain/seenCache/seenBlockProposers.ts +13 -3
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +143 -14
- package/src/chain/stateCache/fifoBlockStateCache.ts +8 -1
- package/src/chain/stateCache/persistentCheckpointsCache.ts +133 -8
- package/src/chain/stateCache/types.ts +3 -3
- package/src/chain/validation/attestation.ts +1 -7
- package/src/chain/validation/attesterSlashing.ts +1 -8
- package/src/chain/validation/block.ts +21 -7
- package/src/chain/validation/executionPayloadBid.ts +168 -14
- package/src/chain/validation/executionPayloadEnvelope.ts +0 -1
- package/src/chain/validation/payloadAttestationMessage.ts +6 -17
- package/src/chain/validation/proposerPreferences.ts +15 -5
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/voluntaryExit.ts +59 -2
- package/src/execution/builder/apiClient.ts +244 -0
- package/src/execution/builder/http.ts +11 -11
- package/src/execution/builder/validateBid.ts +166 -0
- package/src/metrics/metrics/beacon.ts +9 -9
- package/src/metrics/metrics/lodestar.ts +178 -58
- package/src/network/gossip/topic.ts +38 -0
- package/src/network/libp2p/index.ts +11 -2
- package/src/network/network.ts +29 -54
- package/src/network/processor/constants.ts +6 -0
- package/src/network/processor/gossipHandlers.ts +41 -5
- package/src/network/processor/gossipQueues/indexed.ts +0 -1
- package/src/network/processor/index.ts +53 -21
- package/src/network/reqresp/score.ts +5 -11
- package/src/network/util.ts +0 -5
- package/src/node/deferredVoluntaryExitPublisher.ts +54 -0
- package/src/node/nodejs.ts +10 -1
- package/src/sync/range/batch.ts +83 -28
- package/src/sync/range/chain.ts +26 -11
- package/src/sync/types.ts +36 -1
- package/src/sync/unknownBlock.ts +273 -70
- package/src/sync/utils/downloadByRange.ts +21 -12
- package/src/sync/utils/downloadByRoot.ts +3 -1
- package/lib/chain/bls/maybeBatch.d.ts +0 -12
- package/lib/chain/bls/maybeBatch.d.ts.map +0 -1
- package/lib/chain/bls/maybeBatch.js +0 -35
- package/lib/chain/bls/maybeBatch.js.map +0 -1
- package/src/chain/bls/maybeBatch.ts +0 -45
|
@@ -134,6 +134,8 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
134
134
|
stateRoot: toRootHex(blockHeader.stateRoot),
|
|
135
135
|
blockRoot: toRootHex(checkpoint.root),
|
|
136
136
|
timeliness: true, // Optimistically assume is timely
|
|
137
|
+
ptcTimeliness: true, // Spec: block_timeliness for anchor = [True, True]
|
|
138
|
+
proposerIndex: blockHeader.proposerIndex,
|
|
137
139
|
|
|
138
140
|
justifiedEpoch: justifiedCheckpoint.epoch,
|
|
139
141
|
justifiedRoot: toRootHex(justifiedCheckpoint.root),
|
|
@@ -230,6 +232,8 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
230
232
|
blockRoot: headRoot,
|
|
231
233
|
targetRoot: headRoot,
|
|
232
234
|
timeliness: true, // Optimistically assume is timely
|
|
235
|
+
ptcTimeliness: true, // Spec: block_timeliness for anchor = [True, True]
|
|
236
|
+
proposerIndex: blockHeader.proposerIndex,
|
|
233
237
|
|
|
234
238
|
justifiedEpoch: justifiedCheckpoint.epoch,
|
|
235
239
|
justifiedRoot: toRootHex(justifiedCheckpoint.root),
|
package/src/chain/interface.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
1
2
|
import {Type} from "@chainsafe/ssz";
|
|
2
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
4
|
import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
4
|
-
import {EpochShuffling, IBeaconStateView
|
|
5
|
+
import {EpochShuffling, IBeaconStateView} from "@lodestar/state-transition";
|
|
5
6
|
import {
|
|
6
7
|
BeaconBlock,
|
|
7
8
|
BlindedBeaconBlock,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
rewards,
|
|
24
25
|
} from "@lodestar/types";
|
|
25
26
|
import {Logger} from "@lodestar/utils";
|
|
27
|
+
import {BuilderApiClient} from "../execution/builder/apiClient.js";
|
|
26
28
|
import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
|
|
27
29
|
import {Metrics} from "../metrics/metrics.js";
|
|
28
30
|
import {BufferPool} from "../util/bufferPool.js";
|
|
@@ -44,6 +46,7 @@ import {LightClientServer} from "./lightClient/index.js";
|
|
|
44
46
|
import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js";
|
|
45
47
|
import {
|
|
46
48
|
AttestationPool,
|
|
49
|
+
DeferredVoluntaryExitPool,
|
|
47
50
|
ExecutionPayloadBidPool,
|
|
48
51
|
OpPool,
|
|
49
52
|
PayloadAttestationPool,
|
|
@@ -97,6 +100,7 @@ export interface IBeaconChain {
|
|
|
97
100
|
readonly executionEngine: IExecutionEngine;
|
|
98
101
|
readonly executionBuilder?: IExecutionBuilder;
|
|
99
102
|
readonly builderCircuitBreaker: BuilderCircuitBreaker;
|
|
103
|
+
readonly builderApiClient: BuilderApiClient;
|
|
100
104
|
// Expose config for convenience in modularized functions
|
|
101
105
|
readonly config: BeaconConfig;
|
|
102
106
|
readonly custodyConfig: CustodyConfig;
|
|
@@ -127,6 +131,7 @@ export interface IBeaconChain {
|
|
|
127
131
|
readonly payloadAttestationPool: PayloadAttestationPool;
|
|
128
132
|
readonly proposerPreferencesPool: ProposerPreferencesPool;
|
|
129
133
|
readonly opPool: OpPool;
|
|
134
|
+
readonly deferredVoluntaryExitPool: DeferredVoluntaryExitPool;
|
|
130
135
|
|
|
131
136
|
// Gossip seen cache
|
|
132
137
|
readonly seenAttesters: SeenAttesters;
|
|
@@ -269,8 +274,8 @@ export interface IBeaconChain {
|
|
|
269
274
|
|
|
270
275
|
recomputeForkChoiceHead(caller: ForkchoiceCaller): ProtoBlock;
|
|
271
276
|
|
|
272
|
-
/** When proposerBoostReorg is enabled,
|
|
273
|
-
predictProposerHead(
|
|
277
|
+
/** When proposerBoostReorg is enabled, predict (as of the current slot) the head block a proposer would build on next slot */
|
|
278
|
+
predictProposerHead(): ProtoBlock;
|
|
274
279
|
|
|
275
280
|
/** When proposerBoostReorg is enabled and we are proposing a block, this is called to determine which head block to build on */
|
|
276
281
|
getProposerHead(slot: Slot): ProtoBlock;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
4
|
import {IForkChoice} from "@lodestar/fork-choice";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {MAX_COMMITTEES_PER_SLOT, isForkPostElectra} from "@lodestar/params";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {Logger} from "@lodestar/logger";
|
|
2
|
+
import {IBeaconStateView, VoluntaryExitValidity} from "@lodestar/state-transition";
|
|
3
|
+
import {Epoch, ValidatorIndex} from "@lodestar/types";
|
|
4
|
+
import {SignedVoluntaryExit} from "@lodestar/types/phase0";
|
|
5
|
+
import {isTransientExitValidity} from "../validation/voluntaryExit.js";
|
|
6
|
+
|
|
7
|
+
type DeferredEntry = {
|
|
8
|
+
exit: SignedVoluntaryExit;
|
|
9
|
+
validity: VoluntaryExitValidity;
|
|
10
|
+
insertedAtEpoch: Epoch;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class DeferredVoluntaryExitPool {
|
|
14
|
+
private pool = new Map<ValidatorIndex, DeferredEntry>();
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
private readonly logger: Logger,
|
|
18
|
+
private readonly maxSize = 1024,
|
|
19
|
+
private readonly maxDeferEpochs = 4096
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
insert(exit: SignedVoluntaryExit, validity: VoluntaryExitValidity, currentEpoch: Epoch): boolean {
|
|
23
|
+
if (!isTransientExitValidity(validity)) return false;
|
|
24
|
+
if (this.pool.size === this.maxSize) return false;
|
|
25
|
+
if (this.pool.has(exit.message.validatorIndex)) return false;
|
|
26
|
+
|
|
27
|
+
this.pool.set(exit.message.validatorIndex, {exit, validity, insertedAtEpoch: currentEpoch});
|
|
28
|
+
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
drainProcessableExits(state: IBeaconStateView): SignedVoluntaryExit[] {
|
|
33
|
+
const epoch = state.epoch;
|
|
34
|
+
const validExits: SignedVoluntaryExit[] = [];
|
|
35
|
+
for (const [validatorIndex, entry] of this.pool) {
|
|
36
|
+
try {
|
|
37
|
+
if (epoch - entry.insertedAtEpoch > this.maxDeferEpochs) {
|
|
38
|
+
this.pool.delete(validatorIndex);
|
|
39
|
+
this.logger.debug("Deferred voluntary exit expired", {validatorIndex, lastValidity: entry.validity});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const validity = state.getVoluntaryExitValidity(entry.exit, true);
|
|
43
|
+
if (validity === VoluntaryExitValidity.valid) {
|
|
44
|
+
validExits.push(entry.exit);
|
|
45
|
+
this.pool.delete(validatorIndex);
|
|
46
|
+
} else if (!isTransientExitValidity(validity)) {
|
|
47
|
+
this.logger.debug("Deferred voluntary exit became permanently invalid", {validatorIndex, validity});
|
|
48
|
+
this.pool.delete(validatorIndex);
|
|
49
|
+
}
|
|
50
|
+
// Else if still transient - keep
|
|
51
|
+
} catch (e) {
|
|
52
|
+
this.logger.debug("Processing deferred voluntary exit failed", {validatorIndex}, e as Error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return validExits;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
has(validatorIndex: ValidatorIndex): boolean {
|
|
59
|
+
return this.pool.has(validatorIndex);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
size(): number {
|
|
63
|
+
return this.pool.size;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -11,14 +11,20 @@ const SLOTS_RETAINED = 2;
|
|
|
11
11
|
type BlockRootHex = string;
|
|
12
12
|
type BlockHashHex = string;
|
|
13
13
|
|
|
14
|
+
export type PooledExecutionPayloadBid = {
|
|
15
|
+
signedBid: gloas.SignedExecutionPayloadBid;
|
|
16
|
+
/** Time in milliseconds from the slot start when the bid was received */
|
|
17
|
+
receivedMs: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* Store the best signed execution payload bid per slot / (parent block root, parent block hash).
|
|
16
22
|
*/
|
|
17
23
|
export class ExecutionPayloadBidPool {
|
|
18
24
|
private readonly bidByParentHashByParentRootBySlot = new MapDef<
|
|
19
25
|
Slot,
|
|
20
|
-
MapDef<BlockRootHex, Map<BlockHashHex,
|
|
21
|
-
>(() => new MapDef<BlockRootHex, Map<BlockHashHex,
|
|
26
|
+
MapDef<BlockRootHex, Map<BlockHashHex, PooledExecutionPayloadBid>>
|
|
27
|
+
>(() => new MapDef<BlockRootHex, Map<BlockHashHex, PooledExecutionPayloadBid>>(() => new Map()));
|
|
22
28
|
private lowestPermissibleSlot = 0;
|
|
23
29
|
|
|
24
30
|
get size(): number {
|
|
@@ -31,7 +37,7 @@ export class ExecutionPayloadBidPool {
|
|
|
31
37
|
return count;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
add(bid: gloas.SignedExecutionPayloadBid): InsertOutcome {
|
|
40
|
+
add(bid: gloas.SignedExecutionPayloadBid, receivedMs: number): InsertOutcome {
|
|
35
41
|
const {slot, parentBlockRoot, parentBlockHash, value} = bid.message;
|
|
36
42
|
const lowestPermissibleSlot = this.lowestPermissibleSlot;
|
|
37
43
|
|
|
@@ -45,16 +51,16 @@ export class ExecutionPayloadBidPool {
|
|
|
45
51
|
const existing = bidByParentHash.get(parentHashHex);
|
|
46
52
|
|
|
47
53
|
if (existing) {
|
|
48
|
-
const existingValue = existing.message.value;
|
|
54
|
+
const existingValue = existing.signedBid.message.value;
|
|
49
55
|
const newValue = value;
|
|
50
56
|
if (newValue > existingValue) {
|
|
51
|
-
bidByParentHash.set(parentHashHex, bid);
|
|
57
|
+
bidByParentHash.set(parentHashHex, {signedBid: bid, receivedMs});
|
|
52
58
|
return InsertOutcome.NewData;
|
|
53
59
|
}
|
|
54
60
|
return newValue === existingValue ? InsertOutcome.AlreadyKnown : InsertOutcome.NotBetterThan;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
bidByParentHash.set(parentHashHex, bid);
|
|
63
|
+
bidByParentHash.set(parentHashHex, {signedBid: bid, receivedMs});
|
|
58
64
|
return InsertOutcome.NewData;
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -66,7 +72,7 @@ export class ExecutionPayloadBidPool {
|
|
|
66
72
|
slot: Slot,
|
|
67
73
|
parentBlockHash: BlockHashHex | null,
|
|
68
74
|
parentBlockRoot: BlockRootHex
|
|
69
|
-
):
|
|
75
|
+
): PooledExecutionPayloadBid | null {
|
|
70
76
|
if (parentBlockHash === null) return null;
|
|
71
77
|
const bidByParentHash = this.bidByParentHashByParentRootBySlot.get(slot)?.get(parentBlockRoot);
|
|
72
78
|
return bidByParentHash?.get(parentBlockHash) ?? null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export {AggregatedAttestationPool} from "./aggregatedAttestationPool.js";
|
|
2
2
|
export {AttestationPool} from "./attestationPool.js";
|
|
3
|
-
export {
|
|
3
|
+
export {DeferredVoluntaryExitPool} from "./deferredVoluntaryExitPool.js";
|
|
4
|
+
export {ExecutionPayloadBidPool, type PooledExecutionPayloadBid} from "./executionPayloadBidPool.js";
|
|
4
5
|
export {OpPool} from "./opPool.js";
|
|
5
6
|
export {PayloadAttestationPool} from "./payloadAttestationPool.js";
|
|
6
7
|
export {ProposerPreferencesPool} from "./proposerPreferencesPool.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {MAX_COMMITTEES_PER_SLOT, MAX_PAYLOAD_ATTESTATIONS, PTC_SIZE} from "@lodestar/params";
|
|
@@ -178,8 +178,8 @@ function aggregateMessageInto(
|
|
|
178
178
|
validatorCommitteeIndices: number[],
|
|
179
179
|
aggregate: AggregateFast
|
|
180
180
|
): InsertOutcome {
|
|
181
|
-
// Gossip dedup via `seenPayloadAttesters` is keyed by (
|
|
182
|
-
// validator's message is never processed twice
|
|
181
|
+
// Gossip dedup via `seenPayloadAttesters` is keyed by (slot, validatorIndex), so the same
|
|
182
|
+
// validator's message is never processed twice for this aggregate's slot. All of its bits are set together or none.
|
|
183
183
|
// Checking the first index is sufficient.
|
|
184
184
|
if (aggregate.aggregationBits.get(validatorCommitteeIndices[0]) === true) {
|
|
185
185
|
return InsertOutcome.AlreadyKnown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BitArray} from "@chainsafe/ssz";
|
|
3
3
|
import {ChainForkConfig} from "@lodestar/config";
|
|
4
4
|
import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params";
|
package/src/chain/options.ts
CHANGED
|
@@ -53,7 +53,7 @@ export type IChainOptions = BlockProcessOpts &
|
|
|
53
53
|
nativeStateView?: boolean;
|
|
54
54
|
/** Builder circuit breaker fault inspection window in slots */
|
|
55
55
|
faultInspectionWindow?: number;
|
|
56
|
-
/**
|
|
56
|
+
/** Canonical EMPTY blocks allowed per `faultInspectionWindow` observed blocks */
|
|
57
57
|
allowedFaults?: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -151,25 +151,40 @@ export class PrepareNextSlotScheduler {
|
|
|
151
151
|
const proposerIndex = await getProposerIndex();
|
|
152
152
|
feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
// Predict the proposer head of the next slot when either:
|
|
155
|
+
// - we are proposing the next slot (single-slot proposer-boost-reorg), or
|
|
156
|
+
// - this is an epoch transition: post-Fulu the next proposer may reorg a weak
|
|
157
|
+
// last-block-of-epoch and build slot 0 on the strong parent (epoch-boundary reorg),
|
|
158
|
+
// so we should dial the strong parent through the boundary instead of the weak head.
|
|
159
|
+
if (feeRecipient || isEpochTransition) {
|
|
160
|
+
const proposerHead = this.chain.predictProposerHead();
|
|
157
161
|
const {slot: proposerHeadSlot, blockRoot: proposerHeadRoot} = proposerHead;
|
|
158
162
|
|
|
159
|
-
// If we predict
|
|
163
|
+
// If we predict a reorg, we build the epoch transition on the proposer head (parent) instead
|
|
160
164
|
if (proposerHeadRoot !== headRoot || proposerHeadSlot !== headSlot) {
|
|
161
|
-
|
|
165
|
+
// feeRecipient set => WE propose the next slot and may reorg it out ourselves;
|
|
166
|
+
// otherwise it's a predicted reorg by another proposer (epoch-boundary reorg).
|
|
167
|
+
const logMessage = feeRecipient
|
|
168
|
+
? "Weak head detected. We may build on parent block instead"
|
|
169
|
+
: "Weak head detected. Another proposer may build on parent block instead";
|
|
170
|
+
this.logger.verbose(logMessage, {
|
|
162
171
|
proposerHeadSlot,
|
|
163
172
|
proposerHeadRoot,
|
|
164
173
|
headSlot,
|
|
165
174
|
headRoot,
|
|
175
|
+
isEpochTransition,
|
|
166
176
|
});
|
|
167
177
|
this.metrics?.weakHeadDetected.inc();
|
|
178
|
+
if (isEpochTransition) {
|
|
179
|
+
this.metrics?.precomputeNextEpochTransition.predictedReorg.inc();
|
|
180
|
+
}
|
|
168
181
|
updatedHead = proposerHead;
|
|
169
182
|
}
|
|
183
|
+
}
|
|
170
184
|
|
|
185
|
+
if (feeRecipient) {
|
|
171
186
|
if (isForkPostGloas(fork)) {
|
|
172
|
-
this.chain.builderCircuitBreaker.update(clockSlot);
|
|
187
|
+
this.chain.builderCircuitBreaker.update(clockSlot, updatedHead);
|
|
173
188
|
} else {
|
|
174
189
|
// Update the builder status, if enabled shoot an api call to check status
|
|
175
190
|
this.chain.updateBuilderStatus(clockSlot);
|
|
@@ -182,6 +197,7 @@ export class PrepareNextSlotScheduler {
|
|
|
182
197
|
}
|
|
183
198
|
|
|
184
199
|
// post-fulu we'll always reach here because preparedState is undefined
|
|
200
|
+
// we may run epoch transition not with headBlock if it's weak
|
|
185
201
|
if (preparedState === undefined || updatedHead !== headBlock) {
|
|
186
202
|
preparedState = await this.chain.regen.getBlockSlotState(
|
|
187
203
|
updatedHead,
|
|
@@ -280,7 +296,7 @@ export class PrepareNextSlotScheduler {
|
|
|
280
296
|
// + if next slot is a skipped slot, it'd help getting target checkpoint state faster to validate attestations
|
|
281
297
|
if (isEpochTransition) {
|
|
282
298
|
this.metrics?.precomputeNextEpochTransition.count.inc({result: "success"}, 1);
|
|
283
|
-
const previousHits = this.chain.regen.updatePreComputedCheckpoint(
|
|
299
|
+
const previousHits = this.chain.regen.updatePreComputedCheckpoint(updatedHead.blockRoot, nextEpoch);
|
|
284
300
|
if (previousHits === 0) {
|
|
285
301
|
this.metrics?.precomputeNextEpochTransition.waste.inc();
|
|
286
302
|
}
|
|
@@ -289,6 +305,8 @@ export class PrepareNextSlotScheduler {
|
|
|
289
305
|
this.logger.verbose("Completed PrepareNextSlotScheduler epoch transition", {
|
|
290
306
|
nextEpoch,
|
|
291
307
|
headSlot,
|
|
308
|
+
headRoot,
|
|
309
|
+
updatedHeadRoot: updatedHead.blockRoot,
|
|
292
310
|
prepareSlot,
|
|
293
311
|
previousHits,
|
|
294
312
|
durationMs: Date.now() - start,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataAvailabilityStatus,
|
|
3
|
-
ExecutionPayloadStatus,
|
|
4
|
-
IBeaconStateView,
|
|
5
|
-
StateHashTreeRootSource,
|
|
6
|
-
} from "@lodestar/state-transition";
|
|
1
|
+
import {EMPTY_SIGNATURE, IBeaconStateView} from "@lodestar/state-transition";
|
|
7
2
|
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
|
|
8
|
-
import {ZERO_HASH} from "../../constants/index.js";
|
|
9
3
|
import {Metrics} from "../../metrics/index.js";
|
|
10
4
|
|
|
11
5
|
/**
|
|
@@ -19,35 +13,6 @@ export function computeNewStateRoot(
|
|
|
19
13
|
block: BeaconBlock | BlindedBeaconBlock
|
|
20
14
|
): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
|
|
21
15
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const postState = state.stateTransition(
|
|
25
|
-
blockEmptySig,
|
|
26
|
-
{
|
|
27
|
-
// ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL
|
|
28
|
-
executionPayloadStatus: ExecutionPayloadStatus.valid,
|
|
29
|
-
// DataAvailabilityStatus.available: Assume the blobs to be available, have just been produced by trusted EL
|
|
30
|
-
dataAvailabilityStatus: DataAvailabilityStatus.Available,
|
|
31
|
-
// verifyStateRoot: false | the root in the block is zero-ed, it's being computed here
|
|
32
|
-
verifyStateRoot: false,
|
|
33
|
-
// verifyProposer: false | as the block signature is zero-ed
|
|
34
|
-
verifyProposer: false,
|
|
35
|
-
// verifySignatures: false | since the data to assemble the block is trusted
|
|
36
|
-
verifySignatures: false,
|
|
37
|
-
// Preserve cache in source state, since the resulting state is not added to the state cache
|
|
38
|
-
dontTransferCache: true,
|
|
39
|
-
},
|
|
40
|
-
{metrics}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const {attestations, syncAggregate, slashing} = postState.proposerRewards;
|
|
44
|
-
const proposerReward = BigInt(attestations + syncAggregate + slashing);
|
|
45
|
-
|
|
46
|
-
const hashTreeRootTimer = metrics?.stateHashTreeRootTime.startTimer({
|
|
47
|
-
source: StateHashTreeRootSource.computeNewStateRoot,
|
|
48
|
-
});
|
|
49
|
-
const newStateRoot = postState.hashTreeRoot();
|
|
50
|
-
hashTreeRootTimer?.();
|
|
51
|
-
|
|
52
|
-
return {newStateRoot, proposerReward, postState};
|
|
16
|
+
const signedBlock = {message: block, signature: EMPTY_SIGNATURE};
|
|
17
|
+
return state.computeNewStateRoot({block: signedBlock}, {metrics});
|
|
53
18
|
}
|
|
@@ -100,6 +100,8 @@ export type BlockAttributes = {
|
|
|
100
100
|
slot: Slot;
|
|
101
101
|
parentBlock: ProtoBlock;
|
|
102
102
|
feeRecipient?: string;
|
|
103
|
+
/** Verify that a locally produced execution payload uses `feeRecipient`. */
|
|
104
|
+
strictFeeRecipientCheck?: boolean;
|
|
103
105
|
/** When provided, build block with this builder bid instead of a self-build bid */
|
|
104
106
|
builderBid?: gloas.SignedExecutionPayloadBid;
|
|
105
107
|
};
|
|
@@ -201,6 +203,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
201
203
|
const {
|
|
202
204
|
slot: blockSlot,
|
|
203
205
|
feeRecipient: requestedFeeRecipient,
|
|
206
|
+
strictFeeRecipientCheck,
|
|
204
207
|
parentBlock,
|
|
205
208
|
proposerIndex,
|
|
206
209
|
proposerPubKey,
|
|
@@ -238,7 +241,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
238
241
|
const parentExecutionRequests = isExtendingPayload
|
|
239
242
|
? await this.getParentExecutionRequests(parentBlock.slot, parentBlock.blockRoot)
|
|
240
243
|
: ssz.gloas.ExecutionRequests.defaultValue();
|
|
241
|
-
executionPayloadValue = BigInt(builderBid.message.value) * GWEI_TO_WEI;
|
|
244
|
+
executionPayloadValue = (BigInt(builderBid.message.value) + builderBid.message.executionPayment) * GWEI_TO_WEI;
|
|
242
245
|
|
|
243
246
|
const commonBlockBody = await commonBlockBodyPromise;
|
|
244
247
|
const gloasBody = Object.assign({}, commonBlockBody) as gloas.BeaconBlockBody;
|
|
@@ -334,6 +337,16 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
334
337
|
executionPayloadValue = payloadRes.executionPayloadValue;
|
|
335
338
|
shouldOverrideBuilder = payloadRes.shouldOverrideBuilder;
|
|
336
339
|
|
|
340
|
+
if (
|
|
341
|
+
strictFeeRecipientCheck &&
|
|
342
|
+
requestedFeeRecipient &&
|
|
343
|
+
!byteArrayEquals(executionPayload.feeRecipient, fromHex(requestedFeeRecipient))
|
|
344
|
+
) {
|
|
345
|
+
throw Error(
|
|
346
|
+
`Invalid feeRecipient set in engine payload expected=${requestedFeeRecipient} actual=${toHex(executionPayload.feeRecipient)}`
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
337
350
|
if (blobsBundle === undefined) {
|
|
338
351
|
throw Error(`Missing blobsBundle response from getPayload at fork=${fork}`);
|
|
339
352
|
}
|
|
@@ -21,7 +21,10 @@ export enum RegenCaller {
|
|
|
21
21
|
validateGossipAggregateAndProof = "validateGossipAggregateAndProof",
|
|
22
22
|
validateGossipAttestation = "validateGossipAttestation",
|
|
23
23
|
validateGossipVoluntaryExit = "validateGossipVoluntaryExit",
|
|
24
|
+
validateApiVoluntaryExit = "validateApiVoluntaryExit",
|
|
25
|
+
publishDeferredVoluntaryExits = "publishDeferredVoluntaryExits",
|
|
24
26
|
validateGossipExecutionPayloadBid = "validateGossipExecutionPayloadBid",
|
|
27
|
+
validateApiExecutionPayloadBid = "validateApiExecutionPayloadBid",
|
|
25
28
|
validateGossipPayloadAttestationMessage = "validateGossipPayloadAttestationMessage",
|
|
26
29
|
validateGossipProposerPreferences = "validateGossipProposerPreferences",
|
|
27
30
|
onForkChoiceFinalized = "onForkChoiceFinalized",
|
|
@@ -39,14 +42,14 @@ export type StateRegenerationOpts = {
|
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
export interface IStateRegenerator extends IStateRegeneratorInternal {
|
|
42
|
-
dropCache(): void
|
|
45
|
+
dropCache(): Promise<void>;
|
|
43
46
|
dumpCacheSummary(): routes.lodestar.StateCacheItem[];
|
|
44
47
|
getStateSync(stateRoot: RootHex): IBeaconStateView | null;
|
|
45
48
|
getPreStateSync(block: BeaconBlock): IBeaconStateView | null;
|
|
46
49
|
getCheckpointStateOrBytes(cp: CheckpointHex): Promise<IBeaconStateView | Uint8Array | null>;
|
|
47
50
|
getCheckpointStateSync(cp: CheckpointHex): IBeaconStateView | null;
|
|
48
51
|
getClosestHeadState(head: ProtoBlock): IBeaconStateView | null;
|
|
49
|
-
|
|
52
|
+
onCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void;
|
|
50
53
|
processState(blockRootHex: RootHex, postState: IBeaconStateView): void;
|
|
51
54
|
addCheckpointState(cp: phase0.Checkpoint, item: IBeaconStateView): void;
|
|
52
55
|
updateHeadState(newHead: ProtoBlock, maybeHeadState: IBeaconStateView): void;
|
|
@@ -67,9 +67,9 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
67
67
|
return this.jobQueue.jobLen < REGEN_CAN_ACCEPT_WORK_THRESHOLD;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
dropCache(): void {
|
|
70
|
+
async dropCache(): Promise<void> {
|
|
71
71
|
this.blockStateCache.clear();
|
|
72
|
-
this.checkpointStateCache.clear();
|
|
72
|
+
await this.checkpointStateCache.clear();
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
dumpCacheSummary(): routes.lodestar.StateCacheItem[] {
|
|
@@ -138,9 +138,9 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
138
138
|
return this.checkpointStateCache.getLatest(head.blockRoot, Infinity) || this.blockStateCache.get(head.stateRoot);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
this.checkpointStateCache.
|
|
143
|
-
this.blockStateCache.
|
|
141
|
+
onCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void {
|
|
142
|
+
this.checkpointStateCache.onCheckpoint(finalizedEpoch, justifiedEpoch);
|
|
143
|
+
this.blockStateCache.onCheckpoint(headStateRoot);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
processState(blockRootHex: RootHex, postState: IBeaconStateView): void {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
2
|
+
import {Epoch, Slot, ValidatorIndex} from "@lodestar/types";
|
|
2
3
|
import {MapDef} from "@lodestar/utils";
|
|
3
4
|
|
|
4
5
|
// How many *non future* epochs we intend to keep for SeenAttesters.
|
|
@@ -57,7 +58,32 @@ export class SeenAttesters {
|
|
|
57
58
|
*/
|
|
58
59
|
export class SeenAggregators extends SeenAttesters {}
|
|
59
60
|
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
/** Keeps a cache to filter payload attestations from the same validator in the same slot. */
|
|
62
|
+
export class SeenPayloadAttesters {
|
|
63
|
+
private readonly validatorIndexesBySlot = new MapDef<Slot, Set<ValidatorIndex>>(() => new Set<ValidatorIndex>());
|
|
64
|
+
private readonly validatorIndexesByEpoch = new SeenAttesters();
|
|
65
|
+
|
|
66
|
+
isKnown(slot: Slot, validatorIndex: ValidatorIndex): boolean {
|
|
67
|
+
return this.validatorIndexesBySlot.get(slot)?.has(validatorIndex) === true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
add(slot: Slot, validatorIndex: ValidatorIndex): void {
|
|
71
|
+
const epoch = computeEpochAtSlot(slot);
|
|
72
|
+
this.validatorIndexesByEpoch.add(epoch, validatorIndex);
|
|
73
|
+
this.validatorIndexesBySlot.getOrDefault(slot).add(validatorIndex);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
seenAtEpoch(epoch: Epoch, validatorIndex: ValidatorIndex): boolean {
|
|
77
|
+
return this.validatorIndexesByEpoch.isKnown(epoch, validatorIndex);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
prune(currentEpoch: Epoch): void {
|
|
81
|
+
const lowestPermissibleEpoch = Math.max(currentEpoch - EPOCH_LOOKBACK_LIMIT, 0);
|
|
82
|
+
for (const slot of this.validatorIndexesBySlot.keys()) {
|
|
83
|
+
if (computeEpochAtSlot(slot) < lowestPermissibleEpoch) {
|
|
84
|
+
this.validatorIndexesBySlot.delete(slot);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
this.validatorIndexesByEpoch.prune(currentEpoch);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -19,7 +19,9 @@ const MIN_EQUIVOCATION_BLOCK_ROOTS_PER_PROPOSAL = 2;
|
|
|
19
19
|
* The cache is pruned on finalization and bounds the number of roots stored per proposer and slot
|
|
20
20
|
*/
|
|
21
21
|
export class SeenBlockProposers {
|
|
22
|
-
private readonly proposerIndexesBySlot = new MapDef<Slot,
|
|
22
|
+
private readonly proposerIndexesBySlot = new MapDef<Slot, Map<ValidatorIndex, RootHex>>(
|
|
23
|
+
() => new Map<ValidatorIndex, RootHex>()
|
|
24
|
+
);
|
|
23
25
|
private readonly signedBlockHeadersBySlot = new MapDef<
|
|
24
26
|
Slot,
|
|
25
27
|
MapDef<ValidatorIndex, Map<RootHex, phase0.SignedBeaconBlockHeader>>
|
|
@@ -30,6 +32,14 @@ export class SeenBlockProposers {
|
|
|
30
32
|
return this.proposerIndexesBySlot.get(blockSlot)?.has(proposerIndex) === true;
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The block proposer is known at slot with a different root.
|
|
37
|
+
*/
|
|
38
|
+
isRepeatProposal(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): boolean {
|
|
39
|
+
const knownRoot = this.proposerIndexesBySlot.get(blockSlot)?.get(proposerIndex);
|
|
40
|
+
return knownRoot !== undefined && knownRoot !== blockRoot;
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
hasBlockRoot(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): boolean {
|
|
34
44
|
return this.signedBlockHeadersBySlot.get(blockSlot)?.get(proposerIndex)?.has(blockRoot) === true;
|
|
35
45
|
}
|
|
@@ -85,12 +95,12 @@ export class SeenBlockProposers {
|
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
/** Mark a block as known from gossip or another block import path */
|
|
88
|
-
add(blockSlot: Slot, proposerIndex: ValidatorIndex): void {
|
|
98
|
+
add(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): void {
|
|
89
99
|
if (blockSlot < this.finalizedSlot) {
|
|
90
100
|
throw Error(`blockSlot ${blockSlot} < finalizedSlot ${this.finalizedSlot}`);
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
this.proposerIndexesBySlot.getOrDefault(blockSlot).
|
|
103
|
+
this.proposerIndexesBySlot.getOrDefault(blockSlot).set(proposerIndex, blockRoot);
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
prune(finalizedSlot: Slot): void {
|