fix: add nil guards for Solana tx metadata and safe signature parsing#4550
fix: add nil guards for Solana tx metadata and safe signature parsing#4550ws4charlie wants to merge 2 commits intomainfrom
Conversation
- Add nil check for txResult.Meta before accessing Meta.Err in three locations (observer/outbound.go, signer/outbound_tracker_reporter.go, observer/inbound.go) to prevent potential nil pointer dereference - Replace MustSignatureFromBase58 with SignatureFromBase58 in inbound_tracker.go to gracefully handle invalid base58 tx hashes instead of panicking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe pull request enhances robustness of Solana transaction processing by introducing defensive nil checks for transaction metadata fields and replacing unsafe signature parsing with error-handling alternatives to prevent nil pointer dereferences and panics across transaction tracking and validation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.16.1)zetaclient/chains/solana/observer/inbound_tracker.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m zetaclient/chains/solana/observer/inbound.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m zetaclient/chains/solana/observer/outbound.go┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m
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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e68f1d9 to
6afe9f7
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Meta != nilguard before accessingtxResult.Meta.Errin three locations to prevent potential nil pointer dereference, consistent with the existing pattern atinbound_parser.go:217MustSignatureFromBase58(panics on invalid input) withSignatureFromBase58(returns error) ininbound_tracker.go, consistent with the outbound path atoutbound.go:234Changes
observer/outbound.go:251Meta != nilguard inCheckFinalizedTxsigner/outbound_tracker_reporter.go:73Meta != nilguard inreportToOutboundTrackerobserver/inbound.go:281Meta != nilguard inFilterInboundEventsobserver/inbound_tracker.go:54SignatureFromBase58+ error handlingTest plan
go build ./zetaclient/chains/solana/...compiles cleango test ./zetaclient/chains/solana/observer/passesgo test ./zetaclient/chains/solana/signer/passes🤖 Generated with Claude Code
Note
Low Risk
Defensive nil/error handling changes only; behavior changes are limited to skipping malformed tracker entries and avoiding potential nil dereferences.
Overview
Prevents Solana observer/signer crashes by adding
Meta != nilchecks before readingMeta.Errwhen filtering inbound events, validating finalized outbound txs, and monitoring outbound confirmations.Inbound tracker processing now uses
SignatureFromBase58with error handling instead ofMustSignatureFromBase58, logging and skipping trackers with invalid tx hashes rather than panicking.Written by Cursor Bugbot for commit 4e25f05. Configure here.
Summary by CodeRabbit
Release Notes