-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add profile test for
foundry_prove
(#1982)
* Run proofs in the main process on `workers=1` * Add profile test * Remove `pytest.ini` By default `pytest` would set `rootdir` to its parent. * Add option to prove with Booster * Run profiling in Docker container * Update kevm-pyk/src/tests/profiling/test-data/foundry/foundry.toml Co-authored-by: Everett Hildenbrandt <[email protected]> * Mark target `profile` exlicitly as `.PHONY` * Set Version: 1.0.248 --------- Co-authored-by: Everett Hildenbrandt <[email protected]> Co-authored-by: devops <[email protected]>
- Loading branch information
1 parent
07a27d6
commit 62996ec
Showing
12 changed files
with
124 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "kevm-pyk" | ||
version = "1.0.247" | ||
version = "1.0.248" | ||
description = "" | ||
authors = [ | ||
"Runtime Verification, Inc. <[email protected]>", | ||
|
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 was deleted.
Oops, something went wrong.
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,4 @@ | ||
[profile.default] | ||
src = 'src' | ||
out = 'out' | ||
extra_output = ['storageLayout', 'abi', 'evm.methodIdentifiers', 'evm.deployedBytecode.object'] |
15 changes: 15 additions & 0 deletions
15
kevm-pyk/src/tests/profiling/test-data/foundry/test/Simple.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,15 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity =0.8.13; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
contract AssertTest is Test { | ||
|
||
function test_revert_branch(uint x, uint y) public{ | ||
if (x < y) { | ||
assert(true); | ||
} else { | ||
assert(false); | ||
} | ||
} | ||
} |
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,55 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from distutils.dir_util import copy_tree | ||
from typing import TYPE_CHECKING | ||
|
||
from pyk.utils import run_process | ||
|
||
from kevm_pyk import config | ||
from kevm_pyk.foundry import foundry_kompile, foundry_prove | ||
|
||
from .utils import TEST_DATA_DIR | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
from typing import Final | ||
|
||
from pyk.testing import Profiler | ||
|
||
|
||
sys.setrecursionlimit(10**7) | ||
|
||
|
||
FORGE_STD_REF: Final = '27e14b7' | ||
|
||
|
||
def test_foundy_prove(profile: Profiler, use_booster: bool, tmp_path: Path) -> None: | ||
foundry_root = tmp_path / 'foundry' | ||
|
||
_forge_build(foundry_root) | ||
|
||
with profile('kompile.prof', sort_keys=('cumtime', 'tottime'), limit=15): | ||
foundry_kompile( | ||
definition_dir=config.FOUNDRY_DIR, | ||
foundry_root=foundry_root, | ||
includes=(), | ||
llvm_library=use_booster, | ||
) | ||
|
||
with profile('prove.prof', sort_keys=('cumtime', 'tottime'), limit=100): | ||
foundry_prove( | ||
foundry_root, | ||
tests=['AssertTest.test_revert_branch'], | ||
simplify_init=False, | ||
smt_timeout=125, | ||
smt_retry_limit=4, | ||
counterexample_info=True, | ||
use_booster=use_booster, | ||
) | ||
|
||
|
||
def _forge_build(target_dir: Path) -> None: | ||
copy_tree(str(TEST_DATA_DIR / 'foundry'), str(target_dir)) | ||
run_process(['forge', 'install', '--no-git', f'foundry-rs/forge-std@{FORGE_STD_REF}'], cwd=target_dir) | ||
run_process(['forge', 'build'], cwd=target_dir) |
File renamed without changes.
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,10 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from typing import Final | ||
|
||
|
||
TEST_DATA_DIR: Final = (Path(__file__).parent / 'test-data').resolve(strict=True) |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
kevm (1.0.247) unstable; urgency=medium | ||
kevm (1.0.248) unstable; urgency=medium | ||
|
||
* Initial Release. | ||
|
||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
1.0.247 | ||
1.0.248 |