diff --git a/packages/client/test/sim/beaconsync.spec.ts b/packages/client/test/sim/beaconsync.spec.ts index 923b82584ee..1a03be41ac7 100644 --- a/packages/client/test/sim/beaconsync.spec.ts +++ b/packages/client/test/sim/beaconsync.spec.ts @@ -162,7 +162,11 @@ describe('simple mainnet test run', async () => { // call sync if not has been called yet void ejsClient.services[0].synchronizer?.sync() const syncResponse = await Promise.race([beaconSyncPromise, syncTimeout]) - assert(syncResponse.syncState, 'SYNCED', 'beaconSyncRelayer should have synced client') + assert.equal( + syncResponse.syncState, + 'SYNCED', + 'beaconSyncRelayer should have synced client' + ) await ejsClient.stop() assert.ok(true, 'completed beacon sync') } catch (e) { diff --git a/packages/client/test/sim/simutils.ts b/packages/client/test/sim/simutils.ts index 83236f031d6..7f20f0e27e0 100644 --- a/packages/client/test/sim/simutils.ts +++ b/packages/client/test/sim/simutils.ts @@ -24,6 +24,7 @@ import { EthereumClient } from '../../src/client' import { Config } from '../../src/config' import { LevelDB } from '../../src/execution/level' import { RPCManager } from '../../src/rpc' +import { Event } from '../../src/types' import type { Common } from '@ethereumjs/common' import type { TransactionType, TxData, TxOptions } from '@ethereumjs/tx' @@ -479,16 +480,16 @@ export async function setupEngineUpdateRelay(client: EthereumClient, peerBeaconU // possible values: STARTED, PAUSED, ERRORED, SYNCING, VALID let syncState = 'PAUSED' - let pollInterval = null + let pollInterval: any | null = null let waitForStates = ['VALID'] let errorMessage = '' - const updateState = (newState) => { + const updateState = (newState: string) => { if (syncState !== 'PAUSED') { syncState = newState } } - const playUpdate = async (payload, finalizedBlockHash, version) => { + const playUpdate = async (payload: any, finalizedBlockHash: string, version: string) => { if (version !== 'capella') { throw Error('only capella replay supported yet') } @@ -525,8 +526,8 @@ export async function setupEngineUpdateRelay(client: EthereumClient, peerBeaconU } } - // ignoring the actual even, just using it as trigger to feed - eventSource.addEventListener(topics[0], (async (_event: MessageEvent) => { + // ignoring the actual event, just using it as trigger to feed + eventSource.addEventListener(topics[0], async (_event: MessageEvent) => { if (syncState === 'PAUSED' || syncState === 'CLOSED') return try { // just fetch finalized updated, it has all relevant hashes for fcU @@ -555,7 +556,7 @@ export async function setupEngineUpdateRelay(client: EthereumClient, peerBeaconU updateState('ERRORED') errorMessage = (e as Error).message } - }) as EventListener) + }) const cleanUpPoll = () => { if (pollInterval !== null) { @@ -564,7 +565,7 @@ export async function setupEngineUpdateRelay(client: EthereumClient, peerBeaconU } } - const start = (opts: { waitForStates?: string } = {}) => { + const start = (opts: { waitForStates?: string[] } = {}) => { waitForStates = opts.waitForStates ?? ['VALID'] if (pollInterval !== null) { throw Error('Already waiting on sync') diff --git a/packages/client/test/sim/snapsync.spec.ts b/packages/client/test/sim/snapsync.spec.ts index a04e675a452..e8683c815cd 100644 --- a/packages/client/test/sim/snapsync.spec.ts +++ b/packages/client/test/sim/snapsync.spec.ts @@ -220,7 +220,7 @@ describe('simple mainnet test run', async () => { const address = Address.fromString(addressString) const account = await stateManager.getAccount(address) assert.equal( - account.balance, + account?.balance, BigInt(customGenesisState[addressString][0]), `${addressString} balance should match` )