sunshine-protocol / sunshine

Governance + Bounty Platform
Other
43 stars 16 forks source link

Client Cannot Pass Currency Trait Between Threads #93

Closed 4meta5 closed 4 years ago

4meta5 commented 4 years ago

steps to reproduce: compile client in open PR at the commit which references this issue (scroll down)

error[E0277]: `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance` cannot be sent between threads safely
   --> client/src/srml/bank.rs:78:39
    |
78  | #[derive(Clone, Debug, Eq, PartialEq, Call, Encode)]
    |                                       ^^^^ `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance` cannot be sent between threads safely
    | 
   ::: /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/substrate-subxt-0.8.0/src/lib.rs:386:10
    |
386 |     ) -> Result<T::Hash, Error> {
    |          ---------------------- within this `impl std::future::Future`
    |
    = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance`
    = note: required because it appears within the type `srml::bank::RegisterAndSeedForBankAccountCall<T>`
    = note: required because it appears within the type `[static generator@substrate_subxt::Client::<T, S, E>::submit::{{closure}}#0 0:&substrate_subxt::Client<T, S, E>, 1:srml::bank::RegisterAndSeedForBankAccountCall<T>, 2:&dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, &'r substrate_subxt::Client<T, S, E>, srml::bank::RegisterAndSeedForBankAccountCall<T>, &'s (dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync + 't0), impl std::future::Future, (), substrate_subxt::sp_runtime::generic::UncheckedExtrinsic<<T as substrate_subxt::system::System>::Address, substrate_subxt::Encoded, S, <E as substrate_subxt::SignedExtra<T>>::Extra>, impl std::future::Future}]`
    = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@substrate_subxt::Client::<T, S, E>::submit::{{closure}}#0 0:&substrate_subxt::Client<T, S, E>, 1:srml::bank::RegisterAndSeedForBankAccountCall<T>, 2:&dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, &'r substrate_subxt::Client<T, S, E>, srml::bank::RegisterAndSeedForBankAccountCall<T>, &'s (dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync + 't0), impl std::future::Future, (), substrate_subxt::sp_runtime::generic::UncheckedExtrinsic<<T as substrate_subxt::system::System>::Address, substrate_subxt::Encoded, S, <E as substrate_subxt::SignedExtra<T>>::Extra>, impl std::future::Future}]>`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required for the cast to the object type `dyn std::future::Future<Output = std::result::Result<<T as substrate_subxt::system::System>::Hash, substrate_subxt::Error>> + std::marker::Send`
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance` cannot be sent between threads safely
   --> client/src/srml/bank.rs:78:39
    |
78  | #[derive(Clone, Debug, Eq, PartialEq, Call, Encode)]
    |                                       ^^^^ `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance` cannot be sent between threads safely
    | 
   ::: /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/substrate-subxt-0.8.0/src/lib.rs:396:10
    |
396 |     ) -> Result<ExtrinsicSuccess<T>, Error> {
    |          ---------------------------------- within this `impl std::future::Future`
    |
    = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `<<T as srml::bank::Bank>::Currency as frame_support::traits::Currency<<T as substrate_subxt::system::System>::AccountId>>::Balance`
    = note: required because it appears within the type `srml::bank::RegisterAndSeedForBankAccountCall<T>`
    = note: required because it appears within the type `[static generator@substrate_subxt::Client::<T, S, E>::watch::{{closure}}#0 0:&substrate_subxt::Client<T, S, E>, 1:srml::bank::RegisterAndSeedForBankAccountCall<T>, 2:&dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, &'r substrate_subxt::Client<T, S, E>, srml::bank::RegisterAndSeedForBankAccountCall<T>, &'s (dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync + 't0), impl std::future::Future, (), substrate_subxt::sp_runtime::generic::UncheckedExtrinsic<<T as substrate_subxt::system::System>::Address, substrate_subxt::Encoded, S, <E as substrate_subxt::SignedExtra<T>>::Extra>, substrate_subxt::EventsDecoder<T>, impl std::future::Future}]`
    = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@substrate_subxt::Client::<T, S, E>::watch::{{closure}}#0 0:&substrate_subxt::Client<T, S, E>, 1:srml::bank::RegisterAndSeedForBankAccountCall<T>, 2:&dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, &'r substrate_subxt::Client<T, S, E>, srml::bank::RegisterAndSeedForBankAccountCall<T>, &'s (dyn substrate_subxt::Signer<T, S, E> + std::marker::Send + std::marker::Sync + 't0), impl std::future::Future, (), substrate_subxt::sp_runtime::generic::UncheckedExtrinsic<<T as substrate_subxt::system::System>::Address, substrate_subxt::Encoded, S, <E as substrate_subxt::SignedExtra<T>>::Extra>, substrate_subxt::EventsDecoder<T>, impl std::future::Future}]>`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required because it appears within the type `impl std::future::Future`
    = note: required for the cast to the object type `dyn std::future::Future<Output = std::result::Result<substrate_subxt::ExtrinsicSuccess<T>, substrate_subxt::Error>> + std::marker::Send`
    = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
error: could not compile `sunshine-client`.

To learn more, run the command again with --verbose.

I was gettting this error before I added a bunch of bounds to the Currency trait in srml/bank and now I am getting it again. Why is it even necessary to pass anything between threads @dvc94ch