Prevent uploading dar if preexisting existing deployed dar with same package name

I was thinking of writing a simple shell script that would wrap daml ledger upload-dar that would not upload the dar if a package with the same package name has already been uploaded.

As I’ve experienced, having multiple dars with the same package name means that all client software that doesn’t reference the package id wouldn’t be able to read any of the contracts.

It occurred to me that such functionality may be needed enough that it might already be included in daml or there might be an existing solution. Is there such a solution or is there a better way of managing packages?

Hi @tiw,

I think it’s actually better to think of this the other way around: all clients should always specify the full package ID. The norm is to have multiple packages with the same name.

The only exception to that is a development feature of the JSON API that accepts package names without their full Id to facilitate ad-hoc query such as curl commands.

To clarify, client code should always use full Package IDs, so this should not be a common issue.

1 Like