diff --git a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Engine.scala b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Engine.scala index bd1120f36b8f..b2f45bb12827 100644 --- a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Engine.scala +++ b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/Engine.scala @@ -57,7 +57,7 @@ class Engine(val config: EngineConfig = Engine.StableConfig) { private[engine] val preprocessor = new preprocessing.Preprocessor( compiledPackages = compiledPackages, - requireV1ContractId = config.requireV1ContractId, + forbidV0ContractId = config.requireV1ContractId, requireV1ContractIdSuffix = config.requireSuffixedGlobalContractId, ) diff --git a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala index 8215f3b7efa9..eaacd96a8654 100644 --- a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala +++ b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/CommandPreprocessor.scala @@ -13,15 +13,15 @@ import scala.annotation.tailrec private[lf] final class CommandPreprocessor( interface: language.Interface, - // See Preprocessor.requiredCidSuffix for more details about the following flags. - requireV1ContractId: Boolean, + // See Preprocessor scala doc for more details about the following flags. + forbidV0ContractId: Boolean, requireV1ContractIdSuffix: Boolean, ) { val valueTranslator = new ValueTranslator( interface = interface, - requireV1ContractId = requireV1ContractId, + forbidV0ContractId = forbidV0ContractId, requireV1ContractIdSuffix = requireV1ContractIdSuffix, ) diff --git a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/Preprocessor.scala b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/Preprocessor.scala index f2ea9b5866ba..882561789b3b 100644 --- a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/Preprocessor.scala +++ b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/Preprocessor.scala @@ -31,7 +31,7 @@ import scala.annotation.tailrec * Daml-LF package definitions against the command should * resolved/typechecked. It is updated dynamically each time the * [[ResultNeedPackage]] continuation is called. - * @param requireV1ContractId when `true` the preprocessor will reject + * @param forbidV0ContractId when `true` the preprocessor will reject * any value/command/transaction that contains V0 Contract IDs * without suffixed. * @param requireV1ContractIdSuffix when `true` the preprocessor will reject @@ -40,7 +40,7 @@ import scala.annotation.tailrec */ private[engine] final class Preprocessor( compiledPackages: MutableCompiledPackages, - requireV1ContractId: Boolean = true, + forbidV0ContractId: Boolean = true, requireV1ContractIdSuffix: Boolean = true, ) { @@ -51,7 +51,7 @@ private[engine] final class Preprocessor( val commandPreprocessor = new CommandPreprocessor( interface = interface, - requireV1ContractId = requireV1ContractId, + forbidV0ContractId = forbidV0ContractId, requireV1ContractIdSuffix = requireV1ContractIdSuffix, ) val transactionPreprocessor = new TransactionPreprocessor(commandPreprocessor) diff --git a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/ValueTranslator.scala b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/ValueTranslator.scala index b98324af0902..b090b6bb79ca 100644 --- a/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/ValueTranslator.scala +++ b/daml-lf/engine/src/main/scala/com/digitalasset/daml/lf/engine/preprocessing/ValueTranslator.scala @@ -16,8 +16,8 @@ import scala.annotation.tailrec private[engine] final class ValueTranslator( interface: language.Interface, - // See Preprocessor.requiredCidSuffix for more details about the following flags. - requireV1ContractId: Boolean, + // See Preprocessor scala doc for more details about the following flags. + forbidV0ContractId: Boolean, requireV1ContractIdSuffix: Boolean, ) { @@ -54,7 +54,7 @@ private[engine] final class ValueTranslator( SValue.SContractId(_) private[this] val unsafeTranslateV0Cid: ContractId.V0 => SValue.SContractId = - if (requireV1ContractId) + if (forbidV0ContractId) cid => throw Error.Preprocessing.IllegalContractId(cid) else SValue.SContractId(_) diff --git a/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/PreprocessorSpec.scala b/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/PreprocessorSpec.scala index 3e868e610909..e30434b01b3b 100644 --- a/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/PreprocessorSpec.scala +++ b/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/PreprocessorSpec.scala @@ -94,7 +94,7 @@ class PreprocessorSpec val valueTranslator = new ValueTranslator( compiledPackage.interface, - requireV1ContractId = true, + forbidV0ContractId = true, requireV1ContractIdSuffix = false, ) import valueTranslator.unsafeTranslateValue @@ -223,7 +223,7 @@ class PreprocessorSpec val valueTranslator = new ValueTranslator( compiledPackage.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) val cids = List( @@ -245,7 +245,7 @@ class PreprocessorSpec val valueTranslator = new ValueTranslator( compiledPackage.interface, - requireV1ContractId = true, + forbidV0ContractId = true, requireV1ContractIdSuffix = false, ) val legalCid = @@ -266,7 +266,7 @@ class PreprocessorSpec val valueTranslator = new ValueTranslator( compiledPackage.interface, - requireV1ContractId = true, + forbidV0ContractId = true, requireV1ContractIdSuffix = true, ) val legalCid = @@ -335,7 +335,7 @@ class PreprocessorSpec val cmdPreprocessor = new CommandPreprocessor( compiledPackage.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) @@ -359,7 +359,7 @@ class PreprocessorSpec val cmdPreprocessor = new CommandPreprocessor( compiledPackage.interface, - requireV1ContractId = true, + forbidV0ContractId = true, requireV1ContractIdSuffix = false, ) @@ -383,7 +383,7 @@ class PreprocessorSpec val cmdPreprocessor = new CommandPreprocessor( compiledPackage.interface, - requireV1ContractId = true, + forbidV0ContractId = true, requireV1ContractIdSuffix = true, ) val List(aLegalCid, anotherLegalCid) = diff --git a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/Converter.scala b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/Converter.scala index acba2256cdbc..69be99e8726f 100644 --- a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/Converter.scala +++ b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/Converter.scala @@ -678,7 +678,7 @@ object Converter { valueTranslator = new preprocessing.ValueTranslator( compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) sValue <- valueTranslator diff --git a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ScriptF.scala b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ScriptF.scala index 373cf50e6799..5a2d91098032 100644 --- a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ScriptF.scala +++ b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ScriptF.scala @@ -66,7 +66,7 @@ object ScriptF { def compiledPackages = machine.compiledPackages val valueTranslator = new ValueTranslator( interface = compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) val utcClock = Clock.systemUTC() diff --git a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ledgerinteraction/IdeLedgerClient.scala b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ledgerinteraction/IdeLedgerClient.scala index 9c519e72b923..7009061c7e0c 100644 --- a/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ledgerinteraction/IdeLedgerClient.scala +++ b/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/ledgerinteraction/IdeLedgerClient.scala @@ -49,7 +49,7 @@ class IdeLedgerClient( private[this] val preprocessor = new preprocessing.CommandPreprocessor( compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = true, requireV1ContractIdSuffix = false, ) diff --git a/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/SpeedyToValueBenchmark.scala b/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/SpeedyToValueBenchmark.scala index 2446002c4dbc..63ef72f9169f 100644 --- a/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/SpeedyToValueBenchmark.scala +++ b/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/SpeedyToValueBenchmark.scala @@ -21,7 +21,7 @@ class SpeedyToValueBenchmark extends BenchmarkWithLedgerExport { val translator = new ValueTranslator( interface = submissions.compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) speedyValues = decodedValues.map(x => assertTranslate(translator)(x.mapValue(_.value))) diff --git a/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/ValueTranslatorBenchmark.scala b/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/ValueTranslatorBenchmark.scala index 175f59f64a46..4de06f296d3d 100644 --- a/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/ValueTranslatorBenchmark.scala +++ b/ledger/participant-state/kvutils/tools/codec-benchmark/src/benchmark/scala/com/daml/lf/engine/ValueTranslatorBenchmark.scala @@ -21,7 +21,7 @@ class ValueTranslatorBenchmark extends BenchmarkWithLedgerExport { decodedValues = submissions.values.map(_.mapValue(assertDecode).mapValue(_.value)).toVector translator = new ValueTranslator( submissions.compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) } diff --git a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scala b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scala index e4ee98fb4fbe..9238f6db45ce 100644 --- a/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scala +++ b/triggers/runner/src/main/scala/com/digitalasset/daml/lf/engine/trigger/Converter.scala @@ -500,7 +500,7 @@ object Converter { def apply(compiledPackages: CompiledPackages, triggerIds: TriggerIds): Converter = { val valueTranslator = new preprocessing.ValueTranslator( compiledPackages.interface, - requireV1ContractId = false, + forbidV0ContractId = false, requireV1ContractIdSuffix = false, ) Converter(