paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
391 stars 236 forks source link

Attempted to use functionality that requires system randomness!! #1543

Closed blue-freedom-technologies closed 2 months ago

blue-freedom-technologies commented 2 months ago

Hello,

target = "xtensa-esp32s3-espidf"

I am getting this weird error below for the ".sign_and_submit_then_watch_default" function.

I (16406) esp32_demo: Connection to rococo-contracts ok.
I (23046) esp32_demo: From account id:"5CcTkwPBya******"
I (23046) esp32_demo: call: AccountId32([*********])
thread 'reductor' panicked at /.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom_or_panic-0.0.3/src/lib.rs:29:55:
Attempted to use functionality that requires system randomness!!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
(...)
 let result = api
     .tx()
     .sign_and_submit_then_watch_default(&call_tx, &keypair)
     ..await;
(...)

cargo.toml

(...)
subxt = { git = "https://github.com/paritytech/subxt.git", branch="master" , default-features = false, features = ["native","unstable-metadata","jsonrpsee"] }
subxt-signer = { git = "https://github.com/paritytech/subxt.git", branch="master", default-features = false, features = ["sr25519","subxt"] }
(...)

I think this is due my features selection that is excluding the getrandom crate.

Am I right ?

Cheers,

niklasad1 commented 2 months ago

Hey,

You are correct when you are enabling sr25519/schnorrkel you need TRNG for it be secure but more info https://github.com/burdges/getrandom_or_panic?tab=readme-ov-file#getrandom_or_panic.

You need to provide/override the system randomness for it and use the RNG from your MCU I guess....

blue-freedom-technologies commented 2 months ago

Hi @niklasad1 ,

yes, you are right in our case the Random Number Generation.

Thank you for the confirmation.