From 4c4421dd8ac2e0c1cd246feb30e692a421ee4a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Mon, 16 Sep 2024 15:09:26 +0200 Subject: [PATCH] Adjust test to match new `selfdestruct` behavior --- src/test/Tests/Integration.hs | 2 +- tests/solidity/basic/killed.sol | 3 ++- tests/solidity/basic/killed.yaml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 tests/solidity/basic/killed.yaml diff --git a/src/test/Tests/Integration.hs b/src/test/Tests/Integration.hs index 6abc27f79..4152363ae 100644 --- a/src/test/Tests/Integration.hs +++ b/src/test/Tests/Integration.hs @@ -92,7 +92,7 @@ integrationTests = testGroup "Solidity Integration Testing" ] , testContract "basic/gaslimit.sol" Nothing [ ("echidna_gaslimit passed", passed "echidna_gaslimit") ] - , testContractV "basic/killed.sol" (Just (< solcV (0,8,0))) Nothing + , testContractV "basic/killed.sol" (Just (< solcV (0,8,0))) (Just "basic/killed.yaml") [ ("echidna_still_alive failed", solved "echidna_still_alive") ] , checkConstructorConditions "basic/codesize.sol" "invalid codesize" diff --git a/tests/solidity/basic/killed.sol b/tests/solidity/basic/killed.sol index 8f21d8a32..90983a9a9 100644 --- a/tests/solidity/basic/killed.sol +++ b/tests/solidity/basic/killed.sol @@ -1,4 +1,5 @@ contract C { + constructor() public payable {} uint private state = 0; function f(uint x) public { @@ -11,7 +12,7 @@ contract C { } function echidna_still_alive() public returns (bool) { - return true; + return address(this).balance > 0; } function echidna_revert_still_alive() public returns (bool) { diff --git a/tests/solidity/basic/killed.yaml b/tests/solidity/basic/killed.yaml new file mode 100644 index 000000000..2bac55777 --- /dev/null +++ b/tests/solidity/basic/killed.yaml @@ -0,0 +1 @@ +balanceContract: 100