Skip to content

Commit

Permalink
Remove useless int to hex parsing (#993)
Browse files Browse the repository at this point in the history
<!-- 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/993)
<!-- Reviewable:end -->
  • Loading branch information
ClementWalter authored Feb 21, 2024
1 parent ac3e25c commit 2617348
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions scripts/utils/starknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,30 +318,6 @@ def compile_contract(contract):
if output.returncode != 0:
raise RuntimeError(output.stderr)

def _convert_offset_to_hex(obj):
if isinstance(obj, list):
return [_convert_offset_to_hex(i) for i in obj]
if isinstance(obj, dict):
return {key: _convert_offset_to_hex(obj[key]) for key, value in obj.items()}
if isinstance(obj, int) and obj >= 0:
return hex(obj)
return obj

compiled = json.loads(artifact.read_text())
compiled = {
**compiled,
"entry_points_by_type": _convert_offset_to_hex(
compiled["entry_points_by_type"]
),
}
json.dump(
compiled,
open(
artifact,
"w",
),
indent=2,
)
elapsed = datetime.now() - start
logger.info(
f"✅ {contract['contract_name']} compiled in {elapsed.total_seconds():.2f}s"
Expand Down

0 comments on commit 2617348

Please sign in to comment.