Skip to content

Local storage pointers and inheritance #47

Open
@hajduakos

Description

@hajduakos

Depending on the target of verification, the postcondition of setB0 might or might not hold.

pragma solidity >=0.5.0;

contract A {
  struct S {
      int x;
  }
  function setA0(S storage s_ptr) internal {
    s_ptr.x = 0;
  }
}

contract B is A {
  S s;
  /// @notice postcondition s.x == 0
  function setB0(S storage s_ptr) internal {
    setA0(s_ptr);
  }
}

contract LocalStorageSpec is B {
  S s;
  function setC0(S storage s_ptr) internal {
    setB0(s_ptr);
  }
  function() external payable {
    setC0(s);
    assert(s.x == 0);
  }

}

If we only target B without C, it should hold. Otherwise it should not.

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