mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Remove by_interface field form proto Transaction Nodes (#13510)
CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
b08fcfada3
commit
fc92298ac0
@ -28,7 +28,6 @@ import scalaz.scalacheck.ScalaCheckBinding._
|
||||
object ValueGenerators {
|
||||
|
||||
import TransactionVersion.minExceptions
|
||||
import TransactionVersion.minInterfaces
|
||||
|
||||
//generate decimal values
|
||||
def numGen(scale: Numeric.Scale): Gen[Numeric] = {
|
||||
@ -304,17 +303,16 @@ object ValueGenerators {
|
||||
signatories <- genNonEmptyParties
|
||||
stakeholders <- genNonEmptyParties
|
||||
key <- Gen.option(keyWithMaintainersGen)
|
||||
byInterface <- if (version < minInterfaces) Gen.const(None) else Gen.option(idGen)
|
||||
} yield Node.Create(
|
||||
coid,
|
||||
templateId,
|
||||
arg,
|
||||
agreement,
|
||||
signatories,
|
||||
stakeholders,
|
||||
key,
|
||||
byInterface,
|
||||
version,
|
||||
coid = coid,
|
||||
templateId = templateId,
|
||||
arg = arg,
|
||||
agreementText = agreement,
|
||||
signatories = signatories,
|
||||
stakeholders = stakeholders,
|
||||
key = key,
|
||||
byInterface = None,
|
||||
version = version,
|
||||
)
|
||||
}
|
||||
|
||||
@ -333,17 +331,16 @@ object ValueGenerators {
|
||||
stakeholders <- genNonEmptyParties
|
||||
key <- Gen.option(keyWithMaintainersGen)
|
||||
byKey <- Gen.oneOf(true, false)
|
||||
byInterface <- if (version < minInterfaces) Gen.const(None) else Gen.option(idGen)
|
||||
} yield Node.Fetch(
|
||||
coid,
|
||||
templateId,
|
||||
actingParties,
|
||||
signatories,
|
||||
stakeholders,
|
||||
key,
|
||||
byKey,
|
||||
byInterface,
|
||||
version,
|
||||
coid = coid,
|
||||
templateId = templateId,
|
||||
actingParties = actingParties,
|
||||
signatories = signatories,
|
||||
stakeholders = stakeholders,
|
||||
key = key,
|
||||
byKey = byKey,
|
||||
byInterface = None,
|
||||
version = version,
|
||||
)
|
||||
}
|
||||
|
||||
@ -385,23 +382,22 @@ object ValueGenerators {
|
||||
exerciseResult <- if (version < minExceptions) valueGen.map(Some(_)) else Gen.option(valueGen)
|
||||
key <- Gen.option(keyWithMaintainersGen)
|
||||
byKey <- Gen.oneOf(true, false)
|
||||
byInterface <- if (version < minInterfaces) Gen.const(None) else Gen.option(idGen)
|
||||
} yield Node.Exercise(
|
||||
targetCoid,
|
||||
templateId,
|
||||
choiceId,
|
||||
consume,
|
||||
actingParties,
|
||||
chosenValue,
|
||||
stakeholders,
|
||||
signatories,
|
||||
targetCoid = targetCoid,
|
||||
templateId = templateId,
|
||||
choiceId = choiceId,
|
||||
consuming = consume,
|
||||
actingParties = actingParties,
|
||||
chosenValue = chosenValue,
|
||||
stakeholders = stakeholders,
|
||||
signatories = signatories,
|
||||
choiceObservers = choiceObservers,
|
||||
children,
|
||||
exerciseResult,
|
||||
key,
|
||||
byKey,
|
||||
byInterface,
|
||||
version,
|
||||
children = children,
|
||||
exerciseResult = exerciseResult,
|
||||
key = key,
|
||||
byKey = byKey,
|
||||
byInterface = None,
|
||||
version = version,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
// * 14 -- add rollback nodes
|
||||
// add by_key flag to fetch and exercise node
|
||||
// * dev -- special staging area for the next version to be released
|
||||
// add by_interface to fetch and exercise node
|
||||
syntax = "proto3";
|
||||
|
||||
package com.daml.lf.transaction;
|
||||
@ -73,7 +72,6 @@ message NodeCreate {
|
||||
repeated string signatories = 4;
|
||||
KeyWithMaintainers key_with_maintainers = 5;
|
||||
com.daml.lf.value.ContractId contract_id_struct = 6;
|
||||
optional com.daml.lf.value.Identifier by_interface = 10; // *since version dev*
|
||||
}
|
||||
|
||||
message NodeFetch {
|
||||
@ -86,7 +84,6 @@ message NodeFetch {
|
||||
com.daml.lf.value.ContractId contract_id_struct = 6;
|
||||
KeyWithMaintainers key_with_maintainers = 8;
|
||||
bool by_key = 9; // *since version 1.14*
|
||||
optional com.daml.lf.value.Identifier by_interface = 10; // *since version dev*
|
||||
}
|
||||
|
||||
message NodeExercise {
|
||||
@ -112,7 +109,6 @@ message NodeExercise {
|
||||
KeyWithMaintainers key_with_maintainers = 14; // optional
|
||||
repeated string observers = 15; // *since version 11*
|
||||
bool by_key = 18; // *since version 14*
|
||||
optional com.daml.lf.value.Identifier by_interface = 19; // *since version dev*
|
||||
}
|
||||
|
||||
message NodeLookupByKey {
|
||||
|
@ -283,11 +283,6 @@ object TransactionCoder {
|
||||
nc.stakeholders.foreach(builder.addStakeholders)
|
||||
nc.signatories.foreach(builder.addSignatories)
|
||||
discard(builder.setContractIdStruct(encodeCid.encode(nc.coid)))
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces) {
|
||||
nc.byInterface.foreach(iface =>
|
||||
builder.setByInterface(ValueCoder.encodeIdentifier(iface))
|
||||
)
|
||||
}
|
||||
for {
|
||||
_ <-
|
||||
if (nodeVersion < TransactionVersion.minNoVersionValue) {
|
||||
@ -325,11 +320,6 @@ object TransactionCoder {
|
||||
discard(builder.setByKey(nf.byKey))
|
||||
}
|
||||
nf.actingParties.foreach(builder.addActors)
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces) {
|
||||
nf.byInterface.foreach(iface =>
|
||||
builder.setByInterface(ValueCoder.encodeIdentifier(iface))
|
||||
)
|
||||
}
|
||||
for {
|
||||
_ <- encodeAndSetContractKey(
|
||||
encodeCid,
|
||||
@ -356,11 +346,6 @@ object TransactionCoder {
|
||||
if (nodeVersion >= TransactionVersion.minByKey) {
|
||||
discard(builder.setByKey(ne.byKey))
|
||||
}
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces) {
|
||||
ne.byInterface.foreach(iface =>
|
||||
builder.setByInterface(ValueCoder.encodeIdentifier(iface))
|
||||
)
|
||||
}
|
||||
for {
|
||||
_ <- Either.cond(
|
||||
test = ne.version >= TransactionVersion.minChoiceObservers ||
|
||||
@ -531,22 +516,16 @@ object TransactionCoder {
|
||||
nodeVersion,
|
||||
protoCreate.getKeyWithMaintainers,
|
||||
)
|
||||
byInterface <-
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces && protoCreate.hasByInterface) {
|
||||
ValueCoder.decodeIdentifier(protoCreate.getByInterface).map(Some(_))
|
||||
} else {
|
||||
Right(None)
|
||||
}
|
||||
} yield ni -> Node.Create(
|
||||
c,
|
||||
ci.template,
|
||||
ci.arg,
|
||||
ci.agreementText,
|
||||
signatories,
|
||||
stakeholders,
|
||||
key,
|
||||
byInterface,
|
||||
nodeVersion,
|
||||
coid = c,
|
||||
templateId = ci.template,
|
||||
arg = ci.arg,
|
||||
agreementText = ci.agreementText,
|
||||
signatories = signatories,
|
||||
stakeholders = stakeholders,
|
||||
key = key,
|
||||
byInterface = None,
|
||||
version = nodeVersion,
|
||||
)
|
||||
case NodeTypeCase.FETCH =>
|
||||
val protoFetch = protoNode.getFetch
|
||||
@ -566,12 +545,6 @@ object TransactionCoder {
|
||||
if (nodeVersion >= TransactionVersion.minByKey)
|
||||
protoFetch.getByKey
|
||||
else false
|
||||
byInterface <-
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces && protoFetch.hasByInterface) {
|
||||
ValueCoder.decodeIdentifier(protoFetch.getByInterface).map(Some(_))
|
||||
} else {
|
||||
Right(None)
|
||||
}
|
||||
} yield ni -> Node.Fetch(
|
||||
coid = c,
|
||||
templateId = templateId,
|
||||
@ -580,7 +553,7 @@ object TransactionCoder {
|
||||
stakeholders = stakeholders,
|
||||
key = key,
|
||||
byKey = byKey,
|
||||
byInterface = byInterface,
|
||||
byInterface = None,
|
||||
version = nodeVersion,
|
||||
)
|
||||
|
||||
@ -630,12 +603,6 @@ object TransactionCoder {
|
||||
if (nodeVersion >= TransactionVersion.minByKey)
|
||||
protoExe.getByKey
|
||||
else false
|
||||
byInterface <-
|
||||
if (nodeVersion >= TransactionVersion.minInterfaces && protoExe.hasByInterface) {
|
||||
ValueCoder.decodeIdentifier(protoExe.getByInterface).map(Some(_))
|
||||
} else {
|
||||
Right(None)
|
||||
}
|
||||
} yield ni -> Node.Exercise(
|
||||
targetCoid = targetCoid,
|
||||
templateId = templateId,
|
||||
@ -650,7 +617,7 @@ object TransactionCoder {
|
||||
exerciseResult = rvOpt,
|
||||
key = keyWithMaintainers,
|
||||
byKey = byKey,
|
||||
byInterface = byInterface,
|
||||
byInterface = None,
|
||||
version = nodeVersion,
|
||||
)
|
||||
case NodeTypeCase.LOOKUP_BY_KEY =>
|
||||
|
@ -49,7 +49,6 @@ object TransactionVersion {
|
||||
//nothing was added in V13, so there are no vals: "minSomething = V13"
|
||||
private[lf] val minExceptions = V14
|
||||
private[lf] val minByKey = V14
|
||||
private[lf] val minInterfaces = VDev
|
||||
|
||||
private[lf] val assignNodeVersion: LanguageVersion => TransactionVersion = {
|
||||
import LanguageVersion._
|
||||
|
@ -906,10 +906,6 @@ class TransactionCoderSpec
|
||||
create.copy(
|
||||
arg = normalize(create.arg, create.version),
|
||||
key = create.key.map(normalizeKey(_, create.version)),
|
||||
byInterface =
|
||||
if (create.version >= TransactionVersion.minInterfaces)
|
||||
create.byInterface
|
||||
else None,
|
||||
)
|
||||
}
|
||||
|
||||
@ -920,10 +916,6 @@ class TransactionCoderSpec
|
||||
if (fetch.version >= TransactionVersion.minByKey)
|
||||
fetch.byKey
|
||||
else false,
|
||||
byInterface =
|
||||
if (fetch.version >= TransactionVersion.minInterfaces)
|
||||
fetch.byInterface
|
||||
else None,
|
||||
)
|
||||
|
||||
private[this] def normalizeExe(exe: Node.Exercise) =
|
||||
@ -946,10 +938,6 @@ class TransactionCoderSpec
|
||||
if (exe.version >= TransactionVersion.minByKey)
|
||||
exe.byKey
|
||||
else false,
|
||||
byInterface =
|
||||
if (exe.version >= TransactionVersion.minInterfaces)
|
||||
exe.byInterface
|
||||
else None,
|
||||
)
|
||||
|
||||
private[this] def normalizeKey(
|
||||
|
Loading…
Reference in New Issue
Block a user