Smart Contract Upgradability#123
Conversation
|
Your Render PR Server URL is https://nomicon-pr-123.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-bu073aipp1jok35mbkog. |
|
Referencing a overview for upgradability in Ethereum - https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/ |
Should we also allow activation upon some absolute time? |
Interesting, we can make Also interesting consideration if I also think it's important to match this with an advance tool I was describing: |
Sounds nice, but I don't think it is trivial to build :( |
|
How does voting for upgrade look like? For non-trustless case I see no concerns. |
This standard doesn't define how exactly owner decides to upgrade or not. It can be anything from multisig to DAO to a single person deciding, to using Oracle if price is above :) |
|
What about pausablity of a contract or escape hatches or commit-reveal scheme? Should we allow for this because of security upgrades? |
How does this differ from using different staging time? |
This would be a tool for testing locally contracts while developing. Not related to staging itself. |
Is there any discussion somewhere about state migration patterns? |
|
Hi @ilblackdragon (or anyone who is interested in championing this NEP forward) – We are cleaning the NEP backlog and noticed that this PR still has some remaining "TBD" sections noted. Therefore, we are labeling this PR as "Needs author revision." Please ping the @near/nep-moderators once you are ready for us to review it. We will review it again in February, unless we hear from you sooner. We typically close NEPs that are inactive for more than two months, so please let us know if you need more time. |
|
I do think it's an important to standardize as we currently have a zoo of upgradability patterns. But I will not be one to do this. I'm going to close until an author who can put in time can be found. |
Smart contract upgradability
In NEAR smart contracts are upgradable in-place by default.
This means that given a specific
account-id- the contract code may change depending on various rules.Non-upgradable
There are many contracts that should not be upgradable.
There are two ways that contract code can be upgraded in-place: using an access key and contract re-deploying it's own code.
To determine if contract is not upgradable, need to check that contract doesn't have any full access keys and that contract's code doesn't contain any
DeployContractcalls to itself.Additionally, contract code can contain ability to add FullAccessKeys to itself, and in this way return back control to the facilitator (for example multisig and lockup contracts have this ability under certain circumstances).
Accessible contract
Accessible contracts are contracts that have access keys with ability to re-deploy new code on them.
Usually this will be used for development or in some highly permissioned settings.
For example, contracts like multisig is really owned by the person or people who control it and hence they can re-deploy the code on it to upgrade or remove multisig.
Owner-pattern
Owner pattern means that contract's upgradability is owned by a different account.
This allows to introduce a more sophisticated management, anything from multisig to DAO. This also allows to easily evolve the management over time. For example, starting from simple account, one can change owner later to multisig and later upgrade to a DAO.
Owner upgradable pattern introduces next set of methods on a contract that follows this standard:
TBD: do we want to have a way to change staging duration?
State migrations
This section is TBD on state migration patters