-
Notifications
You must be signed in to change notification settings - Fork 5
Add logging #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logging #311
Conversation
llbartekll
commented
Jan 5, 2026
- add debug logging
- fix structured message signing
|
Claude finished @llbartekll's task in 1m 32s —— View job PR Review CompleteTasks
Review SummaryAnalyzed PR adding debug logging and fixing structured message signing. Found 2 issues requiring attention. Issue 1: Debug logging uses stdout instead of proper logging frameworkID: pay-stdout-logging-8a3c Debug logging implementation uses Recommendation: Use the tracing framework for consistency: fn log(&self, message: &str) {
if self.debug_enabled.load(Ordering::Relaxed) {
tracing::debug!("[WalletConnectPay] {}", message);
}
}
fn log_error(&self, context: &str, error: &impl std::fmt::Debug) {
if self.debug_enabled.load(Ordering::Relaxed) {
tracing::error!("[WalletConnectPay] {}: {:?}", context, error);
}
}Issue 2: Missing input validation for hex string parsingID: evm-signing-parse-validation-c2f1 The Recommendation: Add explicit validation for hex characters: fn parse_hex_or_decimal(s: &str) -> Option<u64> {
let s = s.trim();
if s.starts_with("0x") || s.starts_with("0X") {
let hex_part = &s[2..];
// Validate hex characters explicitly
if hex_part.chars().all(|c| c.is_ascii_hexdigit()) {
u64::from_str_radix(hex_part, 16).ok()
} else {
None
}
} else {
s.parse::<u64>().ok()
}
}Automated ChecksExternal Domain URLsAll detected URLs are from UniFFI code generation comments (github.com/mozilla/uniffi-rs) which is expected and acceptable. Additional NotesCannot verify: Linting/compilation/tests cannot be run in review-only mode. Recommend running:
Swift changes: The yttrium.swift file contains auto-generated UniFFI bindings (2283 additions) reflecting the Rust API changes - no manual review needed for generated code. |
crates/yttrium/src/pay/mod.rs
Outdated
| impl WalletConnectPay { | ||
| fn log(&self, message: &str) { | ||
| if self.debug_enabled.load(Ordering::Relaxed) { | ||
| println!("[WalletConnectPay] {}", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Auto Review Issue: Debug logging uses stdout instead of proper logging framework
Severity: MEDIUM
Category: code_quality
Tool: Claude Auto Review
Recommendation: Use the tracing framework for consistency:
fn log(&self, message: &str) {
if self.debug_enabled.load(Ordering::Relaxed) {
tracing::debug!("[WalletConnectPay] {}", message);
}
}
fn log_error(&self, context: &str, error: &impl std::fmt::Debug) {
if self.debug_enabled.load(Ordering::Relaxed) {
tracing::error!("[WalletConnectPay] {}: {:?}", context, error);
}
}| }; | ||
|
|
||
| /// Parse a hex string (with or without 0x prefix) or decimal string to u64 | ||
| fn parse_hex_or_decimal(s: &str) -> Option<u64> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Auto Review Issue: Missing input validation for hex string parsing
Severity: LOW
Category: code_quality
Tool: Claude Auto Review
Recommendation: Add explicit validation for hex characters:
fn parse_hex_or_decimal(s: &str) -> Option<u64> {
let s = s.trim();
if s.starts_with("0x") || s.starts_with("0X") {
let hex_part = &s[2..];
// Validate hex characters explicitly
if hex_part.chars().all(|c| c.is_ascii_hexdigit()) {
u64::from_str_radix(hex_part, 16).ok()
} else {
None
}
} else {
s.parse::<u64>().ok()
}
}
crates/yttrium/src/pay/mod.rs
Outdated
| client: Client, | ||
| config: SdkConfig, | ||
| cached_options: RwLock<Vec<CachedPaymentOption>>, | ||
| debug_enabled: AtomicBool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a global logger, we don't need that boolean
Check registerLogger method, use it in Swift, it will log all messages from Yttrium
|
@cloude review |