From 87c7da6e9a7de40bd20204326ac77165b3621685 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Mon, 29 Nov 2021 12:29:23 +0100 Subject: [PATCH 1/2] Split daml-lf encode/decode Haskell libraries I was working on limiting the supported input versions in damlc. This requires the list of stable package ids so we can allow those to be decoded even if they are older. However that leads to a cyclical dependency: To get the package ids of the stable packages, I need to encode them. The version check is in the decoder. If those live in the same package, I now end up with a cyclical dependency and Bazel (understandably) gets very sad. This PR splits decoding/encoding into two libraries with the generation of stable packages only depending on encoding. changelog_begin changelog_end --- compiler/daml-lf-proto/BUILD.bazel | 93 ++++++++++-- .../src/DA/Daml/LF/Proto3/Archive.hs | 133 +----------------- .../src/DA/Daml/LF/Proto3/Archive/Decode.hs | 93 ++++++++++++ .../src/DA/Daml/LF/Proto3/Archive/Encode.hs | 43 ++++++ .../src/DA/Daml/LF/Proto3/Util.hs | 17 +++ compiler/damlc/stable-packages/BUILD.bazel | 4 +- .../lib/DA/Daml/StablePackages.hs | 2 +- .../src/GenerateStablePackage.hs | 2 +- 8 files changed, 246 insertions(+), 141 deletions(-) create mode 100644 compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Decode.hs create mode 100644 compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Encode.hs diff --git a/compiler/daml-lf-proto/BUILD.bazel b/compiler/daml-lf-proto/BUILD.bazel index 6b09c3a79841..03ab9289a4c7 100644 --- a/compiler/daml-lf-proto/BUILD.bazel +++ b/compiler/daml-lf-proto/BUILD.bazel @@ -4,28 +4,105 @@ load("//bazel_tools:haskell.bzl", "da_haskell_library") da_haskell_library( - name = "daml-lf-proto", - srcs = glob(["src/**/*.hs"]), + name = "daml-lf-util", + srcs = + [ + "src/DA/Daml/LF/Mangling.hs", + "src/DA/Daml/LF/Proto3/Error.hs", + "src/DA/Daml/LF/Proto3/Util.hs", + ], hackage_deps = [ "base", "bytestring", - "containers", - "cryptonite", "either", + "text", + ], + deps = [ + "//compiler/daml-lf-ast", + "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", + ], +) + +da_haskell_library( + name = "daml-lf-proto-decode", + srcs = [ + "src/DA/Daml/LF/Proto3/Archive/Decode.hs", + "src/DA/Daml/LF/Proto3/Decode.hs", + "src/DA/Daml/LF/Proto3/DecodeV1.hs", + ], + hackage_deps = [ + "base", + "containers", "lens", + "cryptonite", "memory", + "bytestring", "mtl", "proto3-suite", - "scientific", - "template-haskell", "text", - "transformers", + "vector", + ], + visibility = ["//visibility:public"], + deps = [ + ":daml-lf-util", + "//compiler/daml-lf-ast", + "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", + "//libs-haskell/da-hs-base", + ], +) + +da_haskell_library( + name = "daml-lf-proto-encode", + srcs = [ + "src/DA/Daml/LF/Proto3/Archive/Encode.hs", + "src/DA/Daml/LF/Proto3/Encode.hs", + "src/DA/Daml/LF/Proto3/EncodeV1.hs", + ], + hackage_deps = [ + "base", + "bytestring", + "cryptonite", + "memory", + "containers", + "mtl", + "lens", + "text", + "vector", + "proto3-suite", "unordered-containers", + ], + visibility = ["//visibility:public"], + deps = [ + ":daml-lf-util", + "//compiler/daml-lf-ast", + "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", + "//libs-haskell/da-hs-base", + ], +) + +da_haskell_library( + name = "daml-lf-proto", + srcs = [ + "src/DA/Daml/LF/Proto3/Archive.hs", + ], + hackage_deps = [ + "base", + "containers", + "cryptonite", + "memory", + "bytestring", + "mtl", + "lens", + "text", "vector", + "proto3-suite", + "unordered-containers", ], - src_strip_prefix = "src", visibility = ["//visibility:public"], deps = [ + ":daml-lf-proto-decode", + ":daml-lf-proto-encode", + ":daml-lf-util", "//compiler/daml-lf-ast", "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", "//libs-haskell/da-hs-base", diff --git a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive.hs b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive.hs index aecc048aa346..284fe998b595 100644 --- a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive.hs +++ b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive.hs @@ -1,136 +1,11 @@ -- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -- SPDX-License-Identifier: Apache-2.0 - -- | Utilities for working with DAML-LF protobuf archives module DA.Daml.LF.Proto3.Archive - ( decodeArchive - , decodeArchivePackageId - , decodePackage - , encodeArchive - , encodeArchiveLazy - , encodeArchiveAndHash - , encodePackageHash - , ArchiveError(..) - , DecodingMode(..) + ( module DA.Daml.LF.Proto3.Archive.Decode + , module DA.Daml.LF.Proto3.Archive.Encode ) where -import Control.Lens (over, _Left) -import qualified "cryptonite" Crypto.Hash as Crypto -import qualified Com.Daml.DamlLfDev.DamlLf as ProtoLF -import Control.Monad -import Data.List -import DA.Pretty -import qualified DA.Daml.LF.Ast as LF -import qualified DA.Daml.LF.Proto3.Decode as Decode -import qualified DA.Daml.LF.Proto3.Encode as Encode -import qualified Data.ByteArray as BA -import qualified Data.ByteString as BS -import qualified Data.ByteString.Lazy as BSL -import Data.Int -import qualified Data.Text as T -import qualified Data.Text.Lazy as TL -import qualified Numeric -import qualified Proto3.Suite as Proto - -data ArchiveError - = ProtobufError !String - | UnknownHashFunction !Int32 - | HashMismatch !T.Text !T.Text - deriving (Eq, Show) - --- | Mode in which to decode the DALF. Currently, this only decides whether --- to rewrite occurrences of `PRSelf` with `PRImport packageId`. -data DecodingMode - = DecodeAsMain - -- ^ Keep occurrences of `PRSelf` as is. - | DecodeAsDependency - -- ^ Replace `PRSelf` with `PRImport packageId`, where `packageId` is - -- the id of the package being decoded. - deriving (Eq, Show) - --- | Decode an LF archive, returning the package-id and the package -decodeArchive :: DecodingMode -> BS.ByteString -> Either ArchiveError (LF.PackageId, LF.Package) -decodeArchive mode bytes = do - (packageId, payloadBytes) <- decodeArchiveHeader bytes - package <- decodePackage mode packageId payloadBytes - return (packageId, package) - --- | Decode an LF archive payload, returning the package --- Used to decode a BS returned from the PackageService ledger API -decodePackage :: DecodingMode -> LF.PackageId -> BS.ByteString -> Either ArchiveError LF.Package -decodePackage mode packageId payloadBytes = do - let selfPackageRef = case mode of - DecodeAsMain -> LF.PRSelf - DecodeAsDependency -> LF.PRImport packageId - payload <- over _Left (ProtobufError . show) $ Proto.fromByteString payloadBytes - over _Left (ProtobufError. show) $ Decode.decodePayload selfPackageRef payload - --- | Decode an LF archive header, returning the package-id and the payload -decodeArchiveHeader :: BS.ByteString -> Either ArchiveError (LF.PackageId, BS.ByteString) -decodeArchiveHeader bytes = do - archive <- over _Left (ProtobufError . show) $ Proto.fromByteString bytes - let payloadBytes = ProtoLF.archivePayload archive - let archiveHash = TL.toStrict (ProtoLF.archiveHash archive) - - computedHash <- case ProtoLF.archiveHashFunction archive of - Proto.Enumerated (Right ProtoLF.HashFunctionSHA256) -> - Right $ encodeHash (BA.convert (Crypto.hash @_ @Crypto.SHA256 payloadBytes) :: BS.ByteString) - Proto.Enumerated (Left idx) -> - Left (UnknownHashFunction idx) - - when (computedHash /= archiveHash) $ - Left (HashMismatch archiveHash computedHash) - let packageId = LF.PackageId archiveHash - pure (packageId, payloadBytes) - --- | Decode an LF archive, returning the package-id -decodeArchivePackageId :: BS.ByteString -> Either ArchiveError LF.PackageId -decodeArchivePackageId = fmap fst . decodeArchiveHeader - --- | Encode a LFv1 package payload into a DAML-LF archive using the default --- hash function. -encodeArchiveLazy :: LF.Package -> BSL.ByteString -encodeArchiveLazy = fst . encodeArchiveAndHash - -encodePackageHash :: LF.Package -> LF.PackageId -encodePackageHash = snd . encodeArchiveAndHash - -encodeArchiveAndHash :: LF.Package -> (BSL.ByteString, LF.PackageId) -encodeArchiveAndHash package = - let payload = BSL.toStrict $ Proto.toLazyByteString $ Encode.encodePayload package - hash = encodeHash (BA.convert (Crypto.hash @_ @Crypto.SHA256 payload) :: BS.ByteString) - archive = - ProtoLF.Archive - { ProtoLF.archivePayload = payload - , ProtoLF.archiveHash = TL.fromStrict hash - , ProtoLF.archiveHashFunction = Proto.Enumerated (Right ProtoLF.HashFunctionSHA256) - } - in (Proto.toLazyByteString archive, LF.PackageId hash) - -encodeArchive :: LF.Package -> BS.ByteString -encodeArchive = BSL.toStrict . encodeArchiveLazy - --- | Encode the hash bytes of the payload in the canonical --- lower-case ascii7 hex presentation. -encodeHash :: BS.ByteString -> T.Text -encodeHash = T.pack . reverse . foldl' toHex [] . BS.unpack - where - toHex xs c = - case Numeric.showHex c "" of - [n1, n2] -> n2 : n1 : xs - [n2] -> n2 : '0' : xs - _ -> error "impossible: showHex returned [] on Word8" - -instance Pretty ArchiveError where - pPrint = - \case - ProtobufError e -> "Protobuf error: " <> pretty e - UnknownHashFunction i -> - "Unknown hash function with identifier " <> pretty i - HashMismatch h1 h2 -> - vsep - [ "Computed package hash doesn't match with given package hash: " - , label_ "Package hash: " $ pretty h1 - , label_ "Computed hash: " $ pretty h2 - ] +import DA.Daml.LF.Proto3.Archive.Decode +import DA.Daml.LF.Proto3.Archive.Encode diff --git a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Decode.hs b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Decode.hs new file mode 100644 index 000000000000..32576dda8688 --- /dev/null +++ b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Decode.hs @@ -0,0 +1,93 @@ +-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +-- SPDX-License-Identifier: Apache-2.0 + +module DA.Daml.LF.Proto3.Archive.Decode + ( decodeArchive + , decodeArchivePackageId + , decodePackage + , ArchiveError(..) + , DecodingMode(..) + ) where + +import Control.Lens (over, _Left) +import qualified "cryptonite" Crypto.Hash as Crypto +import qualified Com.Daml.DamlLfDev.DamlLf as ProtoLF +import Control.Monad +import DA.Pretty +import qualified DA.Daml.LF.Ast as LF +import qualified DA.Daml.LF.Proto3.Decode as Decode +import DA.Daml.LF.Proto3.Util (encodeHash) +import qualified Data.ByteArray as BA +import qualified Data.ByteString as BS +import Data.Int +import qualified Data.Text as T +import qualified Data.Text.Lazy as TL +import qualified Proto3.Suite as Proto + +data ArchiveError + = ProtobufError !String + | UnknownHashFunction !Int32 + | HashMismatch !T.Text !T.Text + deriving (Eq, Show) + +-- | Mode in which to decode the DALF. Currently, this only decides whether +-- to rewrite occurrences of `PRSelf` with `PRImport packageId`. +data DecodingMode + = DecodeAsMain + -- ^ Keep occurrences of `PRSelf` as is. + | DecodeAsDependency + -- ^ Replace `PRSelf` with `PRImport packageId`, where `packageId` is + -- the id of the package being decoded. + deriving (Eq, Show) + +-- | Decode an LF archive, returning the package-id and the package +decodeArchive :: DecodingMode -> BS.ByteString -> Either ArchiveError (LF.PackageId, LF.Package) +decodeArchive mode bytes = do + (packageId, payloadBytes) <- decodeArchiveHeader bytes + package <- decodePackage mode packageId payloadBytes + return (packageId, package) + +-- | Decode an LF archive payload, returning the package +-- Used to decode a BS returned from the PackageService ledger API +decodePackage :: DecodingMode -> LF.PackageId -> BS.ByteString -> Either ArchiveError LF.Package +decodePackage mode packageId payloadBytes = do + let selfPackageRef = case mode of + DecodeAsMain -> LF.PRSelf + DecodeAsDependency -> LF.PRImport packageId + payload <- over _Left (ProtobufError . show) $ Proto.fromByteString payloadBytes + over _Left (ProtobufError. show) $ Decode.decodePayload selfPackageRef payload + +-- | Decode an LF archive header, returning the package-id and the payload +decodeArchiveHeader :: BS.ByteString -> Either ArchiveError (LF.PackageId, BS.ByteString) +decodeArchiveHeader bytes = do + archive <- over _Left (ProtobufError . show) $ Proto.fromByteString bytes + let payloadBytes = ProtoLF.archivePayload archive + let archiveHash = TL.toStrict (ProtoLF.archiveHash archive) + + computedHash <- case ProtoLF.archiveHashFunction archive of + Proto.Enumerated (Right ProtoLF.HashFunctionSHA256) -> + Right $ encodeHash (BA.convert (Crypto.hash @_ @Crypto.SHA256 payloadBytes) :: BS.ByteString) + Proto.Enumerated (Left idx) -> + Left (UnknownHashFunction idx) + + when (computedHash /= archiveHash) $ + Left (HashMismatch archiveHash computedHash) + let packageId = LF.PackageId archiveHash + pure (packageId, payloadBytes) + +-- | Decode an LF archive, returning the package-id +decodeArchivePackageId :: BS.ByteString -> Either ArchiveError LF.PackageId +decodeArchivePackageId = fmap fst . decodeArchiveHeader + +instance Pretty ArchiveError where + pPrint = + \case + ProtobufError e -> "Protobuf error: " <> pretty e + UnknownHashFunction i -> + "Unknown hash function with identifier " <> pretty i + HashMismatch h1 h2 -> + vsep + [ "Computed package hash doesn't match with given package hash: " + , label_ "Package hash: " $ pretty h1 + , label_ "Computed hash: " $ pretty h2 + ] diff --git a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Encode.hs b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Encode.hs new file mode 100644 index 000000000000..0d4661de9614 --- /dev/null +++ b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Archive/Encode.hs @@ -0,0 +1,43 @@ +-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +-- SPDX-License-Identifier: Apache-2.0 + +module DA.Daml.LF.Proto3.Archive.Encode + ( encodeArchive + , encodeArchiveLazy + , encodeArchiveAndHash + , encodePackageHash + ) where + +import qualified "cryptonite" Crypto.Hash as Crypto +import qualified Com.Daml.DamlLfDev.DamlLf as ProtoLF +import qualified DA.Daml.LF.Ast as LF +import qualified DA.Daml.LF.Proto3.Encode as Encode +import DA.Daml.LF.Proto3.Util (encodeHash) +import qualified Data.ByteArray as BA +import qualified Data.ByteString as BS +import qualified Data.ByteString.Lazy as BSL +import qualified Data.Text.Lazy as TL +import qualified Proto3.Suite as Proto + +-- | Encode a LFv1 package payload into a DAML-LF archive using the default +-- hash function. +encodeArchiveLazy :: LF.Package -> BSL.ByteString +encodeArchiveLazy = fst . encodeArchiveAndHash + +encodePackageHash :: LF.Package -> LF.PackageId +encodePackageHash = snd . encodeArchiveAndHash + +encodeArchiveAndHash :: LF.Package -> (BSL.ByteString, LF.PackageId) +encodeArchiveAndHash package = + let payload = BSL.toStrict $ Proto.toLazyByteString $ Encode.encodePayload package + hash = encodeHash (BA.convert (Crypto.hash @_ @Crypto.SHA256 payload) :: BS.ByteString) + archive = + ProtoLF.Archive + { ProtoLF.archivePayload = payload + , ProtoLF.archiveHash = TL.fromStrict hash + , ProtoLF.archiveHashFunction = Proto.Enumerated (Right ProtoLF.HashFunctionSHA256) + } + in (Proto.toLazyByteString archive, LF.PackageId hash) + +encodeArchive :: LF.Package -> BS.ByteString +encodeArchive = BSL.toStrict . encodeArchiveLazy diff --git a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Util.hs b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Util.hs index 136df2e13284..a9179719390d 100644 --- a/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Util.hs +++ b/compiler/daml-lf-proto/src/DA/Daml/LF/Proto3/Util.hs @@ -10,11 +10,16 @@ module DA.Daml.LF.Proto3.Util ( EitherLike, toEither, fromEither, + encodeHash, ) where +import qualified Data.ByteString as BS import Data.Int +import Data.List +import qualified Data.Text as T import qualified Data.Text.Lazy as TL import GHC.Generics +import qualified Numeric import qualified Com.Daml.DamlLfDev.DamlLf1 as P @@ -69,3 +74,15 @@ instance EitherLike P.DottedName Int32 P.DefTemplateTycon instance EitherLike P.DottedName Int32 P.DefTypeSynName instance EitherLike P.DottedName Int32 P.DefDataTypeName instance EitherLike P.DottedName Int32 P.ModuleName + + +-- | Encode the hash bytes of the payload in the canonical +-- lower-case ascii7 hex presentation. +encodeHash :: BS.ByteString -> T.Text +encodeHash = T.pack . reverse . foldl' toHex [] . BS.unpack + where + toHex xs c = + case Numeric.showHex c "" of + [n1, n2] -> n2 : n1 : xs + [n2] -> n2 : '0' : xs + _ -> error "impossible: showHex returned [] on Word8" diff --git a/compiler/damlc/stable-packages/BUILD.bazel b/compiler/damlc/stable-packages/BUILD.bazel index f44f80cde86f..fc65a2c9c220 100644 --- a/compiler/damlc/stable-packages/BUILD.bazel +++ b/compiler/damlc/stable-packages/BUILD.bazel @@ -15,7 +15,7 @@ da_haskell_library( visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", - "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-encode", "//compiler/damlc/daml-lf-util", "//libs-haskell/da-hs-base", ], @@ -36,7 +36,7 @@ da_haskell_binary( deps = [ ":stable-packages-lib", "//compiler/daml-lf-ast", - "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-encode", "//libs-haskell/da-hs-base", ], ) diff --git a/compiler/damlc/stable-packages/lib/DA/Daml/StablePackages.hs b/compiler/damlc/stable-packages/lib/DA/Daml/StablePackages.hs index e8558d697ee6..4e4bd6e236ff 100644 --- a/compiler/damlc/stable-packages/lib/DA/Daml/StablePackages.hs +++ b/compiler/damlc/stable-packages/lib/DA/Daml/StablePackages.hs @@ -14,7 +14,7 @@ import qualified Data.NameMap as NM import qualified Data.Text as T import DA.Daml.LF.Ast -import DA.Daml.LF.Proto3.Archive +import DA.Daml.LF.Proto3.Archive.Encode import DA.Daml.UtilLF allStablePackages :: [Package] diff --git a/compiler/damlc/stable-packages/src/GenerateStablePackage.hs b/compiler/damlc/stable-packages/src/GenerateStablePackage.hs index 0ad279bba13e..32f7028cb0df 100644 --- a/compiler/damlc/stable-packages/src/GenerateStablePackage.hs +++ b/compiler/damlc/stable-packages/src/GenerateStablePackage.hs @@ -11,7 +11,7 @@ import Options.Applicative import qualified Data.Text as T import DA.Daml.LF.Ast -import DA.Daml.LF.Proto3.Archive +import DA.Daml.LF.Proto3.Archive.Encode import DA.Daml.StablePackages data Opts = Opts From 7f681adae78925d3b5d9414dcaa83a67a1038a4e Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Mon, 29 Nov 2021 13:01:01 +0100 Subject: [PATCH 2/2] Fix dependants changelog_begin changelog_end --- compiler/daml-lf-proto/BUILD.bazel | 1 + compiler/damlc/daml-ide-core/BUILD.bazel | 2 ++ compiler/damlc/tests/BUILD.bazel | 2 +- compiler/repl-service/client/BUILD.bazel | 2 +- compiler/scenario-service/client/BUILD.bazel | 3 ++- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/daml-lf-proto/BUILD.bazel b/compiler/daml-lf-proto/BUILD.bazel index 03ab9289a4c7..51165c17416d 100644 --- a/compiler/daml-lf-proto/BUILD.bazel +++ b/compiler/daml-lf-proto/BUILD.bazel @@ -17,6 +17,7 @@ da_haskell_library( "either", "text", ], + visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", diff --git a/compiler/damlc/daml-ide-core/BUILD.bazel b/compiler/damlc/daml-ide-core/BUILD.bazel index 52a79a6f82a5..b08a8285914e 100644 --- a/compiler/damlc/daml-ide-core/BUILD.bazel +++ b/compiler/damlc/daml-ide-core/BUILD.bazel @@ -54,6 +54,8 @@ da_haskell_library( "//:sdk-version-hs-lib", "//compiler/daml-lf-ast", "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-decode", + "//compiler/daml-lf-proto:daml-lf-proto-encode", "//compiler/daml-lf-reader", "//compiler/daml-lf-tools", "//compiler/damlc/daml-doctest", diff --git a/compiler/damlc/tests/BUILD.bazel b/compiler/damlc/tests/BUILD.bazel index ef07d6bcd510..f7c13cea3c6d 100644 --- a/compiler/damlc/tests/BUILD.bazel +++ b/compiler/damlc/tests/BUILD.bazel @@ -168,7 +168,7 @@ da_haskell_library( visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", - "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-encode", "//compiler/damlc/daml-compiler", "//compiler/damlc/daml-ide-core", "//compiler/damlc/daml-lf-util", diff --git a/compiler/repl-service/client/BUILD.bazel b/compiler/repl-service/client/BUILD.bazel index f7c6379dac60..a321c35a33a7 100644 --- a/compiler/repl-service/client/BUILD.bazel +++ b/compiler/repl-service/client/BUILD.bazel @@ -41,7 +41,7 @@ da_haskell_library( visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", - "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-encode", "//compiler/repl-service/protos:repl_service_haskell_proto", "//daml-assistant:daml-project-config", "//libs-haskell/bazel-runfiles", diff --git a/compiler/scenario-service/client/BUILD.bazel b/compiler/scenario-service/client/BUILD.bazel index d32d2bb76145..5f60e07dc24c 100644 --- a/compiler/scenario-service/client/BUILD.bazel +++ b/compiler/scenario-service/client/BUILD.bazel @@ -41,7 +41,8 @@ da_haskell_library( visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", - "//compiler/daml-lf-proto", + "//compiler/daml-lf-proto:daml-lf-proto-encode", + "//compiler/daml-lf-proto:daml-lf-util", "//compiler/damlc/daml-opts:daml-opts-types", "//compiler/scenario-service/protos:scenario_service_haskell_proto", "//daml-assistant:daml-project-config",