diff --git a/chia/full_node/generator.py b/chia/full_node/generator.py index 912f64e908eb..7c3a2dd15eab 100644 --- a/chia/full_node/generator.py +++ b/chia/full_node/generator.py @@ -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]: diff --git a/chia/full_node/mempool_check_conditions.py b/chia/full_node/mempool_check_conditions.py index a7c071e44ad7..e63960075294 100644 --- a/chia/full_node/mempool_check_conditions.py +++ b/chia/full_node/mempool_check_conditions.py @@ -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 diff --git a/chia/types/blockchain_format/tree_hash.py b/chia/types/blockchain_format/tree_hash.py index 5bd03db8b511..837d656a19a6 100644 --- a/chia/types/blockchain_format/tree_hash.py +++ b/chia/types/blockchain_format/tree_hash.py @@ -8,13 +8,13 @@ from typing import Optional, Set -from clvm import CLVMObject +from clvm.SExp import SExp from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.hash import std_hash -def sha256_treehash(sexp: CLVMObject, precalculated: Optional[Set[bytes32]] = None) -> bytes32: +def sha256_treehash(sexp: SExp, precalculated: Optional[Set[bytes32]] = None) -> bytes32: """ Hash values in `precalculated` are presumed to have been hashed already. """ diff --git a/chia/wallet/cc_wallet/cc_utils.py b/chia/wallet/cc_wallet/cc_utils.py index b403ea55059e..129be86be2ec 100644 --- a/chia/wallet/cc_wallet/cc_utils.py +++ b/chia/wallet/cc_wallet/cc_utils.py @@ -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 "SExp"; expected "SerializedProgram" [arg-type] + coin_spend = CoinSpend(coin, puzzle_reveal, Program.to(0)) # type: ignore[arg-type] return coin_spend @@ -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: @@ -157,7 +165,11 @@ 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 "SExp"; 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 == []: diff --git a/chia/wallet/cc_wallet/cc_wallet.py b/chia/wallet/cc_wallet/cc_wallet.py index 3487f232a184..20ce7e6d8b07 100644 --- a/chia/wallet/cc_wallet/cc_wallet.py +++ b/chia/wallet/cc_wallet/cc_wallet.py @@ -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( @@ -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 "SExp"; 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) diff --git a/chia/wallet/did_wallet/did_wallet.py b/chia/wallet/did_wallet/did_wallet.py index f6f207a4fc2a..60417b7a99b9 100644 --- a/chia/wallet/did_wallet/did_wallet.py +++ b/chia/wallet/did_wallet/did_wallet.py @@ -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 "SExp"; 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 = ( @@ -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 "SExp"; 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() @@ -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 "SExp"; 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 @@ -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 "SExp"; 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: @@ -935,7 +951,11 @@ 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 "SExp"; 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( @@ -983,7 +1003,11 @@ 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 "SExp"; 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() diff --git a/chia/wallet/puzzles/prefarm/spend_prefarm.py b/chia/wallet/puzzles/prefarm/spend_prefarm.py index 06037659201b..0c03163b02d8 100644 --- a/chia/wallet/puzzles/prefarm/spend_prefarm.py +++ b/chia/wallet/puzzles/prefarm/spend_prefarm.py @@ -63,8 +63,14 @@ 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 "SExp"; expected "SerializedProgram" [arg-type] + # error: Argument 3 to "CoinSpend" has incompatible type "SExp"; 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 "SExp"; expected "SerializedProgram" [arg-type] + # error: Argument 3 to "CoinSpend" has incompatible type "SExp"; 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) diff --git a/chia/wallet/puzzles/singleton_top_layer.py b/chia/wallet/puzzles/singleton_top_layer.py index 3cb0effe55e0..a329dec61462 100644 --- a/chia/wallet/puzzles/singleton_top_layer.py +++ b/chia/wallet/puzzles/singleton_top_layer.py @@ -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 "SExp"; 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 @@ -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 @@ -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 diff --git a/chia/wallet/puzzles/test_cc.py b/chia/wallet/puzzles/test_cc.py index 2ac473e6bf47..289ee1dffaa1 100644 --- a/chia/wallet/puzzles/test_cc.py +++ b/chia/wallet/puzzles/test_cc.py @@ -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 "SExp"; expected "SerializedProgram" [arg-type] + # error: Argument 3 to "CoinSpend" has incompatible type "SExp"; 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 @@ -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 "SExp"; 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] diff --git a/chia/wallet/util/debug_spend_bundle.py b/chia/wallet/util/debug_spend_bundle.py index c22f5cd04882..d111456be15f 100644 --- a/chia/wallet/util/debug_spend_bundle.py +++ b/chia/wallet/util/debug_spend_bundle.py @@ -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: diff --git a/chia/wallet/util/trade_utils.py b/chia/wallet/util/trade_utils.py index 3fd50726fe60..2f9faf2c8aae 100644 --- a/chia/wallet/util/trade_utils.py +++ b/chia/wallet/util/trade_utils.py @@ -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, []): diff --git a/chia/wallet/wallet.py b/chia/wallet/wallet.py index 3458182825d3..8a517311a10d 100644 --- a/chia/wallet/wallet.py +++ b/chia/wallet/wallet.py @@ -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( diff --git a/chia/wallet/wallet_node.py b/chia/wallet/wallet_node.py index 086633f8d1be..45117731b06f 100644 --- a/chia/wallet/wallet_node.py +++ b/chia/wallet/wallet_node.py @@ -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] diff --git a/setup.py b/setup.py index d4c1723ef8f5..6b31e910b045 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/tests/clvm/test_puzzles.py b/tests/clvm/test_puzzles.py index 8f508448c96c..d59e9afc5219 100644 --- a/tests/clvm/test_puzzles.py +++ b/tests/clvm/test_puzzles.py @@ -70,7 +70,7 @@ def do_test_spend( coin = coin_db.farm_coin(puzzle_hash, farm_time) # spend it - coin_spend = CoinSpend(coin, puzzle_reveal, solution) + coin_spend = CoinSpend(coin, puzzle_reveal.to_serialized_program(), solution.to_serialized_program()) spend_bundle = SpendBundle([coin_spend], G2Element()) coin_db.update_coin_store_for_spend_bundle(spend_bundle, spend_time, MAX_BLOCK_COST_CLVM, COST_PER_BYTE) diff --git a/tests/core/full_node/test_conditions.py b/tests/core/full_node/test_conditions.py index 3f7ca9a4876c..a976fc0945c4 100644 --- a/tests/core/full_node/test_conditions.py +++ b/tests/core/full_node/test_conditions.py @@ -121,7 +121,7 @@ async def check_conditions( blocks = initial_blocks() coin = list(blocks[spend_reward_index].get_included_reward_coins())[0] - coin_spend = CoinSpend(coin, EASY_PUZZLE, condition_solution) + coin_spend = CoinSpend(coin, EASY_PUZZLE.to_serialized_program(), condition_solution.to_serialized_program()) spend_bundle = SpendBundle([coin_spend], G2Element()) # now let's try to create a block with the spend bundle and ensure that it doesn't validate diff --git a/tests/core/make_block_generator.py b/tests/core/make_block_generator.py index 37f4711183a9..089461d69ad4 100644 --- a/tests/core/make_block_generator.py +++ b/tests/core/make_block_generator.py @@ -55,7 +55,7 @@ def make_spend_bundle(count: int) -> SpendBundle: puzzle_reveal = puzzle_hash_db[coin.puzzle_hash] conditions = conditions_for_payment(coin) solution = solution_for_conditions(conditions) - coin_spend = CoinSpend(coin, puzzle_reveal, solution) + coin_spend = CoinSpend(coin, puzzle_reveal, solution.to_serialized_program()) coin_spends.append(coin_spend) spend_bundle = SpendBundle(coin_spends, blspy.G2Element()) diff --git a/tests/generator/test_compression.py b/tests/generator/test_compression.py index 1313cc6a2b5c..97474d5e854c 100644 --- a/tests/generator/test_compression.py +++ b/tests/generator/test_compression.py @@ -78,7 +78,7 @@ def create_multiple_ref_generator(args: MultipleCompressorArg, spend_bundle: Spe GeneratorArg(FAKE_BLOCK_HEIGHT1, args.arg[0].generator), GeneratorArg(FAKE_BLOCK_HEIGHT2, args.arg[1].generator), ] - return BlockGenerator(program, generator_args) + return BlockGenerator(program.to_serialized_program(), generator_args) def spend_bundle_to_coin_spend_entry_list(bundle: SpendBundle) -> List[Any]: diff --git a/tests/util/benchmark_cost.py b/tests/util/benchmark_cost.py index 417467917a5f..95fb0f015c68 100644 --- a/tests/util/benchmark_cost.py +++ b/tests/util/benchmark_cost.py @@ -126,7 +126,7 @@ def benchmark_all_operators(): puzzle_start = time.time() clvm_cost = 0 for i in range(0, 1000): - cost_run, sexp = puzzles[i].run_with_cost(solutions[i], INFINITE_COST) + cost_run, sexp = puzzles[i].run_with_cost(max_cost=INFINITE_COST, args=solutions[i]) clvm_cost += cost_run puzzle_end = time.time() diff --git a/tests/wallet/test_singleton_lifecycle.py b/tests/wallet/test_singleton_lifecycle.py index f98c57d164ed..c7214f3972ae 100644 --- a/tests/wallet/test_singleton_lifecycle.py +++ b/tests/wallet/test_singleton_lifecycle.py @@ -70,7 +70,9 @@ def launcher_conditions_and_spend_bundle( ) ) launcher_solution = Program.to([singleton_full_puzzle_hash, launcher_amount, metadata]) - coin_spend = CoinSpend(launcher_coin, launcher_puzzle, launcher_solution) + coin_spend = CoinSpend( + launcher_coin, launcher_puzzle.to_serialized_program(), launcher_solution.to_serialized_program() + ) spend_bundle = SpendBundle([coin_spend], G2Element()) lineage_proof = Program.to([parent_coin_id, launcher_amount]) return lineage_proof, launcher_coin.name(), expected_conditions, spend_bundle diff --git a/tests/wallet/test_singleton_lifecycle_fast.py b/tests/wallet/test_singleton_lifecycle_fast.py index 89af12c7b515..f5ed9da28830 100644 --- a/tests/wallet/test_singleton_lifecycle_fast.py +++ b/tests/wallet/test_singleton_lifecycle_fast.py @@ -221,7 +221,7 @@ def coin_spend_for_conditions(self, puzzle_db: PuzzleDB, **kwargs) -> CoinSpend: solution = solve_puzzle( puzzle_db, puzzle_reveal, lineage_proof=self.lineage_proof, coin_amount=coin.amount, **kwargs ) - return CoinSpend(coin, puzzle_reveal, solution) + return CoinSpend(coin, puzzle_reveal.to_serialized_program(), solution.to_serialized_program()) def update_state(self, puzzle_db: PuzzleDB, removals: List[CoinSpend]) -> int: state_change_count = 0 @@ -293,7 +293,9 @@ def launcher_conditions_and_spend_bundle( launcher_amount=launcher_amount, metadata=metadata, ) - coin_spend = CoinSpend(launcher_coin, SerializedProgram.from_program(launcher_puzzle), solution) + coin_spend = CoinSpend( + launcher_coin, SerializedProgram.from_program(launcher_puzzle), solution.to_serialized_program() + ) spend_bundle = SpendBundle([coin_spend], G2Element()) return launcher_coin.name(), expected_conditions, spend_bundle @@ -355,7 +357,7 @@ def claim_p2_singleton( p2_singleton_coin_spend = CoinSpend( p2_singleton_coin, p2_singleton_puzzle.to_serialized_program(), - p2_singleton_solution, + p2_singleton_solution.to_serialized_program(), ) expected_p2_singleton_announcement = Announcement(p2_singleton_coin_name, bytes(b"$")).name() singleton_conditions = [ @@ -415,7 +417,9 @@ def spend_coin_to_singleton( ) conditions = Program.to(condition_list) - coin_spend = CoinSpend(farmed_coin, ANYONE_CAN_SPEND_PUZZLE, conditions) + coin_spend = CoinSpend( + farmed_coin, ANYONE_CAN_SPEND_PUZZLE.to_serialized_program(), conditions.to_serialized_program() + ) spend_bundle = SpendBundle.aggregate([launcher_spend_bundle, SpendBundle([coin_spend], G2Element())]) additions, removals = coin_store.update_coin_store_for_spend_bundle( diff --git a/tests/wallet_tools.py b/tests/wallet_tools.py index d22e67262cae..efe1a5598f12 100644 --- a/tests/wallet_tools.py +++ b/tests/wallet_tools.py @@ -149,9 +149,15 @@ def generate_unsigned_transaction( ConditionWithArgs(ConditionOpcode.ASSERT_COIN_ANNOUNCEMENT, [primary_announcement_hash]) ) main_solution = self.make_solution(condition_dic) - spends.append(CoinSpend(coin, puzzle, main_solution)) + spends.append(CoinSpend(coin, puzzle.to_serialized_program(), main_solution.to_serialized_program())) else: - spends.append(CoinSpend(coin, puzzle, self.make_solution(secondary_coins_cond_dic))) + spends.append( + CoinSpend( + coin, + puzzle.to_serialized_program(), + self.make_solution(secondary_coins_cond_dic).to_serialized_program(), + ) + ) return spends def sign_transaction(self, coin_spends: List[CoinSpend]) -> SpendBundle: