Synthesis of Super-Optimized Smart Contracts Using Max-SMT

被引:23
作者
Albert, Elvira [1 ,2 ]
Gordillo, Pablo [2 ]
Rubio, Albert [1 ,2 ]
Schett, Maria A. [3 ]
机构
[1] Inst Tecnol Conocimiento, Madrid, Spain
[2] Univ Complutense Madrid, Madrid, Spain
[3] UCL, London, England
来源
COMPUTER AIDED VERIFICATION (CAV 2020), PT I | 2020年 / 12224卷
关键词
D O I
10.1007/978-3-030-53288-8_10
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
With the advent of smart contracts that execute on the blockchain ecosystem, a new mode of reasoning is required for developers that must pay meticulous attention to the gas spent by their smart contracts, as well as for optimization tools that must be capable of effectively reducing the gas required by the smart contracts. Super-optimization is a technique which attempts to find the best translation of a block of code by trying all possible sequences of instructions that produce the same result. This paper presents a novel approach for super-optimization of smart contracts based on Max-SMT which is split into two main phases: (i) the extraction of a stack functional specification from the basic blocks of the smart contract, which is simplified using rules that capture the semantics of the arithmetic, bit-wise, relational operations, etc. (ii) the synthesis of optimized blocks which, by means of an efficient Max-SMT encoding, finds the bytecode blocks with minimal gas cost whose stack functional specification is equal (modulo commutativity) to the extracted one. Our experimental results are very promising: we are able to optimize 55.41 % of the blocks, and prove that 34.28 % were already optimal, for more than 61 000 blocks from the most called 2500 Ethereum contracts.
引用
收藏
页码:177 / 200
页数:24
相关论文
共 23 条
  • [11] Ethereum, 2018, Solidity
  • [12] Grech N., 2018, P ACM PROGRAM LANG, V2, P1, DOI DOI 10.1145/3276486
  • [13] Unbounded Superoptimization
    Jangda, Abhinav
    Yorsh, Greta
    [J]. PROCEEDINGS OF THE 2017 ACM SIGPLAN INTERNATIONAL SYMPOSIUM ON NEW IDEAS, NEW PARADIGMS, AND REFLECTIONS ON PROGRAMMING AND SOFTWARE (ONWARD!'17), 2017, : 78 - 88
  • [14] Analyzing Ethereum's Contract Topology
    Kiffer, Lucianna
    Levin, Dave
    Mislove, Alan
    [J]. IMC'18: PROCEEDINGS OF THE INTERNET MEASUREMENT CONFERENCE, 2018, : 494 - 499
  • [15] Massalin H., 1987, Proceedings of the Second International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS II) (Cat. No.87CH2440-6), P122
  • [16] Mesnard F., 2019, LNCS, V11408, DOI [10.1007/978-3-030-13838-7, DOI 10.1007/978-3-030-13838-7]
  • [17] Mueller B, 2018, 9 ANN HITB SEC C
  • [18] Mukhopadhyay Mayukh., 2018, Ethereum Smart Contract Development: Build blockchain-based decentralized applications using solidity
  • [19] Nakamoto S., 2008, DECENTRALISED BUSINE, V21260
  • [20] Perez D., 2019, ABS190907220 CORR