sphinx-labs / sphinx

DevOps platform for smart contract deployments
https://sphinx.dev/
MIT License
236 stars 14 forks source link

fix(pg): Improve reliability of internal hardhat simulation in monorepos #1710

Closed RPate97 closed 3 months ago

RPate97 commented 3 months ago

Purpose

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.