Skip to content

Commit

Permalink
CHIA-2215 Annotate run_block.py (#19128)
Browse files Browse the repository at this point in the history
Annotate run_block.py.
  • Loading branch information
AmineKhaldi authored Jan 13, 2025
1 parent 3e8b3b5 commit ae2de64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion mypy-exclusions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,3 @@ chia._tests.util.time_out_assert
chia._tests.wallet.did_wallet.test_did
chia._tests.wallet.rpc.test_wallet_rpc
tools.analyze-chain
tools.run_block
9 changes: 5 additions & 4 deletions tools/run_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,25 @@

import json
from pathlib import Path
from typing import Any

import click

from chia._tests.util.run_block import run_json_block
from chia.consensus.constants import replace_str_to_bytes
from chia.consensus.constants import ConsensusConstants, replace_str_to_bytes
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.util.config import load_config
from chia.util.default_root import DEFAULT_ROOT_PATH


@click.command()
@click.argument("filename", type=click.Path(exists=True), default="testnet10.396963.json")
def cmd_run_json_block_file(filename):
def cmd_run_json_block_file(filename: str) -> None:
"""`file` is a file containing a FullBlock in JSON format"""
return run_json_block_file(Path(filename))


def run_json_block_file(filename: Path):
def run_json_block_file(filename: Path) -> None:
full_block = json.load(filename.open("rb"))
# pull in current constants from config.yaml
_, constants = get_config_and_constants()
Expand All @@ -68,7 +69,7 @@ def run_json_block_file(filename: Path):
print(cat_list_json)


def get_config_and_constants():
def get_config_and_constants() -> tuple[dict[str, Any], ConsensusConstants]:
config = load_config(DEFAULT_ROOT_PATH, "config.yaml")
network = config["selected_network"]
overrides = config["network_overrides"]["constants"][network]
Expand Down

0 comments on commit ae2de64

Please sign in to comment.