wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

.fixtures() bug when referencing dependency diamond contracts #469

Open mwawrusch opened 11 months ago

mwawrusch commented 11 months ago

Describe the bug

We encountered an issue where an error is thrown when working with a structure like this:

001_deploy:

002_deploy:

003_deploy:

And two test files, which use either a or b.

test1:

await deployments.fixtures(['a'])

test2:

await deployments.fixtures(['b']).

In this case test2 fails with the following error message:

 TypeError: diamondProxy.facets is not a function
      at _deployViaDiamondProxy (node_modules/hardhat-deploy/src/helpers.ts:1929:38)
      at async _deployViaDiamondProxy (node_modules/hardhat-deploy/src/helpers.ts:2444:11)
      at async Object.func (deploy/001_deploy.ts:47:39)
      at async DeploymentsManager.executeDeployScripts (node_modules/hardhat-deploy/src/DeploymentsManager.ts:1226:22)
      at async DeploymentsManager.runDeploy (node_modules/hardhat-deploy/src/DeploymentsManager.ts:1059:5)
      at async Object.fixture (node_modules/hardhat-deploy/src/DeploymentsManager.ts:316:9)
      at async Context.<anonymous> (test/products/test2.ts:9:5)
      at DeploymentsManager.executeDeployScripts (node_modules/hardhat-deploy/src/DeploymentsManager.ts:1229:19)
      at async DeploymentsManager.runDeploy (node_modules/hardhat-deploy/src/DeploymentsManager.ts:1059:5)
      at async Object.fixture (node_modules/hardhat-deploy/src/DeploymentsManager.ts:316:9)
      at async Context.<anonymous> (test/products//003_deploy.ts:9:5)

When switching the tests around the same error, but in the other test file (e.g. a or b). So the second attempt, when deploying the other contract and looking up the dependency to root something goes off rail.

Workaround for now is to ALWAYS specify ALL tags in the dependencies.fixtures(['root', 'a', 'b']) call.

To Reproduce

see above

Expected behavior

see above

versions