From 7c505e5cdc2a7ec1ef949dbc5ada8aae4fe14bfe Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Fri, 28 Jul 2023 11:02:43 -0700 Subject: [PATCH 1/3] Add condition opcodes for agg sigs to condition_codes.clib --- chia/wallet/puzzles/condition_codes.clib | 7 +++++++ tests/clvm/test_condition_codes.py | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/clvm/test_condition_codes.py diff --git a/chia/wallet/puzzles/condition_codes.clib b/chia/wallet/puzzles/condition_codes.clib index 386036fb62a6..a9106cc4baad 100644 --- a/chia/wallet/puzzles/condition_codes.clib +++ b/chia/wallet/puzzles/condition_codes.clib @@ -1,6 +1,13 @@ ; See chia/types/condition_opcodes.py ( + + (defconstant AGG_SIG_PARENT 43) + (defconstant AGG_SIG_PUZZLE 44) + (defconstant AGG_SIG_AMOUNT 45) + (defconstant AGG_SIG_PUZZLE_AMOUNT 46) + (defconstant AGG_SIG_PARENT_AMOUNT 47) + (defconstant AGG_SIG_PARENT_PUZZLE 48) (defconstant AGG_SIG_UNSAFE 49) (defconstant AGG_SIG_ME 50) diff --git a/tests/clvm/test_condition_codes.py b/tests/clvm/test_condition_codes.py new file mode 100644 index 000000000000..d70395021746 --- /dev/null +++ b/tests/clvm/test_condition_codes.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +import pkg_resources +from clvm.casts import int_from_bytes + +from chia.types.condition_opcodes import ConditionOpcode + + +def test_condition_codes_is_complete() -> None: + with open(pkg_resources.resource_filename("chia.wallet.puzzles", "condition_codes.clib")) as f: + contents: str = f.read() + for name, value in ConditionOpcode._member_map_.items(): + assert f"(defconstant {name} {int_from_bytes(value)})" in contents From f93ac4b7b5f30d04b9e2083169d206cc9c24ddf8 Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Fri, 28 Jul 2023 12:03:42 -0700 Subject: [PATCH 2/3] Add comment about hard fork --- chia/wallet/puzzles/condition_codes.clib | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chia/wallet/puzzles/condition_codes.clib b/chia/wallet/puzzles/condition_codes.clib index a9106cc4baad..19f4d3164b6e 100644 --- a/chia/wallet/puzzles/condition_codes.clib +++ b/chia/wallet/puzzles/condition_codes.clib @@ -2,12 +2,15 @@ ( + ; Unavailable until after 2.0 hard fork (defconstant AGG_SIG_PARENT 43) (defconstant AGG_SIG_PUZZLE 44) (defconstant AGG_SIG_AMOUNT 45) (defconstant AGG_SIG_PUZZLE_AMOUNT 46) (defconstant AGG_SIG_PARENT_AMOUNT 47) (defconstant AGG_SIG_PARENT_PUZZLE 48) + ; + (defconstant AGG_SIG_UNSAFE 49) (defconstant AGG_SIG_ME 50) From 443806b1e97c0c568417f2eadc8fd9fa105bb013 Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Mon, 31 Jul 2023 08:32:39 -0700 Subject: [PATCH 3/3] pylint --- tests/clvm/test_condition_codes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/clvm/test_condition_codes.py b/tests/clvm/test_condition_codes.py index d70395021746..ac64edd8e0e6 100644 --- a/tests/clvm/test_condition_codes.py +++ b/tests/clvm/test_condition_codes.py @@ -9,5 +9,5 @@ def test_condition_codes_is_complete() -> None: with open(pkg_resources.resource_filename("chia.wallet.puzzles", "condition_codes.clib")) as f: contents: str = f.read() - for name, value in ConditionOpcode._member_map_.items(): + for name, value in ConditionOpcode.__members__.items(): assert f"(defconstant {name} {int_from_bytes(value)})" in contents