Skip to content

Function calls in specifications (modifies, require, assert) #78

Open
@dddejan

Description

@dddejan

Using functions as getters is quite common and it would be good to support them in specs, such as modifies or require. The following currently fails for two reasons:

  1. modifies spec fails because it introduces new statements
  2. require just puts true in the assume
pragma solidity >=0.5.0;
contract Issue78 {
  bool b;
  function isSet() public view returns (bool set) {
    return b;
  }
  /// @notice modifies b if !isSet()
  function set() public {
    require(!isSet());
    b = true;
  }
}

Current output

solc-verify.py Issue78.sol 
Error while running compiler, details:
Warning: This is a pre-release compiler version, please do not use it in production.

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

======= Issue78.sol =======
Issue78.sol:12:3: solc-verify error: Annotation expression introduces intermediate statements
  function set() public {
  ^ (Relevant source part starts here and spans across multiple lines).
Issue78.sol:12:3: solc-verify error: Annotation expression introduces intermediate declarations
  function set() public {
  ^ (Relevant source part starts here and spans across multiple lines).
solc-verify warning: Balance modifications due to gas consumption or miner rewards are not modeled
Issue78.sol:12:3: solc-verify error: Error(s) while processing annotation for node
  function set() public {
  ^ (Relevant source part starts here and spans across multiple lines).

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