@ulan mentioned to me that this problem may be solved in the future by supporting
raw_random()
in the System API as a synchronous call.
But I wonder how this can be worked around at all, given that proper randomness requires an asynchronous call to the Management canister. I doubt that is going to change.
The execution layer of replica gets random bits as input in each round [code]. These bits are passed to the management canister to handle raw_rand()
requests. I think we could use some of these bits to provide randomness to canister message execution synchronously. Having random bits during canister installation would be useful in many cases. We definitely need to check this with security/crypto experts because I am not sure if this would break some security properties of raw_rand()
.