From 4f9f10cb64c9f7be0a5fc0e29040b373ef53f88e Mon Sep 17 00:00:00 2001 From: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:14:50 +0200 Subject: [PATCH 1/3] perf: box large AWS and GCP error variants in WalletSignerError --- crates/wallets/src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wallets/src/error.rs b/crates/wallets/src/error.rs index b322ef9797f07..c77f266f481d5 100644 --- a/crates/wallets/src/error.rs +++ b/crates/wallets/src/error.rs @@ -32,10 +32,10 @@ pub enum WalletSignerError { Trezor(#[from] TrezorError), #[error(transparent)] #[cfg(feature = "aws-kms")] - Aws(#[from] AwsSignerError), + Aws(#[from] Box), #[error(transparent)] #[cfg(feature = "gcp-kms")] - Gcp(#[from] GcpSignerError), + Gcp(#[from] Box), #[error(transparent)] Io(#[from] std::io::Error), #[error(transparent)] From f5dd0655dfef24219ea83decb429b941b0afb251 Mon Sep 17 00:00:00 2001 From: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:15:36 +0200 Subject: [PATCH 2/3] fix: update error handling for boxed AWS/GCP errors in wallet operations --- crates/wallets/src/wallet_signer.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/wallets/src/wallet_signer.rs b/crates/wallets/src/wallet_signer.rs index 63c9ccc4f555d..bce5f2dc865a4 100644 --- a/crates/wallets/src/wallet_signer.rs +++ b/crates/wallets/src/wallet_signer.rs @@ -60,7 +60,11 @@ impl WalletSigner { alloy_signer_aws::aws_config::load_defaults(BehaviorVersion::latest()).await; let client = AwsClient::new(&config); - Ok(Self::Aws(AwsSigner::new(client, key_id, None).await?)) + Ok(Self::Aws( + AwsSigner::new(client, key_id, None) + .await + .map_err(|e| WalletSignerError::Aws(Box::new(e)))?, + )) } #[cfg(not(feature = "aws-kms"))] @@ -88,12 +92,18 @@ impl WalletSigner { .await { Ok(c) => c, - Err(e) => return Err(WalletSignerError::from(GcpSignerError::GoogleKmsError(e))), + Err(e) => { + return Err(WalletSignerError::Gcp(Box::new(GcpSignerError::GoogleKmsError(e)))); + } }; let specifier = KeySpecifier::new(keyring, &key_name, key_version); - Ok(Self::Gcp(GcpSigner::new(client, specifier, None).await?)) + Ok(Self::Gcp( + GcpSigner::new(client, specifier, None) + .await + .map_err(|e| WalletSignerError::Gcp(Box::new(e)))?, + )) } #[cfg(not(feature = "gcp-kms"))] From 41e1a6f2c355f79a24e3b5ac2ea891d8c23d4a5d Mon Sep 17 00:00:00 2001 From: Bilog WEB3 <155262265+Bilogweb3@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:29:04 +0200 Subject: [PATCH 3/3] fmt --- crates/wallets/src/wallet_signer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/wallets/src/wallet_signer.rs b/crates/wallets/src/wallet_signer.rs index bce5f2dc865a4..28a81d541eb11 100644 --- a/crates/wallets/src/wallet_signer.rs +++ b/crates/wallets/src/wallet_signer.rs @@ -93,7 +93,9 @@ impl WalletSigner { { Ok(c) => c, Err(e) => { - return Err(WalletSignerError::Gcp(Box::new(GcpSignerError::GoogleKmsError(e)))); + return Err(WalletSignerError::Gcp(Box::new(GcpSignerError::GoogleKmsError( + e, + )))); } };