From de80a6dc60c60ae22e4f14364362007ecb2331be Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Wed, 5 May 2021 12:32:58 +0200 Subject: [PATCH] Drop ValueBuiltinException (#9576) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As discussed, we don’t want to expose this via serializable values at least for now (and it’s not exposed on the ledger API anyway) so this PR drops the type. changelog_begin changelog_end --- .../client/src/DA/Daml/LF/PrettyScenario.hs | 2 - .../protos/scenario_service.proto | 7 --- .../daml/lf/scenario/Conversions.scala | 8 ---- .../daml/lf/scenario/ScenarioLedger.scala | 1 - .../digitalasset/daml/lf/speedy/Pretty.scala | 2 - .../digitalasset/daml/lf/speedy/SValue.scala | 4 +- .../daml/lf/speedy/ExceptionTest.scala | 47 +++++-------------- .../transaction/test/TransactionBuilder.scala | 3 -- .../scala/lf/value/test/ValueGenerators.scala | 12 ----- .../digitalasset/daml/lf/crypto/Hash.scala | 2 - .../daml/lf/transaction/Util.scala | 2 - .../digitalasset/daml/lf/value/Value.scala | 28 ----------- .../daml/lf/value/ValueCoder.scala | 4 -- .../daml/lf/crypto/HashSpec.scala | 15 +----- .../writers/postgresql/Queries.scala | 3 -- .../com/daml/ledger/api/v1/value.proto | 4 -- .../util/ApiValueToLfValueConverterTest.scala | 3 -- .../lf/value/json/ApiCodecCompressed.scala | 8 ---- .../lf/value/json/NavigatorModelAliases.scala | 1 - .../participant/util/LfEngineToApi.scala | 10 ---- .../store/serialization/KeyHasher.scala | 9 ---- .../kvutils/tools/engine/replay/Adapter.scala | 2 - .../navigator/json/ApiCodecVerbose.scala | 4 -- .../model/converter/LedgerApiV1.scala | 3 -- .../navigator/query/filter/package.scala | 3 -- .../navigator/query/project/package.scala | 3 -- 26 files changed, 15 insertions(+), 175 deletions(-) diff --git a/compiler/scenario-service/client/src/DA/Daml/LF/PrettyScenario.hs b/compiler/scenario-service/client/src/DA/Daml/LF/PrettyScenario.hs index c410b2ba6a..b9b3b122a4 100644 --- a/compiler/scenario-service/client/src/DA/Daml/LF/PrettyScenario.hs +++ b/compiler/scenario-service/client/src/DA/Daml/LF/PrettyScenario.hs @@ -708,8 +708,6 @@ prettyValue' showRecordType prec world (Value (Just vsum)) = case vsum of then \fs -> prettyMay "" (prettyDefName world) mbRecordId <-> keyword_ "with" $$ nest 2 fs else id) (sep (punctuate ";" (mapV prettyField fields))) - ValueSumBuiltinException(BuiltinException tag mbValue) -> - ltext tag <> char '(' <> prettyMay "" (prettyValue' True prec world) mbValue <> char ')' ValueSumVariant (Variant mbVariantId ctor mbValue) -> prettyMay "" (\v -> prettyDefName world v <> ":") mbVariantId <> ltext ctor <-> prettyMay "" (prettyValue' True precHighest world) mbValue diff --git a/compiler/scenario-service/protos/scenario_service.proto b/compiler/scenario-service/protos/scenario_service.proto index d4b5f827da..541a651b47 100644 --- a/compiler/scenario-service/protos/scenario_service.proto +++ b/compiler/scenario-service/protos/scenario_service.proto @@ -290,11 +290,6 @@ message Variant { Value value = 3; } -message BuiltinException { - string tag = 1; - Value value = 2; -} - message Enum { Identifier enum_id = 1; string constructor = 2; @@ -335,8 +330,6 @@ message Value { // An unserializable value, e.g. closure. Contains a description of the value. string unserializable = 17; - - BuiltinException builtin_exception = 18; } } diff --git a/compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala b/compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala index 351e9ac608..627aa926e9 100644 --- a/compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala +++ b/compiler/scenario-service/server/src/main/scala/com/digitalasset/daml/lf/scenario/Conversions.scala @@ -650,14 +650,6 @@ final class Conversions( ) .build ) - case V.ValueBuiltinException(tag, value) => - val vbuilder = proto.BuiltinException.newBuilder - builder.setBuiltinException( - vbuilder - .setTag(tag) - .setValue(convertValue(value)) - .build - ) case V.ValueVariant(tycon, variant, value) => val vbuilder = proto.Variant.newBuilder tycon.foreach(x => vbuilder.setVariantId(convertIdentifier(x))) diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/scenario/ScenarioLedger.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/scenario/ScenarioLedger.scala index c90612b60b..7bb925a305 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/scenario/ScenarioLedger.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/scenario/ScenarioLedger.scala @@ -313,7 +313,6 @@ object ScenarioLedger { fs.foreach { case (_, v) => collect(v) } - case ValueBuiltinException(_, arg) => collect(arg) case ValueVariant(_, _, arg) => collect(arg) case _: ValueEnum => () case ValueList(vs) => diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Pretty.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Pretty.scala index d40551c8fe..cca1295eb2 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Pretty.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/Pretty.scala @@ -417,8 +417,6 @@ private[lf] object Pretty { text("") }) + text(constructor) - case ValueBuiltinException(tag, value) => - text(tag) + char('(') + prettyValue(true)(value) + char(')') case ValueText(t) => char('"') + text(t) + char('"') case ValueContractId(acoid) => text(acoid.coid) case ValueUnit => text("") diff --git a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SValue.scala b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SValue.scala index e5cf20b24e..025bcec5ed 100644 --- a/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SValue.scala +++ b/daml-lf/interpreter/src/main/scala/com/digitalasset/daml/lf/speedy/SValue.scala @@ -62,8 +62,8 @@ sealed trait SValue { V.ValueGenMap(entries.view.map { case (k, v) => k.toValue -> v.toValue }.to(ImmArray)) case SContractId(coid) => V.ValueContractId(coid) - case SBuiltinException(tag, value) => - V.ValueBuiltinException(tag, value.toValue) + case SBuiltinException(_, _) => + throw SErrorCrash("SValue.toValue: unexpected SBuiltinException") case SStruct(_, _) => throw SErrorCrash("SValue.toValue: unexpected SStruct") case SAny(_, _) => diff --git a/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ExceptionTest.scala b/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ExceptionTest.scala index 3c991431de..f8eeec0af1 100644 --- a/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ExceptionTest.scala +++ b/daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ExceptionTest.scala @@ -153,10 +153,10 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh module M { val unhandled1 : Update Int64 = - upure @Int64 (ADD_INT64 10 (throw @Int64 @GeneralError (MAKE_GENERAL_ERROR "oops1"))); + upure @Int64 (ADD_INT64 10 (throw @Int64 @M:E1 (M:E1 {}))); val unhandled2 : Update Int64 = - try @Int64 (upure @Int64 (ADD_INT64 10 (throw @Int64 @GeneralError (MAKE_GENERAL_ERROR "oops2")))) + try @Int64 (upure @Int64 (ADD_INT64 10 (throw @Int64 @M:E1 (M:E1 {})))) catch e -> None @(Update Int64); record @serializable E1 = { } ; @@ -180,18 +180,15 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh ( "M:unhandled1", SResultError( - DamlEUnhandledException( - TBuiltin(BTGeneralError), - ValueBuiltinException("GeneralError", ValueText("oops1")), - ) + DamlEUnhandledException(TTyCon(e1), ValueRecord(Some(e1), data.ImmArray.empty)) ), ), ( "M:unhandled2", SResultError( DamlEUnhandledException( - TBuiltin(BTGeneralError), - ValueBuiltinException("GeneralError", ValueText("oops2")), + TTyCon(e1), + ValueRecord(Some(e1), data.ImmArray.empty), ) ), ), @@ -216,31 +213,6 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh } } - "throw/catch (GeneralError)" should { - - // Basic throw/catch example for a builtin (GeneralError) exception - - val pkgs: PureCompiledPackages = typeAndCompile(p""" - module M { - val throwAndCatch : Update Int64 = - try @Int64 (upure @Int64 (ADD_INT64 10 (throw @Int64 @GeneralError (MAKE_GENERAL_ERROR "oops")))) - catch e -> Some @(Update Int64) (upure @Int64 77); - } - """) - - val testCases = Table[String, Long]( - ("expression", "expected"), - ("M:throwAndCatch", 77), - ) - - forEvery(testCases) { (exp: String, num: Long) => - s"eval[$exp] --> $num" in { - val expected: SResult = SResultFinalValue(SValue.SInt64(num)) - runUpdateExpr(pkgs)(e"$exp") shouldBe expected - } - } - } - "throw/catch (UserDefined)" should { // Basic throw/catch example a user defined exception @@ -470,13 +442,18 @@ class ExceptionTest extends AnyWordSpec with Matchers with TableDrivenPropertyCh val pkgs: PureCompiledPackages = typeAndCompile(p""" module M { + record @serializable E = { message: Text } ; + exception E = { + message \(e: M:E) -> M:E {message} e + }; + val myThrow : forall (a: *). (Text -> a) = /\ (a: *). \(mes : Text) -> - throw @a @GeneralError (MAKE_GENERAL_ERROR mes); + throw @a @M:E (M:E { message = mes }); val isPayLoad : AnyException -> Text -> Bool = \(e: AnyException) (mes: Text) -> - EQUAL @AnyException e (to_any_exception @GeneralError (MAKE_GENERAL_ERROR mes)) ; + EQUAL @AnyException e (to_any_exception @M:E (M:E { message = mes })) ; val extractPayload : AnyException -> Int64 = \(e: AnyException) -> diff --git a/daml-lf/transaction-test-lib/src/main/scala/lf/transaction/test/TransactionBuilder.scala b/daml-lf/transaction-test-lib/src/main/scala/lf/transaction/test/TransactionBuilder.scala index d08d791803..55aa86cf28 100644 --- a/daml-lf/transaction-test-lib/src/main/scala/lf/transaction/test/TransactionBuilder.scala +++ b/daml-lf/transaction-test-lib/src/main/scala/lf/transaction/test/TransactionBuilder.scala @@ -316,9 +316,6 @@ object TransactionBuilder { go(currentVersion, map.values ++: values) case ValueEnum(_, _) => go(currentVersion, values) - // for things added after version 10, we raise the minimum if present - case ValueBuiltinException(_, arg) => - go(currentVersion max TransactionVersion.minExceptions, arg +: values) case ValueGenMap(entries) => val newValues = entries.iterator.foldLeft(values) { case (acc, (key, value)) => key +: value +: acc diff --git a/daml-lf/transaction-test-lib/src/main/scala/lf/value/test/ValueGenerators.scala b/daml-lf/transaction-test-lib/src/main/scala/lf/value/test/ValueGenerators.scala index 9953d71501..7c14f1c621 100644 --- a/daml-lf/transaction-test-lib/src/main/scala/lf/value/test/ValueGenerators.scala +++ b/daml-lf/transaction-test-lib/src/main/scala/lf/value/test/ValueGenerators.scala @@ -108,15 +108,6 @@ object ValueGenerators { .chooseNum(Time.Timestamp.MinValue.micros, Time.Timestamp.MaxValue.micros) .map(Time.Timestamp.assertFromLong) - // generate a builtinException with arbitrary value - private def builtinExceptionGen(nesting: Int): Gen[ValueBuiltinException[ContractId]] = - for { - tag <- Gen.alphaStr - value <- Gen.lzy(valueGen(nesting)) - } yield ValueBuiltinException(tag, value) - - def builtinExceptionGen: Gen[ValueBuiltinException[ContractId]] = builtinExceptionGen(0) - // generate a variant with arbitrary value private def variantGen(nesting: Int): Gen[ValueVariant[ContractId]] = for { @@ -224,9 +215,6 @@ object ValueGenerators { val nested = List( (sz / 2 + 1, Gen.resize(sz / 5, valueListGen(newNesting))), (sz / 2 + 1, Gen.resize(sz / 5, variantGen(newNesting))), - // TODO https://github.com/digital-asset/daml/issues/8020 - // test must work when we enable the following line: - //(sz / 2 + 1, Gen.resize(sz / 5, builtinExceptionGen(newNesting))), (sz / 2 + 1, Gen.resize(sz / 5, recordGen(newNesting))), (sz / 2 + 1, Gen.resize(sz / 5, valueOptionalGen(newNesting))), (sz / 2 + 1, Gen.resize(sz / 5, valueMapGen(newNesting))), diff --git a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/crypto/Hash.scala b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/crypto/Hash.scala index 93dbadc07a..98ae94773a 100644 --- a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/crypto/Hash.scala +++ b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/crypto/Hash.scala @@ -211,8 +211,6 @@ object Hash { iterateOver(xs.toImmArray)((acc, x) => acc.add(x._1).addTypedValue(x._2)) case Value.ValueRecord(_, fs) => iterateOver(fs)(_ addTypedValue _._2) - case Value.ValueBuiltinException(tag, v) => - add(tag).addTypedValue(v) case Value.ValueVariant(_, variant, v) => add(variant).addTypedValue(v) case Value.ValueEnum(_, v) => diff --git a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Util.scala b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Util.scala index 5dc771cb78..8836a139dd 100644 --- a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Util.scala +++ b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/transaction/Util.scala @@ -50,8 +50,6 @@ object Util { handleTypeInfo(tyCon), fields.map { case (fieldName, value) => handleTypeInfo(fieldName) -> go(value) }, ) - case ValueBuiltinException(tag, value) => - ValueBuiltinException(tag, go(value)) case ValueVariant(tyCon, variant, value) => ValueVariant(handleTypeInfo(tyCon), variant, go(value)) case _: ValueCidlessLeaf | _: ValueContractId[_] => value diff --git a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/Value.scala b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/Value.scala index 217389dd9a..7796efcdd5 100644 --- a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/Value.scala +++ b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/Value.scala @@ -76,18 +76,6 @@ sealed abstract class Value[+Cid] extends CidContainer[Value[Cid]] with Product go(exceededNesting, errs, values.toImmArray.map(v => (v, newNesting)) ++: vs) } - case ValueBuiltinException(_, value) => - if (newNesting > MAXIMUM_NESTING) { - if (exceededNesting) { - // we already exceeded the nesting, do not output again - go(exceededNesting, errs, vs) - } else { - go(true, errs :+ exceedsNestingErr, vs) - } - } else { - go(exceededNesting, errs, (value, newNesting) +: vs) - } - case ValueVariant(_, _, value) => if (newNesting > MAXIMUM_NESTING) { if (exceededNesting) { @@ -170,8 +158,6 @@ object Value extends CidContainer1[Value] { (lbl, go(value)) }), ) - case ValueBuiltinException(tag, value) => - ValueBuiltinException(tag, go(value)) case ValueVariant(id, variant, value) => ValueVariant(id, variant, go(value)) case x: ValueCidlessLeaf => x @@ -194,8 +180,6 @@ object Value extends CidContainer1[Value] { f(coid) case ValueRecord(id @ _, fs) => fs.foreach { case (_, value) => go(value) } - case ValueBuiltinException(tag @ _, value) => - go(value) case ValueVariant(id @ _, variant @ _, value) => go(value) case _: ValueCidlessLeaf => @@ -265,7 +249,6 @@ object Value extends CidContainer1[Value] { tycon: Option[Identifier], fields: ImmArray[(Option[Name], Value[Cid])], ) extends Value[Cid] - final case class ValueBuiltinException[+Cid](tag: String, value: Value[Cid]) extends Value[Cid] final case class ValueVariant[+Cid](tycon: Option[Identifier], variant: Name, value: Value[Cid]) extends Value[Cid] final case class ValueEnum(tycon: Option[Identifier], value: Name) extends ValueCidlessLeaf @@ -517,13 +500,6 @@ private final class `Value Order instance`[Cid: Order](Scope: Value.LookupVarian }, ) case ValueRecord(_, a) => (140, k { case ValueRecord(_, b) => _2.T.subst(a) ?|? _2.T.subst(b) }) - case ValueBuiltinException(tagA, a) => - ( - 150, - k { case ValueBuiltinException(tagB, b) => - tagA ?|? tagB |+| a ?|? b - }, - ) case ValueVariant(idA, conA, a) => ( 160, @@ -581,10 +557,6 @@ private final class `Value Equal instance`[Cid: Equal] extends Equal[Value[Cid]] import r._ tycon == tycon2 && fields === fields2 } - case v: ValueBuiltinException[Cid] => { case ValueBuiltinException(tag2, value2) => - import v._ - tag == tag2 && value === value2 - } case v: ValueVariant[Cid] => { case ValueVariant(tycon2, variant2, value2) => import v._ tycon == tycon2 && variant == variant2 && value === value2 diff --git a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/ValueCoder.scala b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/ValueCoder.scala index 88321e374c..2e161dfc6c 100644 --- a/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/ValueCoder.scala +++ b/daml-lf/transaction/src/main/scala/com/digitalasset/daml/lf/value/ValueCoder.scala @@ -432,10 +432,6 @@ object ValueCoder { id.foreach(i => recordBuilder.setRecordId(encodeIdentifier(i))) builder.setRecord(recordBuilder).build() - case ValueBuiltinException(_, _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - throw Err(s"Exceptions not supported") - case ValueVariant(id, con, arg) => val protoVar = proto.Variant.newBuilder() protoVar.setConstructor(con) diff --git a/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/crypto/HashSpec.scala b/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/crypto/HashSpec.scala index 3897201ea4..a296bb77ca 100644 --- a/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/crypto/HashSpec.scala +++ b/daml-lf/transaction/src/test/scala/com/digitalasset/daml/lf/crypto/HashSpec.scala @@ -468,15 +468,8 @@ class HashSpec extends AnyWordSpec with Matchers { List(None, Some(false), Some(true)).map(VA.optional(VA.bool).inj(_)) ++ List(Some(None), Some(Some(false))).map(VA.optional(VA.optional(VA.bool)).inj(_)) - val builtinExceptions = - List( - ValueBuiltinException("", ValueText("")), - ValueBuiltinException("someTag", ValueText("someMessage")), - ValueBuiltinException("differentTag", ValueInt64(42)), - ) - val testCases: List[V] = - units ++ bools ++ ints ++ decimals ++ numeric0s ++ dates ++ timestamps ++ texts ++ parties ++ contractIds ++ optionals ++ lists ++ textMaps ++ genMaps ++ enums ++ records0 ++ records2 ++ variants ++ builtinExceptions + units ++ bools ++ ints ++ decimals ++ numeric0s ++ dates ++ timestamps ++ texts ++ parties ++ contractIds ++ optionals ++ lists ++ textMaps ++ genMaps ++ enums ++ records0 ++ records2 ++ variants val expectedOut = """ValueUnit @@ -609,12 +602,6 @@ class HashSpec extends AnyWordSpec with Matchers { | bd89c47c2379a69e8e0d46ff634c533449e8e7e532e84def4e2b2e168bc786e7 |ValueVariant(Some(pkgId:Mod:EitherBis),Left,ValueBool(false)) | 41edeaec86ac919e3c184057b021753781bd2ac1d60b8d4329375f60df953097 - |ValueBuiltinException(,ValueText()) - | 13c6a7b85fcb0443c1d31dafe22561aac714fbaa99d3b9a56474d8dda0c9aee0 - |ValueBuiltinException(someTag,ValueText(someMessage)) - | c7e681e156c80b804a4b105419564e3deb801f3be7ca2ca08fbd81da7a520323 - |ValueBuiltinException(differentTag,ValueInt64(42)) - | c086e55d65a985baaa8d46503905f3711b7390add30d7811f7a7cf93ce6394ad |""".stripMargin val sep = System.getProperty("line.separator") diff --git a/extractor/src/main/scala/com/digitalasset/extractor/writers/postgresql/Queries.scala b/extractor/src/main/scala/com/digitalasset/extractor/writers/postgresql/Queries.scala index dde78d257c..9c00f4854e 100644 --- a/extractor/src/main/scala/com/digitalasset/extractor/writers/postgresql/Queries.scala +++ b/extractor/src/main/scala/com/digitalasset/extractor/writers/postgresql/Queries.scala @@ -286,9 +286,6 @@ object Queries { Fragment.const(if (value) "TRUE" else "FALSE") case r @ V.ValueRecord(_, _) => fr0"${toJsonString(r)}::jsonb" - case _ @V.ValueBuiltinException(_, _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - sys.error("exceptions not supported") case v @ V.ValueVariant(_, _, _) => fr0"${toJsonString(v)}::jsonb" case V.ValueEnum(_, constructor) => diff --git a/ledger-api/grpc-definitions/com/daml/ledger/api/v1/value.proto b/ledger-api/grpc-definitions/com/daml/ledger/api/v1/value.proto index 370ec3b7d5..0d81069cc5 100644 --- a/ledger-api/grpc-definitions/com/daml/ledger/api/v1/value.proto +++ b/ledger-api/grpc-definitions/com/daml/ledger/api/v1/value.proto @@ -80,10 +80,6 @@ message Value { // The GenMap type GenMap gen_map = 18; - -// TODO https://github.com/digital-asset/daml/issues/8020 -// // The BuiltinException type -// BuiltinException builtin_exception = 19; } } diff --git a/ledger-service/http-json/src/test/scala/com/digitalasset/http/util/ApiValueToLfValueConverterTest.scala b/ledger-service/http-json/src/test/scala/com/digitalasset/http/util/ApiValueToLfValueConverterTest.scala index 68434b15d5..523b21b360 100644 --- a/ledger-service/http-json/src/test/scala/com/digitalasset/http/util/ApiValueToLfValueConverterTest.scala +++ b/ledger-service/http-json/src/test/scala/com/digitalasset/http/util/ApiValueToLfValueConverterTest.scala @@ -64,9 +64,6 @@ object ApiValueToLfValueConverterTest { case _: V.ValueCidlessLeaf | V.ValueContractId(_) => fa case r @ V.ValueRecord(_, fields) => r copy (fields = fields map (_ rightMap go)) case v @ V.ValueVariant(_, _, value) => v copy (value = go(value)) - case _ @V.ValueBuiltinException(_, value @ _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - sys.error("exceptions not supported") case V.ValueList(fs) => V.ValueList(fs map go) case V.ValueOptional(o) => V.ValueOptional(o map go) case V.ValueTextMap(m) => V.ValueTextMap(m mapValue go) diff --git a/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/ApiCodecCompressed.scala b/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/ApiCodecCompressed.scala index b79fb452ad..21dcab2cb9 100644 --- a/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/ApiCodecCompressed.scala +++ b/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/ApiCodecCompressed.scala @@ -44,10 +44,6 @@ class ApiCodecCompressed[Cid](val encodeDecimalAsString: Boolean, val encodeInt6 case v: V.ValueVariant[Cid] => apiVariantToJsValue(v) case v: V.ValueEnum => apiEnumToJsValue(v) case v: V.ValueList[Cid] => apiListToJsValue(v) - case _: V.ValueBuiltinException[Cid] => - // TODO https://github.com/digital-asset/daml/issues/8020 - //apiBuiltinExceptionToJsValue(v) - sys.error("exceptions not supported") case V.ValueText(v) => JsString(v) case V.ValueInt64(v) => if (encodeInt64AsString) JsString((v: Long).toString) else JsNumber(v) case V.ValueNumeric(v) => @@ -77,10 +73,6 @@ class ApiCodecCompressed[Cid](val encodeDecimalAsString: Boolean, val encodeInt6 private[this] def apiListToJsValue(value: V.ValueList[Cid]): JsValue = JsArray(value.values.map(apiValueToJsValue(_)).toImmArray.toSeq: _*) - // TODO https://github.com/digital-asset/daml/issues/8020 - /*private[this] def apiBuiltinExceptionToJsValue(value: V.ValueBuiltinException[Cid]): JsValue = - JsonVariant(value.tag, apiValueToJsValue(value.value))*/ - private[this] def apiVariantToJsValue(value: V.ValueVariant[Cid]): JsValue = JsonVariant(value.variant, apiValueToJsValue(value.value)) diff --git a/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/NavigatorModelAliases.scala b/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/NavigatorModelAliases.scala index 29fc56c2fd..afa77903d6 100644 --- a/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/NavigatorModelAliases.scala +++ b/ledger-service/lf-value-json/src/main/scala/com/digitalasset/daml/lf/value/json/NavigatorModelAliases.scala @@ -69,7 +69,6 @@ trait NavigatorModelAliases[Cid] { type ApiValue = OfCid[V] type ApiRecordField = (Option[DamlLfRef.Name], ApiValue) type ApiRecord = OfCid[V.ValueRecord] - type ApiBuiltinException = OfCid[V.ValueBuiltinException] type ApiVariant = OfCid[V.ValueVariant] type ApiList = OfCid[V.ValueList] type ApiOptional = OfCid[V.ValueOptional] diff --git a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala index 2fcf3ba262..cc870f8691 100644 --- a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala +++ b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/participant/util/LfEngineToApi.scala @@ -136,16 +136,6 @@ object LfEngineToApi { vs.toImmArray.toSeq.traverseEitherStrictly(lfValueToApiValue(verbose, _)) map { xs => api.Value(api.Value.Sum.List(api.List(xs))) } - case Lf.ValueBuiltinException(tag @ _, v @ _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - /*lfValueToApiValue(verbose, v) map { x => - api.Value( - api.Value.Sum.BuiltinException( - api.BuiltinException(tag, Some(x)) - ) - ) - }*/ - sys.error("exceptions not supported") case Lf.ValueVariant(tycon, variant, v) => lfValueToApiValue(verbose, v) map { x => api.Value( diff --git a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/store/serialization/KeyHasher.scala b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/store/serialization/KeyHasher.scala index a0d7bf6afb..9bb052a19a 100644 --- a/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/store/serialization/KeyHasher.scala +++ b/ledger/ledger-api-common/src/main/scala/com/digitalasset/platform/store/serialization/KeyHasher.scala @@ -79,15 +79,6 @@ object KeyHasher extends KeyHasher { val z1 = op(z, HashTokenCollectionBegin(0)) op(z1, HashTokenCollectionEnd()) - // Variant: [CollectionBegin(), Text(tag), Token(value), CollectionEnd()] - case ValueBuiltinException(tag @ _, v @ _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - /*val z1 = op(z, HashTokenCollectionBegin(1)) - val z2 = op(z1, HashTokenText(tag)) - val z3 = foldLeft(v, z2, op) - op(z3, HashTokenCollectionEnd())*/ - sys.error("exceptions not supported") - // Variant: [CollectionBegin(), Text(variant), Token(value), CollectionEnd()] case ValueVariant(_, variant, v) => val z1 = op(z, HashTokenCollectionBegin(1)) diff --git a/ledger/participant-state/kvutils/tools/engine-replay/src/replay/scala/ledger/participant/state/kvutils/tools/engine/replay/Adapter.scala b/ledger/participant-state/kvutils/tools/engine-replay/src/replay/scala/ledger/participant/state/kvutils/tools/engine/replay/Adapter.scala index 47b83dbcd3..6043319d70 100644 --- a/ledger/participant-state/kvutils/tools/engine-replay/src/replay/scala/ledger/participant/state/kvutils/tools/engine/replay/Adapter.scala +++ b/ledger/participant-state/kvutils/tools/engine-replay/src/replay/scala/ledger/participant/state/kvutils/tools/engine/replay/Adapter.scala @@ -83,8 +83,6 @@ private[replay] final class Adapter( Value.ValueRecord(tycon.map(adapt), fields.map { case (f, v) => f -> adapt(v) }) case Value.ValueVariant(tycon, variant, value) => Value.ValueVariant(tycon.map(adapt), variant, adapt(value)) - case Value.ValueBuiltinException(tag, value) => - Value.ValueBuiltinException(tag, adapt(value)) case Value.ValueList(values) => Value.ValueList(values.map(adapt)) case Value.ValueOptional(value) => diff --git a/navigator/backend/src/main/scala/com/digitalasset/navigator/json/ApiCodecVerbose.scala b/navigator/backend/src/main/scala/com/digitalasset/navigator/json/ApiCodecVerbose.scala index de72d5325a..8f04c2a764 100644 --- a/navigator/backend/src/main/scala/com/digitalasset/navigator/json/ApiCodecVerbose.scala +++ b/navigator/backend/src/main/scala/com/digitalasset/navigator/json/ApiCodecVerbose.scala @@ -50,10 +50,6 @@ object ApiCodecVerbose { def apiValueToJsValue(value: Model.ApiValue): JsValue = value match { case v: Model.ApiRecord => apiRecordToJsValue(v) case v: Model.ApiVariant => apiVariantToJsValue(v) - case _: Model.ApiBuiltinException => - // TODO https://github.com/digital-asset/daml/issues/8020 - //apiBuiltinExceptionToJsValue(v) - sys.error("exceptions not supported") case v: V.ValueEnum => apiEnumToJsValue(v) case v: Model.ApiList => apiListToJsValue(v) case V.ValueText(v) => JsObject(propType -> JsString(tagText), propValue -> JsString(v)) diff --git a/navigator/backend/src/main/scala/com/digitalasset/navigator/model/converter/LedgerApiV1.scala b/navigator/backend/src/main/scala/com/digitalasset/navigator/model/converter/LedgerApiV1.scala index 51a07c64dd..41034d7938 100644 --- a/navigator/backend/src/main/scala/com/digitalasset/navigator/model/converter/LedgerApiV1.scala +++ b/navigator/backend/src/main/scala/com/digitalasset/navigator/model/converter/LedgerApiV1.scala @@ -430,9 +430,6 @@ case object LedgerApiV1 { case v: Model.ApiList => fillInListTI(v, typ, ctx) case v: Model.ApiRecord => fillInRecordTI(v, typ, ctx) case v: Model.ApiVariant => fillInVariantTI(v, typ, ctx) - case _: Model.ApiBuiltinException => - // TODO https://github.com/digital-asset/daml/issues/8020 - Left(GenericConversionError(s"Exceptions not supported")) } def readCompletion(completion: V1.completion.Completion): Result[Option[Model.CommandStatus]] = { diff --git a/navigator/backend/src/main/scala/com/digitalasset/navigator/query/filter/package.scala b/navigator/backend/src/main/scala/com/digitalasset/navigator/query/filter/package.scala index e2d06e05c2..f072e4ac22 100644 --- a/navigator/backend/src/main/scala/com/digitalasset/navigator/query/filter/package.scala +++ b/navigator/backend/src/main/scala/com/digitalasset/navigator/query/filter/package.scala @@ -217,9 +217,6 @@ package object filter { } } - case V.ValueBuiltinException(_, _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - sys.error("exceptions not supported") } loop(rootArgument, cursor.prev.get) diff --git a/navigator/backend/src/main/scala/com/digitalasset/navigator/query/project/package.scala b/navigator/backend/src/main/scala/com/digitalasset/navigator/query/project/package.scala index c6abad5a0e..16565227bf 100644 --- a/navigator/backend/src/main/scala/com/digitalasset/navigator/query/project/package.scala +++ b/navigator/backend/src/main/scala/com/digitalasset/navigator/query/project/package.scala @@ -223,9 +223,6 @@ object project { Left(TypeCoercionFailure("GenMap index", "int", cursor, cursor.current)) } } - case V.ValueBuiltinException(_, _) => - // TODO https://github.com/digital-asset/daml/issues/8020 - sys.error("exceptions not supported") } loop(rootArgument, cursor.prev.get) }