The Android and Rust code have previously managed joint custody of the derived data database. With more complex migrations now required, we need to make the Android side read-only. To achieve that, the Android side will remove Room and instead rely on more primitive SQLite APIs for read-only access.
As part of implementing this change, database management throughout the SDK is being refactored.
There will be multiple representations of the data:
- Database representation (and some Entity representations in the places that Room hasn’t been removed yet). These representations are not as type safe and don’t match Kotlin best practices in all cases.
- Once #615 is implemented there will also be network representations
- Type safe models, which often appear in the public API The Database and Network representations will be converted to and from the type safe model representation.
The SDK now exposes UAs primarily, with additional methods for obtaining
corresponding Sapling and transparent addresses for legacy compatibility.
The `Account` DAO is also fixed to use the migrated `accounts` table format.
The demo app now shows the current UA and the legacy Sapling and transparent
addresses.
Closeszcash/zcash-android-wallet-sdk#677.
* [#706] Fix crashes identified by robo tests
- Removed unused xml layouts
- Fixed several xml attributes to be backward compatible
* Reduce number of unnecessary logs in console
* Bump min Android SDK version from 19 to 21
* Bump demo-app minSdk to version 21 too
* Update changelog
Co-authored-by: Carter Jernigan <git@carterjernigan.com>
- Enhanced implementation of SaplingParamTool component. It got sapling files move from legacy folder to the preferred one functionality. It downloads the sapling files atomically now (through the temporary file names). It contains all related constants now. It works with SaplingParamToolProperties, which allows us to easily test the SaplingParamTool functionalities. It also now checks file hashes. Removed unnecessary clear function from the component. Changed valid function.
- Moved related constants from ZcashSdk class to SaplingParamTool class
- Changed Initializer, WalletTransactionEncoder and RustBackend classes to work with File instead of path String
- Minor changes in comments in other classes
- Added getSha1Hash() extension function to the FileExt class
* Related tests
- Two new test fixtures to simplify our tests
- Test for getSha1Hash() extension function
- Minor changes in existing tests
- Created new SaplingParamToolBasicTest, which covers non-integration functionality of SaplingParamTool
- Moved integration tests of the SaplingParamTool to the new SaplingParamToolIntegrationTest and added some new
* Related manual tests
- Created Download sapling files manual test
- Created Move sapling files to no_backup manual test
- Update existing Move database files to no_bakcup manual test
Co-authored-by: Carter Jernigan <git@carterjernigan.com>
We need the transparent account privkey in order to be able to derive
the secret key for any leaf transparent address under the ZIP 316
diversified address tree.
UnifiedViewingKey had a bug that made it incompatible with ZIP 316.
For compatibility with the current `zcash/librustzcash` revision we use
a temporary fake UFVK encoding that stores sufficient information to use
the current APIs, and a superset of the actual ZIP 316 FVK information.
The third party plugin that we’ve used for publishing has introduced multiple breaking changes recently.
By migrating to more standard Gradle publishing APIs, the deployment process is more explicit for those unfamiliar with Gradle. It also will simplify some upcoming changes to modularize this SDK project.
This resolves several issues including:
- Updated checkpoints
- #550 Support for new checkpoint format with NU5
- #377 Removed explicit dependency on GSON
* [#539] SDK causes crash on emulators with x86_64 architecture
- NDK version reverted back to 22.1.7171670.
- Attached TODO with issue for future handling of the problem.
- Install specific Android NDK version.
- Update changelog.
Co-authored-by: Carter Jernigan <git@carterjernigan.com>
This doesn't affect Sapling note detection (which uses Compact Blocks),
but enables the enhancement logic to decrypt and store the corresponding
transactions for displaying memo fields.
While there are a lot of changes, the most significant are:
- Update the main entrypoint of the SDK to use a suspending function and eliminate lazy initialization. This also resolves#310
- Changing Dao methods to `suspend`, allowing Room to implicitly manage the threading model under the hood
- Explicitly set the executor thread for the `CompactBlockDb` and `DerivedDataDb`, which is the same thread used when calling into the Rust native library. Room will then use this thread for `suspend` fun calls into it
- With the above set, remove unnecessary hops to Dispatchers.IO which is a thread pool
- Eliminate lazy initialization in `PagedTransactionRepository` to make it easier to reason about the threading model and resolve#355 where the database was being touched from the UI thread
Note that `PendingTransactionsDb` is not opted into this single-threaded approach, because that database is not shared with the Rust code