Skip to content

Commit 4872c75

Browse files
[Speedy] Drop SoftFetch and SoftExercise (#21408)
Soft operations are not produce by the compiler since Feb 2024. @meiersi-da gave is green light to go with this changes together with #21403
1 parent c8f62f0 commit 4872c75

File tree

12 files changed

+1
-150
lines changed

12 files changed

+1
-150
lines changed

sdk/compiler/daml-lf-proto-decode/src/DA/Daml/LF/Proto3/DecodeV2.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,6 @@ decodeUpdate LF2.Update{..} = mayDecode "updateSum" updateSum $ \case
607607
<*> decodeNameId ChoiceName update_ExerciseChoiceInternedStr
608608
<*> mayDecode "update_ExerciseCid" update_ExerciseCid decodeExpr
609609
<*> mayDecode "update_ExerciseArg" update_ExerciseArg decodeExpr
610-
LF2.UpdateSumSoftExercise LF2.Update_SoftExercise{} ->
611-
throwError (ParseError "Update.Sum.soft_exercise is no longer supported")
612610
LF2.UpdateSumExerciseInterface LF2.Update_ExerciseInterface{..} ->
613611
fmap EUpdate $ UExerciseInterface
614612
<$> mayDecode "update_ExerciseInterfaceInterface" update_ExerciseInterfaceInterface decodeTypeConId
@@ -626,8 +624,6 @@ decodeUpdate LF2.Update{..} = mayDecode "updateSum" updateSum $ \case
626624
fmap EUpdate $ UFetch
627625
<$> mayDecode "update_FetchTemplate" update_FetchTemplate decodeTypeConId
628626
<*> mayDecode "update_FetchCid" update_FetchCid decodeExpr
629-
LF2.UpdateSumSoftFetch LF2.Update_SoftFetch{} ->
630-
throwError (ParseError "Update.Sum.soft_fetch is no longer supported")
631627
LF2.UpdateSumFetchInterface LF2.Update_FetchInterface{..} ->
632628
fmap EUpdate $ UFetchInterface
633629
<$> mayDecode "update_FetchInterfaceInterface" update_FetchInterfaceInterface decodeTypeConId

sdk/daml-lf/archive/src/main/protobuf/com/digitalasset/daml/lf/archive/daml_lf2.proto

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,20 +1005,6 @@ message Update {
10051005
Expr arg = 5;
10061006
}
10071007

1008-
// Soft Exercise Update
1009-
// Exercises a contract of the given template type OR a predecessor.
1010-
// *Available in versions >= 2.dev*
1011-
message SoftExercise {
1012-
// Template type
1013-
TypeConId template = 1;
1014-
// *Must be a valid interned identifier*
1015-
int32 choice_interned_str = 2;
1016-
// contract id
1017-
Expr cid = 3;
1018-
// argument
1019-
Expr arg = 4;
1020-
}
1021-
10221008
// Interface Exercise Update
10231009
message ExerciseInterface {
10241010
// Interface type
@@ -1057,16 +1043,6 @@ message Update {
10571043
Expr cid = 2;
10581044
}
10591045

1060-
// Soft Fetch Update
1061-
// Fetches a contract of the given template type OR a predecessor.
1062-
// *Available in versions >= 2.dev*
1063-
message SoftFetch {
1064-
// Template type
1065-
TypeConId template = 1;
1066-
// contract id
1067-
Expr cid = 2;
1068-
}
1069-
10701046
// Interface Fetch Update
10711047
message FetchInterface {
10721048
// Interface type
@@ -1118,9 +1094,6 @@ message Update {
11181094
FetchInterface fetch_interface = 14;
11191095

11201096
Expr ledger_time_lt = 15;
1121-
1122-
SoftFetch soft_fetch = 1002; // *Available in versions >= 2.dev*
1123-
SoftExercise soft_exercise = 1003; // *Available in versions >= 2.dev*
11241097
}
11251098
}
11261099

sdk/daml-lf/archive/src/main/scala/com/digitalasset/daml/lf/archive/DecodeV2.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,18 +1278,6 @@ private[archive] class DecodeV2(minor: LV.Minor) {
12781278
}
12791279
}
12801280

1281-
case PLF.Update.SumCase.SOFT_EXERCISE =>
1282-
val exercise = lfUpdate.getSoftExercise
1283-
val templateId = decodeTypeConId(exercise.getTemplate)
1284-
val choice = internedName(exercise.getChoiceInternedStr)
1285-
decodeExpr(exercise.getCid, definition) { cidE =>
1286-
decodeExpr(exercise.getArg, definition) { argE =>
1287-
Ret(
1288-
UpdateSoftExercise(templateId, choice, cidE, argE)
1289-
)
1290-
}
1291-
}
1292-
12931281
case PLF.Update.SumCase.EXERCISE_INTERFACE =>
12941282
val exercise = lfUpdate.getExerciseInterface
12951283
decodeExpr(exercise.getCid, definition) { cidE =>
@@ -1336,17 +1324,6 @@ private[archive] class DecodeV2(minor: LV.Minor) {
13361324
Ret(UpdateFetchTemplate(templateId = decodeTypeConId(fetch.getTemplate), contractId))
13371325
}
13381326

1339-
case PLF.Update.SumCase.SOFT_FETCH =>
1340-
val softFetch = lfUpdate.getSoftFetch
1341-
decodeExpr(softFetch.getCid, definition) { contractId =>
1342-
Ret(
1343-
UpdateSoftFetchTemplate(
1344-
templateId = decodeTypeConId(softFetch.getTemplate),
1345-
contractId,
1346-
)
1347-
)
1348-
}
1349-
13501327
case PLF.Update.SumCase.FETCH_INTERFACE =>
13511328
val fetch = lfUpdate.getFetchInterface
13521329
decodeExpr(fetch.getCid, definition) { contractId =>

sdk/daml-lf/archive/src/test/scala/com/digitalasset/daml/lf/archive/DecodeV2Spec.scala

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -880,37 +880,6 @@ class DecodeV2Spec
880880
decoder.decodeExprForTest(proto, "test") shouldBe Ast.EUpdate(exerciseInterfaceScala)
881881
}
882882
}
883-
884-
s"decode softFetch" in {
885-
val dottedNameTable = ImmArraySeq("Mod", "T").map(Ref.DottedName.assertFromString)
886-
val unit = DamlLf2.Unit.newBuilder().build()
887-
val pkgRef = DamlLf2.SelfOrImportedPackageId.newBuilder().setSelfPackageId(unit).build
888-
val modRef =
889-
DamlLf2.ModuleId.newBuilder().setPackageId(pkgRef).setModuleNameInternedDname(0).build()
890-
val templateTyConName =
891-
DamlLf2.TypeConId.newBuilder().setModule(modRef).setNameInternedDname(1)
892-
893-
val softFetchProto = {
894-
val exe = DamlLf2.Update.SoftFetch
895-
.newBuilder()
896-
.setTemplate(templateTyConName)
897-
.setCid(unitExpr)
898-
.build()
899-
DamlLf2.Update.newBuilder().setSoftFetch(exe).build()
900-
}
901-
902-
val softFetchScala = Ast.UpdateSoftFetchTemplate(
903-
Ref.Identifier.assertFromString("noPkgId:Mod:T"),
904-
EUnit,
905-
)
906-
907-
forEveryVersion { version =>
908-
val decoder = moduleDecoder(version, ImmArraySeq.empty, dottedNameTable, typeTable)
909-
val proto = DamlLf2.Expr.newBuilder().setUpdate(softFetchProto).build()
910-
val result = Try(decoder.decodeExprForTest(proto, "test"))
911-
result shouldBe Success(Ast.EUpdate(softFetchScala))
912-
}
913-
}
914883
}
915884

916885
"decodeModule" should {

sdk/daml-lf/encoder/src/main/scala/com/digitalasset/daml/lf/archive/testing/EncodeV2.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,6 @@ private[daml] class EncodeV2(minorLanguageVersion: LV.Minor) {
361361
)
362362
case UpdateFetchTemplate(templateId, contractId) =>
363363
builder.setFetch(PLF.Update.Fetch.newBuilder().setTemplate(templateId).setCid(contractId))
364-
case UpdateSoftFetchTemplate(templateId, contractId) =>
365-
builder.setSoftFetch(
366-
PLF.Update.SoftFetch.newBuilder().setTemplate(templateId).setCid(contractId)
367-
)
368364
case UpdateFetchInterface(interface, contractId) =>
369365
builder.setFetchInterface(
370366
PLF.Update.FetchInterface.newBuilder().setInterface(interface).setCid(contractId)
@@ -376,13 +372,6 @@ private[daml] class EncodeV2(minorLanguageVersion: LV.Minor) {
376372
b.setCid(cid)
377373
b.setArg(arg)
378374
builder.setExercise(b)
379-
case UpdateSoftExercise(templateId, choice, cid, arg) =>
380-
val b = PLF.Update.SoftExercise.newBuilder()
381-
b.setTemplate(templateId)
382-
setString(choice, b.setChoiceInternedStr)
383-
b.setCid(cid)
384-
b.setArg(arg)
385-
builder.setSoftExercise(b)
386375
case UpdateExerciseInterface(interface, choice, cid, arg, guard) =>
387376
val b = PLF.Update.ExerciseInterface.newBuilder()
388377
b.setInterface(interface)

sdk/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/PartialTransaction.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ private[speedy] case class PartialTransaction(
484484
ExercisesContextInfo(
485485
targetId = targetId,
486486
packageName = packageName,
487-
templateId = templateId, // may differ from contract.templateId during soft-exercise
487+
templateId = templateId, // may differ from contract.templateId
488488
interfaceId = interfaceId,
489489
contractKey =
490490
// We need to renormalize the key

sdk/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/PhaseOne.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,6 @@ private[lf] final class PhaseOne(
667667
compileExp(env, coid) { coid =>
668668
Return(t.FetchTemplateDefRef(tmplId)(coid))
669669
}
670-
// TODO: https://github.com/digital-asset/daml/issues/17082
671-
// - Soft fetch now has identical behavior to normal fetch, and could be removed
672-
case UpdateSoftFetchTemplate(tmplId, coid) =>
673-
compileExp(env, coid) { coid =>
674-
Return(t.FetchTemplateDefRef(tmplId)(coid))
675-
}
676670
case UpdateFetchInterface(ifaceId, coid) =>
677671
compileExp(env, coid) { coid =>
678672
Return(t.FetchInterfaceDefRef(ifaceId)(coid))
@@ -702,14 +696,6 @@ private[lf] final class PhaseOne(
702696
Return(t.TemplateChoiceDefRef(tmplId, chId)(cid, arg))
703697
}
704698
}
705-
// TODO: https://github.com/digital-asset/daml/issues/17082
706-
// - Soft exercise now has identical behavior to normal exercise, and could be removed
707-
case UpdateSoftExercise(tmplId, chId, cid, arg) =>
708-
compileExp(env, cid) { cid =>
709-
compileExp(env, arg) { arg =>
710-
Return(t.TemplateChoiceDefRef(tmplId, chId)(cid, arg))
711-
}
712-
}
713699
case UpdateExerciseInterface(ifaceId, chId, cid, arg, maybeGuard) =>
714700
compileExp(env, cid) { cid =>
715701
compileExp(env, arg) { arg =>

sdk/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/Ast.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ object Ast {
586586
final case class UpdateCreate(templateId: TypeConId, arg: Expr) extends Update
587587
final case class UpdateCreateInterface(interfaceId: TypeConId, arg: Expr) extends Update
588588
final case class UpdateFetchTemplate(templateId: TypeConId, contractId: Expr) extends Update
589-
final case class UpdateSoftFetchTemplate(templateId: TypeConId, contractId: Expr) extends Update
590589
final case class UpdateFetchInterface(interfaceId: TypeConId, contractId: Expr) extends Update
591590

592591
final case class UpdateExercise(
@@ -595,12 +594,6 @@ object Ast {
595594
cidE: Expr,
596595
argE: Expr,
597596
) extends Update
598-
final case class UpdateSoftExercise(
599-
templateId: TypeConId,
600-
choice: ChoiceName,
601-
cidE: Expr,
602-
argE: Expr,
603-
) extends Update
604597
final case class UpdateExerciseInterface(
605598
interfaceId: TypeConId,
606599
choice: ChoiceName,

sdk/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/util/iterable/ExprIterable.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,10 @@ private[lf] object ExprIterable {
102102
Iterator(arg)
103103
case UpdateFetchTemplate(templateId @ _, contractId) =>
104104
Iterator(contractId)
105-
case UpdateSoftFetchTemplate(templateId @ _, contractId) =>
106-
Iterator(contractId)
107105
case UpdateFetchInterface(interface @ _, contractId) =>
108106
Iterator(contractId)
109107
case UpdateExercise(templateId @ _, choice @ _, cid, arg) =>
110108
Iterator(cid, arg)
111-
case UpdateSoftExercise(templateId @ _, choice @ _, cid, arg) =>
112-
Iterator(cid, arg)
113109
case UpdateExerciseInterface(interface @ _, choice @ _, cid, arg, guard) =>
114110
Iterator(cid, arg) ++ guard.iterator
115111
case UpdateExerciseByKey(templateId @ _, choice @ _, key, arg) =>

sdk/daml-lf/language/src/main/scala/com/digitalasset/daml/lf/language/util/iterable/TypeIterable.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,13 @@ private[lf] object TypeIterable {
130130
case UpdateFetchTemplate(templateId, contractId) =>
131131
Iterator(TTyCon(templateId)) ++
132132
iterator(contractId)
133-
case UpdateSoftFetchTemplate(templateId, contractId) =>
134-
Iterator(TTyCon(templateId)) ++
135-
iterator(contractId)
136133
case UpdateFetchInterface(interface, contractId) =>
137134
Iterator(TTyCon(interface)) ++
138135
iterator(contractId)
139136
case UpdateExercise(templateId, choice @ _, cid, arg) =>
140137
Iterator(TTyCon(templateId)) ++
141138
iterator(cid) ++
142139
iterator(arg)
143-
case UpdateSoftExercise(templateId, choice @ _, cid, arg) =>
144-
Iterator(TTyCon(templateId)) ++
145-
iterator(cid) ++
146-
iterator(arg)
147140
case UpdateExerciseInterface(interface, choice @ _, cid, arg, guard) =>
148141
Iterator(TTyCon(interface)) ++
149142
iterator(cid) ++

0 commit comments

Comments
 (0)