@lodestar/beacon-node 1.39.0-dev.aceb5b7416 → 1.39.0-dev.b2437a6348
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/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/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +8 -2
- 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/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 -11
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +36 -40
- 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/interface.d.ts +6 -9
- 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 +6 -7
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +8 -133
- 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 +9 -8
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +4 -7
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +3 -3
- 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 +5 -12
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +12 -50
- 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/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 +3 -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 +2 -0
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +32 -0
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +12 -0
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +12 -6
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +1 -0
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/stateArchive.d.ts +1 -1
- package/lib/db/repositories/stateArchive.d.ts.map +1 -1
- package/lib/db/repositories/stateArchive.js +2 -2
- package/lib/db/repositories/stateArchive.js.map +1 -1
- package/lib/execution/engine/mock.d.ts +9 -6
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +34 -7
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -6
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +3 -17
- package/lib/metrics/metrics/lodestar.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/node/nodejs.d.ts +6 -3
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +30 -3
- 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/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/package.json +28 -20
- 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/blocks/importBlock.ts +9 -2
- package/src/chain/blocks/verifyBlock.ts +1 -0
- 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 -48
- package/src/chain/forkChoice/index.ts +3 -2
- package/src/chain/interface.ts +6 -8
- package/src/chain/lightClient/proofs.ts +0 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +12 -187
- package/src/chain/opPools/opPool.ts +8 -8
- package/src/chain/prepareNextSlot.ts +2 -6
- package/src/chain/produceBlock/produceBlockBody.ts +3 -3
- 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 +15 -61
- 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/attesterSlashing.ts +14 -2
- package/src/chain/validation/blobSidecar.ts +3 -3
- package/src/chain/validation/block.ts +3 -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 -1
- package/src/db/buckets.ts +12 -6
- package/src/db/interface.ts +2 -0
- package/src/db/repositories/stateArchive.ts +2 -2
- package/src/execution/engine/mock.ts +40 -13
- package/src/metrics/metrics/lodestar.ts +3 -17
- package/src/network/peers/discover.ts +3 -3
- package/src/node/nodejs.ts +37 -4
- package/src/node/notifier.ts +13 -7
- package/src/sync/backfill/backfill.ts +2 -9
- package/src/sync/backfill/verify.ts +3 -8
- 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/src/chain/rewards/attestationsRewards.ts +0 -197
- package/src/chain/rewards/blockRewards.ts +0 -150
- package/src/chain/rewards/syncCommitteeRewards.ts +0 -58
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
1
2
|
import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params";
|
|
2
3
|
import {
|
|
3
4
|
CachedBeaconStateAllForks,
|
|
@@ -9,11 +10,12 @@ import {
|
|
|
9
10
|
import {altair, ssz} from "@lodestar/types";
|
|
10
11
|
|
|
11
12
|
export function getSyncCommitteeSignatureSet(
|
|
13
|
+
config: BeaconConfig,
|
|
12
14
|
index2pubkey: Index2PubkeyCache,
|
|
13
15
|
state: CachedBeaconStateAllForks,
|
|
14
16
|
syncCommittee: altair.SyncCommitteeMessage
|
|
15
17
|
): ISignatureSet {
|
|
16
|
-
const domain =
|
|
18
|
+
const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, syncCommittee.slot);
|
|
17
19
|
|
|
18
20
|
return {
|
|
19
21
|
type: SignatureSetType.single,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {PublicKey} from "@chainsafe/blst";
|
|
2
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
2
3
|
import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params";
|
|
3
4
|
import {CachedBeaconStateAltair, ISignatureSet, SignatureSetType, computeSigningRoot} from "@lodestar/state-transition";
|
|
4
5
|
import {altair, ssz} from "@lodestar/types";
|
|
5
6
|
|
|
6
7
|
export function getSyncCommitteeContributionSignatureSet(
|
|
8
|
+
config: BeaconConfig,
|
|
7
9
|
state: CachedBeaconStateAltair,
|
|
8
10
|
contribution: altair.SyncCommitteeContribution,
|
|
9
11
|
pubkeys: PublicKey[]
|
|
10
12
|
): ISignatureSet {
|
|
11
|
-
const domain =
|
|
13
|
+
const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE, contribution.slot);
|
|
12
14
|
return {
|
|
13
15
|
type: SignatureSetType.aggregate,
|
|
14
16
|
pubkeys,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
1
2
|
import {DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF} from "@lodestar/params";
|
|
2
3
|
import {
|
|
3
4
|
CachedBeaconStateAllForks,
|
|
@@ -9,11 +10,11 @@ import {
|
|
|
9
10
|
import {altair, ssz} from "@lodestar/types";
|
|
10
11
|
|
|
11
12
|
export function getSyncCommitteeSelectionProofSignatureSet(
|
|
13
|
+
config: BeaconConfig,
|
|
12
14
|
index2pubkey: Index2PubkeyCache,
|
|
13
15
|
state: CachedBeaconStateAllForks,
|
|
14
16
|
contributionAndProof: altair.ContributionAndProof
|
|
15
17
|
): ISignatureSet {
|
|
16
|
-
const {config} = state;
|
|
17
18
|
const slot = contributionAndProof.contribution.slot;
|
|
18
19
|
const domain = config.getDomain(state.slot, DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF, slot);
|
|
19
20
|
const signingData: altair.SyncAggregatorSelectionData = {
|
|
@@ -89,7 +89,7 @@ async function validateSyncCommitteeSigOnly(
|
|
|
89
89
|
syncCommittee: altair.SyncCommitteeMessage,
|
|
90
90
|
prioritizeBls = false
|
|
91
91
|
): Promise<void> {
|
|
92
|
-
const signatureSet = getSyncCommitteeSignatureSet(chain.index2pubkey, headState, syncCommittee);
|
|
92
|
+
const signatureSet = getSyncCommitteeSignatureSet(chain.config, chain.index2pubkey, headState, syncCommittee);
|
|
93
93
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
|
|
94
94
|
throw new SyncCommitteeError(GossipAction.REJECT, {
|
|
95
95
|
code: SyncCommitteeErrorCode.INVALID_SIGNATURE,
|
|
@@ -78,14 +78,19 @@ export async function validateSyncCommitteeGossipContributionAndProof(
|
|
|
78
78
|
const signatureSets = [
|
|
79
79
|
// [REJECT] The contribution_and_proof.selection_proof is a valid signature of the SyncAggregatorSelectionData
|
|
80
80
|
// derived from the contribution by the validator with index contribution_and_proof.aggregator_index.
|
|
81
|
-
getSyncCommitteeSelectionProofSignatureSet(index2pubkey, headState, contributionAndProof),
|
|
81
|
+
getSyncCommitteeSelectionProofSignatureSet(chain.config, index2pubkey, headState, contributionAndProof),
|
|
82
82
|
|
|
83
83
|
// [REJECT] The aggregator signature, signed_contribution_and_proof.signature, is valid.
|
|
84
|
-
getContributionAndProofSignatureSet(index2pubkey, headState, signedContributionAndProof),
|
|
84
|
+
getContributionAndProofSignatureSet(chain.config, index2pubkey, headState, signedContributionAndProof),
|
|
85
85
|
|
|
86
86
|
// [REJECT] The aggregate signature is valid for the message beacon_block_root and aggregate pubkey derived from
|
|
87
87
|
// the participation info in aggregation_bits for the subcommittee specified by the contribution.subcommittee_index.
|
|
88
|
-
getSyncCommitteeContributionSignatureSet(
|
|
88
|
+
getSyncCommitteeContributionSignatureSet(
|
|
89
|
+
chain.config,
|
|
90
|
+
headState as CachedBeaconStateAltair,
|
|
91
|
+
contribution,
|
|
92
|
+
participantPubkeys
|
|
93
|
+
),
|
|
89
94
|
];
|
|
90
95
|
|
|
91
96
|
if (!(await chain.bls.verifySignatureSets(signatureSets, {batchable: true}))) {
|
|
@@ -59,7 +59,7 @@ async function validateVoluntaryExit(
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const signatureSet = getVoluntaryExitSignatureSet(chain.index2pubkey, state, voluntaryExit);
|
|
62
|
+
const signatureSet = getVoluntaryExitSignatureSet(chain.config, chain.index2pubkey, state.slot, voluntaryExit);
|
|
63
63
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: true, priority: prioritizeBls}))) {
|
|
64
64
|
throw new VoluntaryExitError(GossipAction.REJECT, {
|
|
65
65
|
code: VoluntaryExitErrorCode.INVALID_SIGNATURE,
|
package/src/db/beacon.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {Db, LevelDbControllerMetrics} from "@lodestar/db";
|
|
2
|
+
import {Db, LevelDbControllerMetrics, encodeKey} from "@lodestar/db";
|
|
3
|
+
import {Bucket} from "./buckets.js";
|
|
3
4
|
import {IBeaconDb} from "./interface.js";
|
|
4
5
|
import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
5
6
|
import {
|
|
@@ -95,4 +96,40 @@ export class BeaconDb implements IBeaconDb {
|
|
|
95
96
|
// TODO: Enable once it's deemed safe
|
|
96
97
|
// await this.block.batchDelete(await this.block.keys());
|
|
97
98
|
}
|
|
99
|
+
|
|
100
|
+
async deleteDeprecatedEth1Data(): Promise<void> {
|
|
101
|
+
const deprecatedBuckets = [
|
|
102
|
+
Bucket.phase0_eth1Data,
|
|
103
|
+
Bucket.index_depositDataRoot,
|
|
104
|
+
Bucket.phase0_depositData,
|
|
105
|
+
Bucket.phase0_depositEvent,
|
|
106
|
+
Bucket.phase0_preGenesisState,
|
|
107
|
+
Bucket.phase0_preGenesisStateLastProcessedBlock,
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
for (const bucket of deprecatedBuckets) {
|
|
111
|
+
await this.deleteBucketData(bucket);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private async deleteBucketData(bucket: Bucket): Promise<void> {
|
|
116
|
+
const minKey = encodeKey(bucket, Buffer.alloc(0));
|
|
117
|
+
const maxKey = encodeKey(bucket + 1, Buffer.alloc(0));
|
|
118
|
+
|
|
119
|
+
// Batch delete to avoid loading all keys into memory at once
|
|
120
|
+
const BATCH_DELETE_SIZE = 1000;
|
|
121
|
+
let keysBatch: Uint8Array[] = [];
|
|
122
|
+
|
|
123
|
+
for await (const key of this.db.keysStream({gte: minKey, lt: maxKey})) {
|
|
124
|
+
keysBatch.push(key);
|
|
125
|
+
if (keysBatch.length >= BATCH_DELETE_SIZE) {
|
|
126
|
+
await this.db.batchDelete(keysBatch);
|
|
127
|
+
keysBatch = [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (keysBatch.length > 0) {
|
|
132
|
+
await this.db.batchDelete(keysBatch);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
98
135
|
}
|
package/src/db/buckets.ts
CHANGED
|
@@ -16,13 +16,16 @@ export enum Bucket {
|
|
|
16
16
|
index_mainChain = 6, // Slot -> Root<BeaconBlock>
|
|
17
17
|
// justified, finalized state and block hashes
|
|
18
18
|
index_chainInfo = 7, // Key -> Number64 | stateHash | blockHash
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
|
|
20
|
+
phase0_eth1Data = 8,
|
|
21
|
+
/** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
|
|
22
|
+
index_depositDataRoot = 9,
|
|
21
23
|
|
|
22
24
|
// op pool
|
|
23
25
|
// phase0_attestation = 10, // DEPRECATED on v0.25.0
|
|
24
26
|
// phase0_aggregateAndProof = 11, // Root -> AggregateAndProof, DEPRECATED on v.27.0
|
|
25
|
-
|
|
27
|
+
/** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
|
|
28
|
+
phase0_depositData = 12,
|
|
26
29
|
phase0_exit = 13, // ValidatorIndex -> VoluntaryExit
|
|
27
30
|
phase0_proposerSlashing = 14, // ValidatorIndex -> ProposerSlashing
|
|
28
31
|
allForks_attesterSlashing = 15, // Root -> AttesterSlashing
|
|
@@ -31,15 +34,18 @@ export enum Bucket {
|
|
|
31
34
|
allForks_checkpointState = 17, // Root -> BeaconState
|
|
32
35
|
|
|
33
36
|
// allForks_pendingBlock = 25, // Root -> SignedBeaconBlock // DEPRECATED on v0.30.0
|
|
34
|
-
|
|
37
|
+
/** @deprecated Eth1 deposit tracking is not required since electra, only kept around to delete data from existing databases */
|
|
38
|
+
phase0_depositEvent = 19,
|
|
35
39
|
|
|
36
40
|
index_stateArchiveRootIndex = 26, // State Root -> slot
|
|
37
41
|
|
|
38
42
|
deneb_blobSidecars = 27, // DENEB BeaconBlockRoot -> BlobSidecars
|
|
39
43
|
deneb_blobSidecarsArchive = 28, // DENEB BeaconBlockSlot -> BlobSidecars
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
/** @deprecated Genesis from eth1 is no longer supported, only kept around to delete data from existing databases */
|
|
46
|
+
phase0_preGenesisState = 30,
|
|
47
|
+
/** @deprecated Genesis from eth1 is no longer supported, only kept around to delete data from existing databases */
|
|
48
|
+
phase0_preGenesisStateLastProcessedBlock = 31,
|
|
43
49
|
|
|
44
50
|
// Lightclient server
|
|
45
51
|
// altair_bestUpdatePerCommitteePeriod = 30, // DEPRECATED on v0.32.0
|
package/src/db/interface.ts
CHANGED
|
@@ -56,6 +56,8 @@ export interface IBeaconDb {
|
|
|
56
56
|
|
|
57
57
|
pruneHotDb(): Promise<void>;
|
|
58
58
|
|
|
59
|
+
deleteDeprecatedEth1Data(): Promise<void>;
|
|
60
|
+
|
|
59
61
|
/** Close the connection to the db instance and close the db store. */
|
|
60
62
|
close(): Promise<void>;
|
|
61
63
|
/** To inject metrics after CLI initialization */
|
|
@@ -42,10 +42,10 @@ export class StateArchiveRepository extends Repository<Slot, BeaconStateAllForks
|
|
|
42
42
|
|
|
43
43
|
// Index Root -> Slot
|
|
44
44
|
|
|
45
|
-
async
|
|
45
|
+
async getBinaryByRoot(stateRoot: Root): Promise<Uint8Array | null> {
|
|
46
46
|
const slot = await this.getSlotByRoot(stateRoot);
|
|
47
47
|
if (slot !== null && Number.isInteger(slot)) {
|
|
48
|
-
return this.
|
|
48
|
+
return this.getBinary(slot);
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
+
import {ChainConfig} from "@lodestar/config";
|
|
2
3
|
import {
|
|
3
4
|
BLOB_TX_TYPE,
|
|
4
5
|
BYTES_PER_FIELD_ELEMENT,
|
|
@@ -7,7 +8,9 @@ import {
|
|
|
7
8
|
ForkPostBellatrix,
|
|
8
9
|
ForkPostCapella,
|
|
9
10
|
ForkSeq,
|
|
11
|
+
SLOTS_PER_EPOCH,
|
|
10
12
|
} from "@lodestar/params";
|
|
13
|
+
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
11
14
|
import {ExecutionPayload, RootHex, bellatrix, deneb, ssz} from "@lodestar/types";
|
|
12
15
|
import {fromHex, toRootHex} from "@lodestar/utils";
|
|
13
16
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
@@ -34,14 +37,11 @@ const INTEROP_GAS_LIMIT = 30e6;
|
|
|
34
37
|
const PRUNE_PAYLOAD_ID_AFTER_MS = 5000;
|
|
35
38
|
|
|
36
39
|
export type ExecutionEngineMockOpts = {
|
|
37
|
-
genesisBlockHash
|
|
40
|
+
genesisBlockHash?: string;
|
|
38
41
|
eth1BlockHash?: string;
|
|
39
42
|
onlyPredefinedResponses?: boolean;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
electraForkTimestamp?: number;
|
|
43
|
-
fuluForkTimestamp?: number;
|
|
44
|
-
gloasForkTimestamp?: number;
|
|
43
|
+
genesisTime?: number;
|
|
44
|
+
config?: ChainConfig;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
type ExecutionBlock = {
|
|
@@ -74,17 +74,21 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
74
74
|
/** Preparing payloads to be retrieved via engine_getPayloadV1 */
|
|
75
75
|
private readonly preparingPayloads = new Map<number, PreparedPayload>();
|
|
76
76
|
private readonly payloadsForDeletion = new Map<number, number>();
|
|
77
|
-
|
|
78
77
|
private readonly predefinedPayloadStatuses = new Map<RootHex, PayloadStatus>();
|
|
79
78
|
|
|
80
79
|
private payloadId = 0;
|
|
80
|
+
private capellaForkTimestamp: number;
|
|
81
|
+
private denebForkTimestamp: number;
|
|
82
|
+
private electraForkTimestamp: number;
|
|
83
|
+
private fuluForkTimestamp: number;
|
|
84
|
+
private gloasForkTimestamp: number;
|
|
81
85
|
|
|
82
86
|
readonly handlers: {
|
|
83
87
|
[K in keyof EngineApiRpcParamTypes]: (...args: EngineApiRpcParamTypes[K]) => EngineApiRpcReturnTypes[K];
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
constructor(private readonly opts: ExecutionEngineMockOpts) {
|
|
87
|
-
this.validBlocks.set(opts.genesisBlockHash, {
|
|
91
|
+
this.validBlocks.set(opts.genesisBlockHash ?? ZERO_HASH_HEX, {
|
|
88
92
|
parentHash: ZERO_HASH_HEX,
|
|
89
93
|
blockHash: ZERO_HASH_HEX,
|
|
90
94
|
timestamp: 0,
|
|
@@ -100,6 +104,29 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
100
104
|
blockNumber: 1,
|
|
101
105
|
});
|
|
102
106
|
|
|
107
|
+
const {config} = opts;
|
|
108
|
+
|
|
109
|
+
this.capellaForkTimestamp =
|
|
110
|
+
opts.genesisTime && config
|
|
111
|
+
? computeTimeAtSlot(config, config.CAPELLA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
112
|
+
: Infinity;
|
|
113
|
+
this.denebForkTimestamp =
|
|
114
|
+
opts.genesisTime && config
|
|
115
|
+
? computeTimeAtSlot(config, config.DENEB_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
116
|
+
: Infinity;
|
|
117
|
+
this.electraForkTimestamp =
|
|
118
|
+
opts.genesisTime && config
|
|
119
|
+
? computeTimeAtSlot(config, config.ELECTRA_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
120
|
+
: Infinity;
|
|
121
|
+
this.fuluForkTimestamp =
|
|
122
|
+
opts.genesisTime && config
|
|
123
|
+
? computeTimeAtSlot(config, config.FULU_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
124
|
+
: Infinity;
|
|
125
|
+
this.gloasForkTimestamp =
|
|
126
|
+
opts.genesisTime && config
|
|
127
|
+
? computeTimeAtSlot(config, config.GLOAS_FORK_EPOCH * SLOTS_PER_EPOCH, opts.genesisTime)
|
|
128
|
+
: Infinity;
|
|
129
|
+
|
|
103
130
|
this.handlers = {
|
|
104
131
|
engine_newPayloadV1: this.notifyNewPayload.bind(this),
|
|
105
132
|
engine_newPayloadV2: this.notifyNewPayload.bind(this),
|
|
@@ -448,11 +475,11 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
448
475
|
}
|
|
449
476
|
|
|
450
477
|
private timestampToFork(timestamp: number): ForkPostBellatrix {
|
|
451
|
-
if (timestamp >=
|
|
452
|
-
if (timestamp >=
|
|
453
|
-
if (timestamp >=
|
|
454
|
-
if (timestamp >=
|
|
455
|
-
if (timestamp >=
|
|
478
|
+
if (timestamp >= this.gloasForkTimestamp) return ForkName.gloas;
|
|
479
|
+
if (timestamp >= this.fuluForkTimestamp) return ForkName.fulu;
|
|
480
|
+
if (timestamp >= this.electraForkTimestamp) return ForkName.electra;
|
|
481
|
+
if (timestamp >= this.denebForkTimestamp) return ForkName.deneb;
|
|
482
|
+
if (timestamp >= this.capellaForkTimestamp) return ForkName.capella;
|
|
456
483
|
return ForkName.bellatrix;
|
|
457
484
|
}
|
|
458
485
|
}
|
|
@@ -1308,33 +1308,19 @@ export function createLodestarMetrics(
|
|
|
1308
1308
|
name: "lodestar_shuffling_cache_miss_count",
|
|
1309
1309
|
help: "Count of shuffling cache miss",
|
|
1310
1310
|
}),
|
|
1311
|
-
|
|
1312
|
-
name: "
|
|
1313
|
-
help: "Count of shuffling that were
|
|
1314
|
-
}),
|
|
1315
|
-
shufflingPromiseNotResolvedAndThrownAway: register.gauge({
|
|
1316
|
-
name: "lodestar_shuffling_cache_promise_not_resolved_and_thrown_away_count",
|
|
1317
|
-
help: "Count of shuffling cache promises that were discarded and the shuffling was built synchronously",
|
|
1311
|
+
shufflingSetMultipleTimes: register.gauge({
|
|
1312
|
+
name: "lodestar_shuffling_cache_set_multiple_times_count",
|
|
1313
|
+
help: "Count of shuffling that were set multiple times",
|
|
1318
1314
|
}),
|
|
1319
1315
|
shufflingPromiseNotResolved: register.gauge({
|
|
1320
1316
|
name: "lodestar_shuffling_cache_promise_not_resolved_count",
|
|
1321
1317
|
help: "Count of shuffling cache promises that were requested before the promise was resolved",
|
|
1322
1318
|
}),
|
|
1323
|
-
nextShufflingNotOnEpochCache: register.gauge({
|
|
1324
|
-
name: "lodestar_shuffling_cache_next_shuffling_not_on_epoch_cache",
|
|
1325
|
-
help: "The next shuffling was not on the epoch cache before the epoch transition",
|
|
1326
|
-
}),
|
|
1327
1319
|
shufflingPromiseResolutionTime: register.histogram({
|
|
1328
1320
|
name: "lodestar_shuffling_cache_promise_resolution_time_seconds",
|
|
1329
1321
|
help: "Time from promise insertion until promise resolution when shuffling was ready in seconds",
|
|
1330
1322
|
buckets: [0.5, 1, 1.5, 2],
|
|
1331
1323
|
}),
|
|
1332
|
-
shufflingCalculationTime: register.histogram<{source: "build" | "getSync"}>({
|
|
1333
|
-
name: "lodestar_shuffling_cache_shuffling_calculation_time_seconds",
|
|
1334
|
-
help: "Run time of shuffling calculation",
|
|
1335
|
-
buckets: [0.5, 0.75, 1, 1.25, 1.5],
|
|
1336
|
-
labelNames: ["source"],
|
|
1337
|
-
}),
|
|
1338
1324
|
},
|
|
1339
1325
|
|
|
1340
1326
|
seenCache: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {PeerId, PeerInfo, PrivateKey} from "@libp2p/interface";
|
|
1
|
+
import type {PeerId, PeerInfo, PendingDial, PrivateKey} from "@libp2p/interface";
|
|
2
2
|
import {Multiaddr} from "@multiformats/multiaddr";
|
|
3
3
|
import {ENR} from "@chainsafe/enr";
|
|
4
4
|
import {BeaconConfig} from "@lodestar/config";
|
|
@@ -217,7 +217,7 @@ export class PeerDiscovery {
|
|
|
217
217
|
const pendingDials = new Set(
|
|
218
218
|
this.libp2p.services.components.connectionManager
|
|
219
219
|
.getDialQueue()
|
|
220
|
-
.map((pendingDial) => pendingDial.peerId?.toString())
|
|
220
|
+
.map((pendingDial: PendingDial) => pendingDial.peerId?.toString())
|
|
221
221
|
);
|
|
222
222
|
for (const [id, cachedENR] of this.cachedENRs.entries()) {
|
|
223
223
|
if (
|
|
@@ -458,7 +458,7 @@ export class PeerDiscovery {
|
|
|
458
458
|
if (
|
|
459
459
|
this.libp2p.services.components.connectionManager
|
|
460
460
|
.getDialQueue()
|
|
461
|
-
.find((pendingDial) => pendingDial.peerId?.equals(peerId))
|
|
461
|
+
.find((pendingDial: PendingDial) => pendingDial.peerId?.equals(peerId))
|
|
462
462
|
) {
|
|
463
463
|
return DiscoveredPeerStatus.already_dialing;
|
|
464
464
|
}
|
package/src/node/nodejs.ts
CHANGED
|
@@ -2,12 +2,14 @@ import {setMaxListeners} from "node:events";
|
|
|
2
2
|
import {PrivateKey} from "@libp2p/interface";
|
|
3
3
|
import {Registry} from "prom-client";
|
|
4
4
|
import {hasher} from "@chainsafe/persistent-merkle-tree";
|
|
5
|
+
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
5
6
|
import {BeaconApiMethods} from "@lodestar/api/beacon/server";
|
|
6
7
|
import {BeaconConfig} from "@lodestar/config";
|
|
7
8
|
import type {LoggerNode} from "@lodestar/logger/node";
|
|
8
|
-
import {
|
|
9
|
+
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
10
|
+
import {CachedBeaconStateAllForks, Index2PubkeyCache, isExecutionCachedStateType} from "@lodestar/state-transition";
|
|
9
11
|
import {phase0} from "@lodestar/types";
|
|
10
|
-
import {sleep} from "@lodestar/utils";
|
|
12
|
+
import {sleep, toRootHex} from "@lodestar/utils";
|
|
11
13
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
12
14
|
import {BeaconRestApiServer, getApi} from "../api/index.js";
|
|
13
15
|
import {BeaconChain, IBeaconChain, initBeaconMetrics} from "../chain/index.js";
|
|
@@ -45,13 +47,15 @@ export type BeaconNodeModules = {
|
|
|
45
47
|
export type BeaconNodeInitModules = {
|
|
46
48
|
opts: IBeaconNodeOptions;
|
|
47
49
|
config: BeaconConfig;
|
|
50
|
+
pubkey2index: PubkeyIndexMap;
|
|
51
|
+
index2pubkey: Index2PubkeyCache;
|
|
48
52
|
db: IBeaconDb;
|
|
49
53
|
logger: LoggerNode;
|
|
50
54
|
processShutdownCallback: ProcessShutdownCallback;
|
|
51
55
|
privateKey: PrivateKey;
|
|
52
56
|
dataDir: string;
|
|
53
57
|
peerStoreDir?: string;
|
|
54
|
-
anchorState:
|
|
58
|
+
anchorState: CachedBeaconStateAllForks;
|
|
55
59
|
isAnchorStateFinalized: boolean;
|
|
56
60
|
wsCheckpoint?: phase0.Checkpoint;
|
|
57
61
|
metricsRegistries?: Registry[];
|
|
@@ -146,6 +150,8 @@ export class BeaconNode {
|
|
|
146
150
|
static async init<T extends BeaconNode = BeaconNode>({
|
|
147
151
|
opts,
|
|
148
152
|
config,
|
|
153
|
+
pubkey2index,
|
|
154
|
+
index2pubkey,
|
|
149
155
|
db,
|
|
150
156
|
logger,
|
|
151
157
|
processShutdownCallback,
|
|
@@ -197,6 +203,17 @@ export class BeaconNode {
|
|
|
197
203
|
// TODO: Should this call be awaited?
|
|
198
204
|
await db.pruneHotDb();
|
|
199
205
|
|
|
206
|
+
// Delete deprecated eth1 data to free up disk space for users
|
|
207
|
+
logger.debug("Deleting deprecated eth1 data from database");
|
|
208
|
+
const startTime = Date.now();
|
|
209
|
+
db.deleteDeprecatedEth1Data()
|
|
210
|
+
.then(() => {
|
|
211
|
+
logger.debug("Deleted deprecated eth1 data", {durationMs: Date.now() - startTime});
|
|
212
|
+
})
|
|
213
|
+
.catch((e) => {
|
|
214
|
+
logger.error("Failed to delete deprecated eth1 data", {}, e);
|
|
215
|
+
});
|
|
216
|
+
|
|
200
217
|
const monitoring = opts.monitoring.endpoint
|
|
201
218
|
? new MonitoringService(
|
|
202
219
|
"beacon",
|
|
@@ -205,10 +222,26 @@ export class BeaconNode {
|
|
|
205
222
|
)
|
|
206
223
|
: null;
|
|
207
224
|
|
|
225
|
+
let executionEngineOpts = opts.executionEngine;
|
|
226
|
+
if (opts.executionEngine.mode === "mock") {
|
|
227
|
+
const eth1BlockHash = isExecutionCachedStateType(anchorState)
|
|
228
|
+
? toRootHex(anchorState.latestExecutionPayloadHeader.blockHash)
|
|
229
|
+
: undefined;
|
|
230
|
+
executionEngineOpts = {
|
|
231
|
+
...opts.executionEngine,
|
|
232
|
+
genesisBlockHash: ZERO_HASH_HEX,
|
|
233
|
+
eth1BlockHash,
|
|
234
|
+
genesisTime: anchorState.genesisTime,
|
|
235
|
+
config,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
208
239
|
const chain = new BeaconChain(opts.chain, {
|
|
209
240
|
privateKey,
|
|
210
241
|
config,
|
|
211
242
|
clock,
|
|
243
|
+
pubkey2index,
|
|
244
|
+
index2pubkey,
|
|
212
245
|
dataDir,
|
|
213
246
|
db,
|
|
214
247
|
dbName: opts.db.name,
|
|
@@ -218,7 +251,7 @@ export class BeaconNode {
|
|
|
218
251
|
validatorMonitor,
|
|
219
252
|
anchorState,
|
|
220
253
|
isAnchorStateFinalized,
|
|
221
|
-
executionEngine: initializeExecutionEngine(
|
|
254
|
+
executionEngine: initializeExecutionEngine(executionEngineOpts, {
|
|
222
255
|
metrics,
|
|
223
256
|
signal,
|
|
224
257
|
logger: logger.child({module: LoggerModule.execution}),
|
package/src/node/notifier.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
computeEpochAtSlot,
|
|
7
7
|
computeStartSlotAtEpoch,
|
|
8
8
|
isExecutionCachedStateType,
|
|
9
|
+
isMergeTransitionComplete,
|
|
9
10
|
} from "@lodestar/state-transition";
|
|
10
11
|
import {Epoch} from "@lodestar/types";
|
|
11
12
|
import {ErrorAborted, Logger, prettyBytes, prettyBytesShort, sleep} from "@lodestar/utils";
|
|
@@ -171,13 +172,18 @@ function getHeadExecutionInfo(
|
|
|
171
172
|
|
|
172
173
|
// Add execution status to notifier only if head is on/post bellatrix
|
|
173
174
|
if (isExecutionCachedStateType(headState)) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
if (isMergeTransitionComplete(headState)) {
|
|
176
|
+
const executionPayloadHashInfo =
|
|
177
|
+
headInfo.executionStatus !== ExecutionStatus.PreMerge ? headInfo.executionPayloadBlockHash : "empty";
|
|
178
|
+
const executionPayloadNumberInfo =
|
|
179
|
+
headInfo.executionStatus !== ExecutionStatus.PreMerge ? headInfo.executionPayloadNumber : NaN;
|
|
180
|
+
return [
|
|
181
|
+
`exec-block: ${executionStatusStr}(${executionPayloadNumberInfo} ${prettyBytesShort(
|
|
182
|
+
executionPayloadHashInfo
|
|
183
|
+
)})`,
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
return [`exec-block: ${executionStatusStr}`];
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
return [];
|
|
@@ -750,9 +750,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
|
|
|
750
750
|
|
|
751
751
|
// GENESIS_SLOT doesn't has valid signature
|
|
752
752
|
if (anchorBlock.message.slot === GENESIS_SLOT) return;
|
|
753
|
-
await verifyBlockProposerSignature(this.chain.
|
|
754
|
-
anchorBlock,
|
|
755
|
-
]);
|
|
753
|
+
await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, [anchorBlock]);
|
|
756
754
|
|
|
757
755
|
// We can write to the disk if this is ahead of prevFinalizedCheckpointBlock otherwise
|
|
758
756
|
// we will need to go make checks on the top of sync loop before writing as it might
|
|
@@ -817,12 +815,7 @@ export class BackfillSync extends (EventEmitter as {new (): BackfillSyncEmitter}
|
|
|
817
815
|
|
|
818
816
|
// If any of the block's proposer signature fail, we can't trust this peer at all
|
|
819
817
|
if (verifiedBlocks.length > 0) {
|
|
820
|
-
await verifyBlockProposerSignature(
|
|
821
|
-
this.chain.index2pubkey,
|
|
822
|
-
this.chain.bls,
|
|
823
|
-
this.chain.getHeadState(),
|
|
824
|
-
verifiedBlocks
|
|
825
|
-
);
|
|
818
|
+
await verifyBlockProposerSignature(this.chain.config, this.chain.index2pubkey, this.chain.bls, verifiedBlocks);
|
|
826
819
|
|
|
827
820
|
// This is bad, like super bad. Abort the backfill
|
|
828
821
|
if (!nextAnchor)
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
3
|
-
import {
|
|
4
|
-
CachedBeaconStateAllForks,
|
|
5
|
-
ISignatureSet,
|
|
6
|
-
Index2PubkeyCache,
|
|
7
|
-
getBlockProposerSignatureSet,
|
|
8
|
-
} from "@lodestar/state-transition";
|
|
3
|
+
import {ISignatureSet, Index2PubkeyCache, getBlockProposerSignatureSet} from "@lodestar/state-transition";
|
|
9
4
|
import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
|
|
10
5
|
import {IBlsVerifier} from "../../chain/bls/index.js";
|
|
11
6
|
import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js";
|
|
@@ -46,15 +41,15 @@ export function verifyBlockSequence(
|
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
export async function verifyBlockProposerSignature(
|
|
44
|
+
config: BeaconConfig,
|
|
49
45
|
index2pubkey: Index2PubkeyCache,
|
|
50
46
|
bls: IBlsVerifier,
|
|
51
|
-
state: CachedBeaconStateAllForks,
|
|
52
47
|
blocks: SignedBeaconBlock[]
|
|
53
48
|
): Promise<void> {
|
|
54
49
|
if (blocks.length === 1 && blocks[0].message.slot === GENESIS_SLOT) return;
|
|
55
50
|
const signatures = blocks.reduce((sigs: ISignatureSet[], block) => {
|
|
56
51
|
// genesis block doesn't have valid signature
|
|
57
|
-
if (block.message.slot !== GENESIS_SLOT) sigs.push(getBlockProposerSignatureSet(
|
|
52
|
+
if (block.message.slot !== GENESIS_SLOT) sigs.push(getBlockProposerSignatureSet(config, index2pubkey, block));
|
|
58
53
|
return sigs;
|
|
59
54
|
}, []);
|
|
60
55
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PubkeyIndexMap } from "@chainsafe/pubkey-index-map";
|
|
2
|
-
import { routes } from "@lodestar/api";
|
|
3
|
-
import { CachedBeaconStateAllForks } from "@lodestar/state-transition";
|
|
4
|
-
import { ValidatorIndex } from "@lodestar/types";
|
|
5
|
-
export type AttestationsRewards = routes.beacon.AttestationsRewards;
|
|
6
|
-
export declare function computeAttestationsRewards(pubkey2index: PubkeyIndexMap, state: CachedBeaconStateAllForks, validatorIds?: (ValidatorIndex | string)[]): Promise<AttestationsRewards>;
|
|
7
|
-
//# sourceMappingURL=attestationsRewards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attestationsRewards.d.ts","sourceRoot":"","sources":["../../../src/chain/rewards/attestationsRewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAcrC,OAAO,EACL,yBAAyB,EAU1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAG/C,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;AASpE,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,cAAc,EAC5B,KAAK,EAAE,yBAAyB,EAChC,YAAY,CAAC,EAAE,CAAC,cAAc,GAAG,MAAM,CAAC,EAAE,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAoB9B"}
|