Skip to content
CCPEDIAby Unity Nodes
App Development

What became of sandbox option --contract-id-seeding=testing-weak in 2.x.x?

10 posts421 views5 likesLast activity Apr 2022

  1. meschOP

    Under Daml SDK 1.x.x, I used this clause in the daml.yaml file to make daml start work without failing on waiting to gather entropy:

    sandbox-options:
      - --contract-id-seeding=testing-weak                                                                       
    

    After upgrading to 2.1.0, I see the following error message in daml start:

    ...
    Created .daml/dist/arbo-ledger-0.0.1.dar
    Error: Unknown option --contract-id-seeding=testing-weak
    Canton v2.1.0
    Usage: canton [daemon|run|generate] [options] <args>...
    ...
    

    The subsequent help text offers some alternatives, and -C seems appealing:

      -C, --config key-value's <key1>=<value1>,<key2>=<value2>
                               Set configuration key value pairs directly.
    

    so I tried:

    sandbox-options:
      - -C contract-id-seeding=testing-weak
    

    yet this yields:

    Error: Unknown option -C contract-id-seeding=testing-weak
    Canton v2.1.0
    Usage: canton [daemon|run|generate] [options] <args>...
    

    and offers the same help text regarding -C. So I’m left clueless.

    Can anyone point me in the right direction?

    Cheers,
    mesch.

  2. mesch 1

    Also, searching the Daml documentation for testing-weak yields no result whatsoever:

    https://docs.daml.com/search.html?query="testing-weak"

    Yet, the log messages from daml start actually recommend “using” this option:

    INFO:root:Ledger: b'\x1b[31mWARN  c.d.p.a.SeedService$ - Trying to gather entropy from the underlying operating system to initialized the contract ID seeding, but the entropy pool seems empty.\n'
    INFO:root:Ledger: b'\x1b[0;39m\x1b[31mWARN  c.d.p.a.SeedService$ - In CI environments environment consider using the "testing-weak" mode, that may produce insecure contract IDs but does not block on startup.\n'
    
  3. Ben_M

    I just checked on my Daml SDK 2.0 Canton Server, and I get no reference to -C contract-id-seeding=testing-weak

    Daml sandbox --help

    $ daml sandbox --help
    Usage: daml sandbox [--port ARG] [--admin-api-port ARG] 
                        [--domain-public-port ARG] [--domain-admin-port ARG] 
                        [--canton-port-file PATH] 
                        [--static-time | --wall-clock-time] [--canton-help] 
                        [-c|--config FILE] [--port-file PATH] [--dar PATH] [ARG]
    
    Available options:
      --canton-port-file PATH  File to write canton participant ports when ready
      --canton-help            Display the help of the underlying Canton JAR instead
                               of the Sandbox wrapper. This is only required for
                               advanced options.
      -c,--config FILE         Set configuration file(s). If several configuration
                               files assign values to the same key, the last value
                               is taken.
      --port-file PATH         File to write ledger API port when ready
      --dar PATH               DAR file to upload to sandbox
      --shutdown-stdin-close   Shut down when stdin is closed, disabled by default
      -h,--help                Show this help text
    

    Daml start --help

    $ daml start --help
    Usage: daml start [--sandbox-port PORT_NUM] [--open-browser ARG] 
                      [--start-navigator ARG] [--navigator-port PORT_NUM] 
                      [--json-api-port ARG] [--on-start COMMAND] 
                      [--wait-for-signal ARG] [--sandbox-option SANDBOX_OPTION] 
                      [--navigator-option NAVIGATOR_OPTION] 
                      [--json-api-option JSON_API_OPTION] 
                      [--script-option SCRIPT_OPTION] 
                      [--sandbox-admin-api-port PORT_NUM] 
                      [--sandbox-domain-public-port PORT_NUM] 
                      [--sandbox-domain-admin-port PORT_NUM]
    
    Available options:
      --sandbox-port PORT_NUM  Port number for the sandbox
      --open-browser ARG       Open the browser after navigator Can be set to "yes",
                               "no" or "auto" to select the default (True)
      --start-navigator ARG    Start navigator as part of daml start. Can be set to
                               true or false. Defaults to true.
      --navigator-port PORT_NUM
                               Port number for navigator (default is 7500).
      --json-api-port ARG      Port that the HTTP JSON API should listen on or
                               'none' to disable it
      --on-start COMMAND       Command to run once sandbox and navigator are
                               running.
      --wait-for-signal ARG    Wait for Ctrl+C or interrupt after starting servers.
                               Can be set to "yes", "no" or "auto" to select the
                               default (True)
      --sandbox-option SANDBOX_OPTION
                               Pass option to sandbox
      --navigator-option NAVIGATOR_OPTION
                               Pass option to navigator
      --json-api-option JSON_API_OPTION
                               Pass option to HTTP JSON API
      --script-option SCRIPT_OPTION
                               Pass option to Daml script interpreter
      --shutdown-stdin-close   Shut down when stdin is closed, disabled by default
      --sandbox-admin-api-port PORT_NUM
                               Port number for the canton admin API
                               (--sandbox-canton only)
      --sandbox-domain-public-port PORT_NUM
                               Port number for the canton domain public API
                               (--sandbox-canton only)
      --sandbox-domain-admin-port PORT_NUM
                               Port number for the canton domain admin API
                               (--sandbox-canton only)
      -h,--help                Show this help text
    

    I think unless you removed the specific sandbox-options: - --contract-id-seeding=testing-weak from your daml.yaml in the App, once you upgraded to the newer SDK, it will still reference that configuration.

    Perhaps one of the Daml SDK team can confirm or deny this?

  4. mesch

    I get no reference to -C contract-id-seeding=testing-weak

    Neither do I. To clarify:

    1. daml start fails if I do include --contract-id-seeding=testing-weak in sandbox-options in daml.yaml, because the option doesn’t exist. (This used to work in pre-2.0.0.)

    2. daml start fails if I don’t include that option, because it cannot gather enough entropy. The WARNING messages in the log contain the hint consider using the "testing-weak" mode, but no indication how to enable testing-weak mode.

    3. The usage page also shown in 1 listed the flag -C to set config options, so I tried that, but it only resulted in the same usage page shown again.

  5. Ben_M

    Referring to Low Entropy Error Stops Daml Start - #4 by stefanobaghino-da, the correct format for the command is/was as you had: - --contract-id-seeding=testing-weak

    As for the underlying Entropy issue, what O/S version are you using?

  6. cocreature 1

    You can set it via a Canton config file. Create canton.config with the following contents:

    canton.participants.sandbox.parameters.contract-id-seeding = testing-weak
    

    You can then run daml sandbox -c canton.config to pick up the config.

  7. stefanobaghino-da
    cocreature:

    You can set it via a Canton config file. Create canton.config with the following contents:

    canton.participants.sandbox.parameters.contract-id-seeding = testing-weak
    

    You can then run daml sandbox -c canton.config to pick up the config.

    @cocreature Looking at the original solution

    mesch:
    sandbox-options:
      - -C contract-id-seeding=testing-weak
    

    This means that

    sandbox-options:
      - -C canton.participants.sandbox.parameters.contract-id-seeding=testing-weak
    

    Should work as well, right?

  8. cocreature 1

    You need an equal sign in between or split it into two arguments so

    sandbox-options:
      - -C=canton.participants.sandbox.parameters.contract-id-seeding=testing-weak
    

    should do the trick

  9. mesch

    Thanks a lot for the answers. I flagged the solution I confirmed to work above.

    Btw. the syntax of a short option with a value separated by = rather than space is very unusual (in addition to being undocumented, as far as I can see):

    -C=canton.participants.sandbox.parameters.contract-id-seeding=testing-weak
    

    FWIW would never have tried that.

    Thanks a lot for all the responses!

    Cheers,
    mesch.

  10. cocreature 2

    The equal sign isn’t mandatory but it’s relatively common across tools to support this. The alternative is that you pass it as two separate arguments

    sandbox-options:
      - -C
      - canton.participants.sandbox.parameters.contract-id-seeding=testing-weak
    

    In your shell you can do that by adding a space and your shell will split it into two arguments before invoking the command but if you put that in your daml.yaml it will be interpreted as a single argument containing a space which is not going to work.