Skip to content

Commit

Permalink
Merge pull request #138 from Chia-Network/update_244
Browse files Browse the repository at this point in the history
Update to chia-blockchain 2.4.4 and remove python 3.8 from runners
  • Loading branch information
emlowe authored Oct 18, 2024
2 parents 61848d1 + cfab52e commit 28bb6e9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand All @@ -65,8 +63,6 @@ jobs:
matrix: arm
- os:
matrix: macos
python:
matrix: '3.8'
arch:
matrix: arm

Expand Down Expand Up @@ -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
25 changes: 13 additions & 12 deletions cdv/cmds/chia_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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:
Expand All @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion cdv/cmds/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"pytest-asyncio",
"pytimeparse",
"anyio",
"chia-blockchain==2.4.2",
"chia-blockchain==2.4.4",
]

dev_dependencies = [
Expand Down Expand Up @@ -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",
],
Expand Down
12 changes: 6 additions & 6 deletions tests/cmds/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 28bb6e9

Please sign in to comment.