Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the upgrade strategy during the development of Ethernet Square intelligent contract?

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what is the upgrade strategy in the development of intelligent contracts in Ethernet Square". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

100% intelligent contract development upgrade mechanism

There are currently two main strategies for implementing scalable smart contracts:

Use agency contract

Separate logic and data into different contracts.

The fundamental problem to be solved by these two methods is how to update the logic of the contract while still retaining access to the status of the contract.

Agent intelligence contract

The agent contract uses the delegatecall opcode to forward the function call to the updatable target contract. Because delegatecall retains the state of the function call, the logic of the target contract can be updated, and the state will be retained in the agent contract for the logical use of the updated target contract. Like delegatecall, msg.sender will maintain its status as the caller of the agent contract.

Because of the recent Byzantine hard bifurcation, it is now possible to get the return size of the function call, so this method is now universal compared to the method first proposed by Nick Johnson. You can see an example of a general agency contract in Daonomic's article, and you can learn more about this mechanism.

Intelligent contract development separates logic and data

This approach involves splitting the smart contract into two contracts:

Data contracts containing data (variables, structures, mappings, etc.) and getter/setter

A logical contract that contains the business logic of how to update this data

Logical contracts update data through setter, while data contracts only allow logical contracts to call setter. This allows the implementation logic to be changed while keeping the data unchanged, thus achieving a fully scalable system.

Contract updates can be achieved by guiding the user to use the new logical contract (through parsers such as ENS) and updating the permissions of the data contract to allow the new logical contract to execute setter.

Check out Thomas Wiesne's video to better understand this mechanism.

Using key values to separate logic and data contracts from the data model

This strategy works similar to the above, except that instead of using the final expected data structure (struct,mapping, etc.) to define the contract data model, all data is abstracted and stored in key-value pairs, and then a standard naming system and sha256 hashing algorithm are used to find data values.

You can refer to David Rugendyke's article to better understand this mechanism.

Upgradeable strategy for the development of some intelligent contracts

Creating a fully scalable contract sounds good, but it requires a big compromise: keep the contract immutable. Therefore, in many cases, the implementation of partially upgradable contracts may be a more reasonable choice.

In this strategy, the core functions of smart contracts can be retained as non-upgradeable. Other components that may be less complete or more complex are implemented with an upgradeable policy.

There have been some good examples in this regard:

The core contract of ENS:ENS service under the name of Etay Fong is a very simple contract and cannot be changed. Domain name registrars can be upgraded by administrators. The domain name registrar is a contract factory, and if you use a new domain manager, it can relink with all previous data states without too much trouble.

0xProject:603DEX (decentralized Exchange) core intelligence contracts can be fully upgraded, while agency contracts (one per user) remain unchanged. The 0x "agent" contract (which is different from the agent policy described earlier) contains user funds and related settings. For this reason, it is not an upgradeable part of the 0x contract system.

Other challenges

In all cases, there is a need to choose whether or not to maintain the invariance of smart contracts.

Creating an optional scalable intelligent contract system is possible and valuable for users, but adds complexity.

Changes to the Solidity compiler may break the compatibility between old and new contracts.

Gas overhead needs to be taken into account when formulating an upgradeable strategy.

This is the end of the content of "what is the upgrade strategy during the development of Ethernet Square intelligent contract". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report