Skip to main content
QUICK REVIEW

[Paper Review] GASTAP: A Gas Analyzer for Smart Contracts.

Elvira Albert, Pablo Gordillo|arXiv (Cornell University)|Nov 22, 2018
Security and Verification in ComputingComputer Science13 references17 citations
TL;DR

GASTAP is a static analysis platform that automatically infers sound upper bounds on gas consumption for Ethereum smart contract functions, supporting EVM, disassembled EVM, and Solidity inputs. By ensuring gas limits exceed these bounds, it guarantees contracts are free from out-of-gas vulnerabilities.

ABSTRACT

Gas is a measurement unit of the computational effort that it will take to execute every single operation that takes part in the Ethereum blockchain platform. Each instruction executed by the Ethereum Virtual Machine (EVM) has an associated gas consumption specified by Ethereum. If a transaction exceeds the amount of gas allotted by the user (known as gas limit), an out-of-gas exception is raised. There is a wide family of contract vulnerabilities due to out-of-gas behaviours. We report on the design and implementation of GASTAP, a Gas-Aware Smart contracT Analysis Platform, which takes as input a smart contract (either in EVM, disassembled EVM, or in Solidity source code) and automatically infers sound gas upper bounds for all its public functions. Our bounds ensure that if the gas limit paid by the user is higher than our inferred gas bounds, the contract is free of out-of-gas vulnerabilities.

Motivation & Objective

  • To address the widespread problem of out-of-gas vulnerabilities in Ethereum smart contracts caused by insufficient gas limits.
  • To design and implement a gas-aware static analysis platform that computes precise, sound upper bounds on gas usage for all public contract functions.
  • To support multiple input formats—EVM bytecode, disassembled EVM, and Solidity source code—enabling broad usability.
  • To ensure that if a user's gas limit exceeds the inferred bound, the contract will not fail due to gas exhaustion.
  • To provide a formally sound and scalable solution for verifying gas safety in smart contracts prior to deployment.

Proposed method

  • The platform performs static analysis on smart contract code in EVM, disassembled EVM, or Solidity source form to compute gas usage bounds.
  • It uses symbolic execution and control-flow analysis to track gas consumption across all possible execution paths.
  • Gas consumption is modeled per EVM instruction, with each opcode assigned a fixed gas cost as defined by the Ethereum specification.
  • The analysis computes the maximum gas usage for each public function by aggregating gas costs along all feasible paths.
  • Sound upper bounds are synthesized to guarantee that no execution path exceeds the computed limit.
  • The platform integrates with existing smart contract development and verification pipelines for practical deployment.

Experimental results

Research questions

  • RQ1Can a static analysis platform accurately infer sound upper bounds on gas consumption for Ethereum smart contract functions?
  • RQ2How effective is the platform in detecting potential out-of-gas vulnerabilities before contract deployment?
  • RQ3To what extent can the platform handle diverse input representations, including EVM bytecode and high-level Solidity code?
  • RQ4What is the precision and scalability of the gas bound inference across real-world smart contracts?
  • RQ5Can the inferred gas bounds be used to formally guarantee that a contract will not fail due to gas limit constraints?

Key findings

  • GASTAP successfully computes sound upper bounds on gas consumption for all public functions in a given smart contract, regardless of input format.
  • The inferred gas bounds are sufficient to guarantee that a transaction will not fail due to out-of-gas exceptions if the user's gas limit exceeds the bound.
  • The platform supports multiple input representations, including EVM bytecode, disassembled EVM, and Solidity source code, enabling broad compatibility.
  • The analysis is sound, ensuring that no execution path exceeds the computed gas bound, thus eliminating false negatives for out-of-gas vulnerabilities.
  • The platform enables formal verification of gas safety, providing a practical solution for preventing runtime gas-related failures.
  • The method scales effectively to real-world contracts, offering a deployable solution for smart contract developers.

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.