Skip to content

Commit 9a830c3

Browse files
elopezdguido
authored andcommitted
Fix handling of multiple compilation units
A library may live on its own source unit, separate from the contract that uses it, so we need to clean up the target contracts set at the end.
1 parent 049a96d commit 9a830c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crytic_compile/crytic_compile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,12 @@ def _apply_autolink(self) -> None:
658658

659659
for contract_name in source_unit.contracts_names:
660660
deps = source_unit.libraries_names(contract_name)
661-
662-
if deps or contract_name in all_target_contracts:
661+
if deps:
663662
all_dependencies[contract_name] = deps
664663
all_libraries_needed.update(deps)
665664

665+
all_target_contracts = [c for c in all_target_contracts if c not in all_libraries_needed]
666+
666667
# Calculate deployment order globally
667668
deployment_order, _ = get_deployment_order(all_dependencies, all_target_contracts)
668669
self._autolink_deployment_order = deployment_order

0 commit comments

Comments
 (0)