LF: Drop completely the support for LF 0 (#7128)

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Remy 2020-08-13 19:59:07 +02:00 committed by GitHub
parent ec7c53ce6f
commit a890618782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 7 additions and 37 deletions

View File

@ -13,7 +13,6 @@ import qualified DA.Daml.LF.Proto3.DecodeV1 as DecodeV1
decodePayload :: PackageRef -> ArchivePayload -> Either Error Package
decodePayload selfPackageRef payload = case archivePayloadSum payload of
Just ArchivePayloadSumDamlLf0{} -> Left $ ParseError "Payload is DamlLf0"
Just (ArchivePayloadSumDamlLf1 package) -> DecodeV1.decodePackage minor selfPackageRef package
Nothing -> Left $ ParseError "Empty payload"
where

View File

@ -7,7 +7,6 @@ package daml_lf_dev;
option java_package = "com.daml.daml_lf_dev";
option csharp_namespace = "Com.Daml.Daml_Lf_Dev.DamlLf";
import "com/daml/daml_lf_dev/daml_lf_0.proto";
import "com/daml/daml_lf_dev/daml_lf_1.proto";
message ArchivePayload {
@ -16,8 +15,9 @@ message ArchivePayload {
string minor = 3;
reserved 9999; // for the removed "dev" major version
reserved 1; // was daml_lf_0
oneof Sum {
daml_lf_0.Package daml_lf_0 = 1;
daml_lf_1.Package daml_lf_1 = 2;
// lf_2 = 4, lf_3 = 5, etc

View File

@ -1,17 +0,0 @@
// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// DAML-LF-0 was a .proto representation of the DAML core stored in
// the legacy sdaml format. We used it to ease transition between
// sdaml and DAML-LF archives. This stub remains so we can
// successfully decode LFv0 archives and then report that they are
// unsupported.
syntax = "proto3";
package daml_lf_0;
option java_package = "com.daml.daml_lf_dev";
option csharp_namespace = "Com.Daml.Daml_Lf_Dev.DamlLf0";
message Package {
}

View File

@ -123,7 +123,6 @@ object Reader extends Reader[(PackageId, DamlLf.ArchivePayload)] {
import DamlLf.ArchivePayload.{SumCase => SC}
import language.{LanguageMajorVersion => LMV}
lf.getSumCase match {
case SC.DAML_LF_0 => LMV.V0
case SC.DAML_LF_1 => LMV.V1
case SC.SUM_NOT_SET => throw ParseError("Unrecognized LF version")
}

View File

@ -19,13 +19,13 @@ class EngineInfoTest extends WordSpec with Matchers {
"show supported LF, Transaction and Value versions" in {
engineInfoStable.show shouldBe
"DAML LF Engine supports LF versions: 0, 0.dev, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10; Output Value versions: 6"
"DAML LF Engine supports LF versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10; Output Value versions: 6"
engineInfoDev.show shouldBe
"DAML LF Engine supports LF versions: 0, 0.dev, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10, 11; Output Value versions: 6, 7"
"DAML LF Engine supports LF versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10, 11; Output Value versions: 6, 7"
engineInfoLegacy.show shouldBe
"DAML LF Engine supports LF versions: 0, 0.dev, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10, 11; Output Value versions: 6, 7"
"DAML LF Engine supports LF versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.dev; Input Transaction versions: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11; Input Value versions: 1, 2, 3, 4, 5, 6, 7; Output Transaction versions: 10, 11; Output Value versions: 6, 7"
}

View File

@ -21,4 +21,4 @@ LF_VERSION_PACKAGE_DIGITALASSET = {"1.6": "digitalasset", "1.7": "digitalasset",
def lf_version_package(version):
return LF_VERSION_PACKAGE_DIGITALASSET.get(version, "daml")
LF_MAJOR_VERSIONS = ["0", "1"]
LF_MAJOR_VERSIONS = ["1"]

View File

@ -34,15 +34,12 @@ sealed abstract class LanguageMajorVersion(
object LanguageMajorVersion {
// Note that DAML-LF v0 never had and never will have minor versions.
case object V0 extends LanguageMajorVersion(pretty = "0", stableAscending = NonEmptyList(""))
case object V1
extends LanguageMajorVersion(
pretty = "1",
stableAscending = NonEmptyList("0", "1", "2", "3", "4", "5", "6", "7", "8"))
val All: List[LanguageMajorVersion] = List(V0, V1)
val All: List[LanguageMajorVersion] = List(V1)
@deprecated("use All instead", since = "100.12.12")
val supported: List[LanguageMajorVersion] = All

View File

@ -15,9 +15,6 @@ object LanguageVersion {
type Minor = LanguageMinorVersion
val Minor = LanguageMinorVersion
val defaultV0: LanguageVersion =
LanguageVersion(Major.V0, Major.V0.maxSupportedStableMinorVersion)
val defaultV1: LanguageVersion =
LanguageVersion(Major.V1, Major.V1.maxSupportedStableMinorVersion)

View File

@ -12,7 +12,6 @@ class LanguageVersionSpec extends WordSpec with Matchers with TableDrivenPropert
"LanguageVersion.ordering order as expected" in {
val versionInOrder = List(
LV.defaultV0,
LV(LVM.V1, "0"),
LV(LVM.V1, "1"),
LV(LVM.V1, "2"),

View File

@ -39,8 +39,6 @@ object VersionTimeline {
*/
private[lf] val inAscendingOrder: NonEmptyList[Release] =
NonEmptyList(
That(LanguageVersion(LMV.V0, "")),
That(LanguageVersion(LMV.V0, Dev)),
Both(Both(ValueVersion("1"), TransactionVersion("1")), LanguageVersion(LMV.V1, "0")),
Both(Both(ValueVersion("2"), TransactionVersion("2")), LanguageVersion(LMV.V1, "1")),
This(That(TransactionVersion("3"))),

View File

@ -684,7 +684,6 @@ class TypingSpec extends WordSpec with TableDrivenPropertyChecks with Matchers {
val testCases = Table[LV, Boolean](
"LF version" -> "reject",
LV.defaultV0 -> true,
LV(LVM.V1, "0") -> true,
LV(LVM.V1, "1") -> true,
LV(LVM.V1, "2") -> false,
@ -728,7 +727,6 @@ class TypingSpec extends WordSpec with TableDrivenPropertyChecks with Matchers {
val testCases = Table[LV, Boolean](
"LF version" -> "reject",
LV.defaultV0 -> true,
LV(LVM.V1, "0") -> true,
LV(LVM.V1, "1") -> true,
LV(LVM.V1, "2") -> false,