What changed, and why it matters
This commit is purely a code-formatting cleanup ("cargo fmt") on Rust files in the Avalanche app. It changes whitespace, line breaks, and import order, but does not alter any program logic, behavior, or security checks. There is no security issue here.
No action required; this is a formatting-only commit. Routine review/merge is sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows only rustfmt-style changes: collapsing or expanding array literals, reformatting macro calls, adding/removing braces around match arms, and reordering imports. No functional code, parsing logic, error handling, cryptographic operations, or FFI boundaries were modified. The changes are syntactic and should produce identical compiled output.
Changed components
rust/apps/avalanche/src/address.rsrust/apps/avalanche/src/encode/cb58.rsrust/apps/avalanche/src/lib.rsrust/apps/avalanche/src/transactions/P_chain/add_permissionless_delegator.rsrust/apps/avalanche/src/transactions/P_chain/add_permissionless_validator.rsrust/apps/avalanche/src/transactions/base_tx.rsrust/apps/avalanche/src/transactions/transferable.rsrust/apps/avalanche/src/transactions/tx_header.rsrust/rust_c/src/avalanche/mod.rsInspect captured patch +47 / −40
diff --git a/rust/apps/avalanche/src/address.rs b/rust/apps/avalanche/src/address.rs
index 00eb8be..3fc56a1 100644
--- a/rust/apps/avalanche/src/address.rs
+++ b/rust/apps/avalanche/src/address.rs
@@ -114,8 +114,8 @@ mod tests {
fn encode_and_evm_address_test() {
// 20-byte payload
let data: [u8; ADDRESS_LEN] = [
- 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x11, 0x22,
- 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc,
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
+ 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc,
];
let addr = Address { address: data };
let bech = addr.encode();
diff --git a/rust/apps/avalanche/src/encode/cb58.rs b/rust/apps/avalanche/src/encode/cb58.rs
index f6a6a87..b2ce43d 100644
--- a/rust/apps/avalanche/src/encode/cb58.rs
+++ b/rust/apps/avalanche/src/encode/cb58.rs
@@ -17,10 +17,6 @@ pub trait Cb58Encodable {
let mut with_checksum = data.to_vec();
with_checksum.extend_from_slice(&checksum[checksum.len() - 4..]);
- format!(
- "{}-{}",
- self.get_prefix(),
- base58::encode(&with_checksum)
- )
+ format!("{}-{}", self.get_prefix(), base58::encode(&with_checksum))
}
}
diff --git a/rust/apps/avalanche/src/lib.rs b/rust/apps/avalanche/src/lib.rs
index 5471111..a79abcc 100644
--- a/rust/apps/avalanche/src/lib.rs
+++ b/rust/apps/avalanche/src/lib.rs
@@ -4,10 +4,7 @@
#[allow(unused_imports)]
#[macro_use]
extern crate alloc;
-use alloc::{
- string::ToString,
- vec::Vec,
-};
+use alloc::{string::ToString, vec::Vec};
pub use address::get_address;
use bytes::{Buf, Bytes};
diff --git a/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_delegator.rs b/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_delegator.rs
index 9c98ea2..68b6278 100644
--- a/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_delegator.rs
+++ b/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_delegator.rs
@@ -70,7 +70,8 @@ impl AvaxTxInfo for AddPermissionlessDelegatorTx {
Some(
self.delegator_owner
.addresses
- .get(0).map(|addr| addr.encode())
+ .get(0)
+ .map(|addr| addr.encode())
.unwrap_or_default(),
)
}
diff --git a/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_validator.rs b/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_validator.rs
index 9540c9c..8fb2d62 100644
--- a/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_validator.rs
+++ b/rust/apps/avalanche/src/transactions/P_chain/add_permissionless_validator.rs
@@ -75,7 +75,8 @@ impl AvaxTxInfo for AddPermissionlessValidatorTx {
Some(
self.validator_owner
.addresses
- .get(0).map(|addr| addr.encode())
+ .get(0)
+ .map(|addr| addr.encode())
.unwrap_or_default(),
)
}
diff --git a/rust/apps/avalanche/src/transactions/base_tx.rs b/rust/apps/avalanche/src/transactions/base_tx.rs
index 18380d4..2ad8d39 100644
--- a/rust/apps/avalanche/src/transactions/base_tx.rs
+++ b/rust/apps/avalanche/src/transactions/base_tx.rs
@@ -152,9 +152,11 @@ mod tests {
assert_eq!(
"avax10j2f4qqnhmay06vjq7rkflmntvv2y66mzhk6s9",
result
- .get_outputs_addresses().first()
+ .get_outputs_addresses()
+ .first()
.unwrap()
- .address.first()
+ .address
+ .first()
.unwrap()
);
assert_eq!(result.get_inputs_len(), 2);
@@ -181,12 +183,14 @@ mod tests {
);
assert_eq!(result.get_outputs_len(), 2);
}
- Err(e) => if let AvaxError::InvalidHex(msg) = e {
- assert_eq!(
- msg, "Unsupported output type found in input bytes.",
- "Unexpected error message"
- );
- },
+ Err(e) => {
+ if let AvaxError::InvalidHex(msg) = e {
+ assert_eq!(
+ msg, "Unsupported output type found in input bytes.",
+ "Unexpected error message"
+ );
+ }
+ }
}
}
}
diff --git a/rust/apps/avalanche/src/transactions/transferable.rs b/rust/apps/avalanche/src/transactions/transferable.rs
index 9368eda..49ab7fd 100644
--- a/rust/apps/avalanche/src/transactions/transferable.rs
+++ b/rust/apps/avalanche/src/transactions/transferable.rs
@@ -56,11 +56,9 @@ impl TryFrom<Bytes> for OutputType {
TypeId::Secp256k1TransferOutput => {
SECP256K1TransferOutput::try_from(bytes).map(OutputType::SECP256K1)
}
- _ => {
- Err(AvaxError::InvalidHex(
- "Unsupported output type found in input bytes.".to_string(),
- ))
- }
+ _ => Err(AvaxError::InvalidHex(
+ "Unsupported output type found in input bytes.".to_string(),
+ )),
}
}
}
@@ -169,11 +167,9 @@ impl TryFrom<Bytes> for InputType {
TypeId::Secp256k1TransferInput => Ok(InputType::SECP256K1(
SECP256K1TransferInput::try_from(bytes)?,
)),
- _ => {
- Err(AvaxError::InvalidHex(
- "Unsupported input type found in input bytes.".to_string(),
- ))
- }
+ _ => Err(AvaxError::InvalidHex(
+ "Unsupported input type found in input bytes.".to_string(),
+ )),
}
}
}
diff --git a/rust/apps/avalanche/src/transactions/tx_header.rs b/rust/apps/avalanche/src/transactions/tx_header.rs
index 69d0c6a..8db7e0a 100644
--- a/rust/apps/avalanche/src/transactions/tx_header.rs
+++ b/rust/apps/avalanche/src/transactions/tx_header.rs
@@ -1,8 +1,8 @@
use crate::constants::*;
use crate::errors::{AvaxError, Result};
+use alloc::string::ToString;
use bytes::{Buf, Bytes};
use core::convert::TryFrom;
-use alloc::string::ToString;
pub type BlockChainId = [u8; BLOCKCHAIN_ID_LEN];
diff --git a/rust/rust_c/src/avalanche/mod.rs b/rust/rust_c/src/avalanche/mod.rs
index 0dfe6b7..69d8b99 100644
--- a/rust/rust_c/src/avalanche/mod.rs
+++ b/rust/rust_c/src/avalanche/mod.rs
@@ -15,7 +15,7 @@ use crate::common::{
utils::{recover_c_array, recover_c_char},
};
use crate::{extract_array, extract_ptr_with_type};
-use alloc::{format, string::ToString, string::String};
+use alloc::{format, string::String, string::ToString};
use app_avalanche::{
constants::{
C_BLOCKCHAIN_ID, C_CHAIN_PREFIX, C_TEST_BLOCKCHAIN_ID, P_BLOCKCHAIN_ID, X_BLOCKCHAIN_ID,
@@ -67,14 +67,25 @@ unsafe fn parse_transaction_by_type(
let tx_data = sign_request.get_tx_data();
let type_id = match get_avax_tx_type_id(sign_request.get_tx_data()) {
Ok(type_id) => type_id,
- Err(_) => return TransactionParseResult::from(RustCError::InvalidData("invalid avax tx type id".to_string())).c_ptr(),
- };
-
- let mut path = match determine_derivation_path(type_id, sign_request, sign_request.get_wallet_index()) {
- Ok(path) => path,
- Err(_) => return TransactionParseResult::from(RustCError::InvalidData("invalid derivation path".to_string())).c_ptr(),
+ Err(_) => {
+ return TransactionParseResult::from(RustCError::InvalidData(
+ "invalid avax tx type id".to_string(),
+ ))
+ .c_ptr()
+ }
};
+ let mut path =
+ match determine_derivation_path(type_id, sign_request, sign_request.get_wallet_index()) {
+ Ok(path) => path,
+ Err(_) => {
+ return TransactionParseResult::from(RustCError::InvalidData(
+ "invalid derivation path".to_string(),
+ ))
+ .c_ptr()
+ }
+ };
+
let mut address = String::new();
for key in recover_c_array(public_keys).iter() {
if recover_c_char(key.path) == path.base_path {
@@ -90,7 +101,8 @@ unsafe fn parse_transaction_by_type(
path.full_path.as_str(),
&recover_c_char(key.xpub),
path.base_path.as_str(),
- ).unwrap_or("".to_string()),
+ )
+ .unwrap_or("".to_string()),
}
}
}
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.