From 422f2bc92ade745e784ad67d68a08ec8c9cfb2b0 Mon Sep 17 00:00:00 2001 From: harkamal Date: Wed, 10 Apr 2024 16:58:26 +0530 Subject: [PATCH] lint and tsc fix --- packages/beacon-node/test/sim/electra-interop.test.ts | 9 +++++---- .../test/unit/chain/rewards/blockRewards.test.ts | 11 +++++++---- .../test/unit/executionEngine/http.test.ts | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/beacon-node/test/sim/electra-interop.test.ts b/packages/beacon-node/test/sim/electra-interop.test.ts index c1663211cbd9..8c72c1cbc2d7 100644 --- a/packages/beacon-node/test/sim/electra-interop.test.ts +++ b/packages/beacon-node/test/sim/electra-interop.test.ts @@ -1,7 +1,5 @@ import fs from "node:fs"; -import {describe, it, vi, afterAll, afterEach} from "vitest"; -/* eslint-disable @typescript-eslint/naming-convention */ -import _ from "lodash"; +import {describe, it, vi, afterAll, afterEach, assert} from "vitest"; import {LogLevel, sleep} from "@lodestar/utils"; import {ForkName, SLOTS_PER_EPOCH, UNSET_DEPOSIT_RECEIPTS_START_INDEX} from "@lodestar/params"; import {electra, Epoch, Slot} from "@lodestar/types"; @@ -173,6 +171,7 @@ describe("executionEngine / ExecutionEngineHttp", function () { blockHash: dataToBytes(newPayloadBlockHash, 32), receiptsRoot: dataToBytes("0x79ee3424eb720a3ad4b1c5a372bb8160580cbe4d893778660f34213c685627a9", 32), blobGasUsed: 0n, + exits: [], }; const parentBeaconBlockRoot = dataToBytes("0x0000000000000000000000000000000000000000000000000000000000000000", 32); const payloadResult = await executionEngine.notifyNewPayload( @@ -225,7 +224,9 @@ describe("executionEngine / ExecutionEngineHttp", function () { } const actualDepositReceipt = payload.depositReceipts[0]; - if (!_.isEqual(actualDepositReceipt, depositReceiptB)) { + try { + assert.deepEqual(actualDepositReceipt, depositReceiptB); + } catch (error) { throw Error( `Deposit receipts mismatched. Expected: ${JSON.stringify(depositReceiptB)}, actual: ${JSON.stringify( actualDepositReceipt 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 f0d85ce3220f..143fed984079 100644 --- a/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts +++ b/packages/beacon-node/test/unit/chain/rewards/blockRewards.test.ts @@ -89,7 +89,10 @@ describe("chain / rewards / blockRewards", () => { // Populate tree root caches of the state state.hashTreeRoot(); cachedStateAltairPopulateCaches(state); - const calculatedBlockReward = await computeBlockRewards(block.message, state as CachedBeaconStateAllForks); + const calculatedBlockReward = await computeBlockRewards( + block.message, + state as unknown as CachedBeaconStateAllForks + ); const {proposerIndex, total, attestations, syncAggregate, proposerSlashings, attesterSlashings} = calculatedBlockReward; @@ -109,7 +112,7 @@ describe("chain / rewards / blockRewards", () => { expect(attesterSlashings).toBe(0); } - const postState = stateTransition(state as CachedBeaconStateAllForks, block, { + const postState = stateTransition(state as unknown as CachedBeaconStateAllForks, block, { executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, verifyProposer: false, @@ -137,7 +140,7 @@ describe("chain / rewards / blockRewards", () => { preState.hashTreeRoot(); cachedStateAltairPopulateCaches(preState); - const postState = stateTransition(preState as CachedBeaconStateAllForks, block, { + const postState = stateTransition(preState as unknown as CachedBeaconStateAllForks, block, { executionPayloadStatus: ExecutionPayloadStatus.valid, dataAvailableStatus: DataAvailableStatus.available, verifyProposer: false, @@ -151,7 +154,7 @@ describe("chain / rewards / blockRewards", () => { const calculatedBlockReward = await computeBlockRewards( block.message, - preState as CachedBeaconStateAllForks, + preState as unknown as CachedBeaconStateAllForks, postState ); const {proposerIndex, total, attestations, syncAggregate, proposerSlashings, attesterSlashings} = diff --git a/packages/beacon-node/test/unit/executionEngine/http.test.ts b/packages/beacon-node/test/unit/executionEngine/http.test.ts index d4a7f3a476e9..29bced11b236 100644 --- a/packages/beacon-node/test/unit/executionEngine/http.test.ts +++ b/packages/beacon-node/test/unit/executionEngine/http.test.ts @@ -189,6 +189,7 @@ describe("ExecutionEngine / http", () => { }, ], depositReceipts: null, // depositReceipts is null pre-electra + exits: null, }, null, // null returned for missing blocks { @@ -198,6 +199,7 @@ describe("ExecutionEngine / http", () => { ], withdrawals: null, // withdrawals is null pre-capella depositReceipts: null, // depositReceipts is null pre-electra + exits: null, }, ], }; @@ -246,6 +248,7 @@ describe("ExecutionEngine / http", () => { }, ], depositReceipts: null, // depositReceipts is null pre-electra + exits: null, }, null, // null returned for missing blocks { @@ -255,6 +258,7 @@ describe("ExecutionEngine / http", () => { ], withdrawals: null, // withdrawals is null pre-capella depositReceipts: null, // depositReceipts is null pre-electra + exits: null, }, ], };