-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update copytree * introduce solidity code * add some comments * comment * replace copy_tree by copytree for py3.12 * fix * dirs_exist_ok=True * delete test * fix copytree * provide `merge` option for `minimize_proof` * provide `Branches` contract for merging node testing * add a test for merging node * add arguments to the parser * test configuration for merging node * make format/check * submit the expected * fix for kompile * fix kompile * fix `cse tests` * fix * fix * add endmodule * fix constracts.k.expected * fix * fix * Update help message for node merging Co-authored-by: JianHong Zhao <[email protected]> --------- Co-authored-by: Palina <[email protected]>
- Loading branch information
1 parent
b642aab
commit 0493bd4
Showing
14 changed files
with
1,913 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MergeKCFGTest.test_branch_merge(uint256,uint256,bool) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity =0.8.13; | ||
|
||
|
||
// CSE challenge: multiple branches that slow down the verification | ||
contract Branches{ | ||
function applyOp(uint256 x, uint256 y, bool z) public returns (uint256) { | ||
if (z) { | ||
return x + y; | ||
} else { | ||
return x * y; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/tests/integration/test-data/foundry/test/MergeKCFGTest.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity =0.8.13; | ||
|
||
import "forge-std/Test.sol"; | ||
import "src/Branches.sol"; | ||
|
||
contract MergeKCFGTest is Test { | ||
Branches c; | ||
|
||
function setUp() external { | ||
c = new Branches(); | ||
} | ||
|
||
function test_branch_merge(uint256 x, uint256 y, bool z) external{ | ||
vm.assume(x <= type(uint256).max - y); | ||
try c.applyOp(x, y, z) returns (uint256 res) { | ||
// This check will fail if the backend cannot recover the preds in the merged postcondition | ||
// If so, assert res == x + y | res == x * y will pass | ||
// If so, we should not always use merge_node, but provide both on need. | ||
if (z) { | ||
assert(res == x + y); | ||
} else { | ||
assert(res == x * y); | ||
} | ||
} catch { | ||
assert(x != 0 && 2 ** 62 / x < y && !z); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.