-
Notifications
You must be signed in to change notification settings - Fork 296
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
Unable to deploy upgradeable contract. "number of arguments do not match implementation constructor" #294
Comments
the issue is that when you use The reason for this is to allow you to use the same contract as an immutable contract (Without any proxy) as well as an upgradeable contract without any change. I use that feature a lot when I develop my front end and then release it on the mainnet. during development, it gets upgraded automatically but when I deploy I can simply disable the proxy and it still works the same. So if you do not expect to deploy without proxy, you ll have to remove the like this:
|
I have the same or very similar issue in 0.11.2 (or 0.11.0), but the code worked on 0.10.6:
Now results in The contract does not have a constructor, only an I also tried what you posted using Did something break in 0.11.x ? |
@jwickers oh yes, there is indeed an issue I just fixed it in 0.11.4 |
Thanks for reporting! |
works @wighawag thanks for addressing. quick follow up. how can you verify the implementation using
npx hardhat etherscan-verify --contract-name BoxV1 --network polygon_testnet
|
for implementation you can use |
works well. I couldn't maybe understand the docs to upgrade the proxy. could you tell how |
@aster2709 the design philosophy of hardhat-deploy script is to be declarative So for proxy upgrade, you are not supposed to change the proxy config hardaht-deploy will detect the changes and perform the upgrade, or tell you own to perform it |
didn't upgrade for me like that. I added the
the script is untouched import { DeployFunction } from "hardhat-deploy/types"
const deploy: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
await hre.deployments.deploy("BoxV1", {
from: deployer,
log: true,
proxy: {
execute: {
methodName: "initialize",
args: [42],
},
},
})
}
deploy.tags = ["BoxV1"]
export default deploy |
hmm, that should not be the case, do you have a repo I could try ? |
prepared one. still errors out for me on upgrade. here it is, https://github.com/aster2709/hardhat-template
|
+1 I can't get 0.11.4 to execute initialize for openzeppelin upgradables |
What error do you get ? @aster2709 I tried your repo and the issue is that your initialize function can only be called once If you want that you can use
|
Yes, that's a know fact. hardhat-deploy do not implement any verification. Having said, happy to receive contribution. There is actually a PR implementing this: #162 but did not found the time yet to look closely |
thanks for clarifications and patience. keep building ser 👍 |
Updates remaining outdated packages that are tightly coupled together and need to be updated in parallel. Note that Ethers has been updated to the latest minor version for v5, an upgrade to v6 requires many changes and will trigger a new major release of this project. Also note that I only updated Tenderly to v1.1 and froze it at that minor version. Using the latest version would require a few code changes, importing an extra package, increase the number of network request on _any_ invocation of `hardhat` and would annoyingly increase the amount of logs that are printed every time `hardhat` is called (the extra logs might be reduced but not configured away as the logging level is hardcoded in the plugin). Issue #32 is related. The changes to the proxy code appear to be caused by a change in behavior in `hardhat-deploy`, the new code should have the same effect (this is confirmed by our tests). I found a related issue [here](wighawag/hardhat-deploy#294) and the new behavior appears to be intended behavior. ### Test Plan Test a few commands and verify that everything works as usual, notably `yarn deploy` and `yarn bench:trace`.
great plugin. I'm still new to the ways of it. trying to deploy an upgradeable contract
the contract
the deploy script
the error
The text was updated successfully, but these errors were encountered: