Skip to main content
QUICK REVIEW

[Paper Review] Executable Operational Semantics of Solidity

Jiao Jiao, Shuanglong Kan|arXiv (Cornell University)|Apr 4, 2018
Blockchain Technology Applications and SecurityComputer Science2 references10 citations
TL;DR

This paper presents the first executable structural operational semantics (SOS) for the Solidity programming language, formalized in the K framework to enable automated verification of smart contracts. By modeling Solidity's unique features—such as storage persistence, nested arrays, and fallback functions—it identifies critical design issues and detects vulnerabilities like reentrancy attacks, demonstrating that formal source-level semantics is essential for secure smart contract development.

ABSTRACT

Bitcoin has attracted everyone's attention and interest recently. Ethereum (ETH), a second generation cryptocurrency, extends Bitcoin's design by offering a Turing-complete programming language called Solidity to develop smart contracts. Smart contracts allow creditable execution of contracts on EVM (Ethereum Virtual Machine) without third parties. Developing correct smart contracts is challenging due to its decentralized computation nature. Buggy smart contracts may lead to huge financial loss. Furthermore, smart contracts are very hard, if not impossible, to patch once they are deployed. Thus, there is a recent surge of interest on analyzing/verifying smart contracts. While existing work focuses on EVM opcode, we argue that it is equally important to understand and define the semantics of Solidity since programmers program and reason about smart contracts at the level of source code. In this work, we develop the structural operational semantics for Solidity, which allows us to identify multiple design issues which underlines many problematic smart contracts. Furthermore, our semantics is executable in the K framework, which allows us to verify/falsify contracts automatically.

Motivation & Objective

  • To address the lack of formal, executable semantics for Solidity, the high-level language used to write Ethereum smart contracts.
  • To enable formal reasoning about smart contract behavior at the source code level, rather than relying on low-level EVM bytecode analysis.
  • To detect design flaws and vulnerabilities—such as unintended array behavior and reentrancy—through formal semantics.
  • To provide a formally verified, executable model of Solidity that is consistent with the official compiler and documentation.
  • To support automated verification and falsification of smart contracts using reachability logic in the K framework.

Proposed method

  • Developed a structural operational semantics (SOS) for Solidity, capturing key language features including storage, memory, and stack semantics.
  • Formalized the semantics in the K framework, enabling executable and machine-checkable reasoning about contract execution.
  • Modeled complex features such as nested arrays, function calls, fallback functions, and external calls with precise state transitions.
  • Integrated function parameter binding and condition checking via function qualifiers, ensuring correct execution context handling.
  • Used the K framework’s reachability logic prover to automatically verify or falsify contract properties.
  • Validated the semantics against the Remix compiler and official Solidity documentation to ensure consistency.

Experimental results

Research questions

  • RQ1How can Solidity’s semantics be formally and precisely defined at the source code level to support correct reasoning by developers?
  • RQ2What design-level issues in Solidity—such as array handling and fallback functions—lead to exploitable vulnerabilities in practice?
  • RQ3Can an executable semantics for Solidity detect known vulnerabilities like the DAO attack, even before deployment?
  • RQ4How consistent is the proposed semantics with the official Solidity compiler and documentation?
  • RQ5To what extent can the K framework’s reachability logic be used to automatically verify or falsify smart contract properties?

Key findings

  • The proposed executable semantics correctly models most core features of Solidity as specified in the official documentation and matches the behavior of the Remix compiler.
  • The formal model uncovered subtle but critical behaviors in Solidity, such as unexpected array modifications due to storage layout, which can lead to security vulnerabilities.
  • The semantics successfully detects reentrancy-style vulnerabilities, including variants of the DAO attack, by modeling function call and state transition behavior precisely.
  • The K framework’s reachability logic enables automated verification of contract correctness, allowing for falsification of incorrect assumptions.
  • The work demonstrates that source-level formal semantics is essential for reliable smart contract development, as low-level EVM analysis alone cannot capture high-level semantic intent.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.