Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Oct 1, 2024
1 parent da7a3c4 commit ad674fd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
4 changes: 0 additions & 4 deletions bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ impl FfiSignatureRequest {
account_address: String,
chain_id: u64,
block_number: u64,
hash: Vec<u8>,
) -> Result<(), GenericError> {
let mut inner = self.inner.lock().await;
let account_id = AccountId::new_evm(chain_id, account_address);
Expand All @@ -216,9 +215,6 @@ impl FfiSignatureRequest {
account_id,
block_number,
chain_id,
hash.try_into().map_err(|_| GenericError::Generic {
err: "Hash byte array is wrong length. (Should be 32)".to_string(),
})?,
);
inner
.add_signature(signature, self.scw_verifier.clone().as_ref())
Expand Down
5 changes: 0 additions & 5 deletions bindings_wasm/src/mls_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ impl WasmClient {
chain_id: u64,
account_address: String,
block_number: u64,
hash: Uint8Array,
) -> Result<(), JsError> {
if self.is_registered() {
return Err(JsError::new(
Expand All @@ -180,10 +179,6 @@ impl WasmClient {
account_id,
block_number,
chain_id,
hash
.to_vec()
.try_into()
.map_err(|_| JsError::new("Hash byte array is wrong length. (Should be 32)"))?,
);

self.signatures.insert(
Expand Down
3 changes: 0 additions & 3 deletions xmtp_id/src/associations/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ impl TryFrom<SignatureWrapperProto> for UnverifiedSignature {
sig.account_id.try_into()?,
sig.block_number,
sig.chain_id,
sig.hash
.try_into()
.map_err(|_| DeserializationError::InvalidHash)?,
),
),
};
Expand Down
10 changes: 7 additions & 3 deletions xmtp_id/src/associations/unverified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use super::{
AccountId, Action, AddAssociation, CreateInbox, IdentityUpdate, RevokeAssociation,
SignatureError,
};
use ethers::{abi::AbiEncode, types::H256};
use futures::future::try_join_all;
use sha2::Digest;
use xmtp_cryptography::hash::sha256_bytes;
use xmtp_proto::xmtp::message_contents::SignedPublicKey as LegacySignedPublicKeyProto;

#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -295,14 +298,12 @@ impl UnverifiedSignature {
account_id: AccountId,
block_number: u64,
chain_id: u64,
hash: [u8; 32],
) -> Self {
Self::SmartContractWallet(UnverifiedSmartContractWalletSignature::new(
signature,
account_id,
block_number,
chain_id,
hash,
))
}

Expand Down Expand Up @@ -358,8 +359,11 @@ impl UnverifiedSmartContractWalletSignature {
account_id: AccountId,
block_number: u64,
chain_id: u64,
hash: [u8; 32],
) -> Self {
let hash = sha256_bytes(&signature_bytes)
.try_into()
.expect("SHA256 hash should be 32 bytes");

Self {
signature_bytes,
account_id,
Expand Down

0 comments on commit ad674fd

Please sign in to comment.