Upgrading and Maintaining Smart Contracts
Our smart contract packaging tools enable you to:
- Upgrade your contracts and specify how the state of the contract is managed
- Specify whether a contract is upgradable or immutable
- Version your contracts and deprecate old versions
- Set permissions around who can perform contract upgrades
The Contract Package
When you upgrade a contract, you add a new contract version in a contract package. The versioning process is additive rather than an in-place replacement of an existing contract. The original version of the contract is still there, and you can enable certain versions for specific clients. You can also disable a contract version if needed. If you find that you need to use a disabled contract version, you may also re-enable it.
The contract package is like a container for different contract versions, with functionality that can differ slightly or significantly among versions. The contract package is created when you install the contract on the blockchain.
Videos and Tutorials
To learn more about versioning contracts, consult the following video, which builds upon the previous topics and videos in the Writing On-Chain Code documentation.
Or, for a different perspective, consult the Smart Contract Upgrade Tutorial.
Maintaining a Contract
The contract maintenance process is generally covered through the contract upgrade process.
Only major version changes in the Casper node software would require specific contract maintenance since a node version has a one-to-one mapping with the contract version. Otherwise, minor contract version changes can be addressed through the contract upgrade process. At the moment, we are not anticipating major contract changes in the Casper Mainnet. Therefore, the contract upgrade process can cater to any minor contract maintenance.
On instances like new node version releases, type upgrades, and bug fixes, we advise you to adhere to the same contract upgrade process.