docs: document use of precompiled proxies and compiler version for proxies#1210
docs: document use of precompiled proxies and compiler version for proxies#1210jose-blockchain wants to merge 4 commits intoOpenZeppelin:masterfrom
Conversation
…oxies Adds FAQ entry explaining that the Hardhat Upgrades plugin deploys proxy contracts using precompiled bytecodes from @openzeppelin/upgrades-core, independently of the user's project compiler version. Adds cross-references in the Overview and Hardhat usage guide. Closes OpenZeppelin#1187
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughDocumentation updates across three files to clarify that the Hardhat Upgrades plugin uses precompiled proxy bytecodes from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ericglau
left a comment
There was a problem hiding this comment.
Thanks for the PR! A few comments.
|
|
||
| This will automatically check that the `Box` contract is upgrade-safe, deploy an implementation contract for the `Box` contract (unless there is one already from a previous deployment), create a proxy (along with a proxy admin if needed), and initialize it by calling `initialize(42)`. | ||
|
|
||
| NOTE: The proxy contract itself is deployed using precompiled bytecodes from `@openzeppelin/upgrades-core`, not compiled with your project's Solidity compiler. See xref:faq.adoc#precompiled-proxy-contracts[Precompiled proxy contracts] for details. |
There was a problem hiding this comment.
Can you also add the same note in https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/plugin-hardhat/README.md (it is a mostly a duplicate of this file, but is used as a readme for this subfolder in the GitHub repo)
docs/modules/ROOT/pages/index.adoc
Outdated
| 2. Deploys the xref:faq.adoc#what-is-an-implementation-contract[implementation contract]. Note that the Hardhat plugin first checks if there is an implementation contract deployed with the same bytecode, and skips this step if one is already deployed. | ||
|
|
||
| 3. Creates and initializes the proxy contract, along with a xref:faq.adoc#what-is-a-proxy-admin[proxy admin] (if needed). | ||
| 3. Creates and initializes the proxy contract, along with a xref:faq.adoc#what-is-a-proxy-admin[proxy admin] (if needed). Note that the Hardhat plugin deploys proxy contracts using xref:faq.adoc#precompiled-proxy-contracts[precompiled bytecodes] from the `@openzeppelin/upgrades-core` package, which are compiled independently from your project's Solidity compiler version. |
There was a problem hiding this comment.
I would suggest moving this lower to around line 41, so that it fits into the existing paragraphs about the differences between the Hardhat and Foundry Upgrades plugins.
Can you also make a similar change in https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/README.md ?
docs/modules/ROOT/pages/faq.adoc
Outdated
|
|
||
| * **For consistent proxy bytecodes across chains**, you should use the same versions of `@openzeppelin/hardhat-upgrades` and `@openzeppelin/upgrades-core` for all deployments. This is particularly important for **source code verification**, since the verification process depends on the exact compiler version and settings used to produce the deployed bytecode. | ||
|
|
||
| NOTE: The Foundry Upgrades library (https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades[`openzeppelin-foundry-upgrades`]) compiles proxy contracts as part of the project's build process using the project's own compiler configuration, so this behavior is specific to the Hardhat plugin. |
There was a problem hiding this comment.
I would clarify this as follows, since currently it is a bit ambiguous:
| NOTE: The Foundry Upgrades library (https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades[`openzeppelin-foundry-upgrades`]) compiles proxy contracts as part of the project's build process using the project's own compiler configuration, so this behavior is specific to the Hardhat plugin. | |
| NOTE: The Foundry Upgrades library (https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades[`openzeppelin-foundry-upgrades`]) compiles proxy contracts as part of the project's build process using the project's own compiler configuration, so the above behavior is specific to the Hardhat plugin only. |
Summary
@openzeppelin/upgrades-core, independent of the user's project compiler versionupgrades-coremay ship different proxy compiler versions and OpenZeppelin Contracts versionsCloses #1187
Files changed:
docs/modules/ROOT/pages/faq.adoc-- new FAQ section "What compiler version is used for proxy contracts?"docs/modules/ROOT/pages/index.adoc-- note in "How the plugins work" step 3docs/modules/ROOT/pages/hardhat-upgrades.adoc-- NOTE admonition afterdeployProxyexampleSummary by CodeRabbit