-
Notifications
You must be signed in to change notification settings - Fork 7
chore: prevent double enconding already hexadecimal tx_hash #143
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
Conversation
Time Submission Status
|
WalkthroughA hex-validation helper was added and the base64-to-hex conversion now short-circuits when the input is already hex. The txInfoClient RPC payload now sends the transaction hash as hexadecimal (no base64 conversion). Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant Utils as base64ToHex
participant Client as txInfoClient
participant Node as RPC Node
Caller->>Utils: provide input (hex or base64)
alt Input is valid hex
Utils-->>Caller: return cleaned hex (strip 0x)
else Input is not hex
Utils->>Utils: decode base64 -> bytes -> toHex
Utils-->>Caller: return hex
end
Caller->>Client: call txInfoClient(tx_hash hex)
Client->>Node: JSON-RPC request { "tx_hash": hex, ... }
Node-->>Client: response
Client-->>Caller: return response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (1)src/api_client/client.ts (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes critical transaction hash encoding bugs that prevented correct hash handling in broadcast and query operations.
Changes:
base64ToHex()utility to auto-detect hexadecimal input and return as-is, eliminating unnecessary double-encodingImpact:
Business Value:
Enables reliable transaction tracking and attestation workflows by ensuring transaction identifiers are correctly formatted throughout the system.
resolves: https://github.com/trufnetwork/truf-network/issues/1274
Summary by CodeRabbit