chore(rust): remove unneeded `script_type` from Trezor::get_public_key()
What changed, and why it matters
This is a small cleanup change in the Rust Trezor client library. It removes an unused `script_type` parameter from the `get_public_key()` function and its callers. The parameter was being set in the request to the Trezor device, but the device does not actually need or use it for this operation. There is no security vulnerability here—just code simplification.
No security action needed. This is a routine API cleanup. Consumers of the Rust client library will need to update call sites to remove the `script_type` argument when upgrading.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the script_type: InputScriptType argument from Trezor::get_public_key() in rust/trezor-client/src/client/bitcoin.rs and updates three example files to match the new signature. Internally, it also removes the req.set_script_type(script_type) call. The GetPublicKey protobuf message in Trezor firmware does not require or consume a script type for deriving an xpub; the field appears to have been unnecessary. This is a non-functional refactor with no behavioral change to the device communication.
Changed components
rust/trezor-client/src/client/bitcoin.rsrust/trezor-client/examples/interaction.rsrust/trezor-client/examples/sign_message.rsrust/trezor-client/examples/sign_tx.rsInspect captured patch +0 / −5
diff --git a/rust/trezor-client/examples/interaction.rs b/rust/trezor-client/examples/interaction.rs
index 190c99ff..908b28ae 100644
--- a/rust/trezor-client/examples/interaction.rs
+++ b/rust/trezor-client/examples/interaction.rs
@@ -40,7 +40,6 @@ fn do_main() -> Result<(), trezor_client::Error> {
bip32::ChildNumber::from_hardened_idx(0).unwrap(),
]
.into(),
- trezor_client::protos::InputScriptType::SPENDADDRESS,
Network::Testnet,
true,
)?,
diff --git a/rust/trezor-client/examples/sign_message.rs b/rust/trezor-client/examples/sign_message.rs
index fd804ef2..49a7518b 100644
--- a/rust/trezor-client/examples/sign_message.rs
+++ b/rust/trezor-client/examples/sign_message.rs
@@ -14,7 +14,6 @@ fn main() {
trezor
.get_public_key(
&DerivationPath::from_str("m/44h/1h/0h/0/0").unwrap(),
- trezor_client::protos::InputScriptType::SPENDADDRESS,
Network::Testnet,
true,
)
diff --git a/rust/trezor-client/examples/sign_tx.rs b/rust/trezor-client/examples/sign_tx.rs
index ad60e0dd..40280e3e 100644
--- a/rust/trezor-client/examples/sign_tx.rs
+++ b/rust/trezor-client/examples/sign_tx.rs
@@ -65,7 +65,6 @@ fn main() {
bip32::ChildNumber::from_hardened_idx(1).unwrap(),
]
.into(),
- trezor_client::protos::InputScriptType::SPENDADDRESS,
Network::Testnet,
true,
)
diff --git a/rust/trezor-client/src/client/bitcoin.rs b/rust/trezor-client/src/client/bitcoin.rs
index ed3b204a..992f7813 100644
--- a/rust/trezor-client/src/client/bitcoin.rs
+++ b/rust/trezor-client/src/client/bitcoin.rs
@@ -11,7 +11,6 @@ impl Trezor {
pub fn get_public_key(
&mut self,
path: &bip32::DerivationPath,
- script_type: InputScriptType,
network: Network,
show_display: bool,
) -> Result<TrezorResponse<'_, bip32::Xpub, protos::PublicKey>> {
@@ -19,7 +18,6 @@ impl Trezor {
req.address_n = utils::convert_path(path);
req.set_show_display(show_display);
req.set_coin_name(utils::coin_name(network)?);
- req.set_script_type(script_type);
self.call(req, Box::new(|_, m| Ok(m.xpub().parse()?)))
}
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.