mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-10 08:08:16 -05:00
chore: add tsconfig to detect unused imports, variables, and functions (#7759)
**Motivation** Get rid of dead code, improve code clarity, no more unused imports **Description** Add tsconfig to detect unused imports, variables, and functions
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import {routes} from "@lodestar/api";
|
||||
import {ApplicationMethods} from "@lodestar/api/server";
|
||||
import {
|
||||
ForkName,
|
||||
ForkPostElectra,
|
||||
ForkPreElectra,
|
||||
SYNC_COMMITTEE_SUBNET_SIZE,
|
||||
isForkPostElectra,
|
||||
} from "@lodestar/params";
|
||||
import {ForkPostElectra, ForkPreElectra, SYNC_COMMITTEE_SUBNET_SIZE, isForkPostElectra} from "@lodestar/params";
|
||||
import {Attestation, Epoch, SingleAttestation, isElectraAttestation, ssz} from "@lodestar/types";
|
||||
import {
|
||||
AttestationError,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {routes} from "@lodestar/api";
|
||||
import {ApplicationMethods} from "@lodestar/api/server";
|
||||
import {ExecutionStatus} from "@lodestar/fork-choice";
|
||||
import {ZERO_HASH_HEX} from "@lodestar/params";
|
||||
import {BeaconState, ssz} from "@lodestar/types";
|
||||
import {BeaconState} from "@lodestar/types";
|
||||
import {isOptimisticBlock} from "../../../util/forkChoice.js";
|
||||
import {getStateSlotFromBytes} from "../../../util/multifork.js";
|
||||
import {getStateResponseWithRegen} from "../beacon/state/utils.js";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {routes} from "@lodestar/api";
|
||||
import {ApplicationMethods} from "@lodestar/api/server";
|
||||
import {ChainForkConfig} from "@lodestar/config";
|
||||
import {Repository} from "@lodestar/db";
|
||||
import {ForkName, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
||||
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
||||
import {BeaconStateCapella, getLatestWeakSubjectivityCheckpointEpoch, loadState} from "@lodestar/state-transition";
|
||||
import {ssz} from "@lodestar/types";
|
||||
import {toHex, toRootHex} from "@lodestar/utils";
|
||||
|
||||
@@ -43,7 +43,6 @@ import {
|
||||
Wei,
|
||||
bellatrix,
|
||||
getValidatorStatus,
|
||||
isBlindedBeaconBlock,
|
||||
isBlockContents,
|
||||
phase0,
|
||||
ssz,
|
||||
|
||||
@@ -32,7 +32,6 @@ export class ArchiveStore {
|
||||
private archiveMode: ArchiveMode;
|
||||
private jobQueue: JobItemQueue<[CheckpointWithHex], void>;
|
||||
|
||||
private prevFinalized: CheckpointWithHex;
|
||||
private archiveBlobEpochs?: number;
|
||||
private readonly statesArchiverStrategy: StateArchiveStrategy;
|
||||
private readonly chain: IBeaconChain;
|
||||
@@ -53,7 +52,6 @@ export class ArchiveStore {
|
||||
this.signal = signal;
|
||||
this.archiveMode = opts.archiveMode;
|
||||
this.archiveBlobEpochs = opts.archiveBlobEpochs;
|
||||
this.prevFinalized = this.chain.forkChoice.getFinalizedCheckpoint();
|
||||
|
||||
this.jobQueue = new JobItemQueue<[CheckpointWithHex], void>(this.processFinalizedCheckpoint, {
|
||||
maxLength: PROCESS_FINALIZED_CHECKPOINT_QUEUE_LENGTH,
|
||||
@@ -198,8 +196,6 @@ export class ArchiveStore {
|
||||
);
|
||||
}
|
||||
|
||||
this.prevFinalized = finalized;
|
||||
|
||||
await this.statesArchiverStrategy.onFinalizedCheckpoint(finalized, this.metrics);
|
||||
|
||||
// should be after ArchiveBlocksTask to handle restart cleanly
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {routes} from "@lodestar/api";
|
||||
import {Epoch} from "@lodestar/types";
|
||||
import {MapDef} from "@lodestar/utils";
|
||||
import {Metrics} from "../metrics/index.js";
|
||||
|
||||
const PROPOSER_PRESERVE_EPOCHS = 2;
|
||||
|
||||
@@ -9,10 +8,7 @@ export type ProposerPreparationData = routes.validator.ProposerPreparationData;
|
||||
|
||||
export class BeaconProposerCache {
|
||||
private readonly feeRecipientByValidatorIndex: MapDef<number, {epoch: Epoch; feeRecipient: string}>;
|
||||
constructor(
|
||||
opts: {suggestedFeeRecipient: string},
|
||||
private readonly metrics?: Metrics | null
|
||||
) {
|
||||
constructor(opts: {suggestedFeeRecipient: string}) {
|
||||
this.feeRecipientByValidatorIndex = new MapDef(() => ({
|
||||
epoch: 0,
|
||||
feeRecipient: opts.suggestedFeeRecipient,
|
||||
|
||||
@@ -561,7 +561,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
||||
}
|
||||
|
||||
/** For testing */
|
||||
private async waitTillInitialized(): Promise<void> {
|
||||
protected async waitTillInitialized(): Promise<void> {
|
||||
await Promise.all(
|
||||
this.workers.map(async (worker) => {
|
||||
if (worker.status.code === WorkerStatusCode.initializing) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import {Metrics} from "../../metrics/index.js";
|
||||
import {JobItemQueue} from "../../util/queue/index.js";
|
||||
import {CheckpointHex, toCheckpointHex} from "../stateCache/index.js";
|
||||
import {BlockStateCache, CheckpointStateCache} from "../stateCache/types.js";
|
||||
import {ValidatorMonitor} from "../validatorMonitor.js";
|
||||
import {RegenError, RegenErrorCode} from "./errors.js";
|
||||
import {
|
||||
IStateRegenerator,
|
||||
@@ -43,7 +42,6 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
||||
private readonly blockStateCache: BlockStateCache;
|
||||
private readonly checkpointStateCache: CheckpointStateCache;
|
||||
private readonly metrics: Metrics | null;
|
||||
private readonly validatorMonitor: ValidatorMonitor | null;
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(modules: QueuedStateRegeneratorModules) {
|
||||
@@ -57,7 +55,6 @@ export class QueuedStateRegenerator implements IStateRegenerator {
|
||||
this.blockStateCache = modules.blockStateCache;
|
||||
this.checkpointStateCache = modules.checkpointStateCache;
|
||||
this.metrics = modules.metrics;
|
||||
this.validatorMonitor = modules.validatorMonitor;
|
||||
this.logger = modules.logger;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
processSlots,
|
||||
stateTransition,
|
||||
} from "@lodestar/state-transition";
|
||||
import {BeaconBlock, RootHex, SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
|
||||
import {BeaconBlock, RootHex, SignedBeaconBlock, Slot, phase0} from "@lodestar/types";
|
||||
import {Logger, fromHex, toRootHex} from "@lodestar/utils";
|
||||
import {IBeaconDb} from "../../db/index.js";
|
||||
import {Metrics} from "../../metrics/index.js";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import {BitArray} from "@chainsafe/ssz";
|
||||
import {CommitteeIndex, RootHex, Slot, SubnetID, phase0} from "@lodestar/types";
|
||||
import {MapDef} from "@lodestar/utils";
|
||||
import {Metrics} from "../../metrics/metrics.js";
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import {ChainForkConfig} from "@lodestar/config";
|
||||
import {BLOBSIDECAR_FIXED_SIZE, ForkName, isForkPostDeneb} from "@lodestar/params";
|
||||
import {ForkName, isForkPostDeneb} from "@lodestar/params";
|
||||
import {RootHex, SignedBeaconBlock, deneb, ssz} from "@lodestar/types";
|
||||
import {pruneSetToMax, toRootHex} from "@lodestar/utils";
|
||||
|
||||
import {Metrics} from "../../metrics/index.js";
|
||||
import {SerializedCache} from "../../util/serializedCache.js";
|
||||
import {
|
||||
BlobsSource,
|
||||
BlockInput,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {SLOTS_PER_EPOCH} from "@lodestar/params";
|
||||
import {pruneSetToMax} from "@lodestar/utils";
|
||||
import {DATA, QUANTITY} from "../../eth1/provider/utils.js";
|
||||
import {Metrics} from "../../metrics/index.js";
|
||||
import {PayloadAttributesRpc} from "./types.js";
|
||||
|
||||
// Idealy this only need to be set to the max head reorgs number
|
||||
@@ -22,7 +21,6 @@ type FcuAttributes = {headBlockHash: DATA; finalizedBlockHash: DATA} & Omit<Payl
|
||||
|
||||
export class PayloadIdCache {
|
||||
private readonly payloadIdByFcuAttributes = new Map<string, {payloadId: PayloadId; fullKey: string}>();
|
||||
constructor(private readonly metrics?: Metrics | null) {}
|
||||
|
||||
getFullKey({headBlockHash, finalizedBlockHash, timestamp, prevRandao, suggestedFeeRecipient}: FcuAttributes): string {
|
||||
return `${headBlockHash}-${finalizedBlockHash}-${timestamp}-${prevRandao}-${suggestedFeeRecipient}`;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import {BeaconState} from "@lodestar/types";
|
||||
import {BlobsSource, BlockSource} from "../../chain/blocks/types.js";
|
||||
import {JobQueueItemType} from "../../chain/bls/index.js";
|
||||
import {AttestationErrorCode, BlockErrorCode} from "../../chain/errors/index.js";
|
||||
|
||||
@@ -494,21 +494,6 @@ export class NetworkCore implements INetworkCore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Re-add regossipCachedBlsChanges()
|
||||
// If we are subscribed and post capella fork epoch, try gossiping the cached bls changes
|
||||
// if (
|
||||
// this.isSubscribedToGossipCoreTopics() &&
|
||||
// epoch >= this.config.CAPELLA_FORK_EPOCH &&
|
||||
// !this.regossipBlsChangesPromise
|
||||
// ) {
|
||||
// this.regossipBlsChangesPromise = this.regossipCachedBlsChanges()
|
||||
// // If the processing fails for e.g. because of lack of peers set the promise
|
||||
// // to be null again to be retried
|
||||
// .catch((_e) => {
|
||||
// this.regossipBlsChangesPromise = null;
|
||||
// });
|
||||
// }
|
||||
} catch (e) {
|
||||
this.logger.error("Error on BeaconGossipHandler.onEpoch", {epoch}, e as Error);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ const NETWORK_WORKER_EXIT_RETRY_COUNT = 3;
|
||||
*/
|
||||
export class WorkerNetworkCore implements INetworkCore {
|
||||
private readonly reqRespBridgeReqCaller: AsyncIterableBridgeCaller<OutgoingRequestArgs, ResponseIncoming>;
|
||||
private readonly reqRespBridgeRespHandler: AsyncIterableBridgeHandler<IncomingRequestArgs, ResponseOutgoing>;
|
||||
protected readonly reqRespBridgeRespHandler: AsyncIterableBridgeHandler<IncomingRequestArgs, ResponseOutgoing>;
|
||||
private readonly reqRespBridgeEventBus = new ReqRespBridgeEventBus();
|
||||
|
||||
constructor(private readonly modules: WorkerNetworkCoreModules) {
|
||||
|
||||
@@ -107,7 +107,6 @@ export class Network implements INetwork {
|
||||
|
||||
private subscribedToCoreTopics = false;
|
||||
private connectedPeers = new Set<PeerIdStr>();
|
||||
private regossipBlsChangesPromise: Promise<void> | null = null;
|
||||
|
||||
constructor(modules: NetworkModules) {
|
||||
this.peerId = peerIdFromPrivateKey(modules.privateKey);
|
||||
|
||||
@@ -22,7 +22,6 @@ const MAX_CACHED_ENRS = 100;
|
||||
const MAX_CACHED_ENR_AGE_MS = 5 * 60 * 1000;
|
||||
|
||||
export type PeerDiscoveryOpts = {
|
||||
maxPeers: number;
|
||||
discv5FirstQueryDelayMs: number;
|
||||
discv5: LodestarDiscv5Opts;
|
||||
connectToDiscv5Bootnodes?: boolean;
|
||||
@@ -97,7 +96,6 @@ export class PeerDiscovery {
|
||||
private peerRpcScores: IPeerRpcScoreStore;
|
||||
private metrics: NetworkCoreMetrics | null;
|
||||
private logger: LoggerNode;
|
||||
private config: BeaconConfig;
|
||||
private cachedENRs = new Map<PeerIdStr, CachedENR>();
|
||||
private randomNodeQuery: QueryStatus = {code: QueryStatusCode.NotActive};
|
||||
private peersToConnect = 0;
|
||||
@@ -106,22 +104,18 @@ export class PeerDiscovery {
|
||||
syncnets: new Map(),
|
||||
};
|
||||
|
||||
/** The maximum number of peers we allow (exceptions for subnet peers) */
|
||||
private maxPeers: number;
|
||||
private discv5StartMs: number;
|
||||
private discv5FirstQueryDelayMs: number;
|
||||
|
||||
private connectToDiscv5BootnodesOnStart: boolean | undefined = false;
|
||||
|
||||
constructor(modules: PeerDiscoveryModules, opts: PeerDiscoveryOpts, discv5: Discv5Worker) {
|
||||
const {libp2p, peerRpcScores, metrics, logger, config} = modules;
|
||||
const {libp2p, peerRpcScores, metrics, logger} = modules;
|
||||
this.libp2p = libp2p;
|
||||
this.peerRpcScores = peerRpcScores;
|
||||
this.metrics = metrics;
|
||||
this.logger = logger;
|
||||
this.config = config;
|
||||
this.discv5 = discv5;
|
||||
this.maxPeers = opts.maxPeers;
|
||||
this.discv5StartMs = 0;
|
||||
this.discv5StartMs = Date.now();
|
||||
this.discv5FirstQueryDelayMs = opts.discv5FirstQueryDelayMs;
|
||||
|
||||
@@ -198,7 +198,6 @@ export class PeerManager {
|
||||
// opts.discv5 === null, discovery is disabled
|
||||
const discovery = opts.discv5
|
||||
? await PeerDiscovery.init(modules, {
|
||||
maxPeers: opts.maxPeers,
|
||||
discv5FirstQueryDelayMs: opts.discv5FirstQueryDelayMs ?? DEFAULT_DISCV5_FIRST_QUERY_DELAY_MS,
|
||||
discv5: opts.discv5,
|
||||
connectToDiscv5Bootnodes: opts.connectToDiscv5Bootnodes,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Peer, PeerId} from "@libp2p/interface";
|
||||
import {PeerId} from "@libp2p/interface";
|
||||
import {Encoding} from "@lodestar/reqresp";
|
||||
import {altair, phase0} from "@lodestar/types";
|
||||
import {ClientKind} from "./client.js";
|
||||
|
||||
@@ -4,13 +4,7 @@ import {routes} from "@lodestar/api";
|
||||
import {ForkName} from "@lodestar/params";
|
||||
import {ssz} from "@lodestar/types";
|
||||
import {afterAll, beforeAll, describe, expect, it} from "vitest";
|
||||
import {
|
||||
BlockInput,
|
||||
BlockInputDataBlobs,
|
||||
BlockInputType,
|
||||
BlockSource,
|
||||
CachedData,
|
||||
} from "../../../../src/chain/blocks/types.js";
|
||||
import {BlockInput, BlockInputType, BlockSource, CachedData} from "../../../../src/chain/blocks/types.js";
|
||||
import {ZERO_HASH, ZERO_HASH_HEX} from "../../../../src/constants/constants.js";
|
||||
import {ReqRespBridgeEventData} from "../../../../src/network/core/events.js";
|
||||
import {ReqRespBridgeEvent} from "../../../../src/network/core/events.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
||||
import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
||||
import {beforeAll, beforeEach, describe, expect, it} from "vitest";
|
||||
import {beforeEach, describe, expect, it} from "vitest";
|
||||
import {RegenCaller} from "../../../../src/chain/regen/interface.js";
|
||||
import {processSlotsToNearestCheckpoint} from "../../../../src/chain/regen/regen.js";
|
||||
import {FIFOBlockStateCache} from "../../../../src/chain/stateCache/fifoBlockStateCache.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {BitArray} from "@chainsafe/ssz";
|
||||
import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params";
|
||||
import {SubnetID, ssz} from "@lodestar/types";
|
||||
import {ssz} from "@lodestar/types";
|
||||
import {LodestarError} from "@lodestar/utils";
|
||||
import {describe, expect, it} from "vitest";
|
||||
import {generateTestCachedBeaconStateOnlyValidators} from "../../../../../../state-transition/test/perf/util.js";
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import {toHexString} from "@chainsafe/ssz";
|
||||
import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config";
|
||||
import {
|
||||
BYTES_PER_FIELD_ELEMENT,
|
||||
FIELD_ELEMENTS_PER_BLOB,
|
||||
ForkName,
|
||||
ForkPostDeneb,
|
||||
isForkPostDeneb,
|
||||
} from "@lodestar/params";
|
||||
import {BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB, ForkName, isForkPostDeneb} from "@lodestar/params";
|
||||
import {signedBlockToSignedHeader} from "@lodestar/state-transition";
|
||||
import {SignedBeaconBlock, deneb, ssz} from "@lodestar/types";
|
||||
import {beforeAll, describe, expect, it, vi} from "vitest";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {Job, JobOptions, RunnerEnv, RunnerType} from "../interfaces.js";
|
||||
|
||||
export class ChildProcessRunner implements RunnerEnv<RunnerType.ChildProcess> {
|
||||
type = RunnerType.ChildProcess as const;
|
||||
private logger: Logger;
|
||||
protected logger: Logger;
|
||||
|
||||
constructor(opts: {logger: Logger}) {
|
||||
this.logger = opts.logger;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ForkSeq, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
||||
import {UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
||||
import {electra, ssz} from "@lodestar/types";
|
||||
|
||||
import {CachedBeaconStateElectra} from "../types.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {FAR_FUTURE_EPOCH, ForkSeq} from "@lodestar/params";
|
||||
import {ValidatorIndex, phase0} from "@lodestar/types";
|
||||
import {phase0} from "@lodestar/types";
|
||||
import {verifyVoluntaryExitSignature} from "../signatureSets/index.js";
|
||||
import {CachedBeaconStateAllForks, CachedBeaconStateElectra} from "../types.js";
|
||||
import {getPendingBalanceToWithdraw, isActiveValidator} from "../util/index.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {PublicKey} from "@chainsafe/blst";
|
||||
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
||||
import {ValidatorIndex, phase0} from "@lodestar/types";
|
||||
import {phase0} from "@lodestar/types";
|
||||
|
||||
export type Index2PubkeyCache = PublicKey[];
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js";
|
||||
import {decreaseBalance, increaseBalance} from "../util/balance.js";
|
||||
import {getMaxEffectiveBalance} from "../util/validator.js";
|
||||
|
||||
/**
|
||||
* Starting from Electra:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {FAR_FUTURE_EPOCH, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
||||
import {Epoch, ValidatorIndex, ssz} from "@lodestar/types";
|
||||
import {ValidatorIndex, ssz} from "@lodestar/types";
|
||||
import {CachedBeaconStateElectra, getCachedBeaconState} from "../cache/stateCache.js";
|
||||
import {G2_POINT_AT_INFINITY} from "../constants/constants.js";
|
||||
import {CachedBeaconStateDeneb} from "../types.js";
|
||||
|
||||
@@ -291,7 +291,7 @@ export function getComputeShuffledIndexFn(indexCount: number, seed: Bytes32): Co
|
||||
assert.lt(index, indexCount, "indexCount must be less than index");
|
||||
assert.lte(indexCount, 2 ** 40, "indexCount too big");
|
||||
let permuted = index;
|
||||
const _seed = seed;
|
||||
// const _seed = seed;
|
||||
for (let i = 0; i < SHUFFLE_ROUND_COUNT; i++) {
|
||||
// optimized version of the below naive code
|
||||
// const pivot = Number(
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
SYNC_REWARD_WEIGHT,
|
||||
WEIGHT_DENOMINATOR,
|
||||
} from "@lodestar/params";
|
||||
import {ValidatorIndex, altair} from "@lodestar/types";
|
||||
import {altair} from "@lodestar/types";
|
||||
import {bigIntSqrt} from "@lodestar/utils";
|
||||
import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
|
||||
import {BeaconStateAllForks} from "../types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
||||
import {fromHexString} from "@chainsafe/ssz";
|
||||
import {createBeaconConfig, createChainForkConfig} from "@lodestar/config";
|
||||
import {createBeaconConfig} from "@lodestar/config";
|
||||
import {config as defaultConfig} from "@lodestar/config/default";
|
||||
import {ssz} from "@lodestar/types";
|
||||
import {toHexString} from "@lodestar/utils";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {ApiClient, routes} from "@lodestar/api";
|
||||
import {ChainForkConfig} from "@lodestar/config";
|
||||
import {ForkName, ForkPostBellatrix, ForkPostDeneb, ForkPreDeneb, ForkSeq} from "@lodestar/params";
|
||||
import {ForkName, ForkPostBellatrix, ForkPostDeneb, ForkPreDeneb} from "@lodestar/params";
|
||||
import {
|
||||
BLSPubkey,
|
||||
BLSSignature,
|
||||
|
||||
@@ -791,16 +791,6 @@ export class ValidatorStore {
|
||||
}
|
||||
}
|
||||
|
||||
private getSignerAndPubkeyHex(pubkey: BLSPubkeyMaybeHex): [Signer, string] {
|
||||
// TODO: Refactor indexing to not have to run toHex() on the pubkey every time
|
||||
const pubkeyHex = typeof pubkey === "string" ? pubkey : toPubkeyHex(pubkey);
|
||||
const signer = this.validators.get(pubkeyHex)?.signer;
|
||||
if (!signer) {
|
||||
throw Error(`Validator pubkey ${pubkeyHex} not known`);
|
||||
}
|
||||
return [signer, pubkeyHex];
|
||||
}
|
||||
|
||||
/** Prevent signing bad data sent by the Beacon node */
|
||||
private validateAttestationDuty(duty: routes.validator.AttesterDuty, data: phase0.AttestationData): void {
|
||||
if (duty.slot !== data.slot) {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// `transpileOnly` mode for the `ts-node`. This change requires to treat types for each module
|
||||
// independently, which is done by setting the `isolatedModules` flag to `true`.
|
||||
"isolatedModules": true,
|
||||
// Detect unused imports, variables, and functions
|
||||
"noUnusedLocals": true,
|
||||
},
|
||||
"ts-node": {
|
||||
"transpileOnly": true
|
||||
|
||||
Reference in New Issue
Block a user