From 6e6675f7bffcc795f08a17c0e6d15c8a7cbcb829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-=C8=98tefan=20Neac=C5=9Fu?= Date: Wed, 22 Jan 2025 15:46:05 +0100 Subject: [PATCH] Handle ecash network errors differently (#5378) --- common/client-libs/validator-client/src/coconut/mod.rs | 6 ++++++ .../credential-verification/src/ecash/credential_sender.rs | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/client-libs/validator-client/src/coconut/mod.rs b/common/client-libs/validator-client/src/coconut/mod.rs index 09ce560b1c5..95270a25ed9 100644 --- a/common/client-libs/validator-client/src/coconut/mod.rs +++ b/common/client-libs/validator-client/src/coconut/mod.rs @@ -65,6 +65,12 @@ pub enum EcashApiError { #[from] source: cosmrs::ErrorReport, }, + + #[error("nym api error")] + NymApi { + #[from] + source: crate::ValidatorClientError, + }, } impl TryFrom for EcashApiClient { diff --git a/common/credential-verification/src/ecash/credential_sender.rs b/common/credential-verification/src/ecash/credential_sender.rs index 140e3e4b4d0..4d4a0b8fe61 100644 --- a/common/credential-verification/src/ecash/credential_sender.rs +++ b/common/credential-verification/src/ecash/credential_sender.rs @@ -13,6 +13,7 @@ use nym_api_requests::constants::MIN_BATCH_REDEMPTION_DELAY; use nym_api_requests::ecash::models::{BatchRedeemTicketsBody, VerifyEcashTicketBody}; use nym_credentials_interface::Bandwidth; use nym_credentials_interface::{ClientTicket, TicketType}; +use nym_validator_client::coconut::EcashApiError; use nym_validator_client::nym_api::EpochId; use nym_validator_client::nyxd::contract_traits::{ EcashSigningClient, MultisigQueryClient, MultisigSigningClient, PagedMultisigQueryClient, @@ -352,7 +353,9 @@ impl CredentialHandler { } Err(err) => { error!("failed to send ticket {ticket_id} for verification to ecash signer '{client}': {err}. if we don't reach quorum, we'll retry later"); - Ok(false) + Err(EcashTicketError::ApiFailure(EcashApiError::NymApi { + source: err, + })) } } }