Demystifying the Characteristics for Smart Contract Upgrades

Ye Liu,Shuo Li,Xiuheng Wu,Yi Li,Zhiyang Chen,David Lo
2024-06-09
Abstract:Upgradable smart contracts play an important role in the decentralized application ecosystem, to support routine maintenance, security patching, and feature additions. In this paper, we conduct an empirical study on proxy-based upgradable smart contracts to understand the characteristics of contract upgrading. Through our study on 57,118 open source proxy contracts, we found that 583 contracts have ever been upgraded on Ethereum, involving 973 unique implementation contract versions. The results show that developers often intend to improve usability of contracts if upgrading, where functionality addition and update are the most frequent upgrade intentions. We investigated the practical impacts of contract upgrades, e.g., breaking changes causing compatibility issues, storage collisions and initialization risks leading to security vulnerabilities. The results demonstrate that there are 4,334 ABI breaking changes due to the upgrades of 276 proxies, causing real-world broken usages within 584 transactions witnessed by the blockchain; 36 contract upgrades had storage collisions and five proxies with 59 implementation contracts are vulnerable to initialization attacks.
Software Engineering
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to understand the characteristics of smart contract upgrades, especially the behavior and intention in practical applications and their impact on compatibility and security. Specifically, the research aims to: 1. **Investigate the content of smart contract upgrades**: Analyze the code changes between the original version and the updated version to understand the modifications made. 2. **Study the motivation behind the upgrades**: Systematically study the fundamental intentions of these upgrades and capture the reasons why developers upgrade contracts. 3. **Evaluate the actual impact of the upgrades**: Explore the impact of smart contract upgrades on compatibility and security, especially the problems caused by breaking changes, storage conflicts, and initialization risks. Through this empirical study, the author hopes to reveal the complexity and potential risks of smart contract upgrades and provide developers with directions for improvement to ensure the safety and reliability of the upgrade process. In addition, the research also aims to promote more attention from the academic community in this area and facilitate more in - depth research and development. ### Main contributions of the paper - **Propose and implement the UpCon framework**: This is a novel analysis framework for characterizing smart contract upgrades, including a customized comprehensive upgrade intention taxonomy. - **Large - scale empirical study**: Conducted a large - scale study on 44,282 proxy contracts on Ethereum, revealing key insights into upgradable smart contracts. - **Open resources**: Provide open access to the prototype tools, data sets, and analysis results used in the research for further research and development by the community. ### Overview of the methodology The paper adopts a systematic method to collect and analyze data on smart contract upgrades. The main steps include: 1. **Detection and identification of proxy contracts**: Crawl open - source smart contracts from multiple blockchain platforms (such as Ethereum) and identify proxy contracts according to specific rules. 2. **Implement the detection algorithm**: Effectively detect the historical implementation contract addresses and corresponding block numbers of proxy contracts through the binary search algorithm. 3. **Data analysis**: Use the GumTree - Sol tool to compare smart contract codes of different versions, identify code changes, and analyze upgrade intentions according to the proposed intention taxonomy. ### Main findings - **Upgrade content**: Adding and removing functions are the most common code changes, followed by changes in expression statements. - **Upgrade intention**: Most upgrades are to improve the usability of contracts, and function addition and update are the most frequent upgrade intentions. - **Compatibility and security issues**: A large number of ABI breaking changes and two common upgrade - related vulnerabilities (storage conflicts and initialization risks) were found, and these problems significantly affect the data integrity of smart contracts. Through these studies, the author hopes to provide valuable insights and tools for the responsible upgrade of smart contracts.