@lodestar/beacon-node 1.39.1 → 1.40.0-dev.193b2e2047
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 +8 -18
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -7
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +0 -12
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/config/constants.d.ts +3 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +5 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +3 -6
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +6 -3
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/proof/index.d.ts.map +1 -1
- package/lib/api/impl/proof/index.js +1 -2
- package/lib/api/impl/proof/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +10 -11
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -3
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +23 -14
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +2 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +6 -0
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -9
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +0 -14
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +0 -2
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +9 -9
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +2 -2
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +1 -0
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts +1 -4
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +20 -28
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +3 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +5 -3
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +2 -2
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -2
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +4 -2
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +2 -2
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +9 -6
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +24 -6
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +196 -21
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/attestationError.d.ts +14 -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 +48 -0
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -0
- package/lib/chain/errors/executionPayloadBid.js +15 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js +16 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -0
- package/lib/chain/errors/index.d.ts +3 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +3 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.d.ts +34 -0
- package/lib/chain/errors/payloadAttestation.d.ts.map +1 -0
- package/lib/chain/errors/payloadAttestation.js +13 -0
- package/lib/chain/errors/payloadAttestation.js.map +1 -0
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +18 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +1 -1
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +5 -3
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +23 -5
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/proofs.d.ts.map +1 -1
- package/lib/chain/lightClient/proofs.js +0 -2
- package/lib/chain/lightClient/proofs.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +5 -9
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +12 -141
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +21 -0
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -0
- package/lib/chain/opPools/executionPayloadBidPool.js +57 -0
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -0
- package/lib/chain/opPools/index.d.ts +2 -0
- package/lib/chain/opPools/index.d.ts.map +1 -1
- package/lib/chain/opPools/index.js +2 -0
- package/lib/chain/opPools/index.js.map +1 -1
- package/lib/chain/opPools/opPool.js +5 -8
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/payloadAttestationPool.d.ts +24 -0
- package/lib/chain/opPools/payloadAttestationPool.d.ts.map +1 -0
- package/lib/chain/opPools/payloadAttestationPool.js +109 -0
- package/lib/chain/opPools/payloadAttestationPool.js.map +1 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +9 -10
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +6 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +4 -13
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/interface.js +1 -1
- package/lib/chain/regen/interface.js.map +1 -1
- package/lib/chain/regen/queued.d.ts +5 -9
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +16 -40
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +4 -8
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +16 -33
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +3 -1
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +3 -1
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenAttesters.d.ts +5 -0
- package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
- package/lib/chain/seenCache/seenAttesters.js +5 -0
- package/lib/chain/seenCache/seenAttesters.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +12 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +30 -0
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts +15 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js +28 -0
- package/lib/chain/seenCache/seenExecutionPayloadEnvelope.js.map +1 -0
- package/lib/chain/shufflingCache.d.ts +16 -11
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +47 -41
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts +1 -2
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +1 -1
- package/lib/chain/stateCache/blockStateCacheImpl.js +2 -2
- package/lib/chain/stateCache/blockStateCacheImpl.js.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -2
- package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
- package/lib/chain/stateCache/fifoBlockStateCache.js +4 -4
- package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +4 -5
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js +9 -10
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +5 -6
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +17 -17
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/stateCache/types.d.ts +5 -6
- package/lib/chain/stateCache/types.d.ts.map +1 -1
- package/lib/chain/stateCache/types.js.map +1 -1
- package/lib/chain/validation/aggregateAndProof.js +35 -14
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts +2 -2
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +28 -9
- 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 +2 -2
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/blobSidecar.d.ts.map +1 -1
- package/lib/chain/validation/blobSidecar.js +3 -3
- package/lib/chain/validation/blobSidecar.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +7 -4
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.d.ts.map +1 -1
- package/lib/chain/validation/blsToExecutionChange.js +9 -2
- package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +3 -3
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +5 -0
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -0
- package/lib/chain/validation/executionPayloadBid.js +104 -0
- package/lib/chain/validation/executionPayloadBid.js.map +1 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts +5 -0
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/chain/validation/executionPayloadEnvelope.js +89 -0
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -0
- package/lib/chain/validation/payloadAttestationMessage.d.ts +9 -0
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -0
- package/lib/chain/validation/payloadAttestationMessage.js +72 -0
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -0
- package/lib/chain/validation/proposerSlashing.js +3 -2
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts +2 -3
- package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.js +8 -3
- package/lib/chain/validation/signatureSets/aggregateAndProof.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 +3 -3
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/selectionProof.d.ts +2 -3
- package/lib/chain/validation/signatureSets/selectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/selectionProof.js +8 -3
- package/lib/chain/validation/signatureSets/selectionProof.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 +3 -3
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +1 -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 +3 -3
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.js +1 -1
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -5
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +1 -1
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +2 -0
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +42 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/repositories/checkpointState.d.ts +2 -6
- package/lib/db/repositories/checkpointState.d.ts.map +1 -1
- package/lib/db/repositories/checkpointState.js +3 -16
- package/lib/db/repositories/checkpointState.js.map +1 -1
- package/lib/db/repositories/stateArchive.d.ts +9 -9
- package/lib/db/repositories/stateArchive.d.ts.map +1 -1
- package/lib/db/repositories/stateArchive.js +6 -21
- package/lib/db/repositories/stateArchive.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +9 -6
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +34 -7
- package/lib/execution/engine/mock.js.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/lodestar.d.ts +28 -6
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +67 -17
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +20 -2
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/interface.js +3 -0
- package/lib/network/gossip/interface.js.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +38 -2
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +77 -1
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +20 -0
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +34 -3
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
- package/lib/network/processor/gossipQueues/index.js +16 -0
- package/lib/network/processor/gossipQueues/index.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +3 -0
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -4
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts +1 -2
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +5 -26
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts +1 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +5 -7
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -5
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.js +2 -2
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +17 -2
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/backfill/backfill.js +2 -2
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/backfill/verify.d.ts +1 -2
- package/lib/sync/backfill/verify.d.ts.map +1 -1
- package/lib/sync/backfill/verify.js +2 -2
- package/lib/sync/backfill/verify.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +0 -1
- 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 +0 -3
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +0 -3
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +8 -18
- package/src/api/impl/beacon/state/utils.ts +2 -22
- package/src/api/impl/config/constants.ts +8 -0
- package/src/api/impl/debug/index.ts +2 -6
- package/src/api/impl/lodestar/index.ts +7 -4
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +13 -14
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -3
- package/src/chain/archiveStore/utils/archiveBlocks.ts +25 -14
- package/src/chain/blocks/blockInput/blockInput.ts +8 -0
- package/src/chain/blocks/importBlock.ts +15 -9
- package/src/chain/blocks/index.ts +0 -19
- package/src/chain/blocks/types.ts +0 -2
- package/src/chain/blocks/verifyBlock.ts +9 -12
- package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
- package/src/chain/blocks/writeBlockInputToDb.ts +24 -30
- package/src/chain/bls/multithread/index.ts +7 -4
- package/src/chain/bls/multithread/jobItem.ts +7 -3
- package/src/chain/bls/singleThread.ts +5 -3
- package/src/chain/bls/utils.ts +15 -7
- package/src/chain/chain.ts +225 -32
- package/src/chain/errors/attestationError.ts +11 -1
- package/src/chain/errors/executionPayloadBid.ts +35 -0
- package/src/chain/errors/executionPayloadEnvelope.ts +34 -0
- package/src/chain/errors/index.ts +3 -0
- package/src/chain/errors/payloadAttestation.ts +25 -0
- package/src/chain/forkChoice/index.ts +19 -0
- package/src/chain/initState.ts +5 -3
- package/src/chain/interface.ts +34 -3
- package/src/chain/lightClient/proofs.ts +0 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +19 -191
- package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
- package/src/chain/opPools/index.ts +2 -0
- package/src/chain/opPools/opPool.ts +5 -7
- package/src/chain/opPools/payloadAttestationPool.ts +157 -0
- package/src/chain/prepareNextSlot.ts +8 -12
- package/src/chain/produceBlock/produceBlockBody.ts +13 -6
- package/src/chain/regen/interface.ts +3 -17
- package/src/chain/regen/queued.ts +17 -56
- package/src/chain/regen/regen.ts +16 -42
- package/src/chain/seenCache/index.ts +3 -1
- package/src/chain/seenCache/seenAttesters.ts +5 -0
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -0
- package/src/chain/seenCache/seenExecutionPayloadEnvelope.ts +34 -0
- package/src/chain/shufflingCache.ts +67 -50
- package/src/chain/stateCache/blockStateCacheImpl.ts +2 -3
- package/src/chain/stateCache/fifoBlockStateCache.ts +4 -5
- package/src/chain/stateCache/inMemoryCheckpointsCache.ts +9 -15
- package/src/chain/stateCache/persistentCheckpointsCache.ts +17 -25
- package/src/chain/stateCache/types.ts +5 -10
- package/src/chain/validation/aggregateAndProof.ts +36 -14
- package/src/chain/validation/attestation.ts +36 -19
- package/src/chain/validation/attesterSlashing.ts +9 -7
- package/src/chain/validation/blobSidecar.ts +2 -7
- package/src/chain/validation/block.ts +8 -4
- package/src/chain/validation/blsToExecutionChange.ts +9 -7
- package/src/chain/validation/dataColumnSidecar.ts +2 -7
- package/src/chain/validation/executionPayloadBid.ts +141 -0
- package/src/chain/validation/executionPayloadEnvelope.ts +122 -0
- package/src/chain/validation/payloadAttestationMessage.ts +109 -0
- package/src/chain/validation/proposerSlashing.ts +3 -7
- package/src/chain/validation/signatureSets/aggregateAndProof.ts +9 -14
- package/src/chain/validation/signatureSets/contributionAndProof.ts +2 -4
- package/src/chain/validation/signatureSets/selectionProof.ts +9 -9
- package/src/chain/validation/signatureSets/syncCommittee.ts +2 -4
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -4
- package/src/chain/validation/syncCommittee.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -5
- package/src/chain/validation/voluntaryExit.ts +1 -1
- package/src/chain/validatorMonitor.ts +52 -3
- package/src/db/repositories/checkpointState.ts +3 -19
- package/src/db/repositories/stateArchive.ts +13 -27
- package/src/execution/engine/mock.ts +40 -13
- package/src/index.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +68 -17
- package/src/network/gossip/interface.ts +17 -0
- package/src/network/gossip/scoringParameters.ts +44 -2
- package/src/network/gossip/topic.ts +21 -0
- package/src/network/processor/gossipHandlers.ts +48 -3
- package/src/network/processor/gossipQueues/index.ts +16 -0
- package/src/network/processor/index.ts +3 -0
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +2 -4
- package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +5 -32
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +5 -9
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +5 -2
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -5
- package/src/network/reqresp/handlers/index.ts +2 -2
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
- package/src/node/nodejs.ts +18 -3
- package/src/sync/backfill/backfill.ts +2 -2
- package/src/sync/backfill/verify.ts +2 -3
- package/src/sync/range/chain.ts +0 -1
- package/src/sync/range/range.ts +0 -3
- package/src/sync/unknownBlock.ts +0 -3
- package/src/util/sszBytes.ts +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {Slot, gloas} from "@lodestar/types";
|
|
2
|
+
import {MapDef, toRootHex} from "@lodestar/utils";
|
|
3
|
+
import {InsertOutcome} from "./types.js";
|
|
4
|
+
import {pruneBySlot} from "./utils.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TODO GLOAS: Revisit this value and add rational for choosing it
|
|
8
|
+
*/
|
|
9
|
+
const SLOTS_RETAINED = 2;
|
|
10
|
+
|
|
11
|
+
type BlockRootHex = string;
|
|
12
|
+
type BlockHashHex = string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Store the best execution payload bid per slot / (parent block root, parent block hash).
|
|
16
|
+
*/
|
|
17
|
+
export class ExecutionPayloadBidPool {
|
|
18
|
+
private readonly bidByParentHashByParentRootBySlot = new MapDef<
|
|
19
|
+
Slot,
|
|
20
|
+
MapDef<BlockRootHex, Map<BlockHashHex, gloas.ExecutionPayloadBid>>
|
|
21
|
+
>(() => new MapDef<BlockRootHex, Map<BlockHashHex, gloas.ExecutionPayloadBid>>(() => new Map()));
|
|
22
|
+
private lowestPermissibleSlot = 0;
|
|
23
|
+
|
|
24
|
+
get size(): number {
|
|
25
|
+
let count = 0;
|
|
26
|
+
for (const byParentRoot of this.bidByParentHashByParentRootBySlot.values()) {
|
|
27
|
+
for (const byParentHash of byParentRoot.values()) {
|
|
28
|
+
count += byParentHash.size;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return count;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
add(bid: gloas.ExecutionPayloadBid): InsertOutcome {
|
|
35
|
+
const {slot, parentBlockRoot, parentBlockHash, value} = bid;
|
|
36
|
+
const lowestPermissibleSlot = this.lowestPermissibleSlot;
|
|
37
|
+
|
|
38
|
+
if (slot < lowestPermissibleSlot) {
|
|
39
|
+
return InsertOutcome.Old;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const parentRootHex = toRootHex(parentBlockRoot);
|
|
43
|
+
const parentHashHex = toRootHex(parentBlockHash);
|
|
44
|
+
const bidByParentHash = this.bidByParentHashByParentRootBySlot.getOrDefault(slot).getOrDefault(parentRootHex);
|
|
45
|
+
const existing = bidByParentHash.get(parentHashHex);
|
|
46
|
+
|
|
47
|
+
if (existing) {
|
|
48
|
+
const existingValue = existing.value;
|
|
49
|
+
const newValue = value;
|
|
50
|
+
if (newValue > existingValue) {
|
|
51
|
+
bidByParentHash.set(parentHashHex, bid);
|
|
52
|
+
return InsertOutcome.NewData;
|
|
53
|
+
}
|
|
54
|
+
return newValue === existingValue ? InsertOutcome.AlreadyKnown : InsertOutcome.NotBetterThan;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
bidByParentHash.set(parentHashHex, bid);
|
|
58
|
+
return InsertOutcome.NewData;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Return the highest-value bid matching slot, parent block root, and parent block hash.
|
|
63
|
+
* Used for gossip validation and block production.
|
|
64
|
+
*/
|
|
65
|
+
getBestBid(
|
|
66
|
+
parentBlockRoot: BlockRootHex,
|
|
67
|
+
parentBlockHash: BlockHashHex,
|
|
68
|
+
slot: Slot
|
|
69
|
+
): gloas.ExecutionPayloadBid | null {
|
|
70
|
+
const bidByParentHash = this.bidByParentHashByParentRootBySlot.get(slot)?.get(parentBlockRoot);
|
|
71
|
+
return bidByParentHash?.get(parentBlockHash) ?? null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
prune(clockSlot: Slot): void {
|
|
75
|
+
this.lowestPermissibleSlot = pruneBySlot(this.bidByParentHashByParentRootBySlot, clockSlot, SLOTS_RETAINED);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export {AggregatedAttestationPool} from "./aggregatedAttestationPool.js";
|
|
2
2
|
export {AttestationPool} from "./attestationPool.js";
|
|
3
|
+
export {ExecutionPayloadBidPool} from "./executionPayloadBidPool.js";
|
|
3
4
|
export {OpPool} from "./opPool.js";
|
|
5
|
+
export {PayloadAttestationPool} from "./payloadAttestationPool.js";
|
|
4
6
|
export {SyncCommitteeMessagePool} from "./syncCommitteeMessagePool.js";
|
|
5
7
|
export {SyncContributionAndProofPool} from "./syncContributionAndProofPool.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {Id, Repository} from "@lodestar/db";
|
|
2
|
+
import {DbBatch, Id, Repository} from "@lodestar/db";
|
|
3
3
|
import {
|
|
4
4
|
BLS_WITHDRAWAL_PREFIX,
|
|
5
5
|
ForkName,
|
|
@@ -440,23 +440,21 @@ async function persistDiff<K extends Id, V>(
|
|
|
440
440
|
serializeKey: (key: K) => number | string
|
|
441
441
|
): Promise<void> {
|
|
442
442
|
const persistedKeys = await dbRepo.keys();
|
|
443
|
-
const
|
|
444
|
-
const keysToDelete: K[] = [];
|
|
443
|
+
const batch: DbBatch<K, V> = [];
|
|
445
444
|
|
|
446
445
|
const persistedKeysSerialized = new Set(persistedKeys.map(serializeKey));
|
|
447
446
|
for (const item of items) {
|
|
448
447
|
if (!persistedKeysSerialized.has(serializeKey(item.key))) {
|
|
449
|
-
|
|
448
|
+
batch.push({type: "put", key: item.key, value: item.value});
|
|
450
449
|
}
|
|
451
450
|
}
|
|
452
451
|
|
|
453
452
|
const targetKeysSerialized = new Set(items.map((item) => serializeKey(item.key)));
|
|
454
453
|
for (const persistedKey of persistedKeys) {
|
|
455
454
|
if (!targetKeysSerialized.has(serializeKey(persistedKey))) {
|
|
456
|
-
|
|
455
|
+
batch.push({type: "del", key: persistedKey});
|
|
457
456
|
}
|
|
458
457
|
}
|
|
459
458
|
|
|
460
|
-
if (
|
|
461
|
-
if (keysToDelete.length > 0) await dbRepo.batchDelete(keysToDelete);
|
|
459
|
+
if (batch.length > 0) await dbRepo.batch(batch);
|
|
462
460
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {Signature, aggregateSignatures} from "@chainsafe/blst";
|
|
2
|
+
import {BitArray} from "@chainsafe/ssz";
|
|
3
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
4
|
+
import {MAX_COMMITTEES_PER_SLOT, PTC_SIZE} from "@lodestar/params";
|
|
5
|
+
import {RootHex, Slot, gloas} from "@lodestar/types";
|
|
6
|
+
import {MapDef, toRootHex} from "@lodestar/utils";
|
|
7
|
+
import {Metrics} from "../../metrics/metrics.js";
|
|
8
|
+
import {IClock} from "../../util/clock.js";
|
|
9
|
+
import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js";
|
|
10
|
+
import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* TODO GLOAS: Revisit this value and add rational for choosing it
|
|
14
|
+
*/
|
|
15
|
+
const SLOTS_RETAINED = 2;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The maximum number of distinct `PayloadAttestationData` that will be stored in each slot.
|
|
19
|
+
*
|
|
20
|
+
* This is a DoS protection measure.
|
|
21
|
+
*/
|
|
22
|
+
// TODO GLOAS: Revisit this value. Educated guess would be MAX_ATTESTATIONS_PER_SLOT in AttestationPool divided by MAX_COMMITTEES_PER_SLOT
|
|
23
|
+
const MAX_PAYLOAD_ATTESTATIONS_PER_SLOT = 16_384 / MAX_COMMITTEES_PER_SLOT;
|
|
24
|
+
|
|
25
|
+
type DataRootHex = string;
|
|
26
|
+
type BlockRootHex = string;
|
|
27
|
+
|
|
28
|
+
type AggregateFast = {
|
|
29
|
+
aggregationBits: BitArray;
|
|
30
|
+
data: gloas.PayloadAttestationData;
|
|
31
|
+
signature: Signature;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export class PayloadAttestationPool {
|
|
35
|
+
private readonly aggregateByDataRootByBlockRootBySlot = new MapDef<
|
|
36
|
+
Slot,
|
|
37
|
+
Map<BlockRootHex, Map<DataRootHex, AggregateFast>>
|
|
38
|
+
>(() => new Map<BlockRootHex, Map<DataRootHex, AggregateFast>>());
|
|
39
|
+
private lowestPermissibleSlot = 0;
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private readonly config: ChainForkConfig,
|
|
43
|
+
private readonly clock: IClock,
|
|
44
|
+
private readonly metrics: Metrics | null = null
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
get size(): number {
|
|
48
|
+
let count = 0;
|
|
49
|
+
for (const aggregateByDataRootByBlockRoot of this.aggregateByDataRootByBlockRootBySlot.values()) {
|
|
50
|
+
for (const aggregateByDataRoot of aggregateByDataRootByBlockRoot.values()) {
|
|
51
|
+
count += aggregateByDataRoot.size;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
add(
|
|
58
|
+
message: gloas.PayloadAttestationMessage,
|
|
59
|
+
payloadAttDataRootHex: RootHex,
|
|
60
|
+
validatorCommitteeIndex: number
|
|
61
|
+
): InsertOutcome {
|
|
62
|
+
const slot = message.data.slot;
|
|
63
|
+
const lowestPermissibleSlot = this.lowestPermissibleSlot;
|
|
64
|
+
|
|
65
|
+
if (slot < lowestPermissibleSlot) {
|
|
66
|
+
return InsertOutcome.Old;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (slot < this.clock.slotWithPastTolerance(this.config.MAXIMUM_GOSSIP_CLOCK_DISPARITY / 1000)) {
|
|
70
|
+
return InsertOutcome.Late;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const aggregateByDataRootByBlockRoot = this.aggregateByDataRootByBlockRootBySlot.getOrDefault(slot);
|
|
74
|
+
let aggregateByDataRoot = aggregateByDataRootByBlockRoot.get(toRootHex(message.data.beaconBlockRoot));
|
|
75
|
+
|
|
76
|
+
if (!aggregateByDataRoot) {
|
|
77
|
+
aggregateByDataRoot = new Map<DataRootHex, AggregateFast>();
|
|
78
|
+
aggregateByDataRootByBlockRoot.set(toRootHex(message.data.beaconBlockRoot), aggregateByDataRoot);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (aggregateByDataRoot.size >= MAX_PAYLOAD_ATTESTATIONS_PER_SLOT) {
|
|
82
|
+
throw new OpPoolError({code: OpPoolErrorCode.REACHED_MAX_PER_SLOT});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const aggregate = aggregateByDataRoot.get(payloadAttDataRootHex);
|
|
86
|
+
if (aggregate) {
|
|
87
|
+
// Aggregate msg into aggregate
|
|
88
|
+
return aggregateMessageInto(message, validatorCommitteeIndex, aggregate);
|
|
89
|
+
}
|
|
90
|
+
// Create a new aggregate with data
|
|
91
|
+
aggregateByDataRoot.set(payloadAttDataRootHex, messageToAggregate(message, validatorCommitteeIndex));
|
|
92
|
+
|
|
93
|
+
return InsertOutcome.NewData;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get payload attestations to be included in a block.
|
|
98
|
+
* Pick the top `maxAttestation` number of attestations with the most votes
|
|
99
|
+
*/
|
|
100
|
+
getPayloadAttestationsForBlock(
|
|
101
|
+
beaconBlockRoot: BlockRootHex,
|
|
102
|
+
slot: Slot,
|
|
103
|
+
maxAttestation: number
|
|
104
|
+
): gloas.PayloadAttestation[] {
|
|
105
|
+
const aggregateByDataRootByBlockRoot = this.aggregateByDataRootByBlockRootBySlot.get(slot);
|
|
106
|
+
|
|
107
|
+
if (!aggregateByDataRootByBlockRoot) {
|
|
108
|
+
this.metrics?.opPool.payloadAttestationPool.getPayloadAttestationsCacheMisses.inc();
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const aggregateByDataRoot = aggregateByDataRootByBlockRoot.get(beaconBlockRoot);
|
|
113
|
+
|
|
114
|
+
if (!aggregateByDataRoot) {
|
|
115
|
+
this.metrics?.opPool.payloadAttestationPool.getPayloadAttestationsCacheMisses.inc();
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return Array.from(aggregateByDataRoot.values())
|
|
120
|
+
.slice()
|
|
121
|
+
.sort((a, b) => b.aggregationBits.getTrueBitIndexes().length - a.aggregationBits.getTrueBitIndexes().length)
|
|
122
|
+
.slice(0, maxAttestation)
|
|
123
|
+
.map(fastToPayloadAttestation);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
prune(clockSlot: Slot): void {
|
|
127
|
+
pruneBySlot(this.aggregateByDataRootByBlockRootBySlot, clockSlot, SLOTS_RETAINED);
|
|
128
|
+
this.lowestPermissibleSlot = clockSlot;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function messageToAggregate(message: gloas.PayloadAttestationMessage, validatorCommitteeIndex: number): AggregateFast {
|
|
133
|
+
return {
|
|
134
|
+
aggregationBits: BitArray.fromSingleBit(PTC_SIZE, validatorCommitteeIndex),
|
|
135
|
+
data: message.data,
|
|
136
|
+
signature: signatureFromBytesNoCheck(message.signature),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function aggregateMessageInto(
|
|
141
|
+
message: gloas.PayloadAttestationMessage,
|
|
142
|
+
validatorCommitteeIndex: number,
|
|
143
|
+
aggregate: AggregateFast
|
|
144
|
+
): InsertOutcome {
|
|
145
|
+
if (aggregate.aggregationBits.get(validatorCommitteeIndex) === true) {
|
|
146
|
+
return InsertOutcome.AlreadyKnown;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
aggregate.aggregationBits.set(validatorCommitteeIndex, true);
|
|
150
|
+
aggregate.signature = aggregateSignatures([aggregate.signature, signatureFromBytesNoCheck(message.signature)]);
|
|
151
|
+
|
|
152
|
+
return InsertOutcome.Aggregated;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function fastToPayloadAttestation(aggFast: AggregateFast): gloas.PayloadAttestation {
|
|
156
|
+
return {...aggFast, signature: aggFast.signature.toBytes()};
|
|
157
|
+
}
|
|
@@ -80,9 +80,8 @@ export class PrepareNextSlotScheduler {
|
|
|
80
80
|
await sleep(this.config.getSlotComponentDurationMs(PREPARE_NEXT_SLOT_BPS), this.signal);
|
|
81
81
|
|
|
82
82
|
// calling updateHead() here before we produce a block to reduce reorg possibility
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
);
|
|
83
|
+
const headBlock = this.chain.recomputeForkChoiceHead(ForkchoiceCaller.prepareNextSlot);
|
|
84
|
+
const {slot: headSlot, blockRoot: headRoot} = headBlock;
|
|
86
85
|
|
|
87
86
|
// PS: previously this was comparing slots, but that gave no leway on the skipped
|
|
88
87
|
// slots on epoch bounday. Making it more fluid.
|
|
@@ -112,17 +111,12 @@ export class PrepareNextSlotScheduler {
|
|
|
112
111
|
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
|
|
113
112
|
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
|
|
114
113
|
const prepareState = await this.chain.regen.getBlockSlotState(
|
|
115
|
-
|
|
114
|
+
headBlock,
|
|
116
115
|
prepareSlot,
|
|
117
116
|
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
118
117
|
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
119
118
|
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
120
|
-
|
|
121
|
-
// Shuffling calculation will be done asynchronously when passing asyncShufflingCalculation=true. Shuffling will be queued in
|
|
122
|
-
// beforeProcessEpoch and should theoretically be ready immediately after the synchronous epoch transition finished and the
|
|
123
|
-
// event loop is free. In long periods of non-finality too many forks will cause the shufflingCache to throw an error for
|
|
124
|
-
// too many queued shufflings so only run async during normal epoch transition. See issue ChainSafe/lodestar#7244
|
|
125
|
-
{dontTransferCache: !isEpochTransition, asyncShufflingCalculation: true},
|
|
119
|
+
{dontTransferCache: !isEpochTransition},
|
|
126
120
|
RegenCaller.precomputeEpoch
|
|
127
121
|
);
|
|
128
122
|
|
|
@@ -134,7 +128,8 @@ export class PrepareNextSlotScheduler {
|
|
|
134
128
|
|
|
135
129
|
if (feeRecipient) {
|
|
136
130
|
// If we are proposing next slot, we need to predict if we can proposer-boost-reorg or not
|
|
137
|
-
const
|
|
131
|
+
const proposerHead = this.chain.predictProposerHead(clockSlot);
|
|
132
|
+
const {slot: proposerHeadSlot, blockRoot: proposerHeadRoot} = proposerHead;
|
|
138
133
|
|
|
139
134
|
// If we predict we can reorg, update prepareState with proposer head block
|
|
140
135
|
if (proposerHeadRoot !== headRoot || proposerHeadSlot !== headSlot) {
|
|
@@ -146,8 +141,9 @@ export class PrepareNextSlotScheduler {
|
|
|
146
141
|
});
|
|
147
142
|
this.metrics?.weakHeadDetected.inc();
|
|
148
143
|
updatedPrepareState = (await this.chain.regen.getBlockSlotState(
|
|
149
|
-
|
|
144
|
+
proposerHead,
|
|
150
145
|
prepareSlot,
|
|
146
|
+
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
151
147
|
{dontTransferCache: !isEpochTransition},
|
|
152
148
|
RegenCaller.predictProposerHead
|
|
153
149
|
)) as CachedBeaconStateExecutions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
2
|
+
import {ProtoBlock, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
3
|
import {
|
|
4
4
|
ForkName,
|
|
5
5
|
ForkPostBellatrix,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
electra,
|
|
44
44
|
fulu,
|
|
45
45
|
} from "@lodestar/types";
|
|
46
|
-
import {Logger, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
46
|
+
import {Logger, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
47
47
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
48
48
|
import {numToQuantity} from "../../execution/engine/utils.js";
|
|
49
49
|
import {
|
|
@@ -86,7 +86,7 @@ export type BlockAttributes = {
|
|
|
86
86
|
randaoReveal: BLSSignature;
|
|
87
87
|
graffiti: Bytes32;
|
|
88
88
|
slot: Slot;
|
|
89
|
-
|
|
89
|
+
parentBlock: ProtoBlock;
|
|
90
90
|
feeRecipient?: string;
|
|
91
91
|
};
|
|
92
92
|
|
|
@@ -155,13 +155,14 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
155
155
|
const {
|
|
156
156
|
slot: blockSlot,
|
|
157
157
|
feeRecipient: requestedFeeRecipient,
|
|
158
|
-
|
|
158
|
+
parentBlock,
|
|
159
159
|
proposerIndex,
|
|
160
160
|
proposerPubKey,
|
|
161
161
|
commonBlockBodyPromise,
|
|
162
162
|
} = blockAttr;
|
|
163
163
|
let executionPayloadValue: Wei;
|
|
164
164
|
let blockBody: AssembledBodyType<T>;
|
|
165
|
+
const parentBlockRoot = fromHex(parentBlock.blockRoot);
|
|
165
166
|
// even though shouldOverrideBuilder is relevant for the engine response, for simplicity of typing
|
|
166
167
|
// we just return it undefined for the builder which anyway doesn't get consumed downstream
|
|
167
168
|
let shouldOverrideBuilder: boolean | undefined;
|
|
@@ -637,7 +638,7 @@ export async function produceCommonBlockBody<T extends BlockType>(
|
|
|
637
638
|
this: BeaconChain,
|
|
638
639
|
blockType: T,
|
|
639
640
|
currentState: CachedBeaconStateAllForks,
|
|
640
|
-
{randaoReveal, graffiti, slot,
|
|
641
|
+
{randaoReveal, graffiti, slot, parentBlock}: BlockAttributes
|
|
641
642
|
): Promise<CommonBlockBody> {
|
|
642
643
|
const stepsMetrics =
|
|
643
644
|
blockType === BlockType.Full
|
|
@@ -661,7 +662,12 @@ export async function produceCommonBlockBody<T extends BlockType>(
|
|
|
661
662
|
this.opPool.getSlashingsAndExits(currentState, blockType, this.metrics);
|
|
662
663
|
|
|
663
664
|
const endAttestations = stepsMetrics?.startTimer();
|
|
664
|
-
const attestations = this.aggregatedAttestationPool.getAttestationsForBlock(
|
|
665
|
+
const attestations = this.aggregatedAttestationPool.getAttestationsForBlock(
|
|
666
|
+
fork,
|
|
667
|
+
this.forkChoice,
|
|
668
|
+
this.shufflingCache,
|
|
669
|
+
currentState
|
|
670
|
+
);
|
|
665
671
|
endAttestations?.({
|
|
666
672
|
step: BlockProductionStep.attestations,
|
|
667
673
|
});
|
|
@@ -686,6 +692,7 @@ export async function produceCommonBlockBody<T extends BlockType>(
|
|
|
686
692
|
|
|
687
693
|
const endSyncAggregate = stepsMetrics?.startTimer();
|
|
688
694
|
if (ForkSeq[fork] >= ForkSeq.altair) {
|
|
695
|
+
const parentBlockRoot = fromHex(parentBlock.blockRoot);
|
|
689
696
|
const previousSlot = slot - 1;
|
|
690
697
|
const syncAggregate = this.syncContributionAndProofPool.getAggregate(previousSlot, parentBlockRoot);
|
|
691
698
|
this.metrics?.production.producedSyncAggregateParticipants.observe(
|
|
@@ -18,6 +18,7 @@ export enum RegenCaller {
|
|
|
18
18
|
validateGossipAggregateAndProof = "validateGossipAggregateAndProof",
|
|
19
19
|
validateGossipAttestation = "validateGossipAttestation",
|
|
20
20
|
validateGossipVoluntaryExit = "validateGossipVoluntaryExit",
|
|
21
|
+
validateGossipExecutionPayloadBid = "validateGossipExecutionPayloadBid",
|
|
21
22
|
onForkChoiceFinalized = "onForkChoiceFinalized",
|
|
22
23
|
restApi = "restApi",
|
|
23
24
|
}
|
|
@@ -26,15 +27,10 @@ export enum RegenFnName {
|
|
|
26
27
|
getBlockSlotState = "getBlockSlotState",
|
|
27
28
|
getState = "getState",
|
|
28
29
|
getPreState = "getPreState",
|
|
29
|
-
getCheckpointState = "getCheckpointState",
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export type StateRegenerationOpts = {
|
|
33
33
|
dontTransferCache: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Do not queue shuffling calculation async. Forces sync JIT calculation in afterProcessEpoch if not passed as `true`
|
|
36
|
-
*/
|
|
37
|
-
asyncShufflingCalculation?: boolean;
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
export interface IStateRegenerator extends IStateRegeneratorInternal {
|
|
@@ -67,21 +63,11 @@ export interface IStateRegeneratorInternal {
|
|
|
67
63
|
rCaller: RegenCaller
|
|
68
64
|
): Promise<CachedBeaconStateAllForks>;
|
|
69
65
|
|
|
70
|
-
/**
|
|
71
|
-
* Return a valid checkpoint state
|
|
72
|
-
* This will always return a state with `state.slot % SLOTS_PER_EPOCH === 0`
|
|
73
|
-
*/
|
|
74
|
-
getCheckpointState(
|
|
75
|
-
cp: phase0.Checkpoint,
|
|
76
|
-
opts: StateRegenerationOpts,
|
|
77
|
-
rCaller: RegenCaller
|
|
78
|
-
): Promise<CachedBeaconStateAllForks>;
|
|
79
|
-
|
|
80
66
|
/**
|
|
81
67
|
* Return the state of `blockRoot` processed to slot `slot`
|
|
82
68
|
*/
|
|
83
69
|
getBlockSlotState(
|
|
84
|
-
|
|
70
|
+
block: ProtoBlock,
|
|
85
71
|
slot: Slot,
|
|
86
72
|
opts: StateRegenerationOpts,
|
|
87
73
|
rCaller: RegenCaller
|
|
@@ -90,5 +76,5 @@ export interface IStateRegeneratorInternal {
|
|
|
90
76
|
/**
|
|
91
77
|
* Return the exact state with `stateRoot`
|
|
92
78
|
*/
|
|
93
|
-
getState(stateRoot: RootHex, rCaller: RegenCaller
|
|
79
|
+
getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks>;
|
|
94
80
|
}
|
|
@@ -5,7 +5,7 @@ import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types";
|
|
|
5
5
|
import {Logger, toRootHex} from "@lodestar/utils";
|
|
6
6
|
import {Metrics} from "../../metrics/index.js";
|
|
7
7
|
import {JobItemQueue} from "../../util/queue/index.js";
|
|
8
|
-
import {CheckpointHex
|
|
8
|
+
import {CheckpointHex} from "../stateCache/index.js";
|
|
9
9
|
import {BlockStateCache, CheckpointStateCache} from "../stateCache/types.js";
|
|
10
10
|
import {RegenError, RegenErrorCode} from "./errors.js";
|
|
11
11
|
import {
|
|
@@ -79,21 +79,15 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Get a state from block state cache.
|
|
82
|
-
* This is not for block processing so don't transfer cache
|
|
83
82
|
*/
|
|
84
83
|
getStateSync(stateRoot: RootHex): CachedBeaconStateAllForks | null {
|
|
85
|
-
return this.blockStateCache.get(stateRoot
|
|
84
|
+
return this.blockStateCache.get(stateRoot);
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
/**
|
|
89
88
|
* Get state for block processing.
|
|
90
|
-
* By default, do not transfer cache except for the block at clock slot
|
|
91
|
-
* which is usually the gossip block.
|
|
92
89
|
*/
|
|
93
|
-
getPreStateSync(
|
|
94
|
-
block: BeaconBlock,
|
|
95
|
-
opts: StateRegenerationOpts = {dontTransferCache: true}
|
|
96
|
-
): CachedBeaconStateAllForks | null {
|
|
90
|
+
getPreStateSync(block: BeaconBlock): CachedBeaconStateAllForks | null {
|
|
97
91
|
const parentRoot = toRootHex(block.parentRoot);
|
|
98
92
|
const parentBlock = this.forkChoice.getBlockHex(parentRoot);
|
|
99
93
|
if (!parentBlock) {
|
|
@@ -108,7 +102,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
108
102
|
|
|
109
103
|
// Check the checkpoint cache (if the pre-state is a checkpoint state)
|
|
110
104
|
if (parentEpoch < blockEpoch) {
|
|
111
|
-
const checkpointState = this.checkpointStateCache.getLatest(parentRoot, blockEpoch
|
|
105
|
+
const checkpointState = this.checkpointStateCache.getLatest(parentRoot, blockEpoch);
|
|
112
106
|
if (checkpointState && computeEpochAtSlot(checkpointState.slot) === blockEpoch) {
|
|
113
107
|
return checkpointState;
|
|
114
108
|
}
|
|
@@ -118,7 +112,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
118
112
|
// Otherwise the state transition may not be cached and wasted. Queue for regen since the
|
|
119
113
|
// work required will still be significant.
|
|
120
114
|
if (parentEpoch === blockEpoch) {
|
|
121
|
-
const state = this.blockStateCache.get(parentBlock.stateRoot
|
|
115
|
+
const state = this.blockStateCache.get(parentBlock.stateRoot);
|
|
122
116
|
if (state) {
|
|
123
117
|
return state;
|
|
124
118
|
}
|
|
@@ -132,21 +126,17 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
132
126
|
}
|
|
133
127
|
|
|
134
128
|
/**
|
|
135
|
-
* Get checkpoint state from cache
|
|
129
|
+
* Get checkpoint state from cache
|
|
136
130
|
*/
|
|
137
131
|
getCheckpointStateSync(cp: CheckpointHex): CachedBeaconStateAllForks | null {
|
|
138
|
-
return this.checkpointStateCache.get(cp
|
|
132
|
+
return this.checkpointStateCache.get(cp);
|
|
139
133
|
}
|
|
140
134
|
|
|
141
135
|
/**
|
|
142
|
-
* Get state closest to head
|
|
136
|
+
* Get state closest to head
|
|
143
137
|
*/
|
|
144
138
|
getClosestHeadState(head: ProtoBlock): CachedBeaconStateAllForks | null {
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
this.checkpointStateCache.getLatest(head.blockRoot, Infinity, opts) ||
|
|
148
|
-
this.blockStateCache.get(head.stateRoot, opts)
|
|
149
|
-
);
|
|
139
|
+
return this.checkpointStateCache.getLatest(head.blockRoot, Infinity) || this.blockStateCache.get(head.stateRoot);
|
|
150
140
|
}
|
|
151
141
|
|
|
152
142
|
pruneOnCheckpoint(finalizedEpoch: Epoch, justifiedEpoch: Epoch, headStateRoot: RootHex): void {
|
|
@@ -181,10 +171,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
181
171
|
maybeHeadStateRoot,
|
|
182
172
|
};
|
|
183
173
|
const headState =
|
|
184
|
-
newHeadStateRoot === maybeHeadStateRoot
|
|
185
|
-
? maybeHeadState
|
|
186
|
-
: // maybeHeadState was already in block state cache so we don't transfer the cache
|
|
187
|
-
this.blockStateCache.get(newHeadStateRoot, {dontTransferCache: true});
|
|
174
|
+
newHeadStateRoot === maybeHeadStateRoot ? maybeHeadState : this.blockStateCache.get(newHeadStateRoot);
|
|
188
175
|
|
|
189
176
|
if (headState) {
|
|
190
177
|
this.blockStateCache.setHeadState(headState);
|
|
@@ -199,9 +186,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
199
186
|
|
|
200
187
|
// for the new FIFOBlockStateCache, it's important to reload state to regen head state here if needed
|
|
201
188
|
const allowDiskReload = true;
|
|
202
|
-
|
|
203
|
-
const cloneOpts = {dontTransferCache: false};
|
|
204
|
-
this.regen.getState(newHeadStateRoot, RegenCaller.processBlock, cloneOpts, allowDiskReload).then(
|
|
189
|
+
this.regen.getState(newHeadStateRoot, RegenCaller.processBlock, allowDiskReload).then(
|
|
205
190
|
(headStateRegen) => this.blockStateCache.setHeadState(headStateRegen),
|
|
206
191
|
(e) => this.logger.error("Error on head state regen", logCtx, e)
|
|
207
192
|
);
|
|
@@ -224,7 +209,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
224
209
|
this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getPreState});
|
|
225
210
|
|
|
226
211
|
// First attempt to fetch the state from caches before queueing
|
|
227
|
-
const cachedState = this.getPreStateSync(block
|
|
212
|
+
const cachedState = this.getPreStateSync(block);
|
|
228
213
|
|
|
229
214
|
if (cachedState !== null) {
|
|
230
215
|
return cachedState;
|
|
@@ -235,24 +220,6 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
235
220
|
return this.jobQueue.push({key: "getPreState", args: [block, opts, rCaller]});
|
|
236
221
|
}
|
|
237
222
|
|
|
238
|
-
async getCheckpointState(
|
|
239
|
-
cp: phase0.Checkpoint,
|
|
240
|
-
opts: StateRegenerationOpts,
|
|
241
|
-
rCaller: RegenCaller
|
|
242
|
-
): Promise<CachedBeaconStateAllForks> {
|
|
243
|
-
this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getCheckpointState});
|
|
244
|
-
|
|
245
|
-
// First attempt to fetch the state from cache before queueing
|
|
246
|
-
const checkpointState = this.checkpointStateCache.get(toCheckpointHex(cp), opts);
|
|
247
|
-
if (checkpointState) {
|
|
248
|
-
return checkpointState;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// The state is not immediately available in the caches, enqueue the job
|
|
252
|
-
this.metrics?.regenFnQueuedTotal.inc({caller: rCaller, entrypoint: RegenFnName.getCheckpointState});
|
|
253
|
-
return this.jobQueue.push({key: "getCheckpointState", args: [cp, opts, rCaller]});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
223
|
/**
|
|
257
224
|
* Get state of provided `blockRoot` and dial forward to `slot`
|
|
258
225
|
* Use this api with care because we don't want the queue to be busy
|
|
@@ -260,7 +227,7 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
260
227
|
* @returns
|
|
261
228
|
*/
|
|
262
229
|
async getBlockSlotState(
|
|
263
|
-
|
|
230
|
+
block: ProtoBlock,
|
|
264
231
|
slot: Slot,
|
|
265
232
|
opts: StateRegenerationOpts,
|
|
266
233
|
rCaller: RegenCaller
|
|
@@ -268,25 +235,21 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
268
235
|
this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getBlockSlotState});
|
|
269
236
|
|
|
270
237
|
// The state is not immediately available in the caches, enqueue the job
|
|
271
|
-
return this.jobQueue.push({key: "getBlockSlotState", args: [
|
|
238
|
+
return this.jobQueue.push({key: "getBlockSlotState", args: [block, slot, opts, rCaller]});
|
|
272
239
|
}
|
|
273
240
|
|
|
274
|
-
async getState(
|
|
275
|
-
stateRoot: RootHex,
|
|
276
|
-
rCaller: RegenCaller,
|
|
277
|
-
opts: StateRegenerationOpts = {dontTransferCache: true}
|
|
278
|
-
): Promise<CachedBeaconStateAllForks> {
|
|
241
|
+
async getState(stateRoot: RootHex, rCaller: RegenCaller): Promise<CachedBeaconStateAllForks> {
|
|
279
242
|
this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getState});
|
|
280
243
|
|
|
281
244
|
// First attempt to fetch the state from cache before queueing
|
|
282
|
-
const state = this.blockStateCache.get(stateRoot
|
|
245
|
+
const state = this.blockStateCache.get(stateRoot);
|
|
283
246
|
if (state) {
|
|
284
247
|
return state;
|
|
285
248
|
}
|
|
286
249
|
|
|
287
250
|
// The state is not immediately available in the cache, enqueue the job
|
|
288
251
|
this.metrics?.regenFnQueuedTotal.inc({caller: rCaller, entrypoint: RegenFnName.getState});
|
|
289
|
-
return this.jobQueue.push({key: "getState", args: [stateRoot, rCaller
|
|
252
|
+
return this.jobQueue.push({key: "getState", args: [stateRoot, rCaller]});
|
|
290
253
|
}
|
|
291
254
|
|
|
292
255
|
private jobQueueProcessor = async (regenRequest: RegenRequest): Promise<CachedBeaconStateAllForks> => {
|
|
@@ -300,8 +263,6 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
|
|
300
263
|
switch (regenRequest.key) {
|
|
301
264
|
case "getPreState":
|
|
302
265
|
return await this.regen.getPreState(...regenRequest.args);
|
|
303
|
-
case "getCheckpointState":
|
|
304
|
-
return await this.regen.getCheckpointState(...regenRequest.args);
|
|
305
266
|
case "getBlockSlotState":
|
|
306
267
|
return await this.regen.getBlockSlotState(...regenRequest.args);
|
|
307
268
|
case "getState":
|