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

[FR] - Command to calculate the correct Plutus Script Costs offline #945

Open
gitmachtl opened this issue Oct 20, 2024 · 1 comment
Open
Labels
conway-feature enhancement New feature or request

Comments

@gitmachtl
Copy link
Contributor

I came across a problem while adding new features in the scripts to automatically use the guardrail scripts for submitting a protocol-parameter or treasury-withdrawal action on conway (v10). The problem is, that there is no way to calculate the correct execution units costs for a given plutus script (file) without a synced live node running.
Because the only implementation we currently have is within the transaction build command.

By using the transaction build command and the option --calculate-plutus-script-cost FILE we get an output like:

[
    {
        "executionUnits": {
            "memory": 610371,
            "steps": 129445331
        },
        "lovelaceCost": 44552,
        "scriptHash": "fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64"
    }
]

Which is super nice, and the values for the execution units can than later be used for a transaction building via transaction build-raw for example. BUT, this does not work in offline mode.

When it comes to governance, we need a feature in cardano-cli to calculate the correct execution units for a governance action that involves the guardrails script.

Two possible options to integrate that?

  • A new command that takes the protocol-parameters file, the action-file and the compiled plutus-script file.
  • Adding the --calculate-plutus-script-cost parameter option into the build-estimate command.

So we can do such calculations also offline without a connected online node, which would also come in handy of doing automated tests or optimizations via iterations.

@Crypto2099
Copy link

Does this make sense as a standalone command and, is it possible to work offline?

e.g.

~$ cardano-cli transaction calculate-plutus-script-cost \
 --protocol-parameters-file mainnet-params.json \
 --proposal-file my.proposal \
 --proposal-script-file guardrails.script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conway-feature enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants