Lolisa: Formal Syntax and Semantics for a Subset of the Solidity Programming Language

This article presents the formal syntax and semantics for a large subset of the Solidity programming language developed for the Etheruem blockchain platform based on our resent work about developing a general, extensible, and reusable formal memory (GERM) framework and an extension of Curry-Howard isomorphism, denoted as execution-verification isomorphism (EVI). This subset is denoted as Lolisa, which, to our knowledge, is the first mechanized and validated formal syntax and semantics developed for Solidity. The formal syntax of Lolisa adopts a stronger static type system than Solidity for enhanced type safety. In addition, Lolisa not only includes nearly all the syntax components of Solidity, such as mapping, modifier, contract, and address types, but it also contains general-purpose programming language features, such as multiple return values, pointer arithmetic, struct, and field access. Therefore, the inherent compatibility of Lolisa allows Solidity programs to be directly translated into Lolisa with a line-by-line correspondence without rebuilding or abstracting, and, in addition, the inherent generality of Lolisa allows it to be extended to express other programming languages as well. To this end, we also present a preliminary scheme for extending Lolisa to other languages systematically.

[1]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[2]  Satoshi Nakamoto Bitcoin : A Peer-to-Peer Electronic Cash System , 2009 .

[3]  ParkDaejun,et al.  KJS: a complete formal semantics of JavaScript , 2015 .

[4]  Andrew W. Appel,et al.  Verified Software Toolchain , 2012, NASA Formal Methods.

[5]  Hang Lei,et al.  A general formal memory framework in Coq for verifying the properties of programs based on higher-order logic theorem proving with increased automation, consistency, and reusability , 2018, ArXiv.

[6]  Prateek Saxena,et al.  Making Smart Contracts Smarter , 2016, IACR Cryptol. ePrint Arch..

[7]  Hang Lei,et al.  FEther: An Extensible Definitional Interpreter for Smart-Contract Verifications in Coq , 2018, IEEE Access.

[8]  Michael Norrish C formalised in HOL , 1998 .

[9]  Philip Wadler,et al.  Monads for functional programming , 1995, NATO ASI PDC.

[10]  Nishant Rodrigues,et al.  KEVM: A Complete Semantics of the Ethereum Virtual Machine , 2017 .

[11]  Ilya Sergey,et al.  Scilla: a Smart Contract Intermediate-Level LAnguage , 2018, ArXiv.

[12]  Daniel Davis Wood,et al.  ETHEREUM: A SECURE DECENTRALISED GENERALISED TRANSACTION LEDGER , 2014 .

[13]  Xavier Leroy,et al.  Mechanized Semantics for the Clight Subset of the C Language , 2009, Journal of Automated Reasoning.

[14]  Hendrik Tews,et al.  A Formal Model of Memory Peculiarities for the Verification of Low-Level Operating-System Code , 2008, SSV.

[15]  Arvind Narayanan,et al.  Bitcoin and Cryptocurrency Technologies - A Comprehensive Introduction , 2016 .

[16]  Irem Demirkan,et al.  Blockchain technology in the future of business cyber security and accounting , 2020 .

[17]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Inf. Comput..

[18]  Yoichi Hirai,et al.  Defining the Ethereum Virtual Machine for Interactive Theorem Provers , 2017, Financial Cryptography Workshops.

[19]  N. Xiong,et al.  A Distributed Privacy Preservation Approach for Big Data in Public Health Emergencies Using Smart Contract and SGX , 2020, Computers, Materials & Continua.

[20]  George C. Necula,et al.  CCured in the real world , 2003, PLDI '03.

[21]  Karl Crary,et al.  Understanding and evolving the ml module system , 2005 .

[22]  Don Syme,et al.  Proving Java Type Soundness , 1999, Formal Syntax and Semantics of Java.

[23]  Shawn Wilkinson,et al.  Storj A Peer-to-Peer Cloud Storage Network , 2014 .

[24]  Nikhil Swamy,et al.  Formal Verification of Smart Contracts: Short Paper , 2016, PLAS@CCS.

[25]  Ankur Taly,et al.  An Operational Semantics for JavaScript , 2008, APLAS.

[26]  Gang Chen,et al.  Guarded recursive datatype constructors , 2003, POPL '03.

[27]  Hang Lei,et al.  A Hybrid Formal Verification System in Coq for Ensuring the Reliability and Security of Ethereum-Based Service Smart Contracts , 2019, IEEE Access.

[28]  Glynn Winskel,et al.  The formal semantics of programming languages - an introduction , 1993, Foundation of computing series.

[29]  Aron Laszka,et al.  Tool Demonstration: FSolidM for Designing Secure Ethereum Smart Contracts , 2018, POST.

[30]  Sidney Amani,et al.  Towards verifying ethereum smart contract bytecode in Isabelle/HOL , 2018, CPP.

[31]  Robert Edström,et al.  Safer smart contracts through type-driven development , 2016 .

[32]  Yu Guo,et al.  Deep Specifications and Certified Abstraction Layers , 2015, POPL.