Solidity is the most widely used smart contract language on the blockchain. As smart contracts are critical software handling a lot of money, there is a huge interest in finding all possible bugs before putting them into production.
For a Solidity function we can state a rule about storage before and after a call. A proof can establish that rule for every call satisfying its hypotheses, even when testing every input would be impractical.
In this blog post, we present the formal verification tool coq-of-solidity that we are developing for Solidity. Its specificities are that:
- It is open-source (GPL-3 for the translation, MIT for the proofs).
- It uses an interactive theorem prover, the system Coq, to state properties and guide proofs interactively.
Here, we present how we translate Solidity code into Coq using the intermediate language Yul. We explain the semantics we use and what remains to be done.
The code is available in our fork of the Solidity compiler at github.com/formal-land/coq-of-solidity.