Skip to content

Commit 70ca23d

Browse files
committed
fix: remove stale Tempo parsing helper
1 parent 98bb3fd commit 70ca23d

File tree

1 file changed

+3
-63
lines changed

1 file changed

+3
-63
lines changed

src/protocol/methods/tempo/method.rs

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//! ```
2525
2626
use alloy::network::ReceiptResponse;
27-
use alloy::primitives::{hex, keccak256, Address, Bytes, TxKind, B256, U256};
27+
use alloy::primitives::{keccak256, Address, Bytes, TxKind, B256, U256};
2828
use alloy::providers::Provider;
2929
use alloy::sol_types::SolCall;
3030
use std::future::Future;
@@ -176,19 +176,6 @@ fn validate_fee_payer_calls(
176176

177177
Ok(())
178178
}
179-
180-
/// Parse a hex string (with or without 0x prefix) into a B256.
181-
fn parse_b256_hex(s: &str) -> Option<B256> {
182-
let s = s.strip_prefix("0x").unwrap_or(s);
183-
hex::decode(s).ok().and_then(|bytes| {
184-
if bytes.len() == 32 {
185-
Some(B256::from_slice(&bytes))
186-
} else {
187-
None
188-
}
189-
})
190-
}
191-
192179
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
193180
enum MatchedTransferLog {
194181
Transfer,
@@ -1059,6 +1046,8 @@ where
10591046

10601047
#[cfg(test)]
10611048
mod tests {
1049+
use alloy::primitives::hex;
1050+
10621051
use super::{super::MODERATO_CHAIN_ID, *};
10631052

10641053
#[test]
@@ -1073,40 +1062,6 @@ mod tests {
10731062
assert_eq!(TRANSFER_WITH_MEMO_SELECTOR, [0x95, 0x77, 0x7d, 0x59]);
10741063
}
10751064

1076-
#[test]
1077-
fn test_parse_b256_hex_valid() {
1078-
let valid = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
1079-
let result = parse_b256_hex(valid);
1080-
assert!(result.is_some());
1081-
1082-
// Without 0x prefix
1083-
let valid_no_prefix = "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
1084-
let result = parse_b256_hex(valid_no_prefix);
1085-
assert!(result.is_some());
1086-
}
1087-
1088-
#[test]
1089-
fn test_parse_b256_hex_invalid_length() {
1090-
// Too short (only 3 bytes)
1091-
let too_short = "0xabcdef";
1092-
assert!(parse_b256_hex(too_short).is_none());
1093-
1094-
// Too long (33 bytes)
1095-
let too_long = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef00";
1096-
assert!(parse_b256_hex(too_long).is_none());
1097-
1098-
// Empty
1099-
assert!(parse_b256_hex("").is_none());
1100-
assert!(parse_b256_hex("0x").is_none());
1101-
}
1102-
1103-
#[test]
1104-
fn test_parse_b256_hex_invalid_chars() {
1105-
// Invalid hex characters
1106-
let invalid = "0xgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg";
1107-
assert!(parse_b256_hex(invalid).is_none());
1108-
}
1109-
11101065
#[test]
11111066
fn test_event_topics() {
11121067
// Verify event topic constants match keccak256 of event signatures
@@ -1127,21 +1082,6 @@ mod tests {
11271082
);
11281083
}
11291084

1130-
#[test]
1131-
fn test_parse_b256_hex_case_insensitive() {
1132-
// Test case insensitivity - both should parse to the same value
1133-
let lower = "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890";
1134-
let upper = "0xABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890";
1135-
let mixed = "0xAbCdEf1234567890AbCdEf1234567890AbCdEf1234567890AbCdEf1234567890";
1136-
1137-
let lower_result = parse_b256_hex(lower).unwrap();
1138-
let upper_result = parse_b256_hex(upper).unwrap();
1139-
let mixed_result = parse_b256_hex(mixed).unwrap();
1140-
1141-
assert_eq!(lower_result, upper_result);
1142-
assert_eq!(lower_result, mixed_result);
1143-
}
1144-
11451085
#[test]
11461086
fn test_calldata_length_constants() {
11471087
// Verify the expected calldata lengths match ABI encoding

0 commit comments

Comments
 (0)