From 070d2418674a337031f6b1f3d9aebcfc497f760c Mon Sep 17 00:00:00 2001 From: Geoff Walmsley Date: Fri, 18 Oct 2024 14:36:05 +0300 Subject: [PATCH 1/2] updates for chia_blockchain 2.4.4 --- cdv/cmds/chia_inspect.py | 25 +++++++++++++------------ cdv/cmds/rpc.py | 2 +- setup.py | 2 +- tests/cmds/test_inspect.py | 12 ++++++------ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/cdv/cmds/chia_inspect.py b/cdv/cmds/chia_inspect.py index a872e34..75b197a 100644 --- a/cdv/cmds/chia_inspect.py +++ b/cdv/cmds/chia_inspect.py @@ -17,7 +17,6 @@ from chia.types.coin_record import CoinRecord from chia.types.coin_spend import CoinSpend, make_spend from chia.types.generator_types import BlockGenerator -from chia.types.spend_bundle import SpendBundle from chia.util.byte_types import hexstr_to_bytes from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict from chia.util.config import load_config @@ -30,6 +29,7 @@ calculate_synthetic_public_key, calculate_synthetic_secret_key, ) +from chia.wallet.wallet_spend_bundle import WalletSpendBundle from chia_rs import AugSchemeMPL, G1Element, G2Element, PrivateKey from cdv.cmds.util import parse_program @@ -134,7 +134,7 @@ def inspect_any_cmd(ctx: click.Context, objects: Tuple[str]): for obj in objects: in_obj: Any = obj # Try it as Streamable types - for cls in [Coin, CoinSpend, SpendBundle, CoinRecord]: + for cls in [Coin, CoinSpend, WalletSpendBundle, CoinRecord]: try: in_obj = streamable_load(cls, [obj])[0] break @@ -166,7 +166,8 @@ def inspect_any_cmd(ctx: click.Context, objects: Tuple[str]): elif type(obj) == CoinSpend: # type: ignore[comparison-overlap] assert isinstance(obj, CoinSpend) do_inspect_coin_spend_cmd(ctx, [obj]) - elif type(obj) == SpendBundle: # type: ignore[comparison-overlap] + elif type(obj) == WalletSpendBundle: # type: ignore[comparison-overlap] + assert isinstance(obj, WalletSpendBundle) do_inspect_spend_bundle_cmd(ctx, [obj]) elif type(obj) == CoinRecord: # type: ignore[comparison-overlap] do_inspect_coin_record_cmd(ctx, [obj]) @@ -315,11 +316,11 @@ def do_inspect_coin_spend_cmd( # We're going to print some extra stuff if they wanted to see the cost if cost_flag: for coin_spend in coin_spend_objs: - program: BlockGenerator = simple_solution_generator(SpendBundle([coin_spend], G2Element())) + program: BlockGenerator = simple_solution_generator(WalletSpendBundle([coin_spend], G2Element())) npc_result: NPCResult = get_name_puzzle_conditions( program, INFINITE_COST, - height=DEFAULT_CONSTANTS.SOFT_FORK2_HEIGHT, # so that all opcodes are available + height=DEFAULT_CONSTANTS.SOFT_FORK5_HEIGHT, # so that all opcodes are available mempool_mode=True, constants=DEFAULT_CONSTANTS, ) @@ -370,10 +371,10 @@ def inspect_spend_bundle_cmd(ctx: click.Context, bundles: Tuple[str], **kwargs): def do_inspect_spend_bundle_cmd( ctx: click.Context, - bundles: Union[Tuple[str], List[SpendBundle]], + bundles: Union[Tuple[str], List[WalletSpendBundle]], print_results: bool = True, **kwargs, -) -> List[SpendBundle]: +) -> List[WalletSpendBundle]: # If this is from the command line and they've specified at lease one spend to parse if kwargs and (len(kwargs["spend"]) > 0): if len(kwargs["aggsig"]) > 0: @@ -382,15 +383,15 @@ def do_inspect_spend_bundle_cmd( ) else: sig = G2Element() - spend_bundle_objs: List[SpendBundle] = [ - SpendBundle( + spend_bundle_objs: List[WalletSpendBundle] = [ + WalletSpendBundle( do_inspect_coin_spend_cmd(ctx, kwargs["spend"], print_results=False), sig, ) ] else: try: - spend_bundle_objs = streamable_load(SpendBundle, bundles) + spend_bundle_objs = streamable_load(WalletSpendBundle, bundles) except Exception as e: print(f"One or more of the specified objects was not a spend bundle: {e}") sys.exit(1) @@ -400,7 +401,7 @@ def do_inspect_spend_bundle_cmd( spend_bundle_objs, ctx, id_calc=(lambda e: e.name().hex()), - type="SpendBundle", + type="WalletSpendBundle", ) # We're going to print some extra stuff if they've asked for it. if kwargs: @@ -410,7 +411,7 @@ def do_inspect_spend_bundle_cmd( npc_result: NPCResult = get_name_puzzle_conditions( program, INFINITE_COST, - height=DEFAULT_CONSTANTS.SOFT_FORK2_HEIGHT, # so that all opcodes are available + height=DEFAULT_CONSTANTS.SOFT_FORK5_HEIGHT, # so that all opcodes are available mempool_mode=True, constants=DEFAULT_CONSTANTS, ) diff --git a/cdv/cmds/rpc.py b/cdv/cmds/rpc.py index a6bfa86..b142b44 100644 --- a/cdv/cmds/rpc.py +++ b/cdv/cmds/rpc.py @@ -7,6 +7,7 @@ import aiohttp import click +from chia.cmds.cmds_util import format_bytes from chia.consensus.block_record import BlockRecord from chia.rpc.full_node_rpc_client import FullNodeRpcClient from chia.types.blockchain_format.coin import Coin @@ -19,7 +20,6 @@ from chia.util.config import load_config from chia.util.default_root import DEFAULT_ROOT_PATH from chia.util.ints import uint16, uint64 -from chia.util.misc import format_bytes from cdv.cmds.chia_inspect import do_inspect_spend_bundle_cmd from cdv.cmds.util import fake_context diff --git a/setup.py b/setup.py index 385b252..baa5a33 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ "pytest-asyncio", "pytimeparse", "anyio", - "chia-blockchain==2.4.2", + "chia-blockchain==2.4.4", ] dev_dependencies = [ diff --git a/tests/cmds/test_inspect.py b/tests/cmds/test_inspect.py index bd3f6d7..cef3e22 100644 --- a/tests/cmds/test_inspect.py +++ b/tests/cmds/test_inspect.py @@ -126,8 +126,8 @@ def test_spends(self): id: str = "f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b" puzzle_reveal: str = "01" solution: str = "80" - cost: str = "569056" - modified_cost: str = "557056" + cost: str = "564064" + modified_cost: str = "552064" runner = CliRunner() @@ -195,12 +195,12 @@ def test_spendbundles(self): ) id_no_sig: str = "3fc441c1048a4e0b9fd1648d7647fdebd220cf7dd51b6967dcaf76f7043e83d6" id_with_sig: str = "7d6f0da915deed117ad5589aa8bd6bf99beb69f48724b14b2134f6f8af6d8afc" - network_modifier: str = "testnet7" + network_modifier: str = "testnet11" modified_signable_data: str = ( - "24f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b117816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af" # noqa + "2458e8f2a1f78f0a591feb75aebecaaa81076e4290894b1c445cc32953604db08937a90eb5185a9c4439a91ddc98bbadce7b4feba060d50116a067de66bf236615" # noqa ) - cost: str = "6692283" - modified_cost: str = "6668283" + cost: str = "6684108" + modified_cost: str = "6660108" runner = CliRunner() From cfab52e7a494dac488c5ca80d2af381acb5e5602 Mon Sep 17 00:00:00 2001 From: Geoff Walmsley Date: Fri, 18 Oct 2024 14:40:17 +0300 Subject: [PATCH 2/2] Update to macos-13 runners and remove python 3.8 --- .github/workflows/precommit.yml | 4 ++-- .github/workflows/run-test-suite.yml | 9 +++------ setup.py | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index f8e1f4e..f06132d 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -27,8 +27,8 @@ jobs: - name: macOS matrix: macos runs-on: - intel: macos-12 - arm: [macos, arm64] + intel: macos-13 + arm: macos-13-arm64 - name: Windows matrix: windows runs-on: diff --git a/.github/workflows/run-test-suite.yml b/.github/workflows/run-test-suite.yml index 648bcda..6304b36 100644 --- a/.github/workflows/run-test-suite.yml +++ b/.github/workflows/run-test-suite.yml @@ -31,8 +31,8 @@ jobs: - name: macOS matrix: macos runs-on: - arm: [macOS, ARM64] - intel: [macos-12] + arm: macos-13-arm64 + intel: [macos-13] - name: Ubuntu matrix: ubuntu runs-on: @@ -43,8 +43,6 @@ jobs: runs-on: intel: [windows-latest] python: - - major-dot-minor: '3.8' - matrix: '3.8' - major-dot-minor: '3.9' matrix: '3.9' - major-dot-minor: '3.10' @@ -65,8 +63,6 @@ jobs: matrix: arm - os: matrix: macos - python: - matrix: '3.8' arch: matrix: arm @@ -105,6 +101,7 @@ jobs: if: runner.os == 'Windows' shell: powershell run: | + python -m pip install --upgrade pip pip install .[dev] chia init pytest tests\ cdv\examples\tests -s -v --durations 0 diff --git a/setup.py b/setup.py index baa5a33..f2f94ed 100644 --- a/setup.py +++ b/setup.py @@ -52,8 +52,9 @@ long_description_content_type="text/markdown", classifiers=[ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "License :: OSI Approved :: Apache Software License", "Topic :: Security :: Cryptography", ],