Skip to content

Commit d2a9c85

Browse files
authored
Keep the order of keys in cost models (#435)
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.
1 parent e2d8f2d commit d2a9c85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pycardano/plutus.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def to_shallow_primitive(self) -> dict:
8181
cm = IndefiniteList([cost_model[k] for k in sorted(cost_model.keys())])
8282
result[l_cbor] = cbor2.dumps(cm, default=default_encoder)
8383
else:
84-
result[language] = [cost_model[k] for k in sorted(cost_model.keys())]
84+
result[language] = [cost_model[k] for k in cost_model.keys()]
8585
return result
8686

8787
@classmethod

0 commit comments

Comments
 (0)