What changed, and why it matters
This commit is purely a code-style and build-maintenance change. It makes the Rust code generated from protocol-buffer definitions be formatted by rustfmt automatically and included in style checks. No security-sensitive behavior is changed.
No security action needed; this is a formatting/build-hygiene commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change updates the protobuf regeneration script to run rustfmt on generated Rust files and removes an exclusion in the CI style check so the generated file is now checked. The diff in the generated file is only whitespace/formatting (collapsing multi-line derive attribute lists to single lines, line-wrapping adjustments). No message definitions, field types, tags, or logic are altered.
Changed components
.ci/check-stylescripts/generate-protobuf-rust.shsrc/rust/bitbox-proto/src/generated/shiftcrypto.bitbox02.rsInspect captured patch +36 / −160
diff --git a/.ci/check-style b/.ci/check-style
index 4025e93..f61a182 100755
--- a/.ci/check-style
+++ b/.ci/check-style
@@ -39,7 +39,7 @@ if git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep
exit 1
fi
-RUST_SOURCES=$(git ls-files | grep "^src/rust.*\.rs\$" | grep -v "^src/rust/vendor" | grep -v "^src/rust/bitbox-proto/src/generated/shiftcrypto\.bitbox02\.rs$")
+RUST_SOURCES=$(git ls-files | grep "^src/rust.*\.rs\$" | grep -v "^src/rust/vendor")
if [ -n "$RUST_SOURCES" ] ; then
"$RUSTFMT" --check $RUST_SOURCES
fi
diff --git a/scripts/generate-protobuf-rust.sh b/scripts/generate-protobuf-rust.sh
index e183137..8db14eb 100755
--- a/scripts/generate-protobuf-rust.sh
+++ b/scripts/generate-protobuf-rust.sh
@@ -19,6 +19,12 @@ prost-build-proto \
"${ROOT_DIR}/messages" \
"${TMP_DIR}"
+rustfmt \
+ --edition 2024 \
+ "${ROOT_DIR}/src/rust/bitbox-proto/src/lib.rs" \
+ "${TMP_DIR}/shiftcrypto.bitbox02.rs" \
+ "${TMP_DIR}/shiftcrypto.bitbox02.backups.rs"
+
for filename in \
"shiftcrypto.bitbox02.rs" \
"shiftcrypto.bitbox02.backups.rs"
diff --git a/src/rust/bitbox-proto/src/generated/shiftcrypto.bitbox02.rs b/src/rust/bitbox-proto/src/generated/shiftcrypto.bitbox02.rs
index 2e90ef2..4cddb3a 100644
--- a/src/rust/bitbox-proto/src/generated/shiftcrypto.bitbox02.rs
+++ b/src/rust/bitbox-proto/src/generated/shiftcrypto.bitbox02.rs
@@ -164,17 +164,7 @@ pub struct InsertRemoveSdCardRequest {
}
/// Nested message and enum types in `InsertRemoveSDCardRequest`.
pub mod insert_remove_sd_card_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SdCardAction {
RemoveCard = 0,
@@ -332,15 +322,7 @@ pub mod btc_script_config {
/// Nested message and enum types in `Multisig`.
pub mod multisig {
#[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
+ Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
)]
#[repr(i32)]
pub enum ScriptType {
@@ -381,17 +363,7 @@ pub mod btc_script_config {
pub keys: ::prost::alloc::vec::Vec<super::KeyOriginInfo>,
}
/// SimpleType is a "simple" script: one public key, no additional inputs.
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SimpleType {
P2wpkhP2sh = 0,
@@ -445,17 +417,7 @@ pub struct BtcPubRequest {
}
/// Nested message and enum types in `BTCPubRequest`.
pub mod btc_pub_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum XPubType {
Tpub = 0,
@@ -532,17 +494,7 @@ pub struct BtcXpubsRequest {
}
/// Nested message and enum types in `BTCXpubsRequest`.
pub mod btc_xpubs_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum XPubType {
Unknown = 0,
@@ -609,17 +561,7 @@ pub struct BtcSignInitRequest {
}
/// Nested message and enum types in `BTCSignInitRequest`.
pub mod btc_sign_init_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum FormatUnit {
/// According to `coin` (BTC, LTC, etc.).
@@ -666,9 +608,7 @@ pub struct BtcSignNextResponse {
#[prost(uint32, tag = "5")]
pub prev_index: u32,
#[prost(message, optional, tag = "6")]
- pub anti_klepto_signer_commitment: ::core::option::Option<
- AntiKleptoSignerCommitment,
- >,
+ pub anti_klepto_signer_commitment: ::core::option::Option<AntiKleptoSignerCommitment>,
/// Generated output. The host *must* verify its correctness using `silent_payment_dleq_proof`.
#[prost(bytes = "vec", tag = "7")]
pub generated_output_pkscript: ::prost::alloc::vec::Vec<u8>,
@@ -677,17 +617,7 @@ pub struct BtcSignNextResponse {
}
/// Nested message and enum types in `BTCSignNextResponse`.
pub mod btc_sign_next_response {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Type {
Input = 0,
@@ -833,22 +763,15 @@ pub struct BtcRegisterScriptConfigRequest {
/// If empty, the name is entered on the device instead.
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
- #[prost(enumeration = "btc_register_script_config_request::XPubType", tag = "3")]
+ #[prost(
+ enumeration = "btc_register_script_config_request::XPubType",
+ tag = "3"
+ )]
pub xpub_type: i32,
}
/// Nested message and enum types in `BTCRegisterScriptConfigRequest`.
pub mod btc_register_script_config_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum XPubType {
/// Automatically choose to match Electrum's xpub format (e.g. Zpub/Vpub for p2wsh multisig mainnet/testnet).
@@ -952,9 +875,7 @@ pub mod btc_payment_request_request {
#[prost(string, tag = "3")]
pub address: ::prost::alloc::string::String,
#[prost(oneof = "coin_purchase_memo::AddressDerivation", tags = "4, 5")]
- pub address_derivation: ::core::option::Option<
- coin_purchase_memo::AddressDerivation,
- >,
+ pub address_derivation: ::core::option::Option<coin_purchase_memo::AddressDerivation>,
}
/// Nested message and enum types in `CoinPurchaseMemo`.
pub mod coin_purchase_memo {
@@ -972,9 +893,8 @@ pub mod btc_payment_request_request {
pub struct BtcAddressDerivation {
/// Script config + keypath are needed to derive BTC/LTC-family addresses.
#[prost(message, optional, tag = "1")]
- pub script_config: ::core::option::Option<
- super::super::super::BtcScriptConfigWithKeypath,
- >,
+ pub script_config:
+ ::core::option::Option<super::super::super::BtcScriptConfigWithKeypath>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
@@ -1220,13 +1140,9 @@ pub struct CardanoSignTransactionRequest {
#[prost(uint64, tag = "5")]
pub ttl: u64,
#[prost(message, repeated, tag = "6")]
- pub certificates: ::prost::alloc::vec::Vec<
- cardano_sign_transaction_request::Certificate,
- >,
+ pub certificates: ::prost::alloc::vec::Vec<cardano_sign_transaction_request::Certificate>,
#[prost(message, repeated, tag = "7")]
- pub withdrawals: ::prost::alloc::vec::Vec<
- cardano_sign_transaction_request::Withdrawal,
- >,
+ pub withdrawals: ::prost::alloc::vec::Vec<cardano_sign_transaction_request::Withdrawal>,
#[prost(uint64, tag = "8")]
pub validity_interval_start: u64,
/// include ttl even if it is zero
@@ -1314,15 +1230,7 @@ pub mod cardano_sign_transaction_request {
/// Nested message and enum types in `VoteDelegation`.
pub mod vote_delegation {
#[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
+ Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
)]
#[repr(i32)]
pub enum CardanoDRepType {
@@ -1382,9 +1290,8 @@ pub mod cardano_sign_transaction_request {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CardanoSignTransactionResponse {
#[prost(message, repeated, tag = "1")]
- pub shelley_witnesses: ::prost::alloc::vec::Vec<
- cardano_sign_transaction_response::ShelleyWitness,
- >,
+ pub shelley_witnesses:
+ ::prost::alloc::vec::Vec<cardano_sign_transaction_response::ShelleyWitness>,
}
/// Nested message and enum types in `CardanoSignTransactionResponse`.
pub mod cardano_sign_transaction_response {
@@ -1481,17 +1388,7 @@ pub struct EthPubRequest {
}
/// Nested message and enum types in `ETHPubRequest`.
pub mod eth_pub_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OutputType {
Address = 0,
@@ -1676,17 +1573,7 @@ pub mod eth_sign_typed_message_request {
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DataType {
Unknown = 0,
@@ -1737,24 +1624,17 @@ pub mod eth_sign_typed_message_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EthTypedMessageValueResponse {
- #[prost(enumeration = "eth_typed_message_value_response::RootObject", tag = "1")]
+ #[prost(
+ enumeration = "eth_typed_message_value_response::RootObject",
+ tag = "1"
+ )]
pub root_object: i32,
#[prost(uint32, repeated, tag = "2")]
pub path: ::prost::alloc::vec::Vec<u32>,
}
/// Nested message and enum types in `ETHTypedMessageValueResponse`.
pub mod eth_typed_message_value_response {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RootObject {
Unknown = 0,
@@ -1984,17 +1864,7 @@ pub struct RebootRequest {
}
/// Nested message and enum types in `RebootRequest`.
pub mod reboot_request {
- #[derive(
- Clone,
- Copy,
- Debug,
- PartialEq,
- Eq,
- Hash,
- PartialOrd,
- Ord,
- ::prost::Enumeration
- )]
+ #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Purpose {
Upgrade = 0,
Why this scored 15/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.