4 questions to test your understanding
The 'reentrancy bug' in the DAO contract (2016) allowed an attacker to withdraw funds repeatedly. In pseudo-code: function withdraw(amount) { if (balance[msg.sender] >= amount) { call(msg.sender).send(amount); balance[msg.sender] -= amount; } }. Why is this vulnerable?
A formal specification for a smart contract token might state: 'the total supply of tokens is immutable — the sum of all balances equals the initial supply.' How would you formally verify this invariant?
Contracts interact with other contracts through external calls. If contract A calls contract B, and B calls back to A, how does formal verification ensure no reentrancy occurs?
Many contract verification efforts focus on 'functional correctness' (the contract does what it's supposed to do) but overlook 'economic properties' (incentives are sound). Why is verifying economic properties harder?