Greetings!
I am currently experimenting with OSS Daml 3.3.x and the integration with it via the ledger-json-api. So far it had worked quite well, however, one of the latest updates to the daml model I’ve done seems to introduce an error that doesn’t immediately make sense.
To elaborate on the context, I have a “factory“ contract that can create more contracts of another type via a choice, and it also keeps track of the metadata for the issued assets within a Map.
I’ve constructed a ledger-json-api request to exercise the choice on the “factory” contract. I have iterated upon the content of the request in attempts to gather more information on the issue(including changing the daml model), but the final version of a sample request looks like:
{
"commands": [
{
"ExerciseCommand": {
"templateId": "{{packageId}}:{{module}}:{{template}}",
"contractId": "{{tokenFactoryCid}}",
"choice": "Issue",
"choiceArgument": {
"id" : "{{asset.id}}",
"amount" : "{{asset.amount}}",
"to" : "{{recipient}}"
}
}
}
],
"commandId": "{{$randomUUID}}",
"userId": "{{actor}}",
"applicationId": "{{applicationId}}",
"actAs": [
"{{actor}}"
]
}
However, submitting this request to the api yields the following result:
{
"code": "LEDGER_API_INTERNAL_ERROR",
"cause": "class scala.Int$ cannot be cast to class java.lang.Integer (scala.Int$ is in unnamed module of loader 'app'; java.lang.Integer is in module java.base of loader 'bootstrap')",
"correlationId": null,
"traceId": null,
"context": {
"throwableO": "Some(java.lang.ClassCastException: class scala.Int$ cannot be cast to class java.lang.Integer (scala.Int$ is in unnamed module of loader 'app'; java.lang.Integer is in module java.base of loader 'bootstrap'))"
},
"resources": [],
"errorCategory": 4,
"grpcCodeValue": 13,
"retryInfo": null,
"definiteAnswer": false
}
I can confirm that this response is irrelevant to the contents of the choice arguments, as the ledger json api yields the same result regardless of what type the each individual choice argument is (e.g. the type of the amount argument is irrelevant, tested with Int, Decimal and Text).
While debugging, I can confirm that this issue persists in versions from 3.2.x to 3.4.x. Version of java is irrelevant to the issue
Another observation that may be relevant to the case, is that this request can still be performed via daml script. The contract will be created (verified via participant.testing.acs_search), however, querying acs via POST v2/state/active-contracts yields the same error, if activeAtOffset is later than the offset at which the contract was created.
Do you have any suggestions as to where I could obtain a deeper insight into the nature of this error?
If any additional information is required, let me know.
Thanks!