Bladeren bron

Migrate lib to smol instead of explicit async deps.

Internally they're the same, smol exports them.
Luther Blissett 3 jaren geleden
bovenliggende
commit
2b587bc14a

+ 0 - 2
Cargo.lock

@@ -1150,8 +1150,6 @@ dependencies = [
 name = "darkfi"
 version = "0.3.0"
 dependencies = [
- "async-channel",
- "async-executor",
  "async-std",
  "async-trait",
  "async-tungstenite",

+ 0 - 4
Cargo.toml

@@ -51,8 +51,6 @@ log = "0.4.17"
 thiserror = "1.0.37"
 
 # async-runtime
-async-channel = {version = "1.7.1", optional = true}
-async-executor = {version = "1.4.1", optional = true}
 async-std = {version = "1.12.0", features = ["attributes"], optional = true}
 async-trait = {version = "0.1.57", optional = true}
 futures = {version = "0.3.24", optional = true}
@@ -141,8 +139,6 @@ plotters = "0.3.4"
 [features]
 async-runtime = [
     "async-std",
-    "async-channel",
-    "async-executor",
     "async-trait",
     "futures",
     "smol",

+ 1 - 1
bin/drk/src/deploy_contract.rs

@@ -28,7 +28,7 @@ const DEPLOY_KEY_NAME: &str = "deploy.key";
 pub fn create_deploy_key(mut rng: impl RngCore, path: &Path) -> Result<SecretKey> {
     let secret = SecretKey::random(&mut rng);
     let mut file = File::create(path)?;
-    file.write_all(&bs58::encode(&secret.to_bytes()).into_string().as_bytes())?;
+    file.write_all(bs58::encode(&secret.to_bytes()).into_string().as_bytes())?;
     Ok(secret)
 }
 

+ 4 - 4
bin/drk/src/main.rs

@@ -264,14 +264,14 @@ async fn main() -> Result<()> {
         Subcmd::Ping => {
             let rpc_client = RpcClient::new(args.endpoint).await?;
             let drk = Drk { rpc_client };
-            return drk.ping().await
+            drk.ping().await
         }
 
         Subcmd::Airdrop { address, faucet_endpoint, amount, token_id } => {
             let rpc_client = RpcClient::new(args.endpoint).await?;
             let drk = Drk { rpc_client };
 
-            return drk.airdrop(address, faucet_endpoint, amount, token_id).await
+            drk.airdrop(address, faucet_endpoint, amount, token_id).await
         }
 
         Subcmd::Wallet { keygen, balance, address, all_addresses } => {
@@ -302,7 +302,7 @@ async fn main() -> Result<()> {
             let rpc_client = RpcClient::new(args.endpoint).await?;
             let drk = Drk { rpc_client };
 
-            return drk.tx_transfer(network, token_id, recipient, amount).await
+            drk.tx_transfer(network, token_id, recipient, amount).await
         }
 
         Subcmd::Broadcast => {
@@ -312,7 +312,7 @@ async fn main() -> Result<()> {
             let mut buf = String::new();
             stdin().read_to_string(&mut buf)?;
 
-            return drk.tx_broadcast(buf).await
+            drk.tx_broadcast(buf).await
         }
 
         Subcmd::DeployContract { path } => {

+ 1 - 2
src/consensus/proto/protocol_participant.rs

@@ -1,8 +1,7 @@
 use async_std::sync::Arc;
-
-use async_executor::Executor;
 use async_trait::async_trait;
 use log::{debug, error};
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 8 - 6
src/consensus/proto/protocol_proposal.rs

@@ -1,8 +1,7 @@
 use async_std::sync::Arc;
-
-use async_executor::Executor;
 use async_trait::async_trait;
 use log::{debug, error, info};
+use smol::Executor;
 use url::Url;
 
 use crate::{
@@ -62,9 +61,9 @@ impl ProtocolProposal {
             debug!("ProtocolProposal::handle_receive_proposal(): Full proposal: {:?}", proposal);
 
             let proposal_copy = (*proposal).clone();
-            
+
             let mut state = self.state.write().await;
-            
+
             // Verify we have the proposal already
             match state.find_proposal(&proposal_copy.block.header.headerhash()) {
                 Ok(p) => {
@@ -72,9 +71,12 @@ impl ProtocolProposal {
                         debug!("ProtocolProposal::handle_receive_proposal(): Proposal already received.");
                         continue
                     }
-                },
+                }
                 Err(e) => {
-                    error!("ProtocolProposal::handle_receive_proposal(): find_proposal() failed: {}", e);
+                    error!(
+                        "ProtocolProposal::handle_receive_proposal(): find_proposal() failed: {}",
+                        e
+                    );
                     continue
                 }
             };

+ 1 - 1
src/consensus/proto/protocol_sync.rs

@@ -1,7 +1,7 @@
-use async_executor::Executor;
 use async_std::sync::Arc;
 use async_trait::async_trait;
 use log::{debug, error, info};
+use smol::Executor;
 
 use crate::{
     consensus::{

+ 1 - 1
src/consensus/proto/protocol_sync_consensus.rs

@@ -1,7 +1,7 @@
-use async_executor::Executor;
 use async_std::sync::Arc;
 use async_trait::async_trait;
 use log::{debug, error};
+use smol::Executor;
 
 use crate::{
     consensus::{

+ 1 - 2
src/consensus/proto/protocol_tx.rs

@@ -1,8 +1,7 @@
 use async_std::sync::Arc;
-
-use async_executor::Executor;
 use async_trait::async_trait;
 use log::{debug, error};
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 1 - 1
src/consensus/state.rs

@@ -867,7 +867,7 @@ impl ValidatorState {
     pub async fn update_canon_state(
         &self,
         updates: Vec<StateUpdate>,
-        notify: Option<async_channel::Sender<(PublicKey, u64)>>,
+        notify: Option<smol::channel::Sender<(PublicKey, u64)>>,
     ) -> Result<()> {
         let secret_keys: Vec<SecretKey> =
             self.client.get_keypairs().await?.iter().map(|x| x.secret).collect();

+ 1 - 1
src/crypto/merkle_node.rs

@@ -73,7 +73,7 @@ impl Serialize for MerkleNode {
 impl<'de> Deserialize<'de> for MerkleNode {
     fn deserialize<D: Deserializer<'de>>(deserializer: D) -> std::result::Result<Self, D::Error> {
         let parsed = <[u8; 32]>::deserialize(deserializer)?;
-        <Option<_>>::from(Self::from_bytes(parsed)).ok_or_else(|| {
+        Self::from_bytes(parsed).ok_or_else(|| {
             Error::custom("Attempted to deserialize a non-canonical representation of a Pallas base field element")
         })
     }

+ 9 - 8
src/dht/mod.rs

@@ -1,11 +1,12 @@
-use async_executor::Executor;
+use std::collections::HashSet;
+
 use async_std::sync::{Arc, RwLock};
 use chrono::Utc;
 use futures::{select, FutureExt};
 use fxhash::FxHashMap;
 use log::{debug, error, warn};
 use rand::Rng;
-use std::collections::HashSet;
+use smol::Executor;
 
 use crate::{
     net,
@@ -43,9 +44,9 @@ pub struct Dht {
     /// P2P network pointer
     pub p2p: P2pPtr,
     /// Channel to receive responses from P2P
-    p2p_recv_channel: async_channel::Receiver<KeyResponse>,
+    p2p_recv_channel: smol::channel::Receiver<KeyResponse>,
     /// Stop signal channel to terminate background processes
-    stop_signal: async_channel::Receiver<()>,
+    stop_signal: smol::channel::Receiver<()>,
     /// Daemon seen requests/responses ids and timestamp,
     /// to prevent rebroadcasting and loops
     pub seen: FxHashMap<blake3::Hash, i64>,
@@ -55,7 +56,7 @@ impl Dht {
     pub async fn new(
         initial: Option<FxHashMap<blake3::Hash, HashSet<blake3::Hash>>>,
         p2p_ptr: P2pPtr,
-        stop_signal: async_channel::Receiver<()>,
+        stop_signal: smol::channel::Receiver<()>,
         ex: Arc<Executor<'_>>,
     ) -> Result<DhtPtr> {
         // Generate a random id
@@ -68,7 +69,7 @@ impl Dht {
             None => FxHashMap::default(),
         };
         let p2p = p2p_ptr.clone();
-        let (p2p_send_channel, p2p_recv_channel) = async_channel::unbounded::<KeyResponse>();
+        let (p2p_send_channel, p2p_recv_channel) = smol::channel::unbounded::<KeyResponse>();
         let seen = FxHashMap::default();
 
         let dht = Arc::new(RwLock::new(Dht {
@@ -273,8 +274,8 @@ pub async fn waiting_for_response(dht: DhtPtr) -> Result<Option<KeyResponse>> {
             _dht.p2p.settings().connect_timeout_seconds as u64,
         )
     };
-    let ex = Arc::new(async_executor::Executor::new());
-    let (timeout_s, timeout_r) = async_channel::unbounded::<()>();
+    let ex = Arc::new(Executor::new());
+    let (timeout_s, timeout_r) = smol::channel::unbounded::<()>();
     ex.spawn(async move {
         sleep(timeout).await;
         timeout_s.send(()).await.unwrap_or(());

+ 3 - 3
src/dht/protocol.rs

@@ -1,8 +1,8 @@
-use async_executor::Executor;
 use async_std::sync::Arc;
 use async_trait::async_trait;
 use chrono::Utc;
 use log::{debug, error};
+use smol::Executor;
 
 use crate::{
     net::{
@@ -19,7 +19,7 @@ use super::{
 
 pub struct Protocol {
     channel: ChannelPtr,
-    notify_queue_sender: async_channel::Sender<KeyResponse>,
+    notify_queue_sender: smol::channel::Sender<KeyResponse>,
     req_sub: MessageSubscription<KeyRequest>,
     resp_sub: MessageSubscription<KeyResponse>,
     lookup_sub: MessageSubscription<LookupRequest>,
@@ -32,7 +32,7 @@ pub struct Protocol {
 impl Protocol {
     pub async fn init(
         channel: ChannelPtr,
-        notify_queue_sender: async_channel::Sender<KeyResponse>,
+        notify_queue_sender: smol::channel::Sender<KeyResponse>,
         dht: DhtPtr,
         p2p: P2pPtr,
     ) -> Result<ProtocolBasePtr> {

+ 8 - 8
src/error.rs

@@ -271,11 +271,11 @@ pub enum Error {
     #[error("Infallible error: {0}")]
     InfallibleError(String),
 
-    #[cfg(feature = "async-channel")]
+    #[cfg(feature = "smol")]
     #[error("async_channel sender error: {0}")]
     AsyncChannelSendError(String),
 
-    #[cfg(feature = "async-channel")]
+    #[cfg(feature = "smol")]
     #[error("async_channel receiver error: {0}")]
     AsyncChannelRecvError(String),
 
@@ -451,16 +451,16 @@ impl From<()> for Error {
     }
 }
 
-#[cfg(feature = "async-channel")]
-impl<T> From<async_channel::SendError<T>> for Error {
-    fn from(err: async_channel::SendError<T>) -> Self {
+#[cfg(feature = "smol")]
+impl<T> From<smol::channel::SendError<T>> for Error {
+    fn from(err: smol::channel::SendError<T>) -> Self {
         Self::AsyncChannelSendError(err.to_string())
     }
 }
 
-#[cfg(feature = "async-channel")]
-impl From<async_channel::RecvError> for Error {
-    fn from(err: async_channel::RecvError) -> Self {
+#[cfg(feature = "smol")]
+impl From<smol::channel::RecvError> for Error {
+    fn from(err: smol::channel::RecvError) -> Self {
         Self::AsyncChannelRecvError(err.to_string())
     }
 }

+ 2 - 2
src/net/hosts.rs

@@ -237,13 +237,13 @@ fn filter_non_resolving(
         for ip in resolves {
             match ip {
                 IpAddr::V4(a) => {
-                    if ipv4_range.contains(&a) {
+                    if ipv4_range.contains(a) {
                         valid = true;
                         break
                     }
                 }
                 IpAddr::V6(a) => {
-                    if ipv6_range.contains(&a) {
+                    if ipv6_range.contains(a) {
                         valid = true;
                         break
                     }

+ 3 - 3
src/net/message_subscriber.rs

@@ -18,7 +18,7 @@ type MessageResult<M> = Result<Arc<M>>;
 /// channel.
 pub struct MessageSubscription<M: Message> {
     id: MessageSubscriptionId,
-    recv_queue: async_channel::Receiver<MessageResult<M>>,
+    recv_queue: smol::channel::Receiver<MessageResult<M>>,
     parent: Arc<MessageDispatcher<M>>,
 }
 
@@ -51,7 +51,7 @@ trait MessageDispatcherInterface: Send + Sync {
 
 /// A dispatchers that is unique to every Message. Maintains a list of subscribers that are subscribed to that unique Message type and handles sending messages across these subscriptions.
 struct MessageDispatcher<M: Message> {
-    subs: Mutex<FxHashMap<MessageSubscriptionId, async_channel::Sender<MessageResult<M>>>>,
+    subs: Mutex<FxHashMap<MessageSubscriptionId, smol::channel::Sender<MessageResult<M>>>>,
 }
 
 impl<M: Message> MessageDispatcher<M> {
@@ -69,7 +69,7 @@ impl<M: Message> MessageDispatcher<M> {
     /// Subscribe to a channel. Assigns a new ID and adds it to the list of
     /// subscribers.
     pub async fn subscribe(self: Arc<Self>) -> MessageSubscription<M> {
-        let (sender, recvr) = async_channel::unbounded();
+        let (sender, recvr) = smol::channel::unbounded();
         let sub_id = Self::random_id();
         self.subs.lock().await.insert(sub_id, sender);
 

+ 2 - 2
src/net/p2p.rs

@@ -1,12 +1,12 @@
 use std::fmt;
 
-use async_executor::Executor;
 use async_std::sync::{Arc, Mutex};
 use futures::{select, stream::FuturesUnordered, try_join, FutureExt, StreamExt, TryFutureExt};
 use fxhash::{FxHashMap, FxHashSet};
 use log::{debug, error, warn};
 use rand::Rng;
 use serde_json::json;
+use smol::Executor;
 use url::Url;
 
 use crate::{
@@ -275,7 +275,7 @@ impl P2p {
             // We use a timeout to eliminate the following cases:
             //  1. Network timeout
             //  2. Thread reaching the receiver after peer has signal it
-            let (timeout_s, timeout_r) = async_channel::unbounded::<()>();
+            let (timeout_s, timeout_r) = smol::channel::unbounded::<()>();
             executor
                 .spawn(async move {
                     sleep(timeout).await;

+ 1 - 1
src/net/session/inbound_session.rs

@@ -1,10 +1,10 @@
 use async_std::sync::{Arc, Mutex, Weak};
 
-use async_executor::Executor;
 use async_trait::async_trait;
 use fxhash::FxHashMap;
 use log::{error, info};
 use serde_json::json;
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 2 - 2
src/net/session/manual_session.rs

@@ -1,9 +1,9 @@
 use async_std::sync::{Arc, Mutex, Weak};
 
-use async_executor::Executor;
 use async_trait::async_trait;
-use log::*;
+use log::{info, warn};
 use serde_json::json;
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 2 - 2
src/net/session/outbound_session.rs

@@ -1,11 +1,11 @@
-use async_std::sync::{Arc, Mutex, Weak};
 use std::fmt;
 
-use async_executor::Executor;
+use async_std::sync::{Arc, Mutex, Weak};
 use async_trait::async_trait;
 use log::{debug, error, info, warn};
 use rand::seq::SliceRandom;
 use serde_json::{json, Value};
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 5 - 5
src/net/session/seedsync_session.rs

@@ -1,14 +1,14 @@
+use std::time::Duration;
+
 use async_std::{
     future::timeout,
     sync::{Arc, Weak},
 };
-use futures::future;
-use std::time::Duration;
-
-use async_executor::Executor;
 use async_trait::async_trait;
+use futures::future::join_all;
 use log::*;
 use serde_json::json;
+use smol::Executor;
 use url::Url;
 
 use crate::Result;
@@ -76,7 +76,7 @@ impl SeedSyncSession {
                 }
             });
         }
-        future::join_all(tasks).await;
+        join_all(tasks).await;
 
         // Seed process complete
         if self.p2p().hosts().is_empty().await {

+ 1 - 1
src/node/state.rs

@@ -155,7 +155,7 @@ impl State {
         &mut self,
         update: StateUpdate,
         secret_keys: Vec<SecretKey>,
-        notify: Option<async_channel::Sender<(PublicKey, u64)>>,
+        notify: Option<smol::channel::Sender<(PublicKey, u64)>>,
         wallet: WalletPtr,
     ) -> Result<()> {
         debug!(target: "state_apply", "Extend nullifier set");

+ 14 - 14
src/raft/consensus.rs

@@ -1,15 +1,15 @@
+use std::time::Duration;
+
 use async_std::{
     sync::{Arc, Mutex},
     task::sleep,
 };
-use std::time::Duration;
-
-use async_executor::Executor;
 use chrono::Utc;
 use futures::{select, FutureExt};
 use fxhash::FxHashMap;
 use log::{debug, error, warn};
 use rand::{rngs::OsRng, Rng, RngCore};
+use smol::Executor;
 
 use crate::{
     net,
@@ -27,7 +27,7 @@ use super::{
     prune_map, DataStore, RaftSettings,
 };
 
-async fn send_loop(sender: async_channel::Sender<()>, timeout: Duration) -> Result<()> {
+async fn send_loop(sender: smol::channel::Sender<()>, timeout: Duration) -> Result<()> {
     loop {
         sleep(timeout).await;
         sender.send(()).await?;
@@ -79,10 +79,10 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
         let datastore = DataStore::new(settings.datastore_path.to_str().unwrap())?;
 
         // broadcasting channels
-        let msgs_channel = async_channel::unbounded::<T>();
-        let commits_channel = async_channel::unbounded::<T>();
+        let msgs_channel = smol::channel::unbounded::<T>();
+        let commits_channel = smol::channel::unbounded::<T>();
 
-        let p2p_sender = async_channel::unbounded::<NetMsg>();
+        let p2p_sender = smol::channel::unbounded::<NetMsg>();
 
         let id = match datastore.id.get_last()? {
             Some(_id) => _id,
@@ -122,9 +122,9 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
     pub async fn run(
         &mut self,
         p2p: net::P2pPtr,
-        p2p_recv_channel: async_channel::Receiver<NetMsg>,
+        p2p_recv_channel: smol::channel::Receiver<NetMsg>,
         executor: Arc<Executor<'_>>,
-        stop_signal: async_channel::Receiver<()>,
+        stop_signal: smol::channel::Receiver<()>,
     ) -> Result<()> {
         let p2p_send_task = executor.spawn(p2p_send_loop(self.p2p_sender.1.clone(), p2p.clone()));
 
@@ -134,9 +134,9 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
         let prune_nodes_id_task =
             executor.spawn(prune_map::<NodeId>(self.nodes.clone(), self.settings.prun_duration));
 
-        let (id_sx, id_rv) = async_channel::unbounded::<()>();
-        let (heartbeat_sx, heartbeat_rv) = async_channel::unbounded::<()>();
-        let (timeout_sx, timeout_rv) = async_channel::unbounded::<()>();
+        let (id_sx, id_rv) = smol::channel::unbounded::<()>();
+        let (heartbeat_sx, heartbeat_rv) = smol::channel::unbounded::<()>();
+        let (timeout_sx, timeout_rv) = smol::channel::unbounded::<()>();
 
         let id_timeout = Duration::from_secs(self.settings.id_timeout);
         let send_id_task = executor.spawn(send_loop(id_sx, id_timeout));
@@ -190,7 +190,7 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
     /// Return async receiver channel which can be used to receive T Messages
     /// from raft consensus
     ///
-    pub fn receiver(&self) -> async_channel::Receiver<T> {
+    pub fn receiver(&self) -> smol::channel::Receiver<T> {
         self.commits_channel.1.clone()
     }
 
@@ -198,7 +198,7 @@ impl<T: Decodable + Encodable + Clone> Raft<T> {
     /// Return async sender channel which can be used to broadcast T Messages
     /// to raft consensus
     ///
-    pub fn sender(&self) -> async_channel::Sender<T> {
+    pub fn sender(&self) -> smol::channel::Sender<T> {
         self.msgs_channel.0.clone()
     }
 

+ 1 - 1
src/raft/mod.rs

@@ -40,7 +40,7 @@ async fn prune_map<T: Clone + Eq + std::hash::Hash>(
     }
 }
 
-async fn p2p_send_loop(receiver: async_channel::Receiver<NetMsg>, p2p: net::P2pPtr) -> Result<()> {
+async fn p2p_send_loop(receiver: smol::channel::Receiver<NetMsg>, p2p: net::P2pPtr) -> Result<()> {
     loop {
         let msg: NetMsg = receiver.recv().await?;
         if let Err(e) = p2p.broadcast(msg).await {

+ 2 - 2
src/raft/primitives.rs

@@ -7,8 +7,8 @@ use crate::{
     Error, Result,
 };
 
-pub type Channel<T> = (async_channel::Sender<T>, async_channel::Receiver<T>);
-pub type Sender = (async_channel::Sender<NetMsg>, async_channel::Receiver<NetMsg>);
+pub type Channel<T> = (smol::channel::Sender<T>, smol::channel::Receiver<T>);
+pub type Sender = (smol::channel::Sender<NetMsg>, smol::channel::Receiver<NetMsg>);
 
 #[derive(PartialEq, Eq, Debug, Clone)]
 pub enum Role {

+ 4 - 6
src/raft/protocol_raft.rs

@@ -1,20 +1,18 @@
 use async_std::sync::{Arc, Mutex};
-
-use async_executor::Executor;
 use async_trait::async_trait;
 use chrono::Utc;
 use fxhash::FxHashMap;
 use log::debug;
 use rand::{rngs::OsRng, RngCore};
-
-use crate::{net, serial::serialize, Result};
+use smol::Executor;
 
 use super::primitives::{NetMsg, NetMsgMethod, NodeId, NodeIdMsg};
+use crate::{net, serial::serialize, Result};
 
 pub struct ProtocolRaft {
     id: NodeId,
     jobsman: net::ProtocolJobsManagerPtr,
-    notify_queue_sender: async_channel::Sender<NetMsg>,
+    notify_queue_sender: smol::channel::Sender<NetMsg>,
     msg_sub: net::MessageSubscription<NetMsg>,
     p2p: net::P2pPtr,
     seen_msgs: Arc<Mutex<FxHashMap<String, i64>>>,
@@ -25,7 +23,7 @@ impl ProtocolRaft {
     pub async fn init(
         id: NodeId,
         channel: net::ChannelPtr,
-        notify_queue_sender: async_channel::Sender<NetMsg>,
+        notify_queue_sender: smol::channel::Sender<NetMsg>,
         p2p: net::P2pPtr,
         seen_msgs: Arc<Mutex<FxHashMap<String, i64>>>,
     ) -> net::ProtocolBasePtr {

+ 12 - 12
src/rpc/client.rs

@@ -18,9 +18,9 @@ use crate::{
 
 /// JSON-RPC client implementation using asynchronous channels.
 pub struct RpcClient {
-    send: async_channel::Sender<Value>,
-    recv: async_channel::Receiver<JsonResult>,
-    stop_signal: async_channel::Sender<()>,
+    send: smol::channel::Sender<Value>,
+    recv: smol::channel::Receiver<JsonResult>,
+    stop_signal: smol::channel::Sender<()>,
     url: Url,
 }
 
@@ -104,13 +104,13 @@ impl RpcClient {
     async fn open_channels(
         uri: &Url,
     ) -> Result<(
-        async_channel::Sender<Value>,
-        async_channel::Receiver<JsonResult>,
-        async_channel::Sender<()>,
+        smol::channel::Sender<Value>,
+        smol::channel::Receiver<JsonResult>,
+        smol::channel::Sender<()>,
     )> {
-        let (data_send, data_recv) = async_channel::unbounded();
-        let (result_send, result_recv) = async_channel::unbounded();
-        let (stop_send, stop_recv) = async_channel::unbounded();
+        let (data_send, data_recv) = smol::channel::unbounded();
+        let (result_send, result_recv) = smol::channel::unbounded();
+        let (stop_send, stop_recv) = smol::channel::unbounded();
 
         let transport_name = TransportName::try_from(uri.clone())?;
 
@@ -174,9 +174,9 @@ impl RpcClient {
     /// Internal function that loops on a given stream and multiplexes the data.
     async fn reqrep_loop<T: TransportStream>(
         mut stream: T,
-        result_send: async_channel::Sender<JsonResult>,
-        data_recv: async_channel::Receiver<Value>,
-        stop_recv: async_channel::Receiver<()>,
+        result_send: smol::channel::Sender<JsonResult>,
+        data_recv: smol::channel::Receiver<Value>,
+        stop_recv: smol::channel::Receiver<()>,
     ) -> Result<()> {
         // If we don't get a reply within 30 seconds, we'll fail.
         let read_timeout = Duration::from_secs(30);

+ 1 - 1
src/sdk/src/crypto/merkle_node.rs

@@ -54,6 +54,6 @@ impl FromStr for MerkleNode {
             return Ok(merkle_node)
         }
 
-        return Err(io::Error::new(io::ErrorKind::Other, "Invalid bytes for MerkleNode"))
+        Err(io::Error::new(io::ErrorKind::Other, "Invalid bytes for MerkleNode"))
     }
 }

+ 1 - 1
src/sdk/src/crypto/nullifier.rs

@@ -54,6 +54,6 @@ impl FromStr for Nullifier {
             return Ok(nullifier)
         }
 
-        return Err(io::Error::new(io::ErrorKind::Other, "Invalid bytes for Nullifier"))
+        Err(io::Error::new(io::ErrorKind::Other, "Invalid bytes for Nullifier"))
     }
 }

+ 2 - 3
src/stakeholder/mod.rs

@@ -1,13 +1,12 @@
-use std::fmt;
+use std::{fmt, thread, time::Duration};
 
-use async_executor::Executor;
 use async_std::sync::Arc;
 use halo2_proofs::arithmetic::Field;
 use incrementalmerkletree::{bridgetree::BridgeTree, Tree};
 use log::{debug, error, info};
 use pasta_curves::{group::ff::PrimeField, pallas};
 use rand::rngs::OsRng;
-use std::{thread, time::Duration};
+use smol::Executor;
 use url::Url;
 
 use crate::{

+ 6 - 5
src/system/stoppable_task.rs

@@ -1,17 +1,18 @@
-use async_executor::Executor;
+use async_std::sync::Arc;
+
 use futures::{Future, FutureExt};
-use std::sync::Arc;
+use smol::Executor;
 
 pub type StoppableTaskPtr = Arc<StoppableTask>;
 
 pub struct StoppableTask {
-    stop_send: async_channel::Sender<()>,
-    stop_recv: async_channel::Receiver<()>,
+    stop_send: smol::channel::Sender<()>,
+    stop_recv: smol::channel::Receiver<()>,
 }
 
 impl StoppableTask {
     pub fn new() -> Arc<Self> {
-        let (stop_send, stop_recv) = async_channel::unbounded();
+        let (stop_send, stop_recv) = smol::channel::unbounded();
         Arc::new(Self { stop_send, stop_recv })
     }
 

+ 4 - 6
src/system/subscriber.rs

@@ -1,6 +1,4 @@
-use async_std::sync::Mutex;
-use std::sync::Arc;
-
+use async_std::sync::{Arc, Mutex};
 use fxhash::FxHashMap;
 use log::warn;
 use rand::Rng;
@@ -11,7 +9,7 @@ pub type SubscriptionId = u64;
 
 pub struct Subscription<T> {
     id: SubscriptionId,
-    recv_queue: async_channel::Receiver<T>,
+    recv_queue: smol::channel::Receiver<T>,
     parent: Arc<Subscriber<T>>,
 }
 
@@ -39,7 +37,7 @@ impl<T: Clone> Subscription<T> {
 
 // Simple broadcast (publish-subscribe) class
 pub struct Subscriber<T> {
-    subs: Mutex<FxHashMap<u64, async_channel::Sender<T>>>,
+    subs: Mutex<FxHashMap<u64, smol::channel::Sender<T>>>,
 }
 
 impl<T: Clone> Subscriber<T> {
@@ -53,7 +51,7 @@ impl<T: Clone> Subscriber<T> {
     }
 
     pub async fn subscribe(self: Arc<Self>) -> Subscription<T> {
-        let (sender, recvr) = async_channel::unbounded();
+        let (sender, recvr) = smol::channel::unbounded();
 
         let sub_id = Self::random_id();
 

+ 1 - 1
src/zk/circuit/lead_contract.rs

@@ -367,7 +367,7 @@ impl Circuit<pallas::Base> for LeadContract {
         //
         let coin_pk = {
             let coin_pk_commit_v = FixedPointBaseField::from_inner(ecc_chip.clone(), NullifierK);
-            coin_pk_commit_v.mul(layouter.namespace(|| "coin pk commit v"), sk.clone())?
+            coin_pk_commit_v.mul(layouter.namespace(|| "coin pk commit v"), sk)?
         };
         let coin_pk_x = coin_pk.inner().x();
         let coin_pk_y = coin_pk.inner().y();