diff --git a/packages/beacon-node/src/chain/chain.ts b/packages/beacon-node/src/chain/chain.ts index 88926ce039c8..69fc6cacfdc7 100644 --- a/packages/beacon-node/src/chain/chain.ts +++ b/packages/beacon-node/src/chain/chain.ts @@ -34,7 +34,6 @@ import {ProcessShutdownCallback} from "@lodestar/validator"; import {Logger, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toHex} from "@lodestar/utils"; import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params"; -import {toHexString} from "@lodestar/utils"; import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js"; import {IBeaconDb} from "../db/index.js"; import {Metrics} from "../metrics/index.js"; diff --git a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts index aea4fd3b19e5..16efb8354985 100644 --- a/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts +++ b/packages/beacon-node/src/network/reqresp/handlers/beaconBlocksByRange.ts @@ -22,8 +22,8 @@ export async function* onBeaconBlocksByRange( // Finalized range of blocks if (startSlot <= finalizedSlot) { // Chain of blobs won't change - for await (const {key, value} of db.finalized.binaryEntriesStream({gte: startSlot, lt: endSlot})) { - const {name, seq} = chain.config.getForkInfo(db.finalized.decodeKey(key)); + for await (const {key, value} of finalized.binaryEntriesStream({gte: startSlot, lt: endSlot})) { + const {name, seq} = chain.config.getForkInfo(finalized.decodeKey(key)); yield { data: await chain.blindedOrFullBlockToFullBytes(seq, value), diff --git a/packages/beacon-node/test/mocks/block.ts b/packages/beacon-node/test/mocks/block.ts index d4c56f1adc55..2afba7ca0515 100644 --- a/packages/beacon-node/test/mocks/block.ts +++ b/packages/beacon-node/test/mocks/block.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import {ssz, allForks} from "@lodestar/types"; import {ForkInfo, createChainForkConfig, defaultChainConfig} from "@lodestar/config"; -import {mainnetChainConfig} from "@lodestar/config/presets"; +import {mainnetChainConfig} from "@lodestar/config/configs"; const directory = "./__fixtures__/"; diff --git a/packages/beacon-node/test/unit/util/fullOrBlindedBlock.test.ts b/packages/beacon-node/test/unit/util/fullOrBlindedBlock.test.ts index 778217583405..d8154da5a3cf 100644 --- a/packages/beacon-node/test/unit/util/fullOrBlindedBlock.test.ts +++ b/packages/beacon-node/test/unit/util/fullOrBlindedBlock.test.ts @@ -1,4 +1,4 @@ -import {expect} from "chai"; +import {describe, it, expect} from "vitest"; import {ForkInfo} from "@lodestar/config"; import {allForks, capella} from "@lodestar/types"; import {isForkExecution} from "@lodestar/params"; @@ -9,7 +9,7 @@ import { isBlindedBytes, serializeFullOrBlindedSignedBeaconBlock, } from "../../../src/util/fullOrBlindedBlock.js"; -import {chainConfig, mockBlocks} from "../../utils/mocks/block.js"; +import {chainConfig, mockBlocks} from "../../mocks/block.js"; import {byteArrayEquals} from "../../../src/util/bytes.js"; type FullOrBlind = "full" | "blinded"; @@ -28,7 +28,7 @@ const fullOrBlindedBlocks = Object.values(mockBlocks) describe("isBlindedBytes", () => { for (const [fullOrBlinded, {seq, name}, , block] of fullOrBlindedBlocks) { it(`should return ${fullOrBlinded === "blinded"} for ${fullOrBlinded} ${name} blocks`, () => { - expect(isBlindedBytes(seq, block)).to.equal(isForkExecution(name) && fullOrBlinded === "blinded"); + expect(isBlindedBytes(seq, block)).toEqual(isForkExecution(name) && fullOrBlinded === "blinded"); }); } }); @@ -37,7 +37,7 @@ describe("serializeFullOrBlindedSignedBeaconBlock", () => { for (const [fullOrBlinded, {name}, block, expected] of fullOrBlindedBlocks) { it(`should serialize ${fullOrBlinded} ${name} block`, () => { const serialized = serializeFullOrBlindedSignedBeaconBlock(chainConfig, block); - expect(byteArrayEquals(serialized, expected)).to.be.true; + expect(byteArrayEquals(serialized, expected)).toBeTruthy(); }); } }); @@ -50,7 +50,7 @@ describe("deserializeFullOrBlindedSignedBeaconBlock", () => { isForkExecution(name) && fullOrBlinded === "blinded" ? chainConfig.getBlindedForkTypes(block.message.slot).SignedBeaconBlock : chainConfig.getForkTypes(block.message.slot).SignedBeaconBlock; - expect(type.equals(deserialized as any, block as any)).to.be.true; + expect(type.equals(deserialized as any, block as any)).toBeTruthy(); }); } }); @@ -69,7 +69,7 @@ describe("blindedOrFullBlockToBlinded", function () { chainConfig.getBlindedForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded!) : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, isExecution ? blinded! : full); - expect(isEqual).to.be.true; + expect(isEqual).toBeTruthy(); }); if (!blinded) continue; it(`should convert blinded ${name} to blinded block`, () => { @@ -77,7 +77,7 @@ describe("blindedOrFullBlockToBlinded", function () { const isEqual = isForkExecution(name) ? chainConfig.getBlindedForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded) : chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded); - expect(isEqual).to.be.true; + expect(isEqual).toBeTruthy(); }); } }); @@ -94,12 +94,12 @@ describe("blindedOrFullBlockToFull", function () { }; it(`should convert full ${name} to full block`, () => { const result = blindedOrFullBlockToFull(chainConfig, seq, full, transactionsAndWithdrawals); - expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).to.be.true; + expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).toBeTruthy(); }); if (!blinded) continue; it(`should convert blinded ${name} to full block`, () => { const result = blindedOrFullBlockToFull(chainConfig, seq, blinded, transactionsAndWithdrawals); - expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).to.be.true; + expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).toBeTruthy(); }); } }); diff --git a/packages/cli/test/sim/deneb.test.ts b/packages/cli/test/sim/deneb.test.ts index 3e844325e1d4..b9c30a5ff523 100644 --- a/packages/cli/test/sim/deneb.test.ts +++ b/packages/cli/test/sim/deneb.test.ts @@ -7,13 +7,6 @@ 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 genesisDelaySeconds = 20 * SIM_TESTS_SECONDS_PER_SLOT; -const altairForkEpoch = 1; -const bellatrixForkEpoch = 2; -const capellaForkEpoch = 3; -const denebForkEpoch = 4; -// Make sure bellatrix started before TTD reach -const additionalSlotsForTTD = activePreset.SLOTS_PER_EPOCH - 2; const runTillEpoch = 6; const syncWaitEpoch = 2; @@ -31,17 +24,8 @@ const env = await Simulation.initWithDefaults( { id: "deneb", logsDir: path.join(logFilesDir, "deneb"), - // TODO: (@matthewkeil) this may be a merge conflict forkConfig, trustedSetup: true, - chainConfig: { - ALTAIR_FORK_EPOCH: altairForkEpoch, - BELLATRIX_FORK_EPOCH: bellatrixForkEpoch, - CAPELLA_FORK_EPOCH: capellaForkEpoch, - DENEB_FORK_EPOCH: denebForkEpoch, - GENESIS_DELAY: genesisDelaySeconds, - TERMINAL_TOTAL_DIFFICULTY: ttd, - }, }, [ { diff --git a/packages/light-client/test/unit/webEsmBundle.browser.test.ts b/packages/light-client/test/unit/webEsmBundle.browser.test.ts index 64f944888184..a0a6f7ee2be9 100644 --- a/packages/light-client/test/unit/webEsmBundle.browser.test.ts +++ b/packages/light-client/test/unit/webEsmBundle.browser.test.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access */ import {expect, describe, it, vi} from "vitest"; import {Lightclient, LightclientEvent, utils, transport} from "../../dist/lightclient.min.mjs";