From 4d9916570f05934d845450f629b467da04498be4 Mon Sep 17 00:00:00 2001 From: Luke Tchang Date: Wed, 25 May 2022 14:15:00 -0700 Subject: [PATCH] fix(signers): aws eip712 does not use eip155 (#1309) * fix(signers): aws eip712 does not use eip155 * chore: update changelog * chore: lints Co-authored-by: Georgios Konstantopoulos --- CHANGELOG.md | 1 + ethers-signers/src/aws/mod.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63ff4482..c8b2a0ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Unreleased +- AWS EIP712 data signing no longer signs with EIP155 - Added Cronos testnet to etherscan options [1276](https://github.com/gakonst/ethers-rs/pull/1276) - Fix parsing of a pending block [1272](https://github.com/gakonst/ethers-rs/pull/1272) diff --git a/ethers-signers/src/aws/mod.rs b/ethers-signers/src/aws/mod.rs index 784f59d6..d489bfe7 100644 --- a/ethers-signers/src/aws/mod.rs +++ b/ethers-signers/src/aws/mod.rs @@ -251,11 +251,14 @@ impl<'a> super::Signer for AwsSigner<'a> { &self, payload: &T, ) -> Result { - let hash = payload.encode_eip712().map_err(|e| Self::Error::Eip712Error(e.to_string()))?; + let digest = + payload.encode_eip712().map_err(|e| Self::Error::Eip712Error(e.to_string()))?; - let digest = self.sign_digest_with_eip155(hash.into(), self.chain_id).await?; + let sig = self.sign_digest(digest).await?; + let sig = utils::rsig_from_digest_bytes_trial_recovery(&sig, digest, &self.pubkey); + let sig = rsig_to_ethsig(&sig); - Ok(digest) + Ok(sig) } fn address(&self) -> Address {