Skip to content

Comparing memory and storage values. #55

Open
@michael-emmi

Description

@michael-emmi

It’s not clear how we can state postconditions for functions which update storage with memory-typed arguments, as in the following example:

$ cat a.sol && solc-verify.py a.sol 
pragma solidity ^0.5.0;

contract A {
    uint[] public ary;

    /// @notice postcondition __verifier_eq(ary, a)
    function f(uint[] memory a) public {
        ary = a;
    }
}
Error while running compiler, details:
Warning: This is a pre-release compiler version, please do not use it in production.

======= Converting to Boogie IVL =======

======= a.sol =======
Annotation:1:1: solc-verify error: Arguments must have the same type
__verifier_eq(ary, a)
^-------------------^
a.sol:7:5: solc-verify error: Error(s) while processing annotation for node
    function f(uint[] memory a) public {
    ^ (Relevant source part starts here and spans across multiple lines).

Perhaps it could be possible to allow comparisons between values whose Boogie-encoded types are comparable? Or maybe some form of casting?

Metadata

Metadata

Assignees

No one assigned

    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