@lodestar/beacon-node 1.40.0-dev.c1d3b3c5cc → 1.40.0-dev.c4af2af040
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 -9
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +24 -2
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +9 -8
- 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/blocks/blockInput/blockInput.d.ts +28 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +36 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.js +1 -1
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +1 -1
- 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/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +8 -0
- 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 +9 -4
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +48 -43
- 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/interface.d.ts +7 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.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/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/options.d.ts +0 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +6 -4
- 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 +5 -3
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +4 -9
- 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 +2 -3
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +2 -16
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +5 -7
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +7 -17
- 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/stateCache/index.d.ts +0 -2
- package/lib/chain/stateCache/index.d.ts.map +1 -1
- package/lib/chain/stateCache/index.js +0 -2
- package/lib/chain/stateCache/index.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +2 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -0
- package/lib/chain/stateCache/persistentCheckpointsCache.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 +27 -8
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +1 -1
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/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 +6 -6
- package/lib/chain/validation/block.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 +1 -1
- 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.map +1 -1
- package/lib/chain/validatorMonitor.js +7 -4
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/repositories/checkpointState.js +0 -1
- package/lib/db/repositories/checkpointState.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +20 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +40 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +3 -0
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +9 -0
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorker.js +3 -0
- package/lib/network/core/networkCoreWorker.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -0
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +9 -0
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/core/types.d.ts +3 -0
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +34 -0
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +123 -0
- package/lib/network/gossip/gossipsub.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/network.d.ts +3 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +9 -0
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts +6 -0
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +9 -0
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +35 -1
- 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/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/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +31 -19
- package/src/api/impl/lodestar/index.ts +29 -3
- package/src/api/impl/validator/index.ts +14 -12
- package/src/chain/ColumnReconstructionTracker.ts +8 -4
- package/src/chain/blocks/blockInput/blockInput.ts +45 -2
- package/src/chain/blocks/importBlock.ts +1 -1
- package/src/chain/blocks/verifyBlock.ts +0 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +4 -12
- package/src/chain/blocks/writeBlockInputToDb.ts +9 -0
- 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 +56 -55
- 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/interface.ts +16 -1
- package/src/chain/opPools/executionPayloadBidPool.ts +77 -0
- package/src/chain/opPools/index.ts +2 -0
- package/src/chain/opPools/payloadAttestationPool.ts +157 -0
- package/src/chain/options.ts +0 -2
- package/src/chain/prepareNextSlot.ts +6 -6
- package/src/chain/produceBlock/produceBlockBody.ts +7 -5
- package/src/chain/regen/interface.ts +3 -13
- package/src/chain/regen/queued.ts +3 -24
- package/src/chain/regen/regen.ts +10 -25
- 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/stateCache/index.ts +0 -2
- package/src/chain/stateCache/persistentCheckpointsCache.ts +6 -2
- package/src/chain/validation/aggregateAndProof.ts +36 -14
- package/src/chain/validation/attestation.ts +33 -16
- package/src/chain/validation/attesterSlashing.ts +1 -6
- package/src/chain/validation/blobSidecar.ts +2 -7
- package/src/chain/validation/block.ts +6 -6
- 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 +1 -6
- 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 +10 -5
- package/src/db/repositories/checkpointState.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +40 -0
- package/src/network/core/networkCore.ts +12 -0
- package/src/network/core/networkCoreWorker.ts +3 -0
- package/src/network/core/networkCoreWorkerHandler.ts +9 -0
- package/src/network/core/types.ts +6 -0
- package/src/network/gossip/gossipsub.ts +147 -1
- 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/network.ts +12 -0
- package/src/network/options.ts +6 -0
- package/src/network/peers/peerManager.ts +11 -0
- package/src/network/processor/gossipHandlers.ts +49 -1
- package/src/network/processor/gossipQueues/index.ts +16 -0
- package/src/network/processor/index.ts +3 -0
- package/src/sync/backfill/backfill.ts +2 -2
- package/src/sync/backfill/verify.ts +2 -3
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts +0 -54
- package/lib/chain/stateCache/blockStateCacheImpl.d.ts.map +0 -1
- package/lib/chain/stateCache/blockStateCacheImpl.js +0 -130
- package/lib/chain/stateCache/blockStateCacheImpl.js.map +0 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts +0 -60
- package/lib/chain/stateCache/inMemoryCheckpointsCache.d.ts.map +0 -1
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js +0 -156
- package/lib/chain/stateCache/inMemoryCheckpointsCache.js.map +0 -1
- package/src/chain/stateCache/blockStateCacheImpl.ts +0 -149
- package/src/chain/stateCache/inMemoryCheckpointsCache.ts +0 -192
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {CachedBeaconStateAllForks,
|
|
2
|
+
import {CachedBeaconStateAllForks, getBlockSignatureSets} from "@lodestar/state-transition";
|
|
3
3
|
import {IndexedAttestation, SignedBeaconBlock} from "@lodestar/types";
|
|
4
4
|
import {Logger} from "@lodestar/utils";
|
|
5
5
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -17,7 +17,6 @@ import {ImportBlockOpts} from "./types.js";
|
|
|
17
17
|
*/
|
|
18
18
|
export async function verifyBlocksSignatures(
|
|
19
19
|
config: BeaconConfig,
|
|
20
|
-
index2pubkey: Index2PubkeyCache,
|
|
21
20
|
bls: IBlsVerifier,
|
|
22
21
|
logger: Logger,
|
|
23
22
|
metrics: Metrics | null,
|
|
@@ -42,16 +41,9 @@ export async function verifyBlocksSignatures(
|
|
|
42
41
|
: //
|
|
43
42
|
// Verify signatures per block to track which block is invalid
|
|
44
43
|
bls.verifySignatureSets(
|
|
45
|
-
getBlockSignatureSets(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
currentSyncCommitteeIndexed,
|
|
49
|
-
block,
|
|
50
|
-
indexedAttestationsByBlock[i],
|
|
51
|
-
{
|
|
52
|
-
skipProposerSignature: opts.validProposerSignature,
|
|
53
|
-
}
|
|
54
|
-
)
|
|
44
|
+
getBlockSignatureSets(config, currentSyncCommitteeIndexed, block, indexedAttestationsByBlock[i], {
|
|
45
|
+
skipProposerSignature: opts.validProposerSignature,
|
|
46
|
+
})
|
|
55
47
|
);
|
|
56
48
|
|
|
57
49
|
// getBlockSignatureSets() takes 45ms in benchmarks for 2022Q2 mainnet blocks (100 sigs). When syncing a 32 blocks
|
|
@@ -44,6 +44,15 @@ export async function writeBlockInputToDb(this: BeaconChain, blocksInputs: IBloc
|
|
|
44
44
|
|
|
45
45
|
// NOTE: Old data is pruned on archive
|
|
46
46
|
if (isBlockInputColumns(blockInput)) {
|
|
47
|
+
if (!blockInput.hasComputedAllData()) {
|
|
48
|
+
// Supernodes may only have a subset of the data columns by the time the block begins to be imported
|
|
49
|
+
// because full data availability can be assumed after NUMBER_OF_COLUMNS / 2 columns are available.
|
|
50
|
+
// Here, however, all data columns must be fully available/reconstructed before persisting to the DB.
|
|
51
|
+
await blockInput.waitForComputedAllData(BLOB_AVAILABILITY_TIMEOUT).catch(() => {
|
|
52
|
+
this.logger.debug("Failed to wait for computed all data", {slot, blockRoot: blockRootHex});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
const {custodyColumns} = this.custodyConfig;
|
|
48
57
|
const blobsLen = (block.message as fulu.BeaconBlock).body.blobKzgCommitments.length;
|
|
49
58
|
let dataColumnsLen: number;
|
|
@@ -7,7 +7,7 @@ import {Worker, spawn} from "@chainsafe/threads";
|
|
|
7
7
|
self = undefined;
|
|
8
8
|
|
|
9
9
|
import {PublicKey} from "@chainsafe/blst";
|
|
10
|
-
import {ISignatureSet} from "@lodestar/state-transition";
|
|
10
|
+
import {ISignatureSet, Index2PubkeyCache} from "@lodestar/state-transition";
|
|
11
11
|
import {Logger} from "@lodestar/utils";
|
|
12
12
|
import {Metrics} from "../../../metrics/index.js";
|
|
13
13
|
import {LinkedList} from "../../../util/array.js";
|
|
@@ -34,6 +34,7 @@ const workerDir = process.env.NODE_ENV === "test" ? "../../../../lib/chain/bls/m
|
|
|
34
34
|
export type BlsMultiThreadWorkerPoolModules = {
|
|
35
35
|
logger: Logger;
|
|
36
36
|
metrics: Metrics | null;
|
|
37
|
+
index2pubkey: Index2PubkeyCache;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
export type BlsMultiThreadWorkerPoolOptions = {
|
|
@@ -113,6 +114,7 @@ type WorkerDescriptor = {
|
|
|
113
114
|
export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
114
115
|
private readonly logger: Logger;
|
|
115
116
|
private readonly metrics: Metrics | null;
|
|
117
|
+
private readonly index2pubkey: Index2PubkeyCache;
|
|
116
118
|
|
|
117
119
|
private readonly workers: WorkerDescriptor[];
|
|
118
120
|
private readonly jobs = new LinkedList<JobQueueItem>();
|
|
@@ -128,9 +130,10 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
128
130
|
private workersBusy = 0;
|
|
129
131
|
|
|
130
132
|
constructor(options: BlsMultiThreadWorkerPoolOptions, modules: BlsMultiThreadWorkerPoolModules) {
|
|
131
|
-
const {logger, metrics} = modules;
|
|
133
|
+
const {logger, metrics, index2pubkey} = modules;
|
|
132
134
|
this.logger = logger;
|
|
133
135
|
this.metrics = metrics;
|
|
136
|
+
this.index2pubkey = index2pubkey;
|
|
134
137
|
this.blsVerifyAllMultiThread = options.blsVerifyAllMultiThread ?? false;
|
|
135
138
|
|
|
136
139
|
// Use compressed for herumi for now.
|
|
@@ -170,7 +173,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
170
173
|
try {
|
|
171
174
|
return verifySignatureSetsMaybeBatch(
|
|
172
175
|
sets.map((set) => ({
|
|
173
|
-
publicKey: getAggregatedPubkey(set),
|
|
176
|
+
publicKey: getAggregatedPubkey(set, this.index2pubkey),
|
|
174
177
|
message: set.signingRoot.valueOf(),
|
|
175
178
|
signature: set.signature,
|
|
176
179
|
}))
|
|
@@ -395,7 +398,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
395
398
|
try {
|
|
396
399
|
// Note: This can throw, must be handled per-job.
|
|
397
400
|
// Pubkey and signature aggregation is defered here
|
|
398
|
-
workReq = await jobItemWorkReq(job, this.metrics);
|
|
401
|
+
workReq = await jobItemWorkReq(job, this.index2pubkey, this.metrics);
|
|
399
402
|
} catch (e) {
|
|
400
403
|
this.metrics?.blsThreadPool.errorAggregateSignatureSetsCount.inc({type: job.type});
|
|
401
404
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, asyncAggregateWithRandomness} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../../metrics/metrics.js";
|
|
4
4
|
import {LinkedList} from "../../../util/array.js";
|
|
5
5
|
import {VerifySignatureOpts} from "../interface.js";
|
|
@@ -48,14 +48,18 @@ export function jobItemSigSets(job: JobQueueItem): number {
|
|
|
48
48
|
* Prepare BlsWorkReq from JobQueueItem
|
|
49
49
|
* WARNING: May throw with untrusted user input
|
|
50
50
|
*/
|
|
51
|
-
export async function jobItemWorkReq(
|
|
51
|
+
export async function jobItemWorkReq(
|
|
52
|
+
job: JobQueueItem,
|
|
53
|
+
index2pubkey: Index2PubkeyCache,
|
|
54
|
+
metrics: Metrics | null
|
|
55
|
+
): Promise<BlsWorkReq> {
|
|
52
56
|
switch (job.type) {
|
|
53
57
|
case JobQueueItemType.default:
|
|
54
58
|
return {
|
|
55
59
|
opts: job.opts,
|
|
56
60
|
sets: job.sets.map((set) => ({
|
|
57
61
|
// this can throw, handled in the consumer code
|
|
58
|
-
publicKey: getAggregatedPubkey(set, metrics).toBytes(),
|
|
62
|
+
publicKey: getAggregatedPubkey(set, index2pubkey, metrics).toBytes(),
|
|
59
63
|
signature: set.signature,
|
|
60
64
|
message: set.signingRoot,
|
|
61
65
|
})),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {PublicKey, Signature, aggregatePublicKeys, aggregateSignatures, verify} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
import {IBlsVerifier} from "./interface.js";
|
|
5
5
|
import {verifySignatureSetsMaybeBatch} from "./maybeBatch.js";
|
|
@@ -7,16 +7,18 @@ import {getAggregatedPubkey, getAggregatedPubkeysCount} from "./utils.js";
|
|
|
7
7
|
|
|
8
8
|
export class BlsSingleThreadVerifier implements IBlsVerifier {
|
|
9
9
|
private readonly metrics: Metrics | null;
|
|
10
|
+
private readonly index2pubkey: Index2PubkeyCache;
|
|
10
11
|
|
|
11
|
-
constructor({metrics = null}: {metrics: Metrics | null}) {
|
|
12
|
+
constructor({metrics = null, index2pubkey}: {metrics: Metrics | null; index2pubkey: Index2PubkeyCache}) {
|
|
12
13
|
this.metrics = metrics;
|
|
14
|
+
this.index2pubkey = index2pubkey;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
async verifySignatureSets(sets: ISignatureSet[]): Promise<boolean> {
|
|
16
18
|
this.metrics?.bls.aggregatedPubkeys.inc(getAggregatedPubkeysCount(sets));
|
|
17
19
|
|
|
18
20
|
const setsAggregated = sets.map((set) => ({
|
|
19
|
-
publicKey: getAggregatedPubkey(set),
|
|
21
|
+
publicKey: getAggregatedPubkey(set, this.index2pubkey, this.metrics),
|
|
20
22
|
message: set.signingRoot,
|
|
21
23
|
signature: set.signature,
|
|
22
24
|
}));
|
package/src/chain/bls/utils.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import {PublicKey, aggregatePublicKeys} from "@chainsafe/blst";
|
|
2
|
-
import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition";
|
|
2
|
+
import {ISignatureSet, Index2PubkeyCache, SignatureSetType} from "@lodestar/state-transition";
|
|
3
3
|
import {Metrics} from "../../metrics/metrics.js";
|
|
4
4
|
|
|
5
|
-
export function getAggregatedPubkey(
|
|
5
|
+
export function getAggregatedPubkey(
|
|
6
|
+
signatureSet: ISignatureSet,
|
|
7
|
+
index2pubkey: Index2PubkeyCache,
|
|
8
|
+
metrics: Metrics | null = null
|
|
9
|
+
): PublicKey {
|
|
6
10
|
switch (signatureSet.type) {
|
|
7
11
|
case SignatureSetType.single:
|
|
8
12
|
return signatureSet.pubkey;
|
|
9
13
|
|
|
14
|
+
case SignatureSetType.indexed:
|
|
15
|
+
return index2pubkey[signatureSet.index];
|
|
16
|
+
|
|
10
17
|
case SignatureSetType.aggregate: {
|
|
11
18
|
const timer = metrics?.blsThreadPool.pubkeysAggregationMainThreadDuration.startTimer();
|
|
12
|
-
const pubkeys =
|
|
19
|
+
const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
|
|
20
|
+
const aggregated = aggregatePublicKeys(pubkeys);
|
|
13
21
|
timer?.();
|
|
14
|
-
return
|
|
22
|
+
return aggregated;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
default:
|
|
@@ -20,11 +28,11 @@ export function getAggregatedPubkey(signatureSet: ISignatureSet, metrics: Metric
|
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
export function getAggregatedPubkeysCount(signatureSets: ISignatureSet[]): number {
|
|
23
|
-
let
|
|
31
|
+
let pubkeysCount = 0;
|
|
24
32
|
for (const set of signatureSets) {
|
|
25
33
|
if (set.type === SignatureSetType.aggregate) {
|
|
26
|
-
|
|
34
|
+
pubkeysCount += set.indices.length;
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
return
|
|
37
|
+
return pubkeysCount;
|
|
30
38
|
}
|
package/src/chain/chain.ts
CHANGED
|
@@ -79,7 +79,9 @@ import {LightClientServer} from "./lightClient/index.js";
|
|
|
79
79
|
import {
|
|
80
80
|
AggregatedAttestationPool,
|
|
81
81
|
AttestationPool,
|
|
82
|
+
ExecutionPayloadBidPool,
|
|
82
83
|
OpPool,
|
|
84
|
+
PayloadAttestationPool,
|
|
83
85
|
SyncCommitteeMessagePool,
|
|
84
86
|
SyncContributionAndProofPool,
|
|
85
87
|
} from "./opPools/index.js";
|
|
@@ -95,6 +97,9 @@ import {
|
|
|
95
97
|
SeenAttesters,
|
|
96
98
|
SeenBlockProposers,
|
|
97
99
|
SeenContributionAndProof,
|
|
100
|
+
SeenExecutionPayloadBids,
|
|
101
|
+
SeenExecutionPayloadEnvelopes,
|
|
102
|
+
SeenPayloadAttesters,
|
|
98
103
|
SeenSyncCommitteeMessages,
|
|
99
104
|
} from "./seenCache/index.js";
|
|
100
105
|
import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js";
|
|
@@ -102,12 +107,10 @@ import {SeenAttestationDatas} from "./seenCache/seenAttestationData.js";
|
|
|
102
107
|
import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js";
|
|
103
108
|
import {SeenBlockInput} from "./seenCache/seenGossipBlockInput.js";
|
|
104
109
|
import {ShufflingCache} from "./shufflingCache.js";
|
|
105
|
-
import {BlockStateCacheImpl} from "./stateCache/blockStateCacheImpl.js";
|
|
106
110
|
import {DbCPStateDatastore, checkpointToDatastoreKey} from "./stateCache/datastore/db.js";
|
|
107
111
|
import {FileCPStateDatastore} from "./stateCache/datastore/file.js";
|
|
108
112
|
import {CPStateDatastore} from "./stateCache/datastore/types.js";
|
|
109
113
|
import {FIFOBlockStateCache} from "./stateCache/fifoBlockStateCache.js";
|
|
110
|
-
import {InMemoryCheckpointStateCache} from "./stateCache/inMemoryCheckpointsCache.js";
|
|
111
114
|
import {PersistentCheckpointStateCache} from "./stateCache/persistentCheckpointsCache.js";
|
|
112
115
|
import {CheckpointStateCache} from "./stateCache/types.js";
|
|
113
116
|
import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
@@ -137,7 +140,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
137
140
|
readonly logger: Logger;
|
|
138
141
|
readonly metrics: Metrics | null;
|
|
139
142
|
readonly validatorMonitor: ValidatorMonitor | null;
|
|
140
|
-
readonly bufferPool: BufferPool
|
|
143
|
+
readonly bufferPool: BufferPool;
|
|
141
144
|
|
|
142
145
|
readonly anchorStateLatestBlockSlot: Slot;
|
|
143
146
|
|
|
@@ -156,12 +159,17 @@ export class BeaconChain implements IBeaconChain {
|
|
|
156
159
|
readonly aggregatedAttestationPool: AggregatedAttestationPool;
|
|
157
160
|
readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
|
|
158
161
|
readonly syncContributionAndProofPool;
|
|
162
|
+
readonly executionPayloadBidPool: ExecutionPayloadBidPool;
|
|
163
|
+
readonly payloadAttestationPool: PayloadAttestationPool;
|
|
159
164
|
readonly opPool: OpPool;
|
|
160
165
|
|
|
161
166
|
// Gossip seen cache
|
|
162
167
|
readonly seenAttesters = new SeenAttesters();
|
|
163
168
|
readonly seenAggregators = new SeenAggregators();
|
|
169
|
+
readonly seenPayloadAttesters = new SeenPayloadAttesters();
|
|
164
170
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
171
|
+
readonly seenExecutionPayloadEnvelopes = new SeenExecutionPayloadEnvelopes();
|
|
172
|
+
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
165
173
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
166
174
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
167
175
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
@@ -268,8 +276,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
268
276
|
const emitter = new ChainEventEmitter();
|
|
269
277
|
// by default, verify signatures on both main threads and worker threads
|
|
270
278
|
const bls = opts.blsVerifyAllMainThread
|
|
271
|
-
? new BlsSingleThreadVerifier({metrics})
|
|
272
|
-
: new BlsMultiThreadWorkerPool(opts, {logger, metrics});
|
|
279
|
+
? new BlsSingleThreadVerifier({metrics, index2pubkey})
|
|
280
|
+
: new BlsMultiThreadWorkerPool(opts, {logger, metrics, index2pubkey});
|
|
273
281
|
|
|
274
282
|
if (!clock) clock = new Clock({config, genesisTime: this.genesisTime, signal});
|
|
275
283
|
|
|
@@ -278,6 +286,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
278
286
|
this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
|
|
279
287
|
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
|
|
280
288
|
this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
|
|
289
|
+
this.executionPayloadBidPool = new ExecutionPayloadBidPool();
|
|
290
|
+
this.payloadAttestationPool = new PayloadAttestationPool(config, clock, metrics);
|
|
281
291
|
this.opPool = new OpPool(config);
|
|
282
292
|
|
|
283
293
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
@@ -327,32 +337,22 @@ export class BeaconChain implements IBeaconChain {
|
|
|
327
337
|
this.index2pubkey = index2pubkey;
|
|
328
338
|
|
|
329
339
|
const fileDataStore = opts.nHistoricalStatesFileDataStore ?? true;
|
|
330
|
-
const blockStateCache = this.opts
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
this.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
clock,
|
|
347
|
-
blockStateCache,
|
|
348
|
-
bufferPool: this.bufferPool,
|
|
349
|
-
datastore: this.cpStateDatastore,
|
|
350
|
-
},
|
|
351
|
-
this.opts
|
|
352
|
-
);
|
|
353
|
-
} else {
|
|
354
|
-
checkpointStateCache = new InMemoryCheckpointStateCache({metrics});
|
|
355
|
-
}
|
|
340
|
+
const blockStateCache = new FIFOBlockStateCache(this.opts, {metrics});
|
|
341
|
+
this.bufferPool = new BufferPool(anchorState.type.tree_serializedSize(anchorState.node), metrics);
|
|
342
|
+
|
|
343
|
+
this.cpStateDatastore = fileDataStore ? new FileCPStateDatastore(dataDir) : new DbCPStateDatastore(this.db);
|
|
344
|
+
const checkpointStateCache: CheckpointStateCache = new PersistentCheckpointStateCache(
|
|
345
|
+
{
|
|
346
|
+
config,
|
|
347
|
+
metrics,
|
|
348
|
+
logger,
|
|
349
|
+
clock,
|
|
350
|
+
blockStateCache,
|
|
351
|
+
bufferPool: this.bufferPool,
|
|
352
|
+
datastore: this.cpStateDatastore,
|
|
353
|
+
},
|
|
354
|
+
this.opts
|
|
355
|
+
);
|
|
356
356
|
|
|
357
357
|
const {checkpoint} = computeAnchorCheckpoint(config, anchorState);
|
|
358
358
|
blockStateCache.add(anchorState);
|
|
@@ -375,6 +375,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
375
375
|
forkChoice,
|
|
376
376
|
blockStateCache,
|
|
377
377
|
checkpointStateCache,
|
|
378
|
+
seenBlockInputCache: this.seenBlockInputCache,
|
|
378
379
|
db,
|
|
379
380
|
metrics,
|
|
380
381
|
validatorMonitor,
|
|
@@ -488,6 +489,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
488
489
|
this.seenAttesters.isKnown(epoch, index) ||
|
|
489
490
|
// seenAggregators = single aggregator index, not participants of the aggregate
|
|
490
491
|
this.seenAggregators.isKnown(epoch, index) ||
|
|
492
|
+
// seenPayloadAttesters = single signer of payload attestation message
|
|
493
|
+
this.seenPayloadAttesters.isKnown(epoch, index) ||
|
|
491
494
|
// seenBlockProposers = single block proposer
|
|
492
495
|
this.seenBlockProposers.seenAtEpoch(epoch, index)
|
|
493
496
|
);
|
|
@@ -530,7 +533,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
530
533
|
// only use regen queue if necessary, it'll cache in checkpointStateCache if regen gets through epoch transition
|
|
531
534
|
const head = this.forkChoice.getHead();
|
|
532
535
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
533
|
-
return this.regen.getBlockSlotState(head
|
|
536
|
+
return this.regen.getBlockSlotState(head, startSlot, {dontTransferCache: true}, regenCaller);
|
|
534
537
|
}
|
|
535
538
|
|
|
536
539
|
async getStateBySlot(
|
|
@@ -548,12 +551,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
548
551
|
if (opts?.allowRegen) {
|
|
549
552
|
// Find closest canonical block to slot, then trigger regen
|
|
550
553
|
const block = this.forkChoice.getCanonicalBlockClosestLteSlot(slot) ?? finalizedBlock;
|
|
551
|
-
const state = await this.regen.getBlockSlotState(
|
|
552
|
-
block.blockRoot,
|
|
553
|
-
slot,
|
|
554
|
-
{dontTransferCache: true},
|
|
555
|
-
RegenCaller.restApi
|
|
556
|
-
);
|
|
554
|
+
const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
|
|
557
555
|
return {
|
|
558
556
|
state,
|
|
559
557
|
executionOptimistic: isOptimisticBlock(block),
|
|
@@ -854,9 +852,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
854
852
|
}
|
|
855
853
|
|
|
856
854
|
async produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody> {
|
|
857
|
-
const {slot,
|
|
855
|
+
const {slot, parentBlock} = blockAttributes;
|
|
858
856
|
const state = await this.regen.getBlockSlotState(
|
|
859
|
-
|
|
857
|
+
parentBlock,
|
|
860
858
|
slot,
|
|
861
859
|
{dontTransferCache: true},
|
|
862
860
|
RegenCaller.produceBlock
|
|
@@ -893,7 +891,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
893
891
|
slot,
|
|
894
892
|
feeRecipient,
|
|
895
893
|
commonBlockBodyPromise,
|
|
896
|
-
|
|
894
|
+
parentBlock,
|
|
897
895
|
}: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}
|
|
898
896
|
): Promise<{
|
|
899
897
|
block: AssembledBlockType<T>;
|
|
@@ -902,7 +900,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
902
900
|
shouldOverrideBuilder?: boolean;
|
|
903
901
|
}> {
|
|
904
902
|
const state = await this.regen.getBlockSlotState(
|
|
905
|
-
|
|
903
|
+
parentBlock,
|
|
906
904
|
slot,
|
|
907
905
|
{dontTransferCache: true},
|
|
908
906
|
RegenCaller.produceBlock
|
|
@@ -919,7 +917,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
919
917
|
graffiti,
|
|
920
918
|
slot,
|
|
921
919
|
feeRecipient,
|
|
922
|
-
|
|
920
|
+
parentBlock,
|
|
923
921
|
proposerIndex,
|
|
924
922
|
proposerPubKey,
|
|
925
923
|
commonBlockBodyPromise,
|
|
@@ -942,7 +940,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
942
940
|
const block = {
|
|
943
941
|
slot,
|
|
944
942
|
proposerIndex,
|
|
945
|
-
parentRoot:
|
|
943
|
+
parentRoot: fromHex(parentBlock.blockRoot),
|
|
946
944
|
stateRoot: ZERO_HASH,
|
|
947
945
|
body,
|
|
948
946
|
} as AssembledBlockType<T>;
|
|
@@ -1138,12 +1136,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1138
1136
|
// thanks to one epoch look ahead, we don't need to dial up to attEpoch
|
|
1139
1137
|
const targetSlot = computeStartSlotAtEpoch(attEpoch - 1);
|
|
1140
1138
|
this.metrics?.gossipAttestation.useHeadBlockStateDialedToTargetEpoch.inc({caller: regenCaller});
|
|
1141
|
-
state = await this.regen.getBlockSlotState(
|
|
1142
|
-
attHeadBlock.blockRoot,
|
|
1143
|
-
targetSlot,
|
|
1144
|
-
{dontTransferCache: true},
|
|
1145
|
-
regenCaller
|
|
1146
|
-
);
|
|
1139
|
+
state = await this.regen.getBlockSlotState(attHeadBlock, targetSlot, {dontTransferCache: true}, regenCaller);
|
|
1147
1140
|
} else if (blockEpoch > attEpoch) {
|
|
1148
1141
|
// should not happen, handled inside attestation verification code
|
|
1149
1142
|
throw Error(`Block epoch ${blockEpoch} is after attestation epoch ${attEpoch}`);
|
|
@@ -1272,6 +1265,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1272
1265
|
metrics.opPool.proposerSlashingPoolSize.set(this.opPool.proposerSlashingsSize);
|
|
1273
1266
|
metrics.opPool.voluntaryExitPoolSize.set(this.opPool.voluntaryExitsSize);
|
|
1274
1267
|
metrics.opPool.syncCommitteeMessagePoolSize.set(this.syncCommitteeMessagePool.size);
|
|
1268
|
+
metrics.opPool.payloadAttestationPool.size.set(this.payloadAttestationPool.size);
|
|
1269
|
+
metrics.opPool.executionPayloadBidPool.size.set(this.executionPayloadBidPool.size);
|
|
1275
1270
|
// syncContributionAndProofPool tracks metrics on its own
|
|
1276
1271
|
metrics.opPool.blsToExecutionChangePoolSize.set(this.opPool.blsToExecutionChangeSize);
|
|
1277
1272
|
metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
|
|
@@ -1302,6 +1297,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1302
1297
|
this.aggregatedAttestationPool.prune(slot);
|
|
1303
1298
|
this.syncCommitteeMessagePool.prune(slot);
|
|
1304
1299
|
this.seenSyncCommitteeMessages.prune(slot);
|
|
1300
|
+
this.payloadAttestationPool.prune(slot);
|
|
1301
|
+
this.executionPayloadBidPool.prune(slot);
|
|
1302
|
+
this.seenExecutionPayloadBids.prune(slot);
|
|
1305
1303
|
this.seenAttestationDatas.onSlot(slot);
|
|
1306
1304
|
this.reprocessController.onSlot(slot);
|
|
1307
1305
|
|
|
@@ -1325,6 +1323,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1325
1323
|
|
|
1326
1324
|
this.seenAttesters.prune(epoch);
|
|
1327
1325
|
this.seenAggregators.prune(epoch);
|
|
1326
|
+
this.seenPayloadAttesters.prune(epoch);
|
|
1328
1327
|
this.seenAggregatedAttestations.prune(epoch);
|
|
1329
1328
|
this.seenBlockAttesters.prune(epoch);
|
|
1330
1329
|
this.beaconProposerCache.prune(epoch);
|
|
@@ -1348,7 +1347,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1348
1347
|
|
|
1349
1348
|
private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithHex): Promise<void> {
|
|
1350
1349
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1351
|
-
|
|
1350
|
+
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1351
|
+
this.seenBlockProposers.prune(finalizedSlot);
|
|
1352
|
+
this.seenExecutionPayloadEnvelopes.prune(finalizedSlot);
|
|
1352
1353
|
|
|
1353
1354
|
// Update validator custody to account for effective balance changes
|
|
1354
1355
|
await this.updateValidatorsCustodyRequirement(cp);
|
|
@@ -1356,13 +1357,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1356
1357
|
// TODO: Improve using regen here
|
|
1357
1358
|
const {blockRoot, stateRoot, slot} = this.forkChoice.getHead();
|
|
1358
1359
|
const headState = this.regen.getStateSync(stateRoot);
|
|
1359
|
-
const
|
|
1360
|
-
if (
|
|
1361
|
-
throw Error(`Head block ${slot}
|
|
1360
|
+
const blockResult = await this.getBlockByRoot(blockRoot);
|
|
1361
|
+
if (blockResult == null) {
|
|
1362
|
+
throw Error(`Head block for ${slot} is not available in cache or database`);
|
|
1362
1363
|
}
|
|
1363
1364
|
|
|
1364
1365
|
if (headState) {
|
|
1365
|
-
this.opPool.pruneAll(
|
|
1366
|
+
this.opPool.pruneAll(blockResult.block, headState);
|
|
1366
1367
|
}
|
|
1367
1368
|
|
|
1368
1369
|
if (headState === null) {
|
|
@@ -139,6 +139,14 @@ export enum AttestationErrorCode {
|
|
|
139
139
|
* Electra: Attester not in committee
|
|
140
140
|
*/
|
|
141
141
|
ATTESTER_NOT_IN_COMMITTEE = "ATTESTATION_ERROR_ATTESTER_NOT_IN_COMMITTEE",
|
|
142
|
+
/**
|
|
143
|
+
* Gloas: Invalid attestationData index: is non-zero and non-one
|
|
144
|
+
*/
|
|
145
|
+
INVALID_PAYLOAD_STATUS_VALUE = "ATTESTATION_ERROR_INVALID_PAYLOAD_STATUS_VALUE",
|
|
146
|
+
/**
|
|
147
|
+
* Gloas: Current slot attestation is marking payload as present
|
|
148
|
+
*/
|
|
149
|
+
PREMATURELY_INDICATED_PAYLOAD_PRESENT = "ATTESTATION_ERROR_PREMATURELY_INDICATED_PAYLOAD_PRESENT",
|
|
142
150
|
}
|
|
143
151
|
|
|
144
152
|
export type AttestationErrorType =
|
|
@@ -175,7 +183,9 @@ export type AttestationErrorType =
|
|
|
175
183
|
| {code: AttestationErrorCode.TOO_MANY_SKIPPED_SLOTS; headBlockSlot: Slot; attestationSlot: Slot}
|
|
176
184
|
| {code: AttestationErrorCode.NOT_EXACTLY_ONE_COMMITTEE_BIT_SET}
|
|
177
185
|
| {code: AttestationErrorCode.NON_ZERO_ATTESTATION_DATA_INDEX}
|
|
178
|
-
| {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE}
|
|
186
|
+
| {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE}
|
|
187
|
+
| {code: AttestationErrorCode.INVALID_PAYLOAD_STATUS_VALUE; attDataIndex: number}
|
|
188
|
+
| {code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT};
|
|
179
189
|
|
|
180
190
|
export class AttestationError extends GossipActionError<AttestationErrorType> {
|
|
181
191
|
getMetadata(): Record<string, string | number | null> {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
|
|
2
|
+
import {GossipActionError} from "./gossipValidation.ts";
|
|
3
|
+
|
|
4
|
+
export enum ExecutionPayloadBidErrorCode {
|
|
5
|
+
BUILDER_NOT_ELIGIBLE = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_NOT_ELIGIBLE",
|
|
6
|
+
NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
|
|
7
|
+
BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
|
|
8
|
+
BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
|
|
9
|
+
BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
|
|
10
|
+
UNKNOWN_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_BLOCK_ROOT",
|
|
11
|
+
INVALID_SLOT = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SLOT",
|
|
12
|
+
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SIGNATURE",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ExecutionPayloadBidErrorType =
|
|
16
|
+
| {code: ExecutionPayloadBidErrorCode.BUILDER_NOT_ELIGIBLE; builderIndex: BuilderIndex}
|
|
17
|
+
| {
|
|
18
|
+
code: ExecutionPayloadBidErrorCode.NON_ZERO_EXECUTION_PAYMENT;
|
|
19
|
+
builderIndex: BuilderIndex;
|
|
20
|
+
executionPayment: number;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
|
|
24
|
+
builderIndex: BuilderIndex;
|
|
25
|
+
slot: Slot;
|
|
26
|
+
parentBlockRoot: RootHex;
|
|
27
|
+
parentBlockHash: RootHex;
|
|
28
|
+
}
|
|
29
|
+
| {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
|
|
30
|
+
| {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}
|
|
31
|
+
| {code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT; parentBlockRoot: RootHex}
|
|
32
|
+
| {code: ExecutionPayloadBidErrorCode.INVALID_SLOT; builderIndex: BuilderIndex; slot: Slot}
|
|
33
|
+
| {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot};
|
|
34
|
+
|
|
35
|
+
export class ExecutionPayloadBidError extends GossipActionError<ExecutionPayloadBidErrorType> {}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
|
|
2
|
+
import {GossipActionError} from "./gossipValidation.js";
|
|
3
|
+
|
|
4
|
+
export enum ExecutionPayloadEnvelopeErrorCode {
|
|
5
|
+
BELONG_TO_FINALIZED_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BELONG_TO_FINALIZED_BLOCK",
|
|
6
|
+
BLOCK_ROOT_UNKNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_ROOT_UNKNOWN",
|
|
7
|
+
ENVELOPE_ALREADY_KNOWN = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_ALREADY_KNOWN",
|
|
8
|
+
INVALID_BLOCK = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK",
|
|
9
|
+
SLOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_SLOT_MISMATCH",
|
|
10
|
+
BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
|
|
11
|
+
BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
|
|
12
|
+
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
|
|
13
|
+
CACHE_FAIL = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_CACHE_FAIL",
|
|
14
|
+
}
|
|
15
|
+
export type ExecutionPayloadEnvelopeErrorType =
|
|
16
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.BELONG_TO_FINALIZED_BLOCK; envelopeSlot: Slot; finalizedSlot: Slot}
|
|
17
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_ROOT_UNKNOWN; blockRoot: RootHex}
|
|
18
|
+
| {
|
|
19
|
+
code: ExecutionPayloadEnvelopeErrorCode.ENVELOPE_ALREADY_KNOWN;
|
|
20
|
+
blockRoot: RootHex;
|
|
21
|
+
slot: Slot;
|
|
22
|
+
}
|
|
23
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK; blockRoot: RootHex}
|
|
24
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH; envelopeSlot: Slot; blockSlot: Slot}
|
|
25
|
+
| {
|
|
26
|
+
code: ExecutionPayloadEnvelopeErrorCode.BUILDER_INDEX_MISMATCH;
|
|
27
|
+
envelopeBuilderIndex: BuilderIndex;
|
|
28
|
+
bidBuilderIndex: BuilderIndex;
|
|
29
|
+
}
|
|
30
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.BLOCK_HASH_MISMATCH; envelopeBlockHash: RootHex; bidBlockHash: RootHex}
|
|
31
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE}
|
|
32
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.CACHE_FAIL; blockRoot: RootHex};
|
|
33
|
+
|
|
34
|
+
export class ExecutionPayloadEnvelopeError extends GossipActionError<ExecutionPayloadEnvelopeErrorType> {}
|
|
@@ -4,7 +4,10 @@ export * from "./blobSidecarError.js";
|
|
|
4
4
|
export * from "./blockError.js";
|
|
5
5
|
export * from "./blsToExecutionChangeError.js";
|
|
6
6
|
export * from "./dataColumnSidecarError.js";
|
|
7
|
+
export * from "./executionPayloadBid.js";
|
|
8
|
+
export * from "./executionPayloadEnvelope.js";
|
|
7
9
|
export * from "./gossipValidation.js";
|
|
10
|
+
export * from "./payloadAttestation.js";
|
|
8
11
|
export * from "./proposerSlashingError.js";
|
|
9
12
|
export * from "./syncCommitteeError.js";
|
|
10
13
|
export * from "./voluntaryExitError.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {RootHex, Slot, ValidatorIndex} from "@lodestar/types";
|
|
2
|
+
import {GossipActionError} from "./gossipValidation.ts";
|
|
3
|
+
|
|
4
|
+
export enum PayloadAttestationErrorCode {
|
|
5
|
+
NOT_CURRENT_SLOT = "PAYLOAD_ATTESTATION_ERROR_NOT_CURRENT_SLOT",
|
|
6
|
+
PAYLOAD_ATTESTATION_ALREADY_KNOWN = "PAYLOAD_ATTESTATION_ERROR_PAYLOAD_ATTESTATION_ALREADY_KNOWN",
|
|
7
|
+
UNKNOWN_BLOCK_ROOT = "PAYLOAD_ATTESTATION_ERROR_UNKNOWN_BLOCK_ROOT",
|
|
8
|
+
INVALID_BLOCK = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK",
|
|
9
|
+
INVALID_ATTESTER = "PAYLOAD_ATTESTATION_ERROR_INVALID_ATTESTER",
|
|
10
|
+
INVALID_SIGNATURE = "PAYLOAD_ATTESTATION_ERROR_INVALID_SIGNATURE",
|
|
11
|
+
}
|
|
12
|
+
export type PayloadAttestationErrorType =
|
|
13
|
+
| {code: PayloadAttestationErrorCode.NOT_CURRENT_SLOT; currentSlot: Slot; slot: Slot}
|
|
14
|
+
| {
|
|
15
|
+
code: PayloadAttestationErrorCode.PAYLOAD_ATTESTATION_ALREADY_KNOWN;
|
|
16
|
+
validatorIndex: ValidatorIndex;
|
|
17
|
+
slot: Slot;
|
|
18
|
+
blockRoot: RootHex;
|
|
19
|
+
}
|
|
20
|
+
| {code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT; blockRoot: RootHex}
|
|
21
|
+
| {code: PayloadAttestationErrorCode.INVALID_BLOCK; blockRoot: RootHex}
|
|
22
|
+
| {code: PayloadAttestationErrorCode.INVALID_ATTESTER; attesterIndex: ValidatorIndex}
|
|
23
|
+
| {code: PayloadAttestationErrorCode.INVALID_SIGNATURE};
|
|
24
|
+
|
|
25
|
+
export class PayloadAttestationError extends GossipActionError<PayloadAttestationErrorType> {}
|