Daml Finance Dar on Canton

Hi Daml community,

I’m working with Daml Finance and successfully run it on Sandbox and test it with Java code gen. Thanks to this fix.

Now I’m trying to do the same but with Canton. Config, participant, domains etc. I added config flags from the fix and got error:

ERROR c.d.c.CantonCommunityApp$ - GENERIC_CONFIG_ERROR(8,0): Cannot convert configuration to a config of class com.digitalasset.canton.config.CantonCommunityConfig. Failures are:
  at 'canton.domains.mydomain.domain-parameters.protocol-version':
    - (/canton/csd/csd.conf: 49) Unable to convert string dev to a valid CantonVersion. A CantonVersion is similar to a semantic version. For example, '1.2.3' or '1.2.3-SNAPSHOT' are valid CantonVersions.
 err-context:{location=CantonConfig.scala:1355} 

Looks like it is complaining about this particular flag: protocol-version = dev
If I drop this flag, the Canton is running well. But then I try to load dar with Finance Library inside and get:

Uploading /canton/csd/models-0.0.1.dar to ledger:5011
upload-dar did not succeed: "\"DAR_PARSE_ERROR(8,91bea5c7): Failed to parse the dar file content.\""

Is it possible to upload Finance Library dar on Canton ledger? I know that it is not possible to load on Daml Hub for the daml<2.5.0. But I have to ask to be sure.

Here is my Canton config:

# first, turn on non-standard configuration support
canton.parameters.non-standard-config = yes

canton {
    participants {
        custodian {
            storage.type = memory
            admin-api.port = 5012
            ledger-api.port = 5011
            ledger-api.address = 0.0.0.0
        }
        issuer {
            storage.type = memory
            admin-api.port = 5032
            ledger-api.port = 5031
            ledger-api.address = 0.0.0.0
        }

    }
    domains {
        mydomain {
            storage.type = memory
            public-api.port = 5018
            admin-api.port = 5019
            domain-parameters.will-corrupt-your-system-dev-version-support = yes
        }
    }
  // enable ledger_api commands for our getting started guide
  features.enable-testing-commands = yes
}

canton.participants.custodian.parameters = {
    # enable dev version on the participant (this will allow the participant to connect to a domain with dev protocol version)
    will-corrupt-your-system-dev-version-support = yes
    # enable engine lf version support
    unsafe-enable-daml-lf-dev-version = yes
}

canton.participants.issuer.parameters = {
    # enable dev version on the participant (this will allow the participant to connect to a domain with dev protocol version)
    will-corrupt-your-system-dev-version-support = yes
    # enable engine lf version support
    unsafe-enable-daml-lf-dev-version = yes
}

Everything is running via docker-compose. Here is how I start ledger service and ledger-script that upload dar:

  ledger:
    image: digitalasset/canton-open-source
    profiles: ["ledger"]
    volumes:
      - ./canton:/canton/csd
    command:
      daemon -c /canton/csd/csd.conf --bootstrap /canton/csd/csd.canton --log-profile=container

  ledger-script:
      image: digitalasset/daml-sdk:2.4.0
      profiles: ["ledger"]
      depends_on:
        - ledger
      volumes:
        - ./canton:/canton/csd
        - ./config:/canton/csd/config
      command: "bash -c /canton/csd/onboarding.sh"

This command uploads dar. Working inside onboarding.sh:
daml ledger upload-dar "${DAR}" --host ledger --port 5011
I run it for every participant port.

Thanks!

1 Like

Hi @VictorShneer,

While I do not yet see why the suggested dev does not work here, I do now that the exact version you are looking for is 4.0.0, and that value will be accepted. A maybe related note is the daml-finance-app uses sdk-version: 2.5.0-snapshot.20221010.10736.0.2f453a14, but you are pulling the canton version 2.4.x and daml-sdk version 2.4.0. Also daml-sdk is an image I recommend you do not use, especially not for any production purpose.

Kind Regards,
Mate

1 Like

@Mate_Varga Thanks for reply! I made it this way, in docker-compose:
image: digitalasset/canton-open-source:dev
and after it pull the image DAR upload succeded :star_struck:

First I tried
domain-parameters.protocol-version = 4.0.0
under canton config, but he said that only 2.0.0 and 3.0.0 are supported :face_with_diagonal_mouth:

Now I have
Command allocateParty failed: INTERNAL: An error occurred. Please contact the operator and inquire about the request <no-correlation-id>

But this is another story. Thanks for help!

P.S
Yep, I don’t run it in production.

1 Like

Glad that you made it work!

This suggests you were trying to run the config with <2.4.0

For the error you received, I’d first look at the participant node’s logs, you can add --log-file-name /canton/csd/canton.log argument to the canton command to evacuate the full logs from the container, which will be more informative if you also add --debug.

1 Like

Thanks for giving this a try. It made me realize we don’t document how to do this. I’ve opened Document how to deploy Daml Finance to Canton · Issue #479 · digital-asset/daml-finance · GitHub to track.

2 Likes