Skip to content

Commit

Permalink
Fix test failures due to Z3 v4.12 (#167)
Browse files Browse the repository at this point in the history
* gitignore: Ignore 'maat_state_*' files from tests

* Fix test failures due to Z3 4.12

Upgrading Z3 causes test failures due to incomplete model for all
expected variables. Previous versions reported values for all variables,
but now tests should check whether a value has been assigned before
testing the value.

* Don't fail fast matrix
  • Loading branch information
ekilmer authored Apr 4, 2023
1 parent 3087078 commit 4a37948
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:

test:
strategy:
fail-fast: false
matrix:
os: [
# TODO: windows,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cmake-build-*/
prefix/
CMakeLists.txt.user
CMakeUserPresets.json
maat_state_*
9 changes: 5 additions & 4 deletions tests/adv-tests/test_evm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ int solve_symbolic_storage()
sol->add(v == 2);
nb += _assert(sol->check(), "Couldn't find model to solve symbolic storage read");
auto model = sol->get_model();
nb += _assert(model->get_as_number("b").equal_to(model->get_as_number("d")), "Got wrong model when solving symbolic storage");
nb += _assert(not model->get_as_number("c").equal_to(model->get_as_number("d")), "Got wrong model when solving symbolic storage");
nb += _assert(not model->contains("a") or not model->get_as_number("a").equal_to(model->get_as_number("d")), "Got wrong model when solving symbolic storage a == d");
nb += _assert(model->get_as_number("b").equal_to(model->get_as_number("d")), "Got wrong model when solving symbolic storage b != d");
nb += _assert(not model->contains("c") or not model->get_as_number("c").equal_to(model->get_as_number("d")), "Got wrong model when solving symbolic storage c == d");

// Write concrete, read symbolic
contract.storage->write(Value(256, 0xaaaa), Value(256, 5), s);
Expand All @@ -70,8 +71,8 @@ int solve_symbolic_storage()
nb += _assert(sol->check(), "Couldn't find model to solve symbolic storage read");
model = sol->get_model();
nb += _assert(model->get_as_number("a").equal_to(Number(256, 0xdedede)), "Got wrong model when solving symbolic storage");
nb += _assert(not model->get_as_number("b").equal_to(Number(256, 0xdedede)), "Got wrong model when solving symbolic storage");
nb += _assert(not model->get_as_number("c").equal_to(Number(256, 0xdedede)), "Got wrong model when solving symbolic storage");
nb += _assert(not model->contains("b") or not model->get_as_number("b").equal_to(Number(256, 0xdedede)), "Got wrong model when solving symbolic storage");
nb += _assert(not model->contains("c") or not model->get_as_number("c").equal_to(Number(256, 0xdedede)), "Got wrong model when solving symbolic storage");

// Overwrite symbolic address
contract.storage->write(Value(exprvar(256, "a")), Value(256, 15), s);
Expand Down

0 comments on commit 4a37948

Please sign in to comment.