OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

docs: clarify how to choose proxy type

Open
#416 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
TypeScript
Stars
658
Forks
286
PR merge metrics
No merged PRs in 30d

Description

I think there is room for improvement in the documentation with regards to explaining how to choose between transparent and UUPS proxies. Let me give you my perspective as someone who is a newbie to upgradeable contracts, but otherwise an experienced developer.

Firstly I read https://docs.openzeppelin.com/contracts/4.x/api/proxy#transparent-vs-uups and several other good resources (including relevant EIPs), to learn the technical differences between transparent and UUPS proxies.

Next I read this overview:

and then followed these instructions to make one of my OpenZeppelin ERC721 contracts upgradeable:

and adjusted my Hardhat tests and deployment scripts according to:

I also consulted the contracts documentation which offered very similar info:

and also this guide:

However none of these six resources mention that there is a way to choose between transparent and UUPS proxies! It was clear to me that there must be, because Transparent vs UUPS Proxies says:

The original proxies included in OpenZeppelin followed the Transparent Proxy Pattern. While this pattern is still provided, our recommendation is now shifting towards UUPS proxies, which are both lightweight and versatile.

So I kept hunting, with no luck.

Eventually I resorted to searching in the source, and found:

https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/c73d34724238f04a91b248c3b345103a45945cda/packages/plugin-hardhat/src/deploy-proxy.ts#L61-L78

which led me to:

https://docs.openzeppelin.com/upgrades-plugins/1.x/api-hardhat-upgrades#common-options

where I finally realised that the trick is to pass { kind: 'uups' } to upgrades.deployProxy(). (I also see that the Truffle upgrades API offers the same thing.)

After more hunting, I eventually found UUPS Proxies: Tutorial (Solidity + JavaScript) - Smart Contracts / Guides and Tutorials - OpenZeppelin Community which is linked from https://docs.openzeppelin.com/openzeppelin/upgrades and is the clearest explanation. But ideally I would have found this information much more easily.

So I would suggest that at least some, if not all, of the first 6 links listed above should be modified to mention the mechanism for choosing the proxy type, and cross-link to the API docs and/or that tutorial.

Hope that feedback makes sense and is useful!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked packages/plugin-hardhat/src/deploy-proxy.ts lines 61-78 and the Hardhat upgrades API's common-options section to confirm the proxy-selection mechanism. Review the six documentation pages listed in the issue and the linked UUPS tutorial. Done means the relevant overview or guide pages explain how to choose a proxy type and link to the API details or tutorial.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, solidity, typescript
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.