TrueFiEng / Waffle

Library for writing and testing smart contracts.
https://getwaffle.io
MIT License
960 stars 161 forks source link

to.be.revertedWith not working when multiple providers for multiple chains #813

Closed roadbuilder closed 1 year ago

roadbuilder commented 1 year ago

Describe the bug Still not working if there are multiple providers being used for multichain. The await expect to.be.revertedWith doesn't catch the actual revert and gives an error message with the actual revert

To Reproduce Setup multiple providers for multiple chains running on different RPC ports through ganache. await expect(chains[0].portionArtWorld.connect(beth.connect(chain.provider)).mint(beth.address,tokenIdGasless,{gasLimit:3e5})).to.be.revertedWith("Ownable: caller is not the owner");

Software versions "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^1.0.4", "@nomicfoundation/hardhat-toolbox": "^2.0.0", "hardhat": "^2.12.2", "typescript": "^4.6.3" },

Additional context Specific tests are using the Axelar local dev to spin up additional chains using createNetwork: https://github.com/axelarnetwork/axelar-local-dev

Image of failure to catch the revertedWith image

roadbuilder commented 1 year ago

Figured it out.. for some reason when I added multi-chain to the projects it is now requiring waffle for the expect to catch the revertedWiths: Before:

require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-chai-matchers");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.9",
};

After (this is what fixed it):

require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-chai-matchers");
require("@nomiclabs/hardhat-waffle");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.9",
};

Just added the line:

require("@nomiclabs/hardhat-waffle");