From 3c605b4928e171890884dc7cd1a2dc59608928bd Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Mon, 29 Jul 2024 20:45:30 -0400 Subject: [PATCH] fix benchmarks --- packages/common/src/common.ts | 2 +- packages/vm/benchmarks/mainnetBlocks.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index b66c44ab26..3965d39147 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -266,7 +266,7 @@ export class Common { Math.min(Number(hf.timestamp ?? timestamp), acc), Number(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/benchmarks/mainnetBlocks.ts b/packages/vm/benchmarks/mainnetBlocks.ts index 2cd6e069de..d5872a2a2a 100644 --- a/packages/vm/benchmarks/mainnetBlocks.ts +++ b/packages/vm/benchmarks/mainnetBlocks.ts @@ -1,9 +1,9 @@ -import { readFileSync } from 'fs' -import Benchmark from 'benchmark' -import { Chain, Common, Hardfork } from '@ethereumjs/common' import { Block, createBlockFromRPC } from '@ethereumjs/block' +import { Common, Hardfork, Mainnet } from '@ethereumjs/common' import { runBlock as runBlockVM, VM } from '@ethereumjs/vm' -import { getPreState, getBlockchain, verifyResult } from './util.js' +import Benchmark from 'benchmark' +import { readFileSync } from 'fs' +import { getBlockchain, getPreState, verifyResult } from './util.js' const BLOCK_FIXTURE = 'benchmarks/fixture/blocks-prestate.json' @@ -25,7 +25,7 @@ export async function mainnetBlocks(suite?: Benchmark.Suite, numSamples?: number console.log(`Number of blocks to sample: ${numSamples}`) data = data.slice(0, numSamples) - const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.MuirGlacier }) + const common = new Common({ chain: Mainnet, hardfork: Hardfork.MuirGlacier }) for (const blockData of data) { const block = createBlockFromRPC(blockData.block, [], { common })