Open dasormeter opened 1 year ago
The --sdk-version
is different across the two examples. Can you please check this doesn't make a difference? From the error I suspect it might also be beneficial to increase the logging level.
I had a quick look into this and it looks like the problem is that the daml
assistant doesn't forward the ssl configuration to the export jar. In the snippet below, you can see that ledgerFlags
only has --host
and --port
(plus --max-inbound-message-size
if present in the args to the assistant) but crucially it lacks --tls
, --cacrt
and --access-token-file
, even though they should be available in the output of getDefaultArgs
.
The fix should be a matter of adding the missing flags in ledgerFlags
depending on the result of getDefaultArgs
I had a quick look into this and it looks like the problem is that the
daml
assistant doesn't forward the ssl configuration to the export jar. In the snippet below, you can see thatledgerFlags
only has--host
and--port
(plus--max-inbound-message-size
if present in the args to the assistant) but crucially it lacks--tls
,--cacrt
and--access-token-file
, even though they should be available in the output ofgetDefaultArgs
.The fix should be a matter of adding the missing flags in
ledgerFlags
depending on the result ofgetDefaultArgs
Thanks @akrmn -- why not just pass through all the getDefaultArgs
here? is it dropping the other passed through values as well (--access-token-file
, --party
, --start
, --end
, --sdk-version
, etc?)
❯ daml ledger export script --help
Usage: script-export [script] [options]
--help Show this help message.
--host <value> Daml ledger host to connect to.
--port <value> Daml ledger port to connect to.
--pem <value> TLS: The pem file to be used as the private key.
--crt <value> TLS: The crt file to be used as the cert chain.
Required for client authentication.
--cacrt <value> TLS: The crt file to be used as the trusted root CA.
--tls TLS: Enable tls. This is redundant if --pem, --crt or --cacrt are set
--access-token-file <value>
File from which the access token will be read, required to interact with an authenticated ledger.
--party <value> Export ledger state as seen by these parties. Pass --party multiple times or use a comma-separated list of party names to specify multiple parties. Use either --party or --all-parties but not both.
--all-parties Export ledger state as seen by all known parties. Use either --party or --all-parties but not both.
--start <value> The transaction offset (exclusive) for the start position of the export. Optional, by default the export includes the beginning of the ledger.
--end <value> The transaction offset (inclusive) for the end position of the export. Optional, by default the export includes the current end of the ledger.
--max-inbound-message-size <value>
Optional max inbound message size in bytes. Defaults to 4194304
Command: script [options]
Export ledger state in Daml script format
--acs-batch-size <value>
Batch this many create commands into one transaction when recreating the ACS.
--set-time <value> Emit setTime commands to replicate transaction time stamps. Only works on ledgers in static-time mode.
-o, --output <value> Create the Daml script under this directory prefix.
--sdk-version <value> Specify this Daml version in the generated project.
also should we add so that export
is shown as one of the available commands when you run daml ledger
or do we generally not do this for alpha
features?
❯ daml ledger
Missing: COMMAND
Usage: daml ledger COMMAND
Interact with a remote Daml ledger. You can specify the ledger in daml.yaml
with the ledger.host and ledger.port options, or you can pass the --host and
--port flags to each command below. If the ledger is authenticated, you should
pass the name of the file containing the token using the --access-token-file
flag or the `daml.access-token-file` field in daml.yaml.
Available options:
-h,--help Show this help text
Available commands:
list-parties List parties known to ledger
allocate-parties Allocate parties on ledger if they don't exist
upload-dar Upload DAR file to ledger
fetch-dar Fetch DAR from ledger into file
metering-report Report on Ledger Use
The
--sdk-version
is different across the two examples. Can you please check this doesn't make a difference? From the error I suspect it might also be beneficial to increase the logging level.
Just copy/pasta mismatch in the examples -- it fails regardless of the version passed. I updated the examples to show 2.4.0 in all cases.
How can the logging level be increased on daml ledger ....
commands? Just through logback-fu, you mean?
Affected Daml version
Verified to be problematic on DAML 2.4.x and above (may also affect earlier version -- not tested)
Bug description
The
daml ledger export script
command does not work when run against an authenticated ledger with SSL enabled, even when all required arguments are passedTo reproduce
Create a canton ledger with SSL and ledger authentication enabled -- (this can be done pretty easily by creating a free Daml Hub ledger, which has SSL and ledger authentication enabled by default and allocates a default user aligned to your name - https://hub.daml.com)
Once the ledger is available, follow these instructions to gather all the credentials and tokens needed for speaking to an authenticated ledger over SSL a. hostname for your ledger b. root cert for Let's encrypt c. JWT token for your user d. party name for your user e. output dir where you want the export scripts to be saved
Try to run the
daml ledger export script
command against your newly created ledger, which will be in the form below (substitute the specific values here for the appropriate ones for your ledger)see error
Expected behavior
When the same command is run directly without going through the
daml
wrapper it succeeds -- it fails when using thedaml
wrapper on M1 Mac, Intel Mac and a Unix machineCommand that succeeds