Skip to content

Commit b6490c4

Browse files
committed
!!! wip: changes for debugging
1 parent 6f3f377 commit b6490c4

File tree

5 files changed

+33
-24
lines changed

5 files changed

+33
-24
lines changed

src/kontrol/kompile.py

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def should_rekompile() -> bool:
150150
if options.o3:
151151
optimization = 3
152152

153+
_LOGGER.warning('Invoking kompile')
153154
kevm_kompile(
154155
target=options.target,
155156
output_dir=output_dir,

src/kontrol/prove.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,12 @@ def create_kcfg_explore() -> KCFGExplore:
436436
rule.label for rule in foundry.kevm.definition.all_modules_dict['KONTROL-ASSERTIONS'].rules
437437
)
438438

439-
lemmas_module = foundry.load_lemmas(options.lemmas)
439+
try:
440+
lemmas_module = foundry.load_lemmas(options.lemmas)
441+
except CalledProcessError as e:
442+
_LOGGER.warning(f'stdout: {e.stdout}')
443+
_LOGGER.warning(f'stderr: {e.stderr}')
444+
raise
440445

441446
if progress is not None and task is not None:
442447
progress.update(

src/tests/integration/test-data/cse-lemmas.k

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module CSE-LEMMAS
55
rule X xorInt maxUInt256 => maxUInt256 -Int X
66
requires #rangeUInt ( 256 , X )
77
[simplification]
8-
8+
/*
99
// Set equality needed for discharging `#Not ( #Exists ( ... )` on `<accessedAccounts>` unification
1010
rule { S1:Set #Equals S2:Set |Set SetItem ( X ) } =>
1111
{ X in S1 } #And
@@ -26,7 +26,7 @@ module CSE-LEMMAS
2626
rule { B:Bytes #Equals B1:Bytes +Bytes B2:Bytes } => {#range(B, 4, lengthBytes(B) -Int 4) #Equals B2}
2727
requires 4 <=Int lengthBytes(B) andBool #range(B, 0, 4) ==K B1
2828
[simplification(60), concrete(B, B1)]
29-
29+
*/
3030
// Bitwise inequalities
3131
rule [bitwise-and-maxUInt-lt-l]:
3232
A <Int X &Int Y => false

src/tests/integration/test-data/show/foundry.k.expected

-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
requires "contracts.k"
2-
requires "requires/lemmas.k"
3-
requires "requires/cse-lemmas.k"
4-
requires "requires/pausability-lemmas.k"
5-
requires "requires/symbolic-bytes-lemmas.k"
6-
requires "requires/keccak.md"
7-
requires "requires/no_stack_checks.md"
8-
requires "requires/no_code_size_checks.md"
92

103
module FOUNDRY-MAIN
114
imports public S2KsrcZModduplicatesZMod2ZModDuplicateName-VERIFICATION
@@ -234,7 +227,6 @@ endmodule
234227

235228
module S2KtestZModArithmeticCallTest-VERIFICATION
236229
imports public S2KtestZModArithmeticCallTest-CONTRACT
237-
imports public CSE-LEMMAS
238230

239231

240232

@@ -368,7 +360,6 @@ endmodule
368360

369361
module S2KtestZModCSETest-VERIFICATION
370362
imports public S2KtestZModCSETest-CONTRACT
371-
imports public CSE-LEMMAS
372363

373364

374365

@@ -712,7 +703,6 @@ endmodule
712703

713704
module S2KtestZModImmutableVarsTest-VERIFICATION
714705
imports public S2KtestZModImmutableVarsTest-CONTRACT
715-
imports public SYMBOLIC-BYTES-LEMMAS
716706

717707

718708

@@ -804,7 +794,6 @@ endmodule
804794

805795
module S2KtestZModLoopsTest-VERIFICATION
806796
imports public S2KtestZModLoopsTest-CONTRACT
807-
imports public SUM-TO-N-INVARIANT
808797

809798

810799

@@ -994,7 +983,6 @@ endmodule
994983

995984
module S2KtestZModPortalTest-VERIFICATION
996985
imports public S2KtestZModPortalTest-CONTRACT
997-
imports public PAUSABILITY-LEMMAS
998986

999987

1000988

src/tests/integration/test_kontrol.py

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from __future__ import annotations
22

3+
import logging
34
import sys
45
from shutil import copytree
6+
from subprocess import CalledProcessError
57
from typing import TYPE_CHECKING
68

79
import pytest
@@ -30,6 +32,9 @@
3032
sys.setrecursionlimit(10**7)
3133

3234

35+
_LOGGER: Final = logging.getLogger(__name__)
36+
37+
3338
@pytest.fixture(scope='module')
3439
def server_end_to_end(foundry_end_to_end: Foundry, no_use_booster: bool) -> Iterator[KoreServer]:
3540
llvm_definition_dir = foundry_end_to_end.out / 'kompiled' / 'llvm-library' if not no_use_booster else None
@@ -56,21 +61,31 @@ def foundry_end_to_end(foundry_root_dir: Path | None, tmp_path_factory: TempPath
5661
root_tmp_dir = tmp_path_factory.getbasetemp().parent
5762

5863
foundry_root = root_tmp_dir / 'kontrol-test-project'
64+
_LOGGER.warning(f'foundry_end_to_end worker_id: {worker_id}')
65+
_LOGGER.warning(f'foundry_end_to_end foundry_root: {foundry_root}')
5966
with FileLock(str(foundry_root) + '.lock'):
6067
if not foundry_root.is_dir():
6168
init_project(project_root=foundry_root, skip_forge=False)
6269
copytree(str(TEST_DATA_DIR / 'src'), str(foundry_root / 'test'), dirs_exist_ok=True)
6370
append_to_file(foundry_root / 'foundry.toml', foundry_toml_cancun_schedule())
6471

65-
foundry_kompile(
66-
BuildOptions(
67-
{
68-
'metadata': False,
69-
'auxiliary_lemmas': True,
70-
}
71-
),
72-
foundry=Foundry(foundry_root),
73-
)
72+
try:
73+
foundry_kompile(
74+
BuildOptions(
75+
{
76+
'metadata': False,
77+
'auxiliary_lemmas': True,
78+
'verbose': True,
79+
'debug': True,
80+
}
81+
),
82+
foundry=Foundry(foundry_root),
83+
)
84+
except CalledProcessError as e:
85+
_LOGGER.warning(e)
86+
_LOGGER.warning(e.stdout)
87+
_LOGGER.warning(e.stderr)
88+
raise
7489

7590
session_foundry_root = tmp_path_factory.mktemp('kontrol-test-project')
7691
copytree(str(foundry_root), str(session_foundry_root), dirs_exist_ok=True)

0 commit comments

Comments
 (0)