diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index af31e2ad69..4eae1b490f 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -328,11 +328,9 @@ export class Common { * @returns The name of the HF */ getHardforkBy(opts: HardforkByOpts): string { - let { blockNumber, timestamp, td } = opts - - blockNumber = toType(blockNumber, TypeOutput.BigInt) - td = toType(td, TypeOutput.BigInt) - timestamp = toType(timestamp, TypeOutput.BigInt) + const blockNumber: bigint | undefined = toType(opts.blockNumber, TypeOutput.BigInt) + const td: bigint | undefined = toType(opts.td, TypeOutput.BigInt) + const timestamp: bigint | undefined = toType(opts.timestamp, TypeOutput.BigInt) // Filter out hardforks with no block number, no ttd or no timestamp (i.e. unapplied hardforks) const hfs = this.hardforks().filter( @@ -353,10 +351,8 @@ export class Common { // discovering/checking number hardforks. let hfIndex = hfs.findIndex( (hf) => - (blockNumber !== undefined && - hf.block !== null && - BigInt(hf.block) > (blockNumber as bigint)) || - (timestamp !== undefined && hf.timestamp !== undefined && hf.timestamp > timestamp) + (blockNumber !== undefined && hf.block !== null && BigInt(hf.block) > blockNumber) || + (timestamp !== undefined && hf.timestamp !== undefined && BigInt(hf.timestamp) > timestamp) ) if (hfIndex === -1) { @@ -601,7 +597,7 @@ export class Common { * @returns The value requested or `BigInt(0)` if not found */ paramByHardfork(topic: string, name: string, hardfork: string | Hardfork): bigint { - let value = null + let value: bigint | null = null for (const hfChanges of this.HARDFORK_CHANGES) { // EIP-referencing HF config (e.g. for berlin) if ('eips' in hfChanges[1]) {