IST PubRep
Not a member yet
752 research outputs found
Sort by
The Treewidth of Smart Contracts
Smart contracts are programs that are stored and executed on the Blockchain and can receive, manage and transfer money in the form of 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 potentially cause significant financial losses. Compiler optimization is also crucial, because every action of a smart contract has to be executed and verified by every node in the Blockchain network. Hence, optimizations in compiling smart contracts can lead to significant savings of computation, time and energy.
Two classical approaches in both 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, optimization and analysis problems are often reduced to graph problems over the control flow graph (CFG) of the program. However, the resulting graph problems are often computationally expensive. Hence, there has been ample research on exploiting structural properties of CFGs to obtain efficient algorithms for these problems. One well-studied structural property is the treewidth. Treewidth is a measure of tree-likeness of graphs and small treewidth can be exploited for efficient algorithms. It is known that intraprocedural CFGs of structured programs have treewidth at most 6, whereas the interprocedural treewidth cannot be bounded. Bounded treewidth 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
Fixation probability and fixation time in structured populations
The rate of biological evolution depends on the fixation probability and on the fixation time of new mutants. Intensive research has focused on identifying population structures that augment the fixation probability of advantageous mutants. But these “amplifiers of natural selection” typically increase fixa- tion time. Here we study population structures that achieve a tradeoff between fixation probability and time. First, we show that no amplifiers can have a significantly lower fixation time than the well-mixed population. Then we design population structures that substantially augment the fixation probability with just a minor increase in fixation time. Finally, we show that those structures enable higher effective rate of evolution than the well-mixed population provided that the rate of generating advantageous mu- tants is relatively low. Our work sheds light on how population structure affects the rate of evolution. Moreover, our structures could be useful for lab-based, medical or industrial applications of evolutionary optimization