diff --git a/biome.jsonc b/biome.jsonc index 5ffc4449ee63..68ebb742878a 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -28,9 +28,7 @@ // We need couple of empty exports to make those files as esm modules "noUselessEmptyExport": "off", // We use normal functions for to ease with debugging context - "useArrowFunction": "off", - // This pattern is used a lot earlier in code so disabling this rule - "useLiteralKeys": "off" + "useArrowFunction": "off" }, "correctness": { "noUnusedVariables": "error", @@ -350,7 +348,9 @@ "linter": { "rules": { "complexity": { - "useArrowFunction": "off" + "useArrowFunction": "off", + // During tests we often need to use private/protected attributes, which is only possible with literal keys + "useLiteralKeys": "off" } } } diff --git a/packages/beacon-node/src/api/impl/lodestar/index.ts b/packages/beacon-node/src/api/impl/lodestar/index.ts index 34f0a722cacc..f89959ad9da6 100644 --- a/packages/beacon-node/src/api/impl/lodestar/index.ts +++ b/packages/beacon-node/src/api/impl/lodestar/index.ts @@ -109,6 +109,7 @@ export function getLodestarApi({ async getBlockProcessorQueueItems() { return { + // biome-ignore lint/complexity/useLiteralKeys: The `blockProcessor` is a protected attribute data: (chain as BeaconChain)["blockProcessor"].jobQueue.getItems().map((item) => { const [blockInputs, opts] = item.args; return { @@ -173,6 +174,7 @@ export function getLodestarApi({ async dumpDbBucketKeys({bucket}) { for (const repo of Object.values(db) as IBeaconDb[keyof IBeaconDb][]) { if (repo instanceof Repository) { + // biome-ignore lint/complexity/useLiteralKeys: `bucket` is protected and `bucketId` is private if (String(repo["bucket"]) === bucket || repo["bucketId"] === bucket) { return {data: stringifyKeys(await repo.keys())}; } diff --git a/packages/beacon-node/src/chain/lightClient/index.ts b/packages/beacon-node/src/chain/lightClient/index.ts index 5cdae8b31c5d..a21c92744e41 100644 --- a/packages/beacon-node/src/chain/lightClient/index.ts +++ b/packages/beacon-node/src/chain/lightClient/index.ts @@ -225,7 +225,7 @@ export class LightClientServer { this.zero = { // Assign the hightest fork's default value because it can always be typecasted down to correct fork finalizedHeader: sszTypesFor(highestFork(forkLightClient)).LightClientHeader.defaultValue(), - finalityBranch: ssz.altair.LightClientUpdate.fields["finalityBranch"].defaultValue(), + finalityBranch: ssz.altair.LightClientUpdate.fields.finalityBranch.defaultValue(), }; if (metrics) { diff --git a/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts b/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts index f4865c73f8e4..0b19495abde6 100644 --- a/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts +++ b/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts @@ -34,9 +34,9 @@ export function validateLightClientFinalityUpdate( } // [IGNORE] The received finality_update matches the locally computed one exactly - const sszType = config.getLightClientForkTypes(gossipedFinalityUpdate.attestedHeader.beacon.slot)[ - "LightClientFinalityUpdate" - ]; + const sszType = config.getLightClientForkTypes( + gossipedFinalityUpdate.attestedHeader.beacon.slot + ).LightClientFinalityUpdate; if (localFinalityUpdate === null || !sszType.equals(gossipedFinalityUpdate, localFinalityUpdate)) { throw new LightClientError(GossipAction.IGNORE, { code: LightClientErrorCode.FINALITY_UPDATE_NOT_MATCHING_LOCAL, diff --git a/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts b/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts index 182321984af5..7a7dd7f34a91 100644 --- a/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts +++ b/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts @@ -35,9 +35,9 @@ export function validateLightClientOptimisticUpdate( } // [IGNORE] The received optimistic_update matches the locally computed one exactly - const sszType = config.getLightClientForkTypes(gossipedOptimisticUpdate.attestedHeader.beacon.slot)[ - "LightClientOptimisticUpdate" - ]; + const sszType = config.getLightClientForkTypes( + gossipedOptimisticUpdate.attestedHeader.beacon.slot + ).LightClientOptimisticUpdate; if (localOptimisticUpdate === null || !sszType.equals(gossipedOptimisticUpdate, localOptimisticUpdate)) { throw new LightClientError(GossipAction.IGNORE, { code: LightClientErrorCode.OPTIMISTIC_UPDATE_NOT_MATCHING_LOCAL, diff --git a/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts b/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts index 797142d09db7..8c2785dbe67c 100644 --- a/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts +++ b/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts @@ -17,7 +17,7 @@ export async function deleteRootIndex( signedBeaconBlockType: SSZTypesFor, block: SignedBeaconBlock ): Promise { - const beaconBlockType = (signedBeaconBlockType as typeof ssz.phase0.SignedBeaconBlock).fields["message"]; + const beaconBlockType = (signedBeaconBlockType as typeof ssz.phase0.SignedBeaconBlock).fields.message; return db.delete(getRootIndexKey(beaconBlockType.hashTreeRoot(block.message))); } diff --git a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts index abd0dd20050e..f2ceae0d8c19 100644 --- a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts +++ b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts @@ -268,7 +268,7 @@ export class JsonRpcHttpClient implements IJsonRpcHttpClient { }; const token = encodeJwtToken(jwtClaim, this.jwtSecret); - headers["Authorization"] = `Bearer ${token}`; + headers.Authorization = `Bearer ${token}`; } const res = await fetch(url, { diff --git a/packages/beacon-node/src/network/core/networkCore.ts b/packages/beacon-node/src/network/core/networkCore.ts index 9d075c730558..b000d184e0eb 100644 --- a/packages/beacon-node/src/network/core/networkCore.ts +++ b/packages/beacon-node/src/network/core/networkCore.ts @@ -224,6 +224,7 @@ export class NetworkCore implements INetworkCore { reqResp.registerProtocolsAtFork(forkCurrentSlot); // Bind discv5's ENR to local metadata + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute discv5 = peerManager["discovery"]?.discv5; // Initialize ENR with clock's fork @@ -277,6 +278,7 @@ export class NetworkCore implements INetworkCore { async scrapeMetrics(): Promise { return [ (await this.metrics?.register.metrics()) ?? "", + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute (await this.peerManager["discovery"]?.discv5.scrapeMetrics()) ?? "", ] .filter((str) => str.length > 0) @@ -344,6 +346,7 @@ export class NetworkCore implements INetworkCore { // REST API queries async getNetworkIdentity(): Promise { + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute const enr = await this.peerManager["discovery"]?.discv5.enr(); const discoveryAddresses = [ enr?.getLocationMultiaddr("tcp")?.toString() ?? null, @@ -410,6 +413,7 @@ export class NetworkCore implements INetworkCore { } async dumpDiscv5KadValues(): Promise { + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute return (await this.peerManager["discovery"]?.discv5?.kadValues())?.map((enr) => enr.encodeTxt()) ?? []; } @@ -426,6 +430,7 @@ export class NetworkCore implements INetworkCore { } async writeDiscv5Profile(durationMs: number, dirpath: string): Promise { + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute return this.peerManager["discovery"]?.discv5.writeProfile(durationMs, dirpath) ?? "no discv5"; } @@ -434,6 +439,7 @@ export class NetworkCore implements INetworkCore { } writeDiscv5HeapSnapshot(prefix: string, dirpath: string): Promise { + // biome-ignore lint/complexity/useLiteralKeys: `discovery` is a private attribute return this.peerManager["discovery"]?.discv5.writeHeapSnapshot(prefix, dirpath) ?? Promise.resolve("no discv5"); } diff --git a/packages/beacon-node/src/network/gossip/gossipsub.ts b/packages/beacon-node/src/network/gossip/gossipsub.ts index e8ccab6fc591..83bb913325bf 100644 --- a/packages/beacon-node/src/network/gossip/gossipsub.ts +++ b/packages/beacon-node/src/network/gossip/gossipsub.ts @@ -184,10 +184,11 @@ export class Eth2Gossipsub extends GossipSub { } private onScrapeLodestarMetrics(metrics: Eth2GossipsubMetrics): void { - const mesh = this["mesh"]; + const mesh = this.mesh; + // biome-ignore lint/complexity/useLiteralKeys: `topics` is a private attribute const topics = this["topics"] as Map>; - const peers = this["peers"]; - const score = this["score"]; + const peers = this.peers; + const score = this.score; const meshPeersByClient = new Map(); const meshPeerIdStrs = new Set(); diff --git a/packages/beacon-node/src/network/util.ts b/packages/beacon-node/src/network/util.ts index 2be4756fe693..f1d6b917b5e4 100644 --- a/packages/beacon-node/src/network/util.ts +++ b/packages/beacon-node/src/network/util.ts @@ -15,6 +15,7 @@ export function prettyPrintPeerIdStr(id: PeerIdStr): string { */ // Compat function for efficiency reasons export function getConnectionsMap(libp2p: Libp2p): Map { + // biome-ignore lint/complexity/useLiteralKeys: `map` is a private attribute return libp2p.services.components.connectionManager.getConnectionsMap()["map"]; } diff --git a/packages/beacon-node/test/spec/presets/light_client/sync.ts b/packages/beacon-node/test/spec/presets/light_client/sync.ts index d931a5f310a8..3e82256fab1d 100644 --- a/packages/beacon-node/test/spec/presets/light_client/sync.ts +++ b/packages/beacon-node/test/spec/presets/light_client/sync.ts @@ -128,7 +128,7 @@ export const sync: TestRunnerFn = (fork) => { } const headerSlot = Number(step.process_update.checks.optimistic_header.slot); - const update = config.getLightClientForkTypes(headerSlot)["LightClientUpdate"].deserialize(updateBytes); + const update = config.getLightClientForkTypes(headerSlot).LightClientUpdate.deserialize(updateBytes); logger.debug(`LightclientUpdateSummary: ${JSON.stringify(toLightClientUpdateSummary(update))}`); diff --git a/packages/beacon-node/test/spec/utils/runValidSszTest.ts b/packages/beacon-node/test/spec/utils/runValidSszTest.ts index a8d3060af08d..748a7770b19c 100644 --- a/packages/beacon-node/test/spec/utils/runValidSszTest.ts +++ b/packages/beacon-node/test/spec/utils/runValidSszTest.ts @@ -83,6 +83,7 @@ export function runValidSszTest(type: Type, testData: ValidTestCaseData if (type.isBasic) { console.log("ROOTS Basic", toHexString(type.serialize(testDataValue))); } else { + // biome-ignore lint/complexity/useLiteralKeys: The `getRoots` is a protected attribute const roots = (type as CompositeType)["getRoots"](testDataValue); console.log( "ROOTS Composite", diff --git a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts index 2881b378069a..a9f91af87152 100644 --- a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts +++ b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts @@ -125,6 +125,7 @@ export function overwriteEnrWithCliArgs( enr.seq = preSeq + BigInt(1); } // invalidate cached signature + // biome-ignore lint/complexity/useLiteralKeys: `_signature` is a private attribute delete enr["_signature"]; } } diff --git a/packages/cli/src/cmds/dev/options.ts b/packages/cli/src/cmds/dev/options.ts index 5286b81729c6..e442b0605cdc 100644 --- a/packages/cli/src/cmds/dev/options.ts +++ b/packages/cli/src/cmds/dev/options.ts @@ -81,12 +81,12 @@ const externalOptionsOverrides: Partial closeMetrics()); // only start server if metrics are explicitly enabled - if (args["metrics"]) { + if (args.metrics) { const port = args["metrics.port"] ?? validatorMetricsDefaultOptions.port; const address = args["metrics.address"] ?? validatorMetricsDefaultOptions.address; const metricsServer = await getHttpMetricsServer({port, address}, {register, logger}); @@ -186,7 +186,7 @@ export async function validatorHandler(args: IValidatorCliArgs & GlobalArgs): Pr // Start keymanager API backend // Only if keymanagerEnabled flag is set to true - if (args["keymanager"]) { + if (args.keymanager) { // if proposerSettingsFile provided disable the key proposerConfigWrite in keymanager const proposerConfigWriteDisabled = args.proposerSettingsFile !== undefined; if (proposerConfigWriteDisabled) { @@ -234,7 +234,7 @@ function getProposerConfigFromArgs( builder: { gasLimit: args.defaultGasLimit, selection: parseBuilderSelection( - args["builder.selection"] ?? (args["builder"] ? defaultOptions.builderAliasSelection : undefined) + args["builder.selection"] ?? (args.builder ? defaultOptions.builderAliasSelection : undefined) ), boostFactor: parseBuilderBoostFactor(args["builder.boostFactor"]), }, diff --git a/packages/cli/src/cmds/validator/signers/index.ts b/packages/cli/src/cmds/validator/signers/index.ts index 6a343d12e6b8..950be2db1cf5 100644 --- a/packages/cli/src/cmds/validator/signers/index.ts +++ b/packages/cli/src/cmds/validator/signers/index.ts @@ -97,7 +97,7 @@ export async function getSignersFromArgs( ignoreLockFile: args.force, onDecrypt: needle, cacheFilePath: path.join(accountPaths.cacheDir, "imported_keystores.cache"), - disableThreadPool: args["disableKeystoresThreadPool"], + disableThreadPool: args.disableKeystoresThreadPool, logger, signal, }); @@ -131,7 +131,7 @@ export async function getSignersFromArgs( ignoreLockFile: args.force, onDecrypt: needle, cacheFilePath: path.join(accountPaths.cacheDir, "local_keystores.cache"), - disableThreadPool: args["disableKeystoresThreadPool"], + disableThreadPool: args.disableKeystoresThreadPool, logger, signal, }); diff --git a/packages/cli/src/cmds/validator/signers/logSigners.ts b/packages/cli/src/cmds/validator/signers/logSigners.ts index 20aa50d25ff6..d245ee75883a 100644 --- a/packages/cli/src/cmds/validator/signers/logSigners.ts +++ b/packages/cli/src/cmds/validator/signers/logSigners.ts @@ -60,11 +60,11 @@ function groupRemoteSignersByUrl(remoteSigners: SignerRemote[]): {url: string; p * is connected with fetching enabled, but otherwise exit the process and suggest a different configuration. */ export function warnOrExitNoSigners(args: IValidatorCliArgs, logger: Pick): void { - if (args["keymanager"] && !args["externalSigner.fetch"]) { + if (args.keymanager && !args["externalSigner.fetch"]) { logger.warn("No local keystores or remote keys found with current args, expecting to be added via keymanager"); - } else if (!args["keymanager"] && args["externalSigner.fetch"]) { + } else if (!args.keymanager && args["externalSigner.fetch"]) { logger.warn("No remote keys found with current args, expecting to be added to external signer and fetched later"); - } else if (args["keymanager"] && args["externalSigner.fetch"]) { + } else if (args.keymanager && args["externalSigner.fetch"]) { logger.warn( "No local keystores or remote keys found with current args, expecting to be added via keymanager or fetched from external signer later" ); diff --git a/packages/cli/src/options/beaconNodeOptions/api.ts b/packages/cli/src/options/beaconNodeOptions/api.ts index 3966abf0ed6d..ea4d4ebccf84 100644 --- a/packages/cli/src/options/beaconNodeOptions/api.ts +++ b/packages/cli/src/options/beaconNodeOptions/api.ts @@ -22,7 +22,7 @@ export function parseArgs(args: ApiArgs): IBeaconNodeOptions["api"] { rest: { api: args["rest.namespace"] as IBeaconNodeOptions["api"]["rest"]["api"], cors: args["rest.cors"], - enabled: args["rest"], + enabled: args.rest, address: args["rest.address"], port: args["rest.port"], headerLimit: args["rest.headerLimit"], diff --git a/packages/cli/src/options/beaconNodeOptions/builder.ts b/packages/cli/src/options/beaconNodeOptions/builder.ts index 2c89cbad89d2..d0e4089dd81c 100644 --- a/packages/cli/src/options/beaconNodeOptions/builder.ts +++ b/packages/cli/src/options/beaconNodeOptions/builder.ts @@ -18,7 +18,7 @@ export function parseArgs(args: ExecutionBuilderArgs): IBeaconNodeOptions["execu } return { - enabled: args["builder"], + enabled: args.builder, url: args["builder.url"] ?? defaultExecutionBuilderHttpOpts.url, timeout: args["builder.timeout"], faultInspectionWindow: args["builder.faultInspectionWindow"], diff --git a/packages/cli/src/options/beaconNodeOptions/chain.ts b/packages/cli/src/options/beaconNodeOptions/chain.ts index 7540dd56a636..78ffd47da8f4 100644 --- a/packages/cli/src/options/beaconNodeOptions/chain.ts +++ b/packages/cli/src/options/beaconNodeOptions/chain.ts @@ -36,7 +36,7 @@ export type ChainArgs = { export function parseArgs(args: ChainArgs): IBeaconNodeOptions["chain"] { return { - suggestedFeeRecipient: args["suggestedFeeRecipient"], + suggestedFeeRecipient: args.suggestedFeeRecipient, blsVerifyAllMultiThread: args["chain.blsVerifyAllMultiThread"], blsVerifyAllMainThread: args["chain.blsVerifyAllMainThread"], disableBlsBatchVerify: args["chain.disableBlsBatchVerify"], @@ -55,8 +55,8 @@ export function parseArgs(args: ChainArgs): IBeaconNodeOptions["chain"] { trustedSetup: args["chain.trustedSetup"], safeSlotsToImportOptimistically: args["safe-slots-to-import-optimistically"], archiveStateEpochFrequency: args["chain.archiveStateEpochFrequency"], - emitPayloadAttributes: args["emitPayloadAttributes"], - broadcastValidationStrictness: args["broadcastValidationStrictness"], + emitPayloadAttributes: args.emitPayloadAttributes, + broadcastValidationStrictness: args.broadcastValidationStrictness, minSameMessageSignatureSetsToBatch: args["chain.minSameMessageSignatureSetsToBatch"] ?? defaultOptions.chain.minSameMessageSignatureSetsToBatch, maxShufflingCacheEpochs: args["chain.maxShufflingCacheEpochs"] ?? defaultOptions.chain.maxShufflingCacheEpochs, diff --git a/packages/cli/src/options/beaconNodeOptions/eth1.ts b/packages/cli/src/options/beaconNodeOptions/eth1.ts index ff777651a039..f12a1704dec7 100644 --- a/packages/cli/src/options/beaconNodeOptions/eth1.ts +++ b/packages/cli/src/options/beaconNodeOptions/eth1.ts @@ -25,14 +25,12 @@ export function parseArgs(args: Eth1Args & Partial): IBeaco // jwt auth mechanism. if (providerUrls === undefined && args["execution.urls"]) { providerUrls = args["execution.urls"]; - jwtSecretHex = args["jwtSecret"] - ? extractJwtHexSecret(fs.readFileSync(args["jwtSecret"], "utf-8").trim()) - : undefined; - jwtId = args["jwtId"]; + jwtSecretHex = args.jwtSecret ? extractJwtHexSecret(fs.readFileSync(args.jwtSecret, "utf-8").trim()) : undefined; + jwtId = args.jwtId; } return { - enabled: args["eth1"], + enabled: args.eth1, providerUrls, jwtSecretHex, jwtId, diff --git a/packages/cli/src/options/beaconNodeOptions/execution.ts b/packages/cli/src/options/beaconNodeOptions/execution.ts index b8b3841ae2ab..2d32ee2ae786 100644 --- a/packages/cli/src/options/beaconNodeOptions/execution.ts +++ b/packages/cli/src/options/beaconNodeOptions/execution.ts @@ -30,10 +30,8 @@ export function parseArgs(args: ExecutionEngineArgs): IBeaconNodeOptions["execut * jwtSecret is parsed as hex instead of bytes because the merge with defaults * in beaconOptions messes up the bytes array as as index => value object */ - jwtSecretHex: args["jwtSecret"] - ? extractJwtHexSecret(fs.readFileSync(args["jwtSecret"], "utf-8").trim()) - : undefined, - jwtId: args["jwtId"], + jwtSecretHex: args.jwtSecret ? extractJwtHexSecret(fs.readFileSync(args.jwtSecret, "utf-8").trim()) : undefined, + jwtId: args.jwtId, }; } diff --git a/packages/cli/src/options/beaconNodeOptions/metrics.ts b/packages/cli/src/options/beaconNodeOptions/metrics.ts index ba12a7546eae..ded63b7dc24d 100644 --- a/packages/cli/src/options/beaconNodeOptions/metrics.ts +++ b/packages/cli/src/options/beaconNodeOptions/metrics.ts @@ -9,7 +9,7 @@ export type MetricsArgs = { export function parseArgs(args: MetricsArgs): IBeaconNodeOptions["metrics"] { return { - enabled: args["metrics"], + enabled: args.metrics, port: args["metrics.port"], address: args["metrics.address"], }; diff --git a/packages/cli/src/options/beaconNodeOptions/network.ts b/packages/cli/src/options/beaconNodeOptions/network.ts index 2311610201df..cfd109bdc50a 100644 --- a/packages/cli/src/options/beaconNodeOptions/network.ts +++ b/packages/cli/src/options/beaconNodeOptions/network.ts @@ -100,16 +100,16 @@ export function parseArgs(args: NetworkArgs): IBeaconNodeOptions["network"] { const bindMu6 = listenAddress6 ? `${muArgs.listenAddress6}${muArgs.discoveryPort6}` : undefined; const localMu6 = listenAddress6 ? `${muArgs.listenAddress6}${muArgs.port6}` : undefined; - const targetPeers = args["targetPeers"]; + const targetPeers = args.targetPeers; const maxPeers = args["network.maxPeers"] ?? (targetPeers !== undefined ? Math.floor(targetPeers * 1.1) : undefined); if (targetPeers != null && maxPeers != null && targetPeers > maxPeers) { throw new YargsError("network.maxPeers must be greater than or equal to targetPeers"); } // Set discv5 opts to null to disable only if explicitly disabled - const enableDiscv5 = args["discv5"] ?? true; + const enableDiscv5 = args.discv5 ?? true; // TODO: Okay to set to empty array? - const bootEnrs = args["bootnodes"] ?? []; + const bootEnrs = args.bootnodes ?? []; // throw if user-provided enrs are invalid for (const enrStr of bootEnrs) { try { @@ -135,10 +135,10 @@ export function parseArgs(args: NetworkArgs): IBeaconNodeOptions["network"] { maxPeers: maxPeers ?? defaultOptions.network.maxPeers, targetPeers: targetPeers ?? defaultOptions.network.targetPeers, localMultiaddrs: [localMu, localMu6].filter(Boolean) as string[], - subscribeAllSubnets: args["subscribeAllSubnets"], + subscribeAllSubnets: args.subscribeAllSubnets, slotsToSubscribeBeforeAggregatorDuty: - args["slotsToSubscribeBeforeAggregatorDuty"] ?? defaultOptions.network.slotsToSubscribeBeforeAggregatorDuty, - disablePeerScoring: args["disablePeerScoring"], + args.slotsToSubscribeBeforeAggregatorDuty ?? defaultOptions.network.slotsToSubscribeBeforeAggregatorDuty, + disablePeerScoring: args.disablePeerScoring, connectToDiscv5Bootnodes: args["network.connectToDiscv5Bootnodes"], discv5FirstQueryDelayMs: args["network.discv5FirstQueryDelayMs"], dontSendGossipAttestationsToForkchoice: args["network.dontSendGossipAttestationsToForkchoice"], @@ -148,7 +148,7 @@ export function parseArgs(args: NetworkArgs): IBeaconNodeOptions["network"] { gossipsubDHigh: args["network.gossipsubDHigh"], gossipsubAwaitHandler: args["network.gossipsubAwaitHandler"], disableFloodPublish: args["network.disableFloodPublish"], - mdns: args["mdns"], + mdns: args.mdns, rateLimitMultiplier: args["network.rateLimitMultiplier"], maxGossipTopicConcurrency: args["network.maxGossipTopicConcurrency"], useWorker: args["network.useWorker"], diff --git a/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts index 5d0f7a268f88..922ce80ae329 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts @@ -32,7 +32,7 @@ export const attestationsCountAssertion: Assertion<"attestationsCount", number, async assert({clock, store, epoch, node, dependantStores}) { const errors: AssertionResult[] = []; - const inclusionDelayStore = dependantStores["inclusionDelay"]; + const inclusionDelayStore = dependantStores.inclusionDelay; const startSlot = epoch === 0 ? 1 : clock.getFirstSlotOfEpoch(epoch); const endSlot = clock.getLastSlotOfEpoch(epoch); diff --git a/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts b/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts index 3321401a21dd..2bc7c27ead41 100644 --- a/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts +++ b/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts @@ -58,11 +58,11 @@ export const generateLodestarBeaconNode: BeaconNodeGenerator const participation: {head: number; source: number; target: number}[] = []; for (const node of nodes) { - participation.push( - stores["attestationParticipation"][node.beacon.id][slot] ?? {head: 0, source: 0, target: 0} - ); + participation.push(stores.attestationParticipation[node.beacon.id][slot] ?? {head: 0, source: 0, target: 0}); const syncCommitteeParticipation: number[] = []; for (let slot = startSlot; slot <= endSlot; slot++) { - syncCommitteeParticipation.push(stores["syncCommitteeParticipation"][node.beacon.id][slot] ?? 0); + syncCommitteeParticipation.push(stores.syncCommitteeParticipation[node.beacon.id][slot] ?? 0); } nodesSyncParticipationAvg.push(avg(syncCommitteeParticipation)); } @@ -87,19 +85,19 @@ export class TableReporter extends SimulationReporter const peersCount: number[] = []; for (const node of nodes) { - const finalized = stores["finalized"][node.beacon.id][slot]; + const finalized = stores.finalized[node.beacon.id][slot]; if (!isNullish(finalized)) finalizedSlots.push(finalized); - const inclusionDelay = stores["inclusionDelay"][node.beacon.id][slot]; + const inclusionDelay = stores.inclusionDelay[node.beacon.id][slot]; if (!isNullish(inclusionDelay)) inclusionDelays.push(inclusionDelay); - const attestationsCount = stores["attestationsCount"][node.beacon.id][slot]; + const attestationsCount = stores.attestationsCount[node.beacon.id][slot]; if (!isNullish(attestationsCount)) attestationCounts.push(attestationsCount); - const head = stores["head"][node.beacon.id][slot]; + const head = stores.head[node.beacon.id][slot]; if (!isNullish(head)) heads.push(head); - const connectedPeerCount = stores["connectedPeerCount"][node.beacon.id][slot]; + const connectedPeerCount = stores.connectedPeerCount[node.beacon.id][slot]; if (!isNullish(connectedPeerCount)) peersCount.push(connectedPeerCount); } diff --git a/packages/logger/src/env.ts b/packages/logger/src/env.ts index 201d91c69069..e81ae9613e15 100644 --- a/packages/logger/src/env.ts +++ b/packages/logger/src/env.ts @@ -6,20 +6,18 @@ import {LogFormat, TimestampFormat} from "./interface.js"; export function getEnvLogLevel(): LogLevel | null { if (process == null) return null; - if (process.env["LOG_LEVEL"]) return process.env["LOG_LEVEL"] as LogLevel; - if (process.env["DEBUG"]) return LogLevel.debug; - if (process.env["VERBOSE"]) return LogLevel.verbose; + if (process.env.LOG_LEVEL) return process.env.LOG_LEVEL as LogLevel; + if (process.env.DEBUG) return LogLevel.debug; + if (process.env.VERBOSE) return LogLevel.verbose; return null; } export function getEnvLogger(opts?: Partial): Logger { const level = opts?.level ?? getEnvLogLevel(); - const format = (opts?.format ?? process.env["LOG_FORMAT"]) as LogFormat; + const format = (opts?.format ?? process.env.LOG_FORMAT) as LogFormat; const timestampFormat = opts?.timestampFormat ?? - ((process.env["LOG_TIMESTAMP_FORMAT"] - ? {format: process.env["LOG_TIMESTAMP_FORMAT"]} - : undefined) as TimestampFormat); + ((process.env.LOG_TIMESTAMP_FORMAT ? {format: process.env.LOG_TIMESTAMP_FORMAT} : undefined) as TimestampFormat); if (level != null) { return getBrowserLogger({...opts, level, format, timestampFormat}); diff --git a/packages/reqresp/src/encoders/responseDecode.ts b/packages/reqresp/src/encoders/responseDecode.ts index d55b283df5e6..64d90c29ed43 100644 --- a/packages/reqresp/src/encoders/responseDecode.ts +++ b/packages/reqresp/src/encoders/responseDecode.ts @@ -121,6 +121,7 @@ export async function readErrorMessage(bufferedSource: BufferedSource): Promise< length = buffer.length; } + // biome-ignore lint/complexity/useLiteralKeys: It is a private attribute const bytes = bufferedSource["buffer"].slice(0, length); try { diff --git a/packages/state-transition/src/cache/stateCache.ts b/packages/state-transition/src/cache/stateCache.ts index 5412675352e9..3eeeb285b660 100644 --- a/packages/state-transition/src/cache/stateCache.ts +++ b/packages/state-transition/src/cache/stateCache.ts @@ -254,9 +254,11 @@ export function isCachedBeaconState( // This cache is populated during epoch transition, and should be preserved for performance. // If the cache is missing too often, means that our clone strategy is not working well. export function isStateValidatorsNodesPopulated(state: CachedBeaconStateAllForks): boolean { + // biome-ignore lint/complexity/useLiteralKeys: It is a private attribute return state.validators["nodesPopulated"] === true; } export function isStateBalancesNodesPopulated(state: CachedBeaconStateAllForks): boolean { + // biome-ignore lint/complexity/useLiteralKeys: It is a private attribute return state.balances["nodesPopulated"] === true; } diff --git a/packages/state-transition/src/metrics.ts b/packages/state-transition/src/metrics.ts index a5e5463231fa..ac558a1be139 100644 --- a/packages/state-transition/src/metrics.ts +++ b/packages/state-transition/src/metrics.ts @@ -74,9 +74,11 @@ export function onPostStateMetrics(postState: CachedBeaconStateAllForks, metrics // This cache is populated during epoch transition, and should be preserved for performance. // If the cache is missing too often, means that our clone strategy is not working well. function isValidatorsNodesPopulated(state: CachedBeaconStateAllForks): boolean { + // biome-ignore lint/complexity/useLiteralKeys: It is a private attribute return state.validators["nodesPopulated"] === true; } function isBalancesNodesPopulated(state: CachedBeaconStateAllForks): boolean { + // biome-ignore lint/complexity/useLiteralKeys: It is a private attribute return state.balances["nodesPopulated"] === true; } diff --git a/packages/state-transition/src/slot/upgradeStateToAltair.ts b/packages/state-transition/src/slot/upgradeStateToAltair.ts index cfe43e097939..22ab8b13882c 100644 --- a/packages/state-transition/src/slot/upgradeStateToAltair.ts +++ b/packages/state-transition/src/slot/upgradeStateToAltair.ts @@ -92,6 +92,7 @@ export function upgradeStateToAltair(statePhase0: CachedBeaconStatePhase0): Cach // // TODO: This could only drop the caches of index 15,16. However this would couple this code tightly with SSZ ViewDU // internals. If the cache is not cleared, consuming the ViewDU instance could break in strange ways. + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute stateAltair["clearCache"](); // TODO: describe issue. Compute progressive target balances diff --git a/packages/state-transition/src/slot/upgradeStateToCapella.ts b/packages/state-transition/src/slot/upgradeStateToCapella.ts index ce27a17bf9b0..30a0701e58e8 100644 --- a/packages/state-transition/src/slot/upgradeStateToCapella.ts +++ b/packages/state-transition/src/slot/upgradeStateToCapella.ts @@ -64,6 +64,7 @@ export function upgradeStateToCapella(stateBellatrix: CachedBeaconStateBellatrix // Commit new added fields ViewDU to the root node stateCapella.commit(); // Clear cache to ensure the cache of bellatrix fields is not used by new capella fields + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute stateCapella["clearCache"](); return stateCapella; diff --git a/packages/state-transition/src/slot/upgradeStateToDeneb.ts b/packages/state-transition/src/slot/upgradeStateToDeneb.ts index 53be75f72ad8..2344a8d4e08e 100644 --- a/packages/state-transition/src/slot/upgradeStateToDeneb.ts +++ b/packages/state-transition/src/slot/upgradeStateToDeneb.ts @@ -34,6 +34,7 @@ export function upgradeStateToDeneb(stateCapella: CachedBeaconStateCapella): Cac stateDeneb.commit(); // Clear cache to ensure the cache of capella fields is not used by new deneb fields + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute stateDeneb["clearCache"](); return stateDeneb; diff --git a/packages/state-transition/src/slot/upgradeStateToElectra.ts b/packages/state-transition/src/slot/upgradeStateToElectra.ts index 0bd36a909b46..b7cdde86a479 100644 --- a/packages/state-transition/src/slot/upgradeStateToElectra.ts +++ b/packages/state-transition/src/slot/upgradeStateToElectra.ts @@ -112,6 +112,7 @@ export function upgradeStateToElectra(stateDeneb: CachedBeaconStateDeneb): Cache // Commit new added fields ViewDU to the root node stateElectra.commit(); // Clear cache to ensure the cache of deneb fields is not used by new ELECTRA fields + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute stateElectra["clearCache"](); return stateElectra; @@ -154,6 +155,7 @@ export function upgradeStateToElectraOriginal(stateDeneb: CachedBeaconStateDeneb // Commit new added fields ViewDU to the root node stateElectra.commit(); // Clear cache to ensure the cache of deneb fields is not used by new ELECTRA fields + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute stateElectra["clearCache"](); return stateElectra; diff --git a/packages/state-transition/test/perf/block/util.ts b/packages/state-transition/test/perf/block/util.ts index baa86dcac6a5..441c67deb198 100644 --- a/packages/state-transition/test/perf/block/util.ts +++ b/packages/state-transition/test/perf/block/util.ts @@ -206,7 +206,9 @@ function getDeposits(preState: CachedBeaconStateAllForks, count: number): phase0 // Fill depositRootViewDU up to depositCount // Instead of actually filling it, just mutate the length to allow .set() + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute depositRootViewDU["_length"] = depositCount + count; + // biome-ignore lint/complexity/useLiteralKeys: It is a protected attribute depositRootViewDU["dirtyLength"] = true; for (let i = 0; i < count; i++) { diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index 55b5adef23e1..47814ff634c7 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -247,7 +247,7 @@ export class ValidatorStore { throw Error(`Validator pubkey ${pubkeyHex} not known`); } // This should directly modify data in the map - delete validatorData["feeRecipient"]; + delete validatorData.feeRecipient; } getGraffiti(pubkeyHex: PubkeyHex): string | undefined { @@ -267,7 +267,7 @@ export class ValidatorStore { if (validatorData === undefined) { throw Error(`Validator pubkey ${pubkeyHex} not known`); } - delete validatorData["graffiti"]; + delete validatorData.graffiti; } getBuilderSelectionParams(pubkeyHex: PubkeyHex): {selection: routes.validator.BuilderSelection; boostFactor: bigint} {