-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Hardhat plugin has the possibility to let you fork an existing blockchain as Sepolia or Mainnet at a given block, allowing you to test your dapp in real condition if you need to interact with other protocols. For instance, I am exploring on the side DeFi projects where we can integrate FHE on top of that, but I do not want locally, to mock all those protocols. For instance mocking AAVE would require the deployment of multiple smart contract, while I will probably not have the exact state represented on-chain. This is where fork of the blockchain for testing can be interesting, as you can copy the current state on-chain.
Issue
I try to defined a fork configuration defining in my hardhat.config.ts the following
hardhat: {
accounts: {
mnemonic: MNEMONIC,
},
chainId: 31337,
forking: {
url: `https://sepolia.infura.io/v3/${INFURA_API_KEY}`,
blockNumber: 10147399,
},
}, However, I am running into this issue:
$ npm run test
Error in plugin @fhevm/hardhat-plugin: FHEVMExecutor contract's bytecode at 0xe3a9105a3a932253A70F126eb1E3b589C643dD24 is not empty.I strongly believe that at the initialization of the test, we are deploying some contracts needed for the FHE interaction on hardhat. But as we are forking the network from sepolia, this contract is already deployed.
I think we would either need to fallback on the existing one on sepolia (but do not have all the implication it means).
And something that I have in mind is that the bytecode of sepolia will potentially not match with the one on hardhat due to FHEVM configuration.
Maybe we would need to add a specific configuration to allowing forking on another chain on hardhat.
Let me know if I can help on this.