diff --git a/sdk/daml-lf/model-test-lib/src/main/scala/com/digitalasset/daml/lf/model/test/Demo.scala b/sdk/daml-lf/model-test-lib/src/main/scala/com/digitalasset/daml/lf/model/test/Demo.scala index b99b3646e0cb..f26a75653923 100644 --- a/sdk/daml-lf/model-test-lib/src/main/scala/com/digitalasset/daml/lf/model/test/Demo.scala +++ b/sdk/daml-lf/model-test-lib/src/main/scala/com/digitalasset/daml/lf/model/test/Demo.scala @@ -12,6 +12,8 @@ import org.apache.pekko.actor.ActorSystem import org.apache.pekko.stream.Materializer import org.scalacheck.{Gen, Prop} +import scala.annotation.nowarn + //import scala.annotation.nowarn import scala.concurrent.duration.Duration import scala.concurrent.{Await, ExecutionContext} @@ -87,7 +89,7 @@ object Demo { // val workers = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(1)) - // @nowarn("cat=unused") + @nowarn("cat=unused") val bad = Parser.parseScenario(""" |Scenario | Topology @@ -101,8 +103,8 @@ object Demo { implicit val pretty: Ledgers.Scenario => org.scalacheck.util.Pretty = (s: Ledgers.Scenario) => org.scalacheck.util.Pretty(_ => Pretty.prettyScenario(s)) - // validSymScenarios - List(bad) + validSymScenarios + // List(bad) .foreach(scenario => { // workers.execute(() => if (scenario.ledger.nonEmpty) { diff --git a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ledgerinteraction/IdeLedgerClient.scala b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ledgerinteraction/IdeLedgerClient.scala index 22a1c8e6bcc3..4bcbeefa3748 100644 --- a/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ledgerinteraction/IdeLedgerClient.scala +++ b/sdk/daml-script/runner/src/main/scala/com/digitalasset/daml/lf/engine/script/v2/ledgerinteraction/IdeLedgerClient.scala @@ -29,6 +29,7 @@ import com.digitalasset.daml.lf.speedy.Speedy.Machine import com.digitalasset.daml.lf.speedy.{Pretty, SError, SValue, TraceLog, WarningLog} import com.digitalasset.daml.lf.transaction.{ FatContractInstance, + FatContractInstanceImpl, GlobalKey, IncompleteTransaction, Node, @@ -39,7 +40,6 @@ import com.digitalasset.daml.lf.transaction.{ import com.digitalasset.daml.lf.value.Value import com.digitalasset.daml.lf.value.Value.ContractId import com.daml.nonempty.NonEmpty - import com.digitalasset.canton.logging.{LoggingContextWithTrace, NamedLoggerFactory} import com.digitalasset.canton.ledger.localstore.InMemoryUserManagementStore import scalaz.OneAnd @@ -119,8 +119,24 @@ class IdeLedgerClient( private val userManagementStore = new InMemoryUserManagementStore(createAdmin = false, namedLoggerFactory) - private[this] def blob(contract: FatContractInstance): Bytes = - Bytes.fromByteString(TransactionCoder.encodeFatContractInstance(contract).toOption.get) + private[this] def blob(contract: FatContractInstance): Bytes = { + val valueTranslator = + new ValueTranslator(compiledPackages.pkgInterface, requireV1ContractIdSuffix = false) + valueTranslator.translateValue(TTyCon(contract.templateId), contract.createArg) match { + case Left(_) => + sys.error("blob: translateValue failed") + case Right(sArg) => + val normalizedArg = sArg.toNormalizedValue(contract.version) + val normalizedContract = + contract.asInstanceOf[FatContractInstanceImpl].copy(createArg = normalizedArg) + Bytes.fromByteString( + TransactionCoder + .encodeFatContractInstance(normalizedContract) + .toOption + .get + ) + } + } private[this] def blob(create: Node.Create, createAt: Time.Timestamp): Bytes = blob(FatContractInstance.fromCreateNode(create, createAt, Bytes.Empty))