Fixes an issue where some mono repo installations would not work correctly because of the location of the hardhat.config.js file used to spin up our internal simulation.
Fixes an issue where the user's version of hardhat may be used for our internal simulation if they have hardhat installed, causing unpredictable behavior.
Solution
We no longer rely on a hardhat task to create the in-process hardhat node. Instead, we create the internal hardhat process provider from scratch and then convert it into an ethers-compatible provider, which we then use for the simulation. This required creating a slightly modified version of the EthersHardhatProvider, which is functionally equivalent but does not require a hardhat project to work. This setup eliminates the brittle process of invoking a hardhat subtask in a child process using the hardhatRunner script and an actual hardhat.config.js configuration file.
Riders
This PR also includes a number of changes that resolve issues recently introduced by updates to Foundry and Hardat.
In hardhat 2.22.3, a bug that causes the simulation to fail in certain situations when running against local nodes was introduced. I tried to resolve that issue but could not, so I disabled the simulation when the target network is a local node. This also required removing/updating some tests that relied on the simulation. I've created a ticket to reverse these changes if/when hardhat fixes the bug.
Purpose
hardhat.config.js
file used to spin up our internal simulation.Solution
We no longer rely on a hardhat task to create the in-process hardhat node. Instead, we create the internal hardhat process provider from scratch and then convert it into an ethers-compatible provider, which we then use for the simulation. This required creating a slightly modified version of the
EthersHardhatProvider
, which is functionally equivalent but does not require a hardhat project to work. This setup eliminates the brittle process of invoking a hardhat subtask in a child process using thehardhatRunner
script and an actualhardhat.config.js
configuration file.Riders
This PR also includes a number of changes that resolve issues recently introduced by updates to Foundry and Hardat.
CHU-1067
by updating to hardhat2.22.3
.2.22.3
, a bug that causes the simulation to fail in certain situations when running against local nodes was introduced. I tried to resolve that issue but could not, so I disabled the simulation when the target network is a local node. This also required removing/updating some tests that relied on the simulation. I've created a ticket to reverse these changes if/when hardhat fixes the bug.