feat(primitives): support multiple Plutus language cost models in script data#763
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Supersedes #730 — rebased onto current
mainto resolve a conflict inpallas-primitives/src/conway/script_data.rswith the recentconst → static LazyLockclippy fix (a9e538a). Original work and authorship by @nicolasLuduena.Summary
LanguageView(PlutusVersion, CostModel)withLanguageViews(BTreeMap<PlutusVersion, CostModel>)so a single transaction can carry cost models for multiple Plutus versions simultaneously.ScriptDatato canonically encode the multi-language map (V2/V3 sorted, then V1 last because it CBOR-encodes as0x4100).StagingTransaction.language_view→language_views; the old.language_view(kind, cm)setter is replaced by.language_views(views)(set whole map) and.add_language(kind, cm)(incremental).pallas-validate::tx_languagesso it returns all languages present in a tx (previously dropped V3 when V1+V2+V3 were all in use, and only ever returned the highest single language).cost_model_for_txnow builds aLanguageViewscovering every language in the tx.test_data/conway9.txexercising a transaction with all three Plutus versions.Breaking changes
Public API:
LanguageView→LanguageViews;ScriptData.language_view→language_views;StagingTransaction.language_viewfield and.language_view(...)builder method renamed/replaced as above.Test plan
cargo build --workspace --testscleancargo test -p pallas-primitives script_data(multi-language hash vector)cargo test -p pallas-txbuildercargo test -p pallas-validate