What changed, and why it matters
This commit is purely a code cleanup: it removes an unused duplicate import in an Avalanche test file and applies formatting (whitespace and line wrapping) to XRP test files. There are no functional code changes, no bug fixes affecting runtime behavior, and no security-relevant modifications.
No security action required. Treat as routine formatting/build-fix cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff shows three files changed, all in Rust test modules. In rust/apps/avalanche/src/transactions/P_chain/validator.rs, a redundant use crate::encode::cb58::Cb58Encodable; line is removed. In rust/apps/xrp/src/address/mod.rs and rust/apps/xrp/src/lib.rs, only formatting changes are made: trailing whitespace removal, blank-line cleanup, and rustfmt-style line wrapping of long assert_eq! calls. No production logic, parsing, validation, or cryptographic code is altered.
Changed components
rust/apps/avalanche/src/transactions/P_chain/validator.rs (tests only)rust/apps/xrp/src/address/mod.rs (tests only)rust/apps/xrp/src/lib.rs (tests only)Inspect captured patch +22 / −16
diff --git a/rust/apps/avalanche/src/transactions/P_chain/validator.rs b/rust/apps/avalanche/src/transactions/P_chain/validator.rs
index 26f3bae..3a66b7b 100644
--- a/rust/apps/avalanche/src/transactions/P_chain/validator.rs
+++ b/rust/apps/avalanche/src/transactions/P_chain/validator.rs
@@ -38,7 +38,6 @@ mod tests {
use crate::encode::cb58::Cb58Encodable;
use super::*;
- use crate::encode::cb58::Cb58Encodable;
#[test]
fn test_validator_parse() {
diff --git a/rust/apps/xrp/src/address/mod.rs b/rust/apps/xrp/src/address/mod.rs
index 49702ee..076608b 100644
--- a/rust/apps/xrp/src/address/mod.rs
+++ b/rust/apps/xrp/src/address/mod.rs
@@ -47,14 +47,13 @@ mod tests {
let address = get_address(path, extended_pub_key, root_path).unwrap();
assert_eq!("r4Sh61HP7nxB6mQxXSSeN2DCkG3sTrzb2c".to_string(), address);
}
-
}
#[test]
fn test_invalid_hd_path_prefix() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'";
-
+
// HD path doesn't start with root path
let path = "44'/144'/1'/0/0";
let result = get_address(path, extended_pub_key, root_path);
@@ -66,7 +65,7 @@ mod tests {
fn test_completely_different_path() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'";
-
+
// Completely different path
let path = "44'/60'/0'/0/0";
let result = get_address(path, extended_pub_key, root_path);
@@ -78,7 +77,7 @@ mod tests {
fn test_empty_hd_path() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'";
-
+
// Empty HD path
let path = "";
let result = get_address(path, extended_pub_key, root_path);
@@ -88,7 +87,7 @@ mod tests {
#[test]
fn test_empty_root_path() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
-
+
// Empty root path should still work if path is also appropriate
let root_path = "";
let path = "0/0";
@@ -100,7 +99,7 @@ mod tests {
fn test_invalid_extended_pub_key() {
let root_path = "44'/144'/0'";
let path = "44'/144'/0'/0/0";
-
+
// Invalid extended public key format
let invalid_xpub = "invalid_xpub_key";
let result = get_address(path, invalid_xpub, root_path);
@@ -111,7 +110,7 @@ mod tests {
fn test_malformed_extended_pub_key() {
let root_path = "44'/144'/0'";
let path = "44'/144'/0'/0/0";
-
+
// Malformed extended public key (too short)
let invalid_xpub = "xpub";
let result = get_address(path, invalid_xpub, root_path);
@@ -122,7 +121,7 @@ mod tests {
fn test_path_shorter_than_root() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'/0/0";
-
+
// Path is shorter than root path
let path = "44'/144'/0'";
let result = get_address(path, extended_pub_key, root_path);
@@ -134,7 +133,7 @@ mod tests {
fn test_malformed_hd_path_format() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'";
-
+
// Malformed HD path (invalid characters)
let path = "44'/144'/0'/0/abc";
let result = get_address(path, extended_pub_key, root_path);
@@ -144,20 +143,23 @@ mod tests {
#[test]
fn test_root_path_with_trailing_slash() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
-
+
// Root path already has trailing slash - should still work
let root_path = "44'/144'/0'/";
let path = "44'/144'/0'/0/0";
let result = get_address(path, extended_pub_key, root_path);
assert!(result.is_ok());
- assert_eq!("rHsMGQEkVNJmpGWs8XUBoTBiAAbwxZN5v3".to_string(), result.unwrap());
+ assert_eq!(
+ "rHsMGQEkVNJmpGWs8XUBoTBiAAbwxZN5v3".to_string(),
+ result.unwrap()
+ );
}
#[test]
fn test_special_characters_in_path() {
let extended_pub_key = "xpub6CFKyZTfzj3cyeRLUDKwQQ5s1tqTTdVgywKMVkrB2i1taGFbhazkxDzWVsfBHZpv7rg6qpDBGYR5oA8iazEfa44CdQkkknPFHJ7YCzncCS9";
let root_path = "44'/144'/0'";
-
+
// Path with special characters
let path = "44'/144'/0'/@#$/!@#";
let result = get_address(path, extended_pub_key, root_path);
diff --git a/rust/apps/xrp/src/lib.rs b/rust/apps/xrp/src/lib.rs
index a629281..db00a43 100644
--- a/rust/apps/xrp/src/lib.rs
+++ b/rust/apps/xrp/src/lib.rs
@@ -132,7 +132,6 @@ mod tests {
assert!(result.is_err());
}
-
#[test]
fn test_get_tx_hash_invalid_json() {
let raw_hex = hex::encode(b"invalid json");
@@ -145,7 +144,10 @@ mod tests {
let raw_hex = "7B225472616E73616374696F6E54797065223A225061796D656E74222C22416D6F756E74223A223130303030303030222C2244657374696E6174696F6E223A22724A6436416D48485A7250756852683377536637696B724D4A516639373646516462222C22466C616773223A323134373438333634382C224163636F756E74223A227247556D6B794C627671474633687758347177474864727A4C6459325170736B756D222C22466565223A223132222C2253657175656E6365223A34323532393130372C224C6173744C656467657253657175656E6365223A34323532393137332C225369676E696E675075624B6579223A22303346354335424231443139454337313044334437464144313939414631304346384243314431313334384535423337363543304230423943304245433332383739227D";
let parsed = parse(hex::decode(raw_hex).unwrap().as_slice()).unwrap();
assert_eq!(parsed.network, "XRP Mainnet");
- assert_eq!(parsed.display_type, parser::structs::XrpTxDisplayType::Payment);
+ assert_eq!(
+ parsed.display_type,
+ parser::structs::XrpTxDisplayType::Payment
+ );
assert_eq!(
parsed.signing_pubkey,
"03F5C5BB1D19EC710D3D7FAD199AF10CF8BC1D11348E5B3765C0B0B9C0BEC32879"
@@ -252,7 +254,10 @@ mod tests {
"SigningPubKey": "03F5C5BB1D19EC710D3D7FAD199AF10CF8BC1D11348E5B3765C0B0B9C0BEC32879"
}"#;
let parsed = parse(tx_str.as_bytes()).unwrap();
- assert_eq!(parsed.display_type, parser::structs::XrpTxDisplayType::Payment);
+ assert_eq!(
+ parsed.display_type,
+ parser::structs::XrpTxDisplayType::Payment
+ );
}
#[test]
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.