Command allocateParty failed

As described here Daml Script — Daml SDK 1.18.1 documentation, I am trying to run daml script against a postgresql ledger that has --auth-jwt-rs256-crt enabled.

I am getting the error:

Command allocateParty failed: DEADLINE_EXCEEDED: REQUEST_TIME_OUT(3,MYID-3c9): Request timed out

In the daml on sql logs:

15:28:53.201 [daml.index.db.threadpool.connection.sandbox-0] WARN c.d.p.s.stores.ledger.sql.SqlLedger - Ignoring duplicate party submission with ID for submissionId Some(-3c9b2ad9-6200-4356-9c57-178d30a259e6) , context: {participantId: “daml-on-sql”, party: “”, submissionId: “-3c9b2ad9-6200-4356-9c57-178d30a259e6”}

In my participants.json I have:

{
    "default_participant": {"host": "localhost", "port": 6865, "application_id": "<APPID>", "access_token": "<access_token>"},

    "participants": {
        "one": {"host": "localhost", "port": 6865, "application_id": "<APPID>", "access_token": "<myid_access_token>"}
    },
    "party_participants": {"<MYID>": "one"}
}

and in my script I have:

testJWT : Script ()
testJWT = do
  myid <- allocatePartyWithHint "MYID" (PartyIdHint "MYID")
  submit myid do
    createCmd SampleTemplate with
      p1 = myid
      observers = [myid]
      id = "mytest"
  pure()

which I am running with:

daml script --dar .daml/dist/MYPROJ-0.1.0.dar --script-name MyScript:testJWT --access-token-file=./jwt_token_admin --participant-config participants.json

(I have successfully run daml upload-jar --access-token-file=./jwt_token_admin)

Do I need to remove the myid <- allocatePartyWithHint "MYID" (PartyIdHint "MYID") line? If so how do I reference the myid party?

Does the participants.json file automatically allocate parties to the ledger by the default_participant?

Also, without the script, do parties need to be explicitly allocated or do they just need the appropriate jwt token signed by the rsa private key?

Does the participants.json file automatically allocate parties to the ledger by the default_participant?

No the parties are not allocated automatically.

When working with a ledger with authorization, I’d generally recommend to split your script into two: The first performs the admin operations and only those, e.g., party allocation. You then return the allocated parties and other info in the result type and write out the result via --output-file. This script only needs an admin token. Then you have a second script which accepts the result of the first one via --input-file and performs per party operations. The docs have an example of that Daml Script — Daml SDK 2.7.6 documentation.

That said, deadline exceeded shouldn’t be caused by auth issues. Can you reproduce your issue against SDK 2.2?

1 Like

Teasing it out into two portions seemed to resolve the issue.

However, I haven’t isolated what caused the DEADLINE_EXCEEDED message.

I will try reproducing it again when we upgrade to daml 2.

1 Like