What changed, and why it matters
This commit is purely a code-formatting cleanup using rustfmt. It adjusts whitespace, line breaks, and removes blank lines in Tron-related Rust files. The only non-cosmetic-looking change is adding a `fragment_len` parameter to a C-exported signing function, but the diff shows it is simply passed through to an existing encoder call and does not alter security logic.
No security action required. Treat as normal style/formatting maintenance. If desired, verify that callers of `tron_sign_request` supply an appropriate `fragment_len` value, but the diff itself does not indicate a vulnerability.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a rustfmt run on five Rust files under rust/apps/tron and rust/rust_c/src/tron. Changes are whitespace/line-wrapping only, plus removal of a trailing blank line. In rust/rust_c/src/tron/mod.rs, tron_sign_request gains a new fragment_len: usize argument and uses it instead of the constant FRAGMENT_MAX_LENGTH_DEFAULT when calling UREncodeResult::encode. This is a parameter plumbing change, not a logic change, and there is no evidence of bounds checking or safety implications in the diff.
Changed components
rust/apps/tron/src/address.rsrust/apps/tron/src/lib.rsrust/apps/tron/src/transaction/wrapped_tron.rsrust/apps/tron/src/utils.rsrust/rust_c/src/tron/mod.rsInspect captured patch +17 / −14
diff --git a/rust/apps/tron/src/address.rs b/rust/apps/tron/src/address.rs
index da56cd2..a179e8d 100644
--- a/rust/apps/tron/src/address.rs
+++ b/rust/apps/tron/src/address.rs
@@ -15,9 +15,12 @@ macro_rules! check_hd_path {
} else {
let coin_type_idx = if $t.len() == 6 { 2 } else { 1 };
let coin_type = $t[coin_type_idx];
-
+
if coin_type != "194'" && coin_type != "195'" {
- result = Err(TronError::InvalidHDPath(format!("Coin type mismatch: {}", coin_type)));
+ result = Err(TronError::InvalidHDPath(format!(
+ "Coin type mismatch: {}",
+ coin_type
+ )));
}
}
result
diff --git a/rust/apps/tron/src/lib.rs b/rust/apps/tron/src/lib.rs
index 9b2ae46..50171d1 100644
--- a/rust/apps/tron/src/lib.rs
+++ b/rust/apps/tron/src/lib.rs
@@ -73,11 +73,7 @@ pub fn parse_tx_request(sign_data: &[u8], path: &String) -> Result<ParsedTx> {
tx.parse()
}
-pub fn check_tx_request(
- sign_data: &[u8],
- path: &str,
- xpub: &str
- ) -> errors::Result<()> {
+pub fn check_tx_request(sign_data: &[u8], path: &str, xpub: &str) -> errors::Result<()> {
let derived_address = get_address(path.to_string(), &xpub.to_string())?;
let tx = decode_to_wrapped(sign_data, path.to_string())?;
diff --git a/rust/apps/tron/src/transaction/wrapped_tron.rs b/rust/apps/tron/src/transaction/wrapped_tron.rs
index ee114c6..fd45eb0 100644
--- a/rust/apps/tron/src/transaction/wrapped_tron.rs
+++ b/rust/apps/tron/src/transaction/wrapped_tron.rs
@@ -554,7 +554,10 @@ mod tests {
let mut tx = WrappedTron::from_payload(payload, &context).unwrap();
tx.from = "TAddressNotMine".to_string();
- assert!(matches!(tx.check_input(&context), Err(TronError::NoMyInputs)));
+ assert!(matches!(
+ tx.check_input(&context),
+ Err(TronError::NoMyInputs)
+ ));
}
#[test]
@@ -565,12 +568,12 @@ mod tests {
let context = prepare_parse_context(pubkey_str);
let mut tx = WrappedTron::from_payload(payload, &context).unwrap();
- tx.xfp = hex::encode(context.master_fingerprint);
-
+ tx.xfp = hex::encode(context.master_fingerprint);
+
tx.from = "TUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdX".to_string();
-
+
let result = tx.check_input(&context);
-
+
assert!(matches!(result, Err(TronError::NoMyInputs)));
}
diff --git a/rust/apps/tron/src/utils.rs b/rust/apps/tron/src/utils.rs
index 1ada3e2..1d3f67c 100644
--- a/rust/apps/tron/src/utils.rs
+++ b/rust/apps/tron/src/utils.rs
@@ -7,4 +7,3 @@ pub fn base58check_to_u8_slice(input: String) -> Result<Vec<u8>> {
let result = base58::decode_check(input.as_str())?;
Ok(result)
}
-
diff --git a/rust/rust_c/src/tron/mod.rs b/rust/rust_c/src/tron/mod.rs
index a7ccae7..054adf8 100644
--- a/rust/rust_c/src/tron/mod.rs
+++ b/rust/rust_c/src/tron/mod.rs
@@ -85,6 +85,7 @@ pub unsafe extern "C" fn tron_sign_request(
ptr: PtrUR,
seed: PtrBytes,
seed_len: u32,
+ fragment_len: usize,
) -> *mut UREncodeResult {
let req = extract_ptr_with_type!(ptr, TronSignRequest);
let seed_slice = extract_array!(seed, u8, seed_len as usize);
@@ -112,13 +113,14 @@ pub unsafe extern "C" fn tron_sign_request(
Ok(data) => UREncodeResult::encode(
data,
TronSignature::get_registry_type().get_type(),
- FRAGMENT_MAX_LENGTH_DEFAULT,
+ fragment_len,
)
.c_ptr(),
Err(e) => UREncodeResult::from(e).c_ptr(),
}
}
+
#[no_mangle]
pub unsafe extern "C" fn tron_check_keystone(
ptr: PtrUR,
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.