Conversation
📝 WalkthroughWalkthroughRefactors LanguageView into a map-based Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This pull request refactors how Plutus language cost models are handled throughout the codebase, changing from a single
LanguageView(supporting just one language/cost model at a time) to a newLanguageViewstype that supports multiple languages and their cost models simultaneously. This enables transactions to include cost models for multiple Plutus versions, aligning with Cardano's evolving protocol requirements. The changes affect primitives, transaction building, validation, and test infrastructure.Core API and Data Model Changes:
Replaced the
LanguageViewstruct (which only allowed a single Plutus version and cost model) with a newLanguageViewsstruct, which is aBTreeMapmapping multiplePlutusVersionvalues to their respectiveCostModels. This affects all serialization, encoding, and builder APIs. [1] [2] [3]Updated the
ScriptDatastruct and associated methods to uselanguage_viewsinstead oflanguage_view, and revised encoding logic to support multiple cost models in canonical order. [1] [2] [3]Transaction Builder and Usage:
StagingTransaction) to support multiple language cost models, including new methods for adding individual or multiple language/cost model pairs. Updated all usages and tests to use the new API.Validation and Protocol Parameter Handling:
Testing and Test Data:
LanguageViewsstructure, added support for transactions with multiple Plutus versions, and introduced a new test vector (conway9.tx) containing a transaction with three Plutus versions and their cost models.Most important changes:
API and Data Model Refactor:
LanguageViewwithLanguageViews(aBTreeMapof Plutus versions to cost models) throughout the primitives, transaction builder, and script data handling code.Builder and Usage:
Validation and Protocol Parameter Handling:
LanguageViewsmap.Testing and Test Data:
LanguageViews, added a new test vector with multiple Plutus versions, and ensured hash checks work with the new structure.Summary by CodeRabbit
New Features
API Updates
Tests