The treewidth of smart contracts

Chatterjee K, Goharshady AK, Goharshady EK. 2019. The treewidth of smart contracts. Proceedings of the 34th ACM Symposium on Applied Computing. SAC: Symposium on Applied Computing vol. Part F147772, 400–408.

Download
OA 2019_ACM_Chatterjee.pdf 6.94 MB [Submitted Version]

Conference Paper | Published | English

Scopus indexed
Author
Chatterjee, KrishnenduISTA ; Goharshady, AmirISTA ; Goharshady, Ehsan Kafshdar

Corresponding author has ISTA affiliation

Department
Abstract
Smart contracts are programs that are stored and executed on the Blockchain and can receive, manage and transfer money (cryptocurrency units). Two important problems regarding smart contracts are formal analysis and compiler optimization. Formal analysis is extremely important, because smart contracts hold funds worth billions of dollars and their code is immutable after deployment. Hence, an undetected bug can cause significant financial losses. Compiler optimization is also crucial, because every action of a smart contract has to be executed by every node in the Blockchain network. Therefore, optimizations in compiling smart contracts can lead to significant savings in computation, time and energy. Two classical approaches in program analysis and compiler optimization are intraprocedural and interprocedural analysis. In intraprocedural analysis, each function is analyzed separately, while interprocedural analysis considers the entire program. In both cases, the analyses are usually reduced to graph problems over the control flow graph (CFG) of the program. These graph problems are often computationally expensive. Hence, there has been ample research on exploiting structural properties of CFGs for efficient algorithms. One such well-studied property is the treewidth, which is a measure of tree-likeness of graphs. It is known that intraprocedural CFGs of structured programs have treewidth at most 6, whereas the interprocedural treewidth cannot be bounded. This result has been used as a basis for many efficient intraprocedural analyses. In this paper, we explore the idea of exploiting the treewidth of smart contracts for formal analysis and compiler optimization. First, similar to classical programs, we show that the intraprocedural treewidth of structured Solidity and Vyper smart contracts is at most 9. Second, for global analysis, we prove that the interprocedural treewidth of structured smart contracts is bounded by 10 and, in sharp contrast with classical programs, treewidth-based algorithms can be easily applied for interprocedural analysis. Finally, we supplement our theoretical results with experiments using a tool we implemented for computing treewidth of smart contracts and show that the treewidth is much lower in practice. We use 36,764 real-world Ethereum smart contracts as benchmarks and find that they have an average treewidth of at most 3.35 for the intraprocedural case and 3.65 for the interprocedural case.
Publishing Year
Date Published
2019-04-01
Proceedings Title
Proceedings of the 34th ACM Symposium on Applied Computing
Publisher
ACM
Volume
Part F147772
Page
400-408
Conference
SAC: Symposium on Applied Computing
Conference Location
Limassol, Cyprus
Conference Date
2019-04-08 – 2019-04-12
IST-REx-ID

Cite this

Chatterjee K, Goharshady AK, Goharshady EK. The treewidth of smart contracts. In: Proceedings of the 34th ACM Symposium on Applied Computing. Vol Part F147772. ACM; 2019:400-408. doi:10.1145/3297280.3297322
Chatterjee, K., Goharshady, A. K., & Goharshady, E. K. (2019). The treewidth of smart contracts. In Proceedings of the 34th ACM Symposium on Applied Computing (Vol. Part F147772, pp. 400–408). Limassol, Cyprus: ACM. https://doi.org/10.1145/3297280.3297322
Chatterjee, Krishnendu, Amir Kafshdar Goharshady, and Ehsan Kafshdar Goharshady. “The Treewidth of Smart Contracts.” In Proceedings of the 34th ACM Symposium on Applied Computing, Part F147772:400–408. ACM, 2019. https://doi.org/10.1145/3297280.3297322.
K. Chatterjee, A. K. Goharshady, and E. K. Goharshady, “The treewidth of smart contracts,” in Proceedings of the 34th ACM Symposium on Applied Computing, Limassol, Cyprus, 2019, vol. Part F147772, pp. 400–408.
Chatterjee K, Goharshady AK, Goharshady EK. 2019. The treewidth of smart contracts. Proceedings of the 34th ACM Symposium on Applied Computing. SAC: Symposium on Applied Computing vol. Part F147772, 400–408.
Chatterjee, Krishnendu, et al. “The Treewidth of Smart Contracts.” Proceedings of the 34th ACM Symposium on Applied Computing, vol. Part F147772, ACM, 2019, pp. 400–08, doi:10.1145/3297280.3297322.
All files available under the following license(s):
Copyright Statement:
This Item is protected by copyright and/or related rights. [...]
Main File(s)
File Name
Access Level
OA Open Access
Date Uploaded
2020-05-14
MD5 Checksum
dddc20f6d9881f23b8755eb720ec9d6f


Material in ISTA:
Dissertation containing ISTA record

Export

Marked Publications

Open Data ISTA Research Explorer

Web of Science

View record in Web of Science®

Search this title in

Google Scholar
ISBN Search