Skip to content

Commit

Permalink
[#1547] Adopt latest Zcash SDK v2.1.3
Browse files Browse the repository at this point in the history
* [#1547] Adopt latest Zcash SDK v2.1.3

- Closes #1547
- Changelogs update

* Switch to production Zcash SDK 2.1.3
  • Loading branch information
HonzaR authored Aug 9, 2024
1 parent dc08b41 commit c9875c0
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2

## [Unreleased]

### Changed
- Adopted the latest Zcash SDK version 2.1.3, which brings a significant block synchronization speed-up and improved
UTXOs fetching logic

## [1.1.4 (700)] - 2024-07-23

### Added
Expand Down
4 changes: 4 additions & 0 deletions docs/whatsNew/WHATS_NEW_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ directly impact users rather than highlighting other key architectural updates.*

## [Unreleased]

### Changed
- Adopted the latest Zcash SDK version 2.1.3, which brings a significant block synchronization speed-up and improved
UTXOs fetching logic

## [1.1.4 (700)] - 2024-07-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ ZXING_VERSION=3.5.3
ZCASH_BIP39_VERSION=1.0.8

# WARNING: Ensure a non-snapshot version is used before releasing to production
ZCASH_SDK_VERSION=2.1.2
ZCASH_SDK_VERSION=2.1.3

# Toolchain is the Java version used to build the application, which is separate from the
# Java version used to run the application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ sealed class SecretState {
class Ready(val persistableWallet: PersistableWallet) : SecretState()
}

/**
* This constant sets the default limitation on the length of the stack trace in the [SynchronizerError]
*/
const val STACKTRACE_LIMIT = 250

// TODO [#529]: Localize Synchronizer Errors
// TODO [#529]: https://github.com/Electric-Coin-Company/zashi-android/issues/529

Expand All @@ -526,24 +531,36 @@ sealed class SecretState {
sealed class SynchronizerError {
abstract fun getCauseMessage(): String?

abstract fun getStackTrace(limit: Int = STACKTRACE_LIMIT): String?

class Critical(val error: Throwable?) : SynchronizerError() {
override fun getCauseMessage(): String? = error?.message

override fun getStackTrace(limit: Int): String? = error?.stackTraceToString()?.substring(0..limit)
}

class Processor(val error: Throwable?) : SynchronizerError() {
override fun getCauseMessage(): String? = error?.message

override fun getStackTrace(limit: Int): String? = error?.stackTraceToString()?.substring(0..limit)
}

class Submission(val error: Throwable?) : SynchronizerError() {
override fun getCauseMessage(): String? = error?.message

override fun getStackTrace(limit: Int): String? = error?.stackTraceToString()?.substring(0..limit)
}

class Setup(val error: Throwable?) : SynchronizerError() {
override fun getCauseMessage(): String? = error?.message

override fun getStackTrace(limit: Int): String? = error?.stackTraceToString()?.substring(0..limit)
}

class Chain(val x: BlockHeight, val y: BlockHeight) : SynchronizerError() {
override fun getCauseMessage(): String = "$x, $y"

override fun getStackTrace(limit: Int): String? = null
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import co.electriccoin.zcash.ui.common.extension.toKotlinLocale
import co.electriccoin.zcash.ui.common.model.WalletSnapshot
import co.electriccoin.zcash.ui.common.model.spendableBalance
import co.electriccoin.zcash.ui.common.model.totalBalance
import co.electriccoin.zcash.ui.common.viewmodel.STACKTRACE_LIMIT

data class WalletDisplayValues(
val progress: PercentDecimal,
Expand Down Expand Up @@ -105,7 +106,9 @@ data class WalletDisplayValues(
context.getString(
R.string.balances_status_error_dialog_cause,
walletSnapshot.synchronizerError.getCauseMessage()
?: context.getString(R.string.balances_status_error_dialog_unknown)
?: context.getString(R.string.balances_status_error_dialog_cause_unknown),
walletSnapshot.synchronizerError.getStackTrace(limit = STACKTRACE_LIMIT)
?: context.getString(R.string.balances_status_error_dialog_stacktrace_unknown)
)
)
}
Expand Down
11 changes: 8 additions & 3 deletions ui-lib/src/main/res/ui/balances/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@
<string name="balances_status_error_dialog_connection">
Disconnected. Please check your internet connection.
</string>
<string name="balances_status_error_dialog_cause" formatted="true">
Error: <xliff:g id="error_cause" example="Block scanning problem">%1$s</xliff:g>
<string name="balances_status_error_dialog_cause" formatted="true">Error:
<xliff:g id="error_cause" example="Block scanning problem">%1$s</xliff:g>\n\nStacktrace:
<xliff:g id="error_stacktrace"
example="java.lang.IllegalStateException: Unsupported wallet state
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
Caused by: java.lang.RuntimeException: Failure from Rust backend">%2$s</xliff:g>
</string>
<string name="balances_status_error_dialog_unknown">
<string name="balances_status_error_dialog_cause_unknown">
Unknown cause. Please contact our support team if the problem persists.
</string>
<string name="balances_status_error_dialog_stacktrace_unknown">Unknown stacktrace.</string>
<string name="balances_status_dialog_stopped">Synchronization is stopped. It will resume soon.</string>
<string name="balances_status_dialog_button">OK</string>

Expand Down

0 comments on commit c9875c0

Please sign in to comment.