[LF] drop proto LF 1 archives (#18581)

This commit is contained in:
Remy 2024-02-27 16:02:45 +01:00 committed by GitHub
parent 3f365b1ca9
commit 979bcd9eca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 7 additions and 1916 deletions

View File

@ -33,8 +33,6 @@ decodeLfVersion major pkgId minorText = do
decodePayload ::
PackageId -> PackageRef -> ArchivePayload -> Either Error Package
decodePayload pkgId selfPackageRef payload = case archivePayloadSum payload of
Just (ArchivePayloadSumDamlLf1 _package) ->
Left $ ParseError "Daml-LF v1 is not supported"
Just (ArchivePayloadSumDamlLf2 package) -> do
version <- decodeLfVersion LF.V2 pkgId minorText
DecodeV2.decodePackage version selfPackageRef package

View File

@ -21,7 +21,7 @@ import qualified Data.ByteString as BS
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import qualified Data.Set as S
import qualified Com.Daml.DamlLfDev.DamlLf1 as LF1
import qualified Com.Daml.DamlLfDev.DamlLf2 as LF2
import qualified Data.Map.Strict as M
import Data.Maybe (mapMaybe)
import Data.Foldable (fold)
@ -141,10 +141,10 @@ instance Protobuf TR.TestResults TestResults where
(mapToVec exercised)
instance Protobuf TR.PackageId PackageId where
decode (TR.PackageId (Just (TR.PackageIdVarietyLocal LF1.Unit))) = Just LocalPackageId
decode (TR.PackageId (Just (TR.PackageIdVarietyLocal LF2.Unit))) = Just LocalPackageId
decode (TR.PackageId (Just (TR.PackageIdVarietyExternal (TR.PackageId_ExternalPackageId id name)))) = Just (ExternalPackageId (TL.toStrict id) (TL.toStrict name))
decode _ = Nothing
encode LocalPackageId = TR.PackageId (Just (TR.PackageIdVarietyLocal LF1.Unit))
encode LocalPackageId = TR.PackageId (Just (TR.PackageIdVarietyLocal LF2.Unit))
encode (ExternalPackageId ext name) = TR.PackageId (Just (TR.PackageIdVarietyExternal (TR.PackageId_ExternalPackageId (TL.fromStrict ext) (TL.fromStrict name))))
saveTestResults :: FilePath -> TestResults -> IO ()

View File

@ -4,7 +4,7 @@
syntax = "proto3";
package daml_lf_dev;
import "com/daml/daml_lf_dev/daml_lf1.proto";
import "com/daml/daml_lf_dev/daml_lf2.proto";
import "scenario_service.proto";
message TestResults {

View File

@ -69,10 +69,7 @@ genrule(
name = "daml_lf_dev_archive_haskell_proto_src",
srcs = ["daml_lf_dev_archive_proto_srcs"],
outs = ["Com/Daml/DamlLfDev/DamlLf.hs"] +
["Com/Daml/DamlLfDev/DamlLf%s.hs" % v.title() for v in [
"1",
"2",
]],
["Com/Daml/DamlLfDev/DamlLf%s.hs" % v.title() for v in ["2"]],
cmd =
"\n".join(
[
@ -82,10 +79,7 @@ genrule(
--proto com/daml/daml_lf_dev/daml_lf%s.proto \
--out $(@D)
""" % vx
for vx in [""] + ["%s" % v for v in [
"1",
"2",
]]
for vx in [""] + ["%s" % v for v in ["2"]]
],
),
tools = [

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_lf1.proto";
import "com/daml/daml_lf_dev/daml_lf2.proto";
message ArchivePayload {
@ -15,13 +14,10 @@ message ArchivePayload {
// Daml-LF v0 and v1 before we had minor versions.
string minor = 3;
reserved 9999; // for the removed "dev" major version
reserved 1; // was daml_lf_0
oneof Sum {
daml_lf_1.Package daml_lf_1 = 2;
daml_lf_2.Package daml_lf_2 = 4;
// lf_3 = 5, lf_4 = 6, etc
}
}

View File

@ -49,12 +49,10 @@ object Reader {
lf: DamlLf.ArchivePayload
): Either[Error, LanguageMajorVersion] =
lf.getSumCase match {
case DamlLf.ArchivePayload.SumCase.DAML_LF_1 =>
Left(Error.Parsing("Unsupported LF version"))
case DamlLf.ArchivePayload.SumCase.DAML_LF_2 =>
Right(LanguageMajorVersion.V2)
case DamlLf.ArchivePayload.SumCase.SUM_NOT_SET =>
Left(Error.Parsing("Unrecognized LF version"))
Left(Error.Parsing("Unrecognized or Unsupported LF version"))
}
// Validate hash and version of a DamlLf.ArchivePayload

View File

@ -34,7 +34,6 @@ export LANG=C
$DIFF -u <(unzip -Z1 $PROTOS | $SORT | sed 's|^[^/]*/||g') <((cat <<EOF
com/daml/daml_lf_dev/daml_lf.proto
com/daml/daml_lf_dev/daml_lf1.proto
com/daml/daml_lf_dev/daml_lf2.proto
com/daml/ledger/api/v1/active_contracts_service.proto
com/daml/ledger/api/v1/admin/config_management_service.proto