Taming callbacks for smart contract modularity

Elvira Albert, Shelly Grossman, Noam Rinetzky, Clara Rodríguez-Núñez, Albert Rubio, Mooly Sagiv

Research output: Contribution to journalArticlepeer-review

14 Scopus citations


Callbacks are an effective programming discipline for implementing event-driven programming, especially in environments like Ethereum which forbid shared global state and concurrency. Callbacks allow a callee to delegate the execution back to the caller. Though effective, they can lead to subtle mistakes principally in open environments where callbacks can be added in a new code. Indeed, several high profile bugs in smart contracts exploit callbacks. We present the first static technique ensuring modularity in the presence of callbacks and apply it to verify prominent smart contracts. Modularity ensures that external calls to other contracts cannot affect the behavior of the contract. Importantly, modularity is guaranteed without restricting programming. In general, checking modularity is undecidable-even for programs without loops. This paper describes an effective technique for soundly ensuring modularity harnessing SMT solvers. The main idea is to define a constructive version of modularity using commutativity and projection operations on program segments. We believe that this approach is also accessible to programmers, since counterexamples to modularity can be generated automatically by the SMT solvers, allowing programmers to understand and fix the error. We implemented our approach in order to demonstrate the precision of the modularity analysis and applied it to real smart contracts, including a subset of the 150 most active contracts in Ethereum. Our implementation decompiles bytecode programs into an intermediate representation and then implements the modularity checking using SMT queries. Overall, we argue that our experimental results indicate that the method can be applied to many realistic contracts, and that it is able to prove modularity where other methods fail.

Original languageEnglish
Article number209
JournalProceedings of the ACM on Programming Languages
Issue numberOOPSLA
StatePublished - 13 Nov 2020


FundersFunder number
Israeli Science Foundation1810/18
British Skin Foundation2016260
United States-Israel Binational Science Foundation
Israel Science Foundation1996/18
Tel Aviv University
European Regional Development FundRTI2018-094403-B-C31, S2018/TCS-4314
PAZY Foundation347853669
Agencia Estatal de Investigación


    • blockchain
    • invariants
    • logic and verification
    • program analysis
    • program verification
    • smart contracts


    Dive into the research topics of 'Taming callbacks for smart contract modularity'. Together they form a unique fingerprint.

    Cite this