`contract-id-seeding=testing-weak` not effective?

I start a sandbox with the option to use testing-weak:

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

Yet I get this warning:

WARN  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.
WARN  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.

Here is the full output:

---
--- Start daml sandbox (upgrade_backup.sh)
---
daml sandbox --port-file=/tmp/tmp.fSk8QzIhEM/port.txt
cat daml.yaml
sdk-version: 2.1.0
name: arbo-ledger-upgrade
source: .
version: 0.0.2
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
build-options: # https://docs.daml.com/tools/assistant.html#recommended-build-options
  - --ghc-option=-Wunused-top-binds
  - --ghc-option=-Wunused-matches
  - --ghc-option=-Wunused-do-bind
  - --ghc-option=-Wincomplete-uni-patterns
  - --ghc-option=-Wredundant-constraints
  - --ghc-option=-Wmissing-signatures
  - --ghc-option=-Wmissing-fields
  - --ghc-option=-Werror
sandbox-options:
  - -C=canton.participants.sandbox.parameters.contract-id-seeding=testing-weak
Starting Canton sandbox.
WARN  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.
WARN  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.

Any idea what’s missing? It always seems to have worked until now.

It also said eventually, despite the --port-file= option:

Port file was not written to '/tmp/extra-dir-80024964901684/canton-portfile.json' in time.

Btw. sometimes it eventually starts, but after about a minute or so delay:

Listening at port 6865
Writing ledger API port to /tmp/tmp.xfRHlZmwzd/port.txt
Canton sandbox is ready.

Hi @mesch,

Other than delay, is your sandbox failing to start? The warning itself should not result in failure to start.
The message about the */canton-portfile.json refers to another portfile containing the Admin API port along with the Ledger API that defaults to the place reported. You can specify it’s place by using the --canton-port-file PATH option.

I think in the case where I saw the port file message it never started; but generally when I see that message it starts after 2-3 minutes. So it’s tolerable but still a nuisance because this happens during execution of a test that would normally complete in about a minute. Also, I was wondering if I’m missing something because previously I never saw this warning with the testing-weak option (as the documentation insinuates btw.; it says canton would not delay at all with that option).

Thanks!
mesch.

I’m still curious to learn whether I do anything wrong, or whether it’s expected that even with testing-weak we might run out of entropy on some systems.

It seems that passing the flag -C=canton.participants.sandbox.parameters.contract-id-seeding=testing-weak directly on the command line of daml sandbox makes the problem go away.

I verified, however, that there is a daml.yaml file in the current working directory where I invoke daml sandbox, and that it contains the sandbox-options: section with the same command line flag.

Hi @mesch,

Looking at the code it looks like you should not get this message if the parameter was digested properly. I believe this is because as described here:

sandbox-options : a list of options that will be passed to Sandbox in daml start

I have been trying to get a console into the sandbox or setting a log level that would print the actual config that it is running with. The only thing I could come up with is a script like this:

$ cat printSeeding.canton
println(sandbox.config.parameters.contractIdSeeding)

And then invoking the sandbox subcommand like this:

$ daml sandbox --bootstrap printSeeding.canton 
SDK 2.3.2 has been released!
See https://github.com/digital-asset/daml/releases/tag/v2.3.2 for details.

Starting Canton sandbox.
Listening at port 6865
Canton sandbox is ready.
strong

$ daml sandbox -C canton.participants.sandbox.parameters.contract-id-seeding=testing-weak --bootstrap printSeeding.canton 
SDK 2.3.2 has been released!
See https://github.com/digital-asset/daml/releases/tag/v2.3.2 for details.

Starting Canton sandbox.
Listening at port 6865
Canton sandbox is ready.
testing-weak

If you want to make the option consume a bit less real estate, consider putting it in a file and pass that with -c.