Original author: @jolestar
< /p>
Recently, there have been many debates about whether it is safer or less secure for users to interact with Move smart contracts without authorization (Approve). Here we try to use popular To explain the difference behind the two and the thinking behind the design of Move.
Let's first understand how users interact with smart contracts. When we sign a transaction and call a smart contract on the chain, it is like entering a digital world of smart contracts from the physical world. We have an avatar in this digital world, and what this avatar does is defined by the smart contract .
In EVM, each contract is equivalent to an independent small world. After entering this world, the avatar can only operate the user The state (asset) in the current contract world.
For example, if you enter the swap world and want to exchange your usdt for other assets, and usdt exists in the contract world that defines usdt, there is no way Withdraw assets from the usdt contract directly in swap as your own. Therefore, users can only go to the usdt contract world to execute approve, tell the usdt contract that swap can extract their own assets on their behalf, and then enter the swap world to operate.
After the operation is completed, go to usdt to cancel the authorization (revoke). However, the approve and revoke operations here require independent transactions. Users often do not perform revoke in order to save gas costs. As a result, if there is a security problem in the swap contract, the user's assets may be stolen without knowing it.
In Move, all contracts operate in a large digital world. The user's digital avatar can freely move between contracts and perform any operation, while the user's state (assets) is stored in the user's own storage space.
The user enters through the swap entrance, withdraws usdt from his own balance, swaps, and stores can be atomically completed in the same transaction. This mode brings a more free combination mode to the contract, and can play many combination games that are difficult to achieve on the EVM. This is also the mode that the account abstraction scheme on the EVM wants to achieve. Of course, this also brings new security challenges.
Can a feature be directly added to the EVM so that calls between contracts can directly bring the user's identity over? This is technically achievable, but the EVM supports dynamic calls, which can call contracts at any address, making it difficult to measure the risk of this operation. At the same time, the state changes of the EVM are not friendly to users and wallets, making it difficult for wallets to Notify the user of a state change.
There are two ways to solve this security challenge in Move:
< p>1. When pre-executing the contract, the status change after the execution of the contract is prompted to the user, so that the user can know which important assets of the transaction have been operated, and the result after execution . This method has been implemented in StarMask, please refer to the link and attached picture https://starcoin.medium.com/starmask-v4-6-

2. There may be some contracts that can be set by setting conditions, Some users cannot discover state changes during pre-execution. The analysis of @0xmetazen https://twitter.com/0xmetazen/status/1582581013972414465 , but there is no dynamic call in Move, when the contract is deployed, its execution logic is determined. By statically analyzing the bytecode, the status of the operation on all possible paths of the contract can be obtained, and the user can be prompted in the block browser or wallet.
Two schemes of EVM and Move, with The security risks that come are different. The security risk of the Approve scheme is to change an immediate authorization into a long-term authorization. Its risk does not occur immediately, such as contract loopholes not being discovered or malicious contracts catching big fish for a long time. Once it happens, users are often very passive, and many users may forget which contracts they have authorized.
However, Move’s solution gives the contract greater freedom, and there will be a greater risk when encountering a malicious contract, but this risk occurs immediately and can be detected through technical means. In the worst case, at least the front is rushing so fast that people are in the pit, and the people behind can be warned, and the malicious contract will be exposed quickly.
Finally, there is no silver bullet in the world, and it is impossible to solve all security problems by using a certain technology. It requires the joint efforts of chains, tools, and users.
Security advice for Move users:
1. Choose a wallet with more complete status change prompts, and try to understand the wallet prompts.
2. Do not interact with DApps from unknown sources or not open source at will.
3. If you can't do the above two points, you can wait for others to go to the pit first.
Move's security challenges and improvement plans are not only Only these, I will detail in the "Why Move" series of security articles, friends who want to know can pay attention.
Original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia