From 6f4005e4ba65604e547a413fad646b197942e2b0 Mon Sep 17 00:00:00 2001 From: Oba Date: Tue, 8 Oct 2024 19:11:57 +0200 Subject: [PATCH] test: avoid overriding dict references (#1475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Time spent on this PR: ## Pull request type Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [x] Other (please describe): ## What is the current behavior? Resolves # ## What is the new behavior? avoid overriding dict references - - - This change is [Reviewable](https://reviewable.io/reviews/kkrt-labs/kakarot/1475) --- kakarot_scripts/utils/kakarot.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/kakarot_scripts/utils/kakarot.py b/kakarot_scripts/utils/kakarot.py index a3f9ebcdc..16894f50e 100644 --- a/kakarot_scripts/utils/kakarot.py +++ b/kakarot_scripts/utils/kakarot.py @@ -1,6 +1,7 @@ import functools import json import logging +from collections import defaultdict from pathlib import Path from types import MethodType from typing import Any, Dict, List, Optional, Tuple, Union, cast @@ -114,15 +115,12 @@ def get_solidity_artifacts( def process_link_references( link_references: Dict[str, Dict[str, Any]] ) -> Dict[str, Dict[str, Any]]: - return { - Path(file_path) - .relative_to(src_path) - .parts[0]: { - library_name: references - for library_name, references in libraries.items() - } - for file_path, libraries in link_references.items() - } + result = defaultdict(lambda: defaultdict(list)) + for file_path, libraries in link_references.items(): + relative_path = Path(file_path).relative_to(src_path).parts[0] + for library_name, references in libraries.items(): + result[relative_path][library_name].extend(references) + return result return { "bytecode": {