From 9ce278c4fec65042ebfc8d03ad9992a22d9d4a22 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 5 Apr 2025 12:15:57 -0700 Subject: [PATCH] Keep the order of keys in cost models Since plutus v3, sorting cost models based on the lexicographical of keys would result in wrong script data hash. We can assume the cost model from the chain context could be directly used without any sorting. --- pycardano/plutus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycardano/plutus.py b/pycardano/plutus.py index da089c26..90a83ca2 100644 --- a/pycardano/plutus.py +++ b/pycardano/plutus.py @@ -81,7 +81,7 @@ def to_shallow_primitive(self) -> dict: cm = IndefiniteList([cost_model[k] for k in sorted(cost_model.keys())]) result[l_cbor] = cbor2.dumps(cm, default=default_encoder) else: - result[language] = [cost_model[k] for k in sorted(cost_model.keys())] + result[language] = [cost_model[k] for k in cost_model.keys()] return result @classmethod