Skip to content

Conversation

@kwxm
Copy link
Contributor

@kwxm kwxm commented Jun 30, 2025

Fixes https://github.com/IntersectMBO/plutus-private/issues/1650.

The ledger and the procol parameters view the cost model parameters as a list of integers with no other information. This makes them quite difficult to deal with (in particular to check that they're in the right order). This PR adds a simple tool to dump the cost model parameters in the expected order, in various formats including the JSON format used by cardano-cli. See the attached files for examples of the output.

cost-model-parameters-untagged.txt
cost-model-parameters-tagged.txt
cost-model-parameters-json.txt

The uplc executable has a dump-cost-model command, but that doesn't know anything about plutus-ledger-api and just produces a list ordered by parameter name,

@kwxm kwxm requested a review from effectfully June 30, 2025 16:38
@kwxm kwxm added Costing Anything relating to costs, fees, gas, etc. No Changelog Required Add this to skip the Changelog Check Plutus Ledger API labels Jun 30, 2025
@kwxm kwxm temporarily deployed to github-pages June 30, 2025 16:38 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Jun 30, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/pr-7171/

Built to branch gh-pages at 2025-06-30 18:15 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@kwxm kwxm temporarily deployed to github-pages June 30, 2025 18:12 — with GitHub Actions Inactive
s -> Left $ "Unknown ledger language version: " ++ s

whichll :: Parser WhichLL
whichll =
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation is inconsistent across newly added files,
do you mind applying Fourmolu to all the Haskell code in this PR?

Copy link
Contributor Author

@kwxm kwxm Jul 1, 2025

Choose a reason for hiding this comment

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

do you mind applying Fourmolu to all the Haskell code in this PR?

I've done that, but then stylish-haskell changed some of it back when I committed the changes. Specifically, it lined up the ->s in case expressions and also the -#}s at the end of the pragmas at the start. I like both of those better than what Fourmolu does, but you might object!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure but I think that also Fourmolu aligned let ... in ... like this

  let xxx
   in yyy

and stylish-haskell changed it back to

  let xxx
  in yyy

The first one looks a bit strange to me but I see why it's done it. It's a pity that let and in don't have the same number of letters...

Copy link
Contributor

@Unisay Unisay left a comment

Choose a reason for hiding this comment

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

LGTM (modulo formatting)

@kwxm kwxm merged commit 1df397c into master Jul 1, 2025
6 of 9 checks passed
@kwxm kwxm deleted the kwxm/ledger-api/dump-cost-model-params branch July 1, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Costing Anything relating to costs, fees, gas, etc. No Changelog Required Add this to skip the Changelog Check Plutus Ledger API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants