Commit Graph

26 Commits

Author SHA1 Message Date
Carter Jernigan bc19797125
[#971] Refactor Rust FFI to separate module
---------

Co-authored-by: Honza <rychnovsky.honza@gmail.com>
2023-05-18 07:36:15 -04:00
Honza Rychnovsky dfaa827fd1
[#1013] Sync stages parallelization
* [#1013] Sync blockchain sub-phases parallelization

- Remove the unnecessary comment after the latest changes in this code fragment

* Move solely CompactBlockProcessor-related constants

* Simplify sync range update construction

* [#1013] Sync blockchain sub-phases parallelization

* Changelog update

* Block files deletion documentation update

* Leverage buildList API

* CompactBlockRepository documentation update

* Move BlockBatch to internal models
2023-05-10 12:45:23 +02:00
Honza Rychnovsky 2593556890
[#1009] Change CompactBlockProcessor methods signature
* [#1009] Change CompactBlockProcessor methods signature

* Remove withContext {}

Since our networking, RustBackend, and CompactBlockRepository all use coroutines internally by implementing `suspend` for their APIs, we don’t need withContext() anymore.  (If we discover something does do blocking IO on the thread, we should deal with it at the point the IO is occurring rather than at the top level)

* Sort FileExt functions

* Add isDirectorySuspend

- To avoid strict mode disc IO violation warning

* Omit try/catch on block files delete action

* Refactor scan batch function

- Removed retry mechanisms, as it’s not needed now after the previous switch from the database-based blocks persisting to file-based blocks persisting
- scan function now works with the current processing range of blocks size instead of hardcoded constant value

* Eliminate duplicate processorInfo object

* Change log text

* MutableList instead of ArrayList

* Eliminate sync range nullability

* Rewind not scanned blocks

If we find out that we previously downloaded, but not validated and scanned persisted blocks, we need to rewind the blocks above the last scanned height first.

* Fix ktlint warning

---------

Co-authored-by: Carter Jernigan <git@carterjernigan.com>
2023-05-01 13:12:38 +02:00
Carter Jernigan 153072b903 [#880] Refactor Twig 2023-02-09 15:44:22 -05:00
Carter Jernigan 3afe655737
[#631] Improve demo app compose UI for testing
* Add testnet faucet to Compose UI
* Show status on home view
* Add BlockHeight for fixture wallets
* Add balance screen
* Keep screen on while syncing
* Fix conversion of seed phrase to bytes
2023-01-09 10:42:38 -05:00
Carter Jernigan a4a6b25bfb
[#631] Initial Compose scaffolding for demo app
* [#631] Initial Compose scaffolding for demo app

* Bump Compose Compiler

- To bypass Kotlin version incompatibility

* Switch ConfigureSeed from Column to Scaffold

- To unify our screens UI components
- And to have a fullscreen content, and thus avoid another background color out of column (e.g. in system dark mode)

* Split addresses to two rows

- To reduce a risk of a user overlooks other addresses scrolled out of the screen

* Additional code migrated from Secant

- Added just missing test files, fixtures and model classes
- Fix previously broken dependencies imports

* Link issue to code

Co-authored-by: Honza <rychnovsky.honza@gmail.com>
2022-12-23 11:00:37 +01:00
Carter Jernigan 2ab6d038ed
[#742] Prevent multiple synchronizer instances
Co-authored-by: Honza <rychnovsky.honza@gmail.com>
2022-12-14 10:33:18 -05:00
Honza Rychnovsky 97c0628798
[#789] Benchmarking Demo-app
* [#789] Add Benchmark module to Demo-app

* Code cleanup

* Opti-in experimental coroutines api in tests

* Add Testing documentation

* Documentation update + ktlint

* Check screen on and keyguard unlocked in each test

* Introduce UiAutomator extensions

* Enhance BenchmarkTrace events definition

* Remove unnecessary mutex

* Change blocks range

* Increase sync blockchain timeout

- To always fit in the Balances screen timeout for the selected blocks range

* Remove unnecessary fun suspend modifiers

* Macrobenchmark lib bump to 1.2.0-alpha8

* Remove duplicate label attr in app/manifest

* File and link benchmark on CI task

* Add proguard keep rules

* Documentation update
2022-12-13 14:25:09 +01:00
Carter Jernigan a37b7c9812
[#763] Add shielding to demo app 2022-11-16 07:38:45 -05:00
Carter Jernigan 5fb5773a7d [#756] Improve funding testnet demo 2022-11-04 10:01:09 -04:00
Carter Jernigan 9af6986e43
[#748] Internal recipients for pending transactions 2022-10-26 21:37:40 -04:00
Carter Jernigan 3b826f8f6a Simplify Synchronizer instantiation
fix

synchronizer
2022-10-06 14:49:04 -04:00
Jack Grigg c6fd783317 Add a `seed` argument to `Synchronizer.Companion.new`
This enables callers to recover from an error that indicates the seed
is needed for a database migration.
2022-10-06 14:49:04 -04:00
Jack Grigg 0b80bff23d Merge branch 'main' into merge-detekt-warning-fixes 2022-08-23 21:28:01 +01:00
Honza Rychnovsky 345af7aacc
[#366] Fix Detekt warnings
* Disable baseline file. Too many functions.
* CurrencyFormatter.kt suppress too many functions
* PersistentTransactionManager.kt suppress too many functions
* OutboundTransactionManager suppress too many functions
* Suppress long parameter list
* Too many functions
* Add log to avoid empty block warning
* Fix several magic number warnings
* Solve max line length warnings
* Solve max line length warnings
* Suppress too long method warnings
* Suppress too complex method warnings
* Suppress large class warning
* Fixed empty catch block
* Changed directory path to the file
* Fix too generic and swallowed exception
* Fix print stack trace warning
* Suppressed single top level file name declaration
* Change parameters name
* Suppress Spread operator warning
* Remove unused private code
* Add Locale to suppress default locale used warning
* Solve several forbidden TODOs warnings
* Fixed another max line length warning
* Simplify return statement
* Suppress class to object change
* Make DemoConstants variables const
* Use error() instead of throwing an IllegalStateException
* Solve too complex condition
* Suppress intentionally generic and swallowed exception
* Suppress TooGenericExceptionCaught
* Solve or suppress several TooGenericExceptionCaught
* Fix swallowed exception
* Suppress warning TooGenericExceptionCaught of PersistentTransactionManager
* Suppress warning TooGenericExceptionCaught of WalletTransactionEncoder
* Suppress TooGenericExceptionCaught of SdkSynchronizer
* Suppress TooGenericExceptionCaught in SaplingParamTool
* Suppress TooGenericExceptionCaught in CompactBlockDownloader
* Suppress TooGenericExceptionCaught in CheckpointTool
* Fix TooGenericExceptionCaught in WalletService
* Suppress TooGenericExceptionCaught in DerivedDataDb
* Suppress TooGenericExceptionCaught in CompactBlockProcessor
* Apply ktlint format after all the previous changes
* Remove detekt baseline file
* Set Android studio right margin
* Address comments from review
* Suppress failing tests on CI
2022-08-23 15:49:00 +02:00
Carter Jernigan f7c9bad367 [#525] Replace UnifiedViewingKey with UnifiedFullViewingKey
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.
2022-08-22 20:57:41 +01:00
Carter Jernigan e01a906407
[#593] Refactor ZcashNetwork
Splits the ZcashNetwork and Lightwalletd server information, making it easier to configure different servers
2022-08-02 09:29:09 -04:00
Carter Jernigan 9b666833b1
[#474] Add type safe BlockHeight API
- Replace int with type safe BlockHeight(Long) object
 - Fix down casting bug, as BlockHeight is uint32 but Java only supports int32 or int64
 - Rename WalletBirthday to Checkpoint and hide from the public API
2022-07-12 08:40:09 -04:00
Carter Jernigan a1cc8f0b69 [#477] Fixes for Zatoshi object 2022-07-07 13:45:03 -04:00
Carter Jernigan 823e8387cb
[#477] Typesafe Zatoshi APIs for amounts 2022-06-21 19:34:42 -04:00
Carter Jernigan 5f40d7a14e [#344] Minimize threads; reduce risk of SQLite issues
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
2022-01-19 15:27:30 -05:00
Carter Jernigan dca91f2558 [#319] Fix ktlint issues 2021-11-18 07:10:30 -05:00
Carter Jernigan 079229972f [#269] Convert blocking calls to suspend functions
To quickly get this implemented, some calls in the demo-app have been wrapped in `runBlocking {}`.  This is not ideal and will be addressed in followup issues.
2021-10-21 16:52:15 -04:00
Carter Jernigan 283718de94 [#285] Apply ktlint to demo-app
In the process of refactoring the Gradle scripts, ktlint now is applied to all Gradle modules.  The demo-app hadn't been linted before, so this applies a series of minor autocorrections to this module.
2021-09-25 12:54:42 -04:00
Carter Jernigan 3afeb0f688 [#260] Depend on sdk-lib instead of published library
Because the demo app was using an old version of the SDK, this also implements a variety of changes to accomodate the new SDK API
2021-09-13 09:25:27 -04:00
Carter Jernigan 2268f814f2 [#255] Refactor Gradle Modules
Move SDK from the root gradle project to its own Gradle module
Move the demo app to be a peer of the SDK

This will simplify integration with CI on Bitrise.
2021-08-31 14:53:25 -04:00