Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent test results in a simple contract (2) #51

Closed
ggrieco-tob opened this issue May 18, 2018 · 5 comments
Closed

Inconsistent test results in a simple contract (2) #51

ggrieco-tob opened this issue May 18, 2018 · 5 comments

Comments

@ggrieco-tob
Copy link
Member

In this simple contract:

contract A {}

contract B {
  function f() {
    return;
  }
}
 
contract TEST {

  A[] private xs;
  B b = new B(); 
 
  function g() public {
    return;
  }

  //function add() {
  //  xs.push(new A());
  //}

  function echidna_true() returns (bool) {
    b.f();
    return true;
  }
}

the echidna_true test cannot fail and Echida works as expected. However it reports a failed test when you uncomment the add() function. For instance:

$ echidna-test test.sol test.sol:TEST
━━━ test.sol ━━━
  ✗ "echidna_true" failed after 2 tests.
  
    │ Call sequence: add();
  
  ✗ 1 failed.
@blperez01
Copy link
Contributor

blperez01 commented May 24, 2018

Weird aspect of this bug, the following function fails:

  function echidna_true() returns (bool) {
    xs.push(new A());
    b.f();
    return true;
  }

But switching the order of the push and call to f() works

  function echidna_true() returns (bool) {
    b.f();
    xs.push(new A());
    return true;
  }

(this is all assuming the add function is commented out)

@ggrieco-tob
Copy link
Member Author

A simplified version of this example:

contract B {
  int x;
  function f() returns (int) {
    return x;
  }
}

contract TEST {

  B b = new B();

  function g() public {
    return;
  }

  function echidna_true() returns (bool) {
    var x = b.f();
    return true;
  }
}

@ggrieco-tob
Copy link
Member Author

Using the last release of hevm (available in branch updated-hevm) solves this issue!

@ggrieco-tob
Copy link
Member Author

@andremarianiello created PR #141 to migrate to hevm-0.21 using stack. It should solve this issue.

@ggrieco-tob
Copy link
Member Author

Not longer failing in master, since we are using hevm-0.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants