OpenZeppelin / OpenZeppelin/openzeppelin-upgrades
`forceImport` fails with `The following deployment clashes with an existing one...`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 658
- Forks
- 286
- PR merge metrics
- No merged PRs in 30d
Description
I am deploying some proxies from a factory contract. I want to do some checks of the storage layout before upgrading these proxies, so in preparation for that I was hoping to import the "before" implementations into openzeppelin-upgrades using the forceImport.
At the time of calling forceImport I do not have any .openzeppelin folder, nor (obviously) any manifest file within that folder. Yet I get the following error when importing the layout for a contract at (say) 0x123:
Error: The following deployment clashes with an existing one at 0x123.
Debugging a little, it seems like checkForAddressClash is bing called twice, with the second invocation failing (because the first succeeded?). The two callstacks (console.trace()) are:
at checkForAddressClash (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:168:7)
at /Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:59:17
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Manifest.lockedRun (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/manifest.ts:123:6)
at async fetchOrDeployGeneric (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:43:24)
at async simulateDeployImpl (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/utils/simulate-deploy.ts:39:3)
at async addImplToManifest (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:94:3)
at async importProxyToManifest (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:68:3)
at async Proxy.forceImport (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:44:7)
```
at checkForAddressClash (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:178:6)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:59:11
at async Manifest.lockedRun (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/manifest.ts:123:6)
at async fetchOrDeployGeneric (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:43:24)
at async simulateDeployImpl (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/utils/simulate-deploy.ts:39:3)
at async addImplToManifest (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:94:3)
at async importProxyToManifest (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:68:3)
at async Proxy.forceImport (/Users/neil/dev/voltz/voltz-core/node_modules/@openzeppelin/hardhat-upgrades/src/force-import.ts:44:7)
```
In case it is relevant, I am also using the hardhat-deploy plugin.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in upgrades-core/src/impl-store.ts at checkForAddressClash and trace the calls from hardhat-upgrades/src/force-import.ts through utils/simulate-deploy.ts. Reproduce forceImport with no .openzeppelin manifest, then compare both clash checks; done means importing the implementation succeeds without a false address-clash error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100