Skip to content
Closed
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
5 changes: 4 additions & 1 deletion chia/full_node/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def create_compressed_generator(
DECOMPRESS_PUZZLE, DECOMPRESS_CSE_WITH_PREFIX, Program.to(start), Program.to(end), compressed_cse_list
)
generator_arg = GeneratorArg(original_generator.block_height, original_generator.generator)
return BlockGenerator(program, [generator_arg])
# TODO: address hint error and remove ignore
# error: Argument 1 to "BlockGenerator" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
return BlockGenerator(program, [generator_arg]) # type: ignore[arg-type]


def setup_generator_args(self: BlockGenerator) -> Tuple[SerializedProgram, Program]:
Expand Down
5 changes: 4 additions & 1 deletion chia/full_node/mempool_check_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def get_puzzle_and_solution_for_coin(generator: BlockGenerator, coin_name: bytes
if not generator.generator_args:
block_program_args = [NIL]
else:
block_program_args = create_generator_args(generator.generator_refs())
# TODO: address hint error and remove ignore
# error: Incompatible types in assignment (expression has type "Program", variable has type
# "List[Program]") [assignment]
block_program_args = create_generator_args(generator.generator_refs()) # type: ignore[assignment]

cost, result = GENERATOR_FOR_SINGLE_COIN_MOD.run_with_cost(
max_cost, block_program, block_program_args, coin_name
Expand Down
4 changes: 3 additions & 1 deletion chia/types/blockchain_format/tree_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from chia.util.hash import std_hash


def sha256_treehash(sexp: CLVMObject, precalculated: Optional[Set[bytes32]] = None) -> bytes32:
# TODO: address hint error and remove ignore
# error: Module "clvm.CLVMObject" is not valid as a type [valid-type]
def sha256_treehash(sexp: CLVMObject, precalculated: Optional[Set[bytes32]] = None) -> bytes32: # type: ignore[valid-type] # noqa E501
"""
Hash values in `precalculated` are presumed to have been hashed already.
"""
Expand Down
19 changes: 16 additions & 3 deletions chia/wallet/cc_wallet/cc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def coin_spend_for_lock_coin(
) -> CoinSpend:
puzzle_reveal = LOCK_INNER_PUZZLE.curry(prev_coin.as_list(), subtotal)
coin = Coin(coin.name(), puzzle_reveal.get_tree_hash(), uint64(0))
coin_spend = CoinSpend(coin, puzzle_reveal, Program.to(0))
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
coin_spend = CoinSpend(coin, puzzle_reveal, Program.to(0)) # type: ignore[arg-type]
return coin_spend


Expand Down Expand Up @@ -120,8 +123,13 @@ def spend_bundle_for_spendable_ccs(
# figure out what the output amounts are by running the inner puzzles & solutions
output_amounts = []
for cc_spend_info, inner_solution in zip(spendable_cc_list, inner_solutions):
# TODO: address hint error and remove ignore
# error: Argument 1 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
# error: Argument 2 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
error, conditions, cost = conditions_dict_for_solution(
cc_spend_info.inner_puzzle, inner_solution, INFINITE_COST
cc_spend_info.inner_puzzle, inner_solution, INFINITE_COST # type: ignore[arg-type]
)
total = 0
if conditions:
Expand Down Expand Up @@ -157,7 +165,12 @@ def spend_bundle_for_spendable_ccs(
next_bundle,
subtotals[index],
]
coin_spend = CoinSpend(input_coins[index], puzzle_reveal, Program.to(solution))
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
coin_spend = CoinSpend(input_coins[index], puzzle_reveal, Program.to(solution)) # type: ignore[arg-type]
coin_spends.append(coin_spend)

if sigs is None or sigs == []:
Expand Down
14 changes: 12 additions & 2 deletions chia/wallet/cc_wallet/cc_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,13 @@ async def get_sigs(self, innerpuz: Program, innersol: Program, coin_name: bytes3
pubkey, private = await self.wallet_state_manager.get_keys(puzzle_hash)
synthetic_secret_key = calculate_synthetic_secret_key(private, DEFAULT_HIDDEN_PUZZLE_HASH)
sigs: List[G2Element] = []
# TODO: address hint error and remove ignore
# error: Argument 1 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
# error: Argument 2 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
error, conditions, cost = conditions_dict_for_solution(
innerpuz, innersol, self.wallet_state_manager.constants.MAX_BLOCK_COST_CLVM
innerpuz, innersol, self.wallet_state_manager.constants.MAX_BLOCK_COST_CLVM # type: ignore[arg-type]
)
if conditions is not None:
for _, msg in pkm_pairs_for_conditions_dict(
Expand Down Expand Up @@ -747,7 +752,12 @@ async def create_spend_bundle_relative_amount(self, cc_amount, zero_coin: Coin =
None,
None,
]
list_of_solutions.append(CoinSpend(coin, puzzle_reveal, Program.to(solution)))
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
list_of_solutions.append(CoinSpend(coin, puzzle_reveal, Program.to(solution))) # type: ignore[arg-type]

aggsig = AugSchemeMPL.aggregate(sigs)
return SpendBundle(list_of_solutions, aggsig)
38 changes: 32 additions & 6 deletions chia/wallet/did_wallet/did_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,11 @@ async def create_message_spend(self, messages: List[Tuple[int, bytes]], new_inne
innersol,
]
)
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)]
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)] # type: ignore[arg-type]
# sign for AGG_SIG_ME
# new_inner_puzhash amount message
message = (
Expand Down Expand Up @@ -609,7 +613,11 @@ async def create_exit_spend(self, puzhash: bytes32):
innersol,
]
)
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)]
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)] # type: ignore[arg-type]
# sign for AGG_SIG_ME
message = (
Program.to([amount, puzhash]).get_tree_hash()
Expand Down Expand Up @@ -681,7 +689,11 @@ async def create_attestment(
innersol,
]
)
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)]
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)] # type: ignore[arg-type]
message_spend = did_wallet_puzzles.create_spend_for_message(coin.name(), recovering_coin_name, newpuz, pubkey)
message_spend_bundle = SpendBundle([message_spend], AugSchemeMPL.aggregate([]))
# sign for AGG_SIG_ME
Expand Down Expand Up @@ -816,7 +828,11 @@ async def recovery_spend(
innersol,
]
)
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)]
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)] # type: ignore[arg-type]

index = await self.wallet_state_manager.puzzle_store.index_for_pubkey(pubkey)
if index is None:
Expand Down Expand Up @@ -935,7 +951,12 @@ async def generate_new_decentralised_id(self, amount: uint64) -> Optional[SpendB

genesis_launcher_solution = Program.to([did_puzzle_hash, amount, bytes(0x80)])

launcher_cs = CoinSpend(launcher_coin, genesis_launcher_puz, genesis_launcher_solution)
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
launcher_cs = CoinSpend(launcher_coin, genesis_launcher_puz, genesis_launcher_solution) # type: ignore[arg-type] # noqa E501
launcher_sb = SpendBundle([launcher_cs], AugSchemeMPL.aggregate([]))
eve_coin = Coin(launcher_coin.name(), did_puzzle_hash, amount)
future_parent = LineageProof(
Expand Down Expand Up @@ -983,7 +1004,12 @@ async def generate_eve_spend(self, coin: Coin, full_puzzle: Program, innerpuz: P
innersol,
]
)
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)]
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
list_of_solutions = [CoinSpend(coin, full_puzzle, fullsol)] # type: ignore[arg-type]
# sign for AGG_SIG_ME
message = (
Program.to([innerpuz.get_tree_hash(), coin.amount, []]).get_tree_hash()
Expand Down
14 changes: 12 additions & 2 deletions chia/wallet/puzzles/prefarm/spend_prefarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,18 @@ async def main() -> None:

p_solution = Program.to(binutils.assemble("()"))

sb_farmer = SpendBundle([CoinSpend(farmer_prefarm, p_farmer_2, p_solution)], G2Element())
sb_pool = SpendBundle([CoinSpend(pool_prefarm, p_pool_2, p_solution)], G2Element())
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
sb_farmer = SpendBundle([CoinSpend(farmer_prefarm, p_farmer_2, p_solution)], G2Element()) # type: ignore[arg-type] # noqa E501
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
sb_pool = SpendBundle([CoinSpend(pool_prefarm, p_pool_2, p_solution)], G2Element()) # type: ignore[arg-type]

print("\n\n\nConditions")
print_conditions(sb_pool)
Expand Down
21 changes: 15 additions & 6 deletions chia/wallet/puzzles/singleton_top_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ def launch_conditions_and_coinsol(

conditions = [create_launcher, assert_launcher_announcement]

# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
launcher_coin_spend = CoinSpend(
launcher_coin,
SINGLETON_LAUNCHER,
launcher_solution,
SINGLETON_LAUNCHER, # type: ignore[arg-type]
launcher_solution, # type: ignore[arg-type]
)

return conditions, launcher_coin_spend
Expand Down Expand Up @@ -174,10 +177,13 @@ def claim_p2_singleton(
delay_time,
delay_ph,
)
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
claim_coinsol = CoinSpend(
p2_singleton_coin,
puzzle,
solution_for_p2_singleton(p2_singleton_coin, singleton_inner_puzhash),
puzzle, # type: ignore[arg-type]
solution_for_p2_singleton(p2_singleton_coin, singleton_inner_puzhash), # type: ignore[arg-type]
)
return assertion, announcement, claim_coinsol

Expand All @@ -190,9 +196,12 @@ def spend_to_delayed_puzzle(
delay_time: uint64,
delay_ph: bytes32,
) -> CoinSpend:
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
claim_coinsol = CoinSpend(
p2_singleton_coin,
pay_to_singleton_or_delay_puzzle(launcher_id, delay_time, delay_ph),
solution_for_p2_delayed_puzzle(output_amount),
pay_to_singleton_or_delay_puzzle(launcher_id, delay_time, delay_ph), # type: ignore[arg-type]
solution_for_p2_delayed_puzzle(output_amount), # type: ignore[arg-type]
)
return claim_coinsol
10 changes: 8 additions & 2 deletions chia/wallet/puzzles/test_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def issue_cc_from_farmed_coin(
# this is just a coincidence... for more complicated puzzles, you'll likely have to do some real work

solution = Program.to(output_conditions)
coin_spend = CoinSpend(farmed_coin, farmed_puzzle, solution)
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
coin_spend = CoinSpend(farmed_coin, farmed_puzzle, solution) # type: ignore[arg-type]
spend_bundle = SpendBundle([coin_spend], NULL_SIGNATURE)
return genesis_coin_checker, spend_bundle

Expand Down Expand Up @@ -206,7 +209,10 @@ def test_spend_zero_coin(mod_code: Program, coin_checker_for_farmed_coin):
wrapped_cc_puzzle_hash = cc_puzzle_hash_for_inner_puzzle_hash(mod_code, genesis_coin_checker, eve_inner_puzzle_hash)

solution = solution_for_pay_to_any([(wrapped_cc_puzzle_hash, 0)])
coin_spend = CoinSpend(farmed_coin, ANYONE_CAN_SPEND_PUZZLE, solution)
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram" [arg-type]
coin_spend = CoinSpend(farmed_coin, ANYONE_CAN_SPEND_PUZZLE, solution) # type: ignore[arg-type]
spendable_cc_list = spendable_cc_list_from_coin_spend(coin_spend, hash_to_puzzle_f)
assert len(spendable_cc_list) == 1
zero_cc_spendable = spendable_cc_list[0]
Expand Down
7 changes: 6 additions & 1 deletion chia/wallet/util/debug_spend_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ def debug_spend_bundle(spend_bundle, agg_sig_additional_data=DEFAULT_CONSTANTS.A
print(f" with id {coin_name}")
print()
print(f"\nbrun -y main.sym '{bu_disassemble(puzzle_reveal)}' '{bu_disassemble(solution)}'")
error, conditions, cost = conditions_dict_for_solution(puzzle_reveal, solution, INFINITE_COST)
# TODO: address hint error and remove ignore
# error: Argument 1 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
# error: Argument 2 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
error, conditions, cost = conditions_dict_for_solution(puzzle_reveal, solution, INFINITE_COST) # type: ignore[arg-type] # noqa E501
if error:
print(f"*** error {error}")
elif conditions is not None:
Expand Down
7 changes: 6 additions & 1 deletion chia/wallet/util/trade_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def get_output_discrepancy_for_puzzle_and_solution(coin, puzzle, solution):


def get_output_amount_for_puzzle_and_solution(puzzle: Program, solution: Program) -> int:
error, conditions, cost = conditions_dict_for_solution(puzzle, solution, INFINITE_COST)
# TODO: address hint error and remove ignore
# error: Argument 1 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
# error: Argument 2 to "conditions_dict_for_solution" has incompatible type "Program"; expected
# "SerializedProgram" [arg-type]
error, conditions, cost = conditions_dict_for_solution(puzzle, solution, INFINITE_COST) # type: ignore[arg-type]
total = 0
if conditions:
for _ in conditions.get(ConditionOpcode.CREATE_COIN, []):
Expand Down
7 changes: 6 additions & 1 deletion chia/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ async def create_spend_bundle_relative_chia(self, chia_amount: int, exclude: Lis
primaries = [{"puzzlehash": newpuzhash, "amount": chia_amount}]
solution = self.make_solution(primaries=primaries)
output_created = coin
list_of_solutions.append(CoinSpend(coin, puzzle, solution))
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
list_of_solutions.append(CoinSpend(coin, puzzle, solution)) # type: ignore[arg-type]

await self.hack_populate_secret_keys_for_coin_spends(list_of_solutions)
spend_bundle = await sign_coin_spends(
Expand Down
7 changes: 6 additions & 1 deletion chia/wallet/wallet_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,12 @@ async def fetch_puzzle_solution(self, peer, height: uint32, coin: Coin) -> CoinS
)
if solution_response is None or not isinstance(solution_response, wallet_protocol.RespondPuzzleSolution):
raise ValueError(f"Was not able to obtain solution {solution_response}")
return CoinSpend(coin, solution_response.response.puzzle, solution_response.response.solution)
# TODO: address hint error and remove ignore
# error: Argument 2 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
# error: Argument 3 to "CoinSpend" has incompatible type "Program"; expected "SerializedProgram"
# [arg-type]
return CoinSpend(coin, solution_response.response.puzzle, solution_response.response.solution) # type: ignore[arg-type] # noqa E501

async def get_additional_coin_spends(
self, peer, block, added_coins: List[Coin], removed_coins: List[Coin]
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"chiavdf==1.0.3", # timelord and vdf verification
"chiabip158==1.0", # bip158-style wallet filters
"chiapos==1.0.6", # proof of space
"clvm==0.9.7",
# TODO: set to the new release version
"clvm @ git+https://github.com/Chia-Network/clvm@pep-561",
"clvm_rs==0.1.15",
"clvm_tools==0.4.3",
"aiohttp==3.7.4", # HTTP server for full node rpc
Expand Down
Loading