From 1dfd2b542e6f09052d312f1297906eba42f1d66c Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Tue, 12 Jul 2022 09:56:11 -0500 Subject: [PATCH] minor test fixes --- chia/data_layer/data_layer_wallet.py | 35 ++++++++++------------ chia/wallet/db_wallet/db_wallet_puzzles.py | 8 ++--- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/chia/data_layer/data_layer_wallet.py b/chia/data_layer/data_layer_wallet.py index 5bf6b73ff9..0f198d116f 100644 --- a/chia/data_layer/data_layer_wallet.py +++ b/chia/data_layer/data_layer_wallet.py @@ -12,8 +12,8 @@ from blspy import G2Element from chia.consensus.block_record import BlockRecord from chia.protocols.wallet_protocol import PuzzleSolutionResponse, CoinState from chia.wallet.db_wallet.db_wallet_puzzles import ( - ACS, - ACS_PH, + ACS_MU, + ACS_MU_PH, create_host_fullpuz, SINGLETON_LAUNCHER, create_host_layer_puzzle, @@ -419,7 +419,6 @@ class DataLayerWallet: # Make the child's puzzles next_inner_puzzle: Program = await self.standard_wallet.get_new_puzzle(in_transaction=in_transaction) - next_db_layer_puzzle: Program = create_host_layer_puzzle(next_inner_puzzle, root_hash) next_full_puz = create_host_fullpuz(next_inner_puzzle, root_hash, launcher_id) # Construct the current puzzles @@ -435,7 +434,7 @@ class DataLayerWallet: assert singleton_record.lineage_proof.amount is not None primaries: List[AmountWithPuzzlehash] = [ { - "puzzlehash": next_db_layer_puzzle.get_tree_hash(), + "puzzlehash": next_inner_puzzle.get_tree_hash(), "amount": singleton_record.lineage_proof.amount, "memos": [launcher_id, root_hash, next_inner_puzzle.get_tree_hash()], } @@ -444,10 +443,10 @@ class DataLayerWallet: primaries=primaries, coin_announcements={b"$"} if fee > 0 else None, ) - magic_condition = [-24, ACS, [[Program.to((root_hash, None)), ACS_PH], None]] + magic_condition = Program.to([-24, ACS_MU, [[Program.to((root_hash, None)), ACS_MU_PH], None]]) # TODO: This line is a hack, make_solution should allow us to pass extra conditions to it - innersol = Program.to([[], (1, magic_condition.cons(innersol.at("rfr"))), []]) - db_layer_sol = Program.to([0, inner_sol, current_inner_puzzle]) + inner_sol = Program.to([[], (1, magic_condition.cons(inner_sol.at("rfr"))), []]) + db_layer_sol = Program.to([inner_sol]) full_sol = Program.to( [ parent_lineage.to_program(), @@ -615,19 +614,15 @@ class DataLayerWallet: if condition[0] == ConditionOpcode.CREATE_COIN and int.from_bytes(condition[2], "big") % 2 == 1: full_puzzle_hash = bytes32(condition[1]) amount = uint64(int.from_bytes(condition[2], "big")) - if current_full_puz_hash == full_puzzle_hash: - root = singleton_record.root - inner_puzzle_hash = singleton_record.inner_puzzle_hash - else: - try: - root = bytes32(condition[3][1]) - inner_puzzle_hash = bytes32(condition[3][2]) - except IndexError: - self.log.warning( - f"Parent {parent_name} with launcher {singleton_record.launcher_id} " - "did not hint its child properly" - ) - return + try: + root = bytes32(condition[3][1]) + inner_puzzle_hash = bytes32(condition[3][2]) + except IndexError: + self.log.warning( + f"Parent {parent_name} with launcher {singleton_record.launcher_id} " + "did not hint its child properly" + ) + return found_singleton = True break diff --git a/chia/wallet/db_wallet/db_wallet_puzzles.py b/chia/wallet/db_wallet/db_wallet_puzzles.py index 12310f4f2a..0f68b59f56 100644 --- a/chia/wallet/db_wallet/db_wallet_puzzles.py +++ b/chia/wallet/db_wallet/db_wallet_puzzles.py @@ -9,8 +9,8 @@ from chia.wallet.puzzles.load_clvm import load_clvm # from chia.types.condition_opcodes import ConditionOpcode # from chia.wallet.util.merkle_tree import MerkleTree, TreeType -ACS = Program.to(1) -ACS_PH = ACS.get_tree_hash() +ACS_MU = Program.to(11) # returns the third argument a.k.a the full solution +ACS_MU_PH = ACS_MU.get_tree_hash() SINGLETON_TOP_LAYER_MOD = load_clvm("singleton_top_layer_v1_1.clvm") # TODO: need new data layer specific clvm SINGLETON_LAUNCHER = load_clvm("singleton_launcher.clvm") @@ -25,7 +25,7 @@ def create_host_fullpuz(innerpuz: Union[Program, bytes32], current_root: bytes32 def create_host_layer_puzzle(innerpuz: Union[Program, bytes32], current_root: bytes32) -> Program: # some hard coded metadata formatting and metadata updater for now - return create_nft_layer_puzzle_with_curry_params(Program.to((current_root, None)), ACS_PH, innerpuz) + return create_nft_layer_puzzle_with_curry_params(Program.to((current_root, None)), ACS_MU_PH, innerpuz) def match_dl_singleton(puzzle: Program) -> Tuple[bool, Iterator[Program]]: @@ -35,7 +35,7 @@ def match_dl_singleton(puzzle: Program) -> Tuple[bool, Iterator[Program]]: mod, singleton_curried_args = puzzle.uncurry() if mod == SINGLETON_TOP_LAYER_MOD: mod, dl_curried_args = singleton_curried_args.at("rf").uncurry() - if mod == NFT_STATE_LAYER_MOD and dl_curried_args.at("rrf") == ACS_PH: + if mod == NFT_STATE_LAYER_MOD and dl_curried_args.at("rrf") == ACS_MU_PH: launcher_id = singleton_curried_args.at("frf") root = dl_curried_args.at("rff") innerpuz = dl_curried_args.at("rrrf")