Commit Graph

287 Commits

Author SHA1 Message Date
Honza a79e204bd9 [#1323] Release zcash-android-wallet-sdk 2.0.5 2024-01-30 19:43:42 +00:00
Jack Grigg 9fd25a0197 CompactBlockProcessor: Add tracing 2024-01-30 17:23:37 +00:00
Jack Grigg 22407a593d Get `WalletSummary` on CBP start and use it to bound subtree roots
This improves performance in two ways:
- The `SdkSynchronizer` now reports balances of existing wallets and
  sync progress almost immediately, instead of after the first batch
  of blocks is scanned.
- In the steady state case, only a few subtree roots are downloaded,
  reducing the time until the first batch of blocks is scanned.

Closes Electric-Coin-Company/zcash-android-wallet-sdk#1310.
2024-01-30 17:23:37 +00:00
Jack Grigg a8965b01c6 Fix types of arguments to `GetSubtreeRoots` and `putSaplingSubtreeRoots` 2024-01-30 17:23:37 +00:00
Jack Grigg e0fcbbea3a Refresh wallet transparent balance flow from `WalletSummary`
Previously we only showed balance updates for the default address; this
could potentially undercount transparent balance in some cases.

We also now use the total zero-conf transparent balance for both "total"
and "available", because we only allow transparent balance to be
shielded, and we use a zero-conf transaction to do so.
2024-01-30 17:23:37 +00:00
Jack Grigg 55d0dd47d8 Deduplicate balance refreshing APIs 2024-01-30 17:23:37 +00:00
Jack Grigg 1f19360ca3 Expose the rest of `WalletSummary` across the FFI 2024-01-30 17:23:37 +00:00
Jack Grigg 7149def6f1 Expose `ScanSummary` across the FFI
Closes Electric-Coin-Company/zcash-android-wallet-sdk#1368.
2024-01-30 17:23:37 +00:00
Jack Grigg bb3733ec94 CompactBlockProcessor: Deduplicate sleep code
Closes Electric-Coin-Company/zcash-android-wallet-sdk#1252.
2024-01-30 17:23:37 +00:00
Jack Grigg 0f0cd81a12 Replace `Backend.{createToAddress, shieldToAddress}` with proposal-based methods
Closes Electric-Coin-Company/zcash-android-wallet-sdk#1338.
2024-01-30 17:23:37 +00:00
Jack Grigg 85af183cee backend-lib: Migrate to latest in-progress revision of Rust crates 2024-01-30 17:23:37 +00:00
Honza Rychnovský 6d90319136
[#1301] Checkpoints update
Closes #1301
2024-01-08 17:25:23 +01:00
Honza Rychnovský 68cfd21fe7
[#1287] Remove LightWalletEndpointExt public API
- Closes #1287
- This refactored out all the occurrences of LightWalletEndpointExt and its functions and variables from the SDK’s public API. It preserves it in tests, demo app, and in the PersistableWallet for backward compatibility, although it’s not available from outside of the SDK.
- Changelog updated
2024-01-08 14:45:47 +01:00
Honza Rychnovský d8902d11df
[#1248] Clean up unused exceptions
* [#1248] Clean up unused exceptions

Closes #1248

* Changelog update

* Suppress detekt warning

Creating these private functions is required by the compiler
2024-01-07 10:29:33 +01:00
Honza Rychnovský 1dd369167a
[#1316] Readable TxId on TransactionOverview
Closes #1316
2024-01-05 09:56:23 +01:00
Honza Rychnovský 73d7afc2a4
[#1327] Ktlint 1.1.0
* [#1327] Ktlint 1.1.0

Closes #1327

* [#1327] Autoformatting with Ktlint

* Ktlint formatting warnings fix
2024-01-04 21:21:32 +01:00
Honza Rychnovský 2ee4140080
[#1307] Gradle 8.5
* [#1307] Gradle 8.5

Closes #1307

* Changelog update

* Flank 23.10.1
2024-01-04 10:47:46 +01:00
Honza Rychnovský 0cdba6a69c
[#1294] Checkpoints update
Closes #1294
2023-11-08 15:22:07 +01:00
Honza Rychnovský 7d7cf4f84f
[#1292] Expose Data database file path
- Implemented as part of synchronizer API
- Closes #1292
- Documentation updated
2023-11-08 12:27:14 +01:00
str4d ae2d7152aa
Replace Sapling balance and scan progress FFIs with wallet summary FFI
* Replace Sapling balance and scan progress FFIs with wallet summary FFI

Closes zcash/zcash-android-wallet-sdk#1282.

* Using test fixture for JniAccountBalance

* Minor documentation changes

* Fix typo

---------

Co-authored-by: Honza <rychnovsky.honza@gmail.com>
2023-11-08 10:57:23 +01:00
Honza Rychnovský 6ae8259466
[#1288] Checkpoints update 2023-10-20 14:46:47 +02:00
Honza Rychnovský ddffd170d1
[#1273] 10_000-ZAT Miners fee
- Removed all uses of the incorrect 1000-ZAT fee as defined with  deprecated zip-313
- Default is now 10k zatoshi, the minimum defined by zip-317
- Changelog updated
- Closes  #1273
2023-10-02 12:49:36 +02:00
Honza Rychnovský ebde156c6c
[#1276] Checkpoints update
- Closes #1276
2023-10-02 12:48:59 +02:00
Honza Rychnovský c8e5a7e125
[#1249] Continuity error rewind
* [#1249] Continuity error rewind

- Fixed the Rust FFI bug that caused us to be unable to catch the Continuity error
- Improved logging
- Moved handling the Continuity error to the outer synchronization loop, which works better with synchronization mutex
- Closes #1249

* Resolve minor comments from older PR #1247
2023-09-21 16:11:02 +02:00
Honza f56146fa05 [#1255] Checkpoints update 2023-09-20 12:59:42 -06:00
Honza 38ee6a80e9 Link fetchTransaction pass txId twice TODO 2023-09-20 08:56:29 -06:00
Honza 83c69fdd9f FirstClassByteArray toString formatting 2023-09-20 15:51:37 +02:00
Honza 55222aad50 Poll UTXOs regularly 2023-09-20 14:10:11 +02:00
Jack Grigg 5e40ff6920 Fix bugs in `TransactionOverview.transactionState` initialization
- Off-by-one in determining whether a transaction is confirmed.
- Expiry logic was inverted for non-zero expiry heights.
  - Transactions with zero (disabled) expiry heights happened to work
    because this case is currently detected in the database logic and
    mapped to `null`, which the old code mapped to `Long.MAX_VALUE`
    which gave the correct result for the old conditional expression.
2023-09-19 23:22:47 +01:00
Jack Grigg 89eb42e473 Fix `BlockHeight` difference type
Block heights are absolute, not relative. Adding heights does not make
sense, and the difference between two heights is an integer.
2023-09-19 23:22:47 +01:00
Jack Grigg 905fb1e1a8 Improve debug printing of `FirstClassByteArray` 2023-09-19 22:59:31 +01:00
Jack Grigg 233acebc2f Migrate to Rust revision with fixes to table views
With the fixes to `v_transactions` and `v_tx_outputs`, there are
several more data fields that may have no data (for rows corresponding
to purely-transparent transactions); their fields are made nullable.
2023-09-19 22:59:31 +01:00
Honza Rychnovský c0c4506664
[#1241][#1243][#1222] Rewinding when ContinuityError
* [#1241] Remove rewind for every verify scan range

- The original solution comes from the pseudocode requirement: Download the blocks in `scan_range` into the block source, overwriting any existing blocks in this range.
- Removed

* [#1243] Rewind only after continuity-error

- Rewind is done only when Continuity-error appears now. In case of other sync failures, the sync loop sleeps for a short time and then retries. Internal actions like fetching subtree roots, fetching chain tip, downloading, scanning, etc., still have their internal retry mechanisms.
- For the calculation of the rewind height, we use the existing checkContinuityErrorResult method, originally used only for validation use cases but later incorrectly used for other failures too.
- Closes #1243
- Closes #1222 as it was created to determine which failure type comes and don’t rewind for all of them
- Tested manually in several scenarios, e.g. lost internet connection or app going to background

* Handle Continuity and other sync errors

- Call handleContinutyError and its rewind logic directly without checking failed attempts. This ensures that we keep trying to reorg.
- And return the correct type of error in that case.
- Add fail logic to the handling of the other types of errors.
2023-09-19 15:47:56 +02:00
Honza Rychnovský 9869fd4300
[#1239] Post-v2.0.0-rc1 cleanup
* Add JniScanProgressTest

* Remove unnecessary testnet workaround

As this was fixed with the last rust changes.

* Simplify batchCount calculating

* Fix ratio typo

* Docummentation comments changes
2023-09-18 16:51:26 +02:00
Honza Rychnovský 62fc5d7cfa
[#1242] ScanRange fails when no matching priority (#1246)
Tests added
2023-09-18 08:15:18 -06:00
Honza 11b031a6af Exit execution when retry limit reached 2023-09-12 19:27:20 +02:00
Honza 39ba2b48b0 Fix ktlint warning 2023-09-11 20:22:41 +02:00
Honza c7125f4183 Update createAccountAndGetSpendingKey API
- TypesafeBackend.createAccountAndGetSpendingKey now works with a type-safe TreeState model class instead of ByteArray.
- New type-safe TreeState added. Once we get the TreeState object from the lightwalletd server, potential validation comes into this object.
2023-09-11 19:11:03 +02:00
Honza Rychnovský a082fe9034
[#1231] GetConsensusBranchId works with chain tip (#1232)
* [#1231] GetConsensusBranchId works with chain tip

Closes #1231
2023-09-11 09:11:01 +02:00
Honza 4c8c32587b Add note on scan continuity error texts 2023-09-10 10:31:56 +02:00
Honza a8813277f7 retryUpToAndContinue exception wrapper trigger fix 2023-09-10 10:19:08 +02:00
Honza 95da0f25ab BlockHeight subtraction fix 2023-09-09 19:56:56 +02:00
Honza 79ba05f23b Change denominator requirement
- Added safe progress ratio calculating function
- Added test
2023-09-09 19:11:58 +02:00
Honza a43c5f130e Change createAccountAndGetSpendingKey API
The checkpoint parameter changed for treeState: ByteArray
2023-09-09 19:11:58 +02:00
Honza Rychnovský 899b487ee4 [#1219] Remove calculated sync progress
Closes #1219
2023-09-08 20:23:37 +02:00
Honza Rychnovský c6032b47bd [#1208][#1215] Pass proper `recoverUntil`
- Closes #1208
- CLoses #1215
2023-09-08 20:23:37 +02:00
Honza Rychnovský 59ab627c82 [#1218] Adopt new getScanProgress API 2023-09-08 20:22:40 +02:00
Honza Rychnovský fc14082a1c [#1213] Remove `BlockTable` and its APIs
* [#1213] Remove `count()` from BlockTable API

* [#1213] Remove `firstScannedHeight()` from BlockTable API

* [#1213] Remove `findBlockHash()` from BlockTable

* [#1213] Remove `lastScannedHeight()` from BlockTable

* [#1213] Remove `BlockTable` entirely
2023-09-08 20:22:40 +02:00
Honza Rychnovský 33a7a2000f [#1210] Eliminate LINEAR sync support 2023-09-08 20:19:51 +02:00
Jack Grigg 42cf9d6466 Migrate to Rust revision that exposes scanned heights 2023-09-08 20:19:51 +02:00