Skip to content

Commit

Permalink
[Backport] Add daml-stdlib packages for whitelisting (#20299) (#20308)
Browse files Browse the repository at this point in the history
Co-authored-by: dylant-da <[email protected]>
  • Loading branch information
remyhaemmerle-da and dylant-da authored Nov 15, 2024
1 parent 6fdc079 commit ecaedd4
Show file tree
Hide file tree
Showing 4 changed files with 1,316 additions and 664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PackageUpgradeValidator(
logger.info(
s"Uploading DAR file for $uploadedPackageIdWithMeta in submission ID ${loggingContext.serializeFiltered("submissionId")}."
)
if (uploadedPackageAst.isInvalidDamlPrim(uploadedPackageId)) {
if (uploadedPackageAst.isInvalidDamlPrimOrStdlib(uploadedPackageId)) {
EitherT.leftT[Future, Unit](
Validation.UpgradeDamlPrimIsNotAUtilityPackage
.Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,15 +1238,24 @@ object Ast {
private val isUtilityPackage: Boolean,
) {
def supportsUpgrades(pkgId: Ref.PackageId) =
LanguageVersion.supportsPackageUpgrades(languageVersion) && (!UtilityDamlPrimPackages.check(
LanguageVersion
.supportsPackageUpgrades(languageVersion) && (!UtilityDamlPackages.checkDamlPrim(
pkgId
) && !UtilityDamlPackages.checkDamlStdlib(
pkgId
) && !isUtilityPackage)
def isInvalidDamlPrim(pkgId: Ref.PackageId) =
def isInvalidDamlPrimOrStdlib(pkgId: Ref.PackageId) =
if (metadata.name == "daml-prim") {
if (!LanguageVersion.supportsPackageUpgrades(languageVersion)) {
false
} else {
!isUtilityPackage && !UtilityDamlPrimPackages.check(pkgId)
!isUtilityPackage && !UtilityDamlPackages.checkDamlPrim(pkgId)
}
} else if (metadata.name == "daml-stdlib") {
if (!LanguageVersion.supportsPackageUpgrades(languageVersion)) {
false
} else {
!isUtilityPackage && !UtilityDamlPackages.checkDamlStdlib(pkgId)
}
} else {
false
Expand Down
Loading

0 comments on commit ecaedd4

Please sign in to comment.