From 99c0dcb81bb2a9c238fb1094ea0b4ffeee646547 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 30 Oct 2024 18:13:00 +0000 Subject: [PATCH 01/48] feat: add keymanager endpoint to retrieve proposer config (#7210) * feat: add keymanager endpoint to retrieve proposer config * Do not return empty builder config * Check all builder proposer config values * Fix settings builder config if undefined * Fix builder config parsing * Use ssz type to handle json serialization Default parsing can't handle BigInt * Revert "Use ssz type to handle json serialization" This reverts commit 01fcea702e32e1f97a0aa351b6623d94dc0fbcea. * Fix boost factor json serialization * Remove unused import * Update test data * Update proposer config test --- packages/api/src/keymanager/index.ts | 1 + packages/api/src/keymanager/routes.ts | 33 +++++++++++++++++++ packages/api/test/unit/keymanager/testData.ts | 15 +++++++++ .../cli/src/cmds/validator/keymanager/impl.ts | 18 ++++++++++ packages/cli/src/util/proposerConfig.ts | 13 +++++--- .../validator/parseProposerConfig.test.ts | 3 +- .../validator/src/services/validatorStore.ts | 4 ++- 7 files changed, 79 insertions(+), 8 deletions(-) diff --git a/packages/api/src/keymanager/index.ts b/packages/api/src/keymanager/index.ts index 1ffcaef897eb..44252acce494 100644 --- a/packages/api/src/keymanager/index.ts +++ b/packages/api/src/keymanager/index.ts @@ -18,6 +18,7 @@ export type { GraffitiData, GasLimitData, BuilderBoostFactorData, + ProposerConfigResponse, } from "./routes.js"; export type {ApiClient}; diff --git a/packages/api/src/keymanager/routes.ts b/packages/api/src/keymanager/routes.ts index 0db096d14e83..c31ae5a04454 100644 --- a/packages/api/src/keymanager/routes.ts +++ b/packages/api/src/keymanager/routes.ts @@ -109,6 +109,17 @@ export type SignerDefinition = { export type RemoteSignerDefinition = Pick; +export type ProposerConfigResponse = { + graffiti?: string; + strictFeeRecipientCheck?: boolean; + feeRecipient?: string; + builder?: { + gasLimit?: number; + selection?: string; + boostFactor?: string; + }; +}; + /** * JSON serialized representation of a single keystore in EIP-2335: BLS12-381 Keystore format. * ``` @@ -356,6 +367,15 @@ export type Endpoints = { EmptyMeta >; + getProposerConfig: Endpoint< + // ⏎ + "GET", + {pubkey: PubkeyHex}, + {params: {pubkey: string}}, + ProposerConfigResponse, + EmptyMeta + >; + /** * Create a signed voluntary exit message for an active validator, identified by a public key known to the validator * client. This endpoint returns a `SignedVoluntaryExit` object, which can be used to initiate voluntary exit via the @@ -635,6 +655,19 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions ({params: {pubkey}}), + parseReq: ({params: {pubkey}}) => ({pubkey}), + schema: { + params: {pubkey: Schema.StringRequired}, + }, + }, + resp: JsonOnlyResponseCodec, + }, + signVoluntaryExit: { url: "/eth/v1/validator/{pubkey}/voluntary_exit", method: "POST", diff --git a/packages/api/test/unit/keymanager/testData.ts b/packages/api/test/unit/keymanager/testData.ts index bd37798c4685..6b17611d1e0b 100644 --- a/packages/api/test/unit/keymanager/testData.ts +++ b/packages/api/test/unit/keymanager/testData.ts @@ -112,4 +112,19 @@ export const testData: GenericServerTestCases = { args: {pubkey: pubkeyRand}, res: undefined, }, + getProposerConfig: { + args: {pubkey: pubkeyRand}, + res: { + data: { + graffiti: graffitiRandUtf8, + strictFeeRecipientCheck: false, + feeRecipient: ethaddressRand, + builder: { + gasLimit: gasLimitRand, + selection: "maxprofit", + boostFactor: builderBoostFactorRand.toString(), + }, + }, + }, + }, }; diff --git a/packages/cli/src/cmds/validator/keymanager/impl.ts b/packages/cli/src/cmds/validator/keymanager/impl.ts index b4233f3162cd..545f2f74f06e 100644 --- a/packages/cli/src/cmds/validator/keymanager/impl.ts +++ b/packages/cli/src/cmds/validator/keymanager/impl.ts @@ -15,6 +15,7 @@ import { GraffitiData, GasLimitData, BuilderBoostFactorData, + ProposerConfigResponse, } from "@lodestar/api/keymanager"; import {KeymanagerApiMethods as Api} from "@lodestar/api/keymanager/server"; import {Interchange, SignerType, Validator} from "@lodestar/validator"; @@ -364,6 +365,23 @@ export class KeymanagerApi implements Api { return {status: 204}; } + async getProposerConfig({pubkey}: {pubkey: PubkeyHex}): ReturnType { + const config = this.validator.validatorStore.getProposerConfig(pubkey); + + const data: ProposerConfigResponse = { + ...config, + builder: config?.builder + ? { + ...config.builder, + // Default JSON serialization can't handle BigInt + boostFactor: config.builder.boostFactor ? config.builder.boostFactor.toString() : undefined, + } + : undefined, + }; + + return {data}; + } + async signVoluntaryExit({pubkey, epoch}: {pubkey: PubkeyHex; epoch?: Epoch}): ReturnType { if (!isValidatePubkeyHex(pubkey)) { throw new ApiError(400, `Invalid pubkey ${pubkey}`); diff --git a/packages/cli/src/util/proposerConfig.ts b/packages/cli/src/util/proposerConfig.ts index 2c12ce8f8524..4cfa6fa71075 100644 --- a/packages/cli/src/util/proposerConfig.ts +++ b/packages/cli/src/util/proposerConfig.ts @@ -88,11 +88,14 @@ function parseProposerConfigSection( overrideConfig?.strictFeeRecipientCheck ?? (strict_fee_recipient_check ? stringtoBool(strict_fee_recipient_check) : undefined), feeRecipient: overrideConfig?.feeRecipient ?? (fee_recipient ? parseFeeRecipient(fee_recipient) : undefined), - builder: { - gasLimit: overrideConfig?.builder?.gasLimit ?? (gas_limit !== undefined ? Number(gas_limit) : undefined), - selection: overrideConfig?.builder?.selection ?? parseBuilderSelection(builderSelection), - boostFactor: overrideConfig?.builder?.boostFactor ?? parseBuilderBoostFactor(boost_factor), - }, + builder: + overrideConfig?.builder || builder + ? { + gasLimit: overrideConfig?.builder?.gasLimit ?? (gas_limit !== undefined ? Number(gas_limit) : undefined), + selection: overrideConfig?.builder?.selection ?? parseBuilderSelection(builderSelection), + boostFactor: overrideConfig?.builder?.boostFactor ?? parseBuilderBoostFactor(boost_factor), + } + : undefined, }; } diff --git a/packages/cli/test/unit/validator/parseProposerConfig.test.ts b/packages/cli/test/unit/validator/parseProposerConfig.test.ts index 83c8c63ef877..40fa57f7feb5 100644 --- a/packages/cli/test/unit/validator/parseProposerConfig.test.ts +++ b/packages/cli/test/unit/validator/parseProposerConfig.test.ts @@ -26,8 +26,7 @@ const testValue = { builder: { gasLimit: 35000000, selection: routes.validator.BuilderSelection.BuilderAlways, - // biome-ignore lint/correctness/noPrecisionLoss: - boostFactor: BigInt(18446744073709551616), + boostFactor: 18446744073709551616n, }, }, }, diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index dfd856b18d13..f959b4e74ff5 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -377,7 +377,9 @@ export class ValidatorStore { graffiti !== undefined || strictFeeRecipientCheck !== undefined || feeRecipient !== undefined || - builder?.gasLimit !== undefined + builder?.gasLimit !== undefined || + builder?.selection !== undefined || + builder?.boostFactor !== undefined ) { proposerConfig = {graffiti, strictFeeRecipientCheck, feeRecipient, builder}; } From 794e5ef488d3d86abb1bb280581b2ea752154314 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 1 Nov 2024 00:19:35 +0000 Subject: [PATCH 02/48] feat: add mekong network option (#7212) --- packages/cli/src/networks/index.ts | 6 +- packages/cli/src/networks/mekong.ts | 130 ++++++++++++++++++ .../config/src/chainConfig/networks/mekong.ts | 44 ++++++ packages/config/src/networks.ts | 9 +- 4 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 packages/cli/src/networks/mekong.ts create mode 100644 packages/config/src/chainConfig/networks/mekong.ts diff --git a/packages/cli/src/networks/index.ts b/packages/cli/src/networks/index.ts index e2fc9dd621b6..13e55685e353 100644 --- a/packages/cli/src/networks/index.ts +++ b/packages/cli/src/networks/index.ts @@ -22,8 +22,9 @@ import * as sepolia from "./sepolia.js"; import * as holesky from "./holesky.js"; import * as chiado from "./chiado.js"; import * as ephemery from "./ephemery.js"; +import * as mekong from "./mekong.js"; -export type NetworkName = "mainnet" | "dev" | "gnosis" | "sepolia" | "holesky" | "chiado" | "ephemery"; +export type NetworkName = "mainnet" | "dev" | "gnosis" | "sepolia" | "holesky" | "chiado" | "ephemery" | "mekong"; export const networkNames: NetworkName[] = [ "mainnet", "gnosis", @@ -31,6 +32,7 @@ export const networkNames: NetworkName[] = [ "holesky", "chiado", "ephemery", + "mekong", // Leave always as last network. The order matters for the --help printout "dev", @@ -70,6 +72,8 @@ export function getNetworkData(network: NetworkName): { return chiado; case "ephemery": return ephemery; + case "mekong": + return mekong; default: throw Error(`Network not supported: ${network}`); } diff --git a/packages/cli/src/networks/mekong.ts b/packages/cli/src/networks/mekong.ts new file mode 100644 index 000000000000..44b45cd8d7ea --- /dev/null +++ b/packages/cli/src/networks/mekong.ts @@ -0,0 +1,130 @@ +export {mekongChainConfig as chainConfig} from "@lodestar/config/networks"; + +export const depositContractDeployBlock = 0; +export const genesisFileUrl = + "https://raw.githubusercontent.com/ethpandaops/mekong-devnets/master/network-configs/devnet-0/metadata/genesis.ssz"; +export const bootnodesFileUrl = + "https://raw.githubusercontent.com/ethpandaops/mekong-devnets/master/network-configs/devnet-0/metadata/bootstrap_nodes.txt"; + +export const bootEnrs = [ + "enr:-Iq4QNDvMuJuQDFx0NERRjcJzjUlpv-MG5ea22uVCNtFbBAbYdQXcL2ylwiZYKVR4ARyHL-ZIFQ45J3UdM3bCVPzTIaGAZLeJx23gmlkgnY0gmlwhJ3m4Z6Jc2VjcDI1NmsxoQJJ3h8aUO3GJHv-bdvHtsQZ2OEisutelYfGjXO4lSg8BYN1ZHCCIzI", + "enr:-LK4QNmKwqyvCkLGM2MC8dnIE5Mg_j3PvEztzwAbRT2rwa97RCjVvEApmk6E6Tcrfae-jicCz646GX0B46Ksgfk9jY4Eh2F0dG5ldHOIYAAAAAAAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJ3m4Z6Jc2VjcDI1NmsxoQPrLuUBjXUN4pFbO9NX5UmF0TXzRLFxKQYshOmGXadK34N0Y3CCIyiDdWRwgiMo", + "enr:-Mm4QMycpeBzbXonM4_D6rG4OlCj3IiomsrKTAo5Lt4WiNR_UjHbqqzWDL4cU_DiRciLGtYZ7FplIBPo3Cc5sokaStUBh2F0dG5ldHOIAAAAAAAAAACDY3NjBIRldGgykNjdQwZgY3Y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O9ChPzEarhfhvTGO677MEh2F0dG5ldHOIAAAAAADAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJ3m4YuJc2VjcDI1NmsxoQKdiOidyLx2IMQyrI-L-a169keDHUmAjMZ3_8vurIiHF4N0Y3CCIyiDdWRwgiMo", + "enr:-LK4QM8rHJc9l75ns1i9tuZyux2m9CtFi7zh9Rjh6t38OhCGTLE_Nq8ZMyg0oy5ktpkIoIp6v5T2DVrmx_P6iDbtHrwEh2F0dG5ldHOIADAAAAAAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJgq582Jc2VjcDI1NmsxoQMXBD2dqEKFbP0hIM624HswH20R-LlZIQIuTsB9nIygh4N0Y3CCIyiDdWRwgiMo", +]; diff --git a/packages/config/src/chainConfig/networks/mekong.ts b/packages/config/src/chainConfig/networks/mekong.ts new file mode 100644 index 000000000000..d7f2d15cb525 --- /dev/null +++ b/packages/config/src/chainConfig/networks/mekong.ts @@ -0,0 +1,44 @@ +import {fromHex as b} from "@lodestar/utils"; +import {ChainConfig} from "../types.js"; +import {chainConfig as mainnet} from "../configs/mainnet.js"; + +// Mekong beacon chain config: +// https://github.com/ethpandaops/mekong-devnets/blob/master/network-configs/devnet-0/metadata/config.yaml + +export const mekongChainConfig: ChainConfig = { + ...mainnet, + + CONFIG_NAME: "mekong", + + // Genesis + // --------------------------------------------------------------- + MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 100000, + MIN_GENESIS_TIME: 1730372340, + GENESIS_FORK_VERSION: b("0x10000000"), + GENESIS_DELAY: 60, + + // Forking + // --------------------------------------------------------------- + // # Altair + ALTAIR_FORK_VERSION: b("0x20000000"), + ALTAIR_FORK_EPOCH: 0, + // # Merge + BELLATRIX_FORK_VERSION: b("0x30000000"), + BELLATRIX_FORK_EPOCH: 0, + TERMINAL_TOTAL_DIFFICULTY: BigInt("0"), + // Capella + CAPELLA_FORK_VERSION: b("0x40000000"), + CAPELLA_FORK_EPOCH: 0, + // Deneb + DENEB_FORK_VERSION: b("0x50637624"), + DENEB_FORK_EPOCH: 0, + // Electra + ELECTRA_FORK_VERSION: b("0x60637624"), + ELECTRA_FORK_EPOCH: 256, + + // Deposit contract + // --------------------------------------------------------------- + DEPOSIT_CHAIN_ID: 7078815900, + DEPOSIT_NETWORK_ID: 7078815900, + DEPOSIT_CONTRACT_ADDRESS: b("0x4242424242424242424242424242424242424242"), +}; diff --git a/packages/config/src/networks.ts b/packages/config/src/networks.ts index 819c02b995b0..df39ae15d09e 100644 --- a/packages/config/src/networks.ts +++ b/packages/config/src/networks.ts @@ -5,6 +5,7 @@ import {sepoliaChainConfig} from "./chainConfig/networks/sepolia.js"; import {holeskyChainConfig} from "./chainConfig/networks/holesky.js"; import {chiadoChainConfig} from "./chainConfig/networks/chiado.js"; import {ephemeryChainConfig} from "./chainConfig/networks/ephemery.js"; +import {mekongChainConfig} from "./chainConfig/networks/mekong.js"; export { mainnetChainConfig, @@ -13,9 +14,10 @@ export { holeskyChainConfig, chiadoChainConfig, ephemeryChainConfig, + mekongChainConfig, }; -export type NetworkName = "mainnet" | "gnosis" | "sepolia" | "holesky" | "chiado" | "ephemery"; +export type NetworkName = "mainnet" | "gnosis" | "sepolia" | "holesky" | "chiado" | "ephemery" | "mekong"; export const networksChainConfig: Record = { mainnet: mainnetChainConfig, gnosis: gnosisChainConfig, @@ -23,6 +25,7 @@ export const networksChainConfig: Record = { holesky: holeskyChainConfig, chiado: chiadoChainConfig, ephemery: ephemeryChainConfig, + mekong: mekongChainConfig, }; export type GenesisData = { @@ -55,4 +58,8 @@ export const genesisData: Record = { genesisTime: ephemeryChainConfig.MIN_GENESIS_TIME + ephemeryChainConfig.GENESIS_DELAY, genesisValidatorsRoot: "0x0000000000000000000000000000000000000000000000000000000000000000", }, + mekong: { + genesisTime: 1730372340, + genesisValidatorsRoot: "0x9838240bca889c52818d7502179b393a828f61f15119d9027827c36caeb67db7", + }, }; From 06b4c2d3241752b676f1673a62cd2a695761c806 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Fri, 1 Nov 2024 17:14:21 +0100 Subject: [PATCH 03/48] chore: fix import order with biome syntax (#7211) Fix import order --- biome.jsonc | 5 +- packages/api/src/beacon/client/debug.ts | 2 +- .../api/src/beacon/routes/beacon/block.ts | 18 +-- .../api/src/beacon/routes/beacon/index.ts | 4 +- packages/api/src/beacon/routes/beacon/pool.ts | 8 +- .../api/src/beacon/routes/beacon/rewards.ts | 4 +- .../api/src/beacon/routes/beacon/state.ts | 4 +- packages/api/src/beacon/routes/config.ts | 2 +- packages/api/src/beacon/routes/debug.ts | 6 +- packages/api/src/beacon/routes/events.ts | 24 ++-- packages/api/src/beacon/routes/lightclient.ts | 16 +-- packages/api/src/beacon/routes/lodestar.ts | 4 +- packages/api/src/beacon/routes/node.ts | 4 +- packages/api/src/beacon/routes/proof.ts | 4 +- packages/api/src/beacon/routes/validator.ts | 24 ++-- packages/api/src/beacon/server/events.ts | 2 +- packages/api/src/beacon/server/index.ts | 2 +- packages/api/src/builder/index.ts | 2 +- packages/api/src/builder/routes.ts | 18 +-- packages/api/src/builder/server/index.ts | 4 +- packages/api/src/keymanager/index.ts | 2 +- packages/api/src/keymanager/routes.ts | 6 +- packages/api/src/keymanager/server/index.ts | 4 +- packages/api/src/utils/client/httpClient.ts | 6 +- packages/api/src/utils/codecs.ts | 4 +- packages/api/src/utils/metadata.ts | 4 +- packages/api/src/utils/server/handler.ts | 4 +- packages/api/src/utils/server/route.ts | 2 +- .../beacon/genericServerTest/beacon.test.ts | 4 +- .../beacon/genericServerTest/config.test.ts | 4 +- .../beacon/genericServerTest/debug.test.ts | 16 +-- .../beacon/genericServerTest/events.test.ts | 8 +- .../genericServerTest/lightclient.test.ts | 4 +- .../beacon/genericServerTest/node.test.ts | 4 +- .../beacon/genericServerTest/proofs.test.ts | 4 +- .../genericServerTest/validator.test.ts | 4 +- .../api/test/unit/beacon/oapiSpec.test.ts | 4 +- .../api/test/unit/beacon/testData/config.ts | 2 +- .../api/test/unit/beacon/testData/events.ts | 2 +- .../test/unit/beacon/testData/lightclient.ts | 2 +- .../test/unit/beacon/testData/validator.ts | 2 +- .../api/test/unit/builder/builder.test.ts | 4 +- .../api/test/unit/builder/oapiSpec.test.ts | 2 +- packages/api/test/unit/builder/testData.ts | 2 +- packages/api/test/unit/client/fetch.test.ts | 2 +- .../api/test/unit/client/httpClient.test.ts | 18 +-- .../unit/client/httpClientOptions.test.ts | 2 +- .../api/test/unit/client/urlFormat.test.ts | 6 +- .../test/unit/keymanager/keymanager.test.ts | 4 +- .../api/test/unit/keymanager/oapiSpec.test.ts | 2 +- packages/api/test/unit/utils/headers.test.ts | 2 +- packages/api/test/unit/utils/serdes.test.ts | 2 +- packages/api/test/utils/checkAgainstSpec.ts | 6 +- packages/api/test/utils/genericServerTest.ts | 8 +- packages/api/test/utils/utils.ts | 6 +- packages/beacon-node/src/api/impl/api.ts | 2 +- .../src/api/impl/beacon/blocks/index.ts | 28 ++--- .../src/api/impl/beacon/blocks/utils.ts | 8 +- .../beacon-node/src/api/impl/beacon/index.ts | 2 +- .../src/api/impl/beacon/pool/index.ts | 16 +-- .../src/api/impl/beacon/state/index.ts | 4 +- .../src/api/impl/beacon/state/utils.ts | 4 +- .../src/api/impl/config/constants.ts | 58 ++++----- .../beacon-node/src/api/impl/config/index.ts | 2 +- .../beacon-node/src/api/impl/debug/index.ts | 6 +- .../src/api/impl/lightclient/index.ts | 6 +- .../src/api/impl/lodestar/index.ts | 10 +- .../beacon-node/src/api/impl/node/index.ts | 2 +- .../beacon-node/src/api/impl/proof/index.ts | 8 +- packages/beacon-node/src/api/impl/types.ts | 4 +- .../src/api/impl/validator/index.ts | 84 ++++++------- .../src/api/impl/validator/utils.ts | 4 +- packages/beacon-node/src/api/options.ts | 2 +- packages/beacon-node/src/api/rest/base.ts | 6 +- packages/beacon-node/src/api/rest/index.ts | 4 +- .../src/chain/archiver/archiveBlocks.ts | 8 +- .../src/chain/archiver/archiver.ts | 10 +- .../src/chain/archiver/interface.ts | 2 +- .../frequencyStateArchiveStrategy.ts | 12 +- .../beacon-node/src/chain/balancesCache.ts | 4 +- .../src/chain/beaconProposerCache.ts | 2 +- .../src/chain/blocks/importBlock.ts | 20 ++-- .../beacon-node/src/chain/blocks/index.ts | 10 +- .../beacon-node/src/chain/blocks/types.ts | 8 +- .../src/chain/blocks/utils/checkpoint.ts | 2 +- .../src/chain/blocks/verifyBlock.ts | 22 ++-- .../blocks/verifyBlocksDataAvailability.ts | 10 +- .../blocks/verifyBlocksExecutionPayloads.ts | 38 +++--- .../chain/blocks/verifyBlocksSanityChecks.ts | 2 +- .../chain/blocks/verifyBlocksSignatures.ts | 4 +- .../blocks/verifyBlocksStateTransitionOnly.ts | 8 +- .../src/chain/bls/multithread/index.ts | 18 +-- .../src/chain/bls/multithread/jobItem.ts | 4 +- .../src/chain/bls/multithread/worker.ts | 6 +- packages/beacon-node/src/chain/chain.ts | 112 +++++++++--------- packages/beacon-node/src/chain/emitter.ts | 2 +- .../src/chain/errors/attestationError.ts | 2 +- .../src/chain/errors/blobSidecarError.ts | 2 +- .../src/chain/errors/blockError.ts | 2 +- .../src/chain/errors/syncCommitteeError.ts | 2 +- .../beacon-node/src/chain/forkChoice/index.ts | 12 +- .../beacon-node/src/chain/genesis/genesis.ts | 20 ++-- .../src/chain/genesis/interface.ts | 2 +- .../historicalState/getHistoricalState.ts | 2 +- .../src/chain/historicalState/index.ts | 2 +- .../src/chain/historicalState/worker.ts | 10 +- packages/beacon-node/src/chain/initState.ts | 6 +- packages/beacon-node/src/chain/interface.ts | 78 ++++++------ .../src/chain/lightClient/index.ts | 68 +++++------ .../src/chain/lightClient/proofs.ts | 6 +- .../opPools/aggregatedAttestationPool.ts | 38 +++--- .../src/chain/opPools/attestationPool.ts | 8 +- .../beacon-node/src/chain/opPools/opPool.ts | 24 ++-- .../chain/opPools/syncCommitteeMessagePool.ts | 4 +- .../opPools/syncContributionAndProofPool.ts | 4 +- packages/beacon-node/src/chain/options.ts | 2 +- .../beacon-node/src/chain/prepareNextSlot.ts | 20 ++-- .../chain/produceBlock/produceBlockBody.ts | 56 ++++----- .../beacon-node/src/chain/regen/errors.ts | 2 +- .../beacon-node/src/chain/regen/interface.ts | 4 +- .../beacon-node/src/chain/regen/queued.ts | 10 +- packages/beacon-node/src/chain/regen/regen.ts | 22 ++-- packages/beacon-node/src/chain/reprocess.ts | 2 +- .../src/chain/rewards/attestationsRewards.ts | 6 +- .../src/chain/rewards/blockRewards.ts | 4 +- .../src/chain/rewards/syncCommitteeRewards.ts | 4 +- .../chain/seenCache/seenAttestationData.ts | 2 +- .../src/chain/seenCache/seenCommittee.ts | 2 +- .../chain/seenCache/seenGossipBlockInput.ts | 14 +-- .../chain/stateCache/blockStateCacheImpl.ts | 4 +- .../chain/stateCache/fifoBlockStateCache.ts | 4 +- .../stateCache/inMemoryCheckpointsCache.ts | 6 +- .../stateCache/persistentCheckpointsCache.ts | 16 +-- .../beacon-node/src/chain/stateCache/types.ts | 2 +- .../src/chain/validation/aggregateAndProof.ts | 8 +- .../src/chain/validation/attestation.ts | 52 ++++---- .../src/chain/validation/attesterSlashing.ts | 6 +- .../src/chain/validation/blobSidecar.ts | 12 +- .../beacon-node/src/chain/validation/block.ts | 10 +- .../chain/validation/blsToExecutionChange.ts | 8 +- .../validation/lightClientFinalityUpdate.ts | 6 +- .../validation/lightClientOptimisticUpdate.ts | 6 +- .../src/chain/validation/proposerSlashing.ts | 4 +- .../signatureSets/aggregateAndProof.ts | 8 +- .../signatureSets/contributionAndProof.ts | 4 +- .../signatureSets/selectionProof.ts | 6 +- .../validation/signatureSets/syncCommittee.ts | 4 +- .../syncCommitteeContribution.ts | 4 +- .../syncCommitteeSelectionProof.ts | 4 +- .../src/chain/validation/syncCommittee.ts | 2 +- .../syncCommitteeContributionAndProof.ts | 8 +- .../src/chain/validation/voluntaryExit.ts | 4 +- packages/beacon-node/src/db/beacon.ts | 20 ++-- packages/beacon-node/src/db/interface.ts | 18 +-- .../src/db/repositories/attesterSlashing.ts | 2 +- .../src/db/repositories/backfilledRanges.ts | 2 +- .../src/db/repositories/blobSidecars.ts | 2 +- .../db/repositories/blobSidecarsArchive.ts | 2 +- .../src/db/repositories/blockArchive.ts | 8 +- .../src/db/repositories/blockArchiveIndex.ts | 4 +- .../db/repositories/blsToExecutionChange.ts | 2 +- .../src/db/repositories/depositDataRoot.ts | 4 +- .../src/db/repositories/depositEvent.ts | 2 +- .../src/db/repositories/eth1Data.ts | 4 +- .../db/repositories/lightclientBestUpdate.ts | 2 +- .../lightclientCheckpointHeader.ts | 2 +- .../src/db/repositories/proposerSlashing.ts | 2 +- .../src/db/repositories/stateArchive.ts | 4 +- .../src/db/repositories/stateArchiveIndex.ts | 2 +- .../src/db/repositories/voluntaryExit.ts | 2 +- .../src/db/single/preGenesisState.ts | 2 +- .../preGenesisStateLastProcessedBlock.ts | 2 +- .../src/eth1/eth1DepositDataTracker.ts | 12 +- .../beacon-node/src/eth1/eth1DepositsCache.ts | 10 +- .../src/eth1/eth1MergeBlockTracker.ts | 6 +- packages/beacon-node/src/eth1/index.ts | 2 +- packages/beacon-node/src/eth1/interface.ts | 2 +- .../src/eth1/provider/eth1Provider.ts | 14 +-- .../src/eth1/provider/jsonRpcHttpClient.ts | 2 +- .../beacon-node/src/eth1/provider/utils.ts | 2 +- packages/beacon-node/src/eth1/stream.ts | 6 +- .../beacon-node/src/eth1/utils/deposits.ts | 10 +- .../beacon-node/src/eth1/utils/eth1Data.ts | 2 +- .../beacon-node/src/eth1/utils/eth1Vote.ts | 4 +- .../beacon-node/src/execution/builder/http.ts | 26 ++-- .../src/execution/builder/interface.ts | 16 +-- .../beacon-node/src/execution/engine/http.ts | 30 ++--- .../beacon-node/src/execution/engine/index.ts | 6 +- .../src/execution/engine/interface.ts | 6 +- .../beacon-node/src/execution/engine/mock.ts | 22 ++-- .../src/execution/engine/payloadIdCache.ts | 2 +- .../beacon-node/src/execution/engine/types.ts | 14 +-- .../beacon-node/src/execution/engine/utils.ts | 6 +- packages/beacon-node/src/metrics/metrics.ts | 14 +-- .../beacon-node/src/metrics/metrics/beacon.ts | 8 +- .../src/metrics/metrics/lodestar.ts | 6 +- .../beacon-node/src/metrics/nodeJsMetrics.ts | 2 +- .../beacon-node/src/metrics/server/http.ts | 4 +- .../src/metrics/utils/avgMinMax.ts | 2 +- .../beacon-node/src/metrics/utils/gauge.ts | 2 +- .../metrics/utils/registryMetricCreator.ts | 2 +- .../src/metrics/validatorMonitor.ts | 14 +-- .../beacon-node/src/monitoring/service.ts | 6 +- packages/beacon-node/src/monitoring/system.ts | 2 +- .../src/network/core/networkCore.ts | 46 +++---- .../src/network/core/networkCoreWorker.ts | 8 +- .../beacon-node/src/network/core/types.ts | 4 +- .../beacon-node/src/network/discv5/index.ts | 8 +- .../beacon-node/src/network/discv5/worker.ts | 16 +-- packages/beacon-node/src/network/events.ts | 6 +- packages/beacon-node/src/network/forks.ts | 2 +- .../src/network/gossip/encoding.ts | 10 +- .../src/network/gossip/gossipsub.ts | 24 ++-- .../src/network/gossip/interface.ts | 22 ++-- .../src/network/gossip/scoringParameters.ts | 6 +- .../beacon-node/src/network/gossip/topic.ts | 6 +- packages/beacon-node/src/network/interface.ts | 22 ++-- .../beacon-node/src/network/libp2p/index.ts | 12 +- packages/beacon-node/src/network/metadata.ts | 4 +- packages/beacon-node/src/network/network.ts | 52 ++++---- packages/beacon-node/src/network/options.ts | 2 +- .../src/network/peers/datastore.ts | 2 +- .../beacon-node/src/network/peers/discover.ts | 14 +-- .../src/network/peers/peerManager.ts | 30 ++--- .../src/network/peers/peersData.ts | 2 +- .../peers/utils/enrSubnetsDeserialize.ts | 2 +- .../network/peers/utils/prioritizePeers.ts | 4 +- .../network/processor/extractSlotRootFns.ts | 2 +- .../src/network/processor/gossipHandlers.ts | 60 +++++----- .../network/processor/gossipQueues/index.ts | 4 +- .../network/processor/gossipQueues/linear.ts | 2 +- .../network/processor/gossipValidatorFn.ts | 10 +- .../src/network/processor/index.ts | 18 +-- .../src/network/processor/types.ts | 2 +- .../src/network/reqresp/ReqRespBeaconNode.ts | 8 +- .../reqresp/beaconBlocksMaybeBlobsByRange.ts | 4 +- .../reqresp/beaconBlocksMaybeBlobsByRoot.ts | 14 +-- .../reqresp/handlers/beaconBlocksByRange.ts | 2 +- .../reqresp/handlers/blobSidecarsByRange.ts | 6 +- .../reqresp/handlers/blobSidecarsByRoot.ts | 4 +- .../src/network/reqresp/handlers/index.ts | 4 +- .../reqresp/handlers/lightClientBootstrap.ts | 6 +- .../handlers/lightClientFinalityUpdate.ts | 4 +- .../handlers/lightClientOptimisticUpdate.ts | 4 +- .../handlers/lightClientUpdatesByRange.ts | 8 +- .../src/network/reqresp/handlers/status.ts | 2 +- .../src/network/reqresp/protocols.ts | 4 +- .../src/network/reqresp/rateLimit.ts | 4 +- .../src/network/reqresp/utils/collect.ts | 2 +- .../utils/collectSequentialBlocksInRange.ts | 2 +- .../src/network/subnets/attnetsService.ts | 14 +-- .../src/network/subnets/interface.ts | 2 +- .../src/network/subnets/syncnetsService.ts | 4 +- packages/beacon-node/src/node/nodejs.ts | 26 ++-- packages/beacon-node/src/node/notifier.ts | 10 +- packages/beacon-node/src/node/options.ts | 24 ++-- .../src/node/utils/interop/deposits.ts | 8 +- .../src/node/utils/interop/state.ts | 4 +- packages/beacon-node/src/node/utils/state.ts | 2 +- .../beacon-node/src/sync/backfill/backfill.ts | 12 +- .../beacon-node/src/sync/backfill/errors.ts | 2 +- .../beacon-node/src/sync/backfill/verify.ts | 4 +- packages/beacon-node/src/sync/interface.ts | 10 +- packages/beacon-node/src/sync/range/batch.ts | 6 +- packages/beacon-node/src/sync/range/chain.ts | 16 +-- packages/beacon-node/src/sync/range/range.ts | 14 +-- .../src/sync/range/utils/hashBlocks.ts | 2 +- packages/beacon-node/src/sync/sync.ts | 18 +-- packages/beacon-node/src/sync/unknownBlock.ts | 18 +-- .../src/sync/utils/pendingBlocksTree.ts | 2 +- .../src/sync/utils/remoteSyncType.ts | 2 +- packages/beacon-node/src/util/blobs.ts | 4 +- packages/beacon-node/src/util/clock.ts | 6 +- packages/beacon-node/src/util/kzg.ts | 2 +- packages/beacon-node/src/util/multifork.ts | 2 +- packages/beacon-node/src/util/peerId.ts | 2 +- .../beacon-node/src/util/queue/fnQueue.ts | 2 +- .../beacon-node/src/util/queue/itemQueue.ts | 4 +- packages/beacon-node/src/util/sszBytes.ts | 2 +- .../api/impl/beacon/block/endpoint.test.ts | 10 +- .../api/impl/beacon/node/endpoints.test.ts | 8 +- .../api/impl/beacon/state/endpoint.test.ts | 8 +- .../test/e2e/api/impl/config.test.ts | 6 +- .../e2e/api/impl/lightclient/endpoint.test.ts | 16 +-- .../test/e2e/api/lodestar/lodestar.test.ts | 16 +-- .../test/e2e/chain/bls/multithread.test.ts | 4 +- .../test/e2e/chain/lightclient.test.ts | 16 +-- .../test/e2e/chain/proposerBoostReorg.test.ts | 14 +-- .../stateCache/nHistoricalStates.test.ts | 18 +-- .../beacon/repositories/blockArchive.test.ts | 2 +- .../e2e/doppelganger/doppelganger.test.ts | 12 +- .../e2e/eth1/eth1ForBlockProduction.test.ts | 12 +- .../e2e/eth1/eth1MergeBlockTracker.test.ts | 8 +- .../test/e2e/eth1/eth1Provider.test.ts | 8 +- .../test/e2e/eth1/jsonRpcHttpClient.test.ts | 4 +- .../beacon-node/test/e2e/eth1/stream.test.ts | 8 +- .../test/e2e/interop/genesisState.test.ts | 4 +- .../test/e2e/network/gossipsub.test.ts | 8 +- .../beacon-node/test/e2e/network/mdns.test.ts | 18 +-- .../test/e2e/network/network.test.ts | 4 +- .../onWorker/dataSerialization.test.ts | 28 ++--- .../e2e/network/onWorker/workerEchoHandler.ts | 2 +- .../e2e/network/peers/peerManager.test.ts | 24 ++-- .../test/e2e/network/reqresp.test.ts | 12 +- .../test/e2e/network/reqrespEncode.test.ts | 20 ++-- .../test/e2e/sync/finalizedSync.test.ts | 18 +-- .../test/e2e/sync/unknownBlockSync.test.ts | 20 ++-- packages/beacon-node/test/globalSetup.ts | 2 +- .../test/memory/unfinalizedPubkey2Index.ts | 4 +- packages/beacon-node/test/mocks/clock.ts | 2 +- packages/beacon-node/test/mocks/loggerMock.ts | 2 +- .../test/mocks/mockedBeaconChain.ts | 20 ++-- .../beacon-node/test/mocks/mockedBeaconDb.ts | 12 +- .../beacon-node/test/mocks/mockedNetwork.ts | 4 +- packages/beacon-node/test/mocks/regenMocks.ts | 2 +- .../beacon-node/test/mocks/shufflingMock.ts | 2 +- .../beacon-node/test/perf/bls/bls.test.ts | 2 +- .../opPools/aggregatedAttestationPool.test.ts | 6 +- .../test/perf/chain/opPools/opPool.test.ts | 2 +- .../produceBlock/produceBlockBody.test.ts | 4 +- .../seenCache/seenAggregateAndProof.test.ts | 2 +- .../inMemoryCheckpointsCache.test.ts | 4 +- .../updateUnfinalizedPubkeys.test.ts | 10 +- .../perf/chain/validation/attestation.test.ts | 4 +- .../perf/chain/verifyImportBlocks.test.ts | 12 +- .../test/perf/eth1/pickEth1Vote.test.ts | 4 +- .../test/perf/misc/bytesHex.test.ts | 2 +- .../perf/network/gossip/fastMsgIdFn.test.ts | 4 +- .../test/perf/network/noise/sendData.test.ts | 8 +- .../peers/enrSubnetsDeserialize.test.ts | 4 +- .../peers/util/prioritizePeers.test.ts | 2 +- .../test/perf/util/bitArray.test.ts | 2 +- packages/beacon-node/test/setupPreset.ts | 2 +- .../test/sim/electra-interop.test.ts | 24 ++-- .../beacon-node/test/sim/mergemock.test.ts | 18 +-- packages/beacon-node/test/spec/bls/bls.ts | 2 +- .../beacon-node/test/spec/bls/index.test.ts | 2 +- .../beacon-node/test/spec/downloadTests.ts | 2 +- packages/beacon-node/test/spec/general/bls.ts | 8 +- .../test/spec/general/index.test.ts | 4 +- .../test/spec/general/ssz_generic.ts | 4 +- .../test/spec/general/ssz_generic_types.ts | 10 +- .../spec/presets/epoch_processing.test.ts | 12 +- .../test/spec/presets/finality.test.ts | 6 +- .../test/spec/presets/fork.test.ts | 12 +- .../test/spec/presets/fork_choice.test.ts | 56 ++++----- .../test/spec/presets/genesis.test.ts | 12 +- .../light_client/single_merkle_proof.ts | 6 +- .../test/spec/presets/light_client/sync.ts | 12 +- .../presets/light_client/update_ranking.ts | 6 +- .../test/spec/presets/merkle.test.ts | 10 +- .../test/spec/presets/operations.test.ts | 10 +- .../test/spec/presets/rewards.test.ts | 8 +- .../test/spec/presets/sanity.test.ts | 6 +- .../test/spec/presets/shuffling.test.ts | 4 +- .../test/spec/presets/ssz_static.test.ts | 8 +- .../test/spec/presets/transition.test.ts | 10 +- .../test/spec/utils/expectEqualBeaconState.ts | 4 +- .../replaceUintTypeWithUintBigintType.ts | 6 +- .../test/spec/utils/runValidSszTest.ts | 4 +- .../test/spec/utils/specTestIterator.ts | 2 +- .../test/spec/utils/sszTestCaseParser.ts | 6 +- .../network/gossip/scoringParameters.test.ts | 6 +- .../unit-mainnet/network/subnets/util.test.ts | 2 +- .../test/unit/api/impl/beacon/beacon.test.ts | 4 +- .../beacon/blocks/getBlockHeaders.test.ts | 6 +- .../unit/api/impl/beacon/state/utils.test.ts | 2 +- .../test/unit/api/impl/config/config.test.ts | 2 +- .../test/unit/api/impl/events/events.test.ts | 4 +- .../test/unit/api/impl/swaggerUI.test.ts | 2 +- .../impl/validator/duties/proposer.test.ts | 12 +- .../validator/produceAttestationData.test.ts | 6 +- .../api/impl/validator/produceBlockV2.test.ts | 18 +-- .../api/impl/validator/produceBlockV3.test.ts | 12 +- .../unit/api/impl/validator/utils.test.ts | 4 +- .../unit/chain/archive/blockArchiver.test.ts | 12 +- .../unit/chain/archive/nonCheckpoint.test.ts | 2 +- .../unit/chain/archive/stateArchiver.test.ts | 2 +- .../test/unit/chain/beaconProposerCache.ts | 2 +- .../rejectFirstInvalidResolveAllValid.test.ts | 2 +- .../blocks/verifyBlocksSanityChecks.test.ts | 10 +- .../test/unit/chain/bls/bls.test.ts | 4 +- .../test/unit/chain/bls/utils.test.ts | 2 +- .../unit/chain/forkChoice/forkChoice.test.ts | 8 +- .../test/unit/chain/genesis/genesis.test.ts | 10 +- .../test/unit/chain/lightclient/proof.test.ts | 6 +- .../upgradeLightClientHeader.test.ts | 6 +- .../opPools/aggregatedAttestationPool.test.ts | 22 ++-- .../chain/opPools/attestationPool.test.ts | 6 +- .../unit/chain/opPools/syncCommittee.test.ts | 4 +- .../opPools/syncCommitteeContribution.test.ts | 10 +- .../test/unit/chain/prepareNextSlot.test.ts | 12 +- .../test/unit/chain/reprocess.test.ts | 2 +- .../unit/chain/rewards/blockRewards.test.ts | 8 +- .../chain/seenCache/aggregateAndProof.test.ts | 4 +- .../seenCache/seenAttestationData.test.ts | 2 +- .../seenCache/seenGossipBlockInput.test.ts | 4 +- .../chain/seenCache/syncCommittee.test.ts | 4 +- .../test/unit/chain/shufflingCache.test.ts | 2 +- .../stateCache/blockStateCacheImpl.test.ts | 6 +- .../stateCache/fifoBlockStateCache.test.ts | 4 +- .../inMemoryCheckpointsCache.test.ts | 4 +- .../persistentCheckpointsCache.test.ts | 14 +-- .../validation/aggregateAndProof.test.ts | 8 +- ...hufflingForAttestationVerification.test.ts | 8 +- .../attestation/validateAttestation.test.ts | 2 +- ...idateGossipAttestationsSameAttData.test.ts | 2 +- .../chain/validation/attesterSlashing.test.ts | 8 +- .../test/unit/chain/validation/block.test.ts | 4 +- .../validation/blsToExecutionChange.test.ts | 20 ++-- .../lightClientFinalityUpdate.test.ts | 6 +- .../lightClientOptimisticUpdate.test.ts | 6 +- .../chain/validation/proposerSlashing.test.ts | 6 +- .../chain/validation/syncCommittee.test.ts | 12 +- .../chain/validation/voluntaryExit.test.ts | 16 +-- .../db/api/repositories/blockArchive.test.ts | 10 +- .../test/unit/db/api/repository.test.ts | 6 +- .../unit/eth1/eth1DepositDataTracker.test.ts | 8 +- .../unit/eth1/eth1MergeBlockTracker.test.ts | 4 +- .../test/unit/eth1/hexEncoding.test.ts | 8 +- .../beacon-node/test/unit/eth1/jwt.test.ts | 4 +- .../unit/eth1/utils/depositContract.test.ts | 4 +- .../test/unit/eth1/utils/deposits.test.ts | 16 +-- .../test/unit/eth1/utils/eth1Data.test.ts | 14 +-- .../unit/eth1/utils/eth1DepositEvent.test.ts | 2 +- .../test/unit/eth1/utils/eth1Vote.test.ts | 12 +- .../utils/groupDepositEventsByBlock.test.ts | 2 +- .../optimizeNextBlockDiffForGenesis.test.ts | 4 +- .../test/unit/execution/engine/utils.test.ts | 8 +- .../test/unit/executionEngine/http.test.ts | 12 +- .../unit/executionEngine/httpRetry.test.ts | 10 +- .../test/unit/metrics/beacon.test.ts | 2 +- .../test/unit/metrics/metrics.test.ts | 2 +- .../test/unit/metrics/server/http.test.ts | 4 +- .../test/unit/metrics/utils.test.ts | 2 +- .../beacon-node/test/unit/metrics/utils.ts | 2 +- .../test/unit/monitoring/clientStats.test.ts | 4 +- .../test/unit/monitoring/properties.test.ts | 2 +- .../test/unit/monitoring/service.test.ts | 10 +- .../beaconBlocksMaybeBlobsByRange.test.ts | 12 +- .../test/unit/network/fork.test.ts | 6 +- .../test/unit/network/gossip/topic.test.ts | 4 +- .../test/unit/network/metadata.test.ts | 4 +- .../test/unit/network/peers/client.test.ts | 4 +- .../test/unit/network/peers/datastore.test.ts | 2 +- .../test/unit/network/peers/discover.test.ts | 4 +- .../unit/network/peers/priorization.test.ts | 8 +- .../test/unit/network/peers/score.test.ts | 8 +- .../peers/utils/assertPeerRelevance.test.ts | 4 +- .../network/peers/utils/enrSubnets.test.ts | 2 +- .../processor/aggregatorTracker.test.ts | 2 +- .../processor/gossipQueues/indexed.test.ts | 2 +- .../processor/gossipQueues/linear.test.ts | 2 +- .../test/unit/network/processorQueues.test.ts | 2 +- .../collectSequentialBlocksInRange.test.ts | 6 +- .../test/unit/network/reqresp/utils.ts | 6 +- .../network/subnets/attnetsService.test.ts | 8 +- .../test/unit/network/subnets/util.test.ts | 4 +- .../test/unit/network/util.test.ts | 4 +- .../test/unit/sync/backfill/verify.test.ts | 8 +- .../test/unit/sync/range/batch.test.ts | 10 +- .../test/unit/sync/range/chain.test.ts | 14 +-- .../unit/sync/range/utils/batches.test.ts | 8 +- .../sync/range/utils/peerBalancer.test.ts | 2 +- .../sync/range/utils/updateChains.test.ts | 4 +- .../test/unit/sync/unknownBlock.test.ts | 18 +-- .../unit/sync/utils/pendingBlocksTree.test.ts | 2 +- .../unit/sync/utils/remoteSyncType.test.ts | 6 +- .../test/unit/util/address.test.ts | 2 +- .../beacon-node/test/unit/util/array.test.ts | 4 +- .../test/unit/util/binarySearch.test.ts | 4 +- .../test/unit/util/bitArray.test.ts | 2 +- .../test/unit/util/bufferPool.test.ts | 2 +- .../beacon-node/test/unit/util/bytes.test.ts | 2 +- .../test/unit/util/chunkify.test.ts | 2 +- .../beacon-node/test/unit/util/clock.test.ts | 4 +- .../test/unit/util/dependentRoot.test.ts | 4 +- .../beacon-node/test/unit/util/error.test.ts | 2 +- .../beacon-node/test/unit/util/file.test.ts | 2 +- .../test/unit/util/graffiti.test.ts | 4 +- .../test/unit/util/itTrigger.test.ts | 2 +- .../beacon-node/test/unit/util/kzg.test.ts | 12 +- .../beacon-node/test/unit/util/map.test.ts | 2 +- .../test/unit/util/metadata.test.ts | 4 +- .../beacon-node/test/unit/util/peerId.test.ts | 2 +- .../beacon-node/test/unit/util/queue.test.ts | 2 +- .../beacon-node/test/unit/util/set.test.ts | 2 +- .../test/unit/util/shuffle.test.ts | 2 +- .../beacon-node/test/unit/util/sortBy.test.ts | 2 +- .../test/unit/util/sszBytes.test.ts | 18 +-- .../beacon-node/test/unit/util/time.test.ts | 2 +- .../test/unit/util/timeSeries.test.ts | 2 +- .../test/unit/util/wrapError.test.ts | 2 +- packages/beacon-node/test/utils/api.ts | 6 +- .../test/utils/cachedBeaconState.ts | 2 +- .../utils/cliTools/kzgTrustedSetupFromJson.ts | 2 +- packages/beacon-node/test/utils/clock.ts | 2 +- packages/beacon-node/test/utils/config.ts | 2 +- packages/beacon-node/test/utils/db.ts | 2 +- packages/beacon-node/test/utils/errors.ts | 2 +- packages/beacon-node/test/utils/logger.ts | 4 +- .../test/utils/networkWithMockDb.ts | 2 +- .../beacon-node/test/utils/node/beacon.ts | 18 +-- .../beacon-node/test/utils/node/simTest.ts | 14 +-- .../beacon-node/test/utils/node/validator.ts | 12 +- packages/beacon-node/test/utils/peer.ts | 2 +- packages/beacon-node/test/utils/runEl.ts | 6 +- packages/beacon-node/test/utils/state.ts | 14 +-- packages/beacon-node/test/utils/testnet.ts | 4 +- .../beacon-node/test/utils/typeGenerator.ts | 2 +- .../utils/validationData/aggregateAndProof.ts | 4 +- .../test/utils/validationData/attestation.ts | 18 +-- packages/cli/src/applyPreset.ts | 2 +- packages/cli/src/cli.ts | 2 +- packages/cli/src/cmds/beacon/handler.ts | 22 ++-- packages/cli/src/cmds/beacon/index.ts | 2 +- .../cli/src/cmds/beacon/initBeaconState.ts | 28 ++--- .../cli/src/cmds/beacon/initPeerIdAndEnr.ts | 8 +- packages/cli/src/cmds/beacon/options.ts | 4 +- packages/cli/src/cmds/beacon/paths.ts | 2 +- packages/cli/src/cmds/bootnode/handler.ts | 16 +-- packages/cli/src/cmds/bootnode/index.ts | 2 +- packages/cli/src/cmds/bootnode/options.ts | 4 +- packages/cli/src/cmds/dev/files.ts | 4 +- packages/cli/src/cmds/dev/handler.ts | 12 +- packages/cli/src/cmds/dev/index.ts | 2 +- packages/cli/src/cmds/dev/options.ts | 2 +- packages/cli/src/cmds/index.ts | 4 +- packages/cli/src/cmds/lightclient/handler.ts | 2 +- packages/cli/src/cmds/lightclient/index.ts | 2 +- .../cmds/validator/blsToExecutionChange.ts | 10 +- packages/cli/src/cmds/validator/handler.ts | 30 ++--- packages/cli/src/cmds/validator/import.ts | 6 +- packages/cli/src/cmds/validator/index.ts | 10 +- .../keymanager/decryptKeystoreDefinitions.ts | 6 +- .../keymanager/decryptKeystores/threadPool.ts | 4 +- .../keymanager/decryptKeystores/worker.ts | 4 +- .../cli/src/cmds/validator/keymanager/impl.ts | 20 ++-- .../validator/keymanager/keystoreCache.ts | 2 +- .../validator/keymanager/persistedKeys.ts | 4 +- .../src/cmds/validator/keymanager/server.ts | 2 +- packages/cli/src/cmds/validator/options.ts | 2 +- .../cli/src/cmds/validator/signers/index.ts | 14 +-- .../src/cmds/validator/signers/logSigners.ts | 2 +- .../validator/slashingProtection/export.ts | 10 +- .../validator/slashingProtection/import.ts | 8 +- .../validator/slashingProtection/index.ts | 4 +- .../validator/slashingProtection/utils.ts | 10 +- .../cli/src/cmds/validator/voluntaryExit.ts | 14 +-- packages/cli/src/config/beaconNodeOptions.ts | 4 +- packages/cli/src/config/beaconParams.ts | 14 +-- packages/cli/src/config/peerId.ts | 4 +- packages/cli/src/index.ts | 2 +- packages/cli/src/networks/dev.ts | 4 +- packages/cli/src/networks/index.ts | 20 ++-- .../cli/src/options/beaconNodeOptions/api.ts | 2 +- .../src/options/beaconNodeOptions/builder.ts | 2 +- .../src/options/beaconNodeOptions/chain.ts | 2 +- .../cli/src/options/beaconNodeOptions/eth1.ts | 2 +- .../options/beaconNodeOptions/execution.ts | 2 +- .../src/options/beaconNodeOptions/metrics.ts | 2 +- .../options/beaconNodeOptions/monitoring.ts | 2 +- .../src/options/beaconNodeOptions/network.ts | 4 +- .../cli/src/options/beaconNodeOptions/sync.ts | 2 +- packages/cli/src/options/globalOptions.ts | 2 +- packages/cli/src/options/logOptions.ts | 2 +- packages/cli/src/util/gitData/gitDataPath.ts | 2 +- packages/cli/src/util/gitData/index.ts | 2 +- packages/cli/src/util/logger.ts | 6 +- packages/cli/src/util/proposerConfig.ts | 2 +- .../cli/test/e2e/blsToExecutionchange.test.ts | 4 +- .../cli/test/e2e/importFromFsDirect.test.ts | 4 +- .../cli/test/e2e/importFromFsPreStep.test.ts | 4 +- .../test/e2e/importKeystoresFromApi.test.ts | 10 +- .../test/e2e/importRemoteKeysFromApi.test.ts | 8 +- .../e2e/propserConfigfromKeymanager.test.ts | 6 +- packages/cli/test/e2e/runDevCmd.test.ts | 4 +- packages/cli/test/e2e/validatorList.test.ts | 8 +- packages/cli/test/e2e/voluntaryExit.test.ts | 6 +- .../cli/test/e2e/voluntaryExitFromApi.test.ts | 2 +- .../e2e/voluntaryExitRemoteSigner.test.ts | 10 +- .../cli/test/sim/backupEthProvider.test.ts | 4 +- packages/cli/test/sim/deneb.test.ts | 4 +- packages/cli/test/sim/endpoints.test.ts | 6 +- packages/cli/test/sim/mixedClient.test.ts | 4 +- packages/cli/test/sim/multiFork.test.ts | 14 +-- packages/cli/test/unit/cmds/beacon.test.ts | 12 +- .../test/unit/cmds/initPeerIdAndEnr.test.ts | 2 +- .../keymanager/keystoreCache.test.ts | 8 +- .../unit/config/beaconNodeOptions.test.ts | 2 +- .../cli/test/unit/config/beaconParams.test.ts | 6 +- packages/cli/test/unit/config/peerId.test.ts | 4 +- .../unit/options/beaconNodeOptions.test.ts | 6 +- .../test/unit/options/paramsOptions.test.ts | 4 +- .../cli/test/unit/paths/globalPaths.test.ts | 2 +- .../unit/util/extractJwtHexSecret.test.ts | 2 +- packages/cli/test/unit/util/format.test.ts | 2 +- packages/cli/test/unit/util/gitData.test.ts | 2 +- packages/cli/test/unit/util/logger.test.ts | 2 +- .../test/unit/util/parseBootnodesFile.test.ts | 2 +- packages/cli/test/unit/util/progress.test.ts | 2 +- .../test/unit/util/pruneOldFilesInDir.test.ts | 2 +- .../test/unit/util/stripOffNewlines.test.ts | 2 +- .../decryptKeystoreDefinitions.test.ts | 10 +- packages/cli/test/unit/validator/keys.test.ts | 2 +- .../cli/test/unit/validator/options.test.ts | 2 +- .../validator/parseProposerConfig.test.ts | 2 +- packages/cli/test/utils.ts | 2 +- .../assertions/accountBalanceAssertion.ts | 2 +- .../crucible/assertions/blobsAssertion.ts | 2 +- .../defaults/attestationCountAssertion.ts | 4 +- .../attestationParticipationAssertion.ts | 2 +- .../defaults/connectedPeerCountAssertion.ts | 2 +- .../assertions/defaults/finalizedAssertion.ts | 2 +- .../assertions/defaults/headAssertion.ts | 2 +- .../defaults/inclusionDelayAssertion.ts | 2 +- .../defaults/missedBlocksAssertion.ts | 2 +- .../syncCommitteeParticipationAssertion.ts | 2 +- .../assertions/executionHeadAssertion.ts | 4 +- .../crucible/assertions/forkAssertion.ts | 2 +- .../lighthousePeerScoreAssertion.ts | 2 +- .../crucible/assertions/mergeAssertion.ts | 2 +- .../crucible/assertions/nodeAssertion.ts | 2 +- .../assertions/withdrawalsAssertion.ts | 4 +- .../crucible/clients/beacon/lighthouse.ts | 4 +- .../utils/crucible/clients/beacon/lodestar.ts | 2 +- .../utils/crucible/clients/execution/geth.ts | 2 +- .../utils/crucible/clients/execution/index.ts | 4 +- .../crucible/clients/execution/nethermind.ts | 4 +- .../utils/crucible/clients/validator/index.ts | 4 +- .../crucible/clients/validator/lighthouse.ts | 6 +- .../crucible/clients/validator/lodestar.ts | 2 +- .../utils/crucible/externalSignerServer.ts | 4 +- .../cli/test/utils/crucible/interfaces.ts | 6 +- .../crucible/runner/childProcessRunner.ts | 2 +- .../utils/crucible/runner/dockerRunner.ts | 2 +- .../cli/test/utils/crucible/simulation.ts | 20 ++-- .../test/utils/crucible/simulationTracker.ts | 14 +-- .../utils/crucible/utils/executionGenesis.ts | 2 +- .../cli/test/utils/crucible/utils/index.ts | 2 +- .../cli/test/utils/crucible/utils/keys.ts | 2 +- .../cli/test/utils/crucible/utils/paths.ts | 2 +- .../cli/test/utils/crucible/utils/ports.ts | 6 +- .../cli/test/utils/crucible/utils/syncing.ts | 4 +- .../web3js/blobsEIP4844Transaction.ts | 2 +- .../cli/test/utils/mockBeaconApiServer.ts | 4 +- packages/cli/test/utils/validator.ts | 4 +- packages/config/src/beaconConfig.ts | 4 +- .../config/src/chainConfig/configs/mainnet.ts | 2 +- .../config/src/chainConfig/configs/minimal.ts | 2 +- packages/config/src/chainConfig/default.ts | 2 +- packages/config/src/chainConfig/index.ts | 2 +- packages/config/src/chainConfig/json.ts | 2 +- .../src/chainConfig/networks/ephemery.ts | 2 +- .../config/src/chainConfig/networks/gnosis.ts | 4 +- .../src/chainConfig/networks/holesky.ts | 2 +- .../src/chainConfig/networks/mainnet.ts | 2 +- .../config/src/chainConfig/networks/mekong.ts | 2 +- .../src/chainConfig/networks/sepolia.ts | 2 +- packages/config/src/forkConfig/index.ts | 18 +-- packages/config/src/genesisConfig/index.ts | 6 +- packages/config/src/networks.ts | 8 +- packages/config/test/unit/index.test.ts | 4 +- packages/config/test/unit/json.test.ts | 4 +- packages/db/src/controller/level.ts | 4 +- .../db/test/unit/controller/level.test.ts | 4 +- packages/db/test/unit/schema.test.ts | 2 +- packages/flare/src/cli.ts | 2 +- packages/flare/src/cmds/index.ts | 2 +- packages/flare/src/cmds/selfSlashAttester.ts | 8 +- packages/flare/src/cmds/selfSlashProposer.ts | 8 +- packages/flare/src/index.ts | 2 +- packages/flare/test/unit/utils/format.test.ts | 2 +- packages/fork-choice/src/forkChoice/errors.ts | 2 +- .../fork-choice/src/forkChoice/forkChoice.ts | 44 +++---- .../fork-choice/src/forkChoice/interface.ts | 10 +- packages/fork-choice/src/forkChoice/store.ts | 6 +- .../src/protoArray/computeDeltas.ts | 4 +- .../fork-choice/src/protoArray/interface.ts | 2 +- .../fork-choice/src/protoArray/protoArray.ts | 8 +- .../perf/forkChoice/onAttestation.test.ts | 6 +- .../test/perf/forkChoice/updateHead.test.ts | 2 +- .../fork-choice/test/perf/forkChoice/util.ts | 6 +- .../perf/protoArray/computeDeltas.test.ts | 2 +- .../test/unit/forkChoice/forkChoice.test.ts | 14 +-- .../unit/forkChoice/getProposerHead.test.ts | 10 +- .../test/unit/forkChoice/utils.test.ts | 4 +- .../unit/protoArray/computeDeltas.test.ts | 2 +- .../protoArray/executionStatusUpdates.test.ts | 8 +- .../unit/protoArray/getCommonAncestor.test.ts | 4 +- .../test/unit/protoArray/protoArray.test.ts | 4 +- packages/light-client/src/index.ts | 18 +-- packages/light-client/src/spec/index.ts | 2 +- .../src/spec/processLightClientUpdate.ts | 4 +- packages/light-client/src/spec/utils.ts | 20 ++-- .../src/spec/validateLightClientBootstrap.ts | 4 +- .../src/spec/validateLightClientUpdate.ts | 26 ++-- .../light-client/src/transport/interface.ts | 2 +- packages/light-client/src/transport/rest.ts | 6 +- packages/light-client/src/utils/api.ts | 2 +- packages/light-client/src/utils/domain.ts | 2 +- packages/light-client/src/utils/utils.ts | 2 +- .../src/utils/verifyMerkleBranch.ts | 2 +- packages/light-client/src/validation.ts | 32 ++--- .../test/mocks/BeaconChainLcMock.ts | 2 +- .../test/mocks/LightclientServerApiMock.ts | 8 +- .../unit/isValidLightClientHeader.test.ts | 4 +- .../light-client/test/unit/sync.node.test.ts | 26 ++-- .../test/unit/syncInMemory.test.ts | 6 +- packages/light-client/test/unit/utils.test.ts | 6 +- .../test/unit/utils/chunkify.test.ts | 2 +- .../light-client/test/unit/validation.test.ts | 8 +- .../test/unit/webEsmBundle.browser.test.ts | 6 +- .../light-client/test/utils/naive/update.ts | 8 +- .../test/utils/prepareUpdateNaive.ts | 4 +- packages/light-client/test/utils/server.ts | 6 +- packages/light-client/test/utils/utils.ts | 4 +- packages/logger/src/browser.ts | 4 +- packages/logger/src/interface.ts | 2 +- packages/logger/src/node.ts | 6 +- packages/logger/src/utils/format.ts | 4 +- packages/logger/src/winston.ts | 2 +- .../test/e2e/logger/workerLoggerHandler.ts | 2 +- .../logger/test/e2e/logger/workerLogs.test.ts | 4 +- packages/logger/test/unit/browser.test.ts | 6 +- packages/logger/test/unit/env.node.test.ts | 6 +- packages/logger/test/unit/node.node.test.ts | 2 +- packages/logger/test/unit/utils/json.test.ts | 2 +- .../logger/test/unit/utils/timeFormat.test.ts | 2 +- .../logger/test/unit/winston.node.test.ts | 2 +- packages/params/src/index.ts | 6 +- packages/params/src/setPreset.ts | 2 +- .../test/e2e/ensure-config-is-synced.test.ts | 4 +- .../params/test/e2e/overridePreset.test.ts | 6 +- .../params/test/e2e/overridePresetError.ts | 2 +- packages/params/test/e2e/overridePresetOk.ts | 2 +- packages/params/test/e2e/setPreset.test.ts | 6 +- packages/params/test/e2e/setPresetError.ts | 2 +- packages/params/test/e2e/setPresetOk.ts | 2 +- .../params/test/unit/activePreset.test.ts | 6 +- .../test/unit/applicationDomains.test.ts | 4 +- packages/params/test/unit/forkName.test.ts | 2 +- packages/params/test/yaml.ts | 2 +- packages/prover/src/cli/applyPreset.ts | 2 +- packages/prover/src/cli/cli.ts | 2 +- packages/prover/src/cli/cmds/start/handler.ts | 4 +- packages/prover/src/cli/options.ts | 2 +- packages/prover/src/interfaces.ts | 2 +- .../src/proof_provider/payload_store.ts | 4 +- .../src/proof_provider/proof_provider.ts | 2 +- packages/prover/src/utils/consensus.ts | 2 +- packages/prover/src/utils/evm.ts | 10 +- packages/prover/src/utils/execution.ts | 2 +- .../prover/src/utils/gitData/gitDataPath.ts | 2 +- packages/prover/src/utils/gitData/index.ts | 2 +- packages/prover/src/utils/json_rpc.ts | 10 +- packages/prover/src/utils/process.ts | 10 +- packages/prover/src/utils/validation.ts | 4 +- packages/prover/src/utils/verification.ts | 2 +- .../prover/src/verified_requests/eth_call.ts | 2 +- .../src/verified_requests/eth_getBalance.ts | 2 +- .../verified_requests/eth_getBlockByHash.ts | 2 +- .../verified_requests/eth_getBlockByNumber.ts | 2 +- .../src/verified_requests/eth_getCode.ts | 2 +- .../eth_getTransactionCount.ts | 4 +- packages/prover/src/web3_provider.ts | 2 +- .../prover/src/web3_provider_inspector.ts | 4 +- packages/prover/src/web3_proxy.ts | 6 +- .../prover/test/e2e/cli/cmds/start.test.ts | 10 +- .../test/e2e/web3_batch_request.test.ts | 6 +- .../prover/test/e2e/web3_provider.test.ts | 6 +- packages/prover/test/mocks/request_handler.ts | 12 +- .../unit/proof_provider/orderd_map.test.ts | 2 +- .../unit/proof_provider/payload_store.test.ts | 10 +- .../ethers_provider_type.test.ts | 2 +- .../legacy_provider_type.test.ts | 2 +- .../web3js_provider_type.test.ts | 2 +- .../prover/test/unit/utils/conversion.test.ts | 2 +- .../prover/test/unit/utils/execution.test.ts | 6 +- .../unit/verified_requests/eth_call.test.ts | 6 +- .../verified_requests/eth_estimateGas.test.ts | 8 +- .../verified_requests/eth_getBalance.test.ts | 6 +- .../eth_getBlockByHash.test.ts | 6 +- .../eth_getBlockByNumber.test.ts | 4 +- .../verified_requests/eth_getCode.test.ts | 6 +- .../eth_getTransactionCount.test.ts | 6 +- .../test/unit/web3_provider.node.test.ts | 10 +- .../test/unit/web3_provider_inspector.test.ts | 6 +- packages/reqresp/src/ReqResp.ts | 10 +- .../reqresp/src/encoders/requestDecode.ts | 2 +- .../reqresp/src/encoders/requestEncode.ts | 2 +- .../reqresp/src/encoders/responseDecode.ts | 8 +- .../reqresp/src/encoders/responseEncode.ts | 4 +- .../encodingStrategies/sszSnappy/decode.ts | 4 +- .../sszSnappy/snappyFrames/compress.ts | 2 +- packages/reqresp/src/request/errors.ts | 2 +- packages/reqresp/src/request/index.ts | 12 +- packages/reqresp/src/response/index.ts | 12 +- packages/reqresp/src/utils/collectExactOne.ts | 2 +- .../test/fixtures/encodingStrategies.ts | 4 +- packages/reqresp/test/fixtures/messages.ts | 2 +- packages/reqresp/test/fixtures/protocols.ts | 6 +- packages/reqresp/test/unit/ReqResp.test.ts | 8 +- .../test/unit/encoders/reqestEncode.test.ts | 2 +- .../test/unit/encoders/requestDecode.test.ts | 2 +- .../test/unit/encoders/responseDecode.test.ts | 6 +- .../test/unit/encoders/responseEncode.test.ts | 4 +- .../sszSnappy/decode.test.ts | 4 +- .../sszSnappy/encode.test.ts | 2 +- .../sszSnappy/snappyFrames/uncompress.test.ts | 6 +- .../sszSnappy/utils.test.ts | 2 +- .../unit/rate_limiter/rateLimiterGRCA.test.ts | 2 +- .../reqresp/test/unit/request/index.test.ts | 18 +-- .../reqresp/test/unit/response/index.test.ts | 6 +- .../test/unit/utils/protocolId.test.ts | 2 +- packages/reqresp/test/utils/errors.ts | 2 +- packages/reqresp/test/utils/index.ts | 8 +- packages/spec-test-util/src/downloadTests.ts | 4 +- packages/spec-test-util/src/single.ts | 4 +- packages/spec-test-util/src/sszGeneric.ts | 4 +- .../test/e2e/single/index.test.ts | 4 +- packages/state-transition/src/block/index.ts | 10 +- .../src/block/isValidIndexedAttestation.ts | 2 +- .../src/block/processAttestationPhase0.ts | 6 +- .../src/block/processAttestations.ts | 2 +- .../src/block/processAttestationsAltair.ts | 8 +- .../src/block/processAttesterSlashing.ts | 6 +- .../src/block/processBlockHeader.ts | 2 +- .../src/block/processBlsToExecutionChange.ts | 4 +- .../src/block/processConsolidationRequest.ts | 6 +- .../src/block/processDeposit.ts | 6 +- .../src/block/processDepositRequest.ts | 2 +- .../src/block/processExecutionPayload.ts | 8 +- .../src/block/processOperations.ts | 10 +- .../src/block/processProposerSlashing.ts | 6 +- .../src/block/processRandao.ts | 4 +- .../src/block/processSyncCommittee.ts | 6 +- .../src/block/processVoluntaryExit.ts | 4 +- .../src/block/processWithdrawalRequest.ts | 8 +- .../src/block/processWithdrawals.ts | 10 +- .../src/block/slashValidator.ts | 4 +- .../state-transition/src/cache/epochCache.ts | 68 +++++------ .../src/cache/epochTransitionCache.ts | 24 ++-- .../state-transition/src/cache/pubkeyCache.ts | 2 +- .../state-transition/src/cache/stateCache.ts | 6 +- .../src/cache/syncCommitteeCache.ts | 4 +- packages/state-transition/src/cache/types.ts | 2 +- .../src/epoch/computeUnrealizedCheckpoints.ts | 4 +- .../src/epoch/getAttestationDeltas.ts | 6 +- .../src/epoch/getRewardsAndPenalties.ts | 2 +- packages/state-transition/src/epoch/index.ts | 10 +- .../epoch/processEffectiveBalanceUpdates.ts | 2 +- .../src/epoch/processEth1DataReset.ts | 2 +- .../src/epoch/processHistoricalRootsUpdate.ts | 2 +- .../epoch/processHistoricalSummariesUpdate.ts | 2 +- .../processJustificationAndFinalization.ts | 2 +- .../src/epoch/processPendingDeposits.ts | 4 +- .../src/epoch/processRandaoMixesReset.ts | 2 +- .../src/epoch/processRegistryUpdates.ts | 4 +- .../src/epoch/processSlashings.ts | 2 +- .../src/epoch/processSlashingsReset.ts | 2 +- .../src/epoch/processSyncCommitteeUpdates.ts | 2 +- packages/state-transition/src/metrics.ts | 4 +- .../src/signatureSets/attesterSlashings.ts | 4 +- .../src/signatureSets/blsToExecutionChange.ts | 4 +- .../src/signatureSets/index.ts | 8 +- .../src/signatureSets/indexedAttestation.ts | 4 +- .../src/signatureSets/proposer.ts | 2 +- .../src/signatureSets/proposerSlashings.ts | 2 +- .../src/signatureSets/randao.ts | 6 +- .../src/signatureSets/voluntaryExits.ts | 6 +- packages/state-transition/src/slot/index.ts | 2 +- .../src/slot/upgradeStateToAltair.ts | 10 +- .../src/slot/upgradeStateToBellatrix.ts | 2 +- .../src/slot/upgradeStateToCapella.ts | 2 +- .../src/slot/upgradeStateToDeneb.ts | 2 +- .../src/slot/upgradeStateToElectra.ts | 6 +- .../state-transition/src/stateTransition.ts | 30 ++--- .../state-transition/src/util/aggregator.ts | 6 +- .../state-transition/src/util/attestation.ts | 2 +- .../state-transition/src/util/blindedBlock.ts | 16 +-- .../state-transition/src/util/blockRoot.ts | 10 +- .../src/util/calculateCommitteeAssignments.ts | 2 +- .../src/util/computeAnchorCheckpoint.ts | 2 +- packages/state-transition/src/util/domain.ts | 2 +- packages/state-transition/src/util/electra.ts | 2 +- packages/state-transition/src/util/epoch.ts | 2 +- .../src/util/epochShuffling.ts | 12 +- .../state-transition/src/util/execution.ts | 18 +-- packages/state-transition/src/util/genesis.ts | 14 +-- packages/state-transition/src/util/interop.ts | 2 +- .../src/util/loadState/loadState.ts | 6 +- .../state-transition/src/util/rootCache.ts | 2 +- packages/state-transition/src/util/seed.ts | 6 +- packages/state-transition/src/util/slot.ts | 4 +- .../src/util/syncCommittee.ts | 4 +- .../state-transition/src/util/validator.ts | 4 +- .../src/util/weakSubjectivity.ts | 2 +- .../test/perf/analyzeEpochs.ts | 4 +- .../perf/block/processAttestation.test.ts | 2 +- .../perf/block/processBlockAltair.test.ts | 4 +- .../perf/block/processBlockPhase0.test.ts | 2 +- .../test/perf/block/processEth1Data.test.ts | 2 +- .../perf/block/processWithdrawals.test.ts | 4 +- .../state-transition/test/perf/block/util.ts | 14 +-- .../test/perf/dataStructures/arrayish.test.ts | 2 +- .../test/perf/epoch/epochAltair.test.ts | 32 ++--- .../test/perf/epoch/epochCapella.test.ts | 32 ++--- .../test/perf/epoch/epochPhase0.test.ts | 28 ++--- .../processEffectiveBalanceUpdates.test.ts | 8 +- .../perf/epoch/processRegistryUpdates.test.ts | 4 +- .../epoch/processRewardsAndPenalties.test.ts | 4 +- .../processRewardsAndPenaltiesPhase0.test.ts | 2 +- .../epoch/processSlashingsAllForks.test.ts | 8 +- .../test/perf/epoch/utilPhase0.ts | 2 +- .../test/perf/hashing.test.ts | 4 +- .../test/perf/misc/aggregationBits.test.ts | 2 +- .../test/perf/misc/byteArrayEquals.test.ts | 2 +- .../test/perf/misc/rootEquals.test.ts | 2 +- .../test/perf/sanityCheck.test.ts | 2 +- .../test/perf/slot/slots.test.ts | 2 +- packages/state-transition/test/perf/types.ts | 2 +- packages/state-transition/test/perf/util.ts | 24 ++-- .../test/perf/util/balance.test.ts | 4 +- .../test/perf/util/epochContext.test.ts | 2 +- .../loadState/findModifiedValidators.test.ts | 6 +- .../perf/util/loadState/loadState.test.ts | 6 +- .../test/perf/util/rootCache.test.ts | 4 +- .../test/perf/util/shufflings.test.ts | 6 +- .../test/perf/util/signingRoot.test.ts | 2 +- .../block/isValidIndexedAttestation.test.ts | 4 +- .../unit/block/processWithdrawals.test.ts | 4 +- .../test/unit/cachedBeaconState.test.ts | 12 +- .../test/unit/constants.test.ts | 2 +- .../unit/signatureSets/signatureSets.test.ts | 6 +- .../test/unit/upgradeState.test.ts | 10 +- .../test/unit/util/aggregator.test.ts | 4 +- .../test/unit/util/balance.test.ts | 8 +- .../test/unit/util/cachedBeaconState.test.ts | 2 +- .../test/unit/util/deposit.test.ts | 4 +- .../test/unit/util/epoch.test.ts | 6 +- .../test/unit/util/flags.test.ts | 2 +- .../test/unit/util/loadState.test.ts | 6 +- .../findModifiedInactivityScores.test.ts | 2 +- .../loadState/findModifiedValidators.test.ts | 2 +- .../unit/util/loadState/loadValidator.test.ts | 2 +- .../test/unit/util/misc.test.ts | 4 +- .../test/unit/util/seed.test.ts | 2 +- .../test/unit/util/shuffling.test.ts | 6 +- .../test/unit/util/slashing.test.ts | 2 +- .../test/unit/util/slot.test.ts | 2 +- .../test/unit/util/validator.test.ts | 4 +- .../test/unit/util/weakSubjectivity.test.ts | 4 +- .../state-transition/test/utils/capella.ts | 6 +- packages/state-transition/test/utils/state.ts | 10 +- .../test/utils/testFileCache.ts | 4 +- packages/test-utils/src/childProcess.ts | 4 +- packages/test-utils/src/cli.ts | 4 +- packages/test-utils/src/doubles.ts | 2 +- packages/test-utils/src/externalSigner.ts | 4 +- packages/test-utils/src/http.ts | 2 +- packages/types/src/altair/index.ts | 2 +- packages/types/src/altair/sszTypes.ts | 8 +- packages/types/src/bellatrix/index.ts | 2 +- packages/types/src/bellatrix/sszTypes.ts | 6 +- packages/types/src/capella/index.ts | 2 +- packages/types/src/capella/sszTypes.ts | 10 +- packages/types/src/deneb/index.ts | 2 +- packages/types/src/deneb/sszTypes.ts | 14 +-- packages/types/src/electra/index.ts | 2 +- packages/types/src/electra/sszTypes.ts | 22 ++-- packages/types/src/phase0/index.ts | 2 +- packages/types/src/phase0/sszTypes.ts | 2 +- packages/types/src/primitive/index.ts | 2 +- packages/types/src/primitive/sszTypes.ts | 2 +- packages/types/src/sszTypes.ts | 2 +- packages/types/src/types.ts | 2 +- packages/types/src/utils/executionAddress.ts | 2 +- packages/types/src/utils/typeguards.ts | 18 +-- packages/types/test/constants/blobs.test.ts | 2 +- .../types/test/constants/lightclient.test.ts | 2 +- packages/types/test/unit/blinded.test.ts | 2 +- .../types/test/unit/executionAddress.test.ts | 2 +- .../types/test/unit/phase0/sszTypes.test.ts | 2 +- packages/types/test/unit/ssz.test.ts | 2 +- .../types/test/unit/validatorStatus.test.ts | 4 +- packages/utils/src/bytes.ts | 2 +- packages/utils/src/bytes/index.ts | 8 +- packages/utils/src/command.ts | 2 +- packages/utils/test/perf/bytes.test.ts | 4 +- packages/utils/test/types/metrics.test-d.ts | 2 +- packages/utils/test/unit/assert.test.ts | 2 +- packages/utils/test/unit/base64.test.ts | 4 +- packages/utils/test/unit/bytes.test.ts | 10 +- packages/utils/test/unit/err.test.ts | 4 +- packages/utils/test/unit/format.test.ts | 2 +- packages/utils/test/unit/math.test.ts | 4 +- packages/utils/test/unit/objects.test.ts | 2 +- packages/utils/test/unit/promise.node.test.ts | 2 +- packages/utils/test/unit/promise.test.ts | 4 +- packages/utils/test/unit/promiserace.test.ts | 4 +- packages/utils/test/unit/retry.test.ts | 4 +- packages/utils/test/unit/sleep.test.ts | 4 +- packages/utils/test/unit/timeout.test.ts | 4 +- packages/utils/test/unit/waitFor.test.ts | 4 +- packages/validator/src/genesis.ts | 2 +- .../src/repositories/metaDataRepository.ts | 4 +- .../validator/src/services/attestation.ts | 18 +-- .../src/services/attestationDuties.ts | 12 +- packages/validator/src/services/block.ts | 22 ++-- .../validator/src/services/blockDuties.ts | 8 +- .../src/services/chainHeaderTracker.ts | 4 +- .../src/services/doppelgangerService.ts | 6 +- packages/validator/src/services/emitter.ts | 2 +- .../src/services/externalSignerSync.ts | 2 +- packages/validator/src/services/indices.ts | 4 +- .../src/services/prepareBeaconProposer.ts | 4 +- .../validator/src/services/syncCommittee.ts | 16 +-- .../src/services/syncCommitteeDuties.ts | 12 +- .../src/services/syncingStatusTracker.ts | 4 +- .../validator/src/services/validatorStore.ts | 46 +++---- .../attestationByTargetRepository.ts | 6 +- .../attestationLowerBoundRepository.ts | 4 +- .../slashingProtection/attestation/index.ts | 4 +- .../block/blockBySlotRepository.ts | 6 +- .../src/slashingProtection/block/index.ts | 4 +- .../validator/src/slashingProtection/index.ts | 12 +- .../interchange/formats/completeV4.ts | 2 +- .../interchange/formats/v5.ts | 2 +- .../interchange/parseInterchange.ts | 2 +- .../interchange/serializeInterchange.ts | 2 +- .../src/slashingProtection/interface.ts | 2 +- .../minMaxSurround/distanceStoreRepository.ts | 2 +- .../minMaxSurround/minMaxSurround.ts | 2 +- packages/validator/src/types.ts | 2 +- packages/validator/src/util/clock.ts | 6 +- .../src/util/externalSignerClient.ts | 22 ++-- packages/validator/src/util/params.ts | 2 +- packages/validator/src/validator.ts | 30 ++--- .../validator/test/e2e/web3signer.test.ts | 16 +-- packages/validator/test/spec/downloadTests.ts | 2 +- packages/validator/test/spec/index.test.ts | 10 +- packages/validator/test/spec/spec.test.ts | 8 +- .../test/unit/services/attestation.test.ts | 14 +-- .../unit/services/attestationDuties.test.ts | 18 +-- .../test/unit/services/block.test.ts | 12 +- .../test/unit/services/blockDuties.test.ts | 10 +- .../test/unit/services/doppelganger.test.ts | 10 +- .../unit/services/externalSignerSync.test.ts | 6 +- .../test/unit/services/indicesService.test.ts | 8 +- .../unit/services/syncCommitteDuties.test.ts | 16 +-- .../test/unit/services/syncCommittee.test.ts | 14 +-- .../services/syncingStatusTracker.test.ts | 6 +- .../test/unit/services/utils.test.ts | 2 +- .../interchange/index.test.ts | 2 +- .../minMaxSurround/surroundTests.test.ts | 2 +- .../minMaxSurround/updateSpans.test.ts | 6 +- .../minMaxSurround/utils.ts | 2 +- .../unit/slashingProtection/utils.test.ts | 2 +- .../validator/test/unit/utils/batch.test.ts | 2 +- .../validator/test/unit/utils/clock.test.ts | 4 +- .../test/unit/utils/difference.test.ts | 2 +- .../validator/test/unit/utils/metrics.test.ts | 2 +- .../validator/test/unit/utils/params.test.ts | 8 +- .../test/unit/validatorStore.test.ts | 10 +- packages/validator/test/utils/apiStub.ts | 2 +- packages/validator/test/utils/logger.ts | 2 +- .../validator/test/utils/validatorStore.ts | 2 +- 1068 files changed, 3633 insertions(+), 3636 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index 212a61d86aa2..f50f4ad9c8d1 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -18,10 +18,7 @@ "ignore": ["**/lib", "**/.nyc_output", "./packages/*/spec-tests", "**/node_modules", "./packages/*/node_modules/**"] }, "organizeImports": { - // TODO: We will enable this settings as soon mono-repo support is provided in biome. - // Currently it didn't recognize local packages in repo and sort those higher than npm packages - // https://github.com/biomejs/biome/issues/2228 - "enabled": false + "enabled": true }, "linter": { "enabled": true, diff --git a/packages/api/src/beacon/client/debug.ts b/packages/api/src/beacon/client/debug.ts index 4df3bef12cf8..c0f2514fa3eb 100644 --- a/packages/api/src/beacon/client/debug.ts +++ b/packages/api/src/beacon/client/debug.ts @@ -1,5 +1,5 @@ import {ChainForkConfig} from "@lodestar/config"; -import {ApiClientMethods, createApiClientMethods, IHttpClient} from "../../utils/client/index.js"; +import {ApiClientMethods, IHttpClient, createApiClientMethods} from "../../utils/client/index.js"; import {Endpoints, getDefinitions} from "../routes/debug.js"; export type ApiClient = ApiClientMethods; diff --git a/packages/api/src/beacon/routes/beacon/block.ts b/packages/api/src/beacon/routes/beacon/block.ts index cd3cae9fd7ff..8fadfa1b9002 100644 --- a/packages/api/src/beacon/routes/beacon/block.ts +++ b/packages/api/src/beacon/routes/beacon/block.ts @@ -1,21 +1,23 @@ import {ContainerType, ListCompositeType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; +import {ForkName, ForkPreElectra, ForkPreExecution, isForkBlobs, isForkExecution} from "@lodestar/params"; import { - Slot, - ssz, + BeaconBlockBody, RootHex, - deneb, - isSignedBlockContents, SignedBeaconBlock, - BeaconBlockBody, SignedBeaconBlockOrContents, SignedBlindedBeaconBlock, SignedBlockContents, + Slot, + deneb, + isSignedBlockContents, + ssz, sszTypesFor, } from "@lodestar/types"; -import {ForkName, ForkPreElectra, ForkPreExecution, isForkBlobs, isForkExecution} from "@lodestar/params"; -import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js"; import {EmptyMeta, EmptyResponseCodec, EmptyResponseData, WithVersion} from "../../../utils/codecs.js"; +import {getExecutionForkTypes, toForkName} from "../../../utils/fork.js"; +import {fromHeaders} from "../../../utils/headers.js"; +import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js"; import { ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta, @@ -23,8 +25,6 @@ import { ExecutionOptimisticFinalizedAndVersionMeta, MetaHeader, } from "../../../utils/metadata.js"; -import {getExecutionForkTypes, toForkName} from "../../../utils/fork.js"; -import {fromHeaders} from "../../../utils/headers.js"; import {WireFormat} from "../../../utils/wireFormat.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/beacon/index.ts b/packages/api/src/beacon/routes/beacon/index.ts index 39d7d995dfb1..5c4a9163a1b7 100644 --- a/packages/api/src/beacon/routes/beacon/index.ts +++ b/packages/api/src/beacon/routes/beacon/index.ts @@ -1,11 +1,11 @@ import {ChainForkConfig} from "@lodestar/config"; import {phase0, ssz} from "@lodestar/types"; +import {EmptyArgs, EmptyMeta, EmptyMetaCodec, EmptyRequest, EmptyRequestCodec} from "../../../utils/codecs.js"; import {Endpoint, RouteDefinitions} from "../../../utils/types.js"; -import {EmptyArgs, EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest} from "../../../utils/codecs.js"; import * as block from "./block.js"; import * as pool from "./pool.js"; -import * as state from "./state.js"; import * as rewards from "./rewards.js"; +import * as state from "./state.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/beacon/pool.ts b/packages/api/src/beacon/routes/beacon/pool.ts index 3f0b8ac74284..4d909c2aac7b 100644 --- a/packages/api/src/beacon/routes/beacon/pool.ts +++ b/packages/api/src/beacon/routes/beacon/pool.ts @@ -1,22 +1,22 @@ import {ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {isForkPostElectra} from "@lodestar/params"; -import {phase0, capella, CommitteeIndex, Slot, ssz, electra, AttesterSlashing} from "@lodestar/types"; -import {Schema, Endpoint, RouteDefinitions} from "../../../utils/index.js"; +import {AttesterSlashing, CommitteeIndex, Slot, capella, electra, phase0, ssz} from "@lodestar/types"; import { ArrayOf, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, EmptyResponseData, WithVersion, } from "../../../utils/codecs.js"; -import {MetaHeader, VersionCodec, VersionMeta} from "../../../utils/metadata.js"; import {toForkName} from "../../../utils/fork.js"; import {fromHeaders} from "../../../utils/headers.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../../utils/index.js"; +import {MetaHeader, VersionCodec, VersionMeta} from "../../../utils/metadata.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/beacon/rewards.ts b/packages/api/src/beacon/routes/beacon/rewards.ts index d41b5ef705f0..3acb09955cb4 100644 --- a/packages/api/src/beacon/routes/beacon/rewards.ts +++ b/packages/api/src/beacon/routes/beacon/rewards.ts @@ -2,10 +2,10 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {Epoch, ssz} from "@lodestar/types"; -import {Schema, Endpoint, RouteDefinitions} from "../../../utils/index.js"; -import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js"; import {ArrayOf, JsonOnlyReq} from "../../../utils/codecs.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../../utils/index.js"; import {ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta} from "../../../utils/metadata.js"; +import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js"; import {BlockArgs} from "./block.js"; import {ValidatorId} from "./state.js"; diff --git a/packages/api/src/beacon/routes/beacon/state.ts b/packages/api/src/beacon/routes/beacon/state.ts index 4127bb1ce793..d1284558f98f 100644 --- a/packages/api/src/beacon/routes/beacon/state.ts +++ b/packages/api/src/beacon/routes/beacon/state.ts @@ -1,9 +1,9 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params"; -import {phase0, CommitteeIndex, Slot, Epoch, ssz, RootHex, StringType, ValidatorStatus} from "@lodestar/types"; -import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js"; +import {CommitteeIndex, Epoch, RootHex, Slot, StringType, ValidatorStatus, phase0, ssz} from "@lodestar/types"; import {ArrayOf, JsonOnlyReq} from "../../../utils/codecs.js"; +import {Endpoint, RequestCodec, RouteDefinitions, Schema} from "../../../utils/index.js"; import {ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta} from "../../../utils/metadata.js"; import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js"; import {WireFormat} from "../../../utils/wireFormat.js"; diff --git a/packages/api/src/beacon/routes/config.ts b/packages/api/src/beacon/routes/config.ts index afce0898908c..cd76c2bf41b2 100644 --- a/packages/api/src/beacon/routes/config.ts +++ b/packages/api/src/beacon/routes/config.ts @@ -4,10 +4,10 @@ import {ssz} from "@lodestar/types"; import { ArrayOf, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, JsonOnlyResp, } from "../../utils/codecs.js"; import {Endpoint, RouteDefinitions} from "../../utils/index.js"; diff --git a/packages/api/src/beacon/routes/debug.ts b/packages/api/src/beacon/routes/debug.ts index 349684f62ccd..9afc96d5a637 100644 --- a/packages/api/src/beacon/routes/debug.ts +++ b/packages/api/src/beacon/routes/debug.ts @@ -1,22 +1,22 @@ import {ContainerType, Type, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; -import {ssz, StringType, BeaconState} from "@lodestar/types"; +import {BeaconState, StringType, ssz} from "@lodestar/types"; import { ArrayOf, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, WithVersion, } from "../../utils/codecs.js"; import { ExecutionOptimisticFinalizedAndVersionCodec, ExecutionOptimisticFinalizedAndVersionMeta, } from "../../utils/metadata.js"; +import {Schema} from "../../utils/schema.js"; import {Endpoint, RouteDefinitions} from "../../utils/types.js"; import {WireFormat} from "../../utils/wireFormat.js"; -import {Schema} from "../../utils/schema.js"; import {StateArgs} from "./beacon/state.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/events.ts b/packages/api/src/beacon/routes/events.ts index 5fa218bc02f3..81bd6e7a7f5e 100644 --- a/packages/api/src/beacon/routes/events.ts +++ b/packages/api/src/beacon/routes/events.ts @@ -1,27 +1,27 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; +import {ForkName} from "@lodestar/params"; import { + Attestation, + AttesterSlashing, Epoch, - phase0, - capella, + LightClientFinalityUpdate, + LightClientOptimisticUpdate, + RootHex, + SSEPayloadAttributes, Slot, - ssz, StringType, - RootHex, - altair, UintNum64, - LightClientOptimisticUpdate, - LightClientFinalityUpdate, - SSEPayloadAttributes, - Attestation, - AttesterSlashing, + altair, + capella, + phase0, + ssz, sszTypesFor, } from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; -import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import {EmptyMeta, EmptyResponseCodec, EmptyResponseData} from "../../utils/codecs.js"; import {getExecutionForkTypes, getLightClientForkTypes} from "../../utils/fork.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import {VersionType} from "../../utils/metadata.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/lightclient.ts b/packages/api/src/beacon/routes/lightclient.ts index bac73b43ddb2..d3e60a69bae9 100644 --- a/packages/api/src/beacon/routes/lightclient.ts +++ b/packages/api/src/beacon/routes/lightclient.ts @@ -1,27 +1,27 @@ import {ListCompositeType, ValueOf} from "@chainsafe/ssz"; +import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config"; +import {NetworkName, genesisData} from "@lodestar/config/networks"; +import {ForkName, ZERO_HASH} from "@lodestar/params"; import { LightClientBootstrap, LightClientFinalityUpdate, LightClientOptimisticUpdate, LightClientUpdate, - ssz, SyncPeriod, + ssz, } from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; -import {ForkName, ZERO_HASH} from "@lodestar/params"; -import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config"; -import {genesisData, NetworkName} from "@lodestar/config/networks"; -import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; -import {MetaHeader, VersionCodec, VersionMeta} from "../../utils/metadata.js"; -import {getLightClientForkTypes, toForkName} from "../../utils/fork.js"; import { EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, WithVersion, } from "../../utils/codecs.js"; +import {getLightClientForkTypes, toForkName} from "../../utils/fork.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; +import {MetaHeader, VersionCodec, VersionMeta} from "../../utils/metadata.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/lodestar.ts b/packages/api/src/beacon/routes/lodestar.ts index 1d3c62ca2082..81191efd2696 100644 --- a/packages/api/src/beacon/routes/lodestar.ts +++ b/packages/api/src/beacon/routes/lodestar.ts @@ -1,15 +1,15 @@ import {ChainForkConfig} from "@lodestar/config"; import {Epoch, RootHex, Slot} from "@lodestar/types"; -import {Schema, Endpoint, RouteDefinitions} from "../../utils/index.js"; import { EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, EmptyResponseData, JsonOnlyResponseCodec, } from "../../utils/codecs.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import {FilterGetPeers, NodePeer, PeerDirection, PeerState} from "./node.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/node.ts b/packages/api/src/beacon/routes/node.ts index c7a6c2e36361..e98c0f42ec56 100644 --- a/packages/api/src/beacon/routes/node.ts +++ b/packages/api/src/beacon/routes/node.ts @@ -1,19 +1,19 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {ssz, stringType} from "@lodestar/types"; -import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import { ArrayOf, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, EmptyResponseData, JsonOnlyResponseCodec, } from "../../utils/codecs.js"; import {HttpStatusCode} from "../../utils/httpStatusCode.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import {WireFormat} from "../../utils/wireFormat.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/routes/proof.ts b/packages/api/src/beacon/routes/proof.ts index 0c6d5a058cea..63f6765e3873 100644 --- a/packages/api/src/beacon/routes/proof.ts +++ b/packages/api/src/beacon/routes/proof.ts @@ -1,10 +1,10 @@ import {CompactMultiProof, ProofType} from "@chainsafe/persistent-merkle-tree"; import {ByteListType, ContainerType} from "@chainsafe/ssz"; -import {fromHex, toHex} from "@lodestar/utils"; import {ChainForkConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; -import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; +import {fromHex, toHex} from "@lodestar/utils"; import {ArrayOf} from "../../utils/codecs.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import {VersionCodec, VersionMeta} from "../../utils/metadata.js"; export const CompactMultiProofType = new ContainerType({ diff --git a/packages/api/src/beacon/routes/validator.ts b/packages/api/src/beacon/routes/validator.ts index cf30d5748a46..313459f4db97 100644 --- a/packages/api/src/beacon/routes/validator.ts +++ b/packages/api/src/beacon/routes/validator.ts @@ -2,27 +2,24 @@ import {ContainerType, Type, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {isForkBlobs, isForkPostElectra} from "@lodestar/params"; import { - altair, + Attestation, BLSSignature, + BeaconBlockOrContents, + BlindedBeaconBlock, CommitteeIndex, Epoch, - phase0, + ProducedBlockSource, Root, Slot, - ssz, UintBn64, ValidatorIndex, - ProducedBlockSource, - stringType, - BeaconBlockOrContents, - BlindedBeaconBlock, - Attestation, + altair, + phase0, + ssz, sszTypesFor, + stringType, } from "@lodestar/types"; import {fromHex, toHex, toRootHex} from "@lodestar/utils"; -import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; -import {fromGraffitiHex, toBoolean, toGraffitiHex} from "../../utils/serdes.js"; -import {getExecutionForkTypes, toForkName} from "../../utils/fork.js"; import { ArrayOf, EmptyMeta, @@ -33,6 +30,9 @@ import { WithMeta, WithVersion, } from "../../utils/codecs.js"; +import {getExecutionForkTypes, toForkName} from "../../utils/fork.js"; +import {fromHeaders} from "../../utils/headers.js"; +import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; import { ExecutionOptimisticAndDependentRootCodec, ExecutionOptimisticAndDependentRootMeta, @@ -43,7 +43,7 @@ import { VersionMeta, VersionType, } from "../../utils/metadata.js"; -import {fromHeaders} from "../../utils/headers.js"; +import {fromGraffitiHex, toBoolean, toGraffitiHex} from "../../utils/serdes.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/beacon/server/events.ts b/packages/api/src/beacon/server/events.ts index b9027ab1879d..a68edb6c4146 100644 --- a/packages/api/src/beacon/server/events.ts +++ b/packages/api/src/beacon/server/events.ts @@ -1,6 +1,6 @@ import {ChainForkConfig} from "@lodestar/config"; import {ApiError, ApplicationMethods, FastifyRoutes, createFastifyRoutes} from "../../utils/server/index.js"; -import {Endpoints, getDefinitions, eventTypes, getEventSerdes} from "../routes/events.js"; +import {Endpoints, eventTypes, getDefinitions, getEventSerdes} from "../routes/events.js"; export function getRoutes(config: ChainForkConfig, methods: ApplicationMethods): FastifyRoutes { const eventSerdes = getEventSerdes(config); diff --git a/packages/api/src/beacon/server/index.ts b/packages/api/src/beacon/server/index.ts index 304f4d42be17..cc5005aa2740 100644 --- a/packages/api/src/beacon/server/index.ts +++ b/packages/api/src/beacon/server/index.ts @@ -1,5 +1,5 @@ -import type {FastifyInstance} from "fastify"; import {ChainForkConfig} from "@lodestar/config"; +import type {FastifyInstance} from "fastify"; import {ApplicationMethods, FastifyRoute} from "../../utils/server/index.js"; import {Endpoints} from "../routes/index.js"; diff --git a/packages/api/src/builder/index.ts b/packages/api/src/builder/index.ts index d1d9d31a17ab..9497cd5e95ba 100644 --- a/packages/api/src/builder/index.ts +++ b/packages/api/src/builder/index.ts @@ -1,7 +1,7 @@ import {ChainForkConfig} from "@lodestar/config"; import {HttpClient, HttpClientModules, HttpClientOptions, IHttpClient} from "../utils/client/httpClient.js"; -import {Endpoints} from "./routes.js"; import type {ApiClient} from "./client.js"; +import {Endpoints} from "./routes.js"; import * as builder from "./client.js"; diff --git a/packages/api/src/builder/routes.ts b/packages/api/src/builder/routes.ts index 3911a515e1c6..91042539f96b 100644 --- a/packages/api/src/builder/routes.ts +++ b/packages/api/src/builder/routes.ts @@ -1,27 +1,25 @@ +import {ChainForkConfig} from "@lodestar/config"; +import {ForkName, isForkBlobs} from "@lodestar/params"; import { - ssz, - bellatrix, - Slot, - Root, BLSPubkey, ExecutionPayload, ExecutionPayloadAndBlobsBundle, + Root, SignedBlindedBeaconBlock, SignedBuilderBid, + Slot, WithOptionalBytes, + bellatrix, + ssz, } from "@lodestar/types"; -import {ForkName, isForkBlobs} from "@lodestar/params"; -import {ChainForkConfig} from "@lodestar/config"; import {fromHex, toPubkeyHex, toRootHex} from "@lodestar/utils"; -import {Endpoint, RouteDefinitions, Schema} from "../utils/index.js"; -import {MetaHeader, VersionCodec, VersionMeta} from "../utils/metadata.js"; import { ArrayOf, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, EmptyResponseData, JsonOnlyReq, @@ -29,6 +27,8 @@ import { } from "../utils/codecs.js"; import {getBlobsForkTypes, getExecutionForkTypes, toForkName} from "../utils/fork.js"; import {fromHeaders} from "../utils/headers.js"; +import {Endpoint, RouteDefinitions, Schema} from "../utils/index.js"; +import {MetaHeader, VersionCodec, VersionMeta} from "../utils/metadata.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes diff --git a/packages/api/src/builder/server/index.ts b/packages/api/src/builder/server/index.ts index 888d6bb64bec..5e59e5d9807b 100644 --- a/packages/api/src/builder/server/index.ts +++ b/packages/api/src/builder/server/index.ts @@ -1,8 +1,8 @@ -import type {FastifyInstance} from "fastify"; import {ChainForkConfig} from "@lodestar/config"; +import type {FastifyInstance} from "fastify"; +import {AnyEndpoint} from "../../utils/codecs.js"; import {ApplicationMethods, FastifyRoute, FastifyRoutes, createFastifyRoutes} from "../../utils/server/index.js"; import {Endpoints, getDefinitions} from "../routes.js"; -import {AnyEndpoint} from "../../utils/codecs.js"; export type BuilderApiMethods = ApplicationMethods; diff --git a/packages/api/src/keymanager/index.ts b/packages/api/src/keymanager/index.ts index 44252acce494..24e7e08da444 100644 --- a/packages/api/src/keymanager/index.ts +++ b/packages/api/src/keymanager/index.ts @@ -1,5 +1,5 @@ import {ChainForkConfig} from "@lodestar/config"; -import {IHttpClient, HttpClient, HttpClientModules, HttpClientOptions} from "../utils/client/index.js"; +import {HttpClient, HttpClientModules, HttpClientOptions, IHttpClient} from "../utils/client/index.js"; import type {ApiClient} from "./client.js"; import * as keymanager from "./client.js"; diff --git a/packages/api/src/keymanager/routes.ts b/packages/api/src/keymanager/routes.ts index c31ae5a04454..05eddeefd604 100644 --- a/packages/api/src/keymanager/routes.ts +++ b/packages/api/src/keymanager/routes.ts @@ -1,19 +1,19 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {Epoch, phase0, ssz, stringType} from "@lodestar/types"; -import {Schema, Endpoint, RouteDefinitions} from "../utils/index.js"; -import {WireFormat} from "../utils/wireFormat.js"; import { EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyMetaCodec, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, EmptyResponseData, JsonOnlyReq, JsonOnlyResponseCodec, } from "../utils/codecs.js"; +import {Endpoint, RouteDefinitions, Schema} from "../utils/index.js"; +import {WireFormat} from "../utils/wireFormat.js"; export enum ImportStatus { /** Keystore successfully decrypted and imported to keymanager permanent storage */ diff --git a/packages/api/src/keymanager/server/index.ts b/packages/api/src/keymanager/server/index.ts index f4d0e75f971e..065bcb5ac5d8 100644 --- a/packages/api/src/keymanager/server/index.ts +++ b/packages/api/src/keymanager/server/index.ts @@ -1,8 +1,8 @@ -import type {FastifyInstance} from "fastify"; import {ChainForkConfig} from "@lodestar/config"; +import type {FastifyInstance} from "fastify"; +import {AnyEndpoint} from "../../utils/codecs.js"; import {ApplicationMethods, FastifyRoute, FastifyRoutes, createFastifyRoutes} from "../../utils/server/index.js"; import {Endpoints, getDefinitions} from "../routes.js"; -import {AnyEndpoint} from "../../utils/codecs.js"; export type KeymanagerApiMethods = ApplicationMethods; diff --git a/packages/api/src/utils/client/httpClient.ts b/packages/api/src/utils/client/httpClient.ts index 33b93e3a9d41..85585e8f40f7 100644 --- a/packages/api/src/utils/client/httpClient.ts +++ b/packages/api/src/utils/client/httpClient.ts @@ -1,8 +1,10 @@ import {ErrorAborted, Logger, MapDef, TimeoutError, isValidHttpUrl, retry, toPrintableUrl} from "@lodestar/utils"; import {mergeHeaders} from "../headers.js"; +import {HttpStatusCode} from "../httpStatusCode.js"; import {Endpoint} from "../types.js"; import {WireFormat} from "../wireFormat.js"; -import {HttpStatusCode} from "../httpStatusCode.js"; +import {fetch, isFetchError} from "./fetch.js"; +import {Metrics} from "./metrics.js"; import { ApiRequestInit, ApiRequestInitRequired, @@ -13,8 +15,6 @@ import { createApiRequest, } from "./request.js"; import {ApiResponse} from "./response.js"; -import {Metrics} from "./metrics.js"; -import {fetch, isFetchError} from "./fetch.js"; /** A higher default timeout, validator will set its own shorter timeoutMs */ const DEFAULT_TIMEOUT_MS = 60_000; diff --git a/packages/api/src/utils/codecs.ts b/packages/api/src/utils/codecs.ts index c075d8592a46..fad6396af085 100644 --- a/packages/api/src/utils/codecs.ts +++ b/packages/api/src/utils/codecs.ts @@ -2,12 +2,12 @@ import {ArrayType, ListBasicType, ListCompositeType, Type, isBasicType, isCompos import {ForkName} from "@lodestar/params"; import {objectToExpectedCase} from "@lodestar/utils"; import { - RequestWithoutBodyCodec, + Endpoint, RequestWithBodyCodec, + RequestWithoutBodyCodec, ResponseCodec, ResponseDataCodec, ResponseMetadataCodec, - Endpoint, SszRequestMethods, } from "./types.js"; import {WireFormat} from "./wireFormat.js"; diff --git a/packages/api/src/utils/metadata.ts b/packages/api/src/utils/metadata.ts index 2ee9b2f51f0e..6186c06a7047 100644 --- a/packages/api/src/utils/metadata.ts +++ b/packages/api/src/utils/metadata.ts @@ -1,10 +1,10 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ForkName} from "@lodestar/params"; import {StringType, ssz, stringType} from "@lodestar/types"; -import {ResponseMetadataCodec} from "./types.js"; -import {toBoolean} from "./serdes.js"; import {toForkName} from "./fork.js"; import {HttpHeader} from "./headers.js"; +import {toBoolean} from "./serdes.js"; +import {ResponseMetadataCodec} from "./types.js"; export const VersionType = new ContainerType({ /** diff --git a/packages/api/src/utils/server/handler.ts b/packages/api/src/utils/server/handler.ts index 035f4328141a..b444d263cf09 100644 --- a/packages/api/src/utils/server/handler.ts +++ b/packages/api/src/utils/server/handler.ts @@ -2,15 +2,15 @@ import type * as fastify from "fastify"; import {HttpHeader, MediaType, SUPPORTED_MEDIA_TYPES, parseAcceptHeader, parseContentTypeHeader} from "../headers.js"; import { Endpoint, - RequestData, JsonRequestData, JsonRequestMethods, + RequestData, RequestWithBodyCodec, + RequestWithoutBodyCodec, RouteDefinition, SszRequestData, SszRequestMethods, isRequestWithoutBody, - RequestWithoutBodyCodec, } from "../types.js"; import {WireFormat, fromWireFormat, getWireFormat} from "../wireFormat.js"; import {ApiError} from "./error.js"; diff --git a/packages/api/src/utils/server/route.ts b/packages/api/src/utils/server/route.ts index aa04a1f11cf7..26bf07b6790e 100644 --- a/packages/api/src/utils/server/route.ts +++ b/packages/api/src/utils/server/route.ts @@ -1,5 +1,5 @@ -import type * as fastify from "fastify"; import {mapValues} from "@lodestar/utils"; +import type * as fastify from "fastify"; import {getFastifySchema} from "../schema.js"; import {Endpoint, RouteDefinition, RouteDefinitions} from "../types.js"; import {toColonNotationPath} from "../urlFormat.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/beacon.test.ts b/packages/api/test/unit/beacon/genericServerTest/beacon.test.ts index f8c13b33afb6..5f2c2d4d50e7 100644 --- a/packages/api/test/unit/beacon/genericServerTest/beacon.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/beacon.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {Endpoints} from "../../../../src/beacon/routes/beacon/index.js"; +import {describe} from "vitest"; import {getClient} from "../../../../src/beacon/client/beacon.js"; +import {Endpoints} from "../../../../src/beacon/routes/beacon/index.js"; import {getRoutes} from "../../../../src/beacon/server/beacon.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/beacon.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/config.test.ts b/packages/api/test/unit/beacon/genericServerTest/config.test.ts index 91075f96d1e3..a66eb1768e2c 100644 --- a/packages/api/test/unit/beacon/genericServerTest/config.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/config.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/config.js"; +import {describe, expect, it} from "vitest"; import {getClient} from "../../../../src/beacon/client/config.js"; +import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/config.js"; import {getRoutes} from "../../../../src/beacon/server/config.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/config.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/debug.test.ts b/packages/api/test/unit/beacon/genericServerTest/debug.test.ts index f329382dbe46..d6140fa20512 100644 --- a/packages/api/test/unit/beacon/genericServerTest/debug.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/debug.test.ts @@ -1,19 +1,19 @@ -import {describe, it, expect, beforeAll, afterAll, vi} from "vitest"; import {toHexString} from "@chainsafe/ssz"; -import {FastifyInstance} from "fastify"; +import {config} from "@lodestar/config/default"; import {ForkName} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {config} from "@lodestar/config/default"; -import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/debug.js"; +import {FastifyInstance} from "fastify"; +import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; import {getClient} from "../../../../src/beacon/client/debug.js"; +import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/debug.js"; import {getRoutes} from "../../../../src/beacon/server/debug.js"; -import {runGenericServerTest} from "../../../utils/genericServerTest.js"; -import {getMockApi, getTestServer} from "../../../utils/utils.js"; import {HttpClient} from "../../../../src/utils/client/httpClient.js"; -import {testData} from "../testData/debug.js"; -import {FastifyRoute} from "../../../../src/utils/server/index.js"; import {AnyEndpoint} from "../../../../src/utils/codecs.js"; +import {FastifyRoute} from "../../../../src/utils/server/index.js"; import {WireFormat} from "../../../../src/utils/wireFormat.js"; +import {runGenericServerTest} from "../../../utils/genericServerTest.js"; +import {getMockApi, getTestServer} from "../../../utils/utils.js"; +import {testData} from "../testData/debug.js"; describe("beacon / debug", () => { // Extend timeout since states are very big diff --git a/packages/api/test/unit/beacon/genericServerTest/events.test.ts b/packages/api/test/unit/beacon/genericServerTest/events.test.ts index 16123ec624e8..c0480c8368c9 100644 --- a/packages/api/test/unit/beacon/genericServerTest/events.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/events.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeEach, afterEach, beforeAll, afterAll} from "vitest"; -import {FastifyInstance} from "fastify"; -import {sleep} from "@lodestar/utils"; import {config} from "@lodestar/config/default"; -import {Endpoints, getDefinitions, EventType, BeaconEvent} from "../../../../src/beacon/routes/events.js"; +import {sleep} from "@lodestar/utils"; +import {FastifyInstance} from "fastify"; +import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from "vitest"; import {getClient} from "../../../../src/beacon/client/events.js"; +import {BeaconEvent, Endpoints, EventType, getDefinitions} from "../../../../src/beacon/routes/events.js"; import {getRoutes} from "../../../../src/beacon/server/events.js"; import {getMockApi, getTestServer} from "../../../utils/utils.js"; import {eventTestData} from "../testData/events.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/lightclient.test.ts b/packages/api/test/unit/beacon/genericServerTest/lightclient.test.ts index 5bf8b7827161..84c06d2a0d17 100644 --- a/packages/api/test/unit/beacon/genericServerTest/lightclient.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/lightclient.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints} from "../../../../src/beacon/routes/lightclient.js"; +import {describe} from "vitest"; import {getClient} from "../../../../src/beacon/client/lightclient.js"; +import {Endpoints} from "../../../../src/beacon/routes/lightclient.js"; import {getRoutes} from "../../../../src/beacon/server/lightclient.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/lightclient.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/node.test.ts b/packages/api/test/unit/beacon/genericServerTest/node.test.ts index 0affaf014c4a..c54737b387ae 100644 --- a/packages/api/test/unit/beacon/genericServerTest/node.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/node.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints} from "../../../../src/beacon/routes/node.js"; +import {describe} from "vitest"; import {getClient} from "../../../../src/beacon/client/node.js"; +import {Endpoints} from "../../../../src/beacon/routes/node.js"; import {getRoutes} from "../../../../src/beacon/server/node.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/node.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/proofs.test.ts b/packages/api/test/unit/beacon/genericServerTest/proofs.test.ts index d31137886e2f..518c3f70381d 100644 --- a/packages/api/test/unit/beacon/genericServerTest/proofs.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/proofs.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints} from "../../../../src/beacon/routes/proof.js"; +import {describe} from "vitest"; import {getClient} from "../../../../src/beacon/client/proof.js"; +import {Endpoints} from "../../../../src/beacon/routes/proof.js"; import {getRoutes} from "../../../../src/beacon/server/proof.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/proofs.js"; diff --git a/packages/api/test/unit/beacon/genericServerTest/validator.test.ts b/packages/api/test/unit/beacon/genericServerTest/validator.test.ts index 0aed65cd6f17..650bc6c8f9a2 100644 --- a/packages/api/test/unit/beacon/genericServerTest/validator.test.ts +++ b/packages/api/test/unit/beacon/genericServerTest/validator.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints} from "../../../../src/beacon/routes/validator.js"; +import {describe} from "vitest"; import {getClient} from "../../../../src/beacon/client/validator.js"; +import {Endpoints} from "../../../../src/beacon/routes/validator.js"; import {getRoutes} from "../../../../src/beacon/server/validator.js"; import {runGenericServerTest} from "../../../utils/genericServerTest.js"; import {testData} from "../testData/validator.js"; diff --git a/packages/api/test/unit/beacon/oapiSpec.test.ts b/packages/api/test/unit/beacon/oapiSpec.test.ts index f6a38505e264..a3033355c984 100644 --- a/packages/api/test/unit/beacon/oapiSpec.test.ts +++ b/packages/api/test/unit/beacon/oapiSpec.test.ts @@ -1,11 +1,11 @@ import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, beforeAll, expect} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; +import {beforeAll, describe, expect, it} from "vitest"; import {routes} from "../../../src/beacon/index.js"; import {IgnoredProperty, runTestCheckAgainstSpec} from "../../utils/checkAgainstSpec.js"; import {fetchOpenApiSpec} from "../../utils/fetchOpenApiSpec.js"; +import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; // Import all testData and merge below import {testData as beaconTestData} from "./testData/beacon.js"; import {testData as configTestData} from "./testData/config.js"; diff --git a/packages/api/test/unit/beacon/testData/config.ts b/packages/api/test/unit/beacon/testData/config.ts index dddc90ae6b25..ab0437650df7 100644 --- a/packages/api/test/unit/beacon/testData/config.ts +++ b/packages/api/test/unit/beacon/testData/config.ts @@ -1,7 +1,7 @@ -import {ssz} from "@lodestar/types"; import {chainConfigToJson} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; import {activePreset, presetToJson} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {Endpoints} from "../../../../src/beacon/routes/config.js"; import {GenericServerTestCases} from "../../../utils/genericServerTest.js"; diff --git a/packages/api/test/unit/beacon/testData/events.ts b/packages/api/test/unit/beacon/testData/events.ts index 3d2ffb708965..c9ba39d24efe 100644 --- a/packages/api/test/unit/beacon/testData/events.ts +++ b/packages/api/test/unit/beacon/testData/events.ts @@ -1,5 +1,5 @@ -import {ssz} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {Endpoints, EventData, EventType, blobSidecarSSE} from "../../../../src/beacon/routes/events.js"; import {GenericServerTestCases} from "../../../utils/genericServerTest.js"; diff --git a/packages/api/test/unit/beacon/testData/lightclient.ts b/packages/api/test/unit/beacon/testData/lightclient.ts index f405d514fc5d..715f823a1d29 100644 --- a/packages/api/test/unit/beacon/testData/lightclient.ts +++ b/packages/api/test/unit/beacon/testData/lightclient.ts @@ -1,6 +1,6 @@ import {toHexString} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {Endpoints} from "../../../../src/beacon/routes/lightclient.js"; import {GenericServerTestCases} from "../../../utils/genericServerTest.js"; diff --git a/packages/api/test/unit/beacon/testData/validator.ts b/packages/api/test/unit/beacon/testData/validator.ts index d4fae4bfe290..327100cedab1 100644 --- a/packages/api/test/unit/beacon/testData/validator.ts +++ b/packages/api/test/unit/beacon/testData/validator.ts @@ -1,5 +1,5 @@ import {ForkName} from "@lodestar/params"; -import {ssz, ProducedBlockSource} from "@lodestar/types"; +import {ProducedBlockSource, ssz} from "@lodestar/types"; import {BuilderSelection, Endpoints} from "../../../../src/beacon/routes/validator.js"; import {GenericServerTestCases} from "../../../utils/genericServerTest.js"; diff --git a/packages/api/test/unit/builder/builder.test.ts b/packages/api/test/unit/builder/builder.test.ts index d2e25916069e..00a38563a100 100644 --- a/packages/api/test/unit/builder/builder.test.ts +++ b/packages/api/test/unit/builder/builder.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {Endpoints} from "../../../src/builder/routes.js"; +import {describe} from "vitest"; import {getClient} from "../../../src/builder/client.js"; +import {Endpoints} from "../../../src/builder/routes.js"; import {getRoutes} from "../../../src/builder/server/index.js"; import {runGenericServerTest} from "../../utils/genericServerTest.js"; import {testData} from "./testData.js"; diff --git a/packages/api/test/unit/builder/oapiSpec.test.ts b/packages/api/test/unit/builder/oapiSpec.test.ts index d972b64905e5..8f567a5c0e1e 100644 --- a/packages/api/test/unit/builder/oapiSpec.test.ts +++ b/packages/api/test/unit/builder/oapiSpec.test.ts @@ -2,10 +2,10 @@ import path from "node:path"; import {fileURLToPath} from "node:url"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; import {getDefinitions} from "../../../src/builder/routes.js"; import {runTestCheckAgainstSpec} from "../../utils/checkAgainstSpec.js"; import {fetchOpenApiSpec} from "../../utils/fetchOpenApiSpec.js"; +import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; import {testData} from "./testData.js"; // Global variable __dirname no longer available in ES6 modules. diff --git a/packages/api/test/unit/builder/testData.ts b/packages/api/test/unit/builder/testData.ts index a807620258df..ad0ce95f5a8b 100644 --- a/packages/api/test/unit/builder/testData.ts +++ b/packages/api/test/unit/builder/testData.ts @@ -1,6 +1,6 @@ import {fromHexString} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {Endpoints} from "../../../src/builder/routes.js"; import {GenericServerTestCases} from "../../utils/genericServerTest.js"; diff --git a/packages/api/test/unit/client/fetch.test.ts b/packages/api/test/unit/client/fetch.test.ts index 1faf7d979a02..067e97e4ba6a 100644 --- a/packages/api/test/unit/client/fetch.test.ts +++ b/packages/api/test/unit/client/fetch.test.ts @@ -1,6 +1,6 @@ import crypto from "node:crypto"; import http from "node:http"; -import {describe, it, expect, afterEach} from "vitest"; +import {afterEach, describe, expect, it} from "vitest"; import {FetchError, FetchErrorType, fetch} from "../../../src/utils/client/fetch.js"; describe("FetchError", () => { diff --git a/packages/api/test/unit/client/httpClient.test.ts b/packages/api/test/unit/client/httpClient.test.ts index 577b860c4cca..aa689967f7b4 100644 --- a/packages/api/test/unit/client/httpClient.test.ts +++ b/packages/api/test/unit/client/httpClient.test.ts @@ -1,26 +1,26 @@ import {IncomingMessage} from "node:http"; -import {describe, it, afterEach, expect, vi} from "vitest"; -import {RouteOptions, fastify} from "fastify"; import {BooleanType, ContainerType, UintNumberType, ValueOf} from "@chainsafe/ssz"; import {ErrorAborted, TimeoutError, toBase64} from "@lodestar/utils"; +import {RouteOptions, fastify} from "fastify"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {WireFormat} from "../../../src/index.js"; +import {addSszContentTypeParser} from "../../../src/server/index.js"; import {HttpClient, RouteDefinitionExtra} from "../../../src/utils/client/index.js"; -import {HttpStatusCode} from "../../../src/utils/httpStatusCode.js"; import { AnyEndpoint, EmptyArgs, - EmptyRequestCodec, EmptyMeta, EmptyRequest, + EmptyRequestCodec, EmptyResponseCodec, + EmptyResponseData, JsonOnlyReq, JsonOnlyResponseCodec, - EmptyResponseData, } from "../../../src/utils/codecs.js"; -import {compileRouteUrlFormatter} from "../../../src/utils/urlFormat.js"; -import {Endpoint, Schema} from "../../../src/utils/index.js"; -import {WireFormat} from "../../../src/index.js"; import {HttpHeader, MediaType} from "../../../src/utils/headers.js"; -import {addSszContentTypeParser} from "../../../src/server/index.js"; +import {HttpStatusCode} from "../../../src/utils/httpStatusCode.js"; +import {Endpoint, Schema} from "../../../src/utils/index.js"; +import {compileRouteUrlFormatter} from "../../../src/utils/urlFormat.js"; /* eslint-disable @typescript-eslint/return-await */ diff --git a/packages/api/test/unit/client/httpClientOptions.test.ts b/packages/api/test/unit/client/httpClientOptions.test.ts index 9bc7ab2bfaf8..b2eb374e26c9 100644 --- a/packages/api/test/unit/client/httpClientOptions.test.ts +++ b/packages/api/test/unit/client/httpClientOptions.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {HttpClient} from "../../../src/index.js"; describe("HTTPClient options", () => { diff --git a/packages/api/test/unit/client/urlFormat.test.ts b/packages/api/test/unit/client/urlFormat.test.ts index 5132044b7631..a97a2dfe94a1 100644 --- a/packages/api/test/unit/client/urlFormat.test.ts +++ b/packages/api/test/unit/client/urlFormat.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { - compileRouteUrlFormatter, - toColonNotationPath, Token, TokenType, + compileRouteUrlFormatter, + toColonNotationPath, urlToTokens, } from "../../../src/utils/urlFormat.js"; diff --git a/packages/api/test/unit/keymanager/keymanager.test.ts b/packages/api/test/unit/keymanager/keymanager.test.ts index 42e6a3dbf511..64778dcab7fc 100644 --- a/packages/api/test/unit/keymanager/keymanager.test.ts +++ b/packages/api/test/unit/keymanager/keymanager.test.ts @@ -1,7 +1,7 @@ -import {describe} from "vitest"; import {config} from "@lodestar/config/default"; -import {Endpoints} from "../../../src/keymanager/routes.js"; +import {describe} from "vitest"; import {getClient} from "../../../src/keymanager/client.js"; +import {Endpoints} from "../../../src/keymanager/routes.js"; import {getRoutes} from "../../../src/keymanager/server/index.js"; import {runGenericServerTest} from "../../utils/genericServerTest.js"; import {testData} from "./testData.js"; diff --git a/packages/api/test/unit/keymanager/oapiSpec.test.ts b/packages/api/test/unit/keymanager/oapiSpec.test.ts index aab4e1823ab0..d3817598029b 100644 --- a/packages/api/test/unit/keymanager/oapiSpec.test.ts +++ b/packages/api/test/unit/keymanager/oapiSpec.test.ts @@ -1,10 +1,10 @@ import path from "node:path"; import {fileURLToPath} from "node:url"; import {config} from "@lodestar/config/default"; -import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; import {getDefinitions} from "../../../src/keymanager/routes.js"; import {runTestCheckAgainstSpec} from "../../utils/checkAgainstSpec.js"; import {fetchOpenApiSpec} from "../../utils/fetchOpenApiSpec.js"; +import {OpenApiFile} from "../../utils/parseOpenApiSpec.js"; import {testData} from "./testData.js"; // Global variable __dirname no longer available in ES6 modules. diff --git a/packages/api/test/unit/utils/headers.test.ts b/packages/api/test/unit/utils/headers.test.ts index 3416335b0dcd..a96a36233505 100644 --- a/packages/api/test/unit/utils/headers.test.ts +++ b/packages/api/test/unit/utils/headers.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {MediaType, SUPPORTED_MEDIA_TYPES, mergeHeaders, parseAcceptHeader} from "../../../src/utils/headers.js"; describe("utils / headers", () => { diff --git a/packages/api/test/unit/utils/serdes.test.ts b/packages/api/test/unit/utils/serdes.test.ts index 5b55ef66805e..e9e178782bb2 100644 --- a/packages/api/test/unit/utils/serdes.test.ts +++ b/packages/api/test/unit/utils/serdes.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {fromGraffitiHex, toGraffitiHex} from "../../../src/utils/serdes.js"; describe("utils / serdes", () => { diff --git a/packages/api/test/utils/checkAgainstSpec.ts b/packages/api/test/utils/checkAgainstSpec.ts index a3f943ad4816..be076dfeb381 100644 --- a/packages/api/test/utils/checkAgainstSpec.ts +++ b/packages/api/test/utils/checkAgainstSpec.ts @@ -1,9 +1,9 @@ import Ajv, {ErrorObject} from "ajv"; -import {expect, describe, beforeAll, it} from "vitest"; -import {WireFormat} from "../../src/utils/wireFormat.js"; +import {beforeAll, describe, expect, it} from "vitest"; import {Endpoint, RequestWithBodyCodec, RouteDefinitions, isRequestWithoutBody} from "../../src/utils/types.js"; -import {applyRecursively, JsonSchema, OpenApiJson, parseOpenApiSpec} from "./parseOpenApiSpec.js"; +import {WireFormat} from "../../src/utils/wireFormat.js"; import {GenericServerTestCases} from "./genericServerTest.js"; +import {JsonSchema, OpenApiJson, applyRecursively, parseOpenApiSpec} from "./parseOpenApiSpec.js"; const ajv = new Ajv({ strict: true, diff --git a/packages/api/test/utils/genericServerTest.ts b/packages/api/test/utils/genericServerTest.ts index 1c01bb449306..3223ff5ca5a5 100644 --- a/packages/api/test/utils/genericServerTest.ts +++ b/packages/api/test/utils/genericServerTest.ts @@ -1,10 +1,10 @@ -import {it, expect, describe, beforeAll, afterAll, MockInstance} from "vitest"; -import {FastifyInstance} from "fastify"; import {ChainForkConfig} from "@lodestar/config"; +import {FastifyInstance} from "fastify"; +import {MockInstance, afterAll, beforeAll, describe, expect, it} from "vitest"; +import {ApiClientMethods, ApiRequestInit, HttpClient, IHttpClient} from "../../src/utils/client/index.js"; import {Endpoint} from "../../src/utils/index.js"; -import {WireFormat} from "../../src/utils/wireFormat.js"; import {ApplicationMethods, ApplicationResponse, FastifyRoutes} from "../../src/utils/server/index.js"; -import {ApiClientMethods, ApiRequestInit, HttpClient, IHttpClient} from "../../src/utils/client/index.js"; +import {WireFormat} from "../../src/utils/wireFormat.js"; import {getMockApi, getTestServer} from "./utils.js"; export type GenericServerTestCases> = { diff --git a/packages/api/test/utils/utils.ts b/packages/api/test/utils/utils.ts index d3ecbc964435..26302db60792 100644 --- a/packages/api/test/utils/utils.ts +++ b/packages/api/test/utils/utils.ts @@ -1,7 +1,7 @@ -import {MockedObject, vi} from "vitest"; -import {parse as parseQueryString} from "qs"; -import {FastifyInstance, fastify} from "fastify"; import {mapValues} from "@lodestar/utils"; +import {FastifyInstance, fastify} from "fastify"; +import {parse as parseQueryString} from "qs"; +import {MockedObject, vi} from "vitest"; import {Endpoint} from "../../src/utils/index.js"; import {ApplicationMethods, addSszContentTypeParser} from "../../src/utils/server/index.js"; diff --git a/packages/beacon-node/src/api/impl/api.ts b/packages/beacon-node/src/api/impl/api.ts index 3647feed2d7c..65d79112f50c 100644 --- a/packages/beacon-node/src/api/impl/api.ts +++ b/packages/beacon-node/src/api/impl/api.ts @@ -1,6 +1,5 @@ import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {ApiOptions} from "../options.js"; -import {ApiModules} from "./types.js"; import {getBeaconApi} from "./beacon/index.js"; import {getConfigApi} from "./config/index.js"; import {getDebugApi} from "./debug/index.js"; @@ -9,6 +8,7 @@ import {getLightclientApi} from "./lightclient/index.js"; import {getLodestarApi} from "./lodestar/index.js"; import {getNodeApi} from "./node/index.js"; import {getProofApi} from "./proof/index.js"; +import {ApiModules} from "./types.js"; import {getValidatorApi} from "./validator/index.js"; export function getApi(opts: ApiOptions, modules: ApiModules): BeaconApiMethods { diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts index 2d36505d822a..bda72bc3b997 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -1,40 +1,40 @@ import {routes} from "@lodestar/api"; import {ApiError, ApplicationMethods} from "@lodestar/api/server"; +import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution, isForkPostElectra} from "@lodestar/params"; import { computeEpochAtSlot, computeTimeAtSlot, reconstructFullBlockOrContents, signedBeaconBlockToBlinded, } from "@lodestar/state-transition"; -import {ForkExecution, SLOTS_PER_HISTORICAL_ROOT, isForkExecution, isForkPostElectra} from "@lodestar/params"; -import {sleep, fromHex, toRootHex} from "@lodestar/utils"; import { - deneb, - isSignedBlockContents, ProducedBlockSource, SignedBeaconBlock, SignedBeaconBlockOrContents, SignedBlindedBeaconBlock, WithOptionalBytes, + deneb, + isSignedBlockContents, } from "@lodestar/types"; +import {fromHex, sleep, toRootHex} from "@lodestar/utils"; import { - BlockSource, - getBlockInput, - ImportBlockOpts, - BlockInput, BlobsSource, + BlockInput, BlockInputDataBlobs, + BlockSource, + ImportBlockOpts, + getBlockInput, } from "../../../../chain/blocks/types.js"; -import {promiseAllMaybeAsync} from "../../../../util/promises.js"; -import {isOptimisticBlock} from "../../../../util/forkChoice.js"; -import {computeBlobSidecars} from "../../../../util/blobs.js"; +import {verifyBlocksInEpoch} from "../../../../chain/blocks/verifyBlock.js"; +import {BeaconChain} from "../../../../chain/chain.js"; import {BlockError, BlockErrorCode, BlockGossipError} from "../../../../chain/errors/index.js"; +import {validateGossipBlock} from "../../../../chain/validation/block.js"; import {OpSource} from "../../../../metrics/validatorMonitor.js"; import {NetworkEvent} from "../../../../network/index.js"; +import {computeBlobSidecars} from "../../../../util/blobs.js"; +import {isOptimisticBlock} from "../../../../util/forkChoice.js"; +import {promiseAllMaybeAsync} from "../../../../util/promises.js"; import {ApiModules} from "../../types.js"; -import {validateGossipBlock} from "../../../../chain/validation/block.js"; -import {verifyBlocksInEpoch} from "../../../../chain/blocks/verifyBlock.js"; -import {BeaconChain} from "../../../../chain/chain.js"; import {getBlockResponse, toBeaconHeaderResponse} from "./utils.js"; type PublishBlockOpts = ImportBlockOpts; diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/utils.ts b/packages/beacon-node/src/api/impl/beacon/blocks/utils.ts index 44152ff4b8a9..b1030c6de58b 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/utils.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/utils.ts @@ -1,12 +1,12 @@ import {routes} from "@lodestar/api"; -import {blockToHeader} from "@lodestar/state-transition"; import {ChainForkConfig} from "@lodestar/config"; -import {RootHex, SignedBeaconBlock, Slot} from "@lodestar/types"; import {IForkChoice} from "@lodestar/fork-choice"; -import {GENESIS_SLOT} from "../../../../constants/index.js"; -import {ApiError, ValidationError} from "../../errors.js"; +import {blockToHeader} from "@lodestar/state-transition"; +import {RootHex, SignedBeaconBlock, Slot} from "@lodestar/types"; import {IBeaconChain} from "../../../../chain/interface.js"; +import {GENESIS_SLOT} from "../../../../constants/index.js"; import {rootHexRegex} from "../../../../eth1/provider/utils.js"; +import {ApiError, ValidationError} from "../../errors.js"; export function toBeaconHeaderResponse( config: ChainForkConfig, diff --git a/packages/beacon-node/src/api/impl/beacon/index.ts b/packages/beacon-node/src/api/impl/beacon/index.ts index 2e75dc76782c..0003e9c97878 100644 --- a/packages/beacon-node/src/api/impl/beacon/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/index.ts @@ -3,8 +3,8 @@ import {ApplicationMethods} from "@lodestar/api/server"; import {ApiModules} from "../types.js"; import {getBeaconBlockApi} from "./blocks/index.js"; import {getBeaconPoolApi} from "./pool/index.js"; -import {getBeaconStateApi} from "./state/index.js"; import {getBeaconRewardsApi} from "./rewards/index.js"; +import {getBeaconStateApi} from "./state/index.js"; export function getBeaconApi( modules: Pick diff --git a/packages/beacon-node/src/api/impl/beacon/pool/index.ts b/packages/beacon-node/src/api/impl/beacon/pool/index.ts index 9343dd67a399..45fb763d9540 100644 --- a/packages/beacon-node/src/api/impl/beacon/pool/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/pool/index.ts @@ -1,22 +1,22 @@ import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; -import {Attestation, Epoch, isElectraAttestation, ssz} from "@lodestar/types"; import {ForkName, SYNC_COMMITTEE_SUBNET_SIZE, isForkPostElectra} from "@lodestar/params"; -import {validateApiAttestation} from "../../../../chain/validation/index.js"; -import {validateApiAttesterSlashing} from "../../../../chain/validation/attesterSlashing.js"; -import {validateApiProposerSlashing} from "../../../../chain/validation/proposerSlashing.js"; -import {validateApiVoluntaryExit} from "../../../../chain/validation/voluntaryExit.js"; -import {validateApiBlsToExecutionChange} from "../../../../chain/validation/blsToExecutionChange.js"; -import {validateApiSyncCommittee} from "../../../../chain/validation/syncCommittee.js"; -import {ApiModules} from "../../types.js"; +import {Attestation, Epoch, isElectraAttestation, ssz} from "@lodestar/types"; import { AttestationError, AttestationErrorCode, GossipAction, SyncCommitteeError, } from "../../../../chain/errors/index.js"; +import {validateApiAttesterSlashing} from "../../../../chain/validation/attesterSlashing.js"; +import {validateApiBlsToExecutionChange} from "../../../../chain/validation/blsToExecutionChange.js"; +import {validateApiAttestation} from "../../../../chain/validation/index.js"; +import {validateApiProposerSlashing} from "../../../../chain/validation/proposerSlashing.js"; +import {validateApiSyncCommittee} from "../../../../chain/validation/syncCommittee.js"; +import {validateApiVoluntaryExit} from "../../../../chain/validation/voluntaryExit.js"; import {validateGossipFnRetryUnknownRoot} from "../../../../network/processor/gossipHandlers.js"; import {ApiError, FailureList, IndexedError} from "../../errors.js"; +import {ApiModules} from "../../types.js"; export function getBeaconPoolApi({ chain, diff --git a/packages/beacon-node/src/api/impl/beacon/state/index.ts b/packages/beacon-node/src/api/impl/beacon/state/index.ts index a1e17b80ea84..916507cc56fc 100644 --- a/packages/beacon-node/src/api/impl/beacon/state/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/state/index.ts @@ -1,5 +1,6 @@ import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; +import {EPOCHS_PER_HISTORICAL_VECTOR} from "@lodestar/params"; import { BeaconStateAllForks, CachedBeaconStateAltair, @@ -8,12 +9,11 @@ import { getCurrentEpoch, getRandaoMix, } from "@lodestar/state-transition"; -import {EPOCHS_PER_HISTORICAL_VECTOR} from "@lodestar/params"; import {getValidatorStatus} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import {ApiError} from "../../errors.js"; import {ApiModules} from "../../types.js"; -import {filterStateValidatorsByStatus, getStateValidatorIndex, getStateResponse, toValidatorResponse} from "./utils.js"; +import {filterStateValidatorsByStatus, getStateResponse, getStateValidatorIndex, toValidatorResponse} from "./utils.js"; export function getBeaconStateApi({ chain, diff --git a/packages/beacon-node/src/api/impl/beacon/state/utils.ts b/packages/beacon-node/src/api/impl/beacon/state/utils.ts index 392262a563be..f23fd52f0286 100644 --- a/packages/beacon-node/src/api/impl/beacon/state/utils.ts +++ b/packages/beacon-node/src/api/impl/beacon/state/utils.ts @@ -1,10 +1,10 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; import {routes} from "@lodestar/api"; +import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice"; import {GENESIS_SLOT} from "@lodestar/params"; import {BeaconStateAllForks} from "@lodestar/state-transition"; -import {BLSPubkey, Epoch, getValidatorStatus, phase0, RootHex, Slot, ValidatorIndex} from "@lodestar/types"; +import {BLSPubkey, Epoch, RootHex, Slot, ValidatorIndex, getValidatorStatus, phase0} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; -import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice"; import {IBeaconChain} from "../../../../chain/index.js"; import {ApiError, ValidationError} from "../../errors.js"; diff --git a/packages/beacon-node/src/api/impl/config/constants.ts b/packages/beacon-node/src/api/impl/config/constants.ts index e951da35bdd2..c55cfe7008f4 100644 --- a/packages/beacon-node/src/api/impl/config/constants.ts +++ b/packages/beacon-node/src/api/impl/config/constants.ts @@ -1,44 +1,44 @@ import { - GENESIS_SLOT, - GENESIS_EPOCH, - FAR_FUTURE_EPOCH, + ATTESTATION_SUBNET_COUNT, BASE_REWARDS_PER_EPOCH, - DEPOSIT_CONTRACT_TREE_DEPTH, - JUSTIFICATION_BITS_LENGTH, + BLOB_TX_TYPE, BLS_WITHDRAWAL_PREFIX, - ETH1_ADDRESS_WITHDRAWAL_PREFIX, - DOMAIN_BEACON_PROPOSER, + COMPOUNDING_WITHDRAWAL_PREFIX, + DEPOSIT_CONTRACT_TREE_DEPTH, + DOMAIN_AGGREGATE_AND_PROOF, + DOMAIN_APPLICATION_BUILDER, DOMAIN_BEACON_ATTESTER, - DOMAIN_RANDAO, + DOMAIN_BEACON_PROPOSER, + DOMAIN_BLS_TO_EXECUTION_CHANGE, + DOMAIN_CONTRIBUTION_AND_PROOF, DOMAIN_DEPOSIT, - DOMAIN_VOLUNTARY_EXIT, + DOMAIN_RANDAO, DOMAIN_SELECTION_PROOF, - DOMAIN_AGGREGATE_AND_PROOF, DOMAIN_SYNC_COMMITTEE, DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF, - DOMAIN_CONTRIBUTION_AND_PROOF, - DOMAIN_BLS_TO_EXECUTION_CHANGE, - DOMAIN_APPLICATION_BUILDER, - TIMELY_SOURCE_FLAG_INDEX, - TIMELY_TARGET_FLAG_INDEX, - TIMELY_HEAD_FLAG_INDEX, - TIMELY_SOURCE_WEIGHT, - TIMELY_TARGET_WEIGHT, - TIMELY_HEAD_WEIGHT, - SYNC_REWARD_WEIGHT, + DOMAIN_VOLUNTARY_EXIT, + EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, + ETH1_ADDRESS_WITHDRAWAL_PREFIX, + FAR_FUTURE_EPOCH, + FULL_EXIT_REQUEST_AMOUNT, + GENESIS_EPOCH, + GENESIS_SLOT, + JUSTIFICATION_BITS_LENGTH, PROPOSER_WEIGHT, - WEIGHT_DENOMINATOR, - TARGET_AGGREGATORS_PER_COMMITTEE, RANDOM_SUBNETS_PER_VALIDATOR, - EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, - ATTESTATION_SUBNET_COUNT, - TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, SYNC_COMMITTEE_SUBNET_COUNT, - BLOB_TX_TYPE, - VERSIONED_HASH_VERSION_KZG, - COMPOUNDING_WITHDRAWAL_PREFIX, + SYNC_REWARD_WEIGHT, + TARGET_AGGREGATORS_PER_COMMITTEE, + TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, + TIMELY_HEAD_FLAG_INDEX, + TIMELY_HEAD_WEIGHT, + TIMELY_SOURCE_FLAG_INDEX, + TIMELY_SOURCE_WEIGHT, + TIMELY_TARGET_FLAG_INDEX, + TIMELY_TARGET_WEIGHT, UNSET_DEPOSIT_REQUESTS_START_INDEX, - FULL_EXIT_REQUEST_AMOUNT, + VERSIONED_HASH_VERSION_KZG, + WEIGHT_DENOMINATOR, } from "@lodestar/params"; /** diff --git a/packages/beacon-node/src/api/impl/config/index.ts b/packages/beacon-node/src/api/impl/config/index.ts index 9b8694aa5914..f9d3924430ad 100644 --- a/packages/beacon-node/src/api/impl/config/index.ts +++ b/packages/beacon-node/src/api/impl/config/index.ts @@ -1,6 +1,6 @@ import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; -import {chainConfigToJson, ChainConfig, specValuesToJson} from "@lodestar/config"; +import {ChainConfig, chainConfigToJson, specValuesToJson} from "@lodestar/config"; import {activePreset, presetToJson} from "@lodestar/params"; import {ApiModules} from "../types.js"; import {specConstants} from "./constants.js"; diff --git a/packages/beacon-node/src/api/impl/debug/index.ts b/packages/beacon-node/src/api/impl/debug/index.ts index e5b6450b206f..e6c104272237 100644 --- a/packages/beacon-node/src/api/impl/debug/index.ts +++ b/packages/beacon-node/src/api/impl/debug/index.ts @@ -1,12 +1,12 @@ import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; import {ExecutionStatus} from "@lodestar/fork-choice"; -import {BeaconState} from "@lodestar/types"; import {ZERO_HASH_HEX} from "@lodestar/params"; -import {getStateResponseWithRegen} from "../beacon/state/utils.js"; -import {ApiModules} from "../types.js"; +import {BeaconState} from "@lodestar/types"; import {isOptimisticBlock} from "../../../util/forkChoice.js"; import {getStateSlotFromBytes} from "../../../util/multifork.js"; +import {getStateResponseWithRegen} from "../beacon/state/utils.js"; +import {ApiModules} from "../types.js"; export function getDebugApi({ chain, diff --git a/packages/beacon-node/src/api/impl/lightclient/index.ts b/packages/beacon-node/src/api/impl/lightclient/index.ts index 0dd366accf68..850a8312978c 100644 --- a/packages/beacon-node/src/api/impl/lightclient/index.ts +++ b/packages/beacon-node/src/api/impl/lightclient/index.ts @@ -1,9 +1,9 @@ -import {fromHex} from "@lodestar/utils"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; -import {MAX_REQUEST_LIGHT_CLIENT_UPDATES, MAX_REQUEST_LIGHT_CLIENT_COMMITTEE_HASHES} from "@lodestar/params"; -import {ApiModules} from "../types.js"; +import {MAX_REQUEST_LIGHT_CLIENT_COMMITTEE_HASHES, MAX_REQUEST_LIGHT_CLIENT_UPDATES} from "@lodestar/params"; +import {fromHex} from "@lodestar/utils"; import {assertLightClientServer} from "../../../node/utils/lightclient.js"; +import {ApiModules} from "../types.js"; // TODO: Import from lightclient/server package export function getLightclientApi({ diff --git a/packages/beacon-node/src/api/impl/lodestar/index.ts b/packages/beacon-node/src/api/impl/lodestar/index.ts index f89959ad9da6..10787194f5f5 100644 --- a/packages/beacon-node/src/api/impl/lodestar/index.ts +++ b/packages/beacon-node/src/api/impl/lodestar/index.ts @@ -2,18 +2,18 @@ import fs from "node:fs"; import path from "node:path"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; +import {ChainForkConfig} from "@lodestar/config"; import {Repository} from "@lodestar/db"; -import {toHex, toRootHex} from "@lodestar/utils"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {getLatestWeakSubjectivityCheckpointEpoch} from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {toHex, toRootHex} from "@lodestar/utils"; import {BeaconChain} from "../../../chain/index.js"; import {QueuedStateRegenerator, RegenRequest} from "../../../chain/regen/index.js"; -import {GossipType} from "../../../network/index.js"; import {IBeaconDb} from "../../../db/interface.js"; -import {ApiModules} from "../types.js"; +import {GossipType} from "../../../network/index.js"; import {profileNodeJS, writeHeapSnapshot} from "../../../util/profile.js"; +import {ApiModules} from "../types.js"; export function getLodestarApi({ chain, diff --git a/packages/beacon-node/src/api/impl/node/index.ts b/packages/beacon-node/src/api/impl/node/index.ts index bd1fb85522de..0d476df32303 100644 --- a/packages/beacon-node/src/api/impl/node/index.ts +++ b/packages/beacon-node/src/api/impl/node/index.ts @@ -1,8 +1,8 @@ import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; +import {ApiOptions} from "../../options.js"; import {ApiError} from "../errors.js"; import {ApiModules} from "../types.js"; -import {ApiOptions} from "../../options.js"; export function getNodeApi( opts: ApiOptions, diff --git a/packages/beacon-node/src/api/impl/proof/index.ts b/packages/beacon-node/src/api/impl/proof/index.ts index 9e1a33940225..7b61e280015f 100644 --- a/packages/beacon-node/src/api/impl/proof/index.ts +++ b/packages/beacon-node/src/api/impl/proof/index.ts @@ -1,10 +1,10 @@ -import {CompactMultiProof, createProof, ProofType} from "@chainsafe/persistent-merkle-tree"; +import {CompactMultiProof, ProofType, createProof} from "@chainsafe/persistent-merkle-tree"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; -import {ApiModules} from "../types.js"; -import {getStateResponse} from "../beacon/state/utils.js"; -import {getBlockResponse} from "../beacon/blocks/utils.js"; import {ApiOptions} from "../../options.js"; +import {getBlockResponse} from "../beacon/blocks/utils.js"; +import {getStateResponse} from "../beacon/state/utils.js"; +import {ApiModules} from "../types.js"; export function getProofApi( opts: ApiOptions, diff --git a/packages/beacon-node/src/api/impl/types.ts b/packages/beacon-node/src/api/impl/types.ts index 6b14e79ef998..4b2649acc556 100644 --- a/packages/beacon-node/src/api/impl/types.ts +++ b/packages/beacon-node/src/api/impl/types.ts @@ -3,9 +3,9 @@ import {Logger} from "@lodestar/utils"; import {IBeaconChain} from "../../chain/index.js"; import {IBeaconDb} from "../../db/index.js"; -import {IBeaconSync} from "../../sync/index.js"; -import {INetwork} from "../../network/index.js"; import {Metrics} from "../../metrics/index.js"; +import {INetwork} from "../../network/index.js"; +import {IBeaconSync} from "../../sync/index.js"; export type ApiModules = { config: ChainForkConfig; diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index 2b558577c22c..b15644a8087e 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -1,61 +1,61 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; +import {DataAvailabilityStatus, ExecutionStatus} from "@lodestar/fork-choice"; import { - CachedBeaconStateAllForks, - computeStartSlotAtEpoch, - calculateCommitteeAssignments, - proposerShufflingDecisionRoot, - attesterShufflingDecisionRoot, - getBlockRootAtSlot, - computeEpochAtSlot, - getCurrentSlot, - beaconBlockToBlinded, - createCachedBeaconState, - loadState, -} from "@lodestar/state-transition"; -import { + ForkBlobs, + ForkExecution, + ForkPreBlobs, + ForkSeq, GENESIS_SLOT, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, SYNC_COMMITTEE_SUBNET_SIZE, isForkBlobs, isForkExecution, - ForkSeq, - ForkPreBlobs, - ForkBlobs, - ForkExecution, isForkPostElectra, } from "@lodestar/params"; -import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator"; import { + CachedBeaconStateAllForks, + attesterShufflingDecisionRoot, + beaconBlockToBlinded, + calculateCommitteeAssignments, + computeEpochAtSlot, + computeStartSlotAtEpoch, + createCachedBeaconState, + getBlockRootAtSlot, + getCurrentSlot, + loadState, + proposerShufflingDecisionRoot, +} from "@lodestar/state-transition"; +import { + BLSSignature, + BeaconBlock, + BlindedBeaconBlock, + BlockContents, + Epoch, + ProducedBlockSource, Root, Slot, ValidatorIndex, - ssz, - Epoch, - ProducedBlockSource, + Wei, bellatrix, - BLSSignature, + getValidatorStatus, isBlindedBeaconBlock, isBlockContents, phase0, - Wei, - BeaconBlock, - BlockContents, - BlindedBeaconBlock, - getValidatorStatus, + ssz, } from "@lodestar/types"; -import {ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice"; import { + TimeoutError, + formatWeiToEth, fromHex, - toHex, - resolveOrRacePromises, prettyWeiToEth, + resolveOrRacePromises, + toHex, toRootHex, - TimeoutError, - formatWeiToEth, } from "@lodestar/utils"; +import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator"; import { AttestationError, AttestationErrorCode, @@ -63,23 +63,23 @@ import { SyncCommitteeError, SyncCommitteeErrorCode, } from "../../../chain/errors/index.js"; +import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js"; +import {SCHEDULER_LOOKAHEAD_FACTOR} from "../../../chain/prepareNextSlot.js"; +import {RegenCaller} from "../../../chain/regen/index.js"; import {validateApiAggregateAndProof} from "../../../chain/validation/index.js"; +import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js"; import {ZERO_HASH} from "../../../constants/index.js"; +import {NoBidReceived} from "../../../execution/builder/http.js"; +import {validateGossipFnRetryUnknownRoot} from "../../../network/processor/gossipHandlers.js"; +import {CommitteeSubscription} from "../../../network/subnets/index.js"; import {SyncState} from "../../../sync/index.js"; import {isOptimisticBlock} from "../../../util/forkChoice.js"; import {getDefaultGraffiti, toGraffitiBuffer} from "../../../util/graffiti.js"; +import {getLodestarClientVersion} from "../../../util/metadata.js"; +import {ApiOptions} from "../../options.js"; +import {getStateResponseWithRegen} from "../beacon/state/utils.js"; import {ApiError, NodeIsSyncing, OnlySupportedByDVT} from "../errors.js"; -import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js"; -import {CommitteeSubscription} from "../../../network/subnets/index.js"; import {ApiModules} from "../types.js"; -import {RegenCaller} from "../../../chain/regen/index.js"; -import {getStateResponseWithRegen} from "../beacon/state/utils.js"; -import {validateGossipFnRetryUnknownRoot} from "../../../network/processor/gossipHandlers.js"; -import {SCHEDULER_LOOKAHEAD_FACTOR} from "../../../chain/prepareNextSlot.js"; -import {ChainEvent, CheckpointHex, CommonBlockBody} from "../../../chain/index.js"; -import {ApiOptions} from "../../options.js"; -import {NoBidReceived} from "../../../execution/builder/http.js"; -import {getLodestarClientVersion} from "../../../util/metadata.js"; import {computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProductionSource} from "./utils.js"; /** diff --git a/packages/beacon-node/src/api/impl/validator/utils.ts b/packages/beacon-node/src/api/impl/validator/utils.ts index 36accf34cfda..b8e5aa525f25 100644 --- a/packages/beacon-node/src/api/impl/validator/utils.ts +++ b/packages/beacon-node/src/api/impl/validator/utils.ts @@ -1,6 +1,6 @@ -import {BeaconStateAllForks, computeSlotsSinceEpochStart} from "@lodestar/state-transition"; -import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; import {routes} from "@lodestar/api"; +import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; +import {BeaconStateAllForks, computeSlotsSinceEpochStart} from "@lodestar/state-transition"; import {BLSPubkey, CommitteeIndex, ProducedBlockSource, Slot, ValidatorIndex} from "@lodestar/types"; import {MAX_BUILDER_BOOST_FACTOR} from "@lodestar/validator"; import {BlockSelectionResult, BuilderBlockSelectionReason, EngineBlockSelectionReason} from "./index.js"; diff --git a/packages/beacon-node/src/api/options.ts b/packages/beacon-node/src/api/options.ts index 811621ba97bf..02d0c9c6cdf6 100644 --- a/packages/beacon-node/src/api/options.ts +++ b/packages/beacon-node/src/api/options.ts @@ -1,4 +1,4 @@ -import {beaconRestApiServerOpts, BeaconRestApiServerOpts} from "./rest/index.js"; +import {BeaconRestApiServerOpts, beaconRestApiServerOpts} from "./rest/index.js"; export type ApiOptions = { maxGindicesInProof?: number; diff --git a/packages/beacon-node/src/api/rest/base.ts b/packages/beacon-node/src/api/rest/base.ts index 276583dc7281..efa01b032230 100644 --- a/packages/beacon-node/src/api/rest/base.ts +++ b/packages/beacon-node/src/api/rest/base.ts @@ -1,9 +1,9 @@ -import {parse as parseQueryString} from "qs"; -import {FastifyInstance, FastifyRequest, fastify, errorCodes} from "fastify"; -import {fastifyCors} from "@fastify/cors"; import bearerAuthPlugin from "@fastify/bearer-auth"; +import {fastifyCors} from "@fastify/cors"; import {addSszContentTypeParser} from "@lodestar/api/server"; import {ErrorAborted, Gauge, Histogram, Logger} from "@lodestar/utils"; +import {FastifyInstance, FastifyRequest, errorCodes, fastify} from "fastify"; +import {parse as parseQueryString} from "qs"; import {isLocalhostIP} from "../../util/ip.js"; import {ApiError, FailureList, IndexedError, NodeIsSyncing} from "../impl/errors.js"; import {HttpActiveSocketsTracker, SocketMetrics} from "./activeSockets.js"; diff --git a/packages/beacon-node/src/api/rest/index.ts b/packages/beacon-node/src/api/rest/index.ts index 6beaf061588c..1d31080327e6 100644 --- a/packages/beacon-node/src/api/rest/index.ts +++ b/packages/beacon-node/src/api/rest/index.ts @@ -1,10 +1,10 @@ import {Endpoints} from "@lodestar/api"; import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {registerRoutes} from "@lodestar/api/beacon/server"; -import {ErrorAborted, Logger} from "@lodestar/utils"; import {ChainForkConfig} from "@lodestar/config"; +import {ErrorAborted, Logger} from "@lodestar/utils"; import {NodeIsSyncing} from "../impl/errors.js"; -import {RestApiServer, RestApiServerModules, RestApiServerMetrics, RestApiServerOpts} from "./base.js"; +import {RestApiServer, RestApiServerMetrics, RestApiServerModules, RestApiServerOpts} from "./base.js"; import {registerSwaggerUIRoutes} from "./swaggerUI.js"; export {allNamespaces} from "@lodestar/api"; diff --git a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts index 8e1ac456579a..69c7dedfc560 100644 --- a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts +++ b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts @@ -1,10 +1,10 @@ -import {Epoch, Slot, RootHex} from "@lodestar/types"; +import {ChainForkConfig} from "@lodestar/config"; +import {KeyValue} from "@lodestar/db"; import {IForkChoice} from "@lodestar/fork-choice"; -import {Logger, fromHex, toRootHex} from "@lodestar/utils"; import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {KeyValue} from "@lodestar/db"; -import {ChainForkConfig} from "@lodestar/config"; +import {Epoch, RootHex, Slot} from "@lodestar/types"; +import {Logger, fromHex, toRootHex} from "@lodestar/utils"; import {IBeaconDb} from "../../db/index.js"; import {BlockArchiveBatchPutBinaryItem} from "../../db/repositories/index.js"; import {LightClientServer} from "../lightClient/index.js"; diff --git a/packages/beacon-node/src/chain/archiver/archiver.ts b/packages/beacon-node/src/chain/archiver/archiver.ts index 2d79f584ea79..6d5be3445eb2 100644 --- a/packages/beacon-node/src/chain/archiver/archiver.ts +++ b/packages/beacon-node/src/chain/archiver/archiver.ts @@ -1,13 +1,13 @@ -import {Logger} from "@lodestar/utils"; import {CheckpointWithHex} from "@lodestar/fork-choice"; +import {Logger} from "@lodestar/utils"; import {IBeaconDb} from "../../db/index.js"; +import {Metrics} from "../../metrics/metrics.js"; import {JobItemQueue} from "../../util/queue/index.js"; -import {IBeaconChain} from "../interface.js"; import {ChainEvent} from "../emitter.js"; -import {Metrics} from "../../metrics/metrics.js"; -import {FrequencyStateArchiveStrategy} from "./strategies/frequencyStateArchiveStrategy.js"; +import {IBeaconChain} from "../interface.js"; import {archiveBlocks} from "./archiveBlocks.js"; -import {StateArchiveMode, ArchiverOpts, StateArchiveStrategy} from "./interface.js"; +import {ArchiverOpts, StateArchiveMode, StateArchiveStrategy} from "./interface.js"; +import {FrequencyStateArchiveStrategy} from "./strategies/frequencyStateArchiveStrategy.js"; export const DEFAULT_STATE_ARCHIVE_MODE = StateArchiveMode.Frequency; diff --git a/packages/beacon-node/src/chain/archiver/interface.ts b/packages/beacon-node/src/chain/archiver/interface.ts index 48c930c78cd3..283fef579024 100644 --- a/packages/beacon-node/src/chain/archiver/interface.ts +++ b/packages/beacon-node/src/chain/archiver/interface.ts @@ -1,6 +1,6 @@ import {CheckpointWithHex} from "@lodestar/fork-choice"; -import {Metrics} from "../../metrics/metrics.js"; import {RootHex} from "@lodestar/types"; +import {Metrics} from "../../metrics/metrics.js"; export enum StateArchiveMode { Frequency = "frequency", diff --git a/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts b/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts index a701da5b22ec..6ae592ce7c63 100644 --- a/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts +++ b/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts @@ -1,14 +1,14 @@ -import {Logger} from "@lodestar/utils"; +import {CheckpointWithHex} from "@lodestar/fork-choice"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {Slot, Epoch, RootHex} from "@lodestar/types"; import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {CheckpointWithHex} from "@lodestar/fork-choice"; +import {Epoch, RootHex, Slot} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {IBeaconDb} from "../../../db/index.js"; -import {IStateRegenerator} from "../../regen/interface.js"; +import {Metrics} from "../../../metrics/metrics.js"; +import {AllocSource, BufferPool} from "../../../util/bufferPool.js"; import {getStateSlotFromBytes} from "../../../util/multifork.js"; +import {IStateRegenerator} from "../../regen/interface.js"; import {serializeState} from "../../serializeState.js"; -import {AllocSource, BufferPool} from "../../../util/bufferPool.js"; -import {Metrics} from "../../../metrics/metrics.js"; import {StateArchiveStrategy, StatesArchiverOpts} from "../interface.js"; /** diff --git a/packages/beacon-node/src/chain/balancesCache.ts b/packages/beacon-node/src/chain/balancesCache.ts index d29a6998f600..8fe09df4c275 100644 --- a/packages/beacon-node/src/chain/balancesCache.ts +++ b/packages/beacon-node/src/chain/balancesCache.ts @@ -1,11 +1,11 @@ +import {CheckpointWithHex} from "@lodestar/fork-choice"; import { CachedBeaconStateAllForks, - computeStartSlotAtEpoch, EffectiveBalanceIncrements, + computeStartSlotAtEpoch, getBlockRootAtSlot, getEffectiveBalanceIncrementsZeroInactive, } from "@lodestar/state-transition"; -import {CheckpointWithHex} from "@lodestar/fork-choice"; import {Epoch, RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; diff --git a/packages/beacon-node/src/chain/beaconProposerCache.ts b/packages/beacon-node/src/chain/beaconProposerCache.ts index f8638aa64bf7..dd46821e6d57 100644 --- a/packages/beacon-node/src/chain/beaconProposerCache.ts +++ b/packages/beacon-node/src/chain/beaconProposerCache.ts @@ -1,5 +1,5 @@ -import {Epoch} from "@lodestar/types"; import {routes} from "@lodestar/api"; +import {Epoch} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; import {Metrics} from "../metrics/index.js"; diff --git a/packages/beacon-node/src/chain/blocks/importBlock.ts b/packages/beacon-node/src/chain/blocks/importBlock.ts index 596f01f391a4..6b23112b03fe 100644 --- a/packages/beacon-node/src/chain/blocks/importBlock.ts +++ b/packages/beacon-node/src/chain/blocks/importBlock.ts @@ -1,26 +1,26 @@ -import {capella, ssz, altair, BeaconBlock} from "@lodestar/types"; +import {routes} from "@lodestar/api"; +import {AncestorStatus, EpochDifference, ForkChoiceError, ForkChoiceErrorCode} from "@lodestar/fork-choice"; import {ForkLightClient, ForkSeq, INTERVALS_PER_SLOT, MAX_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params"; import { CachedBeaconStateAltair, + RootCache, computeEpochAtSlot, computeStartSlotAtEpoch, isStateValidatorsNodesPopulated, - RootCache, } from "@lodestar/state-transition"; -import {routes} from "@lodestar/api"; -import {ForkChoiceError, ForkChoiceErrorCode, EpochDifference, AncestorStatus} from "@lodestar/fork-choice"; +import {BeaconBlock, altair, capella, ssz} from "@lodestar/types"; import {isErrorAborted, toHex, toRootHex} from "@lodestar/utils"; import {ZERO_HASH_HEX} from "../../constants/index.js"; -import {toCheckpointHex} from "../stateCache/index.js"; +import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; +import {callInNextEventLoop} from "../../util/eventLoop.js"; import {isOptimisticBlock} from "../../util/forkChoice.js"; import {isQueueErrorAborted} from "../../util/queue/index.js"; -import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; -import {ChainEvent, ReorgEventData} from "../emitter.js"; -import {REPROCESS_MIN_TIME_TO_NEXT_SLOT_SEC} from "../reprocess.js"; import type {BeaconChain} from "../chain.js"; -import {callInNextEventLoop} from "../../util/eventLoop.js"; +import {ChainEvent, ReorgEventData} from "../emitter.js"; import {ForkchoiceCaller} from "../forkChoice/index.js"; -import {FullyVerifiedBlock, ImportBlockOpts, AttestationImportOpt, BlockInputType} from "./types.js"; +import {REPROCESS_MIN_TIME_TO_NEXT_SLOT_SEC} from "../reprocess.js"; +import {toCheckpointHex} from "../stateCache/index.js"; +import {AttestationImportOpt, BlockInputType, FullyVerifiedBlock, ImportBlockOpts} from "./types.js"; import {getCheckpointFromState} from "./utils/checkpoint.js"; import {writeBlockInputToDb} from "./writeBlockInputToDb.js"; diff --git a/packages/beacon-node/src/chain/blocks/index.ts b/packages/beacon-node/src/chain/blocks/index.ts index f64e4b1f3813..6e8eed428a4b 100644 --- a/packages/beacon-node/src/chain/blocks/index.ts +++ b/packages/beacon-node/src/chain/blocks/index.ts @@ -1,14 +1,14 @@ -import {isErrorAborted, toRootHex} from "@lodestar/utils"; import {SignedBeaconBlock} from "@lodestar/types"; -import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js"; +import {isErrorAborted, toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/metrics.js"; +import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js"; +import type {BeaconChain} from "../chain.js"; import {BlockError, BlockErrorCode, isBlockErrorAborted} from "../errors/index.js"; import {BlockProcessOpts} from "../options.js"; -import type {BeaconChain} from "../chain.js"; -import {verifyBlocksInEpoch} from "./verifyBlock.js"; import {importBlock} from "./importBlock.js"; -import {assertLinearChainSegment} from "./utils/chainSegment.js"; import {BlockInput, FullyVerifiedBlock, ImportBlockOpts} from "./types.js"; +import {assertLinearChainSegment} from "./utils/chainSegment.js"; +import {verifyBlocksInEpoch} from "./verifyBlock.js"; import {verifyBlocksSanityChecks} from "./verifyBlocksSanityChecks.js"; import {removeEagerlyPersistedBlockInputs} from "./writeBlockInputToDb.js"; export {type ImportBlockOpts, AttestationImportOpt} from "./types.js"; diff --git a/packages/beacon-node/src/chain/blocks/types.ts b/packages/beacon-node/src/chain/blocks/types.ts index 8b793932e951..2b7186e91112 100644 --- a/packages/beacon-node/src/chain/blocks/types.ts +++ b/packages/beacon-node/src/chain/blocks/types.ts @@ -1,8 +1,8 @@ -import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; -import {MaybeValidExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice"; -import {deneb, Slot, RootHex, SignedBeaconBlock} from "@lodestar/types"; -import {ForkSeq, ForkBlobs} from "@lodestar/params"; import {ChainForkConfig} from "@lodestar/config"; +import {DataAvailabilityStatus, MaybeValidExecutionStatus} from "@lodestar/fork-choice"; +import {ForkBlobs, ForkSeq} from "@lodestar/params"; +import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; +import {RootHex, SignedBeaconBlock, Slot, deneb} from "@lodestar/types"; export enum BlockInputType { // preData is preDeneb diff --git a/packages/beacon-node/src/chain/blocks/utils/checkpoint.ts b/packages/beacon-node/src/chain/blocks/utils/checkpoint.ts index 2ff77600b2b8..855a1b19e741 100644 --- a/packages/beacon-node/src/chain/blocks/utils/checkpoint.ts +++ b/packages/beacon-node/src/chain/blocks/utils/checkpoint.ts @@ -1,5 +1,5 @@ -import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; import {phase0, ssz} from "@lodestar/types"; import {ZERO_HASH} from "../../../constants/index.js"; diff --git a/packages/beacon-node/src/chain/blocks/verifyBlock.ts b/packages/beacon-node/src/chain/blocks/verifyBlock.ts index 4d21342bd8cc..47a9a9060572 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlock.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlock.ts @@ -1,26 +1,26 @@ +import {ChainForkConfig} from "@lodestar/config"; +import {DataAvailabilityStatus, ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice"; +import {ForkName} from "@lodestar/params"; import { CachedBeaconStateAllForks, + DataAvailableStatus, computeEpochAtSlot, isStateValidatorsNodesPopulated, - DataAvailableStatus, } from "@lodestar/state-transition"; import {bellatrix, deneb} from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; -import {ProtoBlock, ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice"; -import {ChainForkConfig} from "@lodestar/config"; import {Logger, toRootHex} from "@lodestar/utils"; +import type {BeaconChain} from "../chain.js"; import {BlockError, BlockErrorCode} from "../errors/index.js"; import {BlockProcessOpts} from "../options.js"; import {RegenCaller} from "../regen/index.js"; -import type {BeaconChain} from "../chain.js"; -import {BlockInput, ImportBlockOpts, BlockInputType} from "./types.js"; -import {POS_PANDA_MERGE_TRANSITION_BANNER} from "./utils/pandaMergeTransitionBanner.js"; -import {CAPELLA_OWL_BANNER} from "./utils/ownBanner.js"; +import {BlockInput, BlockInputType, ImportBlockOpts} from "./types.js"; import {DENEB_BLOWFISH_BANNER} from "./utils/blowfishBanner.js"; -import {verifyBlocksStateTransitionOnly} from "./verifyBlocksStateTransitionOnly.js"; -import {verifyBlocksSignatures} from "./verifyBlocksSignatures.js"; -import {verifyBlocksExecutionPayload, SegmentExecStatus} from "./verifyBlocksExecutionPayloads.js"; +import {CAPELLA_OWL_BANNER} from "./utils/ownBanner.js"; +import {POS_PANDA_MERGE_TRANSITION_BANNER} from "./utils/pandaMergeTransitionBanner.js"; import {verifyBlocksDataAvailability} from "./verifyBlocksDataAvailability.js"; +import {SegmentExecStatus, verifyBlocksExecutionPayload} from "./verifyBlocksExecutionPayloads.js"; +import {verifyBlocksSignatures} from "./verifyBlocksSignatures.js"; +import {verifyBlocksStateTransitionOnly} from "./verifyBlocksStateTransitionOnly.js"; import {writeBlockInputToDb} from "./writeBlockInputToDb.js"; /** diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts index 98bfae2c1ce3..1d8c72a46873 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts @@ -1,12 +1,12 @@ -import {computeTimeAtSlot} from "@lodestar/state-transition"; -import {DataAvailabilityStatus} from "@lodestar/fork-choice"; import {ChainForkConfig} from "@lodestar/config"; -import {deneb, UintNum64} from "@lodestar/types"; +import {DataAvailabilityStatus} from "@lodestar/fork-choice"; +import {computeTimeAtSlot} from "@lodestar/state-transition"; +import {UintNum64, deneb} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; +import {Metrics} from "../../metrics/metrics.js"; import {BlockError, BlockErrorCode} from "../errors/index.js"; import {validateBlobSidecars} from "../validation/blobSidecar.js"; -import {Metrics} from "../../metrics/metrics.js"; -import {BlockInput, BlockInputType, ImportBlockOpts, BlobSidecarValidation, getBlockInput} from "./types.js"; +import {BlobSidecarValidation, BlockInput, BlockInputType, ImportBlockOpts, getBlockInput} from "./types.js"; // we can now wait for full 12 seconds because unavailable block sync will try pulling // the blobs from the network anyway after 500ms of seeing the block diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksExecutionPayloads.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksExecutionPayloads.ts index e641ff9ae6d9..e37442bfde8f 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksExecutionPayloads.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksExecutionPayloads.ts @@ -1,32 +1,32 @@ +import {ChainForkConfig} from "@lodestar/config"; +import { + ExecutionStatus, + IForkChoice, + LVHInvalidResponse, + LVHValidResponse, + MaybeValidExecutionStatus, + ProtoBlock, + assertValidTerminalPowBlock, +} from "@lodestar/fork-choice"; +import {ForkSeq, SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY} from "@lodestar/params"; import { CachedBeaconStateAllForks, - isExecutionStateType, isExecutionBlockBodyType, - isMergeTransitionBlock as isMergeTransitionBlockFn, isExecutionEnabled, + isExecutionStateType, + isMergeTransitionBlock as isMergeTransitionBlockFn, } from "@lodestar/state-transition"; -import {bellatrix, Slot, deneb, SignedBeaconBlock, electra} from "@lodestar/types"; -import { - IForkChoice, - assertValidTerminalPowBlock, - ProtoBlock, - ExecutionStatus, - MaybeValidExecutionStatus, - LVHValidResponse, - LVHInvalidResponse, -} from "@lodestar/fork-choice"; -import {ChainForkConfig} from "@lodestar/config"; +import {SignedBeaconBlock, Slot, bellatrix, deneb, electra} from "@lodestar/types"; import {ErrorAborted, Logger, toRootHex} from "@lodestar/utils"; -import {ForkSeq, SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY} from "@lodestar/params"; +import {IEth1ForBlockProduction} from "../../eth1/index.js"; import {IExecutionEngine} from "../../execution/engine/interface.js"; -import {BlockError, BlockErrorCode} from "../errors/index.js"; -import {IClock} from "../../util/clock.js"; -import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; -import {BlockProcessOpts} from "../options.js"; import {ExecutionPayloadStatus} from "../../execution/engine/interface.js"; -import {IEth1ForBlockProduction} from "../../eth1/index.js"; import {Metrics} from "../../metrics/metrics.js"; +import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; +import {IClock} from "../../util/clock.js"; +import {BlockError, BlockErrorCode} from "../errors/index.js"; +import {BlockProcessOpts} from "../options.js"; import {ImportBlockOpts} from "./types.js"; export type VerifyBlockExecutionPayloadModules = { diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksSanityChecks.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksSanityChecks.ts index 22b20a55fb67..5115f39ebf47 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksSanityChecks.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksSanityChecks.ts @@ -1,6 +1,6 @@ -import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {ChainForkConfig} from "@lodestar/config"; import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; +import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {Slot} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {IClock} from "../../util/clock.js"; diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksSignatures.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksSignatures.ts index e86549cda7d3..d133579f97a5 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksSignatures.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksSignatures.ts @@ -1,10 +1,10 @@ import {CachedBeaconStateAllForks, getBlockSignatureSets} from "@lodestar/state-transition"; -import {Logger} from "@lodestar/utils"; import {SignedBeaconBlock} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {Metrics} from "../../metrics/metrics.js"; +import {nextEventLoop} from "../../util/eventLoop.js"; import {IBlsVerifier} from "../bls/index.js"; import {BlockError, BlockErrorCode} from "../errors/blockError.js"; -import {nextEventLoop} from "../../util/eventLoop.js"; import {ImportBlockOpts} from "./types.js"; /** diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts index 49cd46220008..b2f70d6274b3 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksStateTransitionOnly.ts @@ -1,16 +1,16 @@ import { CachedBeaconStateAllForks, - stateTransition, - ExecutionPayloadStatus, DataAvailableStatus, + ExecutionPayloadStatus, StateHashTreeRootSource, + stateTransition, } from "@lodestar/state-transition"; import {ErrorAborted, Logger} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; -import {BlockError, BlockErrorCode} from "../errors/index.js"; -import {BlockProcessOpts} from "../options.js"; import {byteArrayEquals} from "../../util/bytes.js"; import {nextEventLoop} from "../../util/eventLoop.js"; +import {BlockError, BlockErrorCode} from "../errors/index.js"; +import {BlockProcessOpts} from "../options.js"; import {BlockInput, ImportBlockOpts} from "./types.js"; /** diff --git a/packages/beacon-node/src/chain/bls/multithread/index.ts b/packages/beacon-node/src/chain/bls/multithread/index.ts index fc8ea7534ad7..4b1867c3793f 100644 --- a/packages/beacon-node/src/chain/bls/multithread/index.ts +++ b/packages/beacon-node/src/chain/bls/multithread/index.ts @@ -1,24 +1,21 @@ /* eslint-disable @typescript-eslint/strict-boolean-expressions */ import path from "node:path"; -import {spawn, Worker} from "@chainsafe/threads"; +import {Worker, spawn} from "@chainsafe/threads"; // `threads` library creates self global variable which breaks `timeout-abort-controller` https://github.com/jacobheun/timeout-abort-controller/issues/9 // Don't add an eslint disable here as a reminder that this has to be fixed eventually // @ts-ignore // biome-ignore lint/suspicious/noGlobalAssign: self = undefined; import {PublicKey} from "@chainsafe/blst"; -import {Logger} from "@lodestar/utils"; import {ISignatureSet} from "@lodestar/state-transition"; -import {QueueError, QueueErrorCode} from "../../../util/queue/index.js"; +import {Logger} from "@lodestar/utils"; import {Metrics} from "../../../metrics/index.js"; -import {IBlsVerifier, VerifySignatureOpts} from "../interface.js"; -import {getAggregatedPubkey, getAggregatedPubkeysCount} from "../utils.js"; -import {verifySignatureSetsMaybeBatch} from "../maybeBatch.js"; import {LinkedList} from "../../../util/array.js"; import {callInNextEventLoop} from "../../../util/eventLoop.js"; -import {BlsWorkReq, BlsWorkResult, WorkerData, WorkResultCode, WorkResultError} from "./types.js"; -import {chunkifyMaximizeChunkSize} from "./utils.js"; -import {defaultPoolSize} from "./poolSize.js"; +import {QueueError, QueueErrorCode} from "../../../util/queue/index.js"; +import {IBlsVerifier, VerifySignatureOpts} from "../interface.js"; +import {verifySignatureSetsMaybeBatch} from "../maybeBatch.js"; +import {getAggregatedPubkey, getAggregatedPubkeysCount} from "../utils.js"; import { JobQueueItem, JobQueueItemSameMessage, @@ -27,6 +24,9 @@ import { jobItemSigSets, jobItemWorkReq, } from "./jobItem.js"; +import {defaultPoolSize} from "./poolSize.js"; +import {BlsWorkReq, BlsWorkResult, WorkResultCode, WorkResultError, WorkerData} from "./types.js"; +import {chunkifyMaximizeChunkSize} from "./utils.js"; // Worker constructor consider the path relative to the current working directory const workerDir = process.env.NODE_ENV === "test" ? "../../../../lib/chain/bls/multithread" : "./"; diff --git a/packages/beacon-node/src/chain/bls/multithread/jobItem.ts b/packages/beacon-node/src/chain/bls/multithread/jobItem.ts index 63591af5ee77..efaaf36fd88f 100644 --- a/packages/beacon-node/src/chain/bls/multithread/jobItem.ts +++ b/packages/beacon-node/src/chain/bls/multithread/jobItem.ts @@ -1,9 +1,9 @@ import {PublicKey, asyncAggregateWithRandomness} from "@chainsafe/blst"; import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition"; +import {Metrics} from "../../../metrics/metrics.js"; +import {LinkedList} from "../../../util/array.js"; import {VerifySignatureOpts} from "../interface.js"; import {getAggregatedPubkey} from "../utils.js"; -import {LinkedList} from "../../../util/array.js"; -import {Metrics} from "../../../metrics/metrics.js"; import {BlsWorkReq} from "./types.js"; export type JobQueueItem = JobQueueItemDefault | JobQueueItemSameMessage; diff --git a/packages/beacon-node/src/chain/bls/multithread/worker.ts b/packages/beacon-node/src/chain/bls/multithread/worker.ts index d2794db2e6bf..7fbd1701950b 100644 --- a/packages/beacon-node/src/chain/bls/multithread/worker.ts +++ b/packages/beacon-node/src/chain/bls/multithread/worker.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/strict-boolean-expressions */ import worker from "node:worker_threads"; -import {expose} from "@chainsafe/threads/worker"; import {PublicKey} from "@chainsafe/blst"; -import {verifySignatureSetsMaybeBatch, SignatureSetDeserialized} from "../maybeBatch.js"; -import {WorkerData, BlsWorkReq, WorkResult, WorkResultCode, SerializedSet, BlsWorkResult} from "./types.js"; +import {expose} from "@chainsafe/threads/worker"; +import {SignatureSetDeserialized, verifySignatureSetsMaybeBatch} from "../maybeBatch.js"; +import {BlsWorkReq, BlsWorkResult, SerializedSet, WorkResult, WorkResultCode, WorkerData} from "./types.js"; import {chunkifyMaximizeChunkSize} from "./utils.js"; /** diff --git a/packages/beacon-node/src/chain/chain.ts b/packages/beacon-node/src/chain/chain.ts index 144b73f0c01d..8b9fa0336283 100644 --- a/packages/beacon-node/src/chain/chain.ts +++ b/packages/beacon-node/src/chain/chain.ts @@ -1,106 +1,106 @@ import path from "node:path"; -import {CompositeTypeAny, TreeView, Type} from "@chainsafe/ssz"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; +import {CompositeTypeAny, TreeView, Type} from "@chainsafe/ssz"; +import {BeaconConfig} from "@lodestar/config"; +import {CheckpointWithHex, ExecutionStatus, IForkChoice, ProtoBlock, UpdateHeadOpt} from "@lodestar/fork-choice"; +import {ForkSeq, GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; import { BeaconStateAllForks, CachedBeaconStateAllForks, + EffectiveBalanceIncrements, + EpochShuffling, + Index2PubkeyCache, + computeAnchorCheckpoint, + computeEndSlotAtEpoch, computeEpochAtSlot, computeStartSlotAtEpoch, createCachedBeaconState, - EffectiveBalanceIncrements, getEffectiveBalanceIncrementsZeroInactive, isCachedBeaconState, - Index2PubkeyCache, - EpochShuffling, - computeEndSlotAtEpoch, - computeAnchorCheckpoint, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; import { - UintNum64, + BeaconBlock, + BlindedBeaconBlock, + BlindedBeaconBlockBody, + Epoch, + ExecutionPayload, Root, - phase0, - Slot, RootHex, - Epoch, + SignedBeaconBlock, + Slot, + UintNum64, ValidatorIndex, - deneb, Wei, bellatrix, + deneb, isBlindedBeaconBlock, - BeaconBlock, - SignedBeaconBlock, - ExecutionPayload, - BlindedBeaconBlock, - BlindedBeaconBlockBody, + phase0, } from "@lodestar/types"; -import {CheckpointWithHex, ExecutionStatus, IForkChoice, ProtoBlock, UpdateHeadOpt} from "@lodestar/fork-choice"; -import {ProcessShutdownCallback} from "@lodestar/validator"; import {Logger, fromHex, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toRootHex} from "@lodestar/utils"; -import {ForkSeq, GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ProcessShutdownCallback} from "@lodestar/validator"; import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js"; import {IBeaconDb} from "../db/index.js"; -import {Metrics} from "../metrics/index.js"; import {IEth1ForBlockProduction} from "../eth1/index.js"; -import {IExecutionEngine, IExecutionBuilder} from "../execution/index.js"; +import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js"; +import {Metrics} from "../metrics/index.js"; +import {BufferPool} from "../util/bufferPool.js"; import {Clock, ClockEvent, IClock} from "../util/clock.js"; import {ensureDir, writeIfNotExist} from "../util/file.js"; import {isOptimisticBlock} from "../util/forkChoice.js"; -import {BufferPool} from "../util/bufferPool.js"; +import {Archiver} from "./archiver/archiver.js"; +import {CheckpointBalancesCache} from "./balancesCache.js"; +import {BeaconProposerCache} from "./beaconProposerCache.js"; import {BlockProcessor, ImportBlockOpts} from "./blocks/index.js"; -import {ChainEventEmitter, ChainEvent} from "./emitter.js"; +import {BlockInput} from "./blocks/types.js"; +import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js"; +import {ChainEvent, ChainEventEmitter} from "./emitter.js"; +import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js"; +import {HistoricalStateRegen} from "./historicalState/index.js"; import { - IBeaconChain, - ProposerPreparationData, BlockHash, - StateGetOpts, CommonBlockBody, FindHeadFnName, + IBeaconChain, + ProposerPreparationData, + StateGetOpts, } from "./interface.js"; -import {IChainOptions} from "./options.js"; -import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js"; -import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js"; -import {IBlsVerifier, BlsSingleThreadVerifier, BlsMultiThreadWorkerPool} from "./bls/index.js"; -import { - SeenAttesters, - SeenAggregators, - SeenBlockProposers, - SeenSyncCommitteeMessages, - SeenContributionAndProof, -} from "./seenCache/index.js"; +import {LightClientServer} from "./lightClient/index.js"; import { AggregatedAttestationPool, AttestationPool, + OpPool, SyncCommitteeMessagePool, SyncContributionAndProofPool, - OpPool, } from "./opPools/index.js"; -import {LightClientServer} from "./lightClient/index.js"; -import {Archiver} from "./archiver/archiver.js"; +import {IChainOptions} from "./options.js"; import {PrepareNextSlotScheduler} from "./prepareNextSlot.js"; -import {ReprocessController} from "./reprocess.js"; -import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js"; -import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js"; -import {BeaconProposerCache} from "./beaconProposerCache.js"; -import {CheckpointBalancesCache} from "./balancesCache.js"; +import {computeNewStateRoot} from "./produceBlock/computeNewStateRoot.js"; import {AssembledBlockType, BlobsResultType, BlockType} from "./produceBlock/index.js"; import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produceBlock/produceBlockBody.js"; -import {computeNewStateRoot} from "./produceBlock/computeNewStateRoot.js"; -import {BlockInput} from "./blocks/types.js"; -import {SeenAttestationDatas} from "./seenCache/seenAttestationData.js"; -import {HistoricalStateRegen} from "./historicalState/index.js"; +import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js"; +import {ReprocessController} from "./reprocess.js"; +import {AttestationsRewards, computeAttestationsRewards} from "./rewards/attestationsRewards.js"; import {BlockRewards, computeBlockRewards} from "./rewards/blockRewards.js"; +import {SyncCommitteeRewards, computeSyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js"; +import { + SeenAggregators, + SeenAttesters, + SeenBlockProposers, + SeenContributionAndProof, + SeenSyncCommitteeMessages, +} from "./seenCache/index.js"; +import {SeenGossipBlockInput} from "./seenCache/index.js"; +import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js"; +import {SeenAttestationDatas} from "./seenCache/seenAttestationData.js"; +import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js"; import {ShufflingCache} from "./shufflingCache.js"; import {BlockStateCacheImpl} from "./stateCache/blockStateCacheImpl.js"; -import {SeenGossipBlockInput} from "./seenCache/index.js"; -import {InMemoryCheckpointStateCache} from "./stateCache/inMemoryCheckpointsCache.js"; -import {FIFOBlockStateCache} from "./stateCache/fifoBlockStateCache.js"; -import {PersistentCheckpointStateCache} from "./stateCache/persistentCheckpointsCache.js"; import {DbCPStateDatastore} from "./stateCache/datastore/db.js"; import {FileCPStateDatastore} from "./stateCache/datastore/file.js"; -import {SyncCommitteeRewards, computeSyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js"; -import {AttestationsRewards, computeAttestationsRewards} from "./rewards/attestationsRewards.js"; +import {FIFOBlockStateCache} from "./stateCache/fifoBlockStateCache.js"; +import {InMemoryCheckpointStateCache} from "./stateCache/inMemoryCheckpointsCache.js"; +import {PersistentCheckpointStateCache} from "./stateCache/persistentCheckpointsCache.js"; /** * Arbitrary constants, blobs and payloads should be consumed immediately in the same slot diff --git a/packages/beacon-node/src/chain/emitter.ts b/packages/beacon-node/src/chain/emitter.ts index 10b6455e48f5..a24c1e37bf92 100644 --- a/packages/beacon-node/src/chain/emitter.ts +++ b/packages/beacon-node/src/chain/emitter.ts @@ -2,9 +2,9 @@ import {EventEmitter} from "node:events"; import {StrictEventEmitter} from "strict-event-emitter-types"; import {routes} from "@lodestar/api"; -import {phase0} from "@lodestar/types"; import {CheckpointWithHex} from "@lodestar/fork-choice"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {phase0} from "@lodestar/types"; /** * Important chain events that occur during normal chain operation. diff --git a/packages/beacon-node/src/chain/errors/attestationError.ts b/packages/beacon-node/src/chain/errors/attestationError.ts index 9f8e86cea1ab..618a334928ae 100644 --- a/packages/beacon-node/src/chain/errors/attestationError.ts +++ b/packages/beacon-node/src/chain/errors/attestationError.ts @@ -1,4 +1,4 @@ -import {Epoch, Slot, ValidatorIndex, RootHex} from "@lodestar/types"; +import {Epoch, RootHex, Slot, ValidatorIndex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {GossipActionError} from "./gossipValidation.js"; diff --git a/packages/beacon-node/src/chain/errors/blobSidecarError.ts b/packages/beacon-node/src/chain/errors/blobSidecarError.ts index f38aa883002c..410574594911 100644 --- a/packages/beacon-node/src/chain/errors/blobSidecarError.ts +++ b/packages/beacon-node/src/chain/errors/blobSidecarError.ts @@ -1,4 +1,4 @@ -import {Slot, RootHex, ValidatorIndex} from "@lodestar/types"; +import {RootHex, Slot, ValidatorIndex} from "@lodestar/types"; import {GossipActionError} from "./gossipValidation.js"; export enum BlobSidecarErrorCode { diff --git a/packages/beacon-node/src/chain/errors/blockError.ts b/packages/beacon-node/src/chain/errors/blockError.ts index 6280533c7a68..bc5dd6c33956 100644 --- a/packages/beacon-node/src/chain/errors/blockError.ts +++ b/packages/beacon-node/src/chain/errors/blockError.ts @@ -1,6 +1,6 @@ +import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {RootHex, SignedBeaconBlock, Slot, ValidatorIndex} from "@lodestar/types"; import {LodestarError, toRootHex} from "@lodestar/utils"; -import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {ExecutionPayloadStatus} from "../../execution/engine/interface.js"; import {QueueErrorCode} from "../../util/queue/index.js"; import {GossipActionError} from "./gossipValidation.js"; diff --git a/packages/beacon-node/src/chain/errors/syncCommitteeError.ts b/packages/beacon-node/src/chain/errors/syncCommitteeError.ts index e4a92729cecd..1564a358ec4c 100644 --- a/packages/beacon-node/src/chain/errors/syncCommitteeError.ts +++ b/packages/beacon-node/src/chain/errors/syncCommitteeError.ts @@ -1,4 +1,4 @@ -import {ValidatorIndex, Slot, RootHex} from "@lodestar/types"; +import {RootHex, Slot, ValidatorIndex} from "@lodestar/types"; import {GossipActionError} from "./gossipValidation.js"; export enum SyncCommitteeErrorCode { diff --git a/packages/beacon-node/src/chain/forkChoice/index.ts b/packages/beacon-node/src/chain/forkChoice/index.ts index 839975de4e26..b3f5d11260f2 100644 --- a/packages/beacon-node/src/chain/forkChoice/index.ts +++ b/packages/beacon-node/src/chain/forkChoice/index.ts @@ -1,26 +1,26 @@ -import {Slot} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import { + DataAvailabilityStatus, + ExecutionStatus, ForkChoice, - ProtoArray, ForkChoiceStore, - ExecutionStatus, JustifiedBalancesGetter, + ProtoArray, ForkChoiceOpts as RawForkChoiceOpts, - DataAvailabilityStatus, } from "@lodestar/fork-choice"; import { CachedBeaconStateAllForks, + computeAnchorCheckpoint, getEffectiveBalanceIncrementsZeroInactive, isExecutionStateType, isMergeTransitionComplete, - computeAnchorCheckpoint, } from "@lodestar/state-transition"; +import {Slot} from "@lodestar/types"; import {Logger, toRootHex} from "@lodestar/utils"; +import {GENESIS_SLOT} from "../../constants/index.js"; import {ChainEventEmitter} from "../emitter.js"; import {ChainEvent} from "../emitter.js"; -import {GENESIS_SLOT} from "../../constants/index.js"; export type ForkChoiceOpts = RawForkChoiceOpts & { // for testing only diff --git a/packages/beacon-node/src/chain/genesis/genesis.ts b/packages/beacon-node/src/chain/genesis/genesis.ts index 0c46f920d614..f56b42a3b89e 100644 --- a/packages/beacon-node/src/chain/genesis/genesis.ts +++ b/packages/beacon-node/src/chain/genesis/genesis.ts @@ -1,25 +1,25 @@ -import {toGindex, Tree} from "@chainsafe/persistent-merkle-tree"; -import {GENESIS_EPOCH, GENESIS_SLOT} from "@lodestar/params"; -import {phase0, ssz} from "@lodestar/types"; +import {Tree, toGindex} from "@chainsafe/persistent-merkle-tree"; import {BeaconConfig, ChainForkConfig} from "@lodestar/config"; +import {GENESIS_EPOCH, GENESIS_SLOT} from "@lodestar/params"; import { - getTemporaryBlockHeader, - getGenesisBeaconState, + BeaconStateAllForks, + CachedBeaconStateAllForks, applyDeposits, - applyTimestamp, applyEth1BlockHash, - CachedBeaconStateAllForks, + applyTimestamp, createCachedBeaconState, - BeaconStateAllForks, createEmptyEpochCacheImmutableData, getActiveValidatorIndices, + getGenesisBeaconState, + getTemporaryBlockHeader, } from "@lodestar/state-transition"; +import {phase0, ssz} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; +import {DepositTree} from "../../db/repositories/depositDataRoot.js"; import {IEth1Provider} from "../../eth1/index.js"; import {IEth1StreamParams} from "../../eth1/interface.js"; import {getDepositsAndBlockStreamForGenesis, getDepositsStream} from "../../eth1/stream.js"; -import {DepositTree} from "../../db/repositories/depositDataRoot.js"; -import {IGenesisBuilder, GenesisResult} from "./interface.js"; +import {GenesisResult, IGenesisBuilder} from "./interface.js"; export type GenesisBuilderKwargs = { config: ChainForkConfig; diff --git a/packages/beacon-node/src/chain/genesis/interface.ts b/packages/beacon-node/src/chain/genesis/interface.ts index d1bae335b9ff..79c402cc29cb 100644 --- a/packages/beacon-node/src/chain/genesis/interface.ts +++ b/packages/beacon-node/src/chain/genesis/interface.ts @@ -1,6 +1,6 @@ import {CompositeViewDU, VectorCompositeType} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; import {Eth1Block} from "../../eth1/interface.js"; export type GenesisResult = { diff --git a/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts b/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts index a9f254dea3f2..20a53c40d73d 100644 --- a/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts +++ b/packages/beacon-node/src/chain/historicalState/getHistoricalState.ts @@ -1,4 +1,5 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; +import {BeaconConfig} from "@lodestar/config"; import { BeaconStateAllForks, CachedBeaconStateAllForks, @@ -7,7 +8,6 @@ import { createCachedBeaconState, stateTransition, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; import {IBeaconDb} from "../../db/index.js"; import {HistoricalStateRegenMetrics, RegenErrorType} from "./types.js"; diff --git a/packages/beacon-node/src/chain/historicalState/index.ts b/packages/beacon-node/src/chain/historicalState/index.ts index 8688bcf9f372..250a80467951 100644 --- a/packages/beacon-node/src/chain/historicalState/index.ts +++ b/packages/beacon-node/src/chain/historicalState/index.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import {ModuleThread, Thread, spawn, Worker} from "@chainsafe/threads"; +import {ModuleThread, Thread, Worker, spawn} from "@chainsafe/threads"; import {chainConfigToJson} from "@lodestar/config"; import {LoggerNode} from "@lodestar/logger/node"; import { diff --git a/packages/beacon-node/src/chain/historicalState/worker.ts b/packages/beacon-node/src/chain/historicalState/worker.ts index 2ea673d0faff..fabb985c66a5 100644 --- a/packages/beacon-node/src/chain/historicalState/worker.ts +++ b/packages/beacon-node/src/chain/historicalState/worker.ts @@ -1,21 +1,21 @@ import worker from "node:worker_threads"; -import {Transfer, expose} from "@chainsafe/threads/worker"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {createBeaconConfig, chainConfigFromJson} from "@lodestar/config"; +import {Transfer, expose} from "@chainsafe/threads/worker"; +import {chainConfigFromJson, createBeaconConfig} from "@lodestar/config"; +import {LevelDbController} from "@lodestar/db"; import {getNodeLogger} from "@lodestar/logger/node"; import {EpochTransitionStep, StateCloneSource, StateHashTreeRootSource} from "@lodestar/state-transition"; -import {LevelDbController} from "@lodestar/db"; +import {BeaconDb} from "../../db/index.js"; import {RegistryMetricCreator, collectNodeJSMetrics} from "../../metrics/index.js"; import {JobFnQueue} from "../../util/queue/fnQueue.js"; import {QueueMetrics} from "../../util/queue/options.js"; -import {BeaconDb} from "../../db/index.js"; +import {getHistoricalState} from "./getHistoricalState.js"; import { HistoricalStateRegenMetrics, HistoricalStateWorkerApi, HistoricalStateWorkerData, RegenErrorType, } from "./types.js"; -import {getHistoricalState} from "./getHistoricalState.js"; // most of this setup copied from networkCoreWorker.ts diff --git a/packages/beacon-node/src/chain/initState.ts b/packages/beacon-node/src/chain/initState.ts index 2883cdc8388e..ff683867d14b 100644 --- a/packages/beacon-node/src/chain/initState.ts +++ b/packages/beacon-node/src/chain/initState.ts @@ -1,17 +1,17 @@ +import {ChainForkConfig} from "@lodestar/config"; import { - computeEpochAtSlot, BeaconStateAllForks, CachedBeaconStateAllForks, + computeEpochAtSlot, computeStartSlotAtEpoch, } from "@lodestar/state-transition"; import {SignedBeaconBlock} from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; import {Logger, toHex, toRootHex} from "@lodestar/utils"; import {GENESIS_SLOT} from "../constants/index.js"; import {IBeaconDb} from "../db/index.js"; import {Eth1Provider} from "../eth1/index.js"; -import {Metrics} from "../metrics/index.js"; import {Eth1Options} from "../eth1/options.js"; +import {Metrics} from "../metrics/index.js"; import {GenesisBuilder} from "./genesis/genesis.js"; import {GenesisResult} from "./genesis/interface.js"; diff --git a/packages/beacon-node/src/chain/interface.ts b/packages/beacon-node/src/chain/interface.ts index 3b44ffd594ae..67b011ec0246 100644 --- a/packages/beacon-node/src/chain/interface.ts +++ b/packages/beacon-node/src/chain/interface.ts @@ -1,64 +1,64 @@ -import {CompositeTypeAny, TreeView, Type} from "@chainsafe/ssz"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; +import {CompositeTypeAny, TreeView, Type} from "@chainsafe/ssz"; +import {BeaconConfig} from "@lodestar/config"; +import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import { - UintNum64, + BeaconStateAllForks, + CachedBeaconStateAllForks, + EpochShuffling, + Index2PubkeyCache, +} from "@lodestar/state-transition"; +import { + BeaconBlock, + BlindedBeaconBlock, + Epoch, + ExecutionPayload, Root, - phase0, - Slot, RootHex, - Epoch, + SignedBeaconBlock, + Slot, + UintNum64, ValidatorIndex, - deneb, Wei, - capella, altair, - BeaconBlock, - ExecutionPayload, - SignedBeaconBlock, - BlindedBeaconBlock, + capella, + deneb, + phase0, } from "@lodestar/types"; -import { - BeaconStateAllForks, - CachedBeaconStateAllForks, - EpochShuffling, - Index2PubkeyCache, -} from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; import {Logger} from "@lodestar/utils"; -import {CheckpointWithHex, IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {IEth1ForBlockProduction} from "../eth1/index.js"; -import {IExecutionEngine, IExecutionBuilder} from "../execution/index.js"; +import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js"; import {Metrics} from "../metrics/metrics.js"; -import {IClock} from "../util/clock.js"; import {BufferPool} from "../util/bufferPool.js"; +import {IClock} from "../util/clock.js"; +import {CheckpointBalancesCache} from "./balancesCache.js"; +import {BeaconProposerCache, ProposerPreparationData} from "./beaconProposerCache.js"; +import {BlockInput, ImportBlockOpts} from "./blocks/types.js"; +import {IBlsVerifier} from "./bls/index.js"; import {ChainEventEmitter} from "./emitter.js"; +import {ForkchoiceCaller} from "./forkChoice/index.js"; +import {LightClientServer} from "./lightClient/index.js"; +import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js"; +import {AttestationPool, OpPool, SyncCommitteeMessagePool, SyncContributionAndProofPool} from "./opPools/index.js"; +import {IChainOptions} from "./options.js"; +import {AssembledBlockType, BlockAttributes, BlockType} from "./produceBlock/produceBlockBody.js"; import {IStateRegenerator, RegenCaller} from "./regen/index.js"; -import {IBlsVerifier} from "./bls/index.js"; +import {ReprocessController} from "./reprocess.js"; +import {AttestationsRewards} from "./rewards/attestationsRewards.js"; +import {BlockRewards} from "./rewards/blockRewards.js"; +import {SyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js"; import { - SeenAttesters, SeenAggregators, + SeenAttesters, SeenBlockProposers, - SeenSyncCommitteeMessages, SeenContributionAndProof, + SeenSyncCommitteeMessages, } from "./seenCache/index.js"; -import {AttestationPool, OpPool, SyncCommitteeMessagePool, SyncContributionAndProofPool} from "./opPools/index.js"; -import {LightClientServer} from "./lightClient/index.js"; -import {AggregatedAttestationPool} from "./opPools/aggregatedAttestationPool.js"; -import {BlockInput, ImportBlockOpts} from "./blocks/types.js"; -import {ReprocessController} from "./reprocess.js"; +import {SeenGossipBlockInput} from "./seenCache/index.js"; import {SeenAggregatedAttestations} from "./seenCache/seenAggregateAndProof.js"; -import {BeaconProposerCache, ProposerPreparationData} from "./beaconProposerCache.js"; -import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js"; -import {CheckpointBalancesCache} from "./balancesCache.js"; -import {IChainOptions} from "./options.js"; -import {AssembledBlockType, BlockAttributes, BlockType} from "./produceBlock/produceBlockBody.js"; import {SeenAttestationDatas} from "./seenCache/seenAttestationData.js"; -import {SeenGossipBlockInput} from "./seenCache/index.js"; +import {SeenBlockAttesters} from "./seenCache/seenBlockAttesters.js"; import {ShufflingCache} from "./shufflingCache.js"; -import {BlockRewards} from "./rewards/blockRewards.js"; -import {AttestationsRewards} from "./rewards/attestationsRewards.js"; -import {SyncCommitteeRewards} from "./rewards/syncCommitteeRewards.js"; -import {ForkchoiceCaller} from "./forkChoice/index.js"; export {BlockType, type AssembledBlockType}; export {type ProposerPreparationData}; diff --git a/packages/beacon-node/src/chain/lightClient/index.ts b/packages/beacon-node/src/chain/lightClient/index.ts index 0a41ea059e73..94dadbd2a646 100644 --- a/packages/beacon-node/src/chain/lightClient/index.ts +++ b/packages/beacon-node/src/chain/lightClient/index.ts @@ -1,6 +1,30 @@ import {BitArray, CompositeViewDU} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; +import {ChainForkConfig} from "@lodestar/config"; +import { + LightClientUpdateSummary, + isBetterUpdate, + toLightClientUpdateSummary, + upgradeLightClientHeader, +} from "@lodestar/light-client/spec"; +import { + ForkExecution, + ForkLightClient, + ForkName, + ForkSeq, + MIN_SYNC_COMMITTEE_PARTICIPANTS, + SYNC_COMMITTEE_SIZE, + forkLightClient, + highestFork, +} from "@lodestar/params"; +import { + CachedBeaconStateAltair, + computeStartSlotAtEpoch, + computeSyncPeriodAtEpoch, + computeSyncPeriodAtSlot, + executionPayloadToPayloadHeader, +} from "@lodestar/state-transition"; import { - altair, BeaconBlock, BeaconBlockBody, LightClientBootstrap, @@ -8,54 +32,30 @@ import { LightClientHeader, LightClientOptimisticUpdate, LightClientUpdate, - phase0, Root, RootHex, + SSZTypesFor, Slot, + SyncPeriod, + altair, + phase0, ssz, sszTypesFor, - SSZTypesFor, - SyncPeriod, } from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; -import { - CachedBeaconStateAltair, - computeStartSlotAtEpoch, - computeSyncPeriodAtEpoch, - computeSyncPeriodAtSlot, - executionPayloadToPayloadHeader, -} from "@lodestar/state-transition"; -import { - isBetterUpdate, - toLightClientUpdateSummary, - LightClientUpdateSummary, - upgradeLightClientHeader, -} from "@lodestar/light-client/spec"; import {Logger, MapDef, pruneSetToMax, toRootHex} from "@lodestar/utils"; -import {routes} from "@lodestar/api"; -import { - MIN_SYNC_COMMITTEE_PARTICIPANTS, - SYNC_COMMITTEE_SIZE, - ForkName, - ForkSeq, - ForkExecution, - ForkLightClient, - highestFork, - forkLightClient, -} from "@lodestar/params"; +import {ZERO_HASH} from "../../constants/index.js"; import {IBeaconDb} from "../../db/index.js"; import {Metrics} from "../../metrics/index.js"; -import {ChainEventEmitter} from "../emitter.js"; import {byteArrayEquals} from "../../util/bytes.js"; -import {ZERO_HASH} from "../../constants/index.js"; +import {ChainEventEmitter} from "../emitter.js"; import {LightClientServerError, LightClientServerErrorCode} from "../errors/lightClientError.js"; import { + getBlockBodyExecutionHeaderProof, + getCurrentSyncCommitteeBranch, + getFinalizedRootProof, getNextSyncCommitteeBranch, getSyncCommitteesWitness, - getFinalizedRootProof, - getCurrentSyncCommitteeBranch, - getBlockBodyExecutionHeaderProof, } from "./proofs.js"; export type LightClientServerOpts = { diff --git a/packages/beacon-node/src/chain/lightClient/proofs.ts b/packages/beacon-node/src/chain/lightClient/proofs.ts index 8d273e30ae5c..d4380e66255f 100644 --- a/packages/beacon-node/src/chain/lightClient/proofs.ts +++ b/packages/beacon-node/src/chain/lightClient/proofs.ts @@ -1,11 +1,11 @@ import {Tree} from "@chainsafe/persistent-merkle-tree"; -import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition"; import { - FINALIZED_ROOT_GINDEX, BLOCK_BODY_EXECUTION_PAYLOAD_GINDEX, - ForkExecution, + FINALIZED_ROOT_GINDEX, FINALIZED_ROOT_GINDEX_ELECTRA, + ForkExecution, } from "@lodestar/params"; +import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {BeaconBlockBody, SSZTypesFor, ssz} from "@lodestar/types"; import {SyncCommitteeWitness} from "./types.js"; diff --git a/packages/beacon-node/src/chain/opPools/aggregatedAttestationPool.ts b/packages/beacon-node/src/chain/opPools/aggregatedAttestationPool.ts index 92d7383b8cad..c4d76db96997 100644 --- a/packages/beacon-node/src/chain/opPools/aggregatedAttestationPool.ts +++ b/packages/beacon-node/src/chain/opPools/aggregatedAttestationPool.ts @@ -1,40 +1,40 @@ -import {aggregateSignatures, Signature} from "@chainsafe/blst"; +import {Signature, aggregateSignatures} from "@chainsafe/blst"; import {BitArray} from "@chainsafe/ssz"; +import {ChainForkConfig} from "@lodestar/config"; +import {EpochDifference, IForkChoice} from "@lodestar/fork-choice"; import { ForkName, ForkSeq, - isForkPostElectra, MAX_ATTESTATIONS, MAX_ATTESTATIONS_ELECTRA, MAX_COMMITTEES_PER_SLOT, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH, + isForkPostElectra, } from "@lodestar/params"; -import { - phase0, - Epoch, - Slot, - ssz, - ValidatorIndex, - RootHex, - electra, - isElectraAttestation, - Attestation, -} from "@lodestar/types"; import { CachedBeaconStateAllForks, - CachedBeaconStatePhase0, CachedBeaconStateAltair, + CachedBeaconStatePhase0, computeEpochAtSlot, computeStartSlotAtEpoch, getBlockRootAtSlot, } from "@lodestar/state-transition"; -import {IForkChoice, EpochDifference} from "@lodestar/fork-choice"; -import {MapDef, toRootHex, assert} from "@lodestar/utils"; -import {ChainForkConfig} from "@lodestar/config"; -import {intersectUint8Arrays, IntersectResult} from "../../util/bitArray.js"; -import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js"; +import { + Attestation, + Epoch, + RootHex, + Slot, + ValidatorIndex, + electra, + isElectraAttestation, + phase0, + ssz, +} from "@lodestar/types"; +import {assert, MapDef, toRootHex} from "@lodestar/utils"; +import {IntersectResult, intersectUint8Arrays} from "../../util/bitArray.js"; import {InsertOutcome} from "./types.js"; +import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js"; type DataRootHex = string; diff --git a/packages/beacon-node/src/chain/opPools/attestationPool.ts b/packages/beacon-node/src/chain/opPools/attestationPool.ts index 8d8fbb92c0f1..9809c9c6304a 100644 --- a/packages/beacon-node/src/chain/opPools/attestationPool.ts +++ b/packages/beacon-node/src/chain/opPools/attestationPool.ts @@ -1,9 +1,9 @@ -import {BitArray} from "@chainsafe/ssz"; import {Signature, aggregateSignatures} from "@chainsafe/blst"; -import {Slot, RootHex, isElectraAttestation, Attestation} from "@lodestar/types"; -import {MapDef, assert} from "@lodestar/utils"; -import {isForkPostElectra} from "@lodestar/params"; +import {BitArray} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; +import {isForkPostElectra} from "@lodestar/params"; +import {Attestation, RootHex, Slot, isElectraAttestation} from "@lodestar/types"; +import {assert, MapDef} from "@lodestar/utils"; import {IClock} from "../../util/clock.js"; import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js"; import {isElectraAggregate, pruneBySlot, signatureFromBytesNoCheck} from "./utils.js"; diff --git a/packages/beacon-node/src/chain/opPools/opPool.ts b/packages/beacon-node/src/chain/opPools/opPool.ts index f71186c06d35..5eec1597a24e 100644 --- a/packages/beacon-node/src/chain/opPools/opPool.ts +++ b/packages/beacon-node/src/chain/opPools/opPool.ts @@ -1,3 +1,13 @@ +import {Id, Repository} from "@lodestar/db"; +import { + BLS_WITHDRAWAL_PREFIX, + ForkSeq, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTER_SLASHINGS_ELECTRA, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_PROPOSER_SLASHINGS, + MAX_VOLUNTARY_EXITS, +} from "@lodestar/params"; import { CachedBeaconStateAllForks, computeEpochAtSlot, @@ -5,22 +15,12 @@ import { getAttesterSlashableIndices, isValidVoluntaryExit, } from "@lodestar/state-transition"; -import {Repository, Id} from "@lodestar/db"; -import { - MAX_PROPOSER_SLASHINGS, - MAX_VOLUNTARY_EXITS, - MAX_BLS_TO_EXECUTION_CHANGES, - BLS_WITHDRAWAL_PREFIX, - MAX_ATTESTER_SLASHINGS, - ForkSeq, - MAX_ATTESTER_SLASHINGS_ELECTRA, -} from "@lodestar/params"; +import {AttesterSlashing, Epoch, SignedBeaconBlock, ValidatorIndex, capella, phase0, ssz} from "@lodestar/types"; import {fromHex, toHex, toRootHex} from "@lodestar/utils"; -import {Epoch, phase0, capella, ssz, ValidatorIndex, SignedBeaconBlock, AttesterSlashing} from "@lodestar/types"; import {IBeaconDb} from "../../db/index.js"; +import {Metrics} from "../../metrics/metrics.js"; import {SignedBLSToExecutionChangeVersioned} from "../../util/types.js"; import {BlockType} from "../interface.js"; -import {Metrics} from "../../metrics/metrics.js"; import {BlockProductionStep} from "../produceBlock/produceBlockBody.js"; import {isValidBlsToExecutionChangeForBlockInclusion} from "./utils.js"; diff --git a/packages/beacon-node/src/chain/opPools/syncCommitteeMessagePool.ts b/packages/beacon-node/src/chain/opPools/syncCommitteeMessagePool.ts index 4de11e447231..6551ee625491 100644 --- a/packages/beacon-node/src/chain/opPools/syncCommitteeMessagePool.ts +++ b/packages/beacon-node/src/chain/opPools/syncCommitteeMessagePool.ts @@ -1,7 +1,7 @@ -import {BitArray} from "@chainsafe/ssz"; import {Signature, aggregateSignatures} from "@chainsafe/blst"; +import {BitArray} from "@chainsafe/ssz"; import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; -import {altair, Root, Slot, SubcommitteeIndex} from "@lodestar/types"; +import {Root, Slot, SubcommitteeIndex, altair} from "@lodestar/types"; import {MapDef, toRootHex} from "@lodestar/utils"; import {IClock} from "../../util/clock.js"; import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js"; diff --git a/packages/beacon-node/src/chain/opPools/syncContributionAndProofPool.ts b/packages/beacon-node/src/chain/opPools/syncContributionAndProofPool.ts index 81363be218d8..0f25032e1d7e 100644 --- a/packages/beacon-node/src/chain/opPools/syncContributionAndProofPool.ts +++ b/packages/beacon-node/src/chain/opPools/syncContributionAndProofPool.ts @@ -1,8 +1,8 @@ -import {BitArray} from "@chainsafe/ssz"; import {Signature, aggregateSignatures} from "@chainsafe/blst"; +import {BitArray} from "@chainsafe/ssz"; import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params"; -import {altair, Slot, Root, ssz} from "@lodestar/types"; import {G2_POINT_AT_INFINITY} from "@lodestar/state-transition"; +import {Root, Slot, altair, ssz} from "@lodestar/types"; import {MapDef, toRootHex} from "@lodestar/utils"; import {InsertOutcome, OpPoolError, OpPoolErrorCode} from "./types.js"; import {pruneBySlot, signatureFromBytesNoCheck} from "./utils.js"; diff --git a/packages/beacon-node/src/chain/options.ts b/packages/beacon-node/src/chain/options.ts index cf83c4432984..f87fffd7b363 100644 --- a/packages/beacon-node/src/chain/options.ts +++ b/packages/beacon-node/src/chain/options.ts @@ -1,5 +1,6 @@ import {SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY} from "@lodestar/params"; import {defaultOptions as defaultValidatorOptions} from "@lodestar/validator"; +import {DEFAULT_STATE_ARCHIVE_MODE} from "./archiver/archiver.js"; import {ArchiverOpts} from "./archiver/interface.js"; import {ForkChoiceOpts} from "./forkChoice/index.js"; import {LightClientServerOpts} from "./lightClient/index.js"; @@ -7,7 +8,6 @@ import {ShufflingCacheOpts} from "./shufflingCache.js"; import {DEFAULT_MAX_BLOCK_STATES, FIFOBlockStateCacheOpts} from "./stateCache/fifoBlockStateCache.js"; import {PersistentCheckpointStateCacheOpts} from "./stateCache/persistentCheckpointsCache.js"; import {DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY} from "./stateCache/persistentCheckpointsCache.js"; -import {DEFAULT_STATE_ARCHIVE_MODE} from "./archiver/archiver.js"; export {StateArchiveMode} from "./archiver/interface.js"; export {DEFAULT_STATE_ARCHIVE_MODE} from "./archiver/archiver.js"; diff --git a/packages/beacon-node/src/chain/prepareNextSlot.ts b/packages/beacon-node/src/chain/prepareNextSlot.ts index bda618758842..40cadb3774c7 100644 --- a/packages/beacon-node/src/chain/prepareNextSlot.ts +++ b/packages/beacon-node/src/chain/prepareNextSlot.ts @@ -1,24 +1,24 @@ +import {routes} from "@lodestar/api"; +import {ChainForkConfig} from "@lodestar/config"; +import {ForkExecution, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; import { - computeEpochAtSlot, - isExecutionStateType, - computeTimeAtSlot, + CachedBeaconStateAllForks, CachedBeaconStateExecutions, StateHashTreeRootSource, - CachedBeaconStateAllForks, + computeEpochAtSlot, + computeTimeAtSlot, + isExecutionStateType, } from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; -import {ForkSeq, SLOTS_PER_EPOCH, ForkExecution} from "@lodestar/params"; import {Slot} from "@lodestar/types"; -import {Logger, sleep, fromHex, isErrorAborted} from "@lodestar/utils"; -import {routes} from "@lodestar/api"; +import {Logger, fromHex, isErrorAborted, sleep} from "@lodestar/utils"; import {GENESIS_SLOT, ZERO_HASH_HEX} from "../constants/constants.js"; import {Metrics} from "../metrics/index.js"; import {ClockEvent} from "../util/clock.js"; import {isQueueErrorAborted} from "../util/queue/index.js"; -import {prepareExecutionPayload, getPayloadAttributesForSSE} from "./produceBlock/produceBlockBody.js"; +import {ForkchoiceCaller} from "./forkChoice/index.js"; import {IBeaconChain} from "./interface.js"; +import {getPayloadAttributesForSSE, prepareExecutionPayload} from "./produceBlock/produceBlockBody.js"; import {RegenCaller} from "./regen/index.js"; -import {ForkchoiceCaller} from "./forkChoice/index.js"; /* With 12s slot times, this scheduler will run 4s before the start of each slot (`12 / 3 = 4`). */ export const SCHEDULER_LOOKAHEAD_FACTOR = 3; diff --git a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts index a353c4e54ff9..d26703050070 100644 --- a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts +++ b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts @@ -1,44 +1,44 @@ +import {ChainForkConfig} from "@lodestar/config"; +import {ForkExecution, ForkSeq, isForkExecution} from "@lodestar/params"; +import { + CachedBeaconStateAllForks, + CachedBeaconStateBellatrix, + CachedBeaconStateCapella, + CachedBeaconStateExecutions, + computeEpochAtSlot, + computeTimeAtSlot, + getCurrentEpoch, + getExpectedWithdrawals, + getRandaoMix, + isMergeTransitionComplete, +} from "@lodestar/state-transition"; import { + BLSPubkey, + BLSSignature, + BeaconBlock, + BeaconBlockBody, + BlindedBeaconBlock, + BlindedBeaconBlockBody, Bytes32, + ExecutionPayloadHeader, Root, RootHex, + SSEPayloadAttributes, Slot, - ssz, ValidatorIndex, - BLSPubkey, - BLSSignature, + Wei, capella, deneb, - Wei, - SSEPayloadAttributes, - BeaconBlock, - BeaconBlockBody, - ExecutionPayloadHeader, - BlindedBeaconBlockBody, - BlindedBeaconBlock, - sszTypesFor, electra, + ssz, + sszTypesFor, } from "@lodestar/types"; -import { - CachedBeaconStateAllForks, - CachedBeaconStateCapella, - CachedBeaconStateBellatrix, - CachedBeaconStateExecutions, - computeEpochAtSlot, - computeTimeAtSlot, - getRandaoMix, - getCurrentEpoch, - isMergeTransitionComplete, - getExpectedWithdrawals, -} from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; -import {ForkSeq, ForkExecution, isForkExecution} from "@lodestar/params"; -import {toHex, sleep, Logger, toRootHex} from "@lodestar/utils"; -import type {BeaconChain} from "../chain.js"; -import {PayloadId, IExecutionEngine, IExecutionBuilder, PayloadAttributes} from "../../execution/index.js"; +import {Logger, sleep, toHex, toRootHex} from "@lodestar/utils"; import {ZERO_HASH, ZERO_HASH_HEX} from "../../constants/index.js"; import {IEth1ForBlockProduction} from "../../eth1/index.js"; import {numToQuantity} from "../../eth1/provider/utils.js"; +import {IExecutionBuilder, IExecutionEngine, PayloadAttributes, PayloadId} from "../../execution/index.js"; +import type {BeaconChain} from "../chain.js"; import {CommonBlockBody} from "../interface.js"; import {validateBlobsAndKzgCommitments} from "./validateBlobsAndKzgCommitments.js"; diff --git a/packages/beacon-node/src/chain/regen/errors.ts b/packages/beacon-node/src/chain/regen/errors.ts index 7c1573b415f8..eb41e8321da3 100644 --- a/packages/beacon-node/src/chain/regen/errors.ts +++ b/packages/beacon-node/src/chain/regen/errors.ts @@ -1,4 +1,4 @@ -import {Root, Slot, RootHex} from "@lodestar/types"; +import {Root, RootHex, Slot} from "@lodestar/types"; export enum RegenErrorCode { BLOCK_NOT_IN_FORKCHOICE = "REGEN_ERROR_BLOCK_NOT_IN_FORKCHOICE", diff --git a/packages/beacon-node/src/chain/regen/interface.ts b/packages/beacon-node/src/chain/regen/interface.ts index 031d19860789..b70fbc059875 100644 --- a/packages/beacon-node/src/chain/regen/interface.ts +++ b/packages/beacon-node/src/chain/regen/interface.ts @@ -1,7 +1,7 @@ -import {phase0, Slot, RootHex, Epoch, BeaconBlock} from "@lodestar/types"; -import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {routes} from "@lodestar/api"; import {ProtoBlock} from "@lodestar/fork-choice"; +import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types"; import {CheckpointHex} from "../stateCache/index.js"; export enum RegenCaller { diff --git a/packages/beacon-node/src/chain/regen/queued.ts b/packages/beacon-node/src/chain/regen/queued.ts index 694e8635a3b7..7b812c04dc8d 100644 --- a/packages/beacon-node/src/chain/regen/queued.ts +++ b/packages/beacon-node/src/chain/regen/queued.ts @@ -1,15 +1,15 @@ -import {phase0, Slot, RootHex, Epoch, BeaconBlock} from "@lodestar/types"; +import {routes} from "@lodestar/api"; import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {CachedBeaconStateAllForks, UnfinalizedPubkeyIndexMap, computeEpochAtSlot} from "@lodestar/state-transition"; +import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types"; import {Logger, toRootHex} from "@lodestar/utils"; -import {routes} from "@lodestar/api"; -import {CheckpointHex, toCheckpointHex} from "../stateCache/index.js"; 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 {IStateRegenerator, IStateRegeneratorInternal, RegenCaller, RegenFnName, StateCloneOpts} from "./interface.js"; -import {StateRegenerator, RegenModules} from "./regen.js"; import {RegenError, RegenErrorCode} from "./errors.js"; +import {IStateRegenerator, IStateRegeneratorInternal, RegenCaller, RegenFnName, StateCloneOpts} from "./interface.js"; +import {RegenModules, StateRegenerator} from "./regen.js"; const REGEN_QUEUE_MAX_LEN = 256; // TODO: Should this constant be lower than above? 256 feels high diff --git a/packages/beacon-node/src/chain/regen/regen.ts b/packages/beacon-node/src/chain/regen/regen.ts index 7c663c6e0d3d..073556d8162f 100644 --- a/packages/beacon-node/src/chain/regen/regen.ts +++ b/packages/beacon-node/src/chain/regen/regen.ts @@ -1,26 +1,26 @@ -import {phase0, Slot, RootHex, BeaconBlock, SignedBeaconBlock} from "@lodestar/types"; +import {ChainForkConfig} from "@lodestar/config"; +import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import { CachedBeaconStateAllForks, + DataAvailableStatus, + ExecutionPayloadStatus, + StateHashTreeRootSource, computeEpochAtSlot, computeStartSlotAtEpoch, - ExecutionPayloadStatus, - DataAvailableStatus, processSlots, stateTransition, - StateHashTreeRootSource, } from "@lodestar/state-transition"; -import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; +import {BeaconBlock, RootHex, SignedBeaconBlock, Slot, phase0} from "@lodestar/types"; import {Logger, fromHex, toRootHex} from "@lodestar/utils"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {ChainForkConfig} from "@lodestar/config"; -import {Metrics} from "../../metrics/index.js"; import {IBeaconDb} from "../../db/index.js"; +import {Metrics} from "../../metrics/index.js"; +import {nextEventLoop} from "../../util/eventLoop.js"; import {getCheckpointFromState} from "../blocks/utils/checkpoint.js"; import {ChainEvent, ChainEventEmitter} from "../emitter.js"; -import {CheckpointStateCache, BlockStateCache} from "../stateCache/types.js"; -import {nextEventLoop} from "../../util/eventLoop.js"; -import {IStateRegeneratorInternal, RegenCaller, StateCloneOpts} from "./interface.js"; +import {BlockStateCache, CheckpointStateCache} from "../stateCache/types.js"; import {RegenError, RegenErrorCode} from "./errors.js"; +import {IStateRegeneratorInternal, RegenCaller, StateCloneOpts} from "./interface.js"; export type RegenModules = { db: IBeaconDb; diff --git a/packages/beacon-node/src/chain/reprocess.ts b/packages/beacon-node/src/chain/reprocess.ts index 4c91ef07ff69..a4d8fa43967d 100644 --- a/packages/beacon-node/src/chain/reprocess.ts +++ b/packages/beacon-node/src/chain/reprocess.ts @@ -1,4 +1,4 @@ -import {Slot, RootHex} from "@lodestar/types"; +import {RootHex, Slot} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; import {Metrics} from "../metrics/index.js"; diff --git a/packages/beacon-node/src/chain/rewards/attestationsRewards.ts b/packages/beacon-node/src/chain/rewards/attestationsRewards.ts index 588b310f87ea..14f2f1ccbc79 100644 --- a/packages/beacon-node/src/chain/rewards/attestationsRewards.ts +++ b/packages/beacon-node/src/chain/rewards/attestationsRewards.ts @@ -1,4 +1,5 @@ -import {Epoch, ValidatorIndex} from "@lodestar/types"; +import {routes} from "@lodestar/api"; +import {BeaconConfig} from "@lodestar/config"; import { EFFECTIVE_BALANCE_INCREMENT, ForkName, @@ -10,7 +11,6 @@ import { TIMELY_TARGET_FLAG_INDEX, WEIGHT_DENOMINATOR, } from "@lodestar/params"; -import {routes} from "@lodestar/api"; import { CachedBeaconStateAllForks, CachedBeaconStateAltair, @@ -23,7 +23,7 @@ import { hasMarkers, isInInactivityLeak, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; +import {Epoch, ValidatorIndex} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; export type AttestationsRewards = routes.beacon.AttestationsRewards; diff --git a/packages/beacon-node/src/chain/rewards/blockRewards.ts b/packages/beacon-node/src/chain/rewards/blockRewards.ts index 19a59aaa028e..4b9c95de4c3b 100644 --- a/packages/beacon-node/src/chain/rewards/blockRewards.ts +++ b/packages/beacon-node/src/chain/rewards/blockRewards.ts @@ -1,3 +1,5 @@ +import {routes} from "@lodestar/api"; +import {ForkName, WHISTLEBLOWER_REWARD_QUOTIENT} from "@lodestar/params"; import { CachedBeaconStateAllForks, CachedBeaconStateAltair, @@ -6,8 +8,6 @@ import { processAttestationsAltair, } from "@lodestar/state-transition"; import {BeaconBlock, altair, phase0} from "@lodestar/types"; -import {ForkName, WHISTLEBLOWER_REWARD_QUOTIENT} from "@lodestar/params"; -import {routes} from "@lodestar/api"; export type BlockRewards = routes.beacon.BlockRewards; type SubRewardValue = number; // All reward values should be integer diff --git a/packages/beacon-node/src/chain/rewards/syncCommitteeRewards.ts b/packages/beacon-node/src/chain/rewards/syncCommitteeRewards.ts index 71d345e32811..55ab69ec0285 100644 --- a/packages/beacon-node/src/chain/rewards/syncCommitteeRewards.ts +++ b/packages/beacon-node/src/chain/rewards/syncCommitteeRewards.ts @@ -1,7 +1,7 @@ +import {routes} from "@lodestar/api"; +import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "@lodestar/state-transition"; import {BeaconBlock, ValidatorIndex, altair} from "@lodestar/types"; -import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {routes} from "@lodestar/api"; export type SyncCommitteeRewards = routes.beacon.SyncCommitteeRewards; type BalanceRecord = {val: number}; // Use val for convenient way to increment/decrement balance diff --git a/packages/beacon-node/src/chain/seenCache/seenAttestationData.ts b/packages/beacon-node/src/chain/seenCache/seenAttestationData.ts index a0aa6db35893..8e0dfcb3bd96 100644 --- a/packages/beacon-node/src/chain/seenCache/seenAttestationData.ts +++ b/packages/beacon-node/src/chain/seenCache/seenAttestationData.ts @@ -1,5 +1,5 @@ import {BitArray} from "@chainsafe/ssz"; -import {CommitteeIndex, phase0, RootHex, Slot} from "@lodestar/types"; +import {CommitteeIndex, RootHex, Slot, phase0} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; import {Metrics} from "../../metrics/metrics.js"; import {InsertOutcome} from "../opPools/types.js"; diff --git a/packages/beacon-node/src/chain/seenCache/seenCommittee.ts b/packages/beacon-node/src/chain/seenCache/seenCommittee.ts index 38d7f67c74a2..9d7e930c94d7 100644 --- a/packages/beacon-node/src/chain/seenCache/seenCommittee.ts +++ b/packages/beacon-node/src/chain/seenCache/seenCommittee.ts @@ -1,4 +1,4 @@ -import {SubcommitteeIndex, Slot, ValidatorIndex, RootHex} from "@lodestar/types"; +import {RootHex, Slot, SubcommitteeIndex, ValidatorIndex} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; /** diff --git a/packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts b/packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts index 1c03979b7d77..fd0d396bb0ba 100644 --- a/packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts +++ b/packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts @@ -1,20 +1,20 @@ -import {deneb, RootHex, SignedBeaconBlock, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {BLOBSIDECAR_FIXED_SIZE, ForkName, isForkBlobs} from "@lodestar/params"; +import {RootHex, SignedBeaconBlock, deneb, ssz} from "@lodestar/types"; import {pruneSetToMax, toRootHex} from "@lodestar/utils"; -import {BLOBSIDECAR_FIXED_SIZE, isForkBlobs, ForkName} from "@lodestar/params"; +import {Metrics} from "../../metrics/index.js"; import { + BlobsSource, BlockInput, - NullBlockInput, - getBlockInput, - BlockSource, BlockInputDataBlobs, + BlockSource, CachedData, GossipedInputType, + NullBlockInput, + getBlockInput, getBlockInputBlobs, - BlobsSource, } from "../blocks/types.js"; -import {Metrics} from "../../metrics/index.js"; export enum BlockInputAvailabilitySource { GOSSIP = "gossip", diff --git a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts index 1cb67cd6cf09..886f6e386309 100644 --- a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts +++ b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts @@ -1,6 +1,6 @@ -import {Epoch, RootHex} from "@lodestar/types"; -import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {routes} from "@lodestar/api"; +import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {Epoch, RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; import {StateCloneOpts} from "../regen/interface.js"; diff --git a/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts b/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts index 7766daf3c5b3..eec1fce5d6c2 100644 --- a/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts +++ b/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts @@ -1,6 +1,6 @@ -import {RootHex} from "@lodestar/types"; -import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {routes} from "@lodestar/api"; +import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; import {LinkedList} from "../../util/array.js"; diff --git a/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts index 38aeabb97955..4caa6779f697 100644 --- a/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts @@ -1,11 +1,11 @@ -import {phase0, Epoch, RootHex} from "@lodestar/types"; +import {routes} from "@lodestar/api"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {Epoch, RootHex, phase0} from "@lodestar/types"; import {MapDef, toRootHex} from "@lodestar/utils"; -import {routes} from "@lodestar/api"; import {Metrics} from "../../metrics/index.js"; import {StateCloneOpts} from "../regen/interface.js"; import {MapTracker} from "./mapMetrics.js"; -import {CheckpointStateCache, CacheItemType} from "./types.js"; +import {CacheItemType, CheckpointStateCache} from "./types.js"; export type CheckpointHex = {epoch: Epoch; rootHex: RootHex}; const MAX_EPOCHS = 10; diff --git a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts index 0719efcfd309..4c9a8b0f1265 100644 --- a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts @@ -1,18 +1,18 @@ -import {phase0, Epoch, RootHex} from "@lodestar/types"; -import {CachedBeaconStateAllForks, computeStartSlotAtEpoch, getBlockRootAtSlot} from "@lodestar/state-transition"; -import {Logger, MapDef, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils"; import {routes} from "@lodestar/api"; -import {loadCachedBeaconState} from "@lodestar/state-transition"; import {INTERVALS_PER_SLOT} from "@lodestar/params"; +import {CachedBeaconStateAllForks, computeStartSlotAtEpoch, getBlockRootAtSlot} from "@lodestar/state-transition"; +import {loadCachedBeaconState} from "@lodestar/state-transition"; +import {Epoch, RootHex, phase0} from "@lodestar/types"; +import {Logger, MapDef, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; -import {IClock} from "../../util/clock.js"; -import {ShufflingCache} from "../shufflingCache.js"; import {AllocSource, BufferPool, BufferWithKey} from "../../util/bufferPool.js"; +import {IClock} from "../../util/clock.js"; import {StateCloneOpts} from "../regen/interface.js"; import {serializeState} from "../serializeState.js"; -import {MapTracker} from "./mapMetrics.js"; +import {ShufflingCache} from "../shufflingCache.js"; import {CPStateDatastore, DatastoreKey, datastoreKeyToCheckpoint} from "./datastore/index.js"; -import {CheckpointHex, CacheItemType, CheckpointStateCache, BlockStateCache} from "./types.js"; +import {MapTracker} from "./mapMetrics.js"; +import {BlockStateCache, CacheItemType, CheckpointHex, CheckpointStateCache} from "./types.js"; export type PersistentCheckpointStateCacheOpts = { /** Keep max n states in memory, persist the rest to disk */ diff --git a/packages/beacon-node/src/chain/stateCache/types.ts b/packages/beacon-node/src/chain/stateCache/types.ts index 1e8d6bd1bd62..403b469dd352 100644 --- a/packages/beacon-node/src/chain/stateCache/types.ts +++ b/packages/beacon-node/src/chain/stateCache/types.ts @@ -1,6 +1,6 @@ +import {routes} from "@lodestar/api"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {Epoch, RootHex, phase0} from "@lodestar/types"; -import {routes} from "@lodestar/api"; import {StateCloneOpts} from "../regen/interface.js"; export type CheckpointHex = {epoch: Epoch; rootHex: RootHex}; diff --git a/packages/beacon-node/src/chain/validation/aggregateAndProof.ts b/packages/beacon-node/src/chain/validation/aggregateAndProof.ts index 6d6eab6ec15a..781e63cf623a 100644 --- a/packages/beacon-node/src/chain/validation/aggregateAndProof.ts +++ b/packages/beacon-node/src/chain/validation/aggregateAndProof.ts @@ -1,15 +1,14 @@ import {ForkName, ForkSeq} from "@lodestar/params"; -import {electra, phase0, RootHex, ssz, IndexedAttestation, SignedAggregateAndProof} from "@lodestar/types"; import { computeEpochAtSlot, - isAggregatorFromCommitteeLength, createAggregateSignatureSetFromComponents, + isAggregatorFromCommitteeLength, } from "@lodestar/state-transition"; +import {IndexedAttestation, RootHex, SignedAggregateAndProof, electra, phase0, ssz} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; -import {IBeaconChain} from "../index.js"; import {AttestationError, AttestationErrorCode, GossipAction} from "../errors/index.js"; +import {IBeaconChain} from "../index.js"; import {RegenCaller} from "../regen/index.js"; -import {getSelectionProofSignatureSet, getAggregateAndProofSignatureSet} from "./signatureSets/index.js"; import { getAttestationDataSigningRoot, getCommitteeIndices, @@ -18,6 +17,7 @@ import { verifyHeadBlockAndTargetRoot, verifyPropagationSlotRange, } from "./attestation.js"; +import {getAggregateAndProofSignatureSet, getSelectionProofSignatureSet} from "./signatureSets/index.js"; export type AggregateAndProofValidationResult = { indexedAttestation: IndexedAttestation; diff --git a/packages/beacon-node/src/chain/validation/attestation.ts b/packages/beacon-node/src/chain/validation/attestation.ts index 0b3f490e4129..e49a3f79450c 100644 --- a/packages/beacon-node/src/chain/validation/attestation.ts +++ b/packages/beacon-node/src/chain/validation/attestation.ts @@ -1,54 +1,54 @@ import {BitArray} from "@chainsafe/ssz"; -import { - phase0, - Epoch, - Root, - Slot, - RootHex, - ssz, - electra, - isElectraAttestation, - CommitteeIndex, - Attestation, - IndexedAttestation, -} from "@lodestar/types"; +import {BeaconConfig} from "@lodestar/config"; import {ProtoBlock} from "@lodestar/fork-choice"; import { ATTESTATION_SUBNET_COUNT, - SLOTS_PER_EPOCH, + DOMAIN_BEACON_ATTESTER, ForkName, ForkSeq, - DOMAIN_BEACON_ATTESTER, + SLOTS_PER_EPOCH, isForkPostElectra, } from "@lodestar/params"; import { - computeEpochAtSlot, - createSingleSignatureSetFromComponents, - SingleSignatureSet, EpochCacheError, EpochCacheErrorCode, EpochShuffling, - computeStartSlotAtEpoch, + SingleSignatureSet, + computeEpochAtSlot, computeSigningRoot, + computeStartSlotAtEpoch, + createSingleSignatureSetFromComponents, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; +import { + Attestation, + CommitteeIndex, + Epoch, + IndexedAttestation, + Root, + RootHex, + Slot, + electra, + isElectraAttestation, + phase0, + ssz, +} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; -import {AttestationError, AttestationErrorCode, GossipAction} from "../errors/index.js"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY_SEC} from "../../constants/index.js"; -import {RegenCaller} from "../regen/index.js"; +import {sszDeserializeAttestation} from "../../network/gossip/topic.js"; +import {getShufflingDependentRoot} from "../../util/dependentRoot.js"; import { getAggregationBitsFromAttestationSerialized, getAttDataFromSignedAggregateAndProofElectra, + getAttDataFromSignedAggregateAndProofPhase0, getCommitteeBitsFromAttestationSerialized, getCommitteeBitsFromSignedAggregateAndProofElectra, - getAttDataFromSignedAggregateAndProofPhase0, getSignatureFromAttestationSerialized, } from "../../util/sszBytes.js"; -import {AttestationDataCacheEntry, SeenAttDataKey} from "../seenCache/seenAttestationData.js"; -import {sszDeserializeAttestation} from "../../network/gossip/topic.js"; import {Result, wrapError} from "../../util/wrapError.js"; +import {AttestationError, AttestationErrorCode, GossipAction} from "../errors/index.js"; import {IBeaconChain} from "../interface.js"; -import {getShufflingDependentRoot} from "../../util/dependentRoot.js"; +import {RegenCaller} from "../regen/index.js"; +import {AttestationDataCacheEntry, SeenAttDataKey} from "../seenCache/seenAttestationData.js"; export type BatchResult = { results: Result[]; diff --git a/packages/beacon-node/src/chain/validation/attesterSlashing.ts b/packages/beacon-node/src/chain/validation/attesterSlashing.ts index 5da146a67a86..c097774ecb02 100644 --- a/packages/beacon-node/src/chain/validation/attesterSlashing.ts +++ b/packages/beacon-node/src/chain/validation/attesterSlashing.ts @@ -1,11 +1,11 @@ -import {phase0} from "@lodestar/types"; import { - getAttesterSlashableIndices, assertValidAttesterSlashing, + getAttesterSlashableIndices, getAttesterSlashingSignatureSets, } from "@lodestar/state-transition"; -import {IBeaconChain} from "../index.js"; +import {phase0} from "@lodestar/types"; import {AttesterSlashingError, AttesterSlashingErrorCode, GossipAction} from "../errors/index.js"; +import {IBeaconChain} from "../index.js"; export async function validateApiAttesterSlashing( chain: IBeaconChain, diff --git a/packages/beacon-node/src/chain/validation/blobSidecar.ts b/packages/beacon-node/src/chain/validation/blobSidecar.ts index 4c82d7be153d..3b90972f62b1 100644 --- a/packages/beacon-node/src/chain/validation/blobSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobSidecar.ts @@ -1,12 +1,12 @@ -import {deneb, Root, Slot, ssz} from "@lodestar/types"; -import {toRootHex, verifyMerkleBranch} from "@lodestar/utils"; -import {computeStartSlotAtEpoch, getBlockHeaderProposerSignatureSet} from "@lodestar/state-transition"; import {KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, KZG_COMMITMENT_SUBTREE_INDEX0} from "@lodestar/params"; +import {computeStartSlotAtEpoch, getBlockHeaderProposerSignatureSet} from "@lodestar/state-transition"; +import {Root, Slot, deneb, ssz} from "@lodestar/types"; +import {toRootHex, verifyMerkleBranch} from "@lodestar/utils"; -import {BlobSidecarGossipError, BlobSidecarErrorCode} from "../errors/blobSidecarError.js"; -import {GossipAction} from "../errors/gossipValidation.js"; -import {ckzg} from "../../util/kzg.js"; import {byteArrayEquals} from "../../util/bytes.js"; +import {ckzg} from "../../util/kzg.js"; +import {BlobSidecarErrorCode, BlobSidecarGossipError} from "../errors/blobSidecarError.js"; +import {GossipAction} from "../errors/gossipValidation.js"; import {IBeaconChain} from "../interface.js"; import {RegenCaller} from "../regen/index.js"; diff --git a/packages/beacon-node/src/chain/validation/block.ts b/packages/beacon-node/src/chain/validation/block.ts index aabc1b14958a..1b5251f77809 100644 --- a/packages/beacon-node/src/chain/validation/block.ts +++ b/packages/beacon-node/src/chain/validation/block.ts @@ -1,18 +1,18 @@ import {ChainForkConfig} from "@lodestar/config"; +import {ForkName} from "@lodestar/params"; import { computeStartSlotAtEpoch, computeTimeAtSlot, + getBlockProposerSignatureSet, isExecutionBlockBodyType, - isExecutionStateType, isExecutionEnabled, - getBlockProposerSignatureSet, + isExecutionStateType, } from "@lodestar/state-transition"; -import {sleep, toRootHex} from "@lodestar/utils"; -import {ForkName} from "@lodestar/params"; import {SignedBeaconBlock} from "@lodestar/types"; +import {sleep, toRootHex} from "@lodestar/utils"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../../constants/index.js"; +import {BlockErrorCode, BlockGossipError, GossipAction} from "../errors/index.js"; import {IBeaconChain} from "../interface.js"; -import {BlockGossipError, BlockErrorCode, GossipAction} from "../errors/index.js"; import {RegenCaller} from "../regen/index.js"; export async function validateGossipBlock( diff --git a/packages/beacon-node/src/chain/validation/blsToExecutionChange.ts b/packages/beacon-node/src/chain/validation/blsToExecutionChange.ts index fff399aada50..53e8b6f5d2b6 100644 --- a/packages/beacon-node/src/chain/validation/blsToExecutionChange.ts +++ b/packages/beacon-node/src/chain/validation/blsToExecutionChange.ts @@ -1,11 +1,11 @@ -import {capella} from "@lodestar/types"; import { - isValidBlsToExecutionChange, - getBlsToExecutionChangeSignatureSet, CachedBeaconStateCapella, + getBlsToExecutionChangeSignatureSet, + isValidBlsToExecutionChange, } from "@lodestar/state-transition"; -import {IBeaconChain} from "../index.js"; +import {capella} from "@lodestar/types"; import {BlsToExecutionChangeError, BlsToExecutionChangeErrorCode, GossipAction} from "../errors/index.js"; +import {IBeaconChain} from "../index.js"; export async function validateApiBlsToExecutionChange( chain: IBeaconChain, diff --git a/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts b/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts index 0b19495abde6..e19b3c28da87 100644 --- a/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts +++ b/packages/beacon-node/src/chain/validation/lightClientFinalityUpdate.ts @@ -1,9 +1,9 @@ import {ChainForkConfig} from "@lodestar/config"; import {LightClientFinalityUpdate} from "@lodestar/types"; -import {IBeaconChain} from "../interface.js"; -import {LightClientError, LightClientErrorCode} from "../errors/lightClientError.js"; -import {GossipAction} from "../errors/index.js"; import {assertLightClientServer} from "../../node/utils/lightclient.js"; +import {GossipAction} from "../errors/index.js"; +import {LightClientError, LightClientErrorCode} from "../errors/lightClientError.js"; +import {IBeaconChain} from "../interface.js"; import {updateReceivedTooEarly} from "./lightClientOptimisticUpdate.js"; // https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md#light_client_finality_update diff --git a/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts b/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts index 7a7dd7f34a91..49bffb3a5305 100644 --- a/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts +++ b/packages/beacon-node/src/chain/validation/lightClientOptimisticUpdate.ts @@ -1,11 +1,11 @@ import {ChainForkConfig} from "@lodestar/config"; import {computeTimeAtSlot} from "@lodestar/state-transition"; import {LightClientOptimisticUpdate} from "@lodestar/types"; -import {IBeaconChain} from "../interface.js"; -import {LightClientError, LightClientErrorCode} from "../errors/lightClientError.js"; -import {GossipAction} from "../errors/index.js"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../../constants/index.js"; import {assertLightClientServer} from "../../node/utils/lightclient.js"; +import {GossipAction} from "../errors/index.js"; +import {LightClientError, LightClientErrorCode} from "../errors/lightClientError.js"; +import {IBeaconChain} from "../interface.js"; // https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md#light_client_optimistic_update export function validateLightClientOptimisticUpdate( diff --git a/packages/beacon-node/src/chain/validation/proposerSlashing.ts b/packages/beacon-node/src/chain/validation/proposerSlashing.ts index 48fe6db326c9..8d76470bb03b 100644 --- a/packages/beacon-node/src/chain/validation/proposerSlashing.ts +++ b/packages/beacon-node/src/chain/validation/proposerSlashing.ts @@ -1,7 +1,7 @@ -import {phase0} from "@lodestar/types"; import {assertValidProposerSlashing, getProposerSlashingSignatureSets} from "@lodestar/state-transition"; +import {phase0} from "@lodestar/types"; +import {GossipAction, ProposerSlashingError, ProposerSlashingErrorCode} from "../errors/index.js"; import {IBeaconChain} from "../index.js"; -import {ProposerSlashingError, ProposerSlashingErrorCode, GossipAction} from "../errors/index.js"; export async function validateApiProposerSlashing( chain: IBeaconChain, diff --git a/packages/beacon-node/src/chain/validation/signatureSets/aggregateAndProof.ts b/packages/beacon-node/src/chain/validation/signatureSets/aggregateAndProof.ts index 31d931818595..6d171aa0c1f4 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/aggregateAndProof.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/aggregateAndProof.ts @@ -1,14 +1,14 @@ import {PublicKey} from "@chainsafe/blst"; +import {BeaconConfig} from "@lodestar/config"; import {DOMAIN_AGGREGATE_AND_PROOF, ForkSeq} from "@lodestar/params"; -import {ssz, SignedAggregateAndProof} from "@lodestar/types"; -import {Epoch} from "@lodestar/types"; import { + ISignatureSet, computeSigningRoot, computeStartSlotAtEpoch, createSingleSignatureSetFromComponents, - ISignatureSet, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; +import {SignedAggregateAndProof, ssz} from "@lodestar/types"; +import {Epoch} from "@lodestar/types"; export function getAggregateAndProofSigningRoot( config: BeaconConfig, diff --git a/packages/beacon-node/src/chain/validation/signatureSets/contributionAndProof.ts b/packages/beacon-node/src/chain/validation/signatureSets/contributionAndProof.ts index 21e447b83677..4fe5122c0d3f 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/contributionAndProof.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/contributionAndProof.ts @@ -1,11 +1,11 @@ import {DOMAIN_CONTRIBUTION_AND_PROOF} from "@lodestar/params"; -import {altair, ssz} from "@lodestar/types"; import { CachedBeaconStateAllForks, - computeSigningRoot, ISignatureSet, SignatureSetType, + computeSigningRoot, } from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; export function getContributionAndProofSignatureSet( state: CachedBeaconStateAllForks, diff --git a/packages/beacon-node/src/chain/validation/signatureSets/selectionProof.ts b/packages/beacon-node/src/chain/validation/signatureSets/selectionProof.ts index 5e129a88aa20..6aa0cffc9b94 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/selectionProof.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/selectionProof.ts @@ -1,8 +1,8 @@ import {PublicKey} from "@chainsafe/blst"; -import {DOMAIN_SELECTION_PROOF} from "@lodestar/params"; -import {phase0, Slot, ssz} from "@lodestar/types"; -import {computeSigningRoot, createSingleSignatureSetFromComponents, ISignatureSet} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; +import {DOMAIN_SELECTION_PROOF} from "@lodestar/params"; +import {ISignatureSet, computeSigningRoot, createSingleSignatureSetFromComponents} from "@lodestar/state-transition"; +import {Slot, phase0, ssz} from "@lodestar/types"; export function getSelectionProofSigningRoot(config: BeaconConfig, slot: Slot): Uint8Array { // previously, we call `const selectionProofDomain = config.getDomain(state.slot, DOMAIN_SELECTION_PROOF, slot)` diff --git a/packages/beacon-node/src/chain/validation/signatureSets/syncCommittee.ts b/packages/beacon-node/src/chain/validation/signatureSets/syncCommittee.ts index ce2b2e2484ab..7765e4d89ea0 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/syncCommittee.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/syncCommittee.ts @@ -1,11 +1,11 @@ import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params"; -import {altair, ssz} from "@lodestar/types"; import { CachedBeaconStateAllForks, - computeSigningRoot, ISignatureSet, SignatureSetType, + computeSigningRoot, } from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; export function getSyncCommitteeSignatureSet( state: CachedBeaconStateAllForks, diff --git a/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeContribution.ts b/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeContribution.ts index 0e1eaefef7c6..f444c48a2103 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeContribution.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeContribution.ts @@ -1,7 +1,7 @@ import {PublicKey} from "@chainsafe/blst"; -import {altair, ssz} from "@lodestar/types"; import {DOMAIN_SYNC_COMMITTEE} from "@lodestar/params"; -import {CachedBeaconStateAltair, computeSigningRoot, ISignatureSet, SignatureSetType} from "@lodestar/state-transition"; +import {CachedBeaconStateAltair, ISignatureSet, SignatureSetType, computeSigningRoot} from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; export function getSyncCommitteeContributionSignatureSet( state: CachedBeaconStateAltair, diff --git a/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts b/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts index 14fcfad2b92e..b94ae87b240f 100644 --- a/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +++ b/packages/beacon-node/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts @@ -1,11 +1,11 @@ import {DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF} from "@lodestar/params"; -import {altair, ssz} from "@lodestar/types"; import { CachedBeaconStateAllForks, - computeSigningRoot, ISignatureSet, SignatureSetType, + computeSigningRoot, } from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; export function getSyncCommitteeSelectionProofSignatureSet( state: CachedBeaconStateAllForks, diff --git a/packages/beacon-node/src/chain/validation/syncCommittee.ts b/packages/beacon-node/src/chain/validation/syncCommittee.ts index f47aa53a314e..c563bf7cf6be 100644 --- a/packages/beacon-node/src/chain/validation/syncCommittee.ts +++ b/packages/beacon-node/src/chain/validation/syncCommittee.ts @@ -1,5 +1,5 @@ +import {SYNC_COMMITTEE_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; -import {SYNC_COMMITTEE_SUBNET_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {altair} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {GossipAction, SyncCommitteeError, SyncCommitteeErrorCode} from "../errors/index.js"; diff --git a/packages/beacon-node/src/chain/validation/syncCommitteeContributionAndProof.ts b/packages/beacon-node/src/chain/validation/syncCommitteeContributionAndProof.ts index 3f9351f2d0d3..611d738b15b6 100644 --- a/packages/beacon-node/src/chain/validation/syncCommitteeContributionAndProof.ts +++ b/packages/beacon-node/src/chain/validation/syncCommitteeContributionAndProof.ts @@ -1,14 +1,14 @@ -import {CachedBeaconStateAltair, isSyncCommitteeAggregator} from "@lodestar/state-transition"; -import {altair, ValidatorIndex} from "@lodestar/types"; import {SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params"; +import {CachedBeaconStateAltair, isSyncCommitteeAggregator} from "@lodestar/state-transition"; +import {ValidatorIndex, altair} from "@lodestar/types"; import {GossipAction, SyncCommitteeError, SyncCommitteeErrorCode} from "../errors/index.js"; import {IBeaconChain} from "../interface.js"; -import {validateGossipSyncCommitteeExceptSig} from "./syncCommittee.js"; import { - getSyncCommitteeSelectionProofSignatureSet, getContributionAndProofSignatureSet, getSyncCommitteeContributionSignatureSet, + getSyncCommitteeSelectionProofSignatureSet, } from "./signatureSets/index.js"; +import {validateGossipSyncCommitteeExceptSig} from "./syncCommittee.js"; /** * Spec v1.1.0-beta.2 diff --git a/packages/beacon-node/src/chain/validation/voluntaryExit.ts b/packages/beacon-node/src/chain/validation/voluntaryExit.ts index 2b38b161423e..79da31084a36 100644 --- a/packages/beacon-node/src/chain/validation/voluntaryExit.ts +++ b/packages/beacon-node/src/chain/validation/voluntaryExit.ts @@ -1,7 +1,7 @@ +import {getVoluntaryExitSignatureSet, isValidVoluntaryExit} from "@lodestar/state-transition"; import {phase0} from "@lodestar/types"; -import {isValidVoluntaryExit, getVoluntaryExitSignatureSet} from "@lodestar/state-transition"; +import {GossipAction, VoluntaryExitError, VoluntaryExitErrorCode} from "../errors/index.js"; import {IBeaconChain} from "../index.js"; -import {VoluntaryExitError, VoluntaryExitErrorCode, GossipAction} from "../errors/index.js"; import {RegenCaller} from "../regen/index.js"; export async function validateApiVoluntaryExit( diff --git a/packages/beacon-node/src/db/beacon.ts b/packages/beacon-node/src/db/beacon.ts index 07cc47fa54d8..1e15aa369141 100644 --- a/packages/beacon-node/src/db/beacon.ts +++ b/packages/beacon-node/src/db/beacon.ts @@ -1,27 +1,27 @@ -import {Db, LevelDbControllerMetrics} from "@lodestar/db"; import {ChainForkConfig} from "@lodestar/config"; +import {Db, LevelDbControllerMetrics} from "@lodestar/db"; import {IBeaconDb} from "./interface.js"; +import {CheckpointStateRepository} from "./repositories/checkpointState.js"; import { AttesterSlashingRepository, + BLSToExecutionChangeRepository, + BackfilledRanges, + BestLightClientUpdateRepository, + BlobSidecarsArchiveRepository, + BlobSidecarsRepository, BlockArchiveRepository, BlockRepository, - DepositEventRepository, + CheckpointHeaderRepository, DepositDataRootRepository, + DepositEventRepository, Eth1DataRepository, ProposerSlashingRepository, StateArchiveRepository, - VoluntaryExitRepository, - BestLightClientUpdateRepository, - CheckpointHeaderRepository, SyncCommitteeRepository, SyncCommitteeWitnessRepository, - BackfilledRanges, - BlobSidecarsRepository, - BlobSidecarsArchiveRepository, - BLSToExecutionChangeRepository, + VoluntaryExitRepository, } from "./repositories/index.js"; import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "./single/index.js"; -import {CheckpointStateRepository} from "./repositories/checkpointState.js"; export type BeaconDbModules = { config: ChainForkConfig; diff --git a/packages/beacon-node/src/db/interface.ts b/packages/beacon-node/src/db/interface.ts index 6ffb8992f635..95336407ef20 100644 --- a/packages/beacon-node/src/db/interface.ts +++ b/packages/beacon-node/src/db/interface.ts @@ -1,25 +1,25 @@ import {LevelDbControllerMetrics} from "@lodestar/db"; +import {CheckpointStateRepository} from "./repositories/checkpointState.js"; import { AttesterSlashingRepository, + BLSToExecutionChangeRepository, + BackfilledRanges, + BestLightClientUpdateRepository, + BlobSidecarsArchiveRepository, + BlobSidecarsRepository, BlockArchiveRepository, BlockRepository, - DepositEventRepository, + CheckpointHeaderRepository, DepositDataRootRepository, + DepositEventRepository, Eth1DataRepository, ProposerSlashingRepository, StateArchiveRepository, - VoluntaryExitRepository, - BestLightClientUpdateRepository, - CheckpointHeaderRepository, SyncCommitteeRepository, SyncCommitteeWitnessRepository, - BackfilledRanges, - BlobSidecarsRepository, - BlobSidecarsArchiveRepository, - BLSToExecutionChangeRepository, + VoluntaryExitRepository, } from "./repositories/index.js"; import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "./single/index.js"; -import {CheckpointStateRepository} from "./repositories/checkpointState.js"; /** * The DB service manages the data layer of the beacon chain diff --git a/packages/beacon-node/src/db/repositories/attesterSlashing.ts b/packages/beacon-node/src/db/repositories/attesterSlashing.ts index a484f605ac15..dd83c25998b6 100644 --- a/packages/beacon-node/src/db/repositories/attesterSlashing.ts +++ b/packages/beacon-node/src/db/repositories/attesterSlashing.ts @@ -1,6 +1,6 @@ -import {phase0, ssz, ValidatorIndex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import {Db, Repository} from "@lodestar/db"; +import {ValidatorIndex, phase0, ssz} from "@lodestar/types"; import {Bucket, getBucketNameByValue} from "../buckets.js"; /** diff --git a/packages/beacon-node/src/db/repositories/backfilledRanges.ts b/packages/beacon-node/src/db/repositories/backfilledRanges.ts index f86c20288099..c2958a0e972e 100644 --- a/packages/beacon-node/src/db/repositories/backfilledRanges.ts +++ b/packages/beacon-node/src/db/repositories/backfilledRanges.ts @@ -1,6 +1,6 @@ import {ChainForkConfig} from "@lodestar/config"; -import {Slot, ssz} from "@lodestar/types"; import {DatabaseController, Repository} from "@lodestar/db"; +import {Slot, ssz} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; import {Bucket, getBucketNameByValue} from "../buckets.js"; diff --git a/packages/beacon-node/src/db/repositories/blobSidecars.ts b/packages/beacon-node/src/db/repositories/blobSidecars.ts index e5750ed31b58..aaa16f760dd6 100644 --- a/packages/beacon-node/src/db/repositories/blobSidecars.ts +++ b/packages/beacon-node/src/db/repositories/blobSidecars.ts @@ -1,4 +1,4 @@ -import {ValueOf, ContainerType} from "@chainsafe/ssz"; +import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; import {Db, Repository} from "@lodestar/db"; import {ssz} from "@lodestar/types"; diff --git a/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts b/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts index 18293fc2924c..4b6c8fbcf046 100644 --- a/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts +++ b/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts @@ -3,7 +3,7 @@ import {Db, Repository} from "@lodestar/db"; import {Slot} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; import {Bucket, getBucketNameByValue} from "../buckets.js"; -import {blobSidecarsWrapperSsz, BlobSidecarsWrapper} from "./blobSidecars.js"; +import {BlobSidecarsWrapper, blobSidecarsWrapperSsz} from "./blobSidecars.js"; /** * blobSidecarsWrapper by slot diff --git a/packages/beacon-node/src/db/repositories/blockArchive.ts b/packages/beacon-node/src/db/repositories/blockArchive.ts index 427650a37bc3..12994ceba5db 100644 --- a/packages/beacon-node/src/db/repositories/blockArchive.ts +++ b/packages/beacon-node/src/db/repositories/blockArchive.ts @@ -1,11 +1,11 @@ -import all from "it-all"; import {ChainForkConfig} from "@lodestar/config"; -import {Db, Repository, KeyValue, FilterOptions} from "@lodestar/db"; -import {Slot, Root, ssz, SignedBeaconBlock} from "@lodestar/types"; +import {Db, FilterOptions, KeyValue, Repository} from "@lodestar/db"; +import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; +import all from "it-all"; import {getSignedBlockTypeFromBytes} from "../../util/multifork.js"; import {Bucket, getBucketNameByValue} from "../buckets.js"; -import {getRootIndexKey, getParentRootIndexKey} from "./blockArchiveIndex.js"; +import {getParentRootIndexKey, getRootIndexKey} from "./blockArchiveIndex.js"; import {deleteParentRootIndex, deleteRootIndex, storeParentRootIndex, storeRootIndex} from "./blockArchiveIndex.js"; export interface BlockFilterOptions extends FilterOptions { diff --git a/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts b/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts index 8c2785dbe67c..12e133ec9acd 100644 --- a/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts +++ b/packages/beacon-node/src/db/repositories/blockArchiveIndex.ts @@ -1,7 +1,7 @@ import {Db, encodeKey} from "@lodestar/db"; -import {Slot, Root, ssz, SignedBeaconBlock, SSZTypesFor} from "@lodestar/types"; -import {intToBytes} from "@lodestar/utils"; import {ForkAll} from "@lodestar/params"; +import {Root, SSZTypesFor, SignedBeaconBlock, Slot, ssz} from "@lodestar/types"; +import {intToBytes} from "@lodestar/utils"; import {Bucket} from "../buckets.js"; export async function storeRootIndex(db: Db, slot: Slot, blockRoot: Root): Promise { diff --git a/packages/beacon-node/src/db/repositories/blsToExecutionChange.ts b/packages/beacon-node/src/db/repositories/blsToExecutionChange.ts index a1b32403dd14..c9495f8fc9a6 100644 --- a/packages/beacon-node/src/db/repositories/blsToExecutionChange.ts +++ b/packages/beacon-node/src/db/repositories/blsToExecutionChange.ts @@ -1,6 +1,6 @@ -import {ValidatorIndex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import {Db, Repository} from "@lodestar/db"; +import {ValidatorIndex} from "@lodestar/types"; import {SignedBLSToExecutionChangeVersioned, signedBLSToExecutionChangeVersionedType} from "../../util/types.js"; import {Bucket, getBucketNameByValue} from "../buckets.js"; diff --git a/packages/beacon-node/src/db/repositories/depositDataRoot.ts b/packages/beacon-node/src/db/repositories/depositDataRoot.ts index 97200ccd0f92..50648655e440 100644 --- a/packages/beacon-node/src/db/repositories/depositDataRoot.ts +++ b/packages/beacon-node/src/db/repositories/depositDataRoot.ts @@ -1,8 +1,8 @@ import {ByteVectorType, CompositeViewDU, ListCompositeType} from "@chainsafe/ssz"; -import {Root, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {Db, KeyValue, Repository} from "@lodestar/db"; +import {Root, ssz} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; -import {Db, Repository, KeyValue} from "@lodestar/db"; import {Bucket, getBucketNameByValue} from "../buckets.js"; // TODO: Review where is best to put this type diff --git a/packages/beacon-node/src/db/repositories/depositEvent.ts b/packages/beacon-node/src/db/repositories/depositEvent.ts index c1d2dd99047f..f2e180a02c43 100644 --- a/packages/beacon-node/src/db/repositories/depositEvent.ts +++ b/packages/beacon-node/src/db/repositories/depositEvent.ts @@ -1,6 +1,6 @@ import {ChainForkConfig} from "@lodestar/config"; -import {phase0, ssz} from "@lodestar/types"; import {Db, Repository} from "@lodestar/db"; +import {phase0, ssz} from "@lodestar/types"; import {Bucket, getBucketNameByValue} from "../buckets.js"; /** diff --git a/packages/beacon-node/src/db/repositories/eth1Data.ts b/packages/beacon-node/src/db/repositories/eth1Data.ts index f87199a0b80e..5a21e8f7d226 100644 --- a/packages/beacon-node/src/db/repositories/eth1Data.ts +++ b/packages/beacon-node/src/db/repositories/eth1Data.ts @@ -1,7 +1,7 @@ -import {phase0, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; -import {bytesToInt} from "@lodestar/utils"; import {Db, Repository} from "@lodestar/db"; +import {phase0, ssz} from "@lodestar/types"; +import {bytesToInt} from "@lodestar/utils"; import {Bucket, getBucketNameByValue} from "../buckets.js"; export class Eth1DataRepository extends Repository { diff --git a/packages/beacon-node/src/db/repositories/lightclientBestUpdate.ts b/packages/beacon-node/src/db/repositories/lightclientBestUpdate.ts index 26493e35e408..ad37b1425c58 100644 --- a/packages/beacon-node/src/db/repositories/lightclientBestUpdate.ts +++ b/packages/beacon-node/src/db/repositories/lightclientBestUpdate.ts @@ -1,6 +1,6 @@ import {ChainForkConfig} from "@lodestar/config"; import {DatabaseController, Repository} from "@lodestar/db"; -import {LightClientUpdate, ssz, SyncPeriod} from "@lodestar/types"; +import {LightClientUpdate, SyncPeriod, ssz} from "@lodestar/types"; import {Bucket, getBucketNameByValue} from "../buckets.js"; const SLOT_BYTE_COUNT = 8; diff --git a/packages/beacon-node/src/db/repositories/lightclientCheckpointHeader.ts b/packages/beacon-node/src/db/repositories/lightclientCheckpointHeader.ts index 22d6559792eb..36b7b9c187e7 100644 --- a/packages/beacon-node/src/db/repositories/lightclientCheckpointHeader.ts +++ b/packages/beacon-node/src/db/repositories/lightclientCheckpointHeader.ts @@ -1,8 +1,8 @@ import {ChainForkConfig} from "@lodestar/config"; import {DatabaseController, Repository} from "@lodestar/db"; import {LightClientHeader, ssz} from "@lodestar/types"; -import {Bucket, getBucketNameByValue} from "../buckets.js"; import {getLightClientHeaderTypeFromBytes} from "../../util/multifork.js"; +import {Bucket, getBucketNameByValue} from "../buckets.js"; /** * Block headers by block root. Until finality includes all headers seen by this node. After finality, diff --git a/packages/beacon-node/src/db/repositories/proposerSlashing.ts b/packages/beacon-node/src/db/repositories/proposerSlashing.ts index e599c22a9c32..210d33234d9b 100644 --- a/packages/beacon-node/src/db/repositories/proposerSlashing.ts +++ b/packages/beacon-node/src/db/repositories/proposerSlashing.ts @@ -1,6 +1,6 @@ -import {phase0, ssz, ValidatorIndex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import {Db, Repository} from "@lodestar/db"; +import {ValidatorIndex, phase0, ssz} from "@lodestar/types"; import {Bucket, getBucketNameByValue} from "../buckets.js"; export class ProposerSlashingRepository extends Repository { diff --git a/packages/beacon-node/src/db/repositories/stateArchive.ts b/packages/beacon-node/src/db/repositories/stateArchive.ts index b3b3d67fd7a0..638499c5fe01 100644 --- a/packages/beacon-node/src/db/repositories/stateArchive.ts +++ b/packages/beacon-node/src/db/repositories/stateArchive.ts @@ -1,8 +1,8 @@ +import {ChainForkConfig} from "@lodestar/config"; +import {Db, Repository} from "@lodestar/db"; import {BeaconStateAllForks} from "@lodestar/state-transition"; import {Epoch, Root, RootHex, Slot, ssz} from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; import {bytesToInt, toHex} from "@lodestar/utils"; -import {Db, Repository} from "@lodestar/db"; import {getStateTypeFromBytes} from "../../util/multifork.js"; import {Bucket, getBucketNameByValue} from "../buckets.js"; import {getRootIndexKey, storeRootIndex} from "./stateArchiveIndex.js"; diff --git a/packages/beacon-node/src/db/repositories/stateArchiveIndex.ts b/packages/beacon-node/src/db/repositories/stateArchiveIndex.ts index a088aa2413e9..f119cd245080 100644 --- a/packages/beacon-node/src/db/repositories/stateArchiveIndex.ts +++ b/packages/beacon-node/src/db/repositories/stateArchiveIndex.ts @@ -1,4 +1,4 @@ -import {encodeKey, Db} from "@lodestar/db"; +import {Db, encodeKey} from "@lodestar/db"; import {Root, Slot} from "@lodestar/types"; import {intToBytes} from "@lodestar/utils"; import {Bucket} from "../buckets.js"; diff --git a/packages/beacon-node/src/db/repositories/voluntaryExit.ts b/packages/beacon-node/src/db/repositories/voluntaryExit.ts index ea2dc73a2903..8609725b6337 100644 --- a/packages/beacon-node/src/db/repositories/voluntaryExit.ts +++ b/packages/beacon-node/src/db/repositories/voluntaryExit.ts @@ -1,6 +1,6 @@ -import {phase0, ssz, ValidatorIndex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import {Db, Repository} from "@lodestar/db"; +import {ValidatorIndex, phase0, ssz} from "@lodestar/types"; import {Bucket, getBucketNameByValue} from "../buckets.js"; export class VoluntaryExitRepository extends Repository { diff --git a/packages/beacon-node/src/db/single/preGenesisState.ts b/packages/beacon-node/src/db/single/preGenesisState.ts index 3789e19d1a7d..a43a54c0923c 100644 --- a/packages/beacon-node/src/db/single/preGenesisState.ts +++ b/packages/beacon-node/src/db/single/preGenesisState.ts @@ -1,6 +1,6 @@ -import {ForkAll, GENESIS_SLOT} from "@lodestar/params"; import {ChainForkConfig} from "@lodestar/config"; import {Db} from "@lodestar/db"; +import {ForkAll, GENESIS_SLOT} from "@lodestar/params"; import {BeaconStateAllForks} from "@lodestar/state-transition"; import {SSZTypesFor} from "@lodestar/types"; import {Bucket} from "../buckets.js"; diff --git a/packages/beacon-node/src/db/single/preGenesisStateLastProcessedBlock.ts b/packages/beacon-node/src/db/single/preGenesisStateLastProcessedBlock.ts index 37dcb069acc9..c31382ec9ee6 100644 --- a/packages/beacon-node/src/db/single/preGenesisStateLastProcessedBlock.ts +++ b/packages/beacon-node/src/db/single/preGenesisStateLastProcessedBlock.ts @@ -1,7 +1,7 @@ import {UintNumberType} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import {Db} from "@lodestar/db"; +import {ssz} from "@lodestar/types"; import {Bucket} from "../buckets.js"; export class PreGenesisStateLastProcessedBlock { diff --git a/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts b/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts index 674b6b600f31..815f5aeb8938 100644 --- a/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts +++ b/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts @@ -1,4 +1,3 @@ -import {phase0, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import { BeaconStateAllForks, @@ -6,19 +5,20 @@ import { CachedBeaconStateElectra, becomesNewEth1Data, } from "@lodestar/state-transition"; -import {ErrorAborted, TimeoutError, fromHex, Logger, isErrorAborted, sleep} from "@lodestar/utils"; +import {phase0, ssz} from "@lodestar/types"; +import {ErrorAborted, Logger, TimeoutError, fromHex, isErrorAborted, sleep} from "@lodestar/utils"; import {IBeaconDb} from "../db/index.js"; import {Metrics} from "../metrics/index.js"; -import {Eth1DepositsCache} from "./eth1DepositsCache.js"; import {Eth1DataCache} from "./eth1DataCache.js"; -import {getEth1VotesToConsider, pickEth1Vote} from "./utils/eth1Vote.js"; -import {getDeposits} from "./utils/deposits.js"; +import {Eth1DepositsCache} from "./eth1DepositsCache.js"; import {Eth1DataAndDeposits, EthJsonRpcBlockRaw, IEth1Provider} from "./interface.js"; import {Eth1Options} from "./options.js"; -import {HttpRpcError} from "./provider/jsonRpcHttpClient.js"; import {parseEth1Block} from "./provider/eth1Provider.js"; +import {HttpRpcError} from "./provider/jsonRpcHttpClient.js"; import {isJsonRpcTruncatedError} from "./provider/utils.js"; +import {getDeposits} from "./utils/deposits.js"; +import {getEth1VotesToConsider, pickEth1Vote} from "./utils/eth1Vote.js"; const MAX_BLOCKS_PER_BLOCK_QUERY = 1000; const MIN_BLOCKS_PER_BLOCK_QUERY = 10; diff --git a/packages/beacon-node/src/eth1/eth1DepositsCache.ts b/packages/beacon-node/src/eth1/eth1DepositsCache.ts index 13dd29013124..16ed7c95a465 100644 --- a/packages/beacon-node/src/eth1/eth1DepositsCache.ts +++ b/packages/beacon-node/src/eth1/eth1DepositsCache.ts @@ -1,14 +1,14 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {phase0, ssz} from "@lodestar/types"; -import {FilterOptions} from "@lodestar/db"; import {ChainForkConfig} from "@lodestar/config"; +import {FilterOptions} from "@lodestar/db"; +import {phase0, ssz} from "@lodestar/types"; import {IBeaconDb} from "../db/index.js"; -import {getEth1DataForBlocks} from "./utils/eth1Data.js"; -import {assertConsecutiveDeposits} from "./utils/eth1DepositEvent.js"; -import {getDepositsWithProofs} from "./utils/deposits.js"; import {Eth1Error, Eth1ErrorCode} from "./errors.js"; import {Eth1Block} from "./interface.js"; +import {getDepositsWithProofs} from "./utils/deposits.js"; +import {getEth1DataForBlocks} from "./utils/eth1Data.js"; +import {assertConsecutiveDeposits} from "./utils/eth1DepositEvent.js"; export class Eth1DepositsCache { unsafeAllowDepositDataOverwrite: boolean; diff --git a/packages/beacon-node/src/eth1/eth1MergeBlockTracker.ts b/packages/beacon-node/src/eth1/eth1MergeBlockTracker.ts index 5bf76625dfe8..ea2d134fe4dd 100644 --- a/packages/beacon-node/src/eth1/eth1MergeBlockTracker.ts +++ b/packages/beacon-node/src/eth1/eth1MergeBlockTracker.ts @@ -1,11 +1,11 @@ import {ChainConfig} from "@lodestar/config"; import {RootHex} from "@lodestar/types"; import {Logger, pruneSetToMax, toRootHex} from "@lodestar/utils"; -import {Metrics} from "../metrics/index.js"; import {ZERO_HASH_HEX} from "../constants/index.js"; +import {Metrics} from "../metrics/index.js"; import {enumToIndexMap} from "../util/enum.js"; -import {IEth1Provider, EthJsonRpcBlockRaw, PowMergeBlock, PowMergeBlockTimestamp, TDProgress} from "./interface.js"; -import {quantityToNum, quantityToBigint, dataToRootHex} from "./provider/utils.js"; +import {EthJsonRpcBlockRaw, IEth1Provider, PowMergeBlock, PowMergeBlockTimestamp, TDProgress} from "./interface.js"; +import {dataToRootHex, quantityToBigint, quantityToNum} from "./provider/utils.js"; export enum StatusCode { STOPPED = "STOPPED", diff --git a/packages/beacon-node/src/eth1/index.ts b/packages/beacon-node/src/eth1/index.ts index 42b82d03a848..f8c28afc5aed 100644 --- a/packages/beacon-node/src/eth1/index.ts +++ b/packages/beacon-node/src/eth1/index.ts @@ -1,9 +1,9 @@ import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {Root} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; -import {IEth1ForBlockProduction, Eth1DataAndDeposits, IEth1Provider, PowMergeBlock, TDProgress} from "./interface.js"; import {Eth1DepositDataTracker, Eth1DepositDataTrackerModules} from "./eth1DepositDataTracker.js"; import {Eth1MergeBlockTracker, Eth1MergeBlockTrackerModules} from "./eth1MergeBlockTracker.js"; +import {Eth1DataAndDeposits, IEth1ForBlockProduction, IEth1Provider, PowMergeBlock, TDProgress} from "./interface.js"; import {Eth1Options} from "./options.js"; import {Eth1Provider} from "./provider/eth1Provider.js"; export {Eth1Provider}; diff --git a/packages/beacon-node/src/eth1/interface.ts b/packages/beacon-node/src/eth1/interface.ts index 54fcdd12492f..ccfd3568e479 100644 --- a/packages/beacon-node/src/eth1/interface.ts +++ b/packages/beacon-node/src/eth1/interface.ts @@ -1,6 +1,6 @@ import {BeaconConfig} from "@lodestar/config"; -import {phase0, Root, RootHex} from "@lodestar/types"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; +import {Root, RootHex, phase0} from "@lodestar/types"; export type EthJsonRpcBlockRaw = { /** the block number. null when its pending block. `"0x1b4"` */ diff --git a/packages/beacon-node/src/eth1/provider/eth1Provider.ts b/packages/beacon-node/src/eth1/provider/eth1Provider.ts index d284700ddb1d..8320f1dedac1 100644 --- a/packages/beacon-node/src/eth1/provider/eth1Provider.ts +++ b/packages/beacon-node/src/eth1/provider/eth1Provider.ts @@ -1,16 +1,16 @@ -import {phase0} from "@lodestar/types"; import {ChainConfig} from "@lodestar/config"; -import {fromHex, isErrorAborted, createElapsedTimeTracker, toPrintableUrl, toHex} from "@lodestar/utils"; import {Logger} from "@lodestar/logger"; +import {phase0} from "@lodestar/types"; +import {createElapsedTimeTracker, fromHex, isErrorAborted, toHex, toPrintableUrl} from "@lodestar/utils"; import {FetchError, isFetchError} from "@lodestar/api"; +import {HTTP_CONNECTION_ERROR_CODES, HTTP_FATAL_ERROR_CODES} from "../../execution/engine/utils.js"; +import {isValidAddress} from "../../util/address.js"; import {linspace} from "../../util/numpy.js"; -import {depositEventTopics, parseDepositLog} from "../utils/depositContract.js"; import {Eth1Block, Eth1ProviderState, IEth1Provider} from "../interface.js"; -import {DEFAULT_PROVIDER_URLS, Eth1Options} from "../options.js"; -import {isValidAddress} from "../../util/address.js"; import {EthJsonRpcBlockRaw} from "../interface.js"; -import {HTTP_CONNECTION_ERROR_CODES, HTTP_FATAL_ERROR_CODES} from "../../execution/engine/utils.js"; +import {DEFAULT_PROVIDER_URLS, Eth1Options} from "../options.js"; +import {depositEventTopics, parseDepositLog} from "../utils/depositContract.js"; import { ErrorJsonRpcResponse, HttpRpcError, @@ -19,7 +19,7 @@ import { JsonRpcHttpClientMetrics, ReqOpts, } from "./jsonRpcHttpClient.js"; -import {isJsonRpcTruncatedError, quantityToNum, numToQuantity, dataToBytes} from "./utils.js"; +import {dataToBytes, isJsonRpcTruncatedError, numToQuantity, quantityToNum} from "./utils.js"; /** * Binds return types to Ethereum JSON RPC methods diff --git a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts index f2ceae0d8c19..da72d5183d30 100644 --- a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts +++ b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts @@ -1,7 +1,7 @@ import {EventEmitter} from "node:events"; -import {StrictEventEmitter} from "strict-event-emitter-types"; import {fetch} from "@lodestar/api"; import {ErrorAborted, Gauge, Histogram, TimeoutError, isValidHttpUrl, retry} from "@lodestar/utils"; +import {StrictEventEmitter} from "strict-event-emitter-types"; import {IJson, RpcPayload} from "../interface.js"; import {JwtClaim, encodeJwtToken} from "./jwt.js"; diff --git a/packages/beacon-node/src/eth1/provider/utils.ts b/packages/beacon-node/src/eth1/provider/utils.ts index 7010e1377ca6..39cb9d4b1849 100644 --- a/packages/beacon-node/src/eth1/provider/utils.ts +++ b/packages/beacon-node/src/eth1/provider/utils.ts @@ -1,5 +1,5 @@ import {RootHex} from "@lodestar/types"; -import {bytesToBigInt, bigIntToBytes, toHex, fromHex} from "@lodestar/utils"; +import {bigIntToBytes, bytesToBigInt, fromHex, toHex} from "@lodestar/utils"; import {ErrorParseJson} from "./jsonRpcHttpClient.js"; /** QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */ diff --git a/packages/beacon-node/src/eth1/stream.ts b/packages/beacon-node/src/eth1/stream.ts index 1e8583bb59a9..f4adaf2829f2 100644 --- a/packages/beacon-node/src/eth1/stream.ts +++ b/packages/beacon-node/src/eth1/stream.ts @@ -1,9 +1,9 @@ -import {sleep} from "@lodestar/utils"; import {phase0} from "@lodestar/types"; -import {Eth1Block, BatchDepositEvents, IEth1Provider, IEth1StreamParams} from "./interface.js"; +import {sleep} from "@lodestar/utils"; +import {BatchDepositEvents, Eth1Block, IEth1Provider, IEth1StreamParams} from "./interface.js"; +import {parseEth1Block} from "./provider/eth1Provider.js"; import {groupDepositEventsByBlock} from "./utils/groupDepositEventsByBlock.js"; import {optimizeNextBlockDiffForGenesis} from "./utils/optimizeNextBlockDiffForGenesis.js"; -import {parseEth1Block} from "./provider/eth1Provider.js"; /** * Phase 1 of genesis building. diff --git a/packages/beacon-node/src/eth1/utils/deposits.ts b/packages/beacon-node/src/eth1/utils/deposits.ts index 36f8c331ebc9..803b4f9deadf 100644 --- a/packages/beacon-node/src/eth1/utils/deposits.ts +++ b/packages/beacon-node/src/eth1/utils/deposits.ts @@ -1,11 +1,11 @@ -import {toGindex, Tree} from "@chainsafe/persistent-merkle-tree"; -import {toRootHex} from "@lodestar/utils"; -import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; -import {phase0, ssz} from "@lodestar/types"; +import {Tree, toGindex} from "@chainsafe/persistent-merkle-tree"; import {FilterOptions} from "@lodestar/db"; +import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {getEth1DepositCount} from "@lodestar/state-transition"; -import {Eth1Error, Eth1ErrorCode} from "../errors.js"; +import {phase0, ssz} from "@lodestar/types"; +import {toRootHex} from "@lodestar/utils"; import {DepositTree} from "../../db/repositories/depositDataRoot.js"; +import {Eth1Error, Eth1ErrorCode} from "../errors.js"; export type DepositGetter = (indexRange: FilterOptions, eth1Data: phase0.Eth1Data) => Promise; diff --git a/packages/beacon-node/src/eth1/utils/eth1Data.ts b/packages/beacon-node/src/eth1/utils/eth1Data.ts index 2b8e976cac2e..96a7031788ff 100644 --- a/packages/beacon-node/src/eth1/utils/eth1Data.ts +++ b/packages/beacon-node/src/eth1/utils/eth1Data.ts @@ -1,7 +1,7 @@ import {Root, phase0} from "@lodestar/types"; +import {DepositTree} from "../../db/repositories/depositDataRoot.js"; import {binarySearchLte} from "../../util/binarySearch.js"; import {Eth1Error, Eth1ErrorCode} from "../errors.js"; -import {DepositTree} from "../../db/repositories/depositDataRoot.js"; import {Eth1Block} from "../interface.js"; type BlockNumber = number; diff --git a/packages/beacon-node/src/eth1/utils/eth1Vote.ts b/packages/beacon-node/src/eth1/utils/eth1Vote.ts index 84d35ae7d434..e1cd47301c22 100644 --- a/packages/beacon-node/src/eth1/utils/eth1Vote.ts +++ b/packages/beacon-node/src/eth1/utils/eth1Vote.ts @@ -1,7 +1,7 @@ -import {EPOCHS_PER_ETH1_VOTING_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; import {ChainForkConfig} from "@lodestar/config"; -import {phase0, RootHex} from "@lodestar/types"; +import {EPOCHS_PER_ETH1_VOTING_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; import {BeaconStateAllForks, computeTimeAtSlot} from "@lodestar/state-transition"; +import {RootHex, phase0} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; export type Eth1DataGetter = ({ diff --git a/packages/beacon-node/src/execution/builder/http.ts b/packages/beacon-node/src/execution/builder/http.ts index b95cfd6a80b9..12e45412bafc 100644 --- a/packages/beacon-node/src/execution/builder/http.ts +++ b/packages/beacon-node/src/execution/builder/http.ts @@ -1,25 +1,25 @@ +import {WireFormat} from "@lodestar/api"; +import {ApiClient as BuilderApi, getClient} from "@lodestar/api/builder"; +import {ChainForkConfig} from "@lodestar/config"; +import {Logger} from "@lodestar/logger"; +import {ForkExecution, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {parseExecutionPayloadAndBlobsBundle, reconstructFullBlockOrContents} from "@lodestar/state-transition"; import { - bellatrix, - Slot, - Root, BLSPubkey, - deneb, - Wei, + ExecutionPayloadHeader, + Root, SignedBeaconBlockOrContents, SignedBlindedBeaconBlock, - ExecutionPayloadHeader, - electra, + Slot, + Wei, WithOptionalBytes, + bellatrix, + deneb, + electra, } from "@lodestar/types"; -import {parseExecutionPayloadAndBlobsBundle, reconstructFullBlockOrContents} from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; -import {Logger} from "@lodestar/logger"; -import {getClient, ApiClient as BuilderApi} from "@lodestar/api/builder"; -import {SLOTS_PER_EPOCH, ForkExecution} from "@lodestar/params"; import {toPrintableUrl} from "@lodestar/utils"; import {Metrics} from "../../metrics/metrics.js"; import {IExecutionBuilder} from "./interface.js"; -import {WireFormat} from "@lodestar/api"; export type ExecutionBuilderHttpOpts = { enabled: boolean; diff --git a/packages/beacon-node/src/execution/builder/interface.ts b/packages/beacon-node/src/execution/builder/interface.ts index 19a935a9bf7e..06cdc1da4ed0 100644 --- a/packages/beacon-node/src/execution/builder/interface.ts +++ b/packages/beacon-node/src/execution/builder/interface.ts @@ -1,17 +1,17 @@ +import {ForkExecution} from "@lodestar/params"; import { - bellatrix, - Root, - Slot, BLSPubkey, - deneb, - Wei, - SignedBeaconBlockOrContents, ExecutionPayloadHeader, + Root, + SignedBeaconBlockOrContents, SignedBlindedBeaconBlock, - electra, + Slot, + Wei, WithOptionalBytes, + bellatrix, + deneb, + electra, } from "@lodestar/types"; -import {ForkExecution} from "@lodestar/params"; export interface IExecutionBuilder { /** diff --git a/packages/beacon-node/src/execution/engine/http.ts b/packages/beacon-node/src/execution/engine/http.ts index e5e65746d90f..c5cf61481b67 100644 --- a/packages/beacon-node/src/execution/engine/http.ts +++ b/packages/beacon-node/src/execution/engine/http.ts @@ -1,6 +1,6 @@ -import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types"; -import {SLOTS_PER_EPOCH, ForkName, ForkSeq} from "@lodestar/params"; import {Logger} from "@lodestar/logger"; +import {ForkName, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types"; import { ErrorJsonRpcResponse, HttpRpcError, @@ -8,36 +8,36 @@ import { JsonRpcHttpClientEvent, ReqOpts, } from "../../eth1/provider/jsonRpcHttpClient.js"; +import {numToQuantity} from "../../eth1/provider/utils.js"; import {Metrics} from "../../metrics/index.js"; -import {JobItemQueue} from "../../util/queue/index.js"; import {EPOCHS_PER_BATCH} from "../../sync/constants.js"; -import {numToQuantity} from "../../eth1/provider/utils.js"; import {getLodestarClientVersion} from "../../util/metadata.js"; +import {JobItemQueue} from "../../util/queue/index.js"; import { - ExecutionPayloadStatus, + BlobsBundle, + ClientCode, + ClientVersion, ExecutePayloadResponse, + ExecutionEngineState, + ExecutionPayloadStatus, IExecutionEngine, - PayloadId, PayloadAttributes, - BlobsBundle, + PayloadId, VersionedHashes, - ExecutionEngineState, - ClientVersion, - ClientCode, } from "./interface.js"; import {PayloadIdCache} from "./payloadIdCache.js"; import { EngineApiRpcParamTypes, EngineApiRpcReturnTypes, - parseExecutionPayload, - serializeExecutionPayload, - serializeVersionedHashes, - serializePayloadAttributes, - serializeBeaconBlockRoot, ExecutionPayloadBody, assertReqSizeLimit, deserializeExecutionPayloadBody, + parseExecutionPayload, + serializeBeaconBlockRoot, + serializeExecutionPayload, serializeExecutionRequests, + serializePayloadAttributes, + serializeVersionedHashes, } from "./types.js"; import {getExecutionEngineState} from "./utils.js"; diff --git a/packages/beacon-node/src/execution/engine/index.ts b/packages/beacon-node/src/execution/engine/index.ts index dd2de2017c22..d339276e2cc2 100644 --- a/packages/beacon-node/src/execution/engine/index.ts +++ b/packages/beacon-node/src/execution/engine/index.ts @@ -1,14 +1,14 @@ import {fromHex, toPrintableUrl} from "@lodestar/utils"; import {JsonRpcHttpClient} from "../../eth1/provider/jsonRpcHttpClient.js"; -import {IExecutionEngine} from "./interface.js"; import {ExecutionEngineDisabled} from "./disabled.js"; import { ExecutionEngineHttp, - ExecutionEngineModules, ExecutionEngineHttpOpts, + ExecutionEngineModules, defaultExecutionEngineHttpOpts, } from "./http.js"; -import {ExecutionEngineMockOpts, ExecutionEngineMockBackend} from "./mock.js"; +import {IExecutionEngine} from "./interface.js"; +import {ExecutionEngineMockBackend, ExecutionEngineMockOpts} from "./mock.js"; import {ExecutionEngineMockJsonRpcClient, JsonRpcBackend} from "./utils.js"; export {ExecutionEngineHttp, ExecutionEngineDisabled, defaultExecutionEngineHttpOpts}; diff --git a/packages/beacon-node/src/execution/engine/interface.ts b/packages/beacon-node/src/execution/engine/interface.ts index e6f9cfee526b..7bbf1bb27c1d 100644 --- a/packages/beacon-node/src/execution/engine/interface.ts +++ b/packages/beacon-node/src/execution/engine/interface.ts @@ -1,9 +1,9 @@ import {ForkName} from "@lodestar/params"; -import {KZGCommitment, Blob, KZGProof} from "@lodestar/types/deneb"; -import {Root, RootHex, capella, Wei, ExecutionPayload, ExecutionRequests} from "@lodestar/types"; +import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei, capella} from "@lodestar/types"; +import {Blob, KZGCommitment, KZGProof} from "@lodestar/types/deneb"; import {DATA} from "../../eth1/provider/utils.js"; -import {PayloadIdCache, PayloadId, WithdrawalV1} from "./payloadIdCache.js"; +import {PayloadId, PayloadIdCache, WithdrawalV1} from "./payloadIdCache.js"; import {ExecutionPayloadBody} from "./types.js"; export {PayloadIdCache, type PayloadId, type WithdrawalV1}; diff --git a/packages/beacon-node/src/execution/engine/mock.ts b/packages/beacon-node/src/execution/engine/mock.ts index 8062b68bf572..2331500624eb 100644 --- a/packages/beacon-node/src/execution/engine/mock.ts +++ b/packages/beacon-node/src/execution/engine/mock.ts @@ -1,30 +1,30 @@ import crypto from "node:crypto"; -import {bellatrix, deneb, RootHex, ssz} from "@lodestar/types"; -import {fromHex, toHex} from "@lodestar/utils"; import { + BLOB_TX_TYPE, BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB, - ForkSeq, ForkExecution, ForkName, - BLOB_TX_TYPE, + ForkSeq, } from "@lodestar/params"; +import {RootHex, bellatrix, deneb, ssz} from "@lodestar/types"; +import {fromHex, toHex} from "@lodestar/utils"; import {ZERO_HASH_HEX} from "../../constants/index.js"; -import {ckzg} from "../../util/kzg.js"; -import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; import {quantityToNum} from "../../eth1/provider/utils.js"; +import {kzgCommitmentToVersionedHash} from "../../util/blobs.js"; +import {ckzg} from "../../util/kzg.js"; +import {ClientCode, ExecutionPayloadStatus, PayloadIdCache} from "./interface.js"; import { + BlobsBundleRpc, EngineApiRpcParamTypes, EngineApiRpcReturnTypes, - deserializePayloadAttributes, + ExecutionPayloadBodyRpc, + ExecutionPayloadRpc, PayloadStatus, + deserializePayloadAttributes, serializeBlobsBundle, serializeExecutionPayload, - ExecutionPayloadRpc, - BlobsBundleRpc, - ExecutionPayloadBodyRpc, } from "./types.js"; -import {ClientCode, ExecutionPayloadStatus, PayloadIdCache} from "./interface.js"; import {JsonRpcBackend} from "./utils.js"; const INTEROP_GAS_LIMIT = 30e6; diff --git a/packages/beacon-node/src/execution/engine/payloadIdCache.ts b/packages/beacon-node/src/execution/engine/payloadIdCache.ts index ea37e0922e9c..f6c18ddac6fa 100644 --- a/packages/beacon-node/src/execution/engine/payloadIdCache.ts +++ b/packages/beacon-node/src/execution/engine/payloadIdCache.ts @@ -1,7 +1,7 @@ import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {pruneSetToMax} from "@lodestar/utils"; -import {Metrics} from "../../metrics/index.js"; 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 diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index 52ddb8548629..9af2d8d1ce10 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -1,22 +1,22 @@ -import {capella, deneb, electra, Wei, bellatrix, Root, ExecutionPayload, ExecutionRequests, ssz} from "@lodestar/types"; import { + BYTES_PER_FIELD_ELEMENT, BYTES_PER_LOGS_BLOOM, FIELD_ELEMENTS_PER_BLOB, - BYTES_PER_FIELD_ELEMENT, ForkName, ForkSeq, } from "@lodestar/params"; +import {ExecutionPayload, ExecutionRequests, Root, Wei, bellatrix, capella, deneb, electra, ssz} from "@lodestar/types"; import { - bytesToData, - numToQuantity, - dataToBytes, - quantityToNum, DATA, QUANTITY, + bytesToData, + dataToBytes, + numToQuantity, quantityToBigint, + quantityToNum, } from "../../eth1/provider/utils.js"; -import {ExecutionPayloadStatus, BlobsBundle, PayloadAttributes, VersionedHashes} from "./interface.js"; +import {BlobsBundle, ExecutionPayloadStatus, PayloadAttributes, VersionedHashes} from "./interface.js"; import {WithdrawalV1} from "./payloadIdCache.js"; export type EngineApiRpcParamTypes = { diff --git a/packages/beacon-node/src/execution/engine/utils.ts b/packages/beacon-node/src/execution/engine/utils.ts index 4d84eda52c44..1a88edb22cce 100644 --- a/packages/beacon-node/src/execution/engine/utils.ts +++ b/packages/beacon-node/src/execution/engine/utils.ts @@ -2,14 +2,14 @@ import {isFetchError} from "@lodestar/api"; import {isErrorAborted} from "@lodestar/utils"; import {IJson, RpcPayload} from "../../eth1/interface.js"; import { - IJsonRpcHttpClient, ErrorJsonRpcResponse, HttpRpcError, - JsonRpcHttpClientEventEmitter, + IJsonRpcHttpClient, JsonRpcHttpClientEvent, + JsonRpcHttpClientEventEmitter, } from "../../eth1/provider/jsonRpcHttpClient.js"; import {isQueueErrorAborted} from "../../util/queue/errors.js"; -import {ExecutionPayloadStatus, ExecutionEngineState} from "./interface.js"; +import {ExecutionEngineState, ExecutionPayloadStatus} from "./interface.js"; export type JsonRpcBackend = { // biome-ignore lint/suspicious/noExplicitAny: diff --git a/packages/beacon-node/src/metrics/metrics.ts b/packages/beacon-node/src/metrics/metrics.ts index 58a48e34bbd5..ed607c7521ed 100644 --- a/packages/beacon-node/src/metrics/metrics.ts +++ b/packages/beacon-node/src/metrics/metrics.ts @@ -1,13 +1,13 @@ -import {Metric, Registry} from "prom-client"; -import {Logger} from "@lodestar/utils"; -import {BeaconStateAllForks, getCurrentSlot} from "@lodestar/state-transition"; import {ChainForkConfig} from "@lodestar/config"; -import {createBeaconMetrics, BeaconMetrics} from "./metrics/beacon.js"; -import {createLodestarMetrics, LodestarMetrics} from "./metrics/lodestar.js"; +import {BeaconStateAllForks, getCurrentSlot} from "@lodestar/state-transition"; +import {Logger} from "@lodestar/utils"; +import {Metric, Registry} from "prom-client"; +import {BeaconMetrics, createBeaconMetrics} from "./metrics/beacon.js"; +import {LodestarMetrics, createLodestarMetrics} from "./metrics/lodestar.js"; +import {collectNodeJSMetrics} from "./nodeJsMetrics.js"; import {MetricsOptions} from "./options.js"; import {RegistryMetricCreator} from "./utils/registryMetricCreator.js"; -import {createValidatorMonitor, ValidatorMonitor} from "./validatorMonitor.js"; -import {collectNodeJSMetrics} from "./nodeJsMetrics.js"; +import {ValidatorMonitor, createValidatorMonitor} from "./validatorMonitor.js"; export type Metrics = BeaconMetrics & LodestarMetrics & diff --git a/packages/beacon-node/src/metrics/metrics/beacon.ts b/packages/beacon-node/src/metrics/metrics/beacon.ts index b9a02a3b2059..0347aef8957b 100644 --- a/packages/beacon-node/src/metrics/metrics/beacon.ts +++ b/packages/beacon-node/src/metrics/metrics/beacon.ts @@ -1,13 +1,13 @@ -import {ProducedBlockSource} from "@lodestar/types"; -import {NotReorgedReason} from "@lodestar/fork-choice/lib/forkChoice/interface.js"; import {UpdateHeadOpt} from "@lodestar/fork-choice"; -import {RegistryMetricCreator} from "../utils/registryMetricCreator.js"; -import {BlockProductionStep, PayloadPreparationType} from "../../chain/produceBlock/index.js"; +import {NotReorgedReason} from "@lodestar/fork-choice/lib/forkChoice/interface.js"; +import {ProducedBlockSource} from "@lodestar/types"; import { BlockSelectionResult, BuilderBlockSelectionReason, EngineBlockSelectionReason, } from "../../api/impl/validator/index.js"; +import {BlockProductionStep, PayloadPreparationType} from "../../chain/produceBlock/index.js"; +import {RegistryMetricCreator} from "../utils/registryMetricCreator.js"; export type BeaconMetrics = ReturnType; diff --git a/packages/beacon-node/src/metrics/metrics/lodestar.ts b/packages/beacon-node/src/metrics/metrics/lodestar.ts index ac2cca319775..c138a8dfe26a 100644 --- a/packages/beacon-node/src/metrics/metrics/lodestar.ts +++ b/packages/beacon-node/src/metrics/metrics/lodestar.ts @@ -1,6 +1,6 @@ import {EpochTransitionStep, StateCloneSource, StateHashTreeRootSource} from "@lodestar/state-transition"; import {BeaconState} from "@lodestar/types"; -import {BlockSource, BlobsSource} from "../../chain/blocks/types.js"; +import {BlobsSource, BlockSource} from "../../chain/blocks/types.js"; import {JobQueueItemType} from "../../chain/bls/index.js"; import {BlockErrorCode} from "../../chain/errors/index.js"; import {InsertOutcome} from "../../chain/opPools/types.js"; @@ -8,17 +8,17 @@ import {RegenCaller, RegenFnName} from "../../chain/regen/interface.js"; import {ReprocessStatus} from "../../chain/reprocess.js"; import {RejectReason} from "../../chain/seenCache/seenAttestationData.js"; import {BlockInputAvailabilitySource} from "../../chain/seenCache/seenGossipBlockInput.js"; +import {CacheItemType} from "../../chain/stateCache/types.js"; import {ExecutionPayloadStatus} from "../../execution/index.js"; import {GossipType} from "../../network/index.js"; import {CannotAcceptWorkReason, ReprocessRejectReason} from "../../network/processor/index.js"; import {BackfillSyncMethod} from "../../sync/backfill/backfill.js"; import {PendingBlockType} from "../../sync/index.js"; import {PeerSyncType, RangeSyncType} from "../../sync/utils/remoteSyncType.js"; +import {AllocSource} from "../../util/bufferPool.js"; import {LodestarMetadata} from "../options.js"; import {RegistryMetricCreator} from "../utils/registryMetricCreator.js"; import {OpSource} from "../validatorMonitor.js"; -import {CacheItemType} from "../../chain/stateCache/types.js"; -import {AllocSource} from "../../util/bufferPool.js"; export type LodestarMetrics = ReturnType; diff --git a/packages/beacon-node/src/metrics/nodeJsMetrics.ts b/packages/beacon-node/src/metrics/nodeJsMetrics.ts index c565cfc07ba5..c448276e278a 100644 --- a/packages/beacon-node/src/metrics/nodeJsMetrics.ts +++ b/packages/beacon-node/src/metrics/nodeJsMetrics.ts @@ -1,5 +1,5 @@ -import {collectDefaultMetrics, Registry} from "prom-client"; import {gcStats} from "@chainsafe/prometheus-gc-stats"; +import {Registry, collectDefaultMetrics} from "prom-client"; export function collectNodeJSMetrics(register: Registry, prefix?: string): () => void { collectDefaultMetrics({ diff --git a/packages/beacon-node/src/metrics/server/http.ts b/packages/beacon-node/src/metrics/server/http.ts index e197dcfa2a25..5d4fa36998fb 100644 --- a/packages/beacon-node/src/metrics/server/http.ts +++ b/packages/beacon-node/src/metrics/server/http.ts @@ -1,9 +1,9 @@ import http from "node:http"; import {AddressInfo} from "node:net"; -import {Registry} from "prom-client"; import {Logger} from "@lodestar/utils"; -import {wrapError} from "../../util/wrapError.js"; +import {Registry} from "prom-client"; import {HttpActiveSocketsTracker} from "../../api/rest/activeSockets.js"; +import {wrapError} from "../../util/wrapError.js"; import {RegistryMetricCreator} from "../utils/registryMetricCreator.js"; export type HttpMetricsServerOpts = { diff --git a/packages/beacon-node/src/metrics/utils/avgMinMax.ts b/packages/beacon-node/src/metrics/utils/avgMinMax.ts index 709c83ee38d6..8bb5b196141e 100644 --- a/packages/beacon-node/src/metrics/utils/avgMinMax.ts +++ b/packages/beacon-node/src/metrics/utils/avgMinMax.ts @@ -1,5 +1,5 @@ -import {GaugeConfiguration} from "prom-client"; import {AvgMinMax as IAvgMinMax, LabelKeys, LabelsGeneric} from "@lodestar/utils"; +import {GaugeConfiguration} from "prom-client"; import {GaugeExtra} from "./gauge.js"; type GetValuesFn = () => number[]; diff --git a/packages/beacon-node/src/metrics/utils/gauge.ts b/packages/beacon-node/src/metrics/utils/gauge.ts index 1f527adfcb64..a4c5e9966759 100644 --- a/packages/beacon-node/src/metrics/utils/gauge.ts +++ b/packages/beacon-node/src/metrics/utils/gauge.ts @@ -1,5 +1,5 @@ -import {Gauge} from "prom-client"; import {CollectFn, Gauge as IGauge, LabelKeys, LabelsGeneric} from "@lodestar/utils"; +import {Gauge} from "prom-client"; /** * Extends the prom-client Gauge to be able to add multiple collect functions after instantiation diff --git a/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts b/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts index adec6f984702..30de36969456 100644 --- a/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts +++ b/packages/beacon-node/src/metrics/utils/registryMetricCreator.ts @@ -1,4 +1,3 @@ -import {Gauge, Registry, Counter, Histogram} from "prom-client"; import { AvgMinMaxConfig, CounterConfig, @@ -14,6 +13,7 @@ import { NoLabels, StaticConfig, } from "@lodestar/utils"; +import {Counter, Gauge, Histogram, Registry} from "prom-client"; import {AvgMinMax} from "./avgMinMax.js"; import {GaugeExtra} from "./gauge.js"; diff --git a/packages/beacon-node/src/metrics/validatorMonitor.ts b/packages/beacon-node/src/metrics/validatorMonitor.ts index 14a210f62997..401d58af57ff 100644 --- a/packages/beacon-node/src/metrics/validatorMonitor.ts +++ b/packages/beacon-node/src/metrics/validatorMonitor.ts @@ -1,19 +1,19 @@ +import {ChainConfig, ChainForkConfig} from "@lodestar/config"; +import {ForkSeq, INTERVALS_PER_SLOT, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params"; import { - computeEpochAtSlot, - parseAttesterFlags, CachedBeaconStateAllForks, CachedBeaconStateAltair, - parseParticipationFlags, + ParticipationFlags, + computeEpochAtSlot, computeStartSlotAtEpoch, getBlockRootAtSlot, - ParticipationFlags, + parseAttesterFlags, + parseParticipationFlags, } from "@lodestar/state-transition"; -import {LogData, LogHandler, LogLevel, Logger, MapDef, MapDefMax, toRootHex} from "@lodestar/utils"; import {BeaconBlock, RootHex, altair, deneb} from "@lodestar/types"; -import {ChainConfig, ChainForkConfig} from "@lodestar/config"; -import {ForkSeq, INTERVALS_PER_SLOT, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params"; import {Epoch, Slot, ValidatorIndex} from "@lodestar/types"; import {IndexedAttestation, SignedAggregateAndProof} from "@lodestar/types"; +import {LogData, LogHandler, LogLevel, Logger, MapDef, MapDefMax, toRootHex} from "@lodestar/utils"; import {GENESIS_SLOT} from "../constants/constants.js"; import {LodestarMetrics} from "./metrics/lodestar.js"; diff --git a/packages/beacon-node/src/monitoring/service.ts b/packages/beacon-node/src/monitoring/service.ts index f6a6a2352e02..930fe4a65224 100644 --- a/packages/beacon-node/src/monitoring/service.ts +++ b/packages/beacon-node/src/monitoring/service.ts @@ -1,11 +1,11 @@ -import {Registry} from "prom-client"; import {fetch} from "@lodestar/api"; import {ErrorAborted, Histogram, Logger, TimeoutError} from "@lodestar/utils"; +import {Registry} from "prom-client"; import {RegistryMetricCreator} from "../metrics/index.js"; -import {defaultMonitoringOptions, MonitoringOptions} from "./options.js"; import {createClientStats} from "./clientStats.js"; -import {ClientStats} from "./types.js"; +import {MonitoringOptions, defaultMonitoringOptions} from "./options.js"; import system from "./system.js"; +import {ClientStats} from "./types.js"; type MonitoringData = Record; diff --git a/packages/beacon-node/src/monitoring/system.ts b/packages/beacon-node/src/monitoring/system.ts index 83507443be01..4afcc6064b16 100644 --- a/packages/beacon-node/src/monitoring/system.ts +++ b/packages/beacon-node/src/monitoring/system.ts @@ -2,9 +2,9 @@ /* eslint-disable import/no-named-as-default-member */ import os from "node:os"; import path from "node:path"; +import {Logger} from "@lodestar/utils"; // We want to keep `system` export as it's more readable and easier to understand import system from "systeminformation"; -import {Logger} from "@lodestar/utils"; type MiscOs = "lin" | "win" | "mac" | "unk"; diff --git a/packages/beacon-node/src/network/core/networkCore.ts b/packages/beacon-node/src/network/core/networkCore.ts index d47fcabd4146..718b7c92df7f 100644 --- a/packages/beacon-node/src/network/core/networkCore.ts +++ b/packages/beacon-node/src/network/core/networkCore.ts @@ -1,37 +1,37 @@ -import {Connection, PeerId} from "@libp2p/interface"; -import {multiaddr} from "@multiformats/multiaddr"; -import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; -import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js"; import {ENR} from "@chainsafe/enr"; +import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/dist/src/score/peer-score.js"; +import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; +import {Connection, PeerId} from "@libp2p/interface"; import {routes} from "@lodestar/api"; import {BeaconConfig} from "@lodestar/config"; import type {LoggerNode} from "@lodestar/logger/node"; -import {Epoch, phase0} from "@lodestar/types"; -import {fromHex, withTimeout} from "@lodestar/utils"; import {ForkName} from "@lodestar/params"; import {ResponseIncoming} from "@lodestar/reqresp"; -import {Libp2p} from "../interface.js"; -import {PeerManager} from "../peers/peerManager.js"; -import {ReqRespBeaconNode} from "../reqresp/ReqRespBeaconNode.js"; -import {OutgoingRequestArgs, GetReqRespHandlerFn} from "../reqresp/types.js"; -import {Eth2Gossipsub, getCoreTopicsAtFork} from "../gossip/index.js"; -import {SyncnetsService} from "../subnets/syncnetsService.js"; +import {Epoch, phase0} from "@lodestar/types"; +import {fromHex, withTimeout} from "@lodestar/utils"; +import {multiaddr} from "@multiformats/multiaddr"; +import {formatNodePeer} from "../../api/impl/node/utils.js"; +import {RegistryMetricCreator} from "../../metrics/index.js"; +import {ClockEvent, IClock} from "../../util/clock.js"; +import {peerIdFromString, peerIdToString} from "../../util/peerId.js"; +import {Discv5Worker} from "../discv5/index.js"; +import {NetworkEventBus} from "../events.js"; import {FORK_EPOCH_LOOKAHEAD, getActiveForks} from "../forks.js"; -import {NetworkOptions} from "../options.js"; -import {CommitteeSubscription, IAttnetsService} from "../subnets/interface.js"; -import {MetadataController} from "../metadata.js"; +import {Eth2Gossipsub, getCoreTopicsAtFork} from "../gossip/index.js"; +import {Libp2p} from "../interface.js"; import {createNodeJsLibp2p} from "../libp2p/index.js"; -import {PeersData} from "../peers/peersData.js"; +import {MetadataController} from "../metadata.js"; +import {NetworkOptions} from "../options.js"; import {PeerAction, PeerRpcScoreStore, PeerScoreStats} from "../peers/index.js"; -import {getConnectionsMap} from "../util.js"; -import {IClock, ClockEvent} from "../../util/clock.js"; -import {formatNodePeer} from "../../api/impl/node/utils.js"; -import {NetworkEventBus} from "../events.js"; -import {Discv5Worker} from "../discv5/index.js"; +import {PeerManager} from "../peers/peerManager.js"; +import {PeersData} from "../peers/peersData.js"; +import {ReqRespBeaconNode} from "../reqresp/ReqRespBeaconNode.js"; +import {GetReqRespHandlerFn, OutgoingRequestArgs} from "../reqresp/types.js"; import {LocalStatusCache} from "../statusCache.js"; -import {RegistryMetricCreator} from "../../metrics/index.js"; -import {peerIdFromString, peerIdToString} from "../../util/peerId.js"; import {AttnetsService} from "../subnets/attnetsService.js"; +import {CommitteeSubscription, IAttnetsService} from "../subnets/interface.js"; +import {SyncnetsService} from "../subnets/syncnetsService.js"; +import {getConnectionsMap} from "../util.js"; import {NetworkCoreMetrics, createNetworkCoreMetrics} from "./metrics.js"; import {INetworkCore, MultiaddrStr, PeerIdStr} from "./types.js"; diff --git a/packages/beacon-node/src/network/core/networkCoreWorker.ts b/packages/beacon-node/src/network/core/networkCoreWorker.ts index 5e4b057402d8..a5622bc6a5c1 100644 --- a/packages/beacon-node/src/network/core/networkCoreWorker.ts +++ b/packages/beacon-node/src/network/core/networkCoreWorker.ts @@ -11,11 +11,8 @@ import {AsyncIterableBridgeCaller, AsyncIterableBridgeHandler} from "../../util/ import {Clock} from "../../util/clock.js"; import {peerIdToString} from "../../util/peerId.js"; import {profileNodeJS, writeHeapSnapshot} from "../../util/profile.js"; -import {NetworkEventBus, NetworkEventData, networkEventDirection} from "../events.js"; import {wireEventsOnWorkerThread} from "../../util/workerEvents.js"; -import {getNetworkCoreWorkerMetrics} from "./metrics.js"; -import {NetworkWorkerApi, NetworkWorkerData} from "./types.js"; -import {NetworkCore} from "./networkCore.js"; +import {NetworkEventBus, NetworkEventData, networkEventDirection} from "../events.js"; import { NetworkWorkerThreadEventType, ReqRespBridgeEventBus, @@ -24,6 +21,9 @@ import { getReqRespBridgeRespEvents, reqRespBridgeEventDirection, } from "./events.js"; +import {getNetworkCoreWorkerMetrics} from "./metrics.js"; +import {NetworkCore} from "./networkCore.js"; +import {NetworkWorkerApi, NetworkWorkerData} from "./types.js"; // Cloned data from instantiation const workerData = worker.workerData as NetworkWorkerData; diff --git a/packages/beacon-node/src/network/core/types.ts b/packages/beacon-node/src/network/core/types.ts index 4eeaf96e1903..87feb9da9d21 100644 --- a/packages/beacon-node/src/network/core/types.ts +++ b/packages/beacon-node/src/network/core/types.ts @@ -1,13 +1,13 @@ import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score"; import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; import {routes} from "@lodestar/api"; +import {LoggerNodeOpts} from "@lodestar/logger/node"; import {ResponseIncoming} from "@lodestar/reqresp"; import {phase0} from "@lodestar/types"; -import {LoggerNodeOpts} from "@lodestar/logger/node"; import {NetworkOptions} from "../options.js"; -import {CommitteeSubscription} from "../subnets/interface.js"; import {PeerAction, PeerScoreStats} from "../peers/index.js"; import {OutgoingRequestArgs} from "../reqresp/types.js"; +import {CommitteeSubscription} from "../subnets/interface.js"; export type MultiaddrStr = string; export type PeerIdStr = string; diff --git a/packages/beacon-node/src/network/discv5/index.ts b/packages/beacon-node/src/network/discv5/index.ts index 745b3171c38d..b010ee1ac670 100644 --- a/packages/beacon-node/src/network/discv5/index.ts +++ b/packages/beacon-node/src/network/discv5/index.ts @@ -1,11 +1,11 @@ import EventEmitter from "node:events"; +import {ENR, ENRData, SignableENR, createPrivateKeyFromPeerId} from "@chainsafe/enr"; +import {Thread, Worker, spawn} from "@chainsafe/threads"; import {PeerId, Secp256k1PeerId} from "@libp2p/interface"; -import {StrictEventEmitter} from "strict-event-emitter-types"; import {exportToProtobuf} from "@libp2p/peer-id-factory"; -import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR} from "@chainsafe/enr"; -import {spawn, Thread, Worker} from "@chainsafe/threads"; -import {chainConfigFromJson, chainConfigToJson, BeaconConfig} from "@lodestar/config"; +import {BeaconConfig, chainConfigFromJson, chainConfigToJson} from "@lodestar/config"; import {LoggerNode} from "@lodestar/logger/node"; +import {StrictEventEmitter} from "strict-event-emitter-types"; import {NetworkCoreMetrics} from "../core/metrics.js"; import {Discv5WorkerApi, Discv5WorkerData, LodestarDiscv5Opts} from "./types.js"; diff --git a/packages/beacon-node/src/network/discv5/worker.ts b/packages/beacon-node/src/network/discv5/worker.ts index 8e96751d5fe7..49dfc9c2f35d 100644 --- a/packages/beacon-node/src/network/discv5/worker.ts +++ b/packages/beacon-node/src/network/discv5/worker.ts @@ -1,20 +1,20 @@ -import worker from "node:worker_threads"; -import path from "node:path"; import fs from "node:fs"; -import {createFromProtobuf} from "@libp2p/peer-id-factory"; -import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; -import {expose} from "@chainsafe/threads/worker"; -import {Observable, Subject} from "@chainsafe/threads/observable"; +import path from "node:path"; +import worker from "node:worker_threads"; import {Discv5} from "@chainsafe/discv5"; -import {createPrivateKeyFromPeerId, ENR, ENRData, SignableENR, SignableENRData} from "@chainsafe/enr"; +import {ENR, ENRData, SignableENR, SignableENRData, createPrivateKeyFromPeerId} from "@chainsafe/enr"; +import {Observable, Subject} from "@chainsafe/threads/observable"; +import {expose} from "@chainsafe/threads/worker"; +import {createFromProtobuf} from "@libp2p/peer-id-factory"; import {createBeaconConfig} from "@lodestar/config"; import {getNodeLogger} from "@lodestar/logger/node"; import {Gauge} from "@lodestar/utils"; +import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; import {RegistryMetricCreator} from "../../metrics/index.js"; import {collectNodeJSMetrics} from "../../metrics/nodeJsMetrics.js"; import {profileNodeJS, writeHeapSnapshot} from "../../util/profile.js"; import {Discv5WorkerApi, Discv5WorkerData} from "./types.js"; -import {enrRelevance, ENRRelevance} from "./utils.js"; +import {ENRRelevance, enrRelevance} from "./utils.js"; // This discv5 worker will start discv5 on initialization (there is no `start` function to call) // A consumer _should_ call `close` before terminating the worker to cleanly exit discv5 before destroying the thread diff --git a/packages/beacon-node/src/network/events.ts b/packages/beacon-node/src/network/events.ts index a95b52394163..ed3e7ec876ed 100644 --- a/packages/beacon-node/src/network/events.ts +++ b/packages/beacon-node/src/network/events.ts @@ -1,12 +1,12 @@ import {EventEmitter} from "node:events"; import {PeerId, TopicValidatorResult} from "@libp2p/interface"; -import {phase0, RootHex} from "@lodestar/types"; +import {RootHex, phase0} from "@lodestar/types"; import {BlockInput, NullBlockInput} from "../chain/blocks/types.js"; -import {StrictEventEmitterSingleArg} from "../util/strictEvents.js"; import {PeerIdStr} from "../util/peerId.js"; +import {StrictEventEmitterSingleArg} from "../util/strictEvents.js"; import {EventDirection} from "../util/workerEvents.js"; -import {RequestTypedContainer} from "./reqresp/ReqRespBeaconNode.js"; import {PendingGossipsubMessage} from "./processor/types.js"; +import {RequestTypedContainer} from "./reqresp/ReqRespBeaconNode.js"; export enum NetworkEvent { /** A relevant peer has connected or has been re-STATUS'd */ diff --git a/packages/beacon-node/src/network/forks.ts b/packages/beacon-node/src/network/forks.ts index 1c613f4cee94..cad4616c008b 100644 --- a/packages/beacon-node/src/network/forks.ts +++ b/packages/beacon-node/src/network/forks.ts @@ -1,5 +1,5 @@ -import {ForkName} from "@lodestar/params"; import {ChainForkConfig, ForkInfo} from "@lodestar/config"; +import {ForkName} from "@lodestar/params"; import {Epoch} from "@lodestar/types"; /** diff --git a/packages/beacon-node/src/network/gossip/encoding.ts b/packages/beacon-node/src/network/gossip/encoding.ts index f7f733fcd915..f6121bf8af91 100644 --- a/packages/beacon-node/src/network/gossip/encoding.ts +++ b/packages/beacon-node/src/network/gossip/encoding.ts @@ -1,13 +1,13 @@ -import {compress, uncompress} from "snappyjs"; -import xxhashFactory from "xxhash-wasm"; -import {Message} from "@libp2p/interface"; import {digest} from "@chainsafe/as-sha256"; import {RPC} from "@chainsafe/libp2p-gossipsub/message"; import {DataTransform} from "@chainsafe/libp2p-gossipsub/types"; -import {intToBytes} from "@lodestar/utils"; +import {Message} from "@libp2p/interface"; import {ForkName} from "@lodestar/params"; +import {intToBytes} from "@lodestar/utils"; +import {compress, uncompress} from "snappyjs"; +import xxhashFactory from "xxhash-wasm"; import {MESSAGE_DOMAIN_VALID_SNAPPY} from "./constants.js"; -import {getGossipSSZType, GossipTopicCache} from "./topic.js"; +import {GossipTopicCache, getGossipSSZType} from "./topic.js"; // Load WASM const xxhash = await xxhashFactory(); diff --git a/packages/beacon-node/src/network/gossip/gossipsub.ts b/packages/beacon-node/src/network/gossip/gossipsub.ts index 76e1330cd4a1..42f8ba8b114c 100644 --- a/packages/beacon-node/src/network/gossip/gossipsub.ts +++ b/packages/beacon-node/src/network/gossip/gossipsub.ts @@ -1,29 +1,29 @@ import {GossipSub, GossipsubEvents} from "@chainsafe/libp2p-gossipsub"; -import {SignaturePolicy, TopicStr} from "@chainsafe/libp2p-gossipsub/types"; -import {PeerScoreParams} from "@chainsafe/libp2p-gossipsub/score"; import {MetricsRegister, TopicLabel, TopicStrToLabel} from "@chainsafe/libp2p-gossipsub/metrics"; +import {PeerScoreParams} from "@chainsafe/libp2p-gossipsub/score"; +import {SignaturePolicy, TopicStr} from "@chainsafe/libp2p-gossipsub/types"; import {BeaconConfig} from "@lodestar/config"; import {ATTESTATION_SUBNET_COUNT, ForkName, SLOTS_PER_EPOCH, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {Logger, Map2d, Map2dArr} from "@lodestar/utils"; -import {RegistryMetricCreator} from "../../metrics/index.js"; -import {PeersData} from "../peers/peersData.js"; -import {ClientKind} from "../peers/client.js"; import {GOSSIP_MAX_SIZE, GOSSIP_MAX_SIZE_BELLATRIX} from "../../constants/network.js"; -import {Libp2p} from "../interface.js"; -import {NetworkEvent, NetworkEventBus, NetworkEventData} from "../events.js"; +import {RegistryMetricCreator} from "../../metrics/index.js"; import {callInNextEventLoop} from "../../util/eventLoop.js"; -import {GossipTopic, GossipType} from "./interface.js"; -import {GossipTopicCache, stringifyGossipTopic, getCoreTopicsAtFork} from "./topic.js"; +import {NetworkEvent, NetworkEventBus, NetworkEventData} from "../events.js"; +import {Libp2p} from "../interface.js"; +import {ClientKind} from "../peers/client.js"; +import {PeersData} from "../peers/peersData.js"; import {DataTransformSnappy, fastMsgIdFn, msgIdFn, msgIdToStrFn} from "./encoding.js"; -import {createEth2GossipsubMetrics, Eth2GossipsubMetrics} from "./metrics.js"; +import {GossipTopic, GossipType} from "./interface.js"; +import {Eth2GossipsubMetrics, createEth2GossipsubMetrics} from "./metrics.js"; +import {GossipTopicCache, getCoreTopicsAtFork, stringifyGossipTopic} from "./topic.js"; import { - computeGossipPeerScoreParams, - gossipScoreThresholds, GOSSIP_D, GOSSIP_D_HIGH, GOSSIP_D_LOW, + computeGossipPeerScoreParams, + gossipScoreThresholds, } from "./scoringParameters.js"; /** As specified in https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md */ diff --git a/packages/beacon-node/src/network/gossip/interface.ts b/packages/beacon-node/src/network/gossip/interface.ts index ff1bfa088c17..9939ed5af657 100644 --- a/packages/beacon-node/src/network/gossip/interface.ts +++ b/packages/beacon-node/src/network/gossip/interface.ts @@ -1,25 +1,25 @@ -import {Libp2p} from "libp2p"; -import {Message, TopicValidatorResult} from "@libp2p/interface"; import {PeerIdStr} from "@chainsafe/libp2p-gossipsub/types"; +import {Message, TopicValidatorResult} from "@libp2p/interface"; +import {BeaconConfig} from "@lodestar/config"; import {ForkName} from "@lodestar/params"; import { - altair, - capella, - deneb, + Attestation, LightClientFinalityUpdate, LightClientOptimisticUpdate, - phase0, + SignedAggregateAndProof, SignedBeaconBlock, Slot, - Attestation, - SignedAggregateAndProof, + altair, + capella, + deneb, + phase0, } from "@lodestar/types"; -import {BeaconConfig} from "@lodestar/config"; import {Logger} from "@lodestar/utils"; -import {IBeaconChain} from "../../chain/index.js"; -import {JobItemQueue} from "../../util/queue/index.js"; +import {Libp2p} from "libp2p"; import {AttestationError, AttestationErrorType} from "../../chain/errors/attestationError.js"; import {GossipActionError} from "../../chain/errors/gossipValidation.js"; +import {IBeaconChain} from "../../chain/index.js"; +import {JobItemQueue} from "../../util/queue/index.js"; export enum GossipType { beacon_block = "beacon_block", diff --git a/packages/beacon-node/src/network/gossip/scoringParameters.ts b/packages/beacon-node/src/network/gossip/scoringParameters.ts index 3ba32614afeb..890fd5acd251 100644 --- a/packages/beacon-node/src/network/gossip/scoringParameters.ts +++ b/packages/beacon-node/src/network/gossip/scoringParameters.ts @@ -1,12 +1,12 @@ import { - defaultTopicScoreParams, PeerScoreParams, - TopicScoreParams, PeerScoreThresholds, + TopicScoreParams, + defaultTopicScoreParams, } from "@chainsafe/libp2p-gossipsub/score"; -import {computeCommitteeCount} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; import {ATTESTATION_SUBNET_COUNT, SLOTS_PER_EPOCH, TARGET_AGGREGATORS_PER_COMMITTEE} from "@lodestar/params"; +import {computeCommitteeCount} from "@lodestar/state-transition"; import {getActiveForks} from "../forks.js"; import {Eth2Context, Eth2GossipsubModules} from "./gossipsub.js"; import {GossipType} from "./interface.js"; diff --git a/packages/beacon-node/src/network/gossip/topic.ts b/packages/beacon-node/src/network/gossip/topic.ts index ed44c8314425..de52860605a9 100644 --- a/packages/beacon-node/src/network/gossip/topic.ts +++ b/packages/beacon-node/src/network/gossip/topic.ts @@ -1,17 +1,17 @@ -import {ssz, Attestation, sszTypesFor} from "@lodestar/types"; import {ForkDigestContext} from "@lodestar/config"; import { ATTESTATION_SUBNET_COUNT, ForkName, ForkSeq, + MAX_BLOBS_PER_BLOCK, SYNC_COMMITTEE_SUBNET_COUNT, isForkLightClient, - MAX_BLOBS_PER_BLOCK, } from "@lodestar/params"; +import {Attestation, ssz, sszTypesFor} from "@lodestar/types"; import {GossipAction, GossipActionError, GossipErrorCode} from "../../chain/errors/gossipValidation.js"; -import {GossipEncoding, GossipTopic, GossipType, GossipTopicTypeMap, SSZTypeOfGossipTopic} from "./interface.js"; import {DEFAULT_ENCODING} from "./constants.js"; +import {GossipEncoding, GossipTopic, GossipTopicTypeMap, GossipType, SSZTypeOfGossipTopic} from "./interface.js"; export interface IGossipTopicCache { getTopic(topicStr: string): GossipTopic; diff --git a/packages/beacon-node/src/network/interface.ts b/packages/beacon-node/src/network/interface.ts index 0d48df42b31e..bf117cc8a743 100644 --- a/packages/beacon-node/src/network/interface.ts +++ b/packages/beacon-node/src/network/interface.ts @@ -1,40 +1,40 @@ -import {Libp2p as ILibp2p} from "libp2p"; +import {Identify} from "@chainsafe/libp2p-identify"; import { - Libp2pEvents, ComponentLogger, - NodeInfo, - ConnectionProtector, ConnectionGater, + ConnectionProtector, ContentRouting, - TypedEventTarget, + Libp2pEvents, Metrics, + NodeInfo, PeerId, PeerRouting, PeerStore, + TypedEventTarget, Upgrader, } from "@libp2p/interface"; import type {AddressManager, ConnectionManager, Registrar, TransportManager} from "@libp2p/interface-internal"; -import type {Datastore} from "interface-datastore"; -import {Identify} from "@chainsafe/libp2p-identify"; import { LightClientFinalityUpdate, LightClientOptimisticUpdate, + SignedAggregateAndProof, SignedBeaconBlock, Slot, SlotRootHex, + WithBytes, altair, capella, deneb, phase0, - SignedAggregateAndProof, - WithBytes, } from "@lodestar/types"; +import type {Datastore} from "interface-datastore"; +import {Libp2p as ILibp2p} from "libp2p"; import {PeerIdStr} from "../util/peerId.js"; -import {INetworkEventBus} from "./events.js"; import {INetworkCorePublic} from "./core/types.js"; +import {INetworkEventBus} from "./events.js"; import {GossipType} from "./gossip/interface.js"; -import {PendingGossipsubMessage} from "./processor/types.js"; import {PeerAction} from "./peers/index.js"; +import {PendingGossipsubMessage} from "./processor/types.js"; /** * The architecture of the network looks like so: diff --git a/packages/beacon-node/src/network/libp2p/index.ts b/packages/beacon-node/src/network/libp2p/index.ts index a0d58033cf2f..3191a63ac85c 100644 --- a/packages/beacon-node/src/network/libp2p/index.ts +++ b/packages/beacon-node/src/network/libp2p/index.ts @@ -1,18 +1,18 @@ -import {PeerId} from "@libp2p/interface"; -import {Registry} from "prom-client"; import {ENR} from "@chainsafe/enr"; // TODO: We should use this fork until https://github.com/libp2p/js-libp2p/pull/2387 import {identify} from "@chainsafe/libp2p-identify"; +import {noise} from "@chainsafe/libp2p-noise"; import {bootstrap} from "@libp2p/bootstrap"; +import {PeerId} from "@libp2p/interface"; import {mdns} from "@libp2p/mdns"; -import {createLibp2p} from "libp2p"; import {mplex} from "@libp2p/mplex"; import {prometheusMetrics} from "@libp2p/prometheus-metrics"; import {tcp} from "@libp2p/tcp"; -import {noise} from "@chainsafe/libp2p-noise"; -import {defaultNetworkOptions, NetworkOptions} from "../options.js"; -import {Eth2PeerDataStore} from "../peers/datastore.js"; +import {createLibp2p} from "libp2p"; +import {Registry} from "prom-client"; import {Libp2p, LodestarComponents} from "../interface.js"; +import {NetworkOptions, defaultNetworkOptions} from "../options.js"; +import {Eth2PeerDataStore} from "../peers/datastore.js"; export type NodeJsLibp2pOpts = { peerStoreDir?: string; diff --git a/packages/beacon-node/src/network/metadata.ts b/packages/beacon-node/src/network/metadata.ts index fab220c1ebf8..7b70775d63c6 100644 --- a/packages/beacon-node/src/network/metadata.ts +++ b/packages/beacon-node/src/network/metadata.ts @@ -1,8 +1,8 @@ import {BitArray} from "@chainsafe/ssz"; +import {BeaconConfig} from "@lodestar/config"; import {ForkSeq} from "@lodestar/params"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {altair, Epoch, phase0, ssz} from "@lodestar/types"; -import {BeaconConfig} from "@lodestar/config"; +import {Epoch, altair, phase0, ssz} from "@lodestar/types"; import {FAR_FUTURE_EPOCH} from "../constants/index.js"; import {getCurrentAndNextFork} from "./forks.js"; diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 15414fcf9138..2181e21744da 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -1,53 +1,53 @@ -import {PeerId} from "@libp2p/interface"; -import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; import {PeerScoreStatsDump} from "@chainsafe/libp2p-gossipsub/score"; +import {PublishOpts} from "@chainsafe/libp2p-gossipsub/types"; +import {PeerId} from "@libp2p/interface"; +import {routes} from "@lodestar/api"; import {BeaconConfig} from "@lodestar/config"; -import {sleep} from "@lodestar/utils"; import {LoggerNode} from "@lodestar/logger/node"; +import {ForkSeq, MAX_BLOBS_PER_BLOCK} from "@lodestar/params"; +import {ResponseIncoming} from "@lodestar/reqresp"; import {computeStartSlotAtEpoch, computeTimeAtSlot} from "@lodestar/state-transition"; import { - phase0, - deneb, - altair, - Root, - capella, - SlotRootHex, - SignedBeaconBlock, LightClientBootstrap, LightClientFinalityUpdate, LightClientOptimisticUpdate, LightClientUpdate, + Root, SignedAggregateAndProof, + SignedBeaconBlock, + SlotRootHex, WithBytes, + altair, + capella, + deneb, + phase0, } from "@lodestar/types"; -import {routes} from "@lodestar/api"; -import {ResponseIncoming} from "@lodestar/reqresp"; -import {ForkSeq, MAX_BLOBS_PER_BLOCK} from "@lodestar/params"; -import {Metrics, RegistryMetricCreator} from "../metrics/index.js"; +import {sleep} from "@lodestar/utils"; import {IBeaconChain} from "../chain/index.js"; import {IBeaconDb} from "../db/interface.js"; -import {PeerIdStr, peerIdToString} from "../util/peerId.js"; +import {Metrics, RegistryMetricCreator} from "../metrics/index.js"; import {IClock} from "../util/clock.js"; -import {NetworkOptions} from "./options.js"; -import {INetwork} from "./interface.js"; -import {ReqRespMethod} from "./reqresp/index.js"; +import {PeerIdStr, peerIdToString} from "../util/peerId.js"; +import {INetworkCore, NetworkCore, WorkerNetworkCore} from "./core/index.js"; +import {INetworkEventBus, NetworkEvent, NetworkEventBus, NetworkEventData} from "./events.js"; +import {getActiveForks} from "./forks.js"; import {GossipHandlers, GossipTopicMap, GossipType, GossipTypeMap} from "./gossip/index.js"; +import {getGossipSSZType, gossipTopicIgnoreDuplicatePublishError, stringifyGossipTopic} from "./gossip/topic.js"; +import {INetwork} from "./interface.js"; +import {NetworkOptions} from "./options.js"; import {PeerAction, PeerScoreStats} from "./peers/index.js"; -import {INetworkEventBus, NetworkEvent, NetworkEventBus, NetworkEventData} from "./events.js"; -import {CommitteeSubscription} from "./subnets/index.js"; -import {isPublishToZeroPeersError} from "./util.js"; +import {AggregatorTracker} from "./processor/aggregatorTracker.js"; import {NetworkProcessor, PendingGossipsubMessage} from "./processor/index.js"; -import {INetworkCore, NetworkCore, WorkerNetworkCore} from "./core/index.js"; +import {ReqRespMethod} from "./reqresp/index.js"; +import {GetReqRespHandlerFn, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./reqresp/types.js"; import { collectExactOneTyped, collectMaxResponseTyped, collectMaxResponseTypedWithBytes, } from "./reqresp/utils/collect.js"; -import {GetReqRespHandlerFn, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./reqresp/types.js"; import {collectSequentialBlocksInRange} from "./reqresp/utils/collectSequentialBlocksInRange.js"; -import {getGossipSSZType, gossipTopicIgnoreDuplicatePublishError, stringifyGossipTopic} from "./gossip/topic.js"; -import {AggregatorTracker} from "./processor/aggregatorTracker.js"; -import {getActiveForks} from "./forks.js"; +import {CommitteeSubscription} from "./subnets/index.js"; +import {isPublishToZeroPeersError} from "./util.js"; type NetworkModules = { opts: NetworkOptions; diff --git a/packages/beacon-node/src/network/options.ts b/packages/beacon-node/src/network/options.ts index ebb321584d12..1420be1d58fb 100644 --- a/packages/beacon-node/src/network/options.ts +++ b/packages/beacon-node/src/network/options.ts @@ -1,7 +1,7 @@ import {Eth2GossipsubOpts} from "./gossip/gossipsub.js"; import {PeerManagerOpts, PeerRpcScoreOpts} from "./peers/index.js"; -import {ReqRespBeaconNodeOpts} from "./reqresp/ReqRespBeaconNode.js"; import {NetworkProcessorOpts} from "./processor/index.js"; +import {ReqRespBeaconNodeOpts} from "./reqresp/ReqRespBeaconNode.js"; import {SubnetsServiceOpts} from "./subnets/interface.js"; // Since Network is eventually intended to be run in a separate thread, ensure that all options are cloneable using structuredClone diff --git a/packages/beacon-node/src/network/peers/datastore.ts b/packages/beacon-node/src/network/peers/datastore.ts index 88a7a6f5f2d6..ba5cae92c9a9 100644 --- a/packages/beacon-node/src/network/peers/datastore.ts +++ b/packages/beacon-node/src/network/peers/datastore.ts @@ -1,6 +1,6 @@ import {BaseDatastore} from "datastore-core"; import {LevelDatastore} from "datastore-level"; -import {Key, KeyQuery, Query, Pair} from "interface-datastore"; +import {Key, KeyQuery, Pair, Query} from "interface-datastore"; type MemoryItem = { lastAccessedMs: number; diff --git a/packages/beacon-node/src/network/peers/discover.ts b/packages/beacon-node/src/network/peers/discover.ts index 2b03656064e4..e658fd6378bf 100644 --- a/packages/beacon-node/src/network/peers/discover.ts +++ b/packages/beacon-node/src/network/peers/discover.ts @@ -1,18 +1,18 @@ -import {Multiaddr} from "@multiformats/multiaddr"; -import type {PeerId, PeerInfo} from "@libp2p/interface"; import {ENR} from "@chainsafe/enr"; +import type {PeerId, PeerInfo} from "@libp2p/interface"; import {BeaconConfig} from "@lodestar/config"; -import {pruneSetToMax, sleep} from "@lodestar/utils"; -import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {LoggerNode} from "@lodestar/logger/node"; +import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {pruneSetToMax, sleep} from "@lodestar/utils"; +import {Multiaddr} from "@multiformats/multiaddr"; import {NetworkCoreMetrics} from "../core/metrics.js"; +import {Discv5Worker} from "../discv5/index.js"; +import {LodestarDiscv5Opts} from "../discv5/types.js"; import {Libp2p} from "../interface.js"; import {ENRKey, SubnetType} from "../metadata.js"; import {getConnectionsMap, prettyPrintPeerId} from "../util.js"; -import {Discv5Worker} from "../discv5/index.js"; -import {LodestarDiscv5Opts} from "../discv5/types.js"; -import {deserializeEnrSubnets, zeroAttnets, zeroSyncnets} from "./utils/enrSubnetsDeserialize.js"; import {IPeerRpcScoreStore, ScoreState} from "./score/index.js"; +import {deserializeEnrSubnets, zeroAttnets, zeroSyncnets} from "./utils/enrSubnetsDeserialize.js"; /** Max number of cached ENRs after discovering a good peer */ const MAX_CACHED_ENRS = 100; diff --git a/packages/beacon-node/src/network/peers/peerManager.ts b/packages/beacon-node/src/network/peers/peerManager.ts index b8742789d4fb..b8787bcc73a7 100644 --- a/packages/beacon-node/src/network/peers/peerManager.ts +++ b/packages/beacon-node/src/network/peers/peerManager.ts @@ -1,33 +1,33 @@ -import {Connection, PeerId} from "@libp2p/interface"; import {BitArray} from "@chainsafe/ssz"; -import {SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {Connection, PeerId} from "@libp2p/interface"; import {BeaconConfig} from "@lodestar/config"; +import {LoggerNode} from "@lodestar/logger/node"; +import {SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {Metadata, altair, phase0} from "@lodestar/types"; import {withTimeout} from "@lodestar/utils"; -import {LoggerNode} from "@lodestar/logger/node"; -import {GoodByeReasonCode, GOODBYE_KNOWN_CODES, Libp2pEvent} from "../../constants/index.js"; +import {GOODBYE_KNOWN_CODES, GoodByeReasonCode, Libp2pEvent} from "../../constants/index.js"; import {IClock} from "../../util/clock.js"; -import {NetworkEvent, INetworkEventBus, NetworkEventData} from "../events.js"; +import {NetworkCoreMetrics} from "../core/metrics.js"; +import {LodestarDiscv5Opts} from "../discv5/types.js"; +import {INetworkEventBus, NetworkEvent, NetworkEventData} from "../events.js"; +import {Eth2Gossipsub} from "../gossip/gossipsub.js"; import {Libp2p} from "../interface.js"; -import {ReqRespMethod} from "../reqresp/ReqRespBeaconNode.js"; -import {getConnection, getConnectionsMap, prettyPrintPeerId} from "../util.js"; -import {SubnetsService} from "../subnets/index.js"; import {SubnetType} from "../metadata.js"; -import {Eth2Gossipsub} from "../gossip/gossipsub.js"; +import {ReqRespMethod} from "../reqresp/ReqRespBeaconNode.js"; import {StatusCache} from "../statusCache.js"; -import {NetworkCoreMetrics} from "../core/metrics.js"; -import {LodestarDiscv5Opts} from "../discv5/types.js"; +import {SubnetsService} from "../subnets/index.js"; +import {getConnection, getConnectionsMap, prettyPrintPeerId} from "../util.js"; +import {ClientKind, getKnownClientFromAgentVersion} from "./client.js"; import {PeerDiscovery, SubnetDiscvQueryMs} from "./discover.js"; -import {PeersData, PeerData} from "./peersData.js"; -import {getKnownClientFromAgentVersion, ClientKind} from "./client.js"; +import {PeerData, PeersData} from "./peersData.js"; +import {IPeerRpcScoreStore, PeerAction, PeerScoreStats, ScoreState, updateGossipsubScores} from "./score/index.js"; import { + assertPeerRelevance, getConnectedPeerIds, hasSomeConnectedPeer, - assertPeerRelevance, prioritizePeers, renderIrrelevantPeerType, } from "./utils/index.js"; -import {IPeerRpcScoreStore, PeerAction, PeerScoreStats, ScoreState, updateGossipsubScores} from "./score/index.js"; /** heartbeat performs regular updates such as updating reputations and performing discovery requests */ const HEARTBEAT_INTERVAL_MS = 30 * 1000; diff --git a/packages/beacon-node/src/network/peers/peersData.ts b/packages/beacon-node/src/network/peers/peersData.ts index 4f96548c73e4..1a2619f202cd 100644 --- a/packages/beacon-node/src/network/peers/peersData.ts +++ b/packages/beacon-node/src/network/peers/peersData.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface"; -import {altair} from "@lodestar/types"; import {Encoding} from "@lodestar/reqresp"; +import {altair} from "@lodestar/types"; import {ClientKind} from "./client.js"; type PeerIdStr = string; diff --git a/packages/beacon-node/src/network/peers/utils/enrSubnetsDeserialize.ts b/packages/beacon-node/src/network/peers/utils/enrSubnetsDeserialize.ts index 0a26cce9b215..a330a8dca3c8 100644 --- a/packages/beacon-node/src/network/peers/utils/enrSubnetsDeserialize.ts +++ b/packages/beacon-node/src/network/peers/utils/enrSubnetsDeserialize.ts @@ -1,6 +1,6 @@ import {getUint8ByteToBitBooleanArray} from "@chainsafe/ssz"; -import {newFilledArray} from "@lodestar/state-transition"; import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {newFilledArray} from "@lodestar/state-transition"; export const zeroAttnets = newFilledArray(ATTESTATION_SUBNET_COUNT, false); export const zeroSyncnets = newFilledArray(SYNC_COMMITTEE_SUBNET_COUNT, false); diff --git a/packages/beacon-node/src/network/peers/utils/prioritizePeers.ts b/packages/beacon-node/src/network/peers/utils/prioritizePeers.ts index b6fe4cb6bc77..545d8a6ca8b0 100644 --- a/packages/beacon-node/src/network/peers/utils/prioritizePeers.ts +++ b/packages/beacon-node/src/network/peers/utils/prioritizePeers.ts @@ -1,7 +1,7 @@ -import {Direction, PeerId} from "@libp2p/interface"; import {BitArray} from "@chainsafe/ssz"; -import {altair, phase0} from "@lodestar/types"; +import {Direction, PeerId} from "@libp2p/interface"; import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {altair, phase0} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; import {shuffle} from "../../../util/shuffle.js"; import {sortBy} from "../../../util/sortBy.js"; diff --git a/packages/beacon-node/src/network/processor/extractSlotRootFns.ts b/packages/beacon-node/src/network/processor/extractSlotRootFns.ts index d31cb3e2d7f9..57a4861b4cb8 100644 --- a/packages/beacon-node/src/network/processor/extractSlotRootFns.ts +++ b/packages/beacon-node/src/network/processor/extractSlotRootFns.ts @@ -3,8 +3,8 @@ import { getBlockRootFromAttestationSerialized, getBlockRootFromSignedAggregateAndProofSerialized, getSlotFromAttestationSerialized, - getSlotFromSignedAggregateAndProofSerialized, getSlotFromBlobSidecarSerialized, + getSlotFromSignedAggregateAndProofSerialized, getSlotFromSignedBeaconBlockSerialized, } from "../../util/sszBytes.js"; import {GossipType} from "../gossip/index.js"; diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index dab3af0df8ba..5bec263a45c8 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -1,59 +1,59 @@ +import {routes} from "@lodestar/api"; import {BeaconConfig, ChainForkConfig} from "@lodestar/config"; -import {LogLevel, Logger, prettyBytes, toRootHex} from "@lodestar/utils"; -import {Root, Slot, ssz, deneb, UintNum64, SignedBeaconBlock, sszTypesFor} from "@lodestar/types"; import {ForkName, ForkSeq} from "@lodestar/params"; -import {routes} from "@lodestar/api"; import {computeTimeAtSlot} from "@lodestar/state-transition"; -import {Metrics} from "../../metrics/index.js"; -import {OpSource} from "../../metrics/validatorMonitor.js"; +import {Root, SignedBeaconBlock, Slot, UintNum64, deneb, ssz, sszTypesFor} from "@lodestar/types"; +import {LogLevel, Logger, prettyBytes, toRootHex} from "@lodestar/utils"; +import { + BlobSidecarValidation, + BlockInput, + BlockInputType, + GossipedInputType, + NullBlockInput, +} from "../../chain/blocks/types.js"; import { AttestationError, AttestationErrorCode, + BlobSidecarErrorCode, + BlobSidecarGossipError, BlockError, BlockErrorCode, BlockGossipError, - BlobSidecarErrorCode, - BlobSidecarGossipError, GossipAction, GossipActionError, SyncCommitteeError, } from "../../chain/errors/index.js"; +import {IBeaconChain} from "../../chain/interface.js"; +import {validateGossipBlobSidecar} from "../../chain/validation/blobSidecar.js"; import { - BatchGossipHandlers, - SequentialGossipHandlers, - GossipHandlerParamGeneric, - GossipHandlers, - GossipType, -} from "../gossip/interface.js"; -import { + AggregateAndProofValidationResult, + GossipAttestation, validateGossipAggregateAndProof, + validateGossipAttestationsSameAttData, validateGossipAttesterSlashing, validateGossipBlock, + validateGossipBlsToExecutionChange, validateGossipProposerSlashing, validateGossipSyncCommittee, - validateSyncCommitteeGossipContributionAndProof, validateGossipVoluntaryExit, - validateGossipBlsToExecutionChange, - AggregateAndProofValidationResult, - validateGossipAttestationsSameAttData, - GossipAttestation, + validateSyncCommitteeGossipContributionAndProof, } from "../../chain/validation/index.js"; -import {NetworkEvent, NetworkEventBus} from "../events.js"; -import {PeerAction} from "../peers/index.js"; import {validateLightClientFinalityUpdate} from "../../chain/validation/lightClientFinalityUpdate.js"; import {validateLightClientOptimisticUpdate} from "../../chain/validation/lightClientOptimisticUpdate.js"; -import {validateGossipBlobSidecar} from "../../chain/validation/blobSidecar.js"; +import {Metrics} from "../../metrics/index.js"; +import {OpSource} from "../../metrics/validatorMonitor.js"; +import {INetworkCore} from "../core/index.js"; +import {NetworkEvent, NetworkEventBus} from "../events.js"; import { - BlockInput, - GossipedInputType, - BlobSidecarValidation, - BlockInputType, - NullBlockInput, -} from "../../chain/blocks/types.js"; + BatchGossipHandlers, + GossipHandlerParamGeneric, + GossipHandlers, + GossipType, + SequentialGossipHandlers, +} from "../gossip/interface.js"; import {sszDeserialize} from "../gossip/topic.js"; -import {INetworkCore} from "../core/index.js"; import {INetwork} from "../interface.js"; -import {IBeaconChain} from "../../chain/interface.js"; +import {PeerAction} from "../peers/index.js"; import {AggregatorTracker} from "./aggregatorTracker.js"; /** diff --git a/packages/beacon-node/src/network/processor/gossipQueues/index.ts b/packages/beacon-node/src/network/processor/gossipQueues/index.ts index dfa5b0dd1973..b76ebe2d875d 100644 --- a/packages/beacon-node/src/network/processor/gossipQueues/index.ts +++ b/packages/beacon-node/src/network/processor/gossipQueues/index.ts @@ -1,10 +1,10 @@ import {mapValues} from "@lodestar/utils"; +import {getGossipAttestationIndex} from "../../../util/sszBytes.js"; import {BatchGossipType, GossipType, SequentialGossipType} from "../../gossip/interface.js"; import {PendingGossipsubMessage} from "../types.js"; -import {getGossipAttestationIndex} from "../../../util/sszBytes.js"; +import {IndexedGossipQueueMinSize} from "./indexed.js"; import {LinearGossipQueue} from "./linear.js"; import {DropType, GossipQueue, GossipQueueOpts, QueueType, isIndexedGossipQueueMinSizeOpts} from "./types.js"; -import {IndexedGossipQueueMinSize} from "./indexed.js"; /** * In normal condition, the higher this value the more efficient the signature verification. diff --git a/packages/beacon-node/src/network/processor/gossipQueues/linear.ts b/packages/beacon-node/src/network/processor/gossipQueues/linear.ts index 57a29054d417..f8a06c0d4622 100644 --- a/packages/beacon-node/src/network/processor/gossipQueues/linear.ts +++ b/packages/beacon-node/src/network/processor/gossipQueues/linear.ts @@ -1,5 +1,5 @@ import {LinkedList} from "../../../util/array.js"; -import {LinearGossipQueueOpts, DropType, GossipQueue, QueueType} from "./types.js"; +import {DropType, GossipQueue, LinearGossipQueueOpts, QueueType} from "./types.js"; // Having a drop ratio of 1 will empty the queue which is too severe // Worse case drop 95% of the queue diff --git a/packages/beacon-node/src/network/processor/gossipValidatorFn.ts b/packages/beacon-node/src/network/processor/gossipValidatorFn.ts index e5b276e7c707..6fda29bf4ac4 100644 --- a/packages/beacon-node/src/network/processor/gossipValidatorFn.ts +++ b/packages/beacon-node/src/network/processor/gossipValidatorFn.ts @@ -1,16 +1,16 @@ import {TopicValidatorResult} from "@libp2p/interface"; import {ChainForkConfig} from "@lodestar/config"; import {Logger} from "@lodestar/utils"; +import {AttestationError, GossipAction, GossipActionError} from "../../chain/errors/index.js"; import {Metrics} from "../../metrics/index.js"; import { - GossipValidatorFn, - GossipHandlers, - GossipHandlerFn, - GossipValidatorBatchFn, BatchGossipHandlerFn, + GossipHandlerFn, + GossipHandlers, GossipMessageInfo, + GossipValidatorBatchFn, + GossipValidatorFn, } from "../gossip/interface.js"; -import {GossipActionError, GossipAction, AttestationError} from "../../chain/errors/index.js"; export type ValidatorFnModules = { config: ChainForkConfig; diff --git a/packages/beacon-node/src/network/processor/index.ts b/packages/beacon-node/src/network/processor/index.ts index ec0edf54644f..4bfc4263adc8 100644 --- a/packages/beacon-node/src/network/processor/index.ts +++ b/packages/beacon-node/src/network/processor/index.ts @@ -1,14 +1,15 @@ -import {Logger, MapDef, mapValues, sleep} from "@lodestar/utils"; -import {RootHex, Slot, SlotRootHex} from "@lodestar/types"; import {routes} from "@lodestar/api"; -import {pruneSetToMax} from "@lodestar/utils"; import {ForkSeq} from "@lodestar/params"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {IBeaconChain} from "../../chain/interface.js"; +import {RootHex, Slot, SlotRootHex} from "@lodestar/types"; +import {Logger, MapDef, mapValues, sleep} from "@lodestar/utils"; +import {pruneSetToMax} from "@lodestar/utils"; import {GossipErrorCode} from "../../chain/errors/gossipValidation.js"; -import {Metrics} from "../../metrics/metrics.js"; +import {IBeaconChain} from "../../chain/interface.js"; import {IBeaconDb} from "../../db/interface.js"; +import {Metrics} from "../../metrics/metrics.js"; import {ClockEvent} from "../../util/clock.js"; +import {callInNextEventLoop} from "../../util/eventLoop.js"; import {NetworkEvent, NetworkEventBus} from "../events.js"; import { GossipHandlers, @@ -18,12 +19,11 @@ import { GossipValidatorFn, } from "../gossip/interface.js"; import {PeerIdStr} from "../peers/index.js"; -import {callInNextEventLoop} from "../../util/eventLoop.js"; -import {createGossipQueues} from "./gossipQueues/index.js"; -import {PendingGossipsubMessage} from "./types.js"; -import {ValidatorFnsModules, GossipHandlerOpts, getGossipHandlers} from "./gossipHandlers.js"; import {createExtractBlockSlotRootFns} from "./extractSlotRootFns.js"; +import {GossipHandlerOpts, ValidatorFnsModules, getGossipHandlers} from "./gossipHandlers.js"; +import {createGossipQueues} from "./gossipQueues/index.js"; import {ValidatorFnModules, getGossipValidatorBatchFn, getGossipValidatorFn} from "./gossipValidatorFn.js"; +import {PendingGossipsubMessage} from "./types.js"; export * from "./types.js"; diff --git a/packages/beacon-node/src/network/processor/types.ts b/packages/beacon-node/src/network/processor/types.ts index 386b9e8afc37..ec78116bc766 100644 --- a/packages/beacon-node/src/network/processor/types.ts +++ b/packages/beacon-node/src/network/processor/types.ts @@ -1,7 +1,7 @@ import {Message} from "@libp2p/interface"; import {Slot, SlotOptionalRoot} from "@lodestar/types"; -import {GossipTopic, GossipType} from "../gossip/index.js"; import {PeerIdStr} from "../../util/peerId.js"; +import {GossipTopic, GossipType} from "../gossip/index.js"; export type GossipAttestationsWork = { messages: PendingGossipsubMessage[]; diff --git a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts index d34b379f4ccd..a2a2ebd657ab 100644 --- a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts +++ b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts @@ -1,5 +1,4 @@ import {PeerId} from "@libp2p/interface"; -import {Libp2p} from "libp2p"; import {BeaconConfig} from "@lodestar/config"; import {ForkName, ForkSeq} from "@lodestar/params"; import { @@ -15,13 +14,15 @@ import { } from "@lodestar/reqresp"; import {Metadata, phase0, ssz} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; +import {Libp2p} from "libp2p"; +import {callInNextEventLoop} from "../../util/eventLoop.js"; +import {NetworkCoreMetrics} from "../core/metrics.js"; import {INetworkEventBus, NetworkEvent} from "../events.js"; import {MetadataController} from "../metadata.js"; import {PeersData} from "../peers/peersData.js"; import {IPeerRpcScoreStore, PeerAction} from "../peers/score/index.js"; -import {NetworkCoreMetrics} from "../core/metrics.js"; import {StatusCache} from "../statusCache.js"; -import {callInNextEventLoop} from "../../util/eventLoop.js"; +import * as protocols from "./protocols.js"; import {onOutgoingReqRespError} from "./score.js"; import { GetReqRespHandlerFn, @@ -32,7 +33,6 @@ import { requestSszTypeByMethod, responseSszTypeByMethod, } from "./types.js"; -import * as protocols from "./protocols.js"; import {collectExactOneTyped} from "./utils/collect.js"; export {getReqRespHandlers} from "./handlers/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts index 3d71087c8fd8..21d781f11437 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts @@ -1,9 +1,9 @@ import {ChainForkConfig} from "@lodestar/config"; -import {deneb, Epoch, phase0, SignedBeaconBlock, Slot, WithBytes} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; import {computeEpochAtSlot} from "@lodestar/state-transition"; +import {Epoch, SignedBeaconBlock, Slot, WithBytes, deneb, phase0} from "@lodestar/types"; -import {BlobsSource, BlockInput, BlockSource, getBlockInput, BlockInputDataBlobs} from "../../chain/blocks/types.js"; +import {BlobsSource, BlockInput, BlockInputDataBlobs, BlockSource, getBlockInput} from "../../chain/blocks/types.js"; import {PeerIdStr} from "../../util/peerId.js"; import {INetwork} from "../interface.js"; diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts index 3d121156d8e6..a6919318999d 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts @@ -1,21 +1,21 @@ import {ChainForkConfig} from "@lodestar/config"; -import {phase0, deneb, SignedBeaconBlock} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; +import {SignedBeaconBlock, deneb, phase0} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import { + BlobsSource, BlockInput, + BlockInputDataBlobs, BlockInputType, BlockSource, - getBlockInputBlobs, - getBlockInput, NullBlockInput, - BlobsSource, - BlockInputDataBlobs, + getBlockInput, + getBlockInputBlobs, } from "../../chain/blocks/types.js"; -import {PeerIdStr} from "../../util/peerId.js"; -import {INetwork} from "../interface.js"; import {BlockInputAvailabilitySource} from "../../chain/seenCache/seenGossipBlockInput.js"; import {Metrics} from "../../metrics/index.js"; +import {PeerIdStr} from "../../util/peerId.js"; +import {INetwork} from "../interface.js"; import {matchBlockWithBlobs} from "./beaconBlocksMaybeBlobsByRange.js"; export async function beaconBlocksMaybeBlobsByRoot( diff --git a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts index d1046db9651d..e8c19fb49628 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts @@ -1,5 +1,5 @@ import {GENESIS_SLOT, MAX_REQUEST_BLOCKS} from "@lodestar/params"; -import {ResponseError, ResponseOutgoing, RespStatus} from "@lodestar/reqresp"; +import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; import {deneb, phase0} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRange.ts index e3655cd90c6f..9cac846fdb61 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRange.ts @@ -1,6 +1,6 @@ -import {GENESIS_SLOT, MAX_REQUEST_BLOCKS_DENEB, BLOBSIDECAR_FIXED_SIZE} from "@lodestar/params"; -import {ResponseError, ResponseOutgoing, RespStatus} from "@lodestar/reqresp"; -import {deneb, Slot} from "@lodestar/types"; +import {BLOBSIDECAR_FIXED_SIZE, GENESIS_SLOT, MAX_REQUEST_BLOCKS_DENEB} from "@lodestar/params"; +import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; +import {Slot, deneb} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts index 144d470d7199..f44f9482eeb6 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts @@ -1,6 +1,6 @@ -import {ResponseError, ResponseOutgoing, RespStatus} from "@lodestar/reqresp"; import {BLOBSIDECAR_FIXED_SIZE} from "@lodestar/params"; -import {deneb, RootHex} from "@lodestar/types"; +import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; +import {RootHex, deneb} from "@lodestar/types"; import {fromHex, toRootHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/handlers/index.ts b/packages/beacon-node/src/network/reqresp/handlers/index.ts index 50b8cc870844..a836cbc47769 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/index.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/index.ts @@ -1,12 +1,12 @@ -import {ssz} from "@lodestar/types"; import {ProtocolHandler} from "@lodestar/reqresp"; +import {ssz} from "@lodestar/types"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; import {GetReqRespHandlerFn, ReqRespMethod} from "../types.js"; import {onBeaconBlocksByRange} from "./beaconBlocksByRange.js"; import {onBeaconBlocksByRoot} from "./beaconBlocksByRoot.js"; -import {onBlobSidecarsByRoot} from "./blobSidecarsByRoot.js"; import {onBlobSidecarsByRange} from "./blobSidecarsByRange.js"; +import {onBlobSidecarsByRoot} from "./blobSidecarsByRoot.js"; import {onLightClientBootstrap} from "./lightClientBootstrap.js"; import {onLightClientFinalityUpdate} from "./lightClientFinalityUpdate.js"; import {onLightClientOptimisticUpdate} from "./lightClientOptimisticUpdate.js"; diff --git a/packages/beacon-node/src/network/reqresp/handlers/lightClientBootstrap.ts b/packages/beacon-node/src/network/reqresp/handlers/lightClientBootstrap.ts index 3b50304eb50c..ae5b5abf1f80 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/lightClientBootstrap.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/lightClientBootstrap.ts @@ -1,14 +1,14 @@ import { - RespStatus, - ResponseError, LightClientServerError, LightClientServerErrorCode, + RespStatus, + ResponseError, ResponseOutgoing, } from "@lodestar/reqresp"; import {Root} from "@lodestar/types"; import {IBeaconChain} from "../../../chain/index.js"; -import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {assertLightClientServer} from "../../../node/utils/lightclient.js"; +import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; export async function* onLightClientBootstrap(requestBody: Root, chain: IBeaconChain): AsyncIterable { assertLightClientServer(chain.lightClientServer); diff --git a/packages/beacon-node/src/network/reqresp/handlers/lightClientFinalityUpdate.ts b/packages/beacon-node/src/network/reqresp/handlers/lightClientFinalityUpdate.ts index 4764c6f198f7..26eec4585d79 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/lightClientFinalityUpdate.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/lightClientFinalityUpdate.ts @@ -1,7 +1,7 @@ -import {ResponseOutgoing, RespStatus, ResponseError} from "@lodestar/reqresp"; +import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; import {IBeaconChain} from "../../../chain/index.js"; -import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {assertLightClientServer} from "../../../node/utils/lightclient.js"; +import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; export async function* onLightClientFinalityUpdate(chain: IBeaconChain): AsyncIterable { assertLightClientServer(chain.lightClientServer); diff --git a/packages/beacon-node/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts b/packages/beacon-node/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts index 4c030a8e4174..e8cdb73ee05a 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts @@ -1,7 +1,7 @@ -import {ResponseOutgoing, ResponseError, RespStatus} from "@lodestar/reqresp"; +import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; import {IBeaconChain} from "../../../chain/index.js"; -import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {assertLightClientServer} from "../../../node/utils/lightclient.js"; +import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; export async function* onLightClientOptimisticUpdate(chain: IBeaconChain): AsyncIterable { assertLightClientServer(chain.lightClientServer); diff --git a/packages/beacon-node/src/network/reqresp/handlers/lightClientUpdatesByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/lightClientUpdatesByRange.ts index 89466eca6c21..53b701d448cd 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/lightClientUpdatesByRange.ts @@ -1,15 +1,15 @@ -import {altair} from "@lodestar/types"; import {MAX_REQUEST_LIGHT_CLIENT_UPDATES} from "@lodestar/params"; import { - ResponseOutgoing, LightClientServerError, LightClientServerErrorCode, - ResponseError, RespStatus, + ResponseError, + ResponseOutgoing, } from "@lodestar/reqresp"; +import {altair} from "@lodestar/types"; import {IBeaconChain} from "../../../chain/index.js"; -import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {assertLightClientServer} from "../../../node/utils/lightclient.js"; +import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; export async function* onLightClientUpdatesByRange( requestBody: altair.LightClientUpdatesByRange, diff --git a/packages/beacon-node/src/network/reqresp/handlers/status.ts b/packages/beacon-node/src/network/reqresp/handlers/status.ts index e46c1a268b06..22c342177334 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/status.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/status.ts @@ -1,6 +1,6 @@ +import {ForkName} from "@lodestar/params"; import {ResponseOutgoing} from "@lodestar/reqresp"; import {ssz} from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; import {IBeaconChain} from "../../../chain/index.js"; export async function* onStatus(chain: IBeaconChain): AsyncIterable { diff --git a/packages/beacon-node/src/network/reqresp/protocols.ts b/packages/beacon-node/src/network/reqresp/protocols.ts index e63df4b1341b..b6b9c6c48967 100644 --- a/packages/beacon-node/src/network/reqresp/protocols.ts +++ b/packages/beacon-node/src/network/reqresp/protocols.ts @@ -1,7 +1,7 @@ -import {ContextBytesFactory, ContextBytesType, Encoding} from "@lodestar/reqresp"; import {ForkDigestContext} from "@lodestar/config"; -import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js"; +import {ContextBytesFactory, ContextBytesType, Encoding} from "@lodestar/reqresp"; import {rateLimitQuotas} from "./rateLimit.js"; +import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js"; export const Goodbye = toProtocol({ method: ReqRespMethod.Goodbye, diff --git a/packages/beacon-node/src/network/reqresp/rateLimit.ts b/packages/beacon-node/src/network/reqresp/rateLimit.ts index b6dacd6ba8e5..5830b48d2eab 100644 --- a/packages/beacon-node/src/network/reqresp/rateLimit.ts +++ b/packages/beacon-node/src/network/reqresp/rateLimit.ts @@ -1,8 +1,8 @@ import { - MAX_REQUEST_BLOCKS, - MAX_REQUEST_LIGHT_CLIENT_UPDATES, MAX_BLOBS_PER_BLOCK, MAX_REQUEST_BLOB_SIDECARS, + MAX_REQUEST_BLOCKS, + MAX_REQUEST_LIGHT_CLIENT_UPDATES, } from "@lodestar/params"; import {InboundRateLimitQuota} from "@lodestar/reqresp"; import {ReqRespMethod, RequestBodyByMethod} from "./types.js"; diff --git a/packages/beacon-node/src/network/reqresp/utils/collect.ts b/packages/beacon-node/src/network/reqresp/utils/collect.ts index 9818b1921f8e..f79ea2abba07 100644 --- a/packages/beacon-node/src/network/reqresp/utils/collect.ts +++ b/packages/beacon-node/src/network/reqresp/utils/collect.ts @@ -1,5 +1,5 @@ import {Type} from "@chainsafe/ssz"; -import {ResponseIncoming, RequestErrorCode, RequestError} from "@lodestar/reqresp"; +import {RequestError, RequestErrorCode, ResponseIncoming} from "@lodestar/reqresp"; import {WithBytes} from "@lodestar/types"; import {ResponseTypeGetter} from "../types.js"; diff --git a/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts b/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts index 2709cb3f64a9..2e2bcf772d76 100644 --- a/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +++ b/packages/beacon-node/src/network/reqresp/utils/collectSequentialBlocksInRange.ts @@ -1,6 +1,6 @@ import {ResponseIncoming} from "@lodestar/reqresp"; +import {SignedBeaconBlock, WithBytes, phase0} from "@lodestar/types"; import {LodestarError} from "@lodestar/utils"; -import {phase0, SignedBeaconBlock, WithBytes} from "@lodestar/types"; import {ReqRespMethod, responseSszTypeByMethod} from "../types.js"; import {sszDeserializeResponse} from "./collect.js"; diff --git a/packages/beacon-node/src/network/subnets/attnetsService.ts b/packages/beacon-node/src/network/subnets/attnetsService.ts index 5044bac059cd..ed2f94bd56d8 100644 --- a/packages/beacon-node/src/network/subnets/attnetsService.ts +++ b/packages/beacon-node/src/network/subnets/attnetsService.ts @@ -1,3 +1,4 @@ +import {BeaconConfig} from "@lodestar/config"; import { ATTESTATION_SUBNET_COUNT, EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION, @@ -6,16 +7,15 @@ import { } from "@lodestar/params"; import {Epoch, Slot, ssz} from "@lodestar/types"; import {Logger, MapDef} from "@lodestar/utils"; -import {BeaconConfig} from "@lodestar/config"; import {ClockEvent, IClock} from "../../util/clock.js"; -import {GossipType} from "../gossip/index.js"; -import {MetadataController} from "../metadata.js"; -import {SubnetMap, RequestedSubnet} from "../peers/utils/index.js"; -import {getActiveForks} from "../forks.js"; import {NetworkCoreMetrics} from "../core/metrics.js"; -import {stringifyGossipTopic} from "../gossip/topic.js"; +import {getActiveForks} from "../forks.js"; +import {GossipType} from "../gossip/index.js"; import {GOSSIP_D_LOW} from "../gossip/scoringParameters.js"; -import {IAttnetsService, CommitteeSubscription, SubnetsServiceOpts, GossipSubscriber, NodeId} from "./interface.js"; +import {stringifyGossipTopic} from "../gossip/topic.js"; +import {MetadataController} from "../metadata.js"; +import {RequestedSubnet, SubnetMap} from "../peers/utils/index.js"; +import {CommitteeSubscription, GossipSubscriber, IAttnetsService, NodeId, SubnetsServiceOpts} from "./interface.js"; import {computeSubscribedSubnet} from "./util.js"; const gossipType = GossipType.beacon_attestation; diff --git a/packages/beacon-node/src/network/subnets/interface.ts b/packages/beacon-node/src/network/subnets/interface.ts index 1d036bf9831d..e3b1e2513818 100644 --- a/packages/beacon-node/src/network/subnets/interface.ts +++ b/packages/beacon-node/src/network/subnets/interface.ts @@ -1,7 +1,7 @@ import {ForkName} from "@lodestar/params"; import {Bytes32, Slot, ValidatorIndex} from "@lodestar/types"; -import {RequestedSubnet} from "../peers/utils/index.js"; import {GossipTopic} from "../gossip/interface.js"; +import {RequestedSubnet} from "../peers/utils/index.js"; /** Generic CommitteeSubscription for both beacon attnets subs and syncnets subs */ export type CommitteeSubscription = { diff --git a/packages/beacon-node/src/network/subnets/syncnetsService.ts b/packages/beacon-node/src/network/subnets/syncnetsService.ts index c61b1060899a..8dee6243b39f 100644 --- a/packages/beacon-node/src/network/subnets/syncnetsService.ts +++ b/packages/beacon-node/src/network/subnets/syncnetsService.ts @@ -1,14 +1,14 @@ -import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; import {ForkName, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {Epoch, ssz} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; import {ClockEvent, IClock} from "../../util/clock.js"; +import {NetworkCoreMetrics} from "../core/metrics.js"; import {getActiveForks} from "../forks.js"; import {GossipType} from "../gossip/index.js"; import {MetadataController} from "../metadata.js"; import {RequestedSubnet, SubnetMap} from "../peers/utils/index.js"; -import {NetworkCoreMetrics} from "../core/metrics.js"; import {CommitteeSubscription, GossipSubscriber, SubnetsService, SubnetsServiceOpts} from "./interface.js"; const gossipType = GossipType.sync_committee; diff --git a/packages/beacon-node/src/node/nodejs.ts b/packages/beacon-node/src/node/nodejs.ts index 701ab0fde070..ec3a0ef66a5a 100644 --- a/packages/beacon-node/src/node/nodejs.ts +++ b/packages/beacon-node/src/node/nodejs.ts @@ -2,28 +2,28 @@ import {setMaxListeners} from "node:events"; import {Registry} from "prom-client"; import {PeerId} from "@libp2p/interface"; +import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {BeaconConfig} from "@lodestar/config"; -import {phase0} from "@lodestar/types"; -import {sleep} from "@lodestar/utils"; import type {LoggerNode} from "@lodestar/logger/node"; -import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {phase0} from "@lodestar/types"; +import {sleep} from "@lodestar/utils"; import {ProcessShutdownCallback} from "@lodestar/validator"; +import {BeaconRestApiServer, getApi} from "../api/index.js"; +import {HistoricalStateRegen} from "../chain/historicalState/index.js"; +import {BeaconChain, IBeaconChain, initBeaconMetrics} from "../chain/index.js"; import {IBeaconDb} from "../db/index.js"; +import {initializeEth1ForBlockProduction} from "../eth1/index.js"; +import {initializeExecutionBuilder, initializeExecutionEngine} from "../execution/index.js"; +import {HttpMetricsServer, Metrics, createMetrics, getHttpMetricsServer} from "../metrics/index.js"; +import {MonitoringService} from "../monitoring/index.js"; import {Network, getReqRespHandlers} from "../network/index.js"; -import {BeaconSync, IBeaconSync} from "../sync/index.js"; import {BackfillSync} from "../sync/backfill/index.js"; -import {BeaconChain, IBeaconChain, initBeaconMetrics} from "../chain/index.js"; -import {createMetrics, Metrics, HttpMetricsServer, getHttpMetricsServer} from "../metrics/index.js"; -import {MonitoringService} from "../monitoring/index.js"; -import {getApi, BeaconRestApiServer} from "../api/index.js"; -import {initializeExecutionEngine, initializeExecutionBuilder} from "../execution/index.js"; -import {initializeEth1ForBlockProduction} from "../eth1/index.js"; -import {initCKZG, loadEthereumTrustedSetup, TrustedFileMode} from "../util/kzg.js"; -import {HistoricalStateRegen} from "../chain/historicalState/index.js"; -import {IBeaconNodeOptions} from "./options.js"; +import {BeaconSync, IBeaconSync} from "../sync/index.js"; +import {TrustedFileMode, initCKZG, loadEthereumTrustedSetup} from "../util/kzg.js"; import {runNodeNotifier} from "./notifier.js"; +import {IBeaconNodeOptions} from "./options.js"; export * from "./options.js"; diff --git a/packages/beacon-node/src/node/notifier.ts b/packages/beacon-node/src/node/notifier.ts index 20a359a45c49..c0d9354197ae 100644 --- a/packages/beacon-node/src/node/notifier.ts +++ b/packages/beacon-node/src/node/notifier.ts @@ -1,12 +1,12 @@ import {BeaconConfig} from "@lodestar/config"; -import {Epoch} from "@lodestar/types"; -import {CachedBeaconStateAllForks, computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {ProtoBlock, ExecutionStatus} from "@lodestar/fork-choice"; -import {ErrorAborted, Logger, sleep, prettyBytes, prettyBytesShort} from "@lodestar/utils"; +import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {CachedBeaconStateAllForks, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {computeEpochAtSlot, isExecutionCachedStateType, isMergeTransitionComplete} from "@lodestar/state-transition"; -import {ExecutionEngineState} from "../execution/index.js"; +import {Epoch} from "@lodestar/types"; +import {ErrorAborted, Logger, prettyBytes, prettyBytesShort, sleep} from "@lodestar/utils"; import {IBeaconChain} from "../chain/index.js"; +import {ExecutionEngineState} from "../execution/index.js"; import {INetwork} from "../network/index.js"; import {IBeaconSync, SyncState} from "../sync/index.js"; import {prettyTimeDiffSec} from "../util/time.js"; diff --git a/packages/beacon-node/src/node/options.ts b/packages/beacon-node/src/node/options.ts index e587e58ec127..1a440bfd4981 100644 --- a/packages/beacon-node/src/node/options.ts +++ b/packages/beacon-node/src/node/options.ts @@ -1,19 +1,19 @@ -import {defaultApiOptions, ApiOptions} from "../api/options.js"; -import {defaultChainOptions, IChainOptions, StateArchiveMode, DEFAULT_STATE_ARCHIVE_MODE} from "../chain/options.js"; -import {defaultDbOptions, DatabaseOptions} from "../db/options.js"; -import {defaultEth1Options, Eth1Options} from "../eth1/options.js"; -import {defaultMetricsOptions, MetricsOptions} from "../metrics/options.js"; -import {defaultMonitoringOptions, MonitoringOptions} from "../monitoring/options.js"; -import {defaultNetworkOptions, NetworkOptions} from "../network/options.js"; -import {defaultSyncOptions, SyncOptions} from "../sync/options.js"; +import {ApiOptions, defaultApiOptions} from "../api/options.js"; +import {DEFAULT_STATE_ARCHIVE_MODE, IChainOptions, StateArchiveMode, defaultChainOptions} from "../chain/options.js"; +import {DatabaseOptions, defaultDbOptions} from "../db/options.js"; +import {Eth1Options, defaultEth1Options} from "../eth1/options.js"; import { - defaultExecutionEngineOpts, - defaultExecutionEngineHttpOpts, - ExecutionEngineOpts, ExecutionBuilderOpts, - defaultExecutionBuilderOpts, + ExecutionEngineOpts, defaultExecutionBuilderHttpOpts, + defaultExecutionBuilderOpts, + defaultExecutionEngineHttpOpts, + defaultExecutionEngineOpts, } from "../execution/index.js"; +import {MetricsOptions, defaultMetricsOptions} from "../metrics/options.js"; +import {MonitoringOptions, defaultMonitoringOptions} from "../monitoring/options.js"; +import {NetworkOptions, defaultNetworkOptions} from "../network/options.js"; +import {SyncOptions, defaultSyncOptions} from "../sync/options.js"; // Re-export so the CLI doesn't need to depend on lodestar-api export {allNamespaces} from "../api/rest/index.js"; diff --git a/packages/beacon-node/src/node/utils/interop/deposits.ts b/packages/beacon-node/src/node/utils/interop/deposits.ts index 6cce7e883b84..21f78a6ec2be 100644 --- a/packages/beacon-node/src/node/utils/interop/deposits.ts +++ b/packages/beacon-node/src/node/utils/interop/deposits.ts @@ -1,14 +1,14 @@ import {digest} from "@chainsafe/as-sha256"; -import {toGindex, Tree} from "@chainsafe/persistent-merkle-tree"; -import {phase0, ssz} from "@lodestar/types"; +import {Tree, toGindex} from "@chainsafe/persistent-merkle-tree"; import {ChainConfig} from "@lodestar/config"; -import {computeDomain, computeSigningRoot, interopSecretKeys, ZERO_HASH} from "@lodestar/state-transition"; import { BLS_WITHDRAWAL_PREFIX, - ETH1_ADDRESS_WITHDRAWAL_PREFIX, DOMAIN_DEPOSIT, + ETH1_ADDRESS_WITHDRAWAL_PREFIX, MAX_EFFECTIVE_BALANCE, } from "@lodestar/params"; +import {ZERO_HASH, computeDomain, computeSigningRoot, interopSecretKeys} from "@lodestar/state-transition"; +import {phase0, ssz} from "@lodestar/types"; import {DepositTree} from "../../../db/repositories/depositDataRoot.js"; /** diff --git a/packages/beacon-node/src/node/utils/interop/state.ts b/packages/beacon-node/src/node/utils/interop/state.ts index fe26afef2013..ef88fb956e05 100644 --- a/packages/beacon-node/src/node/utils/interop/state.ts +++ b/packages/beacon-node/src/node/utils/interop/state.ts @@ -1,8 +1,8 @@ -import {Bytes32, phase0, ssz, sszTypesFor, TimeSeconds} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {ForkName, GENESIS_SLOT} from "@lodestar/params"; import {BeaconStateAllForks, initializeBeaconStateFromEth1} from "@lodestar/state-transition"; import {createEmptyEpochCacheImmutableData} from "@lodestar/state-transition"; -import {ForkName, GENESIS_SLOT} from "@lodestar/params"; +import {Bytes32, TimeSeconds, phase0, ssz, sszTypesFor} from "@lodestar/types"; import {DepositTree} from "../../../db/repositories/depositDataRoot.js"; diff --git a/packages/beacon-node/src/node/utils/state.ts b/packages/beacon-node/src/node/utils/state.ts index 05da7042eef4..ac0ff8101fb6 100644 --- a/packages/beacon-node/src/node/utils/state.ts +++ b/packages/beacon-node/src/node/utils/state.ts @@ -3,7 +3,7 @@ import {BeaconStateAllForks} from "@lodestar/state-transition"; import {phase0, ssz} from "@lodestar/types"; import {IBeaconDb} from "../../db/index.js"; import {interopDeposits} from "./interop/deposits.js"; -import {getInteropState, InteropStateOpts} from "./interop/state.js"; +import {InteropStateOpts, getInteropState} from "./interop/state.js"; /** * Builds state for `dev` command, for sim testing and some other tests diff --git a/packages/beacon-node/src/sync/backfill/backfill.ts b/packages/beacon-node/src/sync/backfill/backfill.ts index 9612cf23b615..4fedb9d1fd5b 100644 --- a/packages/beacon-node/src/sync/backfill/backfill.ts +++ b/packages/beacon-node/src/sync/backfill/backfill.ts @@ -1,22 +1,22 @@ import {EventEmitter} from "node:events"; -import {StrictEventEmitter} from "strict-event-emitter-types"; -import {BeaconStateAllForks, blockToHeader, computeAnchorCheckpoint} from "@lodestar/state-transition"; import {BeaconConfig, ChainForkConfig} from "@lodestar/config"; -import {phase0, Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types"; +import {BeaconStateAllForks, blockToHeader, computeAnchorCheckpoint} from "@lodestar/state-transition"; +import {Root, SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types"; import {ErrorAborted, Logger, sleep, toRootHex} from "@lodestar/utils"; +import {StrictEventEmitter} from "strict-event-emitter-types"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {IBeaconChain} from "../../chain/index.js"; import {GENESIS_SLOT, ZERO_HASH} from "../../constants/index.js"; import {IBeaconDb} from "../../db/index.js"; +import {Metrics} from "../../metrics/metrics.js"; import {INetwork, NetworkEvent, NetworkEventData, PeerAction} from "../../network/index.js"; +import {byteArrayEquals} from "../../util/bytes.js"; import {ItTrigger} from "../../util/itTrigger.js"; import {PeerIdStr} from "../../util/peerId.js"; import {shuffleOne} from "../../util/shuffle.js"; -import {Metrics} from "../../metrics/metrics.js"; -import {byteArrayEquals} from "../../util/bytes.js"; -import {verifyBlockProposerSignature, verifyBlockSequence, BackfillBlockHeader, BackfillBlock} from "./verify.js"; import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js"; +import {BackfillBlock, BackfillBlockHeader, verifyBlockProposerSignature, verifyBlockSequence} from "./verify.js"; /** * Timeout in ms to take a break from reading a backfillBatchSize from db, as just yielding * to sync loop gives hardly any. diff --git a/packages/beacon-node/src/sync/backfill/errors.ts b/packages/beacon-node/src/sync/backfill/errors.ts index e62c90407ed5..530507f99f36 100644 --- a/packages/beacon-node/src/sync/backfill/errors.ts +++ b/packages/beacon-node/src/sync/backfill/errors.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface"; -import {LodestarError} from "@lodestar/utils"; import {Root} from "@lodestar/types"; +import {LodestarError} from "@lodestar/utils"; export enum BackfillSyncErrorCode { /** fetched block doesn't connect to anchor block */ diff --git a/packages/beacon-node/src/sync/backfill/verify.ts b/packages/beacon-node/src/sync/backfill/verify.ts index 715cc6621253..9150e17b3e8c 100644 --- a/packages/beacon-node/src/sync/backfill/verify.ts +++ b/packages/beacon-node/src/sync/backfill/verify.ts @@ -1,7 +1,7 @@ -import {CachedBeaconStateAllForks, ISignatureSet, getBlockProposerSignatureSet} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; -import {Root, ssz, Slot, SignedBeaconBlock, WithBytes} from "@lodestar/types"; import {GENESIS_SLOT} from "@lodestar/params"; +import {CachedBeaconStateAllForks, ISignatureSet, getBlockProposerSignatureSet} from "@lodestar/state-transition"; +import {Root, SignedBeaconBlock, Slot, WithBytes, ssz} from "@lodestar/types"; import {IBlsVerifier} from "../../chain/bls/index.js"; import {BackfillSyncError, BackfillSyncErrorCode} from "./errors.js"; diff --git a/packages/beacon-node/src/sync/interface.ts b/packages/beacon-node/src/sync/interface.ts index c1e83cb476fb..88d7138656f3 100644 --- a/packages/beacon-node/src/sync/interface.ts +++ b/packages/beacon-node/src/sync/interface.ts @@ -1,12 +1,12 @@ -import {Logger} from "@lodestar/utils"; -import {RootHex, Slot, phase0} from "@lodestar/types"; -import {BeaconConfig} from "@lodestar/config"; import {routes} from "@lodestar/api"; +import {BeaconConfig} from "@lodestar/config"; +import {RootHex, Slot, phase0} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {BlockInput, BlockInputType, NullBlockInput} from "../chain/blocks/types.js"; -import {INetwork} from "../network/index.js"; import {IBeaconChain} from "../chain/index.js"; -import {Metrics} from "../metrics/index.js"; import {IBeaconDb} from "../db/index.js"; +import {Metrics} from "../metrics/index.js"; +import {INetwork} from "../network/index.js"; import {SyncChainDebugState} from "./range/chain.js"; export type {SyncChainDebugState}; diff --git a/packages/beacon-node/src/sync/range/batch.ts b/packages/beacon-node/src/sync/range/batch.ts index e3e81bc57143..a78febbc5c7f 100644 --- a/packages/beacon-node/src/sync/range/batch.ts +++ b/packages/beacon-node/src/sync/range/batch.ts @@ -1,10 +1,10 @@ -import {Epoch, phase0, RootHex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {Epoch, RootHex, phase0} from "@lodestar/types"; import {LodestarError} from "@lodestar/utils"; -import {MAX_BATCH_DOWNLOAD_ATTEMPTS, MAX_BATCH_PROCESSING_ATTEMPTS} from "../constants.js"; -import {PeerIdStr} from "../../util/peerId.js"; import {BlockInput} from "../../chain/blocks/types.js"; import {BlockError, BlockErrorCode} from "../../chain/errors/index.js"; +import {PeerIdStr} from "../../util/peerId.js"; +import {MAX_BATCH_DOWNLOAD_ATTEMPTS, MAX_BATCH_PROCESSING_ATTEMPTS} from "../constants.js"; import {getBatchSlotRange, hashBlocks} from "./utils/index.js"; /** diff --git a/packages/beacon-node/src/sync/range/chain.ts b/packages/beacon-node/src/sync/range/chain.ts index 0a2fc1a3f7c3..2a8d76d99785 100644 --- a/packages/beacon-node/src/sync/range/chain.ts +++ b/packages/beacon-node/src/sync/range/chain.ts @@ -1,24 +1,24 @@ +import {ChainForkConfig} from "@lodestar/config"; import {Epoch, Root, Slot, phase0} from "@lodestar/types"; import {ErrorAborted, Logger, toRootHex} from "@lodestar/utils"; -import {ChainForkConfig} from "@lodestar/config"; import {BlockInput, BlockInputType} from "../../chain/blocks/types.js"; import {PeerAction} from "../../network/index.js"; import {ItTrigger} from "../../util/itTrigger.js"; import {PeerIdStr} from "../../util/peerId.js"; import {wrapError} from "../../util/wrapError.js"; -import {RangeSyncType} from "../utils/remoteSyncType.js"; import {BATCH_BUFFER_SIZE, EPOCHS_PER_BATCH} from "../constants.js"; +import {RangeSyncType} from "../utils/remoteSyncType.js"; import {Batch, BatchError, BatchErrorCode, BatchMetadata, BatchStatus} from "./batch.js"; import { - validateBatchesStatus, - getNextBatchToProcess, - toBeDownloadedStartEpoch, - toArr, ChainPeersBalancer, - computeMostCommonTarget, batchStartEpochIsAfterSlot, - isSyncChainDone, + computeMostCommonTarget, getBatchSlotRange, + getNextBatchToProcess, + isSyncChainDone, + toArr, + toBeDownloadedStartEpoch, + validateBatchesStatus, } from "./utils/index.js"; export type SyncChainModules = { diff --git a/packages/beacon-node/src/sync/range/range.ts b/packages/beacon-node/src/sync/range/range.ts index 51e3a5d0f182..8284abd09955 100644 --- a/packages/beacon-node/src/sync/range/range.ts +++ b/packages/beacon-node/src/sync/range/range.ts @@ -1,18 +1,18 @@ import {EventEmitter} from "node:events"; -import {StrictEventEmitter} from "strict-event-emitter-types"; -import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {BeaconConfig} from "@lodestar/config"; +import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {Epoch, phase0} from "@lodestar/types"; import {Logger, toRootHex} from "@lodestar/utils"; +import {StrictEventEmitter} from "strict-event-emitter-types"; +import {AttestationImportOpt, ImportBlockOpts} from "../../chain/blocks/index.js"; import {IBeaconChain} from "../../chain/index.js"; -import {INetwork} from "../../network/index.js"; import {Metrics} from "../../metrics/index.js"; -import {RangeSyncType, rangeSyncTypes, getRangeSyncTarget} from "../utils/remoteSyncType.js"; -import {PeerIdStr} from "../../util/peerId.js"; -import {ImportBlockOpts, AttestationImportOpt} from "../../chain/blocks/index.js"; +import {INetwork} from "../../network/index.js"; import {beaconBlocksMaybeBlobsByRange} from "../../network/reqresp/beaconBlocksMaybeBlobsByRange.js"; +import {PeerIdStr} from "../../util/peerId.js"; +import {RangeSyncType, getRangeSyncTarget, rangeSyncTypes} from "../utils/remoteSyncType.js"; +import {ChainTarget, SyncChain, SyncChainDebugState, SyncChainFns} from "./chain.js"; import {updateChains} from "./utils/index.js"; -import {ChainTarget, SyncChainFns, SyncChain, SyncChainDebugState} from "./chain.js"; export enum RangeSyncEvent { completedChain = "RangeSync-completedChain", diff --git a/packages/beacon-node/src/sync/range/utils/hashBlocks.ts b/packages/beacon-node/src/sync/range/utils/hashBlocks.ts index 986d023d9ca1..9d983fc7278e 100644 --- a/packages/beacon-node/src/sync/range/utils/hashBlocks.ts +++ b/packages/beacon-node/src/sync/range/utils/hashBlocks.ts @@ -1,5 +1,5 @@ -import {RootHex} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {BlockInput} from "../../../chain/blocks/types.js"; diff --git a/packages/beacon-node/src/sync/sync.ts b/packages/beacon-node/src/sync/sync.ts index 94eea73e1ef8..1a4121f4b9f1 100644 --- a/packages/beacon-node/src/sync/sync.ts +++ b/packages/beacon-node/src/sync/sync.ts @@ -1,20 +1,20 @@ -import {Logger} from "@lodestar/utils"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {Slot} from "@lodestar/types"; -import {INetwork, NetworkEvent, NetworkEventData} from "../network/index.js"; -import {isOptimisticBlock} from "../util/forkChoice.js"; -import {Metrics} from "../metrics/index.js"; +import {Logger} from "@lodestar/utils"; import {IBeaconChain} from "../chain/index.js"; -import {ClockEvent} from "../util/clock.js"; import {GENESIS_SLOT} from "../constants/constants.js"; import {ExecutionEngineState} from "../execution/index.js"; -import {IBeaconSync, SyncModules, SyncingStatus} from "./interface.js"; -import {RangeSync, RangeSyncStatus, RangeSyncEvent} from "./range/range.js"; -import {getPeerSyncType, PeerSyncType, peerSyncTypes} from "./utils/remoteSyncType.js"; +import {Metrics} from "../metrics/index.js"; +import {INetwork, NetworkEvent, NetworkEventData} from "../network/index.js"; +import {ClockEvent} from "../util/clock.js"; +import {isOptimisticBlock} from "../util/forkChoice.js"; import {MIN_EPOCH_TO_START_GOSSIP} from "./constants.js"; -import {SyncState, SyncChainDebugState, syncStateMetric} from "./interface.js"; +import {IBeaconSync, SyncModules, SyncingStatus} from "./interface.js"; +import {SyncChainDebugState, SyncState, syncStateMetric} from "./interface.js"; import {SyncOptions} from "./options.js"; +import {RangeSync, RangeSyncEvent, RangeSyncStatus} from "./range/range.js"; import {UnknownBlockSync} from "./unknownBlock.js"; +import {PeerSyncType, getPeerSyncType, peerSyncTypes} from "./utils/remoteSyncType.js"; export class BeaconSync implements IBeaconSync { private readonly logger: Logger; diff --git a/packages/beacon-node/src/sync/unknownBlock.ts b/packages/beacon-node/src/sync/unknownBlock.ts index 003b035a898d..c9652dc6ecd2 100644 --- a/packages/beacon-node/src/sync/unknownBlock.ts +++ b/packages/beacon-node/src/sync/unknownBlock.ts @@ -1,24 +1,24 @@ import {ChainForkConfig} from "@lodestar/config"; -import {Logger, fromHex, pruneSetToMax, toRootHex} from "@lodestar/utils"; -import {Root, RootHex, deneb} from "@lodestar/types"; import {INTERVALS_PER_SLOT} from "@lodestar/params"; +import {Root, RootHex, deneb} from "@lodestar/types"; +import {Logger, fromHex, pruneSetToMax, toRootHex} from "@lodestar/utils"; import {sleep} from "@lodestar/utils"; -import {INetwork, NetworkEvent, NetworkEventData, PeerAction} from "../network/index.js"; -import {PeerIdStr} from "../util/peerId.js"; -import {IBeaconChain} from "../chain/index.js"; import {BlockInput, BlockInputType, NullBlockInput} from "../chain/blocks/types.js"; -import {Metrics} from "../metrics/index.js"; -import {shuffle} from "../util/shuffle.js"; -import {byteArrayEquals} from "../util/bytes.js"; import {BlockError, BlockErrorCode} from "../chain/errors/index.js"; +import {IBeaconChain} from "../chain/index.js"; +import {Metrics} from "../metrics/index.js"; +import {INetwork, NetworkEvent, NetworkEventData, PeerAction} from "../network/index.js"; import { beaconBlocksMaybeBlobsByRoot, unavailableBeaconBlobsByRoot, } from "../network/reqresp/beaconBlocksMaybeBlobsByRoot.js"; +import {byteArrayEquals} from "../util/bytes.js"; +import {PeerIdStr} from "../util/peerId.js"; +import {shuffle} from "../util/shuffle.js"; import {Result, wrapError} from "../util/wrapError.js"; import {PendingBlock, PendingBlockStatus, PendingBlockType} from "./interface.js"; -import {getDescendantBlocks, getAllDescendantBlocks, getUnknownAndAncestorBlocks} from "./utils/pendingBlocksTree.js"; import {SyncOptions} from "./options.js"; +import {getAllDescendantBlocks, getDescendantBlocks, getUnknownAndAncestorBlocks} from "./utils/pendingBlocksTree.js"; const MAX_ATTEMPTS_PER_BLOCK = 5; const MAX_KNOWN_BAD_BLOCKS = 500; diff --git a/packages/beacon-node/src/sync/utils/pendingBlocksTree.ts b/packages/beacon-node/src/sync/utils/pendingBlocksTree.ts index 0feb15862408..deefba91f366 100644 --- a/packages/beacon-node/src/sync/utils/pendingBlocksTree.ts +++ b/packages/beacon-node/src/sync/utils/pendingBlocksTree.ts @@ -1,5 +1,6 @@ import {RootHex} from "@lodestar/types"; import {MapDef} from "@lodestar/utils"; +import {BlockInputType} from "../../chain/blocks/types.js"; import { DownloadedBlock, PendingBlock, @@ -7,7 +8,6 @@ import { UnknownAndAncestorBlocks, UnknownBlock, } from "../interface.js"; -import {BlockInputType} from "../../chain/blocks/types.js"; export function getAllDescendantBlocks(blockRootHex: RootHex, blocks: Map): PendingBlock[] { // Do one pass over all blocks to index by parent diff --git a/packages/beacon-node/src/sync/utils/remoteSyncType.ts b/packages/beacon-node/src/sync/utils/remoteSyncType.ts index 247269ab409a..16f1481a2a83 100644 --- a/packages/beacon-node/src/sync/utils/remoteSyncType.ts +++ b/packages/beacon-node/src/sync/utils/remoteSyncType.ts @@ -1,6 +1,6 @@ import {IForkChoice} from "@lodestar/fork-choice"; import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {phase0, Slot} from "@lodestar/types"; +import {Slot, phase0} from "@lodestar/types"; import {ChainTarget} from "../range/utils/index.js"; /** The type of peer relative to our current state */ diff --git a/packages/beacon-node/src/util/blobs.ts b/packages/beacon-node/src/util/blobs.ts index fcc31092464f..56f1ab21aae9 100644 --- a/packages/beacon-node/src/util/blobs.ts +++ b/packages/beacon-node/src/util/blobs.ts @@ -1,9 +1,9 @@ import {digest as sha256Digest} from "@chainsafe/as-sha256"; import {Tree} from "@chainsafe/persistent-merkle-tree"; -import {VERSIONED_HASH_VERSION_KZG, KZG_COMMITMENT_GINDEX0, ForkName, ForkAll} from "@lodestar/params"; -import {deneb, ssz, BeaconBlockBody, SignedBeaconBlock, SSZTypesFor} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {ForkAll, ForkName, KZG_COMMITMENT_GINDEX0, VERSIONED_HASH_VERSION_KZG} from "@lodestar/params"; import {signedBlockToSignedHeader} from "@lodestar/state-transition"; +import {BeaconBlockBody, SSZTypesFor, SignedBeaconBlock, deneb, ssz} from "@lodestar/types"; type VersionHash = Uint8Array; diff --git a/packages/beacon-node/src/util/clock.ts b/packages/beacon-node/src/util/clock.ts index 197d17f38281..36eb6f6f7f2c 100644 --- a/packages/beacon-node/src/util/clock.ts +++ b/packages/beacon-node/src/util/clock.ts @@ -1,9 +1,9 @@ import EventEmitter from "node:events"; -import type {StrictEventEmitter} from "strict-event-emitter-types"; -import type {Epoch, Slot} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; -import {ErrorAborted} from "@lodestar/utils"; import {computeEpochAtSlot, computeTimeAtSlot, getCurrentSlot} from "@lodestar/state-transition"; +import type {Epoch, Slot} from "@lodestar/types"; +import {ErrorAborted} from "@lodestar/utils"; +import type {StrictEventEmitter} from "strict-event-emitter-types"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../constants/constants.js"; export enum ClockEvent { diff --git a/packages/beacon-node/src/util/kzg.ts b/packages/beacon-node/src/util/kzg.ts index 42224d1ebaa6..36a7d19f8d2b 100644 --- a/packages/beacon-node/src/util/kzg.ts +++ b/packages/beacon-node/src/util/kzg.ts @@ -1,5 +1,5 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import {fileURLToPath} from "node:url"; import {fromHex, toHex} from "@lodestar/utils"; diff --git a/packages/beacon-node/src/util/multifork.ts b/packages/beacon-node/src/util/multifork.ts index 0a00677afadf..952498c5a4d1 100644 --- a/packages/beacon-node/src/util/multifork.ts +++ b/packages/beacon-node/src/util/multifork.ts @@ -1,7 +1,7 @@ import {ChainForkConfig} from "@lodestar/config"; +import {ForkAll, ForkLightClient} from "@lodestar/params"; import {SSZTypesFor, Slot} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; -import {ForkAll, ForkLightClient} from "@lodestar/params"; import {getSlotFromSignedBeaconBlockSerialized} from "./sszBytes.js"; /** diff --git a/packages/beacon-node/src/util/peerId.ts b/packages/beacon-node/src/util/peerId.ts index 2afb9bed390e..6fee7db855da 100644 --- a/packages/beacon-node/src/util/peerId.ts +++ b/packages/beacon-node/src/util/peerId.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface"; -import {base58btc} from "multiformats/bases/base58"; import {peerIdFromString} from "@libp2p/peer-id"; +import {base58btc} from "multiformats/bases/base58"; // Ensure consistent serialization of PeerId to string diff --git a/packages/beacon-node/src/util/queue/fnQueue.ts b/packages/beacon-node/src/util/queue/fnQueue.ts index 80e179f8e8f3..1e4f68b7b9b6 100644 --- a/packages/beacon-node/src/util/queue/fnQueue.ts +++ b/packages/beacon-node/src/util/queue/fnQueue.ts @@ -1,5 +1,5 @@ import {JobItemQueue} from "./itemQueue.js"; -import {QueueMetrics, JobQueueOpts} from "./options.js"; +import {JobQueueOpts, QueueMetrics} from "./options.js"; // biome-ignore lint/suspicious/noExplicitAny: type Fn = (...args: any) => Promise; diff --git a/packages/beacon-node/src/util/queue/itemQueue.ts b/packages/beacon-node/src/util/queue/itemQueue.ts index f380a15f5eaf..8713340ec9a4 100644 --- a/packages/beacon-node/src/util/queue/itemQueue.ts +++ b/packages/beacon-node/src/util/queue/itemQueue.ts @@ -1,7 +1,7 @@ -import {LinkedList} from "../array.js"; import {callInNextEventLoop, nextEventLoop} from "../../util/eventLoop.js"; +import {LinkedList} from "../array.js"; import {QueueError, QueueErrorCode} from "./errors.js"; -import {defaultQueueOpts, QueueMetrics, JobQueueOpts, QueueType} from "./options.js"; +import {JobQueueOpts, QueueMetrics, QueueType, defaultQueueOpts} from "./options.js"; /** * JobQueue that stores arguments in the job array instead of closures. diff --git a/packages/beacon-node/src/util/sszBytes.ts b/packages/beacon-node/src/util/sszBytes.ts index c27df1a0fbf3..cb80d5d1bb4b 100644 --- a/packages/beacon-node/src/util/sszBytes.ts +++ b/packages/beacon-node/src/util/sszBytes.ts @@ -1,5 +1,4 @@ import {BitArray, deserializeUint8ArrayBitListFromBytes} from "@chainsafe/ssz"; -import {BLSSignature, RootHex, Slot} from "@lodestar/types"; import { BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB, @@ -7,6 +6,7 @@ import { ForkSeq, MAX_COMMITTEES_PER_SLOT, } from "@lodestar/params"; +import {BLSSignature, RootHex, Slot} from "@lodestar/types"; export type BlockRootHex = RootHex; // pre-electra, AttestationData is used to cache attestations diff --git a/packages/beacon-node/test/e2e/api/impl/beacon/block/endpoint.test.ts b/packages/beacon-node/test/e2e/api/impl/beacon/block/endpoint.test.ts index b8939b54c294..16a3dd0c80b0 100644 --- a/packages/beacon-node/test/e2e/api/impl/beacon/block/endpoint.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/beacon/block/endpoint.test.ts @@ -1,6 +1,6 @@ -import {describe, beforeAll, afterAll, it, expect, vi} from "vitest"; -import {createBeaconConfig} from "@lodestar/config"; import {ApiClient, WireFormat, getClient} from "@lodestar/api"; +import {createBeaconConfig} from "@lodestar/config"; +import {ForkName} from "@lodestar/params"; import { SignedBeaconBlock, SignedBlindedBeaconBlock, @@ -8,11 +8,11 @@ import { isExecutionPayload, isExecutionPayloadHeader, } from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; -import {LogLevel, testLogger} from "../../../../../utils/logger.js"; -import {getDevBeaconNode} from "../../../../../utils/node/beacon.js"; +import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; import {BeaconNode} from "../../../../../../src/node/nodejs.js"; import {getConfig} from "../../../../../utils/config.js"; +import {LogLevel, testLogger} from "../../../../../utils/logger.js"; +import {getDevBeaconNode} from "../../../../../utils/node/beacon.js"; describe("beacon block api", () => { vi.setConfig({testTimeout: 60_000, hookTimeout: 60_000}); diff --git a/packages/beacon-node/test/e2e/api/impl/beacon/node/endpoints.test.ts b/packages/beacon-node/test/e2e/api/impl/beacon/node/endpoints.test.ts index 6dc01870a844..18747fd2f735 100644 --- a/packages/beacon-node/test/e2e/api/impl/beacon/node/endpoints.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/beacon/node/endpoints.test.ts @@ -1,12 +1,12 @@ -import {describe, beforeAll, afterAll, it, expect, vi} from "vitest"; -import {createBeaconConfig} from "@lodestar/config"; -import {chainConfig as chainConfigDef} from "@lodestar/config/default"; import {routes} from "@lodestar/api"; import {ApiClient, getClient} from "@lodestar/api/beacon"; +import {createBeaconConfig} from "@lodestar/config"; +import {chainConfig as chainConfigDef} from "@lodestar/config/default"; import {sleep} from "@lodestar/utils"; +import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; +import {BeaconNode} from "../../../../../../src/node/nodejs.js"; import {LogLevel, testLogger} from "../../../../../utils/logger.js"; import {getDevBeaconNode} from "../../../../../utils/node/beacon.js"; -import {BeaconNode} from "../../../../../../src/node/nodejs.js"; import {getAndInitDevValidators} from "../../../../../utils/node/validator.js"; describe("beacon node api", () => { diff --git a/packages/beacon-node/test/e2e/api/impl/beacon/state/endpoint.test.ts b/packages/beacon-node/test/e2e/api/impl/beacon/state/endpoint.test.ts index d8c87a3ba6b8..1b2c6b902f20 100644 --- a/packages/beacon-node/test/e2e/api/impl/beacon/state/endpoint.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/beacon/state/endpoint.test.ts @@ -1,12 +1,12 @@ -import {describe, beforeAll, afterAll, it, expect} from "vitest"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ApiClient, getClient} from "@lodestar/api"; import {createBeaconConfig} from "@lodestar/config"; import {chainConfig as chainConfigDef} from "@lodestar/config/default"; -import {ApiClient, getClient} from "@lodestar/api"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {computeCommitteeCount} from "@lodestar/state-transition"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; +import {BeaconNode} from "../../../../../../src/node/nodejs.js"; import {LogLevel, testLogger} from "../../../../../utils/logger.js"; import {getDevBeaconNode} from "../../../../../utils/node/beacon.js"; -import {BeaconNode} from "../../../../../../src/node/nodejs.js"; describe("beacon state api", () => { const restPort = 9596; diff --git a/packages/beacon-node/test/e2e/api/impl/config.test.ts b/packages/beacon-node/test/e2e/api/impl/config.test.ts index 3ffdbc4beb21..a878d41a36f0 100644 --- a/packages/beacon-node/test/e2e/api/impl/config.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/config.test.ts @@ -1,9 +1,9 @@ -import {describe, it} from "vitest"; import {fetch} from "@lodestar/api"; -import {ForkName, activePreset} from "@lodestar/params"; import {chainConfig} from "@lodestar/config/default"; -import {ethereumConsensusSpecsTests} from "../../../spec/specTestVersioning.js"; +import {ForkName, activePreset} from "@lodestar/params"; +import {describe, it} from "vitest"; import {specConstants} from "../../../../src/api/impl/config/constants.js"; +import {ethereumConsensusSpecsTests} from "../../../spec/specTestVersioning.js"; const CONSTANT_NAMES_SKIP_LIST = new Set([ // This constant is an array, so it's skipped due to not being just a string. diff --git a/packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts b/packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts index effbed19fc2c..a836024aab01 100644 --- a/packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/lightclient/endpoint.test.ts @@ -1,17 +1,17 @@ -import {describe, it, beforeEach, afterEach, expect} from "vitest"; import {aggregateSerializedPublicKeys} from "@chainsafe/blst"; -import {createBeaconConfig, ChainConfig} from "@lodestar/config"; +import {HttpHeader, getClient, routes} from "@lodestar/api"; +import {ChainConfig, createBeaconConfig} from "@lodestar/config"; import {chainConfig as chainConfigDef} from "@lodestar/config/default"; -import {getClient, HttpHeader, routes} from "@lodestar/api"; -import {sleep} from "@lodestar/utils"; import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {Validator} from "@lodestar/validator"; import {phase0, ssz} from "@lodestar/types"; -import {LogLevel, testLogger, TestLoggerOpts} from "../../../../utils/logger.js"; -import {getDevBeaconNode} from "../../../../utils/node/beacon.js"; -import {getAndInitDevValidators} from "../../../../utils/node/validator.js"; +import {sleep} from "@lodestar/utils"; +import {Validator} from "@lodestar/validator"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; import {BeaconNode} from "../../../../../src/node/nodejs.js"; import {waitForEvent} from "../../../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../../../utils/logger.js"; +import {getDevBeaconNode} from "../../../../utils/node/beacon.js"; +import {getAndInitDevValidators} from "../../../../utils/node/validator.js"; describe("lightclient api", () => { const SECONDS_PER_SLOT = 1; diff --git a/packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts b/packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts index bc847b47e9a9..7501460779f3 100644 --- a/packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts +++ b/packages/beacon-node/test/e2e/api/lodestar/lodestar.test.ts @@ -1,14 +1,14 @@ -import {describe, it, afterEach, expect, vi} from "vitest"; -import {createBeaconConfig, ChainConfig} from "@lodestar/config"; +import {getClient} from "@lodestar/api"; +import {ChainConfig, createBeaconConfig} from "@lodestar/config"; import {chainConfig as chainConfigDef} from "@lodestar/config/default"; -import {phase0} from "@lodestar/types"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {getClient} from "@lodestar/api"; -import {LogLevel, testLogger, TestLoggerOpts} from "../../../utils/logger.js"; -import {getDevBeaconNode} from "../../../utils/node/beacon.js"; -import {waitForEvent} from "../../../utils/events/resolver.js"; -import {ClockEvent} from "../../../../src/util/clock.js"; +import {phase0} from "@lodestar/types"; +import {afterEach, describe, expect, it, vi} from "vitest"; import {BeaconNode} from "../../../../src/index.js"; +import {ClockEvent} from "../../../../src/util/clock.js"; +import {waitForEvent} from "../../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../../utils/logger.js"; +import {getDevBeaconNode} from "../../../utils/node/beacon.js"; describe("api / impl / validator", () => { vi.setConfig({testTimeout: 60_000}); diff --git a/packages/beacon-node/test/e2e/chain/bls/multithread.test.ts b/packages/beacon-node/test/e2e/chain/bls/multithread.test.ts index a544b3231e87..f8c3a47fb824 100644 --- a/packages/beacon-node/test/e2e/chain/bls/multithread.test.ts +++ b/packages/beacon-node/test/e2e/chain/bls/multithread.test.ts @@ -1,9 +1,9 @@ -import {describe, it, beforeAll, expect, beforeEach, afterEach} from "vitest"; import {PublicKey, SecretKey} from "@chainsafe/blst"; import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition"; +import {afterEach, beforeAll, beforeEach, describe, expect, it} from "vitest"; +import {VerifySignatureOpts} from "../../../../src/chain/bls/interface.js"; import {BlsMultiThreadWorkerPool} from "../../../../src/chain/bls/multithread/index.js"; import {testLogger} from "../../../utils/logger.js"; -import {VerifySignatureOpts} from "../../../../src/chain/bls/interface.js"; describe("chain / bls / multithread queue", () => { const logger = testLogger(); diff --git a/packages/beacon-node/test/e2e/chain/lightclient.test.ts b/packages/beacon-node/test/e2e/chain/lightclient.test.ts index ed698f2844a1..2fc983b8d488 100644 --- a/packages/beacon-node/test/e2e/chain/lightclient.test.ts +++ b/packages/beacon-node/test/e2e/chain/lightclient.test.ts @@ -1,18 +1,18 @@ -import {describe, it, expect, afterEach, vi} from "vitest"; -import {JsonPath, toHexString, fromHexString} from "@chainsafe/ssz"; import {CompactMultiProof, computeDescriptor} from "@chainsafe/persistent-merkle-tree"; +import {JsonPath, fromHexString, toHexString} from "@chainsafe/ssz"; +import {ApiClient, getClient, routes} from "@lodestar/api"; import {ChainConfig} from "@lodestar/config"; -import {ssz, altair} from "@lodestar/types"; +import {Lightclient} from "@lodestar/light-client"; +import {LightClientRestTransport} from "@lodestar/light-client/transport"; import {TimestampFormatCode} from "@lodestar/logger"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {Lightclient} from "@lodestar/light-client"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {LightClientRestTransport} from "@lodestar/light-client/transport"; -import {ApiClient, getClient, routes} from "@lodestar/api"; -import {testLogger, LogLevel, TestLoggerOpts} from "../../utils/logger.js"; +import {altair, ssz} from "@lodestar/types"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {HeadEventData} from "../../../src/chain/index.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../utils/logger.js"; import {getDevBeaconNode} from "../../utils/node/beacon.js"; import {getAndInitDevValidators} from "../../utils/node/validator.js"; -import {HeadEventData} from "../../../src/chain/index.js"; describe("chain / lightclient", () => { vi.setConfig({testTimeout: 600_000}); diff --git a/packages/beacon-node/test/e2e/chain/proposerBoostReorg.test.ts b/packages/beacon-node/test/e2e/chain/proposerBoostReorg.test.ts index fd6af72ad6cb..70f2d87e2456 100644 --- a/packages/beacon-node/test/e2e/chain/proposerBoostReorg.test.ts +++ b/packages/beacon-node/test/e2e/chain/proposerBoostReorg.test.ts @@ -1,16 +1,16 @@ -import {describe, it, afterEach, expect, vi} from "vitest"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {TimestampFormatCode} from "@lodestar/logger"; +import {routes} from "@lodestar/api"; import {ChainConfig} from "@lodestar/config"; +import {TimestampFormatCode} from "@lodestar/logger"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {RootHex, Slot} from "@lodestar/types"; -import {routes} from "@lodestar/api"; import {toHexString} from "@lodestar/utils"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {ReorgEventData} from "../../../src/chain/emitter.js"; +import {TimelinessForkChoice} from "../../mocks/fork-choice/timeliness.js"; +import {waitForEvent} from "../../utils/events/resolver.js"; import {LogLevel, TestLoggerOpts, testLogger} from "../../utils/logger.js"; import {getDevBeaconNode} from "../../utils/node/beacon.js"; -import {TimelinessForkChoice} from "../../mocks/fork-choice/timeliness.js"; import {getAndInitDevValidators} from "../../utils/node/validator.js"; -import {waitForEvent} from "../../utils/events/resolver.js"; -import {ReorgEventData} from "../../../src/chain/emitter.js"; describe("proposer boost reorg", () => { vi.setConfig({testTimeout: 60000}); diff --git a/packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts b/packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts index fcac715e1719..875e3fe13b03 100644 --- a/packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts +++ b/packages/beacon-node/test/e2e/chain/stateCache/nHistoricalStates.test.ts @@ -1,18 +1,18 @@ -import {describe, it, afterEach, expect, vi} from "vitest"; -import {Gauge, Histogram} from "prom-client"; +import {routes} from "@lodestar/api"; import {ChainConfig} from "@lodestar/config"; -import {Slot, phase0} from "@lodestar/types"; import {TimestampFormatCode} from "@lodestar/logger"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {routes} from "@lodestar/api"; -import {LogLevel, TestLoggerOpts, testLogger} from "../../../utils/logger.js"; -import {getDevBeaconNode} from "../../../utils/node/beacon.js"; -import {getAndInitDevValidators} from "../../../utils/node/validator.js"; -import {waitForEvent} from "../../../utils/events/resolver.js"; +import {Slot, phase0} from "@lodestar/types"; +import {Gauge, Histogram} from "prom-client"; +import {afterEach, describe, expect, it, vi} from "vitest"; import {ChainEvent, ReorgEventData} from "../../../../src/chain/emitter.js"; -import {connect, onPeerConnect} from "../../../utils/network.js"; import {CacheItemType} from "../../../../src/chain/stateCache/types.js"; import {ReorgedForkChoice} from "../../../mocks/fork-choice/reorg.js"; +import {waitForEvent} from "../../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../../utils/logger.js"; +import {connect, onPeerConnect} from "../../../utils/network.js"; +import {getDevBeaconNode} from "../../../utils/node/beacon.js"; +import {getAndInitDevValidators} from "../../../utils/node/validator.js"; /** * Test different reorg scenarios to make sure the StateCache implementations are correct. diff --git a/packages/beacon-node/test/e2e/db/api/beacon/repositories/blockArchive.test.ts b/packages/beacon-node/test/e2e/db/api/beacon/repositories/blockArchive.test.ts index 3c7a37e52a8b..a08be8922d2a 100644 --- a/packages/beacon-node/test/e2e/db/api/beacon/repositories/blockArchive.test.ts +++ b/packages/beacon-node/test/e2e/db/api/beacon/repositories/blockArchive.test.ts @@ -1,6 +1,6 @@ -import {beforeAll, afterAll, describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {BeaconDb} from "../../../../../../src/db/index.js"; import {startTmpBeaconDb} from "../../../../../utils/db.js"; diff --git a/packages/beacon-node/test/e2e/doppelganger/doppelganger.test.ts b/packages/beacon-node/test/e2e/doppelganger/doppelganger.test.ts index 949d0104d641..c83a2896530c 100644 --- a/packages/beacon-node/test/e2e/doppelganger/doppelganger.test.ts +++ b/packages/beacon-node/test/e2e/doppelganger/doppelganger.test.ts @@ -1,18 +1,18 @@ -import {describe, afterEach, it, expect} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; import {routes} from "@lodestar/api/beacon"; -import {BLSPubkey, Epoch, phase0, Slot, ssz} from "@lodestar/types"; import {ChainConfig} from "@lodestar/config"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {BLSPubkey, Epoch, Slot, phase0, ssz} from "@lodestar/types"; import {Validator} from "@lodestar/validator"; import {PubkeyHex} from "@lodestar/validator/src/types"; -import {getAndInitDevValidators} from "../../utils/node/validator.js"; +import {afterEach, describe, expect, it} from "vitest"; +import {BeaconNode} from "../../../src/node/index.js"; import {ClockEvent} from "../../../src/util/clock.js"; +import {waitForEvent} from "../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../utils/logger.js"; import {connect} from "../../utils/network.js"; -import {testLogger, LogLevel, TestLoggerOpts} from "../../utils/logger.js"; import {getDevBeaconNode} from "../../utils/node/beacon.js"; -import {waitForEvent} from "../../utils/events/resolver.js"; -import {BeaconNode} from "../../../src/node/index.js"; +import {getAndInitDevValidators} from "../../utils/node/validator.js"; // TODO: Reconsider this tests latter. // Doppelganger testing can be split in two items: diff --git a/packages/beacon-node/test/e2e/eth1/eth1ForBlockProduction.test.ts b/packages/beacon-node/test/e2e/eth1/eth1ForBlockProduction.test.ts index 21cadeb55d2c..f72be5ed3e94 100644 --- a/packages/beacon-node/test/e2e/eth1/eth1ForBlockProduction.test.ts +++ b/packages/beacon-node/test/e2e/eth1/eth1ForBlockProduction.test.ts @@ -1,18 +1,18 @@ -import {describe, it, beforeAll, afterAll, expect} from "vitest"; import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {sleep} from "@lodestar/utils"; import {LevelDbController} from "@lodestar/db"; +import {sleep} from "@lodestar/utils"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {ssz} from "@lodestar/types"; +import {BeaconDb} from "../../../src/db/index.js"; import {Eth1ForBlockProduction} from "../../../src/eth1/index.js"; import {Eth1Options} from "../../../src/eth1/options.js"; -import {getTestnetConfig, medallaTestnetConfig} from "../../utils/testnet.js"; -import {testLogger} from "../../utils/logger.js"; -import {BeaconDb} from "../../../src/db/index.js"; -import {generateState} from "../../utils/state.js"; import {Eth1Provider} from "../../../src/eth1/provider/eth1Provider.js"; import {getGoerliRpcUrl} from "../../testParams.js"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; +import {testLogger} from "../../utils/logger.js"; +import {generateState} from "../../utils/state.js"; +import {getTestnetConfig, medallaTestnetConfig} from "../../utils/testnet.js"; const dbLocation = "./.__testdb"; diff --git a/packages/beacon-node/test/e2e/eth1/eth1MergeBlockTracker.test.ts b/packages/beacon-node/test/e2e/eth1/eth1MergeBlockTracker.test.ts index 9423bb716b3f..79ff059e2b82 100644 --- a/packages/beacon-node/test/e2e/eth1/eth1MergeBlockTracker.test.ts +++ b/packages/beacon-node/test/e2e/eth1/eth1MergeBlockTracker.test.ts @@ -1,14 +1,14 @@ -import {describe, it, beforeAll, expect, beforeEach, afterEach} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; import {ChainConfig} from "@lodestar/config"; import {sleep} from "@lodestar/utils"; -import {Eth1Provider, IEth1Provider} from "../../../src/index.js"; +import {afterEach, beforeAll, beforeEach, describe, expect, it} from "vitest"; +import {ZERO_HASH} from "../../../src/constants/index.js"; import {Eth1MergeBlockTracker, StatusCode} from "../../../src/eth1/eth1MergeBlockTracker.js"; import {Eth1Options} from "../../../src/eth1/options.js"; -import {testLogger} from "../../utils/logger.js"; import {quantityToBigint} from "../../../src/eth1/provider/utils.js"; -import {ZERO_HASH} from "../../../src/constants/index.js"; +import {Eth1Provider, IEth1Provider} from "../../../src/index.js"; import {getGoerliRpcUrl} from "../../testParams.js"; +import {testLogger} from "../../utils/logger.js"; // This test is constantly failing. We must unblock PR so this issue is a TODO to debug it and re-enable latter. // It's OKAY to disable temporarily since this functionality is tested indirectly by the sim merge tests. diff --git a/packages/beacon-node/test/e2e/eth1/eth1Provider.test.ts b/packages/beacon-node/test/e2e/eth1/eth1Provider.test.ts index 606845f40337..d571a695c648 100644 --- a/packages/beacon-node/test/e2e/eth1/eth1Provider.test.ts +++ b/packages/beacon-node/test/e2e/eth1/eth1Provider.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, beforeEach, afterEach} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; +import {Eth1Block} from "../../../src/eth1/interface.js"; import {Eth1Options} from "../../../src/eth1/options.js"; -import {getTestnetConfig} from "../../utils/testnet.js"; -import {goerliTestnetDepositEvents} from "../../utils/testnet.js"; import {Eth1Provider, parseEth1Block} from "../../../src/eth1/provider/eth1Provider.js"; -import {Eth1Block} from "../../../src/eth1/interface.js"; import {getGoerliRpcUrl} from "../../testParams.js"; +import {getTestnetConfig} from "../../utils/testnet.js"; +import {goerliTestnetDepositEvents} from "../../utils/testnet.js"; // https://github.com/ChainSafe/lodestar/issues/5967 describe.skip("eth1 / Eth1Provider", () => { diff --git a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts index 91131a89f379..ee2476549737 100644 --- a/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts +++ b/packages/beacon-node/test/e2e/eth1/jsonRpcHttpClient.test.ts @@ -1,11 +1,11 @@ import crypto from "node:crypto"; import http from "node:http"; -import {describe, it, expect, afterEach, vi} from "vitest"; import {FetchError} from "@lodestar/api"; import {sleep} from "@lodestar/utils"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {RpcPayload} from "../../../src/eth1/interface.js"; import {JsonRpcHttpClient} from "../../../src/eth1/provider/jsonRpcHttpClient.js"; import {getGoerliRpcUrl} from "../../testParams.js"; -import {RpcPayload} from "../../../src/eth1/interface.js"; describe("eth1 / jsonRpcHttpClient", () => { vi.setConfig({testTimeout: 10_000}); diff --git a/packages/beacon-node/test/e2e/eth1/stream.test.ts b/packages/beacon-node/test/e2e/eth1/stream.test.ts index ce65d4353f0e..1ec20608cfd7 100644 --- a/packages/beacon-node/test/e2e/eth1/stream.test.ts +++ b/packages/beacon-node/test/e2e/eth1/stream.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeEach, afterEach} from "vitest"; -import {getTestnetConfig, medallaTestnetConfig} from "../../utils/testnet.js"; -import {getDepositsStream, getDepositsAndBlockStreamForGenesis} from "../../../src/eth1/stream.js"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; +import {Eth1Options} from "../../../src/eth1/options.js"; import {Eth1Provider} from "../../../src/eth1/provider/eth1Provider.js"; +import {getDepositsAndBlockStreamForGenesis, getDepositsStream} from "../../../src/eth1/stream.js"; import {getGoerliRpcUrl} from "../../testParams.js"; -import {Eth1Options} from "../../../src/eth1/options.js"; +import {getTestnetConfig, medallaTestnetConfig} from "../../utils/testnet.js"; // https://github.com/ChainSafe/lodestar/issues/5967 describe.skip("Eth1 streams", () => { diff --git a/packages/beacon-node/test/e2e/interop/genesisState.test.ts b/packages/beacon-node/test/e2e/interop/genesisState.test.ts index 739319a4257c..91d67fae91ce 100644 --- a/packages/beacon-node/test/e2e/interop/genesisState.test.ts +++ b/packages/beacon-node/test/e2e/interop/genesisState.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; import {toHexString} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; -import {initDevState} from "../../../src/node/utils/state.js"; +import {describe, expect, it} from "vitest"; import {interopDeposits} from "../../../src/node/utils/interop/deposits.js"; +import {initDevState} from "../../../src/node/utils/state.js"; describe("interop / initDevState", () => { it("Create interop deposits", () => { diff --git a/packages/beacon-node/test/e2e/network/gossipsub.test.ts b/packages/beacon-node/test/e2e/network/gossipsub.test.ts index 29a745455561..e63b26d026db 100644 --- a/packages/beacon-node/test/e2e/network/gossipsub.test.ts +++ b/packages/beacon-node/test/e2e/network/gossipsub.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect, afterEach, vi} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {sleep} from "@lodestar/utils"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {ssz} from "@lodestar/types"; +import {sleep} from "@lodestar/utils"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {GossipHandlerParamGeneric, GossipHandlers, GossipType} from "../../../src/network/gossip/index.js"; import {Network} from "../../../src/network/index.js"; -import {GossipType, GossipHandlers, GossipHandlerParamGeneric} from "../../../src/network/gossip/index.js"; -import {getNetworkForTest} from "../../utils/networkWithMockDb.js"; import {connect, onPeerConnect} from "../../utils/network.js"; +import {getNetworkForTest} from "../../utils/networkWithMockDb.js"; describe("gossipsub / main thread", () => { vi.setConfig({testTimeout: 3000}); diff --git a/packages/beacon-node/test/e2e/network/mdns.test.ts b/packages/beacon-node/test/e2e/network/mdns.test.ts index f8b55d8afae7..f1df1f1e94d6 100644 --- a/packages/beacon-node/test/e2e/network/mdns.test.ts +++ b/packages/beacon-node/test/e2e/network/mdns.test.ts @@ -1,21 +1,21 @@ -import {describe, it, afterEach, beforeEach, expect, vi} from "vitest"; +import {SignableENR} from "@chainsafe/enr"; import {PeerId} from "@libp2p/interface"; -import {multiaddr} from "@multiformats/multiaddr"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; -import {SignableENR} from "@chainsafe/enr"; import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; -import {ssz} from "@lodestar/types"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; +import {multiaddr} from "@multiformats/multiaddr"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {GossipHandlers} from "../../../src/network/gossip/index.js"; +import {Network, NetworkInitModules, getReqRespHandlers} from "../../../src/network/index.js"; +import {NetworkOptions, defaultNetworkOptions} from "../../../src/network/options.js"; import {getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; import {getMockedBeaconDb} from "../../mocks/mockedBeaconDb.js"; -import {Network, NetworkInitModules, getReqRespHandlers} from "../../../src/network/index.js"; -import {defaultNetworkOptions, NetworkOptions} from "../../../src/network/options.js"; +import {memoOnce} from "../../utils/cache.js"; +import {testLogger} from "../../utils/logger.js"; import {createNetworkModules, onPeerConnect} from "../../utils/network.js"; import {generateState, zeroProtoBlock} from "../../utils/state.js"; -import {testLogger} from "../../utils/logger.js"; -import {GossipHandlers} from "../../../src/network/gossip/index.js"; -import {memoOnce} from "../../utils/cache.js"; let port = 9000; const mu = "/ip4/127.0.0.1/tcp/0"; diff --git a/packages/beacon-node/test/e2e/network/network.test.ts b/packages/beacon-node/test/e2e/network/network.test.ts index 2435b005efa1..fee80d6f48b5 100644 --- a/packages/beacon-node/test/e2e/network/network.test.ts +++ b/packages/beacon-node/test/e2e/network/network.test.ts @@ -1,10 +1,10 @@ -import {describe, it, expect, afterEach, beforeEach, vi} from "vitest"; import {PeerId} from "@libp2p/interface"; import {config} from "@lodestar/config/default"; import {phase0} from "@lodestar/types"; import {sleep} from "@lodestar/utils"; -import {Network, NetworkEvent, ReqRespMethod} from "../../../src/network/index.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {GoodByeReasonCode} from "../../../src/constants/index.js"; +import {Network, NetworkEvent, ReqRespMethod} from "../../../src/network/index.js"; import {connect, disconnect, onPeerConnect, onPeerDisconnect} from "../../utils/network.js"; import {getNetworkForTest} from "../../utils/networkWithMockDb.js"; import {getValidPeerId} from "../../utils/peer.js"; diff --git a/packages/beacon-node/test/e2e/network/onWorker/dataSerialization.test.ts b/packages/beacon-node/test/e2e/network/onWorker/dataSerialization.test.ts index 12d9e393af09..e4056ca9671e 100644 --- a/packages/beacon-node/test/e2e/network/onWorker/dataSerialization.test.ts +++ b/packages/beacon-node/test/e2e/network/onWorker/dataSerialization.test.ts @@ -1,12 +1,20 @@ -import {describe, it, beforeAll, afterAll, expect} from "vitest"; -import {TopicValidatorResult} from "@libp2p/interface"; import {BitArray} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; +import {TopicValidatorResult} from "@libp2p/interface"; import {routes} from "@lodestar/api"; import {ForkName} from "@lodestar/params"; -import {getValidPeerId, validPeerIdStr} from "../../../utils/peer.js"; +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 {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"; +import {NetworkWorkerApi} from "../../../../src/network/core/index.js"; import { GossipType, NetworkEvent, @@ -15,18 +23,10 @@ import { ReqRespMethod, networkEventDirection, } from "../../../../src/network/index.js"; -import { - BlockInputType, - BlockSource, - BlockInput, - BlockInputDataBlobs, - CachedData, -} from "../../../../src/chain/blocks/types.js"; -import {ZERO_HASH, ZERO_HASH_HEX} from "../../../../src/constants/constants.js"; +import {CommitteeSubscription} from "../../../../src/network/subnets/interface.js"; import {IteratorEventType} from "../../../../src/util/asyncIterableToEvents.js"; -import {NetworkWorkerApi} from "../../../../src/network/core/index.js"; import {EventDirection} from "../../../../src/util/workerEvents.js"; -import {CommitteeSubscription} from "../../../../src/network/subnets/interface.js"; +import {getValidPeerId, validPeerIdStr} from "../../../utils/peer.js"; import {EchoWorker, getEchoWorker} from "./workerEchoHandler.js"; describe("data serialization through worker boundary", () => { diff --git a/packages/beacon-node/test/e2e/network/onWorker/workerEchoHandler.ts b/packages/beacon-node/test/e2e/network/onWorker/workerEchoHandler.ts index b2c0f6b56aa0..f4b5df8189a0 100644 --- a/packages/beacon-node/test/e2e/network/onWorker/workerEchoHandler.ts +++ b/packages/beacon-node/test/e2e/network/onWorker/workerEchoHandler.ts @@ -1,5 +1,5 @@ import workerThreads from "node:worker_threads"; -import {spawn, Worker} from "@chainsafe/threads"; +import {Worker, spawn} from "@chainsafe/threads"; export type EchoWorker = { send(data: T): Promise; diff --git a/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts b/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts index d0b94399c01d..e0b1e6b357fc 100644 --- a/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts +++ b/packages/beacon-node/test/e2e/network/peers/peerManager.test.ts @@ -1,24 +1,24 @@ -import {describe, it, afterEach, expect, vi} from "vitest"; +import {BitArray} from "@chainsafe/ssz"; import {Connection} from "@libp2p/interface"; import {CustomEvent} from "@libp2p/interface"; -import {BitArray} from "@chainsafe/ssz"; +import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {altair, phase0, ssz} from "@lodestar/types"; import {sleep} from "@lodestar/utils"; -import {createBeaconConfig} from "@lodestar/config"; -import {ReqRespMethod} from "../../../../src/network/reqresp/ReqRespBeaconNode.js"; -import {PeerRpcScoreStore, PeerManager, IReqRespBeaconNodePeerManager} from "../../../../src/network/peers/index.js"; -import {Eth2Gossipsub, getConnectionsMap, NetworkEvent, NetworkEventBus} from "../../../../src/network/index.js"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {Eth2Gossipsub, NetworkEvent, NetworkEventBus, getConnectionsMap} from "../../../../src/network/index.js"; +import {IReqRespBeaconNodePeerManager, PeerManager, PeerRpcScoreStore} from "../../../../src/network/peers/index.js"; import {PeersData} from "../../../../src/network/peers/peersData.js"; -import {createNode} from "../../../utils/network.js"; -import {getAttnets, getSyncnets} from "../../../utils/network.js"; -import {generateState} from "../../../utils/state.js"; +import {ReqRespMethod} from "../../../../src/network/reqresp/ReqRespBeaconNode.js"; +import {LocalStatusCache} from "../../../../src/network/statusCache.js"; +import {IAttnetsService} from "../../../../src/network/subnets/index.js"; +import {Clock} from "../../../../src/util/clock.js"; import {waitForEvent} from "../../../utils/events/resolver.js"; import {testLogger} from "../../../utils/logger.js"; +import {createNode} from "../../../utils/network.js"; +import {getAttnets, getSyncnets} from "../../../utils/network.js"; import {getValidPeerId} from "../../../utils/peer.js"; -import {IAttnetsService} from "../../../../src/network/subnets/index.js"; -import {Clock} from "../../../../src/util/clock.js"; -import {LocalStatusCache} from "../../../../src/network/statusCache.js"; +import {generateState} from "../../../utils/state.js"; const logger = testLogger("peerManager"); diff --git a/packages/beacon-node/test/e2e/network/reqresp.test.ts b/packages/beacon-node/test/e2e/network/reqresp.test.ts index b7ab190166e7..854a2a2482ff 100644 --- a/packages/beacon-node/test/e2e/network/reqresp.test.ts +++ b/packages/beacon-node/test/e2e/network/reqresp.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect, afterEach, beforeEach, vi} from "vitest"; -import {createChainForkConfig, ChainForkConfig} from "@lodestar/config"; +import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; import {ForkName} from "@lodestar/params"; import {RequestError, RequestErrorCode, ResponseOutgoing} from "@lodestar/reqresp"; -import {altair, phase0, Root, SignedBeaconBlock, ssz} from "@lodestar/types"; +import {Root, SignedBeaconBlock, altair, phase0, ssz} from "@lodestar/types"; import {sleep as _sleep} from "@lodestar/utils"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {Network, ReqRespBeaconNodeOpts} from "../../../src/network/index.js"; +import {GetReqRespHandlerFn, ReqRespMethod} from "../../../src/network/reqresp/types.js"; +import {PeerIdStr} from "../../../src/util/peerId.js"; +import {arrToSource} from "../../unit/network/reqresp/utils.js"; import {expectRejectedWithLodestarError} from "../../utils/errors.js"; import {connect, getPeerIdOf, onPeerConnect} from "../../utils/network.js"; import {getNetworkForTest} from "../../utils/networkWithMockDb.js"; -import {arrToSource} from "../../unit/network/reqresp/utils.js"; -import {GetReqRespHandlerFn, ReqRespMethod} from "../../../src/network/reqresp/types.js"; -import {PeerIdStr} from "../../../src/util/peerId.js"; /* eslint-disable require-yield, @typescript-eslint/naming-convention */ diff --git a/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts b/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts index ae916bdd0ab7..4634870c40fe 100644 --- a/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts +++ b/packages/beacon-node/test/e2e/network/reqrespEncode.test.ts @@ -1,26 +1,26 @@ -import {describe, it, afterEach, expect} from "vitest"; -import all from "it-all"; -import {Libp2p, createLibp2p} from "libp2p"; -import {tcp} from "@libp2p/tcp"; -import {mplex} from "@libp2p/mplex"; -import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; import {noise} from "@chainsafe/libp2p-noise"; -import {ssz} from "@lodestar/types"; +import {mplex} from "@libp2p/mplex"; +import {tcp} from "@libp2p/tcp"; import {createBeaconConfig} from "@lodestar/config"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {fromHex, sleep, toHex} from "@lodestar/utils"; +import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; +import all from "it-all"; +import {Libp2p, createLibp2p} from "libp2p"; +import {afterEach, describe, expect, it} from "vitest"; +import {ZERO_HASH} from "../../../src/constants/constants.js"; import { NetworkEventBus, PeerRpcScoreStore, ReqRespBeaconNode, ReqRespBeaconNodeModules, } from "../../../src/network/index.js"; -import {PeersData} from "../../../src/network/peers/peersData.js"; -import {ZERO_HASH} from "../../../src/constants/constants.js"; import {MetadataController} from "../../../src/network/metadata.js"; -import {testLogger} from "../../utils/logger.js"; +import {PeersData} from "../../../src/network/peers/peersData.js"; import {GetReqRespHandlerFn} from "../../../src/network/reqresp/types.js"; import {LocalStatusCache} from "../../../src/network/statusCache.js"; +import {testLogger} from "../../utils/logger.js"; /* eslint-disable require-yield */ diff --git a/packages/beacon-node/test/e2e/sync/finalizedSync.test.ts b/packages/beacon-node/test/e2e/sync/finalizedSync.test.ts index ba98f2a1facd..38e3f59adf54 100644 --- a/packages/beacon-node/test/e2e/sync/finalizedSync.test.ts +++ b/packages/beacon-node/test/e2e/sync/finalizedSync.test.ts @@ -1,18 +1,18 @@ -import {describe, it, afterEach, vi} from "vitest"; -import {assert} from "chai"; import {fromHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; +import {EventData, EventType} from "@lodestar/api/lib/beacon/routes/events.js"; import {ChainConfig} from "@lodestar/config"; -import {phase0} from "@lodestar/types"; import {TimestampFormatCode} from "@lodestar/logger"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {routes} from "@lodestar/api"; -import {EventData, EventType} from "@lodestar/api/lib/beacon/routes/events.js"; -import {getDevBeaconNode} from "../../utils/node/beacon.js"; -import {waitForEvent} from "../../utils/events/resolver.js"; -import {getAndInitDevValidators} from "../../utils/node/validator.js"; +import {phase0} from "@lodestar/types"; +import {assert} from "chai"; +import {afterEach, describe, it, vi} from "vitest"; import {ChainEvent} from "../../../src/chain/index.js"; +import {waitForEvent} from "../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../utils/logger.js"; import {connect, onPeerConnect} from "../../utils/network.js"; -import {testLogger, LogLevel, TestLoggerOpts} from "../../utils/logger.js"; +import {getDevBeaconNode} from "../../utils/node/beacon.js"; +import {getAndInitDevValidators} from "../../utils/node/validator.js"; describe("sync / finalized sync", () => { // chain is finalized at slot 32, plus 4 slots for genesis delay => ~72s it should sync pretty fast diff --git a/packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts b/packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts index 290213d2b1ee..28ec0871b275 100644 --- a/packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts +++ b/packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts @@ -1,21 +1,21 @@ -import {describe, it, afterEach, vi} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; +import {EventData, EventType} from "@lodestar/api/lib/beacon/routes/events.js"; import {ChainConfig} from "@lodestar/config"; -import {phase0} from "@lodestar/types"; import {config} from "@lodestar/config/default"; import {TimestampFormatCode} from "@lodestar/logger"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {routes} from "@lodestar/api"; -import {EventData, EventType} from "@lodestar/api/lib/beacon/routes/events.js"; -import {getDevBeaconNode} from "../../utils/node/beacon.js"; -import {waitForEvent} from "../../utils/events/resolver.js"; -import {getAndInitDevValidators} from "../../utils/node/validator.js"; +import {phase0} from "@lodestar/types"; +import {afterEach, describe, it, vi} from "vitest"; +import {BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; +import {BlockError, BlockErrorCode} from "../../../src/chain/errors/index.js"; import {ChainEvent} from "../../../src/chain/index.js"; import {NetworkEvent} from "../../../src/network/index.js"; +import {waitForEvent} from "../../utils/events/resolver.js"; +import {LogLevel, TestLoggerOpts, testLogger} from "../../utils/logger.js"; import {connect, onPeerConnect} from "../../utils/network.js"; -import {testLogger, LogLevel, TestLoggerOpts} from "../../utils/logger.js"; -import {BlockError, BlockErrorCode} from "../../../src/chain/errors/index.js"; -import {BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; +import {getDevBeaconNode} from "../../utils/node/beacon.js"; +import {getAndInitDevValidators} from "../../utils/node/validator.js"; describe("sync / unknown block sync", () => { vi.setConfig({testTimeout: 40_000}); diff --git a/packages/beacon-node/test/globalSetup.ts b/packages/beacon-node/test/globalSetup.ts index f41a7f249b9b..784633baf2c4 100644 --- a/packages/beacon-node/test/globalSetup.ts +++ b/packages/beacon-node/test/globalSetup.ts @@ -1,4 +1,4 @@ -import {setActivePreset, PresetName} from "@lodestar/params/setPreset"; +import {PresetName, setActivePreset} from "@lodestar/params/setPreset"; export async function setup(): Promise { process.env.NODE_ENV = "test"; diff --git a/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts b/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts index 1a317a7fe9d3..294dde750865 100644 --- a/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts +++ b/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts @@ -1,8 +1,8 @@ import crypto from "node:crypto"; +import {toMemoryEfficientHexStr} from "@lodestar/state-transition/src/cache/pubkeyCache.js"; +import {ValidatorIndex} from "@lodestar/types"; // biome-ignore lint/suspicious/noShadowRestrictedNames: We explicitly want `Map` name to be imported import {Map} from "immutable"; -import {ValidatorIndex} from "@lodestar/types"; -import {toMemoryEfficientHexStr} from "@lodestar/state-transition/src/cache/pubkeyCache.js"; import {testRunnerMemory} from "./testRunnerMemory.js"; // Results in MacOS Nov 2023 diff --git a/packages/beacon-node/test/mocks/clock.ts b/packages/beacon-node/test/mocks/clock.ts index 6f09bd292491..dc06fcd6922a 100644 --- a/packages/beacon-node/test/mocks/clock.ts +++ b/packages/beacon-node/test/mocks/clock.ts @@ -1,7 +1,7 @@ import EventEmitter from "node:events"; -import {Mocked, vi} from "vitest"; import {computeEpochAtSlot} from "@lodestar/state-transition"; import {Epoch, Slot} from "@lodestar/types"; +import {Mocked, vi} from "vitest"; import {IClock} from "../../src/util/clock.js"; /** diff --git a/packages/beacon-node/test/mocks/loggerMock.ts b/packages/beacon-node/test/mocks/loggerMock.ts index ee25ede93475..99984ba87e9f 100644 --- a/packages/beacon-node/test/mocks/loggerMock.ts +++ b/packages/beacon-node/test/mocks/loggerMock.ts @@ -1,5 +1,5 @@ -import {vi, Mocked} from "vitest"; import {Logger} from "@lodestar/logger"; +import {Mocked, vi} from "vitest"; export type MockedLogger = Mocked; diff --git a/packages/beacon-node/test/mocks/mockedBeaconChain.ts b/packages/beacon-node/test/mocks/mockedBeaconChain.ts index a69efc55836c..b274284e3ab1 100644 --- a/packages/beacon-node/test/mocks/mockedBeaconChain.ts +++ b/packages/beacon-node/test/mocks/mockedBeaconChain.ts @@ -1,22 +1,22 @@ -import {vi, Mocked, Mock} from "vitest"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {config as defaultConfig} from "@lodestar/config/default"; import {ChainForkConfig} from "@lodestar/config"; -import {ForkChoice, ProtoBlock, EpochDifference} from "@lodestar/fork-choice"; +import {config as defaultConfig} from "@lodestar/config/default"; +import {EpochDifference, ForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {Logger} from "@lodestar/utils"; +import {Mock, Mocked, vi} from "vitest"; +import {BeaconProposerCache} from "../../src/chain/beaconProposerCache.js"; import {BeaconChain} from "../../src/chain/chain.js"; import {ChainEventEmitter} from "../../src/chain/emitter.js"; -import {ExecutionEngineHttp} from "../../src/execution/engine/index.js"; -import {ExecutionBuilderHttp} from "../../src/execution/builder/http.js"; -import {Eth1ForBlockProduction} from "../../src/eth1/index.js"; -import {OpPool, AggregatedAttestationPool} from "../../src/chain/opPools/index.js"; -import {BeaconProposerCache} from "../../src/chain/beaconProposerCache.js"; import {LightClientServer} from "../../src/chain/lightClient/index.js"; -import {Clock} from "../../src/util/clock.js"; +import {AggregatedAttestationPool, OpPool} from "../../src/chain/opPools/index.js"; import {QueuedStateRegenerator} from "../../src/chain/regen/index.js"; import {ShufflingCache} from "../../src/chain/shufflingCache.js"; -import {getMockedLogger} from "./loggerMock.js"; +import {Eth1ForBlockProduction} from "../../src/eth1/index.js"; +import {ExecutionBuilderHttp} from "../../src/execution/builder/http.js"; +import {ExecutionEngineHttp} from "../../src/execution/engine/index.js"; +import {Clock} from "../../src/util/clock.js"; import {getMockedClock} from "./clock.js"; +import {getMockedLogger} from "./loggerMock.js"; export type MockedBeaconChain = Mocked & { logger: Mocked; diff --git a/packages/beacon-node/test/mocks/mockedBeaconDb.ts b/packages/beacon-node/test/mocks/mockedBeaconDb.ts index eb209c9b44fb..87404a8965a6 100644 --- a/packages/beacon-node/test/mocks/mockedBeaconDb.ts +++ b/packages/beacon-node/test/mocks/mockedBeaconDb.ts @@ -1,20 +1,20 @@ -import {vi, Mocked} from "vitest"; import {config as minimalConfig} from "@lodestar/config/default"; +import {Mocked, vi} from "vitest"; +import {BeaconDb} from "../../src/db/index.js"; import { AttesterSlashingRepository, + BLSToExecutionChangeRepository, + BlobSidecarsArchiveRepository, + BlobSidecarsRepository, BlockArchiveRepository, BlockRepository, - DepositEventRepository, DepositDataRootRepository, + DepositEventRepository, Eth1DataRepository, ProposerSlashingRepository, StateArchiveRepository, VoluntaryExitRepository, - BLSToExecutionChangeRepository, - BlobSidecarsRepository, - BlobSidecarsArchiveRepository, } from "../../src/db/repositories/index.js"; -import {BeaconDb} from "../../src/db/index.js"; export type MockedBeaconDb = Mocked & { block: Mocked; diff --git a/packages/beacon-node/test/mocks/mockedNetwork.ts b/packages/beacon-node/test/mocks/mockedNetwork.ts index 9258acc9bc1b..27b9c3deaf79 100644 --- a/packages/beacon-node/test/mocks/mockedNetwork.ts +++ b/packages/beacon-node/test/mocks/mockedNetwork.ts @@ -1,5 +1,5 @@ -import {vi, Mocked} from "vitest"; -import {Network, INetwork} from "../../src/network/index.js"; +import {Mocked, vi} from "vitest"; +import {INetwork, Network} from "../../src/network/index.js"; vi.mock("../../src/network/index.js", async (importActual) => { const mod = await importActual(); diff --git a/packages/beacon-node/test/mocks/regenMocks.ts b/packages/beacon-node/test/mocks/regenMocks.ts index 39f7fa382760..f0be21989e83 100644 --- a/packages/beacon-node/test/mocks/regenMocks.ts +++ b/packages/beacon-node/test/mocks/regenMocks.ts @@ -1,4 +1,4 @@ -import {vi, Mocked} from "vitest"; +import {Mocked, vi} from "vitest"; import {QueuedStateRegenerator} from "../../src/chain/regen/index.js"; export type MockedQueuedStateRegenerator = Mocked; diff --git a/packages/beacon-node/test/mocks/shufflingMock.ts b/packages/beacon-node/test/mocks/shufflingMock.ts index 76482f760872..e13d8d6dce5d 100644 --- a/packages/beacon-node/test/mocks/shufflingMock.ts +++ b/packages/beacon-node/test/mocks/shufflingMock.ts @@ -1,4 +1,4 @@ -import {vi, Mocked} from "vitest"; +import {Mocked, vi} from "vitest"; import {ShufflingCache} from "../../src/chain/shufflingCache.js"; export type MockedShufflingCache = Mocked; diff --git a/packages/beacon-node/test/perf/bls/bls.test.ts b/packages/beacon-node/test/perf/bls/bls.test.ts index 9f1f90a4d879..1c6cde5e20ac 100644 --- a/packages/beacon-node/test/perf/bls/bls.test.ts +++ b/packages/beacon-node/test/perf/bls/bls.test.ts @@ -1,5 +1,4 @@ import crypto from "node:crypto"; -import {itBench} from "@dapplion/benchmark"; import { PublicKey, SecretKey, @@ -9,6 +8,7 @@ import { verify, verifyMultipleAggregateSignatures, } from "@chainsafe/blst"; +import {itBench} from "@dapplion/benchmark"; import {linspace} from "../../../src/util/numpy.js"; describe("BLS ops", () => { diff --git a/packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts b/packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts index 89bd76f34eb3..28c1f198da28 100644 --- a/packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts +++ b/packages/beacon-node/test/perf/chain/opPools/aggregatedAttestationPool.test.ts @@ -1,5 +1,7 @@ -import {itBench} from "@dapplion/benchmark"; import {BitArray, toHexString} from "@chainsafe/ssz"; +import {itBench} from "@dapplion/benchmark"; +import {DataAvailabilityStatus, ExecutionStatus, ForkChoice, IForkChoiceStore, ProtoArray} from "@lodestar/fork-choice"; +import {HISTORICAL_ROOTS_LIMIT, SLOTS_PER_EPOCH} from "@lodestar/params"; import { CachedBeaconStateAltair, computeAnchorCheckpoint, @@ -8,8 +10,6 @@ import { getBlockRootAtSlot, newFilledArray, } from "@lodestar/state-transition"; -import {HISTORICAL_ROOTS_LIMIT, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {ExecutionStatus, ForkChoice, IForkChoiceStore, ProtoArray, DataAvailabilityStatus} from "@lodestar/fork-choice"; import {ssz} from "@lodestar/types"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; diff --git a/packages/beacon-node/test/perf/chain/opPools/opPool.test.ts b/packages/beacon-node/test/perf/chain/opPools/opPool.test.ts index 9d518c03eec9..d685ec36c6b7 100644 --- a/packages/beacon-node/test/perf/chain/opPools/opPool.test.ts +++ b/packages/beacon-node/test/perf/chain/opPools/opPool.test.ts @@ -8,6 +8,7 @@ import { import {CachedBeaconStateAltair} from "@lodestar/state-transition"; import {ssz} from "@lodestar/types"; import {generatePerfTestCachedStateAltair} from "../../../../../state-transition/test/perf/util.js"; +import {BlockType} from "../../../../src/chain/interface.js"; import {OpPool} from "../../../../src/chain/opPools/opPool.js"; import {generateBlsToExecutionChanges} from "../../../fixtures/capella.js"; import { @@ -15,7 +16,6 @@ import { generateSignedBeaconBlockHeader, generateVoluntaryExits, } from "../../../fixtures/phase0.js"; -import {BlockType} from "../../../../src/chain/interface.js"; describe("opPool", () => { let originalState: CachedBeaconStateAltair; diff --git a/packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts b/packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts index c08cf64fc974..6d411ca09cd5 100644 --- a/packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts +++ b/packages/beacon-node/test/perf/chain/produceBlock/produceBlockBody.test.ts @@ -3,14 +3,14 @@ import {itBench} from "@dapplion/benchmark"; import {config} from "@lodestar/config/default"; import {LevelDbController} from "@lodestar/db"; import {SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY} from "@lodestar/params"; -import {defaultOptions as defaultValidatorOptions} from "@lodestar/validator"; import {CachedBeaconStateAltair} from "@lodestar/state-transition"; +import {defaultOptions as defaultValidatorOptions} from "@lodestar/validator"; import {generatePerfTestCachedStateAltair} from "../../../../../state-transition/test/perf/util.js"; import {BeaconChain} from "../../../../src/chain/index.js"; import {BlockType, produceBlockBody} from "../../../../src/chain/produceBlock/produceBlockBody.js"; import {Eth1ForBlockProductionDisabled} from "../../../../src/eth1/index.js"; import {ExecutionEngineDisabled} from "../../../../src/execution/engine/index.js"; -import {StateArchiveMode, BeaconDb} from "../../../../src/index.js"; +import {BeaconDb, StateArchiveMode} from "../../../../src/index.js"; import {testLogger} from "../../../utils/logger.js"; const logger = testLogger(); diff --git a/packages/beacon-node/test/perf/chain/seenCache/seenAggregateAndProof.test.ts b/packages/beacon-node/test/perf/chain/seenCache/seenAggregateAndProof.test.ts index 49c3123c14dd..b119fccdd562 100644 --- a/packages/beacon-node/test/perf/chain/seenCache/seenAggregateAndProof.test.ts +++ b/packages/beacon-node/test/perf/chain/seenCache/seenAggregateAndProof.test.ts @@ -1,5 +1,5 @@ -import {itBench} from "@dapplion/benchmark"; import {BitArray} from "@chainsafe/ssz"; +import {itBench} from "@dapplion/benchmark"; import {TARGET_AGGREGATORS_PER_COMMITTEE} from "@lodestar/params"; import {SeenAggregatedAttestations} from "../../../../src/chain/seenCache/seenAggregateAndProof.js"; diff --git a/packages/beacon-node/test/perf/chain/stateCache/inMemoryCheckpointsCache.test.ts b/packages/beacon-node/test/perf/chain/stateCache/inMemoryCheckpointsCache.test.ts index 17a46b09af8d..9f3db45cb827 100644 --- a/packages/beacon-node/test/perf/chain/stateCache/inMemoryCheckpointsCache.test.ts +++ b/packages/beacon-node/test/perf/chain/stateCache/inMemoryCheckpointsCache.test.ts @@ -1,8 +1,8 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; -import {ssz, phase0} from "@lodestar/types"; -import {generateCachedState} from "../../../utils/state.js"; +import {phase0, ssz} from "@lodestar/types"; import {InMemoryCheckpointStateCache, toCheckpointHex} from "../../../../src/chain/stateCache/index.js"; +import {generateCachedState} from "../../../utils/state.js"; describe("InMemoryCheckpointStateCache perf tests", () => { setBenchOpts({noThreshold: true}); diff --git a/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts b/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts index a4bdbe9710cb..8009f36c6301 100644 --- a/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts +++ b/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts @@ -1,13 +1,13 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; -import {Map as ImmutableMap} from "immutable"; -import {toBufferBE} from "bigint-buffer"; import {digest} from "@chainsafe/as-sha256"; import {SecretKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {ValidatorIndex, ssz} from "@lodestar/types"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {type CachedBeaconStateAllForks, toMemoryEfficientHexStr} from "@lodestar/state-transition"; +import {ValidatorIndex, ssz} from "@lodestar/types"; import {bytesToBigInt, intToBytes} from "@lodestar/utils"; -import {InMemoryCheckpointStateCache, BlockStateCacheImpl} from "../../../../src/chain/stateCache/index.js"; +import {toBufferBE} from "bigint-buffer"; +import {Map as ImmutableMap} from "immutable"; +import {BlockStateCacheImpl, InMemoryCheckpointStateCache} from "../../../../src/chain/stateCache/index.js"; import {BlockStateCache} from "../../../../src/chain/stateCache/types.js"; import {generateCachedElectraState} from "../../../utils/state.js"; diff --git a/packages/beacon-node/test/perf/chain/validation/attestation.test.ts b/packages/beacon-node/test/perf/chain/validation/attestation.test.ts index 696b6bdb1871..4814c59cce9a 100644 --- a/packages/beacon-node/test/perf/chain/validation/attestation.test.ts +++ b/packages/beacon-node/test/perf/chain/validation/attestation.test.ts @@ -1,10 +1,10 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; -import {expect} from "chai"; import {ssz} from "@lodestar/types"; +import {expect} from "chai"; import {generateTestCachedBeaconStateOnlyValidators} from "../../../../../state-transition/test/perf/util.js"; import {validateGossipAttestationsSameAttData} from "../../../../src/chain/validation/index.js"; -import {getAttestationValidData} from "../../../utils/validationData/attestation.js"; import {getAttDataFromAttestationSerialized} from "../../../../src/util/sszBytes.js"; +import {getAttestationValidData} from "../../../utils/validationData/attestation.js"; describe("validate gossip attestation", () => { setBenchOpts({ diff --git a/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts b/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts index 6f1cf2ef3da6..35165aa3c38f 100644 --- a/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts +++ b/packages/beacon-node/test/perf/chain/verifyImportBlocks.test.ts @@ -1,19 +1,19 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {config} from "@lodestar/config/default"; -import {SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY, SLOTS_PER_EPOCH} from "@lodestar/params"; import {LevelDbController} from "@lodestar/db"; +import {SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY, SLOTS_PER_EPOCH} from "@lodestar/params"; import {sleep} from "@lodestar/utils"; import {defaultOptions as defaultValidatorOptions} from "@lodestar/validator"; import {rangeSyncTest} from "../../../../state-transition/test/perf/params.js"; -import {getNetworkCachedState, getNetworkCachedBlock} from "../../../../state-transition/test/utils/testFileCache.js"; import {beforeValue} from "../../../../state-transition/test/utils/beforeValueMocha.js"; +import {getNetworkCachedBlock, getNetworkCachedState} from "../../../../state-transition/test/utils/testFileCache.js"; +import {AttestationImportOpt, BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; import {BeaconChain} from "../../../src/chain/index.js"; -import {ExecutionEngineDisabled} from "../../../src/execution/engine/index.js"; import {Eth1ForBlockProductionDisabled} from "../../../src/eth1/index.js"; -import {testLogger} from "../../utils/logger.js"; +import {ExecutionEngineDisabled} from "../../../src/execution/engine/index.js"; +import {BeaconDb, StateArchiveMode} from "../../../src/index.js"; import {linspace} from "../../../src/util/numpy.js"; -import {StateArchiveMode, BeaconDb} from "../../../src/index.js"; -import {getBlockInput, AttestationImportOpt, BlockSource} from "../../../src/chain/blocks/types.js"; +import {testLogger} from "../../utils/logger.js"; // Define this params in `packages/state-transition/test/perf/params.ts` // to trigger Github actions CI cache diff --git a/packages/beacon-node/test/perf/eth1/pickEth1Vote.test.ts b/packages/beacon-node/test/perf/eth1/pickEth1Vote.test.ts index 20efeefe0923..dfc5fb560b27 100644 --- a/packages/beacon-node/test/perf/eth1/pickEth1Vote.test.ts +++ b/packages/beacon-node/test/perf/eth1/pickEth1Vote.test.ts @@ -1,7 +1,7 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {ContainerType, ListCompositeType} from "@chainsafe/ssz"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; +import {BeaconStateAllForks, newFilledArray} from "@lodestar/state-transition"; import {phase0, ssz} from "@lodestar/types"; -import {newFilledArray, BeaconStateAllForks} from "@lodestar/state-transition"; import {fastSerializeEth1Data, pickEth1Vote} from "../../../src/eth1/utils/eth1Vote.js"; describe("eth1 / pickEth1Vote", () => { diff --git a/packages/beacon-node/test/perf/misc/bytesHex.test.ts b/packages/beacon-node/test/perf/misc/bytesHex.test.ts index aa4443a65a61..bb5e2b252960 100644 --- a/packages/beacon-node/test/perf/misc/bytesHex.test.ts +++ b/packages/beacon-node/test/perf/misc/bytesHex.test.ts @@ -1,6 +1,6 @@ import crypto from "node:crypto"; -import {itBench} from "@dapplion/benchmark"; import {toHexString} from "@chainsafe/ssz"; +import {itBench} from "@dapplion/benchmark"; // Results in Linux Dec 2021 // diff --git a/packages/beacon-node/test/perf/network/gossip/fastMsgIdFn.test.ts b/packages/beacon-node/test/perf/network/gossip/fastMsgIdFn.test.ts index 4daeb64f5d79..3b31e38655db 100644 --- a/packages/beacon-node/test/perf/network/gossip/fastMsgIdFn.test.ts +++ b/packages/beacon-node/test/perf/network/gossip/fastMsgIdFn.test.ts @@ -1,7 +1,7 @@ import {randomBytes} from "node:crypto"; -import xxhashFactory from "xxhash-wasm"; -import {itBench} from "@dapplion/benchmark"; import {digest} from "@chainsafe/as-sha256"; +import {itBench} from "@dapplion/benchmark"; +import xxhashFactory from "xxhash-wasm"; const hasher = await xxhashFactory(); diff --git a/packages/beacon-node/test/perf/network/noise/sendData.test.ts b/packages/beacon-node/test/perf/network/noise/sendData.test.ts index 35538a417adf..ee4d734fd5cb 100644 --- a/packages/beacon-node/test/perf/network/noise/sendData.test.ts +++ b/packages/beacon-node/test/perf/network/noise/sendData.test.ts @@ -1,10 +1,10 @@ +import {noise} from "@chainsafe/libp2p-noise"; import {itBench} from "@dapplion/benchmark"; -import {duplexPair} from "it-pair/duplex"; +import {defaultLogger} from "@libp2p/logger"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; -import {pipe} from "it-pipe"; import drain from "it-drain"; -import {defaultLogger} from "@libp2p/logger"; -import {noise} from "@chainsafe/libp2p-noise"; +import {duplexPair} from "it-pair/duplex"; +import {pipe} from "it-pipe"; import {Uint8ArrayList} from "uint8arraylist"; describe("network / noise / sendData", () => { diff --git a/packages/beacon-node/test/perf/network/peers/enrSubnetsDeserialize.test.ts b/packages/beacon-node/test/perf/network/peers/enrSubnetsDeserialize.test.ts index 2507c43bcc9c..ffe22cf5bac5 100644 --- a/packages/beacon-node/test/perf/network/peers/enrSubnetsDeserialize.test.ts +++ b/packages/beacon-node/test/perf/network/peers/enrSubnetsDeserialize.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; -import {expect} from "chai"; -import {SYNC_COMMITTEE_SUBNET_COUNT, ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; +import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {ssz} from "@lodestar/types"; +import {expect} from "chai"; import {deserializeEnrSubnets} from "../../../../src/network/peers/utils/enrSubnetsDeserialize.js"; /** diff --git a/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts b/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts index d5a6b4e9cb25..a8d6365be691 100644 --- a/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts +++ b/packages/beacon-node/test/perf/network/peers/util/prioritizePeers.test.ts @@ -4,7 +4,7 @@ import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {ATTESTATION_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {altair, phase0} from "@lodestar/types"; import {defaultNetworkOptions} from "../../../../../src/network/options.js"; -import {prioritizePeers, RequestedSubnet} from "../../../../../src/network/peers/utils/index.js"; +import {RequestedSubnet, prioritizePeers} from "../../../../../src/network/peers/utils/index.js"; import {getAttnets, getSyncnets} from "../../../../utils/network.js"; describe("prioritizePeers", () => { diff --git a/packages/beacon-node/test/perf/util/bitArray.test.ts b/packages/beacon-node/test/perf/util/bitArray.test.ts index fe421a8f9bd8..fae525def3c4 100644 --- a/packages/beacon-node/test/perf/util/bitArray.test.ts +++ b/packages/beacon-node/test/perf/util/bitArray.test.ts @@ -1,6 +1,6 @@ import crypto from "node:crypto"; -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {BitArray} from "@chainsafe/ssz"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {intersectUint8Arrays} from "../../../src/util/bitArray.js"; /** diff --git a/packages/beacon-node/test/setupPreset.ts b/packages/beacon-node/test/setupPreset.ts index 968c6e12c668..7d64d1336ed5 100644 --- a/packages/beacon-node/test/setupPreset.ts +++ b/packages/beacon-node/test/setupPreset.ts @@ -1,4 +1,4 @@ -import {setActivePreset, PresetName} from "@lodestar/params/setPreset"; +import {PresetName, setActivePreset} from "@lodestar/params/setPreset"; // Set minimal if (process.env.LODESTAR_PRESET === undefined) { process.env.LODESTAR_PRESET = "minimal"; diff --git a/packages/beacon-node/test/sim/electra-interop.test.ts b/packages/beacon-node/test/sim/electra-interop.test.ts index 20fedd3d4b0f..47b7d127fb42 100644 --- a/packages/beacon-node/test/sim/electra-interop.test.ts +++ b/packages/beacon-node/test/sim/electra-interop.test.ts @@ -1,29 +1,29 @@ -import fs from "node:fs"; import assert from "node:assert"; -import {describe, it, vi, afterAll, afterEach} from "vitest"; +import fs from "node:fs"; +import {afterAll, afterEach, describe, it, vi} from "vitest"; -import {LogLevel, sleep} from "@lodestar/utils"; import {ForkName, SLOTS_PER_EPOCH, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params"; -import {electra, Epoch, Slot} from "@lodestar/types"; +import {Epoch, Slot, electra} from "@lodestar/types"; +import {LogLevel, sleep} from "@lodestar/utils"; import {ValidatorProposerConfig} from "@lodestar/validator"; import {ChainConfig} from "@lodestar/config"; import {TimestampFormatCode} from "@lodestar/logger"; import {CachedBeaconStateElectra} from "@lodestar/state-transition"; -import {initializeExecutionEngine} from "../../src/execution/index.js"; import {ExecutionPayloadStatus, PayloadAttributes} from "../../src/execution/engine/interface.js"; +import {initializeExecutionEngine} from "../../src/execution/index.js"; -import {testLogger, TestLoggerOpts} from "../utils/logger.js"; -import {runEL, ELStartMode, ELClient, sendRawTransactionBig} from "../utils/runEl.js"; +import {bytesToData} from "../../lib/eth1/provider/utils.js"; +import {BeaconRestApiServerOpts} from "../../src/api/index.js"; +import {dataToBytes} from "../../src/eth1/provider/utils.js"; import {defaultExecutionEngineHttpOpts} from "../../src/execution/engine/http.js"; +import {BeaconNode} from "../../src/index.js"; +import {ClockEvent} from "../../src/util/clock.js"; +import {TestLoggerOpts, testLogger} from "../utils/logger.js"; import {getDevBeaconNode} from "../utils/node/beacon.js"; -import {BeaconRestApiServerOpts} from "../../src/api/index.js"; import {simTestInfoTracker} from "../utils/node/simTest.js"; import {getAndInitDevValidators} from "../utils/node/validator.js"; -import {ClockEvent} from "../../src/util/clock.js"; -import {dataToBytes} from "../../src/eth1/provider/utils.js"; -import {bytesToData} from "../../lib/eth1/provider/utils.js"; -import {BeaconNode} from "../../src/index.js"; +import {ELClient, ELStartMode, runEL, sendRawTransactionBig} from "../utils/runEl.js"; import {logFilesDir} from "./params.js"; import {shell} from "./shell.js"; diff --git a/packages/beacon-node/test/sim/mergemock.test.ts b/packages/beacon-node/test/sim/mergemock.test.ts index 64020b070e11..230856291f64 100644 --- a/packages/beacon-node/test/sim/mergemock.test.ts +++ b/packages/beacon-node/test/sim/mergemock.test.ts @@ -1,23 +1,23 @@ import fs from "node:fs"; -import {describe, it, afterAll, afterEach, vi} from "vitest"; import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {LogLevel, sleep} from "@lodestar/utils"; +import {routes} from "@lodestar/api"; +import {ChainConfig} from "@lodestar/config"; import {TimestampFormatCode} from "@lodestar/logger"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {ChainConfig} from "@lodestar/config"; import {Epoch, SignedBeaconBlock, bellatrix} from "@lodestar/types"; +import {LogLevel, sleep} from "@lodestar/utils"; import {ValidatorProposerConfig} from "@lodestar/validator"; -import {routes} from "@lodestar/api"; +import {afterAll, afterEach, describe, it, vi} from "vitest"; +import {BeaconRestApiServerOpts} from "../../src/api/index.js"; +import {ZERO_HASH} from "../../src/constants/index.js"; +import {Eth1Provider} from "../../src/index.js"; import {ClockEvent} from "../../src/util/clock.js"; -import {testLogger, TestLoggerOpts} from "../utils/logger.js"; +import {TestLoggerOpts, testLogger} from "../utils/logger.js"; import {getDevBeaconNode} from "../utils/node/beacon.js"; -import {BeaconRestApiServerOpts} from "../../src/api/index.js"; import {simTestInfoTracker} from "../utils/node/simTest.js"; import {getAndInitDevValidators} from "../utils/node/validator.js"; -import {Eth1Provider} from "../../src/index.js"; -import {ZERO_HASH} from "../../src/constants/index.js"; -import {runEL, ELStartMode, ELClient} from "../utils/runEl.js"; +import {ELClient, ELStartMode, runEL} from "../utils/runEl.js"; import {logFilesDir} from "./params.js"; import {shell} from "./shell.js"; diff --git a/packages/beacon-node/test/spec/bls/bls.ts b/packages/beacon-node/test/spec/bls/bls.ts index 76c511215b61..61c86e69b47e 100644 --- a/packages/beacon-node/test/spec/bls/bls.ts +++ b/packages/beacon-node/test/spec/bls/bls.ts @@ -2,11 +2,11 @@ import { PublicKey, SecretKey, Signature, + verify as _verify, aggregateSignatures, aggregateVerify, fastAggregateVerify, verifyMultipleAggregateSignatures, - verify as _verify, } from "@chainsafe/blst"; import {fromHexString} from "@chainsafe/ssz"; diff --git a/packages/beacon-node/test/spec/bls/index.test.ts b/packages/beacon-node/test/spec/bls/index.test.ts index 32baa00d9fbc..cf1da723698f 100644 --- a/packages/beacon-node/test/spec/bls/index.test.ts +++ b/packages/beacon-node/test/spec/bls/index.test.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import jsyaml from "js-yaml"; -import {expect, describe, it} from "vitest"; +import {describe, expect, it} from "vitest"; import {blsSpecTests} from "../specTestVersioning.js"; import {readdirSyncSpec} from "../utils/specTestIterator.js"; import {testFnByType} from "./bls.js"; diff --git a/packages/beacon-node/test/spec/downloadTests.ts b/packages/beacon-node/test/spec/downloadTests.ts index 57efd3ca2183..7790e52ea9e1 100644 --- a/packages/beacon-node/test/spec/downloadTests.ts +++ b/packages/beacon-node/test/spec/downloadTests.ts @@ -1,5 +1,5 @@ import {downloadTests} from "@lodestar/spec-test-util/downloadTests"; -import {ethereumConsensusSpecsTests, blsSpecTests} from "./specTestVersioning.js"; +import {blsSpecTests, ethereumConsensusSpecsTests} from "./specTestVersioning.js"; /* eslint-disable no-console */ diff --git a/packages/beacon-node/test/spec/general/bls.ts b/packages/beacon-node/test/spec/general/bls.ts index 128b5b4f5613..7d4a94481025 100644 --- a/packages/beacon-node/test/spec/general/bls.ts +++ b/packages/beacon-node/test/spec/general/bls.ts @@ -1,14 +1,14 @@ -import {fromHexString} from "@chainsafe/ssz"; import { + aggregateVerify as BLSAggregateVerify, + fastAggregateVerify as BLSFastAggregateVerify, PublicKey, SecretKey, Signature, + verify as _verify, aggregateSerializedPublicKeys, aggregateSignatures, - aggregateVerify as BLSAggregateVerify, - fastAggregateVerify as BLSFastAggregateVerify, - verify as _verify, } from "@chainsafe/blst"; +import {fromHexString} from "@chainsafe/ssz"; import {InputType} from "@lodestar/spec-test-util"; import {TestRunnerFn} from "../utils/types.js"; diff --git a/packages/beacon-node/test/spec/general/index.test.ts b/packages/beacon-node/test/spec/general/index.test.ts index 063f128c3142..c539061d217e 100644 --- a/packages/beacon-node/test/spec/general/index.test.ts +++ b/packages/beacon-node/test/spec/general/index.test.ts @@ -1,7 +1,7 @@ import path from "node:path"; -import {RunnerType} from "../utils/types.js"; -import {SkipOpts, specTestIterator} from "../utils/specTestIterator.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {SkipOpts, specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType} from "../utils/types.js"; import {blsTestRunner} from "./bls.js"; import {sszGeneric} from "./ssz_generic.js"; diff --git a/packages/beacon-node/test/spec/general/ssz_generic.ts b/packages/beacon-node/test/spec/general/ssz_generic.ts index 64e6b4455941..6cfb7686c9e7 100644 --- a/packages/beacon-node/test/spec/general/ssz_generic.ts +++ b/packages/beacon-node/test/spec/general/ssz_generic.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; import path from "node:path"; import {expect, it} from "vitest"; -import {TestRunnerCustom} from "../utils/types.js"; -import {parseSszGenericInvalidTestcase, parseSszGenericValidTestcase} from "../utils/sszTestCaseParser.js"; import {runValidSszTest} from "../utils/runValidSszTest.js"; +import {parseSszGenericInvalidTestcase, parseSszGenericValidTestcase} from "../utils/sszTestCaseParser.js"; +import {TestRunnerCustom} from "../utils/types.js"; import {getTestType} from "./ssz_generic_types.js"; // Mapping of sszGeneric() fn arguments to the path in spec tests diff --git a/packages/beacon-node/test/spec/general/ssz_generic_types.ts b/packages/beacon-node/test/spec/general/ssz_generic_types.ts index fe19f08149b4..2386f770fe60 100644 --- a/packages/beacon-node/test/spec/general/ssz_generic_types.ts +++ b/packages/beacon-node/test/spec/general/ssz_generic_types.ts @@ -1,12 +1,12 @@ import { - Type, - BooleanType, - UintBigintType, - UintNumberType, - BitVectorType, BitListType, + BitVectorType, + BooleanType, ContainerType, ListBasicType, + Type, + UintBigintType, + UintNumberType, VectorBasicType, VectorCompositeType, } from "@chainsafe/ssz"; diff --git a/packages/beacon-node/test/spec/presets/epoch_processing.test.ts b/packages/beacon-node/test/spec/presets/epoch_processing.test.ts index c61aec40fee3..05ce8c4c70e3 100644 --- a/packages/beacon-node/test/spec/presets/epoch_processing.test.ts +++ b/packages/beacon-node/test/spec/presets/epoch_processing.test.ts @@ -1,22 +1,22 @@ import path from "node:path"; -import {expect} from "vitest"; +import {ACTIVE_PRESET} from "@lodestar/params"; import { + BeaconStateAllForks, CachedBeaconStateAllForks, + CachedBeaconStateAltair, EpochTransitionCache, - BeaconStateAllForks, beforeProcessEpoch, - CachedBeaconStateAltair, } from "@lodestar/state-transition"; import * as epochFns from "@lodestar/state-transition/epoch"; import {ssz} from "@lodestar/types"; -import {ACTIVE_PRESET} from "@lodestar/params"; +import {expect} from "vitest"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {getConfig} from "../../utils/config.js"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; export type EpochTransitionFn = (state: CachedBeaconStateAllForks, epochTransitionCache: EpochTransitionCache) => void; diff --git a/packages/beacon-node/test/spec/presets/finality.test.ts b/packages/beacon-node/test/spec/presets/finality.test.ts index 1dce91e360e5..a183d7c2197a 100644 --- a/packages/beacon-node/test/spec/presets/finality.test.ts +++ b/packages/beacon-node/test/spec/presets/finality.test.ts @@ -1,4 +1,5 @@ import path from "node:path"; +import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import { BeaconStateAllForks, DataAvailableStatus, @@ -6,14 +7,13 @@ import { stateTransition, } from "@lodestar/state-transition"; import {altair, bellatrix, ssz} from "@lodestar/types"; -import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; -import {RunnerType, shouldVerify, TestRunnerFn} from "../utils/types.js"; import {getConfig} from "../../utils/config.js"; import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn, shouldVerify} from "../utils/types.js"; const finality: TestRunnerFn = (fork) => { return { diff --git a/packages/beacon-node/test/spec/presets/fork.test.ts b/packages/beacon-node/test/spec/presets/fork.test.ts index 626d6477bcb1..bc66bccb279e 100644 --- a/packages/beacon-node/test/spec/presets/fork.test.ts +++ b/packages/beacon-node/test/spec/presets/fork.test.ts @@ -1,21 +1,21 @@ import path from "node:path"; +import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; +import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import { BeaconStateAllForks, - CachedBeaconStateBellatrix, CachedBeaconStateAltair, - CachedBeaconStatePhase0, + CachedBeaconStateBellatrix, CachedBeaconStateCapella, CachedBeaconStateDeneb, + CachedBeaconStatePhase0, } from "@lodestar/state-transition"; import * as slotFns from "@lodestar/state-transition/slot"; import {phase0, ssz} from "@lodestar/types"; -import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; -import {createChainForkConfig, ChainForkConfig} from "@lodestar/config"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; const fork: TestRunnerFn = (forkNext) => { const config = createChainForkConfig({}); diff --git a/packages/beacon-node/test/spec/presets/fork_choice.test.ts b/packages/beacon-node/test/spec/presets/fork_choice.test.ts index 72515e703582..a12e6e0ac467 100644 --- a/packages/beacon-node/test/spec/presets/fork_choice.test.ts +++ b/packages/beacon-node/test/spec/presets/fork_choice.test.ts @@ -1,50 +1,50 @@ import path from "node:path"; -import {expect} from "vitest"; import {toHexString} from "@chainsafe/ssz"; -import {BeaconStateAllForks, isExecutionStateType, signedBlockToSignedHeader} from "@lodestar/state-transition"; -import {InputType} from "@lodestar/spec-test-util"; +import {createBeaconConfig} from "@lodestar/config"; import {CheckpointWithHex, ForkChoice} from "@lodestar/fork-choice"; +import {ACTIVE_PRESET, ForkName, ForkSeq, isForkBlobs} from "@lodestar/params"; +import {InputType} from "@lodestar/spec-test-util"; +import {BeaconStateAllForks, isExecutionStateType, signedBlockToSignedHeader} from "@lodestar/state-transition"; import { - bellatrix, - ssz, - RootHex, - deneb, + Attestation, + AttesterSlashing, BeaconBlock, + RootHex, SignedBeaconBlock, + bellatrix, + deneb, + ssz, sszTypesFor, - Attestation, - AttesterSlashing, } from "@lodestar/types"; import {bnToNum, fromHex} from "@lodestar/utils"; -import {createBeaconConfig} from "@lodestar/config"; -import {ACTIVE_PRESET, ForkSeq, isForkBlobs, ForkName} from "@lodestar/params"; -import {BeaconChain, ChainEvent} from "../../../src/chain/index.js"; -import {ClockEvent} from "../../../src/util/clock.js"; -import {computeInclusionProof} from "../../../src/util/blobs.js"; -import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {testLogger} from "../../utils/logger.js"; -import {getConfig} from "../../utils/config.js"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; -import {Eth1ForBlockProductionDisabled} from "../../../src/eth1/index.js"; -import {getExecutionEngineFromBackend} from "../../../src/execution/index.js"; -import {ExecutionPayloadStatus} from "../../../src/execution/engine/interface.js"; -import {ExecutionEngineMockBackend} from "../../../src/execution/engine/mock.js"; -import {defaultChainOptions} from "../../../src/chain/options.js"; -import {getMockedBeaconDb} from "../../mocks/mockedBeaconDb.js"; -import {ClockStopped} from "../../mocks/clock.js"; +import {expect} from "vitest"; import { - getBlockInput, AttestationImportOpt, - BlockSource, BlobSidecarValidation, BlobsSource, + BlockSource, + getBlockInput, } from "../../../src/chain/blocks/types.js"; +import {BeaconChain, ChainEvent} from "../../../src/chain/index.js"; +import {defaultChainOptions} from "../../../src/chain/options.js"; import {ZERO_HASH_HEX} from "../../../src/constants/constants.js"; +import {Eth1ForBlockProductionDisabled} from "../../../src/eth1/index.js"; import {PowMergeBlock} from "../../../src/eth1/interface.js"; -import {assertCorrectProgressiveBalances} from "../config.js"; +import {ExecutionPayloadStatus} from "../../../src/execution/engine/interface.js"; +import {ExecutionEngineMockBackend} from "../../../src/execution/engine/mock.js"; +import {getExecutionEngineFromBackend} from "../../../src/execution/index.js"; +import {computeInclusionProof} from "../../../src/util/blobs.js"; +import {ClockEvent} from "../../../src/util/clock.js"; import {initCKZG, loadEthereumTrustedSetup} from "../../../src/util/kzg.js"; +import {ClockStopped} from "../../mocks/clock.js"; +import {getMockedBeaconDb} from "../../mocks/mockedBeaconDb.js"; +import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; +import {getConfig} from "../../utils/config.js"; +import {testLogger} from "../../utils/logger.js"; +import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; const ANCHOR_STATE_FILE_NAME = "anchor_state"; const ANCHOR_BLOCK_FILE_NAME = "anchor_block"; diff --git a/packages/beacon-node/test/spec/presets/genesis.test.ts b/packages/beacon-node/test/spec/presets/genesis.test.ts index 140fa3686e67..7b19e205dc05 100644 --- a/packages/beacon-node/test/spec/presets/genesis.test.ts +++ b/packages/beacon-node/test/spec/presets/genesis.test.ts @@ -1,6 +1,5 @@ import path from "node:path"; -import {expect} from "vitest"; -import {phase0, Root, ssz, TimeSeconds, ExecutionPayloadHeader, sszTypesFor} from "@lodestar/types"; +import {ForkName} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; import { BeaconStateAllForks, @@ -8,17 +7,18 @@ import { initializeBeaconStateFromEth1, isValidGenesisState, } from "@lodestar/state-transition"; +import {ExecutionPayloadHeader, Root, TimeSeconds, phase0, ssz, sszTypesFor} from "@lodestar/types"; import {bnToNum} from "@lodestar/utils"; -import {ForkName} from "@lodestar/params"; +import {expect} from "vitest"; import {ACTIVE_PRESET} from "@lodestar/params"; +import {getConfig} from "../../utils/config.js"; import {expectEqualBeaconState} from "../utils/expectEqualBeaconState.js"; import {TestRunnerFn} from "../utils/types.js"; -import {getConfig} from "../../utils/config.js"; -import {RunnerType} from "../utils/types.js"; -import {specTestIterator} from "../utils/specTestIterator.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType} from "../utils/types.js"; // The aim of the genesis tests is to provide a baseline to test genesis-state initialization and test if the // proposed genesis-validity conditions are working. diff --git a/packages/beacon-node/test/spec/presets/light_client/single_merkle_proof.ts b/packages/beacon-node/test/spec/presets/light_client/single_merkle_proof.ts index 08dcd0ab8acf..3aa73f72ee40 100644 --- a/packages/beacon-node/test/spec/presets/light_client/single_merkle_proof.ts +++ b/packages/beacon-node/test/spec/presets/light_client/single_merkle_proof.ts @@ -1,10 +1,10 @@ -import {expect} from "vitest"; import {Tree} from "@chainsafe/persistent-merkle-tree"; import {TreeViewDU, Type} from "@chainsafe/ssz"; -import {RootHex, ssz} from "@lodestar/types"; -import {InputType} from "@lodestar/spec-test-util"; import {ForkName} from "@lodestar/params"; +import {InputType} from "@lodestar/spec-test-util"; +import {RootHex, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; +import {expect} from "vitest"; import {TestRunnerFn} from "../../utils/types.js"; // https://github.com/ethereum/consensus-specs/blob/da3f5af919be4abb5a6db5a80b235deb8b4b5cba/tests/formats/light_client/single_merkle_proof.md 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 3e82256fab1d..5ac51b95de3b 100644 --- a/packages/beacon-node/test/spec/presets/light_client/sync.ts +++ b/packages/beacon-node/test/spec/presets/light_client/sync.ts @@ -1,13 +1,13 @@ -import {expect} from "vitest"; +import {ChainConfig, createBeaconConfig} from "@lodestar/config"; +import {LightclientSpec, toLightClientUpdateSummary} from "@lodestar/light-client/spec"; import {isForkLightClient} from "@lodestar/params"; -import {altair, phase0, RootHex, Slot, ssz, sszTypesFor} from "@lodestar/types"; import {InputType} from "@lodestar/spec-test-util"; -import {createBeaconConfig, ChainConfig} from "@lodestar/config"; -import {fromHex, toHex} from "@lodestar/utils"; -import {LightclientSpec, toLightClientUpdateSummary} from "@lodestar/light-client/spec"; import {computeSyncPeriodAtSlot} from "@lodestar/state-transition"; -import {TestRunnerFn} from "../../utils/types.js"; +import {RootHex, Slot, altair, phase0, ssz, sszTypesFor} from "@lodestar/types"; +import {fromHex, toHex} from "@lodestar/utils"; +import {expect} from "vitest"; import {testLogger} from "../../../utils/logger.js"; +import {TestRunnerFn} from "../../utils/types.js"; // https://github.com/ethereum/consensus-specs/blob/da3f5af919be4abb5a6db5a80b235deb8b4b5cba/tests/formats/light_client/single_merkle_proof.md type SyncTestCase = { diff --git a/packages/beacon-node/test/spec/presets/light_client/update_ranking.ts b/packages/beacon-node/test/spec/presets/light_client/update_ranking.ts index b51219dd4e54..97cd7639a176 100644 --- a/packages/beacon-node/test/spec/presets/light_client/update_ranking.ts +++ b/packages/beacon-node/test/spec/presets/light_client/update_ranking.ts @@ -1,8 +1,8 @@ -import {expect} from "vitest"; -import {LightClientUpdate, altair, ssz, sszTypesFor} from "@lodestar/types"; +import {LightClientUpdateSummary, isBetterUpdate, toLightClientUpdateSummary} from "@lodestar/light-client/spec"; import {isForkLightClient} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; -import {isBetterUpdate, LightClientUpdateSummary, toLightClientUpdateSummary} from "@lodestar/light-client/spec"; +import {LightClientUpdate, altair, ssz, sszTypesFor} from "@lodestar/types"; +import {expect} from "vitest"; import {TestRunnerFn} from "../../utils/types.js"; // https://github.com/ethereum/consensus-specs/blob/da3f5af919be4abb5a6db5a80b235deb8b4b5cba/tests/formats/light_client/update_ranking.md diff --git a/packages/beacon-node/test/spec/presets/merkle.test.ts b/packages/beacon-node/test/spec/presets/merkle.test.ts index 71cebdbd0b5b..2bc70374bdf5 100644 --- a/packages/beacon-node/test/spec/presets/merkle.test.ts +++ b/packages/beacon-node/test/spec/presets/merkle.test.ts @@ -1,15 +1,15 @@ import path from "node:path"; -import {expect} from "vitest"; import {ProofType, SingleProof, Tree} from "@chainsafe/persistent-merkle-tree"; import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; -import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {ACTIVE_PRESET} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; +import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; import {verifyMerkleBranch} from "@lodestar/utils"; -import {ACTIVE_PRESET} from "@lodestar/params"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; +import {expect} from "vitest"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; const merkle: TestRunnerFn = (fork) => { return { diff --git a/packages/beacon-node/test/spec/presets/operations.test.ts b/packages/beacon-node/test/spec/presets/operations.test.ts index 4c90831ef155..0a9996c0a2b1 100644 --- a/packages/beacon-node/test/spec/presets/operations.test.ts +++ b/packages/beacon-node/test/spec/presets/operations.test.ts @@ -1,4 +1,6 @@ import path from "node:path"; +import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; +import {InputType} from "@lodestar/spec-test-util"; import { BeaconStateAllForks, CachedBeaconStateAllForks, @@ -9,16 +11,14 @@ import { getBlockRootAtSlot, } from "@lodestar/state-transition"; import * as blockFns from "@lodestar/state-transition/block"; -import {ssz, phase0, altair, bellatrix, capella, electra, sszTypesFor} from "@lodestar/types"; -import {InputType} from "@lodestar/spec-test-util"; -import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; +import {altair, bellatrix, capella, electra, phase0, ssz, sszTypesFor} from "@lodestar/types"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {getConfig} from "../../utils/config.js"; -import {BaseSpecTest, RunnerType, shouldVerify, TestRunnerFn} from "../utils/types.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {BaseSpecTest, RunnerType, TestRunnerFn, shouldVerify} from "../utils/types.js"; // Define above to re-use in sync_aggregate and sync_aggregate_random const syncAggregate: BlockProcessFn = ( diff --git a/packages/beacon-node/test/spec/presets/rewards.test.ts b/packages/beacon-node/test/spec/presets/rewards.test.ts index df43c8ca612e..299bf208eb62 100644 --- a/packages/beacon-node/test/spec/presets/rewards.test.ts +++ b/packages/beacon-node/test/spec/presets/rewards.test.ts @@ -1,17 +1,17 @@ import path from "node:path"; -import {expect} from "vitest"; import {VectorCompositeType} from "@chainsafe/ssz"; +import {ACTIVE_PRESET} from "@lodestar/params"; import {BeaconStateAllForks, beforeProcessEpoch} from "@lodestar/state-transition"; import {getRewardsAndPenalties} from "@lodestar/state-transition/epoch"; import {ssz} from "@lodestar/types"; -import {ACTIVE_PRESET} from "@lodestar/params"; +import {expect} from "vitest"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {getConfig} from "../../utils/config.js"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; const deltasType = new VectorCompositeType(ssz.phase0.Balances, 2); diff --git a/packages/beacon-node/test/spec/presets/sanity.test.ts b/packages/beacon-node/test/spec/presets/sanity.test.ts index cd266483c7f8..223587d63ccc 100644 --- a/packages/beacon-node/test/spec/presets/sanity.test.ts +++ b/packages/beacon-node/test/spec/presets/sanity.test.ts @@ -1,4 +1,5 @@ import path from "node:path"; +import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; import { BeaconStateAllForks, @@ -8,15 +9,14 @@ import { stateTransition, } from "@lodestar/state-transition"; import {SignedBeaconBlock, deneb, ssz} from "@lodestar/types"; -import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import {bnToNum} from "@lodestar/utils"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; -import {RunnerType, shouldVerify, TestRunnerFn} from "../utils/types.js"; import {getConfig} from "../../utils/config.js"; import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn, shouldVerify} from "../utils/types.js"; const sanity: TestRunnerFn = (fork, testName, testSuite) => { switch (testName) { diff --git a/packages/beacon-node/test/spec/presets/shuffling.test.ts b/packages/beacon-node/test/spec/presets/shuffling.test.ts index 7b0f38ecf581..ad5fff527bac 100644 --- a/packages/beacon-node/test/spec/presets/shuffling.test.ts +++ b/packages/beacon-node/test/spec/presets/shuffling.test.ts @@ -1,11 +1,11 @@ import path from "node:path"; import {unshuffleList} from "@chainsafe/swap-or-not-shuffle"; +import {ACTIVE_PRESET, SHUFFLE_ROUND_COUNT} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; import {bnToNum, fromHex} from "@lodestar/utils"; -import {ACTIVE_PRESET, SHUFFLE_ROUND_COUNT} from "@lodestar/params"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; const shuffling: TestRunnerFn = () => { return { diff --git a/packages/beacon-node/test/spec/presets/ssz_static.test.ts b/packages/beacon-node/test/spec/presets/ssz_static.test.ts index f5cdcc719b6a..34a252052f65 100644 --- a/packages/beacon-node/test/spec/presets/ssz_static.test.ts +++ b/packages/beacon-node/test/spec/presets/ssz_static.test.ts @@ -1,14 +1,14 @@ import fs from "node:fs"; import path from "node:path"; -import {expect, it, vi} from "vitest"; import {Type} from "@chainsafe/ssz"; -import {ssz, sszTypesFor} from "@lodestar/types"; import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; +import {ssz, sszTypesFor} from "@lodestar/types"; +import {expect, it, vi} from "vitest"; +import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {replaceUintTypeWithUintBigintType} from "../utils/replaceUintTypeWithUintBigintType.js"; -import {parseSszStaticTestcase} from "../utils/sszTestCaseParser.js"; import {runValidSszTest} from "../utils/runValidSszTest.js"; -import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {parseSszStaticTestcase} from "../utils/sszTestCaseParser.js"; import {RunnerType} from "../utils/types.js"; // ssz_static diff --git a/packages/beacon-node/test/spec/presets/transition.test.ts b/packages/beacon-node/test/spec/presets/transition.test.ts index 76ad772f8dfb..0b1aa1b522e5 100644 --- a/packages/beacon-node/test/spec/presets/transition.test.ts +++ b/packages/beacon-node/test/spec/presets/transition.test.ts @@ -1,4 +1,7 @@ import path from "node:path"; +import {ChainConfig, createChainForkConfig} from "@lodestar/config"; +import {config} from "@lodestar/config/default"; +import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import { BeaconStateAllForks, DataAvailableStatus, @@ -6,16 +9,13 @@ import { stateTransition, } from "@lodestar/state-transition"; import {SignedBeaconBlock, ssz} from "@lodestar/types"; -import {createChainForkConfig, ChainConfig} from "@lodestar/config"; -import {ACTIVE_PRESET, ForkName} from "@lodestar/params"; import {bnToNum} from "@lodestar/utils"; -import {config} from "@lodestar/config/default"; -import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {createCachedBeaconStateTest} from "../../utils/cachedBeaconState.js"; -import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {assertCorrectProgressiveBalances} from "../config.js"; import {ethereumConsensusSpecsTests} from "../specTestVersioning.js"; +import {expectEqualBeaconState, inputTypeSszTreeViewDU} from "../utils/expectEqualBeaconState.js"; import {specTestIterator} from "../utils/specTestIterator.js"; +import {RunnerType, TestRunnerFn} from "../utils/types.js"; import {getPreviousFork} from "./fork.test.js"; const transition = diff --git a/packages/beacon-node/test/spec/utils/expectEqualBeaconState.ts b/packages/beacon-node/test/spec/utils/expectEqualBeaconState.ts index 160310160054..a3f6cc149148 100644 --- a/packages/beacon-node/test/spec/utils/expectEqualBeaconState.ts +++ b/packages/beacon-node/test/spec/utils/expectEqualBeaconState.ts @@ -1,8 +1,8 @@ -import {expect} from "vitest"; -import {SSZTypesFor, ssz} from "@lodestar/types"; import {ForkAll, ForkName} from "@lodestar/params"; import {InputType} from "@lodestar/spec-test-util"; import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {SSZTypesFor, ssz} from "@lodestar/types"; +import {expect} from "vitest"; /** Compare each field in BeaconState to help debug failed test easier. */ export function expectEqualBeaconState( diff --git a/packages/beacon-node/test/spec/utils/replaceUintTypeWithUintBigintType.ts b/packages/beacon-node/test/spec/utils/replaceUintTypeWithUintBigintType.ts index 8e0063291d98..356d384e5f6a 100644 --- a/packages/beacon-node/test/spec/utils/replaceUintTypeWithUintBigintType.ts +++ b/packages/beacon-node/test/spec/utils/replaceUintTypeWithUintBigintType.ts @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */ import { - Type, - UintNumberType, - UintBigintType, ContainerType, ListBasicType, ListCompositeType, + Type, + UintBigintType, + UintNumberType, VectorBasicType, VectorCompositeType, } from "@chainsafe/ssz"; diff --git a/packages/beacon-node/test/spec/utils/runValidSszTest.ts b/packages/beacon-node/test/spec/utils/runValidSszTest.ts index a8d3060af08d..03c4e543f276 100644 --- a/packages/beacon-node/test/spec/utils/runValidSszTest.ts +++ b/packages/beacon-node/test/spec/utils/runValidSszTest.ts @@ -1,6 +1,6 @@ -import {expect} from "vitest"; import {Node} from "@chainsafe/persistent-merkle-tree"; -import {Type, CompositeType, fromHexString, toHexString} from "@chainsafe/ssz"; +import {CompositeType, Type, fromHexString, toHexString} from "@chainsafe/ssz"; +import {expect} from "vitest"; type ValidTestCaseData = { root: string; diff --git a/packages/beacon-node/test/spec/utils/specTestIterator.ts b/packages/beacon-node/test/spec/utils/specTestIterator.ts index d8b4f9c0574c..0868183295cf 100644 --- a/packages/beacon-node/test/spec/utils/specTestIterator.ts +++ b/packages/beacon-node/test/spec/utils/specTestIterator.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it} from "vitest"; import {ForkName} from "@lodestar/params"; import {describeDirectorySpecTest} from "@lodestar/spec-test-util"; +import {describe, it} from "vitest"; import {RunnerType, TestRunner} from "./types.js"; const ARTIFACT_FILENAMES = new Set([ diff --git a/packages/beacon-node/test/spec/utils/sszTestCaseParser.ts b/packages/beacon-node/test/spec/utils/sszTestCaseParser.ts index d4108a2eb011..f594a5b88193 100644 --- a/packages/beacon-node/test/spec/utils/sszTestCaseParser.ts +++ b/packages/beacon-node/test/spec/utils/sszTestCaseParser.ts @@ -1,8 +1,8 @@ -import path from "node:path"; import fs from "node:fs"; -import {uncompress} from "snappyjs"; -import jsyaml from "js-yaml"; +import path from "node:path"; import {loadYaml} from "@lodestar/utils"; +import jsyaml from "js-yaml"; +import {uncompress} from "snappyjs"; /* eslint-disable @typescript-eslint/explicit-function-return-type */ diff --git a/packages/beacon-node/test/unit-mainnet/network/gossip/scoringParameters.test.ts b/packages/beacon-node/test/unit-mainnet/network/gossip/scoringParameters.test.ts index b3137755857f..bf9e92ee2ddd 100644 --- a/packages/beacon-node/test/unit-mainnet/network/gossip/scoringParameters.test.ts +++ b/packages/beacon-node/test/unit-mainnet/network/gossip/scoringParameters.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect} from "vitest"; import {TopicScoreParams} from "@chainsafe/libp2p-gossipsub/score"; -import {ATTESTATION_SUBNET_COUNT, ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; import {createBeaconConfig} from "@lodestar/config"; import {mainnetChainConfig} from "@lodestar/config/configs"; +import {ATTESTATION_SUBNET_COUNT, ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {describe, expect, it} from "vitest"; +import {ZERO_HASH} from "../../../../src/constants/index.js"; import {computeGossipPeerScoreParams, gossipScoreThresholds} from "../../../../src/network/gossip/scoringParameters.js"; import {stringifyGossipTopic} from "../../../../src/network/gossip/topic.js"; import {GossipType} from "../../../../src/network/index.js"; -import {ZERO_HASH} from "../../../../src/constants/index.js"; /** * Refer to Teku tests at diff --git a/packages/beacon-node/test/unit-mainnet/network/subnets/util.test.ts b/packages/beacon-node/test/unit-mainnet/network/subnets/util.test.ts index af12ad3d80e8..5509b51ebd0a 100644 --- a/packages/beacon-node/test/unit-mainnet/network/subnets/util.test.ts +++ b/packages/beacon-node/test/unit-mainnet/network/subnets/util.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {bigIntToBytes} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {computeSubscribedSubnet} from "../../../../src/network/subnets/util.js"; describe("computeSubscribedSubnet", () => { diff --git a/packages/beacon-node/test/unit/api/impl/beacon/beacon.test.ts b/packages/beacon-node/test/unit/api/impl/beacon/beacon.test.ts index 99bac5de7ef4..9bfb305b7e7e 100644 --- a/packages/beacon-node/test/unit/api/impl/beacon/beacon.test.ts +++ b/packages/beacon-node/test/unit/api/impl/beacon/beacon.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect, beforeAll} from "vitest"; import {phase0} from "@lodestar/types"; -import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; +import {beforeAll, describe, expect, it} from "vitest"; import {getBeaconApi} from "../../../../../src/api/impl/beacon/index.js"; +import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; import {Mutable} from "../../../../utils/types.js"; describe("beacon api implementation", () => { diff --git a/packages/beacon-node/test/unit/api/impl/beacon/blocks/getBlockHeaders.test.ts b/packages/beacon-node/test/unit/api/impl/beacon/blocks/getBlockHeaders.test.ts index 5e4e8a31ec7f..ce8d770d86ff 100644 --- a/packages/beacon-node/test/unit/api/impl/beacon/blocks/getBlockHeaders.test.ts +++ b/packages/beacon-node/test/unit/api/impl/beacon/blocks/getBlockHeaders.test.ts @@ -1,11 +1,11 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, vi, afterEach} from "vitest"; -import {when} from "vitest-when"; import {routes} from "@lodestar/api"; import {ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {when} from "vitest-when"; +import {getBeaconBlockApi} from "../../../../../../src/api/impl/beacon/blocks/index.js"; import {ApiTestModules, getApiTestModules} from "../../../../../utils/api.js"; import {generateProtoBlock, generateSignedBlockAtSlot} from "../../../../../utils/typeGenerator.js"; -import {getBeaconBlockApi} from "../../../../../../src/api/impl/beacon/blocks/index.js"; describe("api - beacon - getBlockHeaders", () => { let modules: ApiTestModules; diff --git a/packages/beacon-node/test/unit/api/impl/beacon/state/utils.test.ts b/packages/beacon-node/test/unit/api/impl/beacon/state/utils.test.ts index 958093ffba6d..149e0236c448 100644 --- a/packages/beacon-node/test/unit/api/impl/beacon/state/utils.test.ts +++ b/packages/beacon-node/test/unit/api/impl/beacon/state/utils.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {toHexString} from "@chainsafe/ssz"; +import {describe, expect, it} from "vitest"; import {getStateValidatorIndex} from "../../../../../../src/api/impl/beacon/state/utils.js"; import {generateCachedAltairState} from "../../../../../utils/state.js"; diff --git a/packages/beacon-node/test/unit/api/impl/config/config.test.ts b/packages/beacon-node/test/unit/api/impl/config/config.test.ts index 7d0adebbea89..8e67d5d6b156 100644 --- a/packages/beacon-node/test/unit/api/impl/config/config.test.ts +++ b/packages/beacon-node/test/unit/api/impl/config/config.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect, beforeEach} from "vitest"; import {routes} from "@lodestar/api"; import {config} from "@lodestar/config/default"; +import {beforeEach, describe, expect, it} from "vitest"; import {getConfigApi, renderJsonSpec} from "../../../../../src/api/impl/config/index.js"; describe("config api implementation", () => { diff --git a/packages/beacon-node/test/unit/api/impl/events/events.test.ts b/packages/beacon-node/test/unit/api/impl/events/events.test.ts index 5b1686d42f57..cd42945830bc 100644 --- a/packages/beacon-node/test/unit/api/impl/events/events.test.ts +++ b/packages/beacon-node/test/unit/api/impl/events/events.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeEach, afterEach, vi, MockedObject} from "vitest"; import {routes} from "@lodestar/api"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; -import {BeaconChain, ChainEventEmitter, HeadEventData} from "../../../../../src/chain/index.js"; +import {MockedObject, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {getEventsApi} from "../../../../../src/api/impl/events/index.js"; +import {BeaconChain, ChainEventEmitter, HeadEventData} from "../../../../../src/chain/index.js"; import {ZERO_HASH_HEX} from "../../../../../src/constants/constants.js"; vi.mock("../../../../../src/chain/index.js", async (importActual) => { diff --git a/packages/beacon-node/test/unit/api/impl/swaggerUI.test.ts b/packages/beacon-node/test/unit/api/impl/swaggerUI.test.ts index 7ae2382e6404..1b7aecb0a234 100644 --- a/packages/beacon-node/test/unit/api/impl/swaggerUI.test.ts +++ b/packages/beacon-node/test/unit/api/impl/swaggerUI.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {getFavicon, getLogo} from "../../../../src/api/rest/swaggerUI.js"; describe("swaggerUI", () => { diff --git a/packages/beacon-node/test/unit/api/impl/validator/duties/proposer.test.ts b/packages/beacon-node/test/unit/api/impl/validator/duties/proposer.test.ts index b954f983adcc..66cc4f79407d 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/duties/proposer.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/duties/proposer.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {routes} from "@lodestar/api"; import {config} from "@lodestar/config/default"; import {MAX_EFFECTIVE_BALANCE, SLOTS_PER_EPOCH} from "@lodestar/params"; import {BeaconStateAllForks} from "@lodestar/state-transition"; import {Slot} from "@lodestar/types"; -import {ApiTestModules, getApiTestModules} from "../../../../../utils/api.js"; -import {FAR_FUTURE_EPOCH} from "../../../../../../src/constants/index.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {SYNC_TOLERANCE_EPOCHS, getValidatorApi} from "../../../../../../src/api/impl/validator/index.js"; +import {defaultApiOptions} from "../../../../../../src/api/options.js"; +import {FAR_FUTURE_EPOCH} from "../../../../../../src/constants/index.js"; +import {SyncState} from "../../../../../../src/sync/interface.js"; +import {ApiTestModules, getApiTestModules} from "../../../../../utils/api.js"; +import {createCachedBeaconStateTest} from "../../../../../utils/cachedBeaconState.js"; import {generateState, zeroProtoBlock} from "../../../../../utils/state.js"; import {generateValidators} from "../../../../../utils/validator.js"; -import {createCachedBeaconStateTest} from "../../../../../utils/cachedBeaconState.js"; -import {SyncState} from "../../../../../../src/sync/interface.js"; -import {defaultApiOptions} from "../../../../../../src/api/options.js"; describe("get proposers api impl", () => { const currentEpoch = 2; diff --git a/packages/beacon-node/test/unit/api/impl/validator/produceAttestationData.test.ts b/packages/beacon-node/test/unit/api/impl/validator/produceAttestationData.test.ts index fdbfec5ac503..0486c3489800 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/produceAttestationData.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/produceAttestationData.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeEach, vi} from "vitest"; import {ProtoBlock} from "@lodestar/fork-choice"; -import {SyncState} from "../../../../../src/sync/interface.js"; -import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; +import {beforeEach, describe, expect, it, vi} from "vitest"; import {getValidatorApi} from "../../../../../src/api/impl/validator/index.js"; import {defaultApiOptions} from "../../../../../src/api/options.js"; +import {SyncState} from "../../../../../src/sync/interface.js"; +import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; describe("api - validator - produceAttestationData", () => { let modules: ApiTestModules; diff --git a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts index 306b18481c1f..52f600b7174c 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts @@ -1,20 +1,20 @@ import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; -import {ssz} from "@lodestar/types"; import {ProtoBlock} from "@lodestar/fork-choice"; import {ForkName} from "@lodestar/params"; -import {computeTimeAtSlot, CachedBeaconStateBellatrix} from "@lodestar/state-transition"; -import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; -import {SyncState} from "../../../../../src/sync/interface.js"; +import {CachedBeaconStateBellatrix, computeTimeAtSlot} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {getValidatorApi} from "../../../../../src/api/impl/validator/index.js"; +import {defaultApiOptions} from "../../../../../src/api/options.js"; import {BeaconChain} from "../../../../../src/chain/index.js"; -import {generateCachedBellatrixState} from "../../../../utils/state.js"; +import {BlockType, produceBlockBody} from "../../../../../src/chain/produceBlock/produceBlockBody.js"; +import {ZERO_HASH_HEX} from "../../../../../src/constants/index.js"; import {PayloadIdCache} from "../../../../../src/execution/engine/payloadIdCache.js"; +import {SyncState} from "../../../../../src/sync/interface.js"; import {toGraffitiBuffer} from "../../../../../src/util/graffiti.js"; -import {BlockType, produceBlockBody} from "../../../../../src/chain/produceBlock/produceBlockBody.js"; +import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; +import {generateCachedBellatrixState} from "../../../../utils/state.js"; import {generateProtoBlock} from "../../../../utils/typeGenerator.js"; -import {ZERO_HASH_HEX} from "../../../../../src/constants/index.js"; -import {defaultApiOptions} from "../../../../../src/api/options.js"; describe("api/validator - produceBlockV2", () => { let api: ReturnType; diff --git a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV3.test.ts b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV3.test.ts index f705e4b38e14..a93529aa4858 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV3.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV3.test.ts @@ -1,16 +1,16 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {toHexString} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {routes} from "@lodestar/api"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; import {ProtoBlock} from "@lodestar/fork-choice"; -import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; -import {SyncState} from "../../../../../src/sync/interface.js"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {getValidatorApi} from "../../../../../src/api/impl/validator/index.js"; +import {defaultApiOptions} from "../../../../../src/api/options.js"; import {CommonBlockBody} from "../../../../../src/chain/interface.js"; +import {SyncState} from "../../../../../src/sync/interface.js"; +import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js"; import {zeroProtoBlock} from "../../../../utils/state.js"; -import {defaultApiOptions} from "../../../../../src/api/options.js"; describe("api/validator - produceBlockV3", () => { let modules: ApiTestModules; diff --git a/packages/beacon-node/test/unit/api/impl/validator/utils.test.ts b/packages/beacon-node/test/unit/api/impl/validator/utils.test.ts index 32ef5be5d213..2579fe3224b1 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/utils.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/utils.test.ts @@ -1,7 +1,7 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeAll} from "vitest"; -import {BLSPubkey, ssz, ValidatorIndex} from "@lodestar/types"; import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {BLSPubkey, ValidatorIndex, ssz} from "@lodestar/types"; +import {beforeAll, describe, expect, it} from "vitest"; import {getPubkeysForIndices} from "../../../../../src/api/impl/validator/utils.js"; describe("api / impl / validator / utils", () => { diff --git a/packages/beacon-node/test/unit/chain/archive/blockArchiver.test.ts b/packages/beacon-node/test/unit/chain/archive/blockArchiver.test.ts index dc7c9bb75291..f34e2c85f1a1 100644 --- a/packages/beacon-node/test/unit/chain/archive/blockArchiver.test.ts +++ b/packages/beacon-node/test/unit/chain/archive/blockArchiver.test.ts @@ -1,13 +1,13 @@ import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, vi, afterEach} from "vitest"; -import {ssz} from "@lodestar/types"; import {config} from "@lodestar/config/default"; -import {ZERO_HASH_HEX} from "../../../../src/constants/index.js"; -import {generateProtoBlock} from "../../../utils/typeGenerator.js"; -import {testLogger} from "../../../utils/logger.js"; +import {ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {archiveBlocks} from "../../../../src/chain/archiver/archiveBlocks.js"; -import {MockedBeaconDb, getMockedBeaconDb} from "../../../mocks/mockedBeaconDb.js"; +import {ZERO_HASH_HEX} from "../../../../src/constants/index.js"; import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; +import {MockedBeaconDb, getMockedBeaconDb} from "../../../mocks/mockedBeaconDb.js"; +import {testLogger} from "../../../utils/logger.js"; +import {generateProtoBlock} from "../../../utils/typeGenerator.js"; describe("block archiver task", () => { const logger = testLogger(); diff --git a/packages/beacon-node/test/unit/chain/archive/nonCheckpoint.test.ts b/packages/beacon-node/test/unit/chain/archive/nonCheckpoint.test.ts index c58a873fe1db..c3dc5f031893 100644 --- a/packages/beacon-node/test/unit/chain/archive/nonCheckpoint.test.ts +++ b/packages/beacon-node/test/unit/chain/archive/nonCheckpoint.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect, beforeAll} from "vitest"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {Slot} from "@lodestar/types"; +import {beforeAll, describe, expect, it} from "vitest"; import {getNonCheckpointBlocks} from "../../../../src/chain/archiver/archiveBlocks.js"; describe("chain / archive / getNonCheckpointBlocks", () => { diff --git a/packages/beacon-node/test/unit/chain/archive/stateArchiver.test.ts b/packages/beacon-node/test/unit/chain/archive/stateArchiver.test.ts index cbfba0a362df..80ef6b885ae4 100644 --- a/packages/beacon-node/test/unit/chain/archive/stateArchiver.test.ts +++ b/packages/beacon-node/test/unit/chain/archive/stateArchiver.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {describe, expect, it} from "vitest"; import {computeStateSlotsToDelete} from "../../../../src/chain/archiver/strategies/frequencyStateArchiveStrategy.js"; describe("state archiver task", () => { diff --git a/packages/beacon-node/test/unit/chain/beaconProposerCache.ts b/packages/beacon-node/test/unit/chain/beaconProposerCache.ts index b75bbf546a98..96178d508732 100644 --- a/packages/beacon-node/test/unit/chain/beaconProposerCache.ts +++ b/packages/beacon-node/test/unit/chain/beaconProposerCache.ts @@ -1,4 +1,4 @@ -import {expect, describe, it, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {BeaconProposerCache} from "../../../src/chain/beaconProposerCache.js"; const suggestedFeeRecipient = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; diff --git a/packages/beacon-node/test/unit/chain/blocks/rejectFirstInvalidResolveAllValid.test.ts b/packages/beacon-node/test/unit/chain/blocks/rejectFirstInvalidResolveAllValid.test.ts index 2e032f558fe2..5de44a532631 100644 --- a/packages/beacon-node/test/unit/chain/blocks/rejectFirstInvalidResolveAllValid.test.ts +++ b/packages/beacon-node/test/unit/chain/blocks/rejectFirstInvalidResolveAllValid.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {rejectFirstInvalidResolveAllValid} from "../../../../src/chain/blocks/verifyBlocksSignatures.js"; /* eslint-disable @typescript-eslint/explicit-function-return-type */ diff --git a/packages/beacon-node/test/unit/chain/blocks/verifyBlocksSanityChecks.test.ts b/packages/beacon-node/test/unit/chain/blocks/verifyBlocksSanityChecks.test.ts index 1296a79d5eab..48ffe51e4636 100644 --- a/packages/beacon-node/test/unit/chain/blocks/verifyBlocksSanityChecks.test.ts +++ b/packages/beacon-node/test/unit/chain/blocks/verifyBlocksSanityChecks.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {ChainForkConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {toHex} from "@lodestar/utils"; -import {ChainForkConfig} from "@lodestar/config"; import {SignedBeaconBlock, Slot, ssz} from "@lodestar/types"; +import {toHex} from "@lodestar/utils"; +import {beforeEach, describe, expect, it} from "vitest"; +import {BlockSource, getBlockInput} from "../../../../src/chain/blocks/types.js"; import {verifyBlocksSanityChecks as verifyBlocksImportSanityChecks} from "../../../../src/chain/blocks/verifyBlocksSanityChecks.js"; import {BlockErrorCode} from "../../../../src/chain/errors/index.js"; -import {expectThrowsLodestarError} from "../../../utils/errors.js"; import {IClock} from "../../../../src/util/clock.js"; import {ClockStopped} from "../../../mocks/clock.js"; -import {BlockSource, getBlockInput} from "../../../../src/chain/blocks/types.js"; import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; +import {expectThrowsLodestarError} from "../../../utils/errors.js"; describe("chain / blocks / verifyBlocksSanityChecks", () => { let forkChoice: MockedBeaconChain["forkChoice"]; diff --git a/packages/beacon-node/test/unit/chain/bls/bls.test.ts b/packages/beacon-node/test/unit/chain/bls/bls.test.ts index 137f2c4dd9df..fbc602785a68 100644 --- a/packages/beacon-node/test/unit/chain/bls/bls.test.ts +++ b/packages/beacon-node/test/unit/chain/bls/bls.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, beforeEach} from "vitest"; import {PublicKey, SecretKey, Signature} from "@chainsafe/blst"; import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition"; -import {BlsSingleThreadVerifier} from "../../../../src/chain/bls/singleThread.js"; +import {beforeEach, describe, expect, it} from "vitest"; import {BlsMultiThreadWorkerPool} from "../../../../src/chain/bls/multithread/index.js"; +import {BlsSingleThreadVerifier} from "../../../../src/chain/bls/singleThread.js"; import {testLogger} from "../../../utils/logger.js"; describe("BlsVerifier ", () => { diff --git a/packages/beacon-node/test/unit/chain/bls/utils.test.ts b/packages/beacon-node/test/unit/chain/bls/utils.test.ts index d492a36b4d56..5e5259b8649f 100644 --- a/packages/beacon-node/test/unit/chain/bls/utils.test.ts +++ b/packages/beacon-node/test/unit/chain/bls/utils.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {chunkifyMaximizeChunkSize} from "../../../../src/chain/bls/multithread/utils.js"; import {linspace} from "../../../../src/util/numpy.js"; diff --git a/packages/beacon-node/test/unit/chain/forkChoice/forkChoice.test.ts b/packages/beacon-node/test/unit/chain/forkChoice/forkChoice.test.ts index 7cb5d23ba296..017e46f6294b 100644 --- a/packages/beacon-node/test/unit/chain/forkChoice/forkChoice.test.ts +++ b/packages/beacon-node/test/unit/chain/forkChoice/forkChoice.test.ts @@ -1,7 +1,6 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, beforeAll, vi} from "vitest"; import {config} from "@lodestar/config/default"; -import {CheckpointWithHex, ExecutionStatus, ForkChoice, DataAvailabilityStatus} from "@lodestar/fork-choice"; +import {CheckpointWithHex, DataAvailabilityStatus, ExecutionStatus, ForkChoice} from "@lodestar/fork-choice"; import {FAR_FUTURE_EPOCH, MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; import { CachedBeaconStateAllForks, @@ -9,12 +8,13 @@ import { computeEpochAtSlot, getEffectiveBalanceIncrementsZeroed, } from "@lodestar/state-transition"; -import {phase0, Slot, ssz, ValidatorIndex} from "@lodestar/types"; import {getTemporaryBlockHeader, processSlots} from "@lodestar/state-transition"; +import {Slot, ValidatorIndex, phase0, ssz} from "@lodestar/types"; +import {beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {ChainEventEmitter, initializeForkChoice} from "../../../../src/chain/index.js"; -import {generateSignedBlockAtSlot} from "../../../utils/typeGenerator.js"; import {createCachedBeaconStateTest} from "../../../utils/cachedBeaconState.js"; import {generateState} from "../../../utils/state.js"; +import {generateSignedBlockAtSlot} from "../../../utils/typeGenerator.js"; import {generateValidators} from "../../../utils/validator.js"; // We mock this package globally diff --git a/packages/beacon-node/test/unit/chain/genesis/genesis.test.ts b/packages/beacon-node/test/unit/chain/genesis/genesis.test.ts index 40570fcd26e1..40c76bb48045 100644 --- a/packages/beacon-node/test/unit/chain/genesis/genesis.test.ts +++ b/packages/beacon-node/test/unit/chain/genesis/genesis.test.ts @@ -1,15 +1,15 @@ -import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {PublicKey, SecretKey} from "@chainsafe/blst"; -import {DOMAIN_DEPOSIT, MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; +import {toHexString} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; -import {computeDomain, computeSigningRoot, interopSecretKey, ZERO_HASH} from "@lodestar/state-transition"; +import {DOMAIN_DEPOSIT, MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; +import {ZERO_HASH, computeDomain, computeSigningRoot, interopSecretKey} from "@lodestar/state-transition"; import {ValidatorIndex, phase0, ssz} from "@lodestar/types"; import {ErrorAborted} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {GenesisBuilder} from "../../../../src/chain/genesis/genesis.js"; -import {testLogger} from "../../../utils/logger.js"; import {ZERO_HASH_HEX} from "../../../../src/constants/index.js"; import {Eth1ProviderState, EthJsonRpcBlockRaw, IEth1Provider} from "../../../../src/eth1/interface.js"; +import {testLogger} from "../../../utils/logger.js"; describe("genesis builder", () => { const logger = testLogger(); diff --git a/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts b/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts index b30e0f9a9ddb..1ae4812ea200 100644 --- a/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts +++ b/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, beforeAll} from "vitest"; -import {BeaconStateAltair} from "@lodestar/state-transition"; import {SYNC_COMMITTEE_SIZE} from "@lodestar/params"; +import {BeaconStateAltair} from "@lodestar/state-transition"; import {altair, ssz} from "@lodestar/types"; -import {verifyMerkleBranch, hash} from "@lodestar/utils"; +import {hash, verifyMerkleBranch} from "@lodestar/utils"; +import {beforeAll, describe, expect, it} from "vitest"; import {getNextSyncCommitteeBranch, getSyncCommitteesWitness} from "../../../../src/chain/lightClient/proofs.js"; const currentSyncCommitteeGindex = 54; diff --git a/packages/beacon-node/test/unit/chain/lightclient/upgradeLightClientHeader.test.ts b/packages/beacon-node/test/unit/chain/lightclient/upgradeLightClientHeader.test.ts index 3c2f5a664c77..9e602040b315 100644 --- a/packages/beacon-node/test/unit/chain/lightclient/upgradeLightClientHeader.test.ts +++ b/packages/beacon-node/test/unit/chain/lightclient/upgradeLightClientHeader.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, beforeEach} from "vitest"; -import {LightClientHeader, ssz} from "@lodestar/types"; -import {ForkName, ForkSeq} from "@lodestar/params"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; import {upgradeLightClientHeader} from "@lodestar/light-client/spec"; +import {ForkName, ForkSeq} from "@lodestar/params"; +import {LightClientHeader, ssz} from "@lodestar/types"; +import {beforeEach, describe, expect, it} from "vitest"; describe("UpgradeLightClientHeader", () => { let lcHeaderByFork: Record; diff --git a/packages/beacon-node/test/unit/chain/opPools/aggregatedAttestationPool.test.ts b/packages/beacon-node/test/unit/chain/opPools/aggregatedAttestationPool.test.ts index 8742d7da9147..b5bfe191a9f3 100644 --- a/packages/beacon-node/test/unit/chain/opPools/aggregatedAttestationPool.test.ts +++ b/packages/beacon-node/test/unit/chain/opPools/aggregatedAttestationPool.test.ts @@ -1,7 +1,6 @@ +import {SecretKey, Signature, aggregateSignatures, fastAggregateVerify} from "@chainsafe/blst"; import {BitArray, fromHexString, toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, beforeAll, afterEach, vi} from "vitest"; -import {SecretKey, Signature, fastAggregateVerify, aggregateSignatures} from "@chainsafe/blst"; -import {CachedBeaconStateAllForks, newFilledArray} from "@lodestar/state-transition"; +import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; import { FAR_FUTURE_EPOCH, ForkName, @@ -9,23 +8,24 @@ import { MAX_EFFECTIVE_BALANCE, SLOTS_PER_EPOCH, } from "@lodestar/params"; -import {ssz, phase0} from "@lodestar/types"; +import {CachedBeaconStateAllForks, newFilledArray} from "@lodestar/state-transition"; import {CachedBeaconStateAltair} from "@lodestar/state-transition/src/types.js"; -import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {MockedForkChoice, getMockedForkChoice} from "../../../mocks/mockedBeaconChain.js"; +import {phase0, ssz} from "@lodestar/types"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { - aggregateConsolidation, AggregatedAttestationPool, - aggregateInto, AttestationsConsolidation, - getNotSeenValidatorsFn, MatchingDataAttestationGroup, + aggregateConsolidation, + aggregateInto, + getNotSeenValidatorsFn, } from "../../../../src/chain/opPools/aggregatedAttestationPool.js"; import {InsertOutcome} from "../../../../src/chain/opPools/types.js"; +import {ZERO_HASH_HEX} from "../../../../src/constants/constants.js"; import {linspace} from "../../../../src/util/numpy.js"; -import {generateCachedAltairState} from "../../../utils/state.js"; +import {MockedForkChoice, getMockedForkChoice} from "../../../mocks/mockedBeaconChain.js"; import {renderBitArray} from "../../../utils/render.js"; -import {ZERO_HASH_HEX} from "../../../../src/constants/constants.js"; +import {generateCachedAltairState} from "../../../utils/state.js"; import {generateProtoBlock} from "../../../utils/typeGenerator.js"; import {generateValidators} from "../../../utils/validator.js"; diff --git a/packages/beacon-node/test/unit/chain/opPools/attestationPool.test.ts b/packages/beacon-node/test/unit/chain/opPools/attestationPool.test.ts index 98453efaa3b6..fd22f9a7c6a5 100644 --- a/packages/beacon-node/test/unit/chain/opPools/attestationPool.test.ts +++ b/packages/beacon-node/test/unit/chain/opPools/attestationPool.test.ts @@ -1,10 +1,10 @@ import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, vi} from "vitest"; +import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; import {GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {InsertOutcome} from "../../../../src/chain/opPools/types.js"; +import {beforeEach, describe, expect, it, vi} from "vitest"; import {AttestationPool} from "../../../../src/chain/opPools/attestationPool.js"; +import {InsertOutcome} from "../../../../src/chain/opPools/types.js"; import {getMockedClock} from "../../../mocks/clock.js"; /** Valid signature of random data to prevent BLS errors */ diff --git a/packages/beacon-node/test/unit/chain/opPools/syncCommittee.test.ts b/packages/beacon-node/test/unit/chain/opPools/syncCommittee.test.ts index e91eaa58aa73..9af19cc84c71 100644 --- a/packages/beacon-node/test/unit/chain/opPools/syncCommittee.test.ts +++ b/packages/beacon-node/test/unit/chain/opPools/syncCommittee.test.ts @@ -1,7 +1,7 @@ -import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, beforeAll, afterEach, vi, MockedObject} from "vitest"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; import {altair} from "@lodestar/types"; +import {MockedObject, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {SyncCommitteeMessagePool} from "../../../../src/chain/opPools/index.js"; import {Clock} from "../../../../src/util/clock.js"; diff --git a/packages/beacon-node/test/unit/chain/opPools/syncCommitteeContribution.test.ts b/packages/beacon-node/test/unit/chain/opPools/syncCommitteeContribution.test.ts index e1bd60a2305e..c0a639633f37 100644 --- a/packages/beacon-node/test/unit/chain/opPools/syncCommitteeContribution.test.ts +++ b/packages/beacon-node/test/unit/chain/opPools/syncCommitteeContribution.test.ts @@ -1,14 +1,14 @@ -import {BitArray} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, beforeAll} from "vitest"; import {SecretKey, Signature, fastAggregateVerify} from "@chainsafe/blst"; +import {BitArray} from "@chainsafe/ssz"; +import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {newFilledArray} from "@lodestar/state-transition"; import {ssz} from "@lodestar/types"; -import {SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; +import {beforeAll, beforeEach, describe, expect, it} from "vitest"; import { - aggregate, - replaceIfBetter, SyncContributionAndProofPool, SyncContributionFast, + aggregate, + replaceIfBetter, } from "../../../../src/chain/opPools/syncContributionAndProofPool.js"; import {InsertOutcome} from "../../../../src/chain/opPools/types.js"; import {EMPTY_SIGNATURE} from "../../../../src/constants/index.js"; diff --git a/packages/beacon-node/test/unit/chain/prepareNextSlot.test.ts b/packages/beacon-node/test/unit/chain/prepareNextSlot.test.ts index c7d0a7801fec..fa95a00eebfd 100644 --- a/packages/beacon-node/test/unit/chain/prepareNextSlot.test.ts +++ b/packages/beacon-node/test/unit/chain/prepareNextSlot.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect, beforeEach, afterEach, vi, Mock, MockInstance} from "vitest"; -import {config} from "@lodestar/config/default"; -import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; import {routes} from "@lodestar/api"; +import {config} from "@lodestar/config/default"; import {ProtoBlock} from "@lodestar/fork-choice"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; -import {MockedLogger, getMockedLogger} from "../../mocks/loggerMock.js"; +import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {Mock, MockInstance, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {IChainOptions} from "../../../src/chain/options.js"; import {PrepareNextSlotScheduler} from "../../../src/chain/prepareNextSlot.js"; -import {generateCachedBellatrixState, zeroProtoBlock} from "../../utils/state.js"; import {PayloadIdCache} from "../../../src/execution/engine/payloadIdCache.js"; +import {MockedLogger, getMockedLogger} from "../../mocks/loggerMock.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; +import {generateCachedBellatrixState, zeroProtoBlock} from "../../utils/state.js"; describe("PrepareNextSlot scheduler", () => { const abortController = new AbortController(); diff --git a/packages/beacon-node/test/unit/chain/reprocess.test.ts b/packages/beacon-node/test/unit/chain/reprocess.test.ts index 927e4cf8d05f..339dc20de27f 100644 --- a/packages/beacon-node/test/unit/chain/reprocess.test.ts +++ b/packages/beacon-node/test/unit/chain/reprocess.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {ReprocessController} from "../../../src/chain/reprocess.js"; describe("ReprocessController", () => { diff --git a/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts b/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts index d417d83e2da9..ec42395641f4 100644 --- a/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts +++ b/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect} from "vitest"; import {SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {ssz} from "@lodestar/types"; import { CachedBeaconStateAllForks, DataAvailableStatus, ExecutionPayloadStatus, stateTransition, } from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; +import {BlockAltairOpts, getBlockAltair} from "../../../../../state-transition/test/perf/block/util.js"; import { - generatePerfTestCachedStateAltair, cachedStateAltairPopulateCaches, + generatePerfTestCachedStateAltair, } from "../../../../../state-transition/test/perf/util.js"; -import {BlockAltairOpts, getBlockAltair} from "../../../../../state-transition/test/perf/block/util.js"; import {computeBlockRewards} from "../../../../src/chain/rewards/blockRewards.js"; describe("chain / rewards / blockRewards", () => { diff --git a/packages/beacon-node/test/unit/chain/seenCache/aggregateAndProof.test.ts b/packages/beacon-node/test/unit/chain/seenCache/aggregateAndProof.test.ts index d83433a649ca..c69004ac98b9 100644 --- a/packages/beacon-node/test/unit/chain/seenCache/aggregateAndProof.test.ts +++ b/packages/beacon-node/test/unit/chain/seenCache/aggregateAndProof.test.ts @@ -1,9 +1,9 @@ import {BitArray} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { AggregationInfo, - insertDesc, SeenAggregatedAttestations, + insertDesc, } from "../../../../src/chain/seenCache/seenAggregateAndProof.js"; describe("SeenAggregatedAttestations.isKnown", () => { diff --git a/packages/beacon-node/test/unit/chain/seenCache/seenAttestationData.test.ts b/packages/beacon-node/test/unit/chain/seenCache/seenAttestationData.test.ts index b4857226267e..ee5cb94ae959 100644 --- a/packages/beacon-node/test/unit/chain/seenCache/seenAttestationData.test.ts +++ b/packages/beacon-node/test/unit/chain/seenCache/seenAttestationData.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {InsertOutcome} from "../../../../src/chain/opPools/types.js"; import {AttestationDataCacheEntry, SeenAttestationDatas} from "../../../../src/chain/seenCache/seenAttestationData.js"; diff --git a/packages/beacon-node/test/unit/chain/seenCache/seenGossipBlockInput.test.ts b/packages/beacon-node/test/unit/chain/seenCache/seenGossipBlockInput.test.ts index 27b5eadecf11..2af9f40d2de3 100644 --- a/packages/beacon-node/test/unit/chain/seenCache/seenGossipBlockInput.test.ts +++ b/packages/beacon-node/test/unit/chain/seenCache/seenGossipBlockInput.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; +import {BlockInput, BlockInputType, GossipedInputType} from "../../../../src/chain/blocks/types.js"; import {SeenGossipBlockInput} from "../../../../src/chain/seenCache/seenGossipBlockInput.js"; -import {BlockInputType, GossipedInputType, BlockInput} from "../../../../src/chain/blocks/types.js"; describe("SeenGossipBlockInput", () => { const chainConfig = createChainForkConfig({ diff --git a/packages/beacon-node/test/unit/chain/seenCache/syncCommittee.test.ts b/packages/beacon-node/test/unit/chain/seenCache/syncCommittee.test.ts index 59c67f9cedc2..a24fcc41443d 100644 --- a/packages/beacon-node/test/unit/chain/seenCache/syncCommittee.test.ts +++ b/packages/beacon-node/test/unit/chain/seenCache/syncCommittee.test.ts @@ -1,7 +1,7 @@ import {BitArray} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {ssz} from "@lodestar/types"; -import {SeenSyncCommitteeMessages, SeenContributionAndProof} from "../../../../src/chain/seenCache/index.js"; +import {describe, expect, it} from "vitest"; +import {SeenContributionAndProof, SeenSyncCommitteeMessages} from "../../../../src/chain/seenCache/index.js"; const NUM_SLOTS_IN_CACHE = 3; diff --git a/packages/beacon-node/test/unit/chain/shufflingCache.test.ts b/packages/beacon-node/test/unit/chain/shufflingCache.test.ts index d417e555872c..b8a9602ea6ce 100644 --- a/packages/beacon-node/test/unit/chain/shufflingCache.test.ts +++ b/packages/beacon-node/test/unit/chain/shufflingCache.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {generateTestCachedBeaconStateOnlyValidators} from "../../../../state-transition/test/perf/util.js"; import {ShufflingCache} from "../../../src/chain/shufflingCache.js"; diff --git a/packages/beacon-node/test/unit/chain/stateCache/blockStateCacheImpl.test.ts b/packages/beacon-node/test/unit/chain/stateCache/blockStateCacheImpl.test.ts index 19dc0f3a2c60..50ec0b6fc63d 100644 --- a/packages/beacon-node/test/unit/chain/stateCache/blockStateCacheImpl.test.ts +++ b/packages/beacon-node/test/unit/chain/stateCache/blockStateCacheImpl.test.ts @@ -1,11 +1,11 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach} from "vitest"; -import {EpochShuffling} from "@lodestar/state-transition"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {EpochShuffling} from "@lodestar/state-transition"; import {Root} from "@lodestar/types"; +import {beforeEach, describe, expect, it} from "vitest"; import {BlockStateCacheImpl} from "../../../../src/chain/stateCache/index.js"; -import {generateCachedState} from "../../../utils/state.js"; import {ZERO_HASH} from "../../../../src/constants/index.js"; +import {generateCachedState} from "../../../utils/state.js"; describe("BlockStateCacheImpl", () => { let cache: BlockStateCacheImpl; diff --git a/packages/beacon-node/test/unit/chain/stateCache/fifoBlockStateCache.test.ts b/packages/beacon-node/test/unit/chain/stateCache/fifoBlockStateCache.test.ts index 07a8ec12093d..9a341438479d 100644 --- a/packages/beacon-node/test/unit/chain/stateCache/fifoBlockStateCache.test.ts +++ b/packages/beacon-node/test/unit/chain/stateCache/fifoBlockStateCache.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect, beforeEach} from "vitest"; import {toHexString} from "@chainsafe/ssz"; -import {EpochShuffling, CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {CachedBeaconStateAllForks, EpochShuffling} from "@lodestar/state-transition"; +import {beforeEach, describe, expect, it} from "vitest"; import {FIFOBlockStateCache} from "../../../../src/chain/stateCache/index.js"; import {generateCachedState} from "../../../utils/state.js"; diff --git a/packages/beacon-node/test/unit/chain/stateCache/inMemoryCheckpointsCache.test.ts b/packages/beacon-node/test/unit/chain/stateCache/inMemoryCheckpointsCache.test.ts index 23a792bef0a8..edfec599b6eb 100644 --- a/packages/beacon-node/test/unit/chain/stateCache/inMemoryCheckpointsCache.test.ts +++ b/packages/beacon-node/test/unit/chain/stateCache/inMemoryCheckpointsCache.test.ts @@ -1,7 +1,7 @@ -import {describe, beforeAll, it, expect, beforeEach} from "vitest"; +import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {CachedBeaconStateAllForks, computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {phase0} from "@lodestar/types"; -import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; +import {beforeAll, beforeEach, describe, expect, it} from "vitest"; import { CheckpointHex, InMemoryCheckpointStateCache, diff --git a/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts b/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts index f98b180fa983..5ab3da532948 100644 --- a/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts +++ b/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts @@ -1,16 +1,16 @@ -import {describe, it, expect, beforeAll, beforeEach} from "vitest"; import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {CachedBeaconStateAllForks, computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {RootHex, phase0} from "@lodestar/types"; import {mapValues, toHexString} from "@lodestar/utils"; -import {PersistentCheckpointStateCache} from "../../../../src/chain/stateCache/persistentCheckpointsCache.js"; -import {checkpointToDatastoreKey} from "../../../../src/chain/stateCache/datastore/index.js"; -import {generateCachedState} from "../../../utils/state.js"; +import {beforeAll, beforeEach, describe, expect, it} from "vitest"; +import {FIFOBlockStateCache, toCheckpointHex} from "../../../../src/chain/index.js"; import {ShufflingCache} from "../../../../src/chain/shufflingCache.js"; -import {testLogger} from "../../../utils/logger.js"; -import {getTestDatastore} from "../../../utils/chain/stateCache/datastore.js"; +import {checkpointToDatastoreKey} from "../../../../src/chain/stateCache/datastore/index.js"; +import {PersistentCheckpointStateCache} from "../../../../src/chain/stateCache/persistentCheckpointsCache.js"; import {CheckpointHex} from "../../../../src/chain/stateCache/types.js"; -import {FIFOBlockStateCache, toCheckpointHex} from "../../../../src/chain/index.js"; +import {getTestDatastore} from "../../../utils/chain/stateCache/datastore.js"; +import {testLogger} from "../../../utils/logger.js"; +import {generateCachedState} from "../../../utils/state.js"; describe("PersistentCheckpointStateCache", () => { let root0a: Buffer, root0b: Buffer, root1: Buffer, root2: Buffer; diff --git a/packages/beacon-node/test/unit/chain/validation/aggregateAndProof.test.ts b/packages/beacon-node/test/unit/chain/validation/aggregateAndProof.test.ts index e2bc392b4ea2..d9833740a9a5 100644 --- a/packages/beacon-node/test/unit/chain/validation/aggregateAndProof.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/aggregateAndProof.test.ts @@ -1,16 +1,16 @@ import {BitArray, toHexString} from "@chainsafe/ssz"; -import {describe, it} from "vitest"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {phase0, ssz} from "@lodestar/types"; +import {describe, it} from "vitest"; import {generateTestCachedBeaconStateOnlyValidators} from "../../../../../state-transition/test/perf/util.js"; -import {IBeaconChain} from "../../../../src/chain/index.js"; import {AttestationErrorCode} from "../../../../src/chain/errors/index.js"; +import {IBeaconChain} from "../../../../src/chain/index.js"; import {validateApiAggregateAndProof, validateGossipAggregateAndProof} from "../../../../src/chain/validation/index.js"; -import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; import {memoOnce} from "../../../utils/cache.js"; +import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; import { - getAggregateAndProofValidData, AggregateAndProofValidDataOpts, + getAggregateAndProofValidData, } from "../../../utils/validationData/aggregateAndProof.js"; describe("chain / validation / aggregateAndProof", () => { diff --git a/packages/beacon-node/test/unit/chain/validation/attestation/getShufflingForAttestationVerification.test.ts b/packages/beacon-node/test/unit/chain/validation/attestation/getShufflingForAttestationVerification.test.ts index 4ba65270e17a..729c03d9d6e5 100644 --- a/packages/beacon-node/test/unit/chain/validation/attestation/getShufflingForAttestationVerification.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/attestation/getShufflingForAttestationVerification.test.ts @@ -1,11 +1,11 @@ -import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; -// We need to import the mock before the packages -import {MockedBeaconChain, getMockedBeaconChain} from "../../../../mocks/mockedBeaconChain.js"; -import {EpochShuffling, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {EpochDifference, ProtoBlock} from "@lodestar/fork-choice"; +import {EpochShuffling, computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {RegenCaller} from "../../../../../src/chain/regen/interface.js"; import {getShufflingForAttestationVerification} from "../../../../../src/chain/validation/index.js"; import {ZERO_HASH_HEX} from "../../../../../src/constants/constants.js"; +// We need to import the mock before the packages +import {MockedBeaconChain, getMockedBeaconChain} from "../../../../mocks/mockedBeaconChain.js"; describe("getShufflingForAttestationVerification", () => { let chain: MockedBeaconChain; diff --git a/packages/beacon-node/test/unit/chain/validation/attestation/validateAttestation.test.ts b/packages/beacon-node/test/unit/chain/validation/attestation/validateAttestation.test.ts index be9fd3587b7c..1ffbf7696111 100644 --- a/packages/beacon-node/test/unit/chain/validation/attestation/validateAttestation.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/attestation/validateAttestation.test.ts @@ -1,8 +1,8 @@ import {BitArray} from "@chainsafe/ssz"; -import {describe, expect, it} from "vitest"; import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; 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"; import {AttestationErrorCode, GossipErrorCode} from "../../../../../src/chain/errors/index.js"; import {IBeaconChain} from "../../../../../src/chain/index.js"; diff --git a/packages/beacon-node/test/unit/chain/validation/attestation/validateGossipAttestationsSameAttData.test.ts b/packages/beacon-node/test/unit/chain/validation/attestation/validateGossipAttestationsSameAttData.test.ts index 24fae8a03f0b..1b3688fc2e33 100644 --- a/packages/beacon-node/test/unit/chain/validation/attestation/validateGossipAttestationsSameAttData.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/attestation/validateGossipAttestationsSameAttData.test.ts @@ -1,8 +1,8 @@ -import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {PublicKey, SecretKey} from "@chainsafe/blst"; import {ForkName} from "@lodestar/params"; import {SignatureSetType} from "@lodestar/state-transition"; import {ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {BlsSingleThreadVerifier} from "../../../../../src/chain/bls/singleThread.js"; import {AttestationError, AttestationErrorCode, GossipAction} from "../../../../../src/chain/errors/index.js"; import {IBeaconChain} from "../../../../../src/chain/index.js"; diff --git a/packages/beacon-node/test/unit/chain/validation/attesterSlashing.test.ts b/packages/beacon-node/test/unit/chain/validation/attesterSlashing.test.ts index 629753824669..c9577767f78f 100644 --- a/packages/beacon-node/test/unit/chain/validation/attesterSlashing.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/attesterSlashing.test.ts @@ -1,10 +1,10 @@ -import {describe, it, beforeEach, afterEach, vi} from "vitest"; import {phase0, ssz} from "@lodestar/types"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; -import {generateCachedState} from "../../../utils/state.js"; -import {validateGossipAttesterSlashing} from "../../../../src/chain/validation/attesterSlashing.js"; +import {afterEach, beforeEach, describe, it, vi} from "vitest"; import {AttesterSlashingErrorCode} from "../../../../src/chain/errors/attesterSlashingError.js"; +import {validateGossipAttesterSlashing} from "../../../../src/chain/validation/attesterSlashing.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {generateCachedState} from "../../../utils/state.js"; describe("GossipMessageValidator", () => { let chainStub: MockedBeaconChain; diff --git a/packages/beacon-node/test/unit/chain/validation/block.test.ts b/packages/beacon-node/test/unit/chain/validation/block.test.ts index f8a2b7245ef7..4b236181b038 100644 --- a/packages/beacon-node/test/unit/chain/validation/block.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/block.test.ts @@ -1,14 +1,14 @@ -import {Mock, Mocked, beforeEach, describe, it, vi} from "vitest"; import {config} from "@lodestar/config/default"; import {ProtoBlock} from "@lodestar/fork-choice"; import {ForkName} from "@lodestar/params"; import {SignedBeaconBlock, ssz} from "@lodestar/types"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; +import {Mock, Mocked, beforeEach, describe, it, vi} from "vitest"; import {BlockErrorCode} from "../../../../src/chain/errors/index.js"; import {QueuedStateRegenerator} from "../../../../src/chain/regen/index.js"; import {SeenBlockProposers} from "../../../../src/chain/seenCache/index.js"; import {validateGossipBlock} from "../../../../src/chain/validation/index.js"; import {EMPTY_SIGNATURE, ZERO_HASH} from "../../../../src/constants/index.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; import {generateCachedState} from "../../../utils/state.js"; diff --git a/packages/beacon-node/test/unit/chain/validation/blsToExecutionChange.test.ts b/packages/beacon-node/test/unit/chain/validation/blsToExecutionChange.test.ts index 8d5032ed3ec7..6c1d1def3d9d 100644 --- a/packages/beacon-node/test/unit/chain/validation/blsToExecutionChange.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/blsToExecutionChange.test.ts @@ -1,24 +1,24 @@ import {digest} from "@chainsafe/as-sha256"; -import {describe, it, beforeEach, afterEach, vi} from "vitest"; import {SecretKey} from "@chainsafe/blst"; +import {createBeaconConfig} from "@lodestar/config"; import {config as defaultConfig} from "@lodestar/config/default"; -import {computeSigningRoot} from "@lodestar/state-transition"; -import {capella, ssz} from "@lodestar/types"; import { BLS_WITHDRAWAL_PREFIX, - ETH1_ADDRESS_WITHDRAWAL_PREFIX, DOMAIN_BLS_TO_EXECUTION_CHANGE, + ETH1_ADDRESS_WITHDRAWAL_PREFIX, FAR_FUTURE_EPOCH, - SLOTS_PER_EPOCH, ForkName, + SLOTS_PER_EPOCH, } from "@lodestar/params"; -import {createBeaconConfig} from "@lodestar/config"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; -import {generateState} from "../../../utils/state.js"; -import {validateGossipBlsToExecutionChange} from "../../../../src/chain/validation/blsToExecutionChange.js"; +import {computeSigningRoot} from "@lodestar/state-transition"; +import {capella, ssz} from "@lodestar/types"; +import {afterEach, beforeEach, describe, it, vi} from "vitest"; import {BlsToExecutionChangeErrorCode} from "../../../../src/chain/errors/blsToExecutionChangeError.js"; -import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {validateGossipBlsToExecutionChange} from "../../../../src/chain/validation/blsToExecutionChange.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {createCachedBeaconStateTest} from "../../../utils/cachedBeaconState.js"; +import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {generateState} from "../../../utils/state.js"; describe("validate bls to execution change", () => { let chainStub: MockedBeaconChain; diff --git a/packages/beacon-node/test/unit/chain/validation/lightClientFinalityUpdate.test.ts b/packages/beacon-node/test/unit/chain/validation/lightClientFinalityUpdate.test.ts index cbd231c926ce..4288b7f440c9 100644 --- a/packages/beacon-node/test/unit/chain/validation/lightClientFinalityUpdate.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/lightClientFinalityUpdate.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {altair, ssz} from "@lodestar/types"; import {computeTimeAtSlot} from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; import {RequiredSelective} from "@lodestar/utils"; -import {validateLightClientFinalityUpdate} from "../../../../src/chain/validation/lightClientFinalityUpdate.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {LightClientErrorCode} from "../../../../src/chain/errors/lightClientError.js"; import {IBeaconChain} from "../../../../src/chain/index.js"; +import {validateLightClientFinalityUpdate} from "../../../../src/chain/validation/lightClientFinalityUpdate.js"; import {getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; describe("Light Client Finality Update validation", () => { diff --git a/packages/beacon-node/test/unit/chain/validation/lightClientOptimisticUpdate.test.ts b/packages/beacon-node/test/unit/chain/validation/lightClientOptimisticUpdate.test.ts index 7665b4f89179..85a1ebb16330 100644 --- a/packages/beacon-node/test/unit/chain/validation/lightClientOptimisticUpdate.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/lightClientOptimisticUpdate.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {altair, ssz} from "@lodestar/types"; import {computeTimeAtSlot} from "@lodestar/state-transition"; +import {altair, ssz} from "@lodestar/types"; import {RequiredSelective} from "@lodestar/utils"; -import {validateLightClientOptimisticUpdate} from "../../../../src/chain/validation/lightClientOptimisticUpdate.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {LightClientErrorCode} from "../../../../src/chain/errors/lightClientError.js"; import {IBeaconChain} from "../../../../src/chain/index.js"; +import {validateLightClientOptimisticUpdate} from "../../../../src/chain/validation/lightClientOptimisticUpdate.js"; import {getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; describe("Light Client Optimistic Update validation", () => { diff --git a/packages/beacon-node/test/unit/chain/validation/proposerSlashing.test.ts b/packages/beacon-node/test/unit/chain/validation/proposerSlashing.test.ts index f5eb7310a39c..4d1fcb3f2490 100644 --- a/packages/beacon-node/test/unit/chain/validation/proposerSlashing.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/proposerSlashing.test.ts @@ -1,10 +1,10 @@ -import {describe, it, beforeEach, afterEach, vi} from "vitest"; import {phase0, ssz} from "@lodestar/types"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; -import {generateCachedState} from "../../../utils/state.js"; +import {afterEach, beforeEach, describe, it, vi} from "vitest"; import {ProposerSlashingErrorCode} from "../../../../src/chain/errors/proposerSlashingError.js"; import {validateGossipProposerSlashing} from "../../../../src/chain/validation/proposerSlashing.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {generateCachedState} from "../../../utils/state.js"; describe("validate proposer slashing", () => { let chainStub: MockedBeaconChain; diff --git a/packages/beacon-node/test/unit/chain/validation/syncCommittee.test.ts b/packages/beacon-node/test/unit/chain/validation/syncCommittee.test.ts index cbffc2a4ffd9..6ed254254154 100644 --- a/packages/beacon-node/test/unit/chain/validation/syncCommittee.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/syncCommittee.test.ts @@ -1,15 +1,15 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, afterEach, beforeEach, beforeAll, afterAll, vi, Mock} from "vitest"; -import {altair, Epoch, Slot} from "@lodestar/types"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {Epoch, Slot, altair} from "@lodestar/types"; +import {Mock, afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {SyncCommitteeErrorCode} from "../../../../src/chain/errors/syncCommitteeError.js"; +import {SeenSyncCommitteeMessages} from "../../../../src/chain/seenCache/index.js"; import {validateGossipSyncCommittee} from "../../../../src/chain/validation/syncCommittee.js"; +import {ZERO_HASH} from "../../../../src/constants/constants.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; import {generateCachedAltairState} from "../../../utils/state.js"; -import {SeenSyncCommitteeMessages} from "../../../../src/chain/seenCache/index.js"; -import {ZERO_HASH} from "../../../../src/constants/constants.js"; // https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/altair/p2p-interface.md describe("Sync Committee Signature validation", () => { diff --git a/packages/beacon-node/test/unit/chain/validation/voluntaryExit.test.ts b/packages/beacon-node/test/unit/chain/validation/voluntaryExit.test.ts index d556ff610961..697489b8523d 100644 --- a/packages/beacon-node/test/unit/chain/validation/voluntaryExit.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/voluntaryExit.test.ts @@ -1,21 +1,21 @@ -import {describe, it, beforeEach, beforeAll, vi, afterEach} from "vitest"; import {SecretKey} from "@chainsafe/blst"; +import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; +import {DOMAIN_VOLUNTARY_EXIT, FAR_FUTURE_EPOCH, SLOTS_PER_EPOCH} from "@lodestar/params"; import { CachedBeaconStateAllForks, - computeEpochAtSlot, computeDomain, + computeEpochAtSlot, computeSigningRoot, } from "@lodestar/state-transition"; import {phase0, ssz} from "@lodestar/types"; -import {DOMAIN_VOLUNTARY_EXIT, FAR_FUTURE_EPOCH, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {createBeaconConfig} from "@lodestar/config"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; -import {generateState} from "../../../utils/state.js"; -import {validateGossipVoluntaryExit} from "../../../../src/chain/validation/voluntaryExit.js"; +import {afterEach, beforeAll, beforeEach, describe, it, vi} from "vitest"; import {VoluntaryExitErrorCode} from "../../../../src/chain/errors/voluntaryExitError.js"; -import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {validateGossipVoluntaryExit} from "../../../../src/chain/validation/voluntaryExit.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../../mocks/mockedBeaconChain.js"; import {createCachedBeaconStateTest} from "../../../utils/cachedBeaconState.js"; +import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {generateState} from "../../../utils/state.js"; describe("validate voluntary exit", () => { let chainStub: MockedBeaconChain; diff --git a/packages/beacon-node/test/unit/db/api/repositories/blockArchive.test.ts b/packages/beacon-node/test/unit/db/api/repositories/blockArchive.test.ts index b87e9b926fdd..923a143b6766 100644 --- a/packages/beacon-node/test/unit/db/api/repositories/blockArchive.test.ts +++ b/packages/beacon-node/test/unit/db/api/repositories/blockArchive.test.ts @@ -1,13 +1,13 @@ -import {rimraf} from "rimraf"; -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; -import {ssz} from "@lodestar/types"; import {config} from "@lodestar/config/default"; -import {intToBytes} from "@lodestar/utils"; import {LevelDbController, encodeKey} from "@lodestar/db"; +import {ssz} from "@lodestar/types"; +import {intToBytes} from "@lodestar/utils"; +import {rimraf} from "rimraf"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {Bucket} from "../../../../../src/db/buckets.js"; import {BlockArchiveRepository} from "../../../../../src/db/repositories/index.js"; import {testLogger} from "../../../../utils/logger.js"; -import {Bucket} from "../../../../../src/db/buckets.js"; describe("block archive repository", () => { const testDir = "./.tmp"; diff --git a/packages/beacon-node/test/unit/db/api/repository.test.ts b/packages/beacon-node/test/unit/db/api/repository.test.ts index 3b2840b3f0be..e2b908bac777 100644 --- a/packages/beacon-node/test/unit/db/api/repository.test.ts +++ b/packages/beacon-node/test/unit/db/api/repository.test.ts @@ -1,9 +1,9 @@ -import all from "it-all"; import {ContainerType} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, vi, afterEach, MockedObject} from "vitest"; -import {Bytes32, ssz} from "@lodestar/types"; import {config} from "@lodestar/config/default"; import {Db, LevelDbController, Repository} from "@lodestar/db"; +import {Bytes32, ssz} from "@lodestar/types"; +import all from "it-all"; +import {MockedObject, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {Bucket} from "../../../../src/db/buckets.js"; vi.mock("@lodestar/db", async (importOriginal) => { diff --git a/packages/beacon-node/test/unit/eth1/eth1DepositDataTracker.test.ts b/packages/beacon-node/test/unit/eth1/eth1DepositDataTracker.test.ts index 40988ed21728..d46e2870fd41 100644 --- a/packages/beacon-node/test/unit/eth1/eth1DepositDataTracker.test.ts +++ b/packages/beacon-node/test/unit/eth1/eth1DepositDataTracker.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect, beforeEach, afterEach, vi, MockInstance} from "vitest"; import {config} from "@lodestar/config/default"; import {TimeoutError} from "@lodestar/utils"; +import {MockInstance, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {BeaconDb} from "../../../src/db/beacon.js"; import {Eth1DepositDataTracker} from "../../../src/eth1/eth1DepositDataTracker.js"; -import {Eth1Provider} from "../../../src/eth1/provider/eth1Provider.js"; -import {testLogger} from "../../utils/logger.js"; import {defaultEth1Options} from "../../../src/eth1/options.js"; -import {BeaconDb} from "../../../src/db/beacon.js"; +import {Eth1Provider} from "../../../src/eth1/provider/eth1Provider.js"; import {getMockedBeaconDb} from "../../mocks/mockedBeaconDb.js"; +import {testLogger} from "../../utils/logger.js"; describe("Eth1DepositDataTracker", () => { const controller = new AbortController(); diff --git a/packages/beacon-node/test/unit/eth1/eth1MergeBlockTracker.test.ts b/packages/beacon-node/test/unit/eth1/eth1MergeBlockTracker.test.ts index c7f4c8fb7aa4..38ac5dd87fb7 100644 --- a/packages/beacon-node/test/unit/eth1/eth1MergeBlockTracker.test.ts +++ b/packages/beacon-node/test/unit/eth1/eth1MergeBlockTracker.test.ts @@ -1,11 +1,11 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, afterEach} from "vitest"; import {ChainConfig} from "@lodestar/config"; import {sleep} from "@lodestar/utils"; -import {IEth1Provider} from "../../../src/index.js"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; import {ZERO_HASH} from "../../../src/constants/index.js"; import {Eth1MergeBlockTracker, StatusCode, toPowBlock} from "../../../src/eth1/eth1MergeBlockTracker.js"; import {Eth1ProviderState, EthJsonRpcBlockRaw} from "../../../src/eth1/interface.js"; +import {IEth1Provider} from "../../../src/index.js"; import {testLogger} from "../../utils/logger.js"; describe("eth1 / Eth1MergeBlockTracker", () => { diff --git a/packages/beacon-node/test/unit/eth1/hexEncoding.test.ts b/packages/beacon-node/test/unit/eth1/hexEncoding.test.ts index 5e5dd953cd61..bb2782f2f735 100644 --- a/packages/beacon-node/test/unit/eth1/hexEncoding.test.ts +++ b/packages/beacon-node/test/unit/eth1/hexEncoding.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { QUANTITY, + bytesToQuantity, + numToQuantity, + quantityToBigint, quantityToBytes, quantityToNum, - quantityToBigint, - numToQuantity, - bytesToQuantity, } from "../../../src/eth1/provider/utils.js"; describe("eth1 / hex encoding", () => { diff --git a/packages/beacon-node/test/unit/eth1/jwt.test.ts b/packages/beacon-node/test/unit/eth1/jwt.test.ts index 5ebcdc17e355..c96344b37c6a 100644 --- a/packages/beacon-node/test/unit/eth1/jwt.test.ts +++ b/packages/beacon-node/test/unit/eth1/jwt.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {encodeJwtToken, decodeJwtToken} from "../../../src/eth1/provider/jwt.js"; +import {describe, expect, it} from "vitest"; +import {decodeJwtToken, encodeJwtToken} from "../../../src/eth1/provider/jwt.js"; describe("ExecutionEngine / jwt", () => { it("encode/decode correctly", () => { diff --git a/packages/beacon-node/test/unit/eth1/utils/depositContract.test.ts b/packages/beacon-node/test/unit/eth1/utils/depositContract.test.ts index 22ca95765a9a..260cb4fef4bd 100644 --- a/packages/beacon-node/test/unit/eth1/utils/depositContract.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/depositContract.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {goerliTestnetLogs, goerliTestnetDepositEvents} from "../../../utils/testnet.js"; +import {describe, expect, it} from "vitest"; import {parseDepositLog} from "../../../../src/eth1/utils/depositContract.js"; +import {goerliTestnetDepositEvents, goerliTestnetLogs} from "../../../utils/testnet.js"; describe("eth1 / util / depositContract", () => { it("Should parse a raw deposit log", () => { diff --git a/packages/beacon-node/test/unit/eth1/utils/deposits.test.ts b/packages/beacon-node/test/unit/eth1/utils/deposits.test.ts index 34334d1b3f8b..2853bff0f8dd 100644 --- a/packages/beacon-node/test/unit/eth1/utils/deposits.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/deposits.test.ts @@ -1,15 +1,15 @@ -import {describe, it, expect} from "vitest"; -import {phase0, ssz} from "@lodestar/types"; +import {createChainForkConfig} from "@lodestar/config"; import {MAX_DEPOSITS, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {phase0, ssz} from "@lodestar/types"; import {verifyMerkleBranch} from "@lodestar/utils"; -import {createChainForkConfig} from "@lodestar/config"; -import {filterBy} from "../../../utils/db.js"; -import {Eth1ErrorCode} from "../../../../src/eth1/errors.js"; -import {generateState} from "../../../utils/state.js"; -import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; -import {getDeposits, getDepositsWithProofs, DepositGetter} from "../../../../src/eth1/utils/deposits.js"; +import {describe, expect, it} from "vitest"; import {DepositTree} from "../../../../src/db/repositories/depositDataRoot.js"; +import {Eth1ErrorCode} from "../../../../src/eth1/errors.js"; +import {DepositGetter, getDeposits, getDepositsWithProofs} from "../../../../src/eth1/utils/deposits.js"; import {createCachedBeaconStateTest} from "../../../utils/cachedBeaconState.js"; +import {filterBy} from "../../../utils/db.js"; +import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; +import {generateState} from "../../../utils/state.js"; describe("eth1 / util / deposits", () => { describe("getDeposits", () => { diff --git a/packages/beacon-node/test/unit/eth1/utils/eth1Data.test.ts b/packages/beacon-node/test/unit/eth1/utils/eth1Data.test.ts index dff98500b293..c4107d06e43e 100644 --- a/packages/beacon-node/test/unit/eth1/utils/eth1Data.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/eth1Data.test.ts @@ -1,16 +1,16 @@ -import {describe, it, expect} from "vitest"; import {Root, phase0, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; -import {iteratorFromArray} from "../../../utils/interator.js"; +import {describe, expect, it} from "vitest"; +import {DepositTree} from "../../../../src/db/repositories/depositDataRoot.js"; +import {Eth1ErrorCode} from "../../../../src/eth1/errors.js"; +import {Eth1Block} from "../../../../src/eth1/interface.js"; import { - getEth1DataForBlocks, - getDepositsByBlockNumber, getDepositRootByDepositCount, + getDepositsByBlockNumber, + getEth1DataForBlocks, } from "../../../../src/eth1/utils/eth1Data.js"; -import {Eth1Block} from "../../../../src/eth1/interface.js"; import {expectRejectedWithLodestarError} from "../../../utils/errors.js"; -import {Eth1ErrorCode} from "../../../../src/eth1/errors.js"; -import {DepositTree} from "../../../../src/db/repositories/depositDataRoot.js"; +import {iteratorFromArray} from "../../../utils/interator.js"; describe("eth1 / util / getEth1DataForBlocks", () => { type TestCase = { diff --git a/packages/beacon-node/test/unit/eth1/utils/eth1DepositEvent.test.ts b/packages/beacon-node/test/unit/eth1/utils/eth1DepositEvent.test.ts index ea504464778c..a1de0fa748e3 100644 --- a/packages/beacon-node/test/unit/eth1/utils/eth1DepositEvent.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/eth1DepositEvent.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {assertConsecutiveDeposits} from "../../../../src/eth1/utils/eth1DepositEvent.js"; describe("eth1 / util / assertConsecutiveDeposits", () => { diff --git a/packages/beacon-node/test/unit/eth1/utils/eth1Vote.test.ts b/packages/beacon-node/test/unit/eth1/utils/eth1Vote.test.ts index e9a9ab5aad24..f8221f76a0f5 100644 --- a/packages/beacon-node/test/unit/eth1/utils/eth1Vote.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/eth1Vote.test.ts @@ -1,16 +1,16 @@ -import {describe, it, expect} from "vitest"; -import {config} from "@lodestar/config/default"; -import {phase0, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; +import {config} from "@lodestar/config/default"; import {BeaconStateAllForks} from "@lodestar/state-transition"; -import {generateState} from "../../../utils/state.js"; -import {filterBy} from "../../../utils/db.js"; +import {phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import { + Eth1DataGetter, getEth1VotesToConsider, pickEth1Vote, votingPeriodStartTime, - Eth1DataGetter, } from "../../../../src/eth1/utils/eth1Vote.js"; +import {filterBy} from "../../../utils/db.js"; +import {generateState} from "../../../utils/state.js"; describe("eth1 / util / eth1Vote", () => { function generateEth1Vote(i: number): phase0.Eth1Data { diff --git a/packages/beacon-node/test/unit/eth1/utils/groupDepositEventsByBlock.test.ts b/packages/beacon-node/test/unit/eth1/utils/groupDepositEventsByBlock.test.ts index a4e786b3aa68..6c9e9b47c1ae 100644 --- a/packages/beacon-node/test/unit/eth1/utils/groupDepositEventsByBlock.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/groupDepositEventsByBlock.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {phase0} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {groupDepositEventsByBlock} from "../../../../src/eth1/utils/groupDepositEventsByBlock.js"; describe("eth1 / util / groupDepositEventsByBlock", () => { diff --git a/packages/beacon-node/test/unit/eth1/utils/optimizeNextBlockDiffForGenesis.test.ts b/packages/beacon-node/test/unit/eth1/utils/optimizeNextBlockDiffForGenesis.test.ts index 39c4a4d6e773..38a4e6fa83e2 100644 --- a/packages/beacon-node/test/unit/eth1/utils/optimizeNextBlockDiffForGenesis.test.ts +++ b/packages/beacon-node/test/unit/eth1/utils/optimizeNextBlockDiffForGenesis.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {optimizeNextBlockDiffForGenesis} from "../../../../src/eth1/utils/optimizeNextBlockDiffForGenesis.js"; +import {describe, expect, it} from "vitest"; import {Eth1Block} from "../../../../src/eth1/interface.js"; +import {optimizeNextBlockDiffForGenesis} from "../../../../src/eth1/utils/optimizeNextBlockDiffForGenesis.js"; describe("eth1 / utils / optimizeNextBlockDiffForGenesis", () => { it("should return optimized block diff to find genesis time", () => { diff --git a/packages/beacon-node/test/unit/execution/engine/utils.test.ts b/packages/beacon-node/test/unit/execution/engine/utils.test.ts index b81c3e965390..c181166c2aea 100644 --- a/packages/beacon-node/test/unit/execution/engine/utils.test.ts +++ b/packages/beacon-node/test/unit/execution/engine/utils.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect} from "vitest"; -import {ErrorAborted} from "@lodestar/utils"; import {FetchError} from "@lodestar/api"; -import {ExecutionPayloadStatus, ExecutionEngineState} from "../../../../src/execution/index.js"; +import {ErrorAborted} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; +import {ErrorJsonRpcResponse, HttpRpcError} from "../../../../src/eth1/provider/jsonRpcHttpClient.js"; import { HTTP_CONNECTION_ERROR_CODES, HTTP_FATAL_ERROR_CODES, getExecutionEngineState, } from "../../../../src/execution/engine/utils.js"; +import {ExecutionEngineState, ExecutionPayloadStatus} from "../../../../src/execution/index.js"; import {QueueError, QueueErrorCode} from "../../../../src/util/queue/errors.js"; -import {ErrorJsonRpcResponse, HttpRpcError} from "../../../../src/eth1/provider/jsonRpcHttpClient.js"; describe("execution / engine / utils", () => { describe("getExecutionEngineState", () => { diff --git a/packages/beacon-node/test/unit/executionEngine/http.test.ts b/packages/beacon-node/test/unit/executionEngine/http.test.ts index c9f4ae671e53..5c7078500640 100644 --- a/packages/beacon-node/test/unit/executionEngine/http.test.ts +++ b/packages/beacon-node/test/unit/executionEngine/http.test.ts @@ -1,16 +1,16 @@ -import {fastify} from "fastify"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; -import {ForkName} from "@lodestar/params"; import {Logger} from "@lodestar/logger"; +import {ForkName} from "@lodestar/params"; +import {fastify} from "fastify"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; +import {RpcPayload} from "../../../src/eth1/interface.js"; +import {numToQuantity} from "../../../src/eth1/provider/utils.js"; import {defaultExecutionEngineHttpOpts} from "../../../src/execution/engine/http.js"; -import {IExecutionEngine, initializeExecutionEngine} from "../../../src/execution/index.js"; import { parseExecutionPayload, serializeExecutionPayload, serializeExecutionPayloadBody, } from "../../../src/execution/engine/types.js"; -import {RpcPayload} from "../../../src/eth1/interface.js"; -import {numToQuantity} from "../../../src/eth1/provider/utils.js"; +import {IExecutionEngine, initializeExecutionEngine} from "../../../src/execution/index.js"; describe("ExecutionEngine / http", () => { const afterCallbacks: (() => Promise | void)[] = []; diff --git a/packages/beacon-node/test/unit/executionEngine/httpRetry.test.ts b/packages/beacon-node/test/unit/executionEngine/httpRetry.test.ts index b254fc9d8b45..e84a1edd1e4f 100644 --- a/packages/beacon-node/test/unit/executionEngine/httpRetry.test.ts +++ b/packages/beacon-node/test/unit/executionEngine/httpRetry.test.ts @@ -1,11 +1,11 @@ -import {fastify} from "fastify"; import {fromHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; -import {ForkName} from "@lodestar/params"; import {Logger} from "@lodestar/logger"; -import {defaultExecutionEngineHttpOpts} from "../../../src/execution/engine/http.js"; +import {ForkName} from "@lodestar/params"; +import {fastify} from "fastify"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {bytesToData, numToQuantity} from "../../../src/eth1/provider/utils.js"; -import {IExecutionEngine, initializeExecutionEngine, PayloadAttributes} from "../../../src/execution/index.js"; +import {defaultExecutionEngineHttpOpts} from "../../../src/execution/engine/http.js"; +import {IExecutionEngine, PayloadAttributes, initializeExecutionEngine} from "../../../src/execution/index.js"; describe("ExecutionEngine / http ", () => { const afterCallbacks: (() => Promise | void)[] = []; diff --git a/packages/beacon-node/test/unit/metrics/beacon.test.ts b/packages/beacon-node/test/unit/metrics/beacon.test.ts index 070ea9064be5..b1d32166fe33 100644 --- a/packages/beacon-node/test/unit/metrics/beacon.test.ts +++ b/packages/beacon-node/test/unit/metrics/beacon.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {createMetricsTest} from "./utils.js"; describe("BeaconMetrics", () => { diff --git a/packages/beacon-node/test/unit/metrics/metrics.test.ts b/packages/beacon-node/test/unit/metrics/metrics.test.ts index 327142a81b5f..f654f97180af 100644 --- a/packages/beacon-node/test/unit/metrics/metrics.test.ts +++ b/packages/beacon-node/test/unit/metrics/metrics.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {createMetricsTest} from "./utils.js"; describe("Metrics", () => { diff --git a/packages/beacon-node/test/unit/metrics/server/http.test.ts b/packages/beacon-node/test/unit/metrics/server/http.test.ts index 623410ccd7ae..4356a2e579e8 100644 --- a/packages/beacon-node/test/unit/metrics/server/http.test.ts +++ b/packages/beacon-node/test/unit/metrics/server/http.test.ts @@ -1,6 +1,6 @@ -import {describe, it, afterAll} from "vitest"; import {fetch} from "@lodestar/api"; -import {getHttpMetricsServer, HttpMetricsServer} from "../../../../src/metrics/index.js"; +import {afterAll, describe, it} from "vitest"; +import {HttpMetricsServer, getHttpMetricsServer} from "../../../../src/metrics/index.js"; import {testLogger} from "../../../utils/logger.js"; import {createMetricsTest} from "../utils.js"; diff --git a/packages/beacon-node/test/unit/metrics/utils.test.ts b/packages/beacon-node/test/unit/metrics/utils.test.ts index 921a549eaf5c..8932d601c273 100644 --- a/packages/beacon-node/test/unit/metrics/utils.test.ts +++ b/packages/beacon-node/test/unit/metrics/utils.test.ts @@ -1,5 +1,5 @@ import {Gauge, Registry} from "prom-client"; -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {GaugeExtra} from "../../../src/metrics/utils/gauge.js"; type MetricValue = { diff --git a/packages/beacon-node/test/unit/metrics/utils.ts b/packages/beacon-node/test/unit/metrics/utils.ts index 53e61826250c..93c635d15b85 100644 --- a/packages/beacon-node/test/unit/metrics/utils.ts +++ b/packages/beacon-node/test/unit/metrics/utils.ts @@ -1,6 +1,6 @@ import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; -import {createMetrics, Metrics} from "../../../src/metrics/index.js"; +import {Metrics, createMetrics} from "../../../src/metrics/index.js"; import {testLogger} from "../../utils/logger.js"; export function createMetricsTest(): Metrics { diff --git a/packages/beacon-node/test/unit/monitoring/clientStats.test.ts b/packages/beacon-node/test/unit/monitoring/clientStats.test.ts index d14fd88796f2..e4e1e3714a6e 100644 --- a/packages/beacon-node/test/unit/monitoring/clientStats.test.ts +++ b/packages/beacon-node/test/unit/monitoring/clientStats.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {ClientStats} from "../../../src/monitoring/types.js"; +import {describe, expect, it} from "vitest"; import {createClientStats} from "../../../src/monitoring/clientStats.js"; +import {ClientStats} from "../../../src/monitoring/types.js"; import {BEACON_NODE_STATS_SCHEMA, ClientStatsSchema, SYSTEM_STATS_SCHEMA, VALIDATOR_STATS_SCHEMA} from "./schemas.js"; describe("monitoring / clientStats", () => { diff --git a/packages/beacon-node/test/unit/monitoring/properties.test.ts b/packages/beacon-node/test/unit/monitoring/properties.test.ts index 1a2e2c58377a..184617389443 100644 --- a/packages/beacon-node/test/unit/monitoring/properties.test.ts +++ b/packages/beacon-node/test/unit/monitoring/properties.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeAll} from "vitest"; +import {beforeAll, describe, expect, it} from "vitest"; import {Metrics} from "../../../src/metrics/index.js"; import {DynamicProperty, MetricProperty, StaticProperty} from "../../../src/monitoring/properties.js"; import {JsonType} from "../../../src/monitoring/types.js"; diff --git a/packages/beacon-node/test/unit/monitoring/service.test.ts b/packages/beacon-node/test/unit/monitoring/service.test.ts index fed64b9bc553..06fd0d1f511a 100644 --- a/packages/beacon-node/test/unit/monitoring/service.test.ts +++ b/packages/beacon-node/test/unit/monitoring/service.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect, beforeEach, beforeAll, afterAll, vi, afterEach, MockInstance} from "vitest"; -import {Histogram} from "prom-client"; import {ErrorAborted, TimeoutError} from "@lodestar/utils"; +import {Histogram} from "prom-client"; +import {MockInstance, afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {RegistryMetricCreator} from "../../../src/index.js"; -import {MonitoringService} from "../../../src/monitoring/service.js"; import {MonitoringOptions} from "../../../src/monitoring/options.js"; -import {sleep} from "../../utils/sleep.js"; +import {MonitoringService} from "../../../src/monitoring/service.js"; import {MockedLogger, getMockedLogger} from "../../mocks/loggerMock.js"; -import {startRemoteService, remoteServiceRoutes, remoteServiceError} from "./remoteService.js"; +import {sleep} from "../../utils/sleep.js"; +import {remoteServiceError, remoteServiceRoutes, startRemoteService} from "./remoteService.js"; describe("monitoring / service", () => { const endpoint = "https://test.example.com/api/v1/client/metrics"; diff --git a/packages/beacon-node/test/unit/network/beaconBlocksMaybeBlobsByRange.test.ts b/packages/beacon-node/test/unit/network/beaconBlocksMaybeBlobsByRange.test.ts index 2104235e7215..2d9c0967a409 100644 --- a/packages/beacon-node/test/unit/network/beaconBlocksMaybeBlobsByRange.test.ts +++ b/packages/beacon-node/test/unit/network/beaconBlocksMaybeBlobsByRange.test.ts @@ -1,13 +1,13 @@ -import {describe, it, expect, beforeAll} from "vitest"; -import {ssz, deneb} from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; +import {ForkName} from "@lodestar/params"; +import {deneb, ssz} from "@lodestar/types"; +import {beforeAll, describe, expect, it} from "vitest"; +import {BlobsSource, BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; +import {ZERO_HASH} from "../../../src/constants/constants.js"; +import {INetwork} from "../../../src/network/interface.js"; import {beaconBlocksMaybeBlobsByRange} from "../../../src/network/reqresp/index.js"; -import {BlockSource, BlobsSource, getBlockInput} from "../../../src/chain/blocks/types.js"; import {initCKZG, loadEthereumTrustedSetup} from "../../../src/util/kzg.js"; -import {INetwork} from "../../../src/network/interface.js"; -import {ZERO_HASH} from "../../../src/constants/constants.js"; describe("beaconBlocksMaybeBlobsByRange", () => { beforeAll(async () => { diff --git a/packages/beacon-node/test/unit/network/fork.test.ts b/packages/beacon-node/test/unit/network/fork.test.ts index bbe1c0870d30..ed11ce979ef0 100644 --- a/packages/beacon-node/test/unit/network/fork.test.ts +++ b/packages/beacon-node/test/unit/network/fork.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; -import {ForkName, ForkSeq} from "@lodestar/params"; import {BeaconConfig, ForkInfo} from "@lodestar/config"; -import {getCurrentAndNextFork, getActiveForks} from "../../../src/network/forks.js"; +import {ForkName, ForkSeq} from "@lodestar/params"; +import {describe, expect, it} from "vitest"; +import {getActiveForks, getCurrentAndNextFork} from "../../../src/network/forks.js"; function getForkConfig({ phase0, diff --git a/packages/beacon-node/test/unit/network/gossip/topic.test.ts b/packages/beacon-node/test/unit/network/gossip/topic.test.ts index 2a61d8604439..f68c2d737fd6 100644 --- a/packages/beacon-node/test/unit/network/gossip/topic.test.ts +++ b/packages/beacon-node/test/unit/network/gossip/topic.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; import {ForkName} from "@lodestar/params"; -import {GossipType, GossipEncoding, GossipTopicMap} from "../../../../src/network/gossip/index.js"; +import {describe, expect, it} from "vitest"; +import {GossipEncoding, GossipTopicMap, GossipType} from "../../../../src/network/gossip/index.js"; import {parseGossipTopic, stringifyGossipTopic} from "../../../../src/network/gossip/topic.js"; import {config} from "../../../utils/config.js"; diff --git a/packages/beacon-node/test/unit/network/metadata.test.ts b/packages/beacon-node/test/unit/network/metadata.test.ts index 50e4157a29cd..90b75a16df66 100644 --- a/packages/beacon-node/test/unit/network/metadata.test.ts +++ b/packages/beacon-node/test/unit/network/metadata.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {toHex} from "@lodestar/utils"; import {ssz} from "@lodestar/types"; +import {toHex} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {getENRForkID} from "../../../src/network/metadata.js"; import {config} from "../../utils/config.js"; diff --git a/packages/beacon-node/test/unit/network/peers/client.test.ts b/packages/beacon-node/test/unit/network/peers/client.test.ts index 44d16ad4bb8f..6d280d82ddcf 100644 --- a/packages/beacon-node/test/unit/network/peers/client.test.ts +++ b/packages/beacon-node/test/unit/network/peers/client.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {getKnownClientFromAgentVersion, ClientKind} from "../../../../src/network/peers/client.js"; +import {describe, expect, it} from "vitest"; +import {ClientKind, getKnownClientFromAgentVersion} from "../../../../src/network/peers/client.js"; describe("clientFromAgentVersion", () => { const testCases: {name: string; agentVersion: string; client: ClientKind | null}[] = [ diff --git a/packages/beacon-node/test/unit/network/peers/datastore.test.ts b/packages/beacon-node/test/unit/network/peers/datastore.test.ts index 6ef60b0962e5..01bdc5b058e5 100644 --- a/packages/beacon-node/test/unit/network/peers/datastore.test.ts +++ b/packages/beacon-node/test/unit/network/peers/datastore.test.ts @@ -1,6 +1,6 @@ import {LevelDatastore} from "datastore-level"; import {Key} from "interface-datastore"; -import {describe, it, expect, beforeEach, afterEach, vi, MockedObject} from "vitest"; +import {MockedObject, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {Eth2PeerDataStore} from "../../../../src/network/peers/datastore.js"; vi.mock("datastore-level"); diff --git a/packages/beacon-node/test/unit/network/peers/discover.test.ts b/packages/beacon-node/test/unit/network/peers/discover.test.ts index 52e254ec70aa..40614a3c55d1 100644 --- a/packages/beacon-node/test/unit/network/peers/discover.test.ts +++ b/packages/beacon-node/test/unit/network/peers/discover.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {getValidPeerId} from "../../../utils/peer.js"; +import {describe, expect, it} from "vitest"; import {peerIdFromString} from "../../../../src/util/peerId.js"; +import {getValidPeerId} from "../../../utils/peer.js"; describe("network / peers / discover", () => { it("PeerId API", () => { diff --git a/packages/beacon-node/test/unit/network/peers/priorization.test.ts b/packages/beacon-node/test/unit/network/peers/priorization.test.ts index 26f8d8c9e535..168335a4bd31 100644 --- a/packages/beacon-node/test/unit/network/peers/priorization.test.ts +++ b/packages/beacon-node/test/unit/network/peers/priorization.test.ts @@ -1,16 +1,16 @@ +import {BitArray} from "@chainsafe/ssz"; import {PeerId} from "@libp2p/interface"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; -import {BitArray} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; +import {describe, expect, it} from "vitest"; +import {RequestedSubnet} from "../../../../src/network/peers/utils/index.js"; import { ExcessPeerDisconnectReason, - prioritizePeers, PrioritizePeersOpts, + prioritizePeers, sortPeersToPrune, } from "../../../../src/network/peers/utils/prioritizePeers.js"; import {getAttnets, getSyncnets} from "../../../utils/network.js"; -import {RequestedSubnet} from "../../../../src/network/peers/utils/index.js"; type Result = ReturnType; diff --git a/packages/beacon-node/test/unit/network/peers/score.test.ts b/packages/beacon-node/test/unit/network/peers/score.test.ts index 8962b282e0ad..2a5c7d51be59 100644 --- a/packages/beacon-node/test/unit/network/peers/score.test.ts +++ b/packages/beacon-node/test/unit/network/peers/score.test.ts @@ -1,13 +1,13 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {MapDef} from "@lodestar/utils"; -import {peerIdFromString} from "../../../../src/util/peerId.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import { PeerAction, - ScoreState, PeerRpcScoreStore, - updateGossipsubScores, RealScore, + ScoreState, + updateGossipsubScores, } from "../../../../src/network/peers/score/index.js"; +import {peerIdFromString} from "../../../../src/util/peerId.js"; vi.mock("../../../../src/network/peers/score/index.js", async (importActual) => { const mod = await importActual(); diff --git a/packages/beacon-node/test/unit/network/peers/utils/assertPeerRelevance.test.ts b/packages/beacon-node/test/unit/network/peers/utils/assertPeerRelevance.test.ts index 19cf4a9e9c5e..b3ee9e49b3ed 100644 --- a/packages/beacon-node/test/unit/network/peers/utils/assertPeerRelevance.test.ts +++ b/packages/beacon-node/test/unit/network/peers/utils/assertPeerRelevance.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; import {phase0} from "@lodestar/types"; -import {assertPeerRelevance, IrrelevantPeerCode} from "../../../../../src/network/peers/utils/assertPeerRelevance.js"; +import {describe, expect, it} from "vitest"; +import {IrrelevantPeerCode, assertPeerRelevance} from "../../../../../src/network/peers/utils/assertPeerRelevance.js"; describe("network / peers / utils / assertPeerRelevance", () => { const correctForkDigest = Buffer.alloc(4, 0); diff --git a/packages/beacon-node/test/unit/network/peers/utils/enrSubnets.test.ts b/packages/beacon-node/test/unit/network/peers/utils/enrSubnets.test.ts index 1c738c764404..c13cc6152f36 100644 --- a/packages/beacon-node/test/unit/network/peers/utils/enrSubnets.test.ts +++ b/packages/beacon-node/test/unit/network/peers/utils/enrSubnets.test.ts @@ -1,8 +1,8 @@ import {BitArray} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params"; import {ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {deserializeEnrSubnets} from "../../../../../src/network/peers/utils/enrSubnetsDeserialize.js"; describe("ENR syncnets", () => { diff --git a/packages/beacon-node/test/unit/network/processor/aggregatorTracker.test.ts b/packages/beacon-node/test/unit/network/processor/aggregatorTracker.test.ts index da907fd737e9..f211ebbeffae 100644 --- a/packages/beacon-node/test/unit/network/processor/aggregatorTracker.test.ts +++ b/packages/beacon-node/test/unit/network/processor/aggregatorTracker.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {AggregatorTracker} from "../../../../src/network/processor/aggregatorTracker.js"; describe("AggregatorTracker", () => { diff --git a/packages/beacon-node/test/unit/network/processor/gossipQueues/indexed.test.ts b/packages/beacon-node/test/unit/network/processor/gossipQueues/indexed.test.ts index 97f6bb804c99..3776f3e6cfd1 100644 --- a/packages/beacon-node/test/unit/network/processor/gossipQueues/indexed.test.ts +++ b/packages/beacon-node/test/unit/network/processor/gossipQueues/indexed.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {IndexedGossipQueueMinSize} from "../../../../../src/network/processor/gossipQueues/indexed.js"; type Item = { diff --git a/packages/beacon-node/test/unit/network/processor/gossipQueues/linear.test.ts b/packages/beacon-node/test/unit/network/processor/gossipQueues/linear.test.ts index 5848e1885622..9ad7c8e8b4ad 100644 --- a/packages/beacon-node/test/unit/network/processor/gossipQueues/linear.test.ts +++ b/packages/beacon-node/test/unit/network/processor/gossipQueues/linear.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {LinearGossipQueue} from "../../../../../src/network/processor/gossipQueues/linear.js"; import {DropType} from "../../../../../src/network/processor/gossipQueues/types.js"; import {QueueType} from "../../../../../src/util/queue/index.js"; diff --git a/packages/beacon-node/test/unit/network/processorQueues.test.ts b/packages/beacon-node/test/unit/network/processorQueues.test.ts index 07a10591c0ad..23caae9dd774 100644 --- a/packages/beacon-node/test/unit/network/processorQueues.test.ts +++ b/packages/beacon-node/test/unit/network/processorQueues.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {sleep} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; type ValidateOpts = { skipAsync1: boolean; diff --git a/packages/beacon-node/test/unit/network/reqresp/collectSequentialBlocksInRange.test.ts b/packages/beacon-node/test/unit/network/reqresp/collectSequentialBlocksInRange.test.ts index fa9b47ebf026..79f076c828a7 100644 --- a/packages/beacon-node/test/unit/network/reqresp/collectSequentialBlocksInRange.test.ts +++ b/packages/beacon-node/test/unit/network/reqresp/collectSequentialBlocksInRange.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; -import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types"; -import {ResponseIncoming} from "@lodestar/reqresp"; import {ForkName} from "@lodestar/params"; +import {ResponseIncoming} from "@lodestar/reqresp"; +import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import { BlocksByRangeError, BlocksByRangeErrorCode, diff --git a/packages/beacon-node/test/unit/network/reqresp/utils.ts b/packages/beacon-node/test/unit/network/reqresp/utils.ts index 231bd0cc42fb..01ec743b5258 100644 --- a/packages/beacon-node/test/unit/network/reqresp/utils.ts +++ b/packages/beacon-node/test/unit/network/reqresp/utils.ts @@ -1,9 +1,9 @@ -import {expect} from "vitest"; +import {toHexString} from "@chainsafe/ssz"; import {Direction, ReadStatus, Stream, StreamStatus, WriteStatus} from "@libp2p/interface"; import {logger} from "@libp2p/logger"; -import {Uint8ArrayList} from "uint8arraylist"; -import {toHexString} from "@chainsafe/ssz"; import {Root} from "@lodestar/types"; +import {Uint8ArrayList} from "uint8arraylist"; +import {expect} from "vitest"; export function generateRoots(count: number, offset = 0): Root[] { const roots: Root[] = []; diff --git a/packages/beacon-node/test/unit/network/subnets/attnetsService.test.ts b/packages/beacon-node/test/unit/network/subnets/attnetsService.test.ts index d279a5d759d7..5e7149f4d7f8 100644 --- a/packages/beacon-node/test/unit/network/subnets/attnetsService.test.ts +++ b/packages/beacon-node/test/unit/network/subnets/attnetsService.test.ts @@ -1,6 +1,4 @@ -import {describe, it, expect, beforeEach, vi, MockedObject, afterEach} from "vitest"; import {createBeaconConfig} from "@lodestar/config"; -import {ZERO_HASH} from "@lodestar/state-transition"; import { ATTESTATION_SUBNET_COUNT, EPOCHS_PER_SUBNET_SUBSCRIPTION, @@ -8,14 +6,16 @@ import { SLOTS_PER_EPOCH, SUBNETS_PER_NODE, } from "@lodestar/params"; +import {ZERO_HASH} from "@lodestar/state-transition"; import {getCurrentSlot} from "@lodestar/state-transition"; import {bigIntToBytes} from "@lodestar/utils"; -import {Clock, IClock} from "../../../../src/util/clock.js"; +import {MockedObject, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {Eth2Gossipsub} from "../../../../src/network/gossip/gossipsub.js"; import {MetadataController} from "../../../../src/network/metadata.js"; -import {testLogger} from "../../../utils/logger.js"; import {AttnetsService} from "../../../../src/network/subnets/attnetsService.js"; import {CommitteeSubscription} from "../../../../src/network/subnets/interface.js"; +import {Clock, IClock} from "../../../../src/util/clock.js"; +import {testLogger} from "../../../utils/logger.js"; vi.mock("../../../../src/network/gossip/gossipsub.js"); diff --git a/packages/beacon-node/test/unit/network/subnets/util.test.ts b/packages/beacon-node/test/unit/network/subnets/util.test.ts index dc2f261d021e..edcc96a772da 100644 --- a/packages/beacon-node/test/unit/network/subnets/util.test.ts +++ b/packages/beacon-node/test/unit/network/subnets/util.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {bigIntToBytes} from "@lodestar/utils"; import {ATTESTATION_SUBNET_PREFIX_BITS, NODE_ID_BITS} from "@lodestar/params"; +import {bigIntToBytes} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {getNodeIdPrefix, getNodeOffset} from "../../../../src/network/subnets/util.js"; const nodeIds: string[] = [ diff --git a/packages/beacon-node/test/unit/network/util.test.ts b/packages/beacon-node/test/unit/network/util.test.ts index 70da41bd2c2a..57e18a34a77b 100644 --- a/packages/beacon-node/test/unit/network/util.test.ts +++ b/packages/beacon-node/test/unit/network/util.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, afterEach} from "vitest"; import {config} from "@lodestar/config/default"; import {ForkName} from "@lodestar/params"; -import {getDiscv5Multiaddrs} from "../../../src/network/libp2p/index.js"; +import {afterEach, describe, expect, it} from "vitest"; import {getCurrentAndNextFork} from "../../../src/network/forks.js"; +import {getDiscv5Multiaddrs} from "../../../src/network/libp2p/index.js"; describe("getCurrentAndNextFork", () => { const altairEpoch = config.forks.altair.epoch; diff --git a/packages/beacon-node/test/unit/sync/backfill/verify.test.ts b/packages/beacon-node/test/unit/sync/backfill/verify.test.ts index 3197013455e3..fb00e5840317 100644 --- a/packages/beacon-node/test/unit/sync/backfill/verify.test.ts +++ b/packages/beacon-node/test/unit/sync/backfill/verify.test.ts @@ -1,13 +1,13 @@ import fs from "node:fs"; import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect} from "vitest"; import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; -import {phase0, ssz, WithBytes} from "@lodestar/types"; -import {verifyBlockSequence} from "../../../../src/sync/backfill/verify.js"; +import {WithBytes, phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {ZERO_HASH} from "../../../../src/constants/constants.js"; -import {BackfillSyncErrorCode, BackfillSyncError} from "./../../../../src/sync/backfill/errors.js"; +import {verifyBlockSequence} from "../../../../src/sync/backfill/verify.js"; +import {BackfillSyncError, BackfillSyncErrorCode} from "./../../../../src/sync/backfill/errors.js"; // Global variable __dirname no longer available in ES6 modules. // Solutions: https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules diff --git a/packages/beacon-node/test/unit/sync/range/batch.test.ts b/packages/beacon-node/test/unit/sync/range/batch.test.ts index 02f49226c11f..2a140760e827 100644 --- a/packages/beacon-node/test/unit/sync/range/batch.test.ts +++ b/packages/beacon-node/test/unit/sync/range/batch.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {config} from "@lodestar/config/default"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {expectThrowsLodestarError} from "../../../utils/errors.js"; -import {Batch, BatchStatus, BatchErrorCode, BatchError} from "../../../../src/sync/range/batch.js"; -import {EPOCHS_PER_BATCH} from "../../../../src/sync/constants.js"; +import {describe, expect, it} from "vitest"; import {BlockSource, getBlockInput} from "../../../../src/chain/blocks/types.js"; +import {EPOCHS_PER_BATCH} from "../../../../src/sync/constants.js"; +import {Batch, BatchError, BatchErrorCode, BatchStatus} from "../../../../src/sync/range/batch.js"; +import {expectThrowsLodestarError} from "../../../utils/errors.js"; import {validPeerIdStr} from "../../../utils/peer.js"; describe("sync / range / batch", () => { // Common mock data diff --git a/packages/beacon-node/test/unit/sync/range/chain.test.ts b/packages/beacon-node/test/unit/sync/range/chain.test.ts index 658f950b2c18..a761cd3a739a 100644 --- a/packages/beacon-node/test/unit/sync/range/chain.test.ts +++ b/packages/beacon-node/test/unit/sync/range/chain.test.ts @@ -1,16 +1,16 @@ -import {describe, it, afterEach} from "vitest"; import {config} from "@lodestar/config/default"; -import {Logger} from "@lodestar/utils"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {Epoch, phase0, Slot, ssz} from "@lodestar/types"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {linspace} from "../../../../src/util/numpy.js"; -import {SyncChain, SyncChainFns, ChainTarget} from "../../../../src/sync/range/chain.js"; -import {RangeSyncType} from "../../../../src/sync/utils/remoteSyncType.js"; +import {Epoch, Slot, phase0, ssz} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; +import {afterEach, describe, it} from "vitest"; +import {BlockInput, BlockSource, getBlockInput} from "../../../../src/chain/blocks/types.js"; import {ZERO_HASH} from "../../../../src/constants/index.js"; +import {ChainTarget, SyncChain, SyncChainFns} from "../../../../src/sync/range/chain.js"; +import {RangeSyncType} from "../../../../src/sync/utils/remoteSyncType.js"; +import {linspace} from "../../../../src/util/numpy.js"; import {testLogger} from "../../../utils/logger.js"; import {validPeerIdStr} from "../../../utils/peer.js"; -import {BlockInput, BlockSource, getBlockInput} from "../../../../src/chain/blocks/types.js"; describe("sync / range / chain", () => { const testCases: { diff --git a/packages/beacon-node/test/unit/sync/range/utils/batches.test.ts b/packages/beacon-node/test/unit/sync/range/utils/batches.test.ts index c3c6a273dd8d..fcc5f9a1561a 100644 --- a/packages/beacon-node/test/unit/sync/range/utils/batches.test.ts +++ b/packages/beacon-node/test/unit/sync/range/utils/batches.test.ts @@ -1,15 +1,15 @@ -import {describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; -import {Epoch, Slot} from "@lodestar/types"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {validPeerIdStr} from "../../../../utils/peer.js"; +import {Epoch, Slot} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {Batch, BatchStatus} from "../../../../../src/sync/range/batch.js"; import { - validateBatchesStatus, getNextBatchToProcess, isSyncChainDone, toBeDownloadedStartEpoch, + validateBatchesStatus, } from "../../../../../src/sync/range/utils/batches.js"; +import {validPeerIdStr} from "../../../../utils/peer.js"; describe("sync / range / batches", () => { const peer = validPeerIdStr; diff --git a/packages/beacon-node/test/unit/sync/range/utils/peerBalancer.test.ts b/packages/beacon-node/test/unit/sync/range/utils/peerBalancer.test.ts index a495c41683d6..0eac008d2ecf 100644 --- a/packages/beacon-node/test/unit/sync/range/utils/peerBalancer.test.ts +++ b/packages/beacon-node/test/unit/sync/range/utils/peerBalancer.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; +import {describe, expect, it} from "vitest"; import {Batch} from "../../../../../src/sync/range/batch.js"; import {ChainPeersBalancer} from "../../../../../src/sync/range/utils/peerBalancer.js"; import {getRandPeerIdStr} from "../../../../utils/peer.js"; diff --git a/packages/beacon-node/test/unit/sync/range/utils/updateChains.test.ts b/packages/beacon-node/test/unit/sync/range/utils/updateChains.test.ts index 4ff2da3d4441..cfdad515fb3c 100644 --- a/packages/beacon-node/test/unit/sync/range/utils/updateChains.test.ts +++ b/packages/beacon-node/test/unit/sync/range/utils/updateChains.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {updateChains} from "../../../../../src/sync/range/utils/updateChains.js"; +import {describe, expect, it} from "vitest"; import {SyncChain} from "../../../../../src/sync/range/chain.js"; +import {updateChains} from "../../../../../src/sync/range/utils/updateChains.js"; import {RangeSyncType} from "../../../../../src/sync/utils/remoteSyncType.js"; describe("sync / range / utils / updateChains", () => { diff --git a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts index 0694cb97f4ab..8476d025d4f9 100644 --- a/packages/beacon-node/test/unit/sync/unknownBlock.test.ts +++ b/packages/beacon-node/test/unit/sync/unknownBlock.test.ts @@ -1,23 +1,23 @@ import EventEmitter from "node:events"; import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; -import {config as minimalConfig} from "@lodestar/config/default"; import {createChainForkConfig} from "@lodestar/config"; +import {config as minimalConfig} from "@lodestar/config/default"; import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {ssz} from "@lodestar/types"; import {notNullish, sleep} from "@lodestar/utils"; -import {MockedBeaconChain, getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; +import {BlockError, BlockErrorCode} from "../../../src/chain/errors/blockError.js"; import {IBeaconChain} from "../../../src/chain/index.js"; +import {SeenBlockProposers} from "../../../src/chain/seenCache/seenBlockProposers.js"; +import {ZERO_HASH} from "../../../src/constants/constants.js"; import {INetwork, NetworkEvent, NetworkEventBus, PeerAction} from "../../../src/network/index.js"; +import {defaultSyncOptions} from "../../../src/sync/options.js"; import {UnknownBlockSync} from "../../../src/sync/unknownBlock.js"; +import {ClockStopped} from "../../mocks/clock.js"; +import {MockedBeaconChain, getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; import {testLogger} from "../../utils/logger.js"; import {getRandPeerIdStr} from "../../utils/peer.js"; -import {BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js"; -import {ClockStopped} from "../../mocks/clock.js"; -import {SeenBlockProposers} from "../../../src/chain/seenCache/seenBlockProposers.js"; -import {BlockError, BlockErrorCode} from "../../../src/chain/errors/blockError.js"; -import {defaultSyncOptions} from "../../../src/sync/options.js"; -import {ZERO_HASH} from "../../../src/constants/constants.js"; describe("sync by UnknownBlockSync", () => { const logger = testLogger(); diff --git a/packages/beacon-node/test/unit/sync/utils/pendingBlocksTree.test.ts b/packages/beacon-node/test/unit/sync/utils/pendingBlocksTree.test.ts index 8e343acc80df..9251c1159c64 100644 --- a/packages/beacon-node/test/unit/sync/utils/pendingBlocksTree.test.ts +++ b/packages/beacon-node/test/unit/sync/utils/pendingBlocksTree.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {RootHex} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {PendingBlock, PendingBlockStatus, UnknownAndAncestorBlocks} from "../../../../src/sync/index.js"; import { getAllDescendantBlocks, diff --git a/packages/beacon-node/test/unit/sync/utils/remoteSyncType.test.ts b/packages/beacon-node/test/unit/sync/utils/remoteSyncType.test.ts index 0c74170e8029..7404362d8805 100644 --- a/packages/beacon-node/test/unit/sync/utils/remoteSyncType.test.ts +++ b/packages/beacon-node/test/unit/sync/utils/remoteSyncType.test.ts @@ -1,13 +1,13 @@ import {toHexString} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {IForkChoice} from "@lodestar/fork-choice"; import {Root, phase0} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {ZERO_HASH} from "../../../../src/constants/index.js"; import { - getPeerSyncType, - getRangeSyncType, PeerSyncType, RangeSyncType, + getPeerSyncType, + getRangeSyncType, } from "../../../../src/sync/utils/remoteSyncType.js"; describe("network / peers / remoteSyncType", () => { diff --git a/packages/beacon-node/test/unit/util/address.test.ts b/packages/beacon-node/test/unit/util/address.test.ts index 27f7eba48e0c..cdc01f52797b 100644 --- a/packages/beacon-node/test/unit/util/address.test.ts +++ b/packages/beacon-node/test/unit/util/address.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {isValidAddress} from "../../../src/util/address.js"; describe("Eth address helper", () => { diff --git a/packages/beacon-node/test/unit/util/array.test.ts b/packages/beacon-node/test/unit/util/array.test.ts index 75d3a1b0856d..343a152bb857 100644 --- a/packages/beacon-node/test/unit/util/array.test.ts +++ b/packages/beacon-node/test/unit/util/array.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect, beforeEach} from "vitest"; -import {findLastIndex, LinkedList} from "../../../src/util/array.js"; +import {beforeEach, describe, expect, it} from "vitest"; +import {LinkedList, findLastIndex} from "../../../src/util/array.js"; describe("findLastIndex", () => { it("should return the last index that matches a predicate", () => { diff --git a/packages/beacon-node/test/unit/util/binarySearch.test.ts b/packages/beacon-node/test/unit/util/binarySearch.test.ts index a64420400c24..cccddbd9ffd8 100644 --- a/packages/beacon-node/test/unit/util/binarySearch.test.ts +++ b/packages/beacon-node/test/unit/util/binarySearch.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {binarySearchLte, ErrorNoValues, ErrorNoValueMinValue} from "../../../src/util/binarySearch.js"; +import {describe, expect, it} from "vitest"; +import {ErrorNoValueMinValue, ErrorNoValues, binarySearchLte} from "../../../src/util/binarySearch.js"; describe("util / binarySearch", () => { describe("binarySearchLte", () => { diff --git a/packages/beacon-node/test/unit/util/bitArray.test.ts b/packages/beacon-node/test/unit/util/bitArray.test.ts index 516b4ae79155..7e569b71a8e2 100644 --- a/packages/beacon-node/test/unit/util/bitArray.test.ts +++ b/packages/beacon-node/test/unit/util/bitArray.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {IntersectResult, intersectUint8Arrays} from "../../../src/util/bitArray.js"; describe("util / bitArray / intersectUint8Arrays", () => { diff --git a/packages/beacon-node/test/unit/util/bufferPool.test.ts b/packages/beacon-node/test/unit/util/bufferPool.test.ts index ff66504ae65f..5c97a05a58e4 100644 --- a/packages/beacon-node/test/unit/util/bufferPool.test.ts +++ b/packages/beacon-node/test/unit/util/bufferPool.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {AllocSource, BufferPool} from "../../../src/util/bufferPool.js"; describe("BufferPool", () => { diff --git a/packages/beacon-node/test/unit/util/bytes.test.ts b/packages/beacon-node/test/unit/util/bytes.test.ts index 1942307cde75..38823939d48b 100644 --- a/packages/beacon-node/test/unit/util/bytes.test.ts +++ b/packages/beacon-node/test/unit/util/bytes.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {fromHexString, toHexString} from "@chainsafe/ssz"; +import {describe, expect, it} from "vitest"; import {byteArrayEquals} from "../../../src/util/bytes.js"; diff --git a/packages/beacon-node/test/unit/util/chunkify.test.ts b/packages/beacon-node/test/unit/util/chunkify.test.ts index 595c5807e1b3..c8af022ccf8e 100644 --- a/packages/beacon-node/test/unit/util/chunkify.test.ts +++ b/packages/beacon-node/test/unit/util/chunkify.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {chunkifyInclusiveRange} from "../../../src/util/chunkify.js"; describe("chunkifyInclusiveRange", () => { diff --git a/packages/beacon-node/test/unit/util/clock.test.ts b/packages/beacon-node/test/unit/util/clock.test.ts index 87955b98182c..cdb4aa39e1aa 100644 --- a/packages/beacon-node/test/unit/util/clock.test.ts +++ b/packages/beacon-node/test/unit/util/clock.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; import {config} from "@lodestar/config/default"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {Clock, ClockEvent} from "../../../src/util/clock.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../../../src/constants/index.js"; +import {Clock, ClockEvent} from "../../../src/util/clock.js"; describe("Clock", () => { let abortController: AbortController; diff --git a/packages/beacon-node/test/unit/util/dependentRoot.test.ts b/packages/beacon-node/test/unit/util/dependentRoot.test.ts index c8044f332e34..3961c3e1730b 100644 --- a/packages/beacon-node/test/unit/util/dependentRoot.test.ts +++ b/packages/beacon-node/test/unit/util/dependentRoot.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect, beforeEach, afterEach, vi, Mocked} from "vitest"; -import {EpochDifference, ProtoBlock, ForkChoice} from "@lodestar/fork-choice"; +import {EpochDifference, ForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {computeEpochAtSlot} from "@lodestar/state-transition"; +import {Mocked, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {getShufflingDependentRoot} from "../../../src/util/dependentRoot.js"; vi.mock("@lodestar/fork-choice"); diff --git a/packages/beacon-node/test/unit/util/error.test.ts b/packages/beacon-node/test/unit/util/error.test.ts index 61aa4e42d35e..0293acf3f2ba 100644 --- a/packages/beacon-node/test/unit/util/error.test.ts +++ b/packages/beacon-node/test/unit/util/error.test.ts @@ -1,6 +1,6 @@ import v8 from "node:v8"; -import {describe, it, expect} from "vitest"; import {RequestError, RequestErrorCode, RespStatus, ResponseError} from "@lodestar/reqresp"; +import {describe, expect, it} from "vitest"; import {fromThreadBoundaryError, toThreadBoundaryError} from "../../../src/util/error.js"; function structuredClone(value: T): T { diff --git a/packages/beacon-node/test/unit/util/file.test.ts b/packages/beacon-node/test/unit/util/file.test.ts index 6040e14b4263..ad8a1a324fff 100644 --- a/packages/beacon-node/test/unit/util/file.test.ts +++ b/packages/beacon-node/test/unit/util/file.test.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {ensureDir, writeIfNotExist} from "../../../src/util/file.js"; describe("file util", () => { diff --git a/packages/beacon-node/test/unit/util/graffiti.test.ts b/packages/beacon-node/test/unit/util/graffiti.test.ts index 0197e39c5e52..89750d423790 100644 --- a/packages/beacon-node/test/unit/util/graffiti.test.ts +++ b/packages/beacon-node/test/unit/util/graffiti.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {getDefaultGraffiti, toGraffitiBuffer} from "../../../src/util/graffiti.js"; +import {describe, expect, it} from "vitest"; import {ClientCode} from "../../../src/execution/index.js"; +import {getDefaultGraffiti, toGraffitiBuffer} from "../../../src/util/graffiti.js"; describe("Graffiti helper", () => { describe("toGraffitiBuffer", () => { diff --git a/packages/beacon-node/test/unit/util/itTrigger.test.ts b/packages/beacon-node/test/unit/util/itTrigger.test.ts index 942791c118bd..ff76cf13eafa 100644 --- a/packages/beacon-node/test/unit/util/itTrigger.test.ts +++ b/packages/beacon-node/test/unit/util/itTrigger.test.ts @@ -1,5 +1,5 @@ import all from "it-all"; -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {ItTrigger} from "../../../src/util/itTrigger.js"; describe("util / itTrigger", () => { diff --git a/packages/beacon-node/test/unit/util/kzg.test.ts b/packages/beacon-node/test/unit/util/kzg.test.ts index 3b1de419ae93..616505268ae1 100644 --- a/packages/beacon-node/test/unit/util/kzg.test.ts +++ b/packages/beacon-node/test/unit/util/kzg.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, afterEach, beforeAll} from "vitest"; -import {bellatrix, deneb, ssz} from "@lodestar/types"; -import {BYTES_PER_FIELD_ELEMENT, BLOB_TX_TYPE} from "@lodestar/params"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; -import {computeBlobSidecars, kzgCommitmentToVersionedHash} from "../../../src/util/blobs.js"; -import {loadEthereumTrustedSetup, initCKZG, ckzg, FIELD_ELEMENTS_PER_BLOB_MAINNET} from "../../../src/util/kzg.js"; +import {BLOB_TX_TYPE, BYTES_PER_FIELD_ELEMENT} from "@lodestar/params"; +import {bellatrix, deneb, ssz} from "@lodestar/types"; +import {afterEach, beforeAll, describe, expect, it} from "vitest"; import {validateBlobSidecars, validateGossipBlobSidecar} from "../../../src/chain/validation/blobSidecar.js"; +import {computeBlobSidecars, kzgCommitmentToVersionedHash} from "../../../src/util/blobs.js"; +import {FIELD_ELEMENTS_PER_BLOB_MAINNET, ckzg, initCKZG, loadEthereumTrustedSetup} from "../../../src/util/kzg.js"; +import {getMockedBeaconChain} from "../../mocks/mockedBeaconChain.js"; describe("C-KZG", () => { const afterEachCallbacks: (() => Promise | void)[] = []; diff --git a/packages/beacon-node/test/unit/util/map.test.ts b/packages/beacon-node/test/unit/util/map.test.ts index 2d568b89ae3f..f336ac1d3d8e 100644 --- a/packages/beacon-node/test/unit/util/map.test.ts +++ b/packages/beacon-node/test/unit/util/map.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {OrderedMap} from "../../../src/util/map.js"; describe("OrderedMap", () => { diff --git a/packages/beacon-node/test/unit/util/metadata.test.ts b/packages/beacon-node/test/unit/util/metadata.test.ts index 4e732d93e5d0..17e2ba04ce37 100644 --- a/packages/beacon-node/test/unit/util/metadata.test.ts +++ b/packages/beacon-node/test/unit/util/metadata.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {getLodestarClientVersion} from "../../../src/util/metadata.js"; +import {describe, expect, it} from "vitest"; import {ClientCode} from "../../../src/execution/index.js"; +import {getLodestarClientVersion} from "../../../src/util/metadata.js"; describe("util / metadata", () => { describe("getLodestarClientVersion", () => { diff --git a/packages/beacon-node/test/unit/util/peerId.test.ts b/packages/beacon-node/test/unit/util/peerId.test.ts index 92205c5d0334..5014741aa4b9 100644 --- a/packages/beacon-node/test/unit/util/peerId.test.ts +++ b/packages/beacon-node/test/unit/util/peerId.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {peerIdFromString, peerIdToString} from "../../../src/util/peerId.js"; describe("network peerid", () => { diff --git a/packages/beacon-node/test/unit/util/queue.test.ts b/packages/beacon-node/test/unit/util/queue.test.ts index 10c411547c89..3263ec12a0b7 100644 --- a/packages/beacon-node/test/unit/util/queue.test.ts +++ b/packages/beacon-node/test/unit/util/queue.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {sleep} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {JobFnQueue, QueueError, QueueErrorCode, QueueType} from "../../../src/util/queue/index.js"; import {expectLodestarError, expectRejectedWithLodestarError} from "../../utils/errors.js"; diff --git a/packages/beacon-node/test/unit/util/set.test.ts b/packages/beacon-node/test/unit/util/set.test.ts index 482819b3b77d..361680d2930c 100644 --- a/packages/beacon-node/test/unit/util/set.test.ts +++ b/packages/beacon-node/test/unit/util/set.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {OrderedSet} from "../../../src/util/set.js"; describe("OrderedSet", () => { diff --git a/packages/beacon-node/test/unit/util/shuffle.test.ts b/packages/beacon-node/test/unit/util/shuffle.test.ts index 2ba879514020..faa99ef67737 100644 --- a/packages/beacon-node/test/unit/util/shuffle.test.ts +++ b/packages/beacon-node/test/unit/util/shuffle.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {shuffle} from "../../../src/util/shuffle.js"; describe("util / shuffle", () => { diff --git a/packages/beacon-node/test/unit/util/sortBy.test.ts b/packages/beacon-node/test/unit/util/sortBy.test.ts index 747327cc2bbd..1c648640ffff 100644 --- a/packages/beacon-node/test/unit/util/sortBy.test.ts +++ b/packages/beacon-node/test/unit/util/sortBy.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {sortBy} from "../../../src/util/sortBy.js"; describe("util / sortBy", () => { diff --git a/packages/beacon-node/test/unit/util/sszBytes.test.ts b/packages/beacon-node/test/unit/util/sszBytes.test.ts index 8b72c31df6c8..8fd6011e6255 100644 --- a/packages/beacon-node/test/unit/util/sszBytes.test.ts +++ b/packages/beacon-node/test/unit/util/sszBytes.test.ts @@ -1,22 +1,22 @@ -import {describe, it, expect} from "vitest"; import {BitArray} from "@chainsafe/ssz"; -import {deneb, electra, Epoch, isElectraAttestation, phase0, RootHex, Slot, ssz} from "@lodestar/types"; -import {fromHex, toHex} from "@lodestar/utils"; import {ForkName, MAX_COMMITTEES_PER_SLOT} from "@lodestar/params"; +import {Epoch, RootHex, Slot, deneb, electra, isElectraAttestation, phase0, ssz} from "@lodestar/types"; +import {fromHex, toHex} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import { + getAggregationBitsFromAttestationSerialized, getAttDataFromAttestationSerialized, + getAttDataFromSignedAggregateAndProofElectra, getAttDataFromSignedAggregateAndProofPhase0, - getAggregationBitsFromAttestationSerialized, getBlockRootFromAttestationSerialized, getBlockRootFromSignedAggregateAndProofSerialized, + getCommitteeBitsFromAttestationSerialized, + getCommitteeBitsFromSignedAggregateAndProofElectra, + getSignatureFromAttestationSerialized, getSlotFromAttestationSerialized, + getSlotFromBlobSidecarSerialized, getSlotFromSignedAggregateAndProofSerialized, - getSignatureFromAttestationSerialized, getSlotFromSignedBeaconBlockSerialized, - getSlotFromBlobSidecarSerialized, - getCommitteeBitsFromAttestationSerialized, - getCommitteeBitsFromSignedAggregateAndProofElectra, - getAttDataFromSignedAggregateAndProofElectra, } from "../../../src/util/sszBytes.js"; describe("attestation SSZ serialized picking", () => { diff --git a/packages/beacon-node/test/unit/util/time.test.ts b/packages/beacon-node/test/unit/util/time.test.ts index ccf1b9e308c8..2f32729a5225 100644 --- a/packages/beacon-node/test/unit/util/time.test.ts +++ b/packages/beacon-node/test/unit/util/time.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {prettyTimeDiffSec} from "../../../src/util/time.js"; describe("util / time / prettyTimeDiffSec", () => { diff --git a/packages/beacon-node/test/unit/util/timeSeries.test.ts b/packages/beacon-node/test/unit/util/timeSeries.test.ts index b338310c83b1..f273508e885f 100644 --- a/packages/beacon-node/test/unit/util/timeSeries.test.ts +++ b/packages/beacon-node/test/unit/util/timeSeries.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {TimeSeries} from "../../../src/util/timeSeries.js"; // Even with rounding to 3 decimals, the test still breaks sometimes... diff --git a/packages/beacon-node/test/unit/util/wrapError.test.ts b/packages/beacon-node/test/unit/util/wrapError.test.ts index 2a8e5ca15ceb..f972a1bff148 100644 --- a/packages/beacon-node/test/unit/util/wrapError.test.ts +++ b/packages/beacon-node/test/unit/util/wrapError.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {wrapError} from "../../../src/util/wrapError.js"; describe("util / wrapError", () => { diff --git a/packages/beacon-node/test/utils/api.ts b/packages/beacon-node/test/utils/api.ts index 593bae0c2643..17126defc2c2 100644 --- a/packages/beacon-node/test/utils/api.ts +++ b/packages/beacon-node/test/utils/api.ts @@ -1,11 +1,11 @@ -import {Mocked} from "vitest"; import {config} from "@lodestar/config/default"; import {ForkChoice} from "@lodestar/fork-choice"; -import {MockedBeaconChain, MockedBeaconChainOptions, getMockedBeaconChain} from "../mocks/mockedBeaconChain.js"; +import {Mocked} from "vitest"; +import {ApiModules} from "../../src/api/index.js"; import {getMockedBeaconSync} from "../mocks/beaconSyncMock.js"; +import {MockedBeaconChain, MockedBeaconChainOptions, getMockedBeaconChain} from "../mocks/mockedBeaconChain.js"; import {MockedBeaconDb, getMockedBeaconDb} from "../mocks/mockedBeaconDb.js"; import {getMockedNetwork} from "../mocks/mockedNetwork.js"; -import {ApiModules} from "../../src/api/index.js"; type ApiModulesWithoutConfig = Omit; diff --git a/packages/beacon-node/test/utils/cachedBeaconState.ts b/packages/beacon-node/test/utils/cachedBeaconState.ts index 3efb16b6250f..1c092f2ba4a2 100644 --- a/packages/beacon-node/test/utils/cachedBeaconState.ts +++ b/packages/beacon-node/test/utils/cachedBeaconState.ts @@ -1,10 +1,10 @@ +import {ChainForkConfig} from "@lodestar/config"; import { BeaconStateAllForks, BeaconStateCache, createCachedBeaconState, createEmptyEpochCacheImmutableData, } from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; export function createCachedBeaconStateTest( state: T, diff --git a/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts b/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts index 731f44df59c8..d3cb51458c56 100644 --- a/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts +++ b/packages/beacon-node/test/utils/cliTools/kzgTrustedSetupFromJson.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import {TrustedSetupJSON, trustedSetupJsonToBin, TRUSTED_SETUP_BIN_FILEPATH} from "../../../src/util/kzg.js"; +import {TRUSTED_SETUP_BIN_FILEPATH, TrustedSetupJSON, trustedSetupJsonToBin} from "../../../src/util/kzg.js"; // CLI TOOL: Use to transform a JSON trusted setup into .ssz // diff --git a/packages/beacon-node/test/utils/clock.ts b/packages/beacon-node/test/utils/clock.ts index 390d7dd095dd..1e44b1c42551 100644 --- a/packages/beacon-node/test/utils/clock.ts +++ b/packages/beacon-node/test/utils/clock.ts @@ -1,6 +1,6 @@ import EventEmitter from "node:events"; import {computeEpochAtSlot} from "@lodestar/state-transition"; -import {Slot, Epoch} from "@lodestar/types"; +import {Epoch, Slot} from "@lodestar/types"; import {IClock} from "../../src/util/clock.js"; export class ClockStatic extends EventEmitter implements IClock { diff --git a/packages/beacon-node/test/utils/config.ts b/packages/beacon-node/test/utils/config.ts index f5d566560b65..6822b546de1e 100644 --- a/packages/beacon-node/test/utils/config.ts +++ b/packages/beacon-node/test/utils/config.ts @@ -1,5 +1,5 @@ +import {ChainForkConfig, createBeaconConfig, createChainForkConfig} from "@lodestar/config"; import {config as chainConfig} from "@lodestar/config/default"; -import {createBeaconConfig, ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import {ForkName} from "@lodestar/params"; import {ZERO_HASH} from "../../src/constants/index.js"; diff --git a/packages/beacon-node/test/utils/db.ts b/packages/beacon-node/test/utils/db.ts index c44aa7f878dc..88f8de8c0b30 100644 --- a/packages/beacon-node/test/utils/db.ts +++ b/packages/beacon-node/test/utils/db.ts @@ -1,6 +1,6 @@ import childProcess from "node:child_process"; -import {FilterOptions, LevelDbController} from "@lodestar/db"; import {ChainForkConfig} from "@lodestar/config"; +import {FilterOptions, LevelDbController} from "@lodestar/db"; import {BeaconDb} from "../../src/index.js"; import {testLogger} from "./logger.js"; diff --git a/packages/beacon-node/test/utils/errors.ts b/packages/beacon-node/test/utils/errors.ts index 1bf31a2ce9af..7380433292f2 100644 --- a/packages/beacon-node/test/utils/errors.ts +++ b/packages/beacon-node/test/utils/errors.ts @@ -1,5 +1,5 @@ -import {expect} from "vitest"; import {LodestarError, mapValues} from "@lodestar/utils"; +import {expect} from "vitest"; export function expectThrowsLodestarError(fn: () => void, expectedErr: LodestarError | string): void { try { diff --git a/packages/beacon-node/test/utils/logger.ts b/packages/beacon-node/test/utils/logger.ts index 10f27565216f..7d67dd6fbd16 100644 --- a/packages/beacon-node/test/utils/logger.ts +++ b/packages/beacon-node/test/utils/logger.ts @@ -1,6 +1,6 @@ -import {LogLevel} from "@lodestar/utils"; -import {getNodeLogger, LoggerNode, LoggerNodeOpts} from "@lodestar/logger/node"; import {getEnvLogLevel} from "@lodestar/logger/env"; +import {LoggerNode, LoggerNodeOpts, getNodeLogger} from "@lodestar/logger/node"; +import {LogLevel} from "@lodestar/utils"; export {LogLevel}; export type TestLoggerOpts = LoggerNodeOpts; diff --git a/packages/beacon-node/test/utils/networkWithMockDb.ts b/packages/beacon-node/test/utils/networkWithMockDb.ts index 689d332ebbce..d3b7e70e8168 100644 --- a/packages/beacon-node/test/utils/networkWithMockDb.ts +++ b/packages/beacon-node/test/utils/networkWithMockDb.ts @@ -4,6 +4,7 @@ import {ssz} from "@lodestar/types"; import {BeaconChain} from "../../src/chain/chain.js"; import {Eth1ForBlockProductionDisabled} from "../../src/eth1/index.js"; import {ExecutionEngineDisabled} from "../../src/execution/index.js"; +import {StateArchiveMode} from "../../src/index.js"; import {GossipHandlers, Network, NetworkInitModules, getReqRespHandlers} from "../../src/network/index.js"; import {NetworkOptions, defaultNetworkOptions} from "../../src/network/options.js"; import {GetReqRespHandlerFn} from "../../src/network/reqresp/types.js"; @@ -12,7 +13,6 @@ import {createCachedBeaconStateTest} from "./cachedBeaconState.js"; import {ClockStatic} from "./clock.js"; import {testLogger} from "./logger.js"; import {generateState} from "./state.js"; -import {StateArchiveMode} from "../../src/index.js"; export type NetworkForTestOpts = { startSlot?: number; diff --git a/packages/beacon-node/test/utils/node/beacon.ts b/packages/beacon-node/test/utils/node/beacon.ts index 0163fa148102..ea1d7aa3300d 100644 --- a/packages/beacon-node/test/utils/node/beacon.ts +++ b/packages/beacon-node/test/utils/node/beacon.ts @@ -1,24 +1,24 @@ -import deepmerge from "deepmerge"; -import tmp from "tmp"; import {PeerId} from "@libp2p/interface"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; +import {ChainConfig, createBeaconConfig, createChainForkConfig} from "@lodestar/config"; import {config as minimalConfig} from "@lodestar/config/default"; -import {createBeaconConfig, createChainForkConfig, ChainConfig} from "@lodestar/config"; -import {RecursivePartial} from "@lodestar/utils"; import {LevelDbController} from "@lodestar/db"; -import {phase0, ssz} from "@lodestar/types"; +import {LoggerNode} from "@lodestar/logger/node"; import {ForkSeq, GENESIS_SLOT} from "@lodestar/params"; import {BeaconStateAllForks} from "@lodestar/state-transition"; +import {phase0, ssz} from "@lodestar/types"; +import {RecursivePartial} from "@lodestar/utils"; import {isPlainObject} from "@lodestar/utils"; -import {LoggerNode} from "@lodestar/logger/node"; +import deepmerge from "deepmerge"; +import tmp from "tmp"; +import {BeaconDb} from "../../../src/db/index.js"; import {BeaconNode} from "../../../src/index.js"; import {defaultNetworkOptions} from "../../../src/network/options.js"; -import {initDevState, writeDeposits} from "../../../src/node/utils/state.js"; import {IBeaconNodeOptions} from "../../../src/node/options.js"; import {defaultOptions} from "../../../src/node/options.js"; -import {BeaconDb} from "../../../src/db/index.js"; -import {testLogger} from "../logger.js"; import {InteropStateOpts} from "../../../src/node/utils/interop/state.js"; +import {initDevState, writeDeposits} from "../../../src/node/utils/state.js"; +import {testLogger} from "../logger.js"; export async function getDevBeaconNode( opts: { diff --git a/packages/beacon-node/test/utils/node/simTest.ts b/packages/beacon-node/test/utils/node/simTest.ts index 7b771b8534ed..391fc6345b22 100644 --- a/packages/beacon-node/test/utils/node/simTest.ts +++ b/packages/beacon-node/test/utils/node/simTest.ts @@ -1,20 +1,20 @@ import {toHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; +import {BeaconConfig} from "@lodestar/config"; +import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import { - computeEpochAtSlot, - computeStartSlotAtEpoch, CachedBeaconStateAllForks, beforeProcessEpoch, + computeEpochAtSlot, + computeStartSlotAtEpoch, } from "@lodestar/state-transition"; -import {BeaconConfig} from "@lodestar/config"; -import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {BeaconBlock, Epoch, Slot} from "@lodestar/types"; import {Checkpoint} from "@lodestar/types/phase0"; import {Logger, mapValues} from "@lodestar/utils"; -import {routes} from "@lodestar/api"; -import {BeaconNode} from "../../../src/index.js"; import {ChainEvent, HeadEventData} from "../../../src/chain/index.js"; -import {linspace} from "../../../src/util/numpy.js"; import {RegenCaller} from "../../../src/chain/regen/index.js"; +import {BeaconNode} from "../../../src/index.js"; +import {linspace} from "../../../src/util/numpy.js"; /* eslint-disable no-console */ diff --git a/packages/beacon-node/test/utils/node/validator.ts b/packages/beacon-node/test/utils/node/validator.ts index 285fa13fd01f..f841d0681992 100644 --- a/packages/beacon-node/test/utils/node/validator.ts +++ b/packages/beacon-node/test/utils/node/validator.ts @@ -1,14 +1,14 @@ -import tmp from "tmp"; -import {vi} from "vitest"; import {SecretKey} from "@chainsafe/blst"; +import {ApiClient, ApiError, ApiResponse, HttpStatusCode} from "@lodestar/api"; +import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {LevelDbController} from "@lodestar/db"; import {interopSecretKey} from "@lodestar/state-transition"; -import {SlashingProtection, Validator, Signer, SignerType, ValidatorProposerConfig} from "@lodestar/validator"; -import {ApiClient, ApiError, HttpStatusCode, ApiResponse} from "@lodestar/api"; -import {BeaconApiMethods} from "@lodestar/api/beacon/server"; import {mapValues} from "@lodestar/utils"; +import {Signer, SignerType, SlashingProtection, Validator, ValidatorProposerConfig} from "@lodestar/validator"; +import tmp from "tmp"; +import {vi} from "vitest"; import {BeaconNode} from "../../../src/index.js"; -import {testLogger, TestLoggerOpts} from "../logger.js"; +import {TestLoggerOpts, testLogger} from "../logger.js"; export async function getAndInitDevValidators({ node, diff --git a/packages/beacon-node/test/utils/peer.ts b/packages/beacon-node/test/utils/peer.ts index 8bd5c6c67be8..81cb83665007 100644 --- a/packages/beacon-node/test/utils/peer.ts +++ b/packages/beacon-node/test/utils/peer.ts @@ -1,6 +1,6 @@ import {PeerId} from "@libp2p/interface"; -import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {peerIdFromBytes} from "@libp2p/peer-id"; +import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; import {peerIdToString} from "../../src/util/peerId.js"; /** diff --git a/packages/beacon-node/test/utils/runEl.ts b/packages/beacon-node/test/utils/runEl.ts index 9a407f91d414..0cd3189329f8 100644 --- a/packages/beacon-node/test/utils/runEl.ts +++ b/packages/beacon-node/test/utils/runEl.ts @@ -1,10 +1,10 @@ +import {spawn} from "node:child_process"; import fs from "node:fs"; import net from "node:net"; -import {spawn} from "node:child_process"; -import {sleep} from "@lodestar/utils"; import {ChainConfig} from "@lodestar/config"; -import {Eth1Provider} from "../../src/index.js"; +import {sleep} from "@lodestar/utils"; import {ZERO_HASH} from "../../src/constants/index.js"; +import {Eth1Provider} from "../../src/index.js"; import {shell} from "../sim/shell.js"; /* eslint-disable no-console */ diff --git a/packages/beacon-node/test/utils/state.ts b/packages/beacon-node/test/utils/state.ts index 6ad85f3422f7..3e14ccf7630b 100644 --- a/packages/beacon-node/test/utils/state.ts +++ b/packages/beacon-node/test/utils/state.ts @@ -1,23 +1,23 @@ import {SecretKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; +import {ChainForkConfig, createBeaconConfig} from "@lodestar/config"; import {config as minimalConfig} from "@lodestar/config/default"; +import {FAR_FUTURE_EPOCH, ForkName, ForkSeq, MAX_EFFECTIVE_BALANCE, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; import { BeaconStateAllForks, + BeaconStateBellatrix, + BeaconStateElectra, CachedBeaconStateAllForks, - createCachedBeaconState, CachedBeaconStateBellatrix, - BeaconStateBellatrix, CachedBeaconStateElectra, - BeaconStateElectra, + createCachedBeaconState, } from "@lodestar/state-transition"; import {BeaconState, altair, bellatrix, electra, ssz} from "@lodestar/types"; -import {createBeaconConfig, ChainForkConfig} from "@lodestar/config"; -import {FAR_FUTURE_EPOCH, ForkName, ForkSeq, MAX_EFFECTIVE_BALANCE, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {ExecutionStatus, ProtoBlock, DataAvailabilityStatus} from "@lodestar/fork-choice"; +import {DataAvailabilityStatus, ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice"; import {ZERO_HASH_HEX} from "../../src/constants/constants.js"; -import {generateValidator, generateValidators} from "./validator.js"; import {getConfig} from "./config.js"; +import {generateValidator, generateValidators} from "./validator.js"; /** * Copy of BeaconState, but all fields are marked optional to allow for swapping out variables as needed. diff --git a/packages/beacon-node/test/utils/testnet.ts b/packages/beacon-node/test/utils/testnet.ts index 0c0c7a8369c8..95abc185b62d 100644 --- a/packages/beacon-node/test/utils/testnet.ts +++ b/packages/beacon-node/test/utils/testnet.ts @@ -1,7 +1,7 @@ import {fromHexString} from "@chainsafe/ssz"; -import {phase0} from "@lodestar/types"; -import {createChainForkConfig, ChainForkConfig} from "@lodestar/config"; +import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; +import {phase0} from "@lodestar/types"; /** Generic testnet data taken from the Medalla testnet */ export const medallaTestnetConfig = { diff --git a/packages/beacon-node/test/utils/typeGenerator.ts b/packages/beacon-node/test/utils/typeGenerator.ts index dde169ebce26..329060e6eb31 100644 --- a/packages/beacon-node/test/utils/typeGenerator.ts +++ b/packages/beacon-node/test/utils/typeGenerator.ts @@ -1,6 +1,6 @@ +import {DataAvailabilityStatus, ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice"; import {Slot} from "@lodestar/types"; import {phase0} from "@lodestar/types"; -import {ProtoBlock, ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice"; import {ssz} from "@lodestar/types"; import {fromHex} from "@lodestar/utils"; import {ZERO_HASH_HEX} from "../../src/constants/index.js"; diff --git a/packages/beacon-node/test/utils/validationData/aggregateAndProof.ts b/packages/beacon-node/test/utils/validationData/aggregateAndProof.ts index 462502719134..a8ac5833fbd5 100644 --- a/packages/beacon-node/test/utils/validationData/aggregateAndProof.ts +++ b/packages/beacon-node/test/utils/validationData/aggregateAndProof.ts @@ -1,11 +1,11 @@ -import {computeSigningRoot} from "@lodestar/state-transition"; import {DOMAIN_AGGREGATE_AND_PROOF, DOMAIN_SELECTION_PROOF} from "@lodestar/params"; +import {computeSigningRoot} from "@lodestar/state-transition"; import {phase0, ssz} from "@lodestar/types"; import {getSecretKeyFromIndexCached} from "../../../../state-transition/test/perf/util.js"; import {IBeaconChain} from "../../../src/chain/index.js"; import {SeenAggregators} from "../../../src/chain/seenCache/index.js"; import {signCached} from "../cache.js"; -import {getAttestationValidData, AttestationValidDataOpts} from "./attestation.js"; +import {AttestationValidDataOpts, getAttestationValidData} from "./attestation.js"; export type AggregateAndProofValidDataOpts = AttestationValidDataOpts; diff --git a/packages/beacon-node/test/utils/validationData/attestation.ts b/packages/beacon-node/test/utils/validationData/attestation.ts index 6715512ac667..40dccbd77f18 100644 --- a/packages/beacon-node/test/utils/validationData/attestation.ts +++ b/packages/beacon-node/test/utils/validationData/attestation.ts @@ -1,24 +1,24 @@ import {BitArray, toHexString} from "@chainsafe/ssz"; -import {computeEpochAtSlot, computeSigningRoot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {ProtoBlock, IForkChoice, ExecutionStatus, DataAvailabilityStatus} from "@lodestar/fork-choice"; +import {DataAvailabilityStatus, ExecutionStatus, IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params"; -import {phase0, Slot, ssz} from "@lodestar/types"; +import {computeEpochAtSlot, computeSigningRoot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {Slot, phase0, ssz} from "@lodestar/types"; import { generateTestCachedBeaconStateOnlyValidators, getSecretKeyFromIndexCached, } from "../../../../state-transition/test/perf/util.js"; +import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier} from "../../../src/chain/bls/index.js"; import {IBeaconChain} from "../../../src/chain/index.js"; +import {defaultChainOptions} from "../../../src/chain/options.js"; import {IStateRegenerator} from "../../../src/chain/regen/index.js"; -import {ZERO_HASH, ZERO_HASH_HEX} from "../../../src/constants/index.js"; import {SeenAttesters} from "../../../src/chain/seenCache/index.js"; -import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier} from "../../../src/chain/bls/index.js"; -import {signCached} from "../cache.js"; -import {ClockStatic} from "../clock.js"; import {SeenAggregatedAttestations} from "../../../src/chain/seenCache/seenAggregateAndProof.js"; import {SeenAttestationDatas} from "../../../src/chain/seenCache/seenAttestationData.js"; -import {defaultChainOptions} from "../../../src/chain/options.js"; -import {testLogger} from "../logger.js"; import {ShufflingCache} from "../../../src/chain/shufflingCache.js"; +import {ZERO_HASH, ZERO_HASH_HEX} from "../../../src/constants/index.js"; +import {signCached} from "../cache.js"; +import {ClockStatic} from "../clock.js"; +import {testLogger} from "../logger.js"; export type AttestationValidDataOpts = { currentSlot?: Slot; diff --git a/packages/cli/src/applyPreset.ts b/packages/cli/src/applyPreset.ts index 612c5d648c63..06d29d353af8 100644 --- a/packages/cli/src/applyPreset.ts +++ b/packages/cli/src/applyPreset.ts @@ -21,7 +21,7 @@ setHasher(hasher); // set LODESTAR_PRESET manually every time. // IMPORTANT: only import Lodestar code here which does not import any other Lodestar libraries -import {setActivePreset, presetFromJson, PresetName} from "@lodestar/params/setPreset"; +import {PresetName, presetFromJson, setActivePreset} from "@lodestar/params/setPreset"; import {readFile} from "./util/file.js"; const network = valueOfArg("network"); diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index e8f4aeba8ebc..d64661f6ec66 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,7 +1,7 @@ +import {registerCommandToYargs} from "@lodestar/utils"; // Must not use `* as yargs`, see https://github.com/yargs/yargs/issues/1131 import yargs from "yargs"; import {hideBin} from "yargs/helpers"; -import {registerCommandToYargs} from "@lodestar/utils"; import {cmds} from "./cmds/index.js"; import {globalOptions, rcConfigOption} from "./options/index.js"; import {getVersionData} from "./util/version.js"; diff --git a/packages/cli/src/cmds/beacon/handler.ts b/packages/cli/src/cmds/beacon/handler.ts index ea424e04824a..389bcea25223 100644 --- a/packages/cli/src/cmds/beacon/handler.ts +++ b/packages/cli/src/cmds/beacon/handler.ts @@ -1,30 +1,30 @@ import path from "node:path"; import {getHeapStatistics} from "node:v8"; -import {ErrorAborted} from "@lodestar/utils"; -import {LevelDbController} from "@lodestar/db"; -import {BeaconNode, BeaconDb} from "@lodestar/beacon-node"; +import {BeaconDb, BeaconNode} from "@lodestar/beacon-node"; import {ChainForkConfig, createBeaconConfig} from "@lodestar/config"; +import {LevelDbController} from "@lodestar/db"; +import {LoggerNode, getNodeLogger} from "@lodestar/logger/node"; import {ACTIVE_PRESET, PresetName} from "@lodestar/params"; +import {ErrorAborted} from "@lodestar/utils"; import {ProcessShutdownCallback} from "@lodestar/validator"; -import {LoggerNode, getNodeLogger} from "@lodestar/logger/node"; -import {GlobalArgs, parseBeaconNodeArgs} from "../../options/index.js"; import {BeaconNodeOptions, getBeaconConfigFromArgs} from "../../config/index.js"; import {getNetworkBootnodes, getNetworkData, isKnownNetworkName, readBootnodes} from "../../networks/index.js"; +import {GlobalArgs, parseBeaconNodeArgs} from "../../options/index.js"; +import {LogArgs} from "../../options/logOptions.js"; import { - onGracefulShutdown, - mkdir, - writeFile600Perm, cleanOldLogFiles, + mkdir, + onGracefulShutdown, parseLoggerArgs, pruneOldFilesInDir, + writeFile600Perm, } from "../../util/index.js"; import {getVersionData} from "../../util/version.js"; -import {LogArgs} from "../../options/logOptions.js"; -import {BeaconArgs} from "./options.js"; -import {getBeaconPaths} from "./paths.js"; import {initBeaconState} from "./initBeaconState.js"; import {initPeerIdAndEnr} from "./initPeerIdAndEnr.js"; +import {BeaconArgs} from "./options.js"; +import {getBeaconPaths} from "./paths.js"; const DEFAULT_RETENTION_SSZ_OBJECTS_HOURS = 15 * 24; const HOURS_TO_MS = 3600 * 1000; diff --git a/packages/cli/src/cmds/beacon/index.ts b/packages/cli/src/cmds/beacon/index.ts index d1d91b9fe424..9746a43d40fb 100644 --- a/packages/cli/src/cmds/beacon/index.ts +++ b/packages/cli/src/cmds/beacon/index.ts @@ -1,7 +1,7 @@ import {CliCommand, CliCommandOptions} from "@lodestar/utils"; import {GlobalArgs} from "../../options/index.js"; -import {beaconOptions, BeaconArgs} from "./options.js"; import {beaconHandler} from "./handler.js"; +import {BeaconArgs, beaconOptions} from "./options.js"; export const beacon: CliCommand = { command: "beacon", diff --git a/packages/cli/src/cmds/beacon/initBeaconState.ts b/packages/cli/src/cmds/beacon/initBeaconState.ts index 8dc9e9317c65..5fc32d63de6b 100644 --- a/packages/cli/src/cmds/beacon/initBeaconState.ts +++ b/packages/cli/src/cmds/beacon/initBeaconState.ts @@ -1,30 +1,30 @@ -import {ssz} from "@lodestar/types"; -import {createBeaconConfig, BeaconConfig, ChainForkConfig} from "@lodestar/config"; -import {Logger, formatBytes} from "@lodestar/utils"; -import { - isWithinWeakSubjectivityPeriod, - ensureWithinWeakSubjectivityPeriod, - BeaconStateAllForks, - loadState, - loadStateAndValidators, -} from "@lodestar/state-transition"; import { IBeaconDb, IBeaconNodeOptions, checkAndPersistAnchorState, - initStateFromEth1, getStateTypeFromBytes, + initStateFromEth1, } from "@lodestar/beacon-node"; +import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config"; +import { + BeaconStateAllForks, + ensureWithinWeakSubjectivityPeriod, + isWithinWeakSubjectivityPeriod, + loadState, + loadStateAndValidators, +} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; import {Checkpoint} from "@lodestar/types/phase0"; +import {Logger, formatBytes} from "@lodestar/utils"; -import {downloadOrLoadFile, wrapFnError} from "../../util/index.js"; -import {defaultNetwork, GlobalArgs} from "../../options/globalOptions.js"; import { fetchWeakSubjectivityState, getCheckpointFromArg, - getGenesisFileUrl, getCheckpointFromState, + getGenesisFileUrl, } from "../../networks/index.js"; +import {GlobalArgs, defaultNetwork} from "../../options/globalOptions.js"; +import {downloadOrLoadFile, wrapFnError} from "../../util/index.js"; import {BeaconArgs} from "./options.js"; type StateWithBytes = {state: BeaconStateAllForks; stateBytes: Uint8Array}; diff --git a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts index 3e5963797c3d..cac34d65b194 100644 --- a/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts +++ b/packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts @@ -1,14 +1,14 @@ import fs from "node:fs"; -import path from "node:path"; import os from "node:os"; +import path from "node:path"; +import {SignableENR, createPrivateKeyFromPeerId} from "@chainsafe/enr"; import type {PeerId} from "@libp2p/interface"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; -import {Multiaddr} from "@multiformats/multiaddr"; -import {createPrivateKeyFromPeerId, SignableENR} from "@chainsafe/enr"; import {Logger} from "@lodestar/utils"; +import {Multiaddr} from "@multiformats/multiaddr"; import {exportToJSON, readPeerId} from "../../config/index.js"; -import {writeFile600Perm} from "../../util/file.js"; import {parseListenArgs} from "../../options/beaconNodeOptions/network.js"; +import {writeFile600Perm} from "../../util/file.js"; import {BeaconArgs} from "./options.js"; /** diff --git a/packages/cli/src/cmds/beacon/options.ts b/packages/cli/src/cmds/beacon/options.ts index 5b57b58e82e2..a623ca99512c 100644 --- a/packages/cli/src/cmds/beacon/options.ts +++ b/packages/cli/src/cmds/beacon/options.ts @@ -1,7 +1,7 @@ import {CliCommandOptions, CliOptionDefinition} from "@lodestar/utils"; -import {beaconNodeOptions, paramsOptions, BeaconNodeArgs} from "../../options/index.js"; +import {BeaconNodeArgs, beaconNodeOptions, paramsOptions} from "../../options/index.js"; import {LogArgs, logOptions} from "../../options/logOptions.js"; -import {defaultBeaconPaths, BeaconPaths} from "./paths.js"; +import {BeaconPaths, defaultBeaconPaths} from "./paths.js"; type BeaconExtraArgs = { forceGenesis?: boolean; diff --git a/packages/cli/src/cmds/beacon/paths.ts b/packages/cli/src/cmds/beacon/paths.ts index f92732b2a94e..9485bc5fca8a 100644 --- a/packages/cli/src/cmds/beacon/paths.ts +++ b/packages/cli/src/cmds/beacon/paths.ts @@ -1,6 +1,6 @@ import path from "node:path"; import {GlobalArgs} from "../../options/index.js"; -import {getGlobalPaths, GlobalPaths} from "../../paths/global.js"; +import {GlobalPaths, getGlobalPaths} from "../../paths/global.js"; export type BeaconPathsPartial = Partial<{ beaconDir: string; diff --git a/packages/cli/src/cmds/bootnode/handler.ts b/packages/cli/src/cmds/bootnode/handler.ts index 8a262d8f12b7..4dc044a87006 100644 --- a/packages/cli/src/cmds/bootnode/handler.ts +++ b/packages/cli/src/cmds/bootnode/handler.ts @@ -1,21 +1,21 @@ import path from "node:path"; -import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; import {Discv5} from "@chainsafe/discv5"; import {ENR} from "@chainsafe/enr"; -import {ErrorAborted} from "@lodestar/utils"; import {HttpMetricsServer, RegistryMetricCreator, getHttpMetricsServer} from "@lodestar/beacon-node"; +import {ErrorAborted} from "@lodestar/utils"; +import {Multiaddr, multiaddr} from "@multiformats/multiaddr"; -import {GlobalArgs} from "../../options/index.js"; import {getBeaconConfigFromArgs} from "../../config/index.js"; import {getNetworkBootnodes, isKnownNetworkName, readBootnodes} from "../../networks/index.js"; -import {onGracefulShutdown, mkdir, writeFile600Perm} from "../../util/index.js"; -import {getVersionData} from "../../util/version.js"; -import {initPeerIdAndEnr} from "../beacon/initPeerIdAndEnr.js"; import {parseArgs as parseMetricsArgs} from "../../options/beaconNodeOptions/metrics.js"; import {parseArgs as parseNetworkArgs} from "../../options/beaconNodeOptions/network.js"; -import {getBeaconPaths} from "../beacon/paths.js"; -import {BeaconArgs} from "../beacon/options.js"; +import {GlobalArgs} from "../../options/index.js"; +import {mkdir, onGracefulShutdown, writeFile600Perm} from "../../util/index.js"; +import {getVersionData} from "../../util/version.js"; import {initLogger} from "../beacon/handler.js"; +import {initPeerIdAndEnr} from "../beacon/initPeerIdAndEnr.js"; +import {BeaconArgs} from "../beacon/options.js"; +import {getBeaconPaths} from "../beacon/paths.js"; import {BootnodeArgs} from "./options.js"; /** diff --git a/packages/cli/src/cmds/bootnode/index.ts b/packages/cli/src/cmds/bootnode/index.ts index 6fc3c01247d6..3143f7a77ba7 100644 --- a/packages/cli/src/cmds/bootnode/index.ts +++ b/packages/cli/src/cmds/bootnode/index.ts @@ -1,7 +1,7 @@ import {CliCommand, CliCommandOptions} from "@lodestar/utils"; import {GlobalArgs} from "../../options/index.js"; -import {bootnodeOptions, BootnodeArgs} from "./options.js"; import {bootnodeHandler} from "./handler.js"; +import {BootnodeArgs, bootnodeOptions} from "./options.js"; export const bootnode: CliCommand = { command: "bootnode", diff --git a/packages/cli/src/cmds/bootnode/options.ts b/packages/cli/src/cmds/bootnode/options.ts index f3422b4029a1..e4e943bfef0c 100644 --- a/packages/cli/src/cmds/bootnode/options.ts +++ b/packages/cli/src/cmds/bootnode/options.ts @@ -1,7 +1,7 @@ -import {CliOptionDefinition, CliCommandOptions} from "@lodestar/utils"; -import {LogArgs, logOptions} from "../../options/logOptions.js"; +import {CliCommandOptions, CliOptionDefinition} from "@lodestar/utils"; import {MetricsArgs, options as metricsOptions} from "../../options/beaconNodeOptions/metrics.js"; import {defaultListenAddress, defaultP2pPort, defaultP2pPort6} from "../../options/beaconNodeOptions/network.js"; +import {LogArgs, logOptions} from "../../options/logOptions.js"; type BootnodeExtraArgs = { listenAddress?: string; diff --git a/packages/cli/src/cmds/dev/files.ts b/packages/cli/src/cmds/dev/files.ts index 9baf0dc845dd..e5b019c4b48e 100644 --- a/packages/cli/src/cmds/dev/files.ts +++ b/packages/cli/src/cmds/dev/files.ts @@ -2,9 +2,9 @@ import fs from "node:fs"; import path from "node:path"; import {Keystore} from "@chainsafe/bls-keystore"; import {nodeUtils} from "@lodestar/beacon-node"; -import {chainConfigToJson, ChainForkConfig} from "@lodestar/config"; -import {dumpYaml} from "@lodestar/utils"; +import {ChainForkConfig, chainConfigToJson} from "@lodestar/config"; import {interopSecretKey} from "@lodestar/state-transition"; +import {dumpYaml} from "@lodestar/utils"; import {PersistedKeysBackend} from "../validator/keymanager/persistedKeys.js"; /* eslint-disable no-console */ diff --git a/packages/cli/src/cmds/dev/handler.ts b/packages/cli/src/cmds/dev/handler.ts index 3018bb8790a6..43fe12435a9a 100644 --- a/packages/cli/src/cmds/dev/handler.ts +++ b/packages/cli/src/cmds/dev/handler.ts @@ -1,16 +1,16 @@ import fs from "node:fs"; -import {rimraf} from "rimraf"; -import {toHex, fromHex} from "@lodestar/utils"; import {nodeUtils} from "@lodestar/beacon-node"; +import {fromHex, toHex} from "@lodestar/utils"; +import {rimraf} from "rimraf"; +import {getBeaconConfigFromArgs} from "../../config/beaconParams.js"; import {GlobalArgs} from "../../options/index.js"; import {mkdir, onGracefulShutdown} from "../../util/index.js"; -import {getBeaconConfigFromArgs} from "../../config/beaconParams.js"; -import {getBeaconPaths} from "../beacon/paths.js"; -import {getValidatorPaths} from "../validator/paths.js"; import {beaconHandler} from "../beacon/handler.js"; +import {getBeaconPaths} from "../beacon/paths.js"; import {validatorHandler} from "../validator/handler.js"; -import {IDevArgs} from "./options.js"; +import {getValidatorPaths} from "../validator/paths.js"; import {writeTestnetFiles} from "./files.js"; +import {IDevArgs} from "./options.js"; /** * Run a beacon node with validator diff --git a/packages/cli/src/cmds/dev/index.ts b/packages/cli/src/cmds/dev/index.ts index 6c0f73327816..b628d116c526 100644 --- a/packages/cli/src/cmds/dev/index.ts +++ b/packages/cli/src/cmds/dev/index.ts @@ -1,7 +1,7 @@ import {CliCommand, CliCommandOptions} from "@lodestar/utils"; import {GlobalArgs} from "../../options/index.js"; -import {devOptions, IDevArgs} from "./options.js"; import {devHandler} from "./handler.js"; +import {IDevArgs, devOptions} from "./options.js"; export const dev: CliCommand = { command: "dev", diff --git a/packages/cli/src/cmds/dev/options.ts b/packages/cli/src/cmds/dev/options.ts index e442b0605cdc..3bbc32f0ab0e 100644 --- a/packages/cli/src/cmds/dev/options.ts +++ b/packages/cli/src/cmds/dev/options.ts @@ -1,7 +1,7 @@ import {CliCommandOptions, CliOptionDefinition} from "@lodestar/utils"; -import {beaconOptions, BeaconArgs} from "../beacon/options.js"; import {NetworkName} from "../../networks/index.js"; import {beaconNodeOptions, globalOptions} from "../../options/index.js"; +import {BeaconArgs, beaconOptions} from "../beacon/options.js"; import {IValidatorCliArgs, validatorOptions} from "../validator/options.js"; type IDevOwnArgs = { diff --git a/packages/cli/src/cmds/index.ts b/packages/cli/src/cmds/index.ts index 7f701379b097..36217ef1b622 100644 --- a/packages/cli/src/cmds/index.ts +++ b/packages/cli/src/cmds/index.ts @@ -1,10 +1,10 @@ import {CliCommand} from "@lodestar/utils"; import {GlobalArgs} from "../options/index.js"; import {beacon} from "./beacon/index.js"; +import {bootnode} from "./bootnode/index.js"; import {dev} from "./dev/index.js"; -import {validator} from "./validator/index.js"; import {lightclient} from "./lightclient/index.js"; -import {bootnode} from "./bootnode/index.js"; +import {validator} from "./validator/index.js"; export const cmds: Required>>["subcommands"] = [ beacon, diff --git a/packages/cli/src/cmds/lightclient/handler.ts b/packages/cli/src/cmds/lightclient/handler.ts index 5af8f84d8959..b51a7227ce4c 100644 --- a/packages/cli/src/cmds/lightclient/handler.ts +++ b/packages/cli/src/cmds/lightclient/handler.ts @@ -5,9 +5,9 @@ import {LightClientRestTransport} from "@lodestar/light-client/transport"; import {getNodeLogger} from "@lodestar/logger/node"; import {fromHex} from "@lodestar/utils"; import {getBeaconConfigFromArgs} from "../../config/beaconParams.js"; +import {GlobalArgs} from "../../options/index.js"; import {getGlobalPaths} from "../../paths/global.js"; import {parseLoggerArgs} from "../../util/logger.js"; -import {GlobalArgs} from "../../options/index.js"; import {ILightClientArgs} from "./options.js"; export async function lightclientHandler(args: ILightClientArgs & GlobalArgs): Promise { diff --git a/packages/cli/src/cmds/lightclient/index.ts b/packages/cli/src/cmds/lightclient/index.ts index bf85df50800f..55c56697bd0a 100644 --- a/packages/cli/src/cmds/lightclient/index.ts +++ b/packages/cli/src/cmds/lightclient/index.ts @@ -1,7 +1,7 @@ import {CliCommand} from "@lodestar/utils"; import {GlobalArgs} from "../../options/index.js"; -import {ILightClientArgs, lightclientOptions} from "./options.js"; import {lightclientHandler} from "./handler.js"; +import {ILightClientArgs, lightclientOptions} from "./options.js"; export const lightclient: CliCommand = { command: "lightclient", diff --git a/packages/cli/src/cmds/validator/blsToExecutionChange.ts b/packages/cli/src/cmds/validator/blsToExecutionChange.ts index 7fbdbb029bf5..2eeaab846589 100644 --- a/packages/cli/src/cmds/validator/blsToExecutionChange.ts +++ b/packages/cli/src/cmds/validator/blsToExecutionChange.ts @@ -1,13 +1,13 @@ import {SecretKey} from "@chainsafe/blst"; -import {computeSigningRoot} from "@lodestar/state-transition"; -import {DOMAIN_BLS_TO_EXECUTION_CHANGE, ForkName} from "@lodestar/params"; -import {createBeaconConfig} from "@lodestar/config"; -import {ssz, capella} from "@lodestar/types"; import {getClient} from "@lodestar/api"; +import {createBeaconConfig} from "@lodestar/config"; +import {DOMAIN_BLS_TO_EXECUTION_CHANGE, ForkName} from "@lodestar/params"; +import {computeSigningRoot} from "@lodestar/state-transition"; +import {capella, ssz} from "@lodestar/types"; import {CliCommand, fromHex} from "@lodestar/utils"; -import {GlobalArgs} from "../../options/index.js"; import {getBeaconConfigFromArgs} from "../../config/index.js"; +import {GlobalArgs} from "../../options/index.js"; import {IValidatorCliArgs} from "./options.js"; /* eslint-disable no-console */ diff --git a/packages/cli/src/cmds/validator/handler.ts b/packages/cli/src/cmds/validator/handler.ts index 66e66400a3fd..6cb48f862bda 100644 --- a/packages/cli/src/cmds/validator/handler.ts +++ b/packages/cli/src/cmds/validator/handler.ts @@ -1,6 +1,14 @@ -import path from "node:path"; import {setMaxListeners} from "node:events"; +import path from "node:path"; +import {WireFormat, routes} from "@lodestar/api"; +import { + MonitoringService, + RegistryMetricCreator, + collectNodeJSMetrics, + getHttpMetricsServer, +} from "@lodestar/beacon-node"; import {LevelDbController} from "@lodestar/db"; +import {getNodeLogger} from "@lodestar/logger/node"; import { ProcessShutdownCallback, SlashingProtection, @@ -8,29 +16,21 @@ import { ValidatorProposerConfig, defaultOptions, } from "@lodestar/validator"; -import {WireFormat, routes} from "@lodestar/api"; import {getMetrics} from "@lodestar/validator"; -import { - RegistryMetricCreator, - collectNodeJSMetrics, - getHttpMetricsServer, - MonitoringService, -} from "@lodestar/beacon-node"; -import {getNodeLogger} from "@lodestar/logger/node"; import {getBeaconConfigFromArgs} from "../../config/index.js"; import {GlobalArgs} from "../../options/index.js"; import {YargsError, cleanOldLogFiles, mkdir, parseLoggerArgs} from "../../util/index.js"; import {onGracefulShutdown, parseFeeRecipient, parseProposerConfig} from "../../util/index.js"; +import {parseBuilderBoostFactor, parseBuilderSelection} from "../../util/proposerConfig.js"; import {getVersionData} from "../../util/version.js"; -import {parseBuilderSelection, parseBuilderBoostFactor} from "../../util/proposerConfig.js"; -import {getAccountPaths, getValidatorPaths} from "./paths.js"; -import {IValidatorCliArgs, validatorMetricsDefaultOptions, validatorMonitoringDefaultOptions} from "./options.js"; -import {getSignersFromArgs} from "./signers/index.js"; -import {logSigners, warnOrExitNoSigners} from "./signers/logSigners.js"; import {KeymanagerApi} from "./keymanager/impl.js"; -import {PersistedKeysBackend} from "./keymanager/persistedKeys.js"; import {IPersistedKeysBackend} from "./keymanager/interface.js"; +import {PersistedKeysBackend} from "./keymanager/persistedKeys.js"; import {KeymanagerRestApiServer} from "./keymanager/server.js"; +import {IValidatorCliArgs, validatorMetricsDefaultOptions, validatorMonitoringDefaultOptions} from "./options.js"; +import {getAccountPaths, getValidatorPaths} from "./paths.js"; +import {getSignersFromArgs} from "./signers/index.js"; +import {logSigners, warnOrExitNoSigners} from "./signers/logSigners.js"; /** * Runs a validator client. diff --git a/packages/cli/src/cmds/validator/import.ts b/packages/cli/src/cmds/validator/import.ts index 48e5205549f1..2c9343cf71e2 100644 --- a/packages/cli/src/cmds/validator/import.ts +++ b/packages/cli/src/cmds/validator/import.ts @@ -1,13 +1,13 @@ import fs from "node:fs"; import {Keystore} from "@chainsafe/bls-keystore"; import {CliCommand} from "@lodestar/utils"; -import {YargsError, getPubkeyHexFromKeystore} from "../../util/index.js"; import {getBeaconConfigFromArgs} from "../../config/beaconParams.js"; import {GlobalArgs} from "../../options/index.js"; -import {validatorOptions, IValidatorCliArgs} from "./options.js"; +import {YargsError, getPubkeyHexFromKeystore} from "../../util/index.js"; +import {PersistedKeysBackend} from "./keymanager/persistedKeys.js"; +import {IValidatorCliArgs, validatorOptions} from "./options.js"; import {getAccountPaths} from "./paths.js"; import {importKeystoreDefinitionsFromExternalDir, readPassphraseOrPrompt} from "./signers/importExternalKeystores.js"; -import {PersistedKeysBackend} from "./keymanager/persistedKeys.js"; /* eslint-disable no-console */ diff --git a/packages/cli/src/cmds/validator/index.ts b/packages/cli/src/cmds/validator/index.ts index d0c7ea86c042..0c41744e49fd 100644 --- a/packages/cli/src/cmds/validator/index.ts +++ b/packages/cli/src/cmds/validator/index.ts @@ -1,13 +1,13 @@ import {CliCommand} from "@lodestar/utils"; import {GlobalArgs} from "../../options/index.js"; -import {getAccountPaths} from "./paths.js"; -import {slashingProtection} from "./slashingProtection/index.js"; +import {blsToExecutionChange} from "./blsToExecutionChange.js"; +import {validatorHandler} from "./handler.js"; import {importCmd} from "./import.js"; import {list} from "./list.js"; +import {IValidatorCliArgs, validatorOptions} from "./options.js"; +import {getAccountPaths} from "./paths.js"; +import {slashingProtection} from "./slashingProtection/index.js"; import {voluntaryExit} from "./voluntaryExit.js"; -import {blsToExecutionChange} from "./blsToExecutionChange.js"; -import {validatorOptions, IValidatorCliArgs} from "./options.js"; -import {validatorHandler} from "./handler.js"; export const validator: CliCommand = { command: "validator", diff --git a/packages/cli/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts b/packages/cli/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts index 7cfaa9768494..2c17f70e8255 100644 --- a/packages/cli/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts +++ b/packages/cli/src/cmds/validator/keymanager/decryptKeystoreDefinitions.ts @@ -1,13 +1,13 @@ import fs from "node:fs"; import path from "node:path"; -import {SecretKey} from "@chainsafe/blst"; import {Keystore} from "@chainsafe/bls-keystore"; -import {SignerLocal, SignerType} from "@lodestar/validator"; +import {SecretKey} from "@chainsafe/blst"; import {LogLevel, Logger} from "@lodestar/utils"; +import {SignerLocal, SignerType} from "@lodestar/validator"; import {lockFilepath, unlockFilepath} from "../../../util/lockfile.js"; +import {DecryptKeystoresThreadPool} from "./decryptKeystores/index.js"; import {LocalKeystoreDefinition} from "./interface.js"; import {clearKeystoreCache, loadKeystoreCache, writeKeystoreCache} from "./keystoreCache.js"; -import {DecryptKeystoresThreadPool} from "./decryptKeystores/index.js"; export type KeystoreDecryptOptions = { ignoreLockFile?: boolean; diff --git a/packages/cli/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts b/packages/cli/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts index 169ddb74ffda..4203e0640e39 100644 --- a/packages/cli/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts +++ b/packages/cli/src/cmds/validator/keymanager/decryptKeystores/threadPool.ts @@ -1,7 +1,7 @@ import path from "node:path"; -import {spawn, Pool, Worker, ModuleThread, QueuedTask} from "@chainsafe/threads"; -import {DecryptKeystoreArgs, DecryptKeystoreWorkerAPI} from "./types.js"; +import {ModuleThread, Pool, QueuedTask, Worker, spawn} from "@chainsafe/threads"; import {maxPoolSize} from "./poolSize.js"; +import {DecryptKeystoreArgs, DecryptKeystoreWorkerAPI} from "./types.js"; // Worker constructor consider the path relative to the current working directory const workerDir = diff --git a/packages/cli/src/cmds/validator/keymanager/decryptKeystores/worker.ts b/packages/cli/src/cmds/validator/keymanager/decryptKeystores/worker.ts index 711ec4f88b00..9ebebb3a73d9 100644 --- a/packages/cli/src/cmds/validator/keymanager/decryptKeystores/worker.ts +++ b/packages/cli/src/cmds/validator/keymanager/decryptKeystores/worker.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; -import {expose} from "@chainsafe/threads/worker"; -import {Transfer, TransferDescriptor} from "@chainsafe/threads"; import {Keystore} from "@chainsafe/bls-keystore"; +import {Transfer, TransferDescriptor} from "@chainsafe/threads"; +import {expose} from "@chainsafe/threads/worker"; import {DecryptKeystoreArgs, DecryptKeystoreWorkerAPI, isLocalKeystoreDefinition} from "./types.js"; /** diff --git a/packages/cli/src/cmds/validator/keymanager/impl.ts b/packages/cli/src/cmds/validator/keymanager/impl.ts index 545f2f74f06e..8816f964a8ce 100644 --- a/packages/cli/src/cmds/validator/keymanager/impl.ts +++ b/packages/cli/src/cmds/validator/keymanager/impl.ts @@ -1,27 +1,27 @@ import {Keystore} from "@chainsafe/bls-keystore"; import {SecretKey} from "@chainsafe/blst"; import { + BuilderBoostFactorData, DeleteRemoteKeyStatus, DeletionStatus, + FeeRecipientData, + GasLimitData, + GraffitiData, + ImportRemoteKeyStatus, ImportStatus, - ResponseStatus, KeystoreStr, + ProposerConfigResponse, PubkeyHex, - SlashingProtectionData, - SignerDefinition, RemoteSignerDefinition, - ImportRemoteKeyStatus, - FeeRecipientData, - GraffitiData, - GasLimitData, - BuilderBoostFactorData, - ProposerConfigResponse, + ResponseStatus, + SignerDefinition, + SlashingProtectionData, } from "@lodestar/api/keymanager"; import {KeymanagerApiMethods as Api} from "@lodestar/api/keymanager/server"; -import {Interchange, SignerType, Validator} from "@lodestar/validator"; import {ApiError} from "@lodestar/api/server"; import {Epoch} from "@lodestar/types"; import {fromHex, isValidHttpUrl} from "@lodestar/utils"; +import {Interchange, SignerType, Validator} from "@lodestar/validator"; import {getPubkeyHexFromKeystore, isValidatePubkeyHex} from "../../../util/format.js"; import {parseFeeRecipient} from "../../../util/index.js"; import {DecryptKeystoresThreadPool} from "./decryptKeystores/index.js"; diff --git a/packages/cli/src/cmds/validator/keymanager/keystoreCache.ts b/packages/cli/src/cmds/validator/keymanager/keystoreCache.ts index 2997a6b6b113..1f8643621bdc 100644 --- a/packages/cli/src/cmds/validator/keymanager/keystoreCache.ts +++ b/packages/cli/src/cmds/validator/keymanager/keystoreCache.ts @@ -2,8 +2,8 @@ import fs from "node:fs"; import path from "node:path"; import {Keystore} from "@chainsafe/bls-keystore"; import {SecretKey} from "@chainsafe/blst"; -import {SignerLocal, SignerType} from "@lodestar/validator"; import {fromHex, toHex, toPubkeyHex} from "@lodestar/utils"; +import {SignerLocal, SignerType} from "@lodestar/validator"; import {writeFile600Perm} from "../../../util/file.js"; import {lockFilepath, unlockFilepath} from "../../../util/lockfile.js"; import {LocalKeystoreDefinition} from "./interface.js"; diff --git a/packages/cli/src/cmds/validator/keymanager/persistedKeys.ts b/packages/cli/src/cmds/validator/keymanager/persistedKeys.ts index 6a1324dcbaa2..56d508fa4e2f 100644 --- a/packages/cli/src/cmds/validator/keymanager/persistedKeys.ts +++ b/packages/cli/src/cmds/validator/keymanager/persistedKeys.ts @@ -1,15 +1,15 @@ import fs from "node:fs"; import path from "node:path"; import {Keystore} from "@chainsafe/bls-keystore"; -import {ProposerConfig} from "@lodestar/validator"; import {DeletionStatus, ImportStatus, PubkeyHex, SignerDefinition} from "@lodestar/api/keymanager"; +import {ProposerConfig} from "@lodestar/validator"; import { getPubkeyHexFromKeystore, readPassphraseFile, + readProposerConfigDir, rmdirSyncMaybe, unlinkSyncMaybe, writeFile600Perm, - readProposerConfigDir, } from "../../../util/index.js"; import {lockFilepath} from "../../../util/lockfile.js"; import {IPersistedKeysBackend, LocalKeystoreDefinition} from "./interface.js"; diff --git a/packages/cli/src/cmds/validator/keymanager/server.ts b/packages/cli/src/cmds/validator/keymanager/server.ts index e48c708c96a8..4fec2295f293 100644 --- a/packages/cli/src/cmds/validator/keymanager/server.ts +++ b/packages/cli/src/cmds/validator/keymanager/server.ts @@ -1,8 +1,8 @@ import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path"; -import {RestApiServer, RestApiServerOpts, RestApiServerModules} from "@lodestar/beacon-node"; import {KeymanagerApiMethods, registerRoutes} from "@lodestar/api/keymanager/server"; +import {RestApiServer, RestApiServerModules, RestApiServerOpts} from "@lodestar/beacon-node"; import {ChainForkConfig} from "@lodestar/config"; import {toHex} from "@lodestar/utils"; import {writeFile600Perm} from "../../../util/index.js"; diff --git a/packages/cli/src/cmds/validator/options.ts b/packages/cli/src/cmds/validator/options.ts index 3beb8197793c..b20caeccb268 100644 --- a/packages/cli/src/cmds/validator/options.ts +++ b/packages/cli/src/cmds/validator/options.ts @@ -1,6 +1,6 @@ import {WireFormat, defaultInit} from "@lodestar/api"; -import {defaultOptions} from "@lodestar/validator"; import {CliCommandOptions} from "@lodestar/utils"; +import {defaultOptions} from "@lodestar/validator"; import {LogArgs, logOptions} from "../../options/logOptions.js"; import {ensure0xPrefix} from "../../util/index.js"; import {keymanagerRestApiServerOptsDefault} from "./keymanager/server.js"; diff --git a/packages/cli/src/cmds/validator/signers/index.ts b/packages/cli/src/cmds/validator/signers/index.ts index 950be2db1cf5..ebe3ed72cdba 100644 --- a/packages/cli/src/cmds/validator/signers/index.ts +++ b/packages/cli/src/cmds/validator/signers/index.ts @@ -2,15 +2,15 @@ import path from "node:path"; import {deriveEth2ValidatorKeys, deriveKeyFromMnemonic} from "@chainsafe/bls-keygen"; import {SecretKey} from "@chainsafe/blst"; import {interopSecretKey} from "@lodestar/state-transition"; -import {externalSignerGetKeys, Signer, SignerType} from "@lodestar/validator"; import {LogLevel, Logger, isValidHttpUrl} from "@lodestar/utils"; -import {defaultNetwork, GlobalArgs} from "../../../options/index.js"; -import {assertValidPubkeysHex, parseRange, YargsError} from "../../../util/index.js"; -import {getAccountPaths} from "../paths.js"; -import {IValidatorCliArgs} from "../options.js"; -import {PersistedKeysBackend} from "../keymanager/persistedKeys.js"; -import {decryptKeystoreDefinitions} from "../keymanager/decryptKeystoreDefinitions.js"; +import {Signer, SignerType, externalSignerGetKeys} from "@lodestar/validator"; +import {GlobalArgs, defaultNetwork} from "../../../options/index.js"; +import {YargsError, assertValidPubkeysHex, parseRange} from "../../../util/index.js"; import {showProgress} from "../../../util/progress.js"; +import {decryptKeystoreDefinitions} from "../keymanager/decryptKeystoreDefinitions.js"; +import {PersistedKeysBackend} from "../keymanager/persistedKeys.js"; +import {IValidatorCliArgs} from "../options.js"; +import {getAccountPaths} from "../paths.js"; import {importKeystoreDefinitionsFromExternalDir, readPassphraseOrPrompt} from "./importExternalKeystores.js"; const KEYSTORE_IMPORT_PROGRESS_MS = 10000; diff --git a/packages/cli/src/cmds/validator/signers/logSigners.ts b/packages/cli/src/cmds/validator/signers/logSigners.ts index d245ee75883a..9f65befb1cc7 100644 --- a/packages/cli/src/cmds/validator/signers/logSigners.ts +++ b/packages/cli/src/cmds/validator/signers/logSigners.ts @@ -1,5 +1,5 @@ -import {Signer, SignerLocal, SignerRemote, SignerType} from "@lodestar/validator"; import {LogLevel, Logger, toPrintableUrl} from "@lodestar/utils"; +import {Signer, SignerLocal, SignerRemote, SignerType} from "@lodestar/validator"; import {YargsError} from "../../../util/errors.js"; import {IValidatorCliArgs} from "../options.js"; diff --git a/packages/cli/src/cmds/validator/slashingProtection/export.ts b/packages/cli/src/cmds/validator/slashingProtection/export.ts index f57f9d3ec0bd..be7caae12e49 100644 --- a/packages/cli/src/cmds/validator/slashingProtection/export.ts +++ b/packages/cli/src/cmds/validator/slashingProtection/export.ts @@ -1,16 +1,16 @@ import path from "node:path"; -import {InterchangeFormatVersion} from "@lodestar/validator"; import {getNodeLogger} from "@lodestar/logger/node"; import {CliCommand, toPubkeyHex} from "@lodestar/utils"; -import {YargsError, ensure0xPrefix, isValidatePubkeyHex, writeFile600Perm} from "../../../util/index.js"; -import {parseLoggerArgs} from "../../../util/logger.js"; +import {InterchangeFormatVersion} from "@lodestar/validator"; +import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {GlobalArgs} from "../../../options/index.js"; import {LogArgs} from "../../../options/logOptions.js"; +import {YargsError, ensure0xPrefix, isValidatePubkeyHex, writeFile600Perm} from "../../../util/index.js"; +import {parseLoggerArgs} from "../../../util/logger.js"; import {AccountValidatorArgs} from "../options.js"; -import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {getValidatorPaths} from "../paths.js"; -import {getGenesisValidatorsRoot, getSlashingProtection} from "./utils.js"; import {ISlashingProtectionArgs} from "./options.js"; +import {getGenesisValidatorsRoot, getSlashingProtection} from "./utils.js"; type ExportArgs = { file: string; diff --git a/packages/cli/src/cmds/validator/slashingProtection/import.ts b/packages/cli/src/cmds/validator/slashingProtection/import.ts index 78be9e6126f7..e0e0cb5744c7 100644 --- a/packages/cli/src/cmds/validator/slashingProtection/import.ts +++ b/packages/cli/src/cmds/validator/slashingProtection/import.ts @@ -1,16 +1,16 @@ import fs from "node:fs"; import path from "node:path"; -import {Interchange} from "@lodestar/validator"; import {getNodeLogger} from "@lodestar/logger/node"; import {CliCommand} from "@lodestar/utils"; -import {parseLoggerArgs} from "../../../util/logger.js"; +import {Interchange} from "@lodestar/validator"; +import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {GlobalArgs} from "../../../options/index.js"; import {LogArgs} from "../../../options/logOptions.js"; +import {parseLoggerArgs} from "../../../util/logger.js"; import {AccountValidatorArgs} from "../options.js"; -import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {getValidatorPaths} from "../paths.js"; -import {getGenesisValidatorsRoot, getSlashingProtection} from "./utils.js"; import {ISlashingProtectionArgs} from "./options.js"; +import {getGenesisValidatorsRoot, getSlashingProtection} from "./utils.js"; type ImportArgs = { file: string; diff --git a/packages/cli/src/cmds/validator/slashingProtection/index.ts b/packages/cli/src/cmds/validator/slashingProtection/index.ts index 9c180c59c378..92d8bba619af 100644 --- a/packages/cli/src/cmds/validator/slashingProtection/index.ts +++ b/packages/cli/src/cmds/validator/slashingProtection/index.ts @@ -1,8 +1,8 @@ import {CliCommand} from "@lodestar/utils"; import {AccountValidatorArgs} from "../options.js"; -import {ISlashingProtectionArgs, slashingProtectionOptions} from "./options.js"; -import {importCmd} from "./import.js"; import {exportCmd} from "./export.js"; +import {importCmd} from "./import.js"; +import {ISlashingProtectionArgs, slashingProtectionOptions} from "./options.js"; export const slashingProtection: CliCommand = { command: "slashing-protection ", diff --git a/packages/cli/src/cmds/validator/slashingProtection/utils.ts b/packages/cli/src/cmds/validator/slashingProtection/utils.ts index fe0af1cb2633..48a25b6d83b9 100644 --- a/packages/cli/src/cmds/validator/slashingProtection/utils.ts +++ b/packages/cli/src/cmds/validator/slashingProtection/utils.ts @@ -1,12 +1,12 @@ -import {Root} from "@lodestar/types"; import {getClient} from "@lodestar/api"; -import {fromHex, Logger} from "@lodestar/utils"; -import {genesisData, NetworkName} from "@lodestar/config/networks"; -import {SlashingProtection, MetaDataRepository} from "@lodestar/validator"; +import {NetworkName, genesisData} from "@lodestar/config/networks"; import {LevelDbController} from "@lodestar/db"; +import {Root} from "@lodestar/types"; +import {Logger, fromHex} from "@lodestar/utils"; +import {MetaDataRepository, SlashingProtection} from "@lodestar/validator"; +import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {GlobalArgs} from "../../../options/index.js"; import {getValidatorPaths} from "../paths.js"; -import {getBeaconConfigFromArgs} from "../../../config/index.js"; import {ISlashingProtectionArgs} from "./options.js"; /** diff --git a/packages/cli/src/cmds/validator/voluntaryExit.ts b/packages/cli/src/cmds/validator/voluntaryExit.ts index 5b4cfdf270f0..9b8b33c8601f 100644 --- a/packages/cli/src/cmds/validator/voluntaryExit.ts +++ b/packages/cli/src/cmds/validator/voluntaryExit.ts @@ -1,19 +1,19 @@ -import inquirer from "inquirer"; import {Signature} from "@chainsafe/blst"; +import {ApiClient, getClient} from "@lodestar/api"; +import {BeaconConfig, createBeaconConfig} from "@lodestar/config"; import { computeEpochAtSlot, computeSigningRoot, computeStartSlotAtEpoch, getCurrentSlot, } from "@lodestar/state-transition"; -import {createBeaconConfig, BeaconConfig} from "@lodestar/config"; -import {phase0, ssz, ValidatorIndex, Epoch} from "@lodestar/types"; +import {Epoch, ValidatorIndex, phase0, ssz} from "@lodestar/types"; import {CliCommand, fromHex, toPubkeyHex} from "@lodestar/utils"; -import {externalSignerPostSignature, SignableMessageType, Signer, SignerType} from "@lodestar/validator"; -import {ApiClient, getClient} from "@lodestar/api"; -import {ensure0xPrefix, YargsError, wrapError} from "../../util/index.js"; -import {GlobalArgs} from "../../options/index.js"; +import {SignableMessageType, Signer, SignerType, externalSignerPostSignature} from "@lodestar/validator"; +import inquirer from "inquirer"; import {getBeaconConfigFromArgs} from "../../config/index.js"; +import {GlobalArgs} from "../../options/index.js"; +import {YargsError, ensure0xPrefix, wrapError} from "../../util/index.js"; import {IValidatorCliArgs} from "./options.js"; import {getSignersFromArgs} from "./signers/index.js"; diff --git a/packages/cli/src/config/beaconNodeOptions.ts b/packages/cli/src/config/beaconNodeOptions.ts index edab28e1ed21..f99ced67d40b 100644 --- a/packages/cli/src/config/beaconNodeOptions.ts +++ b/packages/cli/src/config/beaconNodeOptions.ts @@ -1,6 +1,6 @@ +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; +import {RecursivePartial, isPlainObject} from "@lodestar/utils"; import deepmerge from "deepmerge"; -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; -import {isPlainObject, RecursivePartial} from "@lodestar/utils"; export class BeaconNodeOptions { /** diff --git a/packages/cli/src/config/beaconParams.ts b/packages/cli/src/config/beaconParams.ts index 54a4155a3914..7abb0e9a5537 100644 --- a/packages/cli/src/config/beaconParams.ts +++ b/packages/cli/src/config/beaconParams.ts @@ -1,19 +1,19 @@ import { ChainConfig, - createChainForkConfig, - createChainConfig, ChainForkConfig, chainConfigFromJson, + createChainConfig, + createChainForkConfig, } from "@lodestar/config"; -import {readFile} from "../util/index.js"; -import {getNetworkBeaconParams, NetworkName} from "../networks/index.js"; +import {NetworkName, getNetworkBeaconParams} from "../networks/index.js"; import { - parseBeaconParamsArgs, - parseTerminalPowArgs, - ITerminalPowArgs, GlobalArgs, + ITerminalPowArgs, defaultNetwork, + parseBeaconParamsArgs, + parseTerminalPowArgs, } from "../options/index.js"; +import {readFile} from "../util/index.js"; import {IBeaconParamsUnparsed} from "./types.js"; type BeaconParamsArgs = { diff --git a/packages/cli/src/config/peerId.ts b/packages/cli/src/config/peerId.ts index 576a99e6980e..dd45ff408d0c 100644 --- a/packages/cli/src/config/peerId.ts +++ b/packages/cli/src/config/peerId.ts @@ -1,10 +1,10 @@ +import {unmarshalPrivateKey, unmarshalPublicKey} from "@libp2p/crypto/keys"; import type {PeerId} from "@libp2p/interface"; import {peerIdFromBytes} from "@libp2p/peer-id"; import {createFromPrivKey, createFromPubKey} from "@libp2p/peer-id-factory"; -import {unmarshalPrivateKey, unmarshalPublicKey} from "@libp2p/crypto/keys"; import {fromString as uint8ArrayFromString} from "uint8arrays/from-string"; import {toString as uint8ArrayToString} from "uint8arrays/to-string"; -import {writeFile600Perm, readFile} from "../util/index.js"; +import {readFile, writeFile600Perm} from "../util/index.js"; // Peer id to / from JSON taken from peer-id-factory // See https://github.com/libp2p/js-libp2p-peer-id/pull/9 for more details diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 0d509af17ab0..bc232bf0cce3 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -2,8 +2,8 @@ // MUST import first to apply preset from args and set ssz hasher import "./applyPreset.js"; -import {YargsError} from "./util/index.js"; import {getLodestarCli, yarg} from "./cli.js"; +import {YargsError} from "./util/index.js"; import "source-map-support/register.js"; const lodestar = getLodestarCli(); diff --git a/packages/cli/src/networks/dev.ts b/packages/cli/src/networks/dev.ts index 6ce87273b3cb..3ae54051ea37 100644 --- a/packages/cli/src/networks/dev.ts +++ b/packages/cli/src/networks/dev.ts @@ -1,7 +1,7 @@ +import {ChainConfig} from "@lodestar/config"; +import {mainnetChainConfig, minimalChainConfig} from "@lodestar/config/configs"; import {gnosisChainConfig} from "@lodestar/config/networks"; -import {minimalChainConfig, mainnetChainConfig} from "@lodestar/config/configs"; import {ACTIVE_PRESET, PresetName} from "@lodestar/params"; -import {ChainConfig} from "@lodestar/config"; let chainConfig: ChainConfig; switch (ACTIVE_PRESET) { diff --git a/packages/cli/src/networks/index.ts b/packages/cli/src/networks/index.ts index 13e55685e353..b81fe7094fdd 100644 --- a/packages/cli/src/networks/index.ts +++ b/packages/cli/src/networks/index.ts @@ -1,28 +1,28 @@ import fs from "node:fs"; -import got from "got"; import {ENR} from "@chainsafe/enr"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {HttpHeader, MediaType, WireFormat, getClient} from "@lodestar/api"; import {getStateSlotFromBytes} from "@lodestar/beacon-node"; import {ChainConfig, ChainForkConfig} from "@lodestar/config"; -import {Checkpoint} from "@lodestar/types/phase0"; -import {Slot} from "@lodestar/types"; -import {fromHex, callFnWhenAwait, Logger, formatBytes} from "@lodestar/utils"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import { BeaconStateAllForks, - getLatestBlockRoot, computeCheckpointEpochAtStateSlot, + getLatestBlockRoot, loadState, } from "@lodestar/state-transition"; +import {Slot} from "@lodestar/types"; +import {Checkpoint} from "@lodestar/types/phase0"; +import {Logger, callFnWhenAwait, formatBytes, fromHex} from "@lodestar/utils"; +import got from "got"; import {parseBootnodesFile} from "../util/format.js"; -import * as mainnet from "./mainnet.js"; +import * as chiado from "./chiado.js"; import * as dev from "./dev.js"; +import * as ephemery from "./ephemery.js"; import * as gnosis from "./gnosis.js"; -import * as sepolia from "./sepolia.js"; import * as holesky from "./holesky.js"; -import * as chiado from "./chiado.js"; -import * as ephemery from "./ephemery.js"; +import * as mainnet from "./mainnet.js"; import * as mekong from "./mekong.js"; +import * as sepolia from "./sepolia.js"; export type NetworkName = "mainnet" | "dev" | "gnosis" | "sepolia" | "holesky" | "chiado" | "ephemery" | "mekong"; export const networkNames: NetworkName[] = [ diff --git a/packages/cli/src/options/beaconNodeOptions/api.ts b/packages/cli/src/options/beaconNodeOptions/api.ts index ea4d4ebccf84..7ee3bd9caa17 100644 --- a/packages/cli/src/options/beaconNodeOptions/api.ts +++ b/packages/cli/src/options/beaconNodeOptions/api.ts @@ -1,4 +1,4 @@ -import {defaultOptions, IBeaconNodeOptions, allNamespaces} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, allNamespaces, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; const enabledAll = "*"; diff --git a/packages/cli/src/options/beaconNodeOptions/builder.ts b/packages/cli/src/options/beaconNodeOptions/builder.ts index d0e4089dd81c..01e21125637b 100644 --- a/packages/cli/src/options/beaconNodeOptions/builder.ts +++ b/packages/cli/src/options/beaconNodeOptions/builder.ts @@ -1,4 +1,4 @@ -import {defaultExecutionBuilderHttpOpts, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultExecutionBuilderHttpOpts} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; import {YargsError} from "../../util/index.js"; diff --git a/packages/cli/src/options/beaconNodeOptions/chain.ts b/packages/cli/src/options/beaconNodeOptions/chain.ts index c5f907804a83..21c05545c43d 100644 --- a/packages/cli/src/options/beaconNodeOptions/chain.ts +++ b/packages/cli/src/options/beaconNodeOptions/chain.ts @@ -1,5 +1,5 @@ import * as path from "node:path"; -import {StateArchiveMode, defaultOptions, IBeaconNodeOptions, DEFAULT_STATE_ARCHIVE_MODE} from "@lodestar/beacon-node"; +import {DEFAULT_STATE_ARCHIVE_MODE, IBeaconNodeOptions, StateArchiveMode, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; export type ChainArgs = { diff --git a/packages/cli/src/options/beaconNodeOptions/eth1.ts b/packages/cli/src/options/beaconNodeOptions/eth1.ts index f12a1704dec7..cab090a96781 100644 --- a/packages/cli/src/options/beaconNodeOptions/eth1.ts +++ b/packages/cli/src/options/beaconNodeOptions/eth1.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; import {extractJwtHexSecret} from "../../util/index.js"; import {ExecutionEngineArgs} from "./execution.js"; diff --git a/packages/cli/src/options/beaconNodeOptions/execution.ts b/packages/cli/src/options/beaconNodeOptions/execution.ts index 2d32ee2ae786..79ea4ade98de 100644 --- a/packages/cli/src/options/beaconNodeOptions/execution.ts +++ b/packages/cli/src/options/beaconNodeOptions/execution.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import {defaultExecutionEngineHttpOpts, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultExecutionEngineHttpOpts} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; import {extractJwtHexSecret} from "../../util/index.js"; diff --git a/packages/cli/src/options/beaconNodeOptions/metrics.ts b/packages/cli/src/options/beaconNodeOptions/metrics.ts index ded63b7dc24d..ae4c045fb07c 100644 --- a/packages/cli/src/options/beaconNodeOptions/metrics.ts +++ b/packages/cli/src/options/beaconNodeOptions/metrics.ts @@ -1,4 +1,4 @@ -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; export type MetricsArgs = { diff --git a/packages/cli/src/options/beaconNodeOptions/monitoring.ts b/packages/cli/src/options/beaconNodeOptions/monitoring.ts index 2143277df2ae..2f35a4a29c5c 100644 --- a/packages/cli/src/options/beaconNodeOptions/monitoring.ts +++ b/packages/cli/src/options/beaconNodeOptions/monitoring.ts @@ -1,4 +1,4 @@ -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; export type MonitoringArgs = { diff --git a/packages/cli/src/options/beaconNodeOptions/network.ts b/packages/cli/src/options/beaconNodeOptions/network.ts index cfd109bdc50a..56944d90fd0c 100644 --- a/packages/cli/src/options/beaconNodeOptions/network.ts +++ b/packages/cli/src/options/beaconNodeOptions/network.ts @@ -1,7 +1,7 @@ -import {multiaddr} from "@multiformats/multiaddr"; import {ENR} from "@chainsafe/enr"; -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; +import {multiaddr} from "@multiformats/multiaddr"; import {YargsError} from "../../util/index.js"; export const defaultListenAddress = "0.0.0.0"; diff --git a/packages/cli/src/options/beaconNodeOptions/sync.ts b/packages/cli/src/options/beaconNodeOptions/sync.ts index 789307781ed0..a33fa43db470 100644 --- a/packages/cli/src/options/beaconNodeOptions/sync.ts +++ b/packages/cli/src/options/beaconNodeOptions/sync.ts @@ -1,4 +1,4 @@ -import {defaultOptions, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, defaultOptions} from "@lodestar/beacon-node"; import {CliCommandOptions} from "@lodestar/utils"; export type SyncArgs = { diff --git a/packages/cli/src/options/globalOptions.ts b/packages/cli/src/options/globalOptions.ts index 52a5090c6794..58ae396b67d1 100644 --- a/packages/cli/src/options/globalOptions.ts +++ b/packages/cli/src/options/globalOptions.ts @@ -2,7 +2,7 @@ import {ACTIVE_PRESET} from "@lodestar/params"; import {CliCommandOptions} from "@lodestar/utils"; import {NetworkName, networkNames} from "../networks/index.js"; import {readFile} from "../util/index.js"; -import {paramsOptions, IParamsArgs} from "./paramsOptions.js"; +import {IParamsArgs, paramsOptions} from "./paramsOptions.js"; type GlobalSingleArgs = { dataDir?: string; diff --git a/packages/cli/src/options/logOptions.ts b/packages/cli/src/options/logOptions.ts index 09eb5b1d56cb..5b8c32c3b796 100644 --- a/packages/cli/src/options/logOptions.ts +++ b/packages/cli/src/options/logOptions.ts @@ -1,5 +1,5 @@ -import {LogLevels, CliCommandOptions} from "@lodestar/utils"; import {LogLevel, logFormats} from "@lodestar/logger"; +import {CliCommandOptions, LogLevels} from "@lodestar/utils"; import {LOG_FILE_DISABLE_KEYWORD} from "../util/logger.js"; export type LogArgs = { diff --git a/packages/cli/src/util/gitData/gitDataPath.ts b/packages/cli/src/util/gitData/gitDataPath.ts index 1ad3104aafc6..b4c7f8c7c62c 100644 --- a/packages/cli/src/util/gitData/gitDataPath.ts +++ b/packages/cli/src/util/gitData/gitDataPath.ts @@ -1,5 +1,5 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import {fileURLToPath} from "node:url"; // Global variable __dirname no longer available in ES6 modules. diff --git a/packages/cli/src/util/gitData/index.ts b/packages/cli/src/util/gitData/index.ts index 0720d39d9e30..c5681660f8ce 100644 --- a/packages/cli/src/util/gitData/index.ts +++ b/packages/cli/src/util/gitData/index.ts @@ -2,7 +2,7 @@ import {execSync} from "node:child_process"; // This file is created in the build step and is distributed through NPM // MUST be in sync with `-/gitDataPath.ts` and `package.json` files. -import {readGitDataFile, GitData} from "./gitDataPath.js"; +import {GitData, readGitDataFile} from "./gitDataPath.js"; /** Reads git data from a persisted file or local git data at build time. */ export function readAndGetGitData(): GitData { diff --git a/packages/cli/src/util/logger.ts b/packages/cli/src/util/logger.ts index 7a394c9ce25f..99504ce5d43b 100644 --- a/packages/cli/src/util/logger.ts +++ b/packages/cli/src/util/logger.ts @@ -1,12 +1,12 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import {ChainForkConfig} from "@lodestar/config"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {LogFormat, TimestampFormatCode, logFormats} from "@lodestar/logger"; import {LoggerNodeOpts} from "@lodestar/logger/node"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {LogLevel} from "@lodestar/utils"; -import {LogArgs} from "../options/logOptions.js"; import {GlobalArgs} from "../options/globalOptions.js"; +import {LogArgs} from "../options/logOptions.js"; export const LOG_FILE_DISABLE_KEYWORD = "none"; diff --git a/packages/cli/src/util/proposerConfig.ts b/packages/cli/src/util/proposerConfig.ts index 4cfa6fa71075..0aa745bc78af 100644 --- a/packages/cli/src/util/proposerConfig.ts +++ b/packages/cli/src/util/proposerConfig.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import {ValidatorProposerConfig} from "@lodestar/validator"; import {routes} from "@lodestar/api"; +import {ValidatorProposerConfig} from "@lodestar/validator"; import {parseFeeRecipient} from "./feeRecipient.js"; diff --git a/packages/cli/test/e2e/blsToExecutionchange.test.ts b/packages/cli/test/e2e/blsToExecutionchange.test.ts index 57f32421d313..ec7322caba00 100644 --- a/packages/cli/test/e2e/blsToExecutionchange.test.ts +++ b/packages/cli/test/e2e/blsToExecutionchange.test.ts @@ -1,11 +1,11 @@ import path from "node:path"; -import {describe, it, vi, onTestFinished} from "vitest"; import {toHexString} from "@chainsafe/ssz"; -import {sleep, retry} from "@lodestar/utils"; import {getClient} from "@lodestar/api"; import {config} from "@lodestar/config/default"; import {interopSecretKey} from "@lodestar/state-transition"; import {execCliCommand, spawnCliCommand, stopChildProcess} from "@lodestar/test-utils"; +import {retry, sleep} from "@lodestar/utils"; +import {describe, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; describe("bLSToExecutionChange cmd", () => { diff --git a/packages/cli/test/e2e/importFromFsDirect.test.ts b/packages/cli/test/e2e/importFromFsDirect.test.ts index 6f612e84afe6..b65ebf74fede 100644 --- a/packages/cli/test/e2e/importFromFsDirect.test.ts +++ b/packages/cli/test/e2e/importFromFsDirect.test.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, beforeAll, vi} from "vitest"; -import {rimraf} from "rimraf"; import {getKeystoresStr} from "@lodestar/test-utils"; +import {rimraf} from "rimraf"; +import {beforeAll, describe, it, vi} from "vitest"; import {testFilesDir} from "../utils.js"; import {cachedPubkeysHex, cachedSeckeysHex} from "../utils/cachedKeys.js"; import {expectKeys, startValidatorWithKeyManager} from "../utils/validator.js"; diff --git a/packages/cli/test/e2e/importFromFsPreStep.test.ts b/packages/cli/test/e2e/importFromFsPreStep.test.ts index 437180ef07e5..2933b6113a32 100644 --- a/packages/cli/test/e2e/importFromFsPreStep.test.ts +++ b/packages/cli/test/e2e/importFromFsPreStep.test.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, beforeAll, vi, onTestFinished} from "vitest"; -import {rimraf} from "rimraf"; import {execCliCommand} from "@lodestar/test-utils"; import {getKeystoresStr} from "@lodestar/test-utils"; +import {rimraf} from "rimraf"; +import {beforeAll, describe, expect, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; import {cachedPubkeysHex, cachedSeckeysHex} from "../utils/cachedKeys.js"; import {expectKeys, startValidatorWithKeyManager} from "../utils/validator.js"; diff --git a/packages/cli/test/e2e/importKeystoresFromApi.test.ts b/packages/cli/test/e2e/importKeystoresFromApi.test.ts index 7f71e2977a92..6d15cfe13827 100644 --- a/packages/cli/test/e2e/importKeystoresFromApi.test.ts +++ b/packages/cli/test/e2e/importKeystoresFromApi.test.ts @@ -1,12 +1,12 @@ import path from "node:path"; -import {describe, it, expect, beforeAll, vi, onTestFinished} from "vitest"; -import {rimraf} from "rimraf"; -import {DeletionStatus, getClient, ImportStatus} from "@lodestar/api/keymanager"; -import {config} from "@lodestar/config/default"; -import {Interchange} from "@lodestar/validator"; import {HttpStatusCode} from "@lodestar/api"; +import {DeletionStatus, ImportStatus, getClient} from "@lodestar/api/keymanager"; +import {config} from "@lodestar/config/default"; import {bufferStderr, spawnCliCommand} from "@lodestar/test-utils"; import {getKeystoresStr} from "@lodestar/test-utils"; +import {Interchange} from "@lodestar/validator"; +import {rimraf} from "rimraf"; +import {beforeAll, describe, expect, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; import {cachedPubkeysHex, cachedSeckeysHex} from "../utils/cachedKeys.js"; import {expectDeepEquals} from "../utils/runUtils.js"; diff --git a/packages/cli/test/e2e/importRemoteKeysFromApi.test.ts b/packages/cli/test/e2e/importRemoteKeysFromApi.test.ts index b66611cbf4f4..2f3efea9425e 100644 --- a/packages/cli/test/e2e/importRemoteKeysFromApi.test.ts +++ b/packages/cli/test/e2e/importRemoteKeysFromApi.test.ts @@ -1,9 +1,9 @@ import path from "node:path"; -import {describe, it, expect, beforeAll, vi, onTestFinished} from "vitest"; -import {rimraf} from "rimraf"; -import {ApiClient, DeleteRemoteKeyStatus, getClient, ImportRemoteKeyStatus} from "@lodestar/api/keymanager"; -import {config} from "@lodestar/config/default"; import {HttpStatusCode} from "@lodestar/api"; +import {ApiClient, DeleteRemoteKeyStatus, ImportRemoteKeyStatus, getClient} from "@lodestar/api/keymanager"; +import {config} from "@lodestar/config/default"; +import {rimraf} from "rimraf"; +import {beforeAll, describe, expect, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; import {cachedPubkeysHex} from "../utils/cachedKeys.js"; import {expectDeepEquals} from "../utils/runUtils.js"; diff --git a/packages/cli/test/e2e/propserConfigfromKeymanager.test.ts b/packages/cli/test/e2e/propserConfigfromKeymanager.test.ts index 2f25c82999a7..26bf3e618c2b 100644 --- a/packages/cli/test/e2e/propserConfigfromKeymanager.test.ts +++ b/packages/cli/test/e2e/propserConfigfromKeymanager.test.ts @@ -1,9 +1,9 @@ import path from "node:path"; -import {describe, it, beforeAll, vi, onTestFinished} from "vitest"; -import {rimraf} from "rimraf"; import {ImportStatus} from "@lodestar/api/keymanager"; -import {Interchange} from "@lodestar/validator"; import {getKeystoresStr} from "@lodestar/test-utils"; +import {Interchange} from "@lodestar/validator"; +import {rimraf} from "rimraf"; +import {beforeAll, describe, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; import {cachedPubkeysHex, cachedSeckeysHex} from "../utils/cachedKeys.js"; import {expectDeepEquals} from "../utils/runUtils.js"; diff --git a/packages/cli/test/e2e/runDevCmd.test.ts b/packages/cli/test/e2e/runDevCmd.test.ts index 3beb68393815..e935e5eaf411 100644 --- a/packages/cli/test/e2e/runDevCmd.test.ts +++ b/packages/cli/test/e2e/runDevCmd.test.ts @@ -1,8 +1,8 @@ -import {describe, it, vi, onTestFinished} from "vitest"; import {getClient} from "@lodestar/api"; import {config} from "@lodestar/config/default"; -import {retry} from "@lodestar/utils"; import {spawnCliCommand, stopChildProcess} from "@lodestar/test-utils"; +import {retry} from "@lodestar/utils"; +import {describe, it, onTestFinished, vi} from "vitest"; describe("Run dev command", () => { vi.setConfig({testTimeout: 30_000}); diff --git a/packages/cli/test/e2e/validatorList.test.ts b/packages/cli/test/e2e/validatorList.test.ts index 7f86fb8ef89b..6987006bd26a 100644 --- a/packages/cli/test/e2e/validatorList.test.ts +++ b/packages/cli/test/e2e/validatorList.test.ts @@ -1,13 +1,13 @@ /* eslint-disable no-console */ import fs from "node:fs"; import path from "node:path"; -import {describe, it, beforeAll, vi, expect, afterEach, beforeEach} from "vitest"; -import {rimraf} from "rimraf"; import {Keystore} from "@chainsafe/bls-keystore"; -import {fromHex} from "@lodestar/utils"; import {runCliCommand} from "@lodestar/test-utils"; -import {testFilesDir} from "../utils.js"; +import {fromHex} from "@lodestar/utils"; +import {rimraf} from "rimraf"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {getLodestarCli} from "../../src/cli.js"; +import {testFilesDir} from "../utils.js"; describe("cmds / validator", () => { vi.setConfig({testTimeout: 30_000}); diff --git a/packages/cli/test/e2e/voluntaryExit.test.ts b/packages/cli/test/e2e/voluntaryExit.test.ts index 0abddcab7652..8c17e8ef8c5b 100644 --- a/packages/cli/test/e2e/voluntaryExit.test.ts +++ b/packages/cli/test/e2e/voluntaryExit.test.ts @@ -1,10 +1,10 @@ import path from "node:path"; -import {describe, it, vi, onTestFinished} from "vitest"; -import {retry} from "@lodestar/utils"; import {getClient} from "@lodestar/api"; import {config} from "@lodestar/config/default"; import {interopSecretKey} from "@lodestar/state-transition"; -import {spawnCliCommand, execCliCommand, stopChildProcess} from "@lodestar/test-utils"; +import {execCliCommand, spawnCliCommand, stopChildProcess} from "@lodestar/test-utils"; +import {retry} from "@lodestar/utils"; +import {describe, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; describe("voluntaryExit cmd", () => { diff --git a/packages/cli/test/e2e/voluntaryExitFromApi.test.ts b/packages/cli/test/e2e/voluntaryExitFromApi.test.ts index 97ac06d5fc5c..8421d57658af 100644 --- a/packages/cli/test/e2e/voluntaryExitFromApi.test.ts +++ b/packages/cli/test/e2e/voluntaryExitFromApi.test.ts @@ -1,11 +1,11 @@ import path from "node:path"; -import {describe, it, vi, expect, onTestFinished} from "vitest"; import {getClient} from "@lodestar/api"; import {getClient as getKeymanagerClient} from "@lodestar/api/keymanager"; import {config} from "@lodestar/config/default"; import {interopSecretKey} from "@lodestar/state-transition"; import {spawnCliCommand, stopChildProcess} from "@lodestar/test-utils"; import {retry} from "@lodestar/utils"; +import {describe, expect, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; describe("voluntary exit from api", () => { diff --git a/packages/cli/test/e2e/voluntaryExitRemoteSigner.test.ts b/packages/cli/test/e2e/voluntaryExitRemoteSigner.test.ts index 769380f2053f..172f79c5191d 100644 --- a/packages/cli/test/e2e/voluntaryExitRemoteSigner.test.ts +++ b/packages/cli/test/e2e/voluntaryExitRemoteSigner.test.ts @@ -1,17 +1,17 @@ import path from "node:path"; -import {describe, it, beforeAll, afterAll, vi, onTestFinished} from "vitest"; -import {retry} from "@lodestar/utils"; import {getClient} from "@lodestar/api"; import {config} from "@lodestar/config/default"; import {interopSecretKey, interopSecretKeys} from "@lodestar/state-transition"; import { - spawnCliCommand, - execCliCommand, - startExternalSigner, StartedExternalSigner, + execCliCommand, getKeystoresStr, + spawnCliCommand, + startExternalSigner, stopChildProcess, } from "@lodestar/test-utils"; +import {retry} from "@lodestar/utils"; +import {afterAll, beforeAll, describe, it, onTestFinished, vi} from "vitest"; import {testFilesDir} from "../utils.js"; describe("voluntaryExit using remote signer", () => { diff --git a/packages/cli/test/sim/backupEthProvider.test.ts b/packages/cli/test/sim/backupEthProvider.test.ts index 4ccc131a58bc..8b34d57e4d67 100644 --- a/packages/cli/test/sim/backupEthProvider.test.ts +++ b/packages/cli/test/sim/backupEthProvider.test.ts @@ -1,8 +1,8 @@ import path from "node:path"; import {activePreset} from "@lodestar/params"; -import {Simulation} from "../utils/crucible/simulation.js"; import {nodeAssertion} from "../utils/crucible/assertions/nodeAssertion.js"; -import {Match, BeaconClient, ExecutionClient} from "../utils/crucible/interfaces.js"; +import {BeaconClient, ExecutionClient, Match} from "../utils/crucible/interfaces.js"; +import {Simulation} from "../utils/crucible/simulation.js"; import {defineSimTestConfig, logFilesDir, replaceIpFromUrl} from "../utils/crucible/utils/index.js"; import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; diff --git a/packages/cli/test/sim/deneb.test.ts b/packages/cli/test/sim/deneb.test.ts index 865540ae7635..8d3bd3064bc2 100644 --- a/packages/cli/test/sim/deneb.test.ts +++ b/packages/cli/test/sim/deneb.test.ts @@ -1,9 +1,9 @@ import path from "node:path"; -import {Simulation} from "../utils/crucible/simulation.js"; +import {createBlobsAssertion} from "../utils/crucible/assertions/blobsAssertion.js"; import {BeaconClient, ExecutionClient, ValidatorClient} from "../utils/crucible/interfaces.js"; +import {Simulation} from "../utils/crucible/simulation.js"; import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; -import {createBlobsAssertion} from "../utils/crucible/assertions/blobsAssertion.js"; import {assertCheckpointSync, assertRangeSync} from "../utils/crucible/utils/syncing.js"; const runTillEpoch = 6; diff --git a/packages/cli/test/sim/endpoints.test.ts b/packages/cli/test/sim/endpoints.test.ts index 308ac6a0053c..b1492865309a 100644 --- a/packages/cli/test/sim/endpoints.test.ts +++ b/packages/cli/test/sim/endpoints.test.ts @@ -1,10 +1,10 @@ -import path from "node:path"; import assert from "node:assert"; +import path from "node:path"; import {toHexString} from "@chainsafe/ssz"; -import {routes, fetch} from "@lodestar/api"; +import {fetch, routes} from "@lodestar/api"; import {ssz} from "@lodestar/types"; -import {Simulation} from "../utils/crucible/simulation.js"; import {BeaconClient, ExecutionClient} from "../utils/crucible/interfaces.js"; +import {Simulation} from "../utils/crucible/simulation.js"; import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; import {waitForSlot} from "../utils/crucible/utils/network.js"; diff --git a/packages/cli/test/sim/mixedClient.test.ts b/packages/cli/test/sim/mixedClient.test.ts index 45029a1b26b4..5fe786829cf1 100644 --- a/packages/cli/test/sim/mixedClient.test.ts +++ b/packages/cli/test/sim/mixedClient.test.ts @@ -1,7 +1,7 @@ import path from "node:path"; -import {Simulation} from "../utils/crucible/simulation.js"; import {nodeAssertion} from "../utils/crucible/assertions/nodeAssertion.js"; -import {Match, BeaconClient, ExecutionClient, ValidatorClient} from "../utils/crucible/interfaces.js"; +import {BeaconClient, ExecutionClient, Match, ValidatorClient} from "../utils/crucible/interfaces.js"; +import {Simulation} from "../utils/crucible/simulation.js"; import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; diff --git a/packages/cli/test/sim/multiFork.test.ts b/packages/cli/test/sim/multiFork.test.ts index 047d9196239d..83cb8f234646 100644 --- a/packages/cli/test/sim/multiFork.test.ts +++ b/packages/cli/test/sim/multiFork.test.ts @@ -1,14 +1,14 @@ import path from "node:path"; -import {Match, BeaconClient, ExecutionClient, ValidatorClient} from "../utils/crucible/interfaces.js"; -import {Simulation} from "../utils/crucible/simulation.js"; -import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; -import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; -import {nodeAssertion} from "../utils/crucible/assertions/nodeAssertion.js"; -import {mergeAssertion} from "../utils/crucible/assertions/mergeAssertion.js"; -import {createForkAssertion} from "../utils/crucible/assertions/forkAssertion.js"; import {createAccountBalanceAssertion} from "../utils/crucible/assertions/accountBalanceAssertion.js"; import {createExecutionHeadAssertion} from "../utils/crucible/assertions/executionHeadAssertion.js"; +import {createForkAssertion} from "../utils/crucible/assertions/forkAssertion.js"; +import {mergeAssertion} from "../utils/crucible/assertions/mergeAssertion.js"; +import {nodeAssertion} from "../utils/crucible/assertions/nodeAssertion.js"; import {createWithdrawalAssertions} from "../utils/crucible/assertions/withdrawalsAssertion.js"; +import {BeaconClient, ExecutionClient, Match, ValidatorClient} from "../utils/crucible/interfaces.js"; +import {Simulation} from "../utils/crucible/simulation.js"; +import {defineSimTestConfig, logFilesDir} from "../utils/crucible/utils/index.js"; +import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js"; import {assertCheckpointSync, assertRangeSync, assertUnknownBlockSync} from "../utils/crucible/utils/syncing.js"; const altairForkEpoch = 2; diff --git a/packages/cli/test/unit/cmds/beacon.test.ts b/packages/cli/test/unit/cmds/beacon.test.ts index 6e7b7f389a29..a1dac019a7e8 100644 --- a/packages/cli/test/unit/cmds/beacon.test.ts +++ b/packages/cli/test/unit/cmds/beacon.test.ts @@ -1,16 +1,16 @@ -import path from "node:path"; import fs from "node:fs"; -import {describe, it, expect} from "vitest"; +import path from "node:path"; +import {ENR, SignableENR, createPrivateKeyFromPeerId} from "@chainsafe/enr"; import {createFromJSON, createSecp256k1PeerId} from "@libp2p/peer-id-factory"; -import {multiaddr} from "@multiformats/multiaddr"; -import {createPrivateKeyFromPeerId, ENR, SignableENR} from "@chainsafe/enr"; -import {chainConfig} from "@lodestar/config/default"; import {chainConfigToJson} from "@lodestar/config"; +import {chainConfig} from "@lodestar/config/default"; import {LogLevel} from "@lodestar/utils"; -import {exportToJSON} from "../../../src/config/peerId.js"; +import {multiaddr} from "@multiformats/multiaddr"; +import {describe, expect, it} from "vitest"; import {beaconHandlerInit} from "../../../src/cmds/beacon/handler.js"; import {initPeerIdAndEnr, isLocalMultiAddr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; +import {exportToJSON} from "../../../src/config/peerId.js"; import {GlobalArgs} from "../../../src/options/globalOptions.js"; import {testFilesDir, testLogger} from "../../utils.js"; diff --git a/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts b/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts index a207e0c0f59d..a7b7ed64e743 100644 --- a/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts +++ b/packages/cli/test/unit/cmds/initPeerIdAndEnr.test.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; -import {describe, it, expect, beforeEach, afterEach} from "vitest"; import tmp from "tmp"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; import {initPeerIdAndEnr} from "../../../src/cmds/beacon/initPeerIdAndEnr.js"; import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; import {testLogger} from "../../utils.js"; diff --git a/packages/cli/test/unit/cmds/validator/keymanager/keystoreCache.test.ts b/packages/cli/test/unit/cmds/validator/keymanager/keystoreCache.test.ts index 8d3dbb989b5d..a313455f7d8c 100644 --- a/packages/cli/test/unit/cmds/validator/keymanager/keystoreCache.test.ts +++ b/packages/cli/test/unit/cmds/validator/keymanager/keystoreCache.test.ts @@ -1,13 +1,13 @@ -import fs from "node:fs"; import {randomBytes} from "node:crypto"; -import {describe, it, expect, beforeEach, vi} from "vitest"; -import tmp from "tmp"; +import fs from "node:fs"; import {Keystore} from "@chainsafe/bls-keystore"; import {SecretKey} from "@chainsafe/blst"; import {interopSecretKey} from "@lodestar/state-transition"; import {SignerLocal, SignerType} from "@lodestar/validator"; -import {loadKeystoreCache, writeKeystoreCache} from "../../../../../src/cmds/validator/keymanager/keystoreCache.js"; +import tmp from "tmp"; +import {beforeEach, describe, expect, it, vi} from "vitest"; import {LocalKeystoreDefinition} from "../../../../../src/cmds/validator/keymanager/interface.js"; +import {loadKeystoreCache, writeKeystoreCache} from "../../../../../src/cmds/validator/keymanager/keystoreCache.js"; const numberOfSigners = 10; diff --git a/packages/cli/test/unit/config/beaconNodeOptions.test.ts b/packages/cli/test/unit/config/beaconNodeOptions.test.ts index d35cf06ad1a4..cb21a15ce0af 100644 --- a/packages/cli/test/unit/config/beaconNodeOptions.test.ts +++ b/packages/cli/test/unit/config/beaconNodeOptions.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {defaultOptions} from "@lodestar/beacon-node"; +import {describe, expect, it} from "vitest"; import {BeaconNodeOptions} from "../../../src/config/index.js"; describe("config / beaconNodeOptions", () => { diff --git a/packages/cli/test/unit/config/beaconParams.test.ts b/packages/cli/test/unit/config/beaconParams.test.ts index 2a78d498bf89..1d24cda5dda9 100644 --- a/packages/cli/test/unit/config/beaconParams.test.ts +++ b/packages/cli/test/unit/config/beaconParams.test.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; -import yaml from "js-yaml"; import {toHexString} from "@chainsafe/ssz"; -import {getTestdirPath} from "../../utils.js"; +import yaml from "js-yaml"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {getBeaconParams} from "../../../src/config/index.js"; +import {getTestdirPath} from "../../utils.js"; describe("config / beaconParams", () => { const GENESIS_FORK_VERSION_MAINNET = "0x00000000"; diff --git a/packages/cli/test/unit/config/peerId.test.ts b/packages/cli/test/unit/config/peerId.test.ts index c0cdc8cff1a9..a85aaf1a5a5c 100644 --- a/packages/cli/test/unit/config/peerId.test.ts +++ b/packages/cli/test/unit/config/peerId.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {createSecp256k1PeerId} from "@libp2p/peer-id-factory"; +import {describe, expect, it} from "vitest"; +import {readPeerId, writePeerId} from "../../../src/config/index.js"; import {getTestdirPath} from "../../utils.js"; -import {writePeerId, readPeerId} from "../../../src/config/index.js"; describe("config / peerId", () => { const peerIdFilepath = getTestdirPath("./test-peer-id.json"); diff --git a/packages/cli/test/unit/options/beaconNodeOptions.test.ts b/packages/cli/test/unit/options/beaconNodeOptions.test.ts index 8d295197b541..a94079ee0544 100644 --- a/packages/cli/test/unit/options/beaconNodeOptions.test.ts +++ b/packages/cli/test/unit/options/beaconNodeOptions.test.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; -import {describe, it, expect} from "vitest"; -import {StateArchiveMode, IBeaconNodeOptions} from "@lodestar/beacon-node"; +import {IBeaconNodeOptions, StateArchiveMode} from "@lodestar/beacon-node"; import {RecursivePartial} from "@lodestar/utils"; -import {parseBeaconNodeArgs, BeaconNodeArgs} from "../../../src/options/beaconNodeOptions/index.js"; +import {describe, expect, it} from "vitest"; +import {BeaconNodeArgs, parseBeaconNodeArgs} from "../../../src/options/beaconNodeOptions/index.js"; import {getTestdirPath} from "../../utils.js"; describe("options / beaconNodeOptions", () => { diff --git a/packages/cli/test/unit/options/paramsOptions.test.ts b/packages/cli/test/unit/options/paramsOptions.test.ts index d6563203e652..13b3b6e41c6b 100644 --- a/packages/cli/test/unit/options/paramsOptions.test.ts +++ b/packages/cli/test/unit/options/paramsOptions.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {parseBeaconParamsArgs} from "../../../src/options/paramsOptions.js"; +import {describe, expect, it} from "vitest"; import {IBeaconParamsUnparsed} from "../../../src/config/types.js"; +import {parseBeaconParamsArgs} from "../../../src/options/paramsOptions.js"; describe("options / paramsOptions", () => { it("Should parse BeaconParams", () => { diff --git a/packages/cli/test/unit/paths/globalPaths.test.ts b/packages/cli/test/unit/paths/globalPaths.test.ts index 0d301bb56ffb..67655600c25b 100644 --- a/packages/cli/test/unit/paths/globalPaths.test.ts +++ b/packages/cli/test/unit/paths/globalPaths.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {getGlobalPaths} from "../../../src/paths/global.js"; describe("paths / global", () => { diff --git a/packages/cli/test/unit/util/extractJwtHexSecret.test.ts b/packages/cli/test/unit/util/extractJwtHexSecret.test.ts index bb7032390208..9f8543c2b9a1 100644 --- a/packages/cli/test/unit/util/extractJwtHexSecret.test.ts +++ b/packages/cli/test/unit/util/extractJwtHexSecret.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {extractJwtHexSecret} from "../../../src/util/index.js"; describe("parseJwtHexSecret", () => { diff --git a/packages/cli/test/unit/util/format.test.ts b/packages/cli/test/unit/util/format.test.ts index 194cc1dcbde7..f113d400860c 100644 --- a/packages/cli/test/unit/util/format.test.ts +++ b/packages/cli/test/unit/util/format.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {isValidatePubkeyHex, parseRange} from "../../../src/util/index.js"; describe("util / format / parseRange", () => { diff --git a/packages/cli/test/unit/util/gitData.test.ts b/packages/cli/test/unit/util/gitData.test.ts index 9e15fc2f4956..fe1827e58df2 100644 --- a/packages/cli/test/unit/util/gitData.test.ts +++ b/packages/cli/test/unit/util/gitData.test.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect} from "vitest"; import {findUpSync} from "find-up"; +import {describe, expect, it} from "vitest"; import {gitDataPath, readGitDataFile} from "../../../src/util/gitData/gitDataPath.js"; import {getGitData} from "../../../src/util/index.js"; diff --git a/packages/cli/test/unit/util/logger.test.ts b/packages/cli/test/unit/util/logger.test.ts index fa17218bfd1c..dba3a72fda6c 100644 --- a/packages/cli/test/unit/util/logger.test.ts +++ b/packages/cli/test/unit/util/logger.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {shouldDeleteLogFile} from "../../../src/util/logger.js"; describe("shouldDeleteLogFile", () => { diff --git a/packages/cli/test/unit/util/parseBootnodesFile.test.ts b/packages/cli/test/unit/util/parseBootnodesFile.test.ts index 07338192bc68..87af3c994fb5 100644 --- a/packages/cli/test/unit/util/parseBootnodesFile.test.ts +++ b/packages/cli/test/unit/util/parseBootnodesFile.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {parseBootnodesFile} from "../../../src/util/index.js"; describe("config / bootnodes / parsing", () => { diff --git a/packages/cli/test/unit/util/progress.test.ts b/packages/cli/test/unit/util/progress.test.ts index d04d959d7422..11f443d35678 100644 --- a/packages/cli/test/unit/util/progress.test.ts +++ b/packages/cli/test/unit/util/progress.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {showProgress} from "../../../src/util/progress.js"; describe("progress", () => { diff --git a/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts b/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts index 76285afff081..a50c59547688 100644 --- a/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts +++ b/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, beforeEach, afterEach} from "vitest"; import {rimraf} from "rimraf"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; import {pruneOldFilesInDir} from "../../../src/util/index.js"; import {testFilesDir} from "../../utils.js"; diff --git a/packages/cli/test/unit/util/stripOffNewlines.test.ts b/packages/cli/test/unit/util/stripOffNewlines.test.ts index 3a5a5a1f3523..0a118a499e34 100644 --- a/packages/cli/test/unit/util/stripOffNewlines.test.ts +++ b/packages/cli/test/unit/util/stripOffNewlines.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {stripOffNewlines} from "../../../src/util/index.js"; describe("stripOffNewlines", () => { diff --git a/packages/cli/test/unit/validator/decryptKeystoreDefinitions.test.ts b/packages/cli/test/unit/validator/decryptKeystoreDefinitions.test.ts index 10f6b34bd152..5bf19c635139 100644 --- a/packages/cli/test/unit/validator/decryptKeystoreDefinitions.test.ts +++ b/packages/cli/test/unit/validator/decryptKeystoreDefinitions.test.ts @@ -1,16 +1,16 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, beforeEach, vi} from "vitest"; -import {rimraf} from "rimraf"; import {getKeystoresStr} from "@lodestar/test-utils"; -import {cachedSeckeysHex} from "../../utils/cachedKeys.js"; -import {testFilesDir} from "../../utils.js"; +import {rimraf} from "rimraf"; +import {beforeEach, describe, expect, it, vi} from "vitest"; import { - decryptKeystoreDefinitions, KeystoreDecryptOptions, + decryptKeystoreDefinitions, } from "../../../src/cmds/validator/keymanager/decryptKeystoreDefinitions.js"; import {LocalKeystoreDefinition} from "../../../src/cmds/validator/keymanager/interface.js"; import {LockfileError, unlockFilepath} from "../../../src/util/lockfile.js"; +import {testFilesDir} from "../../utils.js"; +import {cachedSeckeysHex} from "../../utils/cachedKeys.js"; describe("decryptKeystoreDefinitions", () => { vi.setConfig({testTimeout: 100_000, hookTimeout: 50_000}); diff --git a/packages/cli/test/unit/validator/keys.test.ts b/packages/cli/test/unit/validator/keys.test.ts index 6902d17b3883..589e68db7f0d 100644 --- a/packages/cli/test/unit/validator/keys.test.ts +++ b/packages/cli/test/unit/validator/keys.test.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, afterEach} from "vitest"; +import {afterEach, describe, expect, it} from "vitest"; import {importKeystoreDefinitionsFromExternalDir} from "../../../src/cmds/validator/signers/importExternalKeystores.js"; describe("validator / signers / importKeystoreDefinitionsFromExternalDir", () => { diff --git a/packages/cli/test/unit/validator/options.test.ts b/packages/cli/test/unit/validator/options.test.ts index 627ee8f59818..85aa0b3f21f7 100644 --- a/packages/cli/test/unit/validator/options.test.ts +++ b/packages/cli/test/unit/validator/options.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {parseFeeRecipient} from "../../../src/util/index.js"; const feeRecipient = Buffer.from(Array.from({length: 20}, () => Math.round(Math.random() * 255))); diff --git a/packages/cli/test/unit/validator/parseProposerConfig.test.ts b/packages/cli/test/unit/validator/parseProposerConfig.test.ts index 40fa57f7feb5..f10d5d7cc080 100644 --- a/packages/cli/test/unit/validator/parseProposerConfig.test.ts +++ b/packages/cli/test/unit/validator/parseProposerConfig.test.ts @@ -1,7 +1,7 @@ import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect} from "vitest"; import {routes} from "@lodestar/api"; +import {describe, expect, it} from "vitest"; import {parseProposerConfig} from "../../../src/util/index.js"; diff --git a/packages/cli/test/utils.ts b/packages/cli/test/utils.ts index 81136c0a18d4..7c20ec0b9c2d 100644 --- a/packages/cli/test/utils.ts +++ b/packages/cli/test/utils.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; import path from "node:path"; -import tmp from "tmp"; import {getEnvLogLevel} from "@lodestar/logger/env"; import {LoggerNode, LoggerNodeOpts, getNodeLogger} from "@lodestar/logger/node"; import {LogLevel} from "@lodestar/utils"; +import tmp from "tmp"; export const networkDev = "dev"; diff --git a/packages/cli/test/utils/crucible/assertions/accountBalanceAssertion.ts b/packages/cli/test/utils/crucible/assertions/accountBalanceAssertion.ts index e6c4f4c744eb..e237bba69dcb 100644 --- a/packages/cli/test/utils/crucible/assertions/accountBalanceAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/accountBalanceAssertion.ts @@ -1,5 +1,5 @@ import {EL_GENESIS_ACCOUNT} from "../constants.js"; -import {Match, AssertionResult, NodePair, Assertion} from "../interfaces.js"; +import {Assertion, AssertionResult, Match, NodePair} from "../interfaces.js"; const transactionAmount = BigInt(2441406250); diff --git a/packages/cli/test/utils/crucible/assertions/blobsAssertion.ts b/packages/cli/test/utils/crucible/assertions/blobsAssertion.ts index 50c9ed13f972..9bea3f1ca1f5 100644 --- a/packages/cli/test/utils/crucible/assertions/blobsAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/blobsAssertion.ts @@ -1,7 +1,7 @@ import {randomBytes} from "node:crypto"; import {fromHex, toHex} from "@lodestar/utils"; -import {Assertion, Match, AssertionResult, NodePair} from "../interfaces.js"; import {EL_GENESIS_ACCOUNT, EL_GENESIS_SECRET_KEY, SIM_ENV_CHAIN_ID} from "../constants.js"; +import {Assertion, AssertionResult, Match, NodePair} from "../interfaces.js"; import {generateBlobsForTransaction} from "../utils/blobs.js"; import {BlobsEIP4844Transaction} from "../web3js/blobsEIP4844Transaction.js"; diff --git a/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts index 922ce80ae329..2d0715051fa5 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/attestationCountAssertion.ts @@ -1,6 +1,6 @@ import {MAX_COMMITTEES_PER_SLOT} from "@lodestar/params"; -import {Match, AssertionResult, Assertion} from "../../interfaces.js"; -import {inclusionDelayAssertion, expectedMaxInclusionDelay} from "./inclusionDelayAssertion.js"; +import {Assertion, AssertionResult, Match} from "../../interfaces.js"; +import {expectedMaxInclusionDelay, inclusionDelayAssertion} from "./inclusionDelayAssertion.js"; export const expectedMinAttestationCount = MAX_COMMITTEES_PER_SLOT - 1; diff --git a/packages/cli/test/utils/crucible/assertions/defaults/attestationParticipationAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/attestationParticipationAssertion.ts index 01cd6d29d09a..5715392758f1 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/attestationParticipationAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/attestationParticipationAssertion.ts @@ -1,7 +1,7 @@ import {TIMELY_HEAD_FLAG_INDEX, TIMELY_SOURCE_FLAG_INDEX, TIMELY_TARGET_FLAG_INDEX} from "@lodestar/params"; import {isActiveValidator} from "@lodestar/state-transition"; import {altair} from "@lodestar/types"; -import {Match, AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult, Match} from "../../interfaces.js"; const TIMELY_HEAD = 1 << TIMELY_HEAD_FLAG_INDEX; const TIMELY_SOURCE = 1 << TIMELY_SOURCE_FLAG_INDEX; diff --git a/packages/cli/test/utils/crucible/assertions/defaults/connectedPeerCountAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/connectedPeerCountAssertion.ts index 83f308e62789..5304731ee8fc 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/connectedPeerCountAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/connectedPeerCountAssertion.ts @@ -1,4 +1,4 @@ -import {AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult} from "../../interfaces.js"; import {everySlotMatcher} from "../matchers.js"; export const connectedPeerCountAssertion: Assertion<"connectedPeerCount", number> = { diff --git a/packages/cli/test/utils/crucible/assertions/defaults/finalizedAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/finalizedAssertion.ts index f03fc41eb8e9..89998fd87627 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/finalizedAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/finalizedAssertion.ts @@ -1,5 +1,5 @@ import {Slot} from "@lodestar/types"; -import {AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult} from "../../interfaces.js"; import {everySlotMatcher} from "../matchers.js"; export const finalizedAssertion: Assertion<"finalized", Slot> = { diff --git a/packages/cli/test/utils/crucible/assertions/defaults/headAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/headAssertion.ts index 6464067d5d7d..3a3f910a4489 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/headAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/headAssertion.ts @@ -1,6 +1,6 @@ import {RootHex, Slot} from "@lodestar/types"; import {toHexString} from "@lodestar/utils"; -import {AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult} from "../../interfaces.js"; import {everySlotMatcher} from "../matchers.js"; export interface HeadSummary { diff --git a/packages/cli/test/utils/crucible/assertions/defaults/inclusionDelayAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/inclusionDelayAssertion.ts index e3ec467099ba..f0f08c92f202 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/inclusionDelayAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/inclusionDelayAssertion.ts @@ -1,4 +1,4 @@ -import {AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult} from "../../interfaces.js"; import {avg} from "../../utils/index.js"; import {everySlotMatcher} from "../matchers.js"; diff --git a/packages/cli/test/utils/crucible/assertions/defaults/missedBlocksAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/missedBlocksAssertion.ts index 1209a6469ca3..8c8d96451f5e 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/missedBlocksAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/missedBlocksAssertion.ts @@ -1,5 +1,5 @@ import {isNullish} from "../../../../utils.js"; -import {Match, AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult, Match} from "../../interfaces.js"; import {arrayEquals} from "../../utils/index.js"; import {headAssertion} from "./headAssertion.js"; diff --git a/packages/cli/test/utils/crucible/assertions/defaults/syncCommitteeParticipationAssertion.ts b/packages/cli/test/utils/crucible/assertions/defaults/syncCommitteeParticipationAssertion.ts index 83b945da0b0a..a0d6f8328187 100644 --- a/packages/cli/test/utils/crucible/assertions/defaults/syncCommitteeParticipationAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/defaults/syncCommitteeParticipationAssertion.ts @@ -1,6 +1,6 @@ import {ForkName} from "@lodestar/params"; import {altair} from "@lodestar/types"; -import {Match, AssertionResult, Assertion} from "../../interfaces.js"; +import {Assertion, AssertionResult, Match} from "../../interfaces.js"; import {avg} from "../../utils/index.js"; // Until we identity and fix the following issue, reducing the expected sync committee participation rate from 0.9 to 0.75 diff --git a/packages/cli/test/utils/crucible/assertions/executionHeadAssertion.ts b/packages/cli/test/utils/crucible/assertions/executionHeadAssertion.ts index 8ea0be1b445c..3f6fedd139fd 100644 --- a/packages/cli/test/utils/crucible/assertions/executionHeadAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/executionHeadAssertion.ts @@ -1,6 +1,6 @@ -import {toHex} from "@lodestar/utils"; import {bellatrix} from "@lodestar/types"; -import {Match, AssertionResult, Assertion} from "../interfaces.js"; +import {toHex} from "@lodestar/utils"; +import {Assertion, AssertionResult, Match} from "../interfaces.js"; export function createExecutionHeadAssertion({ checkForSlot, diff --git a/packages/cli/test/utils/crucible/assertions/forkAssertion.ts b/packages/cli/test/utils/crucible/assertions/forkAssertion.ts index 8f6372f856f6..aeddff9ab13c 100644 --- a/packages/cli/test/utils/crucible/assertions/forkAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/forkAssertion.ts @@ -1,7 +1,7 @@ import {ForkName} from "@lodestar/params"; import {Epoch} from "@lodestar/types"; import {toHexString} from "@lodestar/utils"; -import {Match, AssertionResult, Assertion} from "../interfaces.js"; +import {Assertion, AssertionResult, Match} from "../interfaces.js"; export function createForkAssertion(fork: ForkName, epoch: Epoch): Assertion { return { diff --git a/packages/cli/test/utils/crucible/assertions/lighthousePeerScoreAssertion.ts b/packages/cli/test/utils/crucible/assertions/lighthousePeerScoreAssertion.ts index 29fa36220b3d..d9dd4e0adc55 100644 --- a/packages/cli/test/utils/crucible/assertions/lighthousePeerScoreAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/lighthousePeerScoreAssertion.ts @@ -1,4 +1,4 @@ -import {AssertionResult, BeaconClient, LighthouseAPI, NodePair, Assertion} from "../interfaces.js"; +import {Assertion, AssertionResult, BeaconClient, LighthouseAPI, NodePair} from "../interfaces.js"; import {neverMatcher} from "./matchers.js"; const MIN_GOSSIPSUB_SCORE = 10; diff --git a/packages/cli/test/utils/crucible/assertions/mergeAssertion.ts b/packages/cli/test/utils/crucible/assertions/mergeAssertion.ts index acd686c87bf7..6e0c1a63d7af 100644 --- a/packages/cli/test/utils/crucible/assertions/mergeAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/mergeAssertion.ts @@ -1,5 +1,5 @@ import {BeaconStateAllForks, isExecutionStateType, isMergeTransitionComplete} from "@lodestar/state-transition"; -import {AssertionResult, Assertion} from "../interfaces.js"; +import {Assertion, AssertionResult} from "../interfaces.js"; import {neverMatcher} from "./matchers.js"; export const mergeAssertion: Assertion<"merge", string> = { diff --git a/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts b/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts index 04c9b393d245..6b94f2e701a9 100644 --- a/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts @@ -1,7 +1,7 @@ import {SecretKey} from "@chainsafe/blst"; import {routes} from "@lodestar/api/beacon"; import {toHex} from "@lodestar/utils"; -import {AssertionResult, ValidatorClientKeys, Assertion, ValidatorClient} from "../interfaces.js"; +import {Assertion, AssertionResult, ValidatorClient, ValidatorClientKeys} from "../interfaces.js"; import {arrayEquals} from "../utils/index.js"; import {neverMatcher} from "./matchers.js"; diff --git a/packages/cli/test/utils/crucible/assertions/withdrawalsAssertion.ts b/packages/cli/test/utils/crucible/assertions/withdrawalsAssertion.ts index be256a0b696d..020684682858 100644 --- a/packages/cli/test/utils/crucible/assertions/withdrawalsAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/withdrawalsAssertion.ts @@ -1,6 +1,6 @@ -import {capella} from "@lodestar/types"; import {MAX_WITHDRAWALS_PER_PAYLOAD} from "@lodestar/params"; -import {Match, AssertionResult, Assertion} from "../interfaces.js"; +import {capella} from "@lodestar/types"; +import {Assertion, AssertionResult, Match} from "../interfaces.js"; type WithdrawalsData = { withdrawalCount: number; diff --git a/packages/cli/test/utils/crucible/clients/beacon/lighthouse.ts b/packages/cli/test/utils/crucible/clients/beacon/lighthouse.ts index 515418f7e558..725c08389105 100644 --- a/packages/cli/test/utils/crucible/clients/beacon/lighthouse.ts +++ b/packages/cli/test/utils/crucible/clients/beacon/lighthouse.ts @@ -1,9 +1,9 @@ import {writeFile} from "node:fs/promises"; import path from "node:path"; -import got, {RequestError} from "got"; -import yaml from "js-yaml"; import {getClient} from "@lodestar/api/beacon"; import {chainConfigToJson} from "@lodestar/config"; +import got, {RequestError} from "got"; +import yaml from "js-yaml"; import {BeaconClient, BeaconNodeGenerator, LighthouseAPI, RunnerType} from "../../interfaces.js"; import {getNodeMountedPaths} from "../../utils/paths.js"; import {getNodePorts} from "../../utils/ports.js"; diff --git a/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts b/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts index 2bc7c27ead41..320b9c1fd224 100644 --- a/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts +++ b/packages/cli/test/utils/crucible/clients/beacon/lodestar.ts @@ -1,9 +1,9 @@ import {writeFile} from "node:fs/promises"; import path from "node:path"; -import got from "got"; import {getClient} from "@lodestar/api/beacon"; import {chainConfigToJson} from "@lodestar/config"; import {LogLevel} from "@lodestar/utils"; +import got from "got"; import {BeaconArgs} from "../../../../../src/cmds/beacon/options.js"; import {GlobalArgs} from "../../../../../src/options/globalOptions.js"; import {LODESTAR_BINARY_PATH} from "../../constants.js"; diff --git a/packages/cli/test/utils/crucible/clients/execution/geth.ts b/packages/cli/test/utils/crucible/clients/execution/geth.ts index ca3dee2dcb86..4daa008f0c54 100644 --- a/packages/cli/test/utils/crucible/clients/execution/geth.ts +++ b/packages/cli/test/utils/crucible/clients/execution/geth.ts @@ -9,10 +9,10 @@ import { SHARED_JWT_SECRET, SIM_ENV_NETWORK_ID, } from "../../constants.js"; -import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js"; import {ExecutionClient, ExecutionNodeGenerator, ExecutionStartMode, JobOptions, RunnerType} from "../../interfaces.js"; import {getNodeMountedPaths} from "../../utils/paths.js"; import {getNodePorts} from "../../utils/ports.js"; +import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js"; export const generateGethNode: ExecutionNodeGenerator = (opts, runner) => { if (!process.env.GETH_BINARY_DIR && !process.env.GETH_DOCKER_IMAGE) { diff --git a/packages/cli/test/utils/crucible/clients/execution/index.ts b/packages/cli/test/utils/crucible/clients/execution/index.ts index db6510a7a7d6..b7e83813ce3d 100644 --- a/packages/cli/test/utils/crucible/clients/execution/index.ts +++ b/packages/cli/test/utils/crucible/clients/execution/index.ts @@ -1,5 +1,5 @@ import {writeFile} from "node:fs/promises"; -import {SHARED_JWT_SECRET, CLIQUE_SEALING_PERIOD} from "../../constants.js"; +import {CLIQUE_SEALING_PERIOD, SHARED_JWT_SECRET} from "../../constants.js"; import { AtLeast, ExecutionClient, @@ -8,8 +8,8 @@ import { ExecutionNode, ExecutionStartMode, } from "../../interfaces.js"; -import {getEstimatedForkTime} from "../../utils/index.js"; import {getGethGenesisBlock} from "../../utils/executionGenesis.js"; +import {getEstimatedForkTime} from "../../utils/index.js"; import {ensureDirectories} from "../../utils/paths.js"; import {generateGethNode} from "./geth.js"; import {generateMockNode} from "./mock.js"; diff --git a/packages/cli/test/utils/crucible/clients/execution/nethermind.ts b/packages/cli/test/utils/crucible/clients/execution/nethermind.ts index 1c991afa6189..a59f7e55ece6 100644 --- a/packages/cli/test/utils/crucible/clients/execution/nethermind.ts +++ b/packages/cli/test/utils/crucible/clients/execution/nethermind.ts @@ -2,12 +2,12 @@ import {writeFile} from "node:fs/promises"; import path from "node:path"; import got from "got"; import {Web3} from "web3"; -import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js"; +import {SHARED_JWT_SECRET} from "../../constants.js"; import {ExecutionClient, ExecutionNodeGenerator, JobOptions, RunnerType} from "../../interfaces.js"; import {getNethermindChainSpec} from "../../utils/executionGenesis.js"; import {getNodeMountedPaths} from "../../utils/paths.js"; -import {SHARED_JWT_SECRET} from "../../constants.js"; import {getNodePorts} from "../../utils/ports.js"; +import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js"; export const generateNethermindNode: ExecutionNodeGenerator = (opts, runner) => { if (!process.env.NETHERMIND_DOCKER_IMAGE) { diff --git a/packages/cli/test/utils/crucible/clients/validator/index.ts b/packages/cli/test/utils/crucible/clients/validator/index.ts index 677deca23ff0..74f9734c767a 100644 --- a/packages/cli/test/utils/crucible/clients/validator/index.ts +++ b/packages/cli/test/utils/crucible/clients/validator/index.ts @@ -1,11 +1,11 @@ import {writeFile} from "node:fs/promises"; -import {SHARED_JWT_SECRET, SHARED_VALIDATOR_PASSWORD, BN_REST_BASE_PORT} from "../../constants.js"; +import {BN_REST_BASE_PORT, SHARED_JWT_SECRET, SHARED_VALIDATOR_PASSWORD} from "../../constants.js"; import {AtLeast, BeaconClient, ValidatorClient, ValidatorGeneratorOptions, ValidatorNode} from "../../interfaces.js"; import {makeUniqueArray} from "../../utils/index.js"; import {createKeystores} from "../../utils/keys.js"; import {ensureDirectories} from "../../utils/paths.js"; -import {generateLodestarValidatorNode} from "./lodestar.js"; import {generateLighthouseValidatorNode} from "./lighthouse.js"; +import {generateLodestarValidatorNode} from "./lodestar.js"; export async function createValidatorNode( client: V, diff --git a/packages/cli/test/utils/crucible/clients/validator/lighthouse.ts b/packages/cli/test/utils/crucible/clients/validator/lighthouse.ts index f99310dc7907..a5f137a861d5 100644 --- a/packages/cli/test/utils/crucible/clients/validator/lighthouse.ts +++ b/packages/cli/test/utils/crucible/clients/validator/lighthouse.ts @@ -1,9 +1,9 @@ -import path from "node:path"; import {writeFile} from "node:fs/promises"; -import got, {RequestError} from "got"; -import yaml from "js-yaml"; +import path from "node:path"; import {getClient as keyManagerGetClient} from "@lodestar/api/keymanager"; import {chainConfigToJson} from "@lodestar/config"; +import got, {RequestError} from "got"; +import yaml from "js-yaml"; import {RunnerType, ValidatorClient, ValidatorNodeGenerator} from "../../interfaces.js"; import {updateKeystoresPath} from "../../utils/keys.js"; import {getNodeMountedPaths} from "../../utils/paths.js"; diff --git a/packages/cli/test/utils/crucible/clients/validator/lodestar.ts b/packages/cli/test/utils/crucible/clients/validator/lodestar.ts index a2b928c0a2d5..4e2e88b71cc5 100644 --- a/packages/cli/test/utils/crucible/clients/validator/lodestar.ts +++ b/packages/cli/test/utils/crucible/clients/validator/lodestar.ts @@ -1,10 +1,10 @@ import {writeFile} from "node:fs/promises"; import path from "node:path"; -import got from "got"; import {getClient as keyManagerGetClient} from "@lodestar/api/keymanager"; import {chainConfigToJson} from "@lodestar/config"; import {LogLevel} from "@lodestar/utils"; import {defaultOptions} from "@lodestar/validator"; +import got from "got"; import {IValidatorCliArgs} from "../../../../../src/cmds/validator/options.js"; import {GlobalArgs} from "../../../../../src/options/globalOptions.js"; import {LODESTAR_BINARY_PATH} from "../../constants.js"; diff --git a/packages/cli/test/utils/crucible/externalSignerServer.ts b/packages/cli/test/utils/crucible/externalSignerServer.ts index 4282f1761db9..29789432a0d5 100644 --- a/packages/cli/test/utils/crucible/externalSignerServer.ts +++ b/packages/cli/test/utils/crucible/externalSignerServer.ts @@ -1,6 +1,6 @@ -import {fromHexString} from "@chainsafe/ssz"; -import {fastify, FastifyInstance} from "fastify"; import {SecretKey} from "@chainsafe/blst"; +import {fromHexString} from "@chainsafe/ssz"; +import {FastifyInstance, fastify} from "fastify"; import {EXTERNAL_SIGNER_BASE_PORT} from "./constants.js"; /* eslint-disable no-console */ diff --git a/packages/cli/test/utils/crucible/interfaces.ts b/packages/cli/test/utils/crucible/interfaces.ts index 84b5043ba983..13c56dd5012b 100644 --- a/packages/cli/test/utils/crucible/interfaces.ts +++ b/packages/cli/test/utils/crucible/interfaces.ts @@ -1,12 +1,12 @@ import {ChildProcess} from "node:child_process"; -import {Web3} from "web3"; import {SecretKey} from "@chainsafe/blst"; import {ApiClient} from "@lodestar/api"; import {ApiClient as KeyManagerApi} from "@lodestar/api/keymanager"; import {ChainForkConfig} from "@lodestar/config"; -import {ForkName} from "@lodestar/params"; -import {Slot, Epoch, SignedBeaconBlock} from "@lodestar/types"; import {LogLevel, Logger} from "@lodestar/logger"; +import {ForkName} from "@lodestar/params"; +import {Epoch, SignedBeaconBlock, Slot} from "@lodestar/types"; +import {Web3} from "web3"; import {BeaconArgs} from "../../../src/cmds/beacon/options.js"; import {IValidatorCliArgs} from "../../../src/cmds/validator/options.js"; import {GlobalArgs} from "../../../src/options/index.js"; diff --git a/packages/cli/test/utils/crucible/runner/childProcessRunner.ts b/packages/cli/test/utils/crucible/runner/childProcessRunner.ts index 4c2041d0860f..199d815cc8c3 100644 --- a/packages/cli/test/utils/crucible/runner/childProcessRunner.ts +++ b/packages/cli/test/utils/crucible/runner/childProcessRunner.ts @@ -1,6 +1,6 @@ import {ChildProcess} from "node:child_process"; -import {spawnChildProcess, stopChildProcess, SpawnChildProcessOptions, ChildProcessResolve} from "@lodestar/test-utils"; import {Logger} from "@lodestar/logger"; +import {ChildProcessResolve, SpawnChildProcessOptions, spawnChildProcess, stopChildProcess} from "@lodestar/test-utils"; import {Job, JobOptions, RunnerEnv, RunnerType} from "../interfaces.js"; export class ChildProcessRunner implements RunnerEnv { diff --git a/packages/cli/test/utils/crucible/runner/dockerRunner.ts b/packages/cli/test/utils/crucible/runner/dockerRunner.ts index bc5b97811cf4..33adb5aebbe0 100644 --- a/packages/cli/test/utils/crucible/runner/dockerRunner.ts +++ b/packages/cli/test/utils/crucible/runner/dockerRunner.ts @@ -1,7 +1,7 @@ import {ChildProcess} from "node:child_process"; import {Logger} from "@lodestar/logger"; +import {ChildProcessResolve, SpawnChildProcessOptions, execChildProcess, spawnChildProcess} from "@lodestar/test-utils"; import {sleep} from "@lodestar/utils"; -import {SpawnChildProcessOptions, execChildProcess, spawnChildProcess, ChildProcessResolve} from "@lodestar/test-utils"; import {Job, JobOptions, RunnerEnv, RunnerType} from "../interfaces.js"; const dockerNetworkIpRange = "192.168.0"; diff --git a/packages/cli/test/utils/crucible/simulation.ts b/packages/cli/test/utils/crucible/simulation.ts index c6e58095474a..e9674e5193e2 100644 --- a/packages/cli/test/utils/crucible/simulation.ts +++ b/packages/cli/test/utils/crucible/simulation.ts @@ -1,36 +1,36 @@ import fs from "node:fs"; import {mkdir, writeFile} from "node:fs/promises"; import path from "node:path"; -import tmp from "tmp"; import {fromHexString} from "@chainsafe/ssz"; import {nodeUtils} from "@lodestar/beacon-node"; -import {loadEthereumTrustedSetup, initCKZG} from "@lodestar/beacon-node/util"; +import {initCKZG, loadEthereumTrustedSetup} from "@lodestar/beacon-node/util"; import {ChainForkConfig} from "@lodestar/config"; +import {LogLevel, TimestampFormatCode} from "@lodestar/logger"; +import {LoggerNode, getNodeLogger} from "@lodestar/logger/node"; import {activePreset} from "@lodestar/params"; import {BeaconStateAllForks, interopSecretKey} from "@lodestar/state-transition"; import {prettyMsToTime} from "@lodestar/utils"; -import {LogLevel, TimestampFormatCode} from "@lodestar/logger"; -import {getNodeLogger, LoggerNode} from "@lodestar/logger/node"; -import {EpochClock, MS_IN_SEC} from "./epochClock.js"; -import {ExternalSignerServer} from "./externalSignerServer.js"; -import {SimulationTracker} from "./simulationTracker.js"; +import tmp from "tmp"; import {createBeaconNode} from "./clients/beacon/index.js"; +import {createExecutionNode} from "./clients/execution/index.js"; import {createValidatorNode, getValidatorForBeaconNode} from "./clients/validator/index.js"; import {MOCK_ETH1_GENESIS_HASH} from "./constants.js"; -import {createExecutionNode} from "./clients/execution/index.js"; +import {EpochClock, MS_IN_SEC} from "./epochClock.js"; +import {ExternalSignerServer} from "./externalSignerServer.js"; import { BeaconClient, - ValidatorClientKeys, ExecutionClient, + GeneratorOptions, IRunner, NodePair, NodePairDefinition, SimulationInitOptions, SimulationOptions, ValidatorClient, - GeneratorOptions, + ValidatorClientKeys, } from "./interfaces.js"; import {Runner} from "./runner/index.js"; +import {SimulationTracker} from "./simulationTracker.js"; import {registerProcessHandler, replaceIpFromUrl} from "./utils/index.js"; import {getNodePaths} from "./utils/paths.js"; diff --git a/packages/cli/test/utils/crucible/simulationTracker.ts b/packages/cli/test/utils/crucible/simulationTracker.ts index 778a7ad2a771..3e714ca8950f 100644 --- a/packages/cli/test/utils/crucible/simulationTracker.ts +++ b/packages/cli/test/utils/crucible/simulationTracker.ts @@ -1,25 +1,25 @@ import EventEmitter from "node:events"; -import path from "node:path"; import fs from "node:fs/promises"; -import createDebug from "debug"; +import path from "node:path"; import {routes} from "@lodestar/api/beacon"; import {ChainForkConfig} from "@lodestar/config"; -import {Epoch, Slot} from "@lodestar/types"; import {LoggerNode} from "@lodestar/logger/node"; +import {Epoch, Slot} from "@lodestar/types"; +import createDebug from "debug"; import {isNullish} from "../../utils.js"; +import {defaultAssertions} from "./assertions/defaults/index.js"; import {EpochClock} from "./epochClock.js"; import { - Match, + Assertion, + AssertionError, AtLeast, + Match, NodeId, NodePair, - Assertion, - AssertionError, SimulationReporter, StoreType, StoreTypes, } from "./interfaces.js"; -import {defaultAssertions} from "./assertions/defaults/index.js"; import {TableReporter} from "./tableReporter.js"; import {fetchBlock} from "./utils/network.js"; diff --git a/packages/cli/test/utils/crucible/utils/executionGenesis.ts b/packages/cli/test/utils/crucible/utils/executionGenesis.ts index bd3da4ba7662..02f7d553df16 100644 --- a/packages/cli/test/utils/crucible/utils/executionGenesis.ts +++ b/packages/cli/test/utils/crucible/utils/executionGenesis.ts @@ -1,5 +1,5 @@ import {SIM_ENV_CHAIN_ID, SIM_ENV_NETWORK_ID} from "../constants.js"; -import {ExecutionGenesisOptions, ExecutionStartMode, Eth1GenesisBlock} from "../interfaces.js"; +import {Eth1GenesisBlock, ExecutionGenesisOptions, ExecutionStartMode} from "../interfaces.js"; export const getGethGenesisBlock = ( mode: ExecutionStartMode, diff --git a/packages/cli/test/utils/crucible/utils/index.ts b/packages/cli/test/utils/crucible/utils/index.ts index 0e016778cdce..13b26cfd9318 100644 --- a/packages/cli/test/utils/crucible/utils/index.ts +++ b/packages/cli/test/utils/crucible/utils/index.ts @@ -1,7 +1,7 @@ +import {ChainConfig, ChainForkConfig, createChainForkConfig} from "@lodestar/config"; /* eslint-disable no-console */ import {activePreset} from "@lodestar/params"; import {Epoch} from "@lodestar/types"; -import {ChainConfig, ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import { CLIQUE_SEALING_PERIOD, ETH_TTD_INCREMENT, diff --git a/packages/cli/test/utils/crucible/utils/keys.ts b/packages/cli/test/utils/crucible/utils/keys.ts index 8915e85b529e..1a4da9ffec65 100644 --- a/packages/cli/test/utils/crucible/utils/keys.ts +++ b/packages/cli/test/utils/crucible/utils/keys.ts @@ -1,7 +1,7 @@ import {readFile, writeFile} from "node:fs/promises"; import path from "node:path"; -import yaml from "js-yaml"; import {Keystore} from "@chainsafe/bls-keystore"; +import yaml from "js-yaml"; import {SHARED_VALIDATOR_PASSWORD} from "../constants.js"; import {ValidatorClientKeys, ValidatorPaths} from "../interfaces.js"; diff --git a/packages/cli/test/utils/crucible/utils/paths.ts b/packages/cli/test/utils/crucible/utils/paths.ts index 4ff149d6f308..06ef1bf7fe1f 100644 --- a/packages/cli/test/utils/crucible/utils/paths.ts +++ b/packages/cli/test/utils/crucible/utils/paths.ts @@ -1,6 +1,6 @@ -import path from "node:path"; import fs from "node:fs"; import {mkdir} from "node:fs/promises"; +import path from "node:path"; import { BeaconClient, BeaconPaths, diff --git a/packages/cli/test/utils/crucible/utils/ports.ts b/packages/cli/test/utils/crucible/utils/ports.ts index be430598895e..3b6f51ad1429 100644 --- a/packages/cli/test/utils/crucible/utils/ports.ts +++ b/packages/cli/test/utils/crucible/utils/ports.ts @@ -1,10 +1,10 @@ import { BN_P2P_BASE_PORT, BN_REST_BASE_PORT, - KEY_MANAGER_BASE_PORT, - EL_P2P_BASE_PORT, - EL_ETH_BASE_PORT, EL_ENGINE_BASE_PORT, + EL_ETH_BASE_PORT, + EL_P2P_BASE_PORT, + KEY_MANAGER_BASE_PORT, } from "../constants.js"; export const getNodePorts = ( diff --git a/packages/cli/test/utils/crucible/utils/syncing.ts b/packages/cli/test/utils/crucible/utils/syncing.ts index b720c6bf6ccc..e0232ae7b5ba 100644 --- a/packages/cli/test/utils/crucible/utils/syncing.ts +++ b/packages/cli/test/utils/crucible/utils/syncing.ts @@ -1,9 +1,9 @@ import {routes} from "@lodestar/api"; +import {ForkBlobs} from "@lodestar/params"; import {SignedBeaconBlock, Slot} from "@lodestar/types"; import {sleep, toHex} from "@lodestar/utils"; -import {ForkBlobs} from "@lodestar/params"; -import type {Simulation} from "../simulation.js"; import {BeaconClient, ExecutionClient, NodePair} from "../interfaces.js"; +import type {Simulation} from "../simulation.js"; import {connectNewCLNode, connectNewELNode, connectNewNode, waitForHead, waitForSlot} from "./network.js"; export async function assertRangeSync(env: Simulation): Promise { diff --git a/packages/cli/test/utils/crucible/web3js/blobsEIP4844Transaction.ts b/packages/cli/test/utils/crucible/web3js/blobsEIP4844Transaction.ts index a5dbf9408b7d..b61814e6ae1e 100644 --- a/packages/cli/test/utils/crucible/web3js/blobsEIP4844Transaction.ts +++ b/packages/cli/test/utils/crucible/web3js/blobsEIP4844Transaction.ts @@ -1,4 +1,5 @@ import {RLP} from "@ethereumjs/rlp"; +import {fromHex} from "@lodestar/utils"; import {keccak256} from "ethereum-cryptography/keccak.js"; import { FeeMarketEIP1559Transaction, @@ -7,7 +8,6 @@ import { bigIntToUnpaddedUint8Array, uint8ArrayToBigInt, } from "web3-eth-accounts"; -import {fromHex} from "@lodestar/utils"; function uint8ArrayConcat(...arrays: Uint8Array[]): Uint8Array { const totalLength = arrays.reduce((acc, arr) => acc + arr.length, 0); diff --git a/packages/cli/test/utils/mockBeaconApiServer.ts b/packages/cli/test/utils/mockBeaconApiServer.ts index e7e80338686f..24b8b9c7473b 100644 --- a/packages/cli/test/utils/mockBeaconApiServer.ts +++ b/packages/cli/test/utils/mockBeaconApiServer.ts @@ -1,6 +1,6 @@ -import {RestApiServer, RestApiServerOpts, RestApiServerModules} from "@lodestar/beacon-node"; -import {BeaconApiMethods, registerRoutes} from "@lodestar/api/beacon/server"; import {allNamespaces} from "@lodestar/api"; +import {BeaconApiMethods, registerRoutes} from "@lodestar/api/beacon/server"; +import {RestApiServer, RestApiServerModules, RestApiServerOpts} from "@lodestar/beacon-node"; import {ChainForkConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; diff --git a/packages/cli/test/utils/validator.ts b/packages/cli/test/utils/validator.ts index 139683d5dd6b..fbecf6900d28 100644 --- a/packages/cli/test/utils/validator.ts +++ b/packages/cli/test/utils/validator.ts @@ -1,8 +1,8 @@ import childProcess from "node:child_process"; -import {retry} from "@lodestar/utils"; import {ApiClient, getClient} from "@lodestar/api/keymanager"; import {config} from "@lodestar/config/default"; -import {spawnCliCommand, gracefullyStopChildProcess} from "@lodestar/test-utils"; +import {gracefullyStopChildProcess, spawnCliCommand} from "@lodestar/test-utils"; +import {retry} from "@lodestar/utils"; import {getMockBeaconApiServer} from "./mockBeaconApiServer.js"; import {expectDeepEqualsUnordered, findApiToken} from "./runUtils.js"; diff --git a/packages/config/src/beaconConfig.ts b/packages/config/src/beaconConfig.ts index 634bdc8b5047..7c84dbaeeb8d 100644 --- a/packages/config/src/beaconConfig.ts +++ b/packages/config/src/beaconConfig.ts @@ -1,6 +1,6 @@ import {Root} from "@lodestar/types"; -import {createChainConfig, ChainConfig} from "./chainConfig/index.js"; -import {createForkConfig, ForkConfig} from "./forkConfig/index.js"; +import {ChainConfig, createChainConfig} from "./chainConfig/index.js"; +import {ForkConfig, createForkConfig} from "./forkConfig/index.js"; import {createCachedGenesis} from "./genesisConfig/index.js"; import {CachedGenesis} from "./genesisConfig/types.js"; diff --git a/packages/config/src/chainConfig/configs/mainnet.ts b/packages/config/src/chainConfig/configs/mainnet.ts index 5da5f8d2acb0..4a01d9d062b1 100644 --- a/packages/config/src/chainConfig/configs/mainnet.ts +++ b/packages/config/src/chainConfig/configs/mainnet.ts @@ -1,5 +1,5 @@ -import {fromHex as b} from "@lodestar/utils"; import {PresetName} from "@lodestar/params"; +import {fromHex as b} from "@lodestar/utils"; import {ChainConfig} from "../types.js"; // Mainnet config diff --git a/packages/config/src/chainConfig/configs/minimal.ts b/packages/config/src/chainConfig/configs/minimal.ts index f1a52e956f4d..f0e116a553ab 100644 --- a/packages/config/src/chainConfig/configs/minimal.ts +++ b/packages/config/src/chainConfig/configs/minimal.ts @@ -1,5 +1,5 @@ -import {fromHex as b} from "@lodestar/utils"; import {PresetName} from "@lodestar/params"; +import {fromHex as b} from "@lodestar/utils"; import {ChainConfig} from "../types.js"; // Minimal config diff --git a/packages/config/src/chainConfig/default.ts b/packages/config/src/chainConfig/default.ts index ef2b9743a1d2..8f8acc37a9f3 100644 --- a/packages/config/src/chainConfig/default.ts +++ b/packages/config/src/chainConfig/default.ts @@ -1,7 +1,7 @@ import {ACTIVE_PRESET, PresetName} from "@lodestar/params"; -import {ChainConfig} from "./types.js"; import {chainConfig as mainnet} from "./configs/mainnet.js"; import {chainConfig as minimal} from "./configs/minimal.js"; +import {ChainConfig} from "./types.js"; let defaultChainConfig: ChainConfig; diff --git a/packages/config/src/chainConfig/index.ts b/packages/config/src/chainConfig/index.ts index b202021b0337..cd7d2d9c29f0 100644 --- a/packages/config/src/chainConfig/index.ts +++ b/packages/config/src/chainConfig/index.ts @@ -1,6 +1,6 @@ import {ACTIVE_PRESET} from "@lodestar/params"; -import {ChainConfig} from "./types.js"; import {defaultChainConfig} from "./default.js"; +import {ChainConfig} from "./types.js"; export {chainConfigToJson, chainConfigFromJson, specValuesToJson} from "./json.js"; export * from "./types.js"; diff --git a/packages/config/src/chainConfig/json.ts b/packages/config/src/chainConfig/json.ts index 78db9230c836..de5214d96416 100644 --- a/packages/config/src/chainConfig/json.ts +++ b/packages/config/src/chainConfig/json.ts @@ -1,5 +1,5 @@ import {fromHex, toHex} from "@lodestar/utils"; -import {ChainConfig, chainConfigTypes, SpecValue, SpecValueTypeName} from "./types.js"; +import {ChainConfig, SpecValue, SpecValueTypeName, chainConfigTypes} from "./types.js"; const MAX_UINT64_JSON = "18446744073709551615"; diff --git a/packages/config/src/chainConfig/networks/ephemery.ts b/packages/config/src/chainConfig/networks/ephemery.ts index d1c17c36f0ab..f6349afe1e9a 100644 --- a/packages/config/src/chainConfig/networks/ephemery.ts +++ b/packages/config/src/chainConfig/networks/ephemery.ts @@ -1,6 +1,6 @@ import {fromHex as b} from "@lodestar/utils"; -import {ChainConfig} from "../types.js"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; // Ephemery dynamic beacon chain config: // https://github.com/ephemery-testnet/ephemery-genesis/blob/master/cl-config.yaml diff --git a/packages/config/src/chainConfig/networks/gnosis.ts b/packages/config/src/chainConfig/networks/gnosis.ts index a25162ae5028..a3b2679bd080 100644 --- a/packages/config/src/chainConfig/networks/gnosis.ts +++ b/packages/config/src/chainConfig/networks/gnosis.ts @@ -1,7 +1,7 @@ -import {fromHex as b} from "@lodestar/utils"; import {PresetName} from "@lodestar/params"; -import {ChainConfig} from "../types.js"; +import {fromHex as b} from "@lodestar/utils"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; // Gnosis beacon chain config: // https://github.com/gnosischain/configs/blob/main/mainnet/config.yaml diff --git a/packages/config/src/chainConfig/networks/holesky.ts b/packages/config/src/chainConfig/networks/holesky.ts index 46c32606931f..18f356d6bc03 100644 --- a/packages/config/src/chainConfig/networks/holesky.ts +++ b/packages/config/src/chainConfig/networks/holesky.ts @@ -1,6 +1,6 @@ import {fromHex as b} from "@lodestar/utils"; -import {ChainConfig} from "../types.js"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; // Holesky beacon chain config: // https://github.com/eth-clients/holesky/blob/main/metadata/config.yaml diff --git a/packages/config/src/chainConfig/networks/mainnet.ts b/packages/config/src/chainConfig/networks/mainnet.ts index 13225b463da9..d10e3209243b 100644 --- a/packages/config/src/chainConfig/networks/mainnet.ts +++ b/packages/config/src/chainConfig/networks/mainnet.ts @@ -1,6 +1,6 @@ import {fromHex as b} from "@lodestar/utils"; -import {ChainConfig} from "../types.js"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; export const mainnetChainConfig: ChainConfig = { ...mainnet, diff --git a/packages/config/src/chainConfig/networks/mekong.ts b/packages/config/src/chainConfig/networks/mekong.ts index d7f2d15cb525..191d801e22b2 100644 --- a/packages/config/src/chainConfig/networks/mekong.ts +++ b/packages/config/src/chainConfig/networks/mekong.ts @@ -1,6 +1,6 @@ import {fromHex as b} from "@lodestar/utils"; -import {ChainConfig} from "../types.js"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; // Mekong beacon chain config: // https://github.com/ethpandaops/mekong-devnets/blob/master/network-configs/devnet-0/metadata/config.yaml diff --git a/packages/config/src/chainConfig/networks/sepolia.ts b/packages/config/src/chainConfig/networks/sepolia.ts index e7e5dc76f691..f47d73436702 100644 --- a/packages/config/src/chainConfig/networks/sepolia.ts +++ b/packages/config/src/chainConfig/networks/sepolia.ts @@ -1,6 +1,6 @@ import {fromHex as b} from "@lodestar/utils"; -import {ChainConfig} from "../types.js"; import {chainConfig as mainnet} from "../configs/mainnet.js"; +import {ChainConfig} from "../types.js"; // Sepolia beacon chain config: // https://github.com/eth-clients/sepolia/blob/main/metadata/config.yaml diff --git a/packages/config/src/forkConfig/index.ts b/packages/config/src/forkConfig/index.ts index 513cd7559ee3..725e0a3af572 100644 --- a/packages/config/src/forkConfig/index.ts +++ b/packages/config/src/forkConfig/index.ts @@ -1,17 +1,17 @@ import { - GENESIS_EPOCH, + ForkAll, + ForkBlobs, + ForkExecution, + ForkLightClient, ForkName, - SLOTS_PER_EPOCH, ForkSeq, - isForkLightClient, - isForkExecution, + GENESIS_EPOCH, + SLOTS_PER_EPOCH, isForkBlobs, - ForkExecution, - ForkAll, - ForkLightClient, - ForkBlobs, + isForkExecution, + isForkLightClient, } from "@lodestar/params"; -import {Slot, Version, SSZTypesFor, sszTypesFor, Epoch} from "@lodestar/types"; +import {Epoch, SSZTypesFor, Slot, Version, sszTypesFor} from "@lodestar/types"; import {ChainConfig} from "../chainConfig/index.js"; import {ForkConfig, ForkInfo} from "./types.js"; diff --git a/packages/config/src/genesisConfig/index.ts b/packages/config/src/genesisConfig/index.ts index d2dfae2a8e08..dad79df1a98d 100644 --- a/packages/config/src/genesisConfig/index.ts +++ b/packages/config/src/genesisConfig/index.ts @@ -1,8 +1,8 @@ -import {ForkName, SLOTS_PER_EPOCH, DOMAIN_VOLUNTARY_EXIT} from "@lodestar/params"; -import {DomainType, ForkDigest, phase0, Root, Slot, ssz, Version} from "@lodestar/types"; +import {DOMAIN_VOLUNTARY_EXIT, ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {DomainType, ForkDigest, Root, Slot, Version, phase0, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {ChainForkConfig} from "../beaconConfig.js"; -import {ForkDigestHex, CachedGenesis} from "./types.js"; +import {CachedGenesis, ForkDigestHex} from "./types.js"; export type {ForkDigestContext} from "./types.js"; export function createCachedGenesis(chainForkConfig: ChainForkConfig, genesisValidatorsRoot: Root): CachedGenesis { diff --git a/packages/config/src/networks.ts b/packages/config/src/networks.ts index df39ae15d09e..5e377e86a974 100644 --- a/packages/config/src/networks.ts +++ b/packages/config/src/networks.ts @@ -1,11 +1,11 @@ import {ChainConfig} from "./chainConfig/index.js"; -import {mainnetChainConfig} from "./chainConfig/networks/mainnet.js"; -import {gnosisChainConfig} from "./chainConfig/networks/gnosis.js"; -import {sepoliaChainConfig} from "./chainConfig/networks/sepolia.js"; -import {holeskyChainConfig} from "./chainConfig/networks/holesky.js"; import {chiadoChainConfig} from "./chainConfig/networks/chiado.js"; import {ephemeryChainConfig} from "./chainConfig/networks/ephemery.js"; +import {gnosisChainConfig} from "./chainConfig/networks/gnosis.js"; +import {holeskyChainConfig} from "./chainConfig/networks/holesky.js"; +import {mainnetChainConfig} from "./chainConfig/networks/mainnet.js"; import {mekongChainConfig} from "./chainConfig/networks/mekong.js"; +import {sepoliaChainConfig} from "./chainConfig/networks/sepolia.js"; export { mainnetChainConfig, diff --git a/packages/config/test/unit/index.test.ts b/packages/config/test/unit/index.test.ts index bde31f6b1477..9c6e94978504 100644 --- a/packages/config/test/unit/index.test.ts +++ b/packages/config/test/unit/index.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {toHexString} from "@chainsafe/ssz"; import {ForkName} from "@lodestar/params"; -import {config, chainConfig} from "../../src/default.js"; +import {describe, expect, it} from "vitest"; +import {chainConfig, config} from "../../src/default.js"; import {createForkConfig} from "../../src/index.js"; describe("forks", () => { diff --git a/packages/config/test/unit/json.test.ts b/packages/config/test/unit/json.test.ts index 96ffd050a088..970a40048540 100644 --- a/packages/config/test/unit/json.test.ts +++ b/packages/config/test/unit/json.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {chainConfigFromJson, chainConfigToJson} from "../../src/index.js"; +import {describe, expect, it} from "vitest"; import {chainConfig} from "../../src/default.js"; +import {chainConfigFromJson, chainConfigToJson} from "../../src/index.js"; describe("chainConfig JSON", () => { it("Convert to and from JSON", () => { diff --git a/packages/db/src/controller/level.ts b/packages/db/src/controller/level.ts index 82fbf631f7ae..ac3688a161ab 100644 --- a/packages/db/src/controller/level.ts +++ b/packages/db/src/controller/level.ts @@ -1,6 +1,6 @@ -import {ClassicLevel} from "classic-level"; import {Logger} from "@lodestar/utils"; -import {DbReqOpts, DatabaseController, DatabaseOptions, FilterOptions, KeyValue} from "./interface.js"; +import {ClassicLevel} from "classic-level"; +import {DatabaseController, DatabaseOptions, DbReqOpts, FilterOptions, KeyValue} from "./interface.js"; import {LevelDbControllerMetrics} from "./metrics.js"; enum Status { diff --git a/packages/db/test/unit/controller/level.test.ts b/packages/db/test/unit/controller/level.test.ts index 16f20e770c93..af9de5a04e46 100644 --- a/packages/db/test/unit/controller/level.test.ts +++ b/packages/db/test/unit/controller/level.test.ts @@ -1,8 +1,8 @@ import {execSync} from "node:child_process"; import os from "node:os"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; -import all from "it-all"; import {getEnvLogger} from "@lodestar/logger/env"; +import all from "it-all"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import {LevelDbController} from "../../../src/controller/index.js"; describe("LevelDB controller", () => { diff --git a/packages/db/test/unit/schema.test.ts b/packages/db/test/unit/schema.test.ts index c72611453e4f..7488e9f5aaef 100644 --- a/packages/db/test/unit/schema.test.ts +++ b/packages/db/test/unit/schema.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {intToBytes} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {BUCKET_LENGTH, encodeKey} from "../../src/index.js"; describe("encodeKey", () => { diff --git a/packages/flare/src/cli.ts b/packages/flare/src/cli.ts index 91c4ef83ca09..9b29d22629de 100644 --- a/packages/flare/src/cli.ts +++ b/packages/flare/src/cli.ts @@ -1,7 +1,7 @@ +import {registerCommandToYargs} from "@lodestar/utils"; // Must not use `* as yargs`, see https://github.com/yargs/yargs/issues/1131 import yargs from "yargs"; import {hideBin} from "yargs/helpers"; -import {registerCommandToYargs} from "@lodestar/utils"; import {cmds} from "./cmds/index.js"; const topBanner = `Beacon chain multi-purpose and debugging tool. diff --git a/packages/flare/src/cmds/index.ts b/packages/flare/src/cmds/index.ts index 63e1f316b3b6..58d882040e8a 100644 --- a/packages/flare/src/cmds/index.ts +++ b/packages/flare/src/cmds/index.ts @@ -1,6 +1,6 @@ import {CliCommand} from "@lodestar/utils"; -import {selfSlashProposer} from "./selfSlashProposer.js"; import {selfSlashAttester} from "./selfSlashAttester.js"; +import {selfSlashProposer} from "./selfSlashProposer.js"; export const cmds: Required, Record>>["subcommands"] = [ selfSlashProposer, diff --git a/packages/flare/src/cmds/selfSlashAttester.ts b/packages/flare/src/cmds/selfSlashAttester.ts index 174535ba2e7d..78c10b6451a3 100644 --- a/packages/flare/src/cmds/selfSlashAttester.ts +++ b/packages/flare/src/cmds/selfSlashAttester.ts @@ -1,12 +1,12 @@ import {SecretKey, aggregateSignatures} from "@chainsafe/blst"; import {getClient} from "@lodestar/api"; -import {AttesterSlashing, phase0, ssz} from "@lodestar/types"; +import {BeaconConfig, createBeaconConfig} from "@lodestar/config"; import {config as chainConfig} from "@lodestar/config/default"; -import {createBeaconConfig, BeaconConfig} from "@lodestar/config"; import {DOMAIN_BEACON_ATTESTER, MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params"; -import {CliCommand, toPubkeyHex} from "@lodestar/utils"; import {computeSigningRoot} from "@lodestar/state-transition"; -import {deriveSecretKeys, SecretKeysArgs, secretKeysOptions} from "../util/deriveSecretKeys.js"; +import {AttesterSlashing, phase0, ssz} from "@lodestar/types"; +import {CliCommand, toPubkeyHex} from "@lodestar/utils"; +import {SecretKeysArgs, deriveSecretKeys, secretKeysOptions} from "../util/deriveSecretKeys.js"; /* eslint-disable no-console */ diff --git a/packages/flare/src/cmds/selfSlashProposer.ts b/packages/flare/src/cmds/selfSlashProposer.ts index dd9580232e71..83992aae7d82 100644 --- a/packages/flare/src/cmds/selfSlashProposer.ts +++ b/packages/flare/src/cmds/selfSlashProposer.ts @@ -1,12 +1,12 @@ import {SecretKey} from "@chainsafe/blst"; import {getClient} from "@lodestar/api"; -import {phase0, ssz} from "@lodestar/types"; +import {BeaconConfig, createBeaconConfig} from "@lodestar/config"; import {config as chainConfig} from "@lodestar/config/default"; -import {createBeaconConfig, BeaconConfig} from "@lodestar/config"; import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params"; -import {CliCommand, toPubkeyHex} from "@lodestar/utils"; import {computeSigningRoot} from "@lodestar/state-transition"; -import {deriveSecretKeys, SecretKeysArgs, secretKeysOptions} from "../util/deriveSecretKeys.js"; +import {phase0, ssz} from "@lodestar/types"; +import {CliCommand, toPubkeyHex} from "@lodestar/utils"; +import {SecretKeysArgs, deriveSecretKeys, secretKeysOptions} from "../util/deriveSecretKeys.js"; /* eslint-disable no-console */ diff --git a/packages/flare/src/index.ts b/packages/flare/src/index.ts index 5f3b85b459c1..b2ef85ce4c10 100644 --- a/packages/flare/src/index.ts +++ b/packages/flare/src/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import {YargsError} from "./util/errors.js"; import {getCli, yarg} from "./cli.js"; +import {YargsError} from "./util/errors.js"; import "source-map-support/register.js"; const flare = getCli(); diff --git a/packages/flare/test/unit/utils/format.test.ts b/packages/flare/test/unit/utils/format.test.ts index c6ef8805fe7b..846793175d9d 100644 --- a/packages/flare/test/unit/utils/format.test.ts +++ b/packages/flare/test/unit/utils/format.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {parseRange} from "../../../src/util/format.js"; describe("utils / format", () => { diff --git a/packages/fork-choice/src/forkChoice/errors.ts b/packages/fork-choice/src/forkChoice/errors.ts index 43d209106eed..cd0e0cd25274 100644 --- a/packages/fork-choice/src/forkChoice/errors.ts +++ b/packages/fork-choice/src/forkChoice/errors.ts @@ -1,4 +1,4 @@ -import {Slot, Epoch, RootHex} from "@lodestar/types"; +import {Epoch, RootHex, Slot} from "@lodestar/types"; import {LodestarError} from "@lodestar/utils"; export enum InvalidBlockCode { diff --git a/packages/fork-choice/src/forkChoice/forkChoice.ts b/packages/fork-choice/src/forkChoice/forkChoice.ts index dcc76441865e..2b803c3553a4 100644 --- a/packages/fork-choice/src/forkChoice/forkChoice.ts +++ b/packages/fork-choice/src/forkChoice/forkChoice.ts @@ -1,47 +1,47 @@ -import {Logger, MapDef, fromHex, toRootHex} from "@lodestar/utils"; -import {SLOTS_PER_HISTORICAL_ROOT, SLOTS_PER_EPOCH, INTERVALS_PER_SLOT} from "@lodestar/params"; -import {bellatrix, Slot, ValidatorIndex, phase0, ssz, RootHex, Epoch, Root, BeaconBlock} from "@lodestar/types"; +import {ChainConfig, ChainForkConfig} from "@lodestar/config"; +import {INTERVALS_PER_SLOT, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import { + CachedBeaconStateAllForks, + EffectiveBalanceIncrements, + ZERO_HASH, + computeEpochAtSlot, computeSlotsSinceEpochStart, computeStartSlotAtEpoch, - computeEpochAtSlot, - ZERO_HASH, - EffectiveBalanceIncrements, - CachedBeaconStateAllForks, + getAttesterSlashableIndices, isExecutionBlockBodyType, - isExecutionStateType, isExecutionEnabled, - getAttesterSlashableIndices, + isExecutionStateType, } from "@lodestar/state-transition"; import {computeUnrealizedCheckpoints} from "@lodestar/state-transition/epoch"; -import {ChainConfig, ChainForkConfig} from "@lodestar/config"; +import {BeaconBlock, Epoch, Root, RootHex, Slot, ValidatorIndex, bellatrix, phase0, ssz} from "@lodestar/types"; +import {Logger, MapDef, fromHex, toRootHex} from "@lodestar/utils"; import {computeDeltas} from "../protoArray/computeDeltas.js"; +import {ProtoArrayError, ProtoArrayErrorCode} from "../protoArray/errors.js"; import { - HEX_ZERO_HASH, - VoteTracker, - ProtoBlock, + DataAvailabilityStatus, ExecutionStatus, - MaybeValidExecutionStatus, + HEX_ZERO_HASH, LVHExecResponse, + MaybeValidExecutionStatus, + ProtoBlock, ProtoNode, - DataAvailabilityStatus, + VoteTracker, } from "../protoArray/interface.js"; import {ProtoArray} from "../protoArray/protoArray.js"; -import {ProtoArrayError, ProtoArrayErrorCode} from "../protoArray/errors.js"; -import {ForkChoiceError, ForkChoiceErrorCode, InvalidBlockCode, InvalidAttestationCode} from "./errors.js"; +import {ForkChoiceError, ForkChoiceErrorCode, InvalidAttestationCode, InvalidBlockCode} from "./errors.js"; import { - IForkChoice, - LatestMessage, - PowBlockHex, - EpochDifference, AncestorResult, AncestorStatus, + EpochDifference, ForkChoiceMetrics, + IForkChoice, + LatestMessage, NotReorgedReason, + PowBlockHex, } from "./interface.js"; -import {IForkChoiceStore, CheckpointWithHex, toCheckpointWithHex, JustifiedBalances} from "./store.js"; +import {CheckpointWithHex, IForkChoiceStore, JustifiedBalances, toCheckpointWithHex} from "./store.js"; export type ForkChoiceOpts = { proposerBoost?: boolean; diff --git a/packages/fork-choice/src/forkChoice/interface.ts b/packages/fork-choice/src/forkChoice/interface.ts index 9ac8cdfac81b..05c803b50dc8 100644 --- a/packages/fork-choice/src/forkChoice/interface.ts +++ b/packages/fork-choice/src/forkChoice/interface.ts @@ -1,15 +1,15 @@ import {EffectiveBalanceIncrements} from "@lodestar/state-transition"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; -import {Epoch, Slot, ValidatorIndex, phase0, Root, RootHex, BeaconBlock, IndexedAttestation} from "@lodestar/types"; +import {BeaconBlock, Epoch, IndexedAttestation, Root, RootHex, Slot, ValidatorIndex, phase0} from "@lodestar/types"; import { - ProtoBlock, - MaybeValidExecutionStatus, + DataAvailabilityStatus, LVHExecResponse, + MaybeValidExecutionStatus, + ProtoBlock, ProtoNode, - DataAvailabilityStatus, } from "../protoArray/interface.js"; -import {CheckpointWithHex} from "./store.js"; import {UpdateAndGetHeadOpt} from "./forkChoice.js"; +import {CheckpointWithHex} from "./store.js"; export type CheckpointHex = { epoch: Epoch; diff --git a/packages/fork-choice/src/forkChoice/store.ts b/packages/fork-choice/src/forkChoice/store.ts index 2cd4da512870..fda01689f96c 100644 --- a/packages/fork-choice/src/forkChoice/store.ts +++ b/packages/fork-choice/src/forkChoice/store.ts @@ -1,7 +1,7 @@ +import {CachedBeaconStateAllForks, EffectiveBalanceIncrements} from "@lodestar/state-transition"; +import {RootHex, Slot, ValidatorIndex, phase0} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; -import {EffectiveBalanceIncrements, CachedBeaconStateAllForks} from "@lodestar/state-transition"; -import {phase0, Slot, RootHex, ValidatorIndex} from "@lodestar/types"; -import {CheckpointHexWithTotalBalance, CheckpointHexWithBalance} from "./interface.js"; +import {CheckpointHexWithBalance, CheckpointHexWithTotalBalance} from "./interface.js"; /** * Stores checkpoints in a hybrid format: diff --git a/packages/fork-choice/src/protoArray/computeDeltas.ts b/packages/fork-choice/src/protoArray/computeDeltas.ts index c921e12f751e..928cef8487cb 100644 --- a/packages/fork-choice/src/protoArray/computeDeltas.ts +++ b/packages/fork-choice/src/protoArray/computeDeltas.ts @@ -1,7 +1,7 @@ -import {ValidatorIndex} from "@lodestar/types"; import {EffectiveBalanceIncrements} from "@lodestar/state-transition"; -import {VoteTracker} from "./interface.js"; +import {ValidatorIndex} from "@lodestar/types"; import {ProtoArrayError, ProtoArrayErrorCode} from "./errors.js"; +import {VoteTracker} from "./interface.js"; // reuse arrays to avoid memory reallocation and gc const deltas = new Array(); diff --git a/packages/fork-choice/src/protoArray/interface.ts b/packages/fork-choice/src/protoArray/interface.ts index d60305a6ff72..5e36593697f6 100644 --- a/packages/fork-choice/src/protoArray/interface.ts +++ b/packages/fork-choice/src/protoArray/interface.ts @@ -1,4 +1,4 @@ -import {Epoch, Slot, RootHex, UintNum64} from "@lodestar/types"; +import {Epoch, RootHex, Slot, UintNum64} from "@lodestar/types"; // RootHex is a root as a hex string // Used for lightweight and easy comparison diff --git a/packages/fork-choice/src/protoArray/protoArray.ts b/packages/fork-choice/src/protoArray/protoArray.ts index 82a8b2620880..e1cbf4970920 100644 --- a/packages/fork-choice/src/protoArray/protoArray.ts +++ b/packages/fork-choice/src/protoArray/protoArray.ts @@ -1,11 +1,11 @@ -import {Epoch, RootHex, Slot} from "@lodestar/types"; -import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {GENESIS_EPOCH} from "@lodestar/params"; +import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {Epoch, RootHex, Slot} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {ForkChoiceError, ForkChoiceErrorCode} from "../forkChoice/errors.js"; -import {ProtoBlock, ProtoNode, HEX_ZERO_HASH, ExecutionStatus, LVHExecResponse} from "./interface.js"; -import {ProtoArrayError, ProtoArrayErrorCode, LVHExecError, LVHExecErrorCode} from "./errors.js"; +import {LVHExecError, LVHExecErrorCode, ProtoArrayError, ProtoArrayErrorCode} from "./errors.js"; +import {ExecutionStatus, HEX_ZERO_HASH, LVHExecResponse, ProtoBlock, ProtoNode} from "./interface.js"; export const DEFAULT_PRUNE_THRESHOLD = 0; type ProposerBoost = {root: RootHex; score: number}; diff --git a/packages/fork-choice/test/perf/forkChoice/onAttestation.test.ts b/packages/fork-choice/test/perf/forkChoice/onAttestation.test.ts index ae3b10b45d63..db344de96c57 100644 --- a/packages/fork-choice/test/perf/forkChoice/onAttestation.test.ts +++ b/packages/fork-choice/test/perf/forkChoice/onAttestation.test.ts @@ -1,9 +1,9 @@ -import {itBench} from "@dapplion/benchmark"; import {fromHexString, toHexString} from "@chainsafe/ssz"; -import {AttestationData, IndexedAttestation} from "@lodestar/types/phase0"; +import {itBench} from "@dapplion/benchmark"; import {ATTESTATION_SUBNET_COUNT} from "@lodestar/params"; -import {ssz} from "@lodestar/types"; import {computeEpochAtSlot} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; +import {AttestationData, IndexedAttestation} from "@lodestar/types/phase0"; import {initializeForkChoice} from "./util.js"; describe("ForkChoice onAttestation", () => { diff --git a/packages/fork-choice/test/perf/forkChoice/updateHead.test.ts b/packages/fork-choice/test/perf/forkChoice/updateHead.test.ts index 850215f5a844..892135b4eb34 100644 --- a/packages/fork-choice/test/perf/forkChoice/updateHead.test.ts +++ b/packages/fork-choice/test/perf/forkChoice/updateHead.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; import {computeEpochAtSlot} from "@lodestar/state-transition"; import {ForkChoice, ProtoBlock} from "../../../src/index.js"; -import {initializeForkChoice, Opts} from "./util.js"; +import {Opts, initializeForkChoice} from "./util.js"; describe("forkchoice updateHead", () => { for (const initialValidatorCount of [100_000, 600_000, 1_000_000]) { diff --git a/packages/fork-choice/test/perf/forkChoice/util.ts b/packages/fork-choice/test/perf/forkChoice/util.ts index 6c04ac817fb2..4376ce047727 100644 --- a/packages/fork-choice/test/perf/forkChoice/util.ts +++ b/packages/fork-choice/test/perf/forkChoice/util.ts @@ -1,14 +1,14 @@ import {fromHexString} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; +import {computeTotalBalance} from "../../../src/forkChoice/store.js"; import { + DataAvailabilityStatus, ExecutionStatus, ForkChoice, IForkChoiceStore, - ProtoBlock, ProtoArray, - DataAvailabilityStatus, + ProtoBlock, } from "../../../src/index.js"; -import {computeTotalBalance} from "../../../src/forkChoice/store.js"; const genesisSlot = 0; const genesisEpoch = 0; diff --git a/packages/fork-choice/test/perf/protoArray/computeDeltas.test.ts b/packages/fork-choice/test/perf/protoArray/computeDeltas.test.ts index 9b51f640d949..cb99d8b566d4 100644 --- a/packages/fork-choice/test/perf/protoArray/computeDeltas.test.ts +++ b/packages/fork-choice/test/perf/protoArray/computeDeltas.test.ts @@ -1,7 +1,7 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsZeroed} from "@lodestar/state-transition"; -import {VoteTracker} from "../../../src/protoArray/interface.js"; import {computeDeltas} from "../../../src/protoArray/computeDeltas.js"; +import {VoteTracker} from "../../../src/protoArray/interface.js"; describe("computeDeltas", () => { let oldBalances: EffectiveBalanceIncrements; diff --git a/packages/fork-choice/test/unit/forkChoice/forkChoice.test.ts b/packages/fork-choice/test/unit/forkChoice/forkChoice.test.ts index f47849136bff..db7482f30cde 100644 --- a/packages/fork-choice/test/unit/forkChoice/forkChoice.test.ts +++ b/packages/fork-choice/test/unit/forkChoice/forkChoice.test.ts @@ -1,18 +1,18 @@ -import {describe, it, expect, beforeEach, beforeAll} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; +import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {computeEpochAtSlot} from "@lodestar/state-transition"; import {RootHex, Slot} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; -import {computeEpochAtSlot} from "@lodestar/state-transition"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {beforeAll, beforeEach, describe, expect, it} from "vitest"; import { + DataAvailabilityStatus, + EpochDifference, + ExecutionStatus, ForkChoice, IForkChoiceStore, - ProtoBlock, ProtoArray, - ExecutionStatus, - EpochDifference, - DataAvailabilityStatus, + ProtoBlock, } from "../../../src/index.js"; import {getBlockRoot, getStateRoot} from "../../utils/index.js"; diff --git a/packages/fork-choice/test/unit/forkChoice/getProposerHead.test.ts b/packages/fork-choice/test/unit/forkChoice/getProposerHead.test.ts index 187834e6d63a..ba225756733d 100644 --- a/packages/fork-choice/test/unit/forkChoice/getProposerHead.test.ts +++ b/packages/fork-choice/test/unit/forkChoice/getProposerHead.test.ts @@ -1,18 +1,18 @@ -import {describe, it, expect, beforeEach} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; +import {INTERVALS_PER_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; import {Slot} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; -import {INTERVALS_PER_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {beforeEach, describe, expect, it} from "vitest"; +import {NotReorgedReason} from "../../../src/forkChoice/interface.js"; import { + DataAvailabilityStatus, + ExecutionStatus, ForkChoice, IForkChoiceStore, ProtoArray, - ExecutionStatus, ProtoBlock, - DataAvailabilityStatus, } from "../../../src/index.js"; -import {NotReorgedReason} from "../../../src/forkChoice/interface.js"; import {getBlockRoot, getStateRoot} from "../../utils/index.js"; type ProtoBlockWithWeight = ProtoBlock & {weight: number}; // weight of the block itself diff --git a/packages/fork-choice/test/unit/forkChoice/utils.test.ts b/packages/fork-choice/test/unit/forkChoice/utils.test.ts index 44b0eb8b719b..b3bea1020544 100644 --- a/packages/fork-choice/test/unit/forkChoice/utils.test.ts +++ b/packages/fork-choice/test/unit/forkChoice/utils.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {createChainForkConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; -import {assertValidTerminalPowBlock, ExecutionStatus} from "../../../src/index.js"; +import {describe, expect, it} from "vitest"; +import {ExecutionStatus, assertValidTerminalPowBlock} from "../../../src/index.js"; describe("assertValidTerminalPowBlock", () => { const config = createChainForkConfig({TERMINAL_TOTAL_DIFFICULTY: BigInt(10)}); diff --git a/packages/fork-choice/test/unit/protoArray/computeDeltas.test.ts b/packages/fork-choice/test/unit/protoArray/computeDeltas.test.ts index 4428807bd13d..af5d42f834b9 100644 --- a/packages/fork-choice/test/unit/protoArray/computeDeltas.test.ts +++ b/packages/fork-choice/test/unit/protoArray/computeDeltas.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {getEffectiveBalanceIncrementsZeroed} from "@lodestar/state-transition"; +import {describe, expect, it} from "vitest"; import {computeDeltas} from "../../../src/protoArray/computeDeltas.js"; diff --git a/packages/fork-choice/test/unit/protoArray/executionStatusUpdates.test.ts b/packages/fork-choice/test/unit/protoArray/executionStatusUpdates.test.ts index cefb2b07df02..4fcc6c79d190 100644 --- a/packages/fork-choice/test/unit/protoArray/executionStatusUpdates.test.ts +++ b/packages/fork-choice/test/unit/protoArray/executionStatusUpdates.test.ts @@ -1,10 +1,10 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { - ProtoBlock, - ProtoArray, + BlockExtraMeta, ExecutionStatus, MaybeValidExecutionStatus, - BlockExtraMeta, + ProtoArray, + ProtoBlock, } from "../../../src/index.js"; import {LVHExecErrorCode} from "../../../src/protoArray/errors.js"; import {DataAvailabilityStatus} from "../../../src/protoArray/interface.js"; diff --git a/packages/fork-choice/test/unit/protoArray/getCommonAncestor.test.ts b/packages/fork-choice/test/unit/protoArray/getCommonAncestor.test.ts index b9b7f9c37b43..3bc322112332 100644 --- a/packages/fork-choice/test/unit/protoArray/getCommonAncestor.test.ts +++ b/packages/fork-choice/test/unit/protoArray/getCommonAncestor.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {ProtoArray, ExecutionStatus, DataAvailabilityStatus} from "../../../src/index.js"; +import {describe, expect, it} from "vitest"; +import {DataAvailabilityStatus, ExecutionStatus, ProtoArray} from "../../../src/index.js"; describe("getCommonAncestor", () => { const blocks: {slot: number; root: string; parent: string}[] = [ diff --git a/packages/fork-choice/test/unit/protoArray/protoArray.test.ts b/packages/fork-choice/test/unit/protoArray/protoArray.test.ts index 92dfc61d61b2..5e87504dc455 100644 --- a/packages/fork-choice/test/unit/protoArray/protoArray.test.ts +++ b/packages/fork-choice/test/unit/protoArray/protoArray.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {RootHex} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; -import {ProtoArray, ExecutionStatus, DataAvailabilityStatus} from "../../../src/index.js"; +import {DataAvailabilityStatus, ExecutionStatus, ProtoArray} from "../../../src/index.js"; describe("ProtoArray", () => { it("finalized descendant", () => { diff --git a/packages/light-client/src/index.ts b/packages/light-client/src/index.ts index 098ea18adc31..7dd4601ab837 100644 --- a/packages/light-client/src/index.ts +++ b/packages/light-client/src/index.ts @@ -1,4 +1,4 @@ -import mitt from "mitt"; +import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD} from "@lodestar/params"; import { LightClientBootstrap, @@ -6,22 +6,22 @@ import { LightClientHeader, LightClientOptimisticUpdate, LightClientUpdate, - phase0, RootHex, Slot, SyncPeriod, + phase0, } from "@lodestar/types"; -import {createBeaconConfig, BeaconConfig, ChainForkConfig} from "@lodestar/config"; import {fromHex, isErrorAborted, sleep, toRootHex} from "@lodestar/utils"; -import {getCurrentSlot, slotWithFutureTolerance, timeUntilNextEpoch} from "./utils/clock.js"; -import {chunkifyInclusiveRange} from "./utils/chunkify.js"; +import mitt from "mitt"; import {LightclientEmitter, LightclientEvent} from "./events.js"; -import {getConsoleLogger, ILcLogger} from "./utils/logger.js"; -import {computeSyncPeriodAtEpoch, computeSyncPeriodAtSlot, computeEpochAtSlot} from "./utils/clock.js"; import {LightclientSpec} from "./spec/index.js"; -import {validateLightClientBootstrap} from "./spec/validateLightClientBootstrap.js"; import {ProcessUpdateOpts} from "./spec/processLightClientUpdate.js"; +import {validateLightClientBootstrap} from "./spec/validateLightClientBootstrap.js"; import {LightClientTransport} from "./transport/interface.js"; +import {chunkifyInclusiveRange} from "./utils/chunkify.js"; +import {getCurrentSlot, slotWithFutureTolerance, timeUntilNextEpoch} from "./utils/clock.js"; +import {computeEpochAtSlot, computeSyncPeriodAtEpoch, computeSyncPeriodAtSlot} from "./utils/clock.js"; +import {ILcLogger, getConsoleLogger} from "./utils/logger.js"; // Re-export types export {LightclientEvent} from "./events.js"; @@ -327,8 +327,8 @@ export class Lightclient { } } +import * as transport from "./transport.js"; // To export these name spaces to the bundle JS import * as utils from "./utils.js"; import * as validation from "./validation.js"; -import * as transport from "./transport.js"; export {utils, validation, transport}; diff --git a/packages/light-client/src/spec/index.ts b/packages/light-client/src/spec/index.ts index 0934e15b1c17..ff4fe22b28b0 100644 --- a/packages/light-client/src/spec/index.ts +++ b/packages/light-client/src/spec/index.ts @@ -8,7 +8,7 @@ import { Slot, } from "@lodestar/types"; import {computeSyncPeriodAtSlot} from "../utils/index.js"; -import {getSyncCommitteeAtPeriod, processLightClientUpdate, ProcessUpdateOpts} from "./processLightClientUpdate.js"; +import {ProcessUpdateOpts, getSyncCommitteeAtPeriod, processLightClientUpdate} from "./processLightClientUpdate.js"; import {ILightClientStore, LightClientStore, LightClientStoreEvents} from "./store.js"; import {ZERO_FINALITY_BRANCH, ZERO_HEADER, ZERO_SYNC_COMMITTEE, getZeroSyncCommitteeBranch} from "./utils.js"; diff --git a/packages/light-client/src/spec/processLightClientUpdate.ts b/packages/light-client/src/spec/processLightClientUpdate.ts index 644a956ab4b0..1c5483b499ab 100644 --- a/packages/light-client/src/spec/processLightClientUpdate.ts +++ b/packages/light-client/src/spec/processLightClientUpdate.ts @@ -1,9 +1,9 @@ +import {ChainForkConfig} from "@lodestar/config"; import {SYNC_COMMITTEE_SIZE} from "@lodestar/params"; import {LightClientUpdate, Slot, SyncPeriod} from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; import {pruneSetToMax} from "@lodestar/utils"; import {computeSyncPeriodAtSlot, deserializeSyncCommittee, sumBits} from "../utils/index.js"; -import {isBetterUpdate, LightClientUpdateSummary, toLightClientUpdateSummary} from "./isBetterUpdate.js"; +import {LightClientUpdateSummary, isBetterUpdate, toLightClientUpdateSummary} from "./isBetterUpdate.js"; import {ILightClientStore, MAX_SYNC_PERIODS_CACHE, SyncCommitteeFast} from "./store.js"; import {getSafetyThreshold, isSyncCommitteeUpdate} from "./utils.js"; import {validateLightClientUpdate} from "./validateLightClientUpdate.js"; diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index 36bc7098fcc5..cd0c03fd5b0d 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -1,30 +1,30 @@ import {BitArray, byteArrayEquals} from "@chainsafe/ssz"; +import {ChainForkConfig} from "@lodestar/config"; import { - FINALIZED_ROOT_DEPTH, - NEXT_SYNC_COMMITTEE_DEPTH, - ForkSeq, - ForkName, BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH, BLOCK_BODY_EXECUTION_PAYLOAD_INDEX as EXECUTION_PAYLOAD_INDEX, + FINALIZED_ROOT_DEPTH, + FINALIZED_ROOT_DEPTH_ELECTRA, + ForkName, + ForkSeq, + NEXT_SYNC_COMMITTEE_DEPTH, NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, isForkPostElectra, - FINALIZED_ROOT_DEPTH_ELECTRA, } from "@lodestar/params"; import { - ssz, - Slot, + BeaconBlockHeader, LightClientFinalityUpdate, LightClientHeader, LightClientOptimisticUpdate, LightClientUpdate, - BeaconBlockHeader, + Slot, SyncCommittee, isElectraLightClientUpdate, + ssz, } from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; -import {isValidMerkleBranch, computeEpochAtSlot, computeSyncPeriodAtSlot} from "../utils/index.js"; +import {computeEpochAtSlot, computeSyncPeriodAtSlot, isValidMerkleBranch} from "../utils/index.js"; import {normalizeMerkleBranch} from "../utils/normalizeMerkleBranch.js"; import {LightClientStore} from "./store.js"; diff --git a/packages/light-client/src/spec/validateLightClientBootstrap.ts b/packages/light-client/src/spec/validateLightClientBootstrap.ts index 2eafea0791f0..79c1f7a68fff 100644 --- a/packages/light-client/src/spec/validateLightClientBootstrap.ts +++ b/packages/light-client/src/spec/validateLightClientBootstrap.ts @@ -1,8 +1,8 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {LightClientBootstrap, Root, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; -import {toHex} from "@lodestar/utils"; import {isForkPostElectra} from "@lodestar/params"; +import {LightClientBootstrap, Root, ssz} from "@lodestar/types"; +import {toHex} from "@lodestar/utils"; import {isValidMerkleBranch} from "../utils/verifyMerkleBranch.js"; import {isValidLightClientHeader} from "./utils.js"; diff --git a/packages/light-client/src/spec/validateLightClientUpdate.ts b/packages/light-client/src/spec/validateLightClientUpdate.ts index 9a5ea1985f16..ce2791f1a9da 100644 --- a/packages/light-client/src/spec/validateLightClientUpdate.ts +++ b/packages/light-client/src/spec/validateLightClientUpdate.ts @@ -1,32 +1,32 @@ import bls from "@chainsafe/bls"; import type {PublicKey, Signature} from "@chainsafe/bls/types"; -import {LightClientUpdate, Root, isElectraLightClientUpdate, ssz} from "@lodestar/types"; import {ChainForkConfig} from "@lodestar/config"; import { - FINALIZED_ROOT_INDEX, - FINALIZED_ROOT_DEPTH, - NEXT_SYNC_COMMITTEE_DEPTH, - MIN_SYNC_COMMITTEE_PARTICIPANTS, DOMAIN_SYNC_COMMITTEE, + FINALIZED_ROOT_DEPTH, + FINALIZED_ROOT_DEPTH_ELECTRA, + FINALIZED_ROOT_INDEX, + FINALIZED_ROOT_INDEX_ELECTRA, GENESIS_SLOT, + MIN_SYNC_COMMITTEE_PARTICIPANTS, + NEXT_SYNC_COMMITTEE_DEPTH, NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, - NEXT_SYNC_COMMITTEE_INDEX_ELECTRA, NEXT_SYNC_COMMITTEE_INDEX, - FINALIZED_ROOT_DEPTH_ELECTRA, - FINALIZED_ROOT_INDEX_ELECTRA, + NEXT_SYNC_COMMITTEE_INDEX_ELECTRA, } from "@lodestar/params"; -import {getParticipantPubkeys, sumBits} from "../utils/utils.js"; -import {isValidMerkleBranch} from "../utils/index.js"; +import {LightClientUpdate, Root, isElectraLightClientUpdate, ssz} from "@lodestar/types"; import {SyncCommitteeFast} from "../types.js"; +import {isValidMerkleBranch} from "../utils/index.js"; +import {getParticipantPubkeys, sumBits} from "../utils/utils.js"; +import {ILightClientStore} from "./store.js"; import { + ZERO_HASH, isFinalityUpdate, isSyncCommitteeUpdate, + isValidLightClientHeader, isZeroedHeader, isZeroedSyncCommittee, - ZERO_HASH, - isValidLightClientHeader, } from "./utils.js"; -import {ILightClientStore} from "./store.js"; export function validateLightClientUpdate( config: ChainForkConfig, diff --git a/packages/light-client/src/transport/interface.ts b/packages/light-client/src/transport/interface.ts index dc9c697c00be..816336a6fa04 100644 --- a/packages/light-client/src/transport/interface.ts +++ b/packages/light-client/src/transport/interface.ts @@ -1,3 +1,4 @@ +import {ForkName} from "@lodestar/params"; import { LightClientBootstrap, LightClientFinalityUpdate, @@ -5,7 +6,6 @@ import { LightClientUpdate, SyncPeriod, } from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; export interface LightClientTransport { getUpdates( diff --git a/packages/light-client/src/transport/rest.ts b/packages/light-client/src/transport/rest.ts index c260e1aaeee3..aaffa090ade0 100644 --- a/packages/light-client/src/transport/rest.ts +++ b/packages/light-client/src/transport/rest.ts @@ -1,4 +1,5 @@ -import mitt from "mitt"; +import {type ApiClient, routes} from "@lodestar/api"; +import {type ForkName} from "@lodestar/params"; import { LightClientBootstrap, LightClientFinalityUpdate, @@ -6,8 +7,7 @@ import { LightClientUpdate, type SyncPeriod, } from "@lodestar/types"; -import {type ApiClient, routes} from "@lodestar/api"; -import {type ForkName} from "@lodestar/params"; +import mitt from "mitt"; import {MittEmitter} from "../events.js"; import {type LightClientTransport} from "./interface.js"; diff --git a/packages/light-client/src/utils/api.ts b/packages/light-client/src/utils/api.ts index 6ccb187052e1..31846270ca40 100644 --- a/packages/light-client/src/utils/api.ts +++ b/packages/light-client/src/utils/api.ts @@ -1,4 +1,4 @@ -import {getClient, ApiClient, ApiRequestInit} from "@lodestar/api"; +import {ApiClient, ApiRequestInit, getClient} from "@lodestar/api"; import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; diff --git a/packages/light-client/src/utils/domain.ts b/packages/light-client/src/utils/domain.ts index 90923ed8c9fc..d9bef6bb511c 100644 --- a/packages/light-client/src/utils/domain.ts +++ b/packages/light-client/src/utils/domain.ts @@ -1,7 +1,7 @@ // Only used by processDeposit + lightclient import {Type} from "@chainsafe/ssz"; -import {Epoch, Version, Root, DomainType, phase0, ssz, Domain} from "@lodestar/types"; +import {Domain, DomainType, Epoch, Root, Version, phase0, ssz} from "@lodestar/types"; /** * Return the domain for the [[domainType]] and [[forkVersion]]. diff --git a/packages/light-client/src/utils/utils.ts b/packages/light-client/src/utils/utils.ts index 5a298d81d37b..a4a697f0420d 100644 --- a/packages/light-client/src/utils/utils.ts +++ b/packages/light-client/src/utils/utils.ts @@ -2,7 +2,7 @@ import bls from "@chainsafe/bls"; import type {PublicKey} from "@chainsafe/bls/types"; import {BitArray} from "@chainsafe/ssz"; import {ApiClient} from "@lodestar/api"; -import {altair, Bytes32, Root, ssz} from "@lodestar/types"; +import {Bytes32, Root, altair, ssz} from "@lodestar/types"; import {BeaconBlockHeader} from "@lodestar/types/phase0"; import {GenesisData} from "../index.js"; import {SyncCommitteeFast} from "../types.js"; diff --git a/packages/light-client/src/utils/verifyMerkleBranch.ts b/packages/light-client/src/utils/verifyMerkleBranch.ts index 87b1d660eb32..a9a5b8643783 100644 --- a/packages/light-client/src/utils/verifyMerkleBranch.ts +++ b/packages/light-client/src/utils/verifyMerkleBranch.ts @@ -1,5 +1,5 @@ -import {byteArrayEquals} from "@chainsafe/ssz"; import {hasher} from "@chainsafe/persistent-merkle-tree"; +import {byteArrayEquals} from "@chainsafe/ssz"; export const SYNC_COMMITTEES_DEPTH = 4; export const SYNC_COMMITTEES_INDEX = 11; diff --git a/packages/light-client/src/validation.ts b/packages/light-client/src/validation.ts index c756d612f3e7..22cbf700ed16 100644 --- a/packages/light-client/src/validation.ts +++ b/packages/light-client/src/validation.ts @@ -1,30 +1,30 @@ import bls from "@chainsafe/bls"; import type {PublicKey, Signature} from "@chainsafe/bls/types"; +import {BeaconConfig} from "@lodestar/config"; +import { + DOMAIN_SYNC_COMMITTEE, + FINALIZED_ROOT_DEPTH, + FINALIZED_ROOT_DEPTH_ELECTRA, + FINALIZED_ROOT_INDEX, + MIN_SYNC_COMMITTEE_PARTICIPANTS, + NEXT_SYNC_COMMITTEE_DEPTH, + NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, + NEXT_SYNC_COMMITTEE_INDEX, + NEXT_SYNC_COMMITTEE_INDEX_ELECTRA, +} from "@lodestar/params"; import { - altair, - isElectraLightClientUpdate, LightClientFinalityUpdate, LightClientUpdate, Root, Slot, + altair, + isElectraLightClientUpdate, ssz, } from "@lodestar/types"; -import { - FINALIZED_ROOT_INDEX, - FINALIZED_ROOT_DEPTH, - NEXT_SYNC_COMMITTEE_INDEX, - NEXT_SYNC_COMMITTEE_DEPTH, - MIN_SYNC_COMMITTEE_PARTICIPANTS, - DOMAIN_SYNC_COMMITTEE, - NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, - FINALIZED_ROOT_DEPTH_ELECTRA, - NEXT_SYNC_COMMITTEE_INDEX_ELECTRA, -} from "@lodestar/params"; -import {BeaconConfig} from "@lodestar/config"; -import {isValidMerkleBranch} from "./utils/verifyMerkleBranch.js"; -import {assertZeroHashes, getParticipantPubkeys, isEmptyHeader} from "./utils/utils.js"; import {SyncCommitteeFast} from "./types.js"; import {computeSyncPeriodAtSlot} from "./utils/clock.js"; +import {assertZeroHashes, getParticipantPubkeys, isEmptyHeader} from "./utils/utils.js"; +import {isValidMerkleBranch} from "./utils/verifyMerkleBranch.js"; /** * diff --git a/packages/light-client/test/mocks/BeaconChainLcMock.ts b/packages/light-client/test/mocks/BeaconChainLcMock.ts index b6813662649e..f08cb55e808c 100644 --- a/packages/light-client/test/mocks/BeaconChainLcMock.ts +++ b/packages/light-client/test/mocks/BeaconChainLcMock.ts @@ -1,6 +1,6 @@ import {toHexString} from "@chainsafe/ssz"; import {BeaconStateAltair} from "@lodestar/state-transition"; -import {altair, Root, ssz} from "@lodestar/types"; +import {Root, altair, ssz} from "@lodestar/types"; import {IBeaconChainLc} from "../utils/prepareUpdateNaive.js"; /** diff --git a/packages/light-client/test/mocks/LightclientServerApiMock.ts b/packages/light-client/test/mocks/LightclientServerApiMock.ts index faf33ad260c8..ce23d785183a 100644 --- a/packages/light-client/test/mocks/LightclientServerApiMock.ts +++ b/packages/light-client/test/mocks/LightclientServerApiMock.ts @@ -1,11 +1,11 @@ -import {concat} from "uint8arrays/concat"; import {digest} from "@chainsafe/as-sha256"; -import {CompactMultiProof, createProof, ProofType} from "@chainsafe/persistent-merkle-tree"; +import {CompactMultiProof, ProofType, createProof} from "@chainsafe/persistent-merkle-tree"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; -import {altair, RootHex, SyncPeriod} from "@lodestar/types"; -import {notNullish} from "@lodestar/utils"; import {ForkName} from "@lodestar/params"; +import {RootHex, SyncPeriod, altair} from "@lodestar/types"; +import {notNullish} from "@lodestar/utils"; +import {concat} from "uint8arrays/concat"; import {BeaconStateAltair} from "../utils/types.js"; type ProofApi = ApplicationMethods; diff --git a/packages/light-client/test/unit/isValidLightClientHeader.test.ts b/packages/light-client/test/unit/isValidLightClientHeader.test.ts index 2bbbd1250961..1782f1853296 100644 --- a/packages/light-client/test/unit/isValidLightClientHeader.test.ts +++ b/packages/light-client/test/unit/isValidLightClientHeader.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; -import {LightClientHeader, ssz} from "@lodestar/types"; import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; +import {LightClientHeader, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {isValidLightClientHeader} from "../../src/spec/utils.js"; describe("isValidLightClientHeader", () => { diff --git a/packages/light-client/test/unit/sync.node.test.ts b/packages/light-client/test/unit/sync.node.test.ts index 52afd05760d7..f373b006584f 100644 --- a/packages/light-client/test/unit/sync.node.test.ts +++ b/packages/light-client/test/unit/sync.node.test.ts @@ -1,27 +1,27 @@ -import {describe, it, expect, afterEach, vi} from "vitest"; -import {JsonPath, toHexString} from "@chainsafe/ssz"; import {CompactMultiProof, computeDescriptor} from "@chainsafe/persistent-merkle-tree"; +import {JsonPath, toHexString} from "@chainsafe/ssz"; +import {ApiClient, getClient, routes} from "@lodestar/api"; +import {ChainConfig, createBeaconConfig} from "@lodestar/config"; +import {chainConfig as chainConfigDef} from "@lodestar/config/default"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; import {BeaconStateAllForks, BeaconStateAltair} from "@lodestar/state-transition"; import {altair, ssz} from "@lodestar/types"; -import {routes, getClient, ApiClient} from "@lodestar/api"; -import {chainConfig as chainConfigDef} from "@lodestar/config/default"; -import {createBeaconConfig, ChainConfig} from "@lodestar/config"; +import {afterEach, describe, expect, it, vi} from "vitest"; import {Lightclient, LightclientEvent} from "../../src/index.js"; -import {LightclientServerApiMock, ProofServerApiMock} from "../mocks/LightclientServerApiMock.js"; +import {LightClientRestTransport} from "../../src/transport/rest.js"; +import {computeSyncPeriodAtSlot} from "../../src/utils/clock.js"; import {EventsServerApiMock} from "../mocks/EventsServerApiMock.js"; +import {LightclientServerApiMock, ProofServerApiMock} from "../mocks/LightclientServerApiMock.js"; +import {ServerOpts, startServer} from "../utils/server.js"; import { - computeLightclientUpdate, + committeeUpdateToLatestFinalizedHeadUpdate, + committeeUpdateToLatestHeadUpdate, computeLightClientSnapshot, + computeLightclientUpdate, getInteropSyncCommittee, - testLogger, - committeeUpdateToLatestHeadUpdate, - committeeUpdateToLatestFinalizedHeadUpdate, lastInMap, + testLogger, } from "../utils/utils.js"; -import {startServer, ServerOpts} from "../utils/server.js"; -import {computeSyncPeriodAtSlot} from "../../src/utils/clock.js"; -import {LightClientRestTransport} from "../../src/transport/rest.js"; const SOME_HASH = Buffer.alloc(32, 0xff); diff --git a/packages/light-client/test/unit/syncInMemory.test.ts b/packages/light-client/test/unit/syncInMemory.test.ts index 6118a1b4e61a..3f3b04cc7baf 100644 --- a/packages/light-client/test/unit/syncInMemory.test.ts +++ b/packages/light-client/test/unit/syncInMemory.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect, beforeAll, vi} from "vitest"; import bls from "@chainsafe/bls"; import {createBeaconConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {altair, ssz, SyncPeriod} from "@lodestar/types"; +import {SyncPeriod, altair, ssz} from "@lodestar/types"; +import {beforeAll, describe, expect, it, vi} from "vitest"; import {LightClientStoreFast} from "../../src/types.js"; import {BeaconChainLcMock} from "../mocks/BeaconChainLcMock.js"; import {processLightClientUpdate} from "../utils/naive/update.js"; import {IBeaconChainLc, prepareUpdateNaive} from "../utils/prepareUpdateNaive.js"; -import {getInteropSyncCommittee, getSyncAggregateSigningRoot, SyncCommitteeKeys} from "../utils/utils.js"; +import {SyncCommitteeKeys, getInteropSyncCommittee, getSyncAggregateSigningRoot} from "../utils/utils.js"; function getSyncCommittee( syncCommitteesKeys: Map, diff --git a/packages/light-client/test/unit/utils.test.ts b/packages/light-client/test/unit/utils.test.ts index 9913c6c462a4..18df5aee076a 100644 --- a/packages/light-client/test/unit/utils.test.ts +++ b/packages/light-client/test/unit/utils.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; +import {ZERO_HASH} from "../../src/spec/utils.js"; +import {normalizeMerkleBranch} from "../../src/utils/normalizeMerkleBranch.js"; import {isValidMerkleBranch} from "../../src/utils/verifyMerkleBranch.js"; import {computeMerkleBranch} from "../utils/utils.js"; -import {normalizeMerkleBranch} from "../../src/utils/normalizeMerkleBranch.js"; -import {ZERO_HASH} from "../../src/spec/utils.js"; describe("utils", () => { it("constructMerkleBranch", () => { diff --git a/packages/light-client/test/unit/utils/chunkify.test.ts b/packages/light-client/test/unit/utils/chunkify.test.ts index 297637fd70b0..585dce5c670e 100644 --- a/packages/light-client/test/unit/utils/chunkify.test.ts +++ b/packages/light-client/test/unit/utils/chunkify.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {chunkifyInclusiveRange} from "../../../src/utils/chunkify.js"; describe("utils / chunkifyInclusiveRange", () => { diff --git a/packages/light-client/test/unit/validation.test.ts b/packages/light-client/test/unit/validation.test.ts index 6ed3b714a690..222277993216 100644 --- a/packages/light-client/test/unit/validation.test.ts +++ b/packages/light-client/test/unit/validation.test.ts @@ -1,9 +1,7 @@ -import {describe, it, expect, beforeAll, vi} from "vitest"; import bls from "@chainsafe/bls"; import {Tree} from "@chainsafe/persistent-merkle-tree"; -import {altair, ssz} from "@lodestar/types"; -import {chainConfig} from "@lodestar/config/default"; import {createBeaconConfig} from "@lodestar/config"; +import {chainConfig} from "@lodestar/config/default"; import { EPOCHS_PER_SYNC_COMMITTEE_PERIOD, FINALIZED_ROOT_GINDEX, @@ -11,8 +9,10 @@ import { SLOTS_PER_EPOCH, SYNC_COMMITTEE_SIZE, } from "@lodestar/params"; -import {assertValidLightClientUpdate} from "../../src/validation.js"; +import {altair, ssz} from "@lodestar/types"; +import {beforeAll, describe, expect, it, vi} from "vitest"; import {LightClientSnapshotFast, SyncCommitteeFast} from "../../src/types.js"; +import {assertValidLightClientUpdate} from "../../src/validation.js"; import {defaultBeaconBlockHeader, getSyncAggregateSigningRoot, signAndAggregate} from "../utils/utils.js"; describe("validation", () => { diff --git a/packages/light-client/test/unit/webEsmBundle.browser.test.ts b/packages/light-client/test/unit/webEsmBundle.browser.test.ts index defc421d7071..9940342e28b2 100644 --- a/packages/light-client/test/unit/webEsmBundle.browser.test.ts +++ b/packages/light-client/test/unit/webEsmBundle.browser.test.ts @@ -1,7 +1,7 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */ -import {expect, describe, it, vi, beforeAll} from "vitest"; import {sleep} from "@lodestar/utils"; -import {Lightclient, LightclientEvent, utils, transport} from "../../dist/lightclient.min.mjs"; +/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */ +import {beforeAll, describe, expect, it, vi} from "vitest"; +import {Lightclient, LightclientEvent, transport, utils} from "../../dist/lightclient.min.mjs"; describe("web bundle for lightclient", () => { vi.setConfig({testTimeout: 20_000}); diff --git a/packages/light-client/test/utils/naive/update.ts b/packages/light-client/test/utils/naive/update.ts index b2e0ecf47a8a..01eaf35e1ad8 100644 --- a/packages/light-client/test/utils/naive/update.ts +++ b/packages/light-client/test/utils/naive/update.ts @@ -1,10 +1,10 @@ -import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {altair, Slot} from "@lodestar/types"; import {BeaconConfig} from "@lodestar/config"; +import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {Slot, altair} from "@lodestar/types"; import {LightClientSnapshotFast, LightClientStoreFast} from "../../../src/types.js"; -import {assertValidLightClientUpdate} from "../../../src/validation.js"; -import {deserializeSyncCommittee, isEmptyHeader, sumBits} from "../../../src/utils/utils.js"; import {computeSyncPeriodAtSlot} from "../../../src/utils/clock.js"; +import {deserializeSyncCommittee, isEmptyHeader, sumBits} from "../../../src/utils/utils.js"; +import {assertValidLightClientUpdate} from "../../../src/validation.js"; // // A lightclient has two types of syncing: diff --git a/packages/light-client/test/utils/prepareUpdateNaive.ts b/packages/light-client/test/utils/prepareUpdateNaive.ts index 3d0653c97263..17900ef7df56 100644 --- a/packages/light-client/test/utils/prepareUpdateNaive.ts +++ b/packages/light-client/test/utils/prepareUpdateNaive.ts @@ -1,7 +1,7 @@ -import {CompositeViewDU} from "@chainsafe/ssz"; import {Tree} from "@chainsafe/persistent-merkle-tree"; -import {altair, Root, ssz} from "@lodestar/types"; +import {CompositeViewDU} from "@chainsafe/ssz"; import {FINALIZED_ROOT_GINDEX, NEXT_SYNC_COMMITTEE_GINDEX, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; +import {Root, altair, ssz} from "@lodestar/types"; export interface IBeaconChainLc { getBlockHeaderByRoot(blockRoot: Root): Promise; diff --git a/packages/light-client/test/utils/server.ts b/packages/light-client/test/utils/server.ts index 6cc55e03cee4..4c6f22e06a31 100644 --- a/packages/light-client/test/utils/server.ts +++ b/packages/light-client/test/utils/server.ts @@ -1,10 +1,10 @@ -import {parse as parseQueryString} from "qs"; -import {FastifyInstance, fastify} from "fastify"; import {fastifyCors} from "@fastify/cors"; import {Endpoints} from "@lodestar/api"; -import {ApplicationMethods, addSszContentTypeParser} from "@lodestar/api/server"; import {BeaconApiMethods, registerRoutes} from "@lodestar/api/beacon/server"; +import {ApplicationMethods, addSszContentTypeParser} from "@lodestar/api/server"; import {ChainForkConfig} from "@lodestar/config"; +import {FastifyInstance, fastify} from "fastify"; +import {parse as parseQueryString} from "qs"; export type ServerOpts = { port: number; diff --git a/packages/light-client/test/utils/utils.ts b/packages/light-client/test/utils/utils.ts index 8364bcc7fc85..f497bac0541e 100644 --- a/packages/light-client/test/utils/utils.ts +++ b/packages/light-client/test/utils/utils.ts @@ -1,6 +1,6 @@ import bls from "@chainsafe/bls"; import {PointFormat, PublicKey, SecretKey} from "@chainsafe/bls/types"; -import {hasher, Tree} from "@chainsafe/persistent-merkle-tree"; +import {Tree, hasher} from "@chainsafe/persistent-merkle-tree"; import {BitArray, fromHexString} from "@chainsafe/ssz"; import {BeaconConfig} from "@lodestar/config"; import { @@ -11,7 +11,7 @@ import { SLOTS_PER_EPOCH, SYNC_COMMITTEE_SIZE, } from "@lodestar/params"; -import {altair, LightClientBootstrap, phase0, Slot, ssz, SyncPeriod} from "@lodestar/types"; +import {LightClientBootstrap, Slot, SyncPeriod, altair, phase0, ssz} from "@lodestar/types"; import {SyncCommitteeFast} from "../../src/types.js"; import {computeSigningRoot} from "../../src/utils/domain.js"; import {getConsoleLogger} from "../../src/utils/logger.js"; diff --git a/packages/logger/src/browser.ts b/packages/logger/src/browser.ts index 7f4972111459..60e756079377 100644 --- a/packages/logger/src/browser.ts +++ b/packages/logger/src/browser.ts @@ -1,8 +1,8 @@ +import {LogLevel, Logger} from "@lodestar/utils"; import winston from "winston"; import Transport from "winston-transport"; -import {LogLevel, Logger} from "@lodestar/utils"; -import {createWinstonLogger} from "./winston.js"; import {LEVEL, MESSAGE, TimestampFormat, WinstonLogInfo} from "./interface.js"; +import {createWinstonLogger} from "./winston.js"; export type BrowserLoggerOpts = { /** diff --git a/packages/logger/src/interface.ts b/packages/logger/src/interface.ts index e3ba8483a458..30b219874248 100644 --- a/packages/logger/src/interface.ts +++ b/packages/logger/src/interface.ts @@ -1,5 +1,5 @@ +import {LogData, LogHandler, LogLevel, Logger} from "@lodestar/utils"; import {LEVEL, MESSAGE} from "triple-beam"; -import {LogLevel, Logger, LogHandler, LogData} from "@lodestar/utils"; export {LogLevel, LEVEL, MESSAGE}; export type {Logger, LogHandler, LogData}; diff --git a/packages/logger/src/node.ts b/packages/logger/src/node.ts index fcd9c535dd9e..21786f21c27c 100644 --- a/packages/logger/src/node.ts +++ b/packages/logger/src/node.ts @@ -1,11 +1,11 @@ import path from "node:path"; -import DailyRotateFile from "winston-daily-rotate-file"; -import TransportStream from "winston-transport"; // We want to keep `winston` export as it's more readable and easier to understand /* eslint-disable import/no-named-as-default-member */ import winston from "winston"; import type {Logger as Winston} from "winston"; -import {Logger, LogLevel, TimestampFormat} from "./interface.js"; +import DailyRotateFile from "winston-daily-rotate-file"; +import TransportStream from "winston-transport"; +import {LogLevel, Logger, TimestampFormat} from "./interface.js"; import {ConsoleDynamicLevel} from "./utils/consoleTransport.js"; import {WinstonLogger} from "./winston.js"; diff --git a/packages/logger/src/utils/format.ts b/packages/logger/src/utils/format.ts index 4e657c0040af..8688016b63c9 100644 --- a/packages/logger/src/utils/format.ts +++ b/packages/logger/src/utils/format.ts @@ -1,7 +1,7 @@ -import winston, {format} from "winston"; import {LodestarError, isEmptyObject} from "@lodestar/utils"; +import winston, {format} from "winston"; import {LoggerOptions, TimestampFormatCode} from "../interface.js"; -import {logCtxToJson, logCtxToString, LogData} from "./json.js"; +import {LogData, logCtxToJson, logCtxToString} from "./json.js"; import {formatEpochSlotTime} from "./timeFormat.js"; type Format = ReturnType; diff --git a/packages/logger/src/winston.ts b/packages/logger/src/winston.ts index b886894e6aba..184f27e31335 100644 --- a/packages/logger/src/winston.ts +++ b/packages/logger/src/winston.ts @@ -2,7 +2,7 @@ /* eslint-disable import/no-named-as-default-member */ import winston from "winston"; import type {Logger as Winston} from "winston"; -import {Logger, LoggerOptions, LogLevel, logLevelNum} from "./interface.js"; +import {LogLevel, Logger, LoggerOptions, logLevelNum} from "./interface.js"; import {getFormat} from "./utils/format.js"; import {LogData} from "./utils/json.js"; diff --git a/packages/logger/test/e2e/logger/workerLoggerHandler.ts b/packages/logger/test/e2e/logger/workerLoggerHandler.ts index ab2097171af0..07a2dd6d2287 100644 --- a/packages/logger/test/e2e/logger/workerLoggerHandler.ts +++ b/packages/logger/test/e2e/logger/workerLoggerHandler.ts @@ -1,5 +1,5 @@ import workerThreads from "node:worker_threads"; -import {spawn, Worker} from "@chainsafe/threads"; +import {Worker, spawn} from "@chainsafe/threads"; export type LoggerWorker = { log(data: string): void; diff --git a/packages/logger/test/e2e/logger/workerLogs.test.ts b/packages/logger/test/e2e/logger/workerLogs.test.ts index 01ede8f6e4ec..13b8247e7dc1 100644 --- a/packages/logger/test/e2e/logger/workerLogs.test.ts +++ b/packages/logger/test/e2e/logger/workerLogs.test.ts @@ -1,8 +1,8 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; import {sleep} from "@lodestar/utils"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {LoggerWorker, getLoggerWorker} from "./workerLoggerHandler.js"; // Global variable __dirname no longer available in ES6 modules. diff --git a/packages/logger/test/unit/browser.test.ts b/packages/logger/test/unit/browser.test.ts index 591437450c2d..e415ef79b3be 100644 --- a/packages/logger/test/unit/browser.test.ts +++ b/packages/logger/test/unit/browser.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; -import {LogLevel} from "@lodestar/utils"; import {stubLoggerForConsole} from "@lodestar/test-utils/doubles"; +import {LogLevel} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; +import {getBrowserLogger} from "../../src/browser.js"; import {TimestampFormatCode, logFormats} from "../../src/index.js"; import {formatsTestCases} from "../fixtures/loggerFormats.js"; -import {getBrowserLogger} from "../../src/browser.js"; describe("browser logger", () => { describe("format and options", () => { diff --git a/packages/logger/test/unit/env.node.test.ts b/packages/logger/test/unit/env.node.test.ts index 4bd4df689adf..c1f39424eb0a 100644 --- a/packages/logger/test/unit/env.node.test.ts +++ b/packages/logger/test/unit/env.node.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; -import {LogLevel} from "@lodestar/utils"; import {stubLoggerForConsole} from "@lodestar/test-utils/doubles"; +import {LogLevel} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; +import {getEnvLogger} from "../../src/env.js"; import {TimestampFormatCode, logFormats} from "../../src/index.js"; import {formatsTestCases} from "../fixtures/loggerFormats.js"; -import {getEnvLogger} from "../../src/env.js"; describe("env logger", () => { describe("format and options", () => { diff --git a/packages/logger/test/unit/node.node.test.ts b/packages/logger/test/unit/node.node.test.ts index b7c882a1e3bd..998c7e42e2fb 100644 --- a/packages/logger/test/unit/node.node.test.ts +++ b/packages/logger/test/unit/node.node.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect, vi, afterEach, Mock} from "vitest"; import {LogLevel} from "@lodestar/utils"; +import {Mock, afterEach, describe, expect, it, vi} from "vitest"; import {TimestampFormatCode, logFormats} from "../../src/index.js"; import {getNodeLogger} from "../../src/node.js"; import {formatsTestCases} from "../fixtures/loggerFormats.js"; diff --git a/packages/logger/test/unit/utils/json.test.ts b/packages/logger/test/unit/utils/json.test.ts index 7ca5604edf00..68e3f827e241 100644 --- a/packages/logger/test/unit/utils/json.test.ts +++ b/packages/logger/test/unit/utils/json.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; import {fromHexString, toHexString} from "@chainsafe/ssz"; import {LodestarError} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {logCtxToJson, logCtxToString} from "../../../src/utils/json.js"; describe("Json helper", () => { diff --git a/packages/logger/test/unit/utils/timeFormat.test.ts b/packages/logger/test/unit/utils/timeFormat.test.ts index fc374a0f6c7f..12c0ea97f167 100644 --- a/packages/logger/test/unit/utils/timeFormat.test.ts +++ b/packages/logger/test/unit/utils/timeFormat.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {formatEpochSlotTime} from "../../../src/utils/timeFormat.js"; describe("logger / util / formatEpochSlotTime", () => { diff --git a/packages/logger/test/unit/winston.node.test.ts b/packages/logger/test/unit/winston.node.test.ts index e4cfca2b041a..0db86a18fab9 100644 --- a/packages/logger/test/unit/winston.node.test.ts +++ b/packages/logger/test/unit/winston.node.test.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, expect, beforeAll, afterAll, afterEach, vi, Mock} from "vitest"; import {LogLevel} from "@lodestar/utils"; +import {Mock, afterAll, afterEach, beforeAll, describe, expect, it, vi} from "vitest"; import {TimestampFormatCode} from "../../src/index.js"; import {getNodeLogger} from "../../src/node.js"; import {readFileWhenExists} from "../utils/files.js"; diff --git a/packages/params/src/index.ts b/packages/params/src/index.ts index 544113e3f8e1..82ffa491daa3 100644 --- a/packages/params/src/index.ts +++ b/packages/params/src/index.ts @@ -1,9 +1,9 @@ import {PresetName} from "./presetName.js"; +import {presetStatus} from "./presetStatus.js"; +import {gnosisPreset} from "./presets/gnosis.js"; import {mainnetPreset} from "./presets/mainnet.js"; import {minimalPreset} from "./presets/minimal.js"; -import {gnosisPreset} from "./presets/gnosis.js"; -import {presetStatus} from "./presetStatus.js"; -import {userSelectedPreset, userOverrides} from "./setPreset.js"; +import {userOverrides, userSelectedPreset} from "./setPreset.js"; export type {BeaconPreset} from "./types.js"; export * from "./forkName.js"; diff --git a/packages/params/src/setPreset.ts b/packages/params/src/setPreset.ts index 61836d86a241..1f2a962a868b 100644 --- a/packages/params/src/setPreset.ts +++ b/packages/params/src/setPreset.ts @@ -1,7 +1,7 @@ +import {presetFromJson} from "./json.js"; import {PresetName} from "./presetName.js"; import {presetStatus} from "./presetStatus.js"; import {BeaconPreset} from "./types.js"; -import {presetFromJson} from "./json.js"; export {PresetName, presetFromJson}; diff --git a/packages/params/test/e2e/ensure-config-is-synced.test.ts b/packages/params/test/e2e/ensure-config-is-synced.test.ts index c54b0d4d44f8..ab34c16201c8 100644 --- a/packages/params/test/e2e/ensure-config-is-synced.test.ts +++ b/packages/params/test/e2e/ensure-config-is-synced.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, vi} from "vitest"; import axios from "axios"; +import {describe, expect, it, vi} from "vitest"; +import {BeaconPreset, ForkName} from "../../src/index.js"; import {mainnetPreset} from "../../src/presets/mainnet.js"; import {minimalPreset} from "../../src/presets/minimal.js"; -import {ForkName, BeaconPreset} from "../../src/index.js"; import {loadConfigYaml} from "../yaml.js"; // Not e2e, but slow. Run with e2e tests diff --git a/packages/params/test/e2e/overridePreset.test.ts b/packages/params/test/e2e/overridePreset.test.ts index df7afbbf84da..aa609b5e8f75 100644 --- a/packages/params/test/e2e/overridePreset.test.ts +++ b/packages/params/test/e2e/overridePreset.test.ts @@ -1,8 +1,8 @@ -import path from "node:path"; -import util from "node:util"; import child from "node:child_process"; +import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect, vi} from "vitest"; +import util from "node:util"; +import {describe, expect, it, vi} from "vitest"; const scriptNames = { ok: "overridePresetOk.ts", diff --git a/packages/params/test/e2e/overridePresetError.ts b/packages/params/test/e2e/overridePresetError.ts index 869f521d33b5..aeb544115c61 100644 --- a/packages/params/test/e2e/overridePresetError.ts +++ b/packages/params/test/e2e/overridePresetError.ts @@ -3,6 +3,6 @@ // 1. Import from not only @lodestar/params/setPreset will trigger an error import "../../lib/index.js"; -import {setActivePreset, PresetName} from "../../lib/setPreset.js"; +import {PresetName, setActivePreset} from "../../lib/setPreset.js"; // This line should throw setActivePreset(PresetName.minimal, {SLOTS_PER_EPOCH: 2}); diff --git a/packages/params/test/e2e/overridePresetOk.ts b/packages/params/test/e2e/overridePresetOk.ts index 8887155b5400..f82d9eb42eb3 100644 --- a/packages/params/test/e2e/overridePresetOk.ts +++ b/packages/params/test/e2e/overridePresetOk.ts @@ -5,7 +5,7 @@ import assert from "node:assert"; // It demonstrates how to properly change the Lodestar preset safely // 1. Import from @lodestar/params/setPreset only -import {setActivePreset, PresetName} from "../../src/setPreset.js"; +import {PresetName, setActivePreset} from "../../src/setPreset.js"; setActivePreset(PresetName.minimal, {SLOTS_PER_EPOCH: 2}); // 2. Import from any other @lodestar/params paths diff --git a/packages/params/test/e2e/setPreset.test.ts b/packages/params/test/e2e/setPreset.test.ts index 2108a4f23342..d75cf9861869 100644 --- a/packages/params/test/e2e/setPreset.test.ts +++ b/packages/params/test/e2e/setPreset.test.ts @@ -1,8 +1,8 @@ -import path from "node:path"; -import util from "node:util"; import child from "node:child_process"; +import path from "node:path"; import {fileURLToPath} from "node:url"; -import {describe, it, expect, vi} from "vitest"; +import util from "node:util"; +import {describe, expect, it, vi} from "vitest"; const scriptNames = { ok: "setPresetOk.ts", diff --git a/packages/params/test/e2e/setPresetError.ts b/packages/params/test/e2e/setPresetError.ts index debbb47f013d..362e7da5ce46 100644 --- a/packages/params/test/e2e/setPresetError.ts +++ b/packages/params/test/e2e/setPresetError.ts @@ -3,6 +3,6 @@ // 1. Import from not only @lodestar/params/setPreset will trigger an error import "../../lib/index.js"; -import {setActivePreset, PresetName} from "../../lib/setPreset.js"; +import {PresetName, setActivePreset} from "../../lib/setPreset.js"; // This line should throw setActivePreset(PresetName.minimal); diff --git a/packages/params/test/e2e/setPresetOk.ts b/packages/params/test/e2e/setPresetOk.ts index 5e76149b293a..a5b291db0047 100644 --- a/packages/params/test/e2e/setPresetOk.ts +++ b/packages/params/test/e2e/setPresetOk.ts @@ -3,7 +3,7 @@ // It demostrates how to properly change the Lodestar preset safely // 1. Import from @lodestar/params/setPreset only -import {setActivePreset, PresetName} from "../../src/setPreset.js"; +import {PresetName, setActivePreset} from "../../src/setPreset.js"; setActivePreset(PresetName.minimal); // 2. Import from any other @lodestar/params paths diff --git a/packages/params/test/unit/activePreset.test.ts b/packages/params/test/unit/activePreset.test.ts index 3aeee69672a1..7035053a9efc 100644 --- a/packages/params/test/unit/activePreset.test.ts +++ b/packages/params/test/unit/activePreset.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, beforeAll} from "vitest"; +import {beforeAll, describe, expect, it} from "vitest"; +import {ACTIVE_PRESET, PresetName} from "../../src/index.js"; +import {gnosisPreset as gnosisParams} from "../../src/presets/gnosis.js"; import {mainnetPreset} from "../../src/presets/mainnet.js"; import {minimalPreset} from "../../src/presets/minimal.js"; -import {gnosisPreset as gnosisParams} from "../../src/presets/gnosis.js"; -import {ACTIVE_PRESET, PresetName} from "../../src/index.js"; import {setActivePreset} from "../../src/setPreset.js"; import {setActivePreset as setActivePresetLib} from "../../src/setPreset.js"; diff --git a/packages/params/test/unit/applicationDomains.test.ts b/packages/params/test/unit/applicationDomains.test.ts index f78e9aa22f07..8192de56dc1a 100644 --- a/packages/params/test/unit/applicationDomains.test.ts +++ b/packages/params/test/unit/applicationDomains.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {DOMAIN_APPLICATION_MASK, DOMAIN_APPLICATION_BUILDER} from "../../src/index.js"; +import {describe, expect, it} from "vitest"; +import {DOMAIN_APPLICATION_BUILDER, DOMAIN_APPLICATION_MASK} from "../../src/index.js"; describe("validate application domains", () => { [{name: "builder domain", domain: DOMAIN_APPLICATION_BUILDER}].map(({name, domain}) => { diff --git a/packages/params/test/unit/forkName.test.ts b/packages/params/test/unit/forkName.test.ts index 4385c1e10d8a..70e3b6d38411 100644 --- a/packages/params/test/unit/forkName.test.ts +++ b/packages/params/test/unit/forkName.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { ForkName, forkAll, diff --git a/packages/params/test/yaml.ts b/packages/params/test/yaml.ts index f56016a4dbc0..a5eac0ed4320 100644 --- a/packages/params/test/yaml.ts +++ b/packages/params/test/yaml.ts @@ -1,4 +1,4 @@ -import {load, FAILSAFE_SCHEMA, Type} from "js-yaml"; +import {FAILSAFE_SCHEMA, Type, load} from "js-yaml"; export function loadConfigYaml(configYaml: string): Record { return load(configYaml, {schema}) as Record; diff --git a/packages/prover/src/cli/applyPreset.ts b/packages/prover/src/cli/applyPreset.ts index f0c3d83c7751..4c1cfbaf757c 100644 --- a/packages/prover/src/cli/applyPreset.ts +++ b/packages/prover/src/cli/applyPreset.ts @@ -21,7 +21,7 @@ setHasher(hasher); // set LODESTAR_PRESET manually every time. // IMPORTANT: only import Lodestar code here which does not import any other Lodestar libraries -import {setActivePreset, presetFromJson, PresetName} from "@lodestar/params/setPreset"; +import {PresetName, presetFromJson, setActivePreset} from "@lodestar/params/setPreset"; import {readFile} from "../utils/file.js"; const network = valueOfArg("network"); diff --git a/packages/prover/src/cli/cli.ts b/packages/prover/src/cli/cli.ts index 5e084a551536..fcd26b2c7b49 100644 --- a/packages/prover/src/cli/cli.ts +++ b/packages/prover/src/cli/cli.ts @@ -1,7 +1,7 @@ +import {registerCommandToYargs} from "@lodestar/utils"; // Must not use `* as yargs`, see https://github.com/yargs/yargs/issues/1131 import yargs from "yargs"; import {hideBin} from "yargs/helpers"; -import {registerCommandToYargs} from "@lodestar/utils"; import {getVersionData} from "../utils/version.js"; import {cmds, proverProxyStartCommand} from "./cmds/index.js"; import {globalOptions} from "./options.js"; diff --git a/packages/prover/src/cli/cmds/start/handler.ts b/packages/prover/src/cli/cmds/start/handler.ts index 92922f1a45a4..e5fa5d402dfd 100644 --- a/packages/prover/src/cli/cmds/start/handler.ts +++ b/packages/prover/src/cli/cmds/start/handler.ts @@ -1,8 +1,8 @@ import {ChainConfig, chainConfigFromJson} from "@lodestar/config"; import {readFile} from "../../../utils/file.js"; -import {createVerifiedExecutionProxy, VerifiedProxyOptions} from "../../../web3_proxy.js"; +import {VerifiedProxyOptions, createVerifiedExecutionProxy} from "../../../web3_proxy.js"; import {GlobalArgs, parseGlobalArgs} from "../../options.js"; -import {parseStartArgs, StartArgs} from "./options.js"; +import {StartArgs, parseStartArgs} from "./options.js"; /** * Runs a beacon node. diff --git a/packages/prover/src/cli/options.ts b/packages/prover/src/cli/options.ts index c37250070056..36ab331ceb78 100644 --- a/packages/prover/src/cli/options.ts +++ b/packages/prover/src/cli/options.ts @@ -1,6 +1,6 @@ import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; -import {CliCommandOptions, LogLevel, LogLevels} from "@lodestar/utils"; import {ACTIVE_PRESET} from "@lodestar/params"; +import {CliCommandOptions, LogLevel, LogLevels} from "@lodestar/utils"; import {YargsError} from "../utils/errors.js"; export type GlobalArgs = { diff --git a/packages/prover/src/interfaces.ts b/packages/prover/src/interfaces.ts index 9a67b47ea3b3..c62d17e7f0f5 100644 --- a/packages/prover/src/interfaces.ts +++ b/packages/prover/src/interfaces.ts @@ -1,6 +1,6 @@ import {ChainConfig} from "@lodestar/config"; import {NetworkName} from "@lodestar/config/networks"; -import {Logger, LogLevel} from "@lodestar/utils"; +import {LogLevel, Logger} from "@lodestar/utils"; import {ProofProvider} from "./proof_provider/proof_provider.js"; import {JsonRpcRequest, JsonRpcRequestOrBatch, JsonRpcResponse, JsonRpcResponseOrBatch} from "./types.js"; import {ELRpcProvider} from "./utils/rpc_provider.js"; diff --git a/packages/prover/src/proof_provider/payload_store.ts b/packages/prover/src/proof_provider/payload_store.ts index c891cb994da1..4cf5dff36ac6 100644 --- a/packages/prover/src/proof_provider/payload_store.ts +++ b/packages/prover/src/proof_provider/payload_store.ts @@ -1,7 +1,7 @@ import {ApiClient} from "@lodestar/api"; -import {Logger} from "@lodestar/utils"; -import {ExecutionPayload, LightClientHeader} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; +import {ExecutionPayload, LightClientHeader} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {MAX_PAYLOAD_HISTORY} from "../constants.js"; import {fetchBlock, getExecutionPayloadForBlockNumber} from "../utils/consensus.js"; import {bufferToHex, hexToNumber} from "../utils/conversion.js"; diff --git a/packages/prover/src/proof_provider/proof_provider.ts b/packages/prover/src/proof_provider/proof_provider.ts index 3a95b0e4e604..fbf025c377ad 100644 --- a/packages/prover/src/proof_provider/proof_provider.ts +++ b/packages/prover/src/proof_provider/proof_provider.ts @@ -4,8 +4,8 @@ import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; import {Lightclient, LightclientEvent, RunStatusCode} from "@lodestar/light-client"; import {LightClientRestTransport} from "@lodestar/light-client/transport"; import {ForkName, isForkWithdrawals} from "@lodestar/params"; -import {Logger} from "@lodestar/utils"; import {ExecutionPayload, LightClientHeader} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {LCTransport, RootProviderInitOptions} from "../interfaces.js"; import {assertLightClient} from "../utils/assertion.js"; import { diff --git a/packages/prover/src/utils/consensus.ts b/packages/prover/src/utils/consensus.ts index ac8fd24d139f..d157bf1cf15c 100644 --- a/packages/prover/src/utils/consensus.ts +++ b/packages/prover/src/utils/consensus.ts @@ -1,6 +1,6 @@ import {ApiClient} from "@lodestar/api/beacon"; -import {Bytes32, ExecutionPayload, capella} from "@lodestar/types"; import {GenesisData, Lightclient} from "@lodestar/light-client"; +import {Bytes32, ExecutionPayload, capella} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; import {MAX_PAYLOAD_HISTORY} from "../constants.js"; import {hexToBuffer} from "./conversion.js"; diff --git a/packages/prover/src/utils/evm.ts b/packages/prover/src/utils/evm.ts index 40950647b8f3..391dd302c7ad 100644 --- a/packages/prover/src/utils/evm.ts +++ b/packages/prover/src/utils/evm.ts @@ -1,19 +1,19 @@ +import {Block, BlockHeader} from "@ethereumjs/block"; import {Blockchain} from "@ethereumjs/blockchain"; -import {Account, Address} from "@ethereumjs/util"; -import {VM, RunTxResult} from "@ethereumjs/vm"; import {TransactionFactory} from "@ethereumjs/tx"; -import {Block, BlockHeader} from "@ethereumjs/block"; +import {Account, Address} from "@ethereumjs/util"; +import {RunTxResult, VM} from "@ethereumjs/vm"; import {NetworkName} from "@lodestar/config/networks"; -import {Logger} from "@lodestar/utils"; import {ExecutionPayload} from "@lodestar/types"; +import {Logger} from "@lodestar/utils"; import {ZERO_ADDRESS} from "../constants.js"; import {ProofProvider} from "../proof_provider/proof_provider.js"; import {ELBlock, ELProof, ELTransaction, JsonRpcVersion} from "../types.js"; import {bufferToHex, chunkIntoN, cleanObject, hexToBigInt, hexToBuffer, numberToHex, padLeft} from "./conversion.js"; import {getChainCommon, getTxType} from "./execution.js"; import {isValidResponse} from "./json_rpc.js"; -import {isNullish, isValidAccount, isValidCodeHash, isValidStorageKeys} from "./validation.js"; import {ELRpcProvider} from "./rpc_provider.js"; +import {isNullish, isValidAccount, isValidCodeHash, isValidStorageKeys} from "./validation.js"; export async function createVM({proofProvider}: {proofProvider: ProofProvider}): Promise { const common = getChainCommon(proofProvider.config.PRESET_BASE as string); diff --git a/packages/prover/src/utils/execution.ts b/packages/prover/src/utils/execution.ts index 91d5f8d625ff..8ce9d71857f3 100644 --- a/packages/prover/src/utils/execution.ts +++ b/packages/prover/src/utils/execution.ts @@ -1,8 +1,8 @@ import {Common, CustomChain, Hardfork} from "@ethereumjs/common"; import {ELApiParams, ELApiReturn, ELTransaction} from "../types.js"; import {isValidResponse} from "./json_rpc.js"; -import {isBlockNumber, isPresent} from "./validation.js"; import {ELRpcProvider} from "./rpc_provider.js"; +import {isBlockNumber, isPresent} from "./validation.js"; export type Optional = Omit & {[P in keyof T]?: T[P] | undefined}; diff --git a/packages/prover/src/utils/gitData/gitDataPath.ts b/packages/prover/src/utils/gitData/gitDataPath.ts index 1ad3104aafc6..b4c7f8c7c62c 100644 --- a/packages/prover/src/utils/gitData/gitDataPath.ts +++ b/packages/prover/src/utils/gitData/gitDataPath.ts @@ -1,5 +1,5 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import {fileURLToPath} from "node:url"; // Global variable __dirname no longer available in ES6 modules. diff --git a/packages/prover/src/utils/gitData/index.ts b/packages/prover/src/utils/gitData/index.ts index 0720d39d9e30..c5681660f8ce 100644 --- a/packages/prover/src/utils/gitData/index.ts +++ b/packages/prover/src/utils/gitData/index.ts @@ -2,7 +2,7 @@ import {execSync} from "node:child_process"; // This file is created in the build step and is distributed through NPM // MUST be in sync with `-/gitDataPath.ts` and `package.json` files. -import {readGitDataFile, GitData} from "./gitDataPath.js"; +import {GitData, readGitDataFile} from "./gitDataPath.js"; /** Reads git data from a persisted file or local git data at build time. */ export function readAndGetGitData(): GitData { diff --git a/packages/prover/src/utils/json_rpc.ts b/packages/prover/src/utils/json_rpc.ts index 74727c198122..d0d2bc850fd0 100644 --- a/packages/prover/src/utils/json_rpc.ts +++ b/packages/prover/src/utils/json_rpc.ts @@ -1,17 +1,17 @@ import {Logger} from "@lodestar/logger"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../constants.js"; import { + JsonRpcBatchRequest, + JsonRpcBatchResponse, JsonRpcErrorPayload, JsonRpcNotificationPayload, - JsonRpcRequestPayload, JsonRpcRequest, + JsonRpcRequestOrBatch, + JsonRpcRequestPayload, JsonRpcResponse, + JsonRpcResponseOrBatch, JsonRpcResponseWithErrorPayload, JsonRpcResponseWithResultPayload, - JsonRpcResponseOrBatch, - JsonRpcBatchResponse, - JsonRpcRequestOrBatch, - JsonRpcBatchRequest, } from "../types.js"; import {isNullish} from "./validation.js"; diff --git a/packages/prover/src/utils/process.ts b/packages/prover/src/utils/process.ts index 75bb79516609..b8464edd7ac8 100644 --- a/packages/prover/src/utils/process.ts +++ b/packages/prover/src/utils/process.ts @@ -1,17 +1,17 @@ import {Logger} from "@lodestar/logger"; import {ELVerifiedRequestHandler} from "../interfaces.js"; import {ProofProvider} from "../proof_provider/proof_provider.js"; -import {JsonRpcRequestOrBatch, JsonRpcBatchRequest, JsonRpcResponseOrBatch, JsonRpcBatchResponse} from "../types.js"; +import {JsonRpcBatchRequest, JsonRpcBatchResponse, JsonRpcRequestOrBatch, JsonRpcResponseOrBatch} from "../types.js"; +import {eth_call} from "../verified_requests/eth_call.js"; +import {eth_estimateGas} from "../verified_requests/eth_estimateGas.js"; import {eth_getBalance} from "../verified_requests/eth_getBalance.js"; -import {eth_getTransactionCount} from "../verified_requests/eth_getTransactionCount.js"; import {eth_getBlockByHash} from "../verified_requests/eth_getBlockByHash.js"; import {eth_getBlockByNumber} from "../verified_requests/eth_getBlockByNumber.js"; import {eth_getCode} from "../verified_requests/eth_getCode.js"; -import {eth_call} from "../verified_requests/eth_call.js"; -import {eth_estimateGas} from "../verified_requests/eth_estimateGas.js"; +import {eth_getTransactionCount} from "../verified_requests/eth_getTransactionCount.js"; import {getResponseForRequest, isBatchRequest, isRequest} from "./json_rpc.js"; -import {isNullish} from "./validation.js"; import {ELRpcProvider} from "./rpc_provider.js"; +import {isNullish} from "./validation.js"; // biome-ignore lint/suspicious/noExplicitAny: export const verifiableMethodHandlers: Record> = { diff --git a/packages/prover/src/utils/validation.ts b/packages/prover/src/utils/validation.ts index 3adc37571db5..085798c875bc 100644 --- a/packages/prover/src/utils/validation.ts +++ b/packages/prover/src/utils/validation.ts @@ -2,10 +2,10 @@ import {Block} from "@ethereumjs/block"; import {RLP} from "@ethereumjs/rlp"; import {Trie} from "@ethereumjs/trie"; import {Account, KECCAK256_NULL_S} from "@ethereumjs/util"; -import {keccak256} from "ethereum-cryptography/keccak.js"; +import {ChainForkConfig} from "@lodestar/config"; import {Bytes32, ExecutionPayload} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; -import {ChainForkConfig} from "@lodestar/config"; +import {keccak256} from "ethereum-cryptography/keccak.js"; import {ELBlock, ELProof, ELStorageProof, HexString} from "../types.js"; import {blockDataFromELBlock, bufferToHex, hexToBuffer, padLeft} from "./conversion.js"; import {getChainCommon} from "./execution.js"; diff --git a/packages/prover/src/utils/verification.ts b/packages/prover/src/utils/verification.ts index a468bf277eba..fb304bf34936 100644 --- a/packages/prover/src/utils/verification.ts +++ b/packages/prover/src/utils/verification.ts @@ -3,8 +3,8 @@ import {ProofProvider} from "../proof_provider/proof_provider.js"; import {ELBlock, ELProof, HexString, JsonRpcRequest} from "../types.js"; import {bufferToHex} from "./conversion.js"; import {getELBlock, getELCode, getELProof} from "./execution.js"; -import {isValidAccount, isValidBlock, isValidCodeHash, isValidStorageKeys} from "./validation.js"; import {ELRpcProvider} from "./rpc_provider.js"; +import {isValidAccount, isValidBlock, isValidCodeHash, isValidStorageKeys} from "./validation.js"; type VerificationResult = {data: T; valid: true} | {valid: false; data?: undefined}; diff --git a/packages/prover/src/verified_requests/eth_call.ts b/packages/prover/src/verified_requests/eth_call.ts index eea7ba146c3f..2b28f699fb5b 100644 --- a/packages/prover/src/verified_requests/eth_call.ts +++ b/packages/prover/src/verified_requests/eth_call.ts @@ -3,8 +3,8 @@ import {ELApiParams, ELApiReturn} from "../types.js"; import {bufferToHex} from "../utils/conversion.js"; import {createVM, executeVMCall, getVMWithState} from "../utils/evm.js"; import { - getResponseForRequest, getErrorResponseForRequestWithFailedVerification, + getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; diff --git a/packages/prover/src/verified_requests/eth_getBalance.ts b/packages/prover/src/verified_requests/eth_getBalance.ts index 0c03b23be788..c1e1749bebf8 100644 --- a/packages/prover/src/verified_requests/eth_getBalance.ts +++ b/packages/prover/src/verified_requests/eth_getBalance.ts @@ -1,10 +1,10 @@ import {ELVerifiedRequestHandler} from "../interfaces.js"; -import {verifyAccount} from "../utils/verification.js"; import { getErrorResponseForRequestWithFailedVerification, getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; +import {verifyAccount} from "../utils/verification.js"; export const eth_getBalance: ELVerifiedRequestHandler<[address: string, block?: number | string], string> = async ({ rpc, diff --git a/packages/prover/src/verified_requests/eth_getBlockByHash.ts b/packages/prover/src/verified_requests/eth_getBlockByHash.ts index 00a110c01e9a..b1374865aa34 100644 --- a/packages/prover/src/verified_requests/eth_getBlockByHash.ts +++ b/packages/prover/src/verified_requests/eth_getBlockByHash.ts @@ -1,11 +1,11 @@ import {ELVerifiedRequestHandler} from "../interfaces.js"; import {ELBlock} from "../types.js"; -import {verifyBlock} from "../utils/verification.js"; import { getErrorResponseForRequestWithFailedVerification, getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; +import {verifyBlock} from "../utils/verification.js"; export const eth_getBlockByHash: ELVerifiedRequestHandler<[block: string, hydrated: boolean], ELBlock> = async ({ rpc, diff --git a/packages/prover/src/verified_requests/eth_getBlockByNumber.ts b/packages/prover/src/verified_requests/eth_getBlockByNumber.ts index 23e0fa2ca863..c54c219be91f 100644 --- a/packages/prover/src/verified_requests/eth_getBlockByNumber.ts +++ b/packages/prover/src/verified_requests/eth_getBlockByNumber.ts @@ -1,11 +1,11 @@ import {ELVerifiedRequestHandler} from "../interfaces.js"; import {ELBlock} from "../types.js"; -import {verifyBlock} from "../utils/verification.js"; import { getErrorResponseForRequestWithFailedVerification, getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; +import {verifyBlock} from "../utils/verification.js"; export const eth_getBlockByNumber: ELVerifiedRequestHandler< [block: string | number, hydrated: boolean], diff --git a/packages/prover/src/verified_requests/eth_getCode.ts b/packages/prover/src/verified_requests/eth_getCode.ts index f94ae8c1c8bd..1132ec089b24 100644 --- a/packages/prover/src/verified_requests/eth_getCode.ts +++ b/packages/prover/src/verified_requests/eth_getCode.ts @@ -1,10 +1,10 @@ import {ELVerifiedRequestHandler} from "../interfaces.js"; -import {verifyAccount, verifyCode} from "../utils/verification.js"; import { getErrorResponseForRequestWithFailedVerification, getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; +import {verifyAccount, verifyCode} from "../utils/verification.js"; export const eth_getCode: ELVerifiedRequestHandler<[address: string, block?: number | string], string> = async ({ rpc, diff --git a/packages/prover/src/verified_requests/eth_getTransactionCount.ts b/packages/prover/src/verified_requests/eth_getTransactionCount.ts index aeef67e96e74..ceb7c0797a81 100644 --- a/packages/prover/src/verified_requests/eth_getTransactionCount.ts +++ b/packages/prover/src/verified_requests/eth_getTransactionCount.ts @@ -1,10 +1,10 @@ import {ELVerifiedRequestHandler} from "../interfaces.js"; -import {verifyAccount} from "../utils/verification.js"; import { - getResponseForRequest, getErrorResponseForRequestWithFailedVerification, + getResponseForRequest, getVerificationFailedMessage, } from "../utils/json_rpc.js"; +import {verifyAccount} from "../utils/verification.js"; export const eth_getTransactionCount: ELVerifiedRequestHandler< [address: string, block?: number | string], diff --git a/packages/prover/src/web3_provider.ts b/packages/prover/src/web3_provider.ts index b42c349d1017..a28d43fa0b7b 100644 --- a/packages/prover/src/web3_provider.ts +++ b/packages/prover/src/web3_provider.ts @@ -3,9 +3,9 @@ import {getBrowserLogger} from "@lodestar/logger/browser"; import {Logger} from "@lodestar/utils"; import {AnyWeb3Provider, ELRequestHandler, VerifiedExecutionInitOptions} from "./interfaces.js"; import {ProofProvider} from "./proof_provider/proof_provider.js"; +import {processAndVerifyRequest} from "./utils/process.js"; import {ELRpcProvider} from "./utils/rpc_provider.js"; import {Web3ProviderInspector} from "./web3_provider_inspector.js"; -import {processAndVerifyRequest} from "./utils/process.js"; export type Web3ProviderTypeHandler = ( provider: T, diff --git a/packages/prover/src/web3_provider_inspector.ts b/packages/prover/src/web3_provider_inspector.ts index 154a860d0922..4cbcb221fc64 100644 --- a/packages/prover/src/web3_provider_inspector.ts +++ b/packages/prover/src/web3_provider_inspector.ts @@ -1,10 +1,10 @@ import {Logger} from "@lodestar/logger"; import {AnyWeb3Provider, Web3ProviderType} from "./interfaces.js"; -import web3jsProviderType from "./provider_types/web3_js_provider_type.js"; -import ethersProviderType from "./provider_types/ethers_provider_type.js"; import eip1193ProviderType from "./provider_types/eip1193_provider_type.js"; +import ethersProviderType from "./provider_types/ethers_provider_type.js"; import legacyProviderType from "./provider_types/legacy_provider_type.js"; +import web3jsProviderType from "./provider_types/web3_js_provider_type.js"; export class Web3ProviderInspector { protected providerTypes: Web3ProviderType[] = []; diff --git a/packages/prover/src/web3_proxy.ts b/packages/prover/src/web3_proxy.ts index 273508852adf..d74eb1319e60 100644 --- a/packages/prover/src/web3_proxy.ts +++ b/packages/prover/src/web3_proxy.ts @@ -1,15 +1,15 @@ import http from "node:http"; import https from "node:https"; import url from "node:url"; -import httpProxy from "http-proxy"; -import {getNodeLogger} from "@lodestar/logger/node"; import {LogLevel} from "@lodestar/logger"; +import {getNodeLogger} from "@lodestar/logger/node"; +import httpProxy from "http-proxy"; import {ELRequestHandler, VerifiedExecutionInitOptions} from "./interfaces.js"; import {ProofProvider} from "./proof_provider/proof_provider.js"; import {JsonRpcRequestOrBatch, JsonRpcRequestPayload, JsonRpcResponseOrBatch} from "./types.js"; import {getResponseForRequest, isBatchRequest} from "./utils/json_rpc.js"; -import {fetchRequestPayload, fetchResponseBody} from "./utils/req_resp.js"; import {processAndVerifyRequest} from "./utils/process.js"; +import {fetchRequestPayload, fetchResponseBody} from "./utils/req_resp.js"; import {ELRpcProvider} from "./utils/rpc_provider.js"; export type VerifiedProxyOptions = Exclude, "mutateProvider" | "providerTypes"> & { diff --git a/packages/prover/test/e2e/cli/cmds/start.test.ts b/packages/prover/test/e2e/cli/cmds/start.test.ts index 75773ac02d36..ffdad63f1bd7 100644 --- a/packages/prover/test/e2e/cli/cmds/start.test.ts +++ b/packages/prover/test/e2e/cli/cmds/start.test.ts @@ -1,13 +1,13 @@ import childProcess from "node:child_process"; -import {writeFile, mkdir} from "node:fs/promises"; +import {mkdir, writeFile} from "node:fs/promises"; import path from "node:path"; -import {describe, it, expect, beforeAll, afterAll} from "vitest"; -import {Web3} from "web3"; +import {ChainConfig, chainConfigToJson} from "@lodestar/config"; import {runCliCommand, spawnCliCommand, stopChildProcess} from "@lodestar/test-utils"; import {sleep} from "@lodestar/utils"; -import {ChainConfig, chainConfigToJson} from "@lodestar/config"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; +import {Web3} from "web3"; import {getLodestarProverCli} from "../../../../src/cli/cli.js"; -import {rpcUrl, beaconUrl, proxyPort, proxyUrl, chainId, waitForCapellaFork, config} from "../../../utils/e2e_env.js"; +import {beaconUrl, chainId, config, proxyPort, proxyUrl, rpcUrl, waitForCapellaFork} from "../../../utils/e2e_env.js"; const cli = getLodestarProverCli(); diff --git a/packages/prover/test/e2e/web3_batch_request.test.ts b/packages/prover/test/e2e/web3_batch_request.test.ts index 6dae04a9c36d..ea265057ef8d 100644 --- a/packages/prover/test/e2e/web3_batch_request.test.ts +++ b/packages/prover/test/e2e/web3_batch_request.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeAll, vi} from "vitest"; +import {beforeAll, describe, expect, it, vi} from "vitest"; import {Web3} from "web3"; import {LCTransport} from "../../src/interfaces.js"; -import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; -import {rpcUrl, beaconUrl, config, waitForCapellaFork, minCapellaTimeMs} from "../utils/e2e_env.js"; import {getVerificationFailedMessage} from "../../src/utils/json_rpc.js"; +import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; +import {beaconUrl, config, minCapellaTimeMs, rpcUrl, waitForCapellaFork} from "../utils/e2e_env.js"; describe("web3_batch_requests", () => { vi.setConfig({hookTimeout: minCapellaTimeMs}); diff --git a/packages/prover/test/e2e/web3_provider.test.ts b/packages/prover/test/e2e/web3_provider.test.ts index edb3bb09e2fb..7f11a6ca1619 100644 --- a/packages/prover/test/e2e/web3_provider.test.ts +++ b/packages/prover/test/e2e/web3_provider.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeAll, vi} from "vitest"; -import {Web3} from "web3"; import {ethers} from "ethers"; +import {beforeAll, describe, expect, it, vi} from "vitest"; +import {Web3} from "web3"; import {LCTransport} from "../../src/interfaces.js"; import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; -import {waitForCapellaFork, minCapellaTimeMs, rpcUrl, beaconUrl, config} from "../utils/e2e_env.js"; +import {beaconUrl, config, minCapellaTimeMs, rpcUrl, waitForCapellaFork} from "../utils/e2e_env.js"; describe("web3_provider", () => { vi.setConfig({hookTimeout: minCapellaTimeMs}); diff --git a/packages/prover/test/mocks/request_handler.ts b/packages/prover/test/mocks/request_handler.ts index edde1e59a3fe..2b37cc134a36 100644 --- a/packages/prover/test/mocks/request_handler.ts +++ b/packages/prover/test/mocks/request_handler.ts @@ -1,10 +1,10 @@ -import {vi, expect} from "vitest"; -import {when} from "vitest-when"; -import deepmerge from "deepmerge"; -import {NetworkName} from "@lodestar/config/networks"; import {ForkConfig} from "@lodestar/config"; -import {PresetName} from "@lodestar/params"; +import {NetworkName} from "@lodestar/config/networks"; import {getEmptyLogger} from "@lodestar/logger/empty"; +import {PresetName} from "@lodestar/params"; +import deepmerge from "deepmerge"; +import {expect, vi} from "vitest"; +import {when} from "vitest-when"; import {ELVerifiedRequestHandlerOpts} from "../../src/interfaces.js"; import {ProofProvider} from "../../src/proof_provider/proof_provider.js"; import { @@ -18,8 +18,8 @@ import { JsonRpcResponseOrBatch, JsonRpcVersion, } from "../../src/types.js"; -import {isNullish} from "../../src/utils/validation.js"; import {isBatchRequest, mergeBatchReqResp} from "../../src/utils/json_rpc.js"; +import {isNullish} from "../../src/utils/validation.js"; type Writeable = { -readonly [K in keyof T]?: T[K] extends object ? Writeable : T[K]; diff --git a/packages/prover/test/unit/proof_provider/orderd_map.test.ts b/packages/prover/test/unit/proof_provider/orderd_map.test.ts index 309c4de71568..eadf76af8b59 100644 --- a/packages/prover/test/unit/proof_provider/orderd_map.test.ts +++ b/packages/prover/test/unit/proof_provider/orderd_map.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {OrderedMap} from "../../../src/proof_provider/ordered_map.js"; describe("proof_provider/ordered_map", () => { diff --git a/packages/prover/test/unit/proof_provider/payload_store.test.ts b/packages/prover/test/unit/proof_provider/payload_store.test.ts index 6bc1e4265205..76007f2a1e22 100644 --- a/packages/prover/test/unit/proof_provider/payload_store.test.ts +++ b/packages/prover/test/unit/proof_provider/payload_store.test.ts @@ -1,13 +1,13 @@ -import {describe, it, expect, beforeEach, vi, MockedObject} from "vitest"; -import {when} from "vitest-when"; import {ApiClient, ApiResponse, HttpStatusCode, routes} from "@lodestar/api"; -import {hash} from "@lodestar/utils"; import {Logger} from "@lodestar/logger"; +import {ForkName} from "@lodestar/params"; import {ExecutionPayload, SignedBeaconBlock, capella} from "@lodestar/types"; +import {hash} from "@lodestar/utils"; import {toHexString} from "@lodestar/utils"; -import {ForkName} from "@lodestar/params"; -import {PayloadStore} from "../../../src/proof_provider/payload_store.js"; +import {MockedObject, beforeEach, describe, expect, it, vi} from "vitest"; +import {when} from "vitest-when"; import {MAX_PAYLOAD_HISTORY} from "../../../src/constants.js"; +import {PayloadStore} from "../../../src/proof_provider/payload_store.js"; const slotNumber = 10; const createHash = (input: string): Uint8Array => hash(Buffer.from(input, "utf8")); diff --git a/packages/prover/test/unit/provider_types/ethers_provider_type.test.ts b/packages/prover/test/unit/provider_types/ethers_provider_type.test.ts index c24252d9548f..b35106d493cb 100644 --- a/packages/prover/test/unit/provider_types/ethers_provider_type.test.ts +++ b/packages/prover/test/unit/provider_types/ethers_provider_type.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {ethers} from "ethers"; +import {describe, expect, it} from "vitest"; import {Web3} from "web3"; import ethersProviderType from "../../../src/provider_types/ethers_provider_type.js"; diff --git a/packages/prover/test/unit/provider_types/legacy_provider_type.test.ts b/packages/prover/test/unit/provider_types/legacy_provider_type.test.ts index 37ffc18e58ab..bdb532788845 100644 --- a/packages/prover/test/unit/provider_types/legacy_provider_type.test.ts +++ b/packages/prover/test/unit/provider_types/legacy_provider_type.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {ethers} from "ethers"; +import {describe, expect, it} from "vitest"; import {Web3} from "web3"; import legacyProviderType from "../../../src/provider_types/legacy_provider_type.js"; diff --git a/packages/prover/test/unit/provider_types/web3js_provider_type.test.ts b/packages/prover/test/unit/provider_types/web3js_provider_type.test.ts index 54da395bca25..badb066c0bc1 100644 --- a/packages/prover/test/unit/provider_types/web3js_provider_type.test.ts +++ b/packages/prover/test/unit/provider_types/web3js_provider_type.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {ethers} from "ethers"; +import {describe, expect, it} from "vitest"; import {Web3} from "web3"; import web3jsProviderType from "../../../src/provider_types/web3_js_provider_type.js"; diff --git a/packages/prover/test/unit/utils/conversion.test.ts b/packages/prover/test/unit/utils/conversion.test.ts index ee9c16b9cb94..8b0c1476b5ac 100644 --- a/packages/prover/test/unit/utils/conversion.test.ts +++ b/packages/prover/test/unit/utils/conversion.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {chunkIntoN} from "../../../src/utils/conversion.js"; describe("utils/conversion", () => { diff --git a/packages/prover/test/unit/utils/execution.test.ts b/packages/prover/test/unit/utils/execution.test.ts index 9219b5ec0c03..5b9443c95bb4 100644 --- a/packages/prover/test/unit/utils/execution.test.ts +++ b/packages/prover/test/unit/utils/execution.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; -import deepmerge from "deepmerge"; import {getEnvLogger} from "@lodestar/logger/env"; +import deepmerge from "deepmerge"; +import {describe, expect, it} from "vitest"; import {ELProof, ELStorageProof} from "../../../src/types.js"; +import {hexToBuffer} from "../../../src/utils/conversion.js"; import {isValidAccount, isValidStorageKeys} from "../../../src/utils/validation.js"; import {invalidStorageProof, validStorageProof} from "../../fixtures/index.js"; import eoaProof from "../../fixtures/sepolia/eth_getBalance_eoa.json" assert {type: "json"}; -import {hexToBuffer} from "../../../src/utils/conversion.js"; const address = eoaProof.request.params[0] as string; const validAccountProof = eoaProof.dependentRequests[0].response.result as unknown as ELProof; diff --git a/packages/prover/test/unit/verified_requests/eth_call.test.ts b/packages/prover/test/unit/verified_requests/eth_call.test.ts index e76b3fe4ed83..74e998910505 100644 --- a/packages/prover/test/unit/verified_requests/eth_call.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_call.test.ts @@ -1,13 +1,13 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {ELTransaction} from "../../../lib/types.js"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {JsonRpcRequest, JsonRpcResponseWithResultPayload} from "../../../src/types.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_call} from "../../../src/verified_requests/eth_call.js"; import ethCallCase1 from "../../fixtures/mainnet/eth_call.json" assert {type: "json"}; import {cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; -import {JsonRpcRequest, JsonRpcResponseWithResultPayload} from "../../../src/types.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; const testCases = [ethCallCase1]; diff --git a/packages/prover/test/unit/verified_requests/eth_estimateGas.test.ts b/packages/prover/test/unit/verified_requests/eth_estimateGas.test.ts index 27fbfb98a1b3..55ac3a74e581 100644 --- a/packages/prover/test/unit/verified_requests/eth_estimateGas.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_estimateGas.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {ELTransaction} from "../../../lib/types.js"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {JsonRpcRequest, JsonRpcResponseWithResultPayload} from "../../../src/types.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_estimateGas} from "../../../src/verified_requests/eth_estimateGas.js"; -import ethEstimateGasCase1 from "../../fixtures/mainnet/eth_estimateGas_simple_transfer.json" assert {type: "json"}; import ethEstimateGasCase2 from "../../fixtures/mainnet/eth_estimateGas_contract_call.json" assert {type: "json"}; +import ethEstimateGasCase1 from "../../fixtures/mainnet/eth_estimateGas_simple_transfer.json" assert {type: "json"}; import {TestFixture, cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; -import {JsonRpcRequest, JsonRpcResponseWithResultPayload} from "../../../src/types.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; const testCases = [ethEstimateGasCase1, ethEstimateGasCase2] as TestFixture[]; diff --git a/packages/prover/test/unit/verified_requests/eth_getBalance.test.ts b/packages/prover/test/unit/verified_requests/eth_getBalance.test.ts index 4032f4c25f19..f5f5470e385f 100644 --- a/packages/prover/test/unit/verified_requests/eth_getBalance.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_getBalance.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_getBalance} from "../../../src/verified_requests/eth_getBalance.js"; -import ethGetBalanceEoa from "../../fixtures/sepolia/eth_getBalance_eoa.json" assert {type: "json"}; import ethGetBalanceContract from "../../fixtures/sepolia/eth_getBalance_contract.json" assert {type: "json"}; +import ethGetBalanceEoa from "../../fixtures/sepolia/eth_getBalance_eoa.json" assert {type: "json"}; import {cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; const testCases = [ethGetBalanceEoa, ethGetBalanceContract]; diff --git a/packages/prover/test/unit/verified_requests/eth_getBlockByHash.test.ts b/packages/prover/test/unit/verified_requests/eth_getBlockByHash.test.ts index 3175bdd6d60c..265863680712 100644 --- a/packages/prover/test/unit/verified_requests/eth_getBlockByHash.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_getBlockByHash.test.ts @@ -1,7 +1,9 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {ELBlock} from "../../../src/types.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_getBlockByHash} from "../../../src/verified_requests/eth_getBlockByHash.js"; import ethGetBlockWithContractCreation from "../../fixtures/sepolia/eth_getBlock_with_contractCreation.json" assert { type: "json", @@ -10,8 +12,6 @@ import ethGetBlockWithNoAccessList from "../../fixtures/sepolia/eth_getBlock_wit type: "json", }; import {TestFixture, cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; -import {ELBlock} from "../../../src/types.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; const testCases = [ethGetBlockWithNoAccessList, ethGetBlockWithContractCreation] as [ TestFixture, diff --git a/packages/prover/test/unit/verified_requests/eth_getBlockByNumber.test.ts b/packages/prover/test/unit/verified_requests/eth_getBlockByNumber.test.ts index cc1389128ec0..9b59d39db771 100644 --- a/packages/prover/test/unit/verified_requests/eth_getBlockByNumber.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_getBlockByNumber.test.ts @@ -1,8 +1,9 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; import {ELBlock} from "../../../src/types.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_getBlockByNumber} from "../../../src/verified_requests/eth_getBlockByNumber.js"; import ethGetBlockWithContractCreation from "../../fixtures/sepolia/eth_getBlock_with_contractCreation.json" assert { type: "json", @@ -11,7 +12,6 @@ import ethGetBlockWithNoAccessList from "../../fixtures/sepolia/eth_getBlock_wit type: "json", }; import {TestFixture, cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; const testCases = [ethGetBlockWithNoAccessList, ethGetBlockWithContractCreation] as [ TestFixture, diff --git a/packages/prover/test/unit/verified_requests/eth_getCode.test.ts b/packages/prover/test/unit/verified_requests/eth_getCode.test.ts index 51cf0c153857..aeef17cb6ced 100644 --- a/packages/prover/test/unit/verified_requests/eth_getCode.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_getCode.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_getCode} from "../../../src/verified_requests/eth_getCode.js"; import ethGetCodeCase1 from "../../fixtures/sepolia/eth_getCode.json" assert {type: "json"}; -import {generateReqHandlerOptionsMock, cloneTestFixture} from "../../mocks/request_handler.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; +import {cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; const testCases = [ethGetCodeCase1]; diff --git a/packages/prover/test/unit/verified_requests/eth_getTransactionCount.test.ts b/packages/prover/test/unit/verified_requests/eth_getTransactionCount.test.ts index 8baf8fd7976b..e72bfd4dbf96 100644 --- a/packages/prover/test/unit/verified_requests/eth_getTransactionCount.test.ts +++ b/packages/prover/test/unit/verified_requests/eth_getTransactionCount.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; import {createForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; +import {describe, expect, it} from "vitest"; import {VERIFICATION_FAILED_RESPONSE_CODE} from "../../../src/constants.js"; +import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; import {eth_getTransactionCount} from "../../../src/verified_requests/eth_getTransactionCount.js"; import getTransactionCountCase1 from "../../fixtures/sepolia/eth_getTransactionCount.json" assert {type: "json"}; -import {generateReqHandlerOptionsMock, cloneTestFixture} from "../../mocks/request_handler.js"; -import {getVerificationFailedMessage} from "../../../src/utils/json_rpc.js"; +import {cloneTestFixture, generateReqHandlerOptionsMock} from "../../mocks/request_handler.js"; const testCases = [getTransactionCountCase1]; diff --git a/packages/prover/test/unit/web3_provider.node.test.ts b/packages/prover/test/unit/web3_provider.node.test.ts index d1f281175b56..10f0fee3387d 100644 --- a/packages/prover/test/unit/web3_provider.node.test.ts +++ b/packages/prover/test/unit/web3_provider.node.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, afterEach, vi} from "vitest"; -import {Web3} from "web3"; import {ethers} from "ethers"; -import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; -import {ELRpcProvider} from "../../src/utils/rpc_provider.js"; -import {ProofProvider} from "../../src/proof_provider/proof_provider.js"; +import {afterEach, describe, expect, it, vi} from "vitest"; +import {Web3} from "web3"; import {LCTransport, Web3ProviderType} from "../../src/interfaces.js"; +import {ProofProvider} from "../../src/proof_provider/proof_provider.js"; import {JsonRpcRequest, JsonRpcRequestOrBatch, JsonRpcResponse} from "../../src/types.js"; +import {ELRpcProvider} from "../../src/utils/rpc_provider.js"; +import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; describe("web3_provider", () => { afterEach(() => { diff --git a/packages/prover/test/unit/web3_provider_inspector.test.ts b/packages/prover/test/unit/web3_provider_inspector.test.ts index 95df8a0d760e..53da2c7c8482 100644 --- a/packages/prover/test/unit/web3_provider_inspector.test.ts +++ b/packages/prover/test/unit/web3_provider_inspector.test.ts @@ -1,9 +1,9 @@ -import {describe, it, beforeEach, expect} from "vitest"; -import {getEnvLogger} from "@lodestar/logger/env"; import {LogLevel} from "@lodestar/logger"; -import {Web3ProviderInspector} from "../../src/web3_provider_inspector.js"; +import {getEnvLogger} from "@lodestar/logger/env"; +import {beforeEach, describe, expect, it} from "vitest"; import {AnyWeb3Provider, Web3ProviderType} from "../../src/interfaces.js"; import web3JsProviderType from "../../src/provider_types/web3_js_provider_type.js"; +import {Web3ProviderInspector} from "../../src/web3_provider_inspector.js"; describe("Web3ProviderInspector", () => { let inspector: Web3ProviderInspector; diff --git a/packages/reqresp/src/ReqResp.ts b/packages/reqresp/src/ReqResp.ts index dc1459d87497..fadf99476156 100644 --- a/packages/reqresp/src/ReqResp.ts +++ b/packages/reqresp/src/ReqResp.ts @@ -1,21 +1,21 @@ import {setMaxListeners} from "node:events"; import {Connection, PeerId, Stream} from "@libp2p/interface"; -import type {Libp2p} from "libp2p"; import {Logger, MetricsRegister} from "@lodestar/utils"; -import {getMetrics, Metrics} from "./metrics.js"; -import {RequestError, RequestErrorCode, sendRequest, SendRequestOpts} from "./request/index.js"; +import type {Libp2p} from "libp2p"; +import {Metrics, getMetrics} from "./metrics.js"; +import {ReqRespRateLimiter} from "./rate_limiter/ReqRespRateLimiter.js"; +import {RequestError, RequestErrorCode, SendRequestOpts, sendRequest} from "./request/index.js"; import {handleRequest} from "./response/index.js"; import { DialOnlyProtocol, Encoding, MixedProtocol, - ReqRespRateLimiterOpts, Protocol, ProtocolDescriptor, + ReqRespRateLimiterOpts, ResponseIncoming, } from "./types.js"; import {formatProtocolID} from "./utils/protocolId.js"; -import {ReqRespRateLimiter} from "./rate_limiter/ReqRespRateLimiter.js"; type ProtocolID = string; diff --git a/packages/reqresp/src/encoders/requestDecode.ts b/packages/reqresp/src/encoders/requestDecode.ts index e91462ab7602..d50f1ee37b5b 100644 --- a/packages/reqresp/src/encoders/requestDecode.ts +++ b/packages/reqresp/src/encoders/requestDecode.ts @@ -1,8 +1,8 @@ import type {Sink} from "it-stream-types"; import {Uint8ArrayList} from "uint8arraylist"; +import {readEncodedPayload} from "../encodingStrategies/index.js"; import {MixedProtocol} from "../types.js"; import {BufferedSource} from "../utils/index.js"; -import {readEncodedPayload} from "../encodingStrategies/index.js"; const EMPTY_DATA = new Uint8Array(); diff --git a/packages/reqresp/src/encoders/requestEncode.ts b/packages/reqresp/src/encoders/requestEncode.ts index 7ea20664bc8b..752924c10118 100644 --- a/packages/reqresp/src/encoders/requestEncode.ts +++ b/packages/reqresp/src/encoders/requestEncode.ts @@ -1,5 +1,5 @@ -import {MixedProtocol} from "../types.js"; import {writeEncodedPayload} from "../encodingStrategies/index.js"; +import {MixedProtocol} from "../types.js"; /** * Yields byte chunks for a `` diff --git a/packages/reqresp/src/encoders/responseDecode.ts b/packages/reqresp/src/encoders/responseDecode.ts index 0dde5bcdc95e..23799037a3d2 100644 --- a/packages/reqresp/src/encoders/responseDecode.ts +++ b/packages/reqresp/src/encoders/responseDecode.ts @@ -1,16 +1,16 @@ -import {Uint8ArrayList} from "uint8arraylist"; import {ForkName} from "@lodestar/params"; -import {BufferedSource, decodeErrorMessage} from "../utils/index.js"; +import {Uint8ArrayList} from "uint8arraylist"; import {readEncodedPayload} from "../encodingStrategies/index.js"; +import {RespStatus} from "../interface.js"; import {ResponseError} from "../response/index.js"; import { - ContextBytesType, CONTEXT_BYTES_FORK_DIGEST_LENGTH, ContextBytesFactory, + ContextBytesType, MixedProtocol, ResponseIncoming, } from "../types.js"; -import {RespStatus} from "../interface.js"; +import {BufferedSource, decodeErrorMessage} from "../utils/index.js"; /** * Internal helper type to signal stream ended early diff --git a/packages/reqresp/src/encoders/responseEncode.ts b/packages/reqresp/src/encoders/responseEncode.ts index c5320ffc1ce9..9a1f9251c008 100644 --- a/packages/reqresp/src/encoders/responseEncode.ts +++ b/packages/reqresp/src/encoders/responseEncode.ts @@ -1,7 +1,7 @@ import {writeEncodedPayload} from "../encodingStrategies/index.js"; -import {encodeErrorMessage} from "../utils/index.js"; -import {ContextBytesType, ContextBytesFactory, MixedProtocol, Protocol, ResponseOutgoing} from "../types.js"; import {RespStatus, RpcResponseStatusError} from "../interface.js"; +import {ContextBytesFactory, ContextBytesType, MixedProtocol, Protocol, ResponseOutgoing} from "../types.js"; +import {encodeErrorMessage} from "../utils/index.js"; const SUCCESS_BUFFER = Buffer.from([RespStatus.SUCCESS]); diff --git a/packages/reqresp/src/encodingStrategies/sszSnappy/decode.ts b/packages/reqresp/src/encodingStrategies/sszSnappy/decode.ts index 9ebe52876cfe..9104104a0aa8 100644 --- a/packages/reqresp/src/encodingStrategies/sszSnappy/decode.ts +++ b/packages/reqresp/src/encodingStrategies/sszSnappy/decode.ts @@ -1,10 +1,10 @@ import {decode as varintDecode, encodingLength as varintEncodingLength} from "uint8-varint"; import {Uint8ArrayList} from "uint8arraylist"; -import {BufferedSource} from "../../utils/index.js"; import {TypeSizes} from "../../types.js"; +import {BufferedSource} from "../../utils/index.js"; +import {SszSnappyError, SszSnappyErrorCode} from "./errors.js"; import {SnappyFramesUncompress} from "./snappyFrames/uncompress.js"; import {maxEncodedLen} from "./utils.js"; -import {SszSnappyError, SszSnappyErrorCode} from "./errors.js"; export const MAX_VARINT_BYTES = 10; diff --git a/packages/reqresp/src/encodingStrategies/sszSnappy/snappyFrames/compress.ts b/packages/reqresp/src/encodingStrategies/sszSnappy/snappyFrames/compress.ts index e1c3887eaa70..98ae4053e90c 100644 --- a/packages/reqresp/src/encodingStrategies/sszSnappy/snappyFrames/compress.ts +++ b/packages/reqresp/src/encodingStrategies/sszSnappy/snappyFrames/compress.ts @@ -1,5 +1,5 @@ -import snappy from "snappy"; import crc32c from "@chainsafe/fast-crc32c"; +import snappy from "snappy"; import {ChunkType, IDENTIFIER_FRAME} from "./common.js"; // The logic in this file is largely copied (in simplified form) from https://github.com/ChainSafe/node-snappy-stream/ diff --git a/packages/reqresp/src/request/errors.ts b/packages/reqresp/src/request/errors.ts index ba3904e563ed..6795d9440a89 100644 --- a/packages/reqresp/src/request/errors.ts +++ b/packages/reqresp/src/request/errors.ts @@ -1,6 +1,6 @@ import {LodestarError, LodestarErrorObject} from "@lodestar/utils"; -import {ResponseError} from "../response/index.js"; import {RespStatus, RpcResponseStatusError} from "../interface.js"; +import {ResponseError} from "../response/index.js"; export enum RequestErrorCode { // Declaring specific values of RpcResponseStatusError for error clarity downstream diff --git a/packages/reqresp/src/request/index.ts b/packages/reqresp/src/request/index.ts index 9a374db3b8be..edd3b25eedbf 100644 --- a/packages/reqresp/src/request/index.ts +++ b/packages/reqresp/src/request/index.ts @@ -1,14 +1,14 @@ -import {pipe} from "it-pipe"; import {PeerId} from "@libp2p/interface"; +import {ErrorAborted, Logger, TimeoutError, withTimeout} from "@lodestar/utils"; +import {pipe} from "it-pipe"; import type {Libp2p} from "libp2p"; import {Uint8ArrayList} from "uint8arraylist"; -import {ErrorAborted, Logger, withTimeout, TimeoutError} from "@lodestar/utils"; -import {MixedProtocol, ResponseIncoming} from "../types.js"; -import {prettyPrintPeerId, abortableSource} from "../utils/index.js"; -import {Metrics} from "../metrics.js"; -import {ResponseError} from "../response/index.js"; import {requestEncode} from "../encoders/requestEncode.js"; import {responseDecode} from "../encoders/responseDecode.js"; +import {Metrics} from "../metrics.js"; +import {ResponseError} from "../response/index.js"; +import {MixedProtocol, ResponseIncoming} from "../types.js"; +import {abortableSource, prettyPrintPeerId} from "../utils/index.js"; import {RequestError, RequestErrorCode, responseStatusErrorToRequestError} from "./errors.js"; export {RequestError, RequestErrorCode}; diff --git a/packages/reqresp/src/response/index.ts b/packages/reqresp/src/response/index.ts index d9f0e1b1806a..265d5418d655 100644 --- a/packages/reqresp/src/response/index.ts +++ b/packages/reqresp/src/response/index.ts @@ -1,15 +1,15 @@ -import {pipe} from "it-pipe"; import {PeerId, Stream} from "@libp2p/interface"; -import {Uint8ArrayList} from "uint8arraylist"; import {Logger, TimeoutError, withTimeout} from "@lodestar/utils"; -import {prettyPrintPeerId} from "../utils/index.js"; -import {Protocol, ReqRespRequest} from "../types.js"; +import {pipe} from "it-pipe"; +import {Uint8ArrayList} from "uint8arraylist"; import {requestDecode} from "../encoders/requestDecode.js"; import {responseEncodeError, responseEncodeSuccess} from "../encoders/responseEncode.js"; import {RespStatus} from "../interface.js"; -import {RequestError, RequestErrorCode} from "../request/errors.js"; -import {ReqRespRateLimiter} from "../rate_limiter/ReqRespRateLimiter.js"; import {Metrics} from "../metrics.js"; +import {ReqRespRateLimiter} from "../rate_limiter/ReqRespRateLimiter.js"; +import {RequestError, RequestErrorCode} from "../request/errors.js"; +import {Protocol, ReqRespRequest} from "../types.js"; +import {prettyPrintPeerId} from "../utils/index.js"; import {ResponseError} from "./errors.js"; export {ResponseError}; diff --git a/packages/reqresp/src/utils/collectExactOne.ts b/packages/reqresp/src/utils/collectExactOne.ts index 962616135cdf..ab1edea6478a 100644 --- a/packages/reqresp/src/utils/collectExactOne.ts +++ b/packages/reqresp/src/utils/collectExactOne.ts @@ -1,4 +1,4 @@ -import {RequestErrorCode, RequestError} from "../request/errors.js"; +import {RequestError, RequestErrorCode} from "../request/errors.js"; /** * Sink for `*`, from diff --git a/packages/reqresp/test/fixtures/encodingStrategies.ts b/packages/reqresp/test/fixtures/encodingStrategies.ts index 7bf183d8714c..58652a4d6b92 100644 --- a/packages/reqresp/test/fixtures/encodingStrategies.ts +++ b/packages/reqresp/test/fixtures/encodingStrategies.ts @@ -1,9 +1,9 @@ import fs from "node:fs"; import path from "node:path"; import {fileURLToPath} from "node:url"; -import {encode as varintEncode} from "uint8-varint"; -import {ssz} from "@lodestar/types"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {encode as varintEncode} from "uint8-varint"; import {SszSnappyErrorCode} from "../../src/encodingStrategies/sszSnappy/errors.js"; import {ResponseOutgoing, TypeSizes} from "../../src/types.js"; import { diff --git a/packages/reqresp/test/fixtures/messages.ts b/packages/reqresp/test/fixtures/messages.ts index a243a05b221b..4fa6c69e2865 100644 --- a/packages/reqresp/test/fixtures/messages.ts +++ b/packages/reqresp/test/fixtures/messages.ts @@ -1,8 +1,8 @@ import {fromHexString} from "@chainsafe/ssz"; import {createBeaconConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; -import {ssz} from "@lodestar/types"; import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {ResponseIncoming, TypeSizes} from "../../src/types.js"; import {ZERO_HASH} from "../utils/index.js"; diff --git a/packages/reqresp/test/fixtures/protocols.ts b/packages/reqresp/test/fixtures/protocols.ts index 19e8936fc376..0afd6300fb1c 100644 --- a/packages/reqresp/test/fixtures/protocols.ts +++ b/packages/reqresp/test/fixtures/protocols.ts @@ -1,7 +1,7 @@ -import {ContainerType, UintNumberType, ListBasicType, ValueOf} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; +import {ContainerType, ListBasicType, UintNumberType, ValueOf} from "@chainsafe/ssz"; import {ForkName} from "@lodestar/params"; -import {ContextBytesType, DialOnlyProtocol, Encoding, ProtocolHandler, Protocol} from "../../src/types.js"; +import {ssz} from "@lodestar/types"; +import {ContextBytesType, DialOnlyProtocol, Encoding, Protocol, ProtocolHandler} from "../../src/types.js"; import {getEmptyHandler} from "./messages.js"; import {beaconConfig} from "./messages.js"; diff --git a/packages/reqresp/test/unit/ReqResp.test.ts b/packages/reqresp/test/unit/ReqResp.test.ts index 8d78a46f292f..b9e9fe3e9e60 100644 --- a/packages/reqresp/test/unit/ReqResp.test.ts +++ b/packages/reqresp/test/unit/ReqResp.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; -import {Libp2p} from "libp2p"; -import {Logger} from "@lodestar/utils"; import {getEmptyLogger} from "@lodestar/logger/empty"; -import {RespStatus} from "../../src/interface.js"; +import {Logger} from "@lodestar/utils"; +import {Libp2p} from "libp2p"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {ReqResp} from "../../src/ReqResp.js"; +import {RespStatus} from "../../src/interface.js"; import {getEmptyHandler, sszSnappyPing} from "../fixtures/messages.js"; import {numberToStringProtocol, numberToStringProtocolDialOnly, pingProtocol} from "../fixtures/protocols.js"; import {MockLibP2pStream} from "../utils/index.js"; diff --git a/packages/reqresp/test/unit/encoders/reqestEncode.test.ts b/packages/reqresp/test/unit/encoders/reqestEncode.test.ts index 221dc8237e19..8771e26913cd 100644 --- a/packages/reqresp/test/unit/encoders/reqestEncode.test.ts +++ b/packages/reqresp/test/unit/encoders/reqestEncode.test.ts @@ -1,6 +1,6 @@ -import {describe, it} from "vitest"; import all from "it-all"; import {pipe} from "it-pipe"; +import {describe, it} from "vitest"; import {requestEncode} from "../../../src/encoders/requestEncode.js"; import {requestEncodersCases} from "../../fixtures/encoders.js"; import {expectEqualByteChunks} from "../../utils/index.js"; diff --git a/packages/reqresp/test/unit/encoders/requestDecode.test.ts b/packages/reqresp/test/unit/encoders/requestDecode.test.ts index 462bc3bb7378..cd8c7bc303e6 100644 --- a/packages/reqresp/test/unit/encoders/requestDecode.test.ts +++ b/packages/reqresp/test/unit/encoders/requestDecode.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {pipe} from "it-pipe"; +import {describe, expect, it} from "vitest"; import {requestDecode} from "../../../src/encoders/requestDecode.js"; import {requestEncodersCases, requestEncodersErrorCases} from "../../fixtures/encoders.js"; import {expectRejectedWithLodestarError} from "../../utils/errors.js"; diff --git a/packages/reqresp/test/unit/encoders/responseDecode.test.ts b/packages/reqresp/test/unit/encoders/responseDecode.test.ts index 8fc919c46313..9c6cf9a32361 100644 --- a/packages/reqresp/test/unit/encoders/responseDecode.test.ts +++ b/packages/reqresp/test/unit/encoders/responseDecode.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect} from "vitest"; +import {LodestarError} from "@lodestar/utils"; import all from "it-all"; import {pipe} from "it-pipe"; -import {LodestarError} from "@lodestar/utils"; +import {describe, expect, it} from "vitest"; import {responseDecode} from "../../../src/encoders/responseDecode.js"; +import {ResponseIncoming} from "../../../src/types.js"; import {responseEncodersErrorTestCases, responseEncodersTestCases} from "../../fixtures/encoders.js"; import {expectRejectedWithLodestarError} from "../../utils/errors.js"; import {arrToSource, onlySuccessResp} from "../../utils/index.js"; -import {ResponseIncoming} from "../../../src/types.js"; describe("encoders / responseDecode", () => { describe("valid cases", () => { diff --git a/packages/reqresp/test/unit/encoders/responseEncode.test.ts b/packages/reqresp/test/unit/encoders/responseEncode.test.ts index b9b5f3f8ee11..9580d0b2fcd8 100644 --- a/packages/reqresp/test/unit/encoders/responseEncode.test.ts +++ b/packages/reqresp/test/unit/encoders/responseEncode.test.ts @@ -1,10 +1,10 @@ -import {describe, it} from "vitest"; import all from "it-all"; import {pipe} from "it-pipe"; +import {describe, it} from "vitest"; import {Protocol} from "../../../src/types.js"; import {responseEncodersTestCases} from "../../fixtures/encoders.js"; -import {responseEncode} from "../../utils/response.js"; import {expectEqualByteChunks} from "../../utils/index.js"; +import {responseEncode} from "../../utils/response.js"; describe("encoders / responseEncode", () => { describe("valid cases", () => { diff --git a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/decode.test.ts b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/decode.test.ts index bfa597e42519..f315cc26316b 100644 --- a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/decode.test.ts +++ b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/decode.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {Uint8ArrayList} from "uint8arraylist"; import {encode as varintEncode} from "uint8-varint"; +import {Uint8ArrayList} from "uint8arraylist"; +import {describe, expect, it} from "vitest"; import {readSszSnappyPayload} from "../../../../src/encodingStrategies/sszSnappy/index.js"; import {BufferedSource} from "../../../../src/utils/index.js"; import { diff --git a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/encode.test.ts b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/encode.test.ts index 6ec27d1e6b16..68f5c4e5299d 100644 --- a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/encode.test.ts +++ b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/encode.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import all from "it-all"; import {pipe} from "it-pipe"; import {encode as varintEncode} from "uint8-varint"; +import {describe, expect, it} from "vitest"; import {writeSszSnappyPayload} from "../../../../src/encodingStrategies/sszSnappy/encode.js"; import {encodingStrategiesMainnetTestCases, encodingStrategiesTestCases} from "../../../fixtures/index.js"; import {expectEqualByteChunks} from "../../../utils/index.js"; diff --git a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/snappyFrames/uncompress.test.ts b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/snappyFrames/uncompress.test.ts index dc01a1952142..66d4f3548b9f 100644 --- a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/snappyFrames/uncompress.test.ts +++ b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/snappyFrames/uncompress.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect} from "vitest"; -import {Uint8ArrayList} from "uint8arraylist"; import {pipe} from "it-pipe"; -import {SnappyFramesUncompress} from "../../../../../src/encodingStrategies/sszSnappy/snappyFrames/uncompress.js"; +import {Uint8ArrayList} from "uint8arraylist"; +import {describe, expect, it} from "vitest"; import {encodeSnappy} from "../../../../../src/encodingStrategies/sszSnappy/snappyFrames/compress.js"; +import {SnappyFramesUncompress} from "../../../../../src/encodingStrategies/sszSnappy/snappyFrames/uncompress.js"; describe("encodingStrategies / sszSnappy / snappy frames / uncompress", () => { it("should work with short input", () => diff --git a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/utils.test.ts b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/utils.test.ts index a494b4acab9a..34e40967bf00 100644 --- a/packages/reqresp/test/unit/encodingStrategies/sszSnappy/utils.test.ts +++ b/packages/reqresp/test/unit/encodingStrategies/sszSnappy/utils.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {maxEncodedLen} from "../../../../src/encodingStrategies/sszSnappy/utils.js"; describe("encodingStrategies / sszSnappy / utils", () => { diff --git a/packages/reqresp/test/unit/rate_limiter/rateLimiterGRCA.test.ts b/packages/reqresp/test/unit/rate_limiter/rateLimiterGRCA.test.ts index a8cbb6e0d3a6..e74eb9a25e0b 100644 --- a/packages/reqresp/test/unit/rate_limiter/rateLimiterGRCA.test.ts +++ b/packages/reqresp/test/unit/rate_limiter/rateLimiterGRCA.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {RateLimiterGRCA} from "../../../src/rate_limiter/rateLimiterGRCA.js"; describe("rateLimiterGRCA", () => { diff --git a/packages/reqresp/test/unit/request/index.test.ts b/packages/reqresp/test/unit/request/index.test.ts index 888520457bb2..4d9a8bfabbd3 100644 --- a/packages/reqresp/test/unit/request/index.test.ts +++ b/packages/reqresp/test/unit/request/index.test.ts @@ -1,19 +1,19 @@ -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; import {PeerId} from "@libp2p/interface"; +import {getEmptyLogger} from "@lodestar/logger/empty"; +import {LodestarError, sleep} from "@lodestar/utils"; import all from "it-all"; import {pipe} from "it-pipe"; import {Libp2p} from "libp2p"; -import {getEmptyLogger} from "@lodestar/logger/empty"; -import {LodestarError, sleep} from "@lodestar/utils"; -import {RequestError, RequestErrorCode, sendRequest, SendRequestOpts} from "../../../src/request/index.js"; -import {Protocol, MixedProtocol, ResponseIncoming} from "../../../src/types.js"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {RespStatus} from "../../../src/interface.js"; +import {RequestError, RequestErrorCode, SendRequestOpts, sendRequest} from "../../../src/request/index.js"; +import {MixedProtocol, Protocol, ResponseIncoming} from "../../../src/types.js"; import {getEmptyHandler, sszSnappyPing} from "../../fixtures/messages.js"; -import {getValidPeerId} from "../../utils/peer.js"; +import {pingProtocol} from "../../fixtures/protocols.js"; +import {expectRejectedWithLodestarError} from "../../utils/errors.js"; import {MockLibP2pStream} from "../../utils/index.js"; +import {getValidPeerId} from "../../utils/peer.js"; import {responseEncode} from "../../utils/response.js"; -import {RespStatus} from "../../../src/interface.js"; -import {expectRejectedWithLodestarError} from "../../utils/errors.js"; -import {pingProtocol} from "../../fixtures/protocols.js"; describe("request / sendRequest", () => { const logger = getEmptyLogger(); diff --git a/packages/reqresp/test/unit/response/index.test.ts b/packages/reqresp/test/unit/response/index.test.ts index 62a8e63f3fe0..4433f44faeeb 100644 --- a/packages/reqresp/test/unit/response/index.test.ts +++ b/packages/reqresp/test/unit/response/index.test.ts @@ -1,15 +1,15 @@ -import {describe, it, expect, beforeEach, afterEach} from "vitest"; import {PeerId} from "@libp2p/interface"; -import {LodestarError, fromHex} from "@lodestar/utils"; import {getEmptyLogger} from "@lodestar/logger/empty"; +import {LodestarError, fromHex} from "@lodestar/utils"; +import {afterEach, beforeEach, describe, expect, it} from "vitest"; import {Protocol, RespStatus} from "../../../src/index.js"; import {ReqRespRateLimiter} from "../../../src/rate_limiter/ReqRespRateLimiter.js"; import {handleRequest} from "../../../src/response/index.js"; import {sszSnappyPing} from "../../fixtures/messages.js"; +import {pingProtocol} from "../../fixtures/protocols.js"; import {expectRejectedWithLodestarError} from "../../utils/errors.js"; import {MockLibP2pStream, expectEqualByteChunks} from "../../utils/index.js"; import {getValidPeerId} from "../../utils/peer.js"; -import {pingProtocol} from "../../fixtures/protocols.js"; const testCases: { id: string; diff --git a/packages/reqresp/test/unit/utils/protocolId.test.ts b/packages/reqresp/test/unit/utils/protocolId.test.ts index 04cd93222045..047c4a0272fa 100644 --- a/packages/reqresp/test/unit/utils/protocolId.test.ts +++ b/packages/reqresp/test/unit/utils/protocolId.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {Encoding, ProtocolAttributes} from "../../../src/index.js"; import {formatProtocolID, parseProtocolID as reqrespParseProtocolID} from "../../../src/utils/index.js"; diff --git a/packages/reqresp/test/utils/errors.ts b/packages/reqresp/test/utils/errors.ts index e4697a6d97d5..b882b1c63e71 100644 --- a/packages/reqresp/test/utils/errors.ts +++ b/packages/reqresp/test/utils/errors.ts @@ -1,5 +1,5 @@ -import {expect} from "vitest"; import {LodestarError, mapValues} from "@lodestar/utils"; +import {expect} from "vitest"; export function expectThrowsLodestarError(fn: () => void, expectedErr: LodestarError | string): void { try { diff --git a/packages/reqresp/test/utils/index.ts b/packages/reqresp/test/utils/index.ts index afddace8328d..77c05c1739a4 100644 --- a/packages/reqresp/test/utils/index.ts +++ b/packages/reqresp/test/utils/index.ts @@ -1,10 +1,10 @@ +import {toHexString} from "@chainsafe/ssz"; import {Direction, ReadStatus, Stream, StreamStatus, WriteStatus} from "@libp2p/interface"; import {logger} from "@libp2p/logger"; -import {expect} from "vitest"; -import {Uint8ArrayList} from "uint8arraylist"; -import {toHexString} from "@chainsafe/ssz"; import {fromHex} from "@lodestar/utils"; -import {ResponseIncoming, RespStatus} from "../../src/index.js"; +import {Uint8ArrayList} from "uint8arraylist"; +import {expect} from "vitest"; +import {RespStatus, ResponseIncoming} from "../../src/index.js"; import {ResponseChunk} from "../fixtures/index.js"; /** diff --git a/packages/spec-test-util/src/downloadTests.ts b/packages/spec-test-util/src/downloadTests.ts index bca6a8ac52c9..53113e716eea 100644 --- a/packages/spec-test-util/src/downloadTests.ts +++ b/packages/spec-test-util/src/downloadTests.ts @@ -3,10 +3,10 @@ import fs from "node:fs"; import path from "node:path"; import stream from "node:stream"; import {promisify} from "node:util"; -import {rimraf} from "rimraf"; +import {retry} from "@lodestar/utils"; import axios from "axios"; +import {rimraf} from "rimraf"; import {x as extractTar} from "tar"; -import {retry} from "@lodestar/utils"; export const defaultSpecTestsRepoUrl = "https://github.com/ethereum/consensus-spec-tests"; diff --git a/packages/spec-test-util/src/single.ts b/packages/spec-test-util/src/single.ts index 888c87e3ffa8..476ac8e1eebf 100644 --- a/packages/spec-test-util/src/single.ts +++ b/packages/spec-test-util/src/single.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; -import {describe, it, vi, expect} from "vitest"; -import {uncompress} from "snappyjs"; import {loadYaml} from "@lodestar/utils"; +import {uncompress} from "snappyjs"; +import {describe, expect, it, vi} from "vitest"; /* eslint-disable @typescript-eslint/no-unsafe-assignment, diff --git a/packages/spec-test-util/src/sszGeneric.ts b/packages/spec-test-util/src/sszGeneric.ts index e932b897a90c..590b97151f17 100644 --- a/packages/spec-test-util/src/sszGeneric.ts +++ b/packages/spec-test-util/src/sszGeneric.ts @@ -1,7 +1,7 @@ -import path from "node:path"; import fs from "node:fs"; -import {uncompress} from "snappyjs"; +import path from "node:path"; import {loadYaml} from "@lodestar/utils"; +import {uncompress} from "snappyjs"; /* eslint-disable @typescript-eslint/explicit-function-return-type */ diff --git a/packages/spec-test-util/test/e2e/single/index.test.ts b/packages/spec-test-util/test/e2e/single/index.test.ts index 2dbefbb9cd22..8e7c90182e7a 100644 --- a/packages/spec-test-util/test/e2e/single/index.test.ts +++ b/packages/spec-test-util/test/e2e/single/index.test.ts @@ -1,10 +1,10 @@ import fs from "node:fs"; import path from "node:path"; import {fileURLToPath} from "node:url"; -import {beforeAll, afterAll} from "vitest"; import {ContainerType, Type} from "@chainsafe/ssz"; import {ssz} from "@lodestar/types"; -import {describeDirectorySpecTest, InputType, loadYamlFile} from "../../../src/single.js"; +import {afterAll, beforeAll} from "vitest"; +import {InputType, describeDirectorySpecTest, loadYamlFile} from "../../../src/single.js"; // Global variable __dirname no longer available in ES6 modules. // Solutions: https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules diff --git a/packages/state-transition/src/block/index.ts b/packages/state-transition/src/block/index.ts index 3857511292c8..8004a2657556 100644 --- a/packages/state-transition/src/block/index.ts +++ b/packages/state-transition/src/block/index.ts @@ -1,15 +1,15 @@ import {ForkSeq} from "@lodestar/params"; import {BeaconBlock, BlindedBeaconBlock, altair, capella} from "@lodestar/types"; +import {CachedBeaconStateAllForks, CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; import {getFullOrBlindedPayload, isExecutionEnabled} from "../util/execution.js"; -import {CachedBeaconStateAllForks, CachedBeaconStateCapella, CachedBeaconStateBellatrix} from "../types.js"; -import {processExecutionPayload} from "./processExecutionPayload.js"; -import {processSyncAggregate} from "./processSyncCommittee.js"; +import {BlockExternalData, DataAvailableStatus} from "./externalData.js"; +import {processBlobKzgCommitments} from "./processBlobKzgCommitments.js"; import {processBlockHeader} from "./processBlockHeader.js"; import {processEth1Data} from "./processEth1Data.js"; +import {processExecutionPayload} from "./processExecutionPayload.js"; import {processOperations} from "./processOperations.js"; import {processRandao} from "./processRandao.js"; -import {processBlobKzgCommitments} from "./processBlobKzgCommitments.js"; -import {BlockExternalData, DataAvailableStatus} from "./externalData.js"; +import {processSyncAggregate} from "./processSyncCommittee.js"; import {processWithdrawals} from "./processWithdrawals.js"; import {ProcessBlockOpts} from "./types.js"; diff --git a/packages/state-transition/src/block/isValidIndexedAttestation.ts b/packages/state-transition/src/block/isValidIndexedAttestation.ts index 8c7502ceedb5..fdb005484733 100644 --- a/packages/state-transition/src/block/isValidIndexedAttestation.ts +++ b/packages/state-transition/src/block/isValidIndexedAttestation.ts @@ -1,8 +1,8 @@ import {ForkSeq, MAX_COMMITTEES_PER_SLOT, MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params"; import {phase0} from "@lodestar/types"; +import {getIndexedAttestationBigintSignatureSet, getIndexedAttestationSignatureSet} from "../signatureSets/index.js"; import {CachedBeaconStateAllForks} from "../types.js"; import {verifySignatureSet} from "../util/index.js"; -import {getIndexedAttestationBigintSignatureSet, getIndexedAttestationSignatureSet} from "../signatureSets/index.js"; /** * Check if `indexedAttestation` has sorted and unique indices and a valid aggregate signature. diff --git a/packages/state-transition/src/block/processAttestationPhase0.ts b/packages/state-transition/src/block/processAttestationPhase0.ts index e2b32bbbbee8..ab57bd27c80d 100644 --- a/packages/state-transition/src/block/processAttestationPhase0.ts +++ b/packages/state-transition/src/block/processAttestationPhase0.ts @@ -1,9 +1,9 @@ +import {ForkSeq, MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {Attestation, Slot, electra, phase0, ssz} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; -import {Slot, Attestation, electra, phase0, ssz} from "@lodestar/types"; -import {MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH, ForkSeq} from "@lodestar/params"; import {assert} from "@lodestar/utils"; +import {CachedBeaconStateAllForks, CachedBeaconStatePhase0} from "../types.js"; import {computeEpochAtSlot} from "../util/index.js"; -import {CachedBeaconStatePhase0, CachedBeaconStateAllForks} from "../types.js"; import {isValidIndexedAttestation} from "./index.js"; /** diff --git a/packages/state-transition/src/block/processAttestations.ts b/packages/state-transition/src/block/processAttestations.ts index 844bda768570..09b8cd7584f2 100644 --- a/packages/state-transition/src/block/processAttestations.ts +++ b/packages/state-transition/src/block/processAttestations.ts @@ -1,5 +1,5 @@ -import {Attestation} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; +import {Attestation} from "@lodestar/types"; import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../types.js"; import {processAttestationPhase0} from "./processAttestationPhase0.js"; import {processAttestationsAltair} from "./processAttestationsAltair.js"; diff --git a/packages/state-transition/src/block/processAttestationsAltair.ts b/packages/state-transition/src/block/processAttestationsAltair.ts index 046a23d7dc27..0157f4e997a1 100644 --- a/packages/state-transition/src/block/processAttestationsAltair.ts +++ b/packages/state-transition/src/block/processAttestationsAltair.ts @@ -1,8 +1,9 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {Epoch, Attestation, phase0} from "@lodestar/types"; +import {Attestation, Epoch, phase0} from "@lodestar/types"; import {intSqrt} from "@lodestar/utils"; import { + ForkSeq, MIN_ATTESTATION_INCLUSION_DELAY, PROPOSER_WEIGHT, SLOTS_PER_EPOCH, @@ -13,12 +14,11 @@ import { TIMELY_TARGET_FLAG_INDEX, TIMELY_TARGET_WEIGHT, WEIGHT_DENOMINATOR, - ForkSeq, } from "@lodestar/params"; -import {increaseBalance, verifySignatureSet} from "../util/index.js"; +import {getAttestationWithIndicesSignatureSet} from "../signatureSets/indexedAttestation.js"; import {CachedBeaconStateAltair} from "../types.js"; +import {increaseBalance, verifySignatureSet} from "../util/index.js"; import {RootCache} from "../util/rootCache.js"; -import {getAttestationWithIndicesSignatureSet} from "../signatureSets/indexedAttestation.js"; import {checkpointToStr, isTimelyTarget, validateAttestation} from "./processAttestationPhase0.js"; const PROPOSER_REWARD_DOMINATOR = ((WEIGHT_DENOMINATOR - PROPOSER_WEIGHT) * WEIGHT_DENOMINATOR) / PROPOSER_WEIGHT; diff --git a/packages/state-transition/src/block/processAttesterSlashing.ts b/packages/state-transition/src/block/processAttesterSlashing.ts index 0f635e33fce2..5470082a7c2b 100644 --- a/packages/state-transition/src/block/processAttesterSlashing.ts +++ b/packages/state-transition/src/block/processAttesterSlashing.ts @@ -1,10 +1,10 @@ -import {phase0} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; +import {phase0} from "@lodestar/types"; -import {isSlashableValidator, isSlashableAttestationData, getAttesterSlashableIndices} from "../util/index.js"; import {CachedBeaconStateAllForks} from "../types.js"; -import {slashValidator} from "./slashValidator.js"; +import {getAttesterSlashableIndices, isSlashableAttestationData, isSlashableValidator} from "../util/index.js"; import {isValidIndexedAttestationBigint} from "./isValidIndexedAttestation.js"; +import {slashValidator} from "./slashValidator.js"; /** * Process an AttesterSlashing operation. Initiates the exit of a validator, decreases the balance of the slashed diff --git a/packages/state-transition/src/block/processBlockHeader.ts b/packages/state-transition/src/block/processBlockHeader.ts index da3e389fb507..b4e07ffd5f73 100644 --- a/packages/state-transition/src/block/processBlockHeader.ts +++ b/packages/state-transition/src/block/processBlockHeader.ts @@ -1,8 +1,8 @@ import {byteArrayEquals} from "@chainsafe/ssz"; import {BeaconBlock, BlindedBeaconBlock, ssz} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; -import {CachedBeaconStateAllForks} from "../types.js"; import {ZERO_HASH} from "../constants/index.js"; +import {CachedBeaconStateAllForks} from "../types.js"; import {blindedOrFullBlockToHeader} from "../util/index.js"; /** * Converts a Deposit record (created by the eth-execution deposit contract) into a Validator object that goes into the eth-consensus state. diff --git a/packages/state-transition/src/block/processBlsToExecutionChange.ts b/packages/state-transition/src/block/processBlsToExecutionChange.ts index be79f06f3f21..04be6371fe6d 100644 --- a/packages/state-transition/src/block/processBlsToExecutionChange.ts +++ b/packages/state-transition/src/block/processBlsToExecutionChange.ts @@ -1,7 +1,7 @@ -import {byteArrayEquals} from "@chainsafe/ssz"; import {digest} from "@chainsafe/as-sha256"; -import {capella} from "@lodestar/types"; +import {byteArrayEquals} from "@chainsafe/ssz"; import {BLS_WITHDRAWAL_PREFIX, ETH1_ADDRESS_WITHDRAWAL_PREFIX} from "@lodestar/params"; +import {capella} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {verifyBlsToExecutionChangeSignature} from "../signatureSets/index.js"; diff --git a/packages/state-transition/src/block/processConsolidationRequest.ts b/packages/state-transition/src/block/processConsolidationRequest.ts index c14612579c58..d0650135d0c6 100644 --- a/packages/state-transition/src/block/processConsolidationRequest.ts +++ b/packages/state-transition/src/block/processConsolidationRequest.ts @@ -1,11 +1,11 @@ -import {electra, ssz} from "@lodestar/types"; import {FAR_FUTURE_EPOCH, MIN_ACTIVATION_BALANCE, PENDING_CONSOLIDATIONS_LIMIT} from "@lodestar/params"; +import {electra, ssz} from "@lodestar/types"; import {CachedBeaconStateElectra} from "../types.js"; -import {getConsolidationChurnLimit, isActiveValidator} from "../util/validator.js"; +import {hasEth1WithdrawalCredential} from "../util/capella.js"; import {hasExecutionWithdrawalCredential, switchToCompoundingValidator} from "../util/electra.js"; import {computeConsolidationEpochAndUpdateChurn} from "../util/epoch.js"; -import {hasEth1WithdrawalCredential} from "../util/capella.js"; +import {getConsolidationChurnLimit, isActiveValidator} from "../util/validator.js"; // TODO Electra: Clean up necessary as there is a lot of overlap with isValidSwitchToCompoundRequest export function processConsolidationRequest( diff --git a/packages/state-transition/src/block/processDeposit.ts b/packages/state-transition/src/block/processDeposit.ts index b7e9827c4cd7..23c5e6c9b26d 100644 --- a/packages/state-transition/src/block/processDeposit.ts +++ b/packages/state-transition/src/block/processDeposit.ts @@ -12,12 +12,12 @@ import { MAX_EFFECTIVE_BALANCE, } from "@lodestar/params"; -import {DepositData} from "@lodestar/types/lib/phase0/types.js"; -import {DepositRequest} from "@lodestar/types/lib/electra/types.js"; import {BeaconConfig} from "@lodestar/config"; +import {DepositRequest} from "@lodestar/types/lib/electra/types.js"; +import {DepositData} from "@lodestar/types/lib/phase0/types.js"; import {ZERO_HASH} from "../constants/index.js"; -import {computeDomain, computeSigningRoot, getMaxEffectiveBalance, increaseBalance} from "../util/index.js"; import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateElectra} from "../types.js"; +import {computeDomain, computeSigningRoot, getMaxEffectiveBalance, increaseBalance} from "../util/index.js"; /** * Process a Deposit operation. Potentially adds a new validator to the registry. Mutates the validators and balances diff --git a/packages/state-transition/src/block/processDepositRequest.ts b/packages/state-transition/src/block/processDepositRequest.ts index 7c6ea4928f54..8a8b6c08eed8 100644 --- a/packages/state-transition/src/block/processDepositRequest.ts +++ b/packages/state-transition/src/block/processDepositRequest.ts @@ -1,5 +1,5 @@ -import {electra, ssz} from "@lodestar/types"; import {ForkSeq, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params"; +import {electra, ssz} from "@lodestar/types"; import {CachedBeaconStateElectra} from "../types.js"; diff --git a/packages/state-transition/src/block/processExecutionPayload.ts b/packages/state-transition/src/block/processExecutionPayload.ts index 3d70e46d40fd..3900583956ba 100644 --- a/packages/state-transition/src/block/processExecutionPayload.ts +++ b/packages/state-transition/src/block/processExecutionPayload.ts @@ -1,14 +1,14 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {BeaconBlockBody, BlindedBeaconBlockBody, deneb, isExecutionPayload} from "@lodestar/types"; import {ForkSeq, MAX_BLOBS_PER_BLOCK} from "@lodestar/params"; +import {BeaconBlockBody, BlindedBeaconBlockBody, deneb, isExecutionPayload} from "@lodestar/types"; import {toHex, toRootHex} from "@lodestar/utils"; import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; -import {getRandaoMix} from "../util/index.js"; import { - isMergeTransitionComplete, - getFullOrBlindedPayloadFromBody, executionPayloadToPayloadHeader, + getFullOrBlindedPayloadFromBody, + isMergeTransitionComplete, } from "../util/execution.js"; +import {getRandaoMix} from "../util/index.js"; import {BlockExternalData, ExecutionPayloadStatus} from "./externalData.js"; export function processExecutionPayload( diff --git a/packages/state-transition/src/block/processOperations.ts b/packages/state-transition/src/block/processOperations.ts index d611581584c1..165dcd10d4e2 100644 --- a/packages/state-transition/src/block/processOperations.ts +++ b/packages/state-transition/src/block/processOperations.ts @@ -1,18 +1,18 @@ -import {BeaconBlockBody, capella, electra} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; +import {BeaconBlockBody, capella, electra} from "@lodestar/types"; import {CachedBeaconStateAllForks, CachedBeaconStateCapella, CachedBeaconStateElectra} from "../types.js"; import {getEth1DepositCount} from "../util/deposit.js"; import {processAttestations} from "./processAttestations.js"; -import {processProposerSlashing} from "./processProposerSlashing.js"; import {processAttesterSlashing} from "./processAttesterSlashing.js"; +import {processBlsToExecutionChange} from "./processBlsToExecutionChange.js"; +import {processConsolidationRequest} from "./processConsolidationRequest.js"; import {processDeposit} from "./processDeposit.js"; +import {processDepositRequest} from "./processDepositRequest.js"; +import {processProposerSlashing} from "./processProposerSlashing.js"; import {processVoluntaryExit} from "./processVoluntaryExit.js"; -import {processBlsToExecutionChange} from "./processBlsToExecutionChange.js"; import {processWithdrawalRequest} from "./processWithdrawalRequest.js"; -import {processDepositRequest} from "./processDepositRequest.js"; import {ProcessBlockOpts} from "./types.js"; -import {processConsolidationRequest} from "./processConsolidationRequest.js"; export { processProposerSlashing, diff --git a/packages/state-transition/src/block/processProposerSlashing.ts b/packages/state-transition/src/block/processProposerSlashing.ts index 70bd37092f98..c65fd567aa24 100644 --- a/packages/state-transition/src/block/processProposerSlashing.ts +++ b/packages/state-transition/src/block/processProposerSlashing.ts @@ -1,9 +1,9 @@ -import {phase0, ssz} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; +import {phase0, ssz} from "@lodestar/types"; +import {getProposerSlashingSignatureSets} from "../signatureSets/index.js"; +import {CachedBeaconStateAllForks} from "../types.js"; import {isSlashableValidator} from "../util/index.js"; import {verifySignatureSet} from "../util/signatureSets.js"; -import {CachedBeaconStateAllForks} from "../types.js"; -import {getProposerSlashingSignatureSets} from "../signatureSets/index.js"; import {slashValidator} from "./slashValidator.js"; /** diff --git a/packages/state-transition/src/block/processRandao.ts b/packages/state-transition/src/block/processRandao.ts index 65bcd60f52f6..b32ec43b6768 100644 --- a/packages/state-transition/src/block/processRandao.ts +++ b/packages/state-transition/src/block/processRandao.ts @@ -1,9 +1,9 @@ import {digest} from "@chainsafe/as-sha256"; -import {BeaconBlock} from "@lodestar/types"; import {EPOCHS_PER_HISTORICAL_VECTOR} from "@lodestar/params"; -import {getRandaoMix} from "../util/index.js"; +import {BeaconBlock} from "@lodestar/types"; import {verifyRandaoSignature} from "../signatureSets/index.js"; import {CachedBeaconStateAllForks} from "../types.js"; +import {getRandaoMix} from "../util/index.js"; /** * Commit a randao reveal to generate pseudorandomness seeds diff --git a/packages/state-transition/src/block/processSyncCommittee.ts b/packages/state-transition/src/block/processSyncCommittee.ts index 5f81a984b677..eaa98ac72a8d 100644 --- a/packages/state-transition/src/block/processSyncCommittee.ts +++ b/packages/state-transition/src/block/processSyncCommittee.ts @@ -1,9 +1,9 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {altair, ssz} from "@lodestar/types"; import {DOMAIN_SYNC_COMMITTEE, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {computeSigningRoot, ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/index.js"; -import {CachedBeaconStateAllForks} from "../types.js"; +import {altair, ssz} from "@lodestar/types"; import {G2_POINT_AT_INFINITY} from "../constants/index.js"; +import {CachedBeaconStateAllForks} from "../types.js"; +import {ISignatureSet, SignatureSetType, computeSigningRoot, verifySignatureSet} from "../util/index.js"; import {decreaseBalance, increaseBalance} from "../util/index.js"; export function processSyncAggregate( diff --git a/packages/state-transition/src/block/processVoluntaryExit.ts b/packages/state-transition/src/block/processVoluntaryExit.ts index b08aa7800884..a0a0271a0d1e 100644 --- a/packages/state-transition/src/block/processVoluntaryExit.ts +++ b/packages/state-transition/src/block/processVoluntaryExit.ts @@ -1,8 +1,8 @@ import {FAR_FUTURE_EPOCH, ForkSeq} from "@lodestar/params"; import {phase0} from "@lodestar/types"; -import {getPendingBalanceToWithdraw, isActiveValidator} from "../util/index.js"; -import {CachedBeaconStateAllForks, CachedBeaconStateElectra} from "../types.js"; import {verifyVoluntaryExitSignature} from "../signatureSets/index.js"; +import {CachedBeaconStateAllForks, CachedBeaconStateElectra} from "../types.js"; +import {getPendingBalanceToWithdraw, isActiveValidator} from "../util/index.js"; import {initiateValidatorExit} from "./index.js"; /** diff --git a/packages/state-transition/src/block/processWithdrawalRequest.ts b/packages/state-transition/src/block/processWithdrawalRequest.ts index e8a64ec63e41..573c0a49dfc8 100644 --- a/packages/state-transition/src/block/processWithdrawalRequest.ts +++ b/packages/state-transition/src/block/processWithdrawalRequest.ts @@ -1,17 +1,17 @@ -import {electra, phase0, ssz} from "@lodestar/types"; import { FAR_FUTURE_EPOCH, - MIN_ACTIVATION_BALANCE, - PENDING_PARTIAL_WITHDRAWALS_LIMIT, FULL_EXIT_REQUEST_AMOUNT, ForkSeq, + MIN_ACTIVATION_BALANCE, + PENDING_PARTIAL_WITHDRAWALS_LIMIT, } from "@lodestar/params"; +import {electra, phase0, ssz} from "@lodestar/types"; import {toHex} from "@lodestar/utils"; import {CachedBeaconStateElectra} from "../types.js"; import {hasCompoundingWithdrawalCredential, hasExecutionWithdrawalCredential} from "../util/electra.js"; -import {getPendingBalanceToWithdraw, isActiveValidator} from "../util/validator.js"; import {computeExitEpochAndUpdateChurn} from "../util/epoch.js"; +import {getPendingBalanceToWithdraw, isActiveValidator} from "../util/validator.js"; import {initiateValidatorExit} from "./initiateValidatorExit.js"; export function processWithdrawalRequest( diff --git a/packages/state-transition/src/block/processWithdrawals.ts b/packages/state-transition/src/block/processWithdrawals.ts index 610a2ed62b41..ab1df570eb30 100644 --- a/packages/state-transition/src/block/processWithdrawals.ts +++ b/packages/state-transition/src/block/processWithdrawals.ts @@ -1,14 +1,14 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {ssz, capella} from "@lodestar/types"; import { - MAX_WITHDRAWALS_PER_PAYLOAD, - MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP, + FAR_FUTURE_EPOCH, ForkSeq, + MAX_EFFECTIVE_BALANCE, MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP, - FAR_FUTURE_EPOCH, + MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP, + MAX_WITHDRAWALS_PER_PAYLOAD, MIN_ACTIVATION_BALANCE, - MAX_EFFECTIVE_BALANCE, } from "@lodestar/params"; +import {capella, ssz} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {CachedBeaconStateCapella, CachedBeaconStateElectra} from "../types.js"; diff --git a/packages/state-transition/src/block/slashValidator.ts b/packages/state-transition/src/block/slashValidator.ts index c4b7d5f848ea..2e1decec1e99 100644 --- a/packages/state-transition/src/block/slashValidator.ts +++ b/packages/state-transition/src/block/slashValidator.ts @@ -1,4 +1,3 @@ -import {ValidatorIndex} from "@lodestar/types"; import { EFFECTIVE_BALANCE_INCREMENT, EPOCHS_PER_SLASHINGS_VECTOR, @@ -14,9 +13,10 @@ import { WHISTLEBLOWER_REWARD_QUOTIENT, WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA, } from "@lodestar/params"; +import {ValidatorIndex} from "@lodestar/types"; -import {decreaseBalance, increaseBalance} from "../util/index.js"; import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js"; +import {decreaseBalance, increaseBalance} from "../util/index.js"; import {initiateValidatorExit} from "./initiateValidatorExit.js"; /** Same to https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.5/specs/altair/beacon-chain.md#has_flag */ diff --git a/packages/state-transition/src/cache/epochCache.ts b/packages/state-transition/src/cache/epochCache.ts index 66ce12b82d18..207267dff4f4 100644 --- a/packages/state-transition/src/cache/epochCache.ts +++ b/packages/state-transition/src/cache/epochCache.ts @@ -1,20 +1,6 @@ import {PublicKey} from "@chainsafe/blst"; -import * as immutable from "immutable"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import { - BLSSignature, - CommitteeIndex, - Epoch, - Slot, - ValidatorIndex, - phase0, - RootHex, - SyncPeriod, - Attestation, - IndexedAttestation, - electra, -} from "@lodestar/types"; -import {createBeaconConfig, BeaconConfig, ChainConfig} from "@lodestar/config"; +import {BeaconConfig, ChainConfig, createBeaconConfig} from "@lodestar/config"; import { ATTESTATION_SUBNET_COUNT, DOMAIN_BEACON_PROPOSER, @@ -26,47 +12,61 @@ import { SLOTS_PER_EPOCH, WEIGHT_DENOMINATOR, } from "@lodestar/params"; +import { + Attestation, + BLSSignature, + CommitteeIndex, + Epoch, + IndexedAttestation, + RootHex, + Slot, + SyncPeriod, + ValidatorIndex, + electra, + phase0, +} from "@lodestar/types"; import {LodestarError, fromHex} from "@lodestar/utils"; +import * as immutable from "immutable"; +import {getTotalSlashingsByIncrement} from "../epoch/processSlashings.js"; +import {EpochCacheMetrics} from "../metrics.js"; +import {AttesterDuty, calculateCommitteeAssignments} from "../util/calculateCommitteeAssignments.js"; +import { + EpochShuffling, + IShufflingCache, + calculateShufflingDecisionRoot, + computeEpochShuffling, +} from "../util/epochShuffling.js"; import { computeActivationExitEpoch, computeEpochAtSlot, + computeProposers, computeStartSlotAtEpoch, + computeSyncPeriodAtEpoch, + getActivationChurnLimit, getChurnLimit, + getSeed, isActiveValidator, isAggregatorFromCommitteeLength, - computeSyncPeriodAtEpoch, - getSeed, - computeProposers, - getActivationChurnLimit, } from "../util/index.js"; -import { - computeEpochShuffling, - EpochShuffling, - calculateShufflingDecisionRoot, - IShufflingCache, -} from "../util/epochShuffling.js"; import {computeBaseRewardPerIncrement, computeSyncParticipantReward} from "../util/syncCommittee.js"; import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalance.js"; -import {getTotalSlashingsByIncrement} from "../epoch/processSlashings.js"; -import {AttesterDuty, calculateCommitteeAssignments} from "../util/calculateCommitteeAssignments.js"; -import {EpochCacheMetrics} from "../metrics.js"; import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsWithLen} from "./effectiveBalanceIncrements.js"; -import {BeaconStateAllForks, BeaconStateAltair} from "./types.js"; import { Index2PubkeyCache, + PubkeyHex, UnfinalizedPubkeyIndexMap, + newUnfinalizedPubkeyIndexMap, syncPubkeys, toMemoryEfficientHexStr, - PubkeyHex, - newUnfinalizedPubkeyIndexMap, } from "./pubkeyCache.js"; +import {CachedBeaconStateAllForks} from "./stateCache.js"; import { - computeSyncCommitteeCache, - getSyncCommitteeCache, SyncCommitteeCache, SyncCommitteeCacheEmpty, + computeSyncCommitteeCache, + getSyncCommitteeCache, } from "./syncCommitteeCache.js"; -import {CachedBeaconStateAllForks} from "./stateCache.js"; +import {BeaconStateAllForks, BeaconStateAltair} from "./types.js"; /** `= PROPOSER_WEIGHT / (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT)` */ export const PROPOSER_WEIGHT_FACTOR = PROPOSER_WEIGHT / (WEIGHT_DENOMINATOR - PROPOSER_WEIGHT); diff --git a/packages/state-transition/src/cache/epochTransitionCache.ts b/packages/state-transition/src/cache/epochTransitionCache.ts index 2a35317fbc93..d86431c72eee 100644 --- a/packages/state-transition/src/cache/epochTransitionCache.ts +++ b/packages/state-transition/src/cache/epochTransitionCache.ts @@ -1,27 +1,27 @@ -import {phase0, Epoch, RootHex, ValidatorIndex} from "@lodestar/types"; -import {intDiv, toRootHex} from "@lodestar/utils"; import { EPOCHS_PER_SLASHINGS_VECTOR, FAR_FUTURE_EPOCH, ForkSeq, - SLOTS_PER_HISTORICAL_ROOT, MIN_ACTIVATION_BALANCE, + SLOTS_PER_HISTORICAL_ROOT, } from "@lodestar/params"; +import {Epoch, RootHex, ValidatorIndex, phase0} from "@lodestar/types"; +import {intDiv, toRootHex} from "@lodestar/utils"; +import {processPendingAttestations} from "../epoch/processPendingAttestations.js"; +import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../index.js"; +import {computeBaseRewardPerIncrement} from "../util/altair.js"; import { - hasMarkers, - FLAG_UNSLASHED, + FLAG_CURR_HEAD_ATTESTER, + FLAG_CURR_SOURCE_ATTESTER, + FLAG_CURR_TARGET_ATTESTER, FLAG_ELIGIBLE_ATTESTER, + FLAG_PREV_HEAD_ATTESTER, FLAG_PREV_SOURCE_ATTESTER, FLAG_PREV_TARGET_ATTESTER, - FLAG_PREV_HEAD_ATTESTER, - FLAG_CURR_SOURCE_ATTESTER, - FLAG_CURR_TARGET_ATTESTER, - FLAG_CURR_HEAD_ATTESTER, + FLAG_UNSLASHED, + hasMarkers, } from "../util/attesterStatus.js"; -import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../index.js"; -import {computeBaseRewardPerIncrement} from "../util/altair.js"; -import {processPendingAttestations} from "../epoch/processPendingAttestations.js"; export type EpochTransitionCacheOpts = { /** diff --git a/packages/state-transition/src/cache/pubkeyCache.ts b/packages/state-transition/src/cache/pubkeyCache.ts index f96436ec14f4..16c8f3de6787 100644 --- a/packages/state-transition/src/cache/pubkeyCache.ts +++ b/packages/state-transition/src/cache/pubkeyCache.ts @@ -1,7 +1,7 @@ import {PublicKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import * as immutable from "immutable"; import {ValidatorIndex, phase0} from "@lodestar/types"; +import * as immutable from "immutable"; export type Index2PubkeyCache = PublicKey[]; /** diff --git a/packages/state-transition/src/cache/stateCache.ts b/packages/state-transition/src/cache/stateCache.ts index 3eeeb285b660..6690f8f5c3db 100644 --- a/packages/state-transition/src/cache/stateCache.ts +++ b/packages/state-transition/src/cache/stateCache.ts @@ -2,17 +2,17 @@ import {PublicKey} from "@chainsafe/blst"; import {BeaconConfig} from "@lodestar/config"; import {loadState} from "../util/loadState/loadState.js"; import {EpochCache, EpochCacheImmutableData, EpochCacheOpts} from "./epochCache.js"; +import {RewardCache, createEmptyRewardCache} from "./rewardCache.js"; import { BeaconStateAllForks, - BeaconStateExecutions, - BeaconStatePhase0, BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, BeaconStateDeneb, BeaconStateElectra, + BeaconStateExecutions, + BeaconStatePhase0, } from "./types.js"; -import {RewardCache, createEmptyRewardCache} from "./rewardCache.js"; export type BeaconStateCache = { config: BeaconConfig; diff --git a/packages/state-transition/src/cache/syncCommitteeCache.ts b/packages/state-transition/src/cache/syncCommitteeCache.ts index b9a65302c3e2..3f79a45f3573 100644 --- a/packages/state-transition/src/cache/syncCommitteeCache.ts +++ b/packages/state-transition/src/cache/syncCommitteeCache.ts @@ -1,6 +1,6 @@ -import {CompositeViewDU} from "@chainsafe/ssz"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {ssz, ValidatorIndex} from "@lodestar/types"; +import {CompositeViewDU} from "@chainsafe/ssz"; +import {ValidatorIndex, ssz} from "@lodestar/types"; import {toPubkeyHex} from "@lodestar/utils"; type SyncComitteeValidatorIndexMap = Map; diff --git a/packages/state-transition/src/cache/types.ts b/packages/state-transition/src/cache/types.ts index b3fe6fc8ed5b..625e47270782 100644 --- a/packages/state-transition/src/cache/types.ts +++ b/packages/state-transition/src/cache/types.ts @@ -1,6 +1,6 @@ import {CompositeViewDU} from "@chainsafe/ssz"; -import {Epoch, RootHex, SSZTypesFor} from "@lodestar/types"; import {ForkAll, ForkExecution, ForkName} from "@lodestar/params"; +import {Epoch, RootHex, SSZTypesFor} from "@lodestar/types"; import {EpochShuffling} from "../util/epochShuffling.js"; export type BeaconStatePhase0 = CompositeViewDU>; diff --git a/packages/state-transition/src/epoch/computeUnrealizedCheckpoints.ts b/packages/state-transition/src/epoch/computeUnrealizedCheckpoints.ts index 3baed0f42cbe..d93b4e4f6d10 100644 --- a/packages/state-transition/src/epoch/computeUnrealizedCheckpoints.ts +++ b/packages/state-transition/src/epoch/computeUnrealizedCheckpoints.ts @@ -1,10 +1,10 @@ import {ForkSeq, GENESIS_EPOCH} from "@lodestar/params"; import {phase0} from "@lodestar/types"; -import {CachedBeaconStateAllForks} from "../types.js"; import {beforeProcessEpoch} from "../cache/epochTransitionCache.js"; +import {CachedBeaconStateAllForks} from "../types.js"; import { - weighJustificationAndFinalization, processJustificationAndFinalization, + weighJustificationAndFinalization, } from "./processJustificationAndFinalization.js"; /** diff --git a/packages/state-transition/src/epoch/getAttestationDeltas.ts b/packages/state-transition/src/epoch/getAttestationDeltas.ts index dd69738a55b5..d9172fd69702 100644 --- a/packages/state-transition/src/epoch/getAttestationDeltas.ts +++ b/packages/state-transition/src/epoch/getAttestationDeltas.ts @@ -1,4 +1,3 @@ -import {bigIntSqrt, bnToNum} from "@lodestar/utils"; import { BASE_REWARD_FACTOR, EFFECTIVE_BALANCE_INCREMENT, @@ -6,10 +5,11 @@ import { MIN_EPOCHS_TO_INACTIVITY_PENALTY, PROPOSER_REWARD_QUOTIENT, } from "@lodestar/params"; +import {bigIntSqrt, bnToNum} from "@lodestar/utils"; import {BASE_REWARDS_PER_EPOCH as BASE_REWARDS_PER_EPOCH_CONST} from "../constants/index.js"; -import {newZeroedArray} from "../util/index.js"; -import {EpochTransitionCache, CachedBeaconStatePhase0} from "../types.js"; +import {CachedBeaconStatePhase0, EpochTransitionCache} from "../types.js"; import {hasMarkers} from "../util/attesterStatus.js"; +import {newZeroedArray} from "../util/index.js"; /** * Redefine constants in attesterStatus to improve performance diff --git a/packages/state-transition/src/epoch/getRewardsAndPenalties.ts b/packages/state-transition/src/epoch/getRewardsAndPenalties.ts index bf766fe4666a..c7619873c202 100644 --- a/packages/state-transition/src/epoch/getRewardsAndPenalties.ts +++ b/packages/state-transition/src/epoch/getRewardsAndPenalties.ts @@ -1,5 +1,6 @@ import { EFFECTIVE_BALANCE_INCREMENT, + ForkSeq, INACTIVITY_PENALTY_QUOTIENT_ALTAIR, INACTIVITY_PENALTY_QUOTIENT_BELLATRIX, PARTICIPATION_FLAG_WEIGHTS, @@ -7,7 +8,6 @@ import { TIMELY_SOURCE_FLAG_INDEX, TIMELY_TARGET_FLAG_INDEX, WEIGHT_DENOMINATOR, - ForkSeq, } from "@lodestar/params"; import {CachedBeaconStateAltair, EpochTransitionCache} from "../types.js"; import { diff --git a/packages/state-transition/src/epoch/index.ts b/packages/state-transition/src/epoch/index.ts index b0b1651321d5..50118f5d4949 100644 --- a/packages/state-transition/src/epoch/index.ts +++ b/packages/state-transition/src/epoch/index.ts @@ -5,15 +5,15 @@ import { MAX_VALIDATORS_PER_COMMITTEE, SLOTS_PER_EPOCH, } from "@lodestar/params"; +import {BeaconStateTransitionMetrics} from "../metrics.js"; import { CachedBeaconStateAllForks, - CachedBeaconStateCapella, CachedBeaconStateAltair, + CachedBeaconStateCapella, + CachedBeaconStateElectra, CachedBeaconStatePhase0, EpochTransitionCache, - CachedBeaconStateElectra, } from "../types.js"; -import {BeaconStateTransitionMetrics} from "../metrics.js"; import {processEffectiveBalanceUpdates} from "./processEffectiveBalanceUpdates.js"; import {processEth1DataReset} from "./processEth1DataReset.js"; import {processHistoricalRootsUpdate} from "./processHistoricalRootsUpdate.js"; @@ -22,14 +22,14 @@ import {processInactivityUpdates} from "./processInactivityUpdates.js"; import {processJustificationAndFinalization} from "./processJustificationAndFinalization.js"; import {processParticipationFlagUpdates} from "./processParticipationFlagUpdates.js"; import {processParticipationRecordUpdates} from "./processParticipationRecordUpdates.js"; +import {processPendingConsolidations} from "./processPendingConsolidations.js"; +import {processPendingDeposits} from "./processPendingDeposits.js"; import {processRandaoMixesReset} from "./processRandaoMixesReset.js"; import {processRegistryUpdates} from "./processRegistryUpdates.js"; import {processRewardsAndPenalties} from "./processRewardsAndPenalties.js"; import {processSlashings} from "./processSlashings.js"; import {processSlashingsReset} from "./processSlashingsReset.js"; import {processSyncCommitteeUpdates} from "./processSyncCommitteeUpdates.js"; -import {processPendingDeposits} from "./processPendingDeposits.js"; -import {processPendingConsolidations} from "./processPendingConsolidations.js"; // For spec tests export {getRewardsAndPenalties} from "./processRewardsAndPenalties.js"; diff --git a/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts b/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts index 1fe5c92eea1a..d55f37aba178 100644 --- a/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts +++ b/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts @@ -7,7 +7,7 @@ import { MAX_EFFECTIVE_BALANCE, TIMELY_TARGET_FLAG_INDEX, } from "@lodestar/params"; -import {EpochTransitionCache, CachedBeaconStateAllForks, BeaconStateAltair} from "../types.js"; +import {BeaconStateAltair, CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; import {getMaxEffectiveBalance} from "../util/validator.js"; /** Same to https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.5/specs/altair/beacon-chain.md#has_flag */ diff --git a/packages/state-transition/src/epoch/processEth1DataReset.ts b/packages/state-transition/src/epoch/processEth1DataReset.ts index a16f865fdc07..d783389e2f24 100644 --- a/packages/state-transition/src/epoch/processEth1DataReset.ts +++ b/packages/state-transition/src/epoch/processEth1DataReset.ts @@ -1,6 +1,6 @@ import {EPOCHS_PER_ETH1_VOTING_PERIOD} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {EpochTransitionCache, CachedBeaconStateAllForks} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; /** * Reset eth1DataVotes tree every `EPOCHS_PER_ETH1_VOTING_PERIOD`. diff --git a/packages/state-transition/src/epoch/processHistoricalRootsUpdate.ts b/packages/state-transition/src/epoch/processHistoricalRootsUpdate.ts index e649e1c9678b..a396738fc840 100644 --- a/packages/state-transition/src/epoch/processHistoricalRootsUpdate.ts +++ b/packages/state-transition/src/epoch/processHistoricalRootsUpdate.ts @@ -1,7 +1,7 @@ import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {ssz} from "@lodestar/types"; import {intDiv} from "@lodestar/utils"; -import {EpochTransitionCache, CachedBeaconStateAllForks} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; /** * Persist blockRoots and stateRoots to historicalRoots. diff --git a/packages/state-transition/src/epoch/processHistoricalSummariesUpdate.ts b/packages/state-transition/src/epoch/processHistoricalSummariesUpdate.ts index 17da010dfa91..38bdc591ef32 100644 --- a/packages/state-transition/src/epoch/processHistoricalSummariesUpdate.ts +++ b/packages/state-transition/src/epoch/processHistoricalSummariesUpdate.ts @@ -1,7 +1,7 @@ import {SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {ssz} from "@lodestar/types"; import {intDiv} from "@lodestar/utils"; -import {EpochTransitionCache, CachedBeaconStateCapella} from "../types.js"; +import {CachedBeaconStateCapella, EpochTransitionCache} from "../types.js"; /** * Persist blockRoots and stateRoots to historicalSummaries. diff --git a/packages/state-transition/src/epoch/processJustificationAndFinalization.ts b/packages/state-transition/src/epoch/processJustificationAndFinalization.ts index 8526b7f3a749..845a98337be7 100644 --- a/packages/state-transition/src/epoch/processJustificationAndFinalization.ts +++ b/packages/state-transition/src/epoch/processJustificationAndFinalization.ts @@ -1,8 +1,8 @@ import {BitArray} from "@chainsafe/ssz"; import {GENESIS_EPOCH} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {computeEpochAtSlot, getBlockRoot} from "../util/index.js"; import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; +import {computeEpochAtSlot, getBlockRoot} from "../util/index.js"; /** * Update justified and finalized checkpoints depending on network participation. diff --git a/packages/state-transition/src/epoch/processPendingDeposits.ts b/packages/state-transition/src/epoch/processPendingDeposits.ts index 53af3ab38763..866dcc2510ad 100644 --- a/packages/state-transition/src/epoch/processPendingDeposits.ts +++ b/packages/state-transition/src/epoch/processPendingDeposits.ts @@ -1,10 +1,10 @@ import {FAR_FUTURE_EPOCH, ForkSeq, GENESIS_SLOT, MAX_PENDING_DEPOSITS_PER_EPOCH} from "@lodestar/params"; import {PendingDeposit} from "@lodestar/types/lib/electra/types.js"; +import {addValidatorToRegistry, isValidDepositSignature} from "../block/processDeposit.js"; import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js"; import {increaseBalance} from "../util/balance.js"; -import {getActivationExitChurnLimit} from "../util/validator.js"; import {computeStartSlotAtEpoch} from "../util/epoch.js"; -import {addValidatorToRegistry, isValidDepositSignature} from "../block/processDeposit.js"; +import {getActivationExitChurnLimit} from "../util/validator.js"; /** * Starting from Electra: diff --git a/packages/state-transition/src/epoch/processRandaoMixesReset.ts b/packages/state-transition/src/epoch/processRandaoMixesReset.ts index afb45ba39d19..d50ae1261778 100644 --- a/packages/state-transition/src/epoch/processRandaoMixesReset.ts +++ b/packages/state-transition/src/epoch/processRandaoMixesReset.ts @@ -1,5 +1,5 @@ import {EPOCHS_PER_HISTORICAL_VECTOR} from "@lodestar/params"; -import {EpochTransitionCache, CachedBeaconStateAllForks} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; /** * Write next randaoMix diff --git a/packages/state-transition/src/epoch/processRegistryUpdates.ts b/packages/state-transition/src/epoch/processRegistryUpdates.ts index d2e93632dabe..05b3b2c8f9ed 100644 --- a/packages/state-transition/src/epoch/processRegistryUpdates.ts +++ b/packages/state-transition/src/epoch/processRegistryUpdates.ts @@ -1,7 +1,7 @@ import {ForkSeq} from "@lodestar/params"; -import {computeActivationExitEpoch} from "../util/index.js"; import {initiateValidatorExit} from "../block/index.js"; -import {EpochTransitionCache, CachedBeaconStateAllForks} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; +import {computeActivationExitEpoch} from "../util/index.js"; /** * Update validator registry for validators that activate + exit diff --git a/packages/state-transition/src/epoch/processSlashings.ts b/packages/state-transition/src/epoch/processSlashings.ts index 23ee815cabb3..09b93b21042d 100644 --- a/packages/state-transition/src/epoch/processSlashings.ts +++ b/packages/state-transition/src/epoch/processSlashings.ts @@ -6,8 +6,8 @@ import { PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX, } from "@lodestar/params"; -import {decreaseBalance} from "../util/index.js"; import {BeaconStateAllForks, CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; +import {decreaseBalance} from "../util/index.js"; /** * Update validator registry for validators that activate + exit diff --git a/packages/state-transition/src/epoch/processSlashingsReset.ts b/packages/state-transition/src/epoch/processSlashingsReset.ts index 6ab22d47526c..68857b266db7 100644 --- a/packages/state-transition/src/epoch/processSlashingsReset.ts +++ b/packages/state-transition/src/epoch/processSlashingsReset.ts @@ -1,5 +1,5 @@ import {EFFECTIVE_BALANCE_INCREMENT, EPOCHS_PER_SLASHINGS_VECTOR} from "@lodestar/params"; -import {EpochTransitionCache, CachedBeaconStateAllForks} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; /** * Reset the next slashings balance accumulator diff --git a/packages/state-transition/src/epoch/processSyncCommitteeUpdates.ts b/packages/state-transition/src/epoch/processSyncCommitteeUpdates.ts index f01f2055420a..4d8106328958 100644 --- a/packages/state-transition/src/epoch/processSyncCommitteeUpdates.ts +++ b/packages/state-transition/src/epoch/processSyncCommitteeUpdates.ts @@ -1,8 +1,8 @@ import {aggregateSerializedPublicKeys} from "@chainsafe/blst"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, ForkSeq} from "@lodestar/params"; import {ssz} from "@lodestar/types"; -import {getNextSyncCommitteeIndices} from "../util/seed.js"; import {CachedBeaconStateAltair} from "../types.js"; +import {getNextSyncCommitteeIndices} from "../util/seed.js"; /** * Rotate nextSyncCommittee to currentSyncCommittee if sync committee period is over. diff --git a/packages/state-transition/src/metrics.ts b/packages/state-transition/src/metrics.ts index ac558a1be139..fee20de1d565 100644 --- a/packages/state-transition/src/metrics.ts +++ b/packages/state-transition/src/metrics.ts @@ -1,8 +1,8 @@ import {Epoch} from "@lodestar/types"; import {Gauge, Histogram} from "@lodestar/utils"; -import {CachedBeaconStateAllForks} from "./types.js"; -import {StateCloneSource, StateHashTreeRootSource} from "./stateTransition.js"; import {EpochTransitionStep} from "./epoch/index.js"; +import {StateCloneSource, StateHashTreeRootSource} from "./stateTransition.js"; +import {CachedBeaconStateAllForks} from "./types.js"; export type BeaconStateTransitionMetrics = { epochTransitionTime: Histogram; diff --git a/packages/state-transition/src/signatureSets/attesterSlashings.ts b/packages/state-transition/src/signatureSets/attesterSlashings.ts index 36f31d97e083..b053bb497805 100644 --- a/packages/state-transition/src/signatureSets/attesterSlashings.ts +++ b/packages/state-transition/src/signatureSets/attesterSlashings.ts @@ -1,7 +1,7 @@ -import {SignedBeaconBlock, ssz, AttesterSlashing, IndexedAttestationBigint} from "@lodestar/types"; import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params"; -import {computeSigningRoot, computeStartSlotAtEpoch, ISignatureSet, SignatureSetType} from "../util/index.js"; +import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, ssz} from "@lodestar/types"; import {CachedBeaconStateAllForks} from "../types.js"; +import {ISignatureSet, SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch} from "../util/index.js"; /** Get signature sets from all AttesterSlashing objects in a block */ export function getAttesterSlashingsSignatureSets( diff --git a/packages/state-transition/src/signatureSets/blsToExecutionChange.ts b/packages/state-transition/src/signatureSets/blsToExecutionChange.ts index 672ad546dfc8..22a5826c4a3a 100644 --- a/packages/state-transition/src/signatureSets/blsToExecutionChange.ts +++ b/packages/state-transition/src/signatureSets/blsToExecutionChange.ts @@ -1,10 +1,10 @@ import {PublicKey} from "@chainsafe/blst"; +import {BeaconConfig} from "@lodestar/config"; import {DOMAIN_BLS_TO_EXECUTION_CHANGE, ForkName} from "@lodestar/params"; import {capella, ssz} from "@lodestar/types"; -import {BeaconConfig} from "@lodestar/config"; -import {computeSigningRoot, ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/index.js"; import {CachedBeaconStateAllForks} from "../types.js"; +import {ISignatureSet, SignatureSetType, computeSigningRoot, verifySignatureSet} from "../util/index.js"; export function verifyBlsToExecutionChangeSignature( state: CachedBeaconStateAllForks, diff --git a/packages/state-transition/src/signatureSets/index.ts b/packages/state-transition/src/signatureSets/index.ts index c883bb0587f8..ac10abef6b34 100644 --- a/packages/state-transition/src/signatureSets/index.ts +++ b/packages/state-transition/src/signatureSets/index.ts @@ -1,15 +1,15 @@ import {ForkSeq} from "@lodestar/params"; import {SignedBeaconBlock, altair, capella} from "@lodestar/types"; -import {ISignatureSet} from "../util/index.js"; -import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js"; import {getSyncCommitteeSignatureSet} from "../block/processSyncCommittee.js"; -import {getProposerSlashingsSignatureSets} from "./proposerSlashings.js"; +import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js"; +import {ISignatureSet} from "../util/index.js"; import {getAttesterSlashingsSignatureSets} from "./attesterSlashings.js"; +import {getBlsToExecutionChangeSignatureSets} from "./blsToExecutionChange.js"; import {getAttestationsSignatureSets} from "./indexedAttestation.js"; import {getBlockProposerSignatureSet} from "./proposer.js"; +import {getProposerSlashingsSignatureSets} from "./proposerSlashings.js"; import {getRandaoRevealSignatureSet} from "./randao.js"; import {getVoluntaryExitsSignatureSets} from "./voluntaryExits.js"; -import {getBlsToExecutionChangeSignatureSets} from "./blsToExecutionChange.js"; export * from "./attesterSlashings.js"; export * from "./indexedAttestation.js"; diff --git a/packages/state-transition/src/signatureSets/indexedAttestation.ts b/packages/state-transition/src/signatureSets/indexedAttestation.ts index 86535fece8b8..2a0765ee60c1 100644 --- a/packages/state-transition/src/signatureSets/indexedAttestation.ts +++ b/packages/state-transition/src/signatureSets/indexedAttestation.ts @@ -1,12 +1,12 @@ import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params"; import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types"; +import {CachedBeaconStateAllForks} from "../types.js"; import { + ISignatureSet, computeSigningRoot, computeStartSlotAtEpoch, createAggregateSignatureSetFromComponents, - ISignatureSet, } from "../util/index.js"; -import {CachedBeaconStateAllForks} from "../types.js"; export function getAttestationDataSigningRoot( state: CachedBeaconStateAllForks, diff --git a/packages/state-transition/src/signatureSets/proposer.ts b/packages/state-transition/src/signatureSets/proposer.ts index e5ae7fd1f6f1..dd662931815f 100644 --- a/packages/state-transition/src/signatureSets/proposer.ts +++ b/packages/state-transition/src/signatureSets/proposer.ts @@ -1,8 +1,8 @@ import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params"; import {SignedBeaconBlock, SignedBlindedBeaconBlock, isBlindedBeaconBlock, phase0, ssz} from "@lodestar/types"; +import {CachedBeaconStateAllForks} from "../types.js"; import {computeSigningRoot} from "../util/index.js"; import {ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/signatureSets.js"; -import {CachedBeaconStateAllForks} from "../types.js"; export function verifyProposerSignature( state: CachedBeaconStateAllForks, diff --git a/packages/state-transition/src/signatureSets/proposerSlashings.ts b/packages/state-transition/src/signatureSets/proposerSlashings.ts index b0c1aa465bd5..d21c0906c511 100644 --- a/packages/state-transition/src/signatureSets/proposerSlashings.ts +++ b/packages/state-transition/src/signatureSets/proposerSlashings.ts @@ -1,7 +1,7 @@ import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params"; import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types"; -import {computeSigningRoot, ISignatureSet, SignatureSetType} from "../util/index.js"; import {CachedBeaconStateAllForks} from "../types.js"; +import {ISignatureSet, SignatureSetType, computeSigningRoot} from "../util/index.js"; /** * Extract signatures to allow validating all block signatures at once diff --git a/packages/state-transition/src/signatureSets/randao.ts b/packages/state-transition/src/signatureSets/randao.ts index 41422a9c1d00..495212f6aa2f 100644 --- a/packages/state-transition/src/signatureSets/randao.ts +++ b/packages/state-transition/src/signatureSets/randao.ts @@ -1,13 +1,13 @@ import {DOMAIN_RANDAO} from "@lodestar/params"; import {BeaconBlock, ssz} from "@lodestar/types"; +import {CachedBeaconStateAllForks} from "../types.js"; import { - computeEpochAtSlot, - computeSigningRoot, ISignatureSet, SignatureSetType, + computeEpochAtSlot, + computeSigningRoot, verifySignatureSet, } from "../util/index.js"; -import {CachedBeaconStateAllForks} from "../types.js"; export function verifyRandaoSignature(state: CachedBeaconStateAllForks, block: BeaconBlock): boolean { return verifySignatureSet(getRandaoRevealSignatureSet(state, block)); diff --git a/packages/state-transition/src/signatureSets/voluntaryExits.ts b/packages/state-transition/src/signatureSets/voluntaryExits.ts index 51dd20d671b6..9fae3f920da0 100644 --- a/packages/state-transition/src/signatureSets/voluntaryExits.ts +++ b/packages/state-transition/src/signatureSets/voluntaryExits.ts @@ -1,12 +1,12 @@ import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types"; +import {CachedBeaconStateAllForks} from "../types.js"; import { - computeSigningRoot, - computeStartSlotAtEpoch, ISignatureSet, SignatureSetType, + computeSigningRoot, + computeStartSlotAtEpoch, verifySignatureSet, } from "../util/index.js"; -import {CachedBeaconStateAllForks} from "../types.js"; export function verifyVoluntaryExitSignature( state: CachedBeaconStateAllForks, diff --git a/packages/state-transition/src/slot/index.ts b/packages/state-transition/src/slot/index.ts index b05bd7ac93f2..0f2fa471f2f0 100644 --- a/packages/state-transition/src/slot/index.ts +++ b/packages/state-transition/src/slot/index.ts @@ -1,7 +1,7 @@ import {byteArrayEquals} from "@chainsafe/ssz"; import {SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; -import {CachedBeaconStateAllForks} from "../types.js"; import {ZERO_HASH} from "../constants/index.js"; +import {CachedBeaconStateAllForks} from "../types.js"; export {upgradeStateToAltair} from "./upgradeStateToAltair.js"; export {upgradeStateToBellatrix} from "./upgradeStateToBellatrix.js"; diff --git a/packages/state-transition/src/slot/upgradeStateToAltair.ts b/packages/state-transition/src/slot/upgradeStateToAltair.ts index 22ab8b13882c..ec6661d0d7ad 100644 --- a/packages/state-transition/src/slot/upgradeStateToAltair.ts +++ b/packages/state-transition/src/slot/upgradeStateToAltair.ts @@ -1,12 +1,12 @@ import {CompositeViewDU} from "@chainsafe/ssz"; -import {ssz} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; -import {CachedBeaconStatePhase0, CachedBeaconStateAltair} from "../types.js"; -import {newZeroedArray, RootCache} from "../util/index.js"; +import {ssz} from "@lodestar/types"; +import {getAttestationParticipationStatus} from "../block/processAttestationsAltair.js"; +import {getCachedBeaconState} from "../cache/stateCache.js"; +import {CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../types.js"; +import {RootCache, newZeroedArray} from "../util/index.js"; import {getNextSyncCommittee} from "../util/syncCommittee.js"; import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalance.js"; -import {getCachedBeaconState} from "../cache/stateCache.js"; -import {getAttestationParticipationStatus} from "../block/processAttestationsAltair.js"; /** * Upgrade a state from phase0 to altair. diff --git a/packages/state-transition/src/slot/upgradeStateToBellatrix.ts b/packages/state-transition/src/slot/upgradeStateToBellatrix.ts index abcaed50a749..969357279d4a 100644 --- a/packages/state-transition/src/slot/upgradeStateToBellatrix.ts +++ b/packages/state-transition/src/slot/upgradeStateToBellatrix.ts @@ -1,6 +1,6 @@ import {ssz} from "@lodestar/types"; -import {CachedBeaconStateAltair, CachedBeaconStateBellatrix} from "../types.js"; import {getCachedBeaconState} from "../cache/stateCache.js"; +import {CachedBeaconStateAltair, CachedBeaconStateBellatrix} from "../types.js"; /** * Upgrade a state from altair to bellatrix. diff --git a/packages/state-transition/src/slot/upgradeStateToCapella.ts b/packages/state-transition/src/slot/upgradeStateToCapella.ts index 30a0701e58e8..06f30ec0360a 100644 --- a/packages/state-transition/src/slot/upgradeStateToCapella.ts +++ b/packages/state-transition/src/slot/upgradeStateToCapella.ts @@ -1,6 +1,6 @@ import {ssz} from "@lodestar/types"; -import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; import {getCachedBeaconState} from "../cache/stateCache.js"; +import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; /** * Upgrade a state from bellatrix to capella. diff --git a/packages/state-transition/src/slot/upgradeStateToDeneb.ts b/packages/state-transition/src/slot/upgradeStateToDeneb.ts index 2344a8d4e08e..158b66db4e71 100644 --- a/packages/state-transition/src/slot/upgradeStateToDeneb.ts +++ b/packages/state-transition/src/slot/upgradeStateToDeneb.ts @@ -1,6 +1,6 @@ import {ssz} from "@lodestar/types"; -import {CachedBeaconStateDeneb} from "../types.js"; import {getCachedBeaconState} from "../cache/stateCache.js"; +import {CachedBeaconStateDeneb} from "../types.js"; import {CachedBeaconStateCapella} from "../types.js"; /** diff --git a/packages/state-transition/src/slot/upgradeStateToElectra.ts b/packages/state-transition/src/slot/upgradeStateToElectra.ts index a3c8981ab13f..f030f9d572fe 100644 --- a/packages/state-transition/src/slot/upgradeStateToElectra.ts +++ b/packages/state-transition/src/slot/upgradeStateToElectra.ts @@ -1,11 +1,11 @@ -import {Epoch, ValidatorIndex, ssz} from "@lodestar/types"; import {FAR_FUTURE_EPOCH, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params"; -import {CachedBeaconStateDeneb} from "../types.js"; +import {Epoch, 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"; import {hasCompoundingWithdrawalCredential, queueExcessActiveBalance} from "../util/electra.js"; import {computeActivationExitEpoch} from "../util/epoch.js"; import {getActivationExitChurnLimit, getConsolidationChurnLimit} from "../util/validator.js"; -import {G2_POINT_AT_INFINITY} from "../constants/constants.js"; /** * Upgrade a state from Deneb to Electra. diff --git a/packages/state-transition/src/stateTransition.ts b/packages/state-transition/src/stateTransition.ts index f025c685b1a6..929a37468c6e 100644 --- a/packages/state-transition/src/stateTransition.ts +++ b/packages/state-transition/src/stateTransition.ts @@ -1,17 +1,12 @@ -import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, ssz} from "@lodestar/types"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, ssz} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; +import {BlockExternalData, DataAvailableStatus, ExecutionPayloadStatus} from "./block/externalData.js"; +import {processBlock} from "./block/index.js"; +import {ProcessBlockOpts} from "./block/types.js"; +import {EpochTransitionCache, EpochTransitionCacheOpts, beforeProcessEpoch} from "./cache/epochTransitionCache.js"; +import {EpochTransitionStep, processEpoch} from "./epoch/index.js"; import {BeaconStateTransitionMetrics, onPostStateMetrics, onStateCloneMetrics} from "./metrics.js"; -import {beforeProcessEpoch, EpochTransitionCache, EpochTransitionCacheOpts} from "./cache/epochTransitionCache.js"; -import { - CachedBeaconStateAllForks, - CachedBeaconStatePhase0, - CachedBeaconStateAltair, - CachedBeaconStateBellatrix, - CachedBeaconStateCapella, - CachedBeaconStateDeneb, -} from "./types.js"; -import {computeEpochAtSlot} from "./util/index.js"; import {verifyProposerSignature} from "./signatureSets/index.js"; import { processSlot, @@ -21,10 +16,15 @@ import { upgradeStateToDeneb, upgradeStateToElectra, } from "./slot/index.js"; -import {processBlock} from "./block/index.js"; -import {EpochTransitionStep, processEpoch} from "./epoch/index.js"; -import {BlockExternalData, DataAvailableStatus, ExecutionPayloadStatus} from "./block/externalData.js"; -import {ProcessBlockOpts} from "./block/types.js"; +import { + CachedBeaconStateAllForks, + CachedBeaconStateAltair, + CachedBeaconStateBellatrix, + CachedBeaconStateCapella, + CachedBeaconStateDeneb, + CachedBeaconStatePhase0, +} from "./types.js"; +import {computeEpochAtSlot} from "./util/index.js"; // Multifork capable state transition diff --git a/packages/state-transition/src/util/aggregator.ts b/packages/state-transition/src/util/aggregator.ts index 02afda67cc42..dc4e140bb4cd 100644 --- a/packages/state-transition/src/util/aggregator.ts +++ b/packages/state-transition/src/util/aggregator.ts @@ -1,12 +1,12 @@ import {digest} from "@chainsafe/as-sha256"; -import {BLSSignature} from "@lodestar/types"; -import {intDiv, bytesToBigInt} from "@lodestar/utils"; import { - TARGET_AGGREGATORS_PER_COMMITTEE, SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT, + TARGET_AGGREGATORS_PER_COMMITTEE, TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, } from "@lodestar/params"; +import {BLSSignature} from "@lodestar/types"; +import {bytesToBigInt, intDiv} from "@lodestar/utils"; const ZERO_BIGINT = BigInt(0); diff --git a/packages/state-transition/src/util/attestation.ts b/packages/state-transition/src/util/attestation.ts index cfa8f512e7d5..f45011b1e838 100644 --- a/packages/state-transition/src/util/attestation.ts +++ b/packages/state-transition/src/util/attestation.ts @@ -1,5 +1,5 @@ import {MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {phase0, Slot, ssz, ValidatorIndex} from "@lodestar/types"; +import {Slot, ValidatorIndex, phase0, ssz} from "@lodestar/types"; /** * Check if [[data1]] and [[data2]] are slashable according to Casper FFG rules. diff --git a/packages/state-transition/src/util/blindedBlock.ts b/packages/state-transition/src/util/blindedBlock.ts index 1793ff37255e..7d25fb25e22c 100644 --- a/packages/state-transition/src/util/blindedBlock.ts +++ b/packages/state-transition/src/util/blindedBlock.ts @@ -1,20 +1,20 @@ import {ChainForkConfig} from "@lodestar/config"; import {ForkExecution, ForkSeq} from "@lodestar/params"; import { - Root, - isBlindedBeaconBlock, - isExecutionPayloadAndBlobsBundle, BeaconBlock, BeaconBlockHeader, - SignedBeaconBlock, + BlindedBeaconBlock, + BlobsBundle, + Contents, ExecutionPayload, ExecutionPayloadAndBlobsBundle, - BlobsBundle, + ExecutionPayloadHeader, + Root, + SignedBeaconBlock, SignedBeaconBlockOrContents, - Contents, SignedBlindedBeaconBlock, - BlindedBeaconBlock, - ExecutionPayloadHeader, + isBlindedBeaconBlock, + isExecutionPayloadAndBlobsBundle, } from "@lodestar/types"; import {executionPayloadToPayloadHeader} from "./execution.js"; diff --git a/packages/state-transition/src/util/blockRoot.ts b/packages/state-transition/src/util/blockRoot.ts index 54d96885e675..c446c9dec386 100644 --- a/packages/state-transition/src/util/blockRoot.ts +++ b/packages/state-transition/src/util/blockRoot.ts @@ -1,14 +1,14 @@ +import {ChainForkConfig} from "@lodestar/config"; +import {SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import { + BeaconBlock, + BeaconBlockHeader, Epoch, - Slot, Root, - BeaconBlock, SignedBeaconBlock, - BeaconBlockHeader, SignedBeaconBlockHeader, + Slot, } from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; -import {SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; import {ZERO_HASH} from "../constants/index.js"; import {BeaconStateAllForks} from "../types.js"; import {computeStartSlotAtEpoch} from "./epoch.js"; diff --git a/packages/state-transition/src/util/calculateCommitteeAssignments.ts b/packages/state-transition/src/util/calculateCommitteeAssignments.ts index 992c5efbdaaa..008161afa04b 100644 --- a/packages/state-transition/src/util/calculateCommitteeAssignments.ts +++ b/packages/state-transition/src/util/calculateCommitteeAssignments.ts @@ -1,5 +1,5 @@ -import {CommitteeIndex, Slot, ValidatorIndex} from "@lodestar/types"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {CommitteeIndex, Slot, ValidatorIndex} from "@lodestar/types"; import {EpochShuffling} from "./epochShuffling.js"; // Copied from lodestar-api package to avoid depending on the package diff --git a/packages/state-transition/src/util/computeAnchorCheckpoint.ts b/packages/state-transition/src/util/computeAnchorCheckpoint.ts index e37ffc2c632d..1edb2ac57ca2 100644 --- a/packages/state-transition/src/util/computeAnchorCheckpoint.ts +++ b/packages/state-transition/src/util/computeAnchorCheckpoint.ts @@ -1,6 +1,6 @@ import {ChainForkConfig} from "@lodestar/config"; -import {ssz, phase0} from "@lodestar/types"; import {GENESIS_SLOT, ZERO_HASH} from "@lodestar/params"; +import {phase0, ssz} from "@lodestar/types"; import {BeaconStateAllForks} from "../types.js"; import {blockToHeader} from "./blockRoot.js"; import {computeCheckpointEpochAtStateSlot} from "./epoch.js"; diff --git a/packages/state-transition/src/util/domain.ts b/packages/state-transition/src/util/domain.ts index b84e5bca44f4..1368834aaa2f 100644 --- a/packages/state-transition/src/util/domain.ts +++ b/packages/state-transition/src/util/domain.ts @@ -1,4 +1,4 @@ -import {Epoch, Version, Root, DomainType, phase0, ssz} from "@lodestar/types"; +import {DomainType, Epoch, Root, Version, phase0, ssz} from "@lodestar/types"; // Only used by processDeposit + lightclient /** diff --git a/packages/state-transition/src/util/electra.ts b/packages/state-transition/src/util/electra.ts index f1082c6d4603..f5b899eadcab 100644 --- a/packages/state-transition/src/util/electra.ts +++ b/packages/state-transition/src/util/electra.ts @@ -1,7 +1,7 @@ import {COMPOUNDING_WITHDRAWAL_PREFIX, GENESIS_SLOT, MIN_ACTIVATION_BALANCE} from "@lodestar/params"; import {ValidatorIndex, ssz} from "@lodestar/types"; -import {CachedBeaconStateElectra} from "../types.js"; import {G2_POINT_AT_INFINITY} from "../constants/constants.js"; +import {CachedBeaconStateElectra} from "../types.js"; import {hasEth1WithdrawalCredential} from "./capella.js"; export function hasCompoundingWithdrawalCredential(withdrawalCredentials: Uint8Array): boolean { diff --git a/packages/state-transition/src/util/epoch.ts b/packages/state-transition/src/util/epoch.ts index 7fed5e53f1f3..cc95d0d192f6 100644 --- a/packages/state-transition/src/util/epoch.ts +++ b/packages/state-transition/src/util/epoch.ts @@ -1,5 +1,5 @@ import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, GENESIS_EPOCH, MAX_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {BeaconState, Epoch, Slot, SyncPeriod, Gwei} from "@lodestar/types"; +import {BeaconState, Epoch, Gwei, Slot, SyncPeriod} from "@lodestar/types"; import {CachedBeaconStateElectra} from "../types.js"; import {getActivationExitChurnLimit, getConsolidationChurnLimit} from "./validator.js"; diff --git a/packages/state-transition/src/util/epochShuffling.ts b/packages/state-transition/src/util/epochShuffling.ts index 6f63a2f4f5f8..6d0acbd32455 100644 --- a/packages/state-transition/src/util/epochShuffling.ts +++ b/packages/state-transition/src/util/epochShuffling.ts @@ -1,20 +1,20 @@ import {asyncUnshuffleList, unshuffleList} from "@chainsafe/swap-or-not-shuffle"; -import {Epoch, RootHex, ssz, ValidatorIndex} from "@lodestar/types"; -import {GaugeExtra, intDiv, Logger, NoLabels, toRootHex} from "@lodestar/utils"; +import {BeaconConfig} from "@lodestar/config"; import { DOMAIN_BEACON_ATTESTER, GENESIS_SLOT, MAX_COMMITTEES_PER_SLOT, + SHUFFLE_ROUND_COUNT, SLOTS_PER_EPOCH, TARGET_COMMITTEE_SIZE, - SHUFFLE_ROUND_COUNT, } from "@lodestar/params"; -import {BeaconConfig} from "@lodestar/config"; +import {Epoch, RootHex, ValidatorIndex, ssz} from "@lodestar/types"; +import {GaugeExtra, Logger, NoLabels, intDiv, toRootHex} from "@lodestar/utils"; import {BeaconStateAllForks} from "../types.js"; -import {getSeed} from "./seed.js"; -import {computeStartSlotAtEpoch} from "./epoch.js"; import {getBlockRootAtSlot} from "./blockRoot.js"; import {computeAnchorCheckpoint} from "./computeAnchorCheckpoint.js"; +import {computeStartSlotAtEpoch} from "./epoch.js"; +import {getSeed} from "./seed.js"; export interface ShufflingBuildProps { state: BeaconStateAllForks; diff --git a/packages/state-transition/src/util/execution.ts b/packages/state-transition/src/util/execution.ts index deed64bd6c51..9d70790f74a6 100644 --- a/packages/state-transition/src/util/execution.ts +++ b/packages/state-transition/src/util/execution.ts @@ -1,23 +1,23 @@ +import {ForkExecution, ForkName, ForkSeq} from "@lodestar/params"; import { + BeaconBlock, + BeaconBlockBody, + BlindedBeaconBlock, + BlindedBeaconBlockBody, + ExecutionPayload, + ExecutionPayloadHeader, bellatrix, capella, deneb, isBlindedBeaconBlockBody, - ssz, - BeaconBlock, - BeaconBlockBody, - ExecutionPayload, isExecutionPayload, - ExecutionPayloadHeader, - BlindedBeaconBlockBody, - BlindedBeaconBlock, + ssz, } from "@lodestar/types"; -import {ForkExecution, ForkName, ForkSeq} from "@lodestar/params"; import { + BeaconStateAllForks, BeaconStateBellatrix, BeaconStateCapella, - BeaconStateAllForks, BeaconStateExecutions, CachedBeaconStateAllForks, CachedBeaconStateExecutions, diff --git a/packages/state-transition/src/util/genesis.ts b/packages/state-transition/src/util/genesis.ts index aca81258a47a..27f7aee00460 100644 --- a/packages/state-transition/src/util/genesis.ts +++ b/packages/state-transition/src/util/genesis.ts @@ -10,18 +10,18 @@ import { MAX_EFFECTIVE_BALANCE, UNSET_DEPOSIT_REQUESTS_START_INDEX, } from "@lodestar/params"; -import {Bytes32, phase0, Root, ssz, TimeSeconds} from "@lodestar/types"; +import {Bytes32, Root, TimeSeconds, phase0, ssz} from "@lodestar/types"; -import {CachedBeaconStateAllForks, BeaconStateAllForks, CachedBeaconStateElectra} from "../types.js"; -import {createCachedBeaconState} from "../cache/stateCache.js"; -import {EpochCacheImmutableData} from "../cache/epochCache.js"; import {processDeposit} from "../block/processDeposit.js"; +import {EpochCacheImmutableData} from "../cache/epochCache.js"; +import {createCachedBeaconState} from "../cache/stateCache.js"; import {increaseBalance} from "../index.js"; -import {computeEpochAtSlot} from "./epoch.js"; -import {getActiveValidatorIndices, getMaxEffectiveBalance} from "./validator.js"; -import {getTemporaryBlockHeader} from "./blockRoot.js"; +import {BeaconStateAllForks, CachedBeaconStateAllForks, CachedBeaconStateElectra} from "../types.js"; import {newFilledArray} from "./array.js"; +import {getTemporaryBlockHeader} from "./blockRoot.js"; +import {computeEpochAtSlot} from "./epoch.js"; import {getNextSyncCommittee} from "./syncCommittee.js"; +import {getActiveValidatorIndices, getMaxEffectiveBalance} from "./validator.js"; type DepositDataRootListType = ListCompositeType; type DepositDataRootViewDU = CompositeViewDU; diff --git a/packages/state-transition/src/util/interop.ts b/packages/state-transition/src/util/interop.ts index e99799da127d..de7ba31d5a63 100644 --- a/packages/state-transition/src/util/interop.ts +++ b/packages/state-transition/src/util/interop.ts @@ -1,7 +1,7 @@ -import {toBufferBE} from "bigint-buffer"; import {digest} from "@chainsafe/as-sha256"; import {SecretKey} from "@chainsafe/blst"; import {bytesToBigInt, intToBytes} from "@lodestar/utils"; +import {toBufferBE} from "bigint-buffer"; let curveOrder: bigint; function getCurveOrder(): bigint { diff --git a/packages/state-transition/src/util/loadState/loadState.ts b/packages/state-transition/src/util/loadState/loadState.ts index 6e3e9c6719fa..b8254f8a5edc 100644 --- a/packages/state-transition/src/util/loadState/loadState.ts +++ b/packages/state-transition/src/util/loadState/loadState.ts @@ -1,10 +1,10 @@ -import {deserializeContainerIgnoreFields, ssz} from "@lodestar/types"; -import {ForkSeq} from "@lodestar/params"; import {ChainForkConfig} from "@lodestar/config"; +import {ForkSeq} from "@lodestar/params"; +import {deserializeContainerIgnoreFields, ssz} from "@lodestar/types"; import {BeaconStateAllForks, BeaconStateAltair} from "../../types.js"; import {VALIDATOR_BYTES_SIZE, getForkFromStateBytes, getStateTypeFromBytes} from "../sszBytes.js"; -import {findModifiedValidators} from "./findModifiedValidators.js"; import {findModifiedInactivityScores} from "./findModifiedInactivityScores.js"; +import {findModifiedValidators} from "./findModifiedValidators.js"; import {loadValidator} from "./loadValidator.js"; type MigrateStateOutput = {state: BeaconStateAllForks; modifiedValidators: number[]}; diff --git a/packages/state-transition/src/util/rootCache.ts b/packages/state-transition/src/util/rootCache.ts index f3fc5b52ff52..ada841dbbb9f 100644 --- a/packages/state-transition/src/util/rootCache.ts +++ b/packages/state-transition/src/util/rootCache.ts @@ -1,4 +1,4 @@ -import {Epoch, phase0, Root, Slot} from "@lodestar/types"; +import {Epoch, Root, Slot, phase0} from "@lodestar/types"; import {CachedBeaconStateAllForks} from "../types.js"; import {getBlockRoot, getBlockRootAtSlot} from "./blockRoot.js"; diff --git a/packages/state-transition/src/util/seed.ts b/packages/state-transition/src/util/seed.ts index 4131d4d9481f..129cf6bfaf72 100644 --- a/packages/state-transition/src/util/seed.ts +++ b/packages/state-transition/src/util/seed.ts @@ -1,6 +1,4 @@ import {digest} from "@chainsafe/as-sha256"; -import {Epoch, Bytes32, DomainType, ValidatorIndex} from "@lodestar/types"; -import {assert, bytesToBigInt, intToBytes} from "@lodestar/utils"; import { DOMAIN_SYNC_COMMITTEE, EFFECTIVE_BALANCE_INCREMENT, @@ -13,8 +11,10 @@ import { SLOTS_PER_EPOCH, SYNC_COMMITTEE_SIZE, } from "@lodestar/params"; -import {BeaconStateAllForks} from "../types.js"; +import {Bytes32, DomainType, Epoch, ValidatorIndex} from "@lodestar/types"; +import {assert, bytesToBigInt, intToBytes} from "@lodestar/utils"; import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js"; +import {BeaconStateAllForks} from "../types.js"; import {computeStartSlotAtEpoch} from "./epoch.js"; import {computeEpochAtSlot} from "./epoch.js"; diff --git a/packages/state-transition/src/util/slot.ts b/packages/state-transition/src/util/slot.ts index 495a350ca11f..3cf145367a1d 100644 --- a/packages/state-transition/src/util/slot.ts +++ b/packages/state-transition/src/util/slot.ts @@ -1,7 +1,7 @@ import {ChainConfig} from "@lodestar/config"; import {GENESIS_SLOT, INTERVALS_PER_SLOT} from "@lodestar/params"; -import {Slot, Epoch, TimeSeconds} from "@lodestar/types"; -import {computeStartSlotAtEpoch, computeEpochAtSlot} from "./epoch.js"; +import {Epoch, Slot, TimeSeconds} from "@lodestar/types"; +import {computeEpochAtSlot, computeStartSlotAtEpoch} from "./epoch.js"; export function getSlotsSinceGenesis(config: ChainConfig, genesisTime: TimeSeconds): Slot { const diffInSeconds = Date.now() / 1000 - genesisTime; diff --git a/packages/state-transition/src/util/syncCommittee.ts b/packages/state-transition/src/util/syncCommittee.ts index c1f53632e521..a0731cf8d6ac 100644 --- a/packages/state-transition/src/util/syncCommittee.ts +++ b/packages/state-transition/src/util/syncCommittee.ts @@ -8,10 +8,10 @@ import { SYNC_REWARD_WEIGHT, WEIGHT_DENOMINATOR, } from "@lodestar/params"; -import {altair, ValidatorIndex} from "@lodestar/types"; +import {ValidatorIndex, altair} from "@lodestar/types"; import {bigIntSqrt} from "@lodestar/utils"; -import {BeaconStateAllForks} from "../types.js"; import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js"; +import {BeaconStateAllForks} from "../types.js"; import {getNextSyncCommitteeIndices} from "./seed.js"; /** diff --git a/packages/state-transition/src/util/validator.ts b/packages/state-transition/src/util/validator.ts index 4906a9349402..555b8a09b614 100644 --- a/packages/state-transition/src/util/validator.ts +++ b/packages/state-transition/src/util/validator.ts @@ -1,5 +1,3 @@ -import {Epoch, phase0, ValidatorIndex} from "@lodestar/types"; -import {intDiv} from "@lodestar/utils"; import {ChainForkConfig} from "@lodestar/config"; import { EFFECTIVE_BALANCE_INCREMENT, @@ -7,6 +5,8 @@ import { MAX_EFFECTIVE_BALANCE_ELECTRA, MIN_ACTIVATION_BALANCE, } from "@lodestar/params"; +import {Epoch, ValidatorIndex, phase0} from "@lodestar/types"; +import {intDiv} from "@lodestar/utils"; import {BeaconStateAllForks, CachedBeaconStateElectra, EpochCache} from "../types.js"; import {hasCompoundingWithdrawalCredential} from "./electra.js"; diff --git a/packages/state-transition/src/util/weakSubjectivity.ts b/packages/state-transition/src/util/weakSubjectivity.ts index 8d7c82842496..fc2b485aea9f 100644 --- a/packages/state-transition/src/util/weakSubjectivity.ts +++ b/packages/state-transition/src/util/weakSubjectivity.ts @@ -6,7 +6,7 @@ import {Checkpoint} from "@lodestar/types/phase0"; import {toRootHex} from "@lodestar/utils"; import {ZERO_HASH} from "../constants/constants.js"; import {BeaconStateAllForks, CachedBeaconStateAllForks} from "../types.js"; -import {computeEpochAtSlot, getCurrentEpoch, computeCheckpointEpochAtStateSlot} from "./epoch.js"; +import {computeCheckpointEpochAtStateSlot, computeEpochAtSlot, getCurrentEpoch} from "./epoch.js"; import {getCurrentSlot} from "./slot.js"; import {getActiveValidatorIndices, getChurnLimit} from "./validator.js"; diff --git a/packages/state-transition/test/perf/analyzeEpochs.ts b/packages/state-transition/test/perf/analyzeEpochs.ts index ebad63ccf0ad..1141f488dba1 100644 --- a/packages/state-transition/test/perf/analyzeEpochs.ts +++ b/packages/state-transition/test/perf/analyzeEpochs.ts @@ -4,10 +4,10 @@ import {config} from "@lodestar/config/default"; import {NetworkName} from "@lodestar/config/networks.js"; import {phase0, ssz} from "@lodestar/types"; import { - computeEpochAtSlot, - computeStartSlotAtEpoch, AttesterFlags, beforeProcessEpoch, + computeEpochAtSlot, + computeStartSlotAtEpoch, parseAttesterFlags, processSlots, } from "../../src/index.js"; diff --git a/packages/state-transition/test/perf/block/processAttestation.test.ts b/packages/state-transition/test/perf/block/processAttestation.test.ts index 673b0e17430f..25528b2458e4 100644 --- a/packages/state-transition/test/perf/block/processAttestation.test.ts +++ b/packages/state-transition/test/perf/block/processAttestation.test.ts @@ -11,8 +11,8 @@ import { SYNC_COMMITTEE_SIZE, } from "@lodestar/params"; import {phase0} from "@lodestar/types"; -import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../../../src/index.js"; import {processAttestationsAltair} from "../../../src/block/processAttestationsAltair.js"; +import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../../../src/index.js"; import {generatePerfTestCachedStateAltair, perfStateId} from "../util.js"; import {BlockAltairOpts, getBlockAltair} from "./util.js"; diff --git a/packages/state-transition/test/perf/block/processBlockAltair.test.ts b/packages/state-transition/test/perf/block/processBlockAltair.test.ts index cf0898946ab6..60ad8b50afa6 100644 --- a/packages/state-transition/test/perf/block/processBlockAltair.test.ts +++ b/packages/state-transition/test/perf/block/processBlockAltair.test.ts @@ -1,5 +1,4 @@ import {itBench} from "@dapplion/benchmark"; -import {ssz} from "@lodestar/types"; import { ACTIVE_PRESET, MAX_ATTESTATIONS, @@ -10,14 +9,15 @@ import { PresetName, SYNC_COMMITTEE_SIZE, } from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import { CachedBeaconStateAltair, DataAvailableStatus, ExecutionPayloadStatus, stateTransition, } from "../../../src/index.js"; -import {cachedStateAltairPopulateCaches, generatePerfTestCachedStateAltair, perfStateId} from "../util.js"; import {StateBlock} from "../types.js"; +import {cachedStateAltairPopulateCaches, generatePerfTestCachedStateAltair, perfStateId} from "../util.js"; import {BlockAltairOpts, getBlockAltair} from "./util.js"; // As of Jun 12 2021 diff --git a/packages/state-transition/test/perf/block/processBlockPhase0.test.ts b/packages/state-transition/test/perf/block/processBlockPhase0.test.ts index 92d8630a58ac..980586f6326b 100644 --- a/packages/state-transition/test/perf/block/processBlockPhase0.test.ts +++ b/packages/state-transition/test/perf/block/processBlockPhase0.test.ts @@ -9,8 +9,8 @@ import { PresetName, } from "@lodestar/params"; import {DataAvailableStatus, ExecutionPayloadStatus, stateTransition} from "../../../src/index.js"; -import {generatePerfTestCachedStatePhase0, perfStateId} from "../util.js"; import {StateBlock} from "../types.js"; +import {generatePerfTestCachedStatePhase0, perfStateId} from "../util.js"; import {BlockOpts, getBlockPhase0} from "./util.js"; // As of Jun 12 2021 diff --git a/packages/state-transition/test/perf/block/processEth1Data.test.ts b/packages/state-transition/test/perf/block/processEth1Data.test.ts index 45dc8aa631d7..ba7cb0b5ba1d 100644 --- a/packages/state-transition/test/perf/block/processEth1Data.test.ts +++ b/packages/state-transition/test/perf/block/processEth1Data.test.ts @@ -1,8 +1,8 @@ import {itBench} from "@dapplion/benchmark"; import {ACTIVE_PRESET, PresetName, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; import {phase0} from "@lodestar/types"; -import {CachedBeaconStateAllForks} from "../../../src/index.js"; import {processEth1Data} from "../../../src/block/processEth1Data.js"; +import {CachedBeaconStateAllForks} from "../../../src/index.js"; import {generatePerfTestCachedStateAltair, perfStateId} from "../util.js"; import {getBlockAltair} from "./util.js"; diff --git a/packages/state-transition/test/perf/block/processWithdrawals.test.ts b/packages/state-transition/test/perf/block/processWithdrawals.test.ts index 66d624b39bfd..23f76825225d 100644 --- a/packages/state-transition/test/perf/block/processWithdrawals.test.ts +++ b/packages/state-transition/test/perf/block/processWithdrawals.test.ts @@ -1,9 +1,9 @@ import {itBench} from "@dapplion/benchmark"; import {ForkSeq} from "@lodestar/params"; -import {CachedBeaconStateCapella} from "../../../src/index.js"; import {getExpectedWithdrawals} from "../../../src/block/processWithdrawals.js"; +import {CachedBeaconStateCapella} from "../../../src/index.js"; +import {WithdrawalOpts, getExpectedWithdrawalsTestData} from "../../utils/capella.js"; import {numValidators} from "../util.js"; -import {getExpectedWithdrawalsTestData, WithdrawalOpts} from "../../utils/capella.js"; // PERF: Fixed cost for MAX_WITHDRAWALS_PER_PAYLOAD probes // + cost 'proportional' to $VALIDATOR_COUNT with balances under MAX_EFFECTIVE_BALANCE or diff --git a/packages/state-transition/test/perf/block/util.ts b/packages/state-transition/test/perf/block/util.ts index baa86dcac6a5..7b95d1621f5a 100644 --- a/packages/state-transition/test/perf/block/util.ts +++ b/packages/state-transition/test/perf/block/util.ts @@ -1,16 +1,16 @@ -import {toGindex, Tree} from "@chainsafe/persistent-merkle-tree"; -import {BitArray} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; -import {altair, phase0, ssz} from "@lodestar/types"; -import {DOMAIN_DEPOSIT, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; +import {Tree, toGindex} from "@chainsafe/persistent-merkle-tree"; +import {BitArray} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; +import {DOMAIN_DEPOSIT, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; +import {altair, phase0, ssz} from "@lodestar/types"; import { + CachedBeaconStateAllForks, + CachedBeaconStateAltair, + ZERO_HASH, computeDomain, computeEpochAtSlot, computeSigningRoot, - ZERO_HASH, - CachedBeaconStateAllForks, - CachedBeaconStateAltair, } from "../../../src/index.js"; import {getBlockRoot, getBlockRootAtSlot} from "../../../src/index.js"; diff --git a/packages/state-transition/test/perf/dataStructures/arrayish.test.ts b/packages/state-transition/test/perf/dataStructures/arrayish.test.ts index 353f81951aa7..ebeefacbd27e 100644 --- a/packages/state-transition/test/perf/dataStructures/arrayish.test.ts +++ b/packages/state-transition/test/perf/dataStructures/arrayish.test.ts @@ -1,5 +1,5 @@ +import {LeafNode, Tree, toGindex, zeroNode} from "@chainsafe/persistent-merkle-tree"; import {itBench, setBenchOpts} from "@dapplion/benchmark"; -import {LeafNode, toGindex, Tree, zeroNode} from "@chainsafe/persistent-merkle-tree"; // Understand the cost of each array-ish data structure to: // - Get one element diff --git a/packages/state-transition/test/perf/epoch/epochAltair.test.ts b/packages/state-transition/test/perf/epoch/epochAltair.test.ts index 5a10fd4d8bbd..aa08619250dd 100644 --- a/packages/state-transition/test/perf/epoch/epochAltair.test.ts +++ b/packages/state-transition/test/perf/epoch/epochAltair.test.ts @@ -1,28 +1,28 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {ForkSeq} from "@lodestar/params"; +import {processEpoch} from "../../../src/epoch/index.js"; +import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; +import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; +import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; +import {processInactivityUpdates} from "../../../src/epoch/processInactivityUpdates.js"; +import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; +import {processParticipationFlagUpdates} from "../../../src/epoch/processParticipationFlagUpdates.js"; +import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; +import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; +import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; +import {processSlashings} from "../../../src/epoch/processSlashings.js"; +import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; +import {processSyncCommitteeUpdates} from "../../../src/epoch/processSyncCommitteeUpdates.js"; import { - computeStartSlotAtEpoch, CachedBeaconStateAllForks, CachedBeaconStateAltair, beforeProcessEpoch, + computeStartSlotAtEpoch, } from "../../../src/index.js"; -import {beforeValue, LazyValue} from "../../utils/beforeValueMocha.js"; +import {LazyValue, beforeValue} from "../../utils/beforeValueMocha.js"; import {getNetworkCachedState} from "../../utils/testFileCache.js"; -import {StateEpoch} from "../types.js"; import {altairState} from "../params.js"; -import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; -import {processInactivityUpdates} from "../../../src/epoch/processInactivityUpdates.js"; -import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; -import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; -import {processSlashings} from "../../../src/epoch/processSlashings.js"; -import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; -import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; -import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; -import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; -import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; -import {processParticipationFlagUpdates} from "../../../src/epoch/processParticipationFlagUpdates.js"; -import {processSyncCommitteeUpdates} from "../../../src/epoch/processSyncCommitteeUpdates.js"; -import {processEpoch} from "../../../src/epoch/index.js"; +import {StateEpoch} from "../types.js"; const slot = computeStartSlotAtEpoch(altairState.epoch) - 1; const stateId = `${altairState.network}_e${altairState.epoch}`; diff --git a/packages/state-transition/test/perf/epoch/epochCapella.test.ts b/packages/state-transition/test/perf/epoch/epochCapella.test.ts index a4daf308aaa0..1376fd61d965 100644 --- a/packages/state-transition/test/perf/epoch/epochCapella.test.ts +++ b/packages/state-transition/test/perf/epoch/epochCapella.test.ts @@ -1,28 +1,28 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {ForkSeq} from "@lodestar/params"; +import {processEpoch} from "../../../src/epoch/index.js"; +import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; +import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; +import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; +import {processInactivityUpdates} from "../../../src/epoch/processInactivityUpdates.js"; +import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; +import {processParticipationFlagUpdates} from "../../../src/epoch/processParticipationFlagUpdates.js"; +import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; +import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; +import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; +import {processSlashings} from "../../../src/epoch/processSlashings.js"; +import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; import { - computeStartSlotAtEpoch, CachedBeaconStateAllForks, - CachedBeaconStateCapella, CachedBeaconStateAltair, + CachedBeaconStateCapella, beforeProcessEpoch, + computeStartSlotAtEpoch, } from "../../../src/index.js"; -import {beforeValue, LazyValue} from "../../utils/beforeValueMocha.js"; +import {LazyValue, beforeValue} from "../../utils/beforeValueMocha.js"; import {getNetworkCachedState} from "../../utils/testFileCache.js"; -import {StateEpoch} from "../types.js"; import {capellaState} from "../params.js"; -import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; -import {processInactivityUpdates} from "../../../src/epoch/processInactivityUpdates.js"; -import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; -import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; -import {processSlashings} from "../../../src/epoch/processSlashings.js"; -import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; -import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; -import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; -import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; -import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; -import {processParticipationFlagUpdates} from "../../../src/epoch/processParticipationFlagUpdates.js"; -import {processEpoch} from "../../../src/epoch/index.js"; +import {StateEpoch} from "../types.js"; const slot = computeStartSlotAtEpoch(capellaState.epoch) - 1; const stateId = `${capellaState.network}_e${capellaState.epoch}`; diff --git a/packages/state-transition/test/perf/epoch/epochPhase0.test.ts b/packages/state-transition/test/perf/epoch/epochPhase0.test.ts index 5c19b347af62..cca93b045cae 100644 --- a/packages/state-transition/test/perf/epoch/epochPhase0.test.ts +++ b/packages/state-transition/test/perf/epoch/epochPhase0.test.ts @@ -1,26 +1,26 @@ import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {ForkSeq} from "@lodestar/params"; +import {processEpoch} from "../../../src/epoch/index.js"; +import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; +import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; +import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; +import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; +import {processParticipationRecordUpdates} from "../../../src/epoch/processParticipationRecordUpdates.js"; +import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; +import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; +import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; +import {processSlashings} from "../../../src/epoch/processSlashings.js"; +import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; import { - computeStartSlotAtEpoch, CachedBeaconStateAllForks, CachedBeaconStatePhase0, beforeProcessEpoch, + computeStartSlotAtEpoch, } from "../../../src/index.js"; -import {beforeValue, LazyValue} from "../../utils/beforeValueMocha.js"; +import {LazyValue, beforeValue} from "../../utils/beforeValueMocha.js"; import {getNetworkCachedState} from "../../utils/testFileCache.js"; -import {StateEpoch} from "../types.js"; import {phase0State} from "../params.js"; -import {processEpoch} from "../../../src/epoch/index.js"; -import {processParticipationRecordUpdates} from "../../../src/epoch/processParticipationRecordUpdates.js"; -import {processJustificationAndFinalization} from "../../../src/epoch/processJustificationAndFinalization.js"; -import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; -import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; -import {processSlashings} from "../../../src/epoch/processSlashings.js"; -import {processEth1DataReset} from "../../../src/epoch/processEth1DataReset.js"; -import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; -import {processSlashingsReset} from "../../../src/epoch/processSlashingsReset.js"; -import {processRandaoMixesReset} from "../../../src/epoch/processRandaoMixesReset.js"; -import {processHistoricalRootsUpdate} from "../../../src/epoch/processHistoricalRootsUpdate.js"; +import {StateEpoch} from "../types.js"; const slot = computeStartSlotAtEpoch(phase0State.epoch) - 1; const stateId = `${phase0State.network}_e${phase0State.epoch}`; diff --git a/packages/state-transition/test/perf/epoch/processEffectiveBalanceUpdates.test.ts b/packages/state-transition/test/perf/epoch/processEffectiveBalanceUpdates.test.ts index 19f18df86c2e..fe2fabd2dd4d 100644 --- a/packages/state-transition/test/perf/epoch/processEffectiveBalanceUpdates.test.ts +++ b/packages/state-transition/test/perf/epoch/processEffectiveBalanceUpdates.test.ts @@ -1,12 +1,12 @@ import {itBench} from "@dapplion/benchmark"; -import {ssz} from "@lodestar/types"; import {config} from "@lodestar/config/default"; import {ForkSeq} from "@lodestar/params"; -import {beforeProcessEpoch, CachedBeaconStateAllForks, EpochTransitionCache} from "../../../src/index.js"; +import {ssz} from "@lodestar/types"; import {processEffectiveBalanceUpdates} from "../../../src/epoch/processEffectiveBalanceUpdates.js"; -import {numValidators} from "../util.js"; -import {StateEpoch} from "../types.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache, beforeProcessEpoch} from "../../../src/index.js"; import {createCachedBeaconStateTest} from "../../utils/state.js"; +import {StateEpoch} from "../types.js"; +import {numValidators} from "../util.js"; // PERF: Cost 'proportional' to $VALIDATOR_COUNT, to iterate over all balances. Then cost is proportional to the amount // of validators whose effectiveBalance changed. Worst case is a massive network leak or a big slashing event which diff --git a/packages/state-transition/test/perf/epoch/processRegistryUpdates.test.ts b/packages/state-transition/test/perf/epoch/processRegistryUpdates.test.ts index 588fe9ec0213..b02c2aa3c9a2 100644 --- a/packages/state-transition/test/perf/epoch/processRegistryUpdates.test.ts +++ b/packages/state-transition/test/perf/epoch/processRegistryUpdates.test.ts @@ -1,9 +1,9 @@ import {itBench} from "@dapplion/benchmark"; import {ForkSeq} from "@lodestar/params"; -import {beforeProcessEpoch, CachedBeaconStateAllForks, EpochTransitionCache} from "../../../src/index.js"; import {processRegistryUpdates} from "../../../src/epoch/processRegistryUpdates.js"; -import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; +import {CachedBeaconStateAllForks, EpochTransitionCache, beforeProcessEpoch} from "../../../src/index.js"; import {StateEpoch} from "../types.js"; +import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; // PERF: Cost 'proportional' to only validators that active + exit. For mainnet conditions: // - indicesEligibleForActivationQueue: Maxing deposits triggers 512 validator mutations diff --git a/packages/state-transition/test/perf/epoch/processRewardsAndPenalties.test.ts b/packages/state-transition/test/perf/epoch/processRewardsAndPenalties.test.ts index 03644ebca0f3..b4c157942584 100644 --- a/packages/state-transition/test/perf/epoch/processRewardsAndPenalties.test.ts +++ b/packages/state-transition/test/perf/epoch/processRewardsAndPenalties.test.ts @@ -1,9 +1,9 @@ import {itBench} from "@dapplion/benchmark"; import {processRewardsAndPenalties} from "../../../src/epoch/processRewardsAndPenalties.js"; -import {generatePerfTestCachedStateAltair, numValidators} from "../util.js"; import {StateAltairEpoch} from "../types.js"; -import {FlagFactors, generateBalanceDeltasEpochTransitionCache} from "./utilPhase0.js"; +import {generatePerfTestCachedStateAltair, numValidators} from "../util.js"; import {mutateInactivityScores} from "./util.js"; +import {FlagFactors, generateBalanceDeltasEpochTransitionCache} from "./utilPhase0.js"; // PERF: Cost = 'proportional' to $VALIDATOR_COUNT. Extra work is done per validator the more status flags are set diff --git a/packages/state-transition/test/perf/epoch/processRewardsAndPenaltiesPhase0.test.ts b/packages/state-transition/test/perf/epoch/processRewardsAndPenaltiesPhase0.test.ts index e39b5962ea18..c5e747502e76 100644 --- a/packages/state-transition/test/perf/epoch/processRewardsAndPenaltiesPhase0.test.ts +++ b/packages/state-transition/test/perf/epoch/processRewardsAndPenaltiesPhase0.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; import {getAttestationDeltas} from "../../../src/epoch/getAttestationDeltas.js"; -import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; import {StatePhase0Epoch} from "../types.js"; +import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; import {FlagFactors, generateBalanceDeltasEpochTransitionCache} from "./utilPhase0.js"; // - On normal mainnet conditions diff --git a/packages/state-transition/test/perf/epoch/processSlashingsAllForks.test.ts b/packages/state-transition/test/perf/epoch/processSlashingsAllForks.test.ts index 3b0bfa623fb2..6a590e3c632f 100644 --- a/packages/state-transition/test/perf/epoch/processSlashingsAllForks.test.ts +++ b/packages/state-transition/test/perf/epoch/processSlashingsAllForks.test.ts @@ -1,14 +1,14 @@ import {itBench} from "@dapplion/benchmark"; import {MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; +import {processSlashings} from "../../../src/epoch/processSlashings.js"; import { - beforeProcessEpoch, - CachedBeaconStatePhase0, CachedBeaconStateAllForks, + CachedBeaconStatePhase0, EpochTransitionCache, + beforeProcessEpoch, } from "../../../src/index.js"; -import {processSlashings} from "../../../src/epoch/processSlashings.js"; -import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; import {StateEpoch} from "../types.js"; +import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; // PERF: Cost 'proportional' to only validators that are slashed. For mainnet conditions: // - indicesToSlash: max len is 8704. But it's very unlikely since it would require all validators on the same diff --git a/packages/state-transition/test/perf/epoch/utilPhase0.ts b/packages/state-transition/test/perf/epoch/utilPhase0.ts index 41c7d9780e01..78e27563835b 100644 --- a/packages/state-transition/test/perf/epoch/utilPhase0.ts +++ b/packages/state-transition/test/perf/epoch/utilPhase0.ts @@ -1,5 +1,5 @@ import {AttesterFlags, toAttesterFlags} from "../../../src/index.js"; -import {CachedBeaconStatePhase0, CachedBeaconStateAltair, EpochTransitionCache} from "../../../src/types.js"; +import {CachedBeaconStateAltair, CachedBeaconStatePhase0, EpochTransitionCache} from "../../../src/types.js"; /** * Generate an incomplete EpochTransitionCache to simulate any network condition relevant to getAttestationDeltas diff --git a/packages/state-transition/test/perf/hashing.test.ts b/packages/state-transition/test/perf/hashing.test.ts index 26bfd935c08a..d0a651cc8824 100644 --- a/packages/state-transition/test/perf/hashing.test.ts +++ b/packages/state-transition/test/perf/hashing.test.ts @@ -1,7 +1,7 @@ -import {itBench} from "@dapplion/benchmark"; import {unshuffleList} from "@chainsafe/swap-or-not-shuffle"; -import {ssz} from "@lodestar/types"; +import {itBench} from "@dapplion/benchmark"; import {SHUFFLE_ROUND_COUNT} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {generatePerfTestCachedStatePhase0, numValidators} from "./util.js"; // Test cost of hashing state after some modifications diff --git a/packages/state-transition/test/perf/misc/aggregationBits.test.ts b/packages/state-transition/test/perf/misc/aggregationBits.test.ts index a0578970dfe9..6beade2d11f4 100644 --- a/packages/state-transition/test/perf/misc/aggregationBits.test.ts +++ b/packages/state-transition/test/perf/misc/aggregationBits.test.ts @@ -1,5 +1,5 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {BitArray} from "@chainsafe/ssz"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params"; import {ssz} from "@lodestar/types"; diff --git a/packages/state-transition/test/perf/misc/byteArrayEquals.test.ts b/packages/state-transition/test/perf/misc/byteArrayEquals.test.ts index 64057a26d103..b8b34eda6721 100644 --- a/packages/state-transition/test/perf/misc/byteArrayEquals.test.ts +++ b/packages/state-transition/test/perf/misc/byteArrayEquals.test.ts @@ -1,6 +1,6 @@ import crypto from "node:crypto"; -import {itBench} from "@dapplion/benchmark"; import {byteArrayEquals} from "@chainsafe/ssz"; +import {itBench} from "@dapplion/benchmark"; import {generateState} from "../../utils/state.js"; import {generateValidators} from "../../utils/validator.js"; diff --git a/packages/state-transition/test/perf/misc/rootEquals.test.ts b/packages/state-transition/test/perf/misc/rootEquals.test.ts index f941e764c26b..39ec15c8de9f 100644 --- a/packages/state-transition/test/perf/misc/rootEquals.test.ts +++ b/packages/state-transition/test/perf/misc/rootEquals.test.ts @@ -1,5 +1,5 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {byteArrayEquals, fromHexString} from "@chainsafe/ssz"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {ssz} from "@lodestar/types"; // As of Sep 2023 diff --git a/packages/state-transition/test/perf/sanityCheck.test.ts b/packages/state-transition/test/perf/sanityCheck.test.ts index 834e118d0f76..26902622f6e4 100644 --- a/packages/state-transition/test/perf/sanityCheck.test.ts +++ b/packages/state-transition/test/perf/sanityCheck.test.ts @@ -1,5 +1,5 @@ -import {expect} from "chai"; import {ACTIVE_PRESET, EFFECTIVE_BALANCE_INCREMENT, PresetName} from "@lodestar/params"; +import {expect} from "chai"; import {beforeProcessEpoch} from "../../src/index.js"; import {generatePerfTestCachedStateAltair, generatePerfTestCachedStatePhase0, perfStateId} from "./util.js"; diff --git a/packages/state-transition/test/perf/slot/slots.test.ts b/packages/state-transition/test/perf/slot/slots.test.ts index 4f436876d9b0..8a1e9836ae22 100644 --- a/packages/state-transition/test/perf/slot/slots.test.ts +++ b/packages/state-transition/test/perf/slot/slots.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; import {processSlot} from "../../../src/slot/index.js"; -import {generatePerfTestCachedStatePhase0} from "../util.js"; import {State} from "../types.js"; +import {generatePerfTestCachedStatePhase0} from "../util.js"; // Test advancing through an empty slot, without any epoch transition diff --git a/packages/state-transition/test/perf/types.ts b/packages/state-transition/test/perf/types.ts index 8f4914238dba..2e494e263214 100644 --- a/packages/state-transition/test/perf/types.ts +++ b/packages/state-transition/test/perf/types.ts @@ -1,5 +1,5 @@ import {SignedBeaconBlock} from "@lodestar/types"; -import {CachedBeaconStateAllForks, CachedBeaconStatePhase0, CachedBeaconStateAltair} from "../../src/index.js"; +import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../../src/index.js"; import {EpochTransitionCache} from "../../src/types.js"; // Type aliases to typesafe itBench() calls diff --git a/packages/state-transition/test/perf/util.ts b/packages/state-transition/test/perf/util.ts index 0f47c241f8f9..7dc5daeff754 100644 --- a/packages/state-transition/test/perf/util.ts +++ b/packages/state-transition/test/perf/util.ts @@ -1,9 +1,8 @@ -import {BitArray, fromHexString} from "@chainsafe/ssz"; import {PublicKey, SecretKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {phase0, ssz, Slot, BeaconState} from "@lodestar/types"; -import {config} from "@lodestar/config/default"; +import {BitArray, fromHexString} from "@chainsafe/ssz"; import {createBeaconConfig, createChainForkConfig} from "@lodestar/config"; +import {config} from "@lodestar/config/default"; import { EPOCHS_PER_ETH1_VOTING_PERIOD, EPOCHS_PER_HISTORICAL_VECTOR, @@ -14,25 +13,26 @@ import { SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, } from "@lodestar/params"; +import {BeaconState, Slot, phase0, ssz} from "@lodestar/types"; +import {getEffectiveBalanceIncrements} from "../../src/cache/effectiveBalanceIncrements.js"; import { - interopSecretKey, + computeCommitteeCount, computeEpochAtSlot, + createCachedBeaconState, getActiveValidatorIndices, + interopSecretKey, newFilledArray, - createCachedBeaconState, - computeCommitteeCount, } from "../../src/index.js"; +import {processSlots} from "../../src/index.js"; import { + BeaconStateAltair, + BeaconStatePhase0, CachedBeaconStateAllForks, - CachedBeaconStatePhase0, CachedBeaconStateAltair, - BeaconStatePhase0, - BeaconStateAltair, + CachedBeaconStatePhase0, } from "../../src/types.js"; -import {interopPubkeysCached} from "../utils/interop.js"; import {getNextSyncCommittee} from "../../src/util/syncCommittee.js"; -import {getEffectiveBalanceIncrements} from "../../src/cache/effectiveBalanceIncrements.js"; -import {processSlots} from "../../src/index.js"; +import {interopPubkeysCached} from "../utils/interop.js"; let phase0State: BeaconStatePhase0 | null = null; let phase0CachedState23637: CachedBeaconStatePhase0 | null = null; diff --git a/packages/state-transition/test/perf/util/balance.test.ts b/packages/state-transition/test/perf/util/balance.test.ts index 4103b3b5517f..a8d4f5157a6e 100644 --- a/packages/state-transition/test/perf/util/balance.test.ts +++ b/packages/state-transition/test/perf/util/balance.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; -import {generatePerfTestCachedStatePhase0, perfStateId} from "../util.js"; -import {State} from "../types.js"; import {getEffectiveBalanceIncrementsZeroInactive} from "../../../src/util/index.js"; +import {State} from "../types.js"; +import {generatePerfTestCachedStatePhase0, perfStateId} from "../util.js"; describe("getEffectiveBalanceIncrementsZeroInactive", () => { itBench({ diff --git a/packages/state-transition/test/perf/util/epochContext.test.ts b/packages/state-transition/test/perf/util/epochContext.test.ts index 9ae478d4161b..2f49d8bfa09b 100644 --- a/packages/state-transition/test/perf/util/epochContext.test.ts +++ b/packages/state-transition/test/perf/util/epochContext.test.ts @@ -1,6 +1,6 @@ import {itBench} from "@dapplion/benchmark"; import {Epoch} from "@lodestar/types"; -import {computeEpochAtSlot, CachedBeaconStateAllForks} from "../../../src/index.js"; +import {CachedBeaconStateAllForks, computeEpochAtSlot} from "../../../src/index.js"; import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; // Current implementation scales very well with number of requested validators diff --git a/packages/state-transition/test/perf/util/loadState/findModifiedValidators.test.ts b/packages/state-transition/test/perf/util/loadState/findModifiedValidators.test.ts index 4028104f0bdc..6cd8650f3afc 100644 --- a/packages/state-transition/test/perf/util/loadState/findModifiedValidators.test.ts +++ b/packages/state-transition/test/perf/util/loadState/findModifiedValidators.test.ts @@ -1,12 +1,12 @@ -import {expect} from "chai"; -import {itBench} from "@dapplion/benchmark"; import {CompositeViewDU} from "@chainsafe/ssz"; +import {itBench} from "@dapplion/benchmark"; import {ssz} from "@lodestar/types"; import {bytesToInt} from "@lodestar/utils"; +import {expect} from "chai"; import {findModifiedValidators} from "../../../../src/util/loadState/findModifiedValidators.js"; import {VALIDATOR_BYTES_SIZE} from "../../../../src/util/sszBytes.js"; -import {generateValidators} from "../../../utils/validator.js"; import {generateState} from "../../../utils/state.js"; +import {generateValidators} from "../../../utils/validator.js"; /** * find modified validators by different ways. This proves that findModifiedValidators() leveraging Buffer.compare() is the fastest way. diff --git a/packages/state-transition/test/perf/util/loadState/loadState.test.ts b/packages/state-transition/test/perf/util/loadState/loadState.test.ts index 9f6175e95684..e41e4f6be7af 100644 --- a/packages/state-transition/test/perf/util/loadState/loadState.test.ts +++ b/packages/state-transition/test/perf/util/loadState/loadState.test.ts @@ -1,9 +1,9 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {PublicKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {loadState} from "../../../../src/util/loadState/loadState.js"; -import {createCachedBeaconState} from "../../../../src/cache/stateCache.js"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {Index2PubkeyCache} from "../../../../src/cache/pubkeyCache.js"; +import {createCachedBeaconState} from "../../../../src/cache/stateCache.js"; +import {loadState} from "../../../../src/util/loadState/loadState.js"; import {generatePerfTestCachedStateAltair} from "../../util.js"; /** diff --git a/packages/state-transition/test/perf/util/rootCache.test.ts b/packages/state-transition/test/perf/util/rootCache.test.ts index 59edd2ebcb4e..2d0ba33004f5 100644 --- a/packages/state-transition/test/perf/util/rootCache.test.ts +++ b/packages/state-transition/test/perf/util/rootCache.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; -import {generatePerfTestCachedStatePhase0, perfStateId, perfStateEpoch} from "../util.js"; +import {RootCache, computeStartSlotAtEpoch, getBlockRootAtSlot} from "../../../src/util/index.js"; import {State} from "../types.js"; -import {computeStartSlotAtEpoch, getBlockRootAtSlot, RootCache} from "../../../src/util/index.js"; +import {generatePerfTestCachedStatePhase0, perfStateEpoch, perfStateId} from "../util.js"; const slot = computeStartSlotAtEpoch(perfStateEpoch) - 1; diff --git a/packages/state-transition/test/perf/util/shufflings.test.ts b/packages/state-transition/test/perf/util/shufflings.test.ts index 41767c184349..95afa1ca9849 100644 --- a/packages/state-transition/test/perf/util/shufflings.test.ts +++ b/packages/state-transition/test/perf/util/shufflings.test.ts @@ -1,12 +1,12 @@ import {itBench} from "@dapplion/benchmark"; -import {Epoch} from "@lodestar/types"; import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params"; +import {Epoch} from "@lodestar/types"; import { - computeEpochAtSlot, CachedBeaconStateAllForks, + computeEpochAtSlot, computeEpochShuffling, - getNextSyncCommittee, computeProposers, + getNextSyncCommittee, getSeed, } from "../../../src/index.js"; import {generatePerfTestCachedStatePhase0, numValidators} from "../util.js"; diff --git a/packages/state-transition/test/perf/util/signingRoot.test.ts b/packages/state-transition/test/perf/util/signingRoot.test.ts index 1d308c2e3e43..b39ef44a15e7 100644 --- a/packages/state-transition/test/perf/util/signingRoot.test.ts +++ b/packages/state-transition/test/perf/util/signingRoot.test.ts @@ -1,6 +1,6 @@ -import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {digest} from "@chainsafe/as-sha256"; import {fromHexString, toHexString} from "@chainsafe/ssz"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import {phase0, ssz} from "@lodestar/types"; import {computeSigningRoot} from "../../../src/util/signingRoot.js"; diff --git a/packages/state-transition/test/unit/block/isValidIndexedAttestation.test.ts b/packages/state-transition/test/unit/block/isValidIndexedAttestation.test.ts index c219943b940f..c54457c0ad09 100644 --- a/packages/state-transition/test/unit/block/isValidIndexedAttestation.test.ts +++ b/packages/state-transition/test/unit/block/isValidIndexedAttestation.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; import {FAR_FUTURE_EPOCH, MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; import {phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; +import {isValidIndexedAttestation} from "../../../src/block/isValidIndexedAttestation.js"; import {EMPTY_SIGNATURE} from "../../../src/index.js"; import {generateCachedState} from "../../utils/state.js"; import {generateValidators} from "../../utils/validator.js"; -import {isValidIndexedAttestation} from "../../../src/block/isValidIndexedAttestation.js"; describe("validate indexed attestation", () => { const state = generateCachedState(config, { diff --git a/packages/state-transition/test/unit/block/processWithdrawals.test.ts b/packages/state-transition/test/unit/block/processWithdrawals.test.ts index 7b708d108a7b..7cfdfc6d58bb 100644 --- a/packages/state-transition/test/unit/block/processWithdrawals.test.ts +++ b/packages/state-transition/test/unit/block/processWithdrawals.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; import {ForkSeq} from "@lodestar/params"; +import {describe, expect, it} from "vitest"; import {getExpectedWithdrawals} from "../../../src/block/processWithdrawals.js"; import {numValidators} from "../../perf/util.js"; -import {getExpectedWithdrawalsTestData, WithdrawalOpts} from "../../utils/capella.js"; import {beforeValue} from "../../utils/beforeValue.js"; +import {WithdrawalOpts, getExpectedWithdrawalsTestData} from "../../utils/capella.js"; describe("getExpectedWithdrawals", () => { const vc = numValidators; diff --git a/packages/state-transition/test/unit/cachedBeaconState.test.ts b/packages/state-transition/test/unit/cachedBeaconState.test.ts index 668f22e13a1e..de2ba5893b02 100644 --- a/packages/state-transition/test/unit/cachedBeaconState.test.ts +++ b/packages/state-transition/test/unit/cachedBeaconState.test.ts @@ -1,14 +1,14 @@ -import {fromHexString} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; +import {fromHexString} from "@chainsafe/ssz"; +import {createBeaconConfig, createChainForkConfig} from "@lodestar/config"; +import {config as defaultConfig} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; import {toHexString} from "@lodestar/utils"; -import {config as defaultConfig} from "@lodestar/config/default"; -import {createBeaconConfig, createChainForkConfig} from "@lodestar/config"; -import {createCachedBeaconStateTest} from "../utils/state.js"; +import {describe, expect, it} from "vitest"; import {createCachedBeaconState, loadCachedBeaconState} from "../../src/cache/stateCache.js"; -import {interopPubkeysCached} from "../utils/interop.js"; import {modifyStateSameValidator, newStateWithValidators} from "../utils/capella.js"; +import {interopPubkeysCached} from "../utils/interop.js"; +import {createCachedBeaconStateTest} from "../utils/state.js"; describe("CachedBeaconState", () => { it("Clone and mutate", () => { diff --git a/packages/state-transition/test/unit/constants.test.ts b/packages/state-transition/test/unit/constants.test.ts index 1cb17472218b..29b50fcb9c04 100644 --- a/packages/state-transition/test/unit/constants.test.ts +++ b/packages/state-transition/test/unit/constants.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import * as blst from "@chainsafe/blst"; +import {describe, expect, it} from "vitest"; import {G2_POINT_AT_INFINITY} from "../../src/index.js"; describe("constants", () => { diff --git a/packages/state-transition/test/unit/signatureSets/signatureSets.test.ts b/packages/state-transition/test/unit/signatureSets/signatureSets.test.ts index 353b68195636..ca9096ea8009 100644 --- a/packages/state-transition/test/unit/signatureSets/signatureSets.test.ts +++ b/packages/state-transition/test/unit/signatureSets/signatureSets.test.ts @@ -1,10 +1,10 @@ import crypto from "node:crypto"; -import {describe, it, expect} from "vitest"; -import {BitArray} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {BitArray} from "@chainsafe/ssz"; import {config} from "@lodestar/config/default"; -import {phase0, capella, ValidatorIndex, BLSSignature, ssz} from "@lodestar/types"; import {FAR_FUTURE_EPOCH, MAX_EFFECTIVE_BALANCE} from "@lodestar/params"; +import {BLSSignature, ValidatorIndex, capella, phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {ZERO_HASH} from "../../../src/constants/index.js"; import {getBlockSignatureSets} from "../../../src/signatureSets/index.js"; import {generateCachedState} from "../../utils/state.js"; diff --git a/packages/state-transition/test/unit/upgradeState.test.ts b/packages/state-transition/test/unit/upgradeState.test.ts index 19a7d5c186f8..9923463b46be 100644 --- a/packages/state-transition/test/unit/upgradeState.test.ts +++ b/packages/state-transition/test/unit/upgradeState.test.ts @@ -1,13 +1,13 @@ -import {expect, describe, it} from "vitest"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {ssz} from "@lodestar/types"; -import {ForkName} from "@lodestar/params"; -import {createBeaconConfig, ChainForkConfig, createChainForkConfig} from "@lodestar/config"; +import {ChainForkConfig, createBeaconConfig, createChainForkConfig} from "@lodestar/config"; import {config as chainConfig} from "@lodestar/config/default"; +import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; +import {createCachedBeaconState} from "../../src/cache/stateCache.js"; import {upgradeStateToDeneb} from "../../src/slot/upgradeStateToDeneb.js"; import {upgradeStateToElectra} from "../../src/slot/upgradeStateToElectra.js"; -import {createCachedBeaconState} from "../../src/cache/stateCache.js"; describe("upgradeState", () => { it("upgradeStateToDeneb", () => { diff --git a/packages/state-transition/test/unit/util/aggregator.test.ts b/packages/state-transition/test/unit/util/aggregator.test.ts index 58c2b0afbf58..ae4f1d0408f8 100644 --- a/packages/state-transition/test/unit/util/aggregator.test.ts +++ b/packages/state-transition/test/unit/util/aggregator.test.ts @@ -1,11 +1,11 @@ -import {describe, it, expect, beforeAll} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; import { SYNC_COMMITTEE_SIZE, SYNC_COMMITTEE_SUBNET_COUNT, - TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, TARGET_AGGREGATORS_PER_COMMITTEE, + TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE, } from "@lodestar/params"; +import {beforeAll, describe, expect, it} from "vitest"; import {isAggregatorFromCommitteeLength, isSyncCommitteeAggregator} from "../../../src/util/aggregator.js"; describe("isAttestationAggregator", () => { diff --git a/packages/state-transition/test/unit/util/balance.test.ts b/packages/state-transition/test/unit/util/balance.test.ts index 5b666cb0524e..2436c74a4e3c 100644 --- a/packages/state-transition/test/unit/util/balance.test.ts +++ b/packages/state-transition/test/unit/util/balance.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect} from "vitest"; import {config as minimalConfig} from "@lodestar/config/default"; +import {describe, expect, it} from "vitest"; import {EFFECTIVE_BALANCE_INCREMENT} from "@lodestar/params"; import {ValidatorIndex} from "@lodestar/types"; -import {increaseBalance, decreaseBalance, getTotalBalance, isActiveValidator} from "../../../src/util/index.js"; -import {getEffectiveBalanceIncrementsZeroed, getEffectiveBalanceIncrementsZeroInactive} from "../../../src/index.js"; +import {getEffectiveBalanceIncrementsZeroInactive, getEffectiveBalanceIncrementsZeroed} from "../../../src/index.js"; +import {decreaseBalance, getTotalBalance, increaseBalance, isActiveValidator} from "../../../src/util/index.js"; -import {generateValidators} from "../../utils/validator.js"; import {generateCachedState, generateState} from "../../utils/state.js"; +import {generateValidators} from "../../utils/validator.js"; describe("getTotalBalance", () => { it("should return correct balances - 500 validators", () => { diff --git a/packages/state-transition/test/unit/util/cachedBeaconState.test.ts b/packages/state-transition/test/unit/util/cachedBeaconState.test.ts index c85a8c7a2ffd..cd7a161d5355 100644 --- a/packages/state-transition/test/unit/util/cachedBeaconState.test.ts +++ b/packages/state-transition/test/unit/util/cachedBeaconState.test.ts @@ -1,8 +1,8 @@ -import {describe, it} from "vitest"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; import {createBeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; +import {describe, it} from "vitest"; import {createCachedBeaconState} from "../../../src/index.js"; describe("CachedBeaconState", () => { diff --git a/packages/state-transition/test/unit/util/deposit.test.ts b/packages/state-transition/test/unit/util/deposit.test.ts index a682b4e993ed..de73015c1f71 100644 --- a/packages/state-transition/test/unit/util/deposit.test.ts +++ b/packages/state-transition/test/unit/util/deposit.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; -import {ssz} from "@lodestar/types"; import {createChainForkConfig} from "@lodestar/config"; import {MAX_DEPOSITS} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {getEth1DepositCount} from "../../../src/index.js"; import {createCachedBeaconStateTest} from "../../utils/state.js"; diff --git a/packages/state-transition/test/unit/util/epoch.test.ts b/packages/state-transition/test/unit/util/epoch.test.ts index e86a41875e1d..cc11688ef080 100644 --- a/packages/state-transition/test/unit/util/epoch.test.ts +++ b/packages/state-transition/test/unit/util/epoch.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {GENESIS_SLOT, MAX_SEED_LOOKAHEAD} from "@lodestar/params"; import {Epoch, Slot} from "@lodestar/types"; import { - computeStartSlotAtEpoch, - getPreviousEpoch, computeActivationExitEpoch, computeEpochAtSlot, + computeStartSlotAtEpoch, + getPreviousEpoch, } from "../../../src/util/index.js"; import {generateState} from "../../utils/state.js"; diff --git a/packages/state-transition/test/unit/util/flags.test.ts b/packages/state-transition/test/unit/util/flags.test.ts index 07a8ce3fe097..58e40ff38586 100644 --- a/packages/state-transition/test/unit/util/flags.test.ts +++ b/packages/state-transition/test/unit/util/flags.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; describe("Altair status flags", () => { for (let prev = 0b000; prev <= 0b111; prev++) { diff --git a/packages/state-transition/test/unit/util/loadState.test.ts b/packages/state-transition/test/unit/util/loadState.test.ts index 97a792a28adb..4955c707e8ff 100644 --- a/packages/state-transition/test/unit/util/loadState.test.ts +++ b/packages/state-transition/test/unit/util/loadState.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect} from "vitest"; -import {ssz} from "@lodestar/types"; -import {mainnetChainConfig} from "@lodestar/config/networks"; import {createChainForkConfig} from "@lodestar/config"; +import {mainnetChainConfig} from "@lodestar/config/networks"; import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {loadStateAndValidators} from "../../../src/util/loadState/loadState.js"; describe("loadStateAndValidators", () => { diff --git a/packages/state-transition/test/unit/util/loadState/findModifiedInactivityScores.test.ts b/packages/state-transition/test/unit/util/loadState/findModifiedInactivityScores.test.ts index 85697af2b7c1..77301b3aef58 100644 --- a/packages/state-transition/test/unit/util/loadState/findModifiedInactivityScores.test.ts +++ b/packages/state-transition/test/unit/util/loadState/findModifiedInactivityScores.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { INACTIVITY_SCORE_SIZE, findModifiedInactivityScores, diff --git a/packages/state-transition/test/unit/util/loadState/findModifiedValidators.test.ts b/packages/state-transition/test/unit/util/loadState/findModifiedValidators.test.ts index 25c6233d2738..29c2b974a7a9 100644 --- a/packages/state-transition/test/unit/util/loadState/findModifiedValidators.test.ts +++ b/packages/state-transition/test/unit/util/loadState/findModifiedValidators.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {fromHexString} from "@chainsafe/ssz"; +import {describe, expect, it} from "vitest"; import {findModifiedValidators} from "../../../../src/util/loadState/findModifiedValidators.js"; import {generateState} from "../../../utils/state.js"; import {generateValidators} from "../../../utils/validator.js"; diff --git a/packages/state-transition/test/unit/util/loadState/loadValidator.test.ts b/packages/state-transition/test/unit/util/loadState/loadValidator.test.ts index 9a2094531813..9295df4f9797 100644 --- a/packages/state-transition/test/unit/util/loadState/loadValidator.test.ts +++ b/packages/state-transition/test/unit/util/loadState/loadValidator.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; import {CompositeViewDU} from "@chainsafe/ssz"; import {phase0, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import {loadValidator} from "../../../../src/util/loadState/loadValidator.js"; describe("loadValidator", () => { diff --git a/packages/state-transition/test/unit/util/misc.test.ts b/packages/state-transition/test/unit/util/misc.test.ts index 5651da5ac5d1..ae6387137a3f 100644 --- a/packages/state-transition/test/unit/util/misc.test.ts +++ b/packages/state-transition/test/unit/util/misc.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; -import {toBigIntLE} from "bigint-buffer"; import {GENESIS_SLOT, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params"; +import {toBigIntLE} from "bigint-buffer"; import {getBlockRoot} from "../../../src/util/index.js"; import {generateState} from "../../utils/state.js"; diff --git a/packages/state-transition/test/unit/util/seed.test.ts b/packages/state-transition/test/unit/util/seed.test.ts index 7f7c0e1f8bc7..e0f9e5d8ae67 100644 --- a/packages/state-transition/test/unit/util/seed.test.ts +++ b/packages/state-transition/test/unit/util/seed.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {toHexString} from "@chainsafe/ssz"; import {GENESIS_EPOCH, GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; diff --git a/packages/state-transition/test/unit/util/shuffling.test.ts b/packages/state-transition/test/unit/util/shuffling.test.ts index f4039b472f5c..ed8eb1775db6 100644 --- a/packages/state-transition/test/unit/util/shuffling.test.ts +++ b/packages/state-transition/test/unit/util/shuffling.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect} from "vitest"; import {ssz} from "@lodestar/types"; -import {generateState} from "../../utils/state.js"; -import {computeEpochShuffling, computeEpochShufflingAsync} from "../../../src/util/epochShuffling.js"; +import {describe, expect, it} from "vitest"; import {computeEpochAtSlot} from "../../../src/index.js"; +import {computeEpochShuffling, computeEpochShufflingAsync} from "../../../src/util/epochShuffling.js"; +import {generateState} from "../../utils/state.js"; describe("EpochShuffling", () => { it("async and sync versions should be identical", async () => { diff --git a/packages/state-transition/test/unit/util/slashing.test.ts b/packages/state-transition/test/unit/util/slashing.test.ts index 49a7b6454c25..fbae1abbce84 100644 --- a/packages/state-transition/test/unit/util/slashing.test.ts +++ b/packages/state-transition/test/unit/util/slashing.test.ts @@ -1,4 +1,4 @@ -import {expect, it, describe} from "vitest"; +import {describe, expect, it} from "vitest"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {Epoch, phase0, ssz} from "@lodestar/types"; diff --git a/packages/state-transition/test/unit/util/slot.test.ts b/packages/state-transition/test/unit/util/slot.test.ts index c9546ad60043..aa76498b366f 100644 --- a/packages/state-transition/test/unit/util/slot.test.ts +++ b/packages/state-transition/test/unit/util/slot.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {Slot} from "@lodestar/types"; import {computeSlotsSinceEpochStart} from "../../../src/util/index.js"; diff --git a/packages/state-transition/test/unit/util/validator.test.ts b/packages/state-transition/test/unit/util/validator.test.ts index 203adf9d8ba3..9c571f87c029 100644 --- a/packages/state-transition/test/unit/util/validator.test.ts +++ b/packages/state-transition/test/unit/util/validator.test.ts @@ -1,12 +1,12 @@ -import {describe, it, expect, beforeEach} from "vitest"; +import {beforeEach, describe, expect, it} from "vitest"; import {phase0, ssz} from "@lodestar/types"; import {getActiveValidatorIndices, isActiveValidator, isSlashableValidator} from "../../../src/util/index.js"; import {randBetween} from "../../utils/misc.js"; -import {generateValidator} from "../../utils/validator.js"; import {generateState} from "../../utils/state.js"; +import {generateValidator} from "../../utils/validator.js"; describe("getActiveValidatorIndices", () => { it("empty list of validators should return no indices (empty list)", () => { diff --git a/packages/state-transition/test/unit/util/weakSubjectivity.test.ts b/packages/state-transition/test/unit/util/weakSubjectivity.test.ts index ce9f02b5ed2f..3db06f86a191 100644 --- a/packages/state-transition/test/unit/util/weakSubjectivity.test.ts +++ b/packages/state-transition/test/unit/util/weakSubjectivity.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; import {config} from "@lodestar/config/default"; -import {computeWeakSubjectivityPeriodFromConstituents} from "../../../src/util/weakSubjectivity.js"; +import {describe, expect, it} from "vitest"; import {getChurnLimit} from "../../../src/util/validator.js"; +import {computeWeakSubjectivityPeriodFromConstituents} from "../../../src/util/weakSubjectivity.js"; describe("weak subjectivity tests", () => { describe("computeWeakSubjectivityPeriodFromConstituents", () => { diff --git a/packages/state-transition/test/utils/capella.ts b/packages/state-transition/test/utils/capella.ts index 7ef9248a5675..249053e2a22a 100644 --- a/packages/state-transition/test/utils/capella.ts +++ b/packages/state-transition/test/utils/capella.ts @@ -1,5 +1,4 @@ import crypto from "node:crypto"; -import {ssz} from "@lodestar/types"; import {config} from "@lodestar/config/default"; import { BLS_WITHDRAWAL_PREFIX, @@ -7,10 +6,11 @@ import { SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT, } from "@lodestar/params"; +import {ssz} from "@lodestar/types"; import {BeaconStateCapella, CachedBeaconStateCapella} from "../../src/index.js"; -import {createCachedBeaconStateTest} from "./state.js"; -import {mulberry32} from "./rand.js"; import {interopPubkeysCached} from "./interop.js"; +import {mulberry32} from "./rand.js"; +import {createCachedBeaconStateTest} from "./state.js"; export interface WithdrawalOpts { excessBalance: number; diff --git a/packages/state-transition/test/utils/state.ts b/packages/state-transition/test/utils/state.ts index 9a79faf74480..23cd90e05469 100644 --- a/packages/state-transition/test/utils/state.ts +++ b/packages/state-transition/test/utils/state.ts @@ -1,5 +1,6 @@ import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; import {config as minimalConfig} from "@lodestar/config/default"; +import {config} from "@lodestar/config/default"; import { EPOCHS_PER_HISTORICAL_VECTOR, EPOCHS_PER_SLASHINGS_VECTOR, @@ -8,20 +9,19 @@ import { SLOTS_PER_HISTORICAL_ROOT, } from "@lodestar/params"; import {phase0, ssz} from "@lodestar/types"; -import {config} from "@lodestar/config/default"; -import {createBeaconConfig, ChainForkConfig} from "@lodestar/config"; +import {ChainForkConfig, createBeaconConfig} from "@lodestar/config"; import {ZERO_HASH} from "../../src/constants/index.js"; import {newZeroedArray} from "../../src/util/index.js"; +import {EpochCacheOpts} from "../../src/cache/epochCache.js"; +import {BeaconStateCache} from "../../src/cache/stateCache.js"; import { + BeaconStateAllForks, BeaconStatePhase0, CachedBeaconStateAllForks, - BeaconStateAllForks, createCachedBeaconState, } from "../../src/index.js"; -import {BeaconStateCache} from "../../src/cache/stateCache.js"; -import {EpochCacheOpts} from "../../src/cache/epochCache.js"; /** * Copy of BeaconState, but all fields are marked optional to allow for swapping out variables as needed. diff --git a/packages/state-transition/test/utils/testFileCache.ts b/packages/state-transition/test/utils/testFileCache.ts index 5283a6f87fa1..dff164bcec44 100644 --- a/packages/state-transition/test/utils/testFileCache.ts +++ b/packages/state-transition/test/utils/testFileCache.ts @@ -1,10 +1,10 @@ import fs from "node:fs"; import path from "node:path"; -import got from "got"; import {getClient} from "@lodestar/api"; +import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; -import {createChainForkConfig, ChainForkConfig} from "@lodestar/config"; import {SignedBeaconBlock} from "@lodestar/types"; +import got from "got"; import {CachedBeaconStateAllForks} from "../../src/index.js"; import {testCachePath} from "../cache.js"; import {createCachedBeaconStateTest} from "../utils/state.js"; diff --git a/packages/test-utils/src/childProcess.ts b/packages/test-utils/src/childProcess.ts index d8b86b83ee48..62262c1c7756 100644 --- a/packages/test-utils/src/childProcess.ts +++ b/packages/test-utils/src/childProcess.ts @@ -1,9 +1,9 @@ /* eslint-disable no-console */ import childProcess, {ChildProcess, ChildProcessWithoutNullStreams} from "node:child_process"; -import stream from "node:stream"; import fs from "node:fs"; import path from "node:path"; -import {prettyMsToTime, retry, sleep, Logger} from "@lodestar/utils"; +import stream from "node:stream"; +import {Logger, prettyMsToTime, retry, sleep} from "@lodestar/utils"; export type ChildProcessLogOptions = { /** diff --git a/packages/test-utils/src/cli.ts b/packages/test-utils/src/cli.ts index a7b2a248bc7e..bdc87df96ac2 100644 --- a/packages/test-utils/src/cli.ts +++ b/packages/test-utils/src/cli.ts @@ -1,13 +1,13 @@ import childProcess from "node:child_process"; import type {Argv} from "yargs"; -import {wrapTimeout} from "./timeout.js"; -import {nodeJsBinaryPath, repoRootPath} from "./path.js"; import { ExecChildProcessOptions, SpawnChildProcessOptions, execChildProcess, spawnChildProcess, } from "./childProcess.js"; +import {nodeJsBinaryPath, repoRootPath} from "./path.js"; +import {wrapTimeout} from "./timeout.js"; // We need to make it easy for the user to pass the args for the CLI // yargs treat `["--preset minimal"] as a single arg, so we need to split it ["--preset", "minimal"] diff --git a/packages/test-utils/src/doubles.ts b/packages/test-utils/src/doubles.ts index 171c55824996..0e2b4aeb1e7f 100644 --- a/packages/test-utils/src/doubles.ts +++ b/packages/test-utils/src/doubles.ts @@ -1,5 +1,5 @@ -import {vi, MockInstance} from "vitest"; import {Logger} from "@lodestar/utils"; +import {MockInstance, vi} from "vitest"; type Callback = () => void; type Handler = (cb: Callback) => void; diff --git a/packages/test-utils/src/externalSigner.ts b/packages/test-utils/src/externalSigner.ts index 1e48e6af8d40..cdfbe484e72e 100644 --- a/packages/test-utils/src/externalSigner.ts +++ b/packages/test-utils/src/externalSigner.ts @@ -1,8 +1,8 @@ import fs from "node:fs"; import path from "node:path"; -import {dirSync as tmpDirSync} from "tmp"; -import {GenericContainer, Wait, StartedTestContainer} from "testcontainers"; import {ForkSeq} from "@lodestar/params"; +import {GenericContainer, StartedTestContainer, Wait} from "testcontainers"; +import {dirSync as tmpDirSync} from "tmp"; const web3signerVersion = "24.2.0"; diff --git a/packages/test-utils/src/http.ts b/packages/test-utils/src/http.ts index 85b64c110cab..1821cebd4112 100644 --- a/packages/test-utils/src/http.ts +++ b/packages/test-utils/src/http.ts @@ -1,5 +1,5 @@ -import axios from "axios"; import {sleep} from "@lodestar/utils"; +import axios from "axios"; type Method = "GET" | "POST" | "PUT"; diff --git a/packages/types/src/altair/index.ts b/packages/types/src/altair/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/altair/index.ts +++ b/packages/types/src/altair/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/altair/sszTypes.ts b/packages/types/src/altair/sszTypes.ts index 8998571a9f0d..61671825c840 100644 --- a/packages/types/src/altair/sszTypes.ts +++ b/packages/types/src/altair/sszTypes.ts @@ -1,13 +1,13 @@ import {BitVectorType, ContainerType, ListBasicType, ListCompositeType, VectorCompositeType} from "@chainsafe/ssz"; import { + EPOCHS_PER_SYNC_COMMITTEE_PERIOD, FINALIZED_ROOT_DEPTH, + HISTORICAL_ROOTS_LIMIT, NEXT_SYNC_COMMITTEE_DEPTH, - SYNC_COMMITTEE_SUBNET_COUNT, + SLOTS_PER_EPOCH, SYNC_COMMITTEE_SIZE, - HISTORICAL_ROOTS_LIMIT, + SYNC_COMMITTEE_SUBNET_COUNT, VALIDATOR_REGISTRY_LIMIT, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD, - SLOTS_PER_EPOCH, } from "@lodestar/params"; import * as phase0Ssz from "../phase0/sszTypes.js"; import * as primitiveSsz from "../primitive/sszTypes.js"; diff --git a/packages/types/src/bellatrix/index.ts b/packages/types/src/bellatrix/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/bellatrix/index.ts +++ b/packages/types/src/bellatrix/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/bellatrix/sszTypes.ts b/packages/types/src/bellatrix/sszTypes.ts index 53e6d436c012..08560552d112 100644 --- a/packages/types/src/bellatrix/sszTypes.ts +++ b/packages/types/src/bellatrix/sszTypes.ts @@ -2,13 +2,13 @@ import {ByteListType, ByteVectorType, ContainerType, ListCompositeType} from "@c import { BYTES_PER_LOGS_BLOOM, HISTORICAL_ROOTS_LIMIT, - MAX_TRANSACTIONS_PER_PAYLOAD, MAX_BYTES_PER_TRANSACTION, MAX_EXTRA_DATA_BYTES, + MAX_TRANSACTIONS_PER_PAYLOAD, } from "@lodestar/params"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.js"; +import {ssz as primitiveSsz} from "../primitive/index.js"; import {stringType} from "../utils/stringType.js"; const { diff --git a/packages/types/src/capella/index.ts b/packages/types/src/capella/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/capella/index.ts +++ b/packages/types/src/capella/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/capella/sszTypes.ts b/packages/types/src/capella/sszTypes.ts index d7cc444e77af..3110e59111d9 100644 --- a/packages/types/src/capella/sszTypes.ts +++ b/packages/types/src/capella/sszTypes.ts @@ -1,16 +1,16 @@ import {ContainerType, ListCompositeType, VectorCompositeType} from "@chainsafe/ssz"; import { + EPOCHS_PER_SYNC_COMMITTEE_PERIOD, + BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH, HISTORICAL_ROOTS_LIMIT, - MAX_WITHDRAWALS_PER_PAYLOAD, MAX_BLS_TO_EXECUTION_CHANGES, - BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD, + MAX_WITHDRAWALS_PER_PAYLOAD, SLOTS_PER_EPOCH, } from "@lodestar/params"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as bellatrixSsz} from "../bellatrix/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.js"; +import {ssz as primitiveSsz} from "../primitive/index.js"; const { UintNum64, diff --git a/packages/types/src/deneb/index.ts b/packages/types/src/deneb/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/deneb/index.ts +++ b/packages/types/src/deneb/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/deneb/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts index 076973bba579..6dc18c8f8b02 100644 --- a/packages/types/src/deneb/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -1,19 +1,19 @@ -import {ContainerType, ListCompositeType, ByteVectorType, VectorCompositeType} from "@chainsafe/ssz"; +import {ByteVectorType, ContainerType, ListCompositeType, VectorCompositeType} from "@chainsafe/ssz"; import { + BYTES_PER_FIELD_ELEMENT, + EPOCHS_PER_SYNC_COMMITTEE_PERIOD, + FIELD_ELEMENTS_PER_BLOB, HISTORICAL_ROOTS_LIMIT, + KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, MAX_BLOB_COMMITMENTS_PER_BLOCK, - FIELD_ELEMENTS_PER_BLOB, MAX_REQUEST_BLOB_SIDECARS, - BYTES_PER_FIELD_ELEMENT, - EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH, - KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, } from "@lodestar/params"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as bellatrixSsz} from "../bellatrix/index.js"; import {ssz as capellaSsz} from "../capella/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.js"; +import {ssz as primitiveSsz} from "../primitive/index.js"; const {UintNum64, Slot, Root, BLSSignature, UintBn64, UintBn256, Bytes32, Bytes48, Bytes96, BLSPubkey, BlobIndex} = primitiveSsz; diff --git a/packages/types/src/electra/index.ts b/packages/types/src/electra/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/electra/index.ts +++ b/packages/types/src/electra/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/electra/sszTypes.ts b/packages/types/src/electra/sszTypes.ts index 079af08352ec..f6b6c745803e 100644 --- a/packages/types/src/electra/sszTypes.ts +++ b/packages/types/src/electra/sszTypes.ts @@ -7,28 +7,28 @@ import { VectorCompositeType, } from "@chainsafe/ssz"; import { - HISTORICAL_ROOTS_LIMIT, EPOCHS_PER_SYNC_COMMITTEE_PERIOD, - SLOTS_PER_EPOCH, - MAX_DEPOSIT_REQUESTS_PER_PAYLOAD, - MAX_VALIDATORS_PER_COMMITTEE, - MAX_COMMITTEES_PER_SLOT, + FINALIZED_ROOT_DEPTH_ELECTRA, + HISTORICAL_ROOTS_LIMIT, MAX_ATTESTATIONS_ELECTRA, MAX_ATTESTER_SLASHINGS_ELECTRA, - MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD, + MAX_COMMITTEES_PER_SLOT, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD, + MAX_DEPOSIT_REQUESTS_PER_PAYLOAD, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD, + NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, + PENDING_CONSOLIDATIONS_LIMIT, PENDING_DEPOSITS_LIMIT, PENDING_PARTIAL_WITHDRAWALS_LIMIT, - PENDING_CONSOLIDATIONS_LIMIT, - FINALIZED_ROOT_DEPTH_ELECTRA, - NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, + SLOTS_PER_EPOCH, } from "@lodestar/params"; -import {ssz as primitiveSsz} from "../primitive/index.js"; -import {ssz as phase0Ssz} from "../phase0/index.js"; import {ssz as altairSsz} from "../altair/index.js"; import {ssz as bellatrixSsz} from "../bellatrix/index.js"; import {ssz as capellaSsz} from "../capella/index.js"; import {ssz as denebSsz} from "../deneb/index.js"; +import {ssz as phase0Ssz} from "../phase0/index.js"; +import {ssz as primitiveSsz} from "../primitive/index.js"; const { Epoch, diff --git a/packages/types/src/phase0/index.ts b/packages/types/src/phase0/index.ts index 981b2015e02a..31c28a0d3690 100644 --- a/packages/types/src/phase0/index.ts +++ b/packages/types/src/phase0/index.ts @@ -1,4 +1,4 @@ export * from "./types.js"; -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/phase0/sszTypes.ts b/packages/types/src/phase0/sszTypes.ts index 4a04701b789d..2f9eead77608 100644 --- a/packages/types/src/phase0/sszTypes.ts +++ b/packages/types/src/phase0/sszTypes.ts @@ -4,8 +4,8 @@ import { ContainerType, ListBasicType, ListCompositeType, - VectorBasicType, ListUintNum64Type, + VectorBasicType, VectorCompositeType, } from "@chainsafe/ssz"; import { diff --git a/packages/types/src/primitive/index.ts b/packages/types/src/primitive/index.ts index b68df6795375..2e5e6adc9753 100644 --- a/packages/types/src/primitive/index.ts +++ b/packages/types/src/primitive/index.ts @@ -1,3 +1,3 @@ -import * as ts from "./types.js"; import * as ssz from "./sszTypes.js"; +import * as ts from "./types.js"; export {ts, ssz}; diff --git a/packages/types/src/primitive/sszTypes.ts b/packages/types/src/primitive/sszTypes.ts index 0b5156eaf24d..40806aa40f4a 100644 --- a/packages/types/src/primitive/sszTypes.ts +++ b/packages/types/src/primitive/sszTypes.ts @@ -1,4 +1,4 @@ -import {ByteVectorType, UintNumberType, UintBigintType, BooleanType} from "@chainsafe/ssz"; +import {BooleanType, ByteVectorType, UintBigintType, UintNumberType} from "@chainsafe/ssz"; import {ExecutionAddressType} from "../utils/executionAddress.js"; // biome-ignore lint/suspicious/noShadowRestrictedNames: We explicitly want this name for variable diff --git a/packages/types/src/sszTypes.ts b/packages/types/src/sszTypes.ts index 55218574be76..2a8666f3e243 100644 --- a/packages/types/src/sszTypes.ts +++ b/packages/types/src/sszTypes.ts @@ -1,11 +1,11 @@ import {CompositeType, CompositeView, CompositeViewDU, ContainerType, ValueOf} from "@chainsafe/ssz"; import {ForkName} from "@lodestar/params"; -import {ssz as phase0} from "./phase0/index.js"; import {ssz as altair} from "./altair/index.js"; import {ssz as bellatrix} from "./bellatrix/index.js"; import {ssz as capella} from "./capella/index.js"; import {ssz as deneb} from "./deneb/index.js"; import {ssz as electra} from "./electra/index.js"; +import {ssz as phase0} from "./phase0/index.js"; export * from "./primitive/sszTypes.js"; export {phase0, altair, bellatrix, capella, deneb, electra}; diff --git a/packages/types/src/types.ts b/packages/types/src/types.ts index b1919c2f0842..badb1f1f2333 100644 --- a/packages/types/src/types.ts +++ b/packages/types/src/types.ts @@ -7,12 +7,12 @@ import { ForkPostElectra, ForkPreBlobs, } from "@lodestar/params"; -import {ts as phase0} from "./phase0/index.js"; import {ts as altair} from "./altair/index.js"; import {ts as bellatrix} from "./bellatrix/index.js"; import {ts as capella} from "./capella/index.js"; import {ts as deneb} from "./deneb/index.js"; import {ts as electra} from "./electra/index.js"; +import {ts as phase0} from "./phase0/index.js"; import {Slot} from "./primitive/types.js"; export * from "./primitive/types.js"; diff --git a/packages/types/src/utils/executionAddress.ts b/packages/types/src/utils/executionAddress.ts index 9d555c016f04..ea1856405443 100644 --- a/packages/types/src/utils/executionAddress.ts +++ b/packages/types/src/utils/executionAddress.ts @@ -1,5 +1,5 @@ -import {keccak256} from "ethereum-cryptography/keccak.js"; import {ByteVectorType} from "@chainsafe/ssz"; +import {keccak256} from "ethereum-cryptography/keccak.js"; export type ByteVector = Uint8Array; diff --git a/packages/types/src/utils/typeguards.ts b/packages/types/src/utils/typeguards.ts index a892c3a0c9c0..d4a27e23d1d6 100644 --- a/packages/types/src/utils/typeguards.ts +++ b/packages/types/src/utils/typeguards.ts @@ -1,20 +1,20 @@ import {FINALIZED_ROOT_DEPTH_ELECTRA, ForkBlobs, ForkExecution, ForkPostElectra} from "@lodestar/params"; import { + Attestation, + BeaconBlock, + BeaconBlockBody, + BeaconBlockOrContents, + BlindedBeaconBlock, + BlindedBeaconBlockBody, BlockContents, - SignedBeaconBlock, ExecutionPayload, ExecutionPayloadAndBlobsBundle, - BeaconBlockBody, - BeaconBlockOrContents, - SignedBeaconBlockOrContents, ExecutionPayloadHeader, - BlindedBeaconBlock, + LightClientUpdate, + SignedBeaconBlock, + SignedBeaconBlockOrContents, SignedBlindedBeaconBlock, - BlindedBeaconBlockBody, SignedBlockContents, - BeaconBlock, - Attestation, - LightClientUpdate, } from "../types.js"; export function isExecutionPayload( diff --git a/packages/types/test/constants/blobs.test.ts b/packages/types/test/constants/blobs.test.ts index 4b145161d292..66927d4b6040 100644 --- a/packages/types/test/constants/blobs.test.ts +++ b/packages/types/test/constants/blobs.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import * as constants from "@lodestar/params"; +import {describe, expect, it} from "vitest"; import {ssz} from "../../src/index.js"; // NOTE: This test is here and not in lodestar-params, to prevent lodestar-params depending on SSZ diff --git a/packages/types/test/constants/lightclient.test.ts b/packages/types/test/constants/lightclient.test.ts index 567cc7c3bd17..9e87fcadca42 100644 --- a/packages/types/test/constants/lightclient.test.ts +++ b/packages/types/test/constants/lightclient.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import * as constants from "@lodestar/params"; +import {describe, expect, it} from "vitest"; import {ssz} from "../../src/index.js"; // NOTE: This test is here and not in lodestar-params, to prevent lodestar-params depending on SSZ diff --git a/packages/types/test/unit/blinded.test.ts b/packages/types/test/unit/blinded.test.ts index 3d087b610b2d..1024707705fe 100644 --- a/packages/types/test/unit/blinded.test.ts +++ b/packages/types/test/unit/blinded.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; import {ForkName, isForkExecution} from "@lodestar/params"; +import {describe, expect, it} from "vitest"; import {ssz} from "../../src/index.js"; describe("blinded data structures", () => { diff --git a/packages/types/test/unit/executionAddress.test.ts b/packages/types/test/unit/executionAddress.test.ts index 841cd52468f5..00f47fefba0c 100644 --- a/packages/types/test/unit/executionAddress.test.ts +++ b/packages/types/test/unit/executionAddress.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {toChecksumAddress} from "../../src/utils/executionAddress.js"; describe("toChecksumAddress", () => { diff --git a/packages/types/test/unit/phase0/sszTypes.test.ts b/packages/types/test/unit/phase0/sszTypes.test.ts index 4bdb2031e5ea..473adae31aea 100644 --- a/packages/types/test/unit/phase0/sszTypes.test.ts +++ b/packages/types/test/unit/phase0/sszTypes.test.ts @@ -1,5 +1,5 @@ import {ContainerType} from "@chainsafe/ssz"; -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {ssz} from "../../../src/index.js"; import {ValidatorType} from "../../../src/phase0/validator.js"; diff --git a/packages/types/test/unit/ssz.test.ts b/packages/types/test/unit/ssz.test.ts index 41e4e0bbd23b..1cc249a17a3e 100644 --- a/packages/types/test/unit/ssz.test.ts +++ b/packages/types/test/unit/ssz.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {ssz} from "../../src/index.js"; describe("size", () => { diff --git a/packages/types/test/unit/validatorStatus.test.ts b/packages/types/test/unit/validatorStatus.test.ts index b5bd34004bdc..70189a29ee11 100644 --- a/packages/types/test/unit/validatorStatus.test.ts +++ b/packages/types/test/unit/validatorStatus.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {getValidatorStatus} from "../../src/utils/validatorStatus.js"; +import {describe, expect, it} from "vitest"; import {phase0} from "../../src/types.js"; +import {getValidatorStatus} from "../../src/utils/validatorStatus.js"; describe("getValidatorStatus", () => { it("should return PENDING_INITIALIZED", () => { diff --git a/packages/utils/src/bytes.ts b/packages/utils/src/bytes.ts index c290232ce8db..195157d7c132 100644 --- a/packages/utils/src/bytes.ts +++ b/packages/utils/src/bytes.ts @@ -1,4 +1,4 @@ -import {toBufferLE, toBigIntLE, toBufferBE, toBigIntBE} from "bigint-buffer"; +import {toBigIntBE, toBigIntLE, toBufferBE, toBufferLE} from "bigint-buffer"; type Endianness = "le" | "be"; diff --git a/packages/utils/src/bytes/index.ts b/packages/utils/src/bytes/index.ts index a079764738b7..762a33bf5237 100644 --- a/packages/utils/src/bytes/index.ts +++ b/packages/utils/src/bytes/index.ts @@ -1,14 +1,14 @@ import { - toHex as browserToHex, - toRootHex as browserToRootHex, fromHex as browserFromHex, + toHex as browserToHex, toPubkeyHex as browserToPubkeyHex, + toRootHex as browserToRootHex, } from "./browser.js"; import { - toHex as nodeToHex, - toRootHex as nodeToRootHex, fromHex as nodeFromHex, + toHex as nodeToHex, toPubkeyHex as nodeToPubkeyHex, + toRootHex as nodeToRootHex, } from "./nodejs.js"; let toHex = browserToHex; diff --git a/packages/utils/src/command.ts b/packages/utils/src/command.ts index 2e62ba5a9648..13bf5850c8de 100644 --- a/packages/utils/src/command.ts +++ b/packages/utils/src/command.ts @@ -1,4 +1,4 @@ -import type {Options, Argv} from "yargs"; +import type {Argv, Options} from "yargs"; export interface CliExample { command: string; diff --git a/packages/utils/test/perf/bytes.test.ts b/packages/utils/test/perf/bytes.test.ts index 6a1e96ab1579..9c67745ed9a3 100644 --- a/packages/utils/test/perf/bytes.test.ts +++ b/packages/utils/test/perf/bytes.test.ts @@ -1,7 +1,7 @@ import {itBench} from "@dapplion/benchmark"; -import {toHex, toRootHex} from "../../src/bytes/nodejs.js"; -import {toHex as browserToHex, toRootHex as browserToRootHex} from "../../src/bytes/browser.js"; import {toHexString} from "../../src/bytes.js"; +import {toHex as browserToHex, toRootHex as browserToRootHex} from "../../src/bytes/browser.js"; +import {toHex, toRootHex} from "../../src/bytes/nodejs.js"; describe("bytes utils", () => { const runsFactor = 1000; diff --git a/packages/utils/test/types/metrics.test-d.ts b/packages/utils/test/types/metrics.test-d.ts index 2f008618e648..c6ad53e976c8 100644 --- a/packages/utils/test/types/metrics.test-d.ts +++ b/packages/utils/test/types/metrics.test-d.ts @@ -1,5 +1,5 @@ -import {describe, it, expectTypeOf} from "vitest"; import {Counter as PromCounter, Gauge as PromGauge, Histogram as PromHistogram} from "prom-client"; +import {describe, expectTypeOf, it} from "vitest"; import {Counter, Gauge, Histogram, MetricsRegister} from "../../src/metrics.js"; describe("Metric types", () => { diff --git a/packages/utils/test/unit/assert.test.ts b/packages/utils/test/unit/assert.test.ts index 3b413efa11be..536c84effd97 100644 --- a/packages/utils/test/unit/assert.test.ts +++ b/packages/utils/test/unit/assert.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {assert} from "../../src/index.js"; describe("assert", () => { diff --git a/packages/utils/test/unit/base64.test.ts b/packages/utils/test/unit/base64.test.ts index 7c68e84f4c3e..97a1a4d6c9b5 100644 --- a/packages/utils/test/unit/base64.test.ts +++ b/packages/utils/test/unit/base64.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {toBase64, fromBase64} from "../../src/index.js"; +import {describe, expect, it} from "vitest"; +import {fromBase64, toBase64} from "../../src/index.js"; describe("toBase64", () => { it("should encode UTF-8 string as base64 string", () => { diff --git a/packages/utils/test/unit/bytes.test.ts b/packages/utils/test/unit/bytes.test.ts index af4df6652f13..3877ad81e120 100644 --- a/packages/utils/test/unit/bytes.test.ts +++ b/packages/utils/test/unit/bytes.test.ts @@ -1,13 +1,13 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { - intToBytes, bytesToInt, - toHex, + formatBytes, fromHex, + intToBytes, + toHex, toHexString, - toRootHex, toPubkeyHex, - formatBytes, + toRootHex, } from "../../src/index.js"; describe("intToBytes", () => { diff --git a/packages/utils/test/unit/err.test.ts b/packages/utils/test/unit/err.test.ts index 7a08ebbc4319..e344e2fb88c7 100644 --- a/packages/utils/test/unit/err.test.ts +++ b/packages/utils/test/unit/err.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {Err, isErr, mapOkResults, mapOkResultsAsync, Result} from "../../src/err.js"; +import {describe, expect, it} from "vitest"; +import {Err, Result, isErr, mapOkResults, mapOkResultsAsync} from "../../src/err.js"; describe("Result Err", () => { describe("isErr works with any type", () => { diff --git a/packages/utils/test/unit/format.test.ts b/packages/utils/test/unit/format.test.ts index 11e8b89cb7a1..2ca679f32a79 100644 --- a/packages/utils/test/unit/format.test.ts +++ b/packages/utils/test/unit/format.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {formatBigDecimal} from "../../src/format.js"; describe("format", () => { diff --git a/packages/utils/test/unit/math.test.ts b/packages/utils/test/unit/math.test.ts index e324714600b1..98a995b24ed8 100644 --- a/packages/utils/test/unit/math.test.ts +++ b/packages/utils/test/unit/math.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {bigIntMin, bigIntMax, intDiv, intSqrt, bigIntSqrt} from "../../src/index.js"; +import {describe, expect, it} from "vitest"; +import {bigIntMax, bigIntMin, bigIntSqrt, intDiv, intSqrt} from "../../src/index.js"; describe("util/maths", () => { describe("bigIntMin", () => { diff --git a/packages/utils/test/unit/objects.test.ts b/packages/utils/test/unit/objects.test.ts index a94ed9213390..59f2024e09d6 100644 --- a/packages/utils/test/unit/objects.test.ts +++ b/packages/utils/test/unit/objects.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {isPlainObject, objectToExpectedCase} from "../../src/index.js"; describe("Objects helper", () => { diff --git a/packages/utils/test/unit/promise.node.test.ts b/packages/utils/test/unit/promise.node.test.ts index 55cbad36b211..d2e7a6e4cc22 100644 --- a/packages/utils/test/unit/promise.node.test.ts +++ b/packages/utils/test/unit/promise.node.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect, vi, beforeEach, afterEach} from "vitest"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {callFnWhenAwait} from "../../src/promise.js"; // TODO: Need to debug why vi.useFakeTimers() is not working for the browsers diff --git a/packages/utils/test/unit/promise.test.ts b/packages/utils/test/unit/promise.test.ts index c76e72f70a22..56df4d88ecf1 100644 --- a/packages/utils/test/unit/promise.test.ts +++ b/packages/utils/test/unit/promise.test.ts @@ -1,7 +1,7 @@ /* Causing this error on usage of expect.any(Number) */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import {describe, it, expect} from "vitest"; -import {wrapPromise, PromiseRejectedResult, PromiseFulfilledResult} from "../../src/promise.js"; +import {describe, expect, it} from "vitest"; +import {PromiseFulfilledResult, PromiseRejectedResult, wrapPromise} from "../../src/promise.js"; describe("promise", () => { describe("wrapPromise", () => { diff --git a/packages/utils/test/unit/promiserace.test.ts b/packages/utils/test/unit/promiserace.test.ts index 4b20f19f9fba..5aa5886c9848 100644 --- a/packages/utils/test/unit/promiserace.test.ts +++ b/packages/utils/test/unit/promiserace.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {resolveOrRacePromises, PromiseResult} from "../../src/promise.js"; +import {describe, expect, it} from "vitest"; +import {PromiseResult, resolveOrRacePromises} from "../../src/promise.js"; import {NonEmptyArray} from "../../src/types.js"; describe("resolveOrRacePromises", () => { diff --git a/packages/utils/test/unit/retry.test.ts b/packages/utils/test/unit/retry.test.ts index bd77c499a364..5e5793664e3b 100644 --- a/packages/utils/test/unit/retry.test.ts +++ b/packages/utils/test/unit/retry.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect} from "vitest"; -import {retry, RetryOptions} from "../../src/retry.js"; +import {describe, expect, it} from "vitest"; +import {RetryOptions, retry} from "../../src/retry.js"; describe("retry", () => { type TestCase = { diff --git a/packages/utils/test/unit/sleep.test.ts b/packages/utils/test/unit/sleep.test.ts index ef632fd34f64..40dd699a5a06 100644 --- a/packages/utils/test/unit/sleep.test.ts +++ b/packages/utils/test/unit/sleep.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {sleep} from "../../src/sleep.js"; +import {describe, expect, it} from "vitest"; import {ErrorAborted} from "../../src/errors.js"; +import {sleep} from "../../src/sleep.js"; describe("sleep", () => { it("Should resolve timeout", async () => { diff --git a/packages/utils/test/unit/timeout.test.ts b/packages/utils/test/unit/timeout.test.ts index 7b4b1eb883be..7568983daa8d 100644 --- a/packages/utils/test/unit/timeout.test.ts +++ b/packages/utils/test/unit/timeout.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect, afterEach} from "vitest"; -import {withTimeout} from "../../src/timeout.js"; +import {afterEach, describe, expect, it} from "vitest"; import {ErrorAborted, TimeoutError} from "../../src/errors.js"; +import {withTimeout} from "../../src/timeout.js"; describe("withTimeout", () => { const data = "DATA"; diff --git a/packages/utils/test/unit/waitFor.test.ts b/packages/utils/test/unit/waitFor.test.ts index 412c06f888ed..844b0d157c61 100644 --- a/packages/utils/test/unit/waitFor.test.ts +++ b/packages/utils/test/unit/waitFor.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect} from "vitest"; -import {waitFor, createElapsedTimeTracker} from "../../src/waitFor.js"; +import {describe, expect, it} from "vitest"; import {ErrorAborted, TimeoutError} from "../../src/errors.js"; import {sleep} from "../../src/sleep.js"; +import {createElapsedTimeTracker, waitFor} from "../../src/waitFor.js"; describe("waitFor", () => { const interval = 10; diff --git a/packages/validator/src/genesis.ts b/packages/validator/src/genesis.ts index 7fc3e20673bc..9e947f89c949 100644 --- a/packages/validator/src/genesis.ts +++ b/packages/validator/src/genesis.ts @@ -1,6 +1,6 @@ +import {ApiClient} from "@lodestar/api"; import {Genesis} from "@lodestar/types/phase0"; import {Logger, sleep} from "@lodestar/utils"; -import {ApiClient} from "@lodestar/api"; /** The time between polls when waiting for genesis */ const WAITING_FOR_GENESIS_POLL_MS = 12 * 1000; diff --git a/packages/validator/src/repositories/metaDataRepository.ts b/packages/validator/src/repositories/metaDataRepository.ts index 0ba1565a6651..263ad9f8c6f3 100644 --- a/packages/validator/src/repositories/metaDataRepository.ts +++ b/packages/validator/src/repositories/metaDataRepository.ts @@ -1,8 +1,8 @@ -import {encodeKey, DbReqOpts} from "@lodestar/db"; +import {DbReqOpts, encodeKey} from "@lodestar/db"; import {Root, UintNum64} from "@lodestar/types"; import {ssz} from "@lodestar/types"; -import {LodestarValidatorDatabaseController} from "../types.js"; import {Bucket, getBucketNameByValue} from "../buckets.js"; +import {LodestarValidatorDatabaseController} from "../types.js"; const GENESIS_VALIDATORS_ROOT = Buffer.from("GENESIS_VALIDATORS_ROOT"); const GENESIS_TIME = Buffer.from("GENESIS_TIME"); diff --git a/packages/validator/src/services/attestation.ts b/packages/validator/src/services/attestation.ts index 7f0dffa3e970..514ecbbd613d 100644 --- a/packages/validator/src/services/attestation.ts +++ b/packages/validator/src/services/attestation.ts @@ -1,18 +1,18 @@ -import {BLSSignature, phase0, Slot, ssz, Attestation, SignedAggregateAndProof} from "@lodestar/types"; +import {ApiClient, routes} from "@lodestar/api"; +import {ChainForkConfig} from "@lodestar/config"; import {ForkSeq} from "@lodestar/params"; import {computeEpochAtSlot, isAggregatorFromCommitteeLength} from "@lodestar/state-transition"; +import {Attestation, BLSSignature, SignedAggregateAndProof, Slot, phase0, ssz} from "@lodestar/types"; import {prettyBytes, sleep, toRootHex} from "@lodestar/utils"; -import {ApiClient, routes} from "@lodestar/api"; -import {ChainForkConfig} from "@lodestar/config"; -import {IClock, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; import {Metrics} from "../metrics.js"; -import {ValidatorStore} from "./validatorStore.js"; -import {AttestationDutiesService, AttDutyAndProof} from "./attestationDuties.js"; -import {groupAttDutiesByCommitteeIndex} from "./utils.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc} from "../util/index.js"; +import {AttDutyAndProof, AttestationDutiesService} from "./attestationDuties.js"; import {ChainHeaderTracker} from "./chainHeaderTracker.js"; -import {SyncingStatusTracker} from "./syncingStatusTracker.js"; import {ValidatorEventEmitter} from "./emitter.js"; +import {SyncingStatusTracker} from "./syncingStatusTracker.js"; +import {groupAttDutiesByCommitteeIndex} from "./utils.js"; +import {ValidatorStore} from "./validatorStore.js"; export type AttestationServiceOpts = { afterBlockDelaySlotFraction?: number; diff --git a/packages/validator/src/services/attestationDuties.ts b/packages/validator/src/services/attestationDuties.ts index 83838afe1492..b57b163b78b8 100644 --- a/packages/validator/src/services/attestationDuties.ts +++ b/packages/validator/src/services/attestationDuties.ts @@ -1,14 +1,14 @@ +import {ApiClient, routes} from "@lodestar/api"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {sleep, toPubkeyHex} from "@lodestar/utils"; import {computeEpochAtSlot, isAggregatorFromCommitteeLength, isStartSlotOfEpoch} from "@lodestar/state-transition"; -import {BLSSignature, Epoch, Slot, ValidatorIndex, RootHex} from "@lodestar/types"; -import {ApiClient, routes} from "@lodestar/api"; -import {batchItems, IClock, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; +import {BLSSignature, Epoch, RootHex, Slot, ValidatorIndex} from "@lodestar/types"; +import {sleep, toPubkeyHex} from "@lodestar/utils"; import {Metrics} from "../metrics.js"; -import {ValidatorStore} from "./validatorStore.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc, batchItems} from "../util/index.js"; import {ChainHeaderTracker, HeadEventData} from "./chainHeaderTracker.js"; import {SyncingStatusTracker} from "./syncingStatusTracker.js"; +import {ValidatorStore} from "./validatorStore.js"; /** Only retain `HISTORICAL_DUTIES_EPOCHS` duties prior to the current epoch. */ const HISTORICAL_DUTIES_EPOCHS = 2; diff --git a/packages/validator/src/services/block.ts b/packages/validator/src/services/block.ts index cb295450e96b..a27b5abe4b79 100644 --- a/packages/validator/src/services/block.ts +++ b/packages/validator/src/services/block.ts @@ -1,26 +1,26 @@ +import {ApiClient, routes} from "@lodestar/api"; +import {ChainForkConfig} from "@lodestar/config"; +import {ForkBlobs, ForkExecution, ForkName, ForkPreBlobs, ForkSeq} from "@lodestar/params"; import { BLSPubkey, - Slot, BLSSignature, - ProducedBlockSource, - deneb, - isBlockContents, BeaconBlock, BeaconBlockOrContents, - isBlindedSignedBeaconBlock, BlindedBeaconBlock, + ProducedBlockSource, SignedBeaconBlock, SignedBlindedBeaconBlock, + Slot, + deneb, + isBlindedSignedBeaconBlock, + isBlockContents, } from "@lodestar/types"; -import {ChainForkConfig} from "@lodestar/config"; -import {ForkPreBlobs, ForkBlobs, ForkSeq, ForkExecution, ForkName} from "@lodestar/params"; import {extendError, prettyBytes, prettyWeiToEth, toPubkeyHex} from "@lodestar/utils"; -import {ApiClient, routes} from "@lodestar/api"; -import {IClock, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; import {Metrics} from "../metrics.js"; -import {ValidatorStore} from "./validatorStore.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc} from "../util/index.js"; import {BlockDutiesService, GENESIS_SLOT} from "./blockDuties.js"; +import {ValidatorStore} from "./validatorStore.js"; // The following combination of blocks and blobs can be produced // i) a full block pre deneb diff --git a/packages/validator/src/services/blockDuties.ts b/packages/validator/src/services/blockDuties.ts index d0e16f60e816..c9fc1712513d 100644 --- a/packages/validator/src/services/blockDuties.ts +++ b/packages/validator/src/services/blockDuties.ts @@ -1,11 +1,11 @@ +import {ApiClient, routes} from "@lodestar/api"; +import {ChainConfig} from "@lodestar/config"; import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {BLSPubkey, Epoch, RootHex, Slot} from "@lodestar/types"; -import {ApiClient, routes} from "@lodestar/api"; import {sleep, toPubkeyHex} from "@lodestar/utils"; -import {ChainConfig} from "@lodestar/config"; -import {IClock, differenceHex, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; import {Metrics} from "../metrics.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc, differenceHex} from "../util/index.js"; import {ValidatorStore} from "./validatorStore.js"; /** This polls block duties 1s before the next epoch */ diff --git a/packages/validator/src/services/chainHeaderTracker.ts b/packages/validator/src/services/chainHeaderTracker.ts index 1c0b0d9a56d8..730d5b201ed3 100644 --- a/packages/validator/src/services/chainHeaderTracker.ts +++ b/packages/validator/src/services/chainHeaderTracker.ts @@ -1,7 +1,7 @@ import {ApiClient, routes} from "@lodestar/api"; -import {Logger, fromHex} from "@lodestar/utils"; -import {Slot, Root, RootHex} from "@lodestar/types"; import {GENESIS_SLOT} from "@lodestar/params"; +import {Root, RootHex, Slot} from "@lodestar/types"; +import {Logger, fromHex} from "@lodestar/utils"; import {ValidatorEvent, ValidatorEventEmitter} from "./emitter.js"; const {EventType} = routes.events; diff --git a/packages/validator/src/services/doppelgangerService.ts b/packages/validator/src/services/doppelgangerService.ts index aa43d7bba55b..33001970ee61 100644 --- a/packages/validator/src/services/doppelgangerService.ts +++ b/packages/validator/src/services/doppelgangerService.ts @@ -1,11 +1,11 @@ -import {Epoch, ValidatorIndex} from "@lodestar/types"; import {ApiClient, routes} from "@lodestar/api"; -import {Logger, fromHex, sleep, truncBytes} from "@lodestar/utils"; import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; +import {Epoch, ValidatorIndex} from "@lodestar/types"; +import {Logger, fromHex, sleep, truncBytes} from "@lodestar/utils"; +import {Metrics} from "../metrics.js"; import {ISlashingProtection} from "../slashingProtection/index.js"; import {ProcessShutdownCallback, PubkeyHex} from "../types.js"; import {IClock} from "../util/index.js"; -import {Metrics} from "../metrics.js"; import {IndicesService} from "./indices.js"; // The number of epochs that must be checked before we assume that there are diff --git a/packages/validator/src/services/emitter.ts b/packages/validator/src/services/emitter.ts index 2072acba6219..5c27189d02cb 100644 --- a/packages/validator/src/services/emitter.ts +++ b/packages/validator/src/services/emitter.ts @@ -1,6 +1,6 @@ import {EventEmitter} from "node:events"; -import {StrictEventEmitter} from "strict-event-emitter-types"; import {Slot} from "@lodestar/types"; +import {StrictEventEmitter} from "strict-event-emitter-types"; import {HeadEventData} from "./chainHeaderTracker.js"; export enum ValidatorEvent { diff --git a/packages/validator/src/services/externalSignerSync.ts b/packages/validator/src/services/externalSignerSync.ts index 2f6828d9e09b..dfccfa942ee6 100644 --- a/packages/validator/src/services/externalSignerSync.ts +++ b/packages/validator/src/services/externalSignerSync.ts @@ -3,8 +3,8 @@ import {ChainForkConfig} from "@lodestar/config"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; import {fromHex, toPrintableUrl} from "@lodestar/utils"; -import {LoggerVc} from "../util/index.js"; import {externalSignerGetKeys} from "../util/externalSignerClient.js"; +import {LoggerVc} from "../util/index.js"; import {SignerType, ValidatorStore} from "./validatorStore.js"; export type ExternalSignerOptions = { diff --git a/packages/validator/src/services/indices.ts b/packages/validator/src/services/indices.ts index ff8d1d46ab26..0a409fe3315d 100644 --- a/packages/validator/src/services/indices.ts +++ b/packages/validator/src/services/indices.ts @@ -1,8 +1,8 @@ +import {ApiClient, routes} from "@lodestar/api"; import {ValidatorIndex} from "@lodestar/types"; import {Logger, MapDef, toPubkeyHex} from "@lodestar/utils"; -import {ApiClient, routes} from "@lodestar/api"; -import {batchItems} from "../util/index.js"; import {Metrics} from "../metrics.js"; +import {batchItems} from "../util/index.js"; /** * This is to prevent the "Request body is too large" issue for http post. diff --git a/packages/validator/src/services/prepareBeaconProposer.ts b/packages/validator/src/services/prepareBeaconProposer.ts index 6ae4b0a83870..51057f7f72da 100644 --- a/packages/validator/src/services/prepareBeaconProposer.ts +++ b/packages/validator/src/services/prepareBeaconProposer.ts @@ -1,10 +1,10 @@ -import {Epoch, bellatrix} from "@lodestar/types"; import {ApiClient, routes} from "@lodestar/api"; import {BeaconConfig} from "@lodestar/config"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; +import {Epoch, bellatrix} from "@lodestar/types"; -import {IClock, LoggerVc, batchItems} from "../util/index.js"; import {Metrics} from "../metrics.js"; +import {IClock, LoggerVc, batchItems} from "../util/index.js"; import {ValidatorStore} from "./validatorStore.js"; const REGISTRATION_CHUNK_SIZE = 512; diff --git a/packages/validator/src/services/syncCommittee.ts b/packages/validator/src/services/syncCommittee.ts index c960adc6986b..fb0aa74238d2 100644 --- a/packages/validator/src/services/syncCommittee.ts +++ b/packages/validator/src/services/syncCommittee.ts @@ -1,17 +1,17 @@ +import {ApiClient, routes} from "@lodestar/api"; import {ChainForkConfig} from "@lodestar/config"; -import {Slot, CommitteeIndex, altair, Root, BLSSignature} from "@lodestar/types"; -import {sleep} from "@lodestar/utils"; import {computeEpochAtSlot, isSyncCommitteeAggregator} from "@lodestar/state-transition"; -import {ApiClient, routes} from "@lodestar/api"; -import {IClock, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; +import {BLSSignature, CommitteeIndex, Root, Slot, altair} from "@lodestar/types"; +import {sleep} from "@lodestar/utils"; import {Metrics} from "../metrics.js"; -import {ValidatorStore} from "./validatorStore.js"; -import {SyncCommitteeDutiesService, SyncDutyAndProofs} from "./syncCommitteeDuties.js"; -import {groupSyncDutiesBySubcommitteeIndex, SubcommitteeDuty} from "./utils.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc} from "../util/index.js"; import {ChainHeaderTracker} from "./chainHeaderTracker.js"; import {ValidatorEventEmitter} from "./emitter.js"; +import {SyncCommitteeDutiesService, SyncDutyAndProofs} from "./syncCommitteeDuties.js"; import {SyncingStatusTracker} from "./syncingStatusTracker.js"; +import {SubcommitteeDuty, groupSyncDutiesBySubcommitteeIndex} from "./utils.js"; +import {ValidatorStore} from "./validatorStore.js"; export type SyncCommitteeServiceOpts = { scAfterBlockDelaySlotFraction?: number; diff --git a/packages/validator/src/services/syncCommitteeDuties.ts b/packages/validator/src/services/syncCommitteeDuties.ts index ea448add15ec..218169e1dcea 100644 --- a/packages/validator/src/services/syncCommitteeDuties.ts +++ b/packages/validator/src/services/syncCommitteeDuties.ts @@ -1,3 +1,5 @@ +import {ApiClient, routes} from "@lodestar/api"; +import {ChainForkConfig} from "@lodestar/config"; import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params"; import { computeEpochAtSlot, @@ -6,16 +8,14 @@ import { isStartSlotOfEpoch, isSyncCommitteeAggregator, } from "@lodestar/state-transition"; -import {ChainForkConfig} from "@lodestar/config"; import {BLSSignature, Epoch, Slot, SyncPeriod, ValidatorIndex} from "@lodestar/types"; -import {ApiClient, routes} from "@lodestar/api"; import {toPubkeyHex} from "@lodestar/utils"; -import {IClock, LoggerVc} from "../util/index.js"; -import {PubkeyHex} from "../types.js"; import {Metrics} from "../metrics.js"; -import {ValidatorStore} from "./validatorStore.js"; -import {syncCommitteeIndicesToSubnets} from "./utils.js"; +import {PubkeyHex} from "../types.js"; +import {IClock, LoggerVc} from "../util/index.js"; import {SyncingStatusTracker} from "./syncingStatusTracker.js"; +import {syncCommitteeIndicesToSubnets} from "./utils.js"; +import {ValidatorStore} from "./validatorStore.js"; /** Only retain `HISTORICAL_DUTIES_PERIODS` duties prior to the current periods. */ const HISTORICAL_DUTIES_PERIODS = 2; diff --git a/packages/validator/src/services/syncingStatusTracker.ts b/packages/validator/src/services/syncingStatusTracker.ts index 4c38e670092d..bd8a8b78fc7c 100644 --- a/packages/validator/src/services/syncingStatusTracker.ts +++ b/packages/validator/src/services/syncingStatusTracker.ts @@ -1,8 +1,8 @@ import {ApiClient, routes} from "@lodestar/api"; -import {Logger} from "@lodestar/utils"; import {Slot} from "@lodestar/types"; -import {IClock} from "../util/clock.js"; +import {Logger} from "@lodestar/utils"; import {BeaconHealth, Metrics} from "../metrics.js"; +import {IClock} from "../util/clock.js"; export type SyncingStatus = routes.node.SyncingStatus; diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index f959b4e74ff5..0c66f576ffa0 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -1,16 +1,10 @@ -import {BitArray} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; -import { - computeEpochAtSlot, - computeSigningRoot, - computeStartSlotAtEpoch, - computeDomain, - ZERO_HASH, - blindedOrFullBlockHashTreeRoot, -} from "@lodestar/state-transition"; +import {BitArray} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; import {BeaconConfig} from "@lodestar/config"; import { DOMAIN_AGGREGATE_AND_PROOF, + DOMAIN_APPLICATION_BUILDER, DOMAIN_BEACON_ATTESTER, DOMAIN_BEACON_PROPOSER, DOMAIN_CONTRIBUTION_AND_PROOF, @@ -18,39 +12,45 @@ import { DOMAIN_SELECTION_PROOF, DOMAIN_SYNC_COMMITTEE, DOMAIN_SYNC_COMMITTEE_SELECTION_PROOF, - DOMAIN_APPLICATION_BUILDER, ForkSeq, MAX_COMMITTEES_PER_SLOT, } from "@lodestar/params"; import { - altair, - BeaconBlock, - bellatrix, - BlindedBeaconBlock, + ZERO_HASH, + blindedOrFullBlockHashTreeRoot, + computeDomain, + computeEpochAtSlot, + computeSigningRoot, + computeStartSlotAtEpoch, +} from "@lodestar/state-transition"; +import { + AggregateAndProof, + Attestation, BLSPubkey, BLSSignature, + BeaconBlock, + BlindedBeaconBlock, Epoch, - phase0, Root, + SignedAggregateAndProof, SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, - ssz, ValidatorIndex, - Attestation, - AggregateAndProof, - SignedAggregateAndProof, + altair, + bellatrix, + phase0, + ssz, } from "@lodestar/types"; -import {routes} from "@lodestar/api"; import {fromHex, toPubkeyHex, toRootHex} from "@lodestar/utils"; +import {Metrics} from "../metrics.js"; import {ISlashingProtection} from "../slashingProtection/index.js"; import {PubkeyHex} from "../types.js"; -import {externalSignerPostSignature, SignableMessageType, SignableMessage} from "../util/externalSignerClient.js"; -import {Metrics} from "../metrics.js"; +import {SignableMessage, SignableMessageType, externalSignerPostSignature} from "../util/externalSignerClient.js"; import {isValidatePubkeyHex} from "../util/format.js"; import {LoggerVc} from "../util/logger.js"; -import {IndicesService} from "./indices.js"; import {DoppelgangerService} from "./doppelgangerService.js"; +import {IndicesService} from "./indices.js"; type BLSPubkeyMaybeHex = BLSPubkey | PubkeyHex; type Eth1Address = string; diff --git a/packages/validator/src/slashingProtection/attestation/attestationByTargetRepository.ts b/packages/validator/src/slashingProtection/attestation/attestationByTargetRepository.ts index 61c13bb17ce2..e97ff5f96fad 100644 --- a/packages/validator/src/slashingProtection/attestation/attestationByTargetRepository.ts +++ b/packages/validator/src/slashingProtection/attestation/attestationByTargetRepository.ts @@ -1,11 +1,11 @@ import {ContainerType, Type} from "@chainsafe/ssz"; -import {BLSPubkey, Epoch, ssz} from "@lodestar/types"; -import {intToBytes, bytesToInt} from "@lodestar/utils"; import {DB_PREFIX_LENGTH, DbReqOpts, encodeKey, uintLen} from "@lodestar/db"; +import {BLSPubkey, Epoch, ssz} from "@lodestar/types"; +import {bytesToInt, intToBytes} from "@lodestar/utils"; +import {Bucket, getBucketNameByValue} from "../../buckets.js"; import {LodestarValidatorDatabaseController} from "../../types.js"; import {SlashingProtectionAttestation} from "../types.js"; import {blsPubkeyLen, uniqueVectorArr} from "../utils.js"; -import {Bucket, getBucketNameByValue} from "../../buckets.js"; /** * Manages validator db storage of attestations. diff --git a/packages/validator/src/slashingProtection/attestation/attestationLowerBoundRepository.ts b/packages/validator/src/slashingProtection/attestation/attestationLowerBoundRepository.ts index 84a4e7032a70..3cd6deab8881 100644 --- a/packages/validator/src/slashingProtection/attestation/attestationLowerBoundRepository.ts +++ b/packages/validator/src/slashingProtection/attestation/attestationLowerBoundRepository.ts @@ -1,8 +1,8 @@ import {ContainerType, Type} from "@chainsafe/ssz"; +import {DbReqOpts, encodeKey} from "@lodestar/db"; import {BLSPubkey, Epoch, ssz} from "@lodestar/types"; -import {encodeKey, DbReqOpts} from "@lodestar/db"; -import {LodestarValidatorDatabaseController} from "../../types.js"; import {Bucket, getBucketNameByValue} from "../../buckets.js"; +import {LodestarValidatorDatabaseController} from "../../types.js"; // Only used locally here export interface SlashingProtectionLowerBound { diff --git a/packages/validator/src/slashingProtection/attestation/index.ts b/packages/validator/src/slashingProtection/attestation/index.ts index f0d3a0bca172..8b2fec1bccab 100644 --- a/packages/validator/src/slashingProtection/attestation/index.ts +++ b/packages/validator/src/slashingProtection/attestation/index.ts @@ -1,10 +1,10 @@ import {BLSPubkey, Epoch} from "@lodestar/types"; -import {isEqualNonZeroRoot, minEpoch} from "../utils.js"; import {MinMaxSurround, SurroundAttestationError, SurroundAttestationErrorCode} from "../minMaxSurround/index.js"; import {SlashingProtectionAttestation} from "../types.js"; -import {InvalidAttestationError, InvalidAttestationErrorCode} from "./errors.js"; +import {isEqualNonZeroRoot, minEpoch} from "../utils.js"; import {AttestationByTargetRepository} from "./attestationByTargetRepository.js"; import {AttestationLowerBoundRepository} from "./attestationLowerBoundRepository.js"; +import {InvalidAttestationError, InvalidAttestationErrorCode} from "./errors.js"; export { AttestationByTargetRepository, AttestationLowerBoundRepository, diff --git a/packages/validator/src/slashingProtection/block/blockBySlotRepository.ts b/packages/validator/src/slashingProtection/block/blockBySlotRepository.ts index eb1ae092cf3f..2a1e86fcce23 100644 --- a/packages/validator/src/slashingProtection/block/blockBySlotRepository.ts +++ b/packages/validator/src/slashingProtection/block/blockBySlotRepository.ts @@ -1,9 +1,9 @@ import {ContainerType, Type} from "@chainsafe/ssz"; -import {BLSPubkey, Slot, ssz} from "@lodestar/types"; -import {intToBytes, bytesToInt} from "@lodestar/utils"; import {DB_PREFIX_LENGTH, DbReqOpts, encodeKey, uintLen} from "@lodestar/db"; -import {LodestarValidatorDatabaseController} from "../../types.js"; +import {BLSPubkey, Slot, ssz} from "@lodestar/types"; +import {bytesToInt, intToBytes} from "@lodestar/utils"; import {Bucket, getBucketNameByValue} from "../../buckets.js"; +import {LodestarValidatorDatabaseController} from "../../types.js"; import {SlashingProtectionBlock} from "../types.js"; import {blsPubkeyLen, uniqueVectorArr} from "../utils.js"; diff --git a/packages/validator/src/slashingProtection/block/index.ts b/packages/validator/src/slashingProtection/block/index.ts index 385575e82a0a..44a06d3ef01d 100644 --- a/packages/validator/src/slashingProtection/block/index.ts +++ b/packages/validator/src/slashingProtection/block/index.ts @@ -1,8 +1,8 @@ import {BLSPubkey} from "@lodestar/types"; -import {isEqualNonZeroRoot} from "../utils.js"; import {SlashingProtectionBlock} from "../types.js"; -import {InvalidBlockError, InvalidBlockErrorCode} from "./errors.js"; +import {isEqualNonZeroRoot} from "../utils.js"; import {BlockBySlotRepository} from "./blockBySlotRepository.js"; +import {InvalidBlockError, InvalidBlockErrorCode} from "./errors.js"; export {BlockBySlotRepository, InvalidBlockError, InvalidBlockErrorCode}; enum SafeStatus { diff --git a/packages/validator/src/slashingProtection/index.ts b/packages/validator/src/slashingProtection/index.ts index bc57b0e51c13..388744f95449 100644 --- a/packages/validator/src/slashingProtection/index.ts +++ b/packages/validator/src/slashingProtection/index.ts @@ -1,23 +1,23 @@ import {BLSPubkey, Epoch, Root} from "@lodestar/types"; import {Logger, toPubkeyHex} from "@lodestar/utils"; -import {LodestarValidatorDatabaseController} from "../types.js"; import {uniqueVectorArr} from "../slashingProtection/utils.js"; -import {BlockBySlotRepository, SlashingProtectionBlockService} from "./block/index.js"; +import {LodestarValidatorDatabaseController} from "../types.js"; import { AttestationByTargetRepository, AttestationLowerBoundRepository, SlashingProtectionAttestationService, } from "./attestation/index.js"; -import {ISlashingProtection} from "./interface.js"; +import {BlockBySlotRepository, SlashingProtectionBlockService} from "./block/index.js"; import { - InterchangeLodestar, Interchange, InterchangeFormatVersion, + InterchangeLodestar, parseInterchange, serializeInterchange, } from "./interchange/index.js"; -import {MinMaxSurround, DistanceStoreRepository} from "./minMaxSurround/index.js"; -import {SlashingProtectionBlock, SlashingProtectionAttestation} from "./types.js"; +import {ISlashingProtection} from "./interface.js"; +import {DistanceStoreRepository, MinMaxSurround} from "./minMaxSurround/index.js"; +import {SlashingProtectionAttestation, SlashingProtectionBlock} from "./types.js"; export {InvalidAttestationError, InvalidAttestationErrorCode} from "./attestation/index.js"; export {InvalidBlockError, InvalidBlockErrorCode} from "./block/index.js"; diff --git a/packages/validator/src/slashingProtection/interchange/formats/completeV4.ts b/packages/validator/src/slashingProtection/interchange/formats/completeV4.ts index 26210390a272..9cc514acd854 100644 --- a/packages/validator/src/slashingProtection/interchange/formats/completeV4.ts +++ b/packages/validator/src/slashingProtection/interchange/formats/completeV4.ts @@ -1,6 +1,6 @@ import {fromHex, toPubkeyHex, toRootHex} from "@lodestar/utils"; -import {InterchangeLodestar} from "../types.js"; import {fromOptionalHexString, numToString, toOptionalHexString} from "../../utils.js"; +import {InterchangeLodestar} from "../types.js"; /** * A complete record of all blocks and attestations signed by a set of validators diff --git a/packages/validator/src/slashingProtection/interchange/formats/v5.ts b/packages/validator/src/slashingProtection/interchange/formats/v5.ts index 88e2ce70fe07..5059fa1917bf 100644 --- a/packages/validator/src/slashingProtection/interchange/formats/v5.ts +++ b/packages/validator/src/slashingProtection/interchange/formats/v5.ts @@ -1,6 +1,6 @@ import {fromHex, toPubkeyHex, toRootHex} from "@lodestar/utils"; -import {InterchangeLodestar} from "../types.js"; import {fromOptionalHexString, numToString, toOptionalHexString} from "../../utils.js"; +import {InterchangeLodestar} from "../types.js"; /** * A complete record of all blocks and attestations signed by a set of validators diff --git a/packages/validator/src/slashingProtection/interchange/parseInterchange.ts b/packages/validator/src/slashingProtection/interchange/parseInterchange.ts index 117cd11b5f2b..ec6b3c1ee6d6 100644 --- a/packages/validator/src/slashingProtection/interchange/parseInterchange.ts +++ b/packages/validator/src/slashingProtection/interchange/parseInterchange.ts @@ -1,9 +1,9 @@ import {Root} from "@lodestar/types"; import {isEqualRoot} from "../utils.js"; import {InterchangeError, InterchangeErrorErrorCode} from "./errors.js"; -import {Interchange, InterchangeLodestar} from "./types.js"; import {InterchangeCompleteV4, parseInterchangeCompleteV4} from "./formats/completeV4.js"; import {InterchangeV5, parseInterchangeV5} from "./formats/v5.js"; +import {Interchange, InterchangeLodestar} from "./types.js"; export function parseInterchange(interchange: Interchange, expectedGenesisValidatorsRoot: Root): InterchangeLodestar { const format = (interchange as InterchangeCompleteV4)?.metadata?.interchange_format; diff --git a/packages/validator/src/slashingProtection/interchange/serializeInterchange.ts b/packages/validator/src/slashingProtection/interchange/serializeInterchange.ts index a99fb3f3d172..4abb03b23d23 100644 --- a/packages/validator/src/slashingProtection/interchange/serializeInterchange.ts +++ b/packages/validator/src/slashingProtection/interchange/serializeInterchange.ts @@ -1,7 +1,7 @@ import {InterchangeError, InterchangeErrorErrorCode} from "./errors.js"; -import {Interchange, InterchangeFormatVersion, InterchangeLodestar} from "./types.js"; import {serializeInterchangeCompleteV4} from "./formats/completeV4.js"; import {serializeInterchangeV5} from "./formats/v5.js"; +import {Interchange, InterchangeFormatVersion, InterchangeLodestar} from "./types.js"; export function serializeInterchange( interchangeLodestar: InterchangeLodestar, diff --git a/packages/validator/src/slashingProtection/interface.ts b/packages/validator/src/slashingProtection/interface.ts index c2a790c98a65..11efa98d20f9 100644 --- a/packages/validator/src/slashingProtection/interface.ts +++ b/packages/validator/src/slashingProtection/interface.ts @@ -1,7 +1,7 @@ import {BLSPubkey, Epoch, Root} from "@lodestar/types"; import {Logger} from "@lodestar/utils"; import {Interchange, InterchangeFormatVersion} from "./interchange/types.js"; -import {SlashingProtectionBlock, SlashingProtectionAttestation} from "./types.js"; +import {SlashingProtectionAttestation, SlashingProtectionBlock} from "./types.js"; export interface ISlashingProtection { /** diff --git a/packages/validator/src/slashingProtection/minMaxSurround/distanceStoreRepository.ts b/packages/validator/src/slashingProtection/minMaxSurround/distanceStoreRepository.ts index 45315bf95b03..556eaf5374ba 100644 --- a/packages/validator/src/slashingProtection/minMaxSurround/distanceStoreRepository.ts +++ b/packages/validator/src/slashingProtection/minMaxSurround/distanceStoreRepository.ts @@ -1,5 +1,5 @@ import {Type} from "@chainsafe/ssz"; -import {encodeKey, DbReqOpts} from "@lodestar/db"; +import {DbReqOpts, encodeKey} from "@lodestar/db"; import {BLSPubkey, Epoch, ssz} from "@lodestar/types"; import {intToBytes} from "@lodestar/utils"; import {Bucket, getBucketNameByValue} from "../../buckets.js"; diff --git a/packages/validator/src/slashingProtection/minMaxSurround/minMaxSurround.ts b/packages/validator/src/slashingProtection/minMaxSurround/minMaxSurround.ts index 446c3cd763e7..87976f734ba6 100644 --- a/packages/validator/src/slashingProtection/minMaxSurround/minMaxSurround.ts +++ b/packages/validator/src/slashingProtection/minMaxSurround/minMaxSurround.ts @@ -1,6 +1,6 @@ import {BLSPubkey} from "@lodestar/types"; -import {IMinMaxSurround, DistanceEntry, IDistanceStore, MinMaxSurroundAttestation} from "./interface.js"; import {SurroundAttestationError, SurroundAttestationErrorCode} from "./errors.js"; +import {DistanceEntry, IDistanceStore, IMinMaxSurround, MinMaxSurroundAttestation} from "./interface.js"; // surround vote checking with min-max surround // https://github.com/protolambda/eth2-surround#min-max-surround diff --git a/packages/validator/src/types.ts b/packages/validator/src/types.ts index dd44fd49c61e..a765a7960b3f 100644 --- a/packages/validator/src/types.ts +++ b/packages/validator/src/types.ts @@ -1,6 +1,6 @@ import {SecretKey} from "@chainsafe/blst"; -import {BLSPubkey} from "@lodestar/types"; import {DatabaseController} from "@lodestar/db"; +import {BLSPubkey} from "@lodestar/types"; export type GenesisInfo = { startTime: number; diff --git a/packages/validator/src/util/clock.ts b/packages/validator/src/util/clock.ts index 4b3fc45cd803..6b7e0868233a 100644 --- a/packages/validator/src/util/clock.ts +++ b/packages/validator/src/util/clock.ts @@ -1,8 +1,8 @@ -import {ErrorAborted, Logger, isErrorAborted, sleep} from "@lodestar/utils"; -import {GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; import {ChainForkConfig} from "@lodestar/config"; -import {Epoch, Slot, TimeSeconds} from "@lodestar/types"; +import {GENESIS_SLOT, SLOTS_PER_EPOCH} from "@lodestar/params"; import {computeEpochAtSlot, getCurrentSlot} from "@lodestar/state-transition"; +import {Epoch, Slot, TimeSeconds} from "@lodestar/types"; +import {ErrorAborted, Logger, isErrorAborted, sleep} from "@lodestar/utils"; type RunEveryFn = (slot: Slot, signal: AbortSignal) => Promise; diff --git a/packages/validator/src/util/externalSignerClient.ts b/packages/validator/src/util/externalSignerClient.ts index 54c0c16946ad..ab5849cf1a6b 100644 --- a/packages/validator/src/util/externalSignerClient.ts +++ b/packages/validator/src/util/externalSignerClient.ts @@ -1,23 +1,23 @@ import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {fetch} from "@lodestar/api"; +import {BeaconConfig} from "@lodestar/config"; +import {ForkPreExecution, ForkSeq} from "@lodestar/params"; +import {blindedOrFullBlockToHeader, computeEpochAtSlot} from "@lodestar/state-transition"; import { - phase0, - altair, - capella, + AggregateAndProof, BeaconBlock, BlindedBeaconBlock, - AggregateAndProof, - sszTypesFor, - ssz, - Slot, Epoch, - RootHex, Root, + RootHex, + Slot, + altair, + capella, + phase0, + ssz, + sszTypesFor, } from "@lodestar/types"; -import {ForkPreExecution, ForkSeq} from "@lodestar/params"; import {ValidatorRegistrationV1} from "@lodestar/types/bellatrix"; -import {BeaconConfig} from "@lodestar/config"; -import {computeEpochAtSlot, blindedOrFullBlockToHeader} from "@lodestar/state-transition"; import {toHex, toRootHex} from "@lodestar/utils"; import {PubkeyHex} from "../types.js"; diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index 16374af2b837..53ccd759a5c1 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -1,5 +1,5 @@ import {ChainConfig, chainConfigToJson} from "@lodestar/config"; -import {activePreset, BeaconPreset, presetToJson} from "@lodestar/params"; +import {BeaconPreset, activePreset, presetToJson} from "@lodestar/params"; export class NotEqualParamsError extends Error {} diff --git a/packages/validator/src/validator.ts b/packages/validator/src/validator.ts index 09a3a80062da..ecb8bb4a161e 100644 --- a/packages/validator/src/validator.ts +++ b/packages/validator/src/validator.ts @@ -1,27 +1,27 @@ +import {ApiClient, ApiRequestInit, defaultInit, getClient, routes} from "@lodestar/api"; +import {BeaconConfig, ChainForkConfig, createBeaconConfig} from "@lodestar/config"; +import {computeEpochAtSlot, getCurrentSlot} from "@lodestar/state-transition"; import {BLSPubkey, phase0, ssz} from "@lodestar/types"; -import {createBeaconConfig, BeaconConfig, ChainForkConfig} from "@lodestar/config"; import {Genesis} from "@lodestar/types/phase0"; import {Logger, toPrintableUrl, toRootHex} from "@lodestar/utils"; -import {getClient, ApiClient, routes, ApiRequestInit, defaultInit} from "@lodestar/api"; -import {computeEpochAtSlot, getCurrentSlot} from "@lodestar/state-transition"; -import {Clock, IClock} from "./util/clock.js"; import {waitForGenesis} from "./genesis.js"; -import {BlockProposingService} from "./services/block.js"; +import {Metrics} from "./metrics.js"; +import {MetaDataRepository} from "./repositories/metaDataRepository.js"; import {AttestationService} from "./services/attestation.js"; +import {BlockProposingService} from "./services/block.js"; +import {ChainHeaderTracker} from "./services/chainHeaderTracker.js"; +import {DoppelgangerService} from "./services/doppelgangerService.js"; +import {ValidatorEventEmitter} from "./services/emitter.js"; +import {ExternalSignerOptions, pollExternalSignerPubkeys} from "./services/externalSignerSync.js"; import {IndicesService} from "./services/indices.js"; +import {pollBuilderValidatorRegistration, pollPrepareBeaconProposer} from "./services/prepareBeaconProposer.js"; import {SyncCommitteeService} from "./services/syncCommittee.js"; -import {pollPrepareBeaconProposer, pollBuilderValidatorRegistration} from "./services/prepareBeaconProposer.js"; -import {ExternalSignerOptions, pollExternalSignerPubkeys} from "./services/externalSignerSync.js"; -import {Interchange, InterchangeFormatVersion, ISlashingProtection} from "./slashingProtection/index.js"; -import {assertEqualParams, getLoggerVc, NotEqualParamsError} from "./util/index.js"; -import {ChainHeaderTracker} from "./services/chainHeaderTracker.js"; import {SyncingStatusTracker} from "./services/syncingStatusTracker.js"; -import {ValidatorEventEmitter} from "./services/emitter.js"; -import {ValidatorStore, Signer, ValidatorProposerConfig, defaultOptions} from "./services/validatorStore.js"; +import {Signer, ValidatorProposerConfig, ValidatorStore, defaultOptions} from "./services/validatorStore.js"; +import {ISlashingProtection, Interchange, InterchangeFormatVersion} from "./slashingProtection/index.js"; import {LodestarValidatorDatabaseController, ProcessShutdownCallback, PubkeyHex} from "./types.js"; -import {Metrics} from "./metrics.js"; -import {MetaDataRepository} from "./repositories/metaDataRepository.js"; -import {DoppelgangerService} from "./services/doppelgangerService.js"; +import {Clock, IClock} from "./util/clock.js"; +import {NotEqualParamsError, assertEqualParams, getLoggerVc} from "./util/index.js"; export type ValidatorModules = { opts: ValidatorOptions; diff --git a/packages/validator/test/e2e/web3signer.test.ts b/packages/validator/test/e2e/web3signer.test.ts index 855b3dd9f754..32a95276a102 100644 --- a/packages/validator/test/e2e/web3signer.test.ts +++ b/packages/validator/test/e2e/web3signer.test.ts @@ -1,14 +1,14 @@ -import {expect, describe, it, vi, beforeAll, afterAll} from "vitest"; -import {fromHex, toHex} from "@lodestar/utils"; -import {config} from "@lodestar/config/default"; -import {computeStartSlotAtEpoch, interopSecretKey, interopSecretKeys} from "@lodestar/state-transition"; +import {getClient, routes} from "@lodestar/api"; import {createBeaconConfig} from "@lodestar/config"; +import {config} from "@lodestar/config/default"; import {genesisData} from "@lodestar/config/networks"; -import {getClient, routes} from "@lodestar/api"; -import {ssz, sszTypesFor} from "@lodestar/types"; import {ForkSeq} from "@lodestar/params"; -import {getKeystoresStr, StartedExternalSigner, startExternalSigner} from "@lodestar/test-utils"; -import {Interchange, ISlashingProtection, Signer, SignerType, ValidatorStore} from "../../src/index.js"; +import {computeStartSlotAtEpoch, interopSecretKey, interopSecretKeys} from "@lodestar/state-transition"; +import {StartedExternalSigner, getKeystoresStr, startExternalSigner} from "@lodestar/test-utils"; +import {ssz, sszTypesFor} from "@lodestar/types"; +import {fromHex, toHex} from "@lodestar/utils"; +import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; +import {ISlashingProtection, Interchange, Signer, SignerType, ValidatorStore} from "../../src/index.js"; import {IndicesService} from "../../src/services/indices.js"; import {testLogger} from "../utils/logger.js"; diff --git a/packages/validator/test/spec/downloadTests.ts b/packages/validator/test/spec/downloadTests.ts index 7aede8425b19..aa360df38a0c 100644 --- a/packages/validator/test/spec/downloadTests.ts +++ b/packages/validator/test/spec/downloadTests.ts @@ -1,5 +1,5 @@ import {downloadGenericSpecTests} from "@lodestar/spec-test-util/downloadTests"; -import {SPEC_TEST_LOCATION, SPEC_TEST_VERSION, SPEC_TEST_REPO_URL, TESTS_TO_DOWNLOAD} from "./params.js"; +import {SPEC_TEST_LOCATION, SPEC_TEST_REPO_URL, SPEC_TEST_VERSION, TESTS_TO_DOWNLOAD} from "./params.js"; /* eslint-disable no-console */ diff --git a/packages/validator/test/spec/index.test.ts b/packages/validator/test/spec/index.test.ts index bd6ff947ca41..457b8589a0eb 100644 --- a/packages/validator/test/spec/index.test.ts +++ b/packages/validator/test/spec/index.test.ts @@ -1,12 +1,12 @@ -import {expect, describe, it, beforeAll, afterAll} from "vitest"; -import {rimraf} from "rimraf"; import {LevelDbController} from "@lodestar/db"; +import {rimraf} from "rimraf"; +import {afterAll, beforeAll, describe, expect, it} from "vitest"; import { + InvalidAttestationError, + InvalidBlockError, SlashingProtection, - SlashingProtectionBlock, SlashingProtectionAttestation, - InvalidBlockError, - InvalidAttestationError, + SlashingProtectionBlock, } from "../../src/slashingProtection/index.js"; import {testLogger} from "../utils/logger.js"; diff --git a/packages/validator/test/spec/spec.test.ts b/packages/validator/test/spec/spec.test.ts index 41b094473c66..18c58bd84fa7 100644 --- a/packages/validator/test/spec/spec.test.ts +++ b/packages/validator/test/spec/spec.test.ts @@ -1,16 +1,16 @@ import path from "node:path"; -import {describe, it, beforeAll, beforeEach, afterAll, expect} from "vitest"; -import {rimraf} from "rimraf"; import {fromHexString} from "@chainsafe/ssz"; import {LevelDbController} from "@lodestar/db"; import {ZERO_HASH} from "@lodestar/state-transition"; +import {rimraf} from "rimraf"; +import {afterAll, beforeAll, beforeEach, describe, expect, it} from "vitest"; import { - SlashingProtection, InterchangeError, InvalidAttestationError, InvalidBlockError, - SlashingProtectionBlock, + SlashingProtection, SlashingProtectionAttestation, + SlashingProtectionBlock, } from "../../src/slashingProtection/index.js"; import {testLogger} from "../utils/logger.js"; import {loadTestCases} from "../utils/spec.js"; diff --git a/packages/validator/test/unit/services/attestation.test.ts b/packages/validator/test/unit/services/attestation.test.ts index 1652af83c5d1..e3a6f0771d62 100644 --- a/packages/validator/test/unit/services/attestation.test.ts +++ b/packages/validator/test/unit/services/attestation.test.ts @@ -1,20 +1,20 @@ -import {describe, it, expect, beforeAll, beforeEach, afterEach, vi} from "vitest"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; -import {ssz} from "@lodestar/types"; +import {toHexString} from "@chainsafe/ssz"; import {routes} from "@lodestar/api"; import {ChainConfig, createChainForkConfig} from "@lodestar/config"; import {config as defaultConfig} from "@lodestar/config/default"; import {ForkName} from "@lodestar/params"; +import {ssz} from "@lodestar/types"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {AttestationService, AttestationServiceOpts} from "../../../src/services/attestation.js"; import {AttDutyAndProof} from "../../../src/services/attestationDuties.js"; +import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; +import {ValidatorEventEmitter} from "../../../src/services/emitter.js"; +import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; -import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; -import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; -import {ValidatorEventEmitter} from "../../../src/services/emitter.js"; +import {loggerVc} from "../../utils/logger.js"; import {ZERO_HASH, ZERO_HASH_HEX} from "../../utils/types.js"; vi.mock("../../../src/services/validatorStore.js"); diff --git a/packages/validator/test/unit/services/attestationDuties.test.ts b/packages/validator/test/unit/services/attestationDuties.test.ts index fafccf209777..93a7aa0a83f7 100644 --- a/packages/validator/test/unit/services/attestationDuties.test.ts +++ b/packages/validator/test/unit/services/attestationDuties.test.ts @@ -1,20 +1,20 @@ -import {describe, it, expect, beforeAll, vi, Mocked, beforeEach, afterEach} from "vitest"; -import {toBufferBE} from "bigint-buffer"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; -import {chainConfig} from "@lodestar/config/default"; +import {toHexString} from "@chainsafe/ssz"; import {routes} from "@lodestar/api"; -import {ssz} from "@lodestar/types"; +import {chainConfig} from "@lodestar/config/default"; import {computeEpochAtSlot} from "@lodestar/state-transition"; +import {ssz} from "@lodestar/types"; +import {toBufferBE} from "bigint-buffer"; +import {Mocked, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {AttestationDutiesService} from "../../../src/services/attestationDuties.js"; +import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; +import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; -import {initValidatorStore} from "../../utils/validatorStore.js"; -import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; -import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; +import {loggerVc} from "../../utils/logger.js"; import {ZERO_HASH_HEX} from "../../utils/types.js"; +import {initValidatorStore} from "../../utils/validatorStore.js"; vi.mock("../../../src/services/chainHeaderTracker.js"); diff --git a/packages/validator/test/unit/services/block.test.ts b/packages/validator/test/unit/services/block.test.ts index dc89f1169d92..6c80bea4ffd2 100644 --- a/packages/validator/test/unit/services/block.test.ts +++ b/packages/validator/test/unit/services/block.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect, beforeAll, beforeEach, afterEach, vi} from "vitest"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; import {createChainForkConfig} from "@lodestar/config"; import {config as mainnetConfig} from "@lodestar/config/default"; -import {sleep} from "@lodestar/utils"; -import {ssz, ProducedBlockSource} from "@lodestar/types"; -import {routes} from "@lodestar/api"; import {ForkName} from "@lodestar/params"; +import {ProducedBlockSource, ssz} from "@lodestar/types"; +import {sleep} from "@lodestar/utils"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {BlockProposingService} from "../../../src/services/block.js"; import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; +import {loggerVc} from "../../utils/logger.js"; import {ZERO_HASH_HEX} from "../../utils/types.js"; vi.mock("../../../src/services/validatorStore.js"); diff --git a/packages/validator/test/unit/services/blockDuties.test.ts b/packages/validator/test/unit/services/blockDuties.test.ts index 51ced2cd70de..3150155d030a 100644 --- a/packages/validator/test/unit/services/blockDuties.test.ts +++ b/packages/validator/test/unit/services/blockDuties.test.ts @@ -1,17 +1,17 @@ -import {describe, it, expect, beforeAll, beforeEach, afterEach, vi} from "vitest"; -import {toBufferBE} from "bigint-buffer"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; import {routes} from "@lodestar/api"; import {chainConfig} from "@lodestar/config/default"; import {toHex} from "@lodestar/utils"; +import {toBufferBE} from "bigint-buffer"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {BlockDutiesService} from "../../../src/services/blockDuties.js"; import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; -import {initValidatorStore} from "../../utils/validatorStore.js"; +import {loggerVc} from "../../utils/logger.js"; import {ZERO_HASH_HEX} from "../../utils/types.js"; +import {initValidatorStore} from "../../utils/validatorStore.js"; describe("BlockDutiesService", () => { const api = getApiClientStub(); diff --git a/packages/validator/test/unit/services/doppelganger.test.ts b/packages/validator/test/unit/services/doppelganger.test.ts index 943f0c08a9d3..ba112245b0d2 100644 --- a/packages/validator/test/unit/services/doppelganger.test.ts +++ b/packages/validator/test/unit/services/doppelganger.test.ts @@ -1,14 +1,14 @@ -import {describe, it, expect} from "vitest"; +import {ApiClient} from "@lodestar/api"; +import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; import {Epoch, Slot, ValidatorIndex} from "@lodestar/types"; import {sleep} from "@lodestar/utils"; -import {computeStartSlotAtEpoch} from "@lodestar/state-transition"; -import {ApiClient} from "@lodestar/api"; +import {describe, expect, it} from "vitest"; import {DoppelgangerService, DoppelgangerStatus} from "../../../src/services/doppelgangerService.js"; import {IndicesService} from "../../../src/services/indices.js"; -import {SlashingProtectionMock} from "../../utils/slashingProtectionMock.js"; import {mockApiResponse} from "../../utils/apiStub.js"; -import {testLogger} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; +import {testLogger} from "../../utils/logger.js"; +import {SlashingProtectionMock} from "../../utils/slashingProtectionMock.js"; // At genesis start validating immediately diff --git a/packages/validator/test/unit/services/externalSignerSync.test.ts b/packages/validator/test/unit/services/externalSignerSync.test.ts index 8dc7bff7e469..4a0ca5338bcb 100644 --- a/packages/validator/test/unit/services/externalSignerSync.test.ts +++ b/packages/validator/test/unit/services/externalSignerSync.test.ts @@ -1,14 +1,14 @@ -import {MockedFunction, afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import {toBufferBE} from "bigint-buffer"; import {SecretKey} from "@chainsafe/blst"; import {createChainForkConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; +import {toBufferBE} from "bigint-buffer"; +import {MockedFunction, afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import {ExternalSignerOptions, pollExternalSignerPubkeys} from "../../../src/services/externalSignerSync.js"; import {SignerRemote, SignerType, ValidatorStore} from "../../../src/services/validatorStore.js"; import {externalSignerGetKeys} from "../../../src/util/externalSignerClient.js"; -import {initValidatorStore} from "../../utils/validatorStore.js"; import {getApiClientStub} from "../../utils/apiStub.js"; import {loggerVc} from "../../utils/logger.js"; +import {initValidatorStore} from "../../utils/validatorStore.js"; vi.mock("../../../src/util/externalSignerClient.js"); diff --git a/packages/validator/test/unit/services/indicesService.test.ts b/packages/validator/test/unit/services/indicesService.test.ts index d4619aa65b94..91624ca36415 100644 --- a/packages/validator/test/unit/services/indicesService.test.ts +++ b/packages/validator/test/unit/services/indicesService.test.ts @@ -1,10 +1,10 @@ -import {describe, it, expect, beforeAll} from "vitest"; -import {toBufferBE} from "bigint-buffer"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; +import {toBufferBE} from "bigint-buffer"; +import {beforeAll, describe, expect, it} from "vitest"; +import {IndicesService} from "../../../src/services/indices.js"; import {getApiClientStub} from "../../utils/apiStub.js"; import {testLogger} from "../../utils/logger.js"; -import {IndicesService} from "../../../src/services/indices.js"; describe("IndicesService", () => { const logger = testLogger(); diff --git a/packages/validator/test/unit/services/syncCommitteDuties.test.ts b/packages/validator/test/unit/services/syncCommitteDuties.test.ts index 27a86d31f901..e7f0c46932ad 100644 --- a/packages/validator/test/unit/services/syncCommitteDuties.test.ts +++ b/packages/validator/test/unit/services/syncCommitteDuties.test.ts @@ -1,24 +1,24 @@ -import {describe, it, expect, beforeAll, beforeEach, afterEach, vi} from "vitest"; -import {when} from "vitest-when"; -import {toBufferBE} from "bigint-buffer"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; import {createChainForkConfig} from "@lodestar/config"; import {config as mainnetConfig} from "@lodestar/config/default"; -import {routes} from "@lodestar/api"; import {ssz} from "@lodestar/types"; +import {toBufferBE} from "bigint-buffer"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; +import {when} from "vitest-when"; import { SyncCommitteeDutiesService, SyncDutyAndProofs, SyncDutySubnet, } from "../../../src/services/syncCommitteeDuties.js"; -import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; +import {syncCommitteeIndicesToSubnets} from "../../../src/services/utils.js"; +import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; +import {loggerVc} from "../../utils/logger.js"; import {initValidatorStore} from "../../utils/validatorStore.js"; -import {syncCommitteeIndicesToSubnets} from "../../../src/services/utils.js"; describe("SyncCommitteeDutiesService", () => { const api = getApiClientStub(); diff --git a/packages/validator/test/unit/services/syncCommittee.test.ts b/packages/validator/test/unit/services/syncCommittee.test.ts index 84c7f14d73b1..10ce3af44a20 100644 --- a/packages/validator/test/unit/services/syncCommittee.test.ts +++ b/packages/validator/test/unit/services/syncCommittee.test.ts @@ -1,20 +1,20 @@ -import {describe, it, expect, beforeAll, beforeEach, afterEach, vi} from "vitest"; -import {toHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {toHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; import {createChainForkConfig} from "@lodestar/config"; import {config as mainnetConfig} from "@lodestar/config/default"; import {ssz} from "@lodestar/types"; -import {routes} from "@lodestar/api"; +import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; +import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; +import {ValidatorEventEmitter} from "../../../src/services/emitter.js"; import {SyncCommitteeService, SyncCommitteeServiceOpts} from "../../../src/services/syncCommittee.js"; import {SyncDutyAndProofs} from "../../../src/services/syncCommitteeDuties.js"; +import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; import {ValidatorStore} from "../../../src/services/validatorStore.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {loggerVc} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; -import {ChainHeaderTracker} from "../../../src/services/chainHeaderTracker.js"; -import {SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; +import {loggerVc} from "../../utils/logger.js"; import {ZERO_HASH} from "../../utils/types.js"; -import {ValidatorEventEmitter} from "../../../src/services/emitter.js"; vi.mock("../../../src/services/validatorStore.js"); vi.mock("../../../src/services/emitter.js"); diff --git a/packages/validator/test/unit/services/syncingStatusTracker.test.ts b/packages/validator/test/unit/services/syncingStatusTracker.test.ts index 07364847e345..eccb00bc51ab 100644 --- a/packages/validator/test/unit/services/syncingStatusTracker.test.ts +++ b/packages/validator/test/unit/services/syncingStatusTracker.test.ts @@ -1,8 +1,8 @@ -import {describe, it, expect, vi, beforeEach, afterEach, MockedFunction} from "vitest"; +import {MockedFunction, afterEach, beforeEach, describe, expect, it, vi} from "vitest"; +import {SyncingStatus, SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; import {getApiClientStub, mockApiResponse} from "../../utils/apiStub.js"; -import {getMockedLogger} from "../../utils/logger.js"; import {ClockMock} from "../../utils/clock.js"; -import {SyncingStatus, SyncingStatusTracker} from "../../../src/services/syncingStatusTracker.js"; +import {getMockedLogger} from "../../utils/logger.js"; describe("SyncingStatusTracker", () => { const api = getApiClientStub(); diff --git a/packages/validator/test/unit/services/utils.test.ts b/packages/validator/test/unit/services/utils.test.ts index f4bb9e57cd04..bd78f36543c5 100644 --- a/packages/validator/test/unit/services/utils.test.ts +++ b/packages/validator/test/unit/services/utils.test.ts @@ -1,5 +1,5 @@ -import {describe, it, expect, beforeAll} from "vitest"; import {SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params"; +import {beforeAll, describe, expect, it} from "vitest"; import {syncCommitteeIndicesToSubnets} from "../../../src/services/utils.js"; describe("services / utils / syncCommitteeIndicesToSubnets", () => { diff --git a/packages/validator/test/unit/slashingProtection/interchange/index.test.ts b/packages/validator/test/unit/slashingProtection/interchange/index.test.ts index 4038c6d1d4c5..92b994605df3 100644 --- a/packages/validator/test/unit/slashingProtection/interchange/index.test.ts +++ b/packages/validator/test/unit/slashingProtection/interchange/index.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; import {toHexString} from "@chainsafe/ssz"; import {Root, ssz} from "@lodestar/types"; +import {describe, expect, it} from "vitest"; import { Interchange, parseInterchange, diff --git a/packages/validator/test/unit/slashingProtection/minMaxSurround/surroundTests.test.ts b/packages/validator/test/unit/slashingProtection/minMaxSurround/surroundTests.test.ts index 6bdc49fb7f0c..7e0d31fbfe7e 100644 --- a/packages/validator/test/unit/slashingProtection/minMaxSurround/surroundTests.test.ts +++ b/packages/validator/test/unit/slashingProtection/minMaxSurround/surroundTests.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import { MinMaxSurround, MinMaxSurroundAttestation, diff --git a/packages/validator/test/unit/slashingProtection/minMaxSurround/updateSpans.test.ts b/packages/validator/test/unit/slashingProtection/minMaxSurround/updateSpans.test.ts index 62f1ea5e1b4f..3471a81f49db 100644 --- a/packages/validator/test/unit/slashingProtection/minMaxSurround/updateSpans.test.ts +++ b/packages/validator/test/unit/slashingProtection/minMaxSurround/updateSpans.test.ts @@ -1,6 +1,6 @@ -import {describe, it, expect} from "vitest"; -import {MinMaxSurroundAttestation, MinMaxSurround} from "../../../../src/slashingProtection/minMaxSurround/index.js"; -import {DistanceStoreMemory, storeToSpansPerEpoch, emptyPubkey} from "./utils.js"; +import {describe, expect, it} from "vitest"; +import {MinMaxSurround, MinMaxSurroundAttestation} from "../../../../src/slashingProtection/minMaxSurround/index.js"; +import {DistanceStoreMemory, emptyPubkey, storeToSpansPerEpoch} from "./utils.js"; const updateSpansTests: { name: string; diff --git a/packages/validator/test/unit/slashingProtection/minMaxSurround/utils.ts b/packages/validator/test/unit/slashingProtection/minMaxSurround/utils.ts index 6d9e4e0f559d..96dc470a00f7 100644 --- a/packages/validator/test/unit/slashingProtection/minMaxSurround/utils.ts +++ b/packages/validator/test/unit/slashingProtection/minMaxSurround/utils.ts @@ -1,5 +1,5 @@ import {BLSPubkey, ssz} from "@lodestar/types"; -import {IDistanceStore, DistanceEntry} from "../../../../src/slashingProtection/minMaxSurround/index.js"; +import {DistanceEntry, IDistanceStore} from "../../../../src/slashingProtection/minMaxSurround/index.js"; export const emptyPubkey = ssz.BLSPubkey.defaultValue(); export class DistanceMapStore { diff --git a/packages/validator/test/unit/slashingProtection/utils.test.ts b/packages/validator/test/unit/slashingProtection/utils.test.ts index 2e0e4859436d..178b1ac4df63 100644 --- a/packages/validator/test/unit/slashingProtection/utils.test.ts +++ b/packages/validator/test/unit/slashingProtection/utils.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {minEpoch} from "../../../src/slashingProtection/utils.js"; describe("slashingProtection / utils / minEpoch", () => { diff --git a/packages/validator/test/unit/utils/batch.test.ts b/packages/validator/test/unit/utils/batch.test.ts index 455d31e19577..78c814505859 100644 --- a/packages/validator/test/unit/utils/batch.test.ts +++ b/packages/validator/test/unit/utils/batch.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {batchItems} from "../../../src/util/index.js"; describe("util / batch", () => { diff --git a/packages/validator/test/unit/utils/clock.test.ts b/packages/validator/test/unit/utils/clock.test.ts index 056260d9e515..430251d25a6e 100644 --- a/packages/validator/test/unit/utils/clock.test.ts +++ b/packages/validator/test/unit/utils/clock.test.ts @@ -1,7 +1,7 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; +import {BeaconConfig} from "@lodestar/config"; import {config} from "@lodestar/config/default"; import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {BeaconConfig} from "@lodestar/config"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {Clock, getCurrentSlotAround} from "../../../src/util/clock.js"; import {testLogger} from "../../utils/logger.js"; diff --git a/packages/validator/test/unit/utils/difference.test.ts b/packages/validator/test/unit/utils/difference.test.ts index 023a6144877a..3d249d1999d9 100644 --- a/packages/validator/test/unit/utils/difference.test.ts +++ b/packages/validator/test/unit/utils/difference.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {differenceHex} from "../../../src/util/difference.js"; describe("utils / differenceHex", () => { diff --git a/packages/validator/test/unit/utils/metrics.test.ts b/packages/validator/test/unit/utils/metrics.test.ts index de4010761001..6876c3705ae9 100644 --- a/packages/validator/test/unit/utils/metrics.test.ts +++ b/packages/validator/test/unit/utils/metrics.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from "vitest"; +import {describe, expect, it} from "vitest"; import {BeaconHealth, renderEnumNumeric} from "../../../src/metrics.js"; describe("renderEnumNumeric", () => { diff --git a/packages/validator/test/unit/utils/params.test.ts b/packages/validator/test/unit/utils/params.test.ts index 13bab507cf13..b483c9a067c3 100644 --- a/packages/validator/test/unit/utils/params.test.ts +++ b/packages/validator/test/unit/utils/params.test.ts @@ -1,9 +1,9 @@ -import {describe, it, expect} from "vitest"; -import {chainConfigToJson, ChainConfig} from "@lodestar/config"; +import {ChainConfig, chainConfigToJson} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; import {networksChainConfig} from "@lodestar/config/networks"; -import {assertEqualParams, NotEqualParamsError} from "../../../src/util/params.js"; -import {lighthouseHoleskyConfig, prysmHoleskyConfig, tekuHoleskyConfig, nimbusHoleskyConfig} from "./interopConfigs.js"; +import {describe, expect, it} from "vitest"; +import {NotEqualParamsError, assertEqualParams} from "../../../src/util/params.js"; +import {lighthouseHoleskyConfig, nimbusHoleskyConfig, prysmHoleskyConfig, tekuHoleskyConfig} from "./interopConfigs.js"; const testCases: {name: string; items: [ChainConfig, Record]}[] = [ {name: "lighthouse", items: [networksChainConfig.holesky, lighthouseHoleskyConfig]}, diff --git a/packages/validator/test/unit/validatorStore.test.ts b/packages/validator/test/unit/validatorStore.test.ts index b029a33e163a..d32acf41647a 100644 --- a/packages/validator/test/unit/validatorStore.test.ts +++ b/packages/validator/test/unit/validatorStore.test.ts @@ -1,15 +1,15 @@ -import {describe, it, expect, beforeEach, afterEach, vi} from "vitest"; -import {toBufferBE} from "bigint-buffer"; -import {toHexString, fromHexString} from "@chainsafe/ssz"; import {SecretKey} from "@chainsafe/blst"; +import {fromHexString, toHexString} from "@chainsafe/ssz"; +import {routes} from "@lodestar/api"; import {chainConfig} from "@lodestar/config/default"; import {bellatrix} from "@lodestar/types"; -import {routes} from "@lodestar/api"; +import {toBufferBE} from "bigint-buffer"; +import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {ValidatorStore} from "../../src/services/validatorStore.js"; +import {ValidatorProposerConfig} from "../../src/services/validatorStore.js"; import {getApiClientStub} from "../utils/apiStub.js"; import {initValidatorStore} from "../utils/validatorStore.js"; -import {ValidatorProposerConfig} from "../../src/services/validatorStore.js"; describe("ValidatorStore", () => { const api = getApiClientStub(); diff --git a/packages/validator/test/utils/apiStub.ts b/packages/validator/test/utils/apiStub.ts index 4443dab5c4ac..e26a18a1c216 100644 --- a/packages/validator/test/utils/apiStub.ts +++ b/packages/validator/test/utils/apiStub.ts @@ -1,5 +1,5 @@ -import {vi, Mocked} from "vitest"; import {ApiClientMethods, ApiResponse, Endpoint, Endpoints, HttpStatusCode, IHttpClient} from "@lodestar/api"; +import {Mocked, vi} from "vitest"; type ApiClientStub = {[K in keyof Endpoints]: Mocked>} & { httpClient: Mocked; diff --git a/packages/validator/test/utils/logger.ts b/packages/validator/test/utils/logger.ts index 44f5190dfe79..7f32ddba0381 100644 --- a/packages/validator/test/utils/logger.ts +++ b/packages/validator/test/utils/logger.ts @@ -1,6 +1,6 @@ -import {vi, Mocked} from "vitest"; import {Logger} from "@lodestar/logger"; import {getEnvLogger} from "@lodestar/logger/env"; +import {Mocked, vi} from "vitest"; import {getLoggerVc} from "../../src/util/index.js"; import {ClockMock} from "./clock.js"; diff --git a/packages/validator/test/utils/validatorStore.ts b/packages/validator/test/utils/validatorStore.ts index d3037ce522b9..e8eaa485cada 100644 --- a/packages/validator/test/utils/validatorStore.ts +++ b/packages/validator/test/utils/validatorStore.ts @@ -1,7 +1,7 @@ import {SecretKey} from "@chainsafe/blst"; import {ApiClient} from "@lodestar/api"; +import {ChainConfig, createBeaconConfig} from "@lodestar/config"; import {chainConfig} from "@lodestar/config/default"; -import {createBeaconConfig, ChainConfig} from "@lodestar/config"; import {Signer, SignerType, ValidatorStore} from "../../src/index.js"; import {IndicesService} from "../../src/services/indices.js"; import {ValidatorProposerConfig} from "../../src/services/validatorStore.js"; From 07d1145194a629baf0f7c93a2fc776e8afd83aea Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 3 Nov 2024 07:21:41 +0000 Subject: [PATCH 04/48] fix: consistently validate pubkey and throw 404 if not found (#7214) * Throw error if pubkey is unknown when getting graffiti * Consistently validate pubkey and throw 404 if not found --- .../cli/src/cmds/validator/keymanager/impl.ts | 23 ++++++++++++++++++- .../validator/src/services/validatorStore.ts | 6 ++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/cmds/validator/keymanager/impl.ts b/packages/cli/src/cmds/validator/keymanager/impl.ts index 8816f964a8ce..24bf653250eb 100644 --- a/packages/cli/src/cmds/validator/keymanager/impl.ts +++ b/packages/cli/src/cmds/validator/keymanager/impl.ts @@ -42,11 +42,13 @@ export class KeymanagerApi implements Api { } async listFeeRecipient({pubkey}: {pubkey: PubkeyHex}): ReturnType { + this.assertValidKnownPubkey(pubkey); return {data: {pubkey, ethaddress: this.validator.validatorStore.getFeeRecipient(pubkey)}}; } async setFeeRecipient({pubkey, ethaddress}: FeeRecipientData): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.setFeeRecipient(pubkey, parseFeeRecipient(ethaddress)); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 202}; @@ -54,12 +56,14 @@ export class KeymanagerApi implements Api { async deleteFeeRecipient({pubkey}: {pubkey: PubkeyHex}): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.deleteFeeRecipient(pubkey); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 204}; } async getGraffiti({pubkey}: {pubkey: PubkeyHex}): ReturnType { + this.assertValidKnownPubkey(pubkey); const graffiti = this.validator.validatorStore.getGraffiti(pubkey); if (graffiti === undefined) { throw new ApiError(404, `No graffiti for pubkey ${pubkey}`); @@ -69,6 +73,7 @@ export class KeymanagerApi implements Api { async setGraffiti({pubkey, graffiti}: GraffitiData): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.setGraffiti(pubkey, graffiti); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 202}; @@ -76,18 +81,21 @@ export class KeymanagerApi implements Api { async deleteGraffiti({pubkey}: {pubkey: PubkeyHex}): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.deleteGraffiti(pubkey); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 204}; } async getGasLimit({pubkey}: {pubkey: PubkeyHex}): ReturnType { + this.assertValidKnownPubkey(pubkey); const gasLimit = this.validator.validatorStore.getGasLimit(pubkey); return {data: {pubkey, gasLimit}}; } async setGasLimit({pubkey, gasLimit}: GasLimitData): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.setGasLimit(pubkey, gasLimit); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 202}; @@ -95,6 +103,7 @@ export class KeymanagerApi implements Api { async deleteGasLimit({pubkey}: {pubkey: PubkeyHex}): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.deleteGasLimit(pubkey); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 204}; @@ -344,6 +353,7 @@ export class KeymanagerApi implements Api { } async getBuilderBoostFactor({pubkey}: {pubkey: PubkeyHex}): ReturnType { + this.assertValidKnownPubkey(pubkey); const builderBoostFactor = this.validator.validatorStore.getBuilderBoostFactor(pubkey); return {data: {pubkey, builderBoostFactor}}; } @@ -353,6 +363,7 @@ export class KeymanagerApi implements Api { builderBoostFactor, }: BuilderBoostFactorData): ReturnType { this.checkIfProposerWriteEnabled(); + this.assertValidKnownPubkey(pubkey); this.validator.validatorStore.setBuilderBoostFactor(pubkey, builderBoostFactor); this.persistedKeysBackend.writeProposerConfig(pubkey, this.validator.validatorStore.getProposerConfig(pubkey)); return {status: 202}; @@ -366,6 +377,8 @@ export class KeymanagerApi implements Api { } async getProposerConfig({pubkey}: {pubkey: PubkeyHex}): ReturnType { + this.assertValidKnownPubkey(pubkey); + const config = this.validator.validatorStore.getProposerConfig(pubkey); const data: ProposerConfigResponse = { @@ -383,10 +396,18 @@ export class KeymanagerApi implements Api { } async signVoluntaryExit({pubkey, epoch}: {pubkey: PubkeyHex; epoch?: Epoch}): ReturnType { + this.assertValidKnownPubkey(pubkey); + return {data: await this.validator.signVoluntaryExit(pubkey, epoch)}; + } + + private assertValidKnownPubkey(pubkey: PubkeyHex): void { if (!isValidatePubkeyHex(pubkey)) { throw new ApiError(400, `Invalid pubkey ${pubkey}`); } - return {data: await this.validator.signVoluntaryExit(pubkey, epoch)}; + + if (!this.validator.validatorStore.hasVotingPubkey(pubkey)) { + throw new ApiError(404, `Validator pubkey ${pubkey} not known`); + } } } diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index 0c66f576ffa0..e80c0b291ef5 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -251,7 +251,11 @@ export class ValidatorStore { } getGraffiti(pubkeyHex: PubkeyHex): string | undefined { - return this.validators.get(pubkeyHex)?.graffiti ?? this.defaultProposerConfig.graffiti; + const validatorData = this.validators.get(pubkeyHex); + if (validatorData === undefined) { + throw Error(`Validator pubkey ${pubkeyHex} not known`); + } + return validatorData.graffiti ?? this.defaultProposerConfig.graffiti; } setGraffiti(pubkeyHex: PubkeyHex, graffiti: string): void { From abe6751566d948df5c55f7d90b7742bfd8973f68 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sun, 3 Nov 2024 07:25:02 +0000 Subject: [PATCH 05/48] fix: only return local keys from /eth/v1/keystores (#7215) * fix: only return local keys from /eth/v1/keystores * Fix fetching remote keys in node assertion --- packages/cli/src/cmds/validator/keymanager/impl.ts | 9 ++++++--- .../cli/test/utils/crucible/assertions/nodeAssertion.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/cmds/validator/keymanager/impl.ts b/packages/cli/src/cmds/validator/keymanager/impl.ts index 24bf653250eb..9a5a8bd72743 100644 --- a/packages/cli/src/cmds/validator/keymanager/impl.ts +++ b/packages/cli/src/cmds/validator/keymanager/impl.ts @@ -110,12 +110,15 @@ export class KeymanagerApi implements Api { } async listKeys(): ReturnType { - const pubkeys = this.validator.validatorStore.votingPubkeys(); + const localKeys = this.validator.validatorStore + .votingPubkeys() + .filter((pubkey) => this.validator.validatorStore.getSigner(pubkey)?.type === SignerType.Local); + return { - data: pubkeys.map((pubkey) => ({ + data: localKeys.map((pubkey) => ({ validatingPubkey: pubkey, derivationPath: "", - readonly: this.validator.validatorStore.getSigner(pubkey)?.type !== SignerType.Local, + readonly: false, })), }; } diff --git a/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts b/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts index 6b94f2e701a9..5a951ced89ce 100644 --- a/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts +++ b/packages/cli/test/utils/crucible/assertions/nodeAssertion.ts @@ -20,8 +20,13 @@ export const nodeAssertion: Assertion<"node", {health: number; keyManagerKeys: s if (node.validator.client === ValidatorClient.Lighthouse || getAllKeys(node.validator.keys).length === 0) { keyManagerKeys = []; } else { - const keys = (await node.validator.keyManager.listKeys()).value(); - keyManagerKeys = keys.map((k) => k.validatingPubkey); + if (node.validator.keys.type === "local") { + const keys = (await node.validator.keyManager.listKeys()).value(); + keyManagerKeys = keys.map((k) => k.validatingPubkey); + } else { + const keys = (await node.validator.keyManager.listRemoteKeys()).value(); + keyManagerKeys = keys.map((k) => k.pubkey); + } } return {health, keyManagerKeys}; From 2e5265bf6fd12bc4ae824328fad9d2915beac29e Mon Sep 17 00:00:00 2001 From: g11tech Date: Sun, 3 Nov 2024 15:05:27 +0530 Subject: [PATCH 06/48] feat: add and use getBlobsV1 to expedite gossip import (#7134) * hookup the getblobs api to get bob and proof data from el remove unused fix import metrics overhault, test, debugging testing, some feeback fix add nethermind bug dicussion link fix resolve conflicts * deblobs timeout * fix metric --- .../src/api/impl/beacon/blocks/index.ts | 10 +- .../src/chain/blocks/verifyBlock.ts | 2 +- .../blocks/verifyBlocksDataAvailability.ts | 28 +- .../src/eth1/provider/jsonRpcHttpClient.ts | 2 +- .../src/execution/engine/disabled.ts | 4 + .../beacon-node/src/execution/engine/http.ts | 57 +++- .../src/execution/engine/interface.ts | 4 +- .../beacon-node/src/execution/engine/mock.ts | 7 + .../beacon-node/src/execution/engine/types.ts | 19 ++ .../beacon-node/src/metrics/metrics/beacon.ts | 115 ++++++++ .../src/network/processor/gossipHandlers.ts | 3 + .../reqresp/beaconBlocksMaybeBlobsByRoot.ts | 169 +++++++++++- packages/beacon-node/src/sync/unknownBlock.ts | 17 +- .../unavailableBeaconBlobsByRoot.test.ts | 257 ++++++++++++++++++ packages/types/src/deneb/types.ts | 4 + 15 files changed, 663 insertions(+), 35 deletions(-) create mode 100644 packages/beacon-node/test/unit/network/unavailableBeaconBlobsByRoot.test.ts diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts index bda72bc3b997..66935df25b2b 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -215,12 +215,12 @@ export function getBeaconBlockApi({ // specification is very clear that this is the desired behaviour. // // i) Publish blobs and block before importing so that network can see them asap - // ii) publish blobs first because - // a) by the times nodes see block, they might decide to pull blobs - // b) they might require more hops to reach recipients in peerDAS kind of setup where - // blobs might need to hop between nodes because of partial subnet subscription - ...blobSidecars.map((blobSidecar) => () => network.publishBlobSidecar(blobSidecar)), + // ii) publish block first because + // a) as soon as node sees block they can start processing it while blobs arrive + // b) getting block first allows nodes to use getBlobs from local ELs and save + // import latency and hopefully bandwidth () => network.publishBeaconBlock(signedBlock) as Promise, + ...blobSidecars.map((blobSidecar) => () => network.publishBlobSidecar(blobSidecar)), () => // there is no rush to persist block since we published it to gossip anyway chain diff --git a/packages/beacon-node/src/chain/blocks/verifyBlock.ts b/packages/beacon-node/src/chain/blocks/verifyBlock.ts index 47a9a9060572..5ead67a720f7 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlock.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlock.ts @@ -106,7 +106,7 @@ export async function verifyBlocksInEpoch( } as SegmentExecStatus), // data availability for the blobs - verifyBlocksDataAvailability(this, blocksInput, opts), + verifyBlocksDataAvailability(this, blocksInput, abortController.signal, opts), // Run state transition only // TODO: Ensure it yields to allow flushing to workers and engine API diff --git a/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts b/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts index 1d8c72a46873..11e1d8f94567 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlocksDataAvailability.ts @@ -2,7 +2,7 @@ import {ChainForkConfig} from "@lodestar/config"; import {DataAvailabilityStatus} from "@lodestar/fork-choice"; import {computeTimeAtSlot} from "@lodestar/state-transition"; import {UintNum64, deneb} from "@lodestar/types"; -import {Logger} from "@lodestar/utils"; +import {ErrorAborted, Logger} from "@lodestar/utils"; import {Metrics} from "../../metrics/metrics.js"; import {BlockError, BlockErrorCode} from "../errors/index.js"; import {validateBlobSidecars} from "../validation/blobSidecar.js"; @@ -27,6 +27,7 @@ const BLOB_AVAILABILITY_TIMEOUT = 12_000; export async function verifyBlocksDataAvailability( chain: {config: ChainForkConfig; genesisTime: UintNum64; logger: Logger; metrics: Metrics | null}, blocks: BlockInput[], + signal: AbortSignal, opts: ImportBlockOpts ): Promise<{ dataAvailabilityStatuses: DataAvailabilityStatus[]; @@ -43,9 +44,12 @@ export async function verifyBlocksDataAvailability( const availableBlockInputs: BlockInput[] = []; for (const blockInput of blocks) { + if (signal.aborted) { + throw new ErrorAborted("verifyBlocksDataAvailability"); + } // Validate status of only not yet finalized blocks, we don't need yet to propogate the status // as it is not used upstream anywhere - const {dataAvailabilityStatus, availableBlockInput} = await maybeValidateBlobs(chain, blockInput, opts); + const {dataAvailabilityStatus, availableBlockInput} = await maybeValidateBlobs(chain, blockInput, signal, opts); dataAvailabilityStatuses.push(dataAvailabilityStatus); availableBlockInputs.push(availableBlockInput); } @@ -69,6 +73,7 @@ export async function verifyBlocksDataAvailability( async function maybeValidateBlobs( chain: {config: ChainForkConfig; genesisTime: UintNum64; logger: Logger}, blockInput: BlockInput, + signal: AbortSignal, opts: ImportBlockOpts ): Promise<{dataAvailabilityStatus: DataAvailabilityStatus; availableBlockInput: BlockInput}> { switch (blockInput.type) { @@ -92,7 +97,7 @@ async function maybeValidateBlobs( const blobsData = blockInput.type === BlockInputType.availableData ? blockInput.blockData - : await raceWithCutoff(chain, blockInput, blockInput.cachedData.availabilityPromise); + : await raceWithCutoff(chain, blockInput, blockInput.cachedData.availabilityPromise, signal); const {blobs} = blobsData; const {blobKzgCommitments} = (block as deneb.SignedBeaconBlock).message.body; @@ -122,16 +127,21 @@ async function maybeValidateBlobs( async function raceWithCutoff( chain: {config: ChainForkConfig; genesisTime: UintNum64; logger: Logger}, blockInput: BlockInput, - availabilityPromise: Promise + availabilityPromise: Promise, + signal: AbortSignal ): Promise { const {block} = blockInput; const blockSlot = block.message.slot; - const cutoffTime = Math.max( - computeTimeAtSlot(chain.config, blockSlot, chain.genesisTime) * 1000 + BLOB_AVAILABILITY_TIMEOUT - Date.now(), - 0 - ); - const cutoffTimeout = new Promise((_resolve, reject) => setTimeout(reject, cutoffTime)); + const cutoffTime = + computeTimeAtSlot(chain.config, blockSlot, chain.genesisTime) * 1000 + BLOB_AVAILABILITY_TIMEOUT - Date.now(); + const cutoffTimeout = + cutoffTime > 0 + ? new Promise((_resolve, reject) => { + setTimeout(() => reject(new Error("Timeout exceeded")), cutoffTime); + signal.addEventListener("abort", () => reject(signal.reason)); + }) + : Promise.reject(new Error("Cutoff time must be greater than 0")); chain.logger.debug("Racing for blob availabilityPromise", {blockSlot, cutoffTime}); try { diff --git a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts index da72d5183d30..906c9cd883c7 100644 --- a/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts +++ b/packages/beacon-node/src/eth1/provider/jsonRpcHttpClient.ts @@ -372,7 +372,7 @@ export class HttpRpcError extends Error { /** * JSON RPC spec errors https://www.jsonrpc.org/specification#response_object */ -function parseJsonRpcErrorCode(code: number): string { +export function parseJsonRpcErrorCode(code: number): string { if (code === -32700) return "Parse request error"; if (code === -32600) return "Invalid request object"; if (code === -32601) return "Method not found"; diff --git a/packages/beacon-node/src/execution/engine/disabled.ts b/packages/beacon-node/src/execution/engine/disabled.ts index 68c72dc02ac6..dce9244ef7ab 100644 --- a/packages/beacon-node/src/execution/engine/disabled.ts +++ b/packages/beacon-node/src/execution/engine/disabled.ts @@ -28,4 +28,8 @@ export class ExecutionEngineDisabled implements IExecutionEngine { getPayloadBodiesByRange(): Promise { throw Error("Execution engine disabled"); } + + getBlobs(): Promise { + throw Error("Execution engine disabled"); + } } diff --git a/packages/beacon-node/src/execution/engine/http.ts b/packages/beacon-node/src/execution/engine/http.ts index c5cf61481b67..ea064d2fe816 100644 --- a/packages/beacon-node/src/execution/engine/http.ts +++ b/packages/beacon-node/src/execution/engine/http.ts @@ -1,14 +1,16 @@ import {Logger} from "@lodestar/logger"; import {ForkName, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types"; +import {BlobAndProof} from "@lodestar/types/deneb"; import { ErrorJsonRpcResponse, HttpRpcError, IJsonRpcHttpClient, JsonRpcHttpClientEvent, ReqOpts, + parseJsonRpcErrorCode, } from "../../eth1/provider/jsonRpcHttpClient.js"; -import {numToQuantity} from "../../eth1/provider/utils.js"; +import {bytesToData, numToQuantity} from "../../eth1/provider/utils.js"; import {Metrics} from "../../metrics/index.js"; import {EPOCHS_PER_BATCH} from "../../sync/constants.js"; import {getLodestarClientVersion} from "../../util/metadata.js"; @@ -31,6 +33,7 @@ import { EngineApiRpcReturnTypes, ExecutionPayloadBody, assertReqSizeLimit, + deserializeBlobAndProofs, deserializeExecutionPayloadBody, parseExecutionPayload, serializeBeaconBlockRoot, @@ -111,6 +114,7 @@ const getPayloadOpts: ReqOpts = {routeId: "getPayload"}; */ export class ExecutionEngineHttp implements IExecutionEngine { private logger: Logger; + private lastGetBlobsErrorTime = 0; // The default state is ONLINE, it will be updated to SYNCING once we receive the first payload // This assumption is better than the OFFLINE state, since we can't be sure if the EL is offline and being offline may trigger some notifications @@ -461,6 +465,57 @@ export class ExecutionEngineHttp implements IExecutionEngine { return response.map(deserializeExecutionPayloadBody); } + async getBlobs(_fork: ForkName, versionedHashes: VersionedHashes): Promise<(BlobAndProof | null)[]> { + // retry only after a day may be + const GETBLOBS_RETRY_TIMEOUT = 256 * 32 * 12; + const timeNow = Date.now() / 1000; + const timeSinceLastFail = timeNow - this.lastGetBlobsErrorTime; + if (timeSinceLastFail < GETBLOBS_RETRY_TIMEOUT) { + // do not try getblobs since it might not be available + this.logger.debug( + `disabled engine_getBlobsV1 api call since last failed < GETBLOBS_RETRY_TIMEOUT=${GETBLOBS_RETRY_TIMEOUT}`, + timeSinceLastFail + ); + throw Error( + `engine_getBlobsV1 call recently failed timeSinceLastFail=${timeSinceLastFail} < GETBLOBS_RETRY_TIMEOUT=${GETBLOBS_RETRY_TIMEOUT}` + ); + } + + const method = "engine_getBlobsV1"; + assertReqSizeLimit(versionedHashes.length, 128); + const versionedHashesHex = versionedHashes.map(bytesToData); + let response = await this.rpc + .fetchWithRetries({ + method, + params: [versionedHashesHex], + }) + .catch((e) => { + if (e instanceof ErrorJsonRpcResponse && parseJsonRpcErrorCode(e.response.error.code) === "Method not found") { + this.lastGetBlobsErrorTime = timeNow; + this.logger.debug("disabling engine_getBlobsV1 api call since engine responded with method not availeble", { + retryTimeout: GETBLOBS_RETRY_TIMEOUT, + }); + } + throw e; + }); + + // handle nethermind buggy response + // see: https://discord.com/channels/595666850260713488/1293605631785304088/1298956894274060301 + if ( + (response as unknown as {blobsAndProofs: EngineApiRpcReturnTypes[typeof method]}).blobsAndProofs !== undefined + ) { + response = (response as unknown as {blobsAndProofs: EngineApiRpcReturnTypes[typeof method]}).blobsAndProofs; + } + + if (response.length !== versionedHashes.length) { + const error = `Invalid engine_getBlobsV1 response length=${response.length} versionedHashes=${versionedHashes.length}`; + this.logger.error(error); + throw Error(error); + } + + return response.map(deserializeBlobAndProofs); + } + private async getClientVersion(clientVersion: ClientVersion): Promise { const method = "engine_getClientVersionV1"; diff --git a/packages/beacon-node/src/execution/engine/interface.ts b/packages/beacon-node/src/execution/engine/interface.ts index 7bbf1bb27c1d..c32cc1bc7215 100644 --- a/packages/beacon-node/src/execution/engine/interface.ts +++ b/packages/beacon-node/src/execution/engine/interface.ts @@ -1,6 +1,6 @@ import {ForkName} from "@lodestar/params"; import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei, capella} from "@lodestar/types"; -import {Blob, KZGCommitment, KZGProof} from "@lodestar/types/deneb"; +import {Blob, BlobAndProof, KZGCommitment, KZGProof} from "@lodestar/types/deneb"; import {DATA} from "../../eth1/provider/utils.js"; import {PayloadId, PayloadIdCache, WithdrawalV1} from "./payloadIdCache.js"; @@ -179,4 +179,6 @@ export interface IExecutionEngine { getPayloadBodiesByHash(fork: ForkName, blockHash: DATA[]): Promise<(ExecutionPayloadBody | null)[]>; getPayloadBodiesByRange(fork: ForkName, start: number, count: number): Promise<(ExecutionPayloadBody | null)[]>; + + getBlobs(fork: ForkName, versionedHashes: VersionedHashes): Promise<(BlobAndProof | null)[]>; } diff --git a/packages/beacon-node/src/execution/engine/mock.ts b/packages/beacon-node/src/execution/engine/mock.ts index 2331500624eb..8a84d2b0148e 100644 --- a/packages/beacon-node/src/execution/engine/mock.ts +++ b/packages/beacon-node/src/execution/engine/mock.ts @@ -99,6 +99,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend { engine_getPayloadBodiesByHashV1: this.getPayloadBodiesByHash.bind(this), engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this), engine_getClientVersionV1: this.getClientVersionV1.bind(this), + engine_getBlobsV1: this.getBlobs.bind(this), }; } @@ -397,6 +398,12 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend { return [{code: ClientCode.XX, name: "mock", version: "", commit: ""}]; } + private getBlobs( + versionedHashes: EngineApiRpcParamTypes["engine_getBlobsV1"][0] + ): EngineApiRpcReturnTypes["engine_getBlobsV1"] { + return versionedHashes.map((_vh) => null); + } + private timestampToFork(timestamp: number): ForkExecution { if (timestamp > (this.opts.electraForkTimestamp ?? Infinity)) return ForkName.electra; if (timestamp > (this.opts.denebForkTimestamp ?? Infinity)) return ForkName.deneb; diff --git a/packages/beacon-node/src/execution/engine/types.ts b/packages/beacon-node/src/execution/engine/types.ts index 9af2d8d1ce10..f35a63aa3d96 100644 --- a/packages/beacon-node/src/execution/engine/types.ts +++ b/packages/beacon-node/src/execution/engine/types.ts @@ -6,6 +6,7 @@ import { ForkSeq, } from "@lodestar/params"; import {ExecutionPayload, ExecutionRequests, Root, Wei, bellatrix, capella, deneb, electra, ssz} from "@lodestar/types"; +import {BlobAndProof} from "@lodestar/types/deneb"; import { DATA, @@ -67,6 +68,8 @@ export type EngineApiRpcParamTypes = { * Object - Instance of ClientVersion */ engine_getClientVersionV1: [ClientVersionRpc]; + + engine_getBlobsV1: [DATA[]]; }; export type PayloadStatus = { @@ -109,6 +112,8 @@ export type EngineApiRpcReturnTypes = { engine_getPayloadBodiesByRangeV1: (ExecutionPayloadBodyRpc | null)[]; engine_getClientVersionV1: ClientVersionRpc[]; + + engine_getBlobsV1: (BlobAndProofRpc | null)[]; }; type ExecutionPayloadRpcWithValue = { @@ -171,6 +176,11 @@ export type DepositRequestsRpc = DATA; export type WithdrawalRequestsRpc = DATA; export type ConsolidationRequestsRpc = DATA; +export type BlobAndProofRpc = { + blob: DATA; + proof: DATA; +}; + export type VersionedHashesRpc = DATA[]; export type PayloadAttributesRpc = { @@ -462,6 +472,15 @@ export function serializeExecutionPayloadBody(data: ExecutionPayloadBody | null) : null; } +export function deserializeBlobAndProofs(data: BlobAndProofRpc | null): BlobAndProof | null { + return data + ? { + blob: dataToBytes(data.blob, BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB), + proof: dataToBytes(data.proof, 48), + } + : null; +} + export function assertReqSizeLimit(blockHashesReqCount: number, count: number): void { if (blockHashesReqCount > count) { throw new Error(`Requested blocks must not be > ${count}`); diff --git a/packages/beacon-node/src/metrics/metrics/beacon.ts b/packages/beacon-node/src/metrics/metrics/beacon.ts index 0347aef8957b..f572ec0d3c1f 100644 --- a/packages/beacon-node/src/metrics/metrics/beacon.ts +++ b/packages/beacon-node/src/metrics/metrics/beacon.ts @@ -220,6 +220,121 @@ export function createBeaconMetrics(register: RegistryMetricCreator) { }), }, + blockInputFetchStats: { + // of already available blocks which didn't have to go through blobs pull + totalDataAvailableBlockInputs: register.gauge({ + name: "beacon_blockinputs_already_available_total", + help: "Total number of block inputs whose blobs were already available", + }), + totalDataAvailableBlockInputBlobs: register.gauge({ + name: "beacon_blockinput_blobs_already_available_total", + help: "Total number of block input blobs that of already available blocks", + }), + + // of those which need to be fetched + dataPromiseBlobsAlreadyAvailable: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_already_available_total", + help: "Count of blocks that were already available in blockinput cache via gossip", + }), + dataPromiseBlobsDelayedGossipAvailable: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_delayed_gossip_available_total", + help: "Count of blobs that became available delayed via gossip post block arrival", + }), + dataPromiseBlobsDeplayedGossipAvailableSavedGetBlobsCompute: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_delayed_gossip_saved_computation_total", + help: "Count of late available blobs that saved blob sidecar computation from getblobs", + }), + dataPromiseBlobsFoundInGetBlobsCacheNotNull: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_found_nonnull_in_getblobs_cache_total", + help: "Count of blobs that were found not null in getblobs cache", + }), + dataPromiseBlobsFoundInGetBlobsCacheNull: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_found_null_in_getblobs_cache_total", + help: "Count of blobs that were found null in the getblobs cache", + }), + dataPromiseBlobsNotAvailableInGetBlobsCache: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_notfound_in_getblobs_cache_total", + help: "Count of blobs that were newly seen and hence in not getblobs cache", + }), + dataPromiseBlobsEngineGetBlobsApiRequests: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_queried_in_getblobs_api_total", + help: "Total number of blobs requested to the getblobs api", + }), + dataPromiseBlobsEngineGetBlobsApiNotNull: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_responded_nonnull_in_getblobs_api_total", + help: "Count of successful engine API responses that were not null", + }), + dataPromiseBlobsEngineGetBlobsApiNull: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_responded_null_in_getblobs_api_total", + help: "Count of engine API responses that were null", + }), + dataPromiseBlobsEngineApiGetBlobsErroredNull: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_errored_as_null_in_getblobs_api_total", + help: "Number of responses marked null due to errors in getblobs api", + }), + dataPromiseBlobsEngineApiGetBlobsUseful: register.gauge({ + name: "beacon_datapromise_blockinput_getblobs_api_nonnull_responses_used_total", + help: "Count of successful non null engine API responses that were found useful", + }), + dataPromiseBlobsFinallyQueriedFromNetwork: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_finally_queried_from_network_total", + help: "Number of blob requests finally sent to the network", + }), + dataPromiseBlobsFinallyAvailableFromNetwork: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_finally_resolved_from_network_total", + help: "Number of blobs successfully fetched from the network", + }), + + totalDataPromiseBlockInputsAvailableUsingGetBlobs: register.gauge({ + name: "beacon_datapromise_blockinputs_available_using_getblobs_total", + help: "Count of block inputs that became available using non-null get blobs requests", + }), + totalDataPromiseBlockInputsTried: register.gauge({ + name: "beacon_datapromise_blockinputs_tried_for_blobs_pull_total", + help: "Total number of block inputs that were tried to resolve", + }), + totalDataPromiseBlockInputsResolvedAvailable: register.gauge({ + name: "beacon_datapromise_blockinputs_available_post_blobs_pull_total", + help: "Total number of block inputs that were successfully resolved as available on blobs pull", + }), + + // retry counts + totalDataPromiseBlockInputsReTried: register.gauge({ + name: "beacon_datapromise_blockinputs_retried_for_blobs_pull_total", + help: "Total number of block inputs that were retried for blobs pull from network", + }), + dataPromiseBlobsRetriedFromNetwork: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_retried_from_network_total", + help: "Number of blob requests required from the network on retries", + }), + dataPromiseBlobsRetriedAvailableFromNetwork: register.gauge({ + name: "beacon_datapromise_blockinput_blobs_retried_and_resolved_from_network_total", + help: "Number of blobs successfully fetched from the network on retries", + }), + totalDataPromiseBlockInputsRetriedAvailableFromNetwork: register.gauge({ + name: "beacon_datapromise_blockinputs_retried_and_resolved_from_network_total", + help: "Number of blockinputs successfully resolved from the network on retries", + }), + + // some caches stats + getBlobsCacheSize: register.gauge({ + name: "getblob_cache_size", + help: "getBlobs cache size", + }), + getBlobsCachePruned: register.gauge({ + name: "getblob_cache_pruned_total", + help: "getblobs cache pruned count", + }), + dataPromiseBlockInputRetryTrackerCacheSize: register.gauge({ + name: "beacon_datapromise_blockinput_retry_tracker_cache_size", + help: "datapromise retry tracker cache size", + }), + dataPromiseBlockInputRetryTrackerCachePruned: register.gauge({ + name: "beacon_datapromise_blockinput_retry_tracker_cache_pruned", + help: "datapromise retry tracker cache pruned count", + }), + }, + // Non-spec'ed clockSlot: register.gauge({ name: "beacon_clock_slot", diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index 5bec263a45c8..029e7ae4db42 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -253,6 +253,9 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand // if blobs are not yet fully available start an aggressive blob pull if (blockInput.type === BlockInputType.dataPromise) { events.emit(NetworkEvent.unknownBlockInput, {blockInput, peer: peerIdStr}); + } else if (blockInput.type === BlockInputType.availableData) { + metrics?.blockInputFetchStats.totalDataAvailableBlockInputs.inc(); + metrics?.blockInputFetchStats.totalDataAvailableBlockInputBlobs.inc(blockInput.blockData.blobs.length); } chain diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts index a6919318999d..3bbe00bfc56b 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRoot.ts @@ -1,6 +1,9 @@ +import {toHexString} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; -import {ForkSeq} from "@lodestar/params"; -import {SignedBeaconBlock, deneb, phase0} from "@lodestar/types"; +import {ForkName, ForkSeq} from "@lodestar/params"; +import {signedBlockToSignedHeader} from "@lodestar/state-transition"; +import {RootHex, SignedBeaconBlock, deneb, phase0} from "@lodestar/types"; +import {BlobAndProof} from "@lodestar/types/deneb"; import {fromHex} from "@lodestar/utils"; import { BlobsSource, @@ -13,11 +16,17 @@ import { getBlockInputBlobs, } from "../../chain/blocks/types.js"; import {BlockInputAvailabilitySource} from "../../chain/seenCache/seenGossipBlockInput.js"; +import {IExecutionEngine} from "../../execution/index.js"; import {Metrics} from "../../metrics/index.js"; +import {computeInclusionProof, kzgCommitmentToVersionedHash} from "../../util/blobs.js"; import {PeerIdStr} from "../../util/peerId.js"; import {INetwork} from "../interface.js"; import {matchBlockWithBlobs} from "./beaconBlocksMaybeBlobsByRange.js"; +// keep 1 epoch of stuff, assmume 16 blobs +const MAX_ENGINE_GETBLOBS_CACHE = 32 * 16; +const MAX_UNAVAILABLE_RETRY_CACHE = 32; + export async function beaconBlocksMaybeBlobsByRoot( config: ChainForkConfig, network: INetwork, @@ -35,6 +44,7 @@ export async function beaconBlocksMaybeBlobsByRoot( if (ForkSeq[fork] >= ForkSeq.deneb) { const blobKzgCommitmentsLen = (block.data.message.body as deneb.BeaconBlockBody).blobKzgCommitments.length; for (let index = 0; index < blobKzgCommitmentsLen; index++) { + // try see if the blob is available locally blobIdentifiers.push({blockRoot, index}); } } @@ -57,8 +67,14 @@ export async function unavailableBeaconBlobsByRoot( network: INetwork, peerId: PeerIdStr, unavailableBlockInput: BlockInput | NullBlockInput, - metrics: Metrics | null + opts: { + metrics: Metrics | null; + executionEngine: IExecutionEngine; + engineGetBlobsCache?: Map; + blockInputsRetryTrackerCache?: Set; + } ): Promise { + const {executionEngine, metrics, engineGetBlobsCache, blockInputsRetryTrackerCache} = opts; if (unavailableBlockInput.block !== null && unavailableBlockInput.type !== BlockInputType.dataPromise) { return unavailableBlockInput; } @@ -81,26 +97,150 @@ export async function unavailableBeaconBlobsByRoot( } // resolve missing blobs - const blobIdentifiers: deneb.BlobIdentifier[] = []; const slot = block.message.slot; + const fork = config.getForkName(slot); const blockRoot = config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block.message); + const blockRootHex = toHexString(blockRoot); + + const blockTriedBefore = blockInputsRetryTrackerCache?.has(blockRootHex) === true; + if (blockTriedBefore) { + metrics?.blockInputFetchStats.totalDataPromiseBlockInputsReTried.inc(); + } else { + metrics?.blockInputFetchStats.totalDataPromiseBlockInputsTried.inc(); + blockInputsRetryTrackerCache?.add(blockRootHex); + } const blobKzgCommitmentsLen = (block.message.body as deneb.BeaconBlockBody).blobKzgCommitments.length; + const signedBlockHeader = signedBlockToSignedHeader(config, block); + + const engineReqIdentifiers: (deneb.BlobIdentifier & { + kzgCommitment: deneb.KZGCommitment; + versionedHash: Uint8Array; + })[] = []; + const networkReqIdentifiers: deneb.BlobIdentifier[] = []; + + let getBlobsUseful = false; for (let index = 0; index < blobKzgCommitmentsLen; index++) { - if (blobsCache.has(index) === false) blobIdentifiers.push({blockRoot, index}); + if (blobsCache.has(index) === false) { + const kzgCommitment = (block.message.body as deneb.BeaconBlockBody).blobKzgCommitments[index]; + const versionedHash = kzgCommitmentToVersionedHash(kzgCommitment); + + // check if the getblobs cache has the data if block not been queried before + if (engineGetBlobsCache?.has(toHexString(versionedHash)) === true && !blockTriedBefore) { + const catchedBlobAndProof = engineGetBlobsCache.get(toHexString(versionedHash)) ?? null; + if (catchedBlobAndProof === null) { + metrics?.blockInputFetchStats.dataPromiseBlobsFoundInGetBlobsCacheNull.inc(); + networkReqIdentifiers.push({blockRoot, index}); + } else { + metrics?.blockInputFetchStats.dataPromiseBlobsFoundInGetBlobsCacheNotNull.inc(); + // compute TODO: also add inclusion proof cache + const {blob, proof: kzgProof} = catchedBlobAndProof; + const kzgCommitmentInclusionProof = computeInclusionProof(fork, block.message.body, index); + const blobSidecar = {index, blob, kzgCommitment, kzgProof, signedBlockHeader, kzgCommitmentInclusionProof}; + blobsCache.set(blobSidecar.index, {blobSidecar, blobBytes: null}); + } + } else if (blockTriedBefore) { + // only retry it from network + networkReqIdentifiers.push({blockRoot, index}); + } else { + // see if we can pull from EL + metrics?.blockInputFetchStats.dataPromiseBlobsNotAvailableInGetBlobsCache.inc(); + engineReqIdentifiers.push({blockRoot, index, versionedHash, kzgCommitment}); + } + } else { + metrics?.blockInputFetchStats.dataPromiseBlobsAlreadyAvailable.inc(); + } } - let allBlobSidecars: deneb.BlobSidecar[]; - if (blobIdentifiers.length > 0) { - allBlobSidecars = await network.sendBlobSidecarsByRoot(peerId, blobIdentifiers); + const versionedHashes = engineReqIdentifiers.map((bi) => bi.versionedHash); + metrics?.blockInputFetchStats.dataPromiseBlobsEngineGetBlobsApiRequests.inc(versionedHashes.length); + + const blobAndProofs = await executionEngine.getBlobs(ForkName.deneb, versionedHashes).catch((_e) => { + metrics?.blockInputFetchStats.dataPromiseBlobsEngineApiGetBlobsErroredNull.inc(versionedHashes.length); + return versionedHashes.map((_vh) => null); + }); + + for (let j = 0; j < versionedHashes.length; j++) { + const blobAndProof = blobAndProofs[j] ?? null; + // save to cache for future reference + engineGetBlobsCache?.set(toHexString(versionedHashes[j]), blobAndProof); + if (blobAndProof !== null) { + metrics?.blockInputFetchStats.dataPromiseBlobsEngineGetBlobsApiNotNull.inc(); + + // if we already got it by now, save the compute + if (blobsCache.has(engineReqIdentifiers[j].index) === false) { + metrics?.blockInputFetchStats.dataPromiseBlobsEngineApiGetBlobsUseful.inc(); + getBlobsUseful = true; + const {blob, proof: kzgProof} = blobAndProof; + const {kzgCommitment, index} = engineReqIdentifiers[j]; + const kzgCommitmentInclusionProof = computeInclusionProof(fork, block.message.body, index); + const blobSidecar = {index, blob, kzgCommitment, kzgProof, signedBlockHeader, kzgCommitmentInclusionProof}; + // add them in cache so that its reflected in all the blockInputs that carry this + // for e.g. a blockInput that might be awaiting blobs promise fullfillment in + // verifyBlocksDataAvailability + blobsCache.set(blobSidecar.index, {blobSidecar, blobBytes: null}); + } else { + metrics?.blockInputFetchStats.dataPromiseBlobsDelayedGossipAvailable.inc(); + metrics?.blockInputFetchStats.dataPromiseBlobsDeplayedGossipAvailableSavedGetBlobsCompute.inc(); + } + } + // may be blobsidecar arrived in the timespan of making the request + else { + metrics?.blockInputFetchStats.dataPromiseBlobsEngineGetBlobsApiNull.inc(); + if (blobsCache.has(engineReqIdentifiers[j].index) === false) { + const {blockRoot, index} = engineReqIdentifiers[j]; + networkReqIdentifiers.push({blockRoot, index}); + } else { + metrics?.blockInputFetchStats.dataPromiseBlobsDelayedGossipAvailable.inc(); + } + } + } + + if (engineGetBlobsCache !== undefined) { + // prune out engineGetBlobsCache + let pruneLength = Math.max(0, engineGetBlobsCache?.size - MAX_ENGINE_GETBLOBS_CACHE); + for (const key of engineGetBlobsCache.keys()) { + if (pruneLength <= 0) break; + engineGetBlobsCache.delete(key); + pruneLength--; + metrics?.blockInputFetchStats.getBlobsCachePruned.inc(); + } + metrics?.blockInputFetchStats.getBlobsCacheSize.set(engineGetBlobsCache.size); + } + if (blockInputsRetryTrackerCache !== undefined) { + // prune out engineGetBlobsCache + let pruneLength = Math.max(0, blockInputsRetryTrackerCache?.size - MAX_UNAVAILABLE_RETRY_CACHE); + for (const key of blockInputsRetryTrackerCache.keys()) { + if (pruneLength <= 0) break; + blockInputsRetryTrackerCache.delete(key); + pruneLength--; + metrics?.blockInputFetchStats.dataPromiseBlockInputRetryTrackerCachePruned.inc(); + } + metrics?.blockInputFetchStats.dataPromiseBlockInputRetryTrackerCacheSize.set(blockInputsRetryTrackerCache.size); + } + + // if clients expect sorted identifiers + networkReqIdentifiers.sort((a, b) => a.index - b.index); + let networkResBlobSidecars: deneb.BlobSidecar[]; + metrics?.blockInputFetchStats.dataPromiseBlobsFinallyQueriedFromNetwork.inc(networkReqIdentifiers.length); + if (blockTriedBefore) { + metrics?.blockInputFetchStats.dataPromiseBlobsRetriedFromNetwork.inc(networkReqIdentifiers.length); + } + + if (networkReqIdentifiers.length > 0) { + networkResBlobSidecars = await network.sendBlobSidecarsByRoot(peerId, networkReqIdentifiers); + metrics?.blockInputFetchStats.dataPromiseBlobsFinallyAvailableFromNetwork.inc(networkResBlobSidecars.length); + if (blockTriedBefore) { + metrics?.blockInputFetchStats.dataPromiseBlobsRetriedAvailableFromNetwork.inc(networkResBlobSidecars.length); + } } else { - allBlobSidecars = []; + networkResBlobSidecars = []; } // add them in cache so that its reflected in all the blockInputs that carry this // for e.g. a blockInput that might be awaiting blobs promise fullfillment in // verifyBlocksDataAvailability - for (const blobSidecar of allBlobSidecars) { + for (const blobSidecar of networkResBlobSidecars) { blobsCache.set(blobSidecar.index, {blobSidecar, blobBytes: null}); } @@ -114,5 +254,14 @@ export async function unavailableBeaconBlobsByRoot( const blockData = {fork: cachedData.fork, ...allBlobs, blobsSource: BlobsSource.byRoot} as BlockInputDataBlobs; resolveAvailability(blockData); metrics?.syncUnknownBlock.resolveAvailabilitySource.inc({source: BlockInputAvailabilitySource.UNKNOWN_SYNC}); + + metrics?.blockInputFetchStats.totalDataAvailableBlockInputs.inc(); + if (getBlobsUseful) { + metrics?.blockInputFetchStats.totalDataPromiseBlockInputsAvailableUsingGetBlobs.inc(); + } + if (blockTriedBefore) { + metrics?.blockInputFetchStats.totalDataPromiseBlockInputsRetriedAvailableFromNetwork.inc(); + } + return getBlockInput.availableData(config, block, BlockSource.byRoot, blockBytes, blockData); } diff --git a/packages/beacon-node/src/sync/unknownBlock.ts b/packages/beacon-node/src/sync/unknownBlock.ts index c9652dc6ecd2..f1fa44750f4b 100644 --- a/packages/beacon-node/src/sync/unknownBlock.ts +++ b/packages/beacon-node/src/sync/unknownBlock.ts @@ -1,6 +1,7 @@ import {ChainForkConfig} from "@lodestar/config"; import {INTERVALS_PER_SLOT} from "@lodestar/params"; import {Root, RootHex, deneb} from "@lodestar/types"; +import {BlobAndProof} from "@lodestar/types/deneb"; import {Logger, fromHex, pruneSetToMax, toRootHex} from "@lodestar/utils"; import {sleep} from "@lodestar/utils"; import {BlockInput, BlockInputType, NullBlockInput} from "../chain/blocks/types.js"; @@ -34,6 +35,9 @@ export class UnknownBlockSync { private readonly maxPendingBlocks; private subscribedToNetworkEvents = false; + private engineGetBlobsCache = new Map(); + private blockInputsRetryTrackerCache = new Set(); + constructor( private readonly config: ChainForkConfig, private readonly network: INetwork, @@ -532,13 +536,12 @@ export class UnknownBlockSync { for (let i = 0; i < MAX_ATTEMPTS_PER_BLOCK; i++) { const peer = shuffledPeers[i % shuffledPeers.length]; try { - const blockInput = await unavailableBeaconBlobsByRoot( - this.config, - this.network, - peer, - unavailableBlockInput, - this.metrics - ); + const blockInput = await unavailableBeaconBlobsByRoot(this.config, this.network, peer, unavailableBlockInput, { + metrics: this.metrics, + executionEngine: this.chain.executionEngine, + engineGetBlobsCache: this.engineGetBlobsCache, + blockInputsRetryTrackerCache: this.blockInputsRetryTrackerCache, + }); // Peer does not have the block, try with next peer if (blockInput === undefined) { diff --git a/packages/beacon-node/test/unit/network/unavailableBeaconBlobsByRoot.test.ts b/packages/beacon-node/test/unit/network/unavailableBeaconBlobsByRoot.test.ts new file mode 100644 index 000000000000..b222b2ac38d8 --- /dev/null +++ b/packages/beacon-node/test/unit/network/unavailableBeaconBlobsByRoot.test.ts @@ -0,0 +1,257 @@ +import {toHexString} from "@chainsafe/ssz"; +import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; +import {BYTES_PER_FIELD_ELEMENT, FIELD_ELEMENTS_PER_BLOB, ForkBlobs, ForkName, isForkBlobs} from "@lodestar/params"; +import {signedBlockToSignedHeader} from "@lodestar/state-transition"; +import {SignedBeaconBlock, deneb, ssz} from "@lodestar/types"; +import {beforeAll, describe, expect, it, vi} from "vitest"; +import { + BlobsSource, + BlockInput, + BlockInputDataBlobs, + BlockInputType, + BlockSource, + CachedData, + getBlockInput, +} from "../../../src/chain/blocks/types.js"; +import {IExecutionEngine} from "../../../src/execution/index.js"; +import {INetwork} from "../../../src/network/interface.js"; +import {unavailableBeaconBlobsByRoot} from "../../../src/network/reqresp/index.js"; +import {computeInclusionProof, kzgCommitmentToVersionedHash} from "../../../src/util/blobs.js"; +import {ckzg} from "../../../src/util/kzg.js"; +import {initCKZG, loadEthereumTrustedSetup} from "../../../src/util/kzg.js"; + +describe("unavailableBeaconBlobsByRoot", () => { + beforeAll(async () => { + await initCKZG(); + loadEthereumTrustedSetup(); + }); + + /* eslint-disable @typescript-eslint/naming-convention */ + const chainConfig = createChainForkConfig({ + ...defaultChainConfig, + ALTAIR_FORK_EPOCH: 0, + BELLATRIX_FORK_EPOCH: 0, + CAPELLA_FORK_EPOCH: 0, + DENEB_FORK_EPOCH: 0, + }); + const genesisValidatorsRoot = Buffer.alloc(32, 0xaa); + const config = createBeaconConfig(chainConfig, genesisValidatorsRoot); + + const executionEngine = { + getBlobs: vi.fn(), + }; + + const network = { + sendBeaconBlocksByRoot: vi.fn(), + sendBlobSidecarsByRoot: vi.fn(), + }; + + const peerId = "mockPeerId"; + const engineGetBlobsCache = new Map(); + + it("should successfully resolve all blobs from engine and network", async () => { + // Simulate a block 1 with 5 blobs + const signedBlock = ssz.deneb.SignedBeaconBlock.defaultValue(); + signedBlock.message.slot = 1; + const blobscommitmentsandproofs = generateBlobs(5); + signedBlock.message.body.blobKzgCommitments.push(...blobscommitmentsandproofs.kzgCommitments); + const blockheader = signedBlockToSignedHeader(config, signedBlock); + + const unavailableBlockInput = { + block: signedBlock, + source: BlockSource.gossip, + blockBytes: null, + type: BlockInputType.dataPromise, + cachedData: getEmptyBlockInputCacheEntry(ForkName.deneb).cachedData, + } as BlockInput; + + // total of 5 blobs + // blob 0. not in cache & to resolved by getBlobs + // blob 1. not in cache & to resolved by getBlobs + // blob 2. to be found in engineGetBlobsCache + // blob 3. null cached earlier so should directly go to network query and skip engine query + // blob 4. to hit getBlobs first with null response and then go to the network query + // + // engineGetBlobsCache caches 2 fully, and null for 3 + // getBlobs should see 0,1,4 and return first two non null and last null + // network should see 3,4 + + engineGetBlobsCache.set(toHexString(blobscommitmentsandproofs.blobVersionedHashes[2]), { + blob: blobscommitmentsandproofs.blobs[2], + proof: blobscommitmentsandproofs.kzgProofs[2], + }); + engineGetBlobsCache.set(toHexString(blobscommitmentsandproofs.blobVersionedHashes[3]), null); + + // Mock execution engine to return 2 blobs + executionEngine.getBlobs.mockResolvedValueOnce([ + { + blob: blobscommitmentsandproofs.blobs[0], + proof: blobscommitmentsandproofs.kzgProofs[0], + }, + { + blob: blobscommitmentsandproofs.blobs[1], + proof: blobscommitmentsandproofs.kzgProofs[1], + }, + null, + ]); + + // Mock network to return 2 blobs + network.sendBlobSidecarsByRoot.mockResolvedValueOnce([ + { + index: 3, + blob: blobscommitmentsandproofs.blobs[3], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[3], + kzgProof: blobscommitmentsandproofs.kzgProofs[3], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 3), + }, + { + index: 4, + blob: blobscommitmentsandproofs.blobs[4], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[4], + kzgProof: blobscommitmentsandproofs.kzgProofs[4], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 4), + }, + ]); + + const result = await unavailableBeaconBlobsByRoot( + config, + network as unknown as INetwork, + peerId, + unavailableBlockInput, + { + executionEngine: executionEngine as unknown as IExecutionEngine, + metrics: null, + engineGetBlobsCache, + } + ); + + // Check if all blobs are aggregated + const allBlobs = [ + { + index: 0, + blob: blobscommitmentsandproofs.blobs[0], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[0], + kzgProof: blobscommitmentsandproofs.kzgProofs[0], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 0), + }, + { + index: 1, + blob: blobscommitmentsandproofs.blobs[1], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[1], + kzgProof: blobscommitmentsandproofs.kzgProofs[1], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 1), + }, + { + index: 2, + blob: blobscommitmentsandproofs.blobs[2], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[2], + kzgProof: blobscommitmentsandproofs.kzgProofs[2], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 2), + }, + { + index: 3, + blob: blobscommitmentsandproofs.blobs[3], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[3], + kzgProof: blobscommitmentsandproofs.kzgProofs[3], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 3), + }, + { + index: 4, + blob: blobscommitmentsandproofs.blobs[4], + kzgCommitment: blobscommitmentsandproofs.kzgCommitments[4], + kzgProof: blobscommitmentsandproofs.kzgProofs[4], + signedBlockHeader: blockheader, + kzgCommitmentInclusionProof: computeInclusionProof(ForkName.deneb, signedBlock.message.body, 4), + }, + ]; + + const blockData = { + fork: ForkName.deneb as ForkBlobs, + blobs: allBlobs, + blobsBytes: [null, null, null, null, null], + blobsSource: BlobsSource.byRoot, + }; + const resolvedBlobs = getBlockInput.availableData(config, signedBlock, BlockSource.byRoot, null, blockData); + + const engineReqIdentifiers = [...blobscommitmentsandproofs.blobVersionedHashes]; + // versionedHashes: 1,2,4 + engineReqIdentifiers.splice(2, 2); + expect(result).toBeDefined(); + expect(executionEngine.getBlobs).toHaveBeenCalledWith("deneb", engineReqIdentifiers); + expect(result).toEqual(resolvedBlobs); + }); +}); + +type BlockInputCacheType = { + fork: ForkName; + block?: SignedBeaconBlock; + blockBytes?: Uint8Array | null; + cachedData?: CachedData; + // block promise and its callback cached for delayed resolution + blockInputPromise: Promise; + resolveBlockInput: (blockInput: BlockInput) => void; +}; + +function getEmptyBlockInputCacheEntry(fork: ForkName): BlockInputCacheType { + // Capture both the promise and its callbacks for blockInput and final availability + // It is not spec'ed but in tests in Firefox and NodeJS the promise constructor is run immediately + let resolveBlockInput: ((block: BlockInput) => void) | null = null; + const blockInputPromise = new Promise((resolveCB) => { + resolveBlockInput = resolveCB; + }); + if (resolveBlockInput === null) { + throw Error("Promise Constructor was not executed immediately"); + } + if (!isForkBlobs(fork)) { + return {fork, blockInputPromise, resolveBlockInput}; + } + + let resolveAvailability: ((blobs: BlockInputDataBlobs) => void) | null = null; + const availabilityPromise = new Promise((resolveCB) => { + resolveAvailability = resolveCB; + }); + + if (resolveAvailability === null) { + throw Error("Promise Constructor was not executed immediately"); + } + + const blobsCache = new Map(); + const cachedData: CachedData = {fork, blobsCache, availabilityPromise, resolveAvailability}; + return {fork, blockInputPromise, resolveBlockInput, cachedData}; +} + +function generateBlobs(count: number): { + blobs: Uint8Array[]; + kzgCommitments: Uint8Array[]; + blobVersionedHashes: Uint8Array[]; + kzgProofs: Uint8Array[]; +} { + const blobs = Array.from({length: count}, (_, index) => generateRandomBlob(index)); + const kzgCommitments = blobs.map((blob) => ckzg.blobToKzgCommitment(blob)); + const versionedHash = kzgCommitments.map((kzgCommitment) => kzgCommitmentToVersionedHash(kzgCommitment)); + const kzgProofs = blobs.map((blob, index) => ckzg.computeBlobKzgProof(blob, kzgCommitments[index])); + + return { + blobs, + kzgCommitments, + blobVersionedHashes: versionedHash.map((hash) => hash), + kzgProofs, + }; +} + +function generateRandomBlob(index: number): deneb.Blob { + const blob = new Uint8Array(FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT); + const dv = new DataView(blob.buffer, blob.byteOffset, blob.byteLength); + + for (let i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) { + // Generate a unique value based on the index + dv.setUint32(i * BYTES_PER_FIELD_ELEMENT, index + i); + } + return blob; +} diff --git a/packages/types/src/deneb/types.ts b/packages/types/src/deneb/types.ts index 7ee6648aeaf2..1bbabd0e4285 100644 --- a/packages/types/src/deneb/types.ts +++ b/packages/types/src/deneb/types.ts @@ -51,3 +51,7 @@ export type ProducedBlobSidecars = Omit; export type SignedBlockContents = ValueOf; export type Contents = Omit; +export type BlobAndProof = { + blob: Blob; + proof: KZGProof; +}; From e2c45b9ca597fa1d2d8101a0c7da725b810acf97 Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Thu, 7 Nov 2024 12:25:24 +0800 Subject: [PATCH 07/48] chore: revert async aggregate with randomness (#7218) Revert "feat: asyncAggregateWithRandomness (#7204)" This reverts commit e31d535bb59d209827cbab61cb4381dccac90171. --- packages/beacon-node/package.json | 2 +- .../src/chain/bls/multithread/index.ts | 2 +- .../src/chain/bls/multithread/jobItem.ts | 18 +++-- .../src/metrics/metrics/lodestar.ts | 5 ++ packages/cli/package.json | 2 +- packages/flare/package.json | 2 +- packages/state-transition/package.json | 2 +- packages/test-utils/package.json | 2 +- packages/validator/package.json | 2 +- yarn.lock | 78 +++++++++---------- 10 files changed, 64 insertions(+), 51 deletions(-) diff --git a/packages/beacon-node/package.json b/packages/beacon-node/package.json index 450c6e119023..fcaf5b715216 100644 --- a/packages/beacon-node/package.json +++ b/packages/beacon-node/package.json @@ -95,7 +95,7 @@ }, "dependencies": { "@chainsafe/as-sha256": "^0.5.0", - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@chainsafe/discv5": "^9.0.0", "@chainsafe/enr": "^3.0.0", "@chainsafe/libp2p-gossipsub": "^13.0.0", diff --git a/packages/beacon-node/src/chain/bls/multithread/index.ts b/packages/beacon-node/src/chain/bls/multithread/index.ts index 4b1867c3793f..74e2dbbca4f7 100644 --- a/packages/beacon-node/src/chain/bls/multithread/index.ts +++ b/packages/beacon-node/src/chain/bls/multithread/index.ts @@ -394,7 +394,7 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier { try { // Note: This can throw, must be handled per-job. // Pubkey and signature aggregation is defered here - workReq = await jobItemWorkReq(job, this.metrics); + workReq = jobItemWorkReq(job, this.metrics); } catch (e) { this.metrics?.blsThreadPool.errorAggregateSignatureSetsCount.inc({type: job.type}); diff --git a/packages/beacon-node/src/chain/bls/multithread/jobItem.ts b/packages/beacon-node/src/chain/bls/multithread/jobItem.ts index efaaf36fd88f..9f0c74fbcf32 100644 --- a/packages/beacon-node/src/chain/bls/multithread/jobItem.ts +++ b/packages/beacon-node/src/chain/bls/multithread/jobItem.ts @@ -1,4 +1,4 @@ -import {PublicKey, asyncAggregateWithRandomness} from "@chainsafe/blst"; +import {PublicKey, aggregateWithRandomness} from "@chainsafe/blst"; import {ISignatureSet, SignatureSetType} from "@lodestar/state-transition"; import {Metrics} from "../../../metrics/metrics.js"; import {LinkedList} from "../../../util/array.js"; @@ -48,7 +48,7 @@ export function jobItemSigSets(job: JobQueueItem): number { * Prepare BlsWorkReq from JobQueueItem * WARNING: May throw with untrusted user input */ -export async function jobItemWorkReq(job: JobQueueItem, metrics: Metrics | null): Promise { +export function jobItemWorkReq(job: JobQueueItem, metrics: Metrics | null): BlsWorkReq { switch (job.type) { case JobQueueItemType.default: return { @@ -61,9 +61,17 @@ export async function jobItemWorkReq(job: JobQueueItem, metrics: Metrics | null) })), }; case JobQueueItemType.sameMessage: { - const {pk, sig} = await asyncAggregateWithRandomness( - job.sets.map((set) => ({pk: set.publicKey, sig: set.signature})) - ); + // This is slow code on main thread (mainly signature deserialization + group check). + // Ideally it can be taken off-thread, but in the mean time, keep track of total time spent here. + // As of July 2024, for a node subscribing to all subnets, with 1 signature per validator per epoch, + // it takes around 2.02 min to perform this operation for a single epoch. + // cpu profile on main thread has 250s idle so this only works until we reach 3M validators + // However, for normal node with only 2 to 7 subnet subscriptions per epoch this works until 27M validators + // and not a problem in the near future + // this is monitored on v1.21.0 https://github.com/ChainSafe/lodestar/pull/6894/files#r1687359225 + const timer = metrics?.blsThreadPool.aggregateWithRandomnessMainThreadDuration.startTimer(); + const {pk, sig} = aggregateWithRandomness(job.sets.map((set) => ({pk: set.publicKey, sig: set.signature}))); + timer?.(); return { opts: job.opts, diff --git a/packages/beacon-node/src/metrics/metrics/lodestar.ts b/packages/beacon-node/src/metrics/metrics/lodestar.ts index c138a8dfe26a..af8d87daa246 100644 --- a/packages/beacon-node/src/metrics/metrics/lodestar.ts +++ b/packages/beacon-node/src/metrics/metrics/lodestar.ts @@ -497,6 +497,11 @@ export function createLodestarMetrics( name: "lodestar_bls_thread_pool_batchable_sig_sets_total", help: "Count of total batchable signature sets", }), + aggregateWithRandomnessMainThreadDuration: register.histogram({ + name: "lodestar_bls_thread_pool_aggregate_with_randomness_main_thread_time_seconds", + help: "Total time performing aggregateWithRandomness on main thread", + buckets: [0.001, 0.005, 0.01, 0.1], + }), pubkeysAggregationMainThreadDuration: register.histogram({ name: "lodestar_bls_thread_pool_pubkeys_aggregation_main_thread_time_seconds", help: "Total time spent aggregating pubkeys on main thread", diff --git a/packages/cli/package.json b/packages/cli/package.json index 40a58a43c754..3634ccd84424 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -53,7 +53,7 @@ "dependencies": { "@chainsafe/bls-keygen": "^0.4.0", "@chainsafe/bls-keystore": "^3.1.0", - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@chainsafe/discv5": "^9.0.0", "@chainsafe/enr": "^3.0.0", "@chainsafe/persistent-merkle-tree": "^0.8.0", diff --git a/packages/flare/package.json b/packages/flare/package.json index 0c073c431f38..f8bd37f5abb5 100644 --- a/packages/flare/package.json +++ b/packages/flare/package.json @@ -59,7 +59,7 @@ ], "dependencies": { "@chainsafe/bls-keygen": "^0.4.0", - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@lodestar/api": "^1.22.0", "@lodestar/config": "^1.22.0", "@lodestar/params": "^1.22.0", diff --git a/packages/state-transition/package.json b/packages/state-transition/package.json index a836d742eb8e..80a6cf45c28f 100644 --- a/packages/state-transition/package.json +++ b/packages/state-transition/package.json @@ -59,7 +59,7 @@ "types": "lib/index.d.ts", "dependencies": { "@chainsafe/as-sha256": "^0.5.0", - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@chainsafe/persistent-merkle-tree": "^0.8.0", "@chainsafe/persistent-ts": "^0.19.1", "@chainsafe/ssz": "^0.18.0", diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index dbb15817cd2a..1b18c3b5a33e 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -58,7 +58,7 @@ ], "dependencies": { "@chainsafe/bls-keystore": "^3.1.0", - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@lodestar/params": "^1.22.0", "@lodestar/utils": "^1.22.0", "axios": "^1.3.4", diff --git a/packages/validator/package.json b/packages/validator/package.json index 7cd6f06a626b..a781d62b0111 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -45,7 +45,7 @@ "blockchain" ], "dependencies": { - "@chainsafe/blst": "^2.2.0", + "@chainsafe/blst": "^2.1.0", "@chainsafe/ssz": "^0.18.0", "@lodestar/api": "^1.22.0", "@lodestar/config": "^1.22.0", diff --git a/yarn.lock b/yarn.lock index 846335c80676..a9cb9ebe4fdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -399,40 +399,40 @@ "@chainsafe/bls-keygen" "^0.4.0" bls-eth-wasm "^0.4.8" -"@chainsafe/blst-darwin-arm64@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-darwin-arm64/-/blst-darwin-arm64-2.2.0.tgz#0ab9083805c308106c2f2107df1e6376d9190b1b" - integrity sha512-BOOy2KHbV028cioPWaAMqHdLRKd6/3XyEmUEcQC2E/SpyYLdNcaKiBUYIU4pT9CrWBbJJxX68UI+3vZVg0M8/w== +"@chainsafe/blst-darwin-arm64@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-darwin-arm64/-/blst-darwin-arm64-2.1.0.tgz#8871d62dc0402df30adbd6f52fbbd02d59f3c5ff" + integrity sha512-7iPRlSbQxEZ2AblmkFLuhnVPUipvA0UenEaUCaLC1MhGFpSwy5bSrF8Krs/E++GN3p2LVz7ZH3tlDfFL0z1EvQ== -"@chainsafe/blst-darwin-x64@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-darwin-x64/-/blst-darwin-x64-2.2.0.tgz#231943a7736f3f89d35e03fec890b7809c98ff1a" - integrity sha512-jG64cwIdPT7u/haRrW26tWCpfMfHBQCfGY169mFQifCwO4VEwvaiVBPOh5olFis6LjpcmD+O0jpM8GqrnsmUHQ== +"@chainsafe/blst-darwin-x64@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-darwin-x64/-/blst-darwin-x64-2.1.0.tgz#8fe58d92b72b1b872f8b687a0aad8beda3e09072" + integrity sha512-aeoidOpOYVmRFeHVm1p/Axd6CfqWpr6SIift216/HTDBTiuJCGSJqHzk9RHf7gzkr6WtxO7g/6AtkagZA2VPFg== -"@chainsafe/blst-linux-arm64-gnu@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-arm64-gnu/-/blst-linux-arm64-gnu-2.2.0.tgz#721aeec63e8e02aba3358a0084c095403a5438fa" - integrity sha512-L8xV2uuLn8we76vdzfryS9ePdheuZrmY6yArGUFaF1Uzcwml6V1/VvyPl9/uooo/YfVRIrvF/D+lQfI2GFAnhw== +"@chainsafe/blst-linux-arm64-gnu@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-arm64-gnu/-/blst-linux-arm64-gnu-2.1.0.tgz#323789a10679cf81813b1e664ef4187a2e941cff" + integrity sha512-d2zgqoJOqkWg2sZbNR7pv8f+oYPOJmnMu46Uulm6NkW3iYNZIc2KkVjBXGYk7xJ+U8ZEzb7KZ7gRB9315sWBcg== -"@chainsafe/blst-linux-arm64-musl@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-arm64-musl/-/blst-linux-arm64-musl-2.2.0.tgz#dbbabaab93156548c86e2b2b3a1d27160b715000" - integrity sha512-0Vn0luxLYVgC3lvWT1MapFHSAoz99PldqjhilXTGv0AcAk/X5LXPH2RC9Dp2KJGqthyUkpbk1j47jUBfBI+BIg== +"@chainsafe/blst-linux-arm64-musl@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-arm64-musl/-/blst-linux-arm64-musl-2.1.0.tgz#4a308d6b1f71a57a6ecc6cc0531746f5cd8ae3d0" + integrity sha512-w+KiL8ViLXigZVS++tdCwnMBnbc4HXb8claKOnlCppE1rAeF0Dt186AU2TRpqOop3QoOqckqvsguR9iQwZlTUw== -"@chainsafe/blst-linux-x64-gnu@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-x64-gnu/-/blst-linux-x64-gnu-2.2.0.tgz#9f8ab825621b75227c75bb75d369d3d42e91fa74" - integrity sha512-gEY/z2SDBA7kXtFEI9VNhWTJAIjx16jdeAyCaS2k4ACGurWZaWk+Ee4KniTsr4WieSqeuNTUr7Pdja0Sr4EKNQ== +"@chainsafe/blst-linux-x64-gnu@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-x64-gnu/-/blst-linux-x64-gnu-2.1.0.tgz#c015f9f25aab10bba7720518ba9dc19bb850dcc3" + integrity sha512-2xdOIkkJTvi+/gUoiPQO+p+2o19pixLsH5BOrwxY+EABLL6wxZ82w5LatV3x27YJTk7PbAlyT36n7CjmzaZ/tw== -"@chainsafe/blst-linux-x64-musl@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-x64-musl/-/blst-linux-x64-musl-2.2.0.tgz#11e99ac12b0f83cad68da56f4e9cfc4aa403a2e6" - integrity sha512-58GKtiUmtVSuerRzPEcMNQZpICPboBKFnL7+1Wo+PSuajkvbae7tEFrFTtWeMoKIPgOEsPMnk96LF+0yNgavUg== +"@chainsafe/blst-linux-x64-musl@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-linux-x64-musl/-/blst-linux-x64-musl-2.1.0.tgz#da4ac690cc3b59bc21c4578d30502490c044f7fb" + integrity sha512-/ddO38KkTTgTmXBLAubU1fjUWcQy90sdUi0IoRm5RprdpXvTSGZ1m8XrcxwEYkUO+KpnacOuU0UDwerHMJl4DA== -"@chainsafe/blst-win32-x64-msvc@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst-win32-x64-msvc/-/blst-win32-x64-msvc-2.2.0.tgz#f32b164721ff5edc279f6d6cd0fffde0ad2fe16c" - integrity sha512-UFrZshl4dfX5Uh2zeKXAZtrkQ+otczHMON2tsrapQNICWmfHZrzE6pKuBL+9QeGAbgflwpbz7+D5nQRDpiuHxQ== +"@chainsafe/blst-win32-x64-msvc@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst-win32-x64-msvc/-/blst-win32-x64-msvc-2.1.0.tgz#edaff899194caa4e40901af90779721673671631" + integrity sha512-wSRVGoLrluus38fmYYS0ft3VSG2EaeeWvb7yxvrAS8xUsaRFRClYo/3kaEHR3D9B9Nu5wiuWfob6DoM3w9deLw== "@chainsafe/blst@^0.2.0": version "0.2.11" @@ -443,18 +443,18 @@ node-fetch "^2.6.1" node-gyp "^8.4.0" -"@chainsafe/blst@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@chainsafe/blst/-/blst-2.2.0.tgz#ced8b861b94934e3c1c53e173c3e1205d775d93b" - integrity sha512-VBaQoNE2a9d9+skAjQKv3Suk0yGKqp3mZM0YWYJNPj/Ae/f6lAyeVSgKqo2LrsNQBzD/LqrJLKUY8rJT3vDKLA== +"@chainsafe/blst@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@chainsafe/blst/-/blst-2.1.0.tgz#1df4fa8e390db5c3cceed673b57468e23b4da36f" + integrity sha512-oY5k4whglgVOkisfujO0s1QgCOp3N/J3GogRbHhuNLrf6KN0zs1C3pKHg66EQhQqWVYnFY2Shx2s71/NFD7y+A== optionalDependencies: - "@chainsafe/blst-darwin-arm64" "2.2.0" - "@chainsafe/blst-darwin-x64" "2.2.0" - "@chainsafe/blst-linux-arm64-gnu" "2.2.0" - "@chainsafe/blst-linux-arm64-musl" "2.2.0" - "@chainsafe/blst-linux-x64-gnu" "2.2.0" - "@chainsafe/blst-linux-x64-musl" "2.2.0" - "@chainsafe/blst-win32-x64-msvc" "2.2.0" + "@chainsafe/blst-darwin-arm64" "2.1.0" + "@chainsafe/blst-darwin-x64" "2.1.0" + "@chainsafe/blst-linux-arm64-gnu" "2.1.0" + "@chainsafe/blst-linux-arm64-musl" "2.1.0" + "@chainsafe/blst-linux-x64-gnu" "2.1.0" + "@chainsafe/blst-linux-x64-musl" "2.1.0" + "@chainsafe/blst-win32-x64-msvc" "2.1.0" "@chainsafe/discv5@^9.0.0": version "9.0.0" From 2e8b8bb4781c703704a163596a7e851281b0b7af Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 8 Nov 2024 14:23:45 +0800 Subject: [PATCH 08/48] fix: update config for relaunched mekong network (#7220) --- packages/cli/src/networks/mekong.ts | 240 +++++++++--------- .../config/src/chainConfig/networks/mekong.ts | 19 +- 2 files changed, 134 insertions(+), 125 deletions(-) diff --git a/packages/cli/src/networks/mekong.ts b/packages/cli/src/networks/mekong.ts index 44b45cd8d7ea..62ac8bf89292 100644 --- a/packages/cli/src/networks/mekong.ts +++ b/packages/cli/src/networks/mekong.ts @@ -7,124 +7,124 @@ export const bootnodesFileUrl = "https://raw.githubusercontent.com/ethpandaops/mekong-devnets/master/network-configs/devnet-0/metadata/bootstrap_nodes.txt"; export const bootEnrs = [ - "enr:-Iq4QNDvMuJuQDFx0NERRjcJzjUlpv-MG5ea22uVCNtFbBAbYdQXcL2ylwiZYKVR4ARyHL-ZIFQ45J3UdM3bCVPzTIaGAZLeJx23gmlkgnY0gmlwhJ3m4Z6Jc2VjcDI1NmsxoQJJ3h8aUO3GJHv-bdvHtsQZ2OEisutelYfGjXO4lSg8BYN1ZHCCIzI", - "enr:-LK4QNmKwqyvCkLGM2MC8dnIE5Mg_j3PvEztzwAbRT2rwa97RCjVvEApmk6E6Tcrfae-jicCz646GX0B46Ksgfk9jY4Eh2F0dG5ldHOIYAAAAAAAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJ3m4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msxoQL0hy3fyx2QhB-qxvdBIB1RqBIXwEcpNAspkyMESe-Ds4N0Y3CCIyiDdWRwgiMo", + "enr:-LK4QMjMMPjyls4JEnYlNcQi7k9j66Z6aDvmyLGh-MmK6Do_CncBF2dTEvrXJPcbDgIrpFrImsyw6tF4YUzO0OhHaGYEh2F0dG5ldHOIwAAAAAAAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJ3m4YuJc2VjcDI1NmsxoQLP3iDQVX979MeG4JUG5TEEOfcBDq4DL6IwV_vMO-iMsIN0Y3CCIyiDdWRwgiMo", + "enr:-LK4QPNn6P_ydDEeOPMp77RH7NHZtEdFstujjbM_mg9N9mHDEGaAim7qZo5jWgMC1HZpf0c4-tf0Y6eFkDdw9EbhPlAEh2F0dG5ldHOIAAAAwAAAAACEZXRoMpDY3UMGYGN2JAABAAAAAAAAgmlkgnY0gmlwhJgq582Jc2VjcDI1NmsxoQN2tk0LwZ9dacFxiUApBGnqfHwLTiOjtC8Kstlel29Xw4N0Y3CCIyiDdWRwgiMo", ]; diff --git a/packages/config/src/chainConfig/networks/mekong.ts b/packages/config/src/chainConfig/networks/mekong.ts index 191d801e22b2..194956c0d6c0 100644 --- a/packages/config/src/chainConfig/networks/mekong.ts +++ b/packages/config/src/chainConfig/networks/mekong.ts @@ -13,21 +13,21 @@ export const mekongChainConfig: ChainConfig = { // Genesis // --------------------------------------------------------------- MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 100000, - MIN_GENESIS_TIME: 1730372340, - GENESIS_FORK_VERSION: b("0x10000000"), + MIN_GENESIS_TIME: 1730822340, // 2024-Nov-05 03:59:00 PM UTC + GENESIS_FORK_VERSION: b("0x10637624"), GENESIS_DELAY: 60, // Forking // --------------------------------------------------------------- // # Altair - ALTAIR_FORK_VERSION: b("0x20000000"), + ALTAIR_FORK_VERSION: b("0x20637624"), ALTAIR_FORK_EPOCH: 0, // # Merge - BELLATRIX_FORK_VERSION: b("0x30000000"), + BELLATRIX_FORK_VERSION: b("0x30637624"), BELLATRIX_FORK_EPOCH: 0, TERMINAL_TOTAL_DIFFICULTY: BigInt("0"), // Capella - CAPELLA_FORK_VERSION: b("0x40000000"), + CAPELLA_FORK_VERSION: b("0x40637624"), CAPELLA_FORK_EPOCH: 0, // Deneb DENEB_FORK_VERSION: b("0x50637624"), @@ -36,6 +36,15 @@ export const mekongChainConfig: ChainConfig = { ELECTRA_FORK_VERSION: b("0x60637624"), ELECTRA_FORK_EPOCH: 256, + // Time parameters + // --------------------------------------------------------------- + MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 2, + + // Validator cycle + // --------------------------------------------------------------- + EJECTION_BALANCE: 30000000000, + CHURN_LIMIT_QUOTIENT: 128, + // Deposit contract // --------------------------------------------------------------- DEPOSIT_CHAIN_ID: 7078815900, From 10d15dce1f62eaa0e5570f6790827f2c091c616d Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:04:55 +0800 Subject: [PATCH 09/48] fix: light client generating `LightClientUpdate` with wrong length of branches (#7187) * initial commit * Rewrite SyncCommitteeWitnessRepository * Fix finality branch * Update unit test * fix e2e * Review PR --------- Co-authored-by: Nico Flaig --- .../src/chain/lightClient/index.ts | 28 ++++- .../src/chain/lightClient/proofs.ts | 54 ++++++--- .../src/chain/lightClient/types.ts | 2 +- .../lightclientSyncCommitteeWitness.ts | 55 ++++++++- .../test/unit/chain/lightclient/proof.test.ts | 107 +++++++++++++++--- packages/light-client/src/spec/index.ts | 4 +- packages/light-client/src/spec/utils.ts | 10 +- packages/light-client/src/validation.ts | 13 ++- packages/types/src/utils/typeguards.ts | 11 ++ 9 files changed, 240 insertions(+), 44 deletions(-) diff --git a/packages/beacon-node/src/chain/lightClient/index.ts b/packages/beacon-node/src/chain/lightClient/index.ts index 94dadbd2a646..57a26a4f267a 100644 --- a/packages/beacon-node/src/chain/lightClient/index.ts +++ b/packages/beacon-node/src/chain/lightClient/index.ts @@ -16,6 +16,7 @@ import { SYNC_COMMITTEE_SIZE, forkLightClient, highestFork, + isForkPostElectra, } from "@lodestar/params"; import { CachedBeaconStateAltair, @@ -38,6 +39,7 @@ import { Slot, SyncPeriod, altair, + electra, phase0, ssz, sszTypesFor, @@ -46,6 +48,7 @@ import {Logger, MapDef, pruneSetToMax, toRootHex} from "@lodestar/utils"; import {ZERO_HASH} from "../../constants/index.js"; import {IBeaconDb} from "../../db/index.js"; +import {NUM_WITNESS, NUM_WITNESS_ELECTRA} from "../../db/repositories/lightclientSyncCommitteeWitness.js"; import {Metrics} from "../../metrics/index.js"; import {byteArrayEquals} from "../../util/bytes.js"; import {ChainEventEmitter} from "../emitter.js"; @@ -208,7 +211,10 @@ export class LightClientServer { private checkpointHeaders = new Map(); private latestHeadUpdate: LightClientOptimisticUpdate | null = null; - private readonly zero: Pick; + private readonly zero: Pick< + altair.LightClientUpdate | electra.LightClientUpdate, + "finalityBranch" | "finalizedHeader" + >; private finalized: LightClientFinalityUpdate | null = null; constructor( @@ -225,7 +231,9 @@ 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(), + // Electra finalityBranch has fixed length of 5 whereas altair has 4. The fifth element will be ignored + // when serializing as altair LightClientUpdate + finalityBranch: ssz.electra.LightClientUpdate.fields.finalityBranch.defaultValue(), }; if (metrics) { @@ -388,12 +396,13 @@ export class LightClientServer { parentBlockSlot: Slot ): Promise { const blockSlot = block.slot; - const header = blockToLightClientHeader(this.config.getForkName(blockSlot), block); + const fork = this.config.getForkName(blockSlot); + const header = blockToLightClientHeader(fork, block); const blockRoot = ssz.phase0.BeaconBlockHeader.hashTreeRoot(header.beacon); const blockRootHex = toRootHex(blockRoot); - const syncCommitteeWitness = getSyncCommitteesWitness(postState); + const syncCommitteeWitness = getSyncCommitteesWitness(fork, postState); // Only store current sync committee once per run if (!this.storedCurrentSyncCommittee) { @@ -621,6 +630,16 @@ export class LightClientServer { if (!syncCommitteeWitness) { throw Error(`syncCommitteeWitness not available at ${toRootHex(attestedData.blockRoot)}`); } + + const attestedFork = this.config.getForkName(attestedHeader.beacon.slot); + const numWitness = syncCommitteeWitness.witness.length; + if (isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS_ELECTRA) { + throw Error(`Expected ${NUM_WITNESS_ELECTRA} witnesses in post-Electra numWitness=${numWitness}`); + } + if (!isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS) { + throw Error(`Expected ${NUM_WITNESS} witnesses in pre-Electra numWitness=${numWitness}`); + } + const nextSyncCommittee = await this.db.syncCommittee.get(syncCommitteeWitness.nextSyncCommitteeRoot); if (!nextSyncCommittee) { throw Error("nextSyncCommittee not available"); @@ -641,7 +660,6 @@ export class LightClientServer { finalityBranch = attestedData.finalityBranch; finalizedHeader = finalizedHeaderAttested; // Fork of LightClientUpdate is based off on attested header's fork - const attestedFork = this.config.getForkName(attestedHeader.beacon.slot); if (this.config.getForkName(finalizedHeader.beacon.slot) !== attestedFork) { finalizedHeader = upgradeLightClientHeader(this.config, attestedFork, finalizedHeader); } diff --git a/packages/beacon-node/src/chain/lightClient/proofs.ts b/packages/beacon-node/src/chain/lightClient/proofs.ts index d4380e66255f..fe8ca7881a76 100644 --- a/packages/beacon-node/src/chain/lightClient/proofs.ts +++ b/packages/beacon-node/src/chain/lightClient/proofs.ts @@ -4,29 +4,55 @@ import { FINALIZED_ROOT_GINDEX, FINALIZED_ROOT_GINDEX_ELECTRA, ForkExecution, + ForkName, + isForkPostElectra, } from "@lodestar/params"; import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {BeaconBlockBody, SSZTypesFor, ssz} from "@lodestar/types"; import {SyncCommitteeWitness} from "./types.js"; -export function getSyncCommitteesWitness(state: BeaconStateAllForks): SyncCommitteeWitness { +export function getSyncCommitteesWitness(fork: ForkName, state: BeaconStateAllForks): SyncCommitteeWitness { state.commit(); const n1 = state.node; - const n3 = n1.right; // [1]0110 - const n6 = n3.left; // 1[0]110 - const n13 = n6.right; // 10[1]10 - const n27 = n13.right; // 101[1]0 - const currentSyncCommitteeRoot = n27.left.root; // n54 1011[0] - const nextSyncCommitteeRoot = n27.right.root; // n55 1011[1] + let witness: Uint8Array[]; + let currentSyncCommitteeRoot: Uint8Array; + let nextSyncCommitteeRoot: Uint8Array; - // Witness branch is sorted by descending gindex - const witness = [ - n13.left.root, // 26 - n6.left.root, // 12 - n3.right.root, // 7 - n1.left.root, // 2 - ]; + if (isForkPostElectra(fork)) { + const n2 = n1.left; + const n5 = n2.right; + const n10 = n5.left; + const n21 = n10.right; + const n43 = n21.right; + + currentSyncCommitteeRoot = n43.left.root; // n86 + nextSyncCommitteeRoot = n43.right.root; // n87 + + // Witness branch is sorted by descending gindex + witness = [ + n21.left.root, // 42 + n10.left.root, // 20 + n5.right.root, // 11 + n2.left.root, // 4 + n1.right.root, // 3 + ]; + } else { + const n3 = n1.right; // [1]0110 + const n6 = n3.left; // 1[0]110 + const n13 = n6.right; // 10[1]10 + const n27 = n13.right; // 101[1]0 + currentSyncCommitteeRoot = n27.left.root; // n54 1011[0] + nextSyncCommitteeRoot = n27.right.root; // n55 1011[1] + + // Witness branch is sorted by descending gindex + witness = [ + n13.left.root, // 26 + n6.left.root, // 12 + n3.right.root, // 7 + n1.left.root, // 2 + ]; + } return { witness, diff --git a/packages/beacon-node/src/chain/lightClient/types.ts b/packages/beacon-node/src/chain/lightClient/types.ts index b253c05d45fb..b9723df501b3 100644 --- a/packages/beacon-node/src/chain/lightClient/types.ts +++ b/packages/beacon-node/src/chain/lightClient/types.ts @@ -26,7 +26,7 @@ * ``` */ export type SyncCommitteeWitness = { - /** Vector[Bytes32, 4] */ + /** Vector[Bytes32, 4] or Vector[Bytes32, 5] depending on the fork */ witness: Uint8Array[]; currentSyncCommitteeRoot: Uint8Array; nextSyncCommitteeRoot: Uint8Array; diff --git a/packages/beacon-node/src/db/repositories/lightclientSyncCommitteeWitness.ts b/packages/beacon-node/src/db/repositories/lightclientSyncCommitteeWitness.ts index 45f91f159997..e323c3e55f61 100644 --- a/packages/beacon-node/src/db/repositories/lightclientSyncCommitteeWitness.ts +++ b/packages/beacon-node/src/db/repositories/lightclientSyncCommitteeWitness.ts @@ -5,6 +5,15 @@ import {ssz} from "@lodestar/types"; import {SyncCommitteeWitness} from "../../chain/lightClient/types.js"; import {Bucket, getBucketNameByValue} from "../buckets.js"; +// We add a 1-byte prefix where 0 means pre-electra and 1 means post-electra +enum PrefixByte { + PRE_ELECTRA = 0, + POST_ELECTRA = 1, +} + +export const NUM_WITNESS = 4; +export const NUM_WITNESS_ELECTRA = 5; + /** * Historical sync committees witness by block root * @@ -13,12 +22,56 @@ import {Bucket, getBucketNameByValue} from "../buckets.js"; export class SyncCommitteeWitnessRepository extends Repository { constructor(config: ChainForkConfig, db: DatabaseController) { const bucket = Bucket.lightClient_syncCommitteeWitness; + // Pick some type but won't be used. Witness can be 4 or 5 so need to handle dynamically const type = new ContainerType({ - witness: new VectorCompositeType(ssz.Root, 4), + witness: new VectorCompositeType(ssz.Root, NUM_WITNESS), currentSyncCommitteeRoot: ssz.Root, nextSyncCommitteeRoot: ssz.Root, }); super(config, db, bucket, type, getBucketNameByValue(bucket)); } + + // Overrides for multi-fork + encodeValue(value: SyncCommitteeWitness): Uint8Array { + const numWitness = value.witness.length; + + if (numWitness !== NUM_WITNESS && numWitness !== NUM_WITNESS_ELECTRA) { + throw Error(`Number of witness can only be 4 pre-electra or 5 post-electra numWitness=${numWitness}`); + } + + const type = new ContainerType({ + witness: new VectorCompositeType(ssz.Root, numWitness), + currentSyncCommitteeRoot: ssz.Root, + nextSyncCommitteeRoot: ssz.Root, + }); + + const valueBytes = type.serialize(value); + + // We need to differentiate between post-electra and pre-electra witness + // such that we can deserialize correctly + const isPostElectra = numWitness === NUM_WITNESS_ELECTRA; + const prefixByte = new Uint8Array(1); + prefixByte[0] = isPostElectra ? PrefixByte.POST_ELECTRA : PrefixByte.PRE_ELECTRA; + + const prefixedData = new Uint8Array(1 + valueBytes.length); + prefixedData.set(prefixByte, 0); + prefixedData.set(valueBytes, 1); + + return prefixedData; + } + + decodeValue(data: Uint8Array): SyncCommitteeWitness { + // First byte is written + const prefix = data.subarray(0, 1); + const isPostElectra = prefix[0] === PrefixByte.POST_ELECTRA; + + const type = new ContainerType({ + witness: new VectorCompositeType(ssz.Root, isPostElectra ? NUM_WITNESS_ELECTRA : NUM_WITNESS), + currentSyncCommitteeRoot: ssz.Root, + nextSyncCommitteeRoot: ssz.Root, + }); + + return type.deserialize(data.subarray(1)); + } } diff --git a/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts b/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts index 1ae4812ea200..769fe49f690c 100644 --- a/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts +++ b/packages/beacon-node/test/unit/chain/lightclient/proof.test.ts @@ -1,73 +1,146 @@ -import {SYNC_COMMITTEE_SIZE} from "@lodestar/params"; -import {BeaconStateAltair} from "@lodestar/state-transition"; +import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params"; +import {BeaconStateAltair, BeaconStateElectra} from "@lodestar/state-transition"; import {altair, ssz} from "@lodestar/types"; import {hash, verifyMerkleBranch} from "@lodestar/utils"; import {beforeAll, describe, expect, it} from "vitest"; import {getNextSyncCommitteeBranch, getSyncCommitteesWitness} from "../../../../src/chain/lightClient/proofs.js"; +import {NUM_WITNESS, NUM_WITNESS_ELECTRA} from "../../../../src/db/repositories/lightclientSyncCommitteeWitness.js"; const currentSyncCommitteeGindex = 54; const nextSyncCommitteeGindex = 55; const syncCommitteesGindex = 27; +const currentSyncCommitteeGindexElectra = 86; +const nextSyncCommitteeGindexElectra = 87; +const syncCommitteesGindexElectra = 43; describe("chain / lightclient / proof", () => { - let state: BeaconStateAltair; - let stateRoot: Uint8Array; + let stateAltair: BeaconStateAltair; + let stateElectra: BeaconStateElectra; + let stateRootAltair: Uint8Array; + let stateRootElectra: Uint8Array; const currentSyncCommittee = fillSyncCommittee(Buffer.alloc(48, 0xbb)); const nextSyncCommittee = fillSyncCommittee(Buffer.alloc(48, 0xcc)); beforeAll(() => { - state = ssz.altair.BeaconState.defaultViewDU(); - state.currentSyncCommittee = ssz.altair.SyncCommittee.toViewDU(currentSyncCommittee); - state.nextSyncCommittee = ssz.altair.SyncCommittee.toViewDU(nextSyncCommittee); + stateAltair = ssz.altair.BeaconState.defaultViewDU(); + stateAltair.currentSyncCommittee = ssz.altair.SyncCommittee.toViewDU(currentSyncCommittee); + stateAltair.nextSyncCommittee = ssz.altair.SyncCommittee.toViewDU(nextSyncCommittee); // Note: .hashTreeRoot() automatically commits() - stateRoot = state.hashTreeRoot(); + stateRootAltair = stateAltair.hashTreeRoot(); + + stateElectra = ssz.electra.BeaconState.defaultViewDU(); + stateElectra.currentSyncCommittee = ssz.altair.SyncCommittee.toViewDU(currentSyncCommittee); + stateElectra.nextSyncCommittee = ssz.altair.SyncCommittee.toViewDU(nextSyncCommittee); + stateRootElectra = stateElectra.hashTreeRoot(); }); - it("SyncCommittees proof", () => { - const syncCommitteesWitness = getSyncCommitteesWitness(state); + it("SyncCommittees proof altair", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.altair, stateAltair); const syncCommitteesLeaf = hash( syncCommitteesWitness.currentSyncCommitteeRoot, syncCommitteesWitness.nextSyncCommitteeRoot ); + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS); expect( verifyMerkleBranch( syncCommitteesLeaf, syncCommitteesWitness.witness, ...fromGindex(syncCommitteesGindex), - stateRoot + stateRootAltair ) ).toBe(true); }); - it("currentSyncCommittee proof", () => { - const syncCommitteesWitness = getSyncCommitteesWitness(state); + it("currentSyncCommittee proof altair", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.altair, stateAltair); const currentSyncCommitteeBranch = [syncCommitteesWitness.nextSyncCommitteeRoot, ...syncCommitteesWitness.witness]; + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS); expect( verifyMerkleBranch( ssz.altair.SyncCommittee.hashTreeRoot(currentSyncCommittee), currentSyncCommitteeBranch, ...fromGindex(currentSyncCommitteeGindex), - stateRoot + stateRootAltair ) ).toBe(true); }); - it("nextSyncCommittee proof", () => { - const syncCommitteesWitness = getSyncCommitteesWitness(state); + it("nextSyncCommittee proof altair", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.altair, stateAltair); const nextSyncCommitteeBranch = getNextSyncCommitteeBranch(syncCommitteesWitness); + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS); expect( verifyMerkleBranch( ssz.altair.SyncCommittee.hashTreeRoot(nextSyncCommittee), nextSyncCommitteeBranch, ...fromGindex(nextSyncCommitteeGindex), - stateRoot + stateRootAltair + ) + ).toBe(true); + }); + + it("SyncCommittees proof electra", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.electra, stateElectra); + const syncCommitteesLeaf = hash( + syncCommitteesWitness.currentSyncCommitteeRoot, + syncCommitteesWitness.nextSyncCommitteeRoot + ); + + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS_ELECTRA); + expect( + verifyMerkleBranch( + syncCommitteesLeaf, + syncCommitteesWitness.witness, + ...fromGindex(syncCommitteesGindexElectra), + stateRootElectra + ) + ).toBe(true); + }); + + it("currentSyncCommittee proof electra", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.electra, stateElectra); + const currentSyncCommitteeBranch = [syncCommitteesWitness.nextSyncCommitteeRoot, ...syncCommitteesWitness.witness]; + + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS_ELECTRA); + expect( + verifyMerkleBranch( + ssz.altair.SyncCommittee.hashTreeRoot(currentSyncCommittee), + currentSyncCommitteeBranch, + ...fromGindex(currentSyncCommitteeGindexElectra), + stateRootElectra + ) + ).toBe(true); + }); + + it("nextSyncCommittee proof electra", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.electra, stateElectra); + const nextSyncCommitteeBranch = getNextSyncCommitteeBranch(syncCommitteesWitness); + + expect( + verifyMerkleBranch( + ssz.altair.SyncCommittee.hashTreeRoot(nextSyncCommittee), + nextSyncCommitteeBranch, + ...fromGindex(nextSyncCommitteeGindexElectra), + stateRootElectra ) ).toBe(true); }); + + it("getSyncCommitteesWitness returns correct number of witness altair", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.altair, stateAltair); + + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS); + }); + + it("getSyncCommitteesWitness returns correct number of witness electra", () => { + const syncCommitteesWitness = getSyncCommitteesWitness(ForkName.electra, stateElectra); + + expect(syncCommitteesWitness.witness.length).toBe(NUM_WITNESS_ELECTRA); + }); }); function fillSyncCommittee(pubkey: Uint8Array): altair.SyncCommittee { diff --git a/packages/light-client/src/spec/index.ts b/packages/light-client/src/spec/index.ts index ff4fe22b28b0..16afebc32db4 100644 --- a/packages/light-client/src/spec/index.ts +++ b/packages/light-client/src/spec/index.ts @@ -10,7 +10,7 @@ import { import {computeSyncPeriodAtSlot} from "../utils/index.js"; import {ProcessUpdateOpts, getSyncCommitteeAtPeriod, processLightClientUpdate} from "./processLightClientUpdate.js"; import {ILightClientStore, LightClientStore, LightClientStoreEvents} from "./store.js"; -import {ZERO_FINALITY_BRANCH, ZERO_HEADER, ZERO_SYNC_COMMITTEE, getZeroSyncCommitteeBranch} from "./utils.js"; +import {ZERO_HEADER, ZERO_SYNC_COMMITTEE, getZeroFinalityBranch, getZeroSyncCommitteeBranch} from "./utils.js"; export {isBetterUpdate, toLightClientUpdateSummary} from "./isBetterUpdate.js"; export type {LightClientUpdateSummary} from "./isBetterUpdate.js"; @@ -51,7 +51,7 @@ export class LightclientSpec { nextSyncCommittee: ZERO_SYNC_COMMITTEE, nextSyncCommitteeBranch: getZeroSyncCommitteeBranch(this.config.getForkName(optimisticUpdate.signatureSlot)), finalizedHeader: {beacon: ZERO_HEADER}, - finalityBranch: ZERO_FINALITY_BRANCH, + finalityBranch: getZeroFinalityBranch(this.config.getForkName(optimisticUpdate.signatureSlot)), syncAggregate: optimisticUpdate.syncAggregate, signatureSlot: optimisticUpdate.signatureSlot, }); diff --git a/packages/light-client/src/spec/utils.ts b/packages/light-client/src/spec/utils.ts index cd0c03fd5b0d..c03f334f284c 100644 --- a/packages/light-client/src/spec/utils.ts +++ b/packages/light-client/src/spec/utils.ts @@ -33,7 +33,6 @@ export const ZERO_HASH = new Uint8Array(32); export const ZERO_PUBKEY = new Uint8Array(48); export const ZERO_SYNC_COMMITTEE = ssz.altair.SyncCommittee.defaultValue(); export const ZERO_HEADER = ssz.phase0.BeaconBlockHeader.defaultValue(); -export const ZERO_FINALITY_BRANCH = Array.from({length: FINALIZED_ROOT_DEPTH}, () => ZERO_HASH); /** From https://notes.ethereum.org/@vbuterin/extended_light_client_protocol#Optimistic-head-determining-function */ const SAFETY_THRESHOLD_FACTOR = 2; @@ -53,6 +52,12 @@ export function getZeroSyncCommitteeBranch(fork: ForkName): Uint8Array[] { return Array.from({length: nextSyncCommitteeDepth}, () => ZERO_HASH); } +export function getZeroFinalityBranch(fork: ForkName): Uint8Array[] { + const finalizedRootDepth = isForkPostElectra(fork) ? FINALIZED_ROOT_DEPTH_ELECTRA : FINALIZED_ROOT_DEPTH; + + return Array.from({length: finalizedRootDepth}, () => ZERO_HASH); +} + export function isSyncCommitteeUpdate(update: LightClientUpdate): boolean { return ( // Fast return for when constructing full LightClientUpdate from partial updates @@ -65,7 +70,8 @@ export function isSyncCommitteeUpdate(update: LightClientUpdate): boolean { export function isFinalityUpdate(update: LightClientUpdate): boolean { return ( // Fast return for when constructing full LightClientUpdate from partial updates - update.finalityBranch !== ZERO_FINALITY_BRANCH && + update.finalityBranch !== + getZeroFinalityBranch(isElectraLightClientUpdate(update) ? ForkName.electra : ForkName.altair) && update.finalityBranch.some((branch) => !byteArrayEquals(branch, ZERO_HASH)) ); } diff --git a/packages/light-client/src/validation.ts b/packages/light-client/src/validation.ts index 22cbf700ed16..d696702307ea 100644 --- a/packages/light-client/src/validation.ts +++ b/packages/light-client/src/validation.ts @@ -6,6 +6,7 @@ import { FINALIZED_ROOT_DEPTH, FINALIZED_ROOT_DEPTH_ELECTRA, FINALIZED_ROOT_INDEX, + FINALIZED_ROOT_INDEX_ELECTRA, MIN_SYNC_COMMITTEE_PARTICIPANTS, NEXT_SYNC_COMMITTEE_DEPTH, NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA, @@ -18,6 +19,7 @@ import { Root, Slot, altair, + isELectraLightClientFinalityUpdate, isElectraLightClientUpdate, ssz, } from "@lodestar/types"; @@ -80,12 +82,19 @@ export function assertValidLightClientUpdate( * Where `hashTreeRoot(state) == update.finalityHeader.stateRoot` */ export function assertValidFinalityProof(update: LightClientFinalityUpdate): void { + const finalizedRootDepth = isELectraLightClientFinalityUpdate(update) + ? FINALIZED_ROOT_DEPTH_ELECTRA + : FINALIZED_ROOT_DEPTH; + const finalizedRootIndex = isELectraLightClientFinalityUpdate(update) + ? FINALIZED_ROOT_INDEX_ELECTRA + : FINALIZED_ROOT_INDEX; + if ( !isValidMerkleBranch( ssz.phase0.BeaconBlockHeader.hashTreeRoot(update.finalizedHeader.beacon), update.finalityBranch, - FINALIZED_ROOT_DEPTH, - FINALIZED_ROOT_INDEX, + finalizedRootDepth, + finalizedRootIndex, update.attestedHeader.beacon.stateRoot ) ) { diff --git a/packages/types/src/utils/typeguards.ts b/packages/types/src/utils/typeguards.ts index d4a27e23d1d6..c212e4726e78 100644 --- a/packages/types/src/utils/typeguards.ts +++ b/packages/types/src/utils/typeguards.ts @@ -10,6 +10,7 @@ import { ExecutionPayload, ExecutionPayloadAndBlobsBundle, ExecutionPayloadHeader, + LightClientFinalityUpdate, LightClientUpdate, SignedBeaconBlock, SignedBeaconBlockOrContents, @@ -80,3 +81,13 @@ export function isElectraLightClientUpdate(update: LightClientUpdate): update is updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA ); } + +export function isELectraLightClientFinalityUpdate( + update: LightClientFinalityUpdate +): update is LightClientFinalityUpdate { + const updatePostElectra = update as LightClientUpdate; + return ( + updatePostElectra.finalityBranch !== undefined && + updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA + ); +} From 0d404f890e36b631ec43b8db192ea9489130f634 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 8 Nov 2024 22:27:21 +0800 Subject: [PATCH 10/48] fix: archive finalized state when shutting down beacon node (#7221) --- packages/beacon-node/src/chain/archiver/archiver.ts | 2 +- packages/beacon-node/src/chain/archiver/interface.ts | 1 + .../chain/archiver/strategies/frequencyStateArchiveStrategy.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/beacon-node/src/chain/archiver/archiver.ts b/packages/beacon-node/src/chain/archiver/archiver.ts index 6d5be3445eb2..6d54a7f64911 100644 --- a/packages/beacon-node/src/chain/archiver/archiver.ts +++ b/packages/beacon-node/src/chain/archiver/archiver.ts @@ -64,7 +64,7 @@ export class Archiver { /** Archive latest finalized state */ async persistToDisk(): Promise { - return this.statesArchiverStrategy.maybeArchiveState(this.chain.forkChoice.getFinalizedCheckpoint()); + return this.statesArchiverStrategy.archiveState(this.chain.forkChoice.getFinalizedCheckpoint()); } private onFinalizedCheckpoint = async (finalized: CheckpointWithHex): Promise => { diff --git a/packages/beacon-node/src/chain/archiver/interface.ts b/packages/beacon-node/src/chain/archiver/interface.ts index 283fef579024..4c9eb27ecbdc 100644 --- a/packages/beacon-node/src/chain/archiver/interface.ts +++ b/packages/beacon-node/src/chain/archiver/interface.ts @@ -44,4 +44,5 @@ export interface StateArchiveStrategy { onCheckpoint(stateRoot: RootHex, metrics?: Metrics | null): Promise; onFinalizedCheckpoint(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise; maybeArchiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise; + archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise; } diff --git a/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts b/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts index 6ae592ce7c63..dca7a8ed1f22 100644 --- a/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts +++ b/packages/beacon-node/src/chain/archiver/strategies/frequencyStateArchiveStrategy.ts @@ -84,7 +84,7 @@ export class FrequencyStateArchiveStrategy implements StateArchiveStrategy { * Archives finalized states from active bucket to archive bucket. * Only the new finalized state is stored to disk */ - private async archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise { + async archiveState(finalized: CheckpointWithHex, metrics?: Metrics | null): Promise { // starting from Mar 2024, the finalized state could be from disk or in memory const finalizedStateOrBytes = await this.regen.getCheckpointStateOrBytes(finalized); const {rootHex} = finalized; From 1fae9689dc2cd57b042aa5af5b19d499b8b42c8c Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:11:40 +0700 Subject: [PATCH 11/48] Fix typo --- docs/README.md | 2 +- types/vitest/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 759ca59d8b03..3ac8fd612325 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,4 +22,4 @@ This command starts a local development server and opens up a browser window. Mo $ yarn build ``` -This command generates static content into the `build` directory and can be served using any static contents hosting service. +This command generates static content into the `build` directory and can be served using any static content hosting service. diff --git a/types/vitest/index.d.ts b/types/vitest/index.d.ts index 297ed11e1904..7cbd5d2edb79 100644 --- a/types/vitest/index.d.ts +++ b/types/vitest/index.d.ts @@ -4,7 +4,7 @@ interface CustomMatchers { toBeValidEpochCommittee(opts: {committeeCount: number; validatorsPerCommittee: number; slotsPerEpoch: number}): R; /** * @deprecated - * We highly recommend to not use this matcher instead use detail test case + * We highly recommend to not use this matcher instead use detailed test case * where you don't need message to explain assertion * * @example @@ -27,7 +27,7 @@ interface CustomMatchers { toBeWithMessage(expected: unknown, message: string): R; /** * @deprecated - * We highly recommend to not use this matcher instead use detail test case with .toEqual + * We highly recommend to not use this matcher instead use detailed test case with .toEqual * where you don't need message to explain assertion * */ toEqualWithMessage(expected: unknown, message: string): R; From b78cb92802cfc12c3a75f33a053055e3db5a7c45 Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:20:52 +0700 Subject: [PATCH 12/48] feat: remove unfinalized pubkey cache (#7230) * Remove unfinalized pubkey cache * lint * Fix unit test --- packages/beacon-node/src/chain/chain.ts | 22 --- .../beacon-node/src/chain/regen/queued.ts | 50 +----- .../chain/stateCache/blockStateCacheImpl.ts | 2 +- .../beacon-node/src/metrics/metrics/beacon.ts | 7 - .../src/metrics/metrics/lodestar.ts | 11 -- .../test/memory/unfinalizedPubkey2Index.ts | 54 ------- .../updateUnfinalizedPubkeys.test.ts | 114 -------------- .../test/sim/electra-interop.test.ts | 31 +--- packages/state-transition/package.json | 3 +- .../state-transition/src/cache/epochCache.ts | 146 +----------------- .../state-transition/src/cache/pubkeyCache.ts | 36 ----- packages/state-transition/src/index.ts | 7 +- packages/state-transition/src/metrics.ts | 5 - .../test/unit/cachedBeaconState.test.ts | 36 +---- yarn.lock | 5 - 15 files changed, 15 insertions(+), 514 deletions(-) delete mode 100644 packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts delete mode 100644 packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts diff --git a/packages/beacon-node/src/chain/chain.ts b/packages/beacon-node/src/chain/chain.ts index 8b9fa0336283..4751770b3bfc 100644 --- a/packages/beacon-node/src/chain/chain.ts +++ b/packages/beacon-node/src/chain/chain.ts @@ -1047,9 +1047,6 @@ export class BeaconChain implements IBeaconChain { metrics.forkChoice.balancesLength.set(forkChoiceMetrics.balancesLength); metrics.forkChoice.nodes.set(forkChoiceMetrics.nodes); metrics.forkChoice.indices.set(forkChoiceMetrics.indices); - - const headState = this.getHeadState(); - metrics.headState.unfinalizedPubkeyCacheSize.set(headState.epochCtx.unfinalizedPubkey2index.size); } private onClockSlot(slot: Slot): void { @@ -1139,27 +1136,8 @@ export class BeaconChain implements IBeaconChain { this.opPool.pruneAll(headBlock, headState); } - const cpEpoch = cp.epoch; - if (headState === null) { this.logger.verbose("Head state is null"); - } else if (cpEpoch >= this.config.ELECTRA_FORK_EPOCH) { - // Get the validator.length from the state at cpEpoch - // We are confident the last element in the list is from headEpoch - // Thus we query from the end of the list. (cpEpoch - headEpoch - 1) is negative number - const pivotValidatorIndex = headState.epochCtx.getValidatorCountAtEpoch(cpEpoch); - - if (pivotValidatorIndex !== undefined) { - // Note EIP-6914 will break this logic - const newFinalizedValidators = headState.epochCtx.unfinalizedPubkey2index.filter( - (index, _pubkey) => index < pivotValidatorIndex - ); - - // Populate finalized pubkey cache and remove unfinalized pubkey cache - if (!newFinalizedValidators.isEmpty()) { - this.regen.updateUnfinalizedPubkeys(newFinalizedValidators); - } - } } // TODO-Electra: Deprecating eth1Data poll requires a check on a finalized checkpoint state. diff --git a/packages/beacon-node/src/chain/regen/queued.ts b/packages/beacon-node/src/chain/regen/queued.ts index 7b812c04dc8d..b5084d593356 100644 --- a/packages/beacon-node/src/chain/regen/queued.ts +++ b/packages/beacon-node/src/chain/regen/queued.ts @@ -1,6 +1,6 @@ import {routes} from "@lodestar/api"; import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice"; -import {CachedBeaconStateAllForks, UnfinalizedPubkeyIndexMap, computeEpochAtSlot} from "@lodestar/state-transition"; +import {CachedBeaconStateAllForks, computeEpochAtSlot} from "@lodestar/state-transition"; import {BeaconBlock, Epoch, RootHex, Slot, phase0} from "@lodestar/types"; import {Logger, toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; @@ -206,54 +206,6 @@ export class QueuedStateRegenerator implements IStateRegenerator { return this.checkpointStateCache.updatePreComputedCheckpoint(rootHex, epoch); } - /** - * Remove `validators` from all unfinalized cache's epochCtx.UnfinalizedPubkey2Index, - * and add them to epochCtx.pubkey2index and epochCtx.index2pubkey - */ - updateUnfinalizedPubkeys(validators: UnfinalizedPubkeyIndexMap): void { - let numStatesUpdated = 0; - const states = this.blockStateCache.getStates(); - const cpStates = this.checkpointStateCache.getStates(); - - // Add finalized pubkeys to all states. - const addTimer = this.metrics?.regenFnAddPubkeyTime.startTimer(); - - // We only need to add pubkeys to any one of the states since the finalized caches is shared globally across all states - const firstState = (states.next().value ?? cpStates.next().value) as CachedBeaconStateAllForks | undefined; - - if (firstState !== undefined) { - firstState.epochCtx.addFinalizedPubkeys(validators, this.metrics?.epochCache ?? undefined); - } else { - this.logger.warn("Attempt to delete finalized pubkey from unfinalized pubkey cache. But no state is available"); - } - - addTimer?.(); - - // Delete finalized pubkeys from unfinalized pubkey cache for all states - const deleteTimer = this.metrics?.regenFnDeletePubkeyTime.startTimer(); - const pubkeysToDelete = Array.from(validators.keys()); - - for (const s of states) { - s.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - numStatesUpdated++; - } - - for (const s of cpStates) { - s.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - numStatesUpdated++; - } - - // Since first state is consumed from the iterator. Will need to perform delete explicitly - if (firstState !== undefined) { - firstState?.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - numStatesUpdated++; - } - - deleteTimer?.(); - - this.metrics?.regenFnNumStatesUpdated.observe(numStatesUpdated); - } - /** * Get the state to run with `block`. * - State after `block.parentRoot` dialed forward to block.slot diff --git a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts index 886f6e386309..f57c9a411923 100644 --- a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts +++ b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts @@ -34,7 +34,7 @@ export class BlockStateCacheImpl implements BlockStateCache { this.maxStates = maxStates; this.cache = new MapTracker(metrics?.stateCache); if (metrics) { - this.metrics = {...metrics.stateCache, ...metrics.epochCache}; + this.metrics = metrics.stateCache; metrics.stateCache.size.addCollect(() => metrics.stateCache.size.set(this.cache.size)); } } diff --git a/packages/beacon-node/src/metrics/metrics/beacon.ts b/packages/beacon-node/src/metrics/metrics/beacon.ts index f572ec0d3c1f..60a49b0b673d 100644 --- a/packages/beacon-node/src/metrics/metrics/beacon.ts +++ b/packages/beacon-node/src/metrics/metrics/beacon.ts @@ -124,13 +124,6 @@ export function createBeaconMetrics(register: RegistryMetricCreator) { }), }, - headState: { - unfinalizedPubkeyCacheSize: register.gauge({ - name: "beacon_head_state_unfinalized_pubkey_cache_size", - help: "Current size of the unfinalizedPubkey2Index cache in the head state", - }), - }, - parentBlockDistance: register.histogram({ name: "beacon_imported_block_parent_distance", help: "Histogram of distance to parent block of valid imported blocks", diff --git a/packages/beacon-node/src/metrics/metrics/lodestar.ts b/packages/beacon-node/src/metrics/metrics/lodestar.ts index af8d87daa246..461f9c9e935b 100644 --- a/packages/beacon-node/src/metrics/metrics/lodestar.ts +++ b/packages/beacon-node/src/metrics/metrics/lodestar.ts @@ -378,17 +378,6 @@ export function createLodestarMetrics( help: "Total count state.validators nodesPopulated is false on stfn for post state", }), - epochCache: { - finalizedPubkeyDuplicateInsert: register.gauge({ - name: "lodestar_epoch_cache_finalized_pubkey_duplicate_insert_total", - help: "Total count of duplicate insert of finalized pubkeys", - }), - newUnFinalizedPubkey: register.gauge({ - name: "lodestar_epoch_cache_new_unfinalized_pubkey_total", - help: "Total count of unfinalized pubkeys added", - }), - }, - // BLS verifier thread pool and queue bls: { diff --git a/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts b/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts deleted file mode 100644 index 294dde750865..000000000000 --- a/packages/beacon-node/test/memory/unfinalizedPubkey2Index.ts +++ /dev/null @@ -1,54 +0,0 @@ -import crypto from "node:crypto"; -import {toMemoryEfficientHexStr} from "@lodestar/state-transition/src/cache/pubkeyCache.js"; -import {ValidatorIndex} from "@lodestar/types"; -// biome-ignore lint/suspicious/noShadowRestrictedNames: We explicitly want `Map` name to be imported -import {Map} from "immutable"; -import {testRunnerMemory} from "./testRunnerMemory.js"; - -// Results in MacOS Nov 2023 -// -// UnfinalizedPubkey2Index 1000 keys - 274956.5 bytes / instance -// UnfinalizedPubkey2Index 10000 keys - 2591129.3 bytes / instance -// UnfinalizedPubkey2Index 100000 keys - 27261443.4 bytes / instance - -testRunnerMemoryBpi([ - { - id: "UnfinalizedPubkey2Index 1000 keys", - getInstance: () => getRandomMap(1000, () => toMemoryEfficientHexStr(crypto.randomBytes(48))), - }, - { - id: "UnfinalizedPubkey2Index 10000 keys", - getInstance: () => getRandomMap(10000, () => toMemoryEfficientHexStr(crypto.randomBytes(48))), - }, - { - id: "UnfinalizedPubkey2Index 100000 keys", - getInstance: () => getRandomMap(100000, () => toMemoryEfficientHexStr(crypto.randomBytes(48))), - }, -]); - -function getRandomMap(n: number, getKey: (i: number) => string): Map { - const map = Map(); - - return map.withMutations((m) => { - for (let i = 0; i < n; i++) { - m.set(getKey(i), i); - } - }); -} - -/** - * Test bytes per instance in different representations of raw binary data - */ -function testRunnerMemoryBpi(testCases: {getInstance: (bytes: number) => unknown; id: string}[]): void { - const longestId = Math.max(...testCases.map(({id}) => id.length)); - - for (const {id, getInstance} of testCases) { - const bpi = testRunnerMemory({ - getInstance, - convergeFactor: 1 / 100, - sampleEvery: 5, - }); - - console.log(`${id.padEnd(longestId)} - ${bpi.toFixed(1)} bytes / instance`); - } -} diff --git a/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts b/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts deleted file mode 100644 index 8009f36c6301..000000000000 --- a/packages/beacon-node/test/perf/chain/stateCache/updateUnfinalizedPubkeys.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -import {digest} from "@chainsafe/as-sha256"; -import {SecretKey} from "@chainsafe/blst"; -import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; -import {itBench, setBenchOpts} from "@dapplion/benchmark"; -import {type CachedBeaconStateAllForks, toMemoryEfficientHexStr} from "@lodestar/state-transition"; -import {ValidatorIndex, ssz} from "@lodestar/types"; -import {bytesToBigInt, intToBytes} from "@lodestar/utils"; -import {toBufferBE} from "bigint-buffer"; -import {Map as ImmutableMap} from "immutable"; -import {BlockStateCacheImpl, InMemoryCheckpointStateCache} from "../../../../src/chain/stateCache/index.js"; -import {BlockStateCache} from "../../../../src/chain/stateCache/types.js"; -import {generateCachedElectraState} from "../../../utils/state.js"; - -// Benchmark date from Mon Nov 21 2023 - Intel Core i7-9750H @ 2.60Ghz -// ✔ updateUnfinalizedPubkeys - updating 10 pubkeys 1444.173 ops/s 692.4380 us/op - 1057 runs 6.03 s -// ✔ updateUnfinalizedPubkeys - updating 100 pubkeys 189.5965 ops/s 5.274358 ms/op - 57 runs 1.15 s -// ✔ updateUnfinalizedPubkeys - updating 1000 pubkeys 12.90495 ops/s 77.48967 ms/op - 13 runs 1.62 s -describe("updateUnfinalizedPubkeys perf tests", () => { - setBenchOpts({noThreshold: true}); - - const numPubkeysToBeFinalizedCases = [10, 100, 1000]; - const numCheckpointStateCache = 8; - const numStateCache = 3 * 32; - - let checkpointStateCache: InMemoryCheckpointStateCache; - let stateCache: BlockStateCache; - - const unfinalizedPubkey2Index = generatePubkey2Index(0, Math.max.apply(null, numPubkeysToBeFinalizedCases)); - const baseState = generateCachedElectraState(); - - for (const numPubkeysToBeFinalized of numPubkeysToBeFinalizedCases) { - itBench({ - id: `updateUnfinalizedPubkeys - updating ${numPubkeysToBeFinalized} pubkeys`, - beforeEach: async () => { - baseState.epochCtx.unfinalizedPubkey2index = ImmutableMap(unfinalizedPubkey2Index); - baseState.epochCtx.pubkey2index = new PubkeyIndexMap(); - baseState.epochCtx.index2pubkey = []; - - checkpointStateCache = new InMemoryCheckpointStateCache({}); - stateCache = new BlockStateCacheImpl({}); - - for (let i = 0; i < numCheckpointStateCache; i++) { - const clonedState = baseState.clone(); - const checkpoint = ssz.phase0.Checkpoint.defaultValue(); - - clonedState.slot = i; - checkpoint.epoch = i; // Assigning arbitrary non-duplicate values to ensure checkpointStateCache correctly saves all the states - - checkpointStateCache.add(checkpoint, clonedState); - } - - for (let i = 0; i < numStateCache; i++) { - const clonedState = baseState.clone(); - clonedState.slot = i; - stateCache.add(clonedState); - } - }, - fn: async () => { - const newFinalizedValidators = baseState.epochCtx.unfinalizedPubkey2index.filter( - (index, _pubkey) => index < numPubkeysToBeFinalized - ); - - const states = stateCache.getStates(); - const cpStates = checkpointStateCache.getStates(); - - const firstState = states.next().value as CachedBeaconStateAllForks; - firstState.epochCtx.addFinalizedPubkeys(newFinalizedValidators); - - const pubkeysToDelete = Array.from(newFinalizedValidators.keys()); - - firstState.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - - for (const s of states) { - s.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - } - - for (const s of cpStates) { - s.epochCtx.deleteUnfinalizedPubkeys(pubkeysToDelete); - } - }, - }); - } - - type PubkeyHex = string; - - function generatePubkey2Index(startIndex: number, endIndex: number): Map { - const pubkey2Index = new Map(); - const pubkeys = generatePubkeys(endIndex - startIndex); - - for (let i = startIndex; i < endIndex; i++) { - pubkey2Index.set(toMemoryEfficientHexStr(pubkeys[i]), i); - } - - return pubkey2Index; - } - - function generatePubkeys(validatorCount: number): Uint8Array[] { - const keys = []; - - for (let i = 0; i < validatorCount; i++) { - const sk = generatePrivateKey(i); - const pk = sk.toPublicKey().toBytes(); - keys.push(pk); - } - - return keys; - } - - function generatePrivateKey(index: number): SecretKey { - const secretKeyBytes = toBufferBE(bytesToBigInt(digest(intToBytes(index, 32))) % BigInt("38581184513"), 32); - const secret: SecretKey = SecretKey.fromBytes(secretKeyBytes); - return secret; - } -}); diff --git a/packages/beacon-node/test/sim/electra-interop.test.ts b/packages/beacon-node/test/sim/electra-interop.test.ts index 47b7d127fb42..148f210f7f65 100644 --- a/packages/beacon-node/test/sim/electra-interop.test.ts +++ b/packages/beacon-node/test/sim/electra-interop.test.ts @@ -375,17 +375,8 @@ describe("executionEngine / ExecutionEngineHttp", () => { if (headState.validators.length !== 33 || headState.balances.length !== 33) { throw Error("New validator is not reflected in the beacon state at slot 5"); } - if (epochCtx.index2pubkey.length !== 32 || epochCtx.pubkey2index.size !== 32) { - throw Error("Finalized cache is modified."); - } - if (epochCtx.unfinalizedPubkey2index.size !== 1) { - throw Error( - `Unfinalized cache is missing the expected validator. Size: ${epochCtx.unfinalizedPubkey2index.size}` - ); - } - // validator count at epoch 1 should be empty at this point since no epoch transition has happened. - if (epochCtx.getValidatorCountAtEpoch(1) !== undefined) { - throw Error("Historical validator lengths is modified"); + if (epochCtx.index2pubkey.length !== 33 || epochCtx.pubkey2index.size !== 33) { + throw Error("Pubkey cache is not updated"); } await new Promise((resolve, _reject) => { @@ -412,23 +403,7 @@ describe("executionEngine / ExecutionEngineHttp", () => { throw Error("New validator is not reflected in the beacon state."); } if (epochCtx.index2pubkey.length !== 33 || epochCtx.pubkey2index.size !== 33) { - throw Error("New validator is not in finalized cache"); - } - if (!epochCtx.unfinalizedPubkey2index.isEmpty()) { - throw Error("Unfinalized cache still contains new validator"); - } - // After 4 epochs, headState's finalized cp epoch should be 2 - // epochCtx should only have validator count for epoch 3 and 4. - if (epochCtx.getValidatorCountAtEpoch(4) === undefined || epochCtx.getValidatorCountAtEpoch(3) === undefined) { - throw Error("Missing historical validator length for epoch 3 or 4"); - } - - if (epochCtx.getValidatorCountAtEpoch(4) !== 33 || epochCtx.getValidatorCountAtEpoch(3) !== 33) { - throw Error("Incorrect historical validator length for epoch 3 or 4"); - } - - if (epochCtx.getValidatorCountAtEpoch(2) !== undefined || epochCtx.getValidatorCountAtEpoch(1) !== undefined) { - throw Error("Historical validator length for epoch 1 or 2 is not dropped properly"); + throw Error("New validator is not in pubkey cache"); } if (headState.depositRequestsStartIndex === UNSET_DEPOSIT_REQUESTS_START_INDEX) { diff --git a/packages/state-transition/package.json b/packages/state-transition/package.json index 5dfecfa9bbf6..ac297b240756 100644 --- a/packages/state-transition/package.json +++ b/packages/state-transition/package.json @@ -69,8 +69,7 @@ "@lodestar/params": "^1.23.0", "@lodestar/types": "^1.23.0", "@lodestar/utils": "^1.23.0", - "bigint-buffer": "^1.1.5", - "immutable": "^4.3.2" + "bigint-buffer": "^1.1.5" }, "keywords": [ "ethereum", diff --git a/packages/state-transition/src/cache/epochCache.ts b/packages/state-transition/src/cache/epochCache.ts index 207267dff4f4..86e63c672024 100644 --- a/packages/state-transition/src/cache/epochCache.ts +++ b/packages/state-transition/src/cache/epochCache.ts @@ -25,10 +25,8 @@ import { electra, phase0, } from "@lodestar/types"; -import {LodestarError, fromHex} from "@lodestar/utils"; -import * as immutable from "immutable"; +import {LodestarError} from "@lodestar/utils"; import {getTotalSlashingsByIncrement} from "../epoch/processSlashings.js"; -import {EpochCacheMetrics} from "../metrics.js"; import {AttesterDuty, calculateCommitteeAssignments} from "../util/calculateCommitteeAssignments.js"; import { EpochShuffling, @@ -51,14 +49,7 @@ import { import {computeBaseRewardPerIncrement, computeSyncParticipantReward} from "../util/syncCommittee.js"; import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalance.js"; import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsWithLen} from "./effectiveBalanceIncrements.js"; -import { - Index2PubkeyCache, - PubkeyHex, - UnfinalizedPubkeyIndexMap, - newUnfinalizedPubkeyIndexMap, - syncPubkeys, - toMemoryEfficientHexStr, -} from "./pubkeyCache.js"; +import {Index2PubkeyCache, syncPubkeys} from "./pubkeyCache.js"; import {CachedBeaconStateAllForks} from "./stateCache.js"; import { SyncCommitteeCache, @@ -111,30 +102,20 @@ type ProposersDeferred = {computed: false; seed: Uint8Array} | {computed: true; export class EpochCache { config: BeaconConfig; /** - * Unique globally shared finalized pubkey registry. There should only exist one for the entire application. + * Unique globally shared pubkey registry. There should only exist one for the entire application. * * TODO: this is a hack, we need a safety mechanism in case a bad eth1 majority vote is in, * or handle non finalized data differently, or use an immutable.js structure for cheap copies * - * New: This would include only validators whose activation_eligibility_epoch != FAR_FUTURE_EPOCH and hence it is - * insert only. Validators could be 1) Active 2) In the activation queue 3) Initialized but pending queued - * * $VALIDATOR_COUNT x 192 char String -> Number Map */ pubkey2index: PubkeyIndexMap; /** - * Unique globally shared finalized pubkey registry. There should only exist one for the entire application. - * - * New: This would include only validators whose activation_eligibility_epoch != FAR_FUTURE_EPOCH and hence it is - * insert only. Validators could be 1) Active 2) In the activation queue 3) Initialized but pending queued + * Unique globally shared pubkey registry. There should only exist one for the entire application. * * $VALIDATOR_COUNT x BLST deserialized pubkey (Jacobian coordinates) */ index2pubkey: Index2PubkeyCache; - /** - * Unique pubkey registry shared in the same fork. There should only exist one for the fork. - */ - unfinalizedPubkey2index: UnfinalizedPubkeyIndexMap; /** * ShufflingCache is passed in from `beacon-node` so should be available at runtime but may not be * present during testing. @@ -252,15 +233,6 @@ export class EpochCache { // TODO: Helper stats syncPeriod: SyncPeriod; - /** - * state.validators.length of every state at epoch boundary - * They are saved in increasing order of epoch. - * The first validator length in the list corresponds to the state AFTER the latest finalized checkpoint state. ie. state.finalizedCheckpoint.epoch - 1 - * The last validator length corresponds to the latest epoch state ie. this.epoch - * eg. latest epoch = 105, latest finalized cp state epoch = 102 - * then the list will be (in terms of epoch) [103, 104, 105] - */ - historicalValidatorLengths: immutable.List; epoch: Epoch; @@ -272,7 +244,6 @@ export class EpochCache { config: BeaconConfig; pubkey2index: PubkeyIndexMap; index2pubkey: Index2PubkeyCache; - unfinalizedPubkey2index: UnfinalizedPubkeyIndexMap; shufflingCache?: IShufflingCache; proposers: number[]; proposersPrevEpoch: number[] | null; @@ -300,12 +271,10 @@ export class EpochCache { nextSyncCommitteeIndexed: SyncCommitteeCache; epoch: Epoch; syncPeriod: SyncPeriod; - historialValidatorLengths: immutable.List; }) { this.config = data.config; this.pubkey2index = data.pubkey2index; this.index2pubkey = data.index2pubkey; - this.unfinalizedPubkey2index = data.unfinalizedPubkey2index; this.shufflingCache = data.shufflingCache; this.proposers = data.proposers; this.proposersPrevEpoch = data.proposersPrevEpoch; @@ -333,12 +302,11 @@ export class EpochCache { this.nextSyncCommitteeIndexed = data.nextSyncCommitteeIndexed; this.epoch = data.epoch; this.syncPeriod = data.syncPeriod; - this.historicalValidatorLengths = data.historialValidatorLengths; } /** * Create an epoch cache - * @param state a finalized beacon state. Passing in unfinalized state may cause unexpected behaviour eg. empty unfinalized cache + * @param state a finalized beacon state. Passing in unfinalized state may cause unexpected behaviour * * SLOW CODE - 🐢 */ @@ -551,8 +519,6 @@ export class EpochCache { config, pubkey2index, index2pubkey, - // `createFromFinalizedState()` creates cache with empty unfinalizedPubkey2index. Be cautious to only pass in finalized state - unfinalizedPubkey2index: newUnfinalizedPubkeyIndexMap(), shufflingCache, proposers, // On first epoch, set to null to prevent unnecessary work since this is only used for metrics @@ -581,7 +547,6 @@ export class EpochCache { nextSyncCommitteeIndexed, epoch: currentEpoch, syncPeriod: computeSyncPeriodAtEpoch(currentEpoch), - historialValidatorLengths: immutable.List(), }); } @@ -597,8 +562,6 @@ export class EpochCache { // Common append-only structures shared with all states, no need to clone pubkey2index: this.pubkey2index, index2pubkey: this.index2pubkey, - // No need to clone this reference. On each mutation the `unfinalizedPubkey2index` reference is replaced, @see `addPubkey` - unfinalizedPubkey2index: this.unfinalizedPubkey2index, shufflingCache: this.shufflingCache, // Immutable data proposers: this.proposers, @@ -630,7 +593,6 @@ export class EpochCache { nextSyncCommitteeIndexed: this.nextSyncCommitteeIndexed, epoch: this.epoch, syncPeriod: this.syncPeriod, - historialValidatorLengths: this.historicalValidatorLengths, }); } @@ -773,25 +735,6 @@ export class EpochCache { // ``` this.epoch = computeEpochAtSlot(state.slot); this.syncPeriod = computeSyncPeriodAtEpoch(this.epoch); - // ELECTRA Only: Add current cpState.validators.length - // Only keep validatorLength for epochs after finalized cpState.epoch - // eg. [100(epoch 1), 102(epoch 2)].push(104(epoch 3)), this.epoch = 3, finalized cp epoch = 1 - // We keep the last (3 - 1) items = [102, 104] - if (upcomingEpoch >= this.config.ELECTRA_FORK_EPOCH) { - this.historicalValidatorLengths = this.historicalValidatorLengths.push(state.validators.length); - - // If number of validatorLengths we want to keep exceeds the current list size, it implies - // finalized checkpoint hasn't advanced, and no need to slice - const hasFinalizedCpAdvanced = - this.epoch - state.finalizedCheckpoint.epoch < this.historicalValidatorLengths.size; - - if (hasFinalizedCpAdvanced) { - // We use finalized cp epoch - this.epoch which is a negative number to keep the last n entries and discard the rest - this.historicalValidatorLengths = this.historicalValidatorLengths.slice( - state.finalizedCheckpoint.epoch - this.epoch - ); - } - } } beforeEpochTransition(): void { @@ -1018,75 +961,19 @@ export class EpochCache { } /** - * Return finalized pubkey given the validator index. - * Only finalized pubkey as we do not store unfinalized pubkey because no where in the spec has a - * need to make such enquiry + * Return pubkey given the validator index. */ getPubkey(index: ValidatorIndex): PublicKey | undefined { return this.index2pubkey[index]; } getValidatorIndex(pubkey: Uint8Array): ValidatorIndex | null { - if (this.isPostElectra()) { - return this.pubkey2index.get(pubkey) ?? this.unfinalizedPubkey2index.get(toMemoryEfficientHexStr(pubkey)) ?? null; - } return this.pubkey2index.get(pubkey); } - /** - * - * Add unfinalized pubkeys - * - */ addPubkey(index: ValidatorIndex, pubkey: Uint8Array): void { - if (this.isPostElectra()) { - this.addUnFinalizedPubkey(index, pubkey); - } else { - // deposit mechanism pre ELECTRA follows a safe distance with assumption - // that they are already canonical - this.addFinalizedPubkey(index, pubkey); - } - } - - addUnFinalizedPubkey(index: ValidatorIndex, pubkey: PubkeyHex | Uint8Array, metrics?: EpochCacheMetrics): void { - this.unfinalizedPubkey2index = this.unfinalizedPubkey2index.set(toMemoryEfficientHexStr(pubkey), index); - metrics?.newUnFinalizedPubkey.inc(); - } - - addFinalizedPubkeys(pubkeyMap: UnfinalizedPubkeyIndexMap, metrics?: EpochCacheMetrics): void { - pubkeyMap.forEach((index, pubkey) => this.addFinalizedPubkey(index, pubkey, metrics)); - } - - /** - * Add finalized validator index and pubkey into finalized cache. - * Since addFinalizedPubkey() primarily takes pubkeys from unfinalized cache, it can take pubkey hex string directly - */ - addFinalizedPubkey(index: ValidatorIndex, pubkeyOrHex: PubkeyHex | Uint8Array, metrics?: EpochCacheMetrics): void { - const pubkey = typeof pubkeyOrHex === "string" ? fromHex(pubkeyOrHex) : pubkeyOrHex; - const existingIndex = this.pubkey2index.get(pubkey); - - if (existingIndex !== null) { - if (existingIndex === index) { - // Repeated insert. - metrics?.finalizedPubkeyDuplicateInsert.inc(); - return; - } - // attempt to insert the same pubkey with different index, should never happen. - throw Error( - `inserted existing pubkey into finalizedPubkey2index cache with a different index, index=${index} priorIndex=${existingIndex}` - ); - } - this.pubkey2index.set(pubkey, index); - const pubkeyBytes = pubkey instanceof Uint8Array ? pubkey : fromHex(pubkey); - this.index2pubkey[index] = PublicKey.fromBytes(pubkeyBytes); // Optimize for aggregation - } - - /** - * Delete pubkeys from unfinalized cache - */ - deleteUnfinalizedPubkeys(pubkeys: Iterable): void { - this.unfinalizedPubkey2index = this.unfinalizedPubkey2index.deleteAll(pubkeys); + this.index2pubkey[index] = PublicKey.fromBytes(pubkey); // Optimize for aggregation } getShufflingAtSlot(slot: Slot): EpochShuffling { @@ -1220,25 +1107,6 @@ export class EpochCache { isPostElectra(): boolean { return this.epoch >= this.config.ELECTRA_FORK_EPOCH; } - - getValidatorCountAtEpoch(targetEpoch: Epoch): number | undefined { - const currentEpoch = this.epoch; - - if (targetEpoch === currentEpoch) { - return this.historicalValidatorLengths.get(-1); - } - - // Attempt to get validator count from future epoch - if (targetEpoch > currentEpoch) { - return undefined; - } - - // targetEpoch is so far back that historicalValidatorLengths doesnt contain such info - if (targetEpoch < currentEpoch - this.historicalValidatorLengths.size + 1) { - return undefined; - } - return this.historicalValidatorLengths.get(targetEpoch - currentEpoch - 1); - } } function getEffectiveBalanceIncrementsByteLen(validatorCount: number): number { diff --git a/packages/state-transition/src/cache/pubkeyCache.ts b/packages/state-transition/src/cache/pubkeyCache.ts index 16c8f3de6787..75281e52e060 100644 --- a/packages/state-transition/src/cache/pubkeyCache.ts +++ b/packages/state-transition/src/cache/pubkeyCache.ts @@ -1,44 +1,8 @@ import {PublicKey} from "@chainsafe/blst"; import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map"; import {ValidatorIndex, phase0} from "@lodestar/types"; -import * as immutable from "immutable"; export type Index2PubkeyCache = PublicKey[]; -/** - * OrderedMap preserves the order of entries in which they are `set()`. - * We assume `values()` yields validator indices in strictly increasing order - * as new validator indices are assigned in increasing order. - * EIP-6914 will break this assumption. - */ -export type UnfinalizedPubkeyIndexMap = immutable.Map; - -export type PubkeyHex = string; - -/** - * toHexString() creates hex strings via string concatenation, which are very memory inefficient. - * Memory benchmarks show that Buffer.toString("hex") produces strings with 10x less memory. - * - * Does not prefix to save memory, thus the prefix is removed from an already string representation. - * - * See https://github.com/ChainSafe/lodestar/issues/3446 - */ -export function toMemoryEfficientHexStr(hex: Uint8Array | string): string { - if (typeof hex === "string") { - if (hex.startsWith("0x")) { - hex = hex.slice(2); - } - return hex; - } - - return Buffer.from(hex.buffer, hex.byteOffset, hex.byteLength).toString("hex"); -} - -/** - * A wrapper for calling immutable.js. To abstract the initialization of UnfinalizedPubkeyIndexMap - */ -export function newUnfinalizedPubkeyIndexMap(): UnfinalizedPubkeyIndexMap { - return immutable.Map(); -} /** * Checks the pubkey indices against a state and adds missing pubkeys diff --git a/packages/state-transition/src/index.ts b/packages/state-transition/src/index.ts index 600bbf173462..0e76c5248a97 100644 --- a/packages/state-transition/src/index.ts +++ b/packages/state-transition/src/index.ts @@ -41,15 +41,10 @@ export { EpochCacheError, EpochCacheErrorCode, } from "./cache/epochCache.js"; -export {toMemoryEfficientHexStr} from "./cache/pubkeyCache.js"; export {type EpochTransitionCache, beforeProcessEpoch} from "./cache/epochTransitionCache.js"; // Aux data-structures -export { - type Index2PubkeyCache, - type UnfinalizedPubkeyIndexMap, - newUnfinalizedPubkeyIndexMap, -} from "./cache/pubkeyCache.js"; +export {type Index2PubkeyCache} from "./cache/pubkeyCache.js"; export { type EffectiveBalanceIncrements, diff --git a/packages/state-transition/src/metrics.ts b/packages/state-transition/src/metrics.ts index fee20de1d565..d975833ba13c 100644 --- a/packages/state-transition/src/metrics.ts +++ b/packages/state-transition/src/metrics.ts @@ -31,11 +31,6 @@ export type BeaconStateTransitionMetrics = { ) => void; }; -export type EpochCacheMetrics = { - finalizedPubkeyDuplicateInsert: Gauge; - newUnFinalizedPubkey: Gauge; -}; - export function onStateCloneMetrics( state: CachedBeaconStateAllForks, metrics: BeaconStateTransitionMetrics, diff --git a/packages/state-transition/test/unit/cachedBeaconState.test.ts b/packages/state-transition/test/unit/cachedBeaconState.test.ts index de2ba5893b02..9466dfd83ab7 100644 --- a/packages/state-transition/test/unit/cachedBeaconState.test.ts +++ b/packages/state-transition/test/unit/cachedBeaconState.test.ts @@ -28,7 +28,7 @@ describe("CachedBeaconState", () => { expect(state2.epochCtx.epoch).toBe(0); }); - it("Clone and mutate cache pre-Electra", () => { + it("Clone and mutate cache", () => { const stateView = ssz.altair.BeaconState.defaultViewDU(); const state1 = createCachedBeaconStateTest(stateView); @@ -52,40 +52,6 @@ describe("CachedBeaconState", () => { expect(state2.epochCtx.getValidatorIndex(pubkey2)).toBe(index2); }); - it("Clone and mutate cache post-Electra", () => { - const stateView = ssz.electra.BeaconState.defaultViewDU(); - const state1 = createCachedBeaconStateTest( - stateView, - createChainForkConfig({ - ALTAIR_FORK_EPOCH: 0, - BELLATRIX_FORK_EPOCH: 0, - CAPELLA_FORK_EPOCH: 0, - DENEB_FORK_EPOCH: 0, - ELECTRA_FORK_EPOCH: 0, - }), - {skipSyncCommitteeCache: true, skipSyncPubkeys: true} - ); - - const pubkey1 = fromHexString( - "0x84105a985058fc8740a48bf1ede9d223ef09e8c6b1735ba0a55cf4a9ff2ff92376b778798365e488dab07a652eb04576" - ); - const index1 = 123; - const pubkey2 = fromHexString( - "0xa41726266b1d83ef609d759ba7796d54cfe549154e01e4730a3378309bc81a7638140d7e184b33593c072595f23f032d" - ); - const index2 = 456; - - state1.epochCtx.addPubkey(index1, pubkey1); - - const state2 = state1.clone(); - state2.epochCtx.addPubkey(index2, pubkey2); - - expect(state1.epochCtx.getValidatorIndex(pubkey1)).toBe(index1); - expect(state2.epochCtx.getValidatorIndex(pubkey1)).toBe(index1); - expect(state1.epochCtx.getValidatorIndex(pubkey2)).toBe(null); - expect(state2.epochCtx.getValidatorIndex(pubkey2)).toBe(index2); - }); - it("Auto-commit on hashTreeRoot", () => { // Use Checkpoint instead of BeaconState to speed up the test const cp1 = ssz.phase0.Checkpoint.defaultViewDU(); diff --git a/yarn.lock b/yarn.lock index a9cb9ebe4fdc..f59b3d082456 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7267,11 +7267,6 @@ ignore@^5.0.4, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== -immutable@^4.3.2: - version "4.3.5" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.5.tgz#f8b436e66d59f99760dc577f5c99a4fd2a5cc5a0" - integrity sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw== - import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" From 18f421859c1cf569437e8bb727b10067f24169b6 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 27 Nov 2024 07:46:14 +0100 Subject: [PATCH 13/48] chore: skip web3_provider unit tests (#7252) --- packages/prover/test/unit/web3_provider.node.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/prover/test/unit/web3_provider.node.test.ts b/packages/prover/test/unit/web3_provider.node.test.ts index 10f0fee3387d..b370c871d0e6 100644 --- a/packages/prover/test/unit/web3_provider.node.test.ts +++ b/packages/prover/test/unit/web3_provider.node.test.ts @@ -7,7 +7,8 @@ import {JsonRpcRequest, JsonRpcRequestOrBatch, JsonRpcResponse} from "../../src/ import {ELRpcProvider} from "../../src/utils/rpc_provider.js"; import {createVerifiedExecutionProvider} from "../../src/web3_provider.js"; -describe("web3_provider", () => { +// https://github.com/ChainSafe/lodestar/issues/7250 +describe.skip("web3_provider", () => { afterEach(() => { vi.clearAllMocks(); }); From e86e816b1d8418063cd64e238f0d88ca6dd0f5ea Mon Sep 17 00:00:00 2001 From: twoeths Date: Wed, 27 Nov 2024 15:22:24 +0700 Subject: [PATCH 14/48] fix: prune checkpoint states at syncing time (#7241) * fix: prune checkpoint states at syncing time * fix: lint * fix: check-types in test --- packages/beacon-node/src/chain/chain.ts | 1 - .../stateCache/persistentCheckpointsCache.ts | 27 +++---------------- .../persistentCheckpointsCache.test.ts | 18 +++++-------- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/packages/beacon-node/src/chain/chain.ts b/packages/beacon-node/src/chain/chain.ts index 4751770b3bfc..415158abb2d5 100644 --- a/packages/beacon-node/src/chain/chain.ts +++ b/packages/beacon-node/src/chain/chain.ts @@ -293,7 +293,6 @@ export class BeaconChain implements IBeaconChain { metrics, logger, clock, - shufflingCache: this.shufflingCache, blockStateCache, bufferPool: this.bufferPool, datastore: fileDataStore diff --git a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts index 4c9a8b0f1265..7fb67a758673 100644 --- a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts @@ -9,7 +9,6 @@ import {AllocSource, BufferPool, BufferWithKey} from "../../util/bufferPool.js"; import {IClock} from "../../util/clock.js"; import {StateCloneOpts} from "../regen/interface.js"; import {serializeState} from "../serializeState.js"; -import {ShufflingCache} from "../shufflingCache.js"; import {CPStateDatastore, DatastoreKey, datastoreKeyToCheckpoint} from "./datastore/index.js"; import {MapTracker} from "./mapMetrics.js"; import {BlockStateCache, CacheItemType, CheckpointHex, CheckpointStateCache} from "./types.js"; @@ -17,8 +16,6 @@ import {BlockStateCache, CacheItemType, CheckpointHex, CheckpointStateCache} fro export type PersistentCheckpointStateCacheOpts = { /** Keep max n states in memory, persist the rest to disk */ maxCPStateEpochsInMemory?: number; - /** for testing only */ - processLateBlock?: boolean; }; type PersistentCheckpointStateCacheModules = { @@ -26,7 +23,6 @@ type PersistentCheckpointStateCacheModules = { logger: Logger; clock?: IClock | null; signal?: AbortSignal; - shufflingCache: ShufflingCache; datastore: CPStateDatastore; blockStateCache: BlockStateCache; bufferPool?: BufferPool | null; @@ -102,24 +98,12 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { private preComputedCheckpoint: string | null = null; private preComputedCheckpointHits: number | null = null; private readonly maxEpochsInMemory: number; - // only for testing, default false for production - private readonly processLateBlock: boolean; private readonly datastore: CPStateDatastore; - private readonly shufflingCache: ShufflingCache; private readonly blockStateCache: BlockStateCache; private readonly bufferPool?: BufferPool | null; constructor( - { - metrics, - logger, - clock, - signal, - shufflingCache, - datastore, - blockStateCache, - bufferPool, - }: PersistentCheckpointStateCacheModules, + {metrics, logger, clock, signal, datastore, blockStateCache, bufferPool}: PersistentCheckpointStateCacheModules, opts: PersistentCheckpointStateCacheOpts ) { this.cache = new MapTracker(metrics?.cpStateCache); @@ -153,10 +137,8 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { throw new Error("maxEpochsInMemory must be >= 0"); } this.maxEpochsInMemory = opts.maxCPStateEpochsInMemory ?? DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY; - this.processLateBlock = opts.processLateBlock ?? false; // Specify different datastore for testing this.datastore = datastore; - this.shufflingCache = shufflingCache; this.blockStateCache = blockStateCache; this.bufferPool = bufferPool; } @@ -487,12 +469,9 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { // 2/3 of slot is the most free time of every slot, take that chance to persist checkpoint states // normally it should only persist checkpoint states at 2/3 of slot 0 of epoch await sleep(secToTwoThirdsSlot * 1000, this.signal); - } else if (!this.processLateBlock) { - // normally the block persist happens at 2/3 of slot 0 of epoch, if it's already late then just skip to allow other tasks to run - // there are plenty of chances in the same epoch to persist checkpoint states, also if block is late it could be reorged - this.logger.verbose("Skip persist checkpoint states", {blockSlot, root: blockRootHex}); - return 0; } + // at syncing time, it's critical to persist checkpoint states as soon as possible to avoid OOM during unfinality time + // if node is synced this is not a hot time because block comes late, we'll likely miss attestation already, or the block is orphaned const persistEpochs = sortedEpochs.slice(0, sortedEpochs.length - this.maxEpochsInMemory); for (const lowestEpoch of persistEpochs) { diff --git a/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts b/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts index 5ab3da532948..4e8b62013331 100644 --- a/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts +++ b/packages/beacon-node/test/unit/chain/stateCache/persistentCheckpointsCache.test.ts @@ -90,10 +90,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 2, processLateBlock: true} + {maxCPStateEpochsInMemory: 2} ); cache.add(cp0a, states["cp0a"]); cache.add(cp0b, states["cp0b"]); @@ -165,10 +164,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 2, processLateBlock: true} + {maxCPStateEpochsInMemory: 2} ); cache.add(cp0a, states["cp0a"]); cache.add(cp0b, states["cp0b"]); @@ -242,10 +240,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 2, processLateBlock: true} + {maxCPStateEpochsInMemory: 2} ); cache.add(cp0a, states["cp0a"]); cache.add(cp0b, states["cp0b"]); @@ -548,10 +545,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 1, processLateBlock: true} + {maxCPStateEpochsInMemory: 1} ); cache.add(cp0a, states["cp0a"]); cache.add(cp0b, states["cp0b"]); @@ -820,10 +816,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 0, processLateBlock: true} + {maxCPStateEpochsInMemory: 0} ); cache.add(cp0a, states["cp0a"]); cache.add(cp0b, states["cp0b"]); @@ -911,10 +906,9 @@ describe("PersistentCheckpointStateCache", () => { { datastore, logger: testLogger(), - shufflingCache: new ShufflingCache(), blockStateCache: new FIFOBlockStateCache({}, {}), }, - {maxCPStateEpochsInMemory: 0, processLateBlock: true} + {maxCPStateEpochsInMemory: 0} ); const root1a = Buffer.alloc(32, 100); From 443e3a8ab3dd1c49706f3e9b9b784aebd627f318 Mon Sep 17 00:00:00 2001 From: twoeths Date: Wed, 27 Nov 2024 15:52:43 +0700 Subject: [PATCH 15/48] fix: sync cached isCompoundingValidatorArr at epoch transition (#7247) --- .../src/cache/epochTransitionCache.ts | 25 +++++++++++++------ .../epoch/processEffectiveBalanceUpdates.ts | 7 +++--- .../src/epoch/processPendingDeposits.ts | 3 +++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/state-transition/src/cache/epochTransitionCache.ts b/packages/state-transition/src/cache/epochTransitionCache.ts index d86431c72eee..16279e851188 100644 --- a/packages/state-transition/src/cache/epochTransitionCache.ts +++ b/packages/state-transition/src/cache/epochTransitionCache.ts @@ -9,7 +9,12 @@ import {Epoch, RootHex, ValidatorIndex, phase0} from "@lodestar/types"; import {intDiv, toRootHex} from "@lodestar/utils"; import {processPendingAttestations} from "../epoch/processPendingAttestations.js"; -import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../index.js"; +import { + CachedBeaconStateAllForks, + CachedBeaconStateAltair, + CachedBeaconStatePhase0, + hasCompoundingWithdrawalCredential, +} from "../index.js"; import {computeBaseRewardPerIncrement} from "../util/altair.js"; import { FLAG_CURR_HEAD_ATTESTER, @@ -133,11 +138,7 @@ export interface EpochTransitionCache { flags: number[]; - /** - * Validators in the current epoch, should use it for read-only value instead of accessing state.validators directly. - * Note that during epoch processing, validators could be updated so need to use it with care. - */ - validators: phase0.Validator[]; + isCompoundingValidatorArr: boolean[]; /** * balances array will be populated by processRewardsAndPenalties() and consumed by processEffectiveBalanceUpdates(). @@ -209,6 +210,8 @@ const inclusionDelays = new Array(); /** WARNING: reused, never gc'd */ const flags = new Array(); /** WARNING: reused, never gc'd */ +const isCompoundingValidatorArr = new Array(); +/** WARNING: reused, never gc'd */ const nextEpochShufflingActiveValidatorIndices = new Array(); export function beforeProcessEpoch( @@ -262,6 +265,10 @@ export function beforeProcessEpoch( // TODO: optimize by combining the two loops // likely will require splitting into phase0 and post-phase0 versions + if (forkSeq >= ForkSeq.electra) { + isCompoundingValidatorArr.length = validatorCount; + } + // Clone before being mutated in processEffectiveBalanceUpdates epochCtx.beforeEpochTransition(); @@ -298,6 +305,10 @@ export function beforeProcessEpoch( flags[i] = flag; + if (forkSeq >= ForkSeq.electra) { + isCompoundingValidatorArr[i] = hasCompoundingWithdrawalCredential(validator.withdrawalCredentials); + } + if (isActiveCurr) { totalActiveStakeByIncrement += effectiveBalancesByIncrements[i]; } else { @@ -511,7 +522,7 @@ export function beforeProcessEpoch( proposerIndices, inclusionDelays, flags, - validators, + isCompoundingValidatorArr, // Will be assigned in processRewardsAndPenalties() balances: undefined, }; diff --git a/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts b/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts index d55f37aba178..b98e5cce9f35 100644 --- a/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts +++ b/packages/state-transition/src/epoch/processEffectiveBalanceUpdates.ts @@ -5,10 +5,11 @@ import { HYSTERESIS_QUOTIENT, HYSTERESIS_UPWARD_MULTIPLIER, MAX_EFFECTIVE_BALANCE, + MAX_EFFECTIVE_BALANCE_ELECTRA, + MIN_ACTIVATION_BALANCE, TIMELY_TARGET_FLAG_INDEX, } from "@lodestar/params"; import {BeaconStateAltair, CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js"; -import {getMaxEffectiveBalance} from "../util/validator.js"; /** Same to https://github.com/ethereum/eth2.0-specs/blob/v1.1.0-alpha.5/specs/altair/beacon-chain.md#has_flag */ const TIMELY_TARGET = 1 << TIMELY_TARGET_FLAG_INDEX; @@ -43,7 +44,7 @@ export function processEffectiveBalanceUpdates( // and updated in processPendingDeposits() and processPendingConsolidations() // so it's recycled here for performance. const balances = cache.balances ?? state.balances.getAll(); - const currentEpochValidators = cache.validators; + const isCompoundingValidatorArr = cache.isCompoundingValidatorArr; let numUpdate = 0; for (let i = 0, len = balances.length; i < len; i++) { @@ -58,7 +59,7 @@ export function processEffectiveBalanceUpdates( effectiveBalanceLimit = MAX_EFFECTIVE_BALANCE; } else { // from electra, effectiveBalanceLimit is per validator - effectiveBalanceLimit = getMaxEffectiveBalance(currentEpochValidators[i].withdrawalCredentials); + effectiveBalanceLimit = isCompoundingValidatorArr[i] ? MAX_EFFECTIVE_BALANCE_ELECTRA : MIN_ACTIVATION_BALANCE; } if ( diff --git a/packages/state-transition/src/epoch/processPendingDeposits.ts b/packages/state-transition/src/epoch/processPendingDeposits.ts index 866dcc2510ad..e00e1ef93c8c 100644 --- a/packages/state-transition/src/epoch/processPendingDeposits.ts +++ b/packages/state-transition/src/epoch/processPendingDeposits.ts @@ -3,6 +3,7 @@ import {PendingDeposit} from "@lodestar/types/lib/electra/types.js"; import {addValidatorToRegistry, isValidDepositSignature} from "../block/processDeposit.js"; import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js"; import {increaseBalance} from "../util/balance.js"; +import {hasCompoundingWithdrawalCredential} from "../util/electra.js"; import {computeStartSlotAtEpoch} from "../util/epoch.js"; import {getActivationExitChurnLimit} from "../util/validator.js"; @@ -106,6 +107,8 @@ function applyPendingDeposit( // Verify the deposit signature (proof of possession) which is not checked by the deposit contract if (isValidDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) { addValidatorToRegistry(ForkSeq.electra, state, pubkey, withdrawalCredentials, amount); + const newValidatorIndex = state.validators.length - 1; + cache.isCompoundingValidatorArr[newValidatorIndex] = hasCompoundingWithdrawalCredential(withdrawalCredentials); } } else { // Increase balance From 0c1ad93f8919c66abf0053ec3f9c2519623ec1b6 Mon Sep 17 00:00:00 2001 From: twoeths Date: Wed, 27 Nov 2024 17:01:15 +0700 Subject: [PATCH 16/48] fix: handle outOfRangeData when range sync Deneb (#7249) * fix: handle outOfRangeData for beaconBlocksMaybeBlobsByRange() * fix: lint * fix: archiveBlocks - handle deneb outOfRangeData block --- .../src/chain/archiver/archiveBlocks.ts | 44 ++++++++++++++----- .../reqresp/beaconBlocksMaybeBlobsByRange.ts | 8 ++-- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts index 69c7dedfc560..ad0ac0ff2c6b 100644 --- a/packages/beacon-node/src/chain/archiver/archiveBlocks.ts +++ b/packages/beacon-node/src/chain/archiver/archiveBlocks.ts @@ -59,8 +59,8 @@ export async function archiveBlocks( }); if (finalizedPostDeneb) { - await migrateBlobSidecarsFromHotToColdDb(config, db, finalizedCanonicalBlockRoots); - logger.verbose("Migrated blobSidecars from hot DB to cold DB"); + const migrate = await migrateBlobSidecarsFromHotToColdDb(config, db, finalizedCanonicalBlockRoots, currentEpoch); + logger.verbose(migrate ? "Migrated blobSidecars from hot DB to cold DB" : "Skip blobSidecars migration"); } } @@ -157,22 +157,36 @@ async function migrateBlocksFromHotToColdDb(db: IBeaconDb, blocks: BlockRootSlot } } +/** + * Migrate blobSidecars from hot db to cold db. + * @returns true if we do that, false if block is out of range data. + */ async function migrateBlobSidecarsFromHotToColdDb( config: ChainForkConfig, db: IBeaconDb, - blocks: BlockRootSlot[] -): Promise { + blocks: BlockRootSlot[], + currentEpoch: Epoch +): Promise { + let result = false; + for (let i = 0; i < blocks.length; i += BLOB_SIDECAR_BATCH_SIZE) { const toIdx = Math.min(i + BLOB_SIDECAR_BATCH_SIZE, blocks.length); const canonicalBlocks = blocks.slice(i, toIdx); // processCanonicalBlocks - if (canonicalBlocks.length === 0) return; + if (canonicalBlocks.length === 0) return false; // load Buffer instead of ssz deserialized to improve performance const canonicalBlobSidecarsEntries: KeyValue[] = await Promise.all( canonicalBlocks - .filter((block) => config.getForkSeq(block.slot) >= ForkSeq.deneb) + .filter((block) => { + const blockSlot = block.slot; + const blockEpoch = computeEpochAtSlot(blockSlot); + return ( + config.getForkSeq(blockSlot) >= ForkSeq.deneb && + blockEpoch >= currentEpoch - config.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS + ); + }) .map(async (block) => { const bytes = await db.blobSidecars.getBinary(block.root); if (!bytes) { @@ -182,12 +196,20 @@ async function migrateBlobSidecarsFromHotToColdDb( }) ); - // put to blockArchive db and delete block db - await Promise.all([ - db.blobSidecarsArchive.batchPutBinary(canonicalBlobSidecarsEntries), - db.blobSidecars.batchDelete(canonicalBlocks.map((block) => block.root)), - ]); + const migrate = canonicalBlobSidecarsEntries.length > 0; + + if (migrate) { + // put to blockArchive db and delete block db + await Promise.all([ + db.blobSidecarsArchive.batchPutBinary(canonicalBlobSidecarsEntries), + db.blobSidecars.batchDelete(canonicalBlocks.map((block) => block.root)), + ]); + } + + result = result || migrate; } + + return result; } /** diff --git a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts index 21d781f11437..d19a7867d873 100644 --- a/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts +++ b/packages/beacon-node/src/network/reqresp/beaconBlocksMaybeBlobsByRange.ts @@ -36,8 +36,9 @@ export async function beaconBlocksMaybeBlobsByRange( return blocks.map((block) => getBlockInput.preData(config, block.data, BlockSource.byRange, block.bytes)); } + // From Deneb // Only request blobs if they are recent enough - if (computeEpochAtSlot(startSlot) >= currentEpoch - config.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS) { + if (startEpoch >= currentEpoch - config.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS) { const [allBlocks, allBlobSidecars] = await Promise.all([ network.sendBeaconBlocksByRange(peerId, request), network.sendBlobSidecarsByRange(peerId, request), @@ -46,8 +47,9 @@ export async function beaconBlocksMaybeBlobsByRange( return matchBlockWithBlobs(config, allBlocks, allBlobSidecars, endSlot, BlockSource.byRange, BlobsSource.byRange); } - // Post Deneb but old blobs - throw Error("Cannot sync blobs outside of blobs prune window"); + // Data is out of range, only request blocks + const blocks = await network.sendBeaconBlocksByRange(peerId, request); + return blocks.map((block) => getBlockInput.outOfRangeData(config, block.data, BlockSource.byRange, block.bytes)); } // Assumes that the blobs are in the same sequence as blocks, doesn't require block to be sorted From 48dea55f542b6356d301663ec7c36e5ab9412c1b Mon Sep 17 00:00:00 2001 From: twoeths Date: Thu, 28 Nov 2024 14:20:20 +0700 Subject: [PATCH 17/48] fix: sync cached balance when adding new validator to registry (#7255) * fix: sync cached balance when adding new validator to registry * chore: add more comments * fix: remove persisted checkpoint states from the previous run at startup --- .../chain/stateCache/persistentCheckpointsCache.ts | 11 +++++------ .../src/epoch/processPendingDeposits.ts | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts index 7fb67a758673..d0540e507df3 100644 --- a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts @@ -151,12 +151,11 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { await this.datastore.init(); } const persistedKeys = await this.datastore.readKeys(); - for (const persistedKey of persistedKeys) { - const cp = datastoreKeyToCheckpoint(persistedKey); - this.cache.set(toCacheKey(cp), {type: CacheItemType.persisted, value: persistedKey}); - this.epochIndex.getOrDefault(cp.epoch).add(toRootHex(cp.root)); - } - this.logger.info("Loaded persisted checkpoint states from the last run", { + // all checkpoint states from the last run are not trusted, remove them + // otherwise if we have a bad checkpoint state from the last run, the node get stucked + // this was found during mekong devnet, see https://github.com/ChainSafe/lodestar/pull/7255 + await Promise.all(persistedKeys.map((key) => this.datastore.remove(key))); + this.logger.info("Removed persisted checkpoint states from the last run", { count: persistedKeys.length, maxEpochsInMemory: this.maxEpochsInMemory, }); diff --git a/packages/state-transition/src/epoch/processPendingDeposits.ts b/packages/state-transition/src/epoch/processPendingDeposits.ts index e00e1ef93c8c..d925aa1cc741 100644 --- a/packages/state-transition/src/epoch/processPendingDeposits.ts +++ b/packages/state-transition/src/epoch/processPendingDeposits.ts @@ -109,6 +109,12 @@ function applyPendingDeposit( addValidatorToRegistry(ForkSeq.electra, state, pubkey, withdrawalCredentials, amount); const newValidatorIndex = state.validators.length - 1; cache.isCompoundingValidatorArr[newValidatorIndex] = hasCompoundingWithdrawalCredential(withdrawalCredentials); + // set balance, so that the next deposit of same pubkey will increase the balance correctly + // this is to fix the double deposit issue found in mekong + // see https://github.com/ChainSafe/lodestar/pull/7255 + if (cachedBalances) { + cachedBalances[newValidatorIndex] = amount; + } } } else { // Increase balance From aaac34aeab632615ceb76ced2b89ca535371557a Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 29 Nov 2024 11:18:21 +0100 Subject: [PATCH 18/48] fix: do not throw error when trying to prune missing directory (#7257) --- packages/cli/src/util/pruneOldFilesInDir.ts | 4 ++++ packages/cli/test/unit/util/pruneOldFilesInDir.test.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/cli/src/util/pruneOldFilesInDir.ts b/packages/cli/src/util/pruneOldFilesInDir.ts index 3d5cc2b60bcb..8b8dfe754059 100644 --- a/packages/cli/src/util/pruneOldFilesInDir.ts +++ b/packages/cli/src/util/pruneOldFilesInDir.ts @@ -2,6 +2,10 @@ import fs from "node:fs"; import path from "node:path"; export function pruneOldFilesInDir(dirpath: string, maxAgeMs: number): number { + if (!fs.existsSync(dirpath)) { + return 0; // Nothing to prune + } + let deletedFileCount = 0; for (const entryName of fs.readdirSync(dirpath)) { const entryPath = path.join(dirpath, entryName); diff --git a/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts b/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts index a50c59547688..ee5532a358ee 100644 --- a/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts +++ b/packages/cli/test/unit/util/pruneOldFilesInDir.test.ts @@ -55,6 +55,10 @@ describe("pruneOldFilesInDir", () => { expect(fs.existsSync(emptyDir)).toBe(false); }); + it("should handle missing directories", () => { + expect(() => pruneOldFilesInDir(path.join(dataDir, "does-not-exist"), DAYS_TO_MS)).not.toThrowError(); + }); + function createFileWithAge(path: string, ageInDays: number): void { // Create a new empty file fs.closeSync(fs.openSync(path, "w")); From c9af6c37f985928491ed1060c4fba453bc9dd0c3 Mon Sep 17 00:00:00 2001 From: Phil Ngo <58080811+philknows@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:17:43 -0500 Subject: [PATCH 19/48] docs: update documentation Oct 2024 (#7178) * docs update oct 2024 init * Reconfig quickstart nav and minor fixes * fix lint * spelling fixes * minor fixes and add to wordlist * prettier fix * add to wordlist * sort wordlist * modify dominance to include lighthouse * fix typescript casing and add recommendation * add selection and boost_factor with keymanager notice * update wordlist * remove builder enabled and add keymanager api * spelling --------- Co-authored-by: Nico Flaig --- .wordlist.txt | 26 + docs/docusaurus.config.ts | 32 +- docs/pages/google0c42298b7ec08b7e.html | 1 - docs/pages/index.md | 24 +- docs/pages/introduction.md | 24 +- .../run/beacon-management/starting-a-node.md | 126 +-- .../pages/run/getting-started/installation.md | 6 +- .../quick-start-custom-guide.md | 728 ++++++++++++++++++ docs/pages/run/getting-started/quick-start.md | 28 +- .../logging-and-metrics/client-monitoring.md | 2 +- .../run/logging-and-metrics/dashboards.md | 0 .../run/logging-and-metrics/log-management.md | 3 - .../logging-and-metrics/metrics-management.md | 0 .../logging-and-metrics/prometheus-grafana.md | 10 +- .../validator-management/proposer-config.md | 48 ++ .../validator-management/vc-configuration.md | 4 + docs/pages/supporting-libraries/libraries.md | 4 +- docs/pages/trouble-shooting.md | 1 - docs/sidebars.ts | 21 +- packages/light-client/README.md | 2 +- packages/prover/README.md | 2 +- 21 files changed, 954 insertions(+), 138 deletions(-) delete mode 100644 docs/pages/google0c42298b7ec08b7e.html create mode 100644 docs/pages/run/getting-started/quick-start-custom-guide.md delete mode 100644 docs/pages/run/logging-and-metrics/dashboards.md delete mode 100644 docs/pages/run/logging-and-metrics/log-management.md delete mode 100644 docs/pages/run/logging-and-metrics/metrics-management.md create mode 100644 docs/pages/run/validator-management/proposer-config.md delete mode 100644 docs/pages/trouble-shooting.md diff --git a/.wordlist.txt b/.wordlist.txt index a2e642a926a0..2c28fc784061 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -1,3 +1,4 @@ +API APIs Andreas Antonopoulos @@ -13,6 +14,7 @@ Casper Chai ChainSafe Codespaces +CoinCashew Corepack Customizations DPoS @@ -29,6 +31,7 @@ ENRs ETH Edgington Erigon +Esat EthStaker EtherScan Ethereum @@ -37,8 +40,11 @@ FINDNODE FX Flamegraph Flamegraphs +GPG Geth Github +Goerli +Golang Gossipsub Grafana Grandine @@ -46,6 +52,7 @@ HTTPS HackMD Hashicorp Homebrew +Hyperledger IPFS IPv Infura @@ -60,15 +67,18 @@ LGPLv LMD LPoS LTS +LVM Lerna MEV MacOS Metamask +MevBoost ModuleNotFoundError Monorepo NPM NVM Nethermind +Nim NodeJS NodeSource OSI @@ -81,9 +91,11 @@ Quickstart RPC Reth Ryzen +SFTP SHA SSD SSZ +Somer Stakehouse TOC TTD @@ -103,6 +115,7 @@ backfill beaconcha blockRoot blockchain +blockspace blst bootnode bootnodes @@ -110,6 +123,7 @@ bundlers chainConfig chainsafe chiado +chmod cli cmd codebase @@ -125,6 +139,8 @@ dApp dApps ddos decrypt +decrypted +derypted deserialization dev devcontainer @@ -139,30 +155,38 @@ env envs ephemery ethers +feeRecipient flamegraph flamegraphs floodsub +fsSL getNetworkIdentity gnosis +gpg heapdump heaptrack holesky interop js +keymanager keypair +keyrings keystore keystores libp lightclient linter +liveness lldb llnode lockfile mainnet malloc +mbps mdns merkle merkleization +misconfiguration mmeshsub monorepo multiaddr @@ -199,6 +223,7 @@ ssz stakers subnet subnets +sudo tcp testnet testnets @@ -215,6 +240,7 @@ vite vitest webpack wip +xRelayPubKey xcode yaml yamux diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index e37cee619e81..3e57867009f8 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -97,29 +97,23 @@ const config: Config = { style: "dark", links: [ { - title: "Docs", - items: [ - { - label: "Introduction", - to: "/introduction", - }, - ], + label: 'Lodestar Website', + href: 'https://lodestar.chainsafe.io', }, { - title: "Community", - items: [ - { - label: "Discord", - href: "https://discord.com/invite/yjyvFRP", - }, - { - label: "Twitter", - href: "https://twitter.com/lodestar_eth", - }, - ], + label: 'Discord', + href: 'https://discord.com/invite/yjyvFRP', + }, + { + label: 'Twitter/X', + href: 'https://x.com/lodestar_eth', + }, + { + label: 'Github', + href: 'https://github.com/ChainSafe/lodestar', }, ], - copyright: `Copyright © ${new Date().getFullYear()} ChainSafe, Inc.`, + copyright: `Copyright © ${new Date().getFullYear()} ChainSafe. Built with Docusaurus.` , }, colorMode: { respectPrefersColorScheme: false, diff --git a/docs/pages/google0c42298b7ec08b7e.html b/docs/pages/google0c42298b7ec08b7e.html deleted file mode 100644 index 7edebde149af..000000000000 --- a/docs/pages/google0c42298b7ec08b7e.html +++ /dev/null @@ -1 +0,0 @@ -google-site-verification: google0c42298b7ec08b7e.html \ No newline at end of file diff --git a/docs/pages/index.md b/docs/pages/index.md index c74ad6470d7d..2bca344b84cb 100644 --- a/docs/pages/index.md +++ b/docs/pages/index.md @@ -4,14 +4,14 @@ title: Home ![lodestar logo](../../assets/lodestar_icon_text_black_stroke.png) -## Welcome to the Lodestar documentation +## Welcome to the Lodestar Documentation -> **Lodestar is an open-source Ethereum Consensus client and Typescript ecosystem, maintained by ChainSafe Systems** +> **Lodestar is an open-source Ethereum Consensus client and TypeScript ecosystem, maintained by ChainSafe Systems** -### Getting started +### Getting Started - Follow the instructions for [build from source](./run/getting-started/installation#build-from-source), [binaries](./run/getting-started/installation#binaries), or [Docker](./run/getting-started/installation#docker-installation) to install Lodestar. Or use our [Lodestar Quickstart scripts](https://github.com/ChainSafe/lodestar-quickstart). -- Use [Lodestar libraries](./supporting-libraries/index.md) in your next Ethereum Typescript project. +- Use [Lodestar libraries](./supporting-libraries/index.md) in your next Ethereum TypeScript project. - Run a beacon node on [mainnet or a public testnet](./run/beacon-management/starting-a-node.md). - Utilize the whole stack by [starting a local testnet](./contribution/advanced-topics/setting-up-a-testnet.md). - View the Lodestar Beacon [CLI commands and options](./run/beacon-management/beacon-cli.md) @@ -26,14 +26,18 @@ Hardware specifications minimum / recommended, to run the Lodestar client. | | Minimum | Recommended | | --------- | -------------------------------------- | -------------------------------------- | | Processor | Intel Core i3–9100 or AMD Ryzen 5 3450 | Intel Core i7–9700 or AMD Ryzen 7 4700 | -| Memory | 16GB RAM | 32GB RAM | -| Storage | 100GB available space SSD | 1TB available space SSD | -| Internet | Broadband connection | Broadband connection | +| Memory | 8 GB RAM | 16 GB RAM | +| Storage | 130 GB available space SSD | 200 GB available space SSD | +| Internet | Reliable broadband with 10mbps upload | Reliable broadband with >10mbps upload | -## About these docs +### Execution Client -This documentation is open source, contribute at [Github Lodestar repository /docs](https://github.com/ChainSafe/lodestar/tree/unstable/docs). +If you run the [execution client](https://ethereum.org/en/developers/docs/nodes-and-clients/#execution-clients) on the same host, you will need to check their requirements and add them to the above requirements. Broadly, to run both an execution and a consensus client on the same machine, we recommend a 4 TB SSD and 32 GB RAM. -## Need assistance? +## About These Docs + +This documentation is open source, contribute on our [Github Lodestar repository /docs](https://github.com/ChainSafe/lodestar/tree/unstable/docs). + +## Need Assistance? If you have questions about this documentation, feel free to talk to us on our [ChainSafe Discord](https://discord.gg/yjyvFRP) or [open an issue](https://github.com/ChainSafe/lodestar/issues/new/choose) and a member of the team or our community will be happy to assist you. diff --git a/docs/pages/introduction.md b/docs/pages/introduction.md index ab864b8a9df8..f74d0b70768d 100644 --- a/docs/pages/introduction.md +++ b/docs/pages/introduction.md @@ -1,29 +1,29 @@ # Introduction -Ethereum is one of the most profoundly important inventions in recent history. It is a decentralized, open-source blockchain featuring smart contract functionality. It is the second-largest cryptocurrency by market capitalization, after Bitcoin, and is the most actively used blockchain. Ethereum was proposed in 2013 by programmer Vitalik Buterin. Development was crowdfunded in 2014, and the network went live on 30 July 2015, with 72 million coins premined. ChainSafe was founded not too long afterwards and has been actively working in the Ethereum space ever since. We are proud to develop Lodestar and to present this documentation as a resource for the Ethereum community. +Ethereum is one of the most profoundly important inventions in recent history. It is a decentralized, open-source blockchain featuring smart contract functionality. It is the second-largest cryptocurrency by market capitalization, after Bitcoin, and is the second largest blockchain by market capitalization. Ethereum was proposed in 2013 by programmer Vitalik Buterin. Development was crowdfunded in 2014, and the network went live on 30 July 2015, with 72 million coins premined. ChainSafe was founded not too long afterwards in 2017 and has been actively working in the Ethereum ecosystem ever since. We are proud to develop Lodestar, the only TypeScript based consensus client, and to present this documentation as a resource for the Ethereum community. ## Proof of Stake -In Ethereum's Proof of Stake (PoS) model, validators replace miners from the Proof of Work (PoW) system. Validators are Ethereum stakeholders who lock up a portion of their Ether as a stake. The protocol randomly selects these validators to propose new blocks. The chance of being chosen is tied to the size of their stake: the more Ether staked, the higher the probability of being selected to propose the block. Proposers receive transaction fees and block rewards as incentives. Validators are also responsible for voting on the validity of blocks proposed by other validators. However, they face penalties, known as slashing, for actions like double-signing, votes on a block that is not in the majority or going offline, ensuring network integrity and reliability. The PoS mechanism significantly reduces energy consumption compared to PoW, because it does not require extensive computational power. Moreover, PoS tends to facilitate faster transaction validations and block creations, enhancing the overall performance and scalability of the network. +In Ethereum's Proof of Stake (PoS) model, validators replace miners from the Proof of Work (PoW) system. Validators are Ethereum stakeholders who lock up a portion of their Ether as a stake. The protocol randomly selects these validators to propose new blocks. The chance of being chosen is tied to the size of their stake: the more Ether staked, the higher the probability of being selected to propose the block. Proposers receive transaction fees and block rewards as incentives. Validators are also responsible for voting on the validity of blocks proposed by other validators. However, they also face penalties, known as slashing, for actions like signing two different block proposals in the same slot or voting on two different attestations for the same target epoch, which creates conflicting states. The PoS mechanism significantly reduces energy consumption compared to PoW, because it does not require extensive computational power. Moreover, PoS tends to facilitate faster transaction validations and block creations, enhancing the overall performance and scalability of the network. ## Consensus Clients -In an effort to promote client diversity there are several beacon-nodes being developed. Each is programmed in a different language and by a different team. The following is a list of the current beacon-node clients: +In an effort to promote client diversity there are several consensus beacon nodes being developed. Each is programmed in a different language and by a different team. The following is a list of the current open source consensus clients in alphabetical order: -- [Lodestar](https://lodestar.chainsafe.io/) -- [Prysm](https://prysmaticlabs.com/) -- [Lighthouse](https://lighthouse.sigmaprime.io/) -- [Teku](https://consensys.net/knowledge-base/ethereum-2/teku/) -- [Nimbus](https://nimbus.team/) -- [Grandine](https://grandine.io) +- [Grandine (Rust)](https://grandine.io) +- [Lighthouse (Rust)](https://lighthouse.sigmaprime.io/) +- [Lodestar (TypeScript)](https://lodestar.chainsafe.io/) +- [Nimbus (Nim)](https://nimbus.team/) +- [Prysm (Golang)](https://prysmaticlabs.com/) +- [Teku (Java)](https://consensys.net/knowledge-base/ethereum-2/teku/) ## Why Client Diversity? -The Ethereum network's robustness is significantly enhanced by its client diversity, whereby multiple, independently-developed clients conforming to a common specification facilitate seamless interaction and function equivalently across nodes. This client variety not only fosters a rich ecosystem but also provides a buffer against network-wide issues stemming from bugs or malicious attacks targeted at particular clients. For instance, during the Shanghai denial-of-service attack in 2016, the diversified client structure enabled the network to withstand the assault, underscoring the resilience afforded by multiple client configurations. +The Ethereum network's robustness is significantly enhanced by its client diversity, whereby multiple, independently-developed clients conforming to a common specification, facilitating seamless interaction and function equivalently across different nodes. This client variety not only fosters a rich ecosystem but also provides a buffer against network-wide issues stemming from bugs or malicious attacks targeted at particular clients. For instance, during the Shanghai denial-of-service attack in 2016, the diversified client structure enabled the network to withstand the assault, underscoring the resilience afforded by multiple client configurations. -On the consensus layer, client distribution is crucial for maintaining network integrity and finality, ensuring transactions are irreversible once validated. A balanced spread of nodes across various clients helps mitigate risks associated with potential bugs or attacks that could, in extreme cases, derail the consensus process or lead to incorrect chain splits, thereby jeopardizing the network's stability and trust. While the data suggests a dominance of Prysm client on the consensus layer, efforts are ongoing to promote a more even distribution among others like Lighthouse, Teku, Nimbus and Grandine. Encouraging the adoption of minority clients, bolstering their documentation, and leveraging real-time client diversity dashboards are among the strategies being employed to enhance client diversity, which in turn fortifies the Ethereum consensus layer against adversities and fosters a healthier decentralized network ecosystem. +On the consensus layer, client distribution is crucial for maintaining network integrity and finality, ensuring transactions are irreversible once validated. A balanced spread of nodes across various clients help to mitigate risks associated with potential bugs or attacks that could, in extreme cases, derail the consensus process (liveness failure) or lead to incorrect chain splits (forking), thereby jeopardizing the network's stability and trust. While the data suggests a [dominance of the Prysm and Lighthouse clients](https://clientdiversity.org) on the consensus layer, efforts are ongoing to promote a more even distribution among others clients. Encouraging the adoption of minority clients, bolstering their documentation, and leveraging real-time client diversity dashboards are among the strategies being employed to enhance client diversity, which in turn fortifies the Ethereum consensus layer against adversities and fosters a healthier decentralized network. -The non-finality event in May 2023 on the Ethereum network posed a significant challenge. The issue arose from attestations for a fork, which necessitated state replays to validate the attestations, causing a notable strain on system resources. As a result, nodes fell out of sync, which deterred the accurate tracking of the actual head of the chain. This situation was exacerbated by a decline in attestations during specific epochs, further hampering the consensus mechanism. The Lodestar team noticed late attestations several weeks prior to the event and implemented a feature that attempted to address such challenges by not processing untimely attestations, and thus not requiring expensive state replays​. While it was done for slightly different reasons, the result was the same. Lodestar was able to follow the chain correctly and helped to stabilize the network. This example underscored the importance of client diversity and network resilience against potential forks and replay attacks. These are considered realistic threats, especially in the context of system complexity like in Ethereum's consensus mechanism. +The [non-finality event of May 2023](https://medium.com/offchainlabs/post-mortem-report-ethereum-mainnet-finality-05-11-2023-95e271dfd8b2) on the Ethereum network posed a significant challenge. The issue arose from attestations for a fork, which necessitated state replays to validate the attestations, causing a notable strain on system resources. As a result, nodes fell out of sync, which deterred the accurate tracking of the actual head of the chain. This situation was exacerbated by a decline in attestations during specific epochs, further hampering the consensus mechanism from reaching finality. The Lodestar team noticed late attestations several weeks prior to the event and implemented a feature that attempted to address such challenges by not processing untimely attestations, and thus not requiring expensive state replays​. While it was done for slightly different reasons, the result was the same. Lodestar was able to follow the chain correctly and helped to stabilize the network. This example underscored the importance of client diversity and network resilience against potential forks and replay attacks. These are considered realistic threats, especially in the context of system complexity like in Ethereum's consensus mechanism. ## Ethereum Reading List diff --git a/docs/pages/run/beacon-management/starting-a-node.md b/docs/pages/run/beacon-management/starting-a-node.md index 6838e14304d6..7aa0799b6e83 100644 --- a/docs/pages/run/beacon-management/starting-a-node.md +++ b/docs/pages/run/beacon-management/starting-a-node.md @@ -2,15 +2,13 @@ title: Starting a Node --- -# Beacon management +# Beacon Management -The following instructions are required to setup and run a Lodestar beacon node. +Running a Lodestar node on mainnet or a testnet only requires basic familiarity with the terminal. The following instructions are required to configure and run the Lodestar beacon node. This page assumes you have already setup an Ethereum execution client. -## Connect to mainnet or a public testnet +## Connect to Mainnet or a Public Testnet -Running a Lodestar node on mainnet or a testnet only requires basic familiarity with the terminal. - -Make sure Lodestar is installed in your local environment, following the chosen install method. The following command should return a non error message. +Make sure Lodestar is installed in your local environment, following the chosen [Installation](../getting-started/installation.md) method. The following command should return a non-error message. ```bash ./lodestar --help @@ -18,25 +16,21 @@ Make sure Lodestar is installed in your local environment, following the chosen For a complete list of beacon node CLI commands and options, see the [`beacon` CLI Command](../beacon-management/beacon-cli.md) section. -To select a known testnet or mainnet, use the `--network` flag. `mainnet` is selected by default, and a list of available networks is listed with the `--help` flag. Setting the `--network` flag will conveniently configure the beacon node or validator client for the selected network. For power users, any configuration option should be able to be overridden. +To select a known testnet or mainnet, use the `--network` flag. The option `mainnet` is selected by default, and a list of available networks is listed with the `--help` flag. Setting the `--network` flag will conveniently configure the beacon node for the selected network. For power users, any configuration option should be able to be overridden. -## Configure the Lodestar JWT authentication token +## Configure the Lodestar JWT Authentication Token -Post-Merge Ethereum will require [secure authentication with the Engine API](https://github.com/ethereum/execution-apis/blob/main/src/engine/authentication.md) connection on your chosen Execution node. +Ethereum requires a [secure authentication with the Engine API](https://github.com/ethereum/execution-apis/blob/main/src/engine/authentication.md) for connecting to your chosen execution client on port 8551. -:::info -Post-Merge Ethereum **requires** a secure, authenticated connection to the Execution client on port 8551. We recommend setting this up now to ensure a proper configuration before the Merge. -::: - -### Generate a secret key +### Generate a Secret Key You must generate a secret 32-byte (64 characters) hexadecimal string that will be used to authenticate with an execution node. You can use the following command in most terminals to generate a random secret: `openssl rand -hex 32`. Or you can use an [online generator](https://codebeautify.org/generate-random-hexadecimal-numbers). Save this secret key into a text file and note where you store this file. -### Configure Lodestar to locate the JWT secret +### Configure Lodestar to Locate the JWT Secret When starting up a Lodestar beacon node in any configuration, ensure you add the `--jwtSecret $JWT_SECRET_PATH` flag to point to the saved secret key file. -### Ensure JWT is configured with your execution node +### Configure the Execution Client with the JWT Secret **For Go Ethereum:** Use the `--authrpc.jwtsecret /path/to/jwtsecret.hex` flag to configure the secret. Use their documentation [here](https://geth.ethereum.org/docs/getting-started#start-geth). @@ -53,59 +47,68 @@ Use the `--authrpc.jwtsecret /path/to/jwtsecret.hex` flag to configure the secre **For Reth:** Use the `--authrpc.jwtsecret /path/to/jwtsecret.hex` flag to configure the secret. Use their documentation [here](https://reth.rs/run/mainnet.html?highlight=jwt#running-the-reth-node). -## Run a beacon node +## Run the Beacon Node -To start a Lodestar beacon run the command: +To start the Lodestar beacon, run the command: ```bash ./lodestar beacon --network $NETWORK_NAME --jwtSecret $JWT_SECRET_PATH ``` -This will assume an execution-layer client is available at the default -location of `https://localhost:8545`. +This will assume an execution client is available at the default location of `https://localhost:8545`. -In case execution-layer clients are available at different locations, use `--execution.urls` to specify these locations in the command: +If the execution clients are available at different locations, use the flag `--execution.urls` to specify these locations in the command: ```bash ./lodestar beacon --network $NETWORK_NAME --jwtSecret $JWT_SECRET_PATH --execution.urls $EL_URL1 $EL_URL2 ``` -Immediately you should see confirmation that the node has started +Your initial logs should confirm that the node has started. ```txt -Apr-20 15:12:45.274[] info: Lodestar network=mainnet, version=v1.7.2, commit= -Apr-20 15:12:45.327[] info: Connected to LevelDB database path=/data/mt1/chain-db -Apr-20 15:12:57.747[] info: Initializing beacon from a valid db state slot=6264480, epoch=195765, stateRoot=0x8133cd4d0be59c3e94405f902fe0ad68ffaa5013b525dddb6285b91ad79716f6, isWithinWeakSubjectivityPeriod=true -Apr-20 15:13:18.077[network] info: PeerId 16Uiu2HAmDsGet67va6VCnaW2Tu1Ae2yujiDMnmURMMWNvssER7ZQ, Multiaddrs /ip4/127.0.0.1/tcp/9000/p2p/16Uiu2HAmDsGet67va6VCnaW2Tu1Ae2yujiDMnmURMMWNvssER7ZQ,/ip4/10.244.0.199/tcp/9000/p2p/16Uiu2HAmDsGet67va6VCnaW2Tu1Ae2yujiDMnmURMMWNvssER7ZQ -Apr-20 15:13:18.270[rest] info: Started REST API server address=http://127.0.0.1:9596 -Apr-20 15:13:18.271[] warn: Low peer count peers=0 -Apr-20 15:13:18.280[] info: Searching peers - peers: 0 - slot: 6264964 - head: (slot - 484) 0x7ee6…2a15 - exec-block: syncing(17088043 0x9442…) - finalized: 0xe359…4d7e:195763 -Apr-20 15:13:23.009[chain] info: Validated transition configuration with execution client terminalTotalDifficulty=0xc70d808a128d7380000, terminalBlockHash=0x0000000000000000000000000000000000000000000000000000000000000000, terminalBlockNumber=0x0 -Apr-20 15:13:29.287[] info: Syncing - ? left - 0.00 slots/s - slot: 6264965 - head: (slot - 485) 0x7ee6…2a15 - exec-block: syncing(17088043 0x9442…) - finalized: 0xe359…4d7e:195763 - peers: 1 -Apr-20 15:14:41.003[] info: Syncing - 22 seconds left - 4.92 slots/s - slot: 6264971 - head: (slot - 108) 0xd15f…b605 - exec-block: valid(17088414 0x3dba…) - finalized: 0x70fd…5157:195775 - peers: 4 -Apr-20 15:14:53.001[] info: Syncing - 9 seconds left - 5.00 slots/s - slot: 6264972 - head: (slot - 45) 0x44e4…20a4 - exec-block: valid(17088475 0xca61…) - finalized: 0x9cbd…ba83:195776 - peers: 8 -Apr-20 15:15:01.443[network] info: Subscribed gossip core topics -Apr-20 15:15:01.446[sync] info: Subscribed gossip core topics -Apr-20 15:15:05.000[] info: Synced - slot: 6264973 - head: 0x90ea…c655 - exec-block: valid(17088521 0xca9b…) - finalized: 0x6981…682f:195778 - peers: 6 +Jul-31 13:35:27.967[] info: Lodestar network=mainnet, version=v1.21.0/ff35faa, commit=ff35faae4ad1697b86d708a0367a95a71648ab6e +Jul-31 13:35:28.344[] info: Connected to LevelDB database path=/data/lodestar/chain-db +Jul-31 13:35:49.828[] info: Initializing beacon from a valid db state slot=9633504, epoch=301047, stateRoot=0xfa2845a6877b98555906a1654941c97d9c05bdd41e61cc0870a967dc9030b156, isWithinWeakSubjectivityPeriod=true +Jul-31 13:35:51.955[chain] info: Historical state worker started +Jul-31 13:35:51.969[eth1] info: Eth1 provider urls=http://localhost:8551 +Jul-31 13:35:51.975[execution] info: Execution client urls=http://localhost:8551 +Jul-31 13:35:51.977[] info: External builder url=http://localhost:8661 +Jul-31 13:36:21.128[network] info: running libp2p instance in worker thread +Jul-31 13:36:21.727[network] info: libp2p worker started peer=15Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW +Jul-31 13:36:27.677[network] info: discv5 worker started peerId=16Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW, initialENR=enr:-IO4QHGTUd1Zg8LAhUAioOz_ySTKoJLIOa6zltSP_AvvhTFVYw6M6YB35IxsiKxQG7nUgCpUB5SIsNxMntCNlTK9sMEBgmlkgnY0iXNlY3AyNTZrMaEC24cdmzuGnWqSwF-8Hw2gbkAZDzMWW3LsHJfp_kDhy-GDdGNwgiMog3VkcIIeWH, bindAddr4=/ip4/0.0.0.0/udp/9000 +Jul-31 13:36:28.134[network] info: PeerId 16Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW, Multiaddrs /ip4/0.0.0.0/tcp/9000 +Jul-31 13:36:28.137[metrics] info: Started metrics HTTP server address=http://127.0.0.1:8008 +Jul-31 13:36:28.256[rest] info: Started REST API server address=http://0.0.0.0:9596 +Jul-31 13:36:28.257[] info: Searching peers - peers: 0 - slot: 9634080 - head: (slot -576) 0x9d88…d02a - exec-block: syncing(20426302 0xcec4…) - finalized: 0x7feb…c130:301045 +Jul-31 13:36:36.461[execution] info: Execution client is synced oldState=ONLINE, newState=SYNCED +Jul-31 13:36:53.019[] info: Syncing - 3.7 minutes left - 2.32 slots/s - slot: 9634082 - head: (slot -515) 0x792f…f8aa - exec-block: valid(20426365 0x58b1…) - finalized: 0x9d88…d02a:301047 - peers: 11 +Jul-31 13:38:53.168[] info: Syncing - 11 seconds left - 4.01 slots/s - slot: 9634092 - head: (slot -44) 0x7491…f63e - exec-block: valid(20426841 0xd4b2…) - finalized: 0x1e00…6e6b:301062 - peers: 59 +Jul-31 13:38:58.051[network] info: Subscribed gossip core topics +Jul-31 13:38:58.132[sync] info: Subscribed gossip core topics +Jul-31 13:39:05.001[] info: Synced - slot: 9634093 - head: 0x35de…1f0e - exec-block: valid(20426886 0x10ff…) - finalized: 0x88f8…5375:301063 - peers: 70 +Jul-31 13:39:17.000[] info: Synced - slot: 9634094 - head: 0x7844…3b3e - exec-block: valid(20426887 0x67d1…) - finalized: 0x88f8…5375:301063 - peers: 69 +Jul-31 13:39:29.000[] info: Synced - slot: 9634095 - head: 0x5516…ba12 - exec-block: valid(20426888 0x4ceb…) - finalized: 0x88f8…5375:301063 - peers: 74 ``` :::info -If your node is stuck with `Searching for peers` review your network configuration to make sure your ports are open. +If your node is stuck with `Searching peers`, review your network configuration to make sure your ports are open and forwarded to your host machine. ::: By default, Lodestar stores all configuration and chain data at the path `$XDG_DATA_HOME/lodestar/$NETWORK_NAME`. -A young testnet should take a few hours to sync. If you see multiple or consistent errors in the logs, please open a [Github issue](https://github.com/ChainSafe/lodestar/issues/new/choose) or reach out to us in [Discord](https://discord.gg/yjyvFRP). Just by reporting anomalies you are helping accelerate the progress of Ethereum Consensus, thanks for contributing! +A young testnet should take a few hours to sync. If you see multiple or consistent errors in the logs, please open a [Github issue](https://github.com/ChainSafe/lodestar/issues/new/choose) or reach out to us in [Discord](https://discord.gg/yjyvFRP). By reporting anomalies, you are helping to accelerate the progress of Ethereum consensus and we thank you for contributing! :::warning -It is dangerous to expose your Beacon APIs publicly as there is no default authentication mechanism provided. Ensure your beacon node host is not exposing ports 8545 or 9596 outside of your internal network. +It is dangerous to expose your Beacon or Execution APIs publicly as there is no default authentication mechanism provided. Ensure your beacon node host is not exposing ports 8545 or 9596 outside of your internal network. ::: ### Checkpoint Sync -If you are starting your node from a blank db, like starting from genesis, or from the last saved state in db and the network is now far ahead, your node will be susceptible to "long range attacks." Ethereum's solution to this is via something called weak subjectivity. [Read Vitalik's illuminating post explaining weak subjectivity.](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/). +If you are starting your node from a blank database, or from a last saved database state that is too old (outside of the weak subjectivity period), your node will be susceptible to "long range attacks." Ethereum's solution to this attack is via something called weak subjectivity. [Read Vitalik's illuminating post explaining weak subjectivity.](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/). -If you have a synced beacon node available (e.g., your friend's node or an infrastructure provider) and a trusted checkpoint you can rely on, you can start off your beacon node in under a minute! And at the same time kicking the "long range attack" in its butt! +If you have a synced beacon node available (e.g., your friend's node or a trusted infrastructure provider) to serve a trusted checkpoint you can rely on, you can start syncing your beacon node from that available checkpoint with the flag `--checkpointSyncUrl` and passing in the URL of the checkpoint provider. This will allow your beacon node to sync within minutes rather than several days. + +The Ethereum community has maintained a set of [public beacon chain checkpoints](https://eth-clients.github.io/checkpoint-sync-endpoints/) that serve these sync endpoints to the larger community. You can correlate the state root and the block root with more than one provider to verify the checkpoints being served follow the same canonical chain. Just supply these **extra arguments** to your beacon node command: @@ -113,28 +116,27 @@ Just supply these **extra arguments** to your beacon node command: --checkpointSyncUrl [--wssCheckpoint ] ``` -In case you really trust `checkpointSyncUrl` then you may skip providing `wssCheckpoint`, which will then result into your beacon node syncing and starting off the recently finalized state from the trusted URL. +In case you really trust the `--checkpointSyncUrl` provider, then you may skip providing `--wssCheckpoint`, which will then result into your beacon node syncing and starting off the recently finalized state from the trusted URL. :::warning -Please use this option very carefully (and at your own risk), a malicious server URL can put you on the wrong chain with a danger of you losing your funds by social engineering. -If possible, validate your `wssCheckpoint` from multiple places (e.g. different client distributions) or from other trusted sources. This will highly reduce the risk of starting off on a malicious chain. -This list of [public endpoints](https://eth-clients.github.io/checkpoint-sync-endpoints/) maintained by the Ethereum community may be used for reference. +Please be aware that a malicious checkpoint sync server URL can put you on the wrong chain with a danger of you losing your funds by social engineering. +If possible, validate your `wssCheckpoint` state from multiple places (e.g. different client distributions) or from other trusted sources. This will highly reduce the risk of starting off on a malicious chain. This list of [public endpoints](https://eth-clients.github.io/checkpoint-sync-endpoints/) maintained by the Ethereum community may be used for reference. ::: -**Taking too long to sync?** +#### Still Taking Long to Sync? -After your node has been offline for a while, it might be the case that it takes a long time to sync even though a `checkpointSyncUrl` is specified. -This is due to the fact that the last db state is still within the weak subjectivity period (~15 days on mainnet) which causes the node -to sync from the db state instead of the checkpoint state. +After your node has been offline for a while, it might be the case that it takes a long time to sync even though a `--checkpointSyncUrl` is specified. +This is due to the fact that the last database state is still within the weak subjectivity period (~15 days on mainnet) which causes the node +to sync from the database state instead of the checkpoint state. -It is possible to force syncing from checkpoint state by supplying the `--forceCheckpointSync` flag. This option is only recommended if it is absolutely +It is possible to force syncing from a checkpoint state by supplying the `--forceCheckpointSync` flag. This option is only recommended if it is absolutely necessary for the node to be synced right away to fulfill its duties as there is an inherent risk each time the state is obtained from an external source. -### Guide to the sync logs +### Sync Log Guide -Lodestar beacon sync log aims to provide information of utmost importance about your node and yet be succinct at the same time. You may see the sync logs in the following format: +The Lodestar beacon sync log aims to provide information of utmost importance about the state of your node and be succinct at the same time. You may see the sync logs in the following format: -`[Sync status] - [ Slot info ] - [Head info] - [Exec block info] - [Finalized info] - [Peers info]` +`[Sync status] - [ Slot info ] - [Head info] - [Execution block info] - [Finalized info] - [Peers info]` See the following example of different kinds of sync log: @@ -171,16 +173,20 @@ Apr-20 15:16:05.000[] info: Synced - slot: 6264978 - head: 0xc9f Apr-20 15:16:17.017[] info: Synced - slot: 6264979 - head: 0xde91…d4cb - exec-block: valid(17088527 0xa488…) - finalized: 0x6981…682f:195778 - peers: 7 ``` -1. Sync status: Takes three values : `Synced` or `Syncing` (along with sync speed info) or `Searching` if node is is still looking for viable peers from where it can download blocks. +1. Sync status: This status takes three values: + +- `Synced`: The node is currently synced +- `Syncing` The node is currently in the syncing process +- `Searching`: The node is is still looking for viable peers from where it can download blocks -2. Slot (clock) info: What is the current ongoing slot as per the chain genesis +2. Slot (clock) info: The current ongoing slot as per the chain genesis -3. Head info: It specifies where the local chain head hash is. In case its far behind the Slot (clock) then it independently shows the head slot else it show how far behind from the Slot it is if difference < 1000. +3. Head info: Specifies where the local beacon chain head hash is. In case it's far behind the Slot (clock), then it independently shows the head slot. Else, it will show how far behind the node is from the Slot (if the difference is < 1000) -4. Execution block info: It provides the execution information about the head whether its confirmed `valid` or execution layer is still `syncing` to it, as well as its number and a short hash to easy identification. +4. Execution block info: Provides the information about the execution block head, whether its confirmed `valid` or still `syncing` to it. In parenthesis, it shows the current execution block number and a short hash for easy identification -5. Finalized info: What is the current local `finalized` checkpoint in the format of `[checkpoint root]:[checkpoint epoch]`, for e.g.: `0xd7ba…8386:189636` +5. Finalized info: Shows the current local `finalized` checkpoint in the format of `[checkpoint root]:[checkpoint epoch]`. For example: `0xd7ba…8386:189636` shows a checkpoint root of `0xd7ba…8386` in epoch `189636` -6. Peer info: Current total number of outbound or inbound peers, for e.g.: `peers: 27` +6. Peer info: Current total number of outbound and inbound peers -For more insight into how a Lodestar beacon node is functioning, you may setup lodestar metrics and use the prepared Grafana dashboards that are found in the repository. Check out our section on [Prometheus and Grafana](../logging-and-metrics/prometheus-grafana.md) for more details. +For more insight into how a Lodestar beacon node is functioning, you may setup Lodestar metrics with the `--metrics` flag and use the prepared Grafana dashboards that are found in the repository. Check out our section on [Prometheus and Grafana](../logging-and-metrics/prometheus-grafana.md) for more details. diff --git a/docs/pages/run/getting-started/installation.md b/docs/pages/run/getting-started/installation.md index 52cb2770725b..40c4865f7726 100644 --- a/docs/pages/run/getting-started/installation.md +++ b/docs/pages/run/getting-started/installation.md @@ -1,8 +1,8 @@ -# Installation +# Install Options ## Binaries -Binaries can be downloaded from [the release page](https://github.com/ChainSafe/lodestar/releases/latest) under the `Assets` section. +Binaries can be downloaded from the Lodestar [release page](https://github.com/ChainSafe/lodestar/releases/latest) under the `Assets` section. ## Docker Installation @@ -100,5 +100,5 @@ pip3 install setuptools --force-reinstall --user ## Install from NPM [not recommended] :::danger -For mainnet (production) usage, we only recommend installing with docker due to [NPM supply chain attacks](https://hackaday.com/2021/10/22/supply-chain-attack-npm-library-used-by-facebook-and-others-was-compromised/). Until a [safer installation method has been found](https://github.com/ChainSafe/lodestar/issues/3596), do not use this install method except for experimental purposes only. +For mainnet (production) usage, we only recommend installing with Docker, using binaries or building from source due to [NPM supply chain attacks](https://hackaday.com/2021/10/22/supply-chain-attack-npm-library-used-by-facebook-and-others-was-compromised/). Until a [safer installation method has been found](https://github.com/ChainSafe/lodestar/issues/3596), do not use this install method except for experimental purposes only. ::: diff --git a/docs/pages/run/getting-started/quick-start-custom-guide.md b/docs/pages/run/getting-started/quick-start-custom-guide.md new file mode 100644 index 000000000000..8afc11c00ebf --- /dev/null +++ b/docs/pages/run/getting-started/quick-start-custom-guide.md @@ -0,0 +1,728 @@ +# Quick Start Custom Setup Guide + +This is a step-by-step guide to utilize [@ChainSafe/lodestar-quickstart](https://github.com/ChainSafe/lodestar-quickstart) to setup a Ubuntu-based full Ethereum node using a local execution client and ChainSafe's Lodestar consensus client via Docker (the recommended method to use Lodestar for production environments). This is an adaptation of [Somer Esat's guides](https://someresat.medium.com/) for the Ethereum staking community. + +This guide will provide instructions which include running a local execution node. This guide uses Lodestar's `stable` release branch and supports **Holesky** testnet setups and **Mainnet**. + +:::info +This guide specifically focuses on using Lodestar's Quickstart scripts which allows for near instant setup with the following technologies: + +- [Ubuntu v22.04 (LTS) x64 server](https://releases.ubuntu.com/22.04/) +- Ethereum Execution (eth1) clients: + - [Erigon](https://github.com/ledgerwatch/erigon/releases) | [Github](https://github.com/ledgerwatch/erigon) + - [Go-Ethereum (Geth)](https://geth.ethereum.org/) | [Github](https://github.com/ethereum/go-ethereum/releases/) + - [Hyperledger Besu](https://www.hyperledger.org/) | [Github](https://github.com/hyperledger/besu) + - [Nethermind](https://nethermind.io/) | [Github](https://github.com/NethermindEth/nethermind) + - [Rust](https://reth.rs) | [Github](https://github.com/paradigmxyz/reth) +- [ChainSafe's Lodestar Ethereum Consensus Client](https://lodestar.chainsafe.io/) | [Github](https://github.com/ChainSafe/lodestar) +- [Docker Engine](https://docs.docker.com/engine/) + ::: + +:::danger +This guide **_does not_** assist with securing your server such as secure SSH logins or enabling firewalls. Ensure you have limited access to your server and blocked unused ports with guides such as [CoinCashew's Security Best Practices for your ETH staking validator node](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet/part-i-installation/guide-or-security-best-practices-for-a-eth2-validator-beaconchain-node) before continuing with this guide. +::: + +:::warning +This guide is for informational purposes only and does not constitute professional advice. The author does not guarantee accuracy of the information in this article and the author is not responsible for any damages or losses incurred by following this article. A full disclaimer can be found at the bottom of this page — please read before continuing. +::: + +## Support + +For technical support please reach out to: + +- The Lodestar team actively develops and collaborates on the [ChainSafe Discord Server](https://discord.gg/642wB3XC3Q) under **_#:star2:-lodestar-general_** channel. +- Please subscribe to our Discord server announcements on the [ChainSafe Discord Server](https://discord.gg/642wB3XC3Q) under **_#lodestar-announcements_** channel. + +## Prerequisites + +This guide assumes knowledge of Ethereum (ETH), Docker, staking and Linux. + +You require the following before getting started: + +- [Ubuntu Server v22.04 (LTS) amd64](https://releases.ubuntu.com/22.04/) or newer, installed and running on a local machine or in the cloud. _A locally running machine is encouraged for greater decentralization — if the cloud provider goes down then all nodes hosted with that provider go down._ + +- 32 ETH to run a solo validator with Lodestar. If running on testnet, contact us in our [ChainSafe Discord Server](https://discord.gg/642wB3XC3Q) for testnet Ether. + +## Testnet to Mainnet + +If moving from a testnet setup to a mainnet setup it is strongly recommended that you start on a fresh (newly installed) server instance. This guide has not been tested for migration scenarios and does not guarantee success if you are using an existing instance with previously installed testnet software. + +## Hardware Requirements + +| | Minimum | Recommended | +| --------- | -------------------------------------- | -------------------------------------- | +| Processor | Intel Core i3–9100 or AMD Ryzen 5 3450 | Intel Core i7–9700 or AMD Ryzen 7 4700 | +| Memory | 8 GB RAM | 16 GB RAM | +| Storage | 130 GB available space SSD | 200 GB available space SSD | +| Internet | Reliable broadband with 10mbps upload | Reliable broadband with >10mbps upload | + +:::info +Check your available disk space. Even you have a large SSD there are cases where Ubuntu is reporting only 100GB free. If this applies to you then take a look at [**_Appendix A — Expanding the Logical Volume._**](#appendix-a---expanding-the-logical-volume) +::: + +--- + +## Setup Machine & Repository + +### Install Docker Engine & Docker Compose + +We must install Docker Engine to run the images on your local machine. + +#### Add Docker's GPG keyrings + +Run each line one at a time. + +```bash= +sudo apt-get update +sudo apt-get install ca-certificates curl gnupg +sudo install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg +``` + +#### Add the repository to Apt sources + +Copy and paste the entire command below. + +```bash +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +``` + +#### Update Ubuntu + +Ensure all updates to your Ubuntu Server are complete. + +```bash= +sudo apt-get update +sudo apt-get upgrade -y +``` + +Hit `Enter` if required to restart services. + +#### Install Docker Engine + +```bash +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +``` + +#### Test Docker + +```bash +sudo docker run hello-world +``` + +If you see the message `Hello from Docker! +This message shows that your installation appears to be working correctly.`, you can move on to the next step. + +#### Clone lodestar-quickstart repository + +Clone the [lodestar-quickstart](https://github.com/ChainSafe/lodestar-quickstart) from Github into your local server. + +```bash +cd ~ && git clone https://github.com/ChainSafe/lodestar-quickstart.git +``` + +## Configure Lodestar Quick Scripts + +### Navigate to the root directory + +The script and required files are located within the `lodestar-quickstart` folder. + +``` +cd lodestar-quickstart +``` + +### Create your own JWT Secret + +We will generate a JWT secret that is shared by the Execution client and Lodestar in order to have a required secure connection for the `Engine API` on port `8551`. + +``` +openssl rand -hex 32 | tr -d "\n" > "jwtsecret" +``` + +Confirm that your JWT token created. + +``` +cat jwtsecret ; echo +``` + +Your terminal should display the secret. Copy the token for the next step. Be careful to only copy the 64 characters corresponding to the secret and nothing else. + +:::danger +:rotating_light: **WARNING:** Do not share this secret as it protects your authenticated port 8551. +::: + +### Input your JWT Secret into the `import-args.sh` script + +Edit the `import-args.sh` file. + +```sh +nano import-args.sh +``` + +Replace the 64 characters after `0x` with your token. + +If you are not running validators, press `CTRL` + `x` then `y` then `Enter` to save and exit. Proceed to Configuring your Network. + +### Configure feeRecipient + +:::warning +If you are running validators, Ethereum requires validators to set a **Fee Recipient** which allows you to receive priority fees and MEV rewards when proposing blocks. If you do not set this address, your rewards will be sent to the [burn address by default](https://etherscan.io/address/0x0000000000000000000000000000000000000000). +::: + +Configure your validator client's feeRecipient address by changing the `FEE_RECIPIENT` line. Ensure you specify an Ethereum address you control. + +An example of a fee recipient set with the address `0xB7576e9d314Df41EC5506494293Afb1bd5D3f65d`, you would change the configuration to: + +``` +FEE_RECIPIENT="0xB7576e9d314Df41EC5506494293Afb1bd5D3f65d" +``` + +If you would like to run [MEV-Boost](https://boost.flashbots.net) with your validators, proceed to the next section. + +If you do not want to run MEV-Boost, press `CTRL` + `x` then `y` then `Enter` to save and exit. Proceed to [Configuring your Network](#configuring-your-network). + +### Set minimum bid for MEV-Boost validators + +:::info +(Optional): If you are running validators and would like to use MEV-Boost, follow this section. Otherwise, skip this section. +::: + +Validators running MEV-Boost maximize their staking reward by selling blockspace to an open market of builders. MEV-Boost v1.4+ allows you to set a minimum bid threshold to only use an externally built block if it meets or exceeds this parameter. + +The `min-bid` parameter is denominated in ETH. For example, if you want to set your threshold to 0.03 ETH, set your configuration to `MIN_BUILDERBID=0.03` + +When complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +### Configuring your Network + +When using the quick scripts, each supported network has a `.vars` file to define the parameters required for configuring the clients to the specified network. + +To view the available files, use the command: + +``` +ls *.vars +``` + +### Select your Network + +Each network has specifics variables that you may want to setup for use. We will use `Holesky` to demonstrate connecting to a public testnet. + +Open the `holesky.vars` file. + +```bash +nano holesky.vars +``` + +### Configure MEV-boost relays + +:::info +(Optional): If you have validators you intend to use for MEV-boost, you can input the relays you want to connect here. Otherwise, skip this section. +::: + +You can list multiple relays simply by pasting the relay URL as a variable in this file. + +```shell= +RELAY_A=https://0xRelayPubKey@relay.com +RELAY_B=https://0xRelayPubKey@relay2.com +``` + +Make sure to identify the ones you want to use by editing the line: + +```shell= +RELAYS="$RELAY_A,$RELAY_B" +``` + +### Configure Lodestar version + +The lodestar-quickstart scripts currently defaults to using our `stable` release branch. To use our nightly `unstable` release instead, replace `LODESTAR_IMAGE=chainsafe/lodestar:latest` with `LODESTAR_IMAGE=chainsafe/lodestar:next` in the `import-images.sh` file. + +You may also choose to use a specific version release of Lodestar. To select a specific version, replace the image with `LODESTAR_IMAGE=chainsafe/lodestar:v1.x.x` + +:::warning +:warning: We do not recommend using the `unstable` branch or `@chainsafe/lodestar:next` docker versions of Lodestar for production related tasks. +::: + +### Modify your weak subjectivity (checkpoint sync) provider + +:::note +(Optional): We use ChainSafe's Lodestar checkpoints by default. You may choose to point your trusted checkpoint at another source or verify the checkpoints with other providers. If you would rather sync from genesis (not recommended), you can skip this step. +::: + +Weak subjectivity (checkpoint sync) allows your beacon node to sync within minutes by utilizing a trusted checkpoint from a trusted provider. + +**We highly recommend using this feature** so you do not need to wait days to sync from genesis and will mitigate your susceptibility to [long-range attacks](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/). + +Minimize your risk of syncing a malicious chain from a malicious checkpoint by verifying the trusted checkpoint from multiple sources. + +1. View the community maintained list of [Beacon Chain checkpoint sync endpoints](https://eth-clients.github.io/checkpoint-sync-endpoints/) +2. Verify multiple endpoint links and ensure the latest finalized and latest justified block roots are the same +3. Choose one of those endpoint URLs +4. Replace the `--checkpointSyncUrl` address with your chosen provider. + +:::info +**NOTE**: Ensure you use checkpoint URLs from the list above corresponding to the network you are trying to sync or you **will** receive errors. +::: + +When complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +## Modify other client parameters (For advanced users) + +:::info +(Optional): We have already set fixed parameters for a seamless setup. If you are looking to customize the default parameters of the clients you are using, follow this section. Otherwise, skip this section. +::: + +Fixed parameters for clients can be modified under the `fixed.vars` configuration file. + +Under the selected client, modify or add the custom arguments on their corresponding line. + +:::note +The following are links to client documentation for CLI commands: + +- [**Lodestar CLI Commands**](https://chainsafe.github.io/lodestar/reference/cli/) +- [**Nethermind CLI Commands**](https://docs.nethermind.io/fundamentals/configuration#command-line-options) +- [**Besu CLI Commands**](https://besu.hyperledger.org/en/stable/Reference/CLI/CLI-Syntax/) +- [**Go Ethereum CLI commands**](https://geth.ethereum.org/docs/interface/command-line-options) +- [**Erigon CLI commands**](https://github.com/ledgerwatch/erigon#beacon-chain) +- [**Reth CLI commands**](https://reth.rs/cli/reth.html) + ::: + +Once complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +--- + +## Setup Validators + +:::info +Optional: Skip this entire section if you do not intend to run validators. +::: + +### Create validator keystore password + +Make sure you are in your main quickstart directory. Create the `pass.txt` file containing your validator's decryption password for use. + +``` +cd ~/lodestar-quickstart +``` + +``` +nano pass.txt +``` + +Enter the password for your validators. + +:::info +Once the validator container is running, you can delete this file from your server. Note that every time you restart this container, you will need this password to decrypt your keystore.json files. +::: + +Once complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +### Option 1: Setup validators with keystores + +If you want to setup validators with your `keystores.json` files follow this section. Otherwise, skip this step. + +#### Copy/Move keystores to `lodestar-quickstart/keystores` directory + +Your `keystore.json` file(s) generated from the [`staking-deposit-cli`](https://github.com/ethereum/staking-deposit-cli) or similar generator for validator keys will be placed in the `lodestar-quickstart/keystores` directory using the `cp` command to copy or `mv` command to move the files. + +``` +mkdir keystores +``` + +:::info +You may choose to use your own method (e.g. SFTP) for copying/uploading keys to your server. This is only a guide. +::: + +The format of the command to use is below: + +``` +cp +``` + +An example usage of this command is: + +``` +cp /home/user/validator_keys/keystore-x.json ~/lodestar-quickstart/keystores +``` + +Ensure your `keystore.json` files are in the `lodestar-quickstart/keystores` directory using `ls` command. + +``` +ls -lsah ~/lodestar-quickstart/keystores/ +``` + +You should see the keystore files within the directory. + +:::info +Ensure the `/keystores` directory only has the `keystore-m_xxxxx.json` files and nothing else. If you copied in the `deposit_data-xxxxx.json` files, you can remove them by using the `sudo rm ` command. + +Example: + +``` +sudo rm deposit_data-1552658472.json +``` + +::: + +Continue to the [**Startup Quickstart Script**](#startup-quickstart-script) section. + +### Option 2: Setup multiple validator sets with keystores encrypted under different passwords + +Optional: If you want to setup validators with your `keystores.json` files but they are not encrypted with the same password, follow this section. Otherwise, skip this step. + +This option will allow you to run multiple validator clients corresponding to each validator keystore set encrypted with the same password. Therefore, we will setup `validatorset1` with one decryption password and `validatorset2` with another decryption password. You can repeat these steps to create subsequent validator sets with different keystore decryption passwords. + +#### Create validator keystore set directory + +Ensure you are in the `lodestar-quickstart` directory and create a folder for your first validator keystore set. + +``` +cd ~/lodestar-quickstart +``` + +Make the new directory for set one. + +``` +mkdir validatorset1 +``` + +Navigate into the directory. + +``` +cd validatorset1 +``` + +#### Create validator keystore password + +Create the `pass.txt` file containing your validator's decryption password for use. + +``` +nano pass.txt +``` + +Enter the password for your validators. + +:::info +Once the validator container is running, you can delete this file from your server. Note that every time you restart this container, you will need this password to decrypt your keystore.json files. +::: + +Once complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +#### Copy/Move keystores to `lodestar-quickstart/validatorset1/keystores` directory + +Your `keystore.json` file(s) generated from the [`staking-deposit-cli`](https://github.com/ethereum/staking-deposit-cli) or similar generator for validator keys will be placed in the `lodestar-quickstart/validatorset1/keystores` directory using the `sudo cp` command to copy or `sudo mv` command to move the files. + +``` +mkdir keystores +``` + +The format of the command to use is below: + +``` +cp +``` + +An example usage of this command is: + +``` +cp /home/user/validator_keys/keystore-x.json ~/lodestar-quickstart/validatorset1/keystores +``` + +Ensure your `keystore.json` files are in the `lodestar-quickstart/validatorset1/keystores` directory using `ls` command. + +``` +ls -lsah ~/lodestar-quickstart/validatorset1/keystores/ +``` + +You should see the keystore files within the directory. + +:::info +Ensure the `/keystores` directory only has the `keystore-m_xxxxx.json` files and nothing else. If you copied in the `deposit_data-xxxxx.json` files, you can remove them by using the `sudo rm ` command. + +Example: + +``` +sudo rm deposit_data-1552658472.json +``` + +::: + +Repeat the same steps above for `validatorset2` and any subsequent sets of validators you require. When complete you should have a similar looking directory tree such as the one below: + +Then, continue to the [**Startup Quickstart Script**](#startup-quickstart-script) section. Pay particular attention to startup script example five (5) and (6). + +### Option 3: Setup validators with mnemonic + +:::warning +**TESTNET USE ONLY:** Do not use this method unless you're validating on a testnet. Your mnemonic will be stored in plaintext on your server, which is unsafe. +::: + +Optional: If you want to setup validators with your mnemonic. Otherwise, skip this step. + +#### Setup Mnemonic + +Select the `.vars` file corresponding to the network you want to run. For Holesky, select `holesky.vars`. Open the file with the `nano` text editor and edit the configuration: + +``` +nano holesky.vars +``` + +We will modify the `LODESTAR_VALIDATOR_MNEMONIC_ARGS=`. Specifically, the mnemonic located after the `--fromMnemonic` flag. + +- Replace the default mnemonic with your mnemonic. Ensure it is between the quotations + +- Indicate which indexes of the mnemonic you wish Lodestar to run. Specify a specific index number `--mnemonicIndexes 0` or a range of numbers `--mnemonicIndexes 0..5` + +:::info +If you created your mnemonic with one key, it is likely located in index 0. If you've added to it, the generated keys are likely the subsequent indexes. + +Therefore, if you generated one key, it is likely in index 0, so you would use `--mnemonicIndexes 0`. If you generated five keys, it is likely in index 0 to 4, so you would use `--mnemonicIndexes 0..4` +::: + +Once complete, press `CTRL` + `x` then `y` then `Enter` to save and exit. + +Continue to the [**Startup Quickstart Script**](#startup-quickstart-script) section. + +--- + +## Startup Quickstart Script + +Ensure you are in the `~/lodestar-quickstart folder. + +``` +cd ~/lodestar-quickstart +``` + +The following are **_example commands_** as a template for initiating the quickstart script: + +1. Startup a Sepolia beacon node with no validators and Go Ethereum (Geth) execution client with terminals attached: + +``` +./setup.sh --dataDir sepolia-data --elClient geth --network sepolia --dockerWithSudo --withTerminal "gnome-terminal --disable-factory --" +``` + +2. Startup Mainnet beacon node with no validators and Nethermind execution client detached from containers (Recommended only when you've verified the setup has initiated properly with terminals attached): + +``` +./setup.sh --dataDir mainnet-data --elClient nethermind --network mainnet --dockerWithSudo --detached +``` + +3. Startup Holesky beacon node with validator client (using mnemonic in /keystores) and Erigon execution client detached from containers: + +``` +./setup.sh --dataDir holesky-data --elClient erigon --network holesky --dockerWithSudo --detached --withValidatorMnemonic ~/lodestar-quickstart/ +``` + +4. Startup Mainnet beacon node with validator client (using keystores) with MEV-Boost and Hyperledger Besu execution client detached from containers: + +``` +./setup.sh --dataDir mainnet-data --elClient besu --network mainnet --dockerWithSudo --detached --withValidatorKeystore ~/lodestar-quickstart/ --withMevBoost +``` + +5. Startup Holesky beacon node with validator client set one (using keystores) and execution client Geth detached from containers: + +``` +./setup.sh --dataDir holesky-data --elClient geth --network holesky --dockerWithSudo --detached --withValidatorKeystore ~/lodestar-quickstart/validatorset1 +``` + +:::warning +You can only start up one set of validator keystores per validator client on the same command. Use the below command (#6) to startup another validator client for another set of validator keys. +::: + +6. Startup validator client only with validator client set two (using keystores) and execution client Geth detached from containers: + +``` +./setup.sh --dataDir holesky-data --elClient geth --network holesky --dockerWithSudo --detached --withValidatorKeystore ~/lodestar-quickstart/validatorset2 --justVC +``` + +:::info +The script will standardize naming your containers so running the `setup.sh` twice, will not create two instances of the same containers. The script will standardize naming your containers so running the `./setup.sh ` a second time, will not create two instances of the same containers. +::: + +Configure the above commands with what you intend to run using the Quickstart Script Help table below. + +## Quickstart Script Help + +| Command | Required/Optional | Description | +| ------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataDir` | Required | File location (volume) of the configuration & data for setup. This directory should be non-existent for the first run. If the directory exists, it will skip fetching the configuration, assuming it has been done previously. You can also clean individual directors of CL/EL between the re-runs. | +| `elClient` | Required | The selected EL client you want to run with Lodestar. Options are `nethermind`, `besu`, `erigon` or `geth`. | +| `network` | Required | The network/chain you want to load, reads the corresponding `.vars` (for e.g. `holesky.vars`) network configuration , like images, or urls for EL/CL to interact. Example: Default for Holesky is `--network holesky` using `holesky.vars`. | +| `dockerWithSudo` | Optional | Provide this argument if your Docker needs a `sudo` prefix. | +| `--withTerminal` | Optional\* | Provide the terminal command prefix for CL and EL processes to run in your favourite terminal. You may use an alias or a terminal launching script as long as it waits for the command it runs till ends and then closes. If not provided, it will launch the docker processes in in-terminal mode. | +| `--detached` | Optional\* | By default the script will wait for processes and use user input (ctrl +c) to end the processes, however you can pass this option to skip this behavior and just return, for e.g. in case you just want to leave it running. | +| `--withValidatorKeystore` | Optional\*\* | Launch a validator client using `LODESTAR_VALIDATOR_MNEMONIC_ARGS` (`--withValidatorMnemonic`) or using a folder (`--withValidatorKeystore --justVC` connecting to same beacon node. | +| `--withValidatorMnemonic` | Optional\*\* | Launch a validator client using mnemonic method.(`LODESTAR_VALIDATOR_MNEMONIC_ARGS`) as set in the network vars file. | +| `--withMevBoost` | Optional | Launch a MEV-Boost container to interface with multiple relays picked for the corresponding network vars file. When paired with `--justCL` or `--justVC` this only activates the builder arguments in the beacon/validator and use the builder url set in MEVBOOST_URL variable in fixed.vars | +| `--justEL` | Optional | Launch only the Execution Layer client. | +| `--justCL` | Optional | Launch only the Lodestar beacon node. | +| `--justVC` | Optional | Launch only the Lodestar validator. | +| `--skipImagePull` | Optional | Launch with only the local Docker images. Do not update them on this run. | + +:::note +`*` : Only one of the two options should be provided. +`**` : Only one of the two options should be provided. +::: + +### Check Containers + +You can check the status and get the name of your containers by using the `docker ps` command: + +``` +sudo docker ps +``` + +The containers should not constantly restart. If they restart, likely a misconfiguration occurred. + +### Check Container Logs + +You can check the status of what your container is logging to diagnose a problem or follow along the status of your container output. + +Check the logs by using the `docker logs` command: + +``` +sudo docker logs +``` + +Follow along the logs by adding the `-f` flag: + +``` +sudo docker logs -f +``` + +Limit the fetched logs by indicating the latest container out puts by number of lines using the `-n ` flag. For the last 10 lines: + +``` +sudo docker logs -n 10 +``` + +### Check beacon node is progressing + +Your beacon node should initialize and you should see something similar to: + +``` +Jul-31 13:35:27.967[] info: Lodestar network=mainnet, version=v1.21.0/ff35faa, commit=ff35faae4ad1697b86d708a0367a95a71648ab6e +Jul-31 13:35:28.344[] info: Connected to LevelDB database path=/data/lodestar/chain-db +Jul-31 13:35:49.828[] info: Initializing beacon from a valid db state slot=9633504, epoch=301047, stateRoot=0xfa2845a6877b98555906a1654941c97d9c05bdd41e61cc0870a967dc9030b156, isWithinWeakSubjectivityPeriod=true +Jul-31 13:35:51.955[chain] info: Historical state worker started +Jul-31 13:35:51.969[eth1] info: Eth1 provider urls=http://localhost:8551 +Jul-31 13:35:51.975[execution] info: Execution client urls=http://localhost:8551 +Jul-31 13:35:51.977[] info: External builder url=http://localhost:8661 +Jul-31 13:36:21.128[network] info: running libp2p instance in worker thread +Jul-31 13:36:21.727[network] info: libp2p worker started peer=15Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW +Jul-31 13:36:27.677[network] info: discv5 worker started peerId=16Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW, initialENR=enr:-IO4QHGTUd1Zg8LAhUAioOz_ySTKoJLIOa6zltSP_AvvhTFVYw6M6YB35IxsiKxQG7nUgCpUB5SIsNxMntCNlTK9sMEBgmlkgnY0iXNlY3AyNTZrMaEC24cdmzuGnWqSwF-8Hw2gbkAZDzMWW3LsHJfp_kDhy-GDdGNwgiMog3VkcIIeWH, bindAddr4=/ip4/0.0.0.0/udp/9000 +Jul-31 13:36:28.134[network] info: PeerId 16Uiu2HAmACcmCEXcgt3zCtJL2rqJZ2Mvdjh6U6fe26HgD2FoNRwW, Multiaddrs /ip4/0.0.0.0/tcp/9000 +Jul-31 13:36:28.137[metrics] info: Started metrics HTTP server address=http://127.0.0.1:8008 +Jul-31 13:36:28.256[rest] info: Started REST API server address=http://0.0.0.0:9596 +Jul-31 13:36:28.257[] info: Searching peers - peers: 0 - slot: 9634080 - head: (slot -576) 0x9d88…d02a - exec-block: syncing(20426302 0xcec4…) - finalized: 0x7feb…c130:301045 +Jul-31 13:36:36.461[execution] info: Execution client is synced oldState=ONLINE, newState=SYNCED +Jul-31 13:36:53.019[] info: Syncing - 3.7 minutes left - 2.32 slots/s - slot: 9634082 - head: (slot -515) 0x792f…f8aa - exec-block: valid(20426365 0x58b1…) - finalized: 0x9d88…d02a:301047 - peers: 11 +Jul-31 13:38:53.168[] info: Syncing - 11 seconds left - 4.01 slots/s - slot: 9634092 - head: (slot -44) 0x7491…f63e - exec-block: valid(20426841 0xd4b2…) - finalized: 0x1e00…6e6b:301062 - peers: 59 +Jul-31 13:38:58.051[network] info: Subscribed gossip core topics +Jul-31 13:38:58.132[sync] info: Subscribed gossip core topics +Jul-31 13:39:05.001[] info: Synced - slot: 9634093 - head: 0x35de…1f0e - exec-block: valid(20426886 0x10ff…) - finalized: 0x88f8…5375:301063 - peers: 70 +Jul-31 13:39:17.000[] info: Synced - slot: 9634094 - head: 0x7844…3b3e - exec-block: valid(20426887 0x67d1…) - finalized: 0x88f8…5375:301063 - peers: 69 +Jul-31 13:39:29.000[] info: Synced - slot: 9634095 - head: 0x5516…ba12 - exec-block: valid(20426888 0x4ceb…) - finalized: 0x88f8…5375:301063 - peers: 74 +``` + +### Check validators are detected and decrypted + +> OPTIONAL: If you are running validators, you can check the validator client logs to ensure the validator keys exist, has been detected and decrypted. + +Here is an example command if you are running validators on Goerli with the lodestar-quickstart script: + +``` +sudo docker logs goerli-validator +``` + +You should see something similar to: + +``` +Mar-01 03:06:35.048[] info: Lodestar network=holesky, version=v1.16.0/6ad9740, commit=6ad9740a085574306cf46c7642e749d6ec9a4264 +Mar-01 03:06:35.050[] info: Connecting to LevelDB database path=/keystoresDir/validator-db-holesky +Mar-01 03:06:35.697[] info: 100% of keystores imported. current=2 total=2 rate=1318.68keys/m +Mar-01 03:06:35.698[] info: 2 local keystores +Mar-01 03:06:35.698[] info: 0xa6fcfca12e1db6c7341d82327010cd57224dc239d1c5e4fb18286cc32edb877d813c5af1c870d474aef7b3ff7ab927ea +Mar-01 03:06:35.698[] info: 0x8f868e53bbe1451bcf6d42c9ab6d292cbd7fbfa09c59b6b99c1dd6a4977e2e7b4b752c328784ca2788dd6f63ffcbdb7e +Mar-01 03:06:35.732[] info: Beacon node urls=http://127.0.0.1:9596 +Mar-01 03:09:23.813[] info: Genesis fetched from the beacon node +Mar-01 03:09:23.816[] info: Verified connected beacon node and validator have same the config +Mar-01 03:09:23.818[] info: Verified connected beacon node and validator have the same genesisValidatorRoot +Mar-01 03:09:23.818[] info: Initializing validator useProduceBlockV3=deneb+, broadcastValidation=gossip, defaultBuilderSelection=executiononly, suggestedFeeRecipient=0xeeef273281fB83F56182eE960aA4bAfe7fE075DE, strictFeeRecipientCheck=false +Mar-01 03:09:23.830[] info: Validator seen on beacon chain validatorIndex=1234567, pubKey=0xa6fcfca12e1db6c7341d82327010cd57224dc239d1c5e4fb18286cc32edb877d813c5af1c870d474aef7b3ff7ab927ea +Mar-01 03:09:23.830[] info: Validator seen on beacon chain validatorIndex=1234568, pubKey=0x8f868e53bbe1451bcf6d42c9ab6d292cbd7fbfa09c59b6b99c1dd6a4977e2e7b4b752c328784ca2788dd6f63ffcbdb7e +Mar-01 03:09:23.830[] info: Validator statuses active=2, total=2 +Mar-01 03:15:50.191[] info: Published attestations slot=1113379, count=1 +Mar-01 03:16:02.728[] info: Published attestations slot=1113380, count=1 +``` + +:::info +It is normal to see `Error on getProposerDuties` in your validator logs as your beacon node and execution node sync up. Give it time. +::: + +## Stop Containers + +You can stop the running containers by using the `docker stop` command and apply it to more than one container if necessary. + +``` +sudo docker stop +``` + +Ensure to remove the container if you don't plan to restart it with the same parameters. + +``` +sudo docker rm +``` + +--- + +# Appendix + +## Appendix A - Expanding the Logical Volume + +There are cases where Ubuntu is provisioning only 200GB of a larger SSD causing users to run out of disk space when syncing their Eth1 node. The error message is similar to: + +`Fatal: Failed to register the Ethereum service: write /var/lib/goethereum/geth/chaindata/383234.ldb: no space left on device` + +To address this issue, assuming you have a SSD that is larger than 200GB, expand the space allocation for the LVM by following these steps: + +``` +sudo lvdisplay <-- Check your logical volume size +sudo lvm +lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv +lvextend -l +100%FREE -r /dev/ubuntu-vg/ubuntu-lv +exit +sudo resize2fs /dev/ubuntu-vg/ubuntu-lv +df -h <-- Check results +``` + +That should resize your disk to the maximum available space. + +If you need support, please check with the [ChainSafe Discord](https://discord.gg/642wB3XC3Q) under the #:star2:-lodestar-general channel. + +## Appendix B - Update client images + +To update client images, you just need to stop all the containers, remove them and restart the lodestar-quickstart script to automatically check for new images. + +You can stop the running containers by using the `docker stop` command with the container names. + +``` +sudo docker stop +``` + +Remove the containers by using the `docker rm` command. + +``` +sudo docker rm +``` + +Restart your containers using your [Startup Quickstart Script](#startup-quickstart-script) command. + +--- + +## Full Disclaimer + +This article (the guide) is for informational purposes only and does not constitute professional advice. The author does not warrant or guarantee the accuracy, integrity, quality, completeness, currency, or validity of any information in this article. All information herein is provided “as is” without warranty of any kind and is subject to change at any time without notice. The author disclaims all express, implied, and statutory warranties of any kind, including warranties as to accuracy, timeliness, completeness, or fitness of the information in this article for any particular purpose. The author is not responsible for any direct, indirect, incidental, consequential or any other damages arising out of or in connection with the use of this article or in reliance on the information available on this article. This includes any personal injury, business interruption, loss of use, lost data, lost profits, or any other pecuniary loss, whether in an action of contract, negligence, or other misuse, even if the author has been informed of the possibility. diff --git a/docs/pages/run/getting-started/quick-start.md b/docs/pages/run/getting-started/quick-start.md index a28de8014b6a..e1a77face695 100644 --- a/docs/pages/run/getting-started/quick-start.md +++ b/docs/pages/run/getting-started/quick-start.md @@ -1,26 +1,20 @@ --- -title: Quick Start +title: Lodestar Quick Start Scripts --- -## Lodestar Quickstart +In order to make things easier and quicker for all types of users to bootstrap the Lodestar consensus client with a variety of execution clients, we have come up with [Lodestar Quickstart](https://github.com/ChainSafe/lodestar-quickstart) Docker scripts! -In order to make things easy for users to onboard and try the Ethereum **Proof of Stake** we have come up with [Lodestar quick start](https://github.com/ChainSafe/lodestar-quickstart) scripts! +- ✅ Zero configuration +- ✅ Single command startup +- ✅ All testnets supported along with mainnet +- ✅ All mainstream execution clients integrated -✅ Zero Configuration -✅ All testnets supported along with `mainnet` -✅ All mainstream Execution Clients integrated - -With just single command you can run lodestar with various execution engines, switch them up to see the Optimistic sync work its magic and eventually brings lodestar and the execution engine in sync - -### Customizations - -You can adapt them to your production setups with ease! Here is a simple guide for you to follow along: +### Support -👉 [Lodestar Quick Setup Guide](https://hackmd.io/@philknows/rJegZyH9q) +We actively maintain and update the configurations of running Lodestar with the most commonly used execution clients for various test/production networks so there is minimal configuration required for a standard setup. -### Support +If you have questions about these scripts, documentation or repository, feel free to talk to us on our [ChainSafe Discord](https://discord.gg/yjyvFRP) or [open an issue](https://github.com/ChainSafe/lodestar-quickstart/issues/new) and a member of the team or our community will be happy to assist you. -We actively maintain and update the configurations of running lodestar with the top of the line execution engines for various PoS networks so you have the minimum possible figuring out to do. +### Customizations (Optional) -In case you are facing any issues with the quick start guide, do reach us out on lodestar discord! -Happy to help! 🙏🙏🙏 +You can further adapt our Quickstart Docker scripts to your node setups with ease! Use our [Quickstart Custom Setup Guide](./quick-start-custom-guide.md)! diff --git a/docs/pages/run/logging-and-metrics/client-monitoring.md b/docs/pages/run/logging-and-metrics/client-monitoring.md index dc707f2b31d0..3d9ede1d8464 100644 --- a/docs/pages/run/logging-and-metrics/client-monitoring.md +++ b/docs/pages/run/logging-and-metrics/client-monitoring.md @@ -1,4 +1,4 @@ -# Client monitoring +# Client Monitoring Lodestar has the ability to send client stats to a remote service for collection. At the moment, the main service offering remote monitoring is [beaconcha.in](https://beaconcha.in/). diff --git a/docs/pages/run/logging-and-metrics/dashboards.md b/docs/pages/run/logging-and-metrics/dashboards.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/docs/pages/run/logging-and-metrics/log-management.md b/docs/pages/run/logging-and-metrics/log-management.md deleted file mode 100644 index a0ee1d5fec07..000000000000 --- a/docs/pages/run/logging-and-metrics/log-management.md +++ /dev/null @@ -1,3 +0,0 @@ -# Log Management - -Check back soon for more information!! diff --git a/docs/pages/run/logging-and-metrics/metrics-management.md b/docs/pages/run/logging-and-metrics/metrics-management.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/docs/pages/run/logging-and-metrics/prometheus-grafana.md b/docs/pages/run/logging-and-metrics/prometheus-grafana.md index f49a44f37209..c36c52a72a0c 100644 --- a/docs/pages/run/logging-and-metrics/prometheus-grafana.md +++ b/docs/pages/run/logging-and-metrics/prometheus-grafana.md @@ -1,8 +1,12 @@ -# Prometheus and Grafana +# Prometheus and Grafana Setup Prometheus is an open-source monitoring system with efficient time series database and a modern alerting approach. Together with Grafana it's the recommended way to make sure that your node and validator(s) are performing correctly. -## Prometheus +## Localized Docker Metrics Script + +The Lodestar team has setup a script which will copy the latest dashboards compiled by our team for development purposes. By utilizing the script located in `/docker/docker-compose.local_dev.sh`, you can instantly setup the latest dockerized metrics alongside your local beacon node. + +## Prometheus Setup To start, download Prometheus from https://prometheus.io/download/. Unzip the downloaded .zip file and run Prometheus from its installed location with the lodestar `prometheus.yml` passed in as the configuration file @@ -23,7 +27,7 @@ lodestar --metrics=true --metrics.port=8008 Navigate to http://localhost:9090/ in your browser to verify that Prometheus is monitoring Lodestar -## Grafana +## Grafana Setup Download and install Grafana from its official repository https://grafana.com/docs/grafana/latest/installation/debian/ diff --git a/docs/pages/run/validator-management/proposer-config.md b/docs/pages/run/validator-management/proposer-config.md new file mode 100644 index 000000000000..444789a9f8b0 --- /dev/null +++ b/docs/pages/run/validator-management/proposer-config.md @@ -0,0 +1,48 @@ +# Proposer Configuration + +:::warning +This is an alpha feature. The feature and its format are subject to change. +::: + +With Lodestar's validator client, you can assign specific metadata for each proposer/public key using a proposer configuration file written in YAML file. This will allow you to set specific graffiti, fee recipients and builder settings per validator key. + +### Example proposer_config.yaml + +```yaml +proposer_config: + "0xa99a76ed7796f7be22d5b7e85deeb7c5677e88e511e0b337618f8c4eb61349b4bf2d153f649f7b53359fe8b94a38e44c": + graffiti: "graffiti" + strict_fee_recipient_check: false + fee_recipient: "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + builder: + gas_limit: "30000000" + selection: "executionalways" + boost_factor: "0" + "0xa4855c83d868f772a579133d9f23818008417b743e8447e235d8eb78b1d8f8a9f63f98c551beb7de254400f89592314d": + fee_recipient: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + builder: + gas_limit: "3000000" + selection: "maxprofit" + boost_factor: "100" +default_config: + graffiti: "default graffiti" + strict_fee_recipient_check: true + fee_recipient: "0xcccccccccccccccccccccccccccccccccccccccc" + builder: + gas_limit: "30000000" + selection: "default" + boost_factor: "90" +``` + +### Enable Proposer Configuration + +After you have configured your proposer configuration YAML file, you can start Lodestar with an additional CLI flag option pointing to the file: `--proposerSettingsFile /path/to/proposer_config.yaml`. + +:::info +The proposer configuration can also be retrieved via the keymanager API endpoint: + +``` +GET /eth/v0/validator/{pubkey}/proposer_config +``` + +::: diff --git a/docs/pages/run/validator-management/vc-configuration.md b/docs/pages/run/validator-management/vc-configuration.md index ce6db52b3a66..a51791eff494 100644 --- a/docs/pages/run/validator-management/vc-configuration.md +++ b/docs/pages/run/validator-management/vc-configuration.md @@ -74,6 +74,10 @@ Configure your validator client's fee recipient address by using the [`--suggest You may choose to use the [`--strictFeeRecipientCheck`](./validator-cli.md#--strictfeerecipientcheck) flag to enable a strict check of the fee recipient address with the one returned by the beacon node for added reassurance. +:::note +If you would like to set unique proposer metadata (e.g. fee recipient address) for each validator you are running, see the [Proposer Configuration](./proposer-config.md) feature. This feature is also available via the keymanager API. +::: + ### Configure your builder selection and/or builder boost factor If you are running a beacon node with connected builder relays, you may use these validator configurations to signal which block (builder vs. local execution) the beacon node should produce. diff --git a/docs/pages/supporting-libraries/libraries.md b/docs/pages/supporting-libraries/libraries.md index e76ccc2f9ec7..58796e56cd15 100644 --- a/docs/pages/supporting-libraries/libraries.md +++ b/docs/pages/supporting-libraries/libraries.md @@ -1,13 +1,13 @@ # Lodestar libraries -The Lodestar project is divided into Typescript packages that can be used independently of the CLI. These packages span the breadth of the Ethereum Consensus layer, and are perfect for Typescript developers looking to build around Ethereum. +The Lodestar project is divided into TypeScript packages that can be used independently of the CLI. These packages span the breadth of the Ethereum Consensus layer, and are perfect for TypeScript developers looking to build around Ethereum. ## Monorepo libraries Several useful Ethereum consensus libraries are developed as part of the [Lodestar monorepo](https://github.com/ChainSafe/lodestar) and may be useful when used individually. - [`params`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/params) - Ethereum consensus constants and fork names -- [`types`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/types) - Ethereum consensus types, Typescript interfaces and SSZ type objects +- [`types`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/types) - Ethereum consensus types, TypeScript interfaces and SSZ type objects - [`config`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/config) - Ethereum consensus run-time network configuration - [`api`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/api) - Ethereum consensus REST API client - [`flare`](https://github.com/ChainSafe/lodestar/tree/unstable/packages/flare) - Beacon chain multi-purpose and debugging tool diff --git a/docs/pages/trouble-shooting.md b/docs/pages/trouble-shooting.md deleted file mode 100644 index 144aeb90ce20..000000000000 --- a/docs/pages/trouble-shooting.md +++ /dev/null @@ -1 +0,0 @@ -# Trouble Shooting diff --git a/docs/sidebars.ts b/docs/sidebars.ts index d9a4839a90c4..1b6eb1ac055d 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -10,11 +10,18 @@ const sidebars: SidebarsConfig = { label: "Run A Node", collapsed: false, items: [ - "run/getting-started/quick-start", "run/getting-started/installation", { type: "category", - label: "Beacon node", + label: "Quick Start", + items: [ + "run/getting-started/quick-start", + "run/getting-started/quick-start-custom-guide", + ], + }, + { + type: "category", + label: "Beacon Node", items: [ "run/beacon-management/starting-a-node", "run/beacon-management/beacon-cli", @@ -31,17 +38,23 @@ const sidebars: SidebarsConfig = { "run/validator-management/vc-configuration", "run/validator-management/validator-cli", "run/validator-management/external-signer", + "run/validator-management/proposer-config", ], }, { type: "category", label: "Logging and Metrics", - items: ["run/logging-and-metrics/prometheus-grafana", "run/logging-and-metrics/client-monitoring"], + items: [ + "run/logging-and-metrics/prometheus-grafana", + "run/logging-and-metrics/client-monitoring", + ], }, { type: "category", label: "Discv5 Bootnode", - items: ["run/bootnode/bootnode-cli"], + items: [ + "run/bootnode/bootnode-cli", + ], }, ], }, diff --git a/packages/light-client/README.md b/packages/light-client/README.md index 0323e8fc4326..3cab0c12f13b 100644 --- a/packages/light-client/README.md +++ b/packages/light-client/README.md @@ -31,7 +31,7 @@ You can find more information about the light-client protocol in the [specificat ## Getting started -- Follow the [installation guide](https://chainsafe.github.io/lodestar/getting-started/installation) or [Docker install](https://chainsafe.github.io/lodestar/getting-started/installation/#docker-installation) to install Lodestar. +- Follow the [installation guide](https://chainsafe.github.io/lodestar/run/getting-started/installation) to install Lodestar. - Quickly try out the whole stack by [starting a local testnet](https://chainsafe.github.io/lodestar/advanced-topics/setting-up-a-testnet). ## Light-Client CLI Example diff --git a/packages/prover/README.md b/packages/prover/README.md index ce1f33dd8efb..477da5140c4b 100644 --- a/packages/prover/README.md +++ b/packages/prover/README.md @@ -152,7 +152,7 @@ You will need to go over the [specification](https://github.com/ethereum/beacon- ## Getting started -- Follow the [installation guide](https://chainsafe.github.io/lodestar/getting-started/installation) to install Lodestar. +- Follow the [installation guide](https://chainsafe.github.io/lodestar/run/getting-started/installation) to install Lodestar. - Quickly try out the whole stack by [starting a local testnet](https://chainsafe.github.io/lodestar/advanced-topics/setting-up-a-testnet). ## Contributors From 8922d55a236db211a56fe6a74d8b19d315da8b08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:59:19 +0100 Subject: [PATCH 20/48] chore(deps): bump cross-spawn from 7.0.3 to 7.0.6 in /docs (#7268) Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/yarn.lock b/docs/yarn.lock index 046829e3530b..80cd3a321a5a 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -3684,9 +3684,9 @@ cosmiconfig@^8.3.5: path-type "^4.0.0" cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0" From 64eb0153dd97b7525cb61625b102a6a521869c05 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 2 Dec 2024 17:11:28 +0100 Subject: [PATCH 21/48] feat: add error log to notifier if execution client auth failed (#7239) * feat: add error log to notifier if execution client auth failed * Update packages/beacon-node/src/node/notifier.ts --------- Co-authored-by: NC <17676176+ensi321@users.noreply.github.com> --- packages/beacon-node/src/node/notifier.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/beacon-node/src/node/notifier.ts b/packages/beacon-node/src/node/notifier.ts index c0d9354197ae..cd316516259b 100644 --- a/packages/beacon-node/src/node/notifier.ts +++ b/packages/beacon-node/src/node/notifier.ts @@ -54,12 +54,12 @@ export async function runNodeNotifier(modules: NodeNotifierModules): Promise= config.BELLATRIX_FORK_EPOCH && - computeStartSlotAtEpoch(clockEpoch) === clockSlot && - chain.executionEngine.state === ExecutionEngineState.OFFLINE - ) { - logger.warn("Execution client is offline"); + if (clockEpoch >= config.BELLATRIX_FORK_EPOCH && computeStartSlotAtEpoch(clockEpoch) === clockSlot) { + if (chain.executionEngine.state === ExecutionEngineState.OFFLINE) { + logger.warn("Execution client is offline"); + } else if (chain.executionEngine.state === ExecutionEngineState.AUTH_FAILED) { + logger.error("Execution client authentication failed. Verify if the JWT secret matches on both clients"); + } } const headInfo = chain.forkChoice.getHead(); From 84e069930156b1fabb2e2cd9261d58fcd6eff6b1 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 3 Dec 2024 15:44:29 +0100 Subject: [PATCH 22/48] docs: display rcConfig flag on CLI reference page (#7270) * docs: display rcConfig flag on CLI reference page * Update word list --- .wordlist.txt | 2 ++ packages/cli/src/options/globalOptions.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.wordlist.txt b/.wordlist.txt index 2c28fc784061..5070aafcf9a5 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -110,6 +110,7 @@ Vitalik Vitest Wagyu api +args async backfill beaconcha @@ -244,3 +245,4 @@ xRelayPubKey xcode yaml yamux +yml diff --git a/packages/cli/src/options/globalOptions.ts b/packages/cli/src/options/globalOptions.ts index 58ae396b67d1..6a6998dc76cc 100644 --- a/packages/cli/src/options/globalOptions.ts +++ b/packages/cli/src/options/globalOptions.ts @@ -10,6 +10,7 @@ type GlobalSingleArgs = { paramsFile?: string; preset: string; presetFile?: string; + rcConfig?: string; }; export const defaultNetwork: NetworkName = "mainnet"; @@ -44,11 +45,16 @@ const globalSingleOptions: CliCommandOptions = { description: "Preset configuration file to override the active preset with custom values", type: "string", }, + + rcConfig: { + description: "RC file to supplement command line args, accepted formats: .yml, .yaml, .json", + type: "string", + }, }; export const rcConfigOption: [string, string, (configPath: string) => Record] = [ "rcConfig", - "RC file to supplement command line args, accepted formats: .yml, .yaml, .json", + globalSingleOptions.rcConfig.description as string, (configPath: string): Record => readFile(configPath, ["json", "yml", "yaml"]), ]; From 376fe2a3c37823c93cdab70fda11c859280e72a2 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 3 Dec 2024 18:04:26 +0100 Subject: [PATCH 23/48] chore: remove prettier as default formatter for all file types (#7275) --- .vscode/settings.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fbc0552fe61c..d36535917835 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,5 @@ { "window.title": "${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}[${activeRepositoryBranchName}]", - "editor.defaultFormatter": "esbenp.prettier-vscode", // For `sysoev.vscode-open-in-github` extension "openInGitHub.defaultBranch": "unstable", "editor.formatOnSave": true, @@ -18,5 +17,11 @@ }, "[jsonc]": { "editor.defaultFormatter": "biomejs.biome" - } + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, } From 37c42875390f8fd8a0c2d872e160709eb5e8858f Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 3 Dec 2024 21:22:02 +0100 Subject: [PATCH 24/48] chore: unhide flags relevant for devnets / testing (#7271) --- packages/cli/src/cmds/beacon/options.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/cli/src/cmds/beacon/options.ts b/packages/cli/src/cmds/beacon/options.ts index a623ca99512c..7f2cdddfc4ff 100644 --- a/packages/cli/src/cmds/beacon/options.ts +++ b/packages/cli/src/cmds/beacon/options.ts @@ -33,7 +33,6 @@ export const beaconExtraOptions: CliCommandOptions = { }, genesisStateFile: { - hidden: true, description: "Path or URL to download a genesis state file in ssz-encoded format", type: "string", }, @@ -80,7 +79,6 @@ export const beaconExtraOptions: CliCommandOptions = { ignoreWeakSubjectivityCheck: { description: "Ignore the checkpoint sync state failing the weak subjectivity check. This is relevant in testnets where the weak subjectivity period is too small for even few epochs of non finalization causing last finalized to be out of range. This flag is not recommended for mainnet use.", - hidden: true, type: "boolean", group: "weak subjectivity", }, @@ -120,7 +118,6 @@ export const beaconExtraOptions: CliCommandOptions = { }, persistNetworkIdentity: { - hidden: true, description: "Whether to reuse the same peer-id across restarts", type: "boolean", }, From dbe2188a37135b2ec34b0322459cdd012395dcc9 Mon Sep 17 00:00:00 2001 From: Matthew Keil Date: Wed, 4 Dec 2024 01:50:26 -0500 Subject: [PATCH 25/48] feat: debug too many shuffling promises (#7251) * feat: add asyncShufflingCalculation to StateTransitionOpts * feat: add asyncShufflingCalculation to all regen / processSlots consumers * fix: default to false for async shuffling and remove unnecessary props * fix: remove unnecessary flags from stateTransition * feat: implement conditional build of shuffling for prepareNextSlot * fix: spec test bug where shufflingCache is present from BeaconChain constructor * feat: sync build next shuffling if not queued async * fix: use getSync to pull next shuffling correctly * docs: add comment to prepareNextSlot * refactor: rename StateCloneOpts to StateRegenerationOpts * feat: pass asyncShufflingCalculation through to afterProcessEpoch and refactor conditional to run purely sync * docs: add issue number to comment * chore: lint --- .../beacon-node/src/chain/prepareNextSlot.ts | 7 ++- .../beacon-node/src/chain/regen/interface.ts | 18 ++++-- .../beacon-node/src/chain/regen/queued.ts | 18 ++++-- packages/beacon-node/src/chain/regen/regen.ts | 14 ++--- .../chain/stateCache/blockStateCacheImpl.ts | 4 +- .../chain/stateCache/fifoBlockStateCache.ts | 4 +- .../stateCache/inMemoryCheckpointsCache.ts | 10 ++-- .../stateCache/persistentCheckpointsCache.ts | 12 ++-- .../beacon-node/src/chain/stateCache/types.ts | 12 ++-- .../state-transition/src/cache/epochCache.ts | 59 ++++++++++--------- .../src/cache/epochTransitionCache.ts | 17 +++++- 11 files changed, 105 insertions(+), 70 deletions(-) diff --git a/packages/beacon-node/src/chain/prepareNextSlot.ts b/packages/beacon-node/src/chain/prepareNextSlot.ts index 40cadb3774c7..f78c1842bd78 100644 --- a/packages/beacon-node/src/chain/prepareNextSlot.ts +++ b/packages/beacon-node/src/chain/prepareNextSlot.ts @@ -114,7 +114,12 @@ export class PrepareNextSlotScheduler { // the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here // the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing // for other slots dontTransferCached=true because we don't run state transition on this state - {dontTransferCache: !isEpochTransition}, + // + // Shuffling calculation will be done asynchronously when passing asyncShufflingCalculation=true. Shuffling will be queued in + // beforeProcessEpoch and should theoretically be ready immediately after the synchronous epoch transition finished and the + // event loop is free. In long periods of non-finality too many forks will cause the shufflingCache to throw an error for + // too many queued shufflings so only run async during normal epoch transition. See issue ChainSafe/lodestar#7244 + {dontTransferCache: !isEpochTransition, asyncShufflingCalculation: true}, RegenCaller.precomputeEpoch ); diff --git a/packages/beacon-node/src/chain/regen/interface.ts b/packages/beacon-node/src/chain/regen/interface.ts index b70fbc059875..b9a4e38b5b68 100644 --- a/packages/beacon-node/src/chain/regen/interface.ts +++ b/packages/beacon-node/src/chain/regen/interface.ts @@ -28,8 +28,12 @@ export enum RegenFnName { getCheckpointState = "getCheckpointState", } -export type StateCloneOpts = { +export type StateRegenerationOpts = { dontTransferCache: boolean; + /** + * Do not queue shuffling calculation async. Forces sync JIT calculation in afterProcessEpoch if not passed as `true` + */ + asyncShufflingCalculation?: boolean; }; export interface IStateRegenerator extends IStateRegeneratorInternal { @@ -56,7 +60,11 @@ export interface IStateRegeneratorInternal { * Return a valid pre-state for a beacon block * This will always return a state in the latest viable epoch */ - getPreState(block: BeaconBlock, opts: StateCloneOpts, rCaller: RegenCaller): Promise; + getPreState( + block: BeaconBlock, + opts: StateRegenerationOpts, + rCaller: RegenCaller + ): Promise; /** * Return a valid checkpoint state @@ -64,7 +72,7 @@ export interface IStateRegeneratorInternal { */ getCheckpointState( cp: phase0.Checkpoint, - opts: StateCloneOpts, + opts: StateRegenerationOpts, rCaller: RegenCaller ): Promise; @@ -74,12 +82,12 @@ export interface IStateRegeneratorInternal { getBlockSlotState( blockRoot: RootHex, slot: Slot, - opts: StateCloneOpts, + opts: StateRegenerationOpts, rCaller: RegenCaller ): Promise; /** * Return the exact state with `stateRoot` */ - getState(stateRoot: RootHex, rCaller: RegenCaller, opts?: StateCloneOpts): Promise; + getState(stateRoot: RootHex, rCaller: RegenCaller, opts?: StateRegenerationOpts): Promise; } diff --git a/packages/beacon-node/src/chain/regen/queued.ts b/packages/beacon-node/src/chain/regen/queued.ts index b5084d593356..9069b384fd58 100644 --- a/packages/beacon-node/src/chain/regen/queued.ts +++ b/packages/beacon-node/src/chain/regen/queued.ts @@ -8,7 +8,13 @@ import {JobItemQueue} from "../../util/queue/index.js"; import {CheckpointHex, toCheckpointHex} from "../stateCache/index.js"; import {BlockStateCache, CheckpointStateCache} from "../stateCache/types.js"; import {RegenError, RegenErrorCode} from "./errors.js"; -import {IStateRegenerator, IStateRegeneratorInternal, RegenCaller, RegenFnName, StateCloneOpts} from "./interface.js"; +import { + IStateRegenerator, + IStateRegeneratorInternal, + RegenCaller, + RegenFnName, + StateRegenerationOpts, +} from "./interface.js"; import {RegenModules, StateRegenerator} from "./regen.js"; const REGEN_QUEUE_MAX_LEN = 256; @@ -86,7 +92,7 @@ export class QueuedStateRegenerator implements IStateRegenerator { */ getPreStateSync( block: BeaconBlock, - opts: StateCloneOpts = {dontTransferCache: true} + opts: StateRegenerationOpts = {dontTransferCache: true} ): CachedBeaconStateAllForks | null { const parentRoot = toRootHex(block.parentRoot); const parentBlock = this.forkChoice.getBlockHex(parentRoot); @@ -212,7 +218,7 @@ export class QueuedStateRegenerator implements IStateRegenerator { */ async getPreState( block: BeaconBlock, - opts: StateCloneOpts, + opts: StateRegenerationOpts, rCaller: RegenCaller ): Promise { this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getPreState}); @@ -231,7 +237,7 @@ export class QueuedStateRegenerator implements IStateRegenerator { async getCheckpointState( cp: phase0.Checkpoint, - opts: StateCloneOpts, + opts: StateRegenerationOpts, rCaller: RegenCaller ): Promise { this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getCheckpointState}); @@ -256,7 +262,7 @@ export class QueuedStateRegenerator implements IStateRegenerator { async getBlockSlotState( blockRoot: RootHex, slot: Slot, - opts: StateCloneOpts, + opts: StateRegenerationOpts, rCaller: RegenCaller ): Promise { this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getBlockSlotState}); @@ -268,7 +274,7 @@ export class QueuedStateRegenerator implements IStateRegenerator { async getState( stateRoot: RootHex, rCaller: RegenCaller, - opts: StateCloneOpts = {dontTransferCache: true} + opts: StateRegenerationOpts = {dontTransferCache: true} ): Promise { this.metrics?.regenFnCallTotal.inc({caller: rCaller, entrypoint: RegenFnName.getState}); diff --git a/packages/beacon-node/src/chain/regen/regen.ts b/packages/beacon-node/src/chain/regen/regen.ts index 073556d8162f..06d1cee71332 100644 --- a/packages/beacon-node/src/chain/regen/regen.ts +++ b/packages/beacon-node/src/chain/regen/regen.ts @@ -20,7 +20,7 @@ import {getCheckpointFromState} from "../blocks/utils/checkpoint.js"; import {ChainEvent, ChainEventEmitter} from "../emitter.js"; import {BlockStateCache, CheckpointStateCache} from "../stateCache/types.js"; import {RegenError, RegenErrorCode} from "./errors.js"; -import {IStateRegeneratorInternal, RegenCaller, StateCloneOpts} from "./interface.js"; +import {IStateRegeneratorInternal, RegenCaller, StateRegenerationOpts} from "./interface.js"; export type RegenModules = { db: IBeaconDb; @@ -51,7 +51,7 @@ export class StateRegenerator implements IStateRegeneratorInternal { */ async getPreState( block: BeaconBlock, - opts: StateCloneOpts, + opts: StateRegenerationOpts, regenCaller: RegenCaller ): Promise { const parentBlock = this.modules.forkChoice.getBlock(block.parentRoot); @@ -84,7 +84,7 @@ export class StateRegenerator implements IStateRegeneratorInternal { */ async getCheckpointState( cp: phase0.Checkpoint, - opts: StateCloneOpts, + opts: StateRegenerationOpts, regenCaller: RegenCaller, allowDiskReload = false ): Promise { @@ -99,7 +99,7 @@ export class StateRegenerator implements IStateRegeneratorInternal { async getBlockSlotState( blockRoot: RootHex, slot: Slot, - opts: StateCloneOpts, + opts: StateRegenerationOpts, regenCaller: RegenCaller, allowDiskReload = false ): Promise { @@ -146,7 +146,7 @@ export class StateRegenerator implements IStateRegeneratorInternal { async getState( stateRoot: RootHex, caller: RegenCaller, - opts?: StateCloneOpts, + opts?: StateRegenerationOpts, // internal option, don't want to expose to external caller allowDiskReload = false ): Promise { @@ -322,7 +322,7 @@ async function processSlotsByCheckpoint( preState: CachedBeaconStateAllForks, slot: Slot, regenCaller: RegenCaller, - opts: StateCloneOpts + opts: StateRegenerationOpts ): Promise { let postState = await processSlotsToNearestCheckpoint(modules, preState, slot, regenCaller, opts); if (postState.slot < slot) { @@ -343,7 +343,7 @@ async function processSlotsToNearestCheckpoint( preState: CachedBeaconStateAllForks, slot: Slot, regenCaller: RegenCaller, - opts: StateCloneOpts + opts: StateRegenerationOpts ): Promise { const preSlot = preState.slot; const postSlot = slot; diff --git a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts index f57c9a411923..7d87675b7bbc 100644 --- a/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts +++ b/packages/beacon-node/src/chain/stateCache/blockStateCacheImpl.ts @@ -3,7 +3,7 @@ import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {Epoch, RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; -import {StateCloneOpts} from "../regen/interface.js"; +import {StateRegenerationOpts} from "../regen/interface.js"; import {MapTracker} from "./mapMetrics.js"; import {BlockStateCache} from "./types.js"; @@ -39,7 +39,7 @@ export class BlockStateCacheImpl implements BlockStateCache { } } - get(rootHex: RootHex, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + get(rootHex: RootHex, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { this.metrics?.lookups.inc(); const item = this.head?.stateRoot === rootHex ? this.head.state : this.cache.get(rootHex); if (!item) { diff --git a/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts b/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts index eec1fce5d6c2..a119efe66887 100644 --- a/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts +++ b/packages/beacon-node/src/chain/stateCache/fifoBlockStateCache.ts @@ -4,7 +4,7 @@ import {RootHex} from "@lodestar/types"; import {toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; import {LinkedList} from "../../util/array.js"; -import {StateCloneOpts} from "../regen/interface.js"; +import {StateRegenerationOpts} from "../regen/interface.js"; import {MapTracker} from "./mapMetrics.js"; import {BlockStateCache} from "./types.js"; @@ -93,7 +93,7 @@ export class FIFOBlockStateCache implements BlockStateCache { /** * Get a state from this cache given a state root hex. */ - get(rootHex: RootHex, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + get(rootHex: RootHex, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { this.metrics?.lookups.inc(); const item = this.cache.get(rootHex); if (!item) { diff --git a/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts index 4caa6779f697..81562d669365 100644 --- a/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/inMemoryCheckpointsCache.ts @@ -3,7 +3,7 @@ import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {Epoch, RootHex, phase0} from "@lodestar/types"; import {MapDef, toRootHex} from "@lodestar/utils"; import {Metrics} from "../../metrics/index.js"; -import {StateCloneOpts} from "../regen/interface.js"; +import {StateRegenerationOpts} from "../regen/interface.js"; import {MapTracker} from "./mapMetrics.js"; import {CacheItemType, CheckpointStateCache} from "./types.js"; @@ -42,7 +42,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache { this.maxEpochs = maxEpochs; } - async getOrReload(cp: CheckpointHex, opts?: StateCloneOpts): Promise { + async getOrReload(cp: CheckpointHex, opts?: StateRegenerationOpts): Promise { return this.get(cp, opts); } @@ -54,7 +54,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache { async getOrReloadLatest( rootHex: string, maxEpoch: number, - opts?: StateCloneOpts + opts?: StateRegenerationOpts ): Promise { return this.getLatest(rootHex, maxEpoch, opts); } @@ -64,7 +64,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache { return 0; } - get(cp: CheckpointHex, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + get(cp: CheckpointHex, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { this.metrics?.lookups.inc(); const cpKey = toCheckpointKey(cp); const item = this.cache.get(cpKey); @@ -98,7 +98,7 @@ export class InMemoryCheckpointStateCache implements CheckpointStateCache { /** * Searches for the latest cached state with a `root`, starting with `epoch` and descending */ - getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { // sort epochs in descending order, only consider epochs lte `epoch` const epochs = Array.from(this.epochIndex.keys()) .sort((a, b) => b - a) diff --git a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts index a7e0a7cdecfe..9a08aaa75461 100644 --- a/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts +++ b/packages/beacon-node/src/chain/stateCache/persistentCheckpointsCache.ts @@ -7,7 +7,7 @@ import {Logger, MapDef, fromHex, sleep, toHex, toRootHex} from "@lodestar/utils" import {Metrics} from "../../metrics/index.js"; import {AllocSource, BufferPool, BufferWithKey} from "../../util/bufferPool.js"; import {IClock} from "../../util/clock.js"; -import {StateCloneOpts} from "../regen/interface.js"; +import {StateRegenerationOpts} from "../regen/interface.js"; import {serializeState} from "../serializeState.js"; import {CPStateDatastore, DatastoreKey} from "./datastore/index.js"; import {MapTracker} from "./mapMetrics.js"; @@ -168,7 +168,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { * - Get block for processing * - Regen head state */ - async getOrReload(cp: CheckpointHex, opts?: StateCloneOpts): Promise { + async getOrReload(cp: CheckpointHex, opts?: StateRegenerationOpts): Promise { const stateOrStateBytesData = await this.getStateOrLoadDb(cp, opts); if (stateOrStateBytesData === null || isCachedBeaconState(stateOrStateBytesData)) { return stateOrStateBytesData?.clone(opts?.dontTransferCache) ?? null; @@ -240,7 +240,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { */ async getStateOrLoadDb( cp: CheckpointHex, - opts?: StateCloneOpts + opts?: StateRegenerationOpts ): Promise { const cpKey = toCacheKey(cp); const inMemoryState = this.get(cpKey, opts); @@ -272,7 +272,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { /** * Similar to get() api without reloading from disk */ - get(cpOrKey: CheckpointHex | string, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + get(cpOrKey: CheckpointHex | string, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { this.metrics?.cpStateCache.lookups.inc(); const cpKey = typeof cpOrKey === "string" ? cpOrKey : toCacheKey(cpOrKey); const cacheItem = this.cache.get(cpKey); @@ -323,7 +323,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { /** * Searches in-memory state for the latest cached state with a `root` without reload, starting with `epoch` and descending */ - getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateCloneOpts): CachedBeaconStateAllForks | null { + getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null { // sort epochs in descending order, only consider epochs lte `epoch` const epochs = Array.from(this.epochIndex.keys()) .sort((a, b) => b - a) @@ -349,7 +349,7 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache { async getOrReloadLatest( rootHex: RootHex, maxEpoch: Epoch, - opts?: StateCloneOpts + opts?: StateRegenerationOpts ): Promise { // sort epochs in descending order, only consider epochs lte `epoch` const epochs = Array.from(this.epochIndex.keys()) diff --git a/packages/beacon-node/src/chain/stateCache/types.ts b/packages/beacon-node/src/chain/stateCache/types.ts index 403b469dd352..19f05c23ee35 100644 --- a/packages/beacon-node/src/chain/stateCache/types.ts +++ b/packages/beacon-node/src/chain/stateCache/types.ts @@ -1,7 +1,7 @@ import {routes} from "@lodestar/api"; import {CachedBeaconStateAllForks} from "@lodestar/state-transition"; import {Epoch, RootHex, phase0} from "@lodestar/types"; -import {StateCloneOpts} from "../regen/interface.js"; +import {StateRegenerationOpts} from "../regen/interface.js"; export type CheckpointHex = {epoch: Epoch; rootHex: RootHex}; @@ -21,7 +21,7 @@ export type CheckpointHex = {epoch: Epoch; rootHex: RootHex}; * The cache key is state root */ export interface BlockStateCache { - get(rootHex: RootHex, opts?: StateCloneOpts): CachedBeaconStateAllForks | null; + get(rootHex: RootHex, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null; add(item: CachedBeaconStateAllForks): void; setHeadState(item: CachedBeaconStateAllForks | null): void; /** @@ -60,15 +60,15 @@ export interface BlockStateCache { */ export interface CheckpointStateCache { init?: () => Promise; - getOrReload(cp: CheckpointHex, opts?: StateCloneOpts): Promise; + getOrReload(cp: CheckpointHex, opts?: StateRegenerationOpts): Promise; getStateOrBytes(cp: CheckpointHex): Promise; - get(cpOrKey: CheckpointHex | string, opts?: StateCloneOpts): CachedBeaconStateAllForks | null; + get(cpOrKey: CheckpointHex | string, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null; add(cp: phase0.Checkpoint, state: CachedBeaconStateAllForks): void; - getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateCloneOpts): CachedBeaconStateAllForks | null; + getLatest(rootHex: RootHex, maxEpoch: Epoch, opts?: StateRegenerationOpts): CachedBeaconStateAllForks | null; getOrReloadLatest( rootHex: RootHex, maxEpoch: Epoch, - opts?: StateCloneOpts + opts?: StateRegenerationOpts ): Promise; updatePreComputedCheckpoint(rootHex: RootHex, epoch: Epoch): number | null; prune(finalizedEpoch: Epoch, justifiedEpoch: Epoch): void; diff --git a/packages/state-transition/src/cache/epochCache.ts b/packages/state-transition/src/cache/epochCache.ts index 86e63c672024..af9e79bc831c 100644 --- a/packages/state-transition/src/cache/epochCache.ts +++ b/packages/state-transition/src/cache/epochCache.ts @@ -49,6 +49,7 @@ import { import {computeBaseRewardPerIncrement, computeSyncParticipantReward} from "../util/syncCommittee.js"; import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalance.js"; import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsWithLen} from "./effectiveBalanceIncrements.js"; +import {EpochTransitionCache} from "./epochTransitionCache.js"; import {Index2PubkeyCache, syncPubkeys} from "./pubkeyCache.js"; import {CachedBeaconStateAllForks} from "./stateCache.js"; import { @@ -605,14 +606,7 @@ export class EpochCache { * Steps for afterProcessEpoch * 1) update previous/current/next values of cached items */ - afterProcessEpoch( - state: CachedBeaconStateAllForks, - epochTransitionCache: { - nextShufflingDecisionRoot: RootHex; - nextShufflingActiveIndices: Uint32Array; - nextEpochTotalActiveBalanceByIncrement: number; - } - ): void { + afterProcessEpoch(state: CachedBeaconStateAllForks, epochTransitionCache: EpochTransitionCache): void { // Because the slot was incremented before entering this function the "next epoch" is actually the "current epoch" // in this context but that is not actually true because the state transition happens in the last 4 seconds of the // epoch. For the context of this function "upcoming epoch" is used to denote the epoch that will begin after this @@ -657,28 +651,35 @@ export class EpochCache { this.nextDecisionRoot = epochTransitionCache.nextShufflingDecisionRoot; this.nextActiveIndices = epochTransitionCache.nextShufflingActiveIndices; if (this.shufflingCache) { - this.nextShuffling = null; - // This promise will resolve immediately after the synchronous code of the state-transition runs. Until - // the build is done on a worker thread it will be calculated immediately after the epoch transition - // completes. Once the work is done concurrently it should be ready by time this get runs so the promise - // will resolve directly on the next spin of the event loop because the epoch transition and shuffling take - // about the same time to calculate so theoretically its ready now. Do not await here though in case it - // is not ready yet as the transition must not be asynchronous. - this.shufflingCache - .get(epochAfterUpcoming, this.nextDecisionRoot) - .then((shuffling) => { - if (!shuffling) { - throw new Error("EpochShuffling not returned from get in afterProcessEpoch"); - } - this.nextShuffling = shuffling; - }) - .catch((err) => { - this.shufflingCache?.logger?.error( - "EPOCH_CONTEXT_SHUFFLING_BUILD_ERROR", - {epoch: epochAfterUpcoming, decisionRoot: epochTransitionCache.nextShufflingDecisionRoot}, - err - ); + if (!epochTransitionCache.asyncShufflingCalculation) { + this.nextShuffling = this.shufflingCache.getSync(epochAfterUpcoming, this.nextDecisionRoot, { + state, + activeIndices: this.nextActiveIndices, }); + } else { + this.nextShuffling = null; + // This promise will resolve immediately after the synchronous code of the state-transition runs. Until + // the build is done on a worker thread it will be calculated immediately after the epoch transition + // completes. Once the work is done concurrently it should be ready by time this get runs so the promise + // will resolve directly on the next spin of the event loop because the epoch transition and shuffling take + // about the same time to calculate so theoretically its ready now. Do not await here though in case it + // is not ready yet as the transition must not be asynchronous. + this.shufflingCache + .get(epochAfterUpcoming, this.nextDecisionRoot) + .then((shuffling) => { + if (!shuffling) { + throw new Error("EpochShuffling not returned from get in afterProcessEpoch"); + } + this.nextShuffling = shuffling; + }) + .catch((err) => { + this.shufflingCache?.logger?.error( + "EPOCH_CONTEXT_SHUFFLING_BUILD_ERROR", + {epoch: epochAfterUpcoming, decisionRoot: epochTransitionCache.nextShufflingDecisionRoot}, + err + ); + }); + } } else { // Only for testing. shufflingCache should always be available in prod this.nextShuffling = computeEpochShuffling(state, this.nextActiveIndices, epochAfterUpcoming); diff --git a/packages/state-transition/src/cache/epochTransitionCache.ts b/packages/state-transition/src/cache/epochTransitionCache.ts index b21f940c28d5..d159ca5f3763 100644 --- a/packages/state-transition/src/cache/epochTransitionCache.ts +++ b/packages/state-transition/src/cache/epochTransitionCache.ts @@ -33,6 +33,10 @@ export type EpochTransitionCacheOpts = { * Assert progressive balances the same to EpochTransitionCache */ assertCorrectProgressiveBalances?: boolean; + /** + * Do not queue shuffling calculation async. Forces sync JIT calculation in afterProcessEpoch + */ + asyncShufflingCalculation?: boolean; }; /** @@ -176,6 +180,12 @@ export interface EpochTransitionCache { */ nextEpochTotalActiveBalanceByIncrement: number; + /** + * Compute the shuffling sync or async. Defaults to synchronous. Need to pass `true` with the + * `EpochTransitionCacheOpts` + */ + asyncShufflingCalculation: boolean; + /** * Track by validator index if it's active in the prev epoch. * Used in metrics @@ -387,7 +397,11 @@ export function beforeProcessEpoch( for (let i = 0; i < nextEpochShufflingActiveIndicesLength; i++) { nextShufflingActiveIndices[i] = nextEpochShufflingActiveValidatorIndices[i]; } - state.epochCtx.shufflingCache?.build(epochAfterNext, nextShufflingDecisionRoot, state, nextShufflingActiveIndices); + + const asyncShufflingCalculation = opts?.asyncShufflingCalculation ?? false; + if (asyncShufflingCalculation) { + state.epochCtx.shufflingCache?.build(epochAfterNext, nextShufflingDecisionRoot, state, nextShufflingActiveIndices); + } if (totalActiveStakeByIncrement < 1) { totalActiveStakeByIncrement = 1; @@ -514,6 +528,7 @@ export function beforeProcessEpoch( indicesToEject, nextShufflingDecisionRoot, nextShufflingActiveIndices, + asyncShufflingCalculation, // to be updated in processEffectiveBalanceUpdates nextEpochTotalActiveBalanceByIncrement: 0, isActivePrevEpoch, From 69ae688bed4b17f93801494aa16919888935c780 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Wed, 4 Dec 2024 14:11:06 +0100 Subject: [PATCH 26/48] chore: unpin nodejs version from 22.4 (#6982) * Revert "chore: pin nodejs version to 22.4 (#6964)" This reverts commit f20484bb4b6b5f3a27c624556d1e6fb9f448b969. * Don't revert formatting changes --------- Co-authored-by: Nico Flaig Co-authored-by: Cayman --- .github/workflows/benchmark.yml | 2 +- .github/workflows/binaries.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 12 ++++++------ .github/workflows/test.yml | 14 +++++++------- Dockerfile | 6 +++--- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 671434fe19ad..e515bef7f92a 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22.4 + node-version: 22 check-latest: true cache: yarn - name: Node.js version diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 722894424b91..469b0803c378 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -42,7 +42,7 @@ jobs: sudo apt-get install -y build-essential python3 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - run: | mkdir -p dist yarn global add caxa@3.0.1 diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index bd7310995d62..180f1c16fdaa 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22.4 + node-version: 22 cache: yarn - name: Node.js version id: node diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a4c0f18cdbe3..cec2bca86b4b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 22.4 + node-version: 22 check-latest: true cache: yarn diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 4e8c76e0dfdd..cb08c5c8fae0 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v4 with: - node-version: 22.4 + node-version: 22 registry-url: "https://registry.npmjs.org" check-latest: true cache: yarn diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 936072de42c9..e16cbce814dc 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -61,7 +61,7 @@ jobs: - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Generate changelog run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index c2909a7e4e24..26fee0ba6052 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -67,7 +67,7 @@ jobs: - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Generate changelog run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index 0042a9337bc3..ad79bc2c0035 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22.4 + node-version: 22 check-latest: true cache: yarn - name: Node.js version diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index fbe2691da637..ff28149537d3 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 sim-test-multifork: name: Multifork sim test @@ -42,7 +42,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -71,7 +71,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -100,7 +100,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -129,7 +129,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -158,7 +158,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22.4 + node: 22 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5514f6e896b7..47e17c56f042 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -42,7 +42,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" @@ -71,7 +71,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: - uses: actions/checkout@v4 @@ -92,7 +92,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" @@ -131,7 +131,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -168,7 +168,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -192,7 +192,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22.4] + node: [22] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" diff --git a/Dockerfile b/Dockerfile index 0ee8083c85e2..5a1f51bfcee6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # --platform=$BUILDPLATFORM is used build javascript source with host arch # Otherwise TS builds on emulated archs and can be extremely slow (+1h) -FROM --platform=${BUILDPLATFORM:-amd64} node:22.4-slim AS build_src +FROM --platform=${BUILDPLATFORM:-amd64} node:22-slim AS build_src ARG COMMIT WORKDIR /usr/app RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/* @@ -21,7 +21,7 @@ RUN cd packages/cli && GIT_COMMIT=${COMMIT} yarn write-git-data # Copy built src + node_modules to build native packages for archs different than host. # Note: This step is redundant for the host arch -FROM node:22.4-slim AS build_deps +FROM node:22-slim AS build_deps WORKDIR /usr/app RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/* @@ -35,7 +35,7 @@ RUN cd node_modules/classic-level && yarn rebuild # Copy built src + node_modules to a new layer to prune unnecessary fs # Previous layer weights 7.25GB, while this final 488MB (as of Oct 2020) -FROM node:22.4-slim +FROM node:22-slim WORKDIR /usr/app COPY --from=build_deps /usr/app . From b5fb76c8e65c59397f34e1ba6b06d618b6845f38 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 5 Dec 2024 20:23:19 +0100 Subject: [PATCH 27/48] chore: update bootnodes file url for holesky and sepolia (#7276) --- packages/cli/src/networks/holesky.ts | 2 +- packages/cli/src/networks/sepolia.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/networks/holesky.ts b/packages/cli/src/networks/holesky.ts index 63bc6e07f8f2..ed1dd7c78462 100644 --- a/packages/cli/src/networks/holesky.ts +++ b/packages/cli/src/networks/holesky.ts @@ -3,7 +3,7 @@ export {holeskyChainConfig as chainConfig} from "@lodestar/config/networks"; export const depositContractDeployBlock = 0; export const genesisFileUrl = "https://media.githubusercontent.com/media/eth-clients/holesky/main/metadata/genesis.ssz"; export const bootnodesFileUrl = - "https://raw.githubusercontent.com/eth-clients/holesky/main/metadata/bootstrap_nodes.txt"; + "https://raw.githubusercontent.com/eth-clients/holesky/main/metadata/bootstrap_nodes.yaml"; export const bootEnrs = [ "enr:-Ku4QFo-9q73SspYI8cac_4kTX7yF800VXqJW4Lj3HkIkb5CMqFLxciNHePmMt4XdJzHvhrCC5ADI4D_GkAsxGJRLnQBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAhnTT-AQFwAP__________gmlkgnY0gmlwhLKAiOmJc2VjcDI1NmsxoQORcM6e19T1T9gi7jxEZjk_sjVLGFscUNqAY9obgZaxbIN1ZHCCIyk", diff --git a/packages/cli/src/networks/sepolia.ts b/packages/cli/src/networks/sepolia.ts index 9dfd5dc20a0f..6900ca493057 100644 --- a/packages/cli/src/networks/sepolia.ts +++ b/packages/cli/src/networks/sepolia.ts @@ -3,7 +3,7 @@ export {sepoliaChainConfig as chainConfig} from "@lodestar/config/networks"; export const depositContractDeployBlock = 1273020; export const genesisFileUrl = "https://github.com/eth-clients/sepolia/raw/main/metadata/genesis.ssz"; export const bootnodesFileUrl = - "https://raw.githubusercontent.com/eth-clients/sepolia/main/metadata/bootstrap_nodes.txt"; + "https://raw.githubusercontent.com/eth-clients/sepolia/main/metadata/bootstrap_nodes.yaml"; export const bootEnrs = [ "enr:-KO4QP7MmB3juk8rUjJHcUoxZDU9Np4FlW0HyDEGIjSO7GD9PbSsabu7713cWSUWKDkxIypIXg1A-6lG7ySRGOMZHeGCAmuEZXRoMpDTH2GRkAAAc___________gmlkgnY0gmlwhBSoyGOJc2VjcDI1NmsxoQNta5b_bexSSwwrGW2Re24MjfMntzFd0f2SAxQtMj3ueYN0Y3CCIyiDdWRwgiMo", From d55bb2da72533e5ce01b29620ad9cf7d923abc74 Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:24:31 -0500 Subject: [PATCH 28/48] feat: add `debug_getHistoricalSummaries` endpoint (#7245) * feat: add new getHistoricalSummaries endpoint to debug namespace * Add JSON response * Restructure to use stateId and add proof to response * add test scaffolding * Address feedback * Move getHistoricalSummaries to lodestar namespace * add lodestar namespace unit test * update route name to lodestar namespace * cast state object as Capella state * Lint * json properties need to be lower case * Make it v1 since it's now part of lodestar namespace * Group with other /lodestar endpoints * Simplify beacon node impl * Rename return type * Update test description * Fix variable name --------- Co-authored-by: Nico Flaig --- packages/api/src/beacon/routes/lodestar.ts | 41 +++++++++++++- .../beacon/genericServerTest/lodestar.test.ts | 53 +++++++++++++++++++ .../beacon-node/src/api/impl/debug/index.ts | 2 +- .../src/api/impl/lodestar/index.ts | 29 +++++++++- packages/types/src/capella/sszTypes.ts | 6 ++- 5 files changed, 126 insertions(+), 5 deletions(-) create mode 100644 packages/api/test/unit/beacon/genericServerTest/lodestar.test.ts diff --git a/packages/api/src/beacon/routes/lodestar.ts b/packages/api/src/beacon/routes/lodestar.ts index 81191efd2696..de05b7f2bb44 100644 --- a/packages/api/src/beacon/routes/lodestar.ts +++ b/packages/api/src/beacon/routes/lodestar.ts @@ -1,8 +1,11 @@ +import {ContainerType, ValueOf} from "@chainsafe/ssz"; import {ChainForkConfig} from "@lodestar/config"; -import {Epoch, RootHex, Slot} from "@lodestar/types"; +import {Epoch, RootHex, Slot, ssz} from "@lodestar/types"; import { + ArrayOf, EmptyArgs, EmptyMeta, + EmptyMetaCodec, EmptyRequest, EmptyRequestCodec, EmptyResponseCodec, @@ -10,6 +13,7 @@ import { JsonOnlyResponseCodec, } from "../../utils/codecs.js"; import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js"; +import {StateArgs} from "./beacon/state.js"; import {FilterGetPeers, NodePeer, PeerDirection, PeerState} from "./node.js"; // See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes @@ -75,6 +79,16 @@ export type LodestarNodePeer = NodePeer & { export type LodestarThreadType = "main" | "network" | "discv5"; +const HistoricalSummariesResponseType = new ContainerType( + { + historicalSummaries: ssz.capella.HistoricalSummaries, + proof: ArrayOf(ssz.Bytes8), + }, + {jsonCase: "eth2"} +); + +export type HistoricalSummariesResponse = ValueOf; + export type Endpoints = { /** Trigger to write a heapdump to disk at `dirpath`. May take > 1min */ writeHeapdump: Endpoint< @@ -214,6 +228,16 @@ export type Endpoints = { {count: number} >; + /** Returns historical summaries and proof for a given state ID */ + getHistoricalSummaries: Endpoint< + // ⏎ + "GET", + StateArgs, + {params: {state_id: string}}, + HistoricalSummariesResponse, + EmptyMeta + >; + /** Dump Discv5 Kad values */ discv5GetKadValues: Endpoint< // ⏎ @@ -365,6 +389,21 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions ({params: {state_id: stateId.toString()}}), + parseReq: ({params}) => ({stateId: params.state_id}), + schema: { + params: {state_id: Schema.StringRequired}, + }, + }, + resp: { + data: HistoricalSummariesResponseType, + meta: EmptyMetaCodec, + }, + }, discv5GetKadValues: { url: "/eth/v1/debug/discv5_kad_values", method: "GET", diff --git a/packages/api/test/unit/beacon/genericServerTest/lodestar.test.ts b/packages/api/test/unit/beacon/genericServerTest/lodestar.test.ts new file mode 100644 index 000000000000..b0f78f4bd62c --- /dev/null +++ b/packages/api/test/unit/beacon/genericServerTest/lodestar.test.ts @@ -0,0 +1,53 @@ +import {config} from "@lodestar/config/default"; +import {FastifyInstance} from "fastify"; +import {afterAll, beforeAll, describe, expect, it, vi} from "vitest"; +import {getClient} from "../../../../src/beacon/client/lodestar.js"; +import {Endpoints, getDefinitions} from "../../../../src/beacon/routes/lodestar.js"; +import {getRoutes} from "../../../../src/beacon/server/lodestar.js"; +import {HttpClient} from "../../../../src/utils/client/httpClient.js"; +import {AnyEndpoint} from "../../../../src/utils/codecs.js"; +import {FastifyRoute} from "../../../../src/utils/server/index.js"; +import {WireFormat} from "../../../../src/utils/wireFormat.js"; +import {getMockApi, getTestServer} from "../../../utils/utils.js"; + +describe("beacon / lodestar", () => { + describe("get HistoricalSummaries as json", () => { + const mockApi = getMockApi(getDefinitions(config)); + let baseUrl: string; + let server: FastifyInstance; + + beforeAll(async () => { + const res = getTestServer(); + server = res.server; + for (const route of Object.values(getRoutes(config, mockApi))) { + server.route(route as FastifyRoute); + } + baseUrl = await res.start(); + }); + + afterAll(async () => { + if (server !== undefined) await server.close(); + }); + + it("getHistoricalSummaries", async () => { + mockApi.getHistoricalSummaries.mockResolvedValue({ + data: { + historicalSummaries: [], + proof: [], + }, + }); + + const httpClient = new HttpClient({baseUrl}); + const client = getClient(config, httpClient); + + const res = await client.getHistoricalSummaries({stateId: "head"}, {responseWireFormat: WireFormat.json}); + + expect(res.ok).toBe(true); + expect(res.wireFormat()).toBe(WireFormat.json); + expect(res.json().data).toStrictEqual({ + historical_summaries: [], + proof: [], + }); + }); + }); +}); diff --git a/packages/beacon-node/src/api/impl/debug/index.ts b/packages/beacon-node/src/api/impl/debug/index.ts index e6c104272237..a004bd80e8f2 100644 --- a/packages/beacon-node/src/api/impl/debug/index.ts +++ b/packages/beacon-node/src/api/impl/debug/index.ts @@ -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} from "@lodestar/types"; +import {BeaconState, ssz} from "@lodestar/types"; import {isOptimisticBlock} from "../../../util/forkChoice.js"; import {getStateSlotFromBytes} from "../../../util/multifork.js"; import {getStateResponseWithRegen} from "../beacon/state/utils.js"; diff --git a/packages/beacon-node/src/api/impl/lodestar/index.ts b/packages/beacon-node/src/api/impl/lodestar/index.ts index 10787194f5f5..aeef2e11a83e 100644 --- a/packages/beacon-node/src/api/impl/lodestar/index.ts +++ b/packages/beacon-node/src/api/impl/lodestar/index.ts @@ -1,11 +1,12 @@ import fs from "node:fs"; import path from "node:path"; +import {Tree} from "@chainsafe/persistent-merkle-tree"; import {routes} from "@lodestar/api"; import {ApplicationMethods} from "@lodestar/api/server"; import {ChainForkConfig} from "@lodestar/config"; import {Repository} from "@lodestar/db"; -import {SLOTS_PER_EPOCH} from "@lodestar/params"; -import {getLatestWeakSubjectivityCheckpointEpoch} from "@lodestar/state-transition"; +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"; import {BeaconChain} from "../../../chain/index.js"; @@ -13,6 +14,7 @@ import {QueuedStateRegenerator, RegenRequest} from "../../../chain/regen/index.j import {IBeaconDb} from "../../../db/interface.js"; import {GossipType} from "../../../network/index.js"; import {profileNodeJS, writeHeapSnapshot} from "../../../util/profile.js"; +import {getStateResponseWithRegen} from "../beacon/state/utils.js"; import {ApiModules} from "../types.js"; export function getLodestarApi({ @@ -187,6 +189,29 @@ export function getLodestarApi({ async dumpDbStateIndex() { return {data: await db.stateArchive.dumpRootIndexEntries()}; }, + + async getHistoricalSummaries({stateId}) { + const {state} = await getStateResponseWithRegen(chain, stateId); + + const stateView = ( + state instanceof Uint8Array ? loadState(config, chain.getHeadState(), state).state : state.clone() + ) as BeaconStateCapella; + + const fork = config.getForkName(stateView.slot); + if (ForkSeq[fork] < ForkSeq.capella) { + throw new Error("Historical summaries are not supported before Capella"); + } + + const {gindex} = ssz[fork].BeaconState.getPathInfo(["historicalSummaries"]); + const proof = new Tree(stateView.node).getSingleProof(gindex); + + return { + data: { + historicalSummaries: stateView.historicalSummaries.toValue(), + proof: proof, + }, + }; + }, }; } diff --git a/packages/types/src/capella/sszTypes.ts b/packages/types/src/capella/sszTypes.ts index 3110e59111d9..057bf97650fe 100644 --- a/packages/types/src/capella/sszTypes.ts +++ b/packages/types/src/capella/sszTypes.ts @@ -125,6 +125,10 @@ export const HistoricalSummary = new ContainerType( {typeName: "HistoricalSummary", jsonCase: "eth2"} ); +export const HistoricalSummaries = new ListCompositeType(HistoricalSummary, HISTORICAL_ROOTS_LIMIT, { + typeName: "HistoricalSummaries", +}); + // we don't reuse bellatrix.BeaconState fields since we need to replace some keys // and we cannot keep order doing that export const BeaconState = new ContainerType( @@ -168,7 +172,7 @@ export const BeaconState = new ContainerType( nextWithdrawalIndex: WithdrawalIndex, // [New in Capella] nextWithdrawalValidatorIndex: ValidatorIndex, // [New in Capella] // Deep history valid from Capella onwards - historicalSummaries: new ListCompositeType(HistoricalSummary, HISTORICAL_ROOTS_LIMIT), // [New in Capella] + historicalSummaries: HistoricalSummaries, // [New in Capella] }, {typeName: "BeaconState", jsonCase: "eth2"} ); From 86ed6f45d548f00ef54a1d35ac20387923762563 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 6 Dec 2024 09:38:42 +0100 Subject: [PATCH 29/48] chore: log sync committee signature errors as `error` (#7283) --- packages/beacon-node/src/api/impl/beacon/pool/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/beacon-node/src/api/impl/beacon/pool/index.ts b/packages/beacon-node/src/api/impl/beacon/pool/index.ts index 45fb763d9540..c283d6d3214c 100644 --- a/packages/beacon-node/src/api/impl/beacon/pool/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/pool/index.ts @@ -257,7 +257,7 @@ export function getBeaconPoolApi({ } failures.push({index: i, message: (e as Error).message}); - logger.debug( + logger.error( `Error on submitPoolSyncCommitteeSignatures [${i}]`, {slot: signature.slot, validatorIndex: signature.validatorIndex}, e as Error From cd1211fef36976f459097ac6765b7822d5a86595 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 6 Dec 2024 09:56:25 +0100 Subject: [PATCH 30/48] fix: update engine_getClientVersionV1 commit encoding (#7282) --- packages/beacon-node/src/execution/engine/http.ts | 5 +++-- packages/beacon-node/src/util/kzg.ts | 9 +-------- packages/config/src/genesisConfig/index.ts | 6 +----- packages/utils/src/format.ts | 7 +++++++ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/beacon-node/src/execution/engine/http.ts b/packages/beacon-node/src/execution/engine/http.ts index ea064d2fe816..0d2656ae46e2 100644 --- a/packages/beacon-node/src/execution/engine/http.ts +++ b/packages/beacon-node/src/execution/engine/http.ts @@ -2,6 +2,7 @@ import {Logger} from "@lodestar/logger"; import {ForkName, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; import {ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types"; import {BlobAndProof} from "@lodestar/types/deneb"; +import {strip0xPrefix} from "@lodestar/utils"; import { ErrorJsonRpcResponse, HttpRpcError, @@ -522,11 +523,11 @@ export class ExecutionEngineHttp implements IExecutionEngine { const response = await this.rpc.fetchWithRetries< EngineApiRpcReturnTypes[typeof method], EngineApiRpcParamTypes[typeof method] - >({method, params: [clientVersion]}); + >({method, params: [{...clientVersion, commit: `0x${clientVersion.commit}`}]}); const clientVersions = response.map((cv) => { const code = cv.code in ClientCode ? ClientCode[cv.code as keyof typeof ClientCode] : ClientCode.XX; - return {code, name: cv.name, version: cv.version, commit: cv.commit}; + return {code, name: cv.name, version: cv.version, commit: strip0xPrefix(cv.commit)}; }); if (clientVersions.length === 0) { diff --git a/packages/beacon-node/src/util/kzg.ts b/packages/beacon-node/src/util/kzg.ts index 36a7d19f8d2b..696eeae73370 100644 --- a/packages/beacon-node/src/util/kzg.ts +++ b/packages/beacon-node/src/util/kzg.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import {fileURLToPath} from "node:url"; -import {fromHex, toHex} from "@lodestar/utils"; +import {fromHex, strip0xPrefix, toHex} from "@lodestar/utils"; // "c-kzg" has hardcoded the mainnet value, do not use params export const FIELD_ELEMENTS_PER_BLOB_MAINNET = 4096; @@ -154,10 +154,3 @@ export function trustedSetupJsonToTxt(data: TrustedSetupJSON): TrustedSetupTXT { ...data.setup_G2.map(strip0xPrefix), ].join("\n"); } - -function strip0xPrefix(hex: string): string { - if (hex.startsWith("0x")) { - return hex.slice(2); - } - return hex; -} diff --git a/packages/config/src/genesisConfig/index.ts b/packages/config/src/genesisConfig/index.ts index dad79df1a98d..992185461b58 100644 --- a/packages/config/src/genesisConfig/index.ts +++ b/packages/config/src/genesisConfig/index.ts @@ -1,6 +1,6 @@ import {DOMAIN_VOLUNTARY_EXIT, ForkName, SLOTS_PER_EPOCH} from "@lodestar/params"; import {DomainType, ForkDigest, Root, Slot, Version, phase0, ssz} from "@lodestar/types"; -import {toHex} from "@lodestar/utils"; +import {strip0xPrefix, toHex} from "@lodestar/utils"; import {ChainForkConfig} from "../beaconConfig.js"; import {CachedGenesis, ForkDigestHex} from "./types.js"; export type {ForkDigestContext} from "./types.js"; @@ -142,10 +142,6 @@ function toHexStringNoPrefix(hex: string | Uint8Array): string { return strip0xPrefix(typeof hex === "string" ? hex : toHex(hex)); } -function strip0xPrefix(hex: string): string { - return hex.startsWith("0x") ? hex.slice(2) : hex; -} - function computeForkDigest(currentVersion: Version, genesisValidatorsRoot: Root): ForkDigest { return computeForkDataRoot(currentVersion, genesisValidatorsRoot).slice(0, 4); } diff --git a/packages/utils/src/format.ts b/packages/utils/src/format.ts index b36412072720..94bf0d635ced 100644 --- a/packages/utils/src/format.ts +++ b/packages/utils/src/format.ts @@ -65,3 +65,10 @@ export function prettyMsToTime(timeMs: number): string { const date = new Date(0, 0, 0, 0, 0, 0, timeMs); return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`; } + +/** + * Remove 0x prefix from a string + */ +export function strip0xPrefix(hex: string): string { + return hex.startsWith("0x") ? hex.slice(2) : hex; +} From e353f67426581e622c6df83c30992b4a28dcb617 Mon Sep 17 00:00:00 2001 From: twoeths Date: Fri, 6 Dec 2024 16:30:33 +0700 Subject: [PATCH 31/48] fix: check pubkey or validator index known to a state (#7284) * fix: check pubkey or validator index known to a state * chore: add more comments --- .../src/block/processConsolidationRequest.ts | 7 ++++++- .../src/epoch/processPendingDeposits.ts | 6 +++--- packages/state-transition/src/util/electra.ts | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/packages/state-transition/src/block/processConsolidationRequest.ts b/packages/state-transition/src/block/processConsolidationRequest.ts index d0650135d0c6..1a1d83eee0be 100644 --- a/packages/state-transition/src/block/processConsolidationRequest.ts +++ b/packages/state-transition/src/block/processConsolidationRequest.ts @@ -3,7 +3,7 @@ import {electra, ssz} from "@lodestar/types"; import {CachedBeaconStateElectra} from "../types.js"; import {hasEth1WithdrawalCredential} from "../util/capella.js"; -import {hasExecutionWithdrawalCredential, switchToCompoundingValidator} from "../util/electra.js"; +import {hasExecutionWithdrawalCredential, isPubkeyKnown, switchToCompoundingValidator} from "../util/electra.js"; import {computeConsolidationEpochAndUpdateChurn} from "../util/epoch.js"; import {getConsolidationChurnLimit, isActiveValidator} from "../util/validator.js"; @@ -13,6 +13,10 @@ export function processConsolidationRequest( consolidationRequest: electra.ConsolidationRequest ): void { const {sourcePubkey, targetPubkey, sourceAddress} = consolidationRequest; + if (!isPubkeyKnown(state, sourcePubkey) || !isPubkeyKnown(state, targetPubkey)) { + return; + } + const sourceIndex = state.epochCtx.getValidatorIndex(sourcePubkey); const targetIndex = state.epochCtx.getValidatorIndex(targetPubkey); @@ -97,6 +101,7 @@ function isValidSwitchToCompoundRequest( // Verify pubkey exists if (sourceIndex === null) { + // this check is mainly to make the compiler happy, pubkey is checked by the consumer already return false; } diff --git a/packages/state-transition/src/epoch/processPendingDeposits.ts b/packages/state-transition/src/epoch/processPendingDeposits.ts index d925aa1cc741..441d5601a380 100644 --- a/packages/state-transition/src/epoch/processPendingDeposits.ts +++ b/packages/state-transition/src/epoch/processPendingDeposits.ts @@ -3,7 +3,7 @@ import {PendingDeposit} from "@lodestar/types/lib/electra/types.js"; import {addValidatorToRegistry, isValidDepositSignature} from "../block/processDeposit.js"; import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js"; import {increaseBalance} from "../util/balance.js"; -import {hasCompoundingWithdrawalCredential} from "../util/electra.js"; +import {hasCompoundingWithdrawalCredential, isValidatorKnown} from "../util/electra.js"; import {computeStartSlotAtEpoch} from "../util/epoch.js"; import {getActivationExitChurnLimit} from "../util/validator.js"; @@ -51,7 +51,7 @@ export function processPendingDeposits(state: CachedBeaconStateElectra, cache: E let isValidatorWithdrawn = false; const validatorIndex = state.epochCtx.getValidatorIndex(deposit.pubkey); - if (validatorIndex !== null) { + if (isValidatorKnown(state, validatorIndex)) { const validator = state.validators.getReadonly(validatorIndex); isValidatorExited = validator.exitEpoch < FAR_FUTURE_EPOCH; isValidatorWithdrawn = validator.withdrawableEpoch < nextEpoch; @@ -103,7 +103,7 @@ function applyPendingDeposit( const {pubkey, withdrawalCredentials, amount, signature} = deposit; const cachedBalances = cache.balances; - if (validatorIndex === null) { + if (!isValidatorKnown(state, validatorIndex)) { // Verify the deposit signature (proof of possession) which is not checked by the deposit contract if (isValidDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) { addValidatorToRegistry(ForkSeq.electra, state, pubkey, withdrawalCredentials, amount); diff --git a/packages/state-transition/src/util/electra.ts b/packages/state-transition/src/util/electra.ts index f5b899eadcab..a9736dc8161e 100644 --- a/packages/state-transition/src/util/electra.ts +++ b/packages/state-transition/src/util/electra.ts @@ -45,3 +45,20 @@ export function queueExcessActiveBalance(state: CachedBeaconStateElectra, index: state.pendingDeposits.push(pendingDeposit); } } + +/** + * Since we share pubkey2index, pubkey maybe added by other epoch transition but we don't have that validator in this state + */ +export function isPubkeyKnown(state: CachedBeaconStateElectra, pubkey: Uint8Array): boolean { + return isValidatorKnown(state, state.epochCtx.getValidatorIndex(pubkey)); +} + +/** + * Since we share pubkey2index, validatorIndex maybe not null but we don't have that validator in this state + */ +export function isValidatorKnown( + state: CachedBeaconStateElectra, + index: ValidatorIndex | null +): index is ValidatorIndex { + return index !== null && index < state.validators.length; +} From f87eb0b2c74e42ea72324392380f28c5047477a1 Mon Sep 17 00:00:00 2001 From: Varun Guleria <152203177+varunguleriaCodes@users.noreply.github.com> Date: Fri, 6 Dec 2024 20:19:45 +0530 Subject: [PATCH 32/48] feat: lodestar script setup (#7254) * feat: lodestar_setup * feat: script_updates + docs * feat: script_addition_in_docs + command_update * Remove duplicate script from docs folder * Minor script updates * Update script to prepare docs and ignore copied file * Update installation page * Wording --------- Co-authored-by: Nico Flaig --- .gitignore | 1 + .../pages/run/getting-started/installation.md | 6 ++ scripts/install-binary.sh | 91 +++++++++++++++++++ scripts/prepare-docs.sh | 3 + 4 files changed, 101 insertions(+) create mode 100755 scripts/install-binary.sh diff --git a/.gitignore b/.gitignore index 52d9bc66e5b6..e54f7440864d 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ docs/pages/libraries/lightclient-prover/lightclient.md docs/pages/libraries/lightclient-prover/prover.md docs/pages/api/api-reference.md docs/pages/contribution/getting-started.md +docs/static/install ## Docusaurus docs/.docusaurus/ docs/build/ diff --git a/docs/pages/run/getting-started/installation.md b/docs/pages/run/getting-started/installation.md index 40c4865f7726..b2b4003f90a5 100644 --- a/docs/pages/run/getting-started/installation.md +++ b/docs/pages/run/getting-started/installation.md @@ -4,6 +4,12 @@ Binaries can be downloaded from the Lodestar [release page](https://github.com/ChainSafe/lodestar/releases/latest) under the `Assets` section. +Run the following command to install the latest version + +```bash +curl -fsSL https://chainsafe.github.io/lodestar/install | bash +``` + ## Docker Installation The [`chainsafe/lodestar`](https://hub.docker.com/r/chainsafe/lodestar) Docker Hub repository is maintained actively. It contains the `lodestar` CLI preinstalled. diff --git a/scripts/install-binary.sh b/scripts/install-binary.sh new file mode 100755 index 000000000000..f6db9948eeda --- /dev/null +++ b/scripts/install-binary.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# ASCII art +echo " _ _ _ " +echo " | | | | | | " +echo " | | ___ __| | ___ ___| |_ __ _ _ __ " +echo " | |/ _ \ / _ |/ _ \/ __| __/ _ | __|" +echo " | | (_) | (_| | __/\__ \ || (_| | | " +echo " |_|\___/ \__ _|\___||___/\__\__ _|_| " +echo "" + +# Declare directories +TEMP_DIR=$(mktemp -d) +LOCAL_BIN="$HOME/.local/bin" + +# Ensure ~/.local/bin exists +mkdir -p "$LOCAL_BIN" + +# Inform the user about temporary directory usage +echo "Using temporary directory: $TEMP_DIR" + +# Fetch the latest release tag from GitHub +echo "Fetching the latest version information..." +VERSION=$(curl -s "https://api.github.com/repos/ChainSafe/lodestar/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + +# Check if VERSION is empty +if [ -z "$VERSION" ]; then + echo "Failed to fetch the latest version. Exiting." + exit 1 +fi + +echo "Latest version detected: $VERSION" + +# Detect the operating system and architecture +OS=$(uname -s) +ARCH=$(uname -m) + +# Translate architecture to expected format +case $ARCH in + x86_64) ARCH="amd64" ;; + aarch64|arm64) ARCH="arm64" ;; + *) + echo "Unsupported architecture: $ARCH. Exiting." + exit 1 + ;; +esac + +# Translate OS to expected format +case $OS in + Linux) PLATFORM="linux-$ARCH" ;; + *) + echo "Unsupported operating system: $OS. Exiting." + exit 1 + ;; +esac + +# Construct the download URL +URL="https://github.com/ChainSafe/lodestar/releases/download/$VERSION/lodestar-$VERSION-$PLATFORM.tar.gz" +echo "Downloading from: $URL" + +# Download the tarball +if ! wget "$URL" -O "$TEMP_DIR/lodestar-$VERSION-$PLATFORM.tar.gz"; then + echo "Download failed. Exiting." + exit 1 +fi + +# Extract the tarball +echo "Extracting the binary..." +if ! tar -xzf "$TEMP_DIR/lodestar-$VERSION-$PLATFORM.tar.gz" -C "$TEMP_DIR"; then + echo "Extraction failed. Exiting." + exit 1 +fi + +# Move the binary to ~/.local/bin +echo "Moving the binary to $LOCAL_BIN..." +mv "$TEMP_DIR/lodestar" "$LOCAL_BIN/" +chmod +x "$LOCAL_BIN/lodestar" + +# Verify if ~/.local/bin is in PATH +if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then + echo "Adding $LOCAL_BIN to PATH..." + echo 'export PATH="$PATH:$HOME/.local/bin"' >> "$HOME/.bashrc" + echo "Run 'source ~/.bashrc' to apply changes to your shell." +fi + +# Clean up the temporary directory +rm -rf "$TEMP_DIR" + +# Inform the user of successful installation +echo "Installation complete!" +echo "Run 'lodestar --help' to get started." diff --git a/scripts/prepare-docs.sh b/scripts/prepare-docs.sh index d2bac519a7f2..2fa16a7cc759 100755 --- a/scripts/prepare-docs.sh +++ b/scripts/prepare-docs.sh @@ -17,3 +17,6 @@ cp -r packages/prover/README.md $DOCS_DIR/pages/libraries/lightclient-prover/pro # Copy visual assets rm -rf $DOCS_DIR/pages/assets $DOCS_DIR/pages/images cp -r $ASSETS_DIR $DOCS_DIR/pages/assets + +# Copy binary install script to docs +cp scripts/install-binary.sh $DOCS_DIR/static/install From dad9037e7739d5bcbccfe627e715ef40e9ba935b Mon Sep 17 00:00:00 2001 From: ClockworkYuzu Date: Fri, 6 Dec 2024 13:00:13 -0800 Subject: [PATCH 33/48] feat: add terminal-sized Electra giraffe banner (#7286) * Create giraffeBanners.ts * Wire in banner * Fix file name * lint * Address @nflaig's comment --------- Co-authored-by: NC <17676176+ensi321@users.noreply.github.com> --- .../src/chain/blocks/utils/giraffeBanner.ts | 27 +++++++++++++++++++ .../src/chain/blocks/verifyBlock.ts | 6 +++++ 2 files changed, 33 insertions(+) create mode 100644 packages/beacon-node/src/chain/blocks/utils/giraffeBanner.ts diff --git a/packages/beacon-node/src/chain/blocks/utils/giraffeBanner.ts b/packages/beacon-node/src/chain/blocks/utils/giraffeBanner.ts new file mode 100644 index 000000000000..d3987831a064 --- /dev/null +++ b/packages/beacon-node/src/chain/blocks/utils/giraffeBanner.ts @@ -0,0 +1,27 @@ +export const ELECTRA_GIRAFFE_BANNER = String.raw` + 2048 + :--: + :-@==+-: + :-=++#+#++#> + :-=+=#+: + ::+*--@-*: + :-+=%*#%@-: + MAXEB**=+%*+: + :-*###+*#*=-: + :--=+*+==#*=-: + :-*=+#*=*-#*+%@%%%#*+: + -=+-+**#+#%%%*#@@+%%#=#% + 32 -*=*+#+=%*#%*#%#+*##***-: + : #+**+*+=*+*%*%%*==++@**=: + =++++=: ::----:: +=-@*: + +++=- -++ =+: + -=@ :+- -+ + :-: :+: :- + :+ := -= + := - @ + - @ : + -: -: - + *: :- =- + :- --: =: + ::*-: :::: :-: +`; diff --git a/packages/beacon-node/src/chain/blocks/verifyBlock.ts b/packages/beacon-node/src/chain/blocks/verifyBlock.ts index 5ead67a720f7..2ce78eb5f3f1 100644 --- a/packages/beacon-node/src/chain/blocks/verifyBlock.ts +++ b/packages/beacon-node/src/chain/blocks/verifyBlock.ts @@ -15,6 +15,7 @@ import {BlockProcessOpts} from "../options.js"; import {RegenCaller} from "../regen/index.js"; import {BlockInput, BlockInputType, ImportBlockOpts} from "./types.js"; import {DENEB_BLOWFISH_BANNER} from "./utils/blowfishBanner.js"; +import {ELECTRA_GIRAFFE_BANNER} from "./utils/giraffeBanner.js"; import {CAPELLA_OWL_BANNER} from "./utils/ownBanner.js"; import {POS_PANDA_MERGE_TRANSITION_BANNER} from "./utils/pandaMergeTransitionBanner.js"; import {verifyBlocksDataAvailability} from "./verifyBlocksDataAvailability.js"; @@ -157,6 +158,11 @@ export async function verifyBlocksInEpoch( this.logger.info("Activating blobs", {epoch: this.config.DENEB_FORK_EPOCH}); break; + case ForkName.electra: + this.logger.info(ELECTRA_GIRAFFE_BANNER); + this.logger.info("Activating maxEB", {epoch: this.config.ELECTRA_FORK_EPOCH}); + break; + default: } } From 99794d3b261bb50f9a6c7d9f6ca19291b3f30911 Mon Sep 17 00:00:00 2001 From: Cayman Date: Thu, 12 Dec 2024 13:16:55 -0500 Subject: [PATCH 34/48] chore: pin nodejs version to 22.4 (#7291) Revert "chore: unpin nodejs version from 22.4 (#6982)" This reverts commit 69ae688bed4b17f93801494aa16919888935c780. --- .github/workflows/benchmark.yml | 2 +- .github/workflows/binaries.yml | 2 +- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/publish-dev.yml | 2 +- .github/workflows/publish-rc.yml | 2 +- .github/workflows/publish-stable.yml | 2 +- .github/workflows/test-sim-merge.yml | 2 +- .github/workflows/test-sim.yml | 12 ++++++------ .github/workflows/test.yml | 14 +++++++------- Dockerfile | 6 +++--- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e515bef7f92a..671434fe19ad 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 22.4 check-latest: true cache: yarn - name: Node.js version diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 469b0803c378..722894424b91 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -42,7 +42,7 @@ jobs: sudo apt-get install -y build-essential python3 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - run: | mkdir -p dist yarn global add caxa@3.0.1 diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 180f1c16fdaa..bd7310995d62 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 22.4 cache: yarn - name: Node.js version id: node diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cec2bca86b4b..a4c0f18cdbe3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 22.4 check-latest: true cache: yarn diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index cb08c5c8fae0..4e8c76e0dfdd 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 22.4 registry-url: "https://registry.npmjs.org" check-latest: true cache: yarn diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index e16cbce814dc..936072de42c9 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -61,7 +61,7 @@ jobs: - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Generate changelog run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md diff --git a/.github/workflows/publish-stable.yml b/.github/workflows/publish-stable.yml index 26fee0ba6052..c2909a7e4e24 100644 --- a/.github/workflows/publish-stable.yml +++ b/.github/workflows/publish-stable.yml @@ -67,7 +67,7 @@ jobs: - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Generate changelog run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md diff --git a/.github/workflows/test-sim-merge.yml b/.github/workflows/test-sim-merge.yml index ad79bc2c0035..0042a9337bc3 100644 --- a/.github/workflows/test-sim-merge.yml +++ b/.github/workflows/test-sim-merge.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 22.4 check-latest: true cache: yarn - name: Node.js version diff --git a/.github/workflows/test-sim.yml b/.github/workflows/test-sim.yml index ff28149537d3..fbe2691da637 100644 --- a/.github/workflows/test-sim.yml +++ b/.github/workflows/test-sim.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 sim-test-multifork: name: Multifork sim test @@ -42,7 +42,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -71,7 +71,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -100,7 +100,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -129,7 +129,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests @@ -158,7 +158,7 @@ jobs: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" with: - node: 22 + node: 22.4 - name: Load env variables uses: ./.github/actions/dotenv - name: Download required docker images before running tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47e17c56f042..5514f6e896b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -42,7 +42,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" @@ -71,7 +71,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: - uses: actions/checkout@v4 @@ -92,7 +92,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" @@ -131,7 +131,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -168,7 +168,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: # - Uses YAML anchors in the future - uses: actions/checkout@v4 @@ -192,7 +192,7 @@ jobs: strategy: fail-fast: false matrix: - node: [22] + node: [22.4] steps: - uses: actions/checkout@v4 - uses: "./.github/actions/setup-and-build" diff --git a/Dockerfile b/Dockerfile index 5a1f51bfcee6..0ee8083c85e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # --platform=$BUILDPLATFORM is used build javascript source with host arch # Otherwise TS builds on emulated archs and can be extremely slow (+1h) -FROM --platform=${BUILDPLATFORM:-amd64} node:22-slim AS build_src +FROM --platform=${BUILDPLATFORM:-amd64} node:22.4-slim AS build_src ARG COMMIT WORKDIR /usr/app RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/* @@ -21,7 +21,7 @@ RUN cd packages/cli && GIT_COMMIT=${COMMIT} yarn write-git-data # Copy built src + node_modules to build native packages for archs different than host. # Note: This step is redundant for the host arch -FROM node:22-slim AS build_deps +FROM node:22.4-slim AS build_deps WORKDIR /usr/app RUN apt-get update && apt-get install -y g++ make python3 python3-setuptools && apt-get clean && rm -rf /var/lib/apt/lists/* @@ -35,7 +35,7 @@ RUN cd node_modules/classic-level && yarn rebuild # Copy built src + node_modules to a new layer to prune unnecessary fs # Previous layer weights 7.25GB, while this final 488MB (as of Oct 2020) -FROM node:22-slim +FROM node:22.4-slim WORKDIR /usr/app COPY --from=build_deps /usr/app . From 879f99bf87b7826bad8c2530a42f5ed16cf340b7 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 13 Dec 2024 21:29:10 +0100 Subject: [PATCH 35/48] feat: expose `DOMAIN_APPLICATION_MASK` in config/spec api (#7296) * feat: expose DOMAIN_APPLICATION_MASK in config/spec api * Lint --- packages/beacon-node/src/api/impl/config/constants.ts | 2 ++ packages/beacon-node/test/e2e/api/impl/config.test.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/src/api/impl/config/constants.ts b/packages/beacon-node/src/api/impl/config/constants.ts index c55cfe7008f4..6b390727cec3 100644 --- a/packages/beacon-node/src/api/impl/config/constants.ts +++ b/packages/beacon-node/src/api/impl/config/constants.ts @@ -7,6 +7,7 @@ import { DEPOSIT_CONTRACT_TREE_DEPTH, DOMAIN_AGGREGATE_AND_PROOF, DOMAIN_APPLICATION_BUILDER, + DOMAIN_APPLICATION_MASK, DOMAIN_BEACON_ATTESTER, DOMAIN_BEACON_PROPOSER, DOMAIN_BLS_TO_EXECUTION_CHANGE, @@ -67,6 +68,7 @@ export const specConstants = { DOMAIN_VOLUNTARY_EXIT, DOMAIN_SELECTION_PROOF, DOMAIN_AGGREGATE_AND_PROOF, + DOMAIN_APPLICATION_MASK, DOMAIN_APPLICATION_BUILDER, // phase0/validator.md diff --git a/packages/beacon-node/test/e2e/api/impl/config.test.ts b/packages/beacon-node/test/e2e/api/impl/config.test.ts index a878d41a36f0..474826050a3a 100644 --- a/packages/beacon-node/test/e2e/api/impl/config.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/config.test.ts @@ -60,7 +60,7 @@ async function downloadRemoteConstants(commit: string): Promise { const constantNames: string[] = []; for (const spec of await Promise.all(downloadedSpecs)) { - const matches = spec.matchAll(/\|\s`*([A-Z_]+)`\s\|/g); + const matches = spec.matchAll(/\|\s`*([A-Z_]+)`\s+\|/g); for (const match of matches) { constantNames.push(match[1]); } From 30c669b1f58d029e4ff821264796f041a45a55d9 Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:51:29 -0800 Subject: [PATCH 36/48] feat: make `MAX_REQUEST_BLOB_SIDECARS` and `MAX_BLOBS_PER_BLOCK` configurable (#7294) * Init commit * Fix check-types * Add comment on how MAX_REQUEST_BLOB_SIDECARS is calculated * Ensure proper config object is passed * Address comment --------- Co-authored-by: Nico Flaig --- .../src/network/core/networkCore.ts | 16 +++++----- .../src/network/gossip/gossipsub.ts | 2 +- .../beacon-node/src/network/gossip/topic.ts | 6 ++-- packages/beacon-node/src/network/interface.ts | 3 +- packages/beacon-node/src/network/network.ts | 12 ++++---- .../src/network/reqresp/ReqRespBeaconNode.ts | 6 ++-- .../reqresp/handlers/blobSidecarsByRoot.ts | 5 ++-- .../src/network/reqresp/handlers/index.ts | 3 +- .../src/network/reqresp/protocols.ts | 8 ++--- .../src/network/reqresp/rateLimit.ts | 29 +++++++++---------- .../beacon-node/src/network/reqresp/types.ts | 12 ++++---- packages/beacon-node/src/util/types.ts | 7 ++++- .../config/src/chainConfig/configs/mainnet.ts | 3 ++ .../config/src/chainConfig/configs/minimal.ts | 3 ++ packages/config/src/chainConfig/types.ts | 4 +++ packages/params/src/index.ts | 2 -- packages/params/src/presets/mainnet.ts | 1 - packages/params/src/presets/minimal.ts | 1 - packages/params/src/types.ts | 2 -- .../test/e2e/ensure-config-is-synced.test.ts | 3 +- .../src/block/processExecutionPayload.ts | 6 ++-- packages/types/src/deneb/sszTypes.ts | 3 -- packages/types/src/deneb/types.ts | 1 - packages/validator/src/util/params.ts | 3 +- 24 files changed, 74 insertions(+), 67 deletions(-) diff --git a/packages/beacon-node/src/network/core/networkCore.ts b/packages/beacon-node/src/network/core/networkCore.ts index 718b7c92df7f..beda73b62a94 100644 --- a/packages/beacon-node/src/network/core/networkCore.ts +++ b/packages/beacon-node/src/network/core/networkCore.ts @@ -316,7 +316,7 @@ export class NetworkCore implements INetworkCore { } for (const fork of getActiveForks(this.config, this.clock.currentEpoch)) { - this.subscribeCoreTopicsAtFork(fork); + this.subscribeCoreTopicsAtFork(this.config, fork); } } @@ -325,7 +325,7 @@ export class NetworkCore implements INetworkCore { */ async unsubscribeGossipCoreTopics(): Promise { for (const fork of this.subscribedForks.values()) { - this.unsubscribeCoreTopicsAtFork(fork); + this.unsubscribeCoreTopicsAtFork(this.config, fork); } } @@ -456,7 +456,7 @@ export class NetworkCore implements INetworkCore { if (epoch === forkEpoch - FORK_EPOCH_LOOKAHEAD) { // Don't subscribe to new fork if the node is not subscribed to any topic if (await this.isSubscribedToGossipCoreTopics()) { - this.subscribeCoreTopicsAtFork(nextFork); + this.subscribeCoreTopicsAtFork(this.config, nextFork); this.logger.info("Subscribing gossip topics before fork", {nextFork}); } else { this.logger.info("Skipping subscribing gossip topics before fork", {nextFork}); @@ -475,7 +475,7 @@ export class NetworkCore implements INetworkCore { // After fork transition if (epoch === forkEpoch + FORK_EPOCH_LOOKAHEAD) { this.logger.info("Unsubscribing gossip topics from prev fork", {prevFork}); - this.unsubscribeCoreTopicsAtFork(prevFork); + this.unsubscribeCoreTopicsAtFork(this.config, prevFork); this.attnetsService.unsubscribeSubnetsFromPrevFork(prevFork); this.syncnetsService.unsubscribeSubnetsFromPrevFork(prevFork); } @@ -501,12 +501,12 @@ export class NetworkCore implements INetworkCore { } }; - private subscribeCoreTopicsAtFork(fork: ForkName): void { + private subscribeCoreTopicsAtFork(config: BeaconConfig, fork: ForkName): void { if (this.subscribedForks.has(fork)) return; this.subscribedForks.add(fork); const {subscribeAllSubnets, disableLightClientServer} = this.opts; - for (const topic of getCoreTopicsAtFork(fork, { + for (const topic of getCoreTopicsAtFork(config, fork, { subscribeAllSubnets, disableLightClientServer, })) { @@ -514,12 +514,12 @@ export class NetworkCore implements INetworkCore { } } - private unsubscribeCoreTopicsAtFork(fork: ForkName): void { + private unsubscribeCoreTopicsAtFork(config: BeaconConfig, fork: ForkName): void { if (!this.subscribedForks.has(fork)) return; this.subscribedForks.delete(fork); const {subscribeAllSubnets, disableLightClientServer} = this.opts; - for (const topic of getCoreTopicsAtFork(fork, { + for (const topic of getCoreTopicsAtFork(config, fork, { subscribeAllSubnets, disableLightClientServer, })) { diff --git a/packages/beacon-node/src/network/gossip/gossipsub.ts b/packages/beacon-node/src/network/gossip/gossipsub.ts index 42f8ba8b114c..9f2b47e21c6f 100644 --- a/packages/beacon-node/src/network/gossip/gossipsub.ts +++ b/packages/beacon-node/src/network/gossip/gossipsub.ts @@ -329,7 +329,7 @@ function getMetricsTopicStrToLabel(config: BeaconConfig, opts: {disableLightClie const metricsTopicStrToLabel = new Map(); for (const {name: fork} of config.forksAscendingEpochOrder) { - const topics = getCoreTopicsAtFork(fork, { + const topics = getCoreTopicsAtFork(config, fork, { subscribeAllSubnets: true, disableLightClientServer: opts.disableLightClientServer, }); diff --git a/packages/beacon-node/src/network/gossip/topic.ts b/packages/beacon-node/src/network/gossip/topic.ts index de52860605a9..1c34440df2b8 100644 --- a/packages/beacon-node/src/network/gossip/topic.ts +++ b/packages/beacon-node/src/network/gossip/topic.ts @@ -1,9 +1,8 @@ -import {ForkDigestContext} from "@lodestar/config"; +import {ChainConfig, ForkDigestContext} from "@lodestar/config"; import { ATTESTATION_SUBNET_COUNT, ForkName, ForkSeq, - MAX_BLOBS_PER_BLOCK, SYNC_COMMITTEE_SUBNET_COUNT, isForkLightClient, } from "@lodestar/params"; @@ -199,6 +198,7 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr: * De-duplicate logic to pick fork topics between subscribeCoreTopicsAtFork and unsubscribeCoreTopicsAtFork */ export function getCoreTopicsAtFork( + config: ChainConfig, fork: ForkName, opts: {subscribeAllSubnets?: boolean; disableLightClientServer?: boolean} ): GossipTopicTypeMap[keyof GossipTopicTypeMap][] { @@ -213,7 +213,7 @@ export function getCoreTopicsAtFork( // After Deneb also track blob_sidecar_{index} if (ForkSeq[fork] >= ForkSeq.deneb) { - for (let index = 0; index < MAX_BLOBS_PER_BLOCK; index++) { + for (let index = 0; index < config.MAX_BLOBS_PER_BLOCK; index++) { topics.push({type: GossipType.blob_sidecar, index}); } } diff --git a/packages/beacon-node/src/network/interface.ts b/packages/beacon-node/src/network/interface.ts index bf117cc8a743..edcf35878420 100644 --- a/packages/beacon-node/src/network/interface.ts +++ b/packages/beacon-node/src/network/interface.ts @@ -30,6 +30,7 @@ import { import type {Datastore} from "interface-datastore"; import {Libp2p as ILibp2p} from "libp2p"; import {PeerIdStr} from "../util/peerId.js"; +import {BlobSidecarsByRootRequest} from "../util/types.js"; import {INetworkCorePublic} from "./core/types.js"; import {INetworkEventBus} from "./events.js"; import {GossipType} from "./gossip/interface.js"; @@ -66,7 +67,7 @@ export interface INetwork extends INetworkCorePublic { request: phase0.BeaconBlocksByRootRequest ): Promise[]>; sendBlobSidecarsByRange(peerId: PeerIdStr, request: deneb.BlobSidecarsByRangeRequest): Promise; - sendBlobSidecarsByRoot(peerId: PeerIdStr, request: deneb.BlobSidecarsByRootRequest): Promise; + sendBlobSidecarsByRoot(peerId: PeerIdStr, request: BlobSidecarsByRootRequest): Promise; // Gossip publishBeaconBlock(signedBlock: SignedBeaconBlock): Promise; diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 2181e21744da..870fbf303ff4 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -4,7 +4,7 @@ import {PeerId} from "@libp2p/interface"; import {routes} from "@lodestar/api"; import {BeaconConfig} from "@lodestar/config"; import {LoggerNode} from "@lodestar/logger/node"; -import {ForkSeq, MAX_BLOBS_PER_BLOCK} from "@lodestar/params"; +import {ForkSeq} from "@lodestar/params"; import {ResponseIncoming} from "@lodestar/reqresp"; import {computeStartSlotAtEpoch, computeTimeAtSlot} from "@lodestar/state-transition"; import { @@ -28,6 +28,7 @@ import {IBeaconDb} from "../db/interface.js"; import {Metrics, RegistryMetricCreator} from "../metrics/index.js"; import {IClock} from "../util/clock.js"; import {PeerIdStr, peerIdToString} from "../util/peerId.js"; +import {BlobSidecarsByRootRequest} from "../util/types.js"; import {INetworkCore, NetworkCore, WorkerNetworkCore} from "./core/index.js"; import {INetworkEventBus, NetworkEvent, NetworkEventBus, NetworkEventData} from "./events.js"; import {getActiveForks} from "./forks.js"; @@ -502,15 +503,12 @@ export class Network implements INetwork { return collectMaxResponseTyped( this.sendReqRespRequest(peerId, ReqRespMethod.BlobSidecarsByRange, [Version.V1], request), // request's count represent the slots, so the actual max count received could be slots * blobs per slot - request.count * MAX_BLOBS_PER_BLOCK, + request.count * this.config.MAX_BLOBS_PER_BLOCK, responseSszTypeByMethod[ReqRespMethod.BlobSidecarsByRange] ); } - async sendBlobSidecarsByRoot( - peerId: PeerIdStr, - request: deneb.BlobSidecarsByRootRequest - ): Promise { + async sendBlobSidecarsByRoot(peerId: PeerIdStr, request: BlobSidecarsByRootRequest): Promise { return collectMaxResponseTyped( this.sendReqRespRequest(peerId, ReqRespMethod.BlobSidecarsByRoot, [Version.V1], request), request.length, @@ -524,7 +522,7 @@ export class Network implements INetwork { versions: number[], request: Req ): AsyncIterable { - const requestType = requestSszTypeByMethod[method]; + const requestType = requestSszTypeByMethod(this.config)[method]; const requestData = requestType ? requestType.serialize(request as never) : new Uint8Array(); // ReqResp outgoing request, emit from main thread to worker diff --git a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts index a2a2ebd657ab..96b5c6c0a776 100644 --- a/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts +++ b/packages/beacon-node/src/network/reqresp/ReqRespBeaconNode.ts @@ -156,7 +156,9 @@ export class ReqRespBeaconNode extends ReqResp { // Overwrite placeholder requestData from main thread with correct sequenceNumber if (method === ReqRespMethod.Ping) { - requestData = requestSszTypeByMethod[ReqRespMethod.Ping].serialize(this.metadataController.seqNumber); + requestData = requestSszTypeByMethod(this.config)[ReqRespMethod.Ping].serialize( + this.metadataController.seqNumber + ); } // ReqResp outgoing request, emit from main thread to worker @@ -205,7 +207,7 @@ export class ReqRespBeaconNode extends ReqResp { versions: number[], request: Req ): AsyncIterable { - const requestType = requestSszTypeByMethod[method]; + const requestType = requestSszTypeByMethod(this.config)[method]; const requestData = requestType ? requestType.serialize(request as never) : new Uint8Array(); return this.sendRequestWithoutEncoding(peerId, method, versions, requestData); } diff --git a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts index f44f9482eeb6..951a39cff564 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/blobSidecarsByRoot.ts @@ -1,13 +1,14 @@ import {BLOBSIDECAR_FIXED_SIZE} from "@lodestar/params"; import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp"; -import {RootHex, deneb} from "@lodestar/types"; +import {RootHex} from "@lodestar/types"; import {fromHex, toRootHex} from "@lodestar/utils"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../../../db/repositories/blobSidecars.js"; +import {BlobSidecarsByRootRequest} from "../../../util/types.js"; export async function* onBlobSidecarsByRoot( - requestBody: deneb.BlobSidecarsByRootRequest, + requestBody: BlobSidecarsByRootRequest, chain: IBeaconChain, db: IBeaconDb ): AsyncIterable { diff --git a/packages/beacon-node/src/network/reqresp/handlers/index.ts b/packages/beacon-node/src/network/reqresp/handlers/index.ts index a836cbc47769..83f6620dbbd4 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/index.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/index.ts @@ -2,6 +2,7 @@ import {ProtocolHandler} from "@lodestar/reqresp"; import {ssz} from "@lodestar/types"; import {IBeaconChain} from "../../../chain/index.js"; import {IBeaconDb} from "../../../db/index.js"; +import {BlobSidecarsByRootRequestType} from "../../../util/types.js"; import {GetReqRespHandlerFn, ReqRespMethod} from "../types.js"; import {onBeaconBlocksByRange} from "./beaconBlocksByRange.js"; import {onBeaconBlocksByRoot} from "./beaconBlocksByRoot.js"; @@ -37,7 +38,7 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh return onBeaconBlocksByRoot(body, chain, db); }, [ReqRespMethod.BlobSidecarsByRoot]: (req) => { - const body = ssz.deneb.BlobSidecarsByRootRequest.deserialize(req.data); + const body = BlobSidecarsByRootRequestType(chain.config).deserialize(req.data); return onBlobSidecarsByRoot(body, chain, db); }, [ReqRespMethod.BlobSidecarsByRange]: (req) => { diff --git a/packages/beacon-node/src/network/reqresp/protocols.ts b/packages/beacon-node/src/network/reqresp/protocols.ts index b6b9c6c48967..b254db022101 100644 --- a/packages/beacon-node/src/network/reqresp/protocols.ts +++ b/packages/beacon-node/src/network/reqresp/protocols.ts @@ -1,4 +1,4 @@ -import {ForkDigestContext} from "@lodestar/config"; +import {BeaconConfig, ForkDigestContext} from "@lodestar/config"; import {ContextBytesFactory, ContextBytesType, Encoding} from "@lodestar/reqresp"; import {rateLimitQuotas} from "./rateLimit.js"; import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js"; @@ -100,13 +100,13 @@ type ProtocolSummary = { }; function toProtocol(protocol: ProtocolSummary) { - return (config: ForkDigestContext): ProtocolNoHandler => ({ + return (config: BeaconConfig): ProtocolNoHandler => ({ method: protocol.method, version: protocol.version, encoding: Encoding.SSZ_SNAPPY, contextBytes: toContextBytes(protocol.contextBytesType, config), - inboundRateLimits: rateLimitQuotas[protocol.method], - requestSizes: requestSszTypeByMethod[protocol.method], + inboundRateLimits: rateLimitQuotas(config)[protocol.method], + requestSizes: requestSszTypeByMethod(config)[protocol.method], responseSizes: (fork) => responseSszTypeByMethod[protocol.method](fork, protocol.version), }); } diff --git a/packages/beacon-node/src/network/reqresp/rateLimit.ts b/packages/beacon-node/src/network/reqresp/rateLimit.ts index 5830b48d2eab..771d01f6c339 100644 --- a/packages/beacon-node/src/network/reqresp/rateLimit.ts +++ b/packages/beacon-node/src/network/reqresp/rateLimit.ts @@ -1,14 +1,10 @@ -import { - MAX_BLOBS_PER_BLOCK, - MAX_REQUEST_BLOB_SIDECARS, - MAX_REQUEST_BLOCKS, - MAX_REQUEST_LIGHT_CLIENT_UPDATES, -} from "@lodestar/params"; +import {ChainConfig} from "@lodestar/config"; +import {MAX_REQUEST_BLOCKS, MAX_REQUEST_LIGHT_CLIENT_UPDATES} from "@lodestar/params"; import {InboundRateLimitQuota} from "@lodestar/reqresp"; import {ReqRespMethod, RequestBodyByMethod} from "./types.js"; import {requestSszTypeByMethod} from "./types.js"; -export const rateLimitQuotas: Record = { +export const rateLimitQuotas: (config: ChainConfig) => Record = (config) => ({ [ReqRespMethod.Status]: { // Rationale: https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 byPeer: {quota: 5, quotaTimeMs: 15_000}, @@ -29,22 +25,22 @@ export const rateLimitQuotas: Record = { [ReqRespMethod.BeaconBlocksByRange]: { // Rationale: https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 byPeer: {quota: MAX_REQUEST_BLOCKS, quotaTimeMs: 10_000}, - getRequestCount: getRequestCountFn(ReqRespMethod.BeaconBlocksByRange, (req) => req.count), + getRequestCount: getRequestCountFn(config, ReqRespMethod.BeaconBlocksByRange, (req) => req.count), }, [ReqRespMethod.BeaconBlocksByRoot]: { // Rationale: https://github.com/sigp/lighthouse/blob/bf533c8e42cc73c35730e285c21df8add0195369/beacon_node/lighthouse_network/src/rpc/mod.rs#L118-L130 byPeer: {quota: 128, quotaTimeMs: 10_000}, - getRequestCount: getRequestCountFn(ReqRespMethod.BeaconBlocksByRoot, (req) => req.length), + getRequestCount: getRequestCountFn(config, ReqRespMethod.BeaconBlocksByRoot, (req) => req.length), }, [ReqRespMethod.BlobSidecarsByRange]: { // Rationale: MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK - byPeer: {quota: MAX_REQUEST_BLOB_SIDECARS, quotaTimeMs: 10_000}, - getRequestCount: getRequestCountFn(ReqRespMethod.BlobSidecarsByRange, (req) => req.count), + byPeer: {quota: config.MAX_REQUEST_BLOB_SIDECARS, quotaTimeMs: 10_000}, + getRequestCount: getRequestCountFn(config, ReqRespMethod.BlobSidecarsByRange, (req) => req.count), }, [ReqRespMethod.BlobSidecarsByRoot]: { // Rationale: quota of BeaconBlocksByRoot * MAX_BLOBS_PER_BLOCK - byPeer: {quota: 128 * MAX_BLOBS_PER_BLOCK, quotaTimeMs: 10_000}, - getRequestCount: getRequestCountFn(ReqRespMethod.BlobSidecarsByRoot, (req) => req.length), + byPeer: {quota: config.MAX_REQUEST_BLOB_SIDECARS, quotaTimeMs: 10_000}, + getRequestCount: getRequestCountFn(config, ReqRespMethod.BlobSidecarsByRoot, (req) => req.length), }, [ReqRespMethod.LightClientBootstrap]: { // As similar in the nature of `Status` protocol so we use the same rate limits. @@ -53,7 +49,7 @@ export const rateLimitQuotas: Record = { [ReqRespMethod.LightClientUpdatesByRange]: { // Same rationale as for BeaconBlocksByRange byPeer: {quota: MAX_REQUEST_LIGHT_CLIENT_UPDATES, quotaTimeMs: 10_000}, - getRequestCount: getRequestCountFn(ReqRespMethod.LightClientUpdatesByRange, (req) => req.count), + getRequestCount: getRequestCountFn(config, ReqRespMethod.LightClientUpdatesByRange, (req) => req.count), }, [ReqRespMethod.LightClientFinalityUpdate]: { // Finality updates should not be requested more than once per epoch. @@ -65,14 +61,15 @@ export const rateLimitQuotas: Record = { // Allow 2 per slot and a very safe bound until there's more testing of real usage. byPeer: {quota: 2, quotaTimeMs: 12_000}, }, -}; +}); // Helper to produce a getRequestCount function function getRequestCountFn( + config: ChainConfig, method: T, fn: (req: RequestBodyByMethod[T]) => number ): (reqData: Uint8Array) => number { - const type = requestSszTypeByMethod[method]; + const type = requestSszTypeByMethod(config)[method]; return (reqData: Uint8Array) => { try { return (type && fn(type.deserialize(reqData))) ?? 1; diff --git a/packages/beacon-node/src/network/reqresp/types.ts b/packages/beacon-node/src/network/reqresp/types.ts index 96ae1558ec07..b7c18ebdfeb5 100644 --- a/packages/beacon-node/src/network/reqresp/types.ts +++ b/packages/beacon-node/src/network/reqresp/types.ts @@ -1,4 +1,5 @@ import {Type} from "@chainsafe/ssz"; +import {ChainConfig} from "@lodestar/config"; import {ForkLightClient, ForkName, isForkLightClient} from "@lodestar/params"; import {Protocol, ProtocolHandler, ReqRespRequest} from "@lodestar/reqresp"; import { @@ -15,6 +16,7 @@ import { ssz, sszTypesFor, } from "@lodestar/types"; +import {BlobSidecarsByRootRequest, BlobSidecarsByRootRequestType} from "../../util/types.js"; export type ProtocolNoHandler = Omit; @@ -44,7 +46,7 @@ export type RequestBodyByMethod = { [ReqRespMethod.BeaconBlocksByRange]: phase0.BeaconBlocksByRangeRequest; [ReqRespMethod.BeaconBlocksByRoot]: phase0.BeaconBlocksByRootRequest; [ReqRespMethod.BlobSidecarsByRange]: deneb.BlobSidecarsByRangeRequest; - [ReqRespMethod.BlobSidecarsByRoot]: deneb.BlobSidecarsByRootRequest; + [ReqRespMethod.BlobSidecarsByRoot]: BlobSidecarsByRootRequest; [ReqRespMethod.LightClientBootstrap]: Root; [ReqRespMethod.LightClientUpdatesByRange]: altair.LightClientUpdatesByRange; [ReqRespMethod.LightClientFinalityUpdate]: null; @@ -68,9 +70,9 @@ type ResponseBodyByMethod = { }; /** Request SSZ type for each method and ForkName */ -export const requestSszTypeByMethod: { +export const requestSszTypeByMethod: (config: ChainConfig) => { [K in ReqRespMethod]: RequestBodyByMethod[K] extends null ? null : Type; -} = { +} = (config) => ({ [ReqRespMethod.Status]: ssz.phase0.Status, [ReqRespMethod.Goodbye]: ssz.phase0.Goodbye, [ReqRespMethod.Ping]: ssz.phase0.Ping, @@ -78,12 +80,12 @@ export const requestSszTypeByMethod: { [ReqRespMethod.BeaconBlocksByRange]: ssz.phase0.BeaconBlocksByRangeRequest, [ReqRespMethod.BeaconBlocksByRoot]: ssz.phase0.BeaconBlocksByRootRequest, [ReqRespMethod.BlobSidecarsByRange]: ssz.deneb.BlobSidecarsByRangeRequest, - [ReqRespMethod.BlobSidecarsByRoot]: ssz.deneb.BlobSidecarsByRootRequest, + [ReqRespMethod.BlobSidecarsByRoot]: BlobSidecarsByRootRequestType(config), [ReqRespMethod.LightClientBootstrap]: ssz.Root, [ReqRespMethod.LightClientUpdatesByRange]: ssz.altair.LightClientUpdatesByRange, [ReqRespMethod.LightClientFinalityUpdate]: null, [ReqRespMethod.LightClientOptimisticUpdate]: null, -}; +}); export type ResponseTypeGetter = (fork: ForkName, version: number) => Type; diff --git a/packages/beacon-node/src/util/types.ts b/packages/beacon-node/src/util/types.ts index 545a706c7511..5b9c7a784277 100644 --- a/packages/beacon-node/src/util/types.ts +++ b/packages/beacon-node/src/util/types.ts @@ -1,4 +1,5 @@ -import {ContainerType, ValueOf} from "@chainsafe/ssz"; +import {ContainerType, ListCompositeType, ValueOf} from "@chainsafe/ssz"; +import {ChainConfig} from "@lodestar/config"; import {ssz} from "@lodestar/types"; // Misc SSZ types used only in the beacon-node package, no need to upstream to types @@ -12,3 +13,7 @@ export const signedBLSToExecutionChangeVersionedType = new ContainerType( {jsonCase: "eth2", typeName: "SignedBLSToExecutionChangeVersionedType"} ); export type SignedBLSToExecutionChangeVersioned = ValueOf; + +export const BlobSidecarsByRootRequestType = (config: ChainConfig) => + new ListCompositeType(ssz.deneb.BlobIdentifier, config.MAX_REQUEST_BLOB_SIDECARS); +export type BlobSidecarsByRootRequest = ValueOf>; diff --git a/packages/config/src/chainConfig/configs/mainnet.ts b/packages/config/src/chainConfig/configs/mainnet.ts index 4a01d9d062b1..ae9a2ec74d1f 100644 --- a/packages/config/src/chainConfig/configs/mainnet.ts +++ b/packages/config/src/chainConfig/configs/mainnet.ts @@ -101,6 +101,9 @@ export const chainConfig: ChainConfig = { // Deneb // `2**12` (= 4096 epochs, ~18 days) MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096, + MAX_BLOBS_PER_BLOCK: 6, + // MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK + MAX_REQUEST_BLOB_SIDECARS: 768, // Electra // 2**8 * 10**9 (= 256,000,000,000) diff --git a/packages/config/src/chainConfig/configs/minimal.ts b/packages/config/src/chainConfig/configs/minimal.ts index f0e116a553ab..6f536bc7732c 100644 --- a/packages/config/src/chainConfig/configs/minimal.ts +++ b/packages/config/src/chainConfig/configs/minimal.ts @@ -98,6 +98,9 @@ export const chainConfig: ChainConfig = { // Deneb // `2**12` (= 4096 epochs, ~18 days) MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096, + MAX_BLOBS_PER_BLOCK: 6, + // MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK + MAX_REQUEST_BLOB_SIDECARS: 768, // Electra // 2**7 * 10**9 (= 128,000,000,000) diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 5c06b205c2f6..513324bdbcb8 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -72,6 +72,8 @@ export type ChainConfig = { // Networking MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: number; + MAX_BLOBS_PER_BLOCK: number; + MAX_REQUEST_BLOB_SIDECARS: number; }; export const chainConfigTypes: SpecTypes = { @@ -136,6 +138,8 @@ export const chainConfigTypes: SpecTypes = { // Networking MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: "number", + MAX_BLOBS_PER_BLOCK: "number", + MAX_REQUEST_BLOB_SIDECARS: "number", }; /** Allows values in a Spec file */ diff --git a/packages/params/src/index.ts b/packages/params/src/index.ts index 82ffa491daa3..64d3b64dbd60 100644 --- a/packages/params/src/index.ts +++ b/packages/params/src/index.ts @@ -91,7 +91,6 @@ export const { FIELD_ELEMENTS_PER_BLOB, MAX_BLOB_COMMITMENTS_PER_BLOCK, - MAX_BLOBS_PER_BLOCK, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, MAX_EFFECTIVE_BALANCE_ELECTRA, @@ -198,7 +197,6 @@ export const SYNC_COMMITTEE_SUBNET_SIZE = Math.floor(SYNC_COMMITTEE_SIZE / SYNC_ export const MAX_REQUEST_BLOCKS = 2 ** 10; // 1024 export const MAX_REQUEST_BLOCKS_DENEB = 2 ** 7; // 128 -export const MAX_REQUEST_BLOB_SIDECARS = MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK; // Lightclient pre-computed /** diff --git a/packages/params/src/presets/mainnet.ts b/packages/params/src/presets/mainnet.ts index 9a03001375f2..afbfd78eba95 100644 --- a/packages/params/src/presets/mainnet.ts +++ b/packages/params/src/presets/mainnet.ts @@ -115,7 +115,6 @@ export const mainnetPreset: BeaconPreset = { /////////// FIELD_ELEMENTS_PER_BLOB: 4096, MAX_BLOB_COMMITMENTS_PER_BLOCK: 4096, - MAX_BLOBS_PER_BLOCK: 6, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 17, // ELECTRA diff --git a/packages/params/src/presets/minimal.ts b/packages/params/src/presets/minimal.ts index 6edd7e2858f1..d9be1b1468ab 100644 --- a/packages/params/src/presets/minimal.ts +++ b/packages/params/src/presets/minimal.ts @@ -116,7 +116,6 @@ export const minimalPreset: BeaconPreset = { /////////// FIELD_ELEMENTS_PER_BLOB: 4096, MAX_BLOB_COMMITMENTS_PER_BLOCK: 16, - MAX_BLOBS_PER_BLOCK: 6, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 9, // ELECTRA diff --git a/packages/params/src/types.ts b/packages/params/src/types.ts index 5e17adaace12..e641e0f05286 100644 --- a/packages/params/src/types.ts +++ b/packages/params/src/types.ts @@ -78,7 +78,6 @@ export type BeaconPreset = { /////////// FIELD_ELEMENTS_PER_BLOB: number; MAX_BLOB_COMMITMENTS_PER_BLOCK: number; - MAX_BLOBS_PER_BLOCK: number; KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: number; // ELECTRA @@ -179,7 +178,6 @@ export const beaconPresetTypes: BeaconPresetTypes = { /////////// FIELD_ELEMENTS_PER_BLOB: "number", MAX_BLOB_COMMITMENTS_PER_BLOCK: "number", - MAX_BLOBS_PER_BLOCK: "number", KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: "number", // ELECTRA diff --git a/packages/params/test/e2e/ensure-config-is-synced.test.ts b/packages/params/test/e2e/ensure-config-is-synced.test.ts index ab34c16201c8..b1d9c05a54b1 100644 --- a/packages/params/test/e2e/ensure-config-is-synced.test.ts +++ b/packages/params/test/e2e/ensure-config-is-synced.test.ts @@ -12,9 +12,8 @@ const specConfigCommit = "v1.5.0-alpha.8"; /** * Fields that we filter from local config when doing comparison. * Ideally this should be empty as it is not spec compliant - * For `MAX_BLOBS_PER_BLOCK`, see https://github.com/ChainSafe/lodestar/issues/7172 */ -const ignoredLocalPresetFields: (keyof BeaconPreset)[] = ["MAX_BLOBS_PER_BLOCK"]; +const ignoredLocalPresetFields: (keyof BeaconPreset)[] = []; describe("Ensure config is synced", () => { vi.setConfig({testTimeout: 60 * 1000}); diff --git a/packages/state-transition/src/block/processExecutionPayload.ts b/packages/state-transition/src/block/processExecutionPayload.ts index 3900583956ba..0ea2fc7a16f7 100644 --- a/packages/state-transition/src/block/processExecutionPayload.ts +++ b/packages/state-transition/src/block/processExecutionPayload.ts @@ -1,5 +1,5 @@ import {byteArrayEquals} from "@chainsafe/ssz"; -import {ForkSeq, MAX_BLOBS_PER_BLOCK} from "@lodestar/params"; +import {ForkSeq} from "@lodestar/params"; import {BeaconBlockBody, BlindedBeaconBlockBody, deneb, isExecutionPayload} from "@lodestar/types"; import {toHex, toRootHex} from "@lodestar/utils"; import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js"; @@ -49,8 +49,8 @@ export function processExecutionPayload( if (fork >= ForkSeq.deneb) { const blobKzgCommitmentsLen = (body as deneb.BeaconBlockBody).blobKzgCommitments?.length ?? 0; - if (blobKzgCommitmentsLen > MAX_BLOBS_PER_BLOCK) { - throw Error(`blobKzgCommitmentsLen exceeds limit=${MAX_BLOBS_PER_BLOCK}`); + if (blobKzgCommitmentsLen > state.config.MAX_BLOBS_PER_BLOCK) { + throw Error(`blobKzgCommitmentsLen exceeds limit=${state.config.MAX_BLOBS_PER_BLOCK}`); } } diff --git a/packages/types/src/deneb/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts index 6dc18c8f8b02..9275ac4c4da5 100644 --- a/packages/types/src/deneb/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -6,7 +6,6 @@ import { HISTORICAL_ROOTS_LIMIT, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, MAX_BLOB_COMMITMENTS_PER_BLOCK, - MAX_REQUEST_BLOB_SIDECARS, SLOTS_PER_EPOCH, } from "@lodestar/params"; import {ssz as altairSsz} from "../altair/index.js"; @@ -62,8 +61,6 @@ export const BlobIdentifier = new ContainerType( {typeName: "BlobIdentifier", jsonCase: "eth2"} ); -export const BlobSidecarsByRootRequest = new ListCompositeType(BlobIdentifier, MAX_REQUEST_BLOB_SIDECARS); - // Beacon Chain types // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/beacon-chain.md#containers diff --git a/packages/types/src/deneb/types.ts b/packages/types/src/deneb/types.ts index 1bbabd0e4285..c1c973d4d5be 100644 --- a/packages/types/src/deneb/types.ts +++ b/packages/types/src/deneb/types.ts @@ -18,7 +18,6 @@ export type BLSFieldElement = ValueOf; export type BlobIdentifier = ValueOf; export type BlobSidecarsByRangeRequest = ValueOf; -export type BlobSidecarsByRootRequest = ValueOf; export type ExecutionPayload = ValueOf; export type ExecutionPayloadHeader = ValueOf; diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index 53ccd759a5c1..e8fd1a1e6dc4 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -136,6 +136,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record Date: Sat, 14 Dec 2024 01:23:31 +0100 Subject: [PATCH 37/48] feat: use `BLOB_SIDECAR_SUBNET_COUNT` to configure blob subnets (#7297) feat: use BLOB_SIDECAR_SUBNET_COUNT to configure blob subnets --- .../src/chain/errors/blobSidecarError.ts | 2 +- .../src/chain/validation/blobSidecar.ts | 15 ++++++++++----- .../beacon-node/src/network/gossip/interface.ts | 2 +- packages/beacon-node/src/network/gossip/topic.ts | 16 ++++++++-------- packages/beacon-node/src/network/network.ts | 4 ++-- .../src/network/processor/gossipHandlers.ts | 10 +++++----- .../beacon-node/test/e2e/api/impl/config.test.ts | 2 -- .../test/unit/network/gossip/topic.test.ts | 2 +- .../config/src/chainConfig/configs/mainnet.ts | 1 + .../config/src/chainConfig/configs/minimal.ts | 1 + packages/config/src/chainConfig/types.ts | 2 ++ packages/validator/src/util/params.ts | 1 + 12 files changed, 33 insertions(+), 25 deletions(-) diff --git a/packages/beacon-node/src/chain/errors/blobSidecarError.ts b/packages/beacon-node/src/chain/errors/blobSidecarError.ts index 410574594911..71118d8b8f9d 100644 --- a/packages/beacon-node/src/chain/errors/blobSidecarError.ts +++ b/packages/beacon-node/src/chain/errors/blobSidecarError.ts @@ -26,7 +26,7 @@ export enum BlobSidecarErrorCode { } export type BlobSidecarErrorType = - | {code: BlobSidecarErrorCode.INVALID_INDEX; blobIdx: number; gossipIndex: number} + | {code: BlobSidecarErrorCode.INVALID_INDEX; blobIdx: number; subnet: number} | {code: BlobSidecarErrorCode.INVALID_KZG; blobIdx: number} | {code: BlobSidecarErrorCode.INVALID_KZG_TXS} | {code: BlobSidecarErrorCode.INCORRECT_SLOT; blockSlot: Slot; blobSlot: Slot; blobIdx: number} diff --git a/packages/beacon-node/src/chain/validation/blobSidecar.ts b/packages/beacon-node/src/chain/validation/blobSidecar.ts index 3b90972f62b1..e2f4ed267d01 100644 --- a/packages/beacon-node/src/chain/validation/blobSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobSidecar.ts @@ -1,6 +1,7 @@ +import {ChainConfig} from "@lodestar/config"; import {KZG_COMMITMENT_INCLUSION_PROOF_DEPTH, KZG_COMMITMENT_SUBTREE_INDEX0} from "@lodestar/params"; import {computeStartSlotAtEpoch, getBlockHeaderProposerSignatureSet} from "@lodestar/state-transition"; -import {Root, Slot, deneb, ssz} from "@lodestar/types"; +import {BlobIndex, Root, Slot, deneb, ssz} from "@lodestar/types"; import {toRootHex, verifyMerkleBranch} from "@lodestar/utils"; import {byteArrayEquals} from "../../util/bytes.js"; @@ -13,16 +14,16 @@ import {RegenCaller} from "../regen/index.js"; export async function validateGossipBlobSidecar( chain: IBeaconChain, blobSidecar: deneb.BlobSidecar, - gossipIndex: number + subnet: number ): Promise { const blobSlot = blobSidecar.signedBlockHeader.message.slot; - // [REJECT] The sidecar is for the correct topic -- i.e. sidecar.index matches the topic {index}. - if (blobSidecar.index !== gossipIndex) { + // [REJECT] The sidecar is for the correct subnet -- i.e. `compute_subnet_for_blob_sidecar(sidecar.index) == subnet_id`. + if (computeSubnetForBlobSidecar(blobSidecar.index, chain.config) !== subnet) { throw new BlobSidecarGossipError(GossipAction.REJECT, { code: BlobSidecarErrorCode.INVALID_INDEX, blobIdx: blobSidecar.index, - gossipIndex, + subnet, }); } @@ -225,3 +226,7 @@ function validateInclusionProof(blobSidecar: deneb.BlobSidecar): boolean { blobSidecar.signedBlockHeader.message.bodyRoot ); } + +function computeSubnetForBlobSidecar(blobIndex: BlobIndex, config: ChainConfig): number { + return blobIndex % config.BLOB_SIDECAR_SUBNET_COUNT; +} diff --git a/packages/beacon-node/src/network/gossip/interface.ts b/packages/beacon-node/src/network/gossip/interface.ts index 9939ed5af657..be7293524ce9 100644 --- a/packages/beacon-node/src/network/gossip/interface.ts +++ b/packages/beacon-node/src/network/gossip/interface.ts @@ -54,7 +54,7 @@ export interface IGossipTopic { export type GossipTopicTypeMap = { [GossipType.beacon_block]: {type: GossipType.beacon_block}; - [GossipType.blob_sidecar]: {type: GossipType.blob_sidecar; index: number}; + [GossipType.blob_sidecar]: {type: GossipType.blob_sidecar; subnet: number}; [GossipType.beacon_aggregate_and_proof]: {type: GossipType.beacon_aggregate_and_proof}; [GossipType.beacon_attestation]: {type: GossipType.beacon_attestation; subnet: number}; [GossipType.voluntary_exit]: {type: GossipType.voluntary_exit}; diff --git a/packages/beacon-node/src/network/gossip/topic.ts b/packages/beacon-node/src/network/gossip/topic.ts index 1c34440df2b8..88ef4143f8ff 100644 --- a/packages/beacon-node/src/network/gossip/topic.ts +++ b/packages/beacon-node/src/network/gossip/topic.ts @@ -73,7 +73,7 @@ function stringifyGossipTopicType(topic: GossipTopic): string { case GossipType.sync_committee: return `${topic.type}_${topic.subnet}`; case GossipType.blob_sidecar: - return `${topic.type}_${topic.index}`; + return `${topic.type}_${topic.subnet}`; } } @@ -181,10 +181,10 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr: } if (gossipTypeStr.startsWith(GossipType.blob_sidecar)) { - const indexStr = gossipTypeStr.slice(GossipType.blob_sidecar.length + 1); // +1 for '_' concatenating the topic name and the index - const index = parseInt(indexStr, 10); - if (Number.isNaN(index)) throw Error(`index ${indexStr} is not a number`); - return {type: GossipType.blob_sidecar, index, fork, encoding}; + const subnetStr = gossipTypeStr.slice(GossipType.blob_sidecar.length + 1); // +1 for '_' concatenating the topic name and the subnet + const subnet = parseInt(subnetStr, 10); + if (Number.isNaN(subnet)) throw Error(`subnet ${subnetStr} is not a number`); + return {type: GossipType.blob_sidecar, subnet, fork, encoding}; } throw Error(`Unknown gossip type ${gossipTypeStr}`); @@ -211,10 +211,10 @@ export function getCoreTopicsAtFork( {type: GossipType.attester_slashing}, ]; - // After Deneb also track blob_sidecar_{index} + // After Deneb also track blob_sidecar_{subnet_id} if (ForkSeq[fork] >= ForkSeq.deneb) { - for (let index = 0; index < config.MAX_BLOBS_PER_BLOCK; index++) { - topics.push({type: GossipType.blob_sidecar, index}); + for (let subnet = 0; subnet < config.BLOB_SIDECAR_SUBNET_COUNT; subnet++) { + topics.push({type: GossipType.blob_sidecar, subnet}); } } diff --git a/packages/beacon-node/src/network/network.ts b/packages/beacon-node/src/network/network.ts index 870fbf303ff4..d8370fc22b5f 100644 --- a/packages/beacon-node/src/network/network.ts +++ b/packages/beacon-node/src/network/network.ts @@ -312,9 +312,9 @@ export class Network implements INetwork { async publishBlobSidecar(blobSidecar: deneb.BlobSidecar): Promise { const slot = blobSidecar.signedBlockHeader.message.slot; const fork = this.config.getForkName(slot); - const index = blobSidecar.index; + const subnet = blobSidecar.index; - return this.publishGossip({type: GossipType.blob_sidecar, fork, index}, blobSidecar, { + return this.publishGossip({type: GossipType.blob_sidecar, fork, subnet}, blobSidecar, { ignoreDuplicatePublishError: true, }); } diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index 029e7ae4db42..3fb7b06e700a 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -179,7 +179,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand async function validateBeaconBlob( blobSidecar: deneb.BlobSidecar, blobBytes: Uint8Array, - gossipIndex: number, + subnet: number, peerIdStr: string, seenTimestampSec: number ): Promise { @@ -202,7 +202,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand ); try { - await validateGossipBlobSidecar(chain, blobSidecar, gossipIndex); + await validateGossipBlobSidecar(chain, blobSidecar, subnet); const recvToValidation = Date.now() / 1000 - seenTimestampSec; const validationTime = recvToValidation - recvToValLatency; @@ -212,10 +212,10 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand logger.debug("Received gossip blob", { slot: slot, root: blockHex, - curentSlot: chain.clock.currentSlot, + currentSlot: chain.clock.currentSlot, peerId: peerIdStr, delaySec, - gossipIndex, + subnet, ...blockInputMeta, recvToValLatency, recvToValidation, @@ -363,7 +363,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand const blockInput = await validateBeaconBlob( blobSidecar, serializedData, - topic.index, + topic.subnet, peerIdStr, seenTimestampSec ); diff --git a/packages/beacon-node/test/e2e/api/impl/config.test.ts b/packages/beacon-node/test/e2e/api/impl/config.test.ts index 474826050a3a..078e210cb0cc 100644 --- a/packages/beacon-node/test/e2e/api/impl/config.test.ts +++ b/packages/beacon-node/test/e2e/api/impl/config.test.ts @@ -10,8 +10,6 @@ const CONSTANT_NAMES_SKIP_LIST = new Set([ // This constant can also be derived from existing constants so it's not critical. // PARTICIPATION_FLAG_WEIGHTS = [TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT] "PARTICIPATION_FLAG_WEIGHTS", - // TODO DENEB: Configure the blob subnets in a followup PR - "BLOB_SIDECAR_SUBNET_COUNT", ]); describe("api / impl / config", () => { diff --git a/packages/beacon-node/test/unit/network/gossip/topic.test.ts b/packages/beacon-node/test/unit/network/gossip/topic.test.ts index f68c2d737fd6..4b323865061e 100644 --- a/packages/beacon-node/test/unit/network/gossip/topic.test.ts +++ b/packages/beacon-node/test/unit/network/gossip/topic.test.ts @@ -17,7 +17,7 @@ describe("network / gossip / topic", () => { ], [GossipType.blob_sidecar]: [ { - topic: {type: GossipType.blob_sidecar, index: 1, fork: ForkName.deneb, encoding}, + topic: {type: GossipType.blob_sidecar, subnet: 1, fork: ForkName.deneb, encoding}, topicStr: "/eth2/46acb19a/blob_sidecar_1/ssz_snappy", }, ], diff --git a/packages/config/src/chainConfig/configs/mainnet.ts b/packages/config/src/chainConfig/configs/mainnet.ts index ae9a2ec74d1f..a4adc04a1756 100644 --- a/packages/config/src/chainConfig/configs/mainnet.ts +++ b/packages/config/src/chainConfig/configs/mainnet.ts @@ -101,6 +101,7 @@ export const chainConfig: ChainConfig = { // Deneb // `2**12` (= 4096 epochs, ~18 days) MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096, + BLOB_SIDECAR_SUBNET_COUNT: 6, MAX_BLOBS_PER_BLOCK: 6, // MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK MAX_REQUEST_BLOB_SIDECARS: 768, diff --git a/packages/config/src/chainConfig/configs/minimal.ts b/packages/config/src/chainConfig/configs/minimal.ts index 6f536bc7732c..d16b03e82c28 100644 --- a/packages/config/src/chainConfig/configs/minimal.ts +++ b/packages/config/src/chainConfig/configs/minimal.ts @@ -98,6 +98,7 @@ export const chainConfig: ChainConfig = { // Deneb // `2**12` (= 4096 epochs, ~18 days) MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096, + BLOB_SIDECAR_SUBNET_COUNT: 6, MAX_BLOBS_PER_BLOCK: 6, // MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK MAX_REQUEST_BLOB_SIDECARS: 768, diff --git a/packages/config/src/chainConfig/types.ts b/packages/config/src/chainConfig/types.ts index 513324bdbcb8..291dcc8601a7 100644 --- a/packages/config/src/chainConfig/types.ts +++ b/packages/config/src/chainConfig/types.ts @@ -72,6 +72,7 @@ export type ChainConfig = { // Networking MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: number; + BLOB_SIDECAR_SUBNET_COUNT: number; MAX_BLOBS_PER_BLOCK: number; MAX_REQUEST_BLOB_SIDECARS: number; }; @@ -138,6 +139,7 @@ export const chainConfigTypes: SpecTypes = { // Networking MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: "number", + BLOB_SIDECAR_SUBNET_COUNT: "number", MAX_BLOBS_PER_BLOCK: "number", MAX_REQUEST_BLOB_SIDECARS: "number", }; diff --git a/packages/validator/src/util/params.ts b/packages/validator/src/util/params.ts index e8fd1a1e6dc4..825f60e8c7fa 100644 --- a/packages/validator/src/util/params.ts +++ b/packages/validator/src/util/params.ts @@ -136,6 +136,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record Date: Sun, 15 Dec 2024 12:34:56 +0100 Subject: [PATCH 38/48] chore: log sync aggregate participants when producing beacon block body (#7300) * chore: log sync aggregate participants when producing beacon block body * Use isForkLightClient instead of ForkSeq * Fix produce block unit tests --- .../chain/produceBlock/produceBlockBody.ts | 23 ++++++++++++++----- .../test/mocks/mockedBeaconChain.ts | 11 ++++++++- .../api/impl/validator/produceBlockV2.test.ts | 6 ++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts index d26703050070..e4c86b78907c 100644 --- a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts +++ b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts @@ -1,11 +1,10 @@ import {ChainForkConfig} from "@lodestar/config"; -import {ForkExecution, ForkSeq, isForkExecution} from "@lodestar/params"; +import {ForkExecution, ForkSeq, isForkExecution, isForkLightClient} from "@lodestar/params"; import { CachedBeaconStateAllForks, CachedBeaconStateBellatrix, CachedBeaconStateCapella, CachedBeaconStateExecutions, - computeEpochAtSlot, computeTimeAtSlot, getCurrentEpoch, getExpectedWithdrawals, @@ -143,8 +142,15 @@ export async function produceBlockBody( ? Object.assign({}, commonBlockBody) : await produceCommonBlockBody.call(this, blockType, currentState, blockAttr); - const {attestations, deposits, voluntaryExits, attesterSlashings, proposerSlashings, blsToExecutionChanges} = - blockBody; + const { + attestations, + deposits, + voluntaryExits, + attesterSlashings, + proposerSlashings, + syncAggregate, + blsToExecutionChanges, + } = blockBody; Object.assign(logMeta, { attestations: attestations.length, @@ -154,6 +160,12 @@ export async function produceBlockBody( proposerSlashings: proposerSlashings.length, }); + if (isForkLightClient(fork)) { + Object.assign(logMeta, { + syncAggregateParticipants: syncAggregate.syncCommitteeBits.getTrueBitIndexes().length, + }); + } + const endExecutionPayload = stepsMetrics?.startTimer(); if (isForkExecution(fork)) { const safeBlockHash = this.forkChoice.getJustifiedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX; @@ -608,7 +620,6 @@ export async function produceCommonBlockBody( ? this.metrics?.executionBlockProductionTimeSteps : this.metrics?.builderBlockProductionTimeSteps; - const blockEpoch = computeEpochAtSlot(slot); const fork = currentState.config.getForkName(slot); // TODO: @@ -653,7 +664,7 @@ export async function produceCommonBlockBody( } const endSyncAggregate = stepsMetrics?.startTimer(); - if (blockEpoch >= this.config.ALTAIR_FORK_EPOCH) { + if (ForkSeq[fork] >= ForkSeq.altair) { const syncAggregate = this.syncContributionAndProofPool.getAggregate(parentSlot, parentBlockRoot); this.metrics?.production.producedSyncAggregateParticipants.observe( syncAggregate.syncCommitteeBits.getTrueBitIndexes().length diff --git a/packages/beacon-node/test/mocks/mockedBeaconChain.ts b/packages/beacon-node/test/mocks/mockedBeaconChain.ts index b274284e3ab1..36d6fb27c53a 100644 --- a/packages/beacon-node/test/mocks/mockedBeaconChain.ts +++ b/packages/beacon-node/test/mocks/mockedBeaconChain.ts @@ -8,7 +8,7 @@ import {BeaconProposerCache} from "../../src/chain/beaconProposerCache.js"; import {BeaconChain} from "../../src/chain/chain.js"; import {ChainEventEmitter} from "../../src/chain/emitter.js"; import {LightClientServer} from "../../src/chain/lightClient/index.js"; -import {AggregatedAttestationPool, OpPool} from "../../src/chain/opPools/index.js"; +import {AggregatedAttestationPool, OpPool, SyncContributionAndProofPool} from "../../src/chain/opPools/index.js"; import {QueuedStateRegenerator} from "../../src/chain/regen/index.js"; import {ShufflingCache} from "../../src/chain/shufflingCache.js"; import {Eth1ForBlockProduction} from "../../src/eth1/index.js"; @@ -27,6 +27,7 @@ export type MockedBeaconChain = Mocked & { eth1: Mocked; opPool: Mocked; aggregatedAttestationPool: Mocked; + syncContributionAndProofPool: Mocked; beaconProposerCache: Mocked; shufflingCache: Mocked; regen: Mocked; @@ -94,10 +95,17 @@ vi.mock("../../src/chain/opPools/index.js", async (importActual) => { }; }); + const SyncContributionAndProofPool = vi.fn().mockImplementation(() => { + return { + getAggregate: vi.fn(), + }; + }); + return { ...mod, OpPool, AggregatedAttestationPool, + SyncContributionAndProofPool, }; }); @@ -124,6 +132,7 @@ vi.mock("../../src/chain/chain.js", async (importActual) => { eth1: new Eth1ForBlockProduction(), opPool: new OpPool(), aggregatedAttestationPool: new AggregatedAttestationPool(config), + syncContributionAndProofPool: new SyncContributionAndProofPool(), // @ts-expect-error beaconProposerCache: new BeaconProposerCache(), shufflingCache: new ShufflingCache(), diff --git a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts index 52f600b7174c..418dd2e56d8d 100644 --- a/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts +++ b/packages/beacon-node/test/unit/api/impl/validator/produceBlockV2.test.ts @@ -1,7 +1,7 @@ import {fromHexString, toHexString} from "@chainsafe/ssz"; import {ProtoBlock} from "@lodestar/fork-choice"; import {ForkName} from "@lodestar/params"; -import {CachedBeaconStateBellatrix, computeTimeAtSlot} from "@lodestar/state-transition"; +import {CachedBeaconStateBellatrix, G2_POINT_AT_INFINITY, computeTimeAtSlot} from "@lodestar/state-transition"; import {ssz} from "@lodestar/types"; import {afterEach, beforeEach, describe, expect, it, vi} from "vitest"; import {getValidatorApi} from "../../../../../src/api/impl/validator/index.js"; @@ -99,6 +99,10 @@ describe("api/validator - produceBlockV2", () => { eth1Data: ssz.phase0.Eth1Data.defaultValue(), deposits: [], }); + modules.chain["syncContributionAndProofPool"].getAggregate.mockReturnValue({ + syncCommitteeBits: ssz.altair.SyncCommitteeBits.defaultValue(), + syncCommitteeSignature: G2_POINT_AT_INFINITY, + }); modules.forkChoice.getJustifiedBlock.mockReturnValue({} as ProtoBlock); modules.forkChoice.getFinalizedBlock.mockReturnValue({} as ProtoBlock); From 3f3c7fcb3476d66550515958a4b80e81b07ea87b Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Mon, 16 Dec 2024 17:25:19 +0000 Subject: [PATCH 39/48] chore: print graffiti when producing beacon block body (#7303) --- packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts index e4c86b78907c..0b7797828c98 100644 --- a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts +++ b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts @@ -143,6 +143,7 @@ export async function produceBlockBody( : await produceCommonBlockBody.call(this, blockType, currentState, blockAttr); const { + graffiti, attestations, deposits, voluntaryExits, @@ -153,6 +154,7 @@ export async function produceBlockBody( } = blockBody; Object.assign(logMeta, { + graffiti, attestations: attestations.length, deposits: deposits.length, voluntaryExits: voluntaryExits.length, From c290469e9069aec2ff1654018d8967b8b82f6106 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 17 Dec 2024 01:24:44 +0000 Subject: [PATCH 40/48] fix: warn if engine / builder failed to produce block within cutoff time (#7305) --- .../src/api/impl/validator/index.ts | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index b15644a8087e..fe26c559661c 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -695,32 +695,46 @@ export function getValidatorApi( throw Error("Builder and engine both failed to produce the block within timeout"); } - if (engine.status === "rejected" && isEngineEnabled) { - logger.warn( - "Engine failed to produce the block", - { - ...loggerContext, - durationMs: engine.durationMs, - }, - engine.reason - ); - } - - if (builder.status === "rejected" && isBuilderEnabled) { - if (builder.reason instanceof NoBidReceived) { - logger.info("Builder did not provide a bid", { - ...loggerContext, - durationMs: builder.durationMs, - }); - } else { + if (isEngineEnabled) { + if (engine.status === "rejected") { logger.warn( - "Builder failed to produce the block", + "Engine failed to produce the block", { ...loggerContext, - durationMs: builder.durationMs, + durationMs: engine.durationMs, }, - builder.reason + engine.reason ); + } else if (engine.status === "pending") { + logger.warn("Engine failed to produce the block within cutoff time", { + ...loggerContext, + cutoffMs, + }); + } + } + + if (isBuilderEnabled) { + if (builder.status === "rejected") { + if (builder.reason instanceof NoBidReceived) { + logger.info("Builder did not provide a bid", { + ...loggerContext, + durationMs: builder.durationMs, + }); + } else { + logger.warn( + "Builder failed to produce the block", + { + ...loggerContext, + durationMs: builder.durationMs, + }, + builder.reason + ); + } + } else if (builder.status === "pending") { + logger.warn("Builder failed to produce the block within cutoff time", { + ...loggerContext, + cutoffMs, + }); } } From 7cd296b0466f75136cbf544aaec5ce000c89a8ed Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:21:22 -0800 Subject: [PATCH 41/48] feat: add kzg commitment length check when validating gossip blocks (#7302) --- .../src/chain/errors/blockError.ts | 5 +- .../beacon-node/src/chain/validation/block.ts | 16 ++++++- .../test/unit/chain/validation/block.test.ts | 47 +++++++++++++++++-- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/packages/beacon-node/src/chain/errors/blockError.ts b/packages/beacon-node/src/chain/errors/blockError.ts index bc5dd6c33956..1dc5b08ccc20 100644 --- a/packages/beacon-node/src/chain/errors/blockError.ts +++ b/packages/beacon-node/src/chain/errors/blockError.ts @@ -64,6 +64,8 @@ export enum BlockErrorCode { TOO_MANY_SKIPPED_SLOTS = "TOO_MANY_SKIPPED_SLOTS", /** The blobs are unavailable */ DATA_UNAVAILABLE = "BLOCK_ERROR_DATA_UNAVAILABLE", + /** Block contains too many kzg commitments */ + TOO_MANY_KZG_COMMITMENTS = "BLOCK_ERROR_TOO_MANY_KZG_COMMITMENTS", } type ExecutionErrorStatus = Exclude< @@ -105,7 +107,8 @@ export type BlockErrorType = | {code: BlockErrorCode.SAME_PARENT_HASH; blockHash: RootHex} | {code: BlockErrorCode.TRANSACTIONS_TOO_BIG; size: number; max: number} | {code: BlockErrorCode.EXECUTION_ENGINE_ERROR; execStatus: ExecutionErrorStatus; errorMessage: string} - | {code: BlockErrorCode.DATA_UNAVAILABLE}; + | {code: BlockErrorCode.DATA_UNAVAILABLE} + | {code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS; blobKzgCommitmentsLen: number; commitmentLimit: number}; export class BlockGossipError extends GossipActionError {} diff --git a/packages/beacon-node/src/chain/validation/block.ts b/packages/beacon-node/src/chain/validation/block.ts index 1b5251f77809..b2623aa4f79d 100644 --- a/packages/beacon-node/src/chain/validation/block.ts +++ b/packages/beacon-node/src/chain/validation/block.ts @@ -1,5 +1,5 @@ import {ChainForkConfig} from "@lodestar/config"; -import {ForkName} from "@lodestar/params"; +import {ForkName, isForkBlobs} from "@lodestar/params"; import { computeStartSlotAtEpoch, computeTimeAtSlot, @@ -8,7 +8,7 @@ import { isExecutionEnabled, isExecutionStateType, } from "@lodestar/state-transition"; -import {SignedBeaconBlock} from "@lodestar/types"; +import {SignedBeaconBlock, deneb} from "@lodestar/types"; import {sleep, toRootHex} from "@lodestar/utils"; import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../../constants/index.js"; import {BlockErrorCode, BlockGossipError, GossipAction} from "../errors/index.js"; @@ -110,6 +110,18 @@ export async function validateGossipBlock( }); } + // [REJECT] The length of KZG commitments is less than or equal to the limitation defined in Consensus Layer -- i.e. validate that len(body.signed_beacon_block.message.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK + if (isForkBlobs(fork)) { + const blobKzgCommitmentsLen = (block as deneb.BeaconBlock).body.blobKzgCommitments.length; + if (blobKzgCommitmentsLen > chain.config.MAX_BLOBS_PER_BLOCK) { + throw new BlockGossipError(GossipAction.REJECT, { + code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS, + blobKzgCommitmentsLen, + commitmentLimit: chain.config.MAX_BLOBS_PER_BLOCK, + }); + } + } + // use getPreState to reload state if needed. It also checks for whether the current finalized checkpoint is an ancestor of the block. // As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario). // this is something we should change this in the future to make the code airtight to the spec. diff --git a/packages/beacon-node/test/unit/chain/validation/block.test.ts b/packages/beacon-node/test/unit/chain/validation/block.test.ts index 4b236181b038..5e3faf794453 100644 --- a/packages/beacon-node/test/unit/chain/validation/block.test.ts +++ b/packages/beacon-node/test/unit/chain/validation/block.test.ts @@ -1,6 +1,6 @@ import {config} from "@lodestar/config/default"; import {ProtoBlock} from "@lodestar/fork-choice"; -import {ForkName} from "@lodestar/params"; +import {ForkBlobs, ForkName} from "@lodestar/params"; import {SignedBeaconBlock, ssz} from "@lodestar/types"; import {Mock, Mocked, beforeEach, describe, it, vi} from "vitest"; import {BlockErrorCode} from "../../../../src/chain/errors/index.js"; @@ -20,12 +20,15 @@ describe("gossip block validation", () => { let job: SignedBeaconBlock; const proposerIndex = 0; const clockSlot = 32; - const block = ssz.phase0.BeaconBlock.defaultValue(); + const block = ssz.deneb.BeaconBlock.defaultValue(); block.slot = clockSlot; const signature = EMPTY_SIGNATURE; const maxSkipSlots = 10; beforeEach(() => { + // Fill up with kzg commitments + block.body.blobKzgCommitments = Array.from({length: config.MAX_BLOBS_PER_BLOCK}, () => new Uint8Array([0])); + chain = getMockedBeaconChain(); vi.spyOn(chain.clock, "currentSlotWithGossipDisparity", "get").mockReturnValue(clockSlot); forkChoice = chain.forkChoice; @@ -184,9 +187,47 @@ describe("gossip block validation", () => { regen.getPreState.mockResolvedValue(state); // BLS signature verifier returns valid verifySignature.mockResolvedValue(true); - // Force proposer shuffling cache to return wrong value + // Force proposer shuffling cache to return correct value vi.spyOn(state.epochCtx, "getBeaconProposer").mockReturnValue(proposerIndex); await validateGossipBlock(config, chain, job, ForkName.phase0); }); + + it("deneb - TOO_MANY_KZG_COMMITMENTS", async () => { + // Return not known for proposed block + forkChoice.getBlockHex.mockReturnValueOnce(null); + // Returned parent block is latter than proposed block + forkChoice.getBlockHex.mockReturnValueOnce({slot: clockSlot - 1} as ProtoBlock); + // Regen returns some state + const state = generateCachedState(); + regen.getPreState.mockResolvedValue(state); + // BLS signature verifier returns valid + verifySignature.mockResolvedValue(true); + // Force proposer shuffling cache to return correct value + vi.spyOn(state.epochCtx, "getBeaconProposer").mockReturnValue(proposerIndex + 1); + // Add one extra kzg commitment in the block so it goes over the limit + (job as SignedBeaconBlock).message.body.blobKzgCommitments.push(new Uint8Array([0])); + + await expectRejectedWithLodestarError( + validateGossipBlock(config, chain, job, ForkName.deneb), + BlockErrorCode.TOO_MANY_KZG_COMMITMENTS + ); + }); + + it("deneb - valid", async () => { + // Return not known for proposed block + forkChoice.getBlockHex.mockReturnValueOnce(null); + // Returned parent block is latter than proposed block + forkChoice.getBlockHex.mockReturnValueOnce({slot: clockSlot - 1} as ProtoBlock); + // Regen returns some state + const state = generateCachedState(); + regen.getPreState.mockResolvedValue(state); + // BLS signature verifier returns valid + verifySignature.mockResolvedValue(true); + // Force proposer shuffling cache to return correct value + vi.spyOn(state.epochCtx, "getBeaconProposer").mockReturnValue(proposerIndex); + // Keep number of kzg commitments as is so it stays within the limit + + await validateGossipBlock(config, chain, job, ForkName.deneb); + }); }); From bfe54d25def3e72705c6fa027549878d7e69f996 Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:45:51 -0800 Subject: [PATCH 42/48] feat: add blob sidecar index check (#7313) Validate blobSidecar index --- .../beacon-node/src/chain/errors/blobSidecarError.ts | 2 ++ packages/beacon-node/src/chain/validation/blobSidecar.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/beacon-node/src/chain/errors/blobSidecarError.ts b/packages/beacon-node/src/chain/errors/blobSidecarError.ts index 71118d8b8f9d..216ad9206db4 100644 --- a/packages/beacon-node/src/chain/errors/blobSidecarError.ts +++ b/packages/beacon-node/src/chain/errors/blobSidecarError.ts @@ -2,6 +2,7 @@ import {RootHex, Slot, ValidatorIndex} from "@lodestar/types"; import {GossipActionError} from "./gossipValidation.js"; export enum BlobSidecarErrorCode { + INDEX_TOO_LARGE = "BLOB_SIDECAR_ERROR_INDEX_TOO_LARGE", INVALID_INDEX = "BLOB_SIDECAR_ERROR_INVALID_INDEX", /** !bls.KeyValidate(block.body.blob_kzg_commitments[i]) */ INVALID_KZG = "BLOB_SIDECAR_ERROR_INVALID_KZG", @@ -26,6 +27,7 @@ export enum BlobSidecarErrorCode { } export type BlobSidecarErrorType = + | {code: BlobSidecarErrorCode.INDEX_TOO_LARGE; blobIdx: number; maxBlobsPerBlock: number} | {code: BlobSidecarErrorCode.INVALID_INDEX; blobIdx: number; subnet: number} | {code: BlobSidecarErrorCode.INVALID_KZG; blobIdx: number} | {code: BlobSidecarErrorCode.INVALID_KZG_TXS} diff --git a/packages/beacon-node/src/chain/validation/blobSidecar.ts b/packages/beacon-node/src/chain/validation/blobSidecar.ts index e2f4ed267d01..4aeff0f23ff1 100644 --- a/packages/beacon-node/src/chain/validation/blobSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobSidecar.ts @@ -18,6 +18,15 @@ export async function validateGossipBlobSidecar( ): Promise { const blobSlot = blobSidecar.signedBlockHeader.message.slot; + // [REJECT] The sidecar's index is consistent with `MAX_BLOBS_PER_BLOCK` -- i.e. `blob_sidecar.index < MAX_BLOBS_PER_BLOCK`. + if (blobSidecar.index < chain.config.MAX_BLOBS_PER_BLOCK) { + throw new BlobSidecarGossipError(GossipAction.REJECT, { + code: BlobSidecarErrorCode.INDEX_TOO_LARGE, + blobIdx: blobSidecar.index, + maxBlobsPerBlock: chain.config.MAX_BLOBS_PER_BLOCK, + }); + } + // [REJECT] The sidecar is for the correct subnet -- i.e. `compute_subnet_for_blob_sidecar(sidecar.index) == subnet_id`. if (computeSubnetForBlobSidecar(blobSidecar.index, chain.config) !== subnet) { throw new BlobSidecarGossipError(GossipAction.REJECT, { From 1f38c8b1751c810e267ceab4d56d06735ac3445c Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:31:22 -0800 Subject: [PATCH 43/48] fix: fix blob sidecar index check (#7315) Fix index check --- packages/beacon-node/src/chain/validation/blobSidecar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/beacon-node/src/chain/validation/blobSidecar.ts b/packages/beacon-node/src/chain/validation/blobSidecar.ts index 4aeff0f23ff1..b79db77e3931 100644 --- a/packages/beacon-node/src/chain/validation/blobSidecar.ts +++ b/packages/beacon-node/src/chain/validation/blobSidecar.ts @@ -19,7 +19,7 @@ export async function validateGossipBlobSidecar( const blobSlot = blobSidecar.signedBlockHeader.message.slot; // [REJECT] The sidecar's index is consistent with `MAX_BLOBS_PER_BLOCK` -- i.e. `blob_sidecar.index < MAX_BLOBS_PER_BLOCK`. - if (blobSidecar.index < chain.config.MAX_BLOBS_PER_BLOCK) { + if (blobSidecar.index >= chain.config.MAX_BLOBS_PER_BLOCK) { throw new BlobSidecarGossipError(GossipAction.REJECT, { code: BlobSidecarErrorCode.INDEX_TOO_LARGE, blobIdx: blobSidecar.index, From 8c7eaf8c57b56aa9294dcb8607f334b5500de237 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 19 Dec 2024 09:35:23 +0000 Subject: [PATCH 44/48] chore: fix format of printed graffiti from hex to utf-8 (#7306) * chore: fix format of printed graffiti from hex to utf-8 * Use Buffer.from no copy with offset --- .../beacon-node/src/chain/produceBlock/produceBlockBody.ts | 3 ++- packages/beacon-node/src/util/graffiti.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts index 0b7797828c98..d7b36e06abc4 100644 --- a/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts +++ b/packages/beacon-node/src/chain/produceBlock/produceBlockBody.ts @@ -37,6 +37,7 @@ import {ZERO_HASH, ZERO_HASH_HEX} from "../../constants/index.js"; import {IEth1ForBlockProduction} from "../../eth1/index.js"; import {numToQuantity} from "../../eth1/provider/utils.js"; import {IExecutionBuilder, IExecutionEngine, PayloadAttributes, PayloadId} from "../../execution/index.js"; +import {fromGraffitiBuffer} from "../../util/graffiti.js"; import type {BeaconChain} from "../chain.js"; import {CommonBlockBody} from "../interface.js"; import {validateBlobsAndKzgCommitments} from "./validateBlobsAndKzgCommitments.js"; @@ -154,7 +155,7 @@ export async function produceBlockBody( } = blockBody; Object.assign(logMeta, { - graffiti, + graffiti: fromGraffitiBuffer(graffiti), attestations: attestations.length, deposits: deposits.length, voluntaryExits: voluntaryExits.length, diff --git a/packages/beacon-node/src/util/graffiti.ts b/packages/beacon-node/src/util/graffiti.ts index 9a4bc3d9689b..fb5c30aca3d3 100644 --- a/packages/beacon-node/src/util/graffiti.ts +++ b/packages/beacon-node/src/util/graffiti.ts @@ -8,6 +8,13 @@ export function toGraffitiBuffer(graffiti: string): Buffer { return Buffer.concat([Buffer.from(graffiti, "utf8"), Buffer.alloc(GRAFFITI_SIZE, 0)], GRAFFITI_SIZE); } +/** + * Converts a graffiti from 32 bytes buffer back to a UTF-8 string + */ +export function fromGraffitiBuffer(graffiti: Uint8Array): string { + return Buffer.from(graffiti.buffer, graffiti.byteOffset, graffiti.byteLength).toString("utf8"); +} + export function getDefaultGraffiti( consensusClientVersion: ClientVersion, executionClientVersion: ClientVersion | null | undefined, From ffdfb2e51704456ffb49214b5aba9bd7a2360051 Mon Sep 17 00:00:00 2001 From: Phil Ngo <58080811+philknows@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:44:42 -0500 Subject: [PATCH 45/48] docs: batch commit typos and update contributor readme (#7312) * batch commit typos and update contributor readme * update donation text Co-authored-by: Nico Flaig * correct spelling Co-authored-by: Nico Flaig --------- Co-authored-by: Nico Flaig --- .wordlist.txt | 1 - CONTRIBUTING.md | 2 ++ README.md | 4 ++-- RELEASE.md | 2 +- docs/pages/contribution/testing/index.md | 4 ++-- docs/pages/contribution/tools/heap-dumps.md | 4 ++-- docs/pages/faqs.md | 2 +- docs/pages/introduction.md | 2 +- docs/pages/run/logging-and-metrics/client-monitoring.md | 2 +- packages/light-client/README.md | 6 +++--- packages/params/README.md | 2 +- packages/prover/README.md | 2 +- packages/utils/src/yaml/int.ts | 2 +- scripts/await-release.sh | 2 +- 14 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.wordlist.txt b/.wordlist.txt index 5070aafcf9a5..d74291a2fb0c 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -198,7 +198,6 @@ namespaces nodemodule orchestrator osx -overriden params performant pid diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24d087810980..ca5a28442fd8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,6 +126,8 @@ Unsure where to begin contributing to Lodestar? Here are some ideas! 5. Make an open pull request when you're ready for it to be reviewed. We review PRs on a regular basis. See Pull request etiquette for more information. 6. You may be asked to sign a Contributor License Agreement (CLA). We make it relatively painless with CLA-bot. +Please note that trivial, non-code contributions such as spelling, grammar, typos, corrections, comments and link fixes are not acceptable pull requests. Although we appreciate the effort to fix these valid concerns, it is not practical for us to run our CI systems to accommodate minor external contributions which generate minimal value for the purpose of contribution/airdrop farming. It would be appreciated for you to open up an issue instead for our team to aggregate these types of contributions into a batch commit. + ## Github Style Guide **Branch Naming** diff --git a/README.md b/README.md index e03de683a9de..53c53cee8621 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,9 @@ Read our [contributors document](/CONTRIBUTING.md), [submit an issue](https://gi ## Meetings -Weekly contributor meetings are public and announced on Discord. Feel free to check out our meeting notes and documents on [HackMD](https://hackmd.io/@wemeetagain/rJTEOdqPS/%2FXBzvaQgMTyyMJuToWAEDjw). Post-September 2021, meeting notes can be found on the [Lodestar Wiki Page](https://github.com/ChainSafe/lodestar/wiki). +Weekly contributor meetings are posted under [Discussions](https://github.com/ChainSafe/lodestar/discussions) and topics are welcomed by any participant in the relevant meeting thread. Feel free to check out our meeting notes and documents on [HackMD](https://hackmd.io/@wemeetagain/rJTEOdqPS/%2FXBzvaQgMTyyMJuToWAEDjw). Post-September 2021, meeting notes can be found on the [Lodestar Wiki Page](https://github.com/ChainSafe/lodestar/wiki). ## Donations We are a local group of Toronto open-source developers. As such, all of our open-source work is funded by grants. We all take the time out of our hectic lives to contribute to the Ethereum ecosystem. -If you want to donate, you can send us ETH at the following address: `lodestar.chainsafe.eth` +If you want to donate, you can find the ETH address under "Sponsor this project" on this repository. diff --git a/RELEASE.md b/RELEASE.md index bb40b611ebe5..6d831ddb3bd4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -69,7 +69,7 @@ Tagging a release candidate will trigger CI to publish to NPM, dockerhub, and Gi Once a release candidate is created, the Lodestar team begins a testing period. -If there is a bug discovered during the testing period which significantly impacts performance, security, or stability, and it is determined that it is no longer prudent to promote the `rc.x` candidate to `stable`, then it will await a bug fix by the team. The fix will be committed to `unstable` first, then cherrypicked into the `rc/v1.1.0` branch. Then we publish and promote the new commit to `rc.x+1`. The 3 day testing period will reset. +If there is a bug discovered during the testing period which significantly impacts performance, security, or stability, and it is determined that it is no longer prudent to promote the `rc.x` candidate to `stable`, then it will await a bug fix by the team. The fix will be committed to `unstable` first, then cherrypicked into the `rc/v1.1.0` branch. Then we publish and promote the new commit to `rc.x+1`. The 3-day testing period will reset. For example: After 3-5 days of testing, is performance equal to or better than latest stable? diff --git a/docs/pages/contribution/testing/index.md b/docs/pages/contribution/testing/index.md index ecef1ef22c56..a9795670fa82 100644 --- a/docs/pages/contribution/testing/index.md +++ b/docs/pages/contribution/testing/index.md @@ -2,7 +2,7 @@ Testing is critical to the Lodestar project and there are many types of tests that are run to build a product that is both effective AND efficient. This page will help to break down the different types of tests you will find in the Lodestar repo. -There are few flags you can set through env variables to override behavior of testing and it's output. +There are a few flags you can set through env variables to override behavior of testing and its output. | ENV variable | Effect | Impact | | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | @@ -24,7 +24,7 @@ Node.js is an unforgiving virtual machine when it comes to high performance, mul ### End-To-End Tests -E2E test are where Lodestar is run in its full form, often from the CLI as a user would to check that the system as a whole works as expected. These tests are meant to exercise the entire system in isolation and there is no network interaction, nor interaction with any other code outside of Lodestar. See the [End-To-End Testing](./end-to-end-tests.md) page for more information. +E2E tests are where Lodestar is run in its full form, often from the CLI as a user would to check that the system as a whole works as expected. These tests are meant to exercise the entire system in isolation and there is no network interaction, nor interaction with any other code outside of Lodestar. See the [End-To-End Testing](./end-to-end-tests.md) page for more information. ### Integration Tests diff --git a/docs/pages/contribution/tools/heap-dumps.md b/docs/pages/contribution/tools/heap-dumps.md index 97f2be51dfac..612dfebc3f83 100644 --- a/docs/pages/contribution/tools/heap-dumps.md +++ b/docs/pages/contribution/tools/heap-dumps.md @@ -40,7 +40,7 @@ Click on the `Open dedicated DevTools for Node` link to open the node specific w ![Memory Tab](/images/heap-dumps/memory-tab.png) -Load the profile by either right clicking on the left pane or by clicking the `Load` button at the bottom. +Load the profile by either right-clicking on the left pane or by clicking the `Load` button at the bottom. ![Load Profile](/images/heap-dumps/load-profile.png) @@ -70,7 +70,7 @@ Having a good understanding of the codebase will help to narrow down where to lo _**note: collecting a native heap dump is only supported on linux, analysis can be done from linux or Mac**_ -There are several tools that can be used to do native heap dump analysis. The most common are [`massif`](https://valgrind.org/docs/manual/ms-manual.html) from the [`Valgrind`](https://valgrind.org/) suite, google's [`gperftools`](https://github.com/gperftools/gperftools) and `heaptrack` from [KDE](https://community.kde.org/Main_Page). Of the three, `heaptrack` is the most user friendly tool, and it is specifically designed for the task. It is much faster than `Valgrind`, easier to integrate than `gperftools` and also includes a gui for result analysis. Often times there are also memory allocations that are not related to memory leaks, and tools like `Valgrind` and `gperftools` become less useful. This is why `heaptrack` is the recommended tool for heap dump analysis on Lodestar. +There are several tools that can be used to do native heap dump analysis. The most common are [`massif`](https://valgrind.org/docs/manual/ms-manual.html) from the [`Valgrind`](https://valgrind.org/) suite, google's [`gperftools`](https://github.com/gperftools/gperftools) and `heaptrack` from [KDE](https://community.kde.org/Main_Page). Of the three, `heaptrack` is the most user-friendly tool, and it is specifically designed for the task. It is much faster than `Valgrind`, easier to integrate than `gperftools` and also includes a gui for result analysis. Often times there are also memory allocations that are not related to memory leaks, and tools like `Valgrind` and `gperftools` become less useful. This is why `heaptrack` is the recommended tool for heap dump analysis on Lodestar. There are a few things that will make the results with `heaptrack` far better. The most important is using debug builds of all libraries included in a binary, including the application itself. This will make the results usable. Not to say that they will be useless without debug symbols but it will be kinda tough to optimize functions without knowing the function names nor the file and line numbers. diff --git a/docs/pages/faqs.md b/docs/pages/faqs.md index e7ac490bf9b9..ebe2a2158a2d 100644 --- a/docs/pages/faqs.md +++ b/docs/pages/faqs.md @@ -1,6 +1,6 @@ # Frequently Asked Questions -This section of the documentation will cover common questions and encounters often asked by users and developers. +This section of the documentation will cover common questions and common encounters by users and developers. ## Tooling diff --git a/docs/pages/introduction.md b/docs/pages/introduction.md index f74d0b70768d..5633131dd600 100644 --- a/docs/pages/introduction.md +++ b/docs/pages/introduction.md @@ -1,6 +1,6 @@ # Introduction -Ethereum is one of the most profoundly important inventions in recent history. It is a decentralized, open-source blockchain featuring smart contract functionality. It is the second-largest cryptocurrency by market capitalization, after Bitcoin, and is the second largest blockchain by market capitalization. Ethereum was proposed in 2013 by programmer Vitalik Buterin. Development was crowdfunded in 2014, and the network went live on 30 July 2015, with 72 million coins premined. ChainSafe was founded not too long afterwards in 2017 and has been actively working in the Ethereum ecosystem ever since. We are proud to develop Lodestar, the only TypeScript based consensus client, and to present this documentation as a resource for the Ethereum community. +Ethereum is one of the most profoundly important inventions in recent history. It is a decentralized, open-source blockchain featuring smart contract functionality. It is the second-largest cryptocurrency by market capitalization, after Bitcoin, and is the second-largest blockchain by market capitalization. Ethereum was proposed in 2013 by programmer Vitalik Buterin. Development was crowdfunded in 2014, and the network went live on 30 July 2015, with 72 million coins premined. ChainSafe was founded not too long afterwards in 2017 and has been actively working in the Ethereum ecosystem ever since. We are proud to develop Lodestar, the only TypeScript based consensus client, and to present this documentation as a resource for the Ethereum community. ## Proof of Stake diff --git a/docs/pages/run/logging-and-metrics/client-monitoring.md b/docs/pages/run/logging-and-metrics/client-monitoring.md index 3d9ede1d8464..31a20600ecf3 100644 --- a/docs/pages/run/logging-and-metrics/client-monitoring.md +++ b/docs/pages/run/logging-and-metrics/client-monitoring.md @@ -27,7 +27,7 @@ When sending data to a remote service you should be conscious about security: - Only use a service that you trust as this will send information which may identify you and associate your validators, IP address and other personal information. -- Always use a HTTPS connection (i.e. a URL starting with `https://`) to prevent the traffic +- Always use an HTTPS connection (i.e. a URL starting with `https://`) to prevent the traffic from being intercepted in transit and leaking information. ::: diff --git a/packages/light-client/README.md b/packages/light-client/README.md index 3cab0c12f13b..f9af65f23f98 100644 --- a/packages/light-client/README.md +++ b/packages/light-client/README.md @@ -18,7 +18,7 @@ The evolution of light clients is emblematic of the broader trajectory of Ethere ## Requirements for Running a Light-Client -Access to an beacon node that supports the light client specification is necessary. The client must support the following routes from the [consensus API spec](https://github.com/ethereum/beacon-APIs/tree/v2.5.0/apis/beacon/light_client): +Access to a beacon node that supports the light client specification is necessary. The client must support the following routes from the [consensus API spec](https://github.com/ethereum/beacon-APIs/tree/v2.5.0/apis/beacon/light_client): - [`GET /eth/v1/beacon/light_client/updates`](https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.5.0#/Beacon/getLightClientUpdatesByRange) - [`GET /eth/v1/beacon/light_client/optimistic_update`](https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.5.0#/Beacon/getLightClientOptimisticUpdate) @@ -32,7 +32,7 @@ You can find more information about the light-client protocol in the [specificat ## Getting started - Follow the [installation guide](https://chainsafe.github.io/lodestar/run/getting-started/installation) to install Lodestar. -- Quickly try out the whole stack by [starting a local testnet](https://chainsafe.github.io/lodestar/advanced-topics/setting-up-a-testnet). +- Quickly try out the whole stack by [starting a local testnet](https://chainsafe.github.io/lodestar/contribution/advanced-topics/setting-up-a-testnet). ## Light-Client CLI Example @@ -92,7 +92,7 @@ lightclient.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (opti ## Browser Integration -If you want to use Lightclient in browser and facing some issues in building it with bundlers like webpack, vite. We suggest to use our distribution build. The support for single distribution build is started from `1.20.0` version. +If you want to use Lightclient in browser and are facing some issues in building it with bundlers like webpack, vite. We suggest using our distribution build. The support for single distribution build is started from `1.20.0` version. Directly link the dist build with the `