Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/modules/ROOT/pages/faq.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
[[frequently-asked-questions]]
= Frequently Asked Questions

[[precompiled-proxy-contracts]]
== What compiler version is used for proxy contracts?

The Hardhat Upgrades plugin deploys proxy contracts using **precompiled bytecodes** that are packaged in the `@openzeppelin/upgrades-core` NPM package. This means:

* **The proxy compiler version is independent of your project's compiler version.** Even if your `hardhat.config.js` specifies a different Solidity version, the proxy contracts (such as `ERC1967Proxy`, `TransparentUpgradeableProxy`, `BeaconProxy`, and `UpgradeableBeacon`) are deployed using the bytecode that was precompiled with the version of Solidity included in `@openzeppelin/upgrades-core`. This does _not_ affect your implementation contracts, which are compiled with your project's configured compiler.

* **Different versions of `@openzeppelin/upgrades-core` may use different compiler versions** and different versions of the proxy contracts from https://docs.openzeppelin.com/contracts[OpenZeppelin Contracts]. Upgrading `@openzeppelin/upgrades-core` or `@openzeppelin/hardhat-upgrades` may change the precompiled proxy bytecodes.

* **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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would clarify this as follows, since currently it is a bit ambiguous:

Suggested change
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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done @ericglau thanks for the comment.


[[is-it-safe-to-upgrade-a-contract-compiled-with-a-version-of-solidity-to-another-compiled-with-a-different-version]]
== Can I change Solidity compiler versions when upgrading?

Expand Down
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/hardhat-upgrades.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ main();

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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done @ericglau thanks for the comment.


Then, in another script, you can use the `upgradeProxy` function to upgrade the deployed instance to a new version. The new version can be a different contract (such as `BoxV2`), or you can just modify the existing `Box` contract and recompile it - the plugin will note it changed.

[source,js]
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For example, `deployProxy` does the following:

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.
Copy link
Copy Markdown
Member

@ericglau ericglau Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done @ericglau thanks for the comment.


And when you call `upgradeProxy`:

Expand Down