import { Hardfork, SHANGHAI } from 'tevm'function checkPUSH0Support(fork: BrandedHardfork) { if (fork.isBefore(SHANGHAI)) { console.warn("PUSH0 opcode not available before Shanghai") return false } return true}
import { Hardfork, MERGE } from 'tevm'function validateMiningConfig(fork: BrandedHardfork, config: MiningConfig) { if (!fork.isBefore(MERGE) && config.mining) { throw new Error("Mining not supported after Merge (Proof of Stake)") }}
Important:isBefore returns false when versions are equal:
import { LONDON } from 'tevm'LONDON.isBefore(LONDON) // false - not strictly before itself
For “less than or equal”, use lte or negate isAfter:
import { LONDON, CANCUN } from 'tevm'// Less than or equalLONDON.lte(LONDON) // true!LONDON.isAfter(LONDON) // true// Strictly less thanLONDON.isBefore(LONDON) // falseLONDON.isBefore(CANCUN) // true