We continue to strengthen the security of smart contracts with our tool coq-of-solidity π οΈ. It checks for vulnerabilities or bugs in Solidity code. It uses formal verification with an interactive theorem prover (CoqΒ π) to make sure that we cover:
- all possible user inputs/storage states, even if there are infinite possibilities,
- for any security properties.
This is very important as a single bug can lead to the loss of millions of dollars in smart contracts, as we have regularly seen in the past, and we can never be sure that a human review of the code did not miss anything.
Our tool coq-of-solidity
is one of the only tools using an interactive theorem prover for Solidity, together with Clear from Nethermind. This might be the most powerful approach to making code without bugs, as exemplified in this PLDI paper comparing the reliability of various C compilers. They found numerous bugs in each compiler except in the formally verified one!
In this blog post we show how we functionally specify and verify the _approve
function of an ERC-20 smart contract. We will see how we prove that a refined version of the function is equivalent to the original one.