Skip to content
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

Question: reference contracts' upgrade approach looks like an error-pone approach #81

Open
twxia opened this issue Oct 29, 2024 · 0 comments

Comments

@twxia
Copy link

twxia commented Oct 29, 2024

From the README,

Tip If possible, keep the old version of the implementation contract's source code somewhere in your project to use as a reference as above. This requires the new version to be in a different directory, Solidity file, or using a different contract name. Otherwise, if you want to use the same directory and name for the new version, keep the build info directory from the previous deployment (or build it from an older branch of your project repository) and reference it as follows:

Options memory opts;
opts.referenceBuildInfoDir = "/old-builds/build-info-v1";
opts.referenceContract = "build-info-v1:MyContract";
Upgrades.upgradeProxy(proxy, "MyContract.sol", "", opts);
// or Upgrades.upgradeBeacon(beacon, "MyContract.sol", opts);

Without using different build info, developers need to change their contract name / directory name and use @custom:oz-upgrades-from to upgrade to the next version. However, this kind of change action means that it's really hard to notice a small part of code being modified during the development process, like git diff returns the whole file change. This looks like an error-prone approach.

It looks like defining different build info is a better practice of upgrading the contracts.

Do you guys have any thoughts about the good practice here? should we remove this kind of renaming error-prone upgrading way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant