diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0b8f276fef6e..0354ca968f72 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: hooks: - id: check-yaml - id: end-of-file-fixer - exclude: ".*?(.hex|.clvm|.clib)" + exclude: ".*?(.hex|.clsp|.clvm|.clib)" - id: trailing-whitespace - id: check-merge-conflict - id: check-ast @@ -31,7 +31,7 @@ repos: - repo: local hooks: - id: clvm_hex - name: .clvm.hex files + name: .clsp.hex files entry: ./activated.py python tools/manage_clvm.py check language: python pass_filenames: false diff --git a/chia/clvm/singleton.py b/chia/clvm/singleton.py index 3a1419de64cf..67519b05fb4c 100644 --- a/chia/clvm/singleton.py +++ b/chia/clvm/singleton.py @@ -2,6 +2,6 @@ from __future__ import annotations from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clvm") -SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm") -SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clvm") +P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clsp") +SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer.clsp") +SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clsp") diff --git a/chia/full_node/generator.py b/chia/full_node/generator.py index 38ade6ee98d8..ce0a7352fb1f 100644 --- a/chia/full_node/generator.py +++ b/chia/full_node/generator.py @@ -12,15 +12,15 @@ from chia.wallet.puzzles.rom_bootstrap_generator import get_generator GENERATOR_MOD = get_generator() -DECOMPRESS_BLOCK = load_clvm_maybe_recompile("block_program_zero.clvm", package_or_requirement="chia.wallet.puzzles") -DECOMPRESS_PUZZLE = load_clvm_maybe_recompile("decompress_puzzle.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_BLOCK = load_clvm_maybe_recompile("block_program_zero.clsp", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_PUZZLE = load_clvm_maybe_recompile("decompress_puzzle.clsp", package_or_requirement="chia.wallet.puzzles") # DECOMPRESS_CSE = load_clvm_maybe_recompile( -# "decompress_coin_spend_entry.clvm", +# "decompress_coin_spend_entry.clsp", # package_or_requirement="chia.wallet.puzzles", # ) DECOMPRESS_CSE_WITH_PREFIX = load_clvm_maybe_recompile( - "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="chia.wallet.puzzles" + "decompress_coin_spend_entry_with_prefix.clsp", package_or_requirement="chia.wallet.puzzles" ) log = logging.getLogger(__name__) diff --git a/chia/full_node/mempool_check_conditions.py b/chia/full_node/mempool_check_conditions.py index 3fa979c19b39..38144a1e7b67 100644 --- a/chia/full_node/mempool_check_conditions.py +++ b/chia/full_node/mempool_check_conditions.py @@ -27,7 +27,7 @@ from chia.wallet.puzzles.rom_bootstrap_generator import get_generator GENERATOR_MOD = get_generator() DESERIALIZE_MOD = load_serialized_clvm_maybe_recompile( - "chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles" + "chialisp_deserialisation.clsp", package_or_requirement="chia.wallet.puzzles" ) log = logging.getLogger(__name__) diff --git a/chia/pools/pool_puzzles.py b/chia/pools/pool_puzzles.py index 117e542609cb..6d5705ddcf5c 100644 --- a/chia/pools/pool_puzzles.py +++ b/chia/pools/pool_puzzles.py @@ -21,10 +21,10 @@ from chia.wallet.puzzles.singleton_top_layer import puzzle_for_singleton log = logging.getLogger(__name__) # "Full" is the outer singleton, with the inner puzzle filled in -SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm") -POOL_WAITING_ROOM_MOD = load_clvm_maybe_recompile("pool_waitingroom_innerpuz.clvm") -POOL_MEMBER_MOD = load_clvm_maybe_recompile("pool_member_innerpuz.clvm") -P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clvm") +SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clsp") +POOL_WAITING_ROOM_MOD = load_clvm_maybe_recompile("pool_waitingroom_innerpuz.clsp") +POOL_MEMBER_MOD = load_clvm_maybe_recompile("pool_member_innerpuz.clsp") +P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clsp") POOL_OUTER_MOD = SINGLETON_MOD POOL_MEMBER_HASH = POOL_MEMBER_MOD.get_tree_hash() diff --git a/chia/types/condition_opcodes.py b/chia/types/condition_opcodes.py index 1cb36c499e5e..3ac77e610f9f 100644 --- a/chia/types/condition_opcodes.py +++ b/chia/types/condition_opcodes.py @@ -4,7 +4,7 @@ import enum from typing import Any -# See chia/wallet/puzzles/condition_codes.clvm +# See chia/wallet/puzzles/condition_codes.clib class ConditionOpcode(bytes, enum.Enum): # AGG_SIG is ascii "1" diff --git a/chia/wallet/db_wallet/db_wallet_puzzles.py b/chia/wallet/db_wallet/db_wallet_puzzles.py index 992ae1725dd8..a0ff84bde06e 100644 --- a/chia/wallet/db_wallet/db_wallet_puzzles.py +++ b/chia/wallet/db_wallet/db_wallet_puzzles.py @@ -14,10 +14,10 @@ from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile 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_maybe_recompile("singleton_top_layer_v1_1.clvm") -SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clvm") -GRAFTROOT_DL_OFFERS = load_clvm_maybe_recompile("graftroot_dl_offers.clvm") -P2_PARENT = load_clvm_maybe_recompile("p2_parent.clvm") +SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clsp") +SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clsp") +GRAFTROOT_DL_OFFERS = load_clvm_maybe_recompile("graftroot_dl_offers.clsp") +P2_PARENT = load_clvm_maybe_recompile("p2_parent.clsp") def create_host_fullpuz(innerpuz: Union[Program, bytes32], current_root: bytes32, genesis_id: bytes32) -> Program: diff --git a/chia/wallet/did_wallet/did_wallet_puzzles.py b/chia/wallet/did_wallet/did_wallet_puzzles.py index 4c0a6cfef676..0d615c31bf2d 100644 --- a/chia/wallet/did_wallet/did_wallet_puzzles.py +++ b/chia/wallet/did_wallet/did_wallet_puzzles.py @@ -19,9 +19,9 @@ from chia.wallet.singleton import ( ) from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash -DID_INNERPUZ_MOD = load_clvm_maybe_recompile("did_innerpuz.clvm") +DID_INNERPUZ_MOD = load_clvm_maybe_recompile("did_innerpuz.clsp") DID_INNERPUZ_MOD_HASH = DID_INNERPUZ_MOD.get_tree_hash() -INTERMEDIATE_LAUNCHER_MOD = load_clvm_maybe_recompile("nft_intermediate_launcher.clvm") +INTERMEDIATE_LAUNCHER_MOD = load_clvm_maybe_recompile("nft_intermediate_launcher.clsp") def create_innerpuz( diff --git a/chia/wallet/nft_wallet/metadata_outer_puzzle.py b/chia/wallet/nft_wallet/metadata_outer_puzzle.py index a641587c8221..cbfbd3738fbd 100644 --- a/chia/wallet/nft_wallet/metadata_outer_puzzle.py +++ b/chia/wallet/nft_wallet/metadata_outer_puzzle.py @@ -11,7 +11,7 @@ from chia.wallet.puzzle_drivers import PuzzleInfo, Solver from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle -NFT_STATE_LAYER_MOD = load_clvm_maybe_recompile("nft_state_layer.clvm") +NFT_STATE_LAYER_MOD = load_clvm_maybe_recompile("nft_state_layer.clsp") NFT_STATE_LAYER_MOD_HASH = NFT_STATE_LAYER_MOD.get_tree_hash() diff --git a/chia/wallet/nft_wallet/nft_info.py b/chia/wallet/nft_wallet/nft_info.py index 045d651da777..b70571433a53 100644 --- a/chia/wallet/nft_wallet/nft_info.py +++ b/chia/wallet/nft_wallet/nft_info.py @@ -11,7 +11,7 @@ from chia.util.streamable import Streamable, streamable from chia.wallet.lineage_proof import LineageProof from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clvm") +LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clsp") IN_TRANSACTION_STATUS = "IN_TRANSACTION" DEFAULT_STATUS = "DEFAULT" diff --git a/chia/wallet/nft_wallet/nft_puzzles.py b/chia/wallet/nft_wallet/nft_puzzles.py index 697102bff047..44f6f79a1de4 100644 --- a/chia/wallet/nft_wallet/nft_puzzles.py +++ b/chia/wallet/nft_wallet/nft_puzzles.py @@ -18,26 +18,26 @@ from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import solution_fo from chia.wallet.util.address_type import AddressType log = logging.getLogger(__name__) -SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") -LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clvm") -NFT_STATE_LAYER_MOD = load_clvm_maybe_recompile("nft_state_layer.clvm") +SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clsp") +LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clsp") +NFT_STATE_LAYER_MOD = load_clvm_maybe_recompile("nft_state_layer.clsp") LAUNCHER_PUZZLE_HASH = LAUNCHER_PUZZLE.get_tree_hash() SINGLETON_MOD_HASH = SINGLETON_TOP_LAYER_MOD.get_tree_hash() NFT_STATE_LAYER_MOD_HASH = NFT_STATE_LAYER_MOD.get_tree_hash() -NFT_METADATA_UPDATER = load_clvm_maybe_recompile("nft_metadata_updater_default.clvm") -NFT_OWNERSHIP_LAYER = load_clvm_maybe_recompile("nft_ownership_layer.clvm") +NFT_METADATA_UPDATER = load_clvm_maybe_recompile("nft_metadata_updater_default.clsp") +NFT_OWNERSHIP_LAYER = load_clvm_maybe_recompile("nft_ownership_layer.clsp") NFT_OWNERSHIP_LAYER_HASH = NFT_OWNERSHIP_LAYER.get_tree_hash() NFT_TRANSFER_PROGRAM_DEFAULT = load_clvm_maybe_recompile( - "nft_ownership_transfer_program_one_way_claim_with_royalties.clvm", + "nft_ownership_transfer_program_one_way_claim_with_royalties.clsp", ) -STANDARD_PUZZLE_MOD = load_clvm_maybe_recompile("p2_delegated_puzzle_or_hidden_puzzle.clvm") -INTERMEDIATE_LAUNCHER_MOD = load_clvm_maybe_recompile("nft_intermediate_launcher.clvm") +STANDARD_PUZZLE_MOD = load_clvm_maybe_recompile("p2_delegated_puzzle_or_hidden_puzzle.clsp") +INTERMEDIATE_LAUNCHER_MOD = load_clvm_maybe_recompile("nft_intermediate_launcher.clsp") def create_nft_layer_puzzle_with_curry_params( metadata: Program, metadata_updater_hash: bytes32, inner_puzzle: Program ) -> Program: - """Curries params into nft_state_layer.clvm + """Curries params into nft_state_layer.clsp Args to curry: NFT_STATE_LAYER_MOD_HASH diff --git a/chia/wallet/nft_wallet/ownership_outer_puzzle.py b/chia/wallet/nft_wallet/ownership_outer_puzzle.py index b227287321cf..15f27b96f592 100644 --- a/chia/wallet/nft_wallet/ownership_outer_puzzle.py +++ b/chia/wallet/nft_wallet/ownership_outer_puzzle.py @@ -11,7 +11,7 @@ from chia.wallet.puzzle_drivers import PuzzleInfo, Solver from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle -OWNERSHIP_LAYER_MOD = load_clvm_maybe_recompile("nft_ownership_layer.clvm") +OWNERSHIP_LAYER_MOD = load_clvm_maybe_recompile("nft_ownership_layer.clsp") def match_ownership_layer_puzzle(puzzle: UncurriedPuzzle) -> Tuple[bool, List[Program]]: diff --git a/chia/wallet/nft_wallet/transfer_program_puzzle.py b/chia/wallet/nft_wallet/transfer_program_puzzle.py index bb4db84e4424..3472e1a7cea3 100644 --- a/chia/wallet/nft_wallet/transfer_program_puzzle.py +++ b/chia/wallet/nft_wallet/transfer_program_puzzle.py @@ -11,7 +11,7 @@ from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.puzzles.singleton_top_layer_v1_1 import SINGLETON_LAUNCHER_HASH, SINGLETON_MOD_HASH from chia.wallet.uncurried_puzzle import UncurriedPuzzle -TRANSFER_PROGRAM_MOD = load_clvm_maybe_recompile("nft_ownership_transfer_program_one_way_claim_with_royalties.clvm") +TRANSFER_PROGRAM_MOD = load_clvm_maybe_recompile("nft_ownership_transfer_program_one_way_claim_with_royalties.clsp") def match_transfer_program_puzzle(puzzle: UncurriedPuzzle) -> Tuple[bool, List[Program]]: diff --git a/chia/wallet/nft_wallet/uncurry_nft.py b/chia/wallet/nft_wallet/uncurry_nft.py index f244ba3d3511..0fa2b2716cae 100644 --- a/chia/wallet/nft_wallet/uncurry_nft.py +++ b/chia/wallet/nft_wallet/uncurry_nft.py @@ -10,9 +10,9 @@ from chia.util.ints import uint16 from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile log = logging.getLogger(__name__) -SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") -NFT_MOD = load_clvm_maybe_recompile("nft_state_layer.clvm") -NFT_OWNERSHIP_LAYER = load_clvm_maybe_recompile("nft_ownership_layer.clvm") +SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clsp") +NFT_MOD = load_clvm_maybe_recompile("nft_state_layer.clsp") +NFT_OWNERSHIP_LAYER = load_clvm_maybe_recompile("nft_ownership_layer.clsp") _T_UncurriedNFT = TypeVar("_T_UncurriedNFT", bound="UncurriedNFT") diff --git a/chia/wallet/puzzles/block_program_zero.clvm b/chia/wallet/puzzles/block_program_zero.clsp similarity index 100% rename from chia/wallet/puzzles/block_program_zero.clvm rename to chia/wallet/puzzles/block_program_zero.clsp diff --git a/chia/wallet/puzzles/block_program_zero.clvm.hex b/chia/wallet/puzzles/block_program_zero.clsp.hex similarity index 100% rename from chia/wallet/puzzles/block_program_zero.clvm.hex rename to chia/wallet/puzzles/block_program_zero.clsp.hex diff --git a/chia/wallet/puzzles/block_program_zero.clvm.hex.sha256tree b/chia/wallet/puzzles/block_program_zero.clvm.hex.sha256tree deleted file mode 100644 index f15d7fbf6c4a..000000000000 --- a/chia/wallet/puzzles/block_program_zero.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -f0a38c8efe58895ae527c65c37f700a4238504691b83990e5dd91bd8b3c30eae diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm b/chia/wallet/puzzles/calculate_synthetic_public_key.clsp similarity index 100% rename from chia/wallet/puzzles/calculate_synthetic_public_key.clvm rename to chia/wallet/puzzles/calculate_synthetic_public_key.clsp diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex b/chia/wallet/puzzles/calculate_synthetic_public_key.clsp.hex similarity index 100% rename from chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex rename to chia/wallet/puzzles/calculate_synthetic_public_key.clsp.hex diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree b/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree deleted file mode 100644 index 9e6a549e6461..000000000000 --- a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -624c5d5704d0decadfc0503e71bbffb6cdfe45025bce7cf3e6864d1eafe8f65e diff --git a/chia/wallet/puzzles/cat_loader.py b/chia/wallet/puzzles/cat_loader.py index e89af5d540f8..91f0f5679c0a 100644 --- a/chia/wallet/puzzles/cat_loader.py +++ b/chia/wallet/puzzles/cat_loader.py @@ -2,7 +2,6 @@ from __future__ import annotations from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -CAT_MOD = load_clvm_maybe_recompile("cat_v2.clvm", package_or_requirement=__name__) -LOCK_INNER_PUZZLE = load_clvm_maybe_recompile("lock.inner.puzzle.clvm", package_or_requirement=__name__) +CAT_MOD = load_clvm_maybe_recompile("cat_v2.clsp", package_or_requirement=__name__) CAT_MOD_HASH = CAT_MOD.get_tree_hash() diff --git a/chia/wallet/puzzles/cat_v2.clvm b/chia/wallet/puzzles/cat_v2.clsp similarity index 97% rename from chia/wallet/puzzles/cat_v2.clvm rename to chia/wallet/puzzles/cat_v2.clsp index 6a9088d1223d..bcfa5a69d495 100644 --- a/chia/wallet/puzzles/cat_v2.clvm +++ b/chia/wallet/puzzles/cat_v2.clsp @@ -1,397 +1,397 @@ -; Coins locked with this puzzle are spendable cats. -; -; Choose a list of n inputs (n>=1), I_1, ... I_n with amounts A_1, ... A_n. -; -; We put them in a ring, so "previous" and "next" have intuitive k-1 and k+1 semantics, -; wrapping so {n} and 0 are the same, ie. all indices are mod n. -; -; Each coin creates 0 or more coins with total output value O_k. -; Let D_k = the "debt" O_k - A_k contribution of coin I_k, ie. how much debt this input accumulates. -; Some coins may spend more than they contribute and some may spend less, ie. D_k need -; not be zero. That's okay. It's enough for the total of all D_k in the ring to be 0. -; -; A coin can calculate its own D_k since it can verify A_k (it's hashed into the coin id) -; and it can sum up `CREATE_COIN` conditions for O_k. -; -; Defines a "subtotal of debts" S_k for each coin as follows: -; -; S_1 = 0 -; S_k = S_{k-1} + D_{k-1} -; -; Here's the main trick that shows the ring sums to 0. -; You can prove by induction that S_{k+1} = D_1 + D_2 + ... + D_k. -; But it's a ring, so S_{n+1} is also S_1, which is 0. So D_1 + D_2 + ... + D_k = 0. -; So the total debts must be 0, ie. no coins are created or destroyed. -; -; Each coin's solution includes I_{k-1}, I_k, and I_{k+1} along with proofs that I_{k}, and I_{k+1} are CATs of the same type. -; Each coin's solution includes S_{k-1}. It calculates D_k = O_k - A_k, and then S_k = S_{k-1} + D_{k-1} -; -; Announcements are used to ensure that each S_k follows the pattern is valid. -; Announcements automatically commit to their own coin id. -; Coin I_k creates an announcement that further commits to I_{k-1} and S_{k-1}. -; -; Coin I_k gets a proof that I_{k+1} is a cat, so it knows it must also create an announcement -; when spent. It checks that I_{k+1} creates an announcement committing to I_k and S_k. -; -; So S_{k+1} is correct iff S_k is correct. -; -; Coins also receive proofs that their neighbours are CATs, ensuring the announcements aren't forgeries. -; Inner puzzles and the CAT layer prepend `CREATE_COIN_ANNOUNCEMENT` with different prefixes to avoid forgeries. -; Ring announcements use 0xcb, and inner puzzles are given 0xca -; -; In summary, I_k generates a coin_announcement Y_k ("Y" for "yell") as follows: -; -; Y_k: hash of I_k (automatically), I_{k-1}, S_k -; -; Each coin creates an assert_coin_announcement to ensure that the next coin's announcement is as expected: -; Y_{k+1} : hash of I_{k+1}, I_k, S_{k+1} -; -; TLDR: -; I_k : coins -; A_k : amount coin k contributes -; O_k : amount coin k spend -; D_k : difference/delta that coin k incurs (A - O) -; S_k : subtotal of debts D_1 + D_2 ... + D_k -; Y_k : announcements created by coin k committing to I_{k-1}, I_k, S_k -; -; All conditions go through a "transformer" that looks for CREATE_COIN conditions -; generated by the inner solution, and wraps the puzzle hash ensuring the output is a cat. -; -; Three output conditions are prepended to the list of conditions for each I_k: -; (ASSERT_MY_ID I_k) to ensure that the passed in value for I_k is correct -; (CREATE_COIN_ANNOUNCEMENT I_{k-1} S_k) to create this coin's announcement -; (ASSERT_COIN_ANNOUNCEMENT hashed_announcement(Y_{k+1})) to ensure the next coin really is next and -; the relative values of S_k and S_{k+1} are correct -; -; This is all we need to do to ensure cats exactly balance in the inputs and outputs. -; -; Proof: -; Consider n, k, I_k values, O_k values, S_k and A_k as above. -; For the (CREATE_COIN_ANNOUNCEMENT Y_{k+1}) (created by the next coin) -; and (ASSERT_COIN_ANNOUNCEMENT hashed(Y_{k+1})) to match, -; we see that I_k can ensure that is has the correct value for S_{k+1}. -; -; By induction, we see that S_{m+1} = sum(i, 1, m) [O_i - A_i] = sum(i, 1, m) O_i - sum(i, 1, m) A_i -; So S_{n+1} = sum(i, 1, n) O_i - sum(i, 1, n) A_i. But S_{n+1} is actually S_1 = 0, -; so thus sum(i, 1, n) O_i = sum (i, 1, n) A_i, ie. output total equals input total. - -;; GLOSSARY: -;; MOD_HASH: this code's sha256 tree hash -;; TAIL_PROGRAM_HASH: the program that determines if a coin can mint new cats, burn cats, and check if its lineage is valid if its parent is not a CAT -;; INNER_PUZZLE: an independent puzzle protecting the coins. Solutions to this puzzle are expected to generate `AGG_SIG` conditions and possibly `CREATE_COIN` conditions. -;; ---- items above are curried into the puzzle hash ---- -;; inner_puzzle_solution: the solution to the inner puzzle -;; prev_coin_id: the id for the previous coin -;; tail_program_reveal: reveal of TAIL_PROGRAM_HASH required to run the program if desired -;; tail_solution: optional solution passed into tail_program -;; lineage_proof: optional proof that our coin's parent is a CAT -;; this_coin_info: (parent_id puzzle_hash amount) -;; next_coin_proof: (parent_id inner_puzzle_hash amount) -;; prev_subtotal: the subtotal between prev-coin and this-coin -;; extra_delta: an amount that is added to our delta and checked by the TAIL program -;; - -(mod ( - MOD_HASH ;; curried into puzzle - TAIL_PROGRAM_HASH ;; curried into puzzle - INNER_PUZZLE ;; curried into puzzle - inner_puzzle_solution ;; if invalid, INNER_PUZZLE will fail - lineage_proof ;; This is the parent's coin info, used to check if the parent was a CAT. Optional if using tail_program. - prev_coin_id ;; used in this coin's announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong - this_coin_info ;; verified with ASSERT_MY_COIN_ID - next_coin_proof ;; used to generate ASSERT_COIN_ANNOUNCEMENT - prev_subtotal ;; included in announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong - extra_delta ;; this is the "legal discrepancy" between your real delta and what you're announcing your delta is - ) - - ;;;;; start library code - - (include condition_codes.clvm) - (include curry-and-treehash.clinc) - (include cat_truths.clib) - (include utility_macros.clib) - - (defconstant RING_MORPH_BYTE 0xcb) - - - ; take two lists and merge them into one - (defun merge_list (list_a list_b) - (if list_a - (c (f list_a) (merge_list (r list_a) list_b)) - list_b - ) - ) - - ; cat_mod_struct = (MOD_HASH MOD_HASH_hash GENESIS_COIN_CHECKER GENESIS_COIN_CHECKER_hash) - - (defun-inline mod_hash_from_cat_mod_struct (cat_mod_struct) (f cat_mod_struct)) - (defun-inline mod_hash_hash_from_cat_mod_struct (cat_mod_struct) (f (r cat_mod_struct))) - (defun-inline tail_program_hash_from_cat_mod_struct (cat_mod_struct) (f (r (r cat_mod_struct)))) - - ;;;;; end library code - - ;; return the puzzle hash for a cat with the given `GENESIS_COIN_CHECKER_hash` & `INNER_PUZZLE` - (defun-inline cat_puzzle_hash (cat_mod_struct inner_puzzle_hash) - (puzzle-hash-of-curried-function (mod_hash_from_cat_mod_struct cat_mod_struct) - inner_puzzle_hash - (sha256 ONE (tail_program_hash_from_cat_mod_struct cat_mod_struct)) - (mod_hash_hash_from_cat_mod_struct cat_mod_struct) - ) - ) - - ;; assert `CREATE_COIN_ANNOUNCEMENT` doesn't contain the RING_MORPH_BYTE bytes so it cannot be used to cheat the coin ring - - (defun-inline morph_condition (condition cat_mod_struct) - (if (= (f condition) CREATE_COIN) - (c CREATE_COIN - (c (cat_puzzle_hash cat_mod_struct (f (r condition))) - (r (r condition))) - ) - (if (= (f condition) CREATE_COIN_ANNOUNCEMENT) - (assert (not (and - (= 33 (strlen (f (r condition)))) - (= (substr (f (r condition)) 0 ONE) RING_MORPH_BYTE) ; lazy eval - )) - ; then - condition - ) - condition - ) - ) - ) - - ;; given a coin's parent, inner_puzzle and amount, and the cat_mod_struct, calculate the id of the coin - (defun-inline coin_id_for_proof (coin cat_mod_struct) - (calculate_coin_id (f coin) (cat_puzzle_hash cat_mod_struct (f (r coin))) (f (r (r coin)))) - ) - - ;; utility to fetch coin amount from coin - (defun-inline input_amount_for_coin (coin) - (f (r (r coin))) - ) - - ;; calculate the hash of an announcement - ;; we add 0xcb so ring announcements exist in a different namespace to announcements from inner_puzzles - (defun-inline calculate_annoucement_id (this_coin_id this_subtotal next_coin_id cat_mod_struct) - (sha256 next_coin_id RING_MORPH_BYTE (sha256tree (list this_coin_id this_subtotal))) - ) - - ;; create the `ASSERT_COIN_ANNOUNCEMENT` condition that ensures the next coin's announcement is correct - (defun-inline create_assert_next_announcement_condition (this_coin_id this_subtotal next_coin_id cat_mod_struct) - (list ASSERT_COIN_ANNOUNCEMENT - (calculate_annoucement_id this_coin_id - this_subtotal - next_coin_id - cat_mod_struct - ) - ) - ) - - ;; here we commit to I_{k-1} and S_k - ;; we add 0xcb so ring announcements exist in a different namespace to announcements from inner_puzzles - (defun-inline create_announcement_condition (prev_coin_id prev_subtotal) - (list CREATE_COIN_ANNOUNCEMENT - (concat RING_MORPH_BYTE (sha256tree (list prev_coin_id prev_subtotal))) - ) - ) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ;; this function takes a condition and returns an integer indicating - ;; the value of all output coins created with CREATE_COIN. If it's not - ;; a CREATE_COIN condition, it returns 0. - - (defun-inline output_value_for_condition (condition) - (if (= (f condition) CREATE_COIN) - (f (r (r condition))) - 0 - ) - ) - - ;; add two conditions to the list of morphed conditions: - ;; CREATE_COIN_ANNOUNCEMENT for my announcement - ;; ASSERT_COIN_ANNOUNCEMENT for the next coin's announcement - (defun-inline generate_final_output_conditions - ( - prev_subtotal - this_subtotal - morphed_conditions - prev_coin_id - this_coin_id - next_coin_id - cat_mod_struct - ) - (c (create_announcement_condition prev_coin_id prev_subtotal) - (c (create_assert_next_announcement_condition this_coin_id this_subtotal next_coin_id cat_mod_struct) - morphed_conditions) - ) - ) - - - ;; This next section of code loops through all of the conditions to do three things: - ;; 1) Look for a "magic" value of -113 and, if one exists, filter it, and take note of the tail reveal and solution - ;; 2) Morph any CREATE_COIN or CREATE_COIN_ANNOUNCEMENT conditions - ;; 3) Sum the total output amount of all of the CREATE_COINs that are output by the inner puzzle - ;; - ;; After everything return a struct in the format (morphed_conditions . (output_sum . tail_reveal_and_solution)) - ;; If multiple magic conditions are specified, the later one will take precedence - - (defun-inline condition_tail_reveal (condition) (f (r (r (r condition))))) - (defun-inline condition_tail_solution (condition) (f (r (r (r (r condition)))))) - - (defun cons_onto_first_and_add_to_second (morphed_condition output_value struct) - (c (c morphed_condition (f struct)) (c (+ output_value (f (r struct))) (r (r struct)))) - ) - - (defun find_and_strip_tail_info (inner_conditions cat_mod_struct tail_reveal_and_solution) - (if inner_conditions - (if (= (output_value_for_condition (f inner_conditions)) -113) ; Checks this is a CREATE_COIN of value -113 - (find_and_strip_tail_info - (r inner_conditions) - cat_mod_struct - (c (condition_tail_reveal (f inner_conditions)) (condition_tail_solution (f inner_conditions))) - ) - (cons_onto_first_and_add_to_second - (morph_condition (f inner_conditions) cat_mod_struct) - (output_value_for_condition (f inner_conditions)) - (find_and_strip_tail_info - (r inner_conditions) - cat_mod_struct - tail_reveal_and_solution - ) - ) - ) - (c () (c 0 tail_reveal_and_solution)) - ) - ) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;; lineage checking - - ;; return true iff parent of `this_coin_info` is provably a cat - ;; A 'lineage proof' consists of (parent_parent_id parent_INNER_puzzle_hash parent_amount) - ;; We use this information to construct a coin who's puzzle has been wrapped in this MOD and verify that, - ;; once wrapped, it matches our parent coin's ID. - (defun-inline is_parent_cat ( - cat_mod_struct - parent_id - lineage_proof - ) - (= parent_id - (calculate_coin_id (f lineage_proof) - (cat_puzzle_hash cat_mod_struct (f (r lineage_proof))) - (f (r (r lineage_proof))) - ) - ) - ) - - (defun check_lineage_or_run_tail_program - ( - this_coin_info - tail_reveal_and_solution - parent_is_cat ; flag which says whether or not the parent CAT check ran and passed - lineage_proof - Truths - extra_delta - inner_conditions - ) - (if tail_reveal_and_solution - (assert (= (sha256tree (f tail_reveal_and_solution)) (cat_tail_program_hash_truth Truths)) - (merge_list - (a (f tail_reveal_and_solution) - (list - Truths - parent_is_cat - lineage_proof ; Lineage proof is only guaranteed to be true if parent_is_cat - extra_delta - inner_conditions - (r tail_reveal_and_solution) - ) - ) - inner_conditions - ) - ) - (assert parent_is_cat (not extra_delta) - inner_conditions - ) - ) - ) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;; - - (defun stager_two ( - Truths - (inner_conditions . (output_sum . tail_reveal_and_solution)) - lineage_proof - prev_coin_id - this_coin_info - next_coin_id - prev_subtotal - extra_delta - ) - (check_lineage_or_run_tail_program - this_coin_info - tail_reveal_and_solution - (if lineage_proof (is_parent_cat (cat_struct_truth Truths) (my_parent_cat_truth Truths) lineage_proof) ()) - lineage_proof - Truths - extra_delta - (generate_final_output_conditions - prev_subtotal - ; the expression on the next line calculates `this_subtotal` by adding the delta to `prev_subtotal` - (+ prev_subtotal (- (input_amount_for_coin this_coin_info) output_sum) extra_delta) - inner_conditions - prev_coin_id - (my_id_cat_truth Truths) - next_coin_id - (cat_struct_truth Truths) - ) - ) - ) - - ; CAT TRUTHS struct is: ; CAT Truths is: ((Inner puzzle hash . (MOD hash . (MOD hash hash . TAIL hash))) . (my_id . (my_parent_info my_puzhash my_amount))) - ; create truths - this_coin_info verified true because we calculated my ID from it! - ; lineage proof is verified later by cat parent check or tail_program - - (defun stager ( - cat_mod_struct - inner_conditions - lineage_proof - inner_puzzle_hash - my_id - prev_coin_id - this_coin_info - next_coin_proof - prev_subtotal - extra_delta - ) - (c (list ASSERT_MY_COIN_ID my_id) (stager_two - (cat_truth_data_to_truth_struct - inner_puzzle_hash - cat_mod_struct - my_id - this_coin_info - ) - (find_and_strip_tail_info inner_conditions cat_mod_struct ()) - lineage_proof - prev_coin_id - this_coin_info - (coin_id_for_proof next_coin_proof cat_mod_struct) - prev_subtotal - extra_delta - )) - ) - - (stager - ;; calculate cat_mod_struct, inner_puzzle_hash, coin_id - (list MOD_HASH (sha256 ONE MOD_HASH) TAIL_PROGRAM_HASH) - (a INNER_PUZZLE inner_puzzle_solution) - lineage_proof - (sha256tree INNER_PUZZLE) - (calculate_coin_id (f this_coin_info) (f (r this_coin_info)) (f (r (r this_coin_info)))) - prev_coin_id ; ID - this_coin_info ; (parent_id puzzle_hash amount) - next_coin_proof ; (parent_id innerpuzhash amount) - prev_subtotal - extra_delta - ) -) +; Coins locked with this puzzle are spendable cats. +; +; Choose a list of n inputs (n>=1), I_1, ... I_n with amounts A_1, ... A_n. +; +; We put them in a ring, so "previous" and "next" have intuitive k-1 and k+1 semantics, +; wrapping so {n} and 0 are the same, ie. all indices are mod n. +; +; Each coin creates 0 or more coins with total output value O_k. +; Let D_k = the "debt" O_k - A_k contribution of coin I_k, ie. how much debt this input accumulates. +; Some coins may spend more than they contribute and some may spend less, ie. D_k need +; not be zero. That's okay. It's enough for the total of all D_k in the ring to be 0. +; +; A coin can calculate its own D_k since it can verify A_k (it's hashed into the coin id) +; and it can sum up `CREATE_COIN` conditions for O_k. +; +; Defines a "subtotal of debts" S_k for each coin as follows: +; +; S_1 = 0 +; S_k = S_{k-1} + D_{k-1} +; +; Here's the main trick that shows the ring sums to 0. +; You can prove by induction that S_{k+1} = D_1 + D_2 + ... + D_k. +; But it's a ring, so S_{n+1} is also S_1, which is 0. So D_1 + D_2 + ... + D_k = 0. +; So the total debts must be 0, ie. no coins are created or destroyed. +; +; Each coin's solution includes I_{k-1}, I_k, and I_{k+1} along with proofs that I_{k}, and I_{k+1} are CATs of the same type. +; Each coin's solution includes S_{k-1}. It calculates D_k = O_k - A_k, and then S_k = S_{k-1} + D_{k-1} +; +; Announcements are used to ensure that each S_k follows the pattern is valid. +; Announcements automatically commit to their own coin id. +; Coin I_k creates an announcement that further commits to I_{k-1} and S_{k-1}. +; +; Coin I_k gets a proof that I_{k+1} is a cat, so it knows it must also create an announcement +; when spent. It checks that I_{k+1} creates an announcement committing to I_k and S_k. +; +; So S_{k+1} is correct iff S_k is correct. +; +; Coins also receive proofs that their neighbours are CATs, ensuring the announcements aren't forgeries. +; Inner puzzles and the CAT layer prepend `CREATE_COIN_ANNOUNCEMENT` with different prefixes to avoid forgeries. +; Ring announcements use 0xcb, and inner puzzles are given 0xca +; +; In summary, I_k generates a coin_announcement Y_k ("Y" for "yell") as follows: +; +; Y_k: hash of I_k (automatically), I_{k-1}, S_k +; +; Each coin creates an assert_coin_announcement to ensure that the next coin's announcement is as expected: +; Y_{k+1} : hash of I_{k+1}, I_k, S_{k+1} +; +; TLDR: +; I_k : coins +; A_k : amount coin k contributes +; O_k : amount coin k spend +; D_k : difference/delta that coin k incurs (A - O) +; S_k : subtotal of debts D_1 + D_2 ... + D_k +; Y_k : announcements created by coin k committing to I_{k-1}, I_k, S_k +; +; All conditions go through a "transformer" that looks for CREATE_COIN conditions +; generated by the inner solution, and wraps the puzzle hash ensuring the output is a cat. +; +; Three output conditions are prepended to the list of conditions for each I_k: +; (ASSERT_MY_ID I_k) to ensure that the passed in value for I_k is correct +; (CREATE_COIN_ANNOUNCEMENT I_{k-1} S_k) to create this coin's announcement +; (ASSERT_COIN_ANNOUNCEMENT hashed_announcement(Y_{k+1})) to ensure the next coin really is next and +; the relative values of S_k and S_{k+1} are correct +; +; This is all we need to do to ensure cats exactly balance in the inputs and outputs. +; +; Proof: +; Consider n, k, I_k values, O_k values, S_k and A_k as above. +; For the (CREATE_COIN_ANNOUNCEMENT Y_{k+1}) (created by the next coin) +; and (ASSERT_COIN_ANNOUNCEMENT hashed(Y_{k+1})) to match, +; we see that I_k can ensure that is has the correct value for S_{k+1}. +; +; By induction, we see that S_{m+1} = sum(i, 1, m) [O_i - A_i] = sum(i, 1, m) O_i - sum(i, 1, m) A_i +; So S_{n+1} = sum(i, 1, n) O_i - sum(i, 1, n) A_i. But S_{n+1} is actually S_1 = 0, +; so thus sum(i, 1, n) O_i = sum (i, 1, n) A_i, ie. output total equals input total. + +;; GLOSSARY: +;; MOD_HASH: this code's sha256 tree hash +;; TAIL_PROGRAM_HASH: the program that determines if a coin can mint new cats, burn cats, and check if its lineage is valid if its parent is not a CAT +;; INNER_PUZZLE: an independent puzzle protecting the coins. Solutions to this puzzle are expected to generate `AGG_SIG` conditions and possibly `CREATE_COIN` conditions. +;; ---- items above are curried into the puzzle hash ---- +;; inner_puzzle_solution: the solution to the inner puzzle +;; prev_coin_id: the id for the previous coin +;; tail_program_reveal: reveal of TAIL_PROGRAM_HASH required to run the program if desired +;; tail_solution: optional solution passed into tail_program +;; lineage_proof: optional proof that our coin's parent is a CAT +;; this_coin_info: (parent_id puzzle_hash amount) +;; next_coin_proof: (parent_id inner_puzzle_hash amount) +;; prev_subtotal: the subtotal between prev-coin and this-coin +;; extra_delta: an amount that is added to our delta and checked by the TAIL program +;; + +(mod ( + MOD_HASH ;; curried into puzzle + TAIL_PROGRAM_HASH ;; curried into puzzle + INNER_PUZZLE ;; curried into puzzle + inner_puzzle_solution ;; if invalid, INNER_PUZZLE will fail + lineage_proof ;; This is the parent's coin info, used to check if the parent was a CAT. Optional if using tail_program. + prev_coin_id ;; used in this coin's announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong + this_coin_info ;; verified with ASSERT_MY_COIN_ID + next_coin_proof ;; used to generate ASSERT_COIN_ANNOUNCEMENT + prev_subtotal ;; included in announcement, prev_coin ASSERT_COIN_ANNOUNCEMENT will fail if wrong + extra_delta ;; this is the "legal discrepancy" between your real delta and what you're announcing your delta is + ) + + ;;;;; start library code + + (include condition_codes.clib) + (include curry-and-treehash.clib) + (include cat_truths.clib) + (include utility_macros.clib) + + (defconstant RING_MORPH_BYTE 0xcb) + + + ; take two lists and merge them into one + (defun merge_list (list_a list_b) + (if list_a + (c (f list_a) (merge_list (r list_a) list_b)) + list_b + ) + ) + + ; cat_mod_struct = (MOD_HASH MOD_HASH_hash GENESIS_COIN_CHECKER GENESIS_COIN_CHECKER_hash) + + (defun-inline mod_hash_from_cat_mod_struct (cat_mod_struct) (f cat_mod_struct)) + (defun-inline mod_hash_hash_from_cat_mod_struct (cat_mod_struct) (f (r cat_mod_struct))) + (defun-inline tail_program_hash_from_cat_mod_struct (cat_mod_struct) (f (r (r cat_mod_struct)))) + + ;;;;; end library code + + ;; return the puzzle hash for a cat with the given `GENESIS_COIN_CHECKER_hash` & `INNER_PUZZLE` + (defun-inline cat_puzzle_hash (cat_mod_struct inner_puzzle_hash) + (puzzle-hash-of-curried-function (mod_hash_from_cat_mod_struct cat_mod_struct) + inner_puzzle_hash + (sha256 ONE (tail_program_hash_from_cat_mod_struct cat_mod_struct)) + (mod_hash_hash_from_cat_mod_struct cat_mod_struct) + ) + ) + + ;; assert `CREATE_COIN_ANNOUNCEMENT` doesn't contain the RING_MORPH_BYTE bytes so it cannot be used to cheat the coin ring + + (defun-inline morph_condition (condition cat_mod_struct) + (if (= (f condition) CREATE_COIN) + (c CREATE_COIN + (c (cat_puzzle_hash cat_mod_struct (f (r condition))) + (r (r condition))) + ) + (if (= (f condition) CREATE_COIN_ANNOUNCEMENT) + (assert (not (and + (= 33 (strlen (f (r condition)))) + (= (substr (f (r condition)) 0 ONE) RING_MORPH_BYTE) ; lazy eval + )) + ; then + condition + ) + condition + ) + ) + ) + + ;; given a coin's parent, inner_puzzle and amount, and the cat_mod_struct, calculate the id of the coin + (defun-inline coin_id_for_proof (coin cat_mod_struct) + (calculate_coin_id (f coin) (cat_puzzle_hash cat_mod_struct (f (r coin))) (f (r (r coin)))) + ) + + ;; utility to fetch coin amount from coin + (defun-inline input_amount_for_coin (coin) + (f (r (r coin))) + ) + + ;; calculate the hash of an announcement + ;; we add 0xcb so ring announcements exist in a different namespace to announcements from inner_puzzles + (defun-inline calculate_annoucement_id (this_coin_id this_subtotal next_coin_id cat_mod_struct) + (sha256 next_coin_id RING_MORPH_BYTE (sha256tree (list this_coin_id this_subtotal))) + ) + + ;; create the `ASSERT_COIN_ANNOUNCEMENT` condition that ensures the next coin's announcement is correct + (defun-inline create_assert_next_announcement_condition (this_coin_id this_subtotal next_coin_id cat_mod_struct) + (list ASSERT_COIN_ANNOUNCEMENT + (calculate_annoucement_id this_coin_id + this_subtotal + next_coin_id + cat_mod_struct + ) + ) + ) + + ;; here we commit to I_{k-1} and S_k + ;; we add 0xcb so ring announcements exist in a different namespace to announcements from inner_puzzles + (defun-inline create_announcement_condition (prev_coin_id prev_subtotal) + (list CREATE_COIN_ANNOUNCEMENT + (concat RING_MORPH_BYTE (sha256tree (list prev_coin_id prev_subtotal))) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; this function takes a condition and returns an integer indicating + ;; the value of all output coins created with CREATE_COIN. If it's not + ;; a CREATE_COIN condition, it returns 0. + + (defun-inline output_value_for_condition (condition) + (if (= (f condition) CREATE_COIN) + (f (r (r condition))) + 0 + ) + ) + + ;; add two conditions to the list of morphed conditions: + ;; CREATE_COIN_ANNOUNCEMENT for my announcement + ;; ASSERT_COIN_ANNOUNCEMENT for the next coin's announcement + (defun-inline generate_final_output_conditions + ( + prev_subtotal + this_subtotal + morphed_conditions + prev_coin_id + this_coin_id + next_coin_id + cat_mod_struct + ) + (c (create_announcement_condition prev_coin_id prev_subtotal) + (c (create_assert_next_announcement_condition this_coin_id this_subtotal next_coin_id cat_mod_struct) + morphed_conditions) + ) + ) + + + ;; This next section of code loops through all of the conditions to do three things: + ;; 1) Look for a "magic" value of -113 and, if one exists, filter it, and take note of the tail reveal and solution + ;; 2) Morph any CREATE_COIN or CREATE_COIN_ANNOUNCEMENT conditions + ;; 3) Sum the total output amount of all of the CREATE_COINs that are output by the inner puzzle + ;; + ;; After everything return a struct in the format (morphed_conditions . (output_sum . tail_reveal_and_solution)) + ;; If multiple magic conditions are specified, the later one will take precedence + + (defun-inline condition_tail_reveal (condition) (f (r (r (r condition))))) + (defun-inline condition_tail_solution (condition) (f (r (r (r (r condition)))))) + + (defun cons_onto_first_and_add_to_second (morphed_condition output_value struct) + (c (c morphed_condition (f struct)) (c (+ output_value (f (r struct))) (r (r struct)))) + ) + + (defun find_and_strip_tail_info (inner_conditions cat_mod_struct tail_reveal_and_solution) + (if inner_conditions + (if (= (output_value_for_condition (f inner_conditions)) -113) ; Checks this is a CREATE_COIN of value -113 + (find_and_strip_tail_info + (r inner_conditions) + cat_mod_struct + (c (condition_tail_reveal (f inner_conditions)) (condition_tail_solution (f inner_conditions))) + ) + (cons_onto_first_and_add_to_second + (morph_condition (f inner_conditions) cat_mod_struct) + (output_value_for_condition (f inner_conditions)) + (find_and_strip_tail_info + (r inner_conditions) + cat_mod_struct + tail_reveal_and_solution + ) + ) + ) + (c () (c 0 tail_reveal_and_solution)) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;; lineage checking + + ;; return true iff parent of `this_coin_info` is provably a cat + ;; A 'lineage proof' consists of (parent_parent_id parent_INNER_puzzle_hash parent_amount) + ;; We use this information to construct a coin who's puzzle has been wrapped in this MOD and verify that, + ;; once wrapped, it matches our parent coin's ID. + (defun-inline is_parent_cat ( + cat_mod_struct + parent_id + lineage_proof + ) + (= parent_id + (calculate_coin_id (f lineage_proof) + (cat_puzzle_hash cat_mod_struct (f (r lineage_proof))) + (f (r (r lineage_proof))) + ) + ) + ) + + (defun check_lineage_or_run_tail_program + ( + this_coin_info + tail_reveal_and_solution + parent_is_cat ; flag which says whether or not the parent CAT check ran and passed + lineage_proof + Truths + extra_delta + inner_conditions + ) + (if tail_reveal_and_solution + (assert (= (sha256tree (f tail_reveal_and_solution)) (cat_tail_program_hash_truth Truths)) + (merge_list + (a (f tail_reveal_and_solution) + (list + Truths + parent_is_cat + lineage_proof ; Lineage proof is only guaranteed to be true if parent_is_cat + extra_delta + inner_conditions + (r tail_reveal_and_solution) + ) + ) + inner_conditions + ) + ) + (assert parent_is_cat (not extra_delta) + inner_conditions + ) + ) + ) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;; + + (defun stager_two ( + Truths + (inner_conditions . (output_sum . tail_reveal_and_solution)) + lineage_proof + prev_coin_id + this_coin_info + next_coin_id + prev_subtotal + extra_delta + ) + (check_lineage_or_run_tail_program + this_coin_info + tail_reveal_and_solution + (if lineage_proof (is_parent_cat (cat_struct_truth Truths) (my_parent_cat_truth Truths) lineage_proof) ()) + lineage_proof + Truths + extra_delta + (generate_final_output_conditions + prev_subtotal + ; the expression on the next line calculates `this_subtotal` by adding the delta to `prev_subtotal` + (+ prev_subtotal (- (input_amount_for_coin this_coin_info) output_sum) extra_delta) + inner_conditions + prev_coin_id + (my_id_cat_truth Truths) + next_coin_id + (cat_struct_truth Truths) + ) + ) + ) + + ; CAT TRUTHS struct is: ; CAT Truths is: ((Inner puzzle hash . (MOD hash . (MOD hash hash . TAIL hash))) . (my_id . (my_parent_info my_puzhash my_amount))) + ; create truths - this_coin_info verified true because we calculated my ID from it! + ; lineage proof is verified later by cat parent check or tail_program + + (defun stager ( + cat_mod_struct + inner_conditions + lineage_proof + inner_puzzle_hash + my_id + prev_coin_id + this_coin_info + next_coin_proof + prev_subtotal + extra_delta + ) + (c (list ASSERT_MY_COIN_ID my_id) (stager_two + (cat_truth_data_to_truth_struct + inner_puzzle_hash + cat_mod_struct + my_id + this_coin_info + ) + (find_and_strip_tail_info inner_conditions cat_mod_struct ()) + lineage_proof + prev_coin_id + this_coin_info + (coin_id_for_proof next_coin_proof cat_mod_struct) + prev_subtotal + extra_delta + )) + ) + + (stager + ;; calculate cat_mod_struct, inner_puzzle_hash, coin_id + (list MOD_HASH (sha256 ONE MOD_HASH) TAIL_PROGRAM_HASH) + (a INNER_PUZZLE inner_puzzle_solution) + lineage_proof + (sha256tree INNER_PUZZLE) + (calculate_coin_id (f this_coin_info) (f (r this_coin_info)) (f (r (r this_coin_info)))) + prev_coin_id ; ID + this_coin_info ; (parent_id puzzle_hash amount) + next_coin_proof ; (parent_id innerpuzhash amount) + prev_subtotal + extra_delta + ) +) diff --git a/chia/wallet/puzzles/cat_v2.clvm.hex b/chia/wallet/puzzles/cat_v2.clsp.hex similarity index 100% rename from chia/wallet/puzzles/cat_v2.clvm.hex rename to chia/wallet/puzzles/cat_v2.clsp.hex diff --git a/chia/wallet/puzzles/cat_v2.clvm.hex.sha256tree b/chia/wallet/puzzles/cat_v2.clvm.hex.sha256tree deleted file mode 100644 index d572827bddc0..000000000000 --- a/chia/wallet/puzzles/cat_v2.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -37bef360ee858133b69d595a906dc45d01af50379dad515eb9518abb7c1d2a7a diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm b/chia/wallet/puzzles/chialisp_deserialisation.clsp similarity index 100% rename from chia/wallet/puzzles/chialisp_deserialisation.clvm rename to chia/wallet/puzzles/chialisp_deserialisation.clsp diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex b/chia/wallet/puzzles/chialisp_deserialisation.clsp.hex similarity index 100% rename from chia/wallet/puzzles/chialisp_deserialisation.clvm.hex rename to chia/wallet/puzzles/chialisp_deserialisation.clsp.hex diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree b/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree deleted file mode 100644 index 0d2e51c3ba96..000000000000 --- a/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -94ec19077f9a34e0b11ad2456af0170f4cc03f11230ca42e3f82e6e644ac4f5d diff --git a/chia/wallet/puzzles/condition_codes.clvm b/chia/wallet/puzzles/condition_codes.clib similarity index 100% rename from chia/wallet/puzzles/condition_codes.clvm rename to chia/wallet/puzzles/condition_codes.clib diff --git a/chia/wallet/puzzles/create-lock-puzzlehash.clvm b/chia/wallet/puzzles/create-lock-puzzlehash.clib similarity index 100% rename from chia/wallet/puzzles/create-lock-puzzlehash.clvm rename to chia/wallet/puzzles/create-lock-puzzlehash.clib diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm b/chia/wallet/puzzles/create_nft_launcher_from_did.clsp similarity index 81% rename from chia/wallet/puzzles/create_nft_launcher_from_did.clvm rename to chia/wallet/puzzles/create_nft_launcher_from_did.clsp index 1b1a22ba61a4..d5654ff44bb9 100644 --- a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm +++ b/chia/wallet/puzzles/create_nft_launcher_from_did.clsp @@ -1,5 +1,5 @@ (mod (LAUNCHER_PH MINT_NUMBER MINT_TOTAL) - (include condition_codes.clvm) + (include condition_codes.clib) (list (list CREATE_COIN LAUNCHER_PH 1) (list CREATE_COIN_ANNOUNCEMENT (sha256 MINT_NUMBER MINT_TOTAL))) diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex b/chia/wallet/puzzles/create_nft_launcher_from_did.clsp.hex similarity index 100% rename from chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex rename to chia/wallet/puzzles/create_nft_launcher_from_did.clsp.hex diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree b/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree deleted file mode 100644 index 8e7ee89ed6b4..000000000000 --- a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -7a32d2d9571d3436791c0ad3d7fcfdb9c43ace2b0f0ff13f98d29f0cc093f445 diff --git a/chia/wallet/puzzles/curry-and-treehash.clinc b/chia/wallet/puzzles/curry-and-treehash.clib similarity index 100% rename from chia/wallet/puzzles/curry-and-treehash.clinc rename to chia/wallet/puzzles/curry-and-treehash.clib diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm b/chia/wallet/puzzles/decompress_coin_spend_entry.clsp similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry.clvm rename to chia/wallet/puzzles/decompress_coin_spend_entry.clsp diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex b/chia/wallet/puzzles/decompress_coin_spend_entry.clsp.hex similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex rename to chia/wallet/puzzles/decompress_coin_spend_entry.clsp.hex diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree b/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree deleted file mode 100644 index 3ed2d288d9be..000000000000 --- a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -9d98ed08770d31be4bd1bde4705dab388db5e7e9c349f5a76fc3c347aa3a0b79 diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm b/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clsp similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm rename to chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clsp diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex b/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clsp.hex similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex rename to chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clsp.hex diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree b/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree deleted file mode 100644 index 4ad6e437a597..000000000000 --- a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -92aa4bc8060a8836355a1884075141b4791ce1b67ae6092bb166b2845954bc89 diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm b/chia/wallet/puzzles/decompress_puzzle.clsp similarity index 100% rename from chia/wallet/puzzles/decompress_puzzle.clvm rename to chia/wallet/puzzles/decompress_puzzle.clsp diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm.hex b/chia/wallet/puzzles/decompress_puzzle.clsp.hex similarity index 100% rename from chia/wallet/puzzles/decompress_puzzle.clvm.hex rename to chia/wallet/puzzles/decompress_puzzle.clsp.hex diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree b/chia/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree deleted file mode 100644 index 2163ca03358f..000000000000 --- a/chia/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -fe94c58f1117afe315e0450daca1c62460ec1a1c439cd4018d79967a5d7d1370 diff --git a/chia/wallet/puzzles/delegated_tail.clvm b/chia/wallet/puzzles/delegated_tail.clsp similarity index 85% rename from chia/wallet/puzzles/delegated_tail.clvm rename to chia/wallet/puzzles/delegated_tail.clsp index 57cc677bd499..496f4446eee3 100644 --- a/chia/wallet/puzzles/delegated_tail.clvm +++ b/chia/wallet/puzzles/delegated_tail.clsp @@ -1,4 +1,4 @@ -; This is a "limitations_program" for use with cat.clvm. +; This is a "limitations_program" for use with cat.clsp. (mod ( PUBKEY Truths @@ -12,7 +12,7 @@ ) ) - (include condition_codes.clvm) + (include condition_codes.clib) (defun sha256tree1 (TREE) (if (l TREE) @@ -22,4 +22,4 @@ (c (list AGG_SIG_UNSAFE PUBKEY (sha256tree1 delegated_puzzle)) (a delegated_puzzle (c Truths (c parent_is_cat (c lineage_proof (c delta (c inner_conditions delegated_solution)))))) ) -) \ No newline at end of file +) diff --git a/chia/wallet/puzzles/delegated_tail.clvm.hex b/chia/wallet/puzzles/delegated_tail.clsp.hex similarity index 100% rename from chia/wallet/puzzles/delegated_tail.clvm.hex rename to chia/wallet/puzzles/delegated_tail.clsp.hex diff --git a/chia/wallet/puzzles/delegated_tail.clvm.hex.sha256tree b/chia/wallet/puzzles/delegated_tail.clvm.hex.sha256tree deleted file mode 100644 index f1d6d7408d04..000000000000 --- a/chia/wallet/puzzles/delegated_tail.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -999c3696e167f8a79d938adc11feba3a3dcb39ccff69a426d570706e7b8ec399 diff --git a/chia/wallet/puzzles/deployed_puzzle_hashes.json b/chia/wallet/puzzles/deployed_puzzle_hashes.json new file mode 100644 index 000000000000..795659ae8156 --- /dev/null +++ b/chia/wallet/puzzles/deployed_puzzle_hashes.json @@ -0,0 +1,43 @@ +{ + "block_program_zero": "f0a38c8efe58895ae527c65c37f700a4238504691b83990e5dd91bd8b3c30eae", + "calculate_synthetic_public_key": "624c5d5704d0decadfc0503e71bbffb6cdfe45025bce7cf3e6864d1eafe8f65e", + "cat_v2": "37bef360ee858133b69d595a906dc45d01af50379dad515eb9518abb7c1d2a7a", + "chialisp_deserialisation": "94ec19077f9a34e0b11ad2456af0170f4cc03f11230ca42e3f82e6e644ac4f5d", + "create_nft_launcher_from_did": "7a32d2d9571d3436791c0ad3d7fcfdb9c43ace2b0f0ff13f98d29f0cc093f445", + "decompress_coin_spend_entry": "9d98ed08770d31be4bd1bde4705dab388db5e7e9c349f5a76fc3c347aa3a0b79", + "decompress_coin_spend_entry_with_prefix": "92aa4bc8060a8836355a1884075141b4791ce1b67ae6092bb166b2845954bc89", + "decompress_puzzle": "fe94c58f1117afe315e0450daca1c62460ec1a1c439cd4018d79967a5d7d1370", + "delegated_tail": "999c3696e167f8a79d938adc11feba3a3dcb39ccff69a426d570706e7b8ec399", + "did_innerpuz": "33143d2bef64f14036742673afd158126b94284b4530a28c354fac202b0c910e", + "everything_with_signature": "1720d13250a7c16988eaf530331cefa9dd57a76b2c82236bec8bbbff91499b89", + "genesis_by_coin_id": "493afb89eed93ab86741b2aa61b8f5de495d33ff9b781dfc8919e602b2afa150", + "genesis_by_puzzle_hash": "de5a6e06d41518be97ff6365694f4f89475dda773dede267caa33da63b434e36", + "graftroot_dl_offers": "0893e36a88c064fddfa6f8abdb42c044584a98cb4273b80cccc83b4867b701a1", + "nft_intermediate_launcher": "7a32d2d9571d3436791c0ad3d7fcfdb9c43ace2b0f0ff13f98d29f0cc093f445", + "nft_metadata_updater_default": "fe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b", + "nft_metadata_updater_updateable": "0b1ffba1601777c06b78ab38636e9624f2f8da73be9b36e0ce17c8d8ef3bad9f", + "nft_ownership_layer": "c5abea79afaa001b5427dfa0c8cf42ca6f38f5841b78f9b3c252733eb2de2726", + "nft_ownership_transfer_program_one_way_claim_with_royalties": "025dee0fb1e9fa110302a7e9bfb6e381ca09618e2778b0184fa5c6b275cfce1f", + "nft_state_layer": "a04d9f57764f54a43e4030befb4d80026e870519aaa66334aef8304f5d0393c2", + "notification": "b8b9d8ffca6d5cba5422ead7f477ecfc8f6aaaa1c024b8c3aeb1956b24a0ab1e", + "p2_conditions": "1c77d7d5efde60a7a1d2d27db6d746bc8e568aea1ef8586ca967a0d60b83cc36", + "p2_delegated_conditions": "0ff94726f1a8dea5c3f70d3121945190778d3b2b3fcda3735a1f290977e98341", + "p2_delegated_puzzle": "542cde70d1102cd1b763220990873efc8ab15625ded7eae22cc11e21ef2e2f7c", + "p2_delegated_puzzle_or_hidden_puzzle": "e9aaa49f45bad5c889b86ee3341550c155cfdd10c3a6757de618d20612fffd52", + "p2_m_of_n_delegate_direct": "0f199d5263ac1a62b077c159404a71abd3f9691cc57520bf1d4c5cb501504457", + "p2_parent": "b10ce2d0b18dcf8c21ddfaf55d9b9f0adcbf1e0beb55b1a8b9cad9bbff4e5f22", + "p2_puzzle_hash": "13e29a62b42cd2ef72a79e4bacdc59733ca6310d65af83d349360d36ec622363", + "p2_singleton": "40f828d8dd55603f4ff9fbf6b73271e904e69406982f4fbefae2c8dcceaf9834", + "p2_singleton_or_delayed_puzhash": "adb656e0211e2ab4f42069a4c5efc80dc907e7062be08bf1628c8e5b6d94d25b", + "pool_member_innerpuz": "a8490702e333ddd831a3ac9c22d0fa26d2bfeaf2d33608deb22f0e0123eb0494", + "pool_waitingroom_innerpuz": "a317541a765bf8375e1c6e7c13503d0d2cbf56cacad5182befe947e78e2c0307", + "rom_bootstrap_generator": "161bade1f822dcd62ab712ebaf30f3922a301e48a639e4295c5685f8bece7bd9", + "settlement_payments": "cfbfdeed5c4ca2de3d0bf520b9cb4bb7743a359bd2e6a188d19ce7dffc21d3e7", + "settlement_payments_old": "bae24162efbd568f89bc7a340798a6118df0189eb9e3f8697bcea27af99f8f79", + "sha256tree_module": "eb4ead6576048c9d730b5ced00646c7fdd390649cfdf48a00de1590cdd8ee18f", + "singleton_launcher": "eff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9", + "singleton_top_layer": "24e044101e57b3d8c908b8a38ad57848afd29d3eecc439dba45f4412df4954fd", + "singleton_top_layer_v1_1": "7faa3253bfddd1e0decb0906b2dc6247bbc4cf608f58345d173adb63e8b47c9f", + "test_generator_deserialize": "52add794fc76e89512e4a063c383418bda084c8a78c74055abe80179e4a7832c", + "test_multiple_generator_input_arguments": "156dafbddc3e1d3bfe1f2a84e48e5e46b287b8358bf65c3c091c93e855fbfc5b" +} diff --git a/chia/wallet/puzzles/did_innerpuz.clvm b/chia/wallet/puzzles/did_innerpuz.clsp similarity index 98% rename from chia/wallet/puzzles/did_innerpuz.clvm rename to chia/wallet/puzzles/did_innerpuz.clsp index 9788f16f9fa1..f073d97e982e 100644 --- a/chia/wallet/puzzles/did_innerpuz.clvm +++ b/chia/wallet/puzzles/did_innerpuz.clsp @@ -24,8 +24,8 @@ ;MOD_HASH, MY_PUBKEY, RECOVERY_DID_LIST_HASH are curried into the puzzle ;EXAMPLE SOLUTION (0xcafef00d 0x12341234 0x923bf9a7856b19d335a65f12d68957d497e1f0c16c0e14baf6d120e60753a1ce 2 1 100 (q "source code") 0xdeadbeef 0xcafef00d ((0xdadadada 0xdad5dad5 200) () (0xfafafafa 0xfaf5faf5 200)) 0xfadeddab (0x22222222 0x33333333 0x44444444)) - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) ; takes a lisp tree and returns the hash of it (defun sha256tree1 (TREE) @@ -52,7 +52,7 @@ ; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash) (puzzle-hash-of-curried-function (f SINGLETON_STRUCT) inner_puzzle_hash diff --git a/chia/wallet/puzzles/did_innerpuz.clvm.hex b/chia/wallet/puzzles/did_innerpuz.clsp.hex similarity index 100% rename from chia/wallet/puzzles/did_innerpuz.clvm.hex rename to chia/wallet/puzzles/did_innerpuz.clsp.hex diff --git a/chia/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree b/chia/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree deleted file mode 100644 index 8b72ac7b5ff0..000000000000 --- a/chia/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -33143d2bef64f14036742673afd158126b94284b4530a28c354fac202b0c910e diff --git a/chia/wallet/puzzles/everything_with_signature.clvm b/chia/wallet/puzzles/everything_with_signature.clsp similarity index 70% rename from chia/wallet/puzzles/everything_with_signature.clvm rename to chia/wallet/puzzles/everything_with_signature.clsp index f467a46de516..a516802f3023 100644 --- a/chia/wallet/puzzles/everything_with_signature.clvm +++ b/chia/wallet/puzzles/everything_with_signature.clsp @@ -1,4 +1,4 @@ -; This is a "limitations_program" for use with cat.clvm. +; This is a "limitations_program" for use with cat.clsp. (mod ( PUBKEY Truths @@ -9,7 +9,7 @@ _ ) - (include condition_codes.clvm) + (include condition_codes.clib) (list (list AGG_SIG_ME PUBKEY delta)) ; Careful with a delta of zero, the bytecode is 80 not 00 -) \ No newline at end of file +) diff --git a/chia/wallet/puzzles/everything_with_signature.clvm.hex b/chia/wallet/puzzles/everything_with_signature.clsp.hex similarity index 100% rename from chia/wallet/puzzles/everything_with_signature.clvm.hex rename to chia/wallet/puzzles/everything_with_signature.clsp.hex diff --git a/chia/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree b/chia/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree deleted file mode 100644 index 8dea922f4edd..000000000000 --- a/chia/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -1720d13250a7c16988eaf530331cefa9dd57a76b2c82236bec8bbbff91499b89 diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm b/chia/wallet/puzzles/genesis_by_coin_id.clsp similarity index 100% rename from chia/wallet/puzzles/genesis_by_coin_id.clvm rename to chia/wallet/puzzles/genesis_by_coin_id.clsp diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex b/chia/wallet/puzzles/genesis_by_coin_id.clsp.hex similarity index 100% rename from chia/wallet/puzzles/genesis_by_coin_id.clvm.hex rename to chia/wallet/puzzles/genesis_by_coin_id.clsp.hex diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree b/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree deleted file mode 100644 index 0ca0e4e61e12..000000000000 --- a/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -493afb89eed93ab86741b2aa61b8f5de495d33ff9b781dfc8919e602b2afa150 diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm b/chia/wallet/puzzles/genesis_by_puzzle_hash.clsp similarity index 90% rename from chia/wallet/puzzles/genesis_by_puzzle_hash.clvm rename to chia/wallet/puzzles/genesis_by_puzzle_hash.clsp index 720465075d0a..17734a073cec 100644 --- a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm +++ b/chia/wallet/puzzles/genesis_by_puzzle_hash.clsp @@ -1,4 +1,4 @@ -; This is a "limitations_program" for use with cat.clvm. +; This is a "limitations_program" for use with cat.clsp. ; ; This checker allows new CATs to be created if their parent has a particular puzzle hash (mod ( diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex b/chia/wallet/puzzles/genesis_by_puzzle_hash.clsp.hex similarity index 100% rename from chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex rename to chia/wallet/puzzles/genesis_by_puzzle_hash.clsp.hex diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree b/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree deleted file mode 100644 index 800a02c7b3d6..000000000000 --- a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -de5a6e06d41518be97ff6365694f4f89475dda773dede267caa33da63b434e36 diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm b/chia/wallet/puzzles/graftroot_dl_offers.clsp similarity index 97% rename from chia/wallet/puzzles/graftroot_dl_offers.clvm rename to chia/wallet/puzzles/graftroot_dl_offers.clsp index 321a7fda6350..844260fac5a3 100644 --- a/chia/wallet/puzzles/graftroot_dl_offers.clvm +++ b/chia/wallet/puzzles/graftroot_dl_offers.clsp @@ -11,9 +11,9 @@ inner_solution ) - (include condition_codes.clvm) + (include condition_codes.clib) (include merkle_utils.clib) - (include curry-and-treehash.clinc) + (include curry-and-treehash.clib) (defmacro assert items (if (r items) diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex b/chia/wallet/puzzles/graftroot_dl_offers.clsp.hex similarity index 100% rename from chia/wallet/puzzles/graftroot_dl_offers.clvm.hex rename to chia/wallet/puzzles/graftroot_dl_offers.clsp.hex diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree b/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree deleted file mode 100644 index 3bcfde7e54da..000000000000 --- a/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -0893e36a88c064fddfa6f8abdb42c044584a98cb4273b80cccc83b4867b701a1 diff --git a/chia/wallet/puzzles/load_clvm.py b/chia/wallet/puzzles/load_clvm.py index 4af4c7c1e28a..b3174309f1ff 100644 --- a/chia/wallet/puzzles/load_clvm.py +++ b/chia/wallet/puzzles/load_clvm.py @@ -82,8 +82,8 @@ def load_serialized_clvm( clvm_filename, package_or_requirement=__name__, include_standard_libraries: bool = False, recompile: bool = True ) -> SerializedProgram: """ - This function takes a .clvm file in the given package and compiles it to a - .clvm.hex file if the .hex file is missing or older than the .clvm file, then + This function takes a .clsp file in the given package and compiles it to a + .clsp.hex file if the .hex file is missing or older than the .clsp file, then returns the contents of the .hex file as a `Program`. clvm_filename: file name diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm b/chia/wallet/puzzles/lock.inner.puzzle.clvm deleted file mode 100644 index b02bb4d364af..000000000000 --- a/chia/wallet/puzzles/lock.inner.puzzle.clvm +++ /dev/null @@ -1,2 +0,0 @@ -; a trivial puzzle used as the core of a lock puzzle -(mod args (q ())) diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex b/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex deleted file mode 100644 index ac8b46cb638d..000000000000 --- a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex +++ /dev/null @@ -1 +0,0 @@ -ff01ff8080 \ No newline at end of file diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree b/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree deleted file mode 100644 index 1ff838fc008c..000000000000 --- a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -f3a579254623f8094e07af862df2e45c9db5592b4105d34a256dd6c498416288 diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm b/chia/wallet/puzzles/nft_intermediate_launcher.clsp similarity index 81% rename from chia/wallet/puzzles/nft_intermediate_launcher.clvm rename to chia/wallet/puzzles/nft_intermediate_launcher.clsp index 1b1a22ba61a4..d5654ff44bb9 100644 --- a/chia/wallet/puzzles/nft_intermediate_launcher.clvm +++ b/chia/wallet/puzzles/nft_intermediate_launcher.clsp @@ -1,5 +1,5 @@ (mod (LAUNCHER_PH MINT_NUMBER MINT_TOTAL) - (include condition_codes.clvm) + (include condition_codes.clib) (list (list CREATE_COIN LAUNCHER_PH 1) (list CREATE_COIN_ANNOUNCEMENT (sha256 MINT_NUMBER MINT_TOTAL))) diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex b/chia/wallet/puzzles/nft_intermediate_launcher.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex rename to chia/wallet/puzzles/nft_intermediate_launcher.clsp.hex diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree deleted file mode 100644 index 8e7ee89ed6b4..000000000000 --- a/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -7a32d2d9571d3436791c0ad3d7fcfdb9c43ace2b0f0ff13f98d29f0cc093f445 diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm b/chia/wallet/puzzles/nft_metadata_updater_default.clsp similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_default.clvm rename to chia/wallet/puzzles/nft_metadata_updater_default.clsp diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex b/chia/wallet/puzzles/nft_metadata_updater_default.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex rename to chia/wallet/puzzles/nft_metadata_updater_default.clsp.hex diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree deleted file mode 100644 index ee4c52dad171..000000000000 --- a/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -fe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm b/chia/wallet/puzzles/nft_metadata_updater_updateable.clsp similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_updateable.clvm rename to chia/wallet/puzzles/nft_metadata_updater_updateable.clsp diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex b/chia/wallet/puzzles/nft_metadata_updater_updateable.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex rename to chia/wallet/puzzles/nft_metadata_updater_updateable.clsp.hex diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree deleted file mode 100644 index 54dd22756dfd..000000000000 --- a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -0b1ffba1601777c06b78ab38636e9624f2f8da73be9b36e0ce17c8d8ef3bad9f diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm b/chia/wallet/puzzles/nft_ownership_layer.clsp similarity index 98% rename from chia/wallet/puzzles/nft_ownership_layer.clvm rename to chia/wallet/puzzles/nft_ownership_layer.clsp index 3b15416590a6..d11531200bb6 100644 --- a/chia/wallet/puzzles/nft_ownership_layer.clvm +++ b/chia/wallet/puzzles/nft_ownership_layer.clsp @@ -6,8 +6,8 @@ inner_solution ) - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) (include utility_macros.clib) (defconstant NEW_OWNER_CONDITION -10) diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm.hex b/chia/wallet/puzzles/nft_ownership_layer.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_ownership_layer.clvm.hex rename to chia/wallet/puzzles/nft_ownership_layer.clsp.hex diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree deleted file mode 100644 index bf67047bf804..000000000000 --- a/chia/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -c5abea79afaa001b5427dfa0c8cf42ca6f38f5841b78f9b3c252733eb2de2726 diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm b/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp similarity index 96% rename from chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm rename to chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp index a297a00f3296..f5c9618dee51 100644 --- a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm +++ b/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp @@ -10,13 +10,13 @@ ; This is a transfer program - which must return (new_owner, Optional[new_transfer_program], conditions) - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) (defconstant TEN_THOUSAND 10000) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash) (puzzle-hash-of-curried-function (f SINGLETON_STRUCT) inner_puzzle_hash diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex b/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex rename to chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp.hex diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree deleted file mode 100644 index 336b9da6ee76..000000000000 --- a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -025dee0fb1e9fa110302a7e9bfb6e381ca09618e2778b0184fa5c6b275cfce1f diff --git a/chia/wallet/puzzles/nft_state_layer.clvm b/chia/wallet/puzzles/nft_state_layer.clsp similarity index 97% rename from chia/wallet/puzzles/nft_state_layer.clvm rename to chia/wallet/puzzles/nft_state_layer.clsp index f247e1d2c955..bec31b0982ef 100644 --- a/chia/wallet/puzzles/nft_state_layer.clvm +++ b/chia/wallet/puzzles/nft_state_layer.clsp @@ -6,8 +6,8 @@ inner_solution ) - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) (include utility_macros.clib) (defun-inline nft_state_layer_puzzle_hash (NFT_STATE_LAYER_MOD_HASH METADATA METADATA_UPDATER_PUZZLE_HASH inner_puzzle_hash) diff --git a/chia/wallet/puzzles/nft_state_layer.clvm.hex b/chia/wallet/puzzles/nft_state_layer.clsp.hex similarity index 100% rename from chia/wallet/puzzles/nft_state_layer.clvm.hex rename to chia/wallet/puzzles/nft_state_layer.clsp.hex diff --git a/chia/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree b/chia/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree deleted file mode 100644 index df9fee304f28..000000000000 --- a/chia/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -a04d9f57764f54a43e4030befb4d80026e870519aaa66334aef8304f5d0393c2 diff --git a/chia/wallet/puzzles/notification.clvm b/chia/wallet/puzzles/notification.clsp similarity index 77% rename from chia/wallet/puzzles/notification.clvm rename to chia/wallet/puzzles/notification.clsp index bb7121796a0d..44762cbd44fe 100644 --- a/chia/wallet/puzzles/notification.clvm +++ b/chia/wallet/puzzles/notification.clsp @@ -2,6 +2,6 @@ TARGET AMOUNT ) - (include condition_codes.clvm) + (include condition_codes.clib) (list (list CREATE_COIN TARGET AMOUNT) (list CREATE_COIN_ANNOUNCEMENT ())) ) \ No newline at end of file diff --git a/chia/wallet/puzzles/notification.clvm.hex b/chia/wallet/puzzles/notification.clsp.hex similarity index 100% rename from chia/wallet/puzzles/notification.clvm.hex rename to chia/wallet/puzzles/notification.clsp.hex diff --git a/chia/wallet/puzzles/notification.clvm.hex.sha256tree b/chia/wallet/puzzles/notification.clvm.hex.sha256tree deleted file mode 100644 index 30cbaf186ad6..000000000000 --- a/chia/wallet/puzzles/notification.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -b8b9d8ffca6d5cba5422ead7f477ecfc8f6aaaa1c024b8c3aeb1956b24a0ab1e diff --git a/chia/wallet/puzzles/p2_conditions.clvm b/chia/wallet/puzzles/p2_conditions.clsp similarity index 100% rename from chia/wallet/puzzles/p2_conditions.clvm rename to chia/wallet/puzzles/p2_conditions.clsp diff --git a/chia/wallet/puzzles/p2_conditions.clvm.hex b/chia/wallet/puzzles/p2_conditions.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_conditions.clvm.hex rename to chia/wallet/puzzles/p2_conditions.clsp.hex diff --git a/chia/wallet/puzzles/p2_conditions.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_conditions.clvm.hex.sha256tree deleted file mode 100644 index 11e75b5c2ba1..000000000000 --- a/chia/wallet/puzzles/p2_conditions.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -1c77d7d5efde60a7a1d2d27db6d746bc8e568aea1ef8586ca967a0d60b83cc36 diff --git a/chia/wallet/puzzles/p2_conditions.py b/chia/wallet/puzzles/p2_conditions.py index ae649bcad448..342a1b9a485b 100644 --- a/chia/wallet/puzzles/p2_conditions.py +++ b/chia/wallet/puzzles/p2_conditions.py @@ -16,7 +16,7 @@ from chia.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile -MOD = load_clvm_maybe_recompile("p2_conditions.clvm") +MOD = load_clvm_maybe_recompile("p2_conditions.clsp") def puzzle_for_conditions(conditions) -> Program: diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm b/chia/wallet/puzzles/p2_delegated_conditions.clsp similarity index 91% rename from chia/wallet/puzzles/p2_delegated_conditions.clvm rename to chia/wallet/puzzles/p2_delegated_conditions.clsp index c0b5ed2b450f..b8f3f4ed3017 100644 --- a/chia/wallet/puzzles/p2_delegated_conditions.clvm +++ b/chia/wallet/puzzles/p2_delegated_conditions.clsp @@ -1,7 +1,7 @@ (mod (public_key conditions) - (include condition_codes.clvm) + (include condition_codes.clib) ;; hash a tree ;; This is used to calculate a puzzle hash given a puzzle program. diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex b/chia/wallet/puzzles/p2_delegated_conditions.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_conditions.clvm.hex rename to chia/wallet/puzzles/p2_delegated_conditions.clsp.hex diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree deleted file mode 100644 index db639ecf7408..000000000000 --- a/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -0ff94726f1a8dea5c3f70d3121945190778d3b2b3fcda3735a1f290977e98341 diff --git a/chia/wallet/puzzles/p2_delegated_conditions.py b/chia/wallet/puzzles/p2_delegated_conditions.py index a382c3fa163f..37bfc2513e0f 100644 --- a/chia/wallet/puzzles/p2_delegated_conditions.py +++ b/chia/wallet/puzzles/p2_delegated_conditions.py @@ -12,7 +12,7 @@ from chia.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile -MOD = load_clvm_maybe_recompile("p2_delegated_conditions.clvm") +MOD = load_clvm_maybe_recompile("p2_delegated_conditions.clsp") def puzzle_for_pk(public_key: Program) -> Program: diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm b/chia/wallet/puzzles/p2_delegated_puzzle.clsp similarity index 93% rename from chia/wallet/puzzles/p2_delegated_puzzle.clvm rename to chia/wallet/puzzles/p2_delegated_puzzle.clsp index 8ba8696da40f..b4fea9c5bd22 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle.clvm +++ b/chia/wallet/puzzles/p2_delegated_puzzle.clsp @@ -2,7 +2,7 @@ (public_key delegated_puzzle delegated_puzzle_solution) - (include condition_codes.clvm) + (include condition_codes.clib) ;; hash a tree ;; This is used to calculate a puzzle hash given a puzzle program. diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex b/chia/wallet/puzzles/p2_delegated_puzzle.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex rename to chia/wallet/puzzles/p2_delegated_puzzle.clsp.hex diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree deleted file mode 100644 index a80f5f326b6e..000000000000 --- a/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -542cde70d1102cd1b763220990873efc8ab15625ded7eae22cc11e21ef2e2f7c diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.py b/chia/wallet/puzzles/p2_delegated_puzzle.py index 7ae342a6515b..55ca9fbd639a 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle.py +++ b/chia/wallet/puzzles/p2_delegated_puzzle.py @@ -19,7 +19,7 @@ from chia.types.blockchain_format.program import Program from . import p2_conditions from .load_clvm import load_clvm_maybe_recompile -MOD = load_clvm_maybe_recompile("p2_delegated_puzzle.clvm") +MOD = load_clvm_maybe_recompile("p2_delegated_puzzle.clsp") def puzzle_for_pk(public_key: bytes) -> Program: diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp similarity index 98% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm rename to chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp index ba1bf691fca9..7c7f593c4a74 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm +++ b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp @@ -47,7 +47,7 @@ ) ) - (include condition_codes.clvm) + (include condition_codes.clib) ;; hash a tree ;; This is used to calculate a puzzle hash given a puzzle program. diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex rename to chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp.hex diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree deleted file mode 100644 index ba886ec896c6..000000000000 --- a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -e9aaa49f45bad5c889b86ee3341550c155cfdd10c3a6757de618d20612fffd52 diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py index 5738cb904813..c935bf1d0869 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +++ b/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py @@ -74,7 +74,7 @@ DEFAULT_HIDDEN_PUZZLE = Program.from_bytes(bytes.fromhex("ff0980")) DEFAULT_HIDDEN_PUZZLE_HASH = DEFAULT_HIDDEN_PUZZLE.get_tree_hash() # this puzzle `(x)` always fails -MOD = load_clvm_maybe_recompile("p2_delegated_puzzle_or_hidden_puzzle.clvm") +MOD = load_clvm_maybe_recompile("p2_delegated_puzzle_or_hidden_puzzle.clsp") QUOTED_MOD_HASH = calculate_hash_of_quoted_mod_hash(MOD.get_tree_hash()) diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp similarity index 98% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm rename to chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp index 2832e5994e5e..3f0400da8415 100644 --- a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm +++ b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp @@ -20,7 +20,7 @@ (mod (M public_key_list selectors delegated_puzzle solution) - (include condition_codes.clvm) + (include condition_codes.clib) ;; hash a tree ;; This is used to calculate a puzzle hash given a puzzle program. diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex rename to chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp.hex diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree deleted file mode 100644 index e48010771e9f..000000000000 --- a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -0f199d5263ac1a62b077c159404a71abd3f9691cc57520bf1d4c5cb501504457 diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py index 10cbfd2d3caf..47770d17bd00 100644 --- a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +++ b/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py @@ -11,7 +11,7 @@ from chia.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile -MOD = load_clvm_maybe_recompile("p2_m_of_n_delegate_direct.clvm") +MOD = load_clvm_maybe_recompile("p2_m_of_n_delegate_direct.clsp") def puzzle_for_m_of_public_key_list(m, public_key_list) -> Program: diff --git a/chia/wallet/puzzles/p2_parent.clvm b/chia/wallet/puzzles/p2_parent.clsp similarity index 81% rename from chia/wallet/puzzles/p2_parent.clvm rename to chia/wallet/puzzles/p2_parent.clsp index 9695146f0963..1b0e44c2b276 100644 --- a/chia/wallet/puzzles/p2_parent.clvm +++ b/chia/wallet/puzzles/p2_parent.clsp @@ -7,8 +7,8 @@ parent_solution ) - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) (c (list ASSERT_MY_PARENT_ID diff --git a/chia/wallet/puzzles/p2_parent.clvm.hex b/chia/wallet/puzzles/p2_parent.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_parent.clvm.hex rename to chia/wallet/puzzles/p2_parent.clsp.hex diff --git a/chia/wallet/puzzles/p2_parent.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_parent.clvm.hex.sha256tree deleted file mode 100644 index 9572b4f1d49c..000000000000 --- a/chia/wallet/puzzles/p2_parent.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -b10ce2d0b18dcf8c21ddfaf55d9b9f0adcbf1e0beb55b1a8b9cad9bbff4e5f22 diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm b/chia/wallet/puzzles/p2_puzzle_hash.clsp similarity index 100% rename from chia/wallet/puzzles/p2_puzzle_hash.clvm rename to chia/wallet/puzzles/p2_puzzle_hash.clsp diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex b/chia/wallet/puzzles/p2_puzzle_hash.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_puzzle_hash.clvm.hex rename to chia/wallet/puzzles/p2_puzzle_hash.clsp.hex diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree deleted file mode 100644 index 8edc286a7054..000000000000 --- a/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -13e29a62b42cd2ef72a79e4bacdc59733ca6310d65af83d349360d36ec622363 diff --git a/chia/wallet/puzzles/p2_puzzle_hash.py b/chia/wallet/puzzles/p2_puzzle_hash.py index 5fe18d65d612..a540ccaec6d2 100644 --- a/chia/wallet/puzzles/p2_puzzle_hash.py +++ b/chia/wallet/puzzles/p2_puzzle_hash.py @@ -12,7 +12,7 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from .load_clvm import load_clvm_maybe_recompile -MOD = load_clvm_maybe_recompile("p2_puzzle_hash.clvm") +MOD = load_clvm_maybe_recompile("p2_puzzle_hash.clsp") def puzzle_for_inner_puzzle_hash(inner_puzzle_hash: bytes32) -> Program: diff --git a/chia/wallet/puzzles/p2_singleton.clvm b/chia/wallet/puzzles/p2_singleton.clsp similarity index 94% rename from chia/wallet/puzzles/p2_singleton.clvm rename to chia/wallet/puzzles/p2_singleton.clsp index f7e91dee397a..041384003d87 100644 --- a/chia/wallet/puzzles/p2_singleton.clvm +++ b/chia/wallet/puzzles/p2_singleton.clsp @@ -6,11 +6,11 @@ ; singleton_inner_puzzle_hash is the innerpuzzlehash for our singleton at the current time ; my_id is the coin_id of the coin that this puzzle is locked into - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_MOD_HASH LAUNCHER_ID LAUNCHER_PUZZLE_HASH inner_puzzle_hash) (puzzle-hash-of-curried-function SINGLETON_MOD_HASH inner_puzzle_hash diff --git a/chia/wallet/puzzles/p2_singleton.clvm.hex b/chia/wallet/puzzles/p2_singleton.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_singleton.clvm.hex rename to chia/wallet/puzzles/p2_singleton.clsp.hex diff --git a/chia/wallet/puzzles/p2_singleton.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_singleton.clvm.hex.sha256tree deleted file mode 100644 index 8c26f84e1d4b..000000000000 --- a/chia/wallet/puzzles/p2_singleton.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -40f828d8dd55603f4ff9fbf6b73271e904e69406982f4fbefae2c8dcceaf9834 diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm b/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp similarity index 96% rename from chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm rename to chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp index e59b90f72332..2f501d527cac 100644 --- a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm +++ b/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp @@ -13,11 +13,11 @@ ; if we are paying to singleton then p1 is singleton_inner_puzzle_hash ; if we are running the delayed case then p1 is the amount to output - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline delayed_spend (SECONDS_DELAY DELAYED_PUZZLE_HASH amount) (list (list ASSERT_SECONDS_RELATIVE SECONDS_DELAY) @@ -27,7 +27,7 @@ ) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_MOD_HASH LAUNCHER_ID LAUNCHER_PUZZLE_HASH inner_puzzle_hash) (puzzle-hash-of-curried-function SINGLETON_MOD_HASH inner_puzzle_hash diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex b/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp.hex similarity index 100% rename from chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex rename to chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp.hex diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree b/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree deleted file mode 100644 index 44570a777aa9..000000000000 --- a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -adb656e0211e2ab4f42069a4c5efc80dc907e7062be08bf1628c8e5b6d94d25b diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm b/chia/wallet/puzzles/pool_member_innerpuz.clsp similarity index 98% rename from chia/wallet/puzzles/pool_member_innerpuz.clvm rename to chia/wallet/puzzles/pool_member_innerpuz.clsp index 696f93135750..68f2c29988b5 100644 --- a/chia/wallet/puzzles/pool_member_innerpuz.clvm +++ b/chia/wallet/puzzles/pool_member_innerpuz.clsp @@ -25,7 +25,7 @@ ; pool_reward_height is the block height that the reward was generated at. This is used to calculate the coin ID. ; key_value_list is signed extra data that the wallet may want to publicly announce for syncing purposes - (include condition_codes.clvm) + (include condition_codes.clib) (include singleton_truths.clib) ; takes a lisp tree and returns the hash of it diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex b/chia/wallet/puzzles/pool_member_innerpuz.clsp.hex similarity index 100% rename from chia/wallet/puzzles/pool_member_innerpuz.clvm.hex rename to chia/wallet/puzzles/pool_member_innerpuz.clsp.hex diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree b/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree deleted file mode 100644 index 33081b4b3781..000000000000 --- a/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -a8490702e333ddd831a3ac9c22d0fa26d2bfeaf2d33608deb22f0e0123eb0494 diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm b/chia/wallet/puzzles/pool_waitingroom_innerpuz.clsp similarity index 98% rename from chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm rename to chia/wallet/puzzles/pool_waitingroom_innerpuz.clsp index 609b201e6fff..caf458d64f16 100644 --- a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm +++ b/chia/wallet/puzzles/pool_waitingroom_innerpuz.clsp @@ -23,7 +23,7 @@ ; p1 is extra_data key_value_list - signed extra data that the wallet may want to publicly announce for syncing purposes ; p2 is destination_puzhash - the location that the escape spend wants to create itself to - (include condition_codes.clvm) + (include condition_codes.clib) (include singleton_truths.clib) ; takes a lisp tree and returns the hash of it diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex b/chia/wallet/puzzles/pool_waitingroom_innerpuz.clsp.hex similarity index 100% rename from chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex rename to chia/wallet/puzzles/pool_waitingroom_innerpuz.clsp.hex diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree b/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree deleted file mode 100644 index 562813256284..000000000000 --- a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -a317541a765bf8375e1c6e7c13503d0d2cbf56cacad5182befe947e78e2c0307 diff --git a/chia/wallet/puzzles/recompile-all.sh b/chia/wallet/puzzles/recompile-all.sh deleted file mode 100755 index 999f0412c7ff..000000000000 --- a/chia/wallet/puzzles/recompile-all.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# This hack is a quick way to recompile everything in this directory - -set -o errexit - -#BASE_DIR=`pwd | dirname` - -FILES=$(ls ./*.clvm) -echo "$FILES" - -INCLUDE_DIR=$(pwd) - -for FILE in $FILES -do - echo "run -d -i $INCLUDE_DIR $FILE > $FILE.hex" - # run -d -i $INCLUDE_DIR $FILE > $FILE.hex -done - -for FILE in $FILES -do - echo "opd -H $FILE.hex | head -1 > $FILE.hex.sha256tree" -done - -echo -echo "Copy & paste the above to the shell to recompile" diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm b/chia/wallet/puzzles/rom_bootstrap_generator.clsp similarity index 98% rename from chia/wallet/puzzles/rom_bootstrap_generator.clvm rename to chia/wallet/puzzles/rom_bootstrap_generator.clsp index 5e3881598ced..e589eb8d0c07 100644 --- a/chia/wallet/puzzles/rom_bootstrap_generator.clvm +++ b/chia/wallet/puzzles/rom_bootstrap_generator.clsp @@ -1,7 +1,7 @@ (mod (block_decompresser_program (historical_blocks_tree)) (defconstant local_deserialize_mod - ;; this monstrosity is the assembly output of `chialisp_deserialisation.clvm` + ;; this monstrosity is the assembly output of `chialisp_deserialisation.clsp` ;; it's pasted in here because the compiler doesn't yet support nested `mod` ;; my apologies -- RK diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex b/chia/wallet/puzzles/rom_bootstrap_generator.clsp.hex similarity index 100% rename from chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex rename to chia/wallet/puzzles/rom_bootstrap_generator.clsp.hex diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree b/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree deleted file mode 100644 index 16218d457bfa..000000000000 --- a/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -161bade1f822dcd62ab712ebaf30f3922a301e48a639e4295c5685f8bece7bd9 diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.py b/chia/wallet/puzzles/rom_bootstrap_generator.py index 697fbbc3262e..94e26d866b54 100644 --- a/chia/wallet/puzzles/rom_bootstrap_generator.py +++ b/chia/wallet/puzzles/rom_bootstrap_generator.py @@ -4,7 +4,7 @@ from chia.types.blockchain_format.serialized_program import SerializedProgram from .load_clvm import load_serialized_clvm_maybe_recompile -MOD = load_serialized_clvm_maybe_recompile("rom_bootstrap_generator.clvm") +MOD = load_serialized_clvm_maybe_recompile("rom_bootstrap_generator.clsp") def get_generator() -> SerializedProgram: diff --git a/chia/wallet/puzzles/settlement_payments.clvm b/chia/wallet/puzzles/settlement_payments.clsp similarity index 98% rename from chia/wallet/puzzles/settlement_payments.clvm rename to chia/wallet/puzzles/settlement_payments.clsp index 42f89e459c6d..15b7b9378e40 100644 --- a/chia/wallet/puzzles/settlement_payments.clvm +++ b/chia/wallet/puzzles/settlement_payments.clsp @@ -6,7 +6,7 @@ ;; The idea is the other side of this trade requires observing the announcement from a ;; `settlement_payments` puzzle hash as a condition of one or more coin spends. - (include condition_codes.clvm) + (include condition_codes.clib) (include utility_macros.clib) (defun sha256tree (TREE) diff --git a/chia/wallet/puzzles/settlement_payments.clvm.hex b/chia/wallet/puzzles/settlement_payments.clsp.hex similarity index 100% rename from chia/wallet/puzzles/settlement_payments.clvm.hex rename to chia/wallet/puzzles/settlement_payments.clsp.hex diff --git a/chia/wallet/puzzles/settlement_payments.clvm.hex.sha256tree b/chia/wallet/puzzles/settlement_payments.clvm.hex.sha256tree deleted file mode 100644 index c1ccfcd50d85..000000000000 --- a/chia/wallet/puzzles/settlement_payments.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -cfbfdeed5c4ca2de3d0bf520b9cb4bb7743a359bd2e6a188d19ce7dffc21d3e7 diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm b/chia/wallet/puzzles/settlement_payments_old.clsp similarity index 97% rename from chia/wallet/puzzles/settlement_payments_old.clvm rename to chia/wallet/puzzles/settlement_payments_old.clsp index 8de19339a0d6..2bb55decc216 100644 --- a/chia/wallet/puzzles/settlement_payments_old.clvm +++ b/chia/wallet/puzzles/settlement_payments_old.clsp @@ -6,7 +6,7 @@ ;; The idea is the other side of this trade requires observing the announcement from a ;; `settlement_payments` puzzle hash as a condition of one or more coin spends. - (include condition_codes.clvm) + (include condition_codes.clib) (defun sha256tree (TREE) (if (l TREE) diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm.hex b/chia/wallet/puzzles/settlement_payments_old.clsp.hex similarity index 100% rename from chia/wallet/puzzles/settlement_payments_old.clvm.hex rename to chia/wallet/puzzles/settlement_payments_old.clsp.hex diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree b/chia/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree deleted file mode 100644 index a1394c5e679b..000000000000 --- a/chia/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -bae24162efbd568f89bc7a340798a6118df0189eb9e3f8697bcea27af99f8f79 diff --git a/chia/wallet/puzzles/sha256tree_module.clvm b/chia/wallet/puzzles/sha256tree_module.clsp similarity index 100% rename from chia/wallet/puzzles/sha256tree_module.clvm rename to chia/wallet/puzzles/sha256tree_module.clsp diff --git a/chia/wallet/puzzles/sha256tree_module.clvm.hex b/chia/wallet/puzzles/sha256tree_module.clsp.hex similarity index 100% rename from chia/wallet/puzzles/sha256tree_module.clvm.hex rename to chia/wallet/puzzles/sha256tree_module.clsp.hex diff --git a/chia/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree b/chia/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree deleted file mode 100644 index a6f1b03250cf..000000000000 --- a/chia/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -eb4ead6576048c9d730b5ced00646c7fdd390649cfdf48a00de1590cdd8ee18f diff --git a/chia/wallet/puzzles/singleton_launcher.clvm b/chia/wallet/puzzles/singleton_launcher.clsp similarity index 93% rename from chia/wallet/puzzles/singleton_launcher.clvm rename to chia/wallet/puzzles/singleton_launcher.clsp index 2636730f1afa..ade69536d9ed 100644 --- a/chia/wallet/puzzles/singleton_launcher.clvm +++ b/chia/wallet/puzzles/singleton_launcher.clsp @@ -1,6 +1,6 @@ (mod (singleton_full_puzzle_hash amount key_value_list) - (include condition_codes.clvm) + (include condition_codes.clib) ; takes a lisp tree and returns the hash of it (defun sha256tree1 (TREE) diff --git a/chia/wallet/puzzles/singleton_launcher.clvm.hex b/chia/wallet/puzzles/singleton_launcher.clsp.hex similarity index 100% rename from chia/wallet/puzzles/singleton_launcher.clvm.hex rename to chia/wallet/puzzles/singleton_launcher.clsp.hex diff --git a/chia/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree b/chia/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree deleted file mode 100644 index fb2621f763ee..000000000000 --- a/chia/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -eff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9 diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm b/chia/wallet/puzzles/singleton_top_layer.clsp similarity index 98% rename from chia/wallet/puzzles/singleton_top_layer.clvm rename to chia/wallet/puzzles/singleton_top_layer.clsp index 19204e8e0ed7..65025a4c1aad 100644 --- a/chia/wallet/puzzles/singleton_top_layer.clvm +++ b/chia/wallet/puzzles/singleton_top_layer.clsp @@ -10,8 +10,8 @@ ; This puzzle is a wrapper around an inner smart puzzle which guarantees uniqueness. ; It takes its singleton identity from a coin with a launcher puzzle which guarantees that it is unique. - (include condition_codes.clvm) - (include curry-and-treehash.clinc) + (include condition_codes.clib) + (include curry-and-treehash.clib) (include singleton_truths.clib) ; takes a lisp tree and returns the hash of it @@ -39,7 +39,7 @@ (defun-inline launcher_puzzle_hash_for_singleton_struct (SINGLETON_STRUCT) (r (r SINGLETON_STRUCT))) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash) (puzzle-hash-of-curried-function (mod_hash_for_singleton_struct SINGLETON_STRUCT) inner_puzzle_hash diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm.hex b/chia/wallet/puzzles/singleton_top_layer.clsp.hex similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer.clvm.hex rename to chia/wallet/puzzles/singleton_top_layer.clsp.hex diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree b/chia/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree deleted file mode 100644 index 094ac5289141..000000000000 --- a/chia/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -24e044101e57b3d8c908b8a38ad57848afd29d3eecc439dba45f4412df4954fd diff --git a/chia/wallet/puzzles/singleton_top_layer.py b/chia/wallet/puzzles/singleton_top_layer.py index 5b7954af956d..621f8af52bf4 100644 --- a/chia/wallet/puzzles/singleton_top_layer.py +++ b/chia/wallet/puzzles/singleton_top_layer.py @@ -12,11 +12,11 @@ from chia.util.ints import uint64 from chia.wallet.lineage_proof import LineageProof from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm") +SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clsp") SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() -P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clvm") -P2_SINGLETON_OR_DELAYED_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clvm") -SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clvm") +P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clsp") +P2_SINGLETON_OR_DELAYED_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clsp") +SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clsp") SINGLETON_LAUNCHER_HASH = SINGLETON_LAUNCHER.get_tree_hash() ESCAPE_VALUE = -113 MELT_CONDITION = [ConditionOpcode.CREATE_COIN, 0, ESCAPE_VALUE] diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm b/chia/wallet/puzzles/singleton_top_layer_v1_1.clsp similarity index 97% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.clvm rename to chia/wallet/puzzles/singleton_top_layer_v1_1.clsp index 59099a81e3fb..181e07b64732 100644 --- a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm +++ b/chia/wallet/puzzles/singleton_top_layer_v1_1.clsp @@ -10,8 +10,8 @@ ; This puzzle is a wrapper around an inner smart puzzle which guarantees uniqueness. ; It takes its singleton identity from a coin with a launcher puzzle which guarantees that it is unique. - (include condition_codes.clvm) - (include curry-and-treehash.clinc) ; also imports the constant ONE == 1 + (include condition_codes.clib) + (include curry-and-treehash.clib) ; also imports the constant ONE == 1 (include singleton_truths.clib) (include utility_macros.clib) @@ -20,7 +20,7 @@ (defun-inline launcher_puzzle_hash_for_singleton_struct (SINGLETON_STRUCT) (r (r SINGLETON_STRUCT))) ;; return the full puzzlehash for a singleton with the innerpuzzle curried in - ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clinc + ; puzzle-hash-of-curried-function is imported from curry-and-treehash.clib (defun-inline calculate_full_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash) (puzzle-hash-of-curried-function (mod_hash_for_singleton_struct SINGLETON_STRUCT) inner_puzzle_hash diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex b/chia/wallet/puzzles/singleton_top_layer_v1_1.clsp.hex similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex rename to chia/wallet/puzzles/singleton_top_layer_v1_1.clsp.hex diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree b/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree deleted file mode 100644 index eae342a9c700..000000000000 --- a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -7faa3253bfddd1e0decb0906b2dc6247bbc4cf608f58345d173adb63e8b47c9f diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.py b/chia/wallet/puzzles/singleton_top_layer_v1_1.py index c4d43bff8f4c..99f7f9594530 100644 --- a/chia/wallet/puzzles/singleton_top_layer_v1_1.py +++ b/chia/wallet/puzzles/singleton_top_layer_v1_1.py @@ -13,11 +13,11 @@ from chia.wallet.lineage_proof import LineageProof from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.uncurried_puzzle import UncurriedPuzzle -SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") +SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clsp") SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() -P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clvm") -P2_SINGLETON_OR_DELAYED_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clvm") -SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clvm") +P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clsp") +P2_SINGLETON_OR_DELAYED_MOD = load_clvm_maybe_recompile("p2_singleton_or_delayed_puzhash.clsp") +SINGLETON_LAUNCHER = load_clvm_maybe_recompile("singleton_launcher.clsp") SINGLETON_LAUNCHER_HASH = SINGLETON_LAUNCHER.get_tree_hash() ESCAPE_VALUE = -113 MELT_CONDITION = [ConditionOpcode.CREATE_COIN, 0, ESCAPE_VALUE] diff --git a/chia/wallet/puzzles/tails.py b/chia/wallet/puzzles/tails.py index 70e17f17aaf0..198d4cf1f818 100644 --- a/chia/wallet/puzzles/tails.py +++ b/chia/wallet/puzzles/tails.py @@ -19,10 +19,10 @@ from chia.wallet.puzzles.cat_loader import CAT_MOD from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.transaction_record import TransactionRecord -GENESIS_BY_ID_MOD = load_clvm_maybe_recompile("genesis_by_coin_id.clvm") -GENESIS_BY_PUZHASH_MOD = load_clvm_maybe_recompile("genesis_by_puzzle_hash.clvm") -EVERYTHING_WITH_SIG_MOD = load_clvm_maybe_recompile("everything_with_signature.clvm") -DELEGATED_LIMITATIONS_MOD = load_clvm_maybe_recompile("delegated_tail.clvm") +GENESIS_BY_ID_MOD = load_clvm_maybe_recompile("genesis_by_coin_id.clsp") +GENESIS_BY_PUZHASH_MOD = load_clvm_maybe_recompile("genesis_by_puzzle_hash.clsp") +EVERYTHING_WITH_SIG_MOD = load_clvm_maybe_recompile("everything_with_signature.clsp") +DELEGATED_LIMITATIONS_MOD = load_clvm_maybe_recompile("delegated_tail.clsp") class LimitationsProgram: diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm b/chia/wallet/puzzles/test_generator_deserialize.clsp similarity index 100% rename from chia/wallet/puzzles/test_generator_deserialize.clvm rename to chia/wallet/puzzles/test_generator_deserialize.clsp diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm.hex b/chia/wallet/puzzles/test_generator_deserialize.clsp.hex similarity index 100% rename from chia/wallet/puzzles/test_generator_deserialize.clvm.hex rename to chia/wallet/puzzles/test_generator_deserialize.clsp.hex diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree b/chia/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree deleted file mode 100644 index 79fc1127d4da..000000000000 --- a/chia/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -52add794fc76e89512e4a063c383418bda084c8a78c74055abe80179e4a7832c diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm b/chia/wallet/puzzles/test_multiple_generator_input_arguments.clsp similarity index 100% rename from chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm rename to chia/wallet/puzzles/test_multiple_generator_input_arguments.clsp diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex b/chia/wallet/puzzles/test_multiple_generator_input_arguments.clsp.hex similarity index 100% rename from chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex rename to chia/wallet/puzzles/test_multiple_generator_input_arguments.clsp.hex diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree b/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree deleted file mode 100644 index 9d046e1cd298..000000000000 --- a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree +++ /dev/null @@ -1 +0,0 @@ -156dafbddc3e1d3bfe1f2a84e48e5e46b287b8358bf65c3c091c93e855fbfc5b diff --git a/chia/wallet/singleton.py b/chia/wallet/singleton.py index 9fd38f79dfc4..527836df9a6d 100644 --- a/chia/wallet/singleton.py +++ b/chia/wallet/singleton.py @@ -7,10 +7,10 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash -SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") +SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clsp") SINGLETON_TOP_LAYER_MOD_HASH = SINGLETON_TOP_LAYER_MOD.get_tree_hash() SINGLETON_TOP_LAYER_MOD_HASH_QUOTED = calculate_hash_of_quoted_mod_hash(SINGLETON_TOP_LAYER_MOD_HASH) -SINGLETON_LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clvm") +SINGLETON_LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clsp") SINGLETON_LAUNCHER_PUZZLE_HASH = SINGLETON_LAUNCHER_PUZZLE.get_tree_hash() diff --git a/chia/wallet/trade_manager.py b/chia/wallet/trade_manager.py index 95f50346c880..24b97fc05ba7 100644 --- a/chia/wallet/trade_manager.py +++ b/chia/wallet/trade_manager.py @@ -33,12 +33,12 @@ from chia.wallet.util.wallet_types import WalletType from chia.wallet.wallet import Wallet from chia.wallet.wallet_coin_record import WalletCoinRecord -OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clvm") +OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clsp") class TradeManager: """ - This class is a driver for creating and accepting settlement_payments.clvm style offers. + This class is a driver for creating and accepting settlement_payments.clsp style offers. By default, standard XCH is supported but to support other types of assets you must implement certain functions on the asset's wallet as well as create a driver for its puzzle(s). Here is a guide to integrating a new types of diff --git a/chia/wallet/trading/offer.py b/chia/wallet/trading/offer.py index b436225af7a4..35a8a1b00db6 100644 --- a/chia/wallet/trading/offer.py +++ b/chia/wallet/trading/offer.py @@ -34,8 +34,8 @@ from chia.wallet.util.puzzle_compression import ( lowest_best_version, ) -OFFER_MOD_OLD = load_clvm_maybe_recompile("settlement_payments_old.clvm") -OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clvm") +OFFER_MOD_OLD = load_clvm_maybe_recompile("settlement_payments_old.clsp") +OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clsp") OFFER_MOD_OLD_HASH = OFFER_MOD_OLD.get_tree_hash() OFFER_MOD_HASH = OFFER_MOD.get_tree_hash() ZERO_32 = bytes32([0] * 32) diff --git a/chia/wallet/util/notifications.py b/chia/wallet/util/notifications.py index 5c93302be373..8a6fb16f58d6 100644 --- a/chia/wallet/util/notifications.py +++ b/chia/wallet/util/notifications.py @@ -5,7 +5,7 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.ints import uint64 from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -NOTIFICATION_MOD = load_clvm_maybe_recompile("notification.clvm") +NOTIFICATION_MOD = load_clvm_maybe_recompile("notification.clsp") def construct_notification(target: bytes32, amount: uint64) -> Program: diff --git a/chia/wallet/util/puzzle_compression.py b/chia/wallet/util/puzzle_compression.py index db6714f3df93..36f9948b3fd5 100644 --- a/chia/wallet/util/puzzle_compression.py +++ b/chia/wallet/util/puzzle_compression.py @@ -20,8 +20,8 @@ LEGACY_CAT_MOD = Program.fromhex( "ff02ffff01ff02ff5effff04ff02ffff04ffff04ff05ffff04ffff0bff2cff0580ffff04ff0bff80808080ffff04ffff02ff17ff2f80ffff04ff5fffff04ffff02ff2effff04ff02ffff04ff17ff80808080ffff04ffff0bff82027fff82057fff820b7f80ffff04ff81bfffff04ff82017fffff04ff8202ffffff04ff8205ffffff04ff820bffff80808080808080808080808080ffff04ffff01ffffffff81ca3dff46ff0233ffff3c04ff01ff0181cbffffff02ff02ffff03ff05ffff01ff02ff32ffff04ff02ffff04ff0dffff04ffff0bff22ffff0bff2cff3480ffff0bff22ffff0bff22ffff0bff2cff5c80ff0980ffff0bff22ff0bffff0bff2cff8080808080ff8080808080ffff010b80ff0180ffff02ffff03ff0bffff01ff02ffff03ffff09ffff02ff2effff04ff02ffff04ff13ff80808080ff820b9f80ffff01ff02ff26ffff04ff02ffff04ffff02ff13ffff04ff5fffff04ff17ffff04ff2fffff04ff81bfffff04ff82017fffff04ff1bff8080808080808080ffff04ff82017fff8080808080ffff01ff088080ff0180ffff01ff02ffff03ff17ffff01ff02ffff03ffff20ff81bf80ffff0182017fffff01ff088080ff0180ffff01ff088080ff018080ff0180ffff04ffff04ff05ff2780ffff04ffff10ff0bff5780ff778080ff02ffff03ff05ffff01ff02ffff03ffff09ffff02ffff03ffff09ff11ff7880ffff0159ff8080ff0180ffff01818f80ffff01ff02ff7affff04ff02ffff04ff0dffff04ff0bffff04ffff04ff81b9ff82017980ff808080808080ffff01ff02ff5affff04ff02ffff04ffff02ffff03ffff09ff11ff7880ffff01ff04ff78ffff04ffff02ff36ffff04ff02ffff04ff13ffff04ff29ffff04ffff0bff2cff5b80ffff04ff2bff80808080808080ff398080ffff01ff02ffff03ffff09ff11ff2480ffff01ff04ff24ffff04ffff0bff20ff2980ff398080ffff010980ff018080ff0180ffff04ffff02ffff03ffff09ff11ff7880ffff0159ff8080ff0180ffff04ffff02ff7affff04ff02ffff04ff0dffff04ff0bffff04ff17ff808080808080ff80808080808080ff0180ffff01ff04ff80ffff04ff80ff17808080ff0180ffffff02ffff03ff05ffff01ff04ff09ffff02ff26ffff04ff02ffff04ff0dffff04ff0bff808080808080ffff010b80ff0180ff0bff22ffff0bff2cff5880ffff0bff22ffff0bff22ffff0bff2cff5c80ff0580ffff0bff22ffff02ff32ffff04ff02ffff04ff07ffff04ffff0bff2cff2c80ff8080808080ffff0bff2cff8080808080ffff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff2effff04ff02ffff04ff09ff80808080ffff02ff2effff04ff02ffff04ff0dff8080808080ffff01ff0bff2cff058080ff0180ffff04ffff04ff28ffff04ff5fff808080ffff02ff7effff04ff02ffff04ffff04ffff04ff2fff0580ffff04ff5fff82017f8080ffff04ffff02ff7affff04ff02ffff04ff0bffff04ff05ffff01ff808080808080ffff04ff17ffff04ff81bfffff04ff82017fffff04ffff0bff8204ffffff02ff36ffff04ff02ffff04ff09ffff04ff820affffff04ffff0bff2cff2d80ffff04ff15ff80808080808080ff8216ff80ffff04ff8205ffffff04ff820bffff808080808080808080808080ff02ff2affff04ff02ffff04ff5fffff04ff3bffff04ffff02ffff03ff17ffff01ff09ff2dffff0bff27ffff02ff36ffff04ff02ffff04ff29ffff04ff57ffff04ffff0bff2cff81b980ffff04ff59ff80808080808080ff81b78080ff8080ff0180ffff04ff17ffff04ff05ffff04ff8202ffffff04ffff04ffff04ff24ffff04ffff0bff7cff2fff82017f80ff808080ffff04ffff04ff30ffff04ffff0bff81bfffff0bff7cff15ffff10ff82017fffff11ff8202dfff2b80ff8202ff808080ff808080ff138080ff80808080808080808080ff018080" # noqa ) -OFFER_MOD_OLD = load_clvm_maybe_recompile("settlement_payments_old.clvm") -OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clvm") +OFFER_MOD_OLD = load_clvm_maybe_recompile("settlement_payments_old.clsp") +OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clsp") # For backwards compatibility to work, we must assume that these mods (already deployed) will not change # In the case that they do change and we don't support the old asset then we need to keep around the legacy module diff --git a/setup.py b/setup.py index 886fd106c40f..a2eb31e3581d 100644 --- a/setup.py +++ b/setup.py @@ -146,7 +146,7 @@ kwargs = dict( }, package_data={ "chia": ["pyinstaller.spec"], - "": ["*.clvm", "*.clvm.hex", "*.clib", "*.clinc", "*.clsp", "py.typed"], + "": ["*.clsp", "*.clsp.hex", "*.clvm", "*.clib", "py.typed"], "chia.util": ["initial-*.yaml", "english.txt"], "chia.ssl": ["chia_ca.crt", "chia_ca.key", "dst_root_ca.pem"], "mozilla-ca": ["cacert.pem"], diff --git a/tests/clvm/test_chialisp_deserialization.py b/tests/clvm/test_chialisp_deserialization.py index 65df55283817..2a7cdfc74c75 100644 --- a/tests/clvm/test_chialisp_deserialization.py +++ b/tests/clvm/test_chialisp_deserialization.py @@ -6,7 +6,7 @@ from chia.types.blockchain_format.program import INFINITE_COST, Program from chia.util.byte_types import hexstr_to_bytes from chia.wallet.puzzles.load_clvm import load_clvm -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clsp", package_or_requirement="chia.wallet.puzzles") def serialized_atom_overflow(size): diff --git a/tests/clvm/test_serialized_program.py b/tests/clvm/test_serialized_program.py index 5ad7011fba37..4b6b18768c07 100644 --- a/tests/clvm/test_serialized_program.py +++ b/tests/clvm/test_serialized_program.py @@ -6,7 +6,7 @@ from chia.types.blockchain_format.program import INFINITE_COST, Program from chia.types.blockchain_format.serialized_program import SerializedProgram from chia.wallet.puzzles.load_clvm import load_clvm -SHA256TREE_MOD = load_clvm("sha256tree_module.clvm") +SHA256TREE_MOD = load_clvm("sha256tree_module.clsp") # TODO: test multiple args diff --git a/tests/clvm/test_singletons.py b/tests/clvm/test_singletons.py index 301129161cfc..24526096dba7 100644 --- a/tests/clvm/test_singletons.py +++ b/tests/clvm/test_singletons.py @@ -23,11 +23,11 @@ from tests.util.key_tool import KeyTool """ This test suite aims to test: - chia.wallet.puzzles.singleton_top_layer.py - - chia.wallet.puzzles.singleton_top_layer.clvm + - chia.wallet.puzzles.singleton_top_layer.clsp - chia.wallet.puzzles.singleton_top_layer_v1_1.py - - chia.wallet.puzzles.singleton_top_layer_v1_1.clvm - - chia.wallet.puzzles.p2_singleton.clvm - - chia.wallet.puzzles.p2_singleton_or_delayed_puzhash.clvm + - chia.wallet.puzzles.singleton_top_layer_v1_1.clsp + - chia.wallet.puzzles.p2_singleton.clsp + - chia.wallet.puzzles.p2_singleton_or_delayed_puzhash.clsp """ diff --git a/tests/generator/test_compression.py b/tests/generator/test_compression.py index 8bcfe2c3ca8f..9ce113102c04 100644 --- a/tests/generator/test_compression.py +++ b/tests/generator/test_compression.py @@ -29,17 +29,17 @@ from chia.util.ints import uint32 from chia.wallet.puzzles.load_clvm import load_clvm from tests.core.make_block_generator import make_spend_bundle -TEST_GEN_DESERIALIZE = load_clvm("test_generator_deserialize.clvm", package_or_requirement="chia.wallet.puzzles") -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +TEST_GEN_DESERIALIZE = load_clvm("test_generator_deserialize.clsp", package_or_requirement="chia.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clsp", package_or_requirement="chia.wallet.puzzles") -DECOMPRESS_PUZZLE = load_clvm("decompress_puzzle.clvm", package_or_requirement="chia.wallet.puzzles") -DECOMPRESS_CSE = load_clvm("decompress_coin_spend_entry.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_PUZZLE = load_clvm("decompress_puzzle.clsp", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_CSE = load_clvm("decompress_coin_spend_entry.clsp", package_or_requirement="chia.wallet.puzzles") DECOMPRESS_CSE_WITH_PREFIX = load_clvm( - "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="chia.wallet.puzzles" + "decompress_coin_spend_entry_with_prefix.clsp", package_or_requirement="chia.wallet.puzzles" ) -DECOMPRESS_BLOCK = load_clvm("block_program_zero.clvm", package_or_requirement="chia.wallet.puzzles") -TEST_MULTIPLE = load_clvm("test_multiple_generator_input_arguments.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_BLOCK = load_clvm("block_program_zero.clsp", package_or_requirement="chia.wallet.puzzles") +TEST_MULTIPLE = load_clvm("test_multiple_generator_input_arguments.clsp", package_or_requirement="chia.wallet.puzzles") Nil = Program.from_bytes(b"\x80") diff --git a/tests/generator/test_rom.py b/tests/generator/test_rom.py index 88539a09676a..bfbc04c983f8 100644 --- a/tests/generator/test_rom.py +++ b/tests/generator/test_rom.py @@ -20,7 +20,7 @@ MAX_COST = int(1e15) COST_PER_BYTE = int(12000) -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clsp", package_or_requirement="chia.wallet.puzzles") GENERATOR_CODE = """ diff --git a/tests/pools/test_pool_puzzles_lifecycle.py b/tests/pools/test_pool_puzzles_lifecycle.py index 90c5c13da522..a032b713a748 100644 --- a/tests/pools/test_pool_puzzles_lifecycle.py +++ b/tests/pools/test_pool_puzzles_lifecycle.py @@ -46,8 +46,8 @@ from tests.util.key_tool import KeyTool """ This test suite aims to test: - chia.pools.pool_puzzles.py - - chia.wallet.puzzles.pool_member_innerpuz.clvm - - chia.wallet.puzzles.pool_waiting_room_innerpuz.clvm + - chia.wallet.puzzles.pool_member_innerpuz.clsp + - chia.wallet.puzzles.pool_waiting_room_innerpuz.clsp """ diff --git a/tests/wallet/db_wallet/test_db_graftroot.py b/tests/wallet/db_wallet/test_db_graftroot.py index 73008fc34b1c..20f5e40ca845 100644 --- a/tests/wallet/db_wallet/test_db_graftroot.py +++ b/tests/wallet/db_wallet/test_db_graftroot.py @@ -16,7 +16,7 @@ from chia.util.errors import Err from chia.wallet.puzzles.load_clvm import load_clvm from chia.wallet.util.merkle_utils import build_merkle_tree, build_merkle_tree_from_binary_tree, simplify_merkle_proof -GRAFTROOT_MOD = load_clvm("graftroot_dl_offers.clvm") +GRAFTROOT_MOD = load_clvm("graftroot_dl_offers.clsp") # Always returns the last value # (mod solution diff --git a/tests/wallet/nft_wallet/test_nft_puzzles.py b/tests/wallet/nft_wallet/test_nft_puzzles.py index f750ef8fd4e2..3028d0e05e37 100644 --- a/tests/wallet/nft_wallet/test_nft_puzzles.py +++ b/tests/wallet/nft_wallet/test_nft_puzzles.py @@ -20,19 +20,19 @@ from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_ from chia.wallet.uncurried_puzzle import uncurry_puzzle from tests.core.make_block_generator import int_to_public_key -SINGLETON_MOD = load_clvm("singleton_top_layer_v1_1.clvm") -LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clvm") -DID_MOD = load_clvm("did_innerpuz.clvm") -NFT_STATE_LAYER_MOD = load_clvm("nft_state_layer.clvm") -NFT_OWNERSHIP_LAYER = load_clvm("nft_ownership_layer.clvm") -NFT_TRANSFER_PROGRAM_DEFAULT = load_clvm("nft_ownership_transfer_program_one_way_claim_with_royalties.clvm") +SINGLETON_MOD = load_clvm("singleton_top_layer_v1_1.clsp") +LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") +DID_MOD = load_clvm("did_innerpuz.clsp") +NFT_STATE_LAYER_MOD = load_clvm("nft_state_layer.clsp") +NFT_OWNERSHIP_LAYER = load_clvm("nft_ownership_layer.clsp") +NFT_TRANSFER_PROGRAM_DEFAULT = load_clvm("nft_ownership_transfer_program_one_way_claim_with_royalties.clsp") LAUNCHER_PUZZLE_HASH = LAUNCHER_PUZZLE.get_tree_hash() NFT_STATE_LAYER_MOD_HASH = NFT_STATE_LAYER_MOD.get_tree_hash() SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() -OFFER_MOD = load_clvm("settlement_payments.clvm") +OFFER_MOD = load_clvm("settlement_payments.clsp") LAUNCHER_ID = Program.to(b"launcher-id").get_tree_hash() -NFT_METADATA_UPDATER_DEFAULT = load_clvm("nft_metadata_updater_default.clvm") +NFT_METADATA_UPDATER_DEFAULT = load_clvm("nft_metadata_updater_default.clsp") def test_nft_transfer_puzzle_hashes(): diff --git a/tests/wallet/test_singleton.py b/tests/wallet/test_singleton.py index 9ae1efd19a79..e47d47294e19 100644 --- a/tests/wallet/test_singleton.py +++ b/tests/wallet/test_singleton.py @@ -8,11 +8,11 @@ from chia.types.blockchain_format.sized_bytes import bytes32 from chia.util.condition_tools import parse_sexp_to_conditions from chia.wallet.puzzles.load_clvm import load_clvm -SINGLETON_MOD = load_clvm("singleton_top_layer.clvm") -LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clvm") -P2_SINGLETON_MOD = load_clvm("p2_singleton.clvm") -POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clvm") -POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clvm") +SINGLETON_MOD = load_clvm("singleton_top_layer.clsp") +LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") +P2_SINGLETON_MOD = load_clvm("p2_singleton.clsp") +POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clsp") +POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clsp") LAUNCHER_PUZZLE_HASH = LAUNCHER_PUZZLE.get_tree_hash() SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() diff --git a/tests/wallet/test_singleton_lifecycle.py b/tests/wallet/test_singleton_lifecycle.py index f3bba741d798..184e6187fd0b 100644 --- a/tests/wallet/test_singleton_lifecycle.py +++ b/tests/wallet/test_singleton_lifecycle.py @@ -17,11 +17,11 @@ from chia.util.ints import uint64 from chia.wallet.puzzles.load_clvm import load_clvm from tests.core.full_node.test_conditions import check_spend_bundle_validity, initial_blocks -SINGLETON_MOD = load_clvm("singleton_top_layer.clvm") -LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clvm") -P2_SINGLETON_MOD = load_clvm("p2_singleton.clvm") -POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clvm") -POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clvm") +SINGLETON_MOD = load_clvm("singleton_top_layer.clsp") +LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") +P2_SINGLETON_MOD = load_clvm("p2_singleton.clsp") +POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clsp") +POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clsp") LAUNCHER_PUZZLE_HASH = LAUNCHER_PUZZLE.get_tree_hash() SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() diff --git a/tests/wallet/test_singleton_lifecycle_fast.py b/tests/wallet/test_singleton_lifecycle_fast.py index bcd75b34cccd..3c632e63cc43 100644 --- a/tests/wallet/test_singleton_lifecycle_fast.py +++ b/tests/wallet/test_singleton_lifecycle_fast.py @@ -18,11 +18,11 @@ from chia.util.ints import uint64 from chia.wallet.puzzles.load_clvm import load_clvm from tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp -SINGLETON_MOD = load_clvm("singleton_top_layer.clvm") -LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clvm") -P2_SINGLETON_MOD = load_clvm("p2_singleton_or_delayed_puzhash.clvm") -POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clvm") -POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clvm") +SINGLETON_MOD = load_clvm("singleton_top_layer.clsp") +LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clsp") +P2_SINGLETON_MOD = load_clvm("p2_singleton_or_delayed_puzhash.clsp") +POOL_MEMBER_MOD = load_clvm("pool_member_innerpuz.clsp") +POOL_WAITINGROOM_MOD = load_clvm("pool_waitingroom_innerpuz.clsp") LAUNCHER_PUZZLE_HASH = LAUNCHER_PUZZLE.get_tree_hash() SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() diff --git a/tools/manage_clvm.py b/tools/manage_clvm.py index 745a367ad98a..7bb2eeff1110 100644 --- a/tools/manage_clvm.py +++ b/tools/manage_clvm.py @@ -30,11 +30,12 @@ from clvm_tools_rs import compile_clvm # noqa: E402 from chia.types.blockchain_format.serialized_program import SerializedProgram # noqa: E402 clvm_suffix = ".clvm" -hex_suffix = ".clvm.hex" -hash_suffix = ".clvm.hex.sha256tree" -all_suffixes = {"clvm": clvm_suffix, "hex": hex_suffix, "hash": hash_suffix} -# TODO: could be cli options +clsp_suffix = ".clsp" +hex_suffix = ".clsp.hex" +all_suffixes = {"clsp": clsp_suffix, "hex": hex_suffix, "clvm": clvm_suffix} +# TODO: these could be cli options top_levels = {"chia"} +hashes_path = root.joinpath("chia/wallet/puzzles/deployed_puzzle_hashes.json") class ManageClvmError(Exception): @@ -42,7 +43,7 @@ class ManageClvmError(Exception): class CacheEntry(typing.TypedDict): - clvm: str + clsp: str hex: str hash: str @@ -100,8 +101,7 @@ def dump_cache(cache: Cache, file: typing.IO[str]) -> None: def generate_hash_bytes(hex_bytes: bytes) -> bytes: cleaned_blob = bytes.fromhex(hex_bytes.decode("utf-8")) serialize_program = SerializedProgram.from_bytes(cleaned_blob) - result = serialize_program.get_tree_hash().hex() - return (result + "\n").encode("utf-8") + return serialize_program.get_tree_hash() @typing_extensions.final @@ -109,14 +109,23 @@ def generate_hash_bytes(hex_bytes: bytes) -> bytes: class ClvmPaths: clvm: pathlib.Path hex: pathlib.Path - hash: pathlib.Path + hash: str + missing_files: typing.List[str] @classmethod - def from_clvm(cls, clvm: pathlib.Path) -> ClvmPaths: + def from_clvm(cls, clvm: pathlib.Path, hash_dict: typing.Dict[str, str] = {}) -> ClvmPaths: + stem_filename = clvm.name[: -len(clsp_suffix)] + hex_path = clvm.with_name(stem_filename + hex_suffix) + missing_files = [] + if not hex_path.exists(): + missing_files.append(str(hex_path)) + if stem_filename not in hash_dict: + missing_files.append(f"{stem_filename} entry in {hashes_path}") return cls( clvm=clvm, - hex=clvm.with_name(clvm.name[: -len(clvm_suffix)] + hex_suffix), - hash=clvm.with_name(clvm.name[: -len(clvm_suffix)] + hash_suffix), + hex=hex_path, + hash=stem_filename, + missing_files=missing_files, ) @@ -127,10 +136,10 @@ class ClvmBytes: hash: bytes @classmethod - def from_clvm_paths(cls, paths: ClvmPaths) -> ClvmBytes: + def from_clvm_paths(cls, paths: ClvmPaths, hash_dict: typing.Dict[str, str] = {}) -> ClvmBytes: return cls( hex=paths.hex.read_bytes(), - hash=paths.hash.read_bytes(), + hash=bytes.fromhex(hash_dict[paths.hash]), ) @classmethod @@ -142,7 +151,7 @@ class ClvmBytes: # These files have the wrong extension for now so we'll just manually exclude them -excludes = {"condition_codes.clvm", "create-lock-puzzlehash.clvm"} +excludes: typing.Set[str] = set() def find_stems( @@ -173,7 +182,7 @@ def create_cache_entry(reference_paths: ClvmPaths, reference_bytes: ClvmBytes) - hash_hasher.update(reference_bytes.hash) return { - "clvm": clvm_hasher.hexdigest(), + "clsp": clvm_hasher.hexdigest(), "hex": hex_hasher.hexdigest(), "hash": hash_hasher.hexdigest(), } @@ -190,6 +199,8 @@ def check(use_cache: bool) -> int: used_excludes = set() overall_fail = False + HASHES: typing.Dict[str, str] = json.loads(hashes_path.read_text()) if hashes_path.exists() else {} + cache: Cache if not use_cache: cache = create_empty_cache() @@ -212,27 +223,43 @@ def check(use_cache: bool) -> int: cache_modified = False found_stems = find_stems(top_levels) - for name in ["hex", "hash"]: - found = found_stems[name] - suffix = all_suffixes[name] - extra = found - found_stems["clvm"] - - print() - print(f"Extra {suffix} files:") - - if len(extra) == 0: - print(" -") - else: - overall_fail = True - for stem in extra: - print(f" {stem.with_name(stem.name + suffix)}") + found = found_stems["hex"] + suffix = all_suffixes["hex"] + extra = found - found_stems["clsp"] print() - print("Checking that all existing .clvm files compile to .clvm.hex that match existing caches:") + print(f"Extra {suffix} files:") + + if len(extra) == 0: + print(" -") + else: + overall_fail = True + for stem in extra: + print(f" {stem.with_name(stem.name + suffix)}") + + print() + print("Checking that no .clvm files begin with `(mod`") for stem_path in sorted(found_stems["clvm"]): - clvm_path = stem_path.with_name(stem_path.name + clvm_suffix) - if clvm_path.name in excludes: - used_excludes.add(clvm_path.name) + with open(stem_path.with_name(stem_path.name + clvm_suffix)) as file: + file_lines = file.readlines() + for line in file_lines: + non_comment: str = line.split(";")[0] + if "(" in non_comment: + paren_index: int = non_comment.find("(") + if len(non_comment) >= paren_index + 4 and non_comment[paren_index : paren_index + 4] == "(mod": + overall_fail = True + print(f"FAIL : {stem_path.name + clvm_suffix} contains `(mod`") + break + + missing_files: typing.List[str] = [] + all_hash_stems: typing.List[str] = [] + + print() + print("Checking that all existing .clsp files compile to .clsp.hex that match existing caches:") + for stem_path in sorted(found_stems["clsp"]): + clsp_path = stem_path.with_name(stem_path.name + clsp_suffix) + if clsp_path.name in excludes: + used_excludes.add(clsp_path.name) continue file_fail = False @@ -240,8 +267,12 @@ def check(use_cache: bool) -> int: cache_key = str(stem_path) try: - reference_paths = ClvmPaths.from_clvm(clvm=clvm_path) - reference_bytes = ClvmBytes.from_clvm_paths(paths=reference_paths) + reference_paths = ClvmPaths.from_clvm(clvm=clsp_path, hash_dict=HASHES) + if reference_paths.missing_files != []: + missing_files.extend(reference_paths.missing_files) + continue + all_hash_stems.append(reference_paths.hash) + reference_bytes = ClvmBytes.from_clvm_paths(paths=reference_paths, hash_dict=HASHES) new_cache_entry = create_cache_entry(reference_paths=reference_paths, reference_bytes=reference_bytes) existing_cache_entry = cache_entries.get(cache_key) @@ -250,7 +281,8 @@ def check(use_cache: bool) -> int: if not cache_hit: with tempfile.TemporaryDirectory() as temporary_directory: generated_paths = ClvmPaths.from_clvm( - clvm=pathlib.Path(temporary_directory).joinpath(f"generated{clvm_suffix}") + clvm=pathlib.Path(temporary_directory).joinpath(reference_paths.clvm.name), + hash_dict=HASHES, ) compile_clvm( @@ -273,15 +305,22 @@ def check(use_cache: bool) -> int: error = traceback.format_exc() if file_fail: - print(f"FAIL : {clvm_path}") + print(f"FAIL : {clsp_path}") if error is not None: print(error) else: - print(f" pass: {clvm_path}") + print(f" pass: {clsp_path}") if file_fail: overall_fail = True + if missing_files != []: + overall_fail = True + print() + print("Missing files (run tools/manage_clvm.py build to build them):") + for filename in missing_files: + print(f" - {filename}") + unused_excludes = sorted(excludes - used_excludes) if len(unused_excludes) > 0: overall_fail = True @@ -291,6 +330,14 @@ def check(use_cache: bool) -> int: for exclude in unused_excludes: print(f" {exclude}") + extra_hashes = HASHES.keys() - all_hash_stems + if len(extra_hashes) != 0: + overall_fail = True + print() + print("Hashes without corresponding files:") + for extra_hash in extra_hashes: + print(f" {extra_hash}") + if use_cache and cache_modified: cache_path.parent.mkdir(parents=True, exist_ok=True) with cache_path.open(mode="w") as file: @@ -303,23 +350,28 @@ def check(use_cache: bool) -> int: def build() -> int: overall_fail = False - found_stems = find_stems(top_levels, suffixes={"clvm": clvm_suffix}) + HASHES: typing.Dict[str, str] = json.loads(hashes_path.read_text()) if hashes_path.exists() else {} - print(f"Building all existing {clvm_suffix} files to {hex_suffix}:") - for stem_path in sorted(found_stems["clvm"]): - clvm_path = stem_path.with_name(stem_path.name + clvm_suffix) - if clvm_path.name in excludes: + found_stems = find_stems(top_levels, suffixes={"clsp": clsp_suffix}) + hash_stems = [] + new_hashes = HASHES.copy() + + print(f"Building all existing {clsp_suffix} files to {hex_suffix}:") + for stem_path in sorted(found_stems["clsp"]): + clsp_path = stem_path.with_name(stem_path.name + clsp_suffix) + if clsp_path.name in excludes: continue file_fail = False error = None try: - reference_paths = ClvmPaths.from_clvm(clvm=clvm_path) + reference_paths = ClvmPaths.from_clvm(clvm=clsp_path, hash_dict=HASHES) with tempfile.TemporaryDirectory() as temporary_directory: generated_paths = ClvmPaths.from_clvm( - clvm=pathlib.Path(temporary_directory).joinpath(f"generated{clvm_suffix}") + clvm=pathlib.Path(temporary_directory).joinpath(reference_paths.clvm.name), + hash_dict=HASHES, ) compile_clvm( @@ -330,20 +382,36 @@ def build() -> int: generated_bytes = ClvmBytes.from_hex_bytes(hex_bytes=generated_paths.hex.read_bytes()) reference_paths.hex.write_bytes(generated_bytes.hex) + + # Only add hashes to json file if they didn't already exist in it + hash_stems.append(reference_paths.hash) + if reference_paths.hash not in new_hashes: + new_hashes[reference_paths.hash] = ClvmBytes.from_clvm_paths( + reference_paths, hash_dict=HASHES + ).hash.hex() except Exception: file_fail = True error = traceback.format_exc() if file_fail: - print(f"FAIL : {clvm_path}") + print(f"FAIL : {clsp_path}") if error is not None: print(error) else: - print(f" built: {clvm_path}") + print(f" built: {clsp_path}") if file_fail: overall_fail = True + hashes_path.write_text( + json.dumps( + {key: value for key, value in new_hashes.items() if key in hash_stems}, # filter out not found files + indent=4, + sort_keys=True, + ) + + "\n" + ) + sys.exit(1 if overall_fail else 0) diff --git a/tools/run_block.py b/tools/run_block.py index caa0da0cbff6..a09c98db876b 100644 --- a/tools/run_block.py +++ b/tools/run_block.py @@ -61,7 +61,7 @@ from chia.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile from chia.wallet.uncurried_puzzle import uncurry_puzzle DESERIALIZE_MOD = load_serialized_clvm_maybe_recompile( - "chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles" + "chialisp_deserialisation.clsp", package_or_requirement="chia.wallet.puzzles" )