Ganache fork at fixed block height

Hi there! I’m trying to set up a local ganache fork of Harmony shard 0 at a fixed block height for testing purposes, but fixing the block height does not seem to work. Basically, this works:

import ganache from "ganache"
import { ethers } from "ethers"

async function main() {
  const options = {
    chain: {
      networkId: 1666600000,
    },
    fork: {
      url: "https://sin.api.harmony.one",
      // blockNumber: 24000000,
    },
  }
  const provider = new ethers.providers.Web3Provider(ganache.provider(options))
  console.log(
    (
      await provider.getBalance("0x71b413da5cc729ff805e2dca1dcde04d29ef2b6a")
    ).toString()
  )
}

main().then(() => process.exit())

But when I uncomment the blockNumber line, I’m getting the following error:

CodedError: missing trie node 992bd7ec9f16b0f4189437440ac9f24878740788362869feb7fcd97af063403e (path )

I’m guessing the issue is that the provider does not support fixing the block height. Does anyone know how I can fix this? Thanks in advance!

1 Like