OpenZeppelin / OpenZeppelin/openzeppelin-upgrades
Separate deployProxy and upgradeProxy tests
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 658
- Forks
- 286
- PR merge metrics
- No merged PRs in 30d
Description
Currently the tests for Truffle and buidler have deployProxy and upgradeProxy in the same script. In production they will be used in separate scripts as an upgrade will happen sometime after a deploy.
The existing upgrades library shows a single script doing deploy and upgrade and this has caused confusion as there aren't examples showing these distinct steps.
The tests act as examples (and will likely be used as the basis for documentation examples), so we should show how they intend to be used.
For example in Truffle we could use something like the following:
2_deploy.js
const Greeter = artifacts.require('Greeter');
const GreeterV2 = artifacts.require('GreeterV2');
const { deployProxy } = require('@openzeppelin/upgrades-truffle');
module.exports = async function (deployer) {
await deployProxy(Greeter, ['Hello Truffle'], { deployer });
};
3_upgrade.js
const Greeter = artifacts.require('Greeter');
const GreeterV2 = artifacts.require('GreeterV2');
const { upgradeProxy } = require('@openzeppelin/upgrades-truffle');
module.exports = async function (deployer) {
const greeter = await Greeter.deployed();
await upgradeProxy(greeter.address, GreeterV2, { deployer });
};
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
Inspect the existing Truffle and buidler test scripts that currently combine deployProxy and upgradeProxy. Separate the deployment and upgrade steps into distinct scripts for each framework, then run the affected tests to confirm both workflows still work and provide separate examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- documentation, testing
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100