Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
test: avoid overriding dict references (#1475)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

<!-- Give an estimate of the time you spent on this PR in terms of work
days.
Did you spend 0.5 days on this PR or rather 2 days?  -->

Time spent on this PR:

## Pull request type

<!-- Please try to limit your pull request to one type,
submit multiple pull requests if needed. -->

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?

<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->

Resolves #<Issue number>

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

avoid overriding dict references

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/kkrt-labs/kakarot/1475)
<!-- Reviewable:end -->
  • Loading branch information
obatirou authored Oct 8, 2024
1 parent 137684e commit 6f4005e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions kakarot_scripts/utils/kakarot.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 6f4005e

Please sign in to comment.