@lodestar/beacon-node 1.39.1 → 1.40.0-dev.1020f27ca9
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 +15 -25
- 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 +16 -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/ColumnReconstructionTracker.d.ts +2 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +7 -3
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +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 +201 -25
- 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 +6 -8
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +20 -34
- 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/seenCache/seenGossipBlockInput.js +1 -1
- 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 +49 -7
- 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 +17 -25
- 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 +19 -4
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +13 -14
- package/src/chain/ColumnReconstructionTracker.ts +8 -4
- 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 +230 -36
- 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 +22 -43
- 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/seenCache/seenGossipBlockInput.ts +1 -1
- 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 +62 -8
- 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
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
12
12
|
import {
|
|
13
13
|
CachedBeaconStateAllForks,
|
|
14
|
+
CachedBeaconStateGloas,
|
|
14
15
|
DataAvailabilityStatus,
|
|
15
16
|
computeAnchorCheckpoint,
|
|
16
17
|
computeEpochAtSlot,
|
|
@@ -144,6 +145,15 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
144
145
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
145
146
|
|
|
146
147
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
148
|
+
...(computeEpochAtSlot(blockHeader.slot) < state.config.GLOAS_FORK_EPOCH
|
|
149
|
+
? {
|
|
150
|
+
builderIndex: undefined,
|
|
151
|
+
blockHashHex: undefined,
|
|
152
|
+
}
|
|
153
|
+
: {
|
|
154
|
+
builderIndex: (state as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex,
|
|
155
|
+
blockHashHex: toRootHex((state as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash),
|
|
156
|
+
}),
|
|
147
157
|
},
|
|
148
158
|
currentSlot
|
|
149
159
|
),
|
|
@@ -225,6 +235,15 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
225
235
|
: {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}),
|
|
226
236
|
|
|
227
237
|
dataAvailabilityStatus: DataAvailabilityStatus.PreData,
|
|
238
|
+
...(computeEpochAtSlot(blockHeader.slot) < unfinalizedState.config.GLOAS_FORK_EPOCH
|
|
239
|
+
? {
|
|
240
|
+
builderIndex: undefined,
|
|
241
|
+
blockHashHex: undefined,
|
|
242
|
+
}
|
|
243
|
+
: {
|
|
244
|
+
builderIndex: (unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex,
|
|
245
|
+
blockHashHex: toRootHex((unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash),
|
|
246
|
+
}),
|
|
228
247
|
};
|
|
229
248
|
|
|
230
249
|
const parentSlot = blockHeader.slot - 1;
|
package/src/chain/initState.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {Logger, toHex, toRootHex} from "@lodestar/utils";
|
|
|
6
6
|
import {GENESIS_SLOT} from "../constants/index.js";
|
|
7
7
|
import {IBeaconDb} from "../db/index.js";
|
|
8
8
|
import {Metrics} from "../metrics/index.js";
|
|
9
|
+
import {getStateTypeFromBytes} from "../util/multifork.js";
|
|
9
10
|
|
|
10
11
|
export async function persistAnchorState(
|
|
11
12
|
config: ChainForkConfig,
|
|
@@ -53,14 +54,15 @@ export function createGenesisBlock(config: ChainForkConfig, genesisState: Beacon
|
|
|
53
54
|
* Restore the latest beacon state from db
|
|
54
55
|
*/
|
|
55
56
|
export async function initStateFromDb(
|
|
56
|
-
|
|
57
|
+
config: ChainForkConfig,
|
|
57
58
|
db: IBeaconDb,
|
|
58
59
|
logger: Logger
|
|
59
60
|
): Promise<BeaconStateAllForks> {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
61
|
+
const stateBytes = await db.stateArchive.lastBinary();
|
|
62
|
+
if (stateBytes == null) {
|
|
62
63
|
throw new Error("No state exists in database");
|
|
63
64
|
}
|
|
65
|
+
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
64
66
|
|
|
65
67
|
logger.info("Initializing beacon state from db", {
|
|
66
68
|
slot: state.slot,
|
package/src/chain/interface.ts
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
Wei,
|
|
23
23
|
altair,
|
|
24
24
|
capella,
|
|
25
|
+
deneb,
|
|
26
|
+
fulu,
|
|
25
27
|
phase0,
|
|
26
28
|
rewards,
|
|
27
29
|
} from "@lodestar/types";
|
|
@@ -44,7 +46,14 @@ import {ForkchoiceCaller} from "./forkChoice/index.js";
|
|
|
44
46
|
import {GetBlobsTracker} from "./GetBlobsTracker.js";
|
|
45
47
|
import {LightClientServer} from "./lightClient/index.js";
|
|
46
48
|
import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js";
|
|
47
|
-
import {
|
|
49
|
+
import {
|
|
50
|
+
AttestationPool,
|
|
51
|
+
ExecutionPayloadBidPool,
|
|
52
|
+
OpPool,
|
|
53
|
+
PayloadAttestationPool,
|
|
54
|
+
SyncCommitteeMessagePool,
|
|
55
|
+
SyncContributionAndProofPool,
|
|
56
|
+
} from "./opPools/index.js";
|
|
48
57
|
import {IChainOptions} from "./options.js";
|
|
49
58
|
import {AssembledBlockType, BlockAttributes, BlockType, ProduceResult} from "./produceBlock/produceBlockBody.js";
|
|
50
59
|
import {IStateRegenerator, RegenCaller} from "./regen/index.js";
|
|
@@ -54,6 +63,9 @@ import {
|
|
|
54
63
|
SeenAttesters,
|
|
55
64
|
SeenBlockProposers,
|
|
56
65
|
SeenContributionAndProof,
|
|
66
|
+
SeenExecutionPayloadBids,
|
|
67
|
+
SeenExecutionPayloadEnvelopes,
|
|
68
|
+
SeenPayloadAttesters,
|
|
57
69
|
SeenSyncCommitteeMessages,
|
|
58
70
|
} from "./seenCache/index.js";
|
|
59
71
|
import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
@@ -114,12 +126,17 @@ export interface IBeaconChain {
|
|
|
114
126
|
readonly aggregatedAttestationPool: AggregatedAttestationPool;
|
|
115
127
|
readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
|
|
116
128
|
readonly syncContributionAndProofPool: SyncContributionAndProofPool;
|
|
129
|
+
readonly executionPayloadBidPool: ExecutionPayloadBidPool;
|
|
130
|
+
readonly payloadAttestationPool: PayloadAttestationPool;
|
|
117
131
|
readonly opPool: OpPool;
|
|
118
132
|
|
|
119
133
|
// Gossip seen cache
|
|
120
134
|
readonly seenAttesters: SeenAttesters;
|
|
121
135
|
readonly seenAggregators: SeenAggregators;
|
|
136
|
+
readonly seenPayloadAttesters: SeenPayloadAttesters;
|
|
122
137
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
138
|
+
readonly seenExecutionPayloadEnvelopes: SeenExecutionPayloadEnvelopes;
|
|
139
|
+
readonly seenExecutionPayloadBids: SeenExecutionPayloadBids;
|
|
123
140
|
readonly seenBlockProposers: SeenBlockProposers;
|
|
124
141
|
readonly seenSyncCommitteeMessages: SeenSyncCommitteeMessages;
|
|
125
142
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
@@ -168,12 +185,12 @@ export interface IBeaconChain {
|
|
|
168
185
|
getStateBySlot(
|
|
169
186
|
slot: Slot,
|
|
170
187
|
opts?: StateGetOpts
|
|
171
|
-
): Promise<{state:
|
|
188
|
+
): Promise<{state: CachedBeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
172
189
|
/** Returns a local state by state root */
|
|
173
190
|
getStateByStateRoot(
|
|
174
191
|
stateRoot: RootHex,
|
|
175
192
|
opts?: StateGetOpts
|
|
176
|
-
): Promise<{state:
|
|
193
|
+
): Promise<{state: CachedBeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
177
194
|
/** Return serialized bytes of a persisted checkpoint state */
|
|
178
195
|
getPersistedCheckpointState(checkpoint?: phase0.Checkpoint): Promise<Uint8Array | null>;
|
|
179
196
|
/** Returns a cached state by checkpoint */
|
|
@@ -193,12 +210,26 @@ export interface IBeaconChain {
|
|
|
193
210
|
getCanonicalBlockAtSlot(
|
|
194
211
|
slot: Slot
|
|
195
212
|
): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Get local block by root, does not fetch from the network
|
|
215
|
+
*/
|
|
216
|
+
getSerializedBlockByRoot(
|
|
217
|
+
root: RootHex
|
|
218
|
+
): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null>;
|
|
196
219
|
/**
|
|
197
220
|
* Get local block by root, does not fetch from the network
|
|
198
221
|
*/
|
|
199
222
|
getBlockByRoot(
|
|
200
223
|
root: RootHex
|
|
201
224
|
): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null>;
|
|
225
|
+
getBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<deneb.BlobSidecars | null>;
|
|
226
|
+
getSerializedBlobSidecars(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null>;
|
|
227
|
+
getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<fulu.DataColumnSidecars>;
|
|
228
|
+
getSerializedDataColumnSidecars(
|
|
229
|
+
blockSlot: Slot,
|
|
230
|
+
blockRootHex: string,
|
|
231
|
+
indices: number[]
|
|
232
|
+
): Promise<(Uint8Array | undefined)[]>;
|
|
202
233
|
|
|
203
234
|
produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody>;
|
|
204
235
|
produceBlock(blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}): Promise<{
|
|
@@ -12,7 +12,6 @@ import {BeaconBlockBody, SSZTypesFor, ssz} from "@lodestar/types";
|
|
|
12
12
|
import {SyncCommitteeWitness} from "./types.js";
|
|
13
13
|
|
|
14
14
|
export function getSyncCommitteesWitness(fork: ForkName, state: BeaconStateAllForks): SyncCommitteeWitness {
|
|
15
|
-
state.commit();
|
|
16
15
|
const n1 = state.node;
|
|
17
16
|
let witness: Uint8Array[];
|
|
18
17
|
let currentSyncCommitteeRoot: Uint8Array;
|
|
@@ -71,7 +70,6 @@ export function getCurrentSyncCommitteeBranch(syncCommitteesWitness: SyncCommitt
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
export function getFinalizedRootProof(state: CachedBeaconStateAllForks): Uint8Array[] {
|
|
74
|
-
state.commit();
|
|
75
73
|
const finalizedRootGindex = state.epochCtx.isPostElectra() ? FINALIZED_ROOT_GINDEX_ELECTRA : FINALIZED_ROOT_GINDEX;
|
|
76
74
|
return new Tree(state.node).getSingleProof(BigInt(finalizedRootGindex));
|
|
77
75
|
}
|
|
@@ -5,7 +5,6 @@ import {IForkChoice} from "@lodestar/fork-choice";
|
|
|
5
5
|
import {
|
|
6
6
|
ForkName,
|
|
7
7
|
ForkSeq,
|
|
8
|
-
MAX_ATTESTATIONS,
|
|
9
8
|
MAX_ATTESTATIONS_ELECTRA,
|
|
10
9
|
MAX_COMMITTEES_PER_SLOT,
|
|
11
10
|
MIN_ATTESTATION_INCLUSION_DELAY,
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
CachedBeaconStateAllForks,
|
|
24
23
|
CachedBeaconStateAltair,
|
|
25
24
|
CachedBeaconStateGloas,
|
|
26
|
-
CachedBeaconStatePhase0,
|
|
27
25
|
EffectiveBalanceIncrements,
|
|
28
26
|
RootCache,
|
|
29
27
|
computeEpochAtSlot,
|
|
@@ -32,21 +30,12 @@ import {
|
|
|
32
30
|
getAttestationParticipationStatus,
|
|
33
31
|
getBlockRootAtSlot,
|
|
34
32
|
} from "@lodestar/state-transition";
|
|
35
|
-
import {
|
|
36
|
-
Attestation,
|
|
37
|
-
Epoch,
|
|
38
|
-
RootHex,
|
|
39
|
-
Slot,
|
|
40
|
-
ValidatorIndex,
|
|
41
|
-
electra,
|
|
42
|
-
isElectraAttestation,
|
|
43
|
-
phase0,
|
|
44
|
-
ssz,
|
|
45
|
-
} from "@lodestar/types";
|
|
33
|
+
import {Attestation, Epoch, RootHex, Slot, electra, isElectraAttestation, phase0, ssz} from "@lodestar/types";
|
|
46
34
|
import {MapDef, assert, toRootHex} from "@lodestar/utils";
|
|
47
35
|
import {Metrics} from "../../metrics/metrics.js";
|
|
48
36
|
import {IntersectResult, intersectUint8Arrays} from "../../util/bitArray.js";
|
|
49
37
|
import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
|
|
38
|
+
import {ShufflingCache} from "../shufflingCache.js";
|
|
50
39
|
import {InsertOutcome} from "./types.js";
|
|
51
40
|
import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js";
|
|
52
41
|
|
|
@@ -54,8 +43,6 @@ type DataRootHex = string;
|
|
|
54
43
|
|
|
55
44
|
type CommitteeIndex = number;
|
|
56
45
|
|
|
57
|
-
// for pre-electra
|
|
58
|
-
type AttestationWithScore = {attestation: Attestation; score: number};
|
|
59
46
|
/**
|
|
60
47
|
* for electra, this is to consolidate aggregated attestations of the same attestation data into a single attestation to be included in block
|
|
61
48
|
* note that this is local definition in this file and it's NOT validator consolidation
|
|
@@ -110,15 +97,6 @@ const MAX_RETAINED_ATTESTATIONS_PER_GROUP = 4;
|
|
|
110
97
|
*/
|
|
111
98
|
const MAX_RETAINED_ATTESTATIONS_PER_GROUP_ELECTRA = 8;
|
|
112
99
|
|
|
113
|
-
/**
|
|
114
|
-
* Pre-electra, each slot has 64 committees, and each block has 128 attestations max so in average
|
|
115
|
-
* we get 2 attestation per groups.
|
|
116
|
-
* Starting from Jan 2024, we have a performance issue getting attestations for a block. Based on the
|
|
117
|
-
* fact that lot of groups will have only 1 full participation attestation, increase this number
|
|
118
|
-
* a bit higher than average. This also help decrease number of slots to search for attestations.
|
|
119
|
-
*/
|
|
120
|
-
const MAX_ATTESTATIONS_PER_GROUP = 3;
|
|
121
|
-
|
|
122
100
|
/**
|
|
123
101
|
* For electra, there is on chain aggregation of attestations across committees, so we can just pick up to 8
|
|
124
102
|
* attestations per group, sort by scores to get first 8.
|
|
@@ -230,123 +208,18 @@ export class AggregatedAttestationPool {
|
|
|
230
208
|
this.lowestPermissibleSlot = Math.max(clockSlot - slotsToRetain, 0);
|
|
231
209
|
}
|
|
232
210
|
|
|
233
|
-
getAttestationsForBlock(
|
|
234
|
-
const forkSeq = ForkSeq[fork];
|
|
235
|
-
return forkSeq >= ForkSeq.electra
|
|
236
|
-
? this.getAttestationsForBlockElectra(fork, forkChoice, state)
|
|
237
|
-
: this.getAttestationsForBlockPreElectra(fork, forkChoice, state);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Get attestations to be included in a block pre-electra. Returns up to $MAX_ATTESTATIONS items
|
|
242
|
-
*/
|
|
243
|
-
getAttestationsForBlockPreElectra(
|
|
211
|
+
getAttestationsForBlock(
|
|
244
212
|
fork: ForkName,
|
|
245
213
|
forkChoice: IForkChoice,
|
|
214
|
+
shufflingCache: ShufflingCache,
|
|
246
215
|
state: CachedBeaconStateAllForks
|
|
247
|
-
):
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, state);
|
|
253
|
-
const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
|
|
254
|
-
|
|
255
|
-
const attestationsByScore: AttestationWithScore[] = [];
|
|
256
|
-
|
|
257
|
-
const slots = Array.from(this.attestationGroupByIndexByDataHexBySlot.keys()).sort((a, b) => b - a);
|
|
258
|
-
let minScore = Number.MAX_SAFE_INTEGER;
|
|
259
|
-
let slotCount = 0;
|
|
260
|
-
slot: for (const slot of slots) {
|
|
261
|
-
slotCount++;
|
|
262
|
-
const attestationGroupByIndexByDataHash = this.attestationGroupByIndexByDataHexBySlot.get(slot);
|
|
263
|
-
// should not happen
|
|
264
|
-
if (!attestationGroupByIndexByDataHash) {
|
|
265
|
-
throw Error(`No aggregated attestation pool for slot=${slot}`);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const epoch = computeEpochAtSlot(slot);
|
|
269
|
-
// validateAttestation condition: Attestation target epoch not in previous or current epoch
|
|
270
|
-
if (!(epoch === stateEpoch || epoch === statePrevEpoch)) {
|
|
271
|
-
continue; // Invalid attestations
|
|
272
|
-
}
|
|
273
|
-
// validateAttestation condition: Attestation slot not within inclusion window
|
|
274
|
-
if (
|
|
275
|
-
!(
|
|
276
|
-
slot + MIN_ATTESTATION_INCLUSION_DELAY <= stateSlot &&
|
|
277
|
-
// Post deneb, attestations are valid for current and previous epoch
|
|
278
|
-
(ForkSeq[fork] >= ForkSeq.deneb || stateSlot <= slot + SLOTS_PER_EPOCH)
|
|
279
|
-
)
|
|
280
|
-
) {
|
|
281
|
-
continue; // Invalid attestations
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const inclusionDistance = stateSlot - slot;
|
|
285
|
-
for (const attestationGroupByIndex of attestationGroupByIndexByDataHash.values()) {
|
|
286
|
-
for (const [committeeIndex, attestationGroup] of attestationGroupByIndex.entries()) {
|
|
287
|
-
const notSeenCommitteeMembers = notSeenValidatorsFn(epoch, slot, committeeIndex);
|
|
288
|
-
if (notSeenCommitteeMembers === null || notSeenCommitteeMembers.size === 0) {
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
slotCount > 2 &&
|
|
294
|
-
attestationsByScore.length >= MAX_ATTESTATIONS &&
|
|
295
|
-
notSeenCommitteeMembers.size / inclusionDistance < minScore
|
|
296
|
-
) {
|
|
297
|
-
// after 2 slots, there are a good chance that we have 2 * MAX_ATTESTATIONS attestations and break the for loop early
|
|
298
|
-
// if not, we may have to scan all slots in the pool
|
|
299
|
-
// if we have enough attestations and the max possible score is lower than scores of `attestationsByScore`, we should skip
|
|
300
|
-
// otherwise it takes time to check attestation, add it and remove it later after the sort by score
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (validateAttestationDataFn(attestationGroup.data) !== null) {
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// TODO: Is it necessary to validateAttestation for:
|
|
309
|
-
// - Attestation committee index not within current committee count
|
|
310
|
-
// - Attestation aggregation bits length does not match committee length
|
|
311
|
-
//
|
|
312
|
-
// These properties should not change after being validate in gossip
|
|
313
|
-
// IF they have to be validated, do it only with one attestation per group since same data
|
|
314
|
-
// The committeeCountPerSlot can be precomputed once per slot
|
|
315
|
-
const getAttestationsResult = attestationGroup.getAttestationsForBlock(
|
|
316
|
-
fork,
|
|
317
|
-
state.epochCtx.effectiveBalanceIncrements,
|
|
318
|
-
notSeenCommitteeMembers,
|
|
319
|
-
MAX_ATTESTATIONS_PER_GROUP
|
|
320
|
-
);
|
|
321
|
-
for (const {attestation, newSeenEffectiveBalance} of getAttestationsResult.result) {
|
|
322
|
-
const score = newSeenEffectiveBalance / inclusionDistance;
|
|
323
|
-
if (score < minScore) {
|
|
324
|
-
minScore = score;
|
|
325
|
-
}
|
|
326
|
-
attestationsByScore.push({
|
|
327
|
-
attestation,
|
|
328
|
-
score,
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Stop accumulating attestations there are enough that may have good scoring
|
|
333
|
-
if (attestationsByScore.length >= MAX_ATTESTATIONS * 2) {
|
|
334
|
-
break slot;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
216
|
+
): Attestation[] {
|
|
217
|
+
const forkSeq = ForkSeq[fork];
|
|
218
|
+
if (forkSeq < ForkSeq.electra) {
|
|
219
|
+
throw new Error("Does not support producing blocks for pre-electra forks anymore");
|
|
338
220
|
}
|
|
339
221
|
|
|
340
|
-
|
|
341
|
-
const attestationsForBlock: phase0.Attestation[] = [];
|
|
342
|
-
for (const [i, attestationWithScore] of sortedAttestationsByScore.entries()) {
|
|
343
|
-
if (i >= MAX_ATTESTATIONS) {
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
// attestations could be modified in this op pool, so we need to clone for block
|
|
347
|
-
attestationsForBlock.push(ssz.phase0.Attestation.clone(attestationWithScore.attestation));
|
|
348
|
-
}
|
|
349
|
-
return attestationsForBlock;
|
|
222
|
+
return this.getAttestationsForBlockElectra(fork, forkChoice, shufflingCache, state);
|
|
350
223
|
}
|
|
351
224
|
|
|
352
225
|
/**
|
|
@@ -355,6 +228,7 @@ export class AggregatedAttestationPool {
|
|
|
355
228
|
getAttestationsForBlockElectra(
|
|
356
229
|
fork: ForkName,
|
|
357
230
|
forkChoice: IForkChoice,
|
|
231
|
+
shufflingCache: ShufflingCache,
|
|
358
232
|
state: CachedBeaconStateAllForks
|
|
359
233
|
): electra.Attestation[] {
|
|
360
234
|
const stateSlot = state.slot;
|
|
@@ -362,7 +236,7 @@ export class AggregatedAttestationPool {
|
|
|
362
236
|
const statePrevEpoch = stateEpoch - 1;
|
|
363
237
|
const rootCache = new RootCache(state);
|
|
364
238
|
|
|
365
|
-
const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, state);
|
|
239
|
+
const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, shufflingCache, state);
|
|
366
240
|
const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
|
|
367
241
|
|
|
368
242
|
const slots = Array.from(this.attestationGroupByIndexByDataHexBySlot.keys()).sort((a, b) => b - a);
|
|
@@ -864,41 +738,14 @@ export function aggregateConsolidation({byCommittee, attData}: AttestationsConso
|
|
|
864
738
|
* Pre-compute participation from a CachedBeaconStateAllForks, for use to check if an attestation's committee
|
|
865
739
|
* has already attested or not.
|
|
866
740
|
*/
|
|
867
|
-
export function getNotSeenValidatorsFn(
|
|
741
|
+
export function getNotSeenValidatorsFn(
|
|
742
|
+
config: BeaconConfig,
|
|
743
|
+
shufflingCache: ShufflingCache,
|
|
744
|
+
state: CachedBeaconStateAllForks
|
|
745
|
+
): GetNotSeenValidatorsFn {
|
|
868
746
|
const stateSlot = state.slot;
|
|
869
747
|
if (config.getForkName(stateSlot) === ForkName.phase0) {
|
|
870
|
-
|
|
871
|
-
// As we are close to altair, this is not really important, it's mainly for e2e.
|
|
872
|
-
// The performance is not great due to the different BeaconState data structure to altair.
|
|
873
|
-
// check for phase0 block already
|
|
874
|
-
const phase0State = state as CachedBeaconStatePhase0;
|
|
875
|
-
const stateEpoch = computeEpochAtSlot(stateSlot);
|
|
876
|
-
|
|
877
|
-
const previousEpochParticipants = extractParticipationPhase0(
|
|
878
|
-
phase0State.previousEpochAttestations.getAllReadonly(),
|
|
879
|
-
state
|
|
880
|
-
);
|
|
881
|
-
const currentEpochParticipants = extractParticipationPhase0(
|
|
882
|
-
phase0State.currentEpochAttestations.getAllReadonly(),
|
|
883
|
-
state
|
|
884
|
-
);
|
|
885
|
-
|
|
886
|
-
return (epoch: Epoch, slot: Slot, committeeIndex: number) => {
|
|
887
|
-
const participants =
|
|
888
|
-
epoch === stateEpoch ? currentEpochParticipants : epoch === stateEpoch - 1 ? previousEpochParticipants : null;
|
|
889
|
-
if (participants === null) {
|
|
890
|
-
return null;
|
|
891
|
-
}
|
|
892
|
-
const committee = state.epochCtx.getBeaconCommittee(slot, committeeIndex);
|
|
893
|
-
|
|
894
|
-
const notSeenCommitteeMembers = new Set<number>();
|
|
895
|
-
for (const [i, validatorIndex] of committee.entries()) {
|
|
896
|
-
if (!participants.has(validatorIndex)) {
|
|
897
|
-
notSeenCommitteeMembers.add(i);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
|
|
901
|
-
};
|
|
748
|
+
throw new Error("getNotSeenValidatorsFn is not supported phase0 state");
|
|
902
749
|
}
|
|
903
750
|
|
|
904
751
|
// altair and future forks
|
|
@@ -927,7 +774,8 @@ export function getNotSeenValidatorsFn(config: BeaconConfig, state: CachedBeacon
|
|
|
927
774
|
return notSeenCommitteeMembers.size === 0 ? null : notSeenCommitteeMembers;
|
|
928
775
|
}
|
|
929
776
|
|
|
930
|
-
const
|
|
777
|
+
const decisionRoot = state.epochCtx.getShufflingDecisionRoot(computeEpochAtSlot(slot));
|
|
778
|
+
const committee = shufflingCache.getBeaconCommittee(epoch, decisionRoot, slot, committeeIndex);
|
|
931
779
|
notSeenCommitteeMembers = new Set<number>();
|
|
932
780
|
for (const [i, validatorIndex] of committee.entries()) {
|
|
933
781
|
// no need to check flagIsTimelySource as if validator is not seen, it's participation status is 0
|
|
@@ -942,26 +790,6 @@ export function getNotSeenValidatorsFn(config: BeaconConfig, state: CachedBeacon
|
|
|
942
790
|
};
|
|
943
791
|
}
|
|
944
792
|
|
|
945
|
-
export function extractParticipationPhase0(
|
|
946
|
-
attestations: phase0.PendingAttestation[],
|
|
947
|
-
state: CachedBeaconStateAllForks
|
|
948
|
-
): Set<ValidatorIndex> {
|
|
949
|
-
const {epochCtx} = state;
|
|
950
|
-
const allParticipants = new Set<ValidatorIndex>();
|
|
951
|
-
for (const att of attestations) {
|
|
952
|
-
const aggregationBits = att.aggregationBits;
|
|
953
|
-
const attData = att.data;
|
|
954
|
-
const attSlot = attData.slot;
|
|
955
|
-
const committeeIndex = attData.index;
|
|
956
|
-
const committee = epochCtx.getBeaconCommittee(attSlot, committeeIndex);
|
|
957
|
-
const participants = aggregationBits.intersectValues(committee);
|
|
958
|
-
for (const participant of participants) {
|
|
959
|
-
allParticipants.add(participant);
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
return allParticipants;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
793
|
/**
|
|
966
794
|
* This returns a function to validate if an attestation data is compatible to a state.
|
|
967
795
|
*
|
|
@@ -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
|
}
|