From 5bd4db31b72f238a7d4c8888dfe704e57464e094 Mon Sep 17 00:00:00 2001 From: Remy Haemmerle Date: Tue, 9 Nov 2021 11:54:27 +0100 Subject: [PATCH] a bit more fixes --- .../digitalasset/daml/lf/engine/EngineTest.scala | 14 ++++---------- .../daml/lf/transaction/PartialTransaction.scala | 7 +++---- .../daml/lf/transaction/TransactionSpec.scala | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/EngineTest.scala b/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/EngineTest.scala index 8ab5f9937ad4..04e13abcfb25 100644 --- a/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/EngineTest.scala +++ b/daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/EngineTest.scala @@ -19,7 +19,6 @@ import com.daml.lf.transaction.{ NodeId, SubmittedTransaction, VersionedTransaction, - Transaction => GenTx, Transaction => Tx, TransactionVersion => TxVersions, } @@ -1196,7 +1195,7 @@ class EngineTest } } - def txFetchActors(tx: GenTx): Set[Party] = + def txFetchActors(tx: Tx): Set[Party] = tx.fold(Set[Party]()) { case (actors, (_, n)) => actors union actFetchActors(n) } @@ -1369,9 +1368,7 @@ class EngineTest lookerUpCid -> lookerUpInst, ) - def firstLookupNode( - tx: GenTx - ): Option[(NodeId, Node.LookupByKey)] = + def firstLookupNode(tx: Tx): Option[(NodeId, Node.LookupByKey)] = tx.nodes.collectFirst { case (nid, nl @ Node.LookupByKey(_, _, _, _)) => nid -> nl } @@ -2213,7 +2210,7 @@ object EngineTest { dependsOnTime: Boolean = false, nodeSeeds: BackStack[(NodeId, crypto.Hash)] = BackStack.empty, ) { - def commit(tr: GenTx, meta: Tx.Metadata) = { + def commit(tr: Tx, meta: Tx.Metadata) = { val (newContracts, newKeys) = tr.fold((contracts, keys)) { case ((contracts, keys), (_, exe: Node.Exercise)) => (contracts - exe.targetCoid, keys) @@ -2306,10 +2303,7 @@ object EngineTest { finalState.map(state => ( TxVersions.asVersionedTransaction( - GenTx( - state.nodes, - state.roots.toImmArray, - ) + Tx(state.nodes, state.roots.toImmArray) ), Tx.Metadata( submissionSeed = None, diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/transaction/PartialTransaction.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/transaction/PartialTransaction.scala index 7a2cb8f3061f..fa1c029b8e0f 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/transaction/PartialTransaction.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/transaction/PartialTransaction.scala @@ -9,7 +9,6 @@ import com.daml.lf.data.{BackStack, ImmArray, Ref, Time} import com.daml.lf.ledger.{Authorize, FailedAuthorization} import com.daml.lf.transaction.{ ContractKeyUniquenessMode, - Transaction, GlobalKey, Node, NodeId, @@ -325,7 +324,7 @@ private[speedy] case class PartialTransaction( nodes.keySet diff allChildNodeIds } - val tx = Transaction(nodes, rootNodes.to(ImmArray)) + val tx = Tx(nodes, rootNodes.to(ImmArray)) tx.foreach { (nid, node) => val rootPrefix = if (rootNodes.contains(nid)) "root " else "" @@ -370,7 +369,7 @@ private[speedy] case class PartialTransaction( context.info match { case _: RootContextInfo if aborted.isEmpty => val roots = context.children.toImmArray - val tx0 = Transaction(nodes, roots) + val tx0 = Tx(nodes, roots) val (tx, seeds) = NormalizeRollbacks.normalizeTx(tx0) CompleteTransaction( SubmittedTransaction( @@ -389,7 +388,7 @@ private[speedy] case class PartialTransaction( val ptx = unwind() transaction.IncompleteTransaction( - Transaction( + Tx( ptx.nodes, ptx.context.children.toImmArray.toSeq.sortBy(_.index).toImmArray, ), diff --git a/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala b/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala index 9758bae9befc..552318d81377 100644 --- a/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala +++ b/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/transaction/TransactionSpec.scala @@ -647,7 +647,6 @@ object TransactionSpec { import TransactionBuilder.Implicits._ - type Transaction = Transaction def mkTransaction( nodes: HashMap[NodeId, Node], roots: ImmArray[NodeId],