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

Decide cost model for PlutusV3 reference script #405

Open
satran004 opened this issue Jun 28, 2024 · 0 comments
Open

Decide cost model for PlutusV3 reference script #405

satran004 opened this issue Jun 28, 2024 · 0 comments
Labels
Milestone

Comments

@satran004
Copy link
Member

Currently, if the reference input is present, the cost model is set to PlutusV2. However, since the reference script can also be a Plutus V3, the library needs to decide the cost model accordingly.

ScriptDataHashCalculator.java

            if (costMdls.isEmpty()) { //Check if costmodel can be decided from other fields //TODO Impl : Check what to do for v3 reference scripts
                if (transaction.getBody().getReferenceInputs() != null
                        && transaction.getBody().getReferenceInputs().size() > 0) { //If reference input is there, then plutus v2
                    var refInputLanguage = ctx.getReferenceInputLanguage();
                    Optional<CostModel> costModel = CostModelUtil.getCostModelFromProtocolParams(ctx.getProtocolParams(), refInputLanguage);
                    costMdls.add(costModel.orElse(PlutusV2CostModel));
                }
            }

Option: 1

Since we have a new method in QuickTxBuilder, withReferenceScripts(PlutusScript ...), we can use this information from the context to determine the correct cost model.

Option: 2

Fetch reference script bytes from node and decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant