Skip to content

Conditional part of modifies should refer to old value #81

Open
@hajduakos

Description

@hajduakos

Currently, the if part of a modifies spec is directly translated into a postcondition, meaning that it will refer to the new values (unless manually adding old(...)). As discussed in #78, it should refer to the old values by default.

For example, this should not fail:

$ cat test.sol && solc-verify.py test.sol 
pragma solidity >=0.5.0;

contract Test {
    bool marked;

    /// @notice modifies marked if !marked
    function mark() public {
        require(!marked);
        marked = true;
    }
}
Test::mark: ERROR
 - test.sol:7:5: Function might modify 'marked' illegally
Test::[implicit_constructor]: OK
Use --show-warnings to see 1 warning.
Errors were found by the verifier.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions