diff --git a/.github/workflows/update-expected-output.yml b/.github/workflows/update-expected-output.yml index 69f16eb3c..dd7352958 100644 --- a/.github/workflows/update-expected-output.yml +++ b/.github/workflows/update-expected-output.yml @@ -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 diff --git a/src/kontrol/__main__.py b/src/kontrol/__main__.py index 8eb5dd23c..8aff9d67f 100644 --- a/src/kontrol/__main__.py +++ b/src/kontrol/__main__.py @@ -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) diff --git a/src/kontrol/foundry.py b/src/kontrol/foundry.py index 84c56871a..1dbb4f92f 100644 --- a/src/kontrol/foundry.py +++ b/src/kontrol/foundry.py @@ -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: @@ -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' @@ -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) diff --git a/src/kontrol/solc.py b/src/kontrol/solc.py index a13f5626b..d8e9f9559 100644 --- a/src/kontrol/solc.py +++ b/src/kontrol/solc.py @@ -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