I am trying to get proptest, a property-testing library in Rust, to compile and run from within a canister. It has a dependency on
getrandom, and I assume that because
getrandom is being compiled for a Wasm environment, it expects a
__getrandom_custom import from the host environment. I get the following error when trying to deploy a canister with that uses
Installing canisters... Upgrading code for canister graphql, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai The invocation to the wallet call forward method failed with the error: An error happened during the call: 5: Wasm module of canister rrkah-fqaaa-aaaaa-aaaaq-cai is not valid: Wasm module has an invalid import section. Module imports function '__getrandom_custom' from 'env' that is not exported by the runtime.
It would be very nice for the Rust CDK to provide this functionality, it seems that dealing with Rust randomness, packages like
getrandom, isn’t as smooth as it could be. I would expect randomness to simply work across the major Rust packages, since the IC has an excellent source of randomness with the random beacon.
Until all of that is sorted out, is there a way for me to provide the
__getrandom_custom function to my canister?