Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to chia-blockchain 2.0.0 #97

Merged
merged 4 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.8"

- name: Install build tools (pep517 compatible)
run: >-
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,14 @@ jobs:
runs-on:
intel: [windows-latest]
python:
- major-dot-minor: '3.7'
matrix: '3.7'
- major-dot-minor: '3.8'
matrix: '3.8'
- major-dot-minor: '3.9'
matrix: '3.9'
- major-dot-minor: '3.10'
matrix: '3.10'
# TODO: add back once we bump have a blockchain dep that supports 3.11
# - major-dot-minor: '3.11'
# matrix: '3.11'
- major-dot-minor: '3.11'
matrix: '3.11'
arch:
- name: ARM
matrix: arm
Expand All @@ -64,10 +61,6 @@ jobs:
matrix: windows
arch:
matrix: arm
- os:
matrix: macos
python:
matrix: '3.7'
- os:
matrix: macos
python:
Expand Down Expand Up @@ -104,12 +97,12 @@ jobs:
. ./venv/bin/activate
pip install ."[dev]"
./venv/bin/chia init
./venv/bin/py.test tests/ cdv/examples/tests -s -v --durations 0
./venv/bin/pytest tests/ cdv/examples/tests -s -v --durations 0

- name: Test code with pytest
if: runner.os == 'Windows'
shell: powershell
run: |
pip install .[dev]
chia init
py.test tests\ cdv\examples\tests -s -v --durations 0
pytest tests\ cdv\examples\tests -s -v --durations 0
2 changes: 1 addition & 1 deletion .github/workflows/test-blockchain-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
sed -i 's/chia-blockchain.*/chia-blockchain @ git+https:\/\/github.com\/Chia-Network\/chia-blockchain.git@main\",/g' setup.py
pip install ."[dev]"
./venv/bin/chia init
./venv/bin/py.test tests/ cdv/examples/tests -s -v --durations 0
./venv/bin/pytest tests/ cdv/examples/tests -s -v --durations 0
5 changes: 5 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[settings]
line_length = 120
profile=black
skip_gitignore=true
add_imports=from __future__ import annotations
9 changes: 6 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ repos:
- id: check-merge-conflict
- id: check-ast
- id: debug-statements
- repo: https://github.com/psf/black
rev: 21.12b0
- repo: local
hooks:
- id: black
additional_dependencies: ['click<8.1']
name: black
entry: black
language: system
require_serial: true
types_or: [python, pyi]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
Expand Down
2 changes: 2 additions & 0 deletions activated.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

from __future__ import annotations

import os
import pathlib
import subprocess
Expand Down
2 changes: 2 additions & 0 deletions cdv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pkg_resources import DistributionNotFound, get_distribution

try:
Expand Down
7 changes: 6 additions & 1 deletion cdv/cmds/chia_inspect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import sys
from pprint import pprint
Expand Down Expand Up @@ -80,6 +82,7 @@ def inspect_callback(

# Utility functions


# If there's only one key, return the data on that key instead (for things like {'spend_bundle': {...}})
def json_and_key_strip(input: str) -> Dict:
json_dict: Dict = json.loads(input)
Expand Down Expand Up @@ -315,6 +318,7 @@ def do_inspect_coin_spend_cmd(
INFINITE_COST,
height=DEFAULT_CONSTANTS.SOFT_FORK2_HEIGHT, # so that all opcodes are available
mempool_mode=True,
constants=DEFAULT_CONSTANTS,
)
cost: int = npc_result.cost
if ignore_byte_cost:
Expand Down Expand Up @@ -403,6 +407,7 @@ def do_inspect_spend_bundle_cmd(
INFINITE_COST,
height=DEFAULT_CONSTANTS.SOFT_FORK2_HEIGHT, # so that all opcodes are available
mempool_mode=True,
constants=DEFAULT_CONSTANTS,
)
cost: int = npc_result.cost
if kwargs["ignore_byte_cost"]:
Expand Down Expand Up @@ -438,7 +443,7 @@ def do_inspect_spend_bundle_cmd(
]
for pk, msg in pkm_pairs_for_conditions_dict(
conditions_dict,
coin_spend.coin.name(),
coin_spend.coin,
hexstr_to_bytes(genesis_challenge),
):
if str(pk) in pkm_dict:
Expand Down
2 changes: 2 additions & 0 deletions cdv/cmds/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import shutil
from pathlib import Path
Expand Down
4 changes: 3 additions & 1 deletion cdv/cmds/clsp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import shutil
from pathlib import Path
Expand Down Expand Up @@ -156,7 +158,7 @@ def uncurry_cmd(program: str, treehash: bool, dump: bool):
)
def cat_puzzle_hash(inner_puzzlehash: str, tail_hash: str):
from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS
from chia.wallet.puzzles.cat_loader import CAT_MOD
from chia.wallet.cat_wallet.cat_utils import CAT_MOD

default_cats_by_symbols = {cat["symbol"]: cat for cat in DEFAULT_CATS.values()}
if tail_hash in default_cats_by_symbols:
Expand Down
2 changes: 2 additions & 0 deletions cdv/cmds/rpc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import asyncio
import json
from pprint import pprint
Expand Down
2 changes: 2 additions & 0 deletions cdv/cmds/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re
from typing import Dict, Iterable, List, Union

Expand Down
2 changes: 2 additions & 0 deletions cdv/examples/drivers/piggybank_drivers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pathlib import Path
from typing import List

Expand Down
2 changes: 2 additions & 0 deletions cdv/examples/tests/test_piggybank.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Dict, List, Optional

import pytest
Expand Down
2 changes: 2 additions & 0 deletions cdv/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import binascii
import datetime
import struct
Expand Down
2 changes: 2 additions & 0 deletions cdv/test/test_skeleton.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pytest
import pytest_asyncio

Expand Down
2 changes: 2 additions & 0 deletions cdv/util/keys.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Dict, List

from blspy import AugSchemeMPL, BasicSchemeMPL, G1Element, G2Element, PrivateKey
Expand Down
2 changes: 2 additions & 0 deletions cdv/util/load_clvm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import importlib
import inspect
import os
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python

from __future__ import annotations

from setuptools import find_packages, setup

with open("README.md", "rt") as fh:
Expand All @@ -11,20 +13,20 @@
"pytest-asyncio",
"pytimeparse",
"anyio",
"chia-blockchain==1.8.1",
"chia-blockchain==2.0.0",
]

dev_dependencies = [
"anyio",
"flake8",
"mypy",
"black==23.7.0",
"types-aiofiles",
"types-click",
"types-cryptography",
"types-pkg_resources",
"types-pyyaml",
"types-setuptools",
"black==21.12b0",
"isort",
"pre-commit",
"pylint",
Expand Down
2 changes: 2 additions & 0 deletions tests/build-init-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#
# Note: This script is run in a `pre-commit` hook (which runs on CI) to make sure we don't miss out any folder.

from __future__ import annotations

import logging
import pathlib
import sys
Expand Down
2 changes: 2 additions & 0 deletions tests/cmds/test_cdv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from pathlib import Path

from click.testing import CliRunner, Result
Expand Down
2 changes: 2 additions & 0 deletions tests/cmds/test_clsp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import os
import shutil
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions tests/cmds/test_inspect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
from pathlib import Path
from typing import Dict, List
Expand Down
Loading