LF: Drop byInterface field from Transaction Nodes (#13520)

part of #13491

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Remy 2022-04-07 11:06:17 +02:00 committed by GitHub
parent b3878fbf00
commit 4e51194041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 69 additions and 181 deletions

View File

@ -9,7 +9,7 @@ import java.util
import com.daml.lf.data.{ImmArray, Ref}
import com.daml.lf.language.{Ast, LookupError}
import com.daml.lf.speedy.SValue
import com.daml.lf.transaction.SubmittedTransaction
import com.daml.lf.transaction.{Node, SubmittedTransaction}
import com.daml.lf.value.Value
import com.daml.nameof.NameOf
@ -86,23 +86,18 @@ private[engine] final class Preprocessor(
ResultDone(acc.toList)
}
@tailrec
private[this] def collectNewPackagesFromTemplateIds(
templateIds: List[Ref.TypeConName],
acc: Map[Ref.PackageId, language.Reference] = Map.empty,
): Result[List[(Ref.PackageId, language.Reference)]] =
templateIds match {
case templateId :: rest =>
val pkgId = templateId.packageId
val newAcc =
if (compiledPackages.packageIds(pkgId) || acc.contains(pkgId))
acc
else
acc.updated(pkgId, language.Reference.TemplateOrInterface(templateId))
collectNewPackagesFromTemplateIds(rest, newAcc)
case Nil =>
ResultDone(acc.toList)
}
templateIds: Iterable[Ref.TypeConName]
): List[(Ref.PackageId, language.Reference)] =
templateIds
.foldLeft(Map.empty[Ref.PackageId, language.Reference]) { (acc, tmplId) =>
val pkgId = tmplId.packageId
if (compiledPackages.packageIds(pkgId) || acc.contains(pkgId))
acc
else
acc.updated(pkgId, language.Reference.TemplateOrInterface(tmplId))
}
.toList
private[this] def pullPackages(
pkgIds: List[(Ref.PackageId, language.Reference)]
@ -125,8 +120,8 @@ private[engine] final class Preprocessor(
private[this] def pullTypePackages(typ: Ast.Type): Result[Unit] =
collectNewPackagesFromTypes(List(typ)).flatMap(pullPackages)
private[this] def pullTemplatePackage(tyCons: List[Ref.TypeConName]): Result[Unit] =
collectNewPackagesFromTemplateIds(tyCons).flatMap(pullPackages)
private[this] def pullTemplatePackage(tyCons: Iterable[Ref.TypeConName]): Result[Unit] =
pullPackages(collectNewPackagesFromTemplateIds(tyCons))
/** Translates the LF value `v0` of type `ty0` to a speedy value.
* Fails if the nesting is too deep or if v0 does not match the type `ty0`.
@ -149,7 +144,7 @@ private[engine] final class Preprocessor(
def preprocessApiCommands(
cmds: data.ImmArray[command.ApiCommand]
): Result[ImmArray[speedy.Command]] =
safelyRun(pullTemplatePackage(cmds.toSeq.view.map(_.templateId).toList)) {
safelyRun(pullTemplatePackage(cmds.toSeq.view.map(_.templateId))) {
commandPreprocessor.unsafePreprocessApiCommands(cmds)
}
@ -166,7 +161,7 @@ private[engine] final class Preprocessor(
): Result[ImmArray[speedy.Command]] =
safelyRun(
pullTemplatePackage(
tx.rootNodes.toSeq.view.map(_.templateId) ++: tx.byInterfaceNodes.map(_.templateId)
tx.nodes.values.collect { case action: Node.Action => action.templateId }
)
) {
transactionPreprocessor.unsafeTranslateTransactionRoots(tx)

View File

@ -37,7 +37,6 @@ class AuthorizationSpec extends AnyFreeSpec with Matchers with Inside {
observers = Seq("Carl"),
key = Some(Value.ValueUnit),
maintainers = maintainers,
byInterface = None,
)
"create" - {

View File

@ -103,7 +103,6 @@ class BlindingSpec extends AnyFreeSpec with Matchers {
observers = Seq("Carl"),
key = Some(ValueRecord(None, ImmArray.empty)),
maintainers = Seq("Alice"),
byInterface = None,
)
val lookup = builder.lookupByKey(create, true)
val nodeId = builder.add(lookup)
@ -125,7 +124,6 @@ class BlindingSpec extends AnyFreeSpec with Matchers {
observers = Seq("Carl"),
key = Some(ValueRecord(None, ImmArray.empty)),
maintainers = Seq("Alice"),
byInterface = None,
)
val lookup = builder.lookupByKey(create, false)
val nodeId = builder.add(lookup)

View File

@ -1147,7 +1147,6 @@ class EngineTest
_,
_,
_,
_,
) =>
coid shouldBe originalCoid
consuming shouldBe true
@ -1234,7 +1233,7 @@ class EngineTest
def actFetchActors(n: Node): Set[Party] = {
n match {
case Node.Fetch(_, _, actingParties, _, _, _, _, _, _) => actingParties
case Node.Fetch(_, _, actingParties, _, _, _, _, _) => actingParties
case _ => Set()
}
}
@ -1620,7 +1619,7 @@ class EngineTest
)
tx.transaction.nodes.values.headOption match {
case Some(Node.Fetch(_, _, _, _, _, key, _, _, _)) =>
case Some(Node.Fetch(_, _, _, _, _, key, _, _)) =>
key match {
// just test that the maintainers match here, getting the key out is a bit hairier
case Some(Node.KeyWithMaintainers(_, maintainers)) =>
@ -1849,7 +1848,7 @@ class EngineTest
val stx = suffix(tx)
val ImmArray(_, exeNode1) = tx.transaction.roots
val Node.Exercise(_, _, _, _, _, _, _, _, _, children, _, _, _, _, _) =
val Node.Exercise(_, _, _, _, _, _, _, _, _, children, _, _, _, _) =
tx.transaction.nodes(exeNode1)
val nids = children.toSeq.take(2).toImmArray

View File

@ -19,7 +19,7 @@ class MetaDataTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
"Engine#desp" should {
val createWithoutInterface = newBuilder.create(
val create = newBuilder.create(
id = TransactionBuilder.newCid,
templateId = Ref.Identifier("pkgT", "M:T"),
argument = ValueUnit,
@ -27,29 +27,27 @@ class MetaDataTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
observers = noOne,
key = Some(ValueParty("alice")),
maintainers = parties,
byInterface = None,
)
val nodeWithoutInterface = Table[TransactionBuilder => Node](
"transaction",
_ => createWithoutInterface,
_ => create,
_.exercise(
contract = createWithoutInterface,
contract = create,
choice = "ChT",
consuming = false,
actingParties = parties,
argument = ValueUnit,
byInterface = createWithoutInterface.byInterface,
),
_.exerciseByKey(
contract = createWithoutInterface,
contract = create,
choice = "ChT",
consuming = false,
actingParties = parties,
argument = ValueUnit,
),
_.fetch(contract = createWithoutInterface, byInterface = createWithoutInterface.byInterface),
_.fetchByKey(contract = createWithoutInterface),
_.lookupByKey(contract = createWithoutInterface),
_.fetch(contract = create),
_.fetchByKey(contract = create),
_.lookupByKey(contract = create),
)
val createWithInterface = newBuilder.create(
@ -60,7 +58,6 @@ class MetaDataTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
observers = noOne,
key = Some(ValueParty("alice")),
maintainers = parties,
byInterface = Some(Ref.Identifier("pkgInt", "M:Int")),
)
val nodeWithInterface = Table[TransactionBuilder => Node](
"transaction",
@ -71,9 +68,8 @@ class MetaDataTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
consuming = false,
actingParties = parties,
argument = ValueUnit,
byInterface = createWithInterface.byInterface,
),
_.fetch(contract = createWithInterface, byInterface = createWithInterface.byInterface),
_.fetch(contract = createWithInterface),
)
"works as expected on root actions node by template" in {
@ -113,7 +109,6 @@ class MetaDataTest extends AnyWordSpec with Matchers with TableDrivenPropertyChe
argument = ValueUnit,
signatories = parties,
observers = noOne,
byInterface = None,
)
forEvery(nodeWithoutInterface) { mkNodeWithout =>
forEvery(nodeWithInterface) { mkNodeWith =>

View File

@ -488,7 +488,7 @@ object ScenarioLedger {
}
processNodes(mbNewCache2, idsToProcess)
case Node.Fetch(referencedCoid, templateId @ _, _, _, _, _, _, _, _) =>
case Node.Fetch(referencedCoid, templateId @ _, _, _, _, _, _, _) =>
val newCacheP =
newCache.updateLedgerNodeInfo(referencedCoid)(info =>
info.copy(referencedBy = info.referencedBy + eventId)

View File

@ -257,37 +257,21 @@ private[lf] object Pretty {
case Node.Rollback(children) =>
text("rollback:") / stack(children.toList.map(prettyEventInfo(l, txId)))
case create: Node.Create =>
val d =
create.byInterface match {
case None => "create" &: prettyContractInst(create.coinst)
case Some(ifaceId) =>
("create" &: prettyContractInst(create.coinst)) & text(
"as interface"
) & prettyIdentifier(ifaceId)
}
val d = "create" &: prettyContractInst(create.coinst)
create.versionedKey match {
case None => d
case Some(key) => d / text("key") & prettyVersionedKeyWithMaintainers(key)
}
case ea: Node.Fetch =>
val d = "ensure active" &: prettyContractId(ea.coid)
(ea.byInterface match {
case None => d
case Some(ifaceId) => d & text("as interface") & prettyIdentifier(ifaceId)
})
"ensure active" &: prettyContractId(ea.coid)
case ex: Node.Exercise =>
val children =
if (ex.children.nonEmpty)
text("children:") / stack(ex.children.toList.map(prettyEventInfo(l, txId)))
else
text("")
val exercises =
text("exercises") & text(ex.choiceId) + char(':') + prettyIdentifier(ex.templateId)
intercalate(text(", "), ex.actingParties.map(p => text(p))) &
(ex.byInterface match {
case None => exercises
case Some(ifaceId) => exercises & text("as interface") & prettyIdentifier(ifaceId)
}) &
(text("exercises") & text(ex.choiceId) + char(':') + prettyIdentifier(ex.templateId)) &
text("on") & prettyContractId(ex.targetCoid) /
(text(" ") + text("with") & prettyValue(false)(ex.chosenValue) / children)
.nested(4)

View File

@ -135,8 +135,6 @@ private[lf] object PartialTransaction {
* @param parent The context in which the exercises is
* happening.
* @param byKey True if the exercise is done "by key"
* @param byInterface The interface through which this exercise
* was invoked, if any.
*/
final case class ExercisesContextInfo(
targetId: Value.ContractId,
@ -152,7 +150,6 @@ private[lf] object PartialTransaction {
nodeId: NodeId,
parent: Context,
byKey: Boolean,
byInterface: Option[TypeConName],
version: TxVersion,
) extends ContextInfo {
val actionNodeSeed = parent.nextActionChildSeed
@ -398,7 +395,6 @@ private[speedy] case class PartialTransaction(
signatories: Set[Party],
stakeholders: Set[Party],
key: Option[Node.KeyWithMaintainers],
byInterface: Option[TypeConName] = None,
version: TxVersion,
): (Value.ContractId, PartialTransaction) = {
val actionNodeSeed = context.nextActionChildSeed
@ -413,7 +409,6 @@ private[speedy] case class PartialTransaction(
signatories,
stakeholders,
key,
byInterface,
version,
)
val nid = NodeId(nextNodeIdx)
@ -492,7 +487,6 @@ private[speedy] case class PartialTransaction(
stakeholders: Set[Party],
key: Option[Node.KeyWithMaintainers],
byKey: Boolean,
byInterface: Option[TypeConName] = None,
version: TxVersion,
): PartialTransaction = {
val nid = NodeId(nextNodeIdx)
@ -504,7 +498,6 @@ private[speedy] case class PartialTransaction(
stakeholders,
key,
normByKey(version, byKey),
byInterface,
version,
)
mustBeActive(
@ -550,7 +543,6 @@ private[speedy] case class PartialTransaction(
mbKey: Option[Node.KeyWithMaintainers],
byKey: Boolean,
chosenValue: Value,
byInterface: Option[TypeConName] = None,
version: TxVersion,
): PartialTransaction = {
val nid = NodeId(nextNodeIdx)
@ -569,7 +561,6 @@ private[speedy] case class PartialTransaction(
nodeId = nid,
parent = context,
byKey = byKey,
byInterface = byInterface,
version = version,
)
@ -664,7 +655,6 @@ private[speedy] case class PartialTransaction(
exerciseResult = None,
key = ec.contractKey,
byKey = normByKey(ec.version, ec.byKey),
byInterface = ec.byInterface,
version = ec.version,
)
}

View File

@ -301,7 +301,6 @@ object NormalizeRollbackSpec {
signatories = Set.empty,
stakeholders = Set.empty,
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)
@ -325,7 +324,6 @@ object NormalizeRollbackSpec {
exerciseResult = None,
key = None,
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
)
}

View File

@ -44,16 +44,15 @@ class PartialTransactionSpec extends AnyWordSpec with Matchers with Inside {
def insertCreate_ : PartialTransaction =
ptx
.insertCreate(
Authorize(Set(party)),
templateId,
Value.ValueUnit,
"agreement",
None,
Set(party),
Set.empty,
None,
None,
TransactionVersion.maxVersion,
auth = Authorize(Set(party)),
templateId = templateId,
arg = Value.ValueUnit,
agreementText = "agreement",
optLocation = None,
signatories = Set(party),
stakeholders = Set.empty,
key = None,
version = TransactionVersion.maxVersion,
)
._2
@ -71,7 +70,6 @@ class PartialTransactionSpec extends AnyWordSpec with Matchers with Inside {
choiceObservers = Set.empty,
mbKey = None,
byKey = false,
byInterface = None,
chosenValue = Value.ValueUnit,
version = TransactionVersion.maxVersion,
)

View File

@ -538,7 +538,6 @@ object TransactionConversionsSpec {
exerciseResult = None,
key = None,
byKey = false,
byInterface = None,
version = TransactionVersion.VDev,
)

View File

@ -95,9 +95,8 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
signatories: Set[Ref.Party],
observers: Set[Ref.Party],
key: Option[Value] = None,
byInterface: Option[Ref.Identifier] = None,
): Node.Create =
create(id, templateId, argument, signatories, observers, key, signatories, byInterface)
create(id, templateId, argument, signatories, observers, key, signatories)
def create(
id: ContractId,
@ -107,7 +106,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
observers: Set[Ref.Party],
key: Option[Value],
maintainers: Set[Ref.Party],
byInterface: Option[Ref.Identifier],
): Node.Create = {
Node.Create(
coid = id,
@ -117,7 +115,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
signatories = signatories,
stakeholders = signatories | observers,
key = key.map(Node.KeyWithMaintainers(_, maintainers)),
byInterface = byInterface,
version = pkgTxVersion(templateId.packageId),
)
}
@ -131,7 +128,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
result: Option[Value] = None,
choiceObservers: Set[Ref.Party] = Set.empty,
byKey: Boolean = true,
byInterface: Option[Ref.Identifier] = None,
): Node.Exercise =
Node.Exercise(
choiceObservers = choiceObservers,
@ -147,7 +143,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
exerciseResult = result,
key = contract.key,
byKey = byKey,
byInterface = byInterface,
version = pkgTxVersion(contract.templateId.packageId),
)
@ -163,7 +158,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
def fetch(
contract: Node.Create,
byKey: Boolean = false,
byInterface: Option[Ref.Identifier] = None,
): Node.Fetch =
Node.Fetch(
coid = contract.coid,
@ -173,7 +167,6 @@ final class TransactionBuilder(pkgTxVersion: Ref.PackageId => TransactionVersion
stakeholders = contract.stakeholders,
key = contract.key,
byKey = byKey,
byInterface = byInterface,
version = pkgTxVersion(contract.templateId.packageId),
)

View File

@ -294,7 +294,7 @@ object ValueGenerators {
*/
def malformedCreateNodeGenWithVersion(
version: TransactionVersion
): Gen[Node.Create] = {
): Gen[Node.Create] =
for {
coid <- coidGen
templateId <- idGen
@ -311,10 +311,8 @@ object ValueGenerators {
signatories = signatories,
stakeholders = stakeholders,
key = key,
byInterface = None,
version = version,
)
}
val fetchNodeGen: Gen[Node.Fetch] =
for {
@ -322,7 +320,7 @@ object ValueGenerators {
node <- fetchNodeGenWithVersion(version)
} yield node
def fetchNodeGenWithVersion(version: TransactionVersion): Gen[Node.Fetch] = {
def fetchNodeGenWithVersion(version: TransactionVersion): Gen[Node.Fetch] =
for {
coid <- coidGen
templateId <- idGen
@ -339,10 +337,8 @@ object ValueGenerators {
stakeholders = stakeholders,
key = key,
byKey = byKey,
byInterface = None,
version = version,
)
}
/** Makes rollback node with some random child IDs. */
val danglingRefRollbackNodeGen: Gen[Node.Rollback] = {
@ -364,7 +360,7 @@ object ValueGenerators {
/** Makes exercise nodes with the given version and some random child IDs. */
def danglingRefExerciseNodeGenWithVersion(
version: TransactionVersion
): Gen[Node.Exercise] = {
): Gen[Node.Exercise] =
for {
targetCoid <- coidGen
templateId <- idGen
@ -396,10 +392,8 @@ object ValueGenerators {
exerciseResult = exerciseResult,
key = key,
byKey = byKey,
byInterface = None,
version = version,
)
}
val lookupNodeGen: Gen[Node.LookupByKey] =
for {

View File

@ -54,8 +54,6 @@ object Node {
def byKey: Boolean
def byInterface: Option[TypeConName]
protected def versioned[X](x: X): Versioned[X] = Versioned(version, x)
}
@ -81,7 +79,6 @@ object Node {
signatories: Set[Party],
stakeholders: Set[Party],
key: Option[KeyWithMaintainers],
override val byInterface: Option[TypeConName],
// For the sake of consistency between types with a version field, keep this field the last.
override val version: TransactionVersion,
) extends LeafOnlyAction
@ -119,7 +116,6 @@ object Node {
stakeholders: Set[Party],
key: Option[KeyWithMaintainers],
override val byKey: Boolean, // invariant (!byKey || exerciseResult.isDefined)
override val byInterface: Option[TypeConName],
// For the sake of consistency between types with a version field, keep this field the last.
override val version: TransactionVersion,
) extends LeafOnlyAction
@ -158,7 +154,6 @@ object Node {
exerciseResult: Option[Value],
key: Option[KeyWithMaintainers],
override val byKey: Boolean, // invariant (!byKey || exerciseResult.isDefined)
override val byInterface: Option[TypeConName],
// For the sake of consistency between types with a version field, keep this field the last.
override val version: TransactionVersion,
) extends Action
@ -206,7 +201,6 @@ object Node {
override def keyMaintainers: Set[Party] = key.maintainers
override def hasResult: Boolean = result.isDefined
override def byKey: Boolean = true
override def byInterface: Option[TypeConName] = None
override private[lf] def updateVersion(version: TransactionVersion): Node.LookupByKey =
copy(version = version)

View File

@ -12,7 +12,6 @@ import com.daml.lf.value.Value.ContractId
import scala.annotation.tailrec
import scala.collection.immutable.HashMap
import com.daml.scalautil.Statement.discard
final case class VersionedTransaction private[lf] (
version: TransactionVersion,
@ -287,17 +286,6 @@ sealed abstract class HasTxNodes {
}
)
private[lf] def byInterfaceNodes: List[Node.Action] = {
val builder = List.newBuilder[Node.Action]
foreach {
case (_, action: Node.Action) if action.byInterface.isDefined =>
discard(builder += action)
case _ =>
()
}
builder.result()
}
/** This function traverses the transaction tree in pre-order traversal (i.e. exercise node are traversed before their children).
*
* Takes constant stack space. Crashes if the transaction is not well formed (see `isWellFormed`)
@ -450,9 +438,9 @@ sealed abstract class HasTxNodes {
*/
final def inputContracts[Cid2 >: ContractId]: Set[Cid2] =
fold(Set.empty[Cid2]) {
case (acc, (_, Node.Exercise(coid, _, _, _, _, _, _, _, _, _, _, _, _, _, _))) =>
case (acc, (_, Node.Exercise(coid, _, _, _, _, _, _, _, _, _, _, _, _, _))) =>
acc + coid
case (acc, (_, Node.Fetch(coid, _, _, _, _, _, _, _, _))) =>
case (acc, (_, Node.Fetch(coid, _, _, _, _, _, _, _))) =>
acc + coid
case (acc, (_, Node.LookupByKey(_, _, Some(coid), _))) =>
acc + coid
@ -780,13 +768,13 @@ object Transaction {
tx.fold(State(Set.empty, Set.empty)) { case (state, (_, node)) =>
node match {
case Node.Create(_, tmplId, _, _, _, _, Some(key), _, _) =>
case Node.Create(_, tmplId, _, _, _, _, Some(key), _) =>
state.created(globalKey(tmplId, key.key))
case Node.Exercise(_, tmplId, _, true, _, _, _, _, _, _, _, Some(key), _, _, _) =>
case Node.Exercise(_, tmplId, _, true, _, _, _, _, _, _, _, Some(key), _, _) =>
state.consumed(globalKey(tmplId, key.key))
case Node.Exercise(_, tmplId, _, false, _, _, _, _, _, _, _, Some(key), _, _, _) =>
case Node.Exercise(_, tmplId, _, false, _, _, _, _, _, _, _, Some(key), _, _) =>
state.referenced(globalKey(tmplId, key.key))
case Node.Fetch(_, tmplId, _, _, _, Some(key), _, _, _) =>
case Node.Fetch(_, tmplId, _, _, _, Some(key), _, _) =>
state.referenced(globalKey(tmplId, key.key))
case Node.LookupByKey(tmplId, key, Some(_), _) =>
state.referenced(globalKey(tmplId, key.key))

View File

@ -278,7 +278,7 @@ object TransactionCoder {
node match {
case nc @ Node.Create(_, _, _, _, _, _, _, _, _) =>
case nc @ Node.Create(_, _, _, _, _, _, _, _) =>
val builder = TransactionOuterClass.NodeCreate.newBuilder()
nc.stakeholders.foreach(builder.addStakeholders)
nc.signatories.foreach(builder.addSignatories)
@ -310,7 +310,7 @@ object TransactionCoder {
)
} yield nodeBuilder.setCreate(builder).build()
case nf @ Node.Fetch(_, _, _, _, _, _, _, _, _) =>
case nf @ Node.Fetch(_, _, _, _, _, _, _, _) =>
val builder = TransactionOuterClass.NodeFetch.newBuilder()
discard(builder.setTemplateId(ValueCoder.encodeIdentifier(nf.templateId)))
nf.stakeholders.foreach(builder.addStakeholders)
@ -329,7 +329,7 @@ object TransactionCoder {
)
} yield nodeBuilder.setFetch(builder).build()
case ne @ Node.Exercise(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case ne @ Node.Exercise(_, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
val builder = TransactionOuterClass.NodeExercise.newBuilder()
discard(
builder
@ -524,7 +524,6 @@ object TransactionCoder {
signatories = signatories,
stakeholders = stakeholders,
key = key,
byInterface = None,
version = nodeVersion,
)
case NodeTypeCase.FETCH =>
@ -553,7 +552,6 @@ object TransactionCoder {
stakeholders = stakeholders,
key = key,
byKey = byKey,
byInterface = None,
version = nodeVersion,
)
@ -617,7 +615,6 @@ object TransactionCoder {
exerciseResult = rvOpt,
key = keyWithMaintainers,
byKey = byKey,
byInterface = None,
version = nodeVersion,
)
case NodeTypeCase.LOOKUP_BY_KEY =>

View File

@ -230,7 +230,6 @@ class TransactionCoderSpec
signatories = Set(Party.assertFromString("alice")),
stakeholders = Set(Party.assertFromString("alice"), Party.assertFromString("bob")),
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)

View File

@ -61,7 +61,6 @@ class TransactionNodeStatisticsSpec
observers = Set.empty,
key = if (withKey) Some(Value.ValueUnit) else None,
maintainers = if (withKey) parties else Set.empty,
byInterface = None,
)
}
@ -76,12 +75,11 @@ class TransactionNodeStatisticsSpec
result = Some(Value.ValueUnit),
choiceObservers = Set.empty,
byKey = byKey,
byInterface = None,
)
}
def fetch(byKey: Boolean)(b: TxBuilder) =
b.fetch(create(b, byKey), byKey, None)
b.fetch(create(b, byKey), byKey)
def lookup(b: TxBuilder) =
b.lookupByKey(create(b, withKey = true), true)

View File

@ -692,7 +692,6 @@ object TransactionSpec {
exerciseResult = if (hasExerciseResult) Some(V.ValueUnit) else None,
key = None,
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
)
@ -705,7 +704,6 @@ object TransactionSpec {
signatories = Set.empty,
stakeholders = Set.empty,
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)

View File

@ -96,9 +96,6 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
signatories = samParties1,
stakeholders = samParties2,
key = key,
byInterface = None,
// TODO https://github.com/digital-asset/daml/issues/12051
// also vary byInterface
version = version,
)
@ -115,9 +112,6 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
stakeholders = samParties3,
key = key,
byKey = samBool1,
byInterface = None,
// TODO https://github.com/digital-asset/daml/issues/12051
// also vary byInterface
version = version,
)
@ -151,9 +145,6 @@ class ValidationSpec extends AnyFreeSpec with Matchers with TableDrivenPropertyC
exerciseResult = exerciseResult,
key = key,
byKey = samBool2,
byInterface = None,
// TODO https://github.com/digital-asset/daml/issues/12051
// also vary byInterface (but this requires an interface choice)
version = version,
)

View File

@ -52,7 +52,7 @@ private[migration] class V10_1__Populate_Event_Data extends BaseJavaMigration {
val txs = loadTransactions(conn)
val data = txs.flatMap { case (txId, tx) =>
tx.nodes.collect {
case (nodeId, Node.Create(cid, _, _, _, signatories, stakeholders, _, _, _)) =>
case (nodeId, Node.Create(cid, _, _, _, signatories, stakeholders, _, _)) =>
(cid, EventId(txId, nodeId), signatories, stakeholders -- signatories)
}
}

View File

@ -34,7 +34,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
signatories = Set(alice),
stakeholders = Set(alice),
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)
)
@ -54,7 +53,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
key = Some(
Node.KeyWithMaintainers(someContractKey(bob, "some key"), Set(bob))
),
byInterface = None,
version = TransactionVersion.minVersion,
)
)
@ -77,7 +75,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
exerciseResult = Some(someChoiceResult),
key = None,
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
)
)
@ -92,7 +89,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
Node.KeyWithMaintainers(ValueParty(bob), Set(bob))
),
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
),
parentId = rootExercise,
@ -114,7 +110,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
Node.KeyWithMaintainers(someContractKey(bob, "some key"), Set(bob))
),
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
),
parentId = rootExercise,
@ -130,7 +125,6 @@ private[dao] trait JdbcLedgerDaoDivulgenceSpec extends LoneElement with Inside {
key = Some(
Node.KeyWithMaintainers(someContractKey(bob, "some key"), Set(bob))
),
byInterface = None,
version = TransactionVersion.minVersion,
),
parentId = nestedExercise,

View File

@ -211,7 +211,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
signatories = signatories,
stakeholders = stakeholders,
key = key,
byInterface = None,
version = txVersion,
)
@ -233,7 +232,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
exerciseResult = Some(someChoiceResult),
key = key,
byKey = false,
byInterface = None,
version = txVersion,
)
@ -249,7 +247,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
stakeholders = Set(party),
None,
byKey = false,
byInterface = None,
version = txVersion,
)
@ -391,7 +388,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
exerciseResult = Some(someChoiceResult),
key = None,
byKey = false,
byInterface = None,
version = txVersion,
)
)
@ -404,7 +400,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
stakeholders = Set(alice),
None,
byKey = false,
byInterface = None,
version = txVersion,
),
exerciseId,
@ -726,7 +721,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
signatories = Set(party),
stakeholders = Set(party),
key = Some(Node.KeyWithMaintainers(someContractKey(party, key), Set(party))),
byInterface = None,
version = txVersion,
)
)
@ -767,7 +761,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
exerciseResult = Some(LfValue.ValueUnit),
key = maybeKey.map(k => Node.KeyWithMaintainers(someContractKey(party, k), Set(party))),
byKey = false,
byInterface = None,
version = txVersion,
)
)
@ -828,7 +821,6 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
stakeholders = Set(party),
None,
byKey = false,
byInterface = None,
version = txVersion,
)
)

View File

@ -772,12 +772,10 @@ class UpdateToDbDtoSpec extends AnyWordSpec with Matchers {
val fetchNode = builder.fetch(
contract = createNode,
byKey = false,
byInterface = None,
)
val fetchByKeyNode = builder.fetch(
contract = createNode,
byKey = true,
byInterface = None,
)
val lookupByKeyNode = builder.lookupByKey(
contract = createNode,

View File

@ -23,7 +23,6 @@ class ProjectionsSpec extends AnyWordSpec with Matchers {
signatories = signatories,
stakeholders = stakeholders,
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)
@ -50,7 +49,6 @@ class ProjectionsSpec extends AnyWordSpec with Matchers {
exerciseResult = None,
key = None,
byKey = false,
byInterface = None,
version = TransactionVersion.minVersion,
)

View File

@ -36,7 +36,6 @@ class BridgeWriteServiceTest extends AnyFlatSpec with MockitoSugar with Matchers
signatories = Set.empty,
stakeholders = Set.empty,
key = None,
byInterface = None,
version = TransactionVersion.minVersion,
)

View File

@ -4,20 +4,20 @@
- Updating the package service fails with insufficient authorization: [AuthorizationTest.scala](ledger-service/http-json/src/it/scala/http/AuthorizationTest.scala#L81)
- Updating the package service succeeds with sufficient authorization: [AuthorizationTest.scala](ledger-service/http-json/src/it/scala/http/AuthorizationTest.scala#L89)
- accept user tokens: [TestMiddleware.scala](triggers/service/auth/src/test/scala/com/daml/auth/middleware/oauth2/TestMiddleware.scala#L151)
- badly-authorized create is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L61)
- badly-authorized create is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L60)
- badly-authorized create is rejected: [AbstractHttpServiceIntegrationTest.scala](ledger-service/http-json/src/itlib/scala/http/AbstractHttpServiceIntegrationTest.scala#L1778)
- badly-authorized exercise is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L159)
- badly-authorized exercise is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L158)
- badly-authorized exercise/create (create is unauthorized) is rejected: [AuthPropagationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthPropagationSpec.scala#L274)
- badly-authorized exercise/create (exercise is unauthorized) is rejected: [AuthPropagationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthPropagationSpec.scala#L242)
- badly-authorized exercise/exercise (no implicit authority from outer exercise) is rejected: [AuthPropagationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthPropagationSpec.scala#L333)
- badly-authorized fetch is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L96)
- badly-authorized lookup is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L118)
- badly-authorized fetch is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L95)
- badly-authorized lookup is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L117)
- create IOU should fail if overwritten actAs & readAs result in missing permission even if the user would have the rights: [HttpServiceIntegrationTestUserManagement.scala](ledger-service/http-json/src/it/scala/http/HttpServiceIntegrationTestUserManagement.scala#L134)
- create IOU should fail if user has no permission: [HttpServiceIntegrationTestUserManagement.scala](ledger-service/http-json/src/it/scala/http/HttpServiceIntegrationTestUserManagement.scala#L108)
- create IOU should work with correct user rights: [HttpServiceIntegrationTestUserManagement.scala](ledger-service/http-json/src/it/scala/http/HttpServiceIntegrationTestUserManagement.scala#L81)
- create with no signatories is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L51)
- create with non-signatory maintainers is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L73)
- exercise with no controllers is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L149)
- create with no signatories is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L50)
- create with non-signatory maintainers is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L72)
- exercise with no controllers is rejected: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L148)
- fetch fails when readAs not authed, even if prior fetch succeeded: [AbstractHttpServiceIntegrationTest.scala](ledger-service/http-json/src/itlib/scala/http/AbstractHttpServiceIntegrationTest.scala#L1836)
- forbid a non-authorized party to check the status of a trigger: [TriggerServiceTest.scala](triggers/service/src/test/scala/com/digitalasset/daml/lf/engine/trigger/TriggerServiceTest.scala#L661)
- forbid a non-authorized party to list triggers: [TriggerServiceTest.scala](triggers/service/src/test/scala/com/digitalasset/daml/lf/engine/trigger/TriggerServiceTest.scala#L651)
@ -38,22 +38,22 @@
- websocket request with invalid protocol token should be denied: [AbstractWebsocketServiceIntegrationTest.scala](ledger-service/http-json/src/itlib/scala/http/AbstractWebsocketServiceIntegrationTest.scala#L91)
- websocket request with valid protocol token should allow client subscribe to stream: [AbstractWebsocketServiceIntegrationTest.scala](ledger-service/http-json/src/itlib/scala/http/AbstractWebsocketServiceIntegrationTest.scala#L79)
- websocket request without protocol token should be denied: [AbstractWebsocketServiceIntegrationTest.scala](ledger-service/http-json/src/itlib/scala/http/AbstractWebsocketServiceIntegrationTest.scala#L101)
- well-authorized create is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L44)
- well-authorized exercise is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L142)
- well-authorized create is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L43)
- well-authorized exercise is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L141)
- well-authorized exercise/create is accepted: [AuthPropagationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthPropagationSpec.scala#L220)
- well-authorized exercise/exercise is accepted: [AuthPropagationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthPropagationSpec.scala#L376)
- well-authorized fetch is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L90)
- well-authorized lookup is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L112)
- well-authorized fetch is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L89)
- well-authorized lookup is accepted: [AuthorizationSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/AuthorizationSpec.scala#L111)
## Privacy:
- ensure correct privacy for create node: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L32)
- ensure correct privacy for exercise node (consuming): [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L43)
- ensure correct privacy for exercise node (non-consuming): [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L62)
- ensure correct privacy for exercise subtree: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L139)
- ensure correct privacy for exercise subtree: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L137)
- ensure correct privacy for fetch node: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L82)
- ensure correct privacy for lookup-by-key node (found): [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L94)
- ensure correct privacy for lookup-by-key node (not-found): [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L116)
- ensure correct privacy for rollback subtree: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L201)
- ensure correct privacy for lookup-by-key node (not-found): [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L115)
- ensure correct privacy for rollback subtree: [BlindingSpec.scala](daml-lf/engine/src/test/scala/com/digitalasset/daml/lf/engine/BlindingSpec.scala#L199)
## Semantics:
- /v1/query GET succeeds after reconnect: [FailureTests.scala](ledger-service/http-json/src/failurelib/scala/http/FailureTests.scala#L153)