sigma0-dev / zkbitcoin

zkBitcoin: zero-knowledge proofs on Bitcoin!
MIT License
163 stars 32 forks source link

randomize and add concurrency to selecting members #10

Closed thogiti closed 9 months ago

thogiti commented 9 months ago

I added below items:

  1. Safe randomize using rand::thread_rng for selecting a random sample of members.
  2. Concurrent selection of members in round 1 and 2.
  3. Used tokio::sync::Mutex to share the data between threads in async.

P.S. For the folks who are beginners:

  1. Don't give up.
  2. I first tried with std::sync::Mutex and got it almost working but I struggled debug the final error where it said future cannot be sent between threads safely. Then I saw the hint in the linked article and used tokio::sync::Mutex to reimplement the solution.
  3. Did I mention, Don't give up.
mimoo commented 9 months ago

hey sry but in the mean time someone got to it :o (https://github.com/sigma0-xyz/zkbitcoin/pull/18), but don't hesitate to submit a PR for another one :)