From beaa077ec301c2f99f0ac61fba92cdf5f0ea40fa Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:30:46 -0400 Subject: [PATCH] yet more fixes --- packages/block/test/util.ts | 2 +- packages/client/test/miner/pendingBlock.spec.ts | 4 ++-- packages/client/test/rpc/eth/chainId.spec.ts | 2 +- packages/client/test/rpc/eth/getFeeHistory.spec.ts | 2 +- packages/common/src/common.ts | 5 +++-- packages/vm/test/api/EIPs/eip-1559-FeeMarket.spec.ts | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/block/test/util.ts b/packages/block/test/util.ts index 91a1f059ab..f6ad8f9d86 100644 --- a/packages/block/test/util.ts +++ b/packages/block/test/util.ts @@ -1,4 +1,4 @@ -import { Chain, Common, Hardfork } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { RLP } from '@ethereumjs/rlp' import { BIGINT_0, BIGINT_1, utf8ToBytes } from '@ethereumjs/util' import { keccak256 } from 'ethereum-cryptography/keccak' diff --git a/packages/client/test/miner/pendingBlock.spec.ts b/packages/client/test/miner/pendingBlock.spec.ts index f0b78e5368..4df75f542e 100644 --- a/packages/client/test/miner/pendingBlock.spec.ts +++ b/packages/client/test/miner/pendingBlock.spec.ts @@ -1,5 +1,5 @@ import { Block, BlockHeader } from '@ethereumjs/block' -import { Common, Goerli, Hardfork, createCommonFromGethGenesis } from '@ethereumjs/common' +import { Common, Goerli, Hardfork, Mainnet, createCommonFromGethGenesis } from '@ethereumjs/common' import { DefaultStateManager } from '@ethereumjs/statemanager' import { create1559FeeMarketTx, create4844BlobTx, createLegacyTx } from '@ethereumjs/tx' import { @@ -78,7 +78,7 @@ const setup = () => { shallowCopy: () => service.execution.vm, setStateRoot: () => {}, blockchain: mockBlockchain({}), - common: new Common({ chain: 'mainnet' }), + common: new Common({ chain: Mainnet }), }, }, } diff --git a/packages/client/test/rpc/eth/chainId.spec.ts b/packages/client/test/rpc/eth/chainId.spec.ts index 18d4f45766..cad0de0f30 100644 --- a/packages/client/test/rpc/eth/chainId.spec.ts +++ b/packages/client/test/rpc/eth/chainId.spec.ts @@ -1,4 +1,4 @@ -import { Chain, Common, Goerli } from '@ethereumjs/common' +import { Common, Goerli } from '@ethereumjs/common' import { assert, describe, it } from 'vitest' import { baseSetup, createClient, createManager, getRpcClient, startRPC } from '../helpers.js' diff --git a/packages/client/test/rpc/eth/getFeeHistory.spec.ts b/packages/client/test/rpc/eth/getFeeHistory.spec.ts index f476013bf0..fd6d80f044 100644 --- a/packages/client/test/rpc/eth/getFeeHistory.spec.ts +++ b/packages/client/test/rpc/eth/getFeeHistory.spec.ts @@ -1,5 +1,5 @@ import { paramsBlock } from '@ethereumjs/block' -import { Common, Chain as CommonChain, Hardfork, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { createTxFromTxData } from '@ethereumjs/tx' import { BIGINT_0, diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 0ec9e62940..b66c44ab26 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -255,7 +255,7 @@ export class Common { (acc: number, hf: HardforkTransitionConfig) => Math.max(Number(hf.timestamp ?? '0'), acc), 0, ) - if (minTimeStamp > timestamp) { + if (BigInt(minTimeStamp) > timestamp) { throw Error(`Maximum HF determined by timestamp is lower than the block number/ttd HF`) } @@ -266,7 +266,8 @@ export class Common { Math.min(Number(hf.timestamp ?? timestamp), acc), Number(timestamp), ) - if (maxTimeStamp < timestamp) { + console.log(minTimeStamp, maxTimeStamp, timestamp, blockNumber) + if (BigInt(maxTimeStamp) < timestamp) { throw Error(`Maximum HF determined by block number/ttd is lower than timestamp HF`) } } diff --git a/packages/vm/test/api/EIPs/eip-1559-FeeMarket.spec.ts b/packages/vm/test/api/EIPs/eip-1559-FeeMarket.spec.ts index e48e12a0eb..567ccdc09b 100644 --- a/packages/vm/test/api/EIPs/eip-1559-FeeMarket.spec.ts +++ b/packages/vm/test/api/EIPs/eip-1559-FeeMarket.spec.ts @@ -1,5 +1,5 @@ import { createBlockFromBlockData } from '@ethereumjs/block' -import { Chain, Common, Hardfork, Mainnet } from '@ethereumjs/common' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { AccessListEIP2930Transaction, FeeMarketEIP1559Transaction,