Skip to content

Modifies specs for libraries with local storage pointers #82

Open
@hajduakos

Description

@hajduakos

While we can add specs to libraries with local storage pointers, modifies specs are not yet working for them, because they are bound to state variables. Seems to be extendable to function parameters with local storage type, but requires a few hours.

Currently we show a warning that it is ignored:

$ cat Test.sol && solc-verify.py Test.sol --show-warnings
pragma solidity>=0.5.0;

library Test {
    struct S {
        int x;
    }

    /// @notice modifies self.x if y > 0
    function f(S storage self, int y) public {
        if (y > 0) self.x += y;
    }
}

Test.sol:9:5: solc-verify warning: Modifies specification for non-state variable 'self' ignored
solc-verify warning: Balance modifications due to gas consumption or miner rewards are not modeled
Test::f: OK
Test::[implicit_constructor]: OK
No errors found.

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