Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the order of keys in cost models #435

Merged
merged 1 commit into from
Apr 6, 2025
Merged

Conversation

cffls
Copy link
Collaborator

@cffls cffls commented Apr 5, 2025

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.

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.
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

pycardano/plutus.py:81

  • The cost model keys are still being sorted in the CBOR branch, while the non-CBOR branch now preserves the original order. Confirm if both branches should use the same ordering for consistency.
cm = IndefiniteList([cost_model[k] for k in sorted(cost_model.keys())])

Copy link

codecov bot commented Apr 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.77%. Comparing base (6e20135) to head (9ce278c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
+ Coverage   85.14%   88.77%   +3.62%     
==========================================
  Files          32       33       +1     
  Lines        4679     4757      +78     
  Branches     1116     1136      +20     
==========================================
+ Hits         3984     4223     +239     
+ Misses        551      375     -176     
- Partials      144      159      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cffls cffls merged commit d2a9c85 into Python-Cardano:main Apr 6, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants