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.
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
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.