Zum Inhalt

A Max-SMT Superoptimizer for EVM handling Memory and Storage

  • Open Access
  • 2022
  • OriginalPaper
  • Buchkapitel
Erschienen in:
loading …

Zusammenfassung

Superoptimization is a compilation technique that searches for the optimal sequence of instructions semantically equivalent to a given (loop-free) initial sequence. With the advent of SMT solvers, it has been successfully applied to LLVM code (to reduce the number of instructions) and to Ethereum EVM bytecode (to reduce its gas consumption). Both applications, when proven practical, have left out memory operations and thus missed important optimization opportunities. A main challenge to superoptimization today is handling memory operations while remaining scalable. We present $$\textsf {GASOL}^{v2}$$ GASOL v 2 , a gas and bytes-size superoptimization tool for Ethereum smart contracts, that leverages a previous Max-SMT approach for only stack optimization to optimize also wrt. memory and storage. $$\textsf {GASOL}^{v2}$$ GASOL v 2 can be used to optimize the size in bytes, aligned with the optimization criterion used by the Solidity compiler solc, and it can also be used to optimize gas consumption. Our experiments on 12,378 blocks from 30 randomly selected real contracts achieve gains of 16.42% in gas wrt. the previous version of the optimizer without memory handling, and gains of 3.28% in bytes-size over code already optimized by solc.

Titel
A Max-SMT Superoptimizer for EVM handling Memory and Storage
Verfasst von
Elvira Albert
Pablo Gordillo
Alejandro Hernández-Cerezo
Albert Rubio
Copyright-Jahr
2022
DOI
https://doi.org/10.1007/978-3-030-99524-9_11
    Bildnachweise
    AvePoint Deutschland GmbH/© AvePoint Deutschland GmbH, NTT Data/© NTT Data, Wildix/© Wildix, arvato Systems GmbH/© arvato Systems GmbH, Ninox Software GmbH/© Ninox Software GmbH, Nagarro GmbH/© Nagarro GmbH, GWS mbH/© GWS mbH, CELONIS Labs GmbH, USU GmbH/© USU GmbH, G Data CyberDefense/© G Data CyberDefense, Vendosoft/© Vendosoft, Deutsche Telekom MMS GmbH/© Vendosoft, Noriis Network AG/© Noriis Network AG, ams.solutions GmbH/© ams.solutions GmbH, Ferrari electronic AG/© Ferrari electronic AG, Asseco Solutions AG/© Asseco Solutions AG, AFB Gemeinnützige GmbH/© AFB Gemeinnützige GmbH, Haufe Group SE/© Haufe Group SE, Doxee AT GmbH/© Doxee AT GmbH , Videocast 1: Standbild/© Springer Fachmedien Wiesbaden, KI-Wissen für mittelständische Unternehmen/© Dell_Getty 1999938268, IT-Director und IT-Mittelstand: Ihre Webinar-Matineen /© da-kuk / Getty Images / iStock