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

bump chia-blockchain 2.3.0 and minor code fixes #120

Merged
merged 1 commit into from
May 8, 2024
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
7 changes: 4 additions & 3 deletions cdv/cmds/chia_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from chia.types.blockchain_format.program import INFINITE_COST, Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_record import CoinRecord
from chia.types.coin_spend import CoinSpend
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
Expand Down Expand Up @@ -164,6 +164,7 @@ def inspect_any_cmd(ctx: click.Context, objects: Tuple[str]):
assert isinstance(obj, Coin) # mypy otherwise complains that obj is a str
do_inspect_coin_cmd(ctx, [obj])
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]
do_inspect_spend_bundle_cmd(ctx, [obj])
Expand Down Expand Up @@ -272,7 +273,7 @@ def do_inspect_coin_spend_cmd(
# If they specified the coin components
if (not kwargs["coin"]) and all([kwargs["parent_id"], kwargs["puzzle_hash"], kwargs["amount"]]):
coin_spend_objs: List[CoinSpend] = [
CoinSpend(
make_spend(
Coin(
bytes32.from_hexstr(kwargs["parent_id"]),
bytes32.from_hexstr(kwargs["puzzle_hash"]),
Expand All @@ -285,7 +286,7 @@ def do_inspect_coin_spend_cmd(
# If they specifed a coin object to parse
elif kwargs["coin"]:
coin_spend_objs = [
CoinSpend(
make_spend(
do_inspect_coin_cmd(ctx, [kwargs["coin"]], print_results=False)[0],
parse_program(kwargs["puzzle_reveal"]),
parse_program(kwargs["solution"]),
Expand Down
16 changes: 3 additions & 13 deletions cdv/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_record import CoinRecord
from chia.types.coin_spend import CoinSpend
from chia.types.coin_spend import CoinSpend, make_spend
from chia.types.spend_bundle import SpendBundle
from chia.util.condition_tools import ConditionOpcode
from chia.util.hash import std_hash
Expand Down Expand Up @@ -455,13 +455,7 @@ async def launch_smart_coin(self, source: Program, **kwargs) -> Optional[CoinWra
)

spend_bundle = SpendBundle(
[
CoinSpend(
found_coin.coin, # Coin to spend
self.puzzle, # Puzzle used for found_coin
solution, # The solution to the puzzle locking found_coin
)
],
[make_spend(found_coin.coin, self.puzzle, solution)],
signature,
)
pushed: Dict[str, Union[str, List[Coin]]] = await self.parent.push_tx(spend_bundle)
Expand Down Expand Up @@ -535,11 +529,7 @@ async def spend_coin(self, coin: CoinWrapper, pushtx: bool = True, **kwargs) ->
delegated_puzzle_solution = Program.to(kwargs["args"])
solution = delegated_puzzle_solution

solution_for_coin = CoinSpend(
coin.coin,
coin.puzzle(),
solution,
)
solution_for_coin = make_spend(coin.coin, coin.puzzle(), solution)

# The reason this use of sign_coin_spends exists is that it correctly handles
# the signing for non-standard coins. I don't fully understand the difference but
Expand Down
2 changes: 1 addition & 1 deletion 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.2.1",
"chia-blockchain==2.3.0",
]

dev_dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion tests/cmds/object_files/spendbundles/spendbundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"parent_coin_info": "0x0000000000000000000000000000000000000000000000000000000000000000",
"puzzle_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"},
"puzzle_reveal": "0x01",
"solution": "80"}
"solution": "0x80"}
],
"aggregated_signature": "c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cmds/object_files/spends/spend.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"parent_coin_info": "0x0000000000000000000000000000000000000000000000000000000000000000",
"puzzle_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"},
"puzzle_reveal": "0x01",
"solution": "ffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff2480ffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff248080"}
"solution": "0xffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff2480ffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff248080"}
hoffmang9 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion tests/cmds/object_files/spends/spend_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"parent_coin_info": "0x0000000000000000000000000000000000000000000000000000000000000001",
"puzzle_hash": "0x0000000000000000000000000000000000000000000000000000000000000000"},
"puzzle_reveal": "0x01",
"solution": "ffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff248080"}
"solution": "0xffff32ffb080df54b2a616f5c79baaed254134ae5dfc6e24e2d8e1165b251601ceb67b1886db50aacf946eb20f00adc303e7534dd0ff248080"}
Loading