Deciphering the dilemma around Upgradeable Smart Contracts

A quick article that will help you clear your dilemma about using upgradeable smart contracts and their use

Deciphering the dilemma around Upgradeable Smart Contracts

Hey, fam ๐Ÿ‘‹๐Ÿป

Welcome to another quick post on this classic dilemma around Upgradeable Smart Contracts:

๐Ÿ”ด Should we even consider upgradeable smart contracts?

๐Ÿ”ด Isnโ€™t it safer to keep smart contracts as simple as possible? Additional complexity means more bugs, right?

๐Ÿ”ด But, how can we securely develop upgradeable smart contracts? What if we run into issues like storage collisions or inadequate upgrades?

๐Ÿ”ด Even if we develop, how should we upgrade them securely?

โ€ฆ..

And such questions or confusion is what keeps us from choosing upgradeable features for our smart contracts.

I was in a similar discussion a few days ago and therefore wrote this quick post to eliminate some of these dilemmas around the upgradeable smart contracts.

๐Ÿค” Dev 1 who wanted to start developing his smart contracts was quite confused about whether or not he should make it upgradeable.

He believed his smart contracts might need additional functionalities in the future which is why upgradable contracts are perhaps the right choice.

However, he wasnโ€™t sure if he should proceed with it, given the complexity of dealing with Upgradeable contracts.

๐Ÿ‘จโ€๐Ÿ’ปDev 2: ๐˜œ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ๐˜ข๐˜ฃ๐˜ญ๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด ๐˜ข๐˜ณ๐˜ฆ๐˜ฏโ€™๐˜ต ๐˜ณ๐˜ฆ๐˜ข๐˜ญ๐˜ญ๐˜บ ๐˜ข ๐˜ด๐˜ข๐˜ง๐˜ฆ ๐˜ช๐˜ฅ๐˜ฆ๐˜ข ๐˜ข๐˜ด ๐˜ต๐˜ฉ๐˜ฆ๐˜บ ๐˜ฎ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ช๐˜ฏ๐˜ต๐˜ณ๐˜ฐ๐˜ฅ๐˜ถ๐˜ค๐˜ฆ ๐˜ข๐˜ฅ๐˜ฅ๐˜ช๐˜ต๐˜ช๐˜ฐ๐˜ฏ๐˜ข๐˜ญ ๐˜ค๐˜ฐ๐˜ฎ๐˜ฑ๐˜ญ๐˜ฆ๐˜น๐˜ช๐˜ต๐˜บ ๐˜ต๐˜ฐ ๐˜บ๐˜ฐ๐˜ถ๐˜ณ ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด ๐˜ข๐˜ฏ๐˜ฅ ๐˜ฎ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ฆ๐˜ฏ๐˜ฅ ๐˜ถ๐˜ฑ ๐˜ช๐˜ฏ๐˜ต๐˜ณ๐˜ฐ๐˜ฅ๐˜ถ๐˜ค๐˜ช๐˜ฏ๐˜จ ๐˜ฉ๐˜ช๐˜จ๐˜ฉ-๐˜ด๐˜ฆ๐˜ท๐˜ฆ๐˜ณ๐˜ช๐˜ต๐˜บ ๐˜ฃ๐˜ถ๐˜จ๐˜ด.

๐˜ฉ๐˜ฆ๐˜ณ๐˜ฆ ๐˜ค๐˜ฐ๐˜ถ๐˜ญ๐˜ฅ ๐˜ฃ๐˜ฆ ๐˜ข ๐˜ฃ๐˜ถ๐˜จ ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ญ๐˜ฆ๐˜ข๐˜ฅ๐˜ด ๐˜ต๐˜ฐ ๐˜ด๐˜ต๐˜ฐ๐˜ณ๐˜ข๐˜จ๐˜ฆ ๐˜ค๐˜ฐ๐˜ญ๐˜ญ๐˜ช๐˜ด๐˜ช๐˜ฐ๐˜ฏ๐˜ด ๐˜ฐ๐˜ณ ๐˜ข๐˜ฏ ๐˜ช๐˜ฏ๐˜ข๐˜ฅ๐˜ฆ๐˜ฒ๐˜ถ๐˜ข๐˜ต๐˜ฆ ๐˜ข๐˜ถ๐˜ต๐˜ฉ๐˜ฆ๐˜ฏ๐˜ต๐˜ช๐˜ค๐˜ข๐˜ต๐˜ช๐˜ฐ๐˜ฏ ๐˜ฑ๐˜ณ๐˜ฐ๐˜ค๐˜ฆ๐˜ฅ๐˜ถ๐˜ณ๐˜ฆ ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ข๐˜ญ๐˜ญ๐˜ฐ๐˜ธ๐˜ด ๐˜ข๐˜ฏ๐˜บ๐˜ฐ๐˜ฏ๐˜ฆ ๐˜ต๐˜ฐ ๐˜ถ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ, ๐˜ธ๐˜ฉ๐˜ช๐˜ค๐˜ฉ ๐˜ฑ๐˜ถ๐˜ต๐˜ด ๐˜บ๐˜ฐ๐˜ถ๐˜ณ ๐˜ข๐˜ด๐˜ด๐˜ฆ๐˜ต๐˜ด ๐˜ข๐˜ต ๐˜ณ๐˜ช๐˜ด๐˜ฌ.

๐Ÿ‘ฉโ€๐Ÿ’ปDev 3: ๐˜๐˜ง ๐˜บ๐˜ฐ๐˜ถ ๐˜ข๐˜ณ๐˜ฆ๐˜ฏโ€™๐˜ต ๐˜ด๐˜ถ๐˜ณ๐˜ฆ ๐˜ข๐˜ฃ๐˜ฐ๐˜ถ๐˜ต ๐˜ข๐˜ญ๐˜ญ ๐˜บ๐˜ฐ๐˜ถ๐˜ณ ๐˜ด๐˜ฎ๐˜ข๐˜ณ๐˜ต ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต ๐˜ง๐˜ถ๐˜ฏ๐˜ค๐˜ต๐˜ช๐˜ฐ๐˜ฏ๐˜ด ๐˜ข๐˜ฏ๐˜ฅ ๐˜ต๐˜ฉ๐˜ฆ๐˜ณ๐˜ฆ ๐˜ข๐˜ณ๐˜ฆ ๐˜ค๐˜ฉ๐˜ข๐˜ฏ๐˜ค๐˜ฆ๐˜ด ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ฏ๐˜ฆ๐˜ธ ๐˜ง๐˜ถ๐˜ฏ๐˜ค๐˜ต๐˜ช๐˜ฐ๐˜ฏ๐˜ข๐˜ญ๐˜ช๐˜ต๐˜ช๐˜ฆ๐˜ด ๐˜ฎ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ค๐˜ฐ๐˜ฎ๐˜ฆ ๐˜ช๐˜ฏ, ๐˜œ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ๐˜ข๐˜ฃ๐˜ญ๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด ๐˜ข๐˜ณ๐˜ฆ ๐˜ต๐˜ฉ๐˜ฆ ๐˜ณ๐˜ช๐˜จ๐˜ฉ๐˜ต ๐˜ค๐˜ฉ๐˜ฐ๐˜ช๐˜ค๐˜ฆ.

๐˜œ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ๐˜ข๐˜ฃ๐˜ญ๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด ๐˜ฅ๐˜ฐ ๐˜ฉ๐˜ฆ๐˜ญ๐˜ฑ ๐˜บ๐˜ฐ๐˜ถ ๐˜ง๐˜ช๐˜น ๐˜ข๐˜ฏ๐˜บ ๐˜ฃ๐˜ถ๐˜จ๐˜ด ๐˜ช๐˜ฏ ๐˜ด๐˜ฎ๐˜ข๐˜ณ๐˜ต ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด ๐˜ธ๐˜ฉ๐˜ช๐˜ค๐˜ฉ ๐˜ค๐˜ข๐˜ฏโ€™๐˜ต ๐˜ฃ๐˜ฆ ๐˜ฐ๐˜ท๐˜ฆ๐˜ณ๐˜ญ๐˜ฐ๐˜ฐ๐˜ฌ๐˜ฆ๐˜ฅ.

๐˜ˆ๐˜ฅ๐˜ฅ๐˜ช๐˜ต๐˜ช๐˜ฐ๐˜ฏ๐˜ข๐˜ญ๐˜ญ๐˜บ, ๐˜ช๐˜ต ๐˜ช๐˜ด๐˜ฏโ€™๐˜ต ๐˜ณ๐˜ฆ๐˜ข๐˜ญ๐˜ญ๐˜บ ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ฉ๐˜ข๐˜ณ๐˜ฅ ๐˜ต๐˜ฐ ๐˜ฅ๐˜ฆ๐˜ท๐˜ฆ๐˜ญ๐˜ฐ๐˜ฑ ๐˜ถ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ๐˜ข๐˜ฃ๐˜ญ๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ต๐˜ณ๐˜ข๐˜ค๐˜ต๐˜ด, ๐˜ฏ๐˜ฐ๐˜ธ ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ธ๐˜ฆ ๐˜ฉ๐˜ข๐˜ท๐˜ฆ ๐˜ด๐˜ฐ๐˜ฎ๐˜ฆ ๐˜ณ๐˜ฆ๐˜ข๐˜ญ๐˜ญ๐˜บ ๐˜ฆ๐˜ง๐˜ง๐˜ฆ๐˜ค๐˜ต๐˜ช๐˜ท๐˜ฆ ๐˜ญ๐˜ช๐˜ฃ๐˜ณ๐˜ข๐˜ณ๐˜ช๐˜ฆ๐˜ด ๐˜ข๐˜ฏ๐˜ฅ ๐˜ต๐˜ฐ๐˜ฐ๐˜ญ๐˜ด ๐˜ธ๐˜ฉ๐˜ช๐˜ค๐˜ฉ ๐˜ฆ๐˜ฏ๐˜ด๐˜ถ๐˜ณ๐˜ฆ๐˜ด ๐˜ต๐˜ฉ๐˜ข๐˜ต ๐˜ช๐˜ด๐˜ด๐˜ถ๐˜ฆ๐˜ด ๐˜ญ๐˜ช๐˜ฌ๐˜ฆ ๐˜ด๐˜ต๐˜ฐ๐˜ณ๐˜ข๐˜จ๐˜ฆ ๐˜ค๐˜ฐ๐˜ญ๐˜ญ๐˜ช๐˜ด๐˜ช๐˜ฐ๐˜ฏ๐˜ด, ๐˜ถ๐˜ฏ๐˜ด๐˜ข๐˜ง๐˜ฆ ๐˜ถ๐˜ฑ๐˜จ๐˜ณ๐˜ข๐˜ฅ๐˜ฆ๐˜ด ๐˜ฆ๐˜ต๐˜ค ๐˜ข๐˜ณ๐˜ฆ ๐˜ต๐˜ข๐˜ฌ๐˜ฆ๐˜ฏ ๐˜ค๐˜ข๐˜ณ๐˜ฆ ๐˜ฐ๐˜ง.

My Thoughts๐Ÿง

โฉ It has been a well-known theory in the Smart Contract world that ๐™Š๐™ฃ๐™š ๐™จ๐™๐™ค๐™ช๐™ก๐™™ ๐™ ๐™š๐™š๐™ฅ ๐™ฉ๐™๐™š๐™ž๐™ง ๐™จ๐™ข๐™–๐™ง๐™ฉ ๐™˜๐™ค๐™ฃ๐™ฉ๐™ง๐™–๐™˜๐™ฉ ๐™–๐™จ ๐™จ๐™ž๐™ข๐™ฅ๐™ก๐™š ๐™–๐™จ ๐™ฅ๐™ค๐™จ๐™จ๐™ž๐™—๐™ก๐™š ๐™–๐™จ ๐™–๐™™๐™™๐™ž๐™ฃ๐™œ ๐™˜๐™ค๐™ข๐™ฅ๐™ก๐™š๐™ญ๐™ž๐™ฉ๐™ฎ ๐™ข๐™ž๐™œ๐™๐™ฉ ๐™ž๐™ฃ๐™ฉ๐™ง๐™ค๐™™๐™ช๐™˜๐™š ๐™ฃ๐™š๐™ฌ ๐™—๐™ช๐™œ๐™จ.

And itโ€™s quite true, to some extent, as we donโ€™t really need to reinvent the wheel every time, and the security of smart contracts should always be a top priority.

โฉ However, smart contracts, despite their incredible powers of handling money or being immutable, are pieces of code too. And having some bugs in the code is inevitable.

As of now, ๐—จ๐—ฝ๐—ด๐—ฟ๐—ฎ๐—ฑ๐—ฒ๐—ฎ๐—ฏ๐—น๐—ฒ ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ฎ๐—ฐ๐˜๐˜€ ๐—ฎ๐—ฟ๐—ฒ ๐—ผ๐—ป๐—ฒ ๐—ผ๐—ณ ๐˜๐—ต๐—ฒ ๐—บ๐—ผ๐˜€๐˜ ๐—ฒ๐—ณ๐—ณ๐—ฒ๐—ฐ๐˜๐—ถ๐˜ƒ๐—ฒ ๐˜๐—ผ๐—ผ๐—น๐˜€ ๐˜„๐—ฒ ๐—ต๐—ฎ๐˜ƒ๐—ฒ ๐—ถ๐—ป ๐—ต๐—ฎ๐—ป๐—ฑ ๐—ฟ๐—ถ๐—ด๐—ต๐˜ ๐—ป๐—ผ๐˜„ ๐˜๐—ผ ๐—ฟ๐—ฒ๐˜€๐—ผ๐—น๐˜ƒ๐—ฒ ๐˜๐—ต๐—ฒ๐˜€๐—ฒ ๐—ฏ๐˜‚๐—ด๐˜€ ๐—ฒ๐˜ƒ๐—ฒ๐—ป ๐—ถ๐—ณ ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ฎ๐—ฐ๐˜๐˜€ ๐—ฎ๐—ฟ๐—ฒ ๐—ฑ๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—ฒ๐—ฑ, (in most cases).

โฉ Avoiding Upgradeable contracts just because they might add to the complexity of your existing smart contract architecture is probably a bad idea, especially when you know you might need one.

โฉ ๐™Ž๐™ฉ๐™ง๐™š๐™ฃ๐™œ๐™ฉ๐™๐™š๐™ฃ๐™ž๐™ฃ๐™œ ๐™ค๐™ช๐™ง ๐™ช๐™ฃ๐™™๐™š๐™ง๐™จ๐™ฉ๐™–๐™ฃ๐™™๐™ž๐™ฃ๐™œ ๐™ค๐™› ๐™ช๐™ฅ๐™œ๐™ง๐™–๐™™๐™š๐™–๐™—๐™ก๐™š ๐™จ๐™ข๐™–๐™ง๐™ฉ ๐™˜๐™ค๐™ฃ๐™ฉ๐™ง๐™–๐™˜๐™ฉ๐™จ ๐™ž๐™จ ๐™ฌ๐™๐™–๐™ฉ ๐™ฌ๐™š ๐™ฃ๐™š๐™š๐™™ ๐™–๐™ฃ๐™™ ๐™จ๐™๐™ค๐™ช๐™ก๐™™ ๐™ฅ๐™ง๐™š๐™›๐™š๐™ง, ๐™ž๐™ฃ๐™จ๐™ฉ๐™š๐™–๐™™ ๐™ค๐™› ๐™–๐™ซ๐™ค๐™ž๐™™๐™ž๐™ฃ๐™œ ๐™ž๐™ฉ.

โฉ Additionally, I believe smart contract upgrade patterns have now seen quite a journey starting from the Eternal Storage mechanism to the recent ones like Transparent Upgradeable proxy or UUPS.

Watch this video and enjoy, the very cool Thomas Wiesner, taking us to this entire journey of upgradeable smart contracts and how they evolved over time.

Therefore now we have a much safer procedure for upgrading contracts and amazing libraries and tools by Openzeppelin which simplifies the entire procedure.

Check out this treasure on Upgradeable smart contracts Here by OpenZeppelin.

โฉ While not every contract needs to be upgradeable, the ones that need to be should be upgradeable.

๐Ÿ’กThe right question for such contracts, however, isnโ€™t whether or not they should be upgradeable.

Instead ๐Ÿ‘‡

How should we Upgrade Smart Contracts Securely?

๐Ÿ”ด If you accumulate all the upgradeable capability of your smart contracts to a simple address (EOA), then itโ€™s definitely not a secure contract.

๐Ÿ”ด One safe way of upgrading such smart contracts is to use ProxyAdmin contracts and a Multisig, thus eliminating a single authority control over upgrades.

๐Ÿ”ด Upgrading through on-chain governance is another secure, effective, and decentralized way of doing it.

Join Decipher Club today

Simplifying Web3 and Technology for everyone

Subscribe Now