Skip to main content
QUICK REVIEW

[Paper Review] Tezla, an Intermediate Representation for Static Analysis of Michelson Smart Contracts

João Santos Reis, Paul Crocker|arXiv (Cornell University)|Jan 1, 2020
Blockchain Technology Applications and SecurityComputer Science11 references4 citations
TL;DR

This paper introduces Tezla, a store-based intermediate representation (IR) for Michelson smart contracts that preserves semantics, control flow, and gas consumption. By translating stack-based Michelson code into a static single assignment (SSA) form with explicit variable assignments and φ-functions, Tezla enables effective static analysis using existing program analysis frameworks, as demonstrated by a case study integrating Tezla with the SoftCheck platform to verify non-trivial properties like sign analysis.

ABSTRACT

This paper introduces Tezla, an intermediate representation of Michelson smart contracts that eases the design of static smart contract analysers. This intermediate representation uses a store and preserves the semantics, ow and resource usage of the original smart contract. This enables properties like gas consumption to be statically verified. We provide an automated decompiler of Michelson smart contracts to Tezla. In order to support our claim about the adequacy of Tezla, we develop a static analyser that takes advantage of the Tezla representation of Michelson smart contracts to prove simple but non-trivial properties.

Motivation & Objective

  • To address the lack of effective static analysis support for Michelson, a stack-based language used in Tezos smart contracts.
  • To bridge the gap between Michelson's stack-based model and existing static analysis tools, which are typically designed for store-based, SSA-form languages.
  • To enable formal verification of properties such as gas consumption and resource usage in Michelson contracts through a semantically faithful IR.
  • To provide a reusable, automated decompiler from Michelson to Tezla that maintains correctness and resource semantics.
  • To demonstrate the feasibility of using Tezla as a foundation for principled static analysis platforms in the Tezos ecosystem.

Proposed method

  • Tezla translates Michelson stack operations into variable assignments, replacing stack manipulation with explicit store-based operations.
  • Push-like instructions are converted into variable assignments, while stack-consuming operations become function calls with variable arguments.
  • Branching constructs like IF_CONS and IF_NONE are modeled using φ-functions to maintain SSA form and track control flow.
  • Looping constructs such as LOOP_LEFT are encoded using φ-functions to preserve SSA semantics across loop iterations.
  • Gas consumption is explicitly modeled in the Tezla semantics, enabling static verification of resource usage.
  • An automated decompiler from Michelson to Tezla is implemented, preserving semantics, control flow, and resource usage.

Experimental results

Research questions

  • RQ1Can a store-based intermediate representation be effectively used to model the semantics of stack-based Michelson smart contracts while preserving control flow and resource usage?
  • RQ2How can static single assignment (SSA) form be naturally enforced in a representation derived from a stack-based language like Michelson?
  • RQ3To what extent can existing static analysis frameworks be adapted to analyze Michelson contracts via a semantically faithful IR like Tezla?
  • RQ4Can Tezla support the verification of non-trivial properties such as sign analysis and gas consumption in Michelson contracts?
  • RQ5How can entrypoint polymorphism in Michelson contracts be modeled and analyzed in Tezla to improve modularity and analysis precision?

Key findings

  • The Tezla representation successfully translates Michelson smart contracts into a store-based, SSA-form intermediate representation that preserves the original semantics and control flow.
  • The decompiler from Michelson to Tezla maintains gas consumption semantics, enabling static verification of resource usage.
  • The case study demonstrates that Tezla enables the application of static analysis techniques—such as sign analysis—on Michelson contracts using the SoftCheck platform.
  • The use of φ-functions in Tezla allows for precise modeling of branching and looping constructs, including list deconstruction and iteration.
  • The analysis results show that Tezla supports the generation of clear control-flow graphs and enables the detection of properties like variable sign and resource usage.
  • The authors confirm that Tezla is a viable foundation for principled static analysis of Michelson contracts, with plans to formalize its resource semantics and integrate with existing verification platforms.

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.