Ensuring Gas Optimisation Correctness by Behavioural Equivalence

Gas consumption has a financial impact on executing Ethereum smart contracts, making gas optimisation an essential development concern. Although several optimisation techniques exist, applying them can alter contract behaviour, compromising correctness or introducing vulnerabilities. This work introduces a formal verification framework to ensure that gas-optimised contracts remain behaviourally equivalent to their originals. Our approach relies on the Certora Prover to mechanise correctness checking: a transformation rule is selected from our catalogue, applied to a Solidity contract, and verified in Certora. If an optimisation violates equivalence, counterexamples guide a diagnosis and correction. To support practical adoption, we compiled a catalogue of 31 gas-saving transformation rules, each featuring a formal pattern and an example alongside a Certora specification for automated verification. Building this catalogue revealed that two previously published optimisations require updates for Solidity 0.8.0 or superior. To evaluate practical applicability, we conducted a case study on the widely-adopted AAVE V3 DeFi protocol, applying our refinement-based methodology to formally prove the behavioural equivalence of optimised versions against the original. Although not fully automated, the framework is mostly mechanisable. Our results demonstrate that combining formal verification with gas-optimisation strategies is both feasible and effective for real-world smart contracts.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-11-12
DOI
https://doi.org/10.1145/3859488
Primary Topic
Logic, programming, and type systems
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Ensuring Gas Optimisation Correctness by Behavioural Equivalence

Juliano Iyoda, Alexandre Mota, Márcio Cornélio, Manoel Villarim
ACM Transactions on Software Engineering and Methodology
Logic, programming, and type systems
article

Ensuring Gas Optimisation Correctness by Behavioural Equivalence

Juliano Iyoda, Alexandre Mota, Márcio Cornélio, Manoel Villarim
article en

Abstract

Gas consumption has a financial impact on executing Ethereum smart contracts, making gas optimisation an essential development concern. Although several optimisation techniques exist, applying them can alter contract behaviour, compromising correctness or introducing vulnerabilities. This work introduces a formal verification framework to ensure that gas-optimised contracts remain behaviourally equivalent to their originals. Our approach relies on the Certora Prover to mechanise correctness checking: a transformation rule is selected from our catalogue, applied to a Solidity contract, and verified in Certora. If an optimisation violates equivalence, counterexamples guide a diagnosis and correction. To support practical adoption, we compiled a catalogue of 31 gas-saving transformation rules, each featuring a formal pattern and an example alongside a Certora specification for automated verification. Building this catalogue revealed that two previously published optimisations require updates for Solidity 0.8.0 or superior. To evaluate practical applicability, we conducted a case study on the widely-adopted AAVE V3 DeFi protocol, applying our refinement-based methodology to formally prove the behavioural equivalence of optimised versions against the original. Although not fully automated, the framework is mostly mechanisable. Our results demonstrate that combining formal verification with gas-optimisation strategies is both feasible and effective for real-world smart contracts.

ACM Transactions on Software Engineering and Methodology
Universidade Federal de Pernambuco (BR)
Conselho Nacional de Desenvolvimento Científico e Tecnológico, Instituto Nacional de Ciência e Tecnologia para Engenharia de Software
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon