Skip to content

Commit

Permalink
Feature branch for SDK 2.1.0 (#1411)
Browse files Browse the repository at this point in the history
* CompactBlockProcessor: Remove `withDownload` parameter

* backend-lib: Migrate to latest in-progress revision of Rust crates

Includes changes to how accounts are stored and referenced. We now
need to remember and provide the seed fingerprint; for now, given
that we know we only create derived accounts from a single seed, we
search for an account with a matching ZIP 32 account index.

* backend-lib: Add `Backend.isSeedRelevantToWallet`

* Remove nullability of DownloadSuccess param

* Comment update

* Fix Detekt warnings

* backend-lib: Migrate to latest in-progress revision of Rust crates

Includes some renames, and a built-in seed relevancy API that we now
use.

* Separate tree state fetching

- Added continuable retry logic

* Integrate Orchard support

Closes #528.
Closes #761.

* Detekt warnings fix

* Fix unit tests

* Update `TxOutputsView` to use correct column names. (#1425)

* Return an error instead of a panic in the case of data corruption. (#1426)

This removes an `expect` call that risked crashing the app in the case of
database corruption, potentially hiding other bugs.

* Include `orchardSubtreeRootList` in final check

* Revert `orchardSubtreeRootList` check

Explanation comment added

* Changelog update

* Update to zcash_client_sqlite version 0.10.3 (#1428)

---------

Co-authored-by: Honza <[email protected]>
Co-authored-by: Kris Nuttycombe <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2024
1 parent 698b7fe commit 52ee2bc
Show file tree
Hide file tree
Showing 30 changed files with 660 additions and 210 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- The Orchard support has been finished, and the SDK now fully supports sending and receiving funds on the Orchard
addresses

### Fixed
- SDK release 1.11.0-beta01 documented that `Synchronizer.new` would throw an
exception indicating that an internal migration requires the wallet seed, if
Expand All @@ -14,9 +18,12 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
added. The SDK now correctly throws `InitializeException.SeedRequired`.

### Changed
- `Synchronizer.refreshAllBalances` now refreshes the Orchard balances as well
- The SDK uses ZIP-317 fee system internally
- `ZcashSdk.MINERS_FEE` has been deprecated, and will be removed in 2.1.0
- `ZcashSdk.MINERS_FEE` has been deprecated, and will be removed in 2.1.x
- `ZecSend` data class now provides `Proposal?` object initiated using `Synchronizer.proposeTransfer`
- Wallet initialization using `Synchronizer.new` now could throw a new `SeedNotRelevant` exception when the provided
seed is not relevant to any of the derived accounts in the wallet database
- Checkpoints update

## [2.0.7] - 2024-03-08
Expand All @@ -34,7 +41,7 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `WalletSnapshot.transparentBalance: WalletBalance` to `WalletSnapshot.transparentBalance: Zatoshi`
- `Memo.MAX_MEMO_LENGTH_BYTES` is now available in public API
- `Synchronizer.sendToAddress` and `Synchronizer.shieldFunds` have been
deprecated, and will be removed in 2.1.0 (which will create multiple
deprecated, and will be removed in 2.1.x (which will create multiple
transactions at once for some recipients).

### Added
Expand Down Expand Up @@ -96,7 +103,7 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- `LightWalletEndpointExt` and its functions and variables were removed from the SDK's public APIs entirely. It's
preserved only for testing and wallet Demo app purposes. The calling wallet app should provide its own
`LightWalletEndpoint` instance within `PersistableWallet` or `SdkSynchornizer` APIs.
`LightWalletEndpoint` instance within `PersistableWallet` or `SdkSynchronizer` APIs.

### Changed
- Gradle 8.5
Expand Down
56 changes: 34 additions & 22 deletions backend-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions backend-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ hdwallet = "0.4"
hdwallet-bitcoin = "0.4"
hex = "0.4"
jni = { version = "0.21", default-features = false }
orchard = "0.8"
prost = "0.12"
rusqlite = "0.29"
sapling = { package = "sapling-crypto", version = "0.1", default-features = false }
schemer = "0.2"
secp256k1 = "0.26"
secrecy = "0.8"
zcash_address = "0.3"
zcash_client_backend = { version = "0.11", features = ["transparent-inputs", "unstable"] }
zcash_client_sqlite = { version = "0.9", features = ["transparent-inputs", "unstable"] }
zcash_primitives = "0.14"
zcash_proofs = "0.14"
zcash_client_backend = { version = "0.12.1", features = ["orchard", "transparent-inputs", "unstable"] }
zcash_client_sqlite = { version = "0.10.3", features = ["orchard", "transparent-inputs", "unstable"] }
zcash_primitives = "0.15"
zcash_proofs = "0.15"

# Initialization
rayon = "1.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ interface Backend {
* If `seed` is `null`, database migrations will be attempted without it.
*
* @return 0 if successful, 1 if the seed must be provided in order to execute the
* requested migrations.
* requested migrations, 2 if the provided seed is not relevant to any of the
* derived accounts in the wallet.
*
* @throws RuntimeException as a common indicator of the operation failure
*/
Expand All @@ -65,6 +66,12 @@ interface Backend {
recoverUntil: Long?
): JniUnifiedSpendingKey

/**
* @throws RuntimeException as a common indicator of the operation failure
*/
@Throws(RuntimeException::class)
suspend fun isSeedRelevantToAnyDerivedAccounts(seed: ByteArray): Boolean

fun isValidSaplingAddr(addr: String): Boolean

fun isValidTransparentAddr(addr: String): Boolean
Expand Down Expand Up @@ -102,9 +109,11 @@ interface Backend {
* @throws RuntimeException as a common indicator of the operation failure
*/
@Throws(RuntimeException::class)
suspend fun putSaplingSubtreeRoots(
startIndex: Long,
roots: List<JniSubtreeRoot>,
suspend fun putSubtreeRoots(
saplingStartIndex: Long,
saplingRoots: List<JniSubtreeRoot>,
orchardStartIndex: Long,
orchardRoots: List<JniSubtreeRoot>,
)

/**
Expand Down Expand Up @@ -154,6 +163,7 @@ interface Backend {
@Throws(RuntimeException::class)
suspend fun scanBlocks(
fromHeight: Long,
fromState: ByteArray,
limit: Long
): JniScanSummary

Expand Down
Loading

0 comments on commit 52ee2bc

Please sign in to comment.