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 20a7171bdfc6..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 @@ -2302,10 +2302,8 @@ object EngineTest { finalState.map(state => ( - VersionedTransaction( - state.nodes.values.map(_.optVersion.getOrElse(TxVersions.minVersion)).max, - state.nodes, - state.roots.toImmArray, + TxVersions.asVersionedTransaction( + Tx(state.nodes, state.roots.toImmArray) ), Tx.Metadata( submissionSeed = None, diff --git a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/TransactionVersion.scala b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/TransactionVersion.scala index 3afeafa705f8..538133f2ec86 100644 --- a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/TransactionVersion.scala +++ b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/TransactionVersion.scala @@ -67,6 +67,19 @@ object TransactionVersion { ) } + private[lf] def asVersionedTransaction( + tx: Transaction + ): VersionedTransaction = tx match { + case Transaction(nodes, roots) => + val rootVersions = roots.iterator.map(nodeId => + nodes(nodeId) match { + case action: Node.Action => action.version + case _: Node.Rollback => minExceptions + } + ) + VersionedTransaction(rootVersions.max, nodes, roots) + } + val StableVersions: VersionRange[TransactionVersion] = LanguageVersion.StableVersions.map(assignNodeVersion)