Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardhat-truffle5 test fixtures fail with: "{FixtureName} has no network configuration for its current network id (31337)." #1253

Closed
Ungolim opened this issue Feb 16, 2021 · 4 comments
Labels
type:docs Documentation-related issue

Comments

@Ungolim
Copy link

Ungolim commented Feb 16, 2021

After following the instructions outlined here for adapting existing Truffle migrations referenced in original Truffle test suites I get the following error if I try to run the test files with the hardhat-truffle5 plugin, no matter what networks config is specified in either the hardhat-config or truffle-config files (is the latter still needed by the plugin?):

image

You can find the project here: https://github.com/lepidotteri/diamond-3/tree/feat/hardhat%2Bsolc-0.8

@fvictorio
Copy link
Member

I don't know a lot about the truffle plugin, but I did some modifications to your truffle-fixture.js and now the tests at least run (but most fail). Here's the diff:

diff --git a/test/truffle-fixture.js b/test/truffle-fixture.js
index b12dd4a..e2f0cde 100644
--- a/test/truffle-fixture.js
+++ b/test/truffle-fixture.js
@@ -35,14 +35,16 @@ module.exports = async () => {
   DiamondCutFacet.setAsDeployed(cutFacet)
   const loupeFacet = await DiamondLoupeFacet.new()
   DiamondLoupeFacet.setAsDeployed(loupeFacet)
+  const ownershipFacet = await OwnershipFacet.new()
+  OwnershipFacet.setAsDeployed(ownershipFacet)
 
   const diamondCut = [
-    [DiamondCutFacet.address, FacetCutAction.Add, getSelectors(DiamondCutFacet)],
-    [DiamondLoupeFacet.address, FacetCutAction.Add, getSelectors(DiamondLoupeFacet)],
-    [OwnershipFacet.address, FacetCutAction.Add, getSelectors(OwnershipFacet)]
+    [cutFacet.address, FacetCutAction.Add, getSelectors(DiamondCutFacet)],
+    [loupeFacet.address, FacetCutAction.Add, getSelectors(DiamondLoupeFacet)],
+    [ownershipFacet.address, FacetCutAction.Add, getSelectors(OwnershipFacet)]
   ]
 
-  const diamond = await Diamond.new(diamondCut, admin)
+  const diamond = await Diamond.new(diamondCut, [admin.address])
   Diamond.setAsDeployed(diamond)
 
   const test1Facet = await Test1Facet.new()

Maybe this helps, but I'm playing it by ear here, so take it with a grain of salt.

Ungolim added a commit to Ungolim/diamond-3 that referenced this issue Feb 17, 2021
@Ungolim
Copy link
Author

Ungolim commented Feb 17, 2021

Maybe this helps, but I'm playing it by ear here, so take it with a grain of salt.

Thank you very much @fvictorio for taking the time to help out with the fixture, I was able to fix most test suites here: mudgen/diamond-3@1b35d2a

@fvictorio
Copy link
Member

Glad to hear that. I don't know if there's something on our side to fix here, but I will leave the issue open because I think something could be improved on those docs.

@fvictorio fvictorio added the type:docs Documentation-related issue label Feb 18, 2021
@fvictorio
Copy link
Member

Closing this since it's on our docs pipeline.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:docs Documentation-related issue
Projects
None yet
Development

No branches or pull requests

2 participants