Skip to content

Why the following rule passes? #45

@iirekm

Description

@iirekm
methods {
    function balances(address a) external returns(uint) envfree;
}

rule sameValue {
    method f;
    env e;
    calldataarg a;    
    mathint initValue = nativeBalances[e.msg.sender] + balances(e, e.msg.sender);
    f(e, a);
    assert initValue == nativeBalances[e.msg.sender] + balances(e, e.msg.sender);
}
// SPDX-License-Identifier: UNKNOWN 
pragma solidity ^0.8.30;
contract Vault {
    mapping(address => uint) public balances;

    function deposit() external payable {     
        //balances[msg.sender] += msg.value;
    }
}

The code contains and obvious bug (balances not updated, but certoraRun happily accepts it!!!
It's either a bug in the prover, or a bug in my rule - in the second case sanity checker should detect it but doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions