Skip to content

Commit

Permalink
Merge branch 'master' into _update-deps/runtimeverification/evm-seman…
Browse files Browse the repository at this point in the history
…tics
  • Loading branch information
palinatolmach authored Sep 23, 2024
2 parents 540d537 + 9598623 commit 368438b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-expected-output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: github.ref != 'refs/heads/master'
name: 'Update Kontrol expected output'
runs-on: [self-hosted, linux, normal, fast]
timeout-minutes: 60
timeout-minutes: 90
steps:
- name: 'Check out code'
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def exec_view_kcfg(options: ViewKcfgOptions) -> None:
contract_name, _ = test_id.split('.')
proof = foundry.get_apr_proof(test_id)

compilation_unit = CompilationUnit.load_build_info(options.foundry_root)
compilation_unit = CompilationUnit.load_build_info(foundry.build_info)

def _short_info(cterm: CTerm) -> Iterable[str]:
return foundry.short_info_for_contract(contract_name, cterm)
Expand Down
17 changes: 15 additions & 2 deletions src/kontrol/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ def lookup_full_contract_name(self, contract_name: str) -> str:
@property
def profile(self) -> dict[str, Any]:
profile_name = os.getenv('FOUNDRY_PROFILE', default='default')
return self._toml['profile'][profile_name]

current_profile = self._toml['profile'].get(profile_name, {})
default_profile = self._toml['profile'].get('default', {})

return {**default_profile, **current_profile}

@property
def out(self) -> Path:
Expand Down Expand Up @@ -212,6 +216,15 @@ def main_file(self) -> Path:
def contracts_file(self) -> Path:
return self.kompiled / 'contracts.k'

@property
def build_info(self) -> Path:
build_info_path = self.profile.get('build_info_path')

if build_info_path:
return self._root / build_info_path
else:
return self.out / 'build-info'

@cached_property
def kevm(self) -> KEVM:
use_directory = self.out / 'tmp'
Expand Down Expand Up @@ -1364,7 +1377,7 @@ def __init__(self, foundry: Foundry, contract_name: str, omit_unstable_output: b
self.foundry = foundry
self.contract_name = contract_name
self.omit_unstable_output = omit_unstable_output
self.compilation_unit = CompilationUnit.load_build_info(foundry._root)
self.compilation_unit = CompilationUnit.load_build_info(foundry.build_info)

def print_node(self, kcfg: KCFG, node: KCFG.Node) -> list[str]:
ret_strs = super().print_node(kcfg, node)
Expand Down
4 changes: 2 additions & 2 deletions src/kontrol/solc.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ def uuid(self) -> int:
return self._id

@staticmethod
def load_build_info(foundry_root: Path) -> CompilationUnit:
build_info_files = (foundry_root / 'out' / 'build-info').glob('*.json')
def load_build_info(foundry_build_info: Path) -> CompilationUnit:
build_info_files = foundry_build_info.glob('*.json')
build_info = json.loads(max(build_info_files, key=os.path.getmtime).read_text())
sources: dict[int, Source] = {} # Source id => Source
contracts: dict[bytes, ContractSource] = {} # CBOR metadata => contract
Expand Down

0 comments on commit 368438b

Please sign in to comment.