Skip to content

Commit

Permalink
chore(deps): bump trezor-client (#2749)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Feb 27, 2024
1 parent 8192609 commit f86ab1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 2 additions & 4 deletions ethers-signers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ coins-ledger = { version = "0.10.1", default-features = false, optional = true }
semver = { workspace = true, optional = true }

# trezor
# TODO: bump this and remove protobuf pin
trezor-client = { version = "=0.1.0", default-features = false, features = [
trezor-client = { version = "=0.1.3", default-features = false, features = [
"ethereum",
], optional = true }
protobuf = { version = "=3.2.0", optional = true }

# yubi
yubihsm = { version = "0.42", features = ["secp256k1", "http", "usb"], optional = true }
Expand All @@ -81,6 +79,6 @@ celo = ["ethers-core/celo"]
optimism = ["ethers-core/optimism"]

ledger = ["coins-ledger", "futures", "semver"]
trezor = ["trezor-client", "futures", "semver", "home", "protobuf"]
trezor = ["trezor-client", "futures", "semver", "home"]
aws = ["rusoto_core/rustls", "rusoto_kms/rustls", "spki"]
yubi = ["yubihsm"]
16 changes: 12 additions & 4 deletions ethers-signers/src/trezor/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl TrezorEthereum {

let transaction = TrezorTransaction::load(tx)?;

let chain_id = tx.chain_id().map(|id| id.as_u64()).unwrap_or(self.chain_id);
let chain_id = Some(tx.chain_id().map(|id| id.as_u64()).unwrap_or(self.chain_id));

let signature = match tx {
TypedTransaction::Eip2930(_) | TypedTransaction::Legacy(_) => client.ethereum_sign_tx(
Expand All @@ -194,11 +194,15 @@ impl TrezorEthereum {
)?,
#[cfg(feature = "optimism")]
TypedTransaction::DepositTransaction(tx) => {
trezor_client::client::Signature { r: 0.into(), s: 0.into(), v: 0 }
trezor_client::client::Signature { r: [0; 32], s: [0; 32], v: 0 }
}
};

Ok(Signature { r: signature.r, s: signature.s, v: signature.v })
Ok(Signature {
r: U256::from_big_endian(&signature.r),
s: U256::from_big_endian(&signature.s),
v: signature.v,
})
}

/// Signs an ethereum personal message
Expand All @@ -209,7 +213,11 @@ impl TrezorEthereum {

let signature = client.ethereum_sign_message(message.into(), apath)?;

Ok(Signature { r: signature.r, s: signature.s, v: signature.v })
Ok(Signature {
r: U256::from_big_endian(&signature.r),
s: U256::from_big_endian(&signature.s),
v: signature.v,
})
}

/// Signs an EIP712 encoded domain separator and message
Expand Down

0 comments on commit f86ab1f

Please sign in to comment.