Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
DO NOT RELY ON contract-update.md for reviewing this PR. The pattern used here is quite different. Instead, read the Openzeppelin Upgades link below. We'll update the documentation when these changes are finalised.
This PR deploys proxied contracts that can be upgraded. To keep PRs small, this is the first of (probably) two PRs. This PR simply adds upgradable contracts, it does not provide any means to carry out an upgrade; that will follow in a second PR.
The PR leans heavily on Openzepplin's Upgrades library. Nevertheless, some changes are required to make contracts upgradeable. This is mainly:
initialize()
functions (note the US spelling or expect hard to find bugs). Theinitializer
modifier ensures they can only be called once..transfer
no longer works because it has heavily restricted gas to prevent reentrancy. We replace it with.call
. This increases the risk of reentrancy attacks and so functions use a checks-effects-interactions pattern normally, but all are additionally protected by the OpenzepplinRentrancyGuard
modifier which prevents a modified function being called reenetrantly in any case.Testing is as normal but you will need to run
./setup-nightfall
to incorporate changes to the packages used. Note that the contracts are actually being called transparently through their proxies in the tests.