mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-11-06 20:58:11 -04:00
CHIA-4458 Annotate debug_spend_bundle.py (#21530)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Low Risk**
> Annotation-only changes to a debug utility with no runtime behavior
impact.
>
> **Overview**
> Adds **mypy type annotations** to
`chia/wallet/util/debug_spend_bundle.py` so the wallet spend-bundle
debug helper is fully typed: `disassemble` now returns `str`, and
`debug_spend_bundle` takes a `SpendBundle` and `bytes32` agg-sig
additional data.
>
> **Removes** `chia.wallet.util.debug_spend_bundle` from
`mypy-exclusions.txt`, so mypy will type-check this module instead of
skipping it (CHIA-4458).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4c244e30ab. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from chia_rs import AugSchemeMPL
|
||||
from chia_rs import AugSchemeMPL, SpendBundle
|
||||
from chia_rs.sized_bytes import bytes32
|
||||
from clvm.operators import KEYWORD_FROM_ATOM
|
||||
from clvm_tools.binutils import disassemble as bu_disassemble
|
||||
|
||||
@@ -21,7 +22,7 @@ KFA = {v: k for k, v in CONDITIONS.items()}
|
||||
# we may need also to save the `genesis_coin_mod` or its hash
|
||||
|
||||
|
||||
def disassemble(sexp: Program):
|
||||
def disassemble(sexp: Program) -> str:
|
||||
"""
|
||||
This version of `disassemble` also disassembles condition opcodes like `ASSERT_ANNOUNCEMENT_CONSUMED`.
|
||||
"""
|
||||
@@ -65,7 +66,9 @@ def uncurry_dump(puzzle: Program, prefix: str = "") -> None:
|
||||
recursive_uncurry_dump(puzzle, 1, prefix, UncurriedPuzzle(mod, curried_args))
|
||||
|
||||
|
||||
def debug_spend_bundle(spend_bundle, agg_sig_additional_data=DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA) -> None:
|
||||
def debug_spend_bundle(
|
||||
spend_bundle: SpendBundle, agg_sig_additional_data: bytes32 = DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA
|
||||
) -> None:
|
||||
"""
|
||||
Print a lot of useful information about a `SpendBundle` that might help with debugging
|
||||
its clvm.
|
||||
|
||||
@@ -12,7 +12,6 @@ chia.simulator.keyring
|
||||
chia.simulator.wallet_tools
|
||||
chia.ssl.create_ssl
|
||||
chia.types.blockchain_format.program
|
||||
chia.wallet.util.debug_spend_bundle
|
||||
chia.wallet.util.new_peak_queue
|
||||
chia.wallet.wallet_transaction_store
|
||||
chia._tests.clvm.test_puzzles
|
||||
|
||||
Reference in New Issue
Block a user