Electric-Coin-Company / zcash-android-wallet-sdk

Native Android SDK for Zcash
MIT License
5 stars 9 forks source link

[SDK audit] Recommendation: Comparing error message strings is fragile #1457

Open HonzaR opened 4 months ago

HonzaR commented 4 months ago

Is your feature request related to a problem? Please describe.

The SDK determines which type of error occurred within librustzcash by comparing the error message string:

Screenshot 2024-04-23 at 14 03 41

Describe the solution you'd like

This is fragile, since if the error messages are changed in librustzcash, this code will break. In librustzcash, these error messages are defined in zcash client backend/src/scanning.rs. This could be made less fragile by using integer codes for errors, exposing a method for determining the error type in the FFI, or by at least adding a comment to librustzcash warning against changing the error message strings.

Alternatives you've considered

Additional context