From 359f038dffba0a32c1147e5f4f47de49413e64f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 5 Jan 2024 12:23:52 +0000 Subject: [PATCH] removed the dkg client retries --- nym-api/src/coconut/dkg/client.rs | 68 ++++--------------------------- 1 file changed, 7 insertions(+), 61 deletions(-) diff --git a/nym-api/src/coconut/dkg/client.rs b/nym-api/src/coconut/dkg/client.rs index dc6cd83d47..630b7976fa 100644 --- a/nym-api/src/coconut/dkg/client.rs +++ b/nym-api/src/coconut/dkg/client.rs @@ -23,11 +23,6 @@ pub(crate) struct DkgClient { } impl DkgClient { - // FIXME: - // Some queries simply don't work the first time - // Until we determine why that is, retry the query a few more times - const RETRIES: usize = 3; - pub(crate) fn new(nyxd_client: C) -> Self where C: Client + Send + Sync + 'static, @@ -42,27 +37,11 @@ impl DkgClient { } pub(crate) async fn get_current_epoch(&self) -> Result { - let mut ret = self.inner.get_current_epoch().await; - for _ in 0..Self::RETRIES { - if ret.is_ok() { - return ret; - } - tokio::time::sleep(Duration::from_millis(200)).await; - ret = self.inner.get_current_epoch().await; - } - ret + self.inner.get_current_epoch().await } pub(crate) async fn get_contract_state(&self) -> Result { - let mut ret = self.inner.contract_state().await; - for _ in 0..Self::RETRIES { - if ret.is_ok() { - return ret; - } - tokio::time::sleep(Duration::from_millis(200)).await; - ret = self.inner.contract_state().await; - } - ret + self.inner.contract_state().await } pub(crate) async fn group_member(&self) -> Result { @@ -100,23 +79,10 @@ impl DkgClient { ) -> Result { let address = self.inner.address().await.to_string(); - let mut ret = self - .inner + self.inner .get_dealing_status(epoch_id, address.clone(), dealing_index) .await - .map(|r| r.dealing_submitted); - for _ in 0..Self::RETRIES { - if ret.is_ok() { - return ret; - } - tokio::time::sleep(Duration::from_millis(200)).await; - ret = self - .inner - .get_dealing_status(epoch_id, address.clone(), dealing_index) - .await - .map(|r| r.dealing_submitted); - } - ret + .map(|r| r.dealing_submitted) } pub(crate) async fn get_dealings( @@ -124,15 +90,7 @@ impl DkgClient { epoch_id: EpochId, dealer: String, ) -> Result, CoconutError> { - let mut ret = self.inner.get_dealings(epoch_id, &dealer).await; - for _ in 0..Self::RETRIES { - if ret.is_ok() { - return ret; - } - tokio::time::sleep(Duration::from_millis(200)).await; - ret = self.inner.get_dealings(epoch_id, &dealer).await; - } - ret + self.inner.get_dealings(epoch_id, &dealer).await } pub(crate) async fn get_verification_key_shares( @@ -188,21 +146,9 @@ impl DkgClient { share: VerificationKeyShare, resharing: bool, ) -> Result { - let mut ret = self - .inner + self.inner .submit_verification_key_share(share.clone(), resharing) - .await; - for _ in 0..Self::RETRIES { - if let Ok(res) = ret { - return Ok(res); - } - tokio::time::sleep(Duration::from_millis(200)).await; - ret = self - .inner - .submit_verification_key_share(share.clone(), resharing) - .await; - } - ret + .await } pub(crate) async fn vote_verification_key_share(