@lodestar/beacon-node 1.39.0-dev.3bf4734ba9 → 1.39.0-dev.4263377242
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/README.md +1 -1
- package/lib/api/impl/beacon/blocks/utils.js +1 -1
- package/lib/api/impl/beacon/blocks/utils.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/lodestar/index.js +1 -1
- 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 +1 -3
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -3
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +12 -3
- 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 +9 -2
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +4 -2
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +3 -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/chain.d.ts +11 -14
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +36 -50
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +3 -3
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/initState.d.ts +2 -15
- package/lib/chain/initState.d.ts.map +1 -1
- package/lib/chain/initState.js +6 -65
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -11
- 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 +8 -12
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +13 -142
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +3 -0
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +14 -16
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +0 -4
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +5 -28
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +0 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +10 -13
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/interface.d.ts +1 -5
- package/lib/chain/regen/interface.d.ts.map +1 -1
- package/lib/chain/regen/queued.d.ts +4 -7
- package/lib/chain/regen/queued.d.ts.map +1 -1
- package/lib/chain/regen/queued.js +15 -25
- package/lib/chain/regen/queued.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +1 -1
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +13 -17
- package/lib/chain/regen/regen.js.map +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 +9 -7
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +21 -19
- 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 +9 -0
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +2 -2
- 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 +2 -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 +5 -3
- 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 +10 -3
- 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 +2 -3
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +3 -2
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.js +1 -1
- package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -1
- 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 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +1 -2
- 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 -3
- 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/db/beacon.d.ts +3 -7
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +33 -12
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +12 -6
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +6 -1
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +2 -7
- package/lib/db/interface.d.ts.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 -15
- package/lib/db/repositories/checkpointState.js.map +1 -1
- package/lib/db/repositories/index.d.ts +0 -3
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +0 -3
- package/lib/db/repositories/index.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/http.d.ts +1 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +2 -3
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +1 -1
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -1
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.d.ts +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -0
- package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -0
- package/lib/execution/engine/jwt.d.ts.map +1 -0
- package/lib/execution/engine/jwt.js.map +1 -0
- 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 +35 -8
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/types.d.ts +1 -1
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +1 -1
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts +64 -2
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js +91 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -41
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +3 -107
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/events.d.ts +1 -1
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +1 -1
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/events.d.ts +6 -1
- package/lib/network/events.d.ts.map +1 -1
- package/lib/network/events.js +7 -1
- package/lib/network/events.js.map +1 -1
- package/lib/network/peers/discover.d.ts.map +1 -1
- package/lib/network/peers/discover.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 +6 -3
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +30 -12
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +9 -6
- package/lib/node/notifier.js.map +1 -1
- package/lib/node/options.d.ts +0 -2
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +0 -2
- package/lib/node/options.js.map +1 -1
- package/lib/node/utils/interop/deposits.d.ts +2 -1
- package/lib/node/utils/interop/deposits.d.ts.map +1 -1
- package/lib/node/utils/interop/deposits.js.map +1 -1
- package/lib/node/utils/interop/state.d.ts +1 -1
- package/lib/node/utils/interop/state.d.ts.map +1 -1
- package/lib/node/utils/state.d.ts +1 -7
- package/lib/node/utils/state.d.ts.map +1 -1
- package/lib/node/utils/state.js +1 -14
- package/lib/node/utils/state.js.map +1 -1
- package/lib/sync/backfill/backfill.d.ts.map +1 -1
- package/lib/sync/backfill/backfill.js +2 -4
- package/lib/sync/backfill/backfill.js.map +1 -1
- package/lib/sync/backfill/verify.d.ts +2 -2
- package/lib/sync/backfill/verify.d.ts.map +1 -1
- package/lib/sync/backfill/verify.js +3 -3
- package/lib/sync/backfill/verify.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/workerEvents.d.ts +1 -6
- package/lib/util/workerEvents.d.ts.map +1 -1
- package/lib/util/workerEvents.js +8 -8
- package/lib/util/workerEvents.js.map +1 -1
- package/package.json +28 -26
- package/src/api/impl/beacon/blocks/utils.ts +1 -1
- package/src/api/impl/beacon/state/utils.ts +2 -22
- package/src/api/impl/lodestar/index.ts +1 -1
- package/src/api/impl/proof/index.ts +1 -2
- package/src/api/impl/validator/index.ts +1 -3
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -3
- package/src/chain/blocks/importBlock.ts +13 -3
- package/src/chain/blocks/verifyBlock.ts +10 -3
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -2
- package/src/chain/blocks/verifyBlocksSignatures.ts +13 -3
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +1 -0
- package/src/chain/chain.ts +50 -62
- package/src/chain/forkChoice/index.ts +3 -2
- package/src/chain/initState.ts +6 -100
- package/src/chain/interface.ts +6 -10
- package/src/chain/lightClient/proofs.ts +0 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +23 -195
- package/src/chain/opPools/opPool.ts +13 -15
- package/src/chain/prepareNextSlot.ts +3 -34
- package/src/chain/produceBlock/produceBlockBody.ts +15 -14
- package/src/chain/regen/interface.ts +1 -5
- package/src/chain/regen/queued.ts +15 -34
- package/src/chain/regen/regen.ts +12 -18
- 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 +32 -27
- package/src/chain/stateCache/types.ts +5 -10
- package/src/chain/validation/aggregateAndProof.ts +12 -0
- package/src/chain/validation/attestation.ts +3 -3
- package/src/chain/validation/attesterSlashing.ts +14 -2
- package/src/chain/validation/blobSidecar.ts +3 -3
- package/src/chain/validation/block.ts +6 -2
- package/src/chain/validation/blsToExecutionChange.ts +10 -8
- package/src/chain/validation/dataColumnSidecar.ts +3 -3
- package/src/chain/validation/proposerSlashing.ts +8 -2
- package/src/chain/validation/signatureSets/aggregateAndProof.ts +1 -1
- package/src/chain/validation/signatureSets/contributionAndProof.ts +3 -1
- package/src/chain/validation/signatureSets/syncCommittee.ts +3 -1
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +3 -1
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -1
- package/src/chain/validation/syncCommittee.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +8 -3
- package/src/chain/validation/voluntaryExit.ts +1 -1
- package/src/db/beacon.ts +38 -16
- package/src/db/buckets.ts +12 -7
- package/src/db/interface.ts +2 -13
- package/src/db/repositories/checkpointState.ts +3 -19
- package/src/db/repositories/index.ts +0 -3
- package/src/db/repositories/stateArchive.ts +13 -27
- package/src/execution/engine/http.ts +8 -9
- package/src/execution/engine/index.ts +1 -1
- package/src/execution/engine/interface.ts +1 -1
- package/src/{eth1/provider → execution/engine}/jsonRpcHttpClient.ts +1 -1
- package/src/execution/engine/mock.ts +41 -15
- package/src/execution/engine/payloadIdCache.ts +1 -1
- package/src/execution/engine/types.ts +9 -9
- package/src/execution/engine/utils.ts +111 -5
- package/src/index.ts +1 -2
- package/src/metrics/metrics/lodestar.ts +3 -109
- package/src/network/core/events.ts +1 -1
- package/src/network/events.ts +7 -1
- package/src/network/peers/discover.ts +3 -3
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -1
- package/src/node/nodejs.ts +37 -13
- package/src/node/notifier.ts +13 -7
- package/src/node/options.ts +0 -3
- package/src/node/utils/interop/deposits.ts +3 -1
- package/src/node/utils/interop/state.ts +1 -1
- package/src/node/utils/state.ts +3 -18
- package/src/sync/backfill/backfill.ts +2 -9
- package/src/sync/backfill/verify.ts +3 -8
- package/src/util/sszBytes.ts +1 -1
- package/src/util/workerEvents.ts +9 -8
- package/lib/chain/genesis/genesis.d.ts +0 -51
- package/lib/chain/genesis/genesis.d.ts.map +0 -1
- package/lib/chain/genesis/genesis.js +0 -123
- package/lib/chain/genesis/genesis.js.map +0 -1
- package/lib/chain/genesis/interface.d.ts +0 -13
- package/lib/chain/genesis/interface.d.ts.map +0 -1
- package/lib/chain/genesis/interface.js +0 -2
- package/lib/chain/genesis/interface.js.map +0 -1
- package/lib/chain/rewards/attestationsRewards.d.ts +0 -7
- package/lib/chain/rewards/attestationsRewards.d.ts.map +0 -1
- package/lib/chain/rewards/attestationsRewards.js +0 -112
- package/lib/chain/rewards/attestationsRewards.js.map +0 -1
- package/lib/chain/rewards/blockRewards.d.ts +0 -14
- package/lib/chain/rewards/blockRewards.d.ts.map +0 -1
- package/lib/chain/rewards/blockRewards.js +0 -94
- package/lib/chain/rewards/blockRewards.js.map +0 -1
- package/lib/chain/rewards/syncCommitteeRewards.d.ts +0 -6
- package/lib/chain/rewards/syncCommitteeRewards.d.ts.map +0 -1
- package/lib/chain/rewards/syncCommitteeRewards.js +0 -36
- package/lib/chain/rewards/syncCommitteeRewards.js.map +0 -1
- package/lib/db/repositories/depositDataRoot.d.ts +0 -22
- package/lib/db/repositories/depositDataRoot.d.ts.map +0 -1
- package/lib/db/repositories/depositDataRoot.js +0 -62
- package/lib/db/repositories/depositDataRoot.js.map +0 -1
- package/lib/db/repositories/depositEvent.d.ts +0 -13
- package/lib/db/repositories/depositEvent.d.ts.map +0 -1
- package/lib/db/repositories/depositEvent.js +0 -27
- package/lib/db/repositories/depositEvent.js.map +0 -1
- package/lib/db/repositories/eth1Data.d.ts +0 -13
- package/lib/db/repositories/eth1Data.d.ts.map +0 -1
- package/lib/db/repositories/eth1Data.js +0 -26
- package/lib/db/repositories/eth1Data.js.map +0 -1
- package/lib/db/single/index.d.ts +0 -3
- package/lib/db/single/index.d.ts.map +0 -1
- package/lib/db/single/index.js +0 -3
- package/lib/db/single/index.js.map +0 -1
- package/lib/db/single/preGenesisState.d.ts +0 -16
- package/lib/db/single/preGenesisState.d.ts.map +0 -1
- package/lib/db/single/preGenesisState.js +0 -29
- package/lib/db/single/preGenesisState.js.map +0 -1
- package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts +0 -14
- package/lib/db/single/preGenesisStateLastProcessedBlock.d.ts.map +0 -1
- package/lib/db/single/preGenesisStateLastProcessedBlock.js +0 -27
- package/lib/db/single/preGenesisStateLastProcessedBlock.js.map +0 -1
- package/lib/eth1/errors.d.ts +0 -66
- package/lib/eth1/errors.d.ts.map +0 -1
- package/lib/eth1/errors.js +0 -27
- package/lib/eth1/errors.js.map +0 -1
- package/lib/eth1/eth1DataCache.d.ts +0 -19
- package/lib/eth1/eth1DataCache.d.ts.map +0 -1
- package/lib/eth1/eth1DataCache.js +0 -19
- package/lib/eth1/eth1DataCache.js.map +0 -1
- package/lib/eth1/eth1DepositDataTracker.d.ts +0 -80
- package/lib/eth1/eth1DepositDataTracker.d.ts.map +0 -1
- package/lib/eth1/eth1DepositDataTracker.js +0 -317
- package/lib/eth1/eth1DepositDataTracker.js.map +0 -1
- package/lib/eth1/eth1DepositsCache.d.ts +0 -42
- package/lib/eth1/eth1DepositsCache.d.ts.map +0 -1
- package/lib/eth1/eth1DepositsCache.js +0 -119
- package/lib/eth1/eth1DepositsCache.js.map +0 -1
- package/lib/eth1/index.d.ts +0 -31
- package/lib/eth1/index.d.ts.map +0 -1
- package/lib/eth1/index.js +0 -71
- package/lib/eth1/index.js.map +0 -1
- package/lib/eth1/interface.d.ts +0 -74
- package/lib/eth1/interface.d.ts.map +0 -1
- package/lib/eth1/interface.js +0 -8
- package/lib/eth1/interface.js.map +0 -1
- package/lib/eth1/options.d.ts +0 -22
- package/lib/eth1/options.d.ts.map +0 -1
- package/lib/eth1/options.js +0 -8
- package/lib/eth1/options.js.map +0 -1
- package/lib/eth1/provider/eth1Provider.d.ts +0 -39
- package/lib/eth1/provider/eth1Provider.d.ts.map +0 -1
- package/lib/eth1/provider/eth1Provider.js +0 -147
- package/lib/eth1/provider/eth1Provider.js.map +0 -1
- package/lib/eth1/provider/jsonRpcHttpClient.d.ts.map +0 -1
- package/lib/eth1/provider/jsonRpcHttpClient.js.map +0 -1
- package/lib/eth1/provider/jwt.d.ts.map +0 -1
- package/lib/eth1/provider/jwt.js.map +0 -1
- package/lib/eth1/provider/utils.d.ts +0 -65
- package/lib/eth1/provider/utils.d.ts.map +0 -1
- package/lib/eth1/provider/utils.js +0 -120
- package/lib/eth1/provider/utils.js.map +0 -1
- package/lib/eth1/stream.d.ts +0 -15
- package/lib/eth1/stream.d.ts.map +0 -1
- package/lib/eth1/stream.js +0 -54
- package/lib/eth1/stream.js.map +0 -1
- package/lib/eth1/utils/depositContract.d.ts +0 -14
- package/lib/eth1/utils/depositContract.d.ts.map +0 -1
- package/lib/eth1/utils/depositContract.js +0 -33
- package/lib/eth1/utils/depositContract.js.map +0 -1
- package/lib/eth1/utils/deposits.d.ts +0 -8
- package/lib/eth1/utils/deposits.d.ts.map +0 -1
- package/lib/eth1/utils/deposits.js +0 -47
- package/lib/eth1/utils/deposits.js.map +0 -1
- package/lib/eth1/utils/eth1Data.d.ts +0 -22
- package/lib/eth1/utils/eth1Data.d.ts.map +0 -1
- package/lib/eth1/utils/eth1Data.js +0 -77
- package/lib/eth1/utils/eth1Data.js.map +0 -1
- package/lib/eth1/utils/eth1DepositEvent.d.ts +0 -7
- package/lib/eth1/utils/eth1DepositEvent.d.ts.map +0 -1
- package/lib/eth1/utils/eth1DepositEvent.js +0 -13
- package/lib/eth1/utils/eth1DepositEvent.js.map +0 -1
- package/lib/eth1/utils/eth1Vote.d.ts +0 -17
- package/lib/eth1/utils/eth1Vote.d.ts.map +0 -1
- package/lib/eth1/utils/eth1Vote.js +0 -111
- package/lib/eth1/utils/eth1Vote.js.map +0 -1
- package/lib/eth1/utils/groupDepositEventsByBlock.d.ts +0 -9
- package/lib/eth1/utils/groupDepositEventsByBlock.d.ts.map +0 -1
- package/lib/eth1/utils/groupDepositEventsByBlock.js +0 -17
- package/lib/eth1/utils/groupDepositEventsByBlock.js.map +0 -1
- package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts +0 -10
- package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.d.ts.map +0 -1
- package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js +0 -14
- package/lib/eth1/utils/optimizeNextBlockDiffForGenesis.js.map +0 -1
- package/src/chain/genesis/genesis.ts +0 -190
- package/src/chain/genesis/interface.ts +0 -14
- package/src/chain/rewards/attestationsRewards.ts +0 -197
- package/src/chain/rewards/blockRewards.ts +0 -150
- package/src/chain/rewards/syncCommitteeRewards.ts +0 -58
- package/src/db/repositories/depositDataRoot.ts +0 -80
- package/src/db/repositories/depositEvent.ts +0 -32
- package/src/db/repositories/eth1Data.ts +0 -33
- package/src/db/single/index.ts +0 -2
- package/src/db/single/preGenesisState.ts +0 -37
- package/src/db/single/preGenesisStateLastProcessedBlock.ts +0 -34
- package/src/eth1/errors.ts +0 -40
- package/src/eth1/eth1DataCache.ts +0 -26
- package/src/eth1/eth1DepositDataTracker.ts +0 -410
- package/src/eth1/eth1DepositsCache.ts +0 -141
- package/src/eth1/index.ts +0 -94
- package/src/eth1/interface.ts +0 -87
- package/src/eth1/options.ts +0 -28
- package/src/eth1/provider/eth1Provider.ts +0 -229
- package/src/eth1/provider/utils.ts +0 -136
- package/src/eth1/stream.ts +0 -75
- package/src/eth1/utils/depositContract.ts +0 -37
- package/src/eth1/utils/deposits.ts +0 -70
- package/src/eth1/utils/eth1Data.ts +0 -100
- package/src/eth1/utils/eth1DepositEvent.ts +0 -12
- package/src/eth1/utils/eth1Vote.ts +0 -142
- package/src/eth1/utils/groupDepositEventsByBlock.ts +0 -19
- package/src/eth1/utils/optimizeNextBlockDiffForGenesis.ts +0 -18
- /package/lib/{eth1/provider → execution/engine}/jsonRpcHttpClient.js +0 -0
- /package/lib/{eth1/provider → execution/engine}/jwt.d.ts +0 -0
- /package/lib/{eth1/provider → execution/engine}/jwt.js +0 -0
- /package/src/{eth1/provider → execution/engine}/jwt.ts +0 -0
|
@@ -418,13 +418,20 @@ export async function importBlock(
|
|
|
418
418
|
this.logger.verbose("After importBlock caching postState without SSZ cache", {slot: postState.slot});
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
// Cache shufflings when crossing an epoch boundary
|
|
422
|
+
const parentEpoch = computeEpochAtSlot(parentBlockSlot);
|
|
423
|
+
if (parentEpoch < blockEpoch) {
|
|
424
|
+
this.shufflingCache.processState(postState);
|
|
425
|
+
this.logger.verbose("Processed shuffling for next epoch", {parentEpoch, blockEpoch, slot: blockSlot});
|
|
426
|
+
}
|
|
427
|
+
|
|
421
428
|
if (blockSlot % SLOTS_PER_EPOCH === 0) {
|
|
422
429
|
// Cache state to preserve epoch transition work
|
|
423
430
|
const checkpointState = postState;
|
|
424
431
|
const cp = getCheckpointFromState(checkpointState);
|
|
425
432
|
this.regen.addCheckpointState(cp, checkpointState);
|
|
426
|
-
// consumers should not mutate
|
|
427
|
-
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState
|
|
433
|
+
// consumers should not mutate state ever
|
|
434
|
+
this.emitter.emit(ChainEvent.checkpoint, cp, checkpointState);
|
|
428
435
|
|
|
429
436
|
// Note: in-lined code from previos handler of ChainEvent.checkpoint
|
|
430
437
|
this.logger.verbose("Checkpoint processed", toCheckpointHex(cp));
|
|
@@ -584,7 +591,10 @@ export function addAttestationPostElectra(
|
|
|
584
591
|
true
|
|
585
592
|
);
|
|
586
593
|
} else {
|
|
587
|
-
const
|
|
594
|
+
const attSlot = attestation.data.slot;
|
|
595
|
+
const attEpoch = computeEpochAtSlot(attSlot);
|
|
596
|
+
const decisionRoot = epochCtx.getShufflingDecisionRoot(attEpoch);
|
|
597
|
+
const committees = this.shufflingCache.getBeaconCommittees(attEpoch, decisionRoot, attSlot, committeeIndices);
|
|
588
598
|
const aggregationBools = attestation.aggregationBits.toBoolArray();
|
|
589
599
|
let offset = 0;
|
|
590
600
|
for (let i = 0; i < committees.length; i++) {
|
|
@@ -75,6 +75,10 @@ export async function verifyBlocksInEpoch(
|
|
|
75
75
|
throw new BlockError(block0, {code: BlockErrorCode.PRESTATE_MISSING, error: e as Error});
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
// in forky condition, make sure to populate ShufflingCache with regened state
|
|
79
|
+
// otherwise it may fail to get indexed attestations from shuffling cache later
|
|
80
|
+
this.shufflingCache.processState(preState0);
|
|
81
|
+
|
|
78
82
|
if (!isStateValidatorsNodesPopulated(preState0)) {
|
|
79
83
|
this.logger.verbose("verifyBlocksInEpoch preState0 SSZ cache stats", {
|
|
80
84
|
slot: preState0.slot,
|
|
@@ -105,9 +109,11 @@ export async function verifyBlocksInEpoch(
|
|
|
105
109
|
// Store indexed attestations for each block to avoid recomputing them during import
|
|
106
110
|
const indexedAttestationsByBlock: IndexedAttestation[][] = [];
|
|
107
111
|
for (const [i, block] of blocks.entries()) {
|
|
108
|
-
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) =>
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) => {
|
|
113
|
+
const attEpoch = computeEpochAtSlot(attestation.data.slot);
|
|
114
|
+
const decisionRoot = preState0.epochCtx.getShufflingDecisionRoot(attEpoch);
|
|
115
|
+
return this.shufflingCache.getIndexedAttestation(attEpoch, decisionRoot, fork, attestation);
|
|
116
|
+
});
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
// batch all I/O operations to reduce overhead
|
|
@@ -139,6 +145,7 @@ export async function verifyBlocksInEpoch(
|
|
|
139
145
|
// All signatures at once
|
|
140
146
|
opts.skipVerifyBlockSignatures !== true
|
|
141
147
|
? verifyBlocksSignatures(
|
|
148
|
+
this.config,
|
|
142
149
|
this.index2pubkey,
|
|
143
150
|
this.bls,
|
|
144
151
|
this.logger,
|
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
ProtoBlock,
|
|
9
9
|
} from "@lodestar/fork-choice";
|
|
10
10
|
import {ForkSeq} from "@lodestar/params";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
CachedBeaconStateAllForks,
|
|
13
|
+
isExecutionBlockBodyType,
|
|
14
|
+
isExecutionEnabled,
|
|
15
|
+
isExecutionStateType,
|
|
16
|
+
} from "@lodestar/state-transition";
|
|
12
17
|
import {bellatrix, electra} from "@lodestar/types";
|
|
13
18
|
import {ErrorAborted, Logger, toRootHex} from "@lodestar/utils";
|
|
14
19
|
import {ExecutionPayloadStatus, IExecutionEngine} from "../../execution/engine/interface.js";
|
|
@@ -145,7 +150,9 @@ export async function verifyBlockExecutionPayload(
|
|
|
145
150
|
const block = blockInput.getBlock();
|
|
146
151
|
/** Not null if execution is enabled */
|
|
147
152
|
const executionPayloadEnabled =
|
|
148
|
-
isExecutionStateType(preState0) &&
|
|
153
|
+
isExecutionStateType(preState0) &&
|
|
154
|
+
isExecutionBlockBodyType(block.message.body) &&
|
|
155
|
+
isExecutionEnabled(preState0, block.message)
|
|
149
156
|
? block.message.body.executionPayload
|
|
150
157
|
: null;
|
|
151
158
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
1
2
|
import {CachedBeaconStateAllForks, Index2PubkeyCache, getBlockSignatureSets} from "@lodestar/state-transition";
|
|
2
3
|
import {IndexedAttestation, SignedBeaconBlock} from "@lodestar/types";
|
|
3
4
|
import {Logger} from "@lodestar/utils";
|
|
@@ -15,6 +16,7 @@ import {ImportBlockOpts} from "./types.js";
|
|
|
15
16
|
* Since all data is known in advance all signatures are verified at once in parallel.
|
|
16
17
|
*/
|
|
17
18
|
export async function verifyBlocksSignatures(
|
|
19
|
+
config: BeaconConfig,
|
|
18
20
|
index2pubkey: Index2PubkeyCache,
|
|
19
21
|
bls: IBlsVerifier,
|
|
20
22
|
logger: Logger,
|
|
@@ -26,6 +28,7 @@ export async function verifyBlocksSignatures(
|
|
|
26
28
|
): Promise<{verifySignaturesTime: number}> {
|
|
27
29
|
const isValidPromises: Promise<boolean>[] = [];
|
|
28
30
|
const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
|
|
31
|
+
const currentSyncCommitteeIndexed = preState0.epochCtx.currentSyncCommitteeIndexed;
|
|
29
32
|
|
|
30
33
|
// Verifies signatures after running state transition, so all SyncCommittee signed roots are known at this point.
|
|
31
34
|
// We must ensure block.slot <= state.slot before running getAllBlockSignatureSets().
|
|
@@ -39,9 +42,16 @@ export async function verifyBlocksSignatures(
|
|
|
39
42
|
: //
|
|
40
43
|
// Verify signatures per block to track which block is invalid
|
|
41
44
|
bls.verifySignatureSets(
|
|
42
|
-
getBlockSignatureSets(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
getBlockSignatureSets(
|
|
46
|
+
config,
|
|
47
|
+
index2pubkey,
|
|
48
|
+
currentSyncCommitteeIndexed,
|
|
49
|
+
block,
|
|
50
|
+
indexedAttestationsByBlock[i],
|
|
51
|
+
{
|
|
52
|
+
skipProposerSignature: opts.validProposerSignature,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
45
55
|
);
|
|
46
56
|
|
|
47
57
|
// getBlockSignatureSets() takes 45ms in benchmarks for 2022Q2 mainnet blocks (100 sigs). When syncing a 32 blocks
|
|
@@ -59,6 +59,7 @@ export async function verifyBlocksStateTransitionOnly(
|
|
|
59
59
|
// if block is trusted don't verify proposer or op signature
|
|
60
60
|
verifyProposer: !useBlsBatchVerify && !validSignatures && !validProposerSignature,
|
|
61
61
|
verifySignatures: !useBlsBatchVerify && !validSignatures,
|
|
62
|
+
dontTransferCache: false,
|
|
62
63
|
},
|
|
63
64
|
{metrics, validatorMonitor}
|
|
64
65
|
);
|
package/src/chain/chain.ts
CHANGED
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
EpochShuffling,
|
|
15
15
|
Index2PubkeyCache,
|
|
16
16
|
computeAnchorCheckpoint,
|
|
17
|
+
computeAttestationsRewards,
|
|
18
|
+
computeBlockRewards,
|
|
17
19
|
computeEndSlotAtEpoch,
|
|
18
20
|
computeEpochAtSlot,
|
|
19
21
|
computeStartSlotAtEpoch,
|
|
20
|
-
|
|
22
|
+
computeSyncCommitteeRewards,
|
|
21
23
|
getEffectiveBalanceIncrementsZeroInactive,
|
|
22
24
|
getEffectiveBalancesFromStateBytes,
|
|
23
|
-
isCachedBeaconState,
|
|
24
25
|
processSlots,
|
|
25
26
|
} from "@lodestar/state-transition";
|
|
26
27
|
import {
|
|
@@ -38,12 +39,12 @@ import {
|
|
|
38
39
|
Wei,
|
|
39
40
|
isBlindedBeaconBlock,
|
|
40
41
|
phase0,
|
|
42
|
+
rewards,
|
|
41
43
|
} from "@lodestar/types";
|
|
42
44
|
import {Logger, fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRootHex} from "@lodestar/utils";
|
|
43
45
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
44
46
|
import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
|
|
45
47
|
import {IBeaconDb} from "../db/index.js";
|
|
46
|
-
import {IEth1ForBlockProduction} from "../eth1/index.js";
|
|
47
48
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
48
49
|
import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
|
|
49
50
|
import {Metrics} from "../metrics/index.js";
|
|
@@ -51,6 +52,7 @@ import {computeNodeIdFromPrivateKey} from "../network/subnets/interface.js";
|
|
|
51
52
|
import {BufferPool} from "../util/bufferPool.js";
|
|
52
53
|
import {Clock, ClockEvent, IClock} from "../util/clock.js";
|
|
53
54
|
import {CustodyConfig, getValidatorsCustodyRequirement} from "../util/dataColumns.js";
|
|
55
|
+
import {callInNextEventLoop} from "../util/eventLoop.js";
|
|
54
56
|
import {ensureDir, writeIfNotExist} from "../util/file.js";
|
|
55
57
|
import {isOptimisticBlock} from "../util/forkChoice.js";
|
|
56
58
|
import {SerializedCache} from "../util/serializedCache.js";
|
|
@@ -80,9 +82,6 @@ import {AssembledBlockType, BlockType, ProduceResult} from "./produceBlock/index
|
|
|
80
82
|
import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produceBlock/produceBlockBody.js";
|
|
81
83
|
import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js";
|
|
82
84
|
import {ReprocessController} from "./reprocess.js";
|
|
83
|
-
import {AttestationsRewards, computeAttestationsRewards} from "./rewards/attestationsRewards.js";
|
|
84
|
-
import {BlockRewards, computeBlockRewards} from "./rewards/blockRewards.js";
|
|
85
|
-
import {SyncCommitteeRewards, computeSyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js";
|
|
86
85
|
import {
|
|
87
86
|
SeenAggregators,
|
|
88
87
|
SeenAttesters,
|
|
@@ -117,7 +116,6 @@ const DEFAULT_MAX_CACHED_PRODUCED_RESULTS = 4;
|
|
|
117
116
|
export class BeaconChain implements IBeaconChain {
|
|
118
117
|
readonly genesisTime: UintNum64;
|
|
119
118
|
readonly genesisValidatorsRoot: Root;
|
|
120
|
-
readonly eth1: IEth1ForBlockProduction;
|
|
121
119
|
readonly executionEngine: IExecutionEngine;
|
|
122
120
|
readonly executionBuilder?: IExecutionBuilder;
|
|
123
121
|
// Expose config for convenience in modularized functions
|
|
@@ -144,7 +142,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
144
142
|
readonly aggregatedAttestationPool: AggregatedAttestationPool;
|
|
145
143
|
readonly syncCommitteeMessagePool: SyncCommitteeMessagePool;
|
|
146
144
|
readonly syncContributionAndProofPool;
|
|
147
|
-
readonly opPool
|
|
145
|
+
readonly opPool: OpPool;
|
|
148
146
|
|
|
149
147
|
// Gossip seen cache
|
|
150
148
|
readonly seenAttesters = new SeenAttesters();
|
|
@@ -206,6 +204,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
206
204
|
{
|
|
207
205
|
privateKey,
|
|
208
206
|
config,
|
|
207
|
+
pubkey2index,
|
|
208
|
+
index2pubkey,
|
|
209
209
|
db,
|
|
210
210
|
dbName,
|
|
211
211
|
dataDir,
|
|
@@ -216,12 +216,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
216
216
|
validatorMonitor,
|
|
217
217
|
anchorState,
|
|
218
218
|
isAnchorStateFinalized,
|
|
219
|
-
eth1,
|
|
220
219
|
executionEngine,
|
|
221
220
|
executionBuilder,
|
|
222
221
|
}: {
|
|
223
222
|
privateKey: PrivateKey;
|
|
224
223
|
config: BeaconConfig;
|
|
224
|
+
pubkey2index: PubkeyIndexMap;
|
|
225
|
+
index2pubkey: Index2PubkeyCache;
|
|
225
226
|
db: IBeaconDb;
|
|
226
227
|
dbName: string;
|
|
227
228
|
dataDir: string;
|
|
@@ -231,9 +232,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
231
232
|
clock?: IClock;
|
|
232
233
|
metrics: Metrics | null;
|
|
233
234
|
validatorMonitor: ValidatorMonitor | null;
|
|
234
|
-
anchorState:
|
|
235
|
+
anchorState: CachedBeaconStateAllForks;
|
|
235
236
|
isAnchorStateFinalized: boolean;
|
|
236
|
-
eth1: IEth1ForBlockProduction;
|
|
237
237
|
executionEngine: IExecutionEngine;
|
|
238
238
|
executionBuilder?: IExecutionBuilder;
|
|
239
239
|
}
|
|
@@ -248,7 +248,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
248
248
|
this.genesisTime = anchorState.genesisTime;
|
|
249
249
|
this.anchorStateLatestBlockSlot = anchorState.latestBlockHeader.slot;
|
|
250
250
|
this.genesisValidatorsRoot = anchorState.genesisValidatorsRoot;
|
|
251
|
-
this.eth1 = eth1;
|
|
252
251
|
this.executionEngine = executionEngine;
|
|
253
252
|
this.executionBuilder = executionBuilder;
|
|
254
253
|
const signal = this.abortController.signal;
|
|
@@ -265,6 +264,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
265
264
|
this.aggregatedAttestationPool = new AggregatedAttestationPool(this.config, metrics);
|
|
266
265
|
this.syncCommitteeMessagePool = new SyncCommitteeMessagePool(config, clock, this.opts?.preaggregateSlotDistance);
|
|
267
266
|
this.syncContributionAndProofPool = new SyncContributionAndProofPool(config, clock, metrics, logger);
|
|
267
|
+
this.opPool = new OpPool(config);
|
|
268
268
|
|
|
269
269
|
this.seenAggregatedAttestations = new SeenAggregatedAttestations(metrics);
|
|
270
270
|
this.seenContributionAndProof = new SeenContributionAndProof(metrics);
|
|
@@ -291,39 +291,26 @@ export class BeaconChain implements IBeaconChain {
|
|
|
291
291
|
logger,
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
// When the BeaconStateCache is created in eth1 genesis builder it may be incorrect. Until we can ensure that
|
|
298
|
-
// it's safe to re-use _ANY_ BeaconStateCache, this option is disabled by default and only used in tests.
|
|
299
|
-
const cachedState =
|
|
300
|
-
isCachedBeaconState(anchorState) && opts.skipCreateStateCacheIfAvailable
|
|
301
|
-
? anchorState
|
|
302
|
-
: createCachedBeaconState(anchorState, {
|
|
303
|
-
config,
|
|
304
|
-
pubkey2index: new PubkeyIndexMap(),
|
|
305
|
-
index2pubkey: [],
|
|
306
|
-
});
|
|
307
|
-
this._earliestAvailableSlot = cachedState.slot;
|
|
308
|
-
|
|
309
|
-
this.shufflingCache = cachedState.epochCtx.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
294
|
+
this._earliestAvailableSlot = anchorState.slot;
|
|
295
|
+
|
|
296
|
+
this.shufflingCache = new ShufflingCache(metrics, logger, this.opts, [
|
|
310
297
|
{
|
|
311
|
-
shuffling:
|
|
312
|
-
decisionRoot:
|
|
298
|
+
shuffling: anchorState.epochCtx.previousShuffling,
|
|
299
|
+
decisionRoot: anchorState.epochCtx.previousDecisionRoot,
|
|
313
300
|
},
|
|
314
301
|
{
|
|
315
|
-
shuffling:
|
|
316
|
-
decisionRoot:
|
|
302
|
+
shuffling: anchorState.epochCtx.currentShuffling,
|
|
303
|
+
decisionRoot: anchorState.epochCtx.currentDecisionRoot,
|
|
317
304
|
},
|
|
318
305
|
{
|
|
319
|
-
shuffling:
|
|
320
|
-
decisionRoot:
|
|
306
|
+
shuffling: anchorState.epochCtx.nextShuffling,
|
|
307
|
+
decisionRoot: anchorState.epochCtx.nextDecisionRoot,
|
|
321
308
|
},
|
|
322
309
|
]);
|
|
323
310
|
|
|
324
|
-
//
|
|
325
|
-
this.pubkey2index =
|
|
326
|
-
this.index2pubkey =
|
|
311
|
+
// Global cache of validators pubkey/index mapping
|
|
312
|
+
this.pubkey2index = pubkey2index;
|
|
313
|
+
this.index2pubkey = index2pubkey;
|
|
327
314
|
|
|
328
315
|
const fileDataStore = opts.nHistoricalStatesFileDataStore ?? true;
|
|
329
316
|
const blockStateCache = this.opts.nHistoricalStates
|
|
@@ -339,6 +326,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
339
326
|
this.cpStateDatastore = fileDataStore ? new FileCPStateDatastore(dataDir) : new DbCPStateDatastore(this.db);
|
|
340
327
|
checkpointStateCache = new PersistentCheckpointStateCache(
|
|
341
328
|
{
|
|
329
|
+
config,
|
|
342
330
|
metrics,
|
|
343
331
|
logger,
|
|
344
332
|
clock,
|
|
@@ -353,15 +341,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
353
341
|
}
|
|
354
342
|
|
|
355
343
|
const {checkpoint} = computeAnchorCheckpoint(config, anchorState);
|
|
356
|
-
blockStateCache.add(
|
|
357
|
-
blockStateCache.setHeadState(
|
|
358
|
-
checkpointStateCache.add(checkpoint,
|
|
344
|
+
blockStateCache.add(anchorState);
|
|
345
|
+
blockStateCache.setHeadState(anchorState);
|
|
346
|
+
checkpointStateCache.add(checkpoint, anchorState);
|
|
359
347
|
|
|
360
348
|
const forkChoice = initializeForkChoice(
|
|
361
349
|
config,
|
|
362
350
|
emitter,
|
|
363
351
|
clock.currentSlot,
|
|
364
|
-
|
|
352
|
+
anchorState,
|
|
365
353
|
isAnchorStateFinalized,
|
|
366
354
|
opts,
|
|
367
355
|
this.justifiedBalancesGetter.bind(this),
|
|
@@ -417,15 +405,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
417
405
|
signal
|
|
418
406
|
);
|
|
419
407
|
|
|
420
|
-
// Stop polling eth1 data if anchor state is in Electra AND deposit_requests_start_index is reached
|
|
421
|
-
const anchorStateFork = this.config.getForkName(anchorState.slot);
|
|
422
|
-
if (isForkPostElectra(anchorStateFork)) {
|
|
423
|
-
const {eth1DepositIndex, depositRequestsStartIndex} = anchorState as BeaconStateElectra;
|
|
424
|
-
if (eth1DepositIndex === Number(depositRequestsStartIndex)) {
|
|
425
|
-
this.eth1.stopPollingEth1Data();
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
408
|
// always run PrepareNextSlotScheduler except for fork_choice spec tests
|
|
430
409
|
if (!opts?.disablePrepareNextSlot) {
|
|
431
410
|
new PrepareNextSlotScheduler(this, this.config, metrics, this.logger, signal);
|
|
@@ -440,6 +419,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
440
419
|
clock.addListener(ClockEvent.epoch, this.onClockEpoch.bind(this));
|
|
441
420
|
emitter.addListener(ChainEvent.forkChoiceFinalized, this.onForkChoiceFinalized.bind(this));
|
|
442
421
|
emitter.addListener(ChainEvent.forkChoiceJustified, this.onForkChoiceJustified.bind(this));
|
|
422
|
+
emitter.addListener(ChainEvent.checkpoint, this.onCheckpoint.bind(this));
|
|
443
423
|
}
|
|
444
424
|
|
|
445
425
|
async init(): Promise<void> {
|
|
@@ -527,7 +507,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
527
507
|
async getStateBySlot(
|
|
528
508
|
slot: Slot,
|
|
529
509
|
opts?: StateGetOpts
|
|
530
|
-
): Promise<{state:
|
|
510
|
+
): Promise<{state: CachedBeaconStateAllForks; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
531
511
|
const finalizedBlock = this.forkChoice.getFinalizedBlock();
|
|
532
512
|
|
|
533
513
|
if (slot < finalizedBlock.slot) {
|
|
@@ -582,7 +562,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
582
562
|
async getStateByStateRoot(
|
|
583
563
|
stateRoot: RootHex,
|
|
584
564
|
opts?: StateGetOpts
|
|
585
|
-
): Promise<{state:
|
|
565
|
+
): Promise<{state: CachedBeaconStateAllForks | Uint8Array; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
586
566
|
if (opts?.allowRegen) {
|
|
587
567
|
const state = await this.regen.getState(stateRoot, RegenCaller.restApi);
|
|
588
568
|
const block = this.forkChoice.getBlock(state.latestBlockHeader.hashTreeRoot());
|
|
@@ -610,7 +590,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
610
590
|
};
|
|
611
591
|
}
|
|
612
592
|
|
|
613
|
-
|
|
593
|
+
// this is mostly useful for a node with `--chain.archiveStateEpochFrequency 1`
|
|
594
|
+
const data = await this.db.stateArchive.getBinaryByRoot(fromHex(stateRoot));
|
|
614
595
|
return data && {state: data, executionOptimistic: false, finalized: true};
|
|
615
596
|
}
|
|
616
597
|
|
|
@@ -1003,8 +984,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1003
984
|
this.metrics?.gossipAttestation.useHeadBlockState.inc({caller: regenCaller});
|
|
1004
985
|
state = await this.regen.getState(attHeadBlock.stateRoot, regenCaller);
|
|
1005
986
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
987
|
+
// resolve the promise to unblock other calls of the same epoch and dependent root
|
|
988
|
+
this.shufflingCache.processState(state);
|
|
1008
989
|
return state.epochCtx.getShufflingAtEpoch(attEpoch);
|
|
1009
990
|
}
|
|
1010
991
|
|
|
@@ -1188,6 +1169,13 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1188
1169
|
this.logger.verbose("Fork choice justified", {epoch: cp.epoch, root: cp.rootHex});
|
|
1189
1170
|
}
|
|
1190
1171
|
|
|
1172
|
+
private onCheckpoint(this: BeaconChain, _checkpoint: phase0.Checkpoint, state: CachedBeaconStateAllForks): void {
|
|
1173
|
+
// Defer to not block other checkpoint event handlers, which can cause lightclient update delays
|
|
1174
|
+
callInNextEventLoop(() => {
|
|
1175
|
+
this.shufflingCache.processState(state);
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1191
1179
|
private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithHex): Promise<void> {
|
|
1192
1180
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1193
1181
|
this.seenBlockProposers.prune(computeStartSlotAtEpoch(cp.epoch));
|
|
@@ -1309,7 +1297,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1309
1297
|
}
|
|
1310
1298
|
}
|
|
1311
1299
|
|
|
1312
|
-
async getBlockRewards(block: BeaconBlock | BlindedBeaconBlock): Promise<BlockRewards> {
|
|
1300
|
+
async getBlockRewards(block: BeaconBlock | BlindedBeaconBlock): Promise<rewards.BlockRewards> {
|
|
1313
1301
|
let preState = this.regen.getPreStateSync(block);
|
|
1314
1302
|
|
|
1315
1303
|
if (preState === null) {
|
|
@@ -1318,15 +1306,15 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1318
1306
|
|
|
1319
1307
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
1320
1308
|
|
|
1321
|
-
const
|
|
1309
|
+
const proposerRewards = this.regen.getStateSync(toRootHex(block.stateRoot))?.proposerRewards ?? undefined;
|
|
1322
1310
|
|
|
1323
|
-
return computeBlockRewards(block, preState
|
|
1311
|
+
return computeBlockRewards(this.config, block, preState, proposerRewards);
|
|
1324
1312
|
}
|
|
1325
1313
|
|
|
1326
1314
|
async getAttestationsRewards(
|
|
1327
1315
|
epoch: Epoch,
|
|
1328
1316
|
validatorIds?: (ValidatorIndex | string)[]
|
|
1329
|
-
): Promise<{rewards: AttestationsRewards; executionOptimistic: boolean; finalized: boolean}> {
|
|
1317
|
+
): Promise<{rewards: rewards.AttestationsRewards; executionOptimistic: boolean; finalized: boolean}> {
|
|
1330
1318
|
// We use end slot of (epoch + 1) to ensure we have seen all attestations. On-time or late. Any late attestation beyond this slot is not considered
|
|
1331
1319
|
const slot = computeEndSlotAtEpoch(epoch + 1);
|
|
1332
1320
|
const stateResult = await this.getStateBySlot(slot, {allowRegen: false}); // No regen if state not in cache
|
|
@@ -1344,7 +1332,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1344
1332
|
throw Error(`State is not in cache for slot ${slot}`);
|
|
1345
1333
|
}
|
|
1346
1334
|
|
|
1347
|
-
const rewards = await computeAttestationsRewards(this.pubkey2index, cachedState, validatorIds);
|
|
1335
|
+
const rewards = await computeAttestationsRewards(this.config, this.pubkey2index, cachedState, validatorIds);
|
|
1348
1336
|
|
|
1349
1337
|
return {rewards, executionOptimistic, finalized};
|
|
1350
1338
|
}
|
|
@@ -1352,7 +1340,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1352
1340
|
async getSyncCommitteeRewards(
|
|
1353
1341
|
block: BeaconBlock | BlindedBeaconBlock,
|
|
1354
1342
|
validatorIds?: (ValidatorIndex | string)[]
|
|
1355
|
-
): Promise<SyncCommitteeRewards> {
|
|
1343
|
+
): Promise<rewards.SyncCommitteeRewards> {
|
|
1356
1344
|
let preState = this.regen.getPreStateSync(block);
|
|
1357
1345
|
|
|
1358
1346
|
if (preState === null) {
|
|
@@ -1361,6 +1349,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1361
1349
|
|
|
1362
1350
|
preState = processSlots(preState, block.slot); // Dial preState's slot to block.slot
|
|
1363
1351
|
|
|
1364
|
-
return computeSyncCommitteeRewards(this.index2pubkey, block, preState
|
|
1352
|
+
return computeSyncCommitteeRewards(this.config, this.index2pubkey, block, preState, validatorIds);
|
|
1365
1353
|
}
|
|
1366
1354
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getBlockRootAtSlot,
|
|
19
19
|
getEffectiveBalanceIncrementsZeroInactive,
|
|
20
20
|
isExecutionStateType,
|
|
21
|
+
isMergeTransitionComplete,
|
|
21
22
|
} from "@lodestar/state-transition";
|
|
22
23
|
import {Slot, ssz} from "@lodestar/types";
|
|
23
24
|
import {Logger, toRootHex} from "@lodestar/utils";
|
|
@@ -134,7 +135,7 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
134
135
|
unrealizedFinalizedEpoch: finalizedCheckpoint.epoch,
|
|
135
136
|
unrealizedFinalizedRoot: toRootHex(finalizedCheckpoint.root),
|
|
136
137
|
|
|
137
|
-
...(isExecutionStateType(state)
|
|
138
|
+
...(isExecutionStateType(state) && isMergeTransitionComplete(state)
|
|
138
139
|
? {
|
|
139
140
|
executionPayloadBlockHash: toRootHex(state.latestExecutionPayloadHeader.blockHash),
|
|
140
141
|
executionPayloadNumber: state.latestExecutionPayloadHeader.blockNumber,
|
|
@@ -215,7 +216,7 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
215
216
|
unrealizedFinalizedEpoch: finalizedCheckpoint.epoch,
|
|
216
217
|
unrealizedFinalizedRoot: toRootHex(finalizedCheckpoint.root),
|
|
217
218
|
|
|
218
|
-
...(isExecutionStateType(unfinalizedState)
|
|
219
|
+
...(isExecutionStateType(unfinalizedState) && isMergeTransitionComplete(unfinalizedState)
|
|
219
220
|
? {
|
|
220
221
|
executionPayloadBlockHash: toRootHex(unfinalizedState.latestExecutionPayloadHeader.blockHash),
|
|
221
222
|
executionPayloadNumber: unfinalizedState.latestExecutionPayloadHeader.blockNumber,
|
package/src/chain/initState.ts
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ZERO_HASH} from "@lodestar/params";
|
|
3
|
-
import {
|
|
4
|
-
BeaconStateAllForks,
|
|
5
|
-
CachedBeaconStateAllForks,
|
|
6
|
-
computeEpochAtSlot,
|
|
7
|
-
computeStartSlotAtEpoch,
|
|
8
|
-
} from "@lodestar/state-transition";
|
|
3
|
+
import {BeaconStateAllForks, computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
9
4
|
import {SignedBeaconBlock, ssz} from "@lodestar/types";
|
|
10
5
|
import {Logger, toHex, toRootHex} from "@lodestar/utils";
|
|
11
6
|
import {GENESIS_SLOT} from "../constants/index.js";
|
|
12
7
|
import {IBeaconDb} from "../db/index.js";
|
|
13
|
-
import {Eth1Provider} from "../eth1/index.js";
|
|
14
|
-
import {Eth1Options} from "../eth1/options.js";
|
|
15
8
|
import {Metrics} from "../metrics/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {GenesisResult} from "./genesis/interface.js";
|
|
18
|
-
|
|
19
|
-
export async function persistGenesisResult(
|
|
20
|
-
db: IBeaconDb,
|
|
21
|
-
genesisResult: GenesisResult,
|
|
22
|
-
genesisBlock: SignedBeaconBlock
|
|
23
|
-
): Promise<void> {
|
|
24
|
-
await Promise.all([
|
|
25
|
-
db.stateArchive.add(genesisResult.state),
|
|
26
|
-
db.blockArchive.add(genesisBlock),
|
|
27
|
-
db.depositDataRoot.putList(genesisResult.depositTree.getAllReadonlyValues()),
|
|
28
|
-
db.eth1Data.put(genesisResult.block.timestamp, {
|
|
29
|
-
...genesisResult.block,
|
|
30
|
-
depositCount: genesisResult.depositTree.length,
|
|
31
|
-
depositRoot: genesisResult.depositTree.hashTreeRoot(),
|
|
32
|
-
}),
|
|
33
|
-
]);
|
|
34
|
-
}
|
|
9
|
+
import {getStateTypeFromBytes} from "../util/multifork.js";
|
|
35
10
|
|
|
36
11
|
export async function persistAnchorState(
|
|
37
12
|
config: ChainForkConfig,
|
|
@@ -75,88 +50,19 @@ export function createGenesisBlock(config: ChainForkConfig, genesisState: Beacon
|
|
|
75
50
|
return genesisBlock;
|
|
76
51
|
}
|
|
77
52
|
|
|
78
|
-
/**
|
|
79
|
-
* Initialize and persist a genesis state and related data
|
|
80
|
-
*/
|
|
81
|
-
export async function initStateFromEth1({
|
|
82
|
-
config,
|
|
83
|
-
db,
|
|
84
|
-
logger,
|
|
85
|
-
opts,
|
|
86
|
-
signal,
|
|
87
|
-
}: {
|
|
88
|
-
config: ChainForkConfig;
|
|
89
|
-
db: IBeaconDb;
|
|
90
|
-
logger: Logger;
|
|
91
|
-
opts: Eth1Options;
|
|
92
|
-
signal: AbortSignal;
|
|
93
|
-
}): Promise<CachedBeaconStateAllForks> {
|
|
94
|
-
logger.info("Listening to eth1 for genesis state");
|
|
95
|
-
|
|
96
|
-
const statePreGenesis = await db.preGenesisState.get();
|
|
97
|
-
const depositTree = await db.depositDataRoot.getDepositRootTree();
|
|
98
|
-
const lastProcessedBlockNumber = await db.preGenesisStateLastProcessedBlock.get();
|
|
99
|
-
|
|
100
|
-
const builder = new GenesisBuilder({
|
|
101
|
-
config,
|
|
102
|
-
eth1Provider: new Eth1Provider(config, {...opts, logger}, signal),
|
|
103
|
-
logger,
|
|
104
|
-
signal,
|
|
105
|
-
pendingStatus:
|
|
106
|
-
statePreGenesis && depositTree !== undefined && lastProcessedBlockNumber != null
|
|
107
|
-
? {state: statePreGenesis, depositTree, lastProcessedBlockNumber}
|
|
108
|
-
: undefined,
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
const genesisResult = await builder.waitForGenesis();
|
|
113
|
-
|
|
114
|
-
// Note: .hashTreeRoot() automatically commits()
|
|
115
|
-
const genesisBlock = createGenesisBlock(config, genesisResult.state);
|
|
116
|
-
const types = config.getForkTypes(GENESIS_SLOT);
|
|
117
|
-
const stateRoot = genesisResult.state.hashTreeRoot();
|
|
118
|
-
const blockRoot = types.BeaconBlock.hashTreeRoot(genesisBlock.message);
|
|
119
|
-
|
|
120
|
-
logger.info("Initializing genesis state", {
|
|
121
|
-
stateRoot: toRootHex(stateRoot),
|
|
122
|
-
blockRoot: toRootHex(blockRoot),
|
|
123
|
-
validatorCount: genesisResult.state.validators.length,
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
await persistGenesisResult(db, genesisResult, genesisBlock);
|
|
127
|
-
|
|
128
|
-
logger.verbose("Clearing pending genesis state if any");
|
|
129
|
-
await db.preGenesisState.delete();
|
|
130
|
-
await db.preGenesisStateLastProcessedBlock.delete();
|
|
131
|
-
|
|
132
|
-
return genesisResult.state;
|
|
133
|
-
} catch (e) {
|
|
134
|
-
if (builder.lastProcessedBlockNumber != null) {
|
|
135
|
-
logger.info("Persisting genesis state", {block: builder.lastProcessedBlockNumber});
|
|
136
|
-
|
|
137
|
-
// Commit changed before serializing
|
|
138
|
-
builder.state.commit();
|
|
139
|
-
|
|
140
|
-
await db.preGenesisState.put(builder.state);
|
|
141
|
-
await db.depositDataRoot.putList(builder.depositTree.getAllReadonlyValues());
|
|
142
|
-
await db.preGenesisStateLastProcessedBlock.put(builder.lastProcessedBlockNumber);
|
|
143
|
-
}
|
|
144
|
-
throw e;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
53
|
/**
|
|
149
54
|
* Restore the latest beacon state from db
|
|
150
55
|
*/
|
|
151
56
|
export async function initStateFromDb(
|
|
152
|
-
|
|
57
|
+
config: ChainForkConfig,
|
|
153
58
|
db: IBeaconDb,
|
|
154
59
|
logger: Logger
|
|
155
60
|
): Promise<BeaconStateAllForks> {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
61
|
+
const stateBytes = await db.stateArchive.lastBinary();
|
|
62
|
+
if (stateBytes == null) {
|
|
158
63
|
throw new Error("No state exists in database");
|
|
159
64
|
}
|
|
65
|
+
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
160
66
|
|
|
161
67
|
logger.info("Initializing beacon state from db", {
|
|
162
68
|
slot: state.slot,
|