From 04d5e335250fd5abc30ac0a868b1b49ce626d44b Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 23 Feb 2024 13:32:09 +0400 Subject: [PATCH 1/3] fix(forge): use --from if specified for call --- crates/wallets/src/wallet.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/wallets/src/wallet.rs b/crates/wallets/src/wallet.rs index a15f805b93fc..47e757bf7d4a 100644 --- a/crates/wallets/src/wallet.rs +++ b/crates/wallets/src/wallet.rs @@ -130,12 +130,18 @@ of the unlocked account you want to use, or provide the --from flag with the add Ok(signer) } - /// Returns the sender address of the signer or `from`. + /// This function preferes the `from` field and may return address different from the configured + /// signer + /// If from is specified, returns it + /// If from is not specified, but there is a signer configured, returns the signer's address + /// If from is not specified and there is no signer configured, returns zero address pub async fn sender(&self) -> Address { - if let Ok(signer) = self.signer().await { + if let Some(from) = self.from { + from + } else if let Ok(signer) = self.signer().await { signer.address().to_alloy() } else { - self.from.unwrap_or(Address::ZERO) + Address::ZERO } } } From 581a8f781e21639e09f65e7c4501aa42106a5a74 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 23 Feb 2024 17:53:12 +0400 Subject: [PATCH 2/3] Update crates/wallets/src/wallet.rs Co-authored-by: Enrique --- crates/wallets/src/wallet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wallets/src/wallet.rs b/crates/wallets/src/wallet.rs index 47e757bf7d4a..1c89d6bb585a 100644 --- a/crates/wallets/src/wallet.rs +++ b/crates/wallets/src/wallet.rs @@ -130,7 +130,7 @@ of the unlocked account you want to use, or provide the --from flag with the add Ok(signer) } - /// This function preferes the `from` field and may return address different from the configured + /// This function prefers the `from` field and may return a different address from the configured /// signer /// If from is specified, returns it /// If from is not specified, but there is a signer configured, returns the signer's address From a5523c38d0b8d5bbaf848f0c97da8c5ef166928d Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 23 Feb 2024 18:09:42 +0400 Subject: [PATCH 3/3] fmt --- crates/wallets/src/wallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wallets/src/wallet.rs b/crates/wallets/src/wallet.rs index 1c89d6bb585a..0cb06980df65 100644 --- a/crates/wallets/src/wallet.rs +++ b/crates/wallets/src/wallet.rs @@ -130,8 +130,8 @@ of the unlocked account you want to use, or provide the --from flag with the add Ok(signer) } - /// This function prefers the `from` field and may return a different address from the configured - /// signer + /// This function prefers the `from` field and may return a different address from the + /// configured signer /// If from is specified, returns it /// If from is not specified, but there is a signer configured, returns the signer's address /// If from is not specified and there is no signer configured, returns zero address