Commit Graph

178 Commits

Author SHA1 Message Date
Michal Fousek 753e3bf605
Merge pull request #779 from Chlup/two_swiftlint_configs
[#778] Add swiflint config file only for tests
2023-02-15 09:31:41 +01:00
Michal Fousek 27b99013f7
Merge pull request #775 from Chlup/715_parametrize_seedPhrase_tests
[#715] Move seed phrase from specific tests to Environment
2023-02-13 15:10:07 +01:00
Michal Fousek 663a785b8f
Merge pull request #776 from Chlup/713_remove_unusedMethods_testcoordinator
[#713] Remove unused methods from TestCoordinator
2023-02-13 13:42:35 +01:00
Michal Fousek 65d6347bcf [#778] Add swiflint config file only for tests
Closes #778

- .swiftlint.yml is now used to lint only the code of the SDK.
- .swiftlint_tests.yml is now used to lint only the code of the tests.
  This config disables rules that were previously disabled in the code
  in lot of tests.
2023-02-13 13:36:58 +01:00
Michal Fousek 71e5e37eec [#715] Move seed phrade from specific tests to Environment
Closes #715
2023-02-13 13:36:38 +01:00
Michal Fousek 44732b179b Update code to to comply better with linter rules
- Removed some disabled linter rules from code and update code to comply
  with those.
- No logic was changed.
2023-02-13 12:18:08 +01:00
Michal Fousek 2718b6c19b [#713] Remove unused methods from TestCoordinator 2023-02-13 10:39:37 +01:00
Francisco Gindre a57d302c5a
Merge pull request #773 from Chlup/770_update_grpc
[#770] Update GRPC swift library
2023-02-10 15:42:16 -03:00
Michal Fousek 1ec12269ae [#764] Stop using Notifications inside the SDK
Closes #764

- All notification that were previously sent from CompactBlockProcessor are now gone.
- `CompactBlockProcessor` now provides `eventStream` to communicate with `SDKSynchronizer`.
- Added `synchronizerStoredUTXOs` notification.
- Tests are updated to not use notifications anymore. Some tests there
  weren't working before are now fixed.
- Added `CompactBlockProcessorEventHandler` utility class. Previously
  expectations were subscribing to notifications. This class replaces
  this functionality. It subscribes to events from
  `CompactBlockProcessor` and fullfill expectations.
2023-02-09 20:09:51 +01:00
Michal Fousek be8afabec4 [#770] Update GRPC swift library
Closes #770
2023-02-09 19:55:46 +01:00
Michal Fousek e83bec6db7
Merge pull request #772 from Chlup/rename_fsmeta_param
[#771] Fix tests failing because of different paths passed to `FSCompactBlockRepository` and `FSMetadataStore`
2023-02-09 15:19:50 +01:00
Michal Fousek 34c08a3a81 [#771] Fix tests failing because of different paths passed to `FSCompactBlockRepository` and `FSMetadataStore`
Closes #771

- Renamed `cacheDirectory` param in `FSCompactBlockRepository`
  constructor to `fsBlockDbRoot`.
- Pass same paths to `FSCompactBlockRepository` and `FSMetadataStore`
  from tests.
2023-02-09 13:58:49 +01:00
Francisco Gindre 67dd061523 Merge branch 'main' into release/0.18.1-beta 2023-02-08 12:48:20 -03:00
Francisco Gindre 2c211732e1 [#767] implement getRecipients() for Synchronizer.
This implements `getRecipients()` function which retrieves the possible
recipients from a sent transaction. These can either be addresses or
internal accounts depending on the transaction being a shielding tx
or a regular outgoing transaction.

Closes #767

Other changes:
Fix version of zcash-light-client-ffi to 0.1.1

Enhance error reporting on a test make Mock comply with protocol

Update CHANGELOG.md
2023-02-08 08:44:29 -03:00
Michal Fousek 09bc1332eb Possibly fix testStoringTenSandblastedBlocksFailsAndThrows test 2023-02-06 13:28:19 +01:00
Michal Fousek 385c0a7195 [#746] Modularize GRPC related code
Closes #746

- `LightWalletGRPCService` is no longer public. `LightWalletService` is no longer public.
- `LightWalletGRPCService` shouldn't be used dicrectly. Use `LightWalletServiceFactory` to create instance of the service.
- Moved sending of `blockProcessorConnectivityStateChanged` notification to `Initilizer`.
- All the errors from GRPC are mapped to `LightWalletServiceError`. Handling of `GRPCStatus` in the SDK is no longer required.
- `Service` directory (that contains GRPC code) is moved to `Modules/Service`. We can put more code to `Modules/` if we decide
to modularize more code.
2023-02-03 22:25:54 +01:00
Michal Fousek 34e444e632 [#742] Refactor blocks scanning in CompactBlockProcessor
Closes #742

- Added new protocol `BlockScanner` and new struct `BlockScannerImpl`. Scanning related code is extracted to `BlockScannerImpl`.
2023-02-03 15:54:10 +01:00
Michal Fousek 1a03fa6f7c [#743] Refactor blocks validation in CompactBlockProcessor
Closes #743

- Added new protocol `BlockValidator` and `BlockValidatorImpl` class. All the code related to blocks validation is extracted to `BlockValidatorImpl`.
- Fixed `testSingleDownloadAndScan()` test.
- Changed how validation error are handled. Previously validation error were handled directly next to validation code. And when some validation
errors happened method from `CompactBlockProcessor` were called. Now validation errors are handled in `CompactBlockProcessor.processNewBlocks`
in a same way as any other error that can occur during sync process.
2023-02-03 09:58:36 +01:00
Francisco Gindre fad3aae174
- [#679] Implementation of the File-system based block cache (#679)
Closes https://github.com/zcash/ZcashLightClientKit/issues/697
Closes https://github.com/zcash/ZcashLightClientKit/issues/720
Closes https://github.com/zcash/ZcashLightClientKit/issues/587
Closes https://github.com/zcash/ZcashLightClientKit/issues/667
Closes https://github.com/zcash/ZcashLightClientKit/issues/443
Closes https://github.com/zcash/ZcashLightClientKit/issues/754

- [#790] Fix ShieldFundsTests

Closes #790
Removes comments on `ShieldFundsTests` since those issues have been fixed

Depends on zcash-light-client-ffi changes that adopt newer versions of
 librustzcash crates `zcash_primitives 0.10`, `zcash_client_backend 0.7`,
`zcash_proofs 0.10`, `zcash_client_sqlite 0.5.0`.

Also allows wallets to define a shielding_threshold and will set
foundations to customize minimum confirmations for balances, spends
and shielding operations.

**Test Bootstrapping**

- `ZcashCompactBlockDescriptor`: struct that holds functions to
describe blocks as filenames and compare those filenames

`ZcashCompactBlockDescriptor.live` has the actual implementation
but it can be replaced by mocks if needed on Tests

main implementations are held under `FSCompactBlockRepository.filenameDescription` and `FSCompactBlockRepository.filenameComparison` on a separate extention

`DirectoryListingProviders` provide two default implementations of listing a
directory deterministically. `FileManager` does not define a sorting and needs to be done in-memory by calling `.sorted()` on the resulting collection. If this
is a big toll on performance it can be changed to a POSIX implementation but
this is good for now.

`ZcashCompactBlockDescriptor` adds a `height` helper function to
turn a filename into the height of the block stored.

Implemented `func latestHeight() throws -> BlockHeight ` that
returns the blockheight by querying the cache directory in a sorted
fashion and getting the last value and turning the filename into a
`BlockHeight`

Added `Meta` struct to ZcashCompactBlock.

Tests implemented:
- `filterBlockFiles`
- `testClearTheCache`
- `testLatestHeightEmptyCacheThrows`
- `testLatestHeightEmptyCacheThrowsAsync`
- `testRewindEmptyCacheDoesNothing`
- `testRewindEmptyCacheDoesNothingAsync`
- `testWhenBlockIsStoredItFollowsTheDescribedFormat`
- `testWhenBlockIsStoredItFollowsTheFilenameConvention`
- `testGetLatestHeight`
- `testRewindDeletesTheRightBlocks` test
- `testPerformanceExample` test. This isn't a real performance test because the API doesn't work with async/await yet

adopts `shield_funds` shielding threshold parameter

Implements `initBlockMetadataDb` and fix tests
Renames dbCache parameter to `fsBlockDbRoot`. Builds but tests don't pass.
Removes cacheDb uses from code. Testing utilities still persist.
Added needed information in  MIGRATING and CHANGELOG.
Added helper to perform deletion of legacy db and creation a the
new file system backed cache.

Renames parameters and changes code where needed.
Network Constants turned into `enum` with static methods.
DeletelastDownloadedBlock helper from initializer
Removes CompactBlockStorage and CompactBlockEntity.
Implements `latestCachedBlockHeight` on rustbackend.

*Replaces dependencies on ZcashRustWelding with `FSMetadataStore`*

This allows the tests to not depend in a particular implementation
of either the MockRustBackend of or ZcashRustBackend. Also provides
a way to test errors properly and switch implementations of critical
areas like `writeBlocks`.
2023-02-02 13:58:12 -03:00
Michal Fousek 6bbaad4cb1 [#740] Refator blocks downloading in CompactBlockProcessor
Closes #740

`CompactBlockDownloading` protocol is renamed to `BlockDownloaderService`. `CompactBlockDownloader` is renamed to `BlockDownloaderServiceImpl`.

What is the motivation for this rename?
Goal of this change is to extract code from `CompactBlockProcessor` which is related to downloading. So naturaly it should be called "downloader".
But `CompactBlockDownloader` was already taken. After analysis of `CompactBlockDownloading` and `CompactBlockDownloader` I found out that
`CompactBlockDownloader` doesn't download blocks exactly. It's more like abstraction over `LightWalletService`. And it does very similar job to
`LightWalletService`. That is why I decided to rename it to "service".

What is the motivation for protoco/impl naming scheme?
First `BlockDownloaderService` protocol doesn't describe capability in my eyes. It describe what something is. Also `BlockDownloaderServicing` sounds
strange. I agree that add suffix "Impl" to class name isn't super nice. But it is acceptable. And it makes sense to use nicer type name
(e.g. `BlockDownloaderService`) for protocol because it's used on much more places in the code.

- Added `BlockDownloader` protocol and `BlockDownloaderImpl` class. The code related to downloading was exctracted to this class.
2023-01-31 15:24:41 +01:00
Michal Fousek a0d0c90555 [#735] Use Swiftlint for the SDK
- Swiftlint binary is included in the repository.
2023-01-27 11:44:25 +01:00
Lukas Korba f69da50ba9
[#747] Remove SampleLogger and replace it with OSLogger (#748)
- SampleLogger removed
- OSLogger used
- category default
2023-01-26 18:14:07 +01:00
Michal Fousek ce4d7bab45 [#556] Rename Transaction to ZCashTransaction
- Xcode's refactor feature used. Only renamed happened no logic was
  changed.
2023-01-23 10:01:07 +01:00
Michal Fousek 28de8d4ac3 Merge branch 'main' into 556_using_transactions_db_views 2023-01-19 12:44:28 +01:00
Lukas Korba 372ea5af70
[#711] Add Swiftlint plug in to SDK (#722)
- plugin integrated
- errors resolved
- warnings resolved
- package.swift macos platform version 10_15 -> 12
2023-01-18 17:09:04 +01:00
Michal Fousek b4e320b9c3 [#556] Fix sorting when selecting transactions without minedHeight
- `id` property of transcations is no longer Optional. `id` column in DB
  is primary key and it can't be nil. This was oversight in previous
  changes.
- Sorting order of transactions is switched from asc to desc. asc is
  oversight in previous changes. Android is using desc.
- Using `IFNULL` when sorting transactions by minedHeight.
- Update tests accordingly. And revert few changes on darkside tests.
  These changes are no longer needed because using `desc` sorting order
  on transactions.
2023-01-16 13:18:08 +01:00
Lukas Korba dcc6ef1757
[#671] Make CompactBlockProcessor Internal (#710)
- sdk and demo app modified
- changelog updated
2023-01-12 13:05:11 +01:00
Michal Fousek 14f1436987 [#556] Fix tests and fix few bugs
- Fix all the tests. In few tests code had to be changes because order
  of transactions is newly defined. It wasn't before.
- Change properties of Transaction.* objects. Some had to be made
  Optional to make all tests work.
- Add new tests for TransactionDAO.
- Removed methods from TransactionDAO that weren't used.
2023-01-10 23:20:46 +01:00
Michal Fousek cb62101e2d [#683] Add Synchronizer API to fetch memos for transactions
Closes #683

Fix tests
2023-01-10 11:03:57 +01:00
Michal Fousek 169fd3da46 Merge branch 'main' into 556_using_transactions_db_views 2023-01-10 11:02:12 +01:00
Michal Fousek c4df36db36 [#556] Rename Transaction to TransactionNG
This change is really only replace one string with other. No logic was
changed.
2023-01-06 10:12:00 +01:00
Michal Fousek becadf21c8 Merge branch 'main' into 657_download_change 2023-01-05 09:50:00 +01:00
Michal Fousek ef88023171 [#556] Remove ConfirmedTransaction and ConfirmedTransactionEntity 2023-01-05 09:42:50 +01:00
Michal Fousek de25513c9c
Merge pull request #694 from Chlup/556_4_remove_entities
[#556] Remove Transaction and TransactionEntity
2023-01-04 21:18:48 +01:00
Michal Fousek ed47bc2327 [#556] Make expiryHeight and raw optional
There can be stored transactions with expiryHeight and raw set to NULL
in database. So these two properties must be optional in code.
2023-01-04 16:21:47 +01:00
Michal Fousek c17706f5d0 [#556] Remove Transaction and TransactionEntity
- Removed `Transaction` struct and `TransactionEntity` protocol.
- Removed some other protocols from `TransactionEntity.swift`.

Use correct default fee and memo count
2023-01-04 10:02:27 +01:00
Michal Fousek f12ace4bf3 [#556] Replace TransactionRepository.findAll methods with new methods
Fix compilation
2023-01-03 13:12:07 +01:00
Michal Fousek a40b311ccd [#556] Replace TransactionRepository.findAllSentTransactions with new method
Make minedHeight optional
2023-01-02 12:29:01 +01:00
Dimitris Apostolou 6c3423181d
Fix typos 2022-12-31 12:50:16 +02:00
Michal Fousek 45d6260688 [#556] Remove unused TransactionRepository.findEncodedTransactionBy method 2022-12-23 22:08:45 +01:00
Michal Fousek 4b4416b1e1 Merge branch 'master' into 657_merge_master
- Changed how metrics are pushed when downloading and scanning blocks.
2022-12-22 15:35:11 +01:00
Michal Fousek 92256c108f [#556] Replace TransactionRepository.findAllReceivedTransactions with new method 2022-12-22 09:46:54 +01:00
Michal Fousek c7b0e0b5b6 Merge branch 'master' into 556_using_transactions_db_views 2022-12-22 09:41:21 +01:00
Lukas Korba 3c3b97ca42
[#663] Create a benchmarking section on the Demo App that can be automated (#681)
- SDKMetrics singleton for the measurement
- download, validate and scan blocks supported
- Sample app refactored to use SDKMetrics, connected to appropriate notifications and labels
- enhancement metric added
- total sync time metric added
- sample app extended to show summary time and operations summaries
- unit tests for the SDKMetrics
- doc for the SDKMetrics and our approach for the performance testing in general
- changelog update
2022-12-21 13:30:05 +01:00
Michal Fousek ef2d904260 [#556] Update API of TransactionRepository and make tests work
This change is prerequisity for future changes. API of
`TransactionRepository` is changed a bit. Now it's possible to filter
transaction by kind (all/sent/received) event when
`TransactionNG.Overview` structure is returned.

Tests are now fixed for new methods and new objects. For this mocked
database `darkside_data.db` had to be updated to the latest scheme used
by the Rust code.
2022-12-21 12:33:20 +01:00
Michal Fousek 6c5bf8de27 [#677] Add support for wipe into SDK
Closes #677

- Previously when keychain wanted to do wipe wallet had to do it on it's
  own. Which isn't good. Now wallet can simply call
  `synchronizer.wipe()` and it's done.
- This change brings support for wipe. `Synchronizer` has new method
  `wipe()` which takes care of everything. All the database connections
  are closed. Databases are removed. `InternalSyncProgress` is reset.

Change condition when wipe can run
2022-12-20 13:41:20 +01:00
Michal Fousek 349148cd38 [#657] Change how blocks are downloaded and processed
Closes #657

- Now SDK downloads N downloads and scan those. And repeat until sync is
  done. This safes lot of space of disk used to store downloaded blocks.
- Most changes are done in `CompactBlockProcessor.processNewBlocks`.
- `SyncRanges` structure is changed a bit.
- `SyncStatus` is changed. SDK now report that it's syncing with
  progress. It doesn't report each phase of the sync process separately.
  Also appropriate notifications were updated.

Address review comments

- Small changes
- Add tests to check computation of processing ranges for single loop
2022-12-19 09:35:09 +01:00
Michal Fousek cb07484c45 [#556] Replace TransactionRepository.findBy methods with new transaction method 2022-12-19 09:28:28 +01:00
Michal Fousek 999ee1e204 [#556] Define structures for db view and add new repository methods
- Structures that represent transactions DB views are newly define.
- New structures are:
  - TransactionNG.Overview
  - TransactionNG.Received
  - TransactionNG.Sent

- `TransactionNG` is used as temporary name. `Transaction` is existing
  structure in the code. `TransactionNG` will be eventually renamed to
  `Transaction` once current `Transaction` is removed from code.

- New methods that are using new structures are added to
  `TransactionRepository`. Those are slightly changed compared to
  predecessors. Those are now little bit simpler to use.

Address review comments
2022-12-15 22:19:14 +01:00
Francisco Gindre b01127bd84 [#665] Fix testShieldFunds() `get_transparent_balance` error
This commit adopts libzcashlc 0.1.1 which fixes this error

Closes #665
2022-12-13 19:12:22 -03:00
Michal Fousek e01c83690f [#646] SDK sync process resumes correctly
- Previously we had one range for each sync which was used for each
  phase of sync process. Newly there is separate range for each phase of
  the sync process.
- I added `InternalSyncProgress` utility. This utility tracks progress
  of some phases. And it is able to compute right ranges which should be
  used for syncing.
- Some unused download code from `CompactBlockProcessor` is removed.

Fix tests

Address review comments

- Rebase to master
- Update how range for `processBatchFinished()` is computed.
- Refactor `InternalSyncProgress`
- Add tests for `InternalSyncProgress`

Address review comments

Change how latest downloaded block is tracked

- Cache DB is no longer used to track which block was downloaded as
  latest. `InternalSyncProgress` is used to do that.
- Thanks to that #660 is fixed. And cache DB can be completely removed
  after sync process.
- Added sleep(1) to some darkside tests when latest block height is set.
  Otherwise lightwalletd in darkside mode doesn't have time to setup and
  tests are flaky.

Fix TransactionEnhancementTests.testBasicEnhancement test
2022-12-12 14:27:30 +01:00
Francisco Gindre 3b7202c922
Fix `testShieldFunds()` dataset loading issue. (#659)
There's a problem withstanding:

````
▿ RustWeldingError
  ▿ genericError : 1 element
    - message : "Error while fetching transparent balances for AccountId(0): Invalid column type Null at index: 0, name: address"
````

Which is fixed by commit `d0297bff0cdaaff42ad26f3be5bc261f6c828e8f` of "https://github.com/zcash/librustzcash".

nil-coalesce thrown errors on test so it reaches the end.

Make balance calls throwing to show underlying errors but nil-coalesce in non-throwing APIs

Add missing fulfill() calls

Add changelog entry

document and handle errors on getting shielded balance before
attempting to download sapling parameters.
2022-12-12 10:00:31 -03:00
Lukas Korba ce6a417154
[#585] Fix RewindRescanTests (#656)
- test fixed, the saplingActivation wasn't passed to the block processor just like to the service, there's the mismatch
2022-11-29 19:59:16 -03:00
Michal Fousek a7fe75c11e
Cleanup warnings (#655)
- TestCoordinator doesn't need to be used in async manner.
2022-11-29 07:40:45 +01:00
Lukas Korba 6029a75038
[#637] Make sapling parameter download part of processing blocks (#650)
- sync process enhanced to try to download sapling params if needed
- tests fixed
- failing import Crypto -> import CryptoKit
- download params only if there are sapling funds
2022-11-29 07:38:28 +01:00
Lukas Korba cc99fbad30
[#590] Fix or delete CompactBlockProcessorTests disabled tests it not needed (#653)
- The tests were fine in the end but Stream needed to be finished in any way, caused "for await" syntax to never finish
2022-11-28 15:08:55 +01:00
Francisco Gindre b350f6b220
[#639] Provide an API to estimate TextMemo length limit correctly (#640)
This provides a method for clients to handle UI for text memo
limit correctly handling memos that are visibly fit within the
capacity defined in ZIP-302 but when encoded into UTF-8 bytes
their size exceeds such limit.

Closes #639
2022-11-22 14:02:39 -03:00
Michal Fousek 44a6970b73 [#616] Dont send notification from SDK on main thread
Closes #616

- Added small helper `NotificationSender` which is used to send
  notifications.
- No notificaiton is sent on main thread.
- Change how `status` is stored and update in `SDKSynchronizer`. It is
  now protected by lock. Before this wasn't needed because status was
  updated from main thread everywhere.
- `SyncBlocksViewController` in the sample app now uses
  `SDKSynchronizer` instead of `CompactBlockProcessor` directly.
2022-11-21 16:33:42 +01:00
Michal Fousek 4e5cb505fa [#488] Delete cache db when sync ends
Closes #488

- When sync process is finished cache DB is removed from disk.
- Latest downloaded block is preserved becuase it's required to computes
  in which phase to resume sync process.
- `SDKSynchronizer.latestDownloadedHeight` public API is removed
  it makes no longer sense. This API was reading from cache DB.
2022-11-15 10:31:59 +01:00
Francisco Gindre 6208beec5c [#621] Adds a synchronizer state subject with the last available
state for this synchronizer.

also reports the SychronizerState on synchonizerStarted notification.

Add tests that verify the state being reported properly

Fix `BlockBatchValidationTests`
2022-11-14 14:44:33 -03:00
Francisco Gindre b9e00055e9 [#614] make prepare(with:) and get{pool_type}Address() synchronous
Closes #614

fixes travis ci

Removed `setStartHeight` function

I’m going back in time and this setHeight is not something we are using anywhere else than in the prepare function. This comes from the times we had `initialize(seed:birthday) and we don’t have that anymore

See diff 246d10edaa (diff-414771774e10bc81260094ffcdc7b310a3be48758b2abd2bfae831c83912c02c)

The `func setStartHeight(_ startHeight: BlockHeight)` function assumes that
there might not be a wallet birthday set up or that it might be changed
in-flight which are things that are no longer happening.

remove test warning

Fix test compiler error
2022-11-11 14:07:45 -03:00
Francisco Gindre 59dc56c9b4 Merge branch 'feature/zip-316-and-latest-upstream' into release/0.17.0-alpha.3 2022-11-01 15:09:39 -03:00
Francisco Gindre a12666e932 [#602] Improve error logging for InitializerError and RustWeldingError 2022-11-01 13:57:42 -03:00
Francisco Gindre 08e6738cf7 Fix compiler error 2022-11-01 07:47:31 -03:00
Francisco Gindre a0d02c4d57 PR Suggestions
`XCAsyncTestCase` does not work as intended but `wait {}` does what
we need.

restored `needsToStartScanningWhenStopped` as a Bool var on actor

fixed Enhancement test
2022-10-31 20:17:21 -03:00
Francisco Gindre 1c8e06742a Fix Tests than need to call the async TestCoordinator build function 2022-10-31 10:17:48 -03:00
Francisco Gindre 01d85f5748 Fix compiler errors 2022-10-31 09:57:10 -03:00
Francisco Gindre dbd4b8934c Merge branch 'master' into merge-master 2022-10-31 09:34:38 -03:00
Michal Fousek 02ee0a54ea [#593] Fix testSmallDownloadAsync test
- Test was failling with:
generalError(message: "block not found in cache, should always be in cache in darkside mode")
- There was no wait so lightwalletd in darkside mode didn't have enough time to accept mocked state.
2022-10-28 12:18:19 +02:00
Francisco Gindre b5d659e8a8 Fix various tests and deleted some that are not useful anymore
Closes #588
Closes #584
Closes #589
Closes #591
2022-10-27 20:09:08 -03:00
Lukas Korba cfe71d5da2
[#523] Make a CompactBlockProcessor an Actor (#565)
- Sample app refactored for the processor being an actor
- tests refactored as well
- dark side tests fixed
- utilities separated to new file
- synchronizer's start and stop are no longer in async context
- updating the UI for the scan fixed
2022-10-27 12:51:38 +02:00
Francisco Gindre 7403bcc809 Remove .orig file committed by mistake 2022-10-21 20:32:01 -03:00
Francisco Gindre 37b060852c
Merge pull request #567 from nuttycom/pending_transaction_entity_recipient
Add internal recipient information to `PendingTransactionEntity`
2022-10-21 18:27:52 -03:00
Francisco Gindre 2fb25dcd35 Fix: Transaction repository tests pass 2022-10-21 18:19:08 -03:00
Francisco Gindre 1979e410b5 Fix pre populated Db to have transactions from darksidewalletd seed 2022-10-21 13:54:53 -03:00
Kris Nuttycombe a483537cb1 Ensure that the persisted test database has had migrations applied. 2022-10-20 14:22:24 -06:00
Francisco Gindre 789cf01188 Add Fee field to Transaction, ConfirmedTransaction, ReceivedTransactions and Pen
dingTransactions.
Update Notes DAOs with new fields.

Make Zatoshi Codable

add tests for Recipient.forEncodedAddress
2022-10-19 17:37:06 -03:00
Kris Nuttycombe 849083ffd9 Fix UInt32 conversions to SQL in PendingTransactionDao 2022-10-19 14:13:18 -06:00
Francisco Gindre 30a9c066ad Replace `db.run` with `db.execute` to fix migration issues 2022-10-19 11:29:15 -03:00
Kris Nuttycombe 0fbf90dc82 Add migration to re-create pending_transactions table with nullable columns. 2022-10-18 19:44:34 -06:00
Kris Nuttycombe f5d7aa0f17 Modify PendingTransactionEntity to be able to represent internal shielding tx. 2022-10-18 10:07:23 -06:00
Francisco Gindre 923eca19ce [#561] Fix unified typecodes tests
Fix tests.

Fix tests.

Use Account 6 vectors on testListTransparentReceivers

only use first tree addresses from the vector for testListTransparentReceivers

Fix unified address generation tests.

Fix build and PR suggestions
2022-10-18 11:40:36 -03:00
Kris Nuttycombe 91ea6f5476 Update to latest librustzcash 2022-10-17 15:00:08 -06:00
Francisco Gindre 8a26e2e469 UFVK validation was validating sapling keys 2022-10-03 21:12:10 -03:00
Francisco Gindre 7f480e417d Merge branch 'master' into merge-master 2022-10-03 20:15:40 -03:00
Lukas Korba 9b6ff51b29
[#492] Get rid of blocking API (#551)
- blocking API removed, only latestBlockHeight() stayed
- non-blocking closure based API removed
- unit tests updated to use async API

[#492] Get rid of blocking API (#551)

- forgotten commented code cleaned up
- some comments were still mentioning result (completion closure), removed
2022-10-03 20:05:11 -03:00
Lukas Korba fa5bbbb2bf
[#541] Initialise gRPC on a separate thread (#545)
MultiThreadedEventLoopGroup has been replaced with NIOTSEventLoopGroup. It's recommended by authors of grpc-swift especially for iOS platform and it allows us to set the priority because NIOTSEventLoopGroup is GCD based while MultiThreadedEventLoopGroup is pthread based.

[#541] Initialise gRPC on a separate thread (#545)

- priority increased to .default
2022-10-03 15:54:43 -03:00
Francisco Gindre 7806b5114f
Use UnifiedSpendingKey for shielding and Spending (#535)
[#534] Use UnifiedSpendingKey for shielding and Spending

This commit implements the use of Unified Spending Keys for shielding
and spending as well as rolling Unified Addresses.

Users should obtain addresses by rolling them from the SDK.
USKs replace Sapling Extended Spending keys and TransparentAccountPrivKeys
when shielding or spending

Closes #534

Co-authored-by: Kris Nuttycombe <kris@nutty.land>

* Fix rebase issues

* PR Suggestion. Make `lastError` an Optional

* Fix test `testReOrgRemovesOutboundTxAndIsNeverMined`

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-10-02 23:11:17 -03:00
Francisco Gindre ca5221ac75 Merge branch 'master' into merge-master-to-zip-316 2022-09-30 09:53:34 -03:00
Francisco Gindre 28985a4e38
Merge pull request #536 from LukasKorba/486_sendToAddress_async_await
[#486] sendToAddress async/await
2022-09-23 12:08:31 -07:00
Lukas Korba 2c93802828 [#487] shieldFunds to async/await
- API refactored to async

[#487] shieldFunds to async/await

- unit tests refactored
2022-09-21 16:36:41 +02:00
Lukas Korba 61683a85f3 [486] sendToAddress async/await
- sendToAddress and SaplingParameterDownloader refactored to async
- unit tests WIP

[486] sendToAddress async/await

- testing code cleanup

[#486] sendToAddress async/await

- reducing number of Tasks in Sample app

[#486] sendToAddress async/await

- I finally figure out how to make the dark side tests async, using new sendToAddress APIs and pass, POC done, 18 more tests to refactor

[#486] sendToAddress async/await

- async sendToAddress unit test refactored except NetworkUpgradeTests

[#486] sendToAddress async/await

- NetworkUpgradeTests refactored to async API

[#486] sendToAddress async/await

- cleanup

[#486] sendToAddress async/await (#536)

- PR comments resolved
2022-09-21 13:47:17 +02:00
Francisco Gindre 38b8fd09d8
Merge pull request #531 from zcash/receiver_type_codes
Receiver type codes
2022-09-20 10:27:54 -07:00
Francisco Gindre a9805cfe7e [#530] Implement ability to extract available typecodes from UA
this introduces several types under UnifiedAddress `ReceiverTypecodes`
and `UnifiedAddress.Errors` to host possible errors on third-party
generated UAs and their composition

Implement extracting the typecodes from a UA
2022-09-19 14:52:30 -03:00
Francisco Gindre db15465ebe Merge branch 'master' into release/0.16.10-beta 2022-09-16 18:04:14 -03:00
Francisco Gindre 60aa28628b [#532] [0.16.x-beta] Download does not stop correctly
Issue Reported:

When the synchronizer is stopped, the processor does not cancel
the download correctly. Then when attempting to resume sync, the
synchronizer is not on .stopped and can't be resumed

this doesn't appear to happen in master branch that uses
structured concurrency for operations.

Fix:
This commit makes sure that the download streamer checks cancelation
before processing any block, or getting called back to report progress
2022-09-16 16:59:31 -03:00
Francisco Gindre e82a6d26ee
Merge pull request #518 from zcash/merge_master_to_zip_316
Merge master to zip 316
2022-09-15 08:03:29 -07:00
Francisco Gindre bee1c9db80 Merge branch 'master' into merge_master_to_zip_316 2022-09-15 11:04:49 -03:00
Lukas Korba 2b65bd46e4 [476] CompactBlockProcessor to async/await
- getting rid of the Operation Queue
- the cleanup is needed
- the update of tests is needed
- tested and it successfully finishes the sync process

[476] CompactBlockProcessor to async/await

- old processNewBlocks() removed

[476] CompactBlockProcessor to async/await

- unused operations removed

[476] CompactBlockProcessor to async/await

- unit tests update

[476] CompactBlockProcessor to async/await

- unit tests refactored

[476] CompactBlockProcessor to async/await

- cleanup of deprecated method

[476] CompactBlockProcessor to async/await

- fail(error) was called even for canceled tasks but that must be excluded

[476] CompactBlockProcessor to async/await

- removal of all ZcashOperations from the code (unit test will follow)

[476] CompactBlockProcessor to async/await

- network tests in building and success order again

[476] CompactBlockProcessor to async/await

- offline tests in building and success order

[476] CompactBlockProcessor to async/await (519)

- cleanup of suspending the task

[476] CompactBlockProcessor to async/await (519)

- most comments resolved

[476] CompactBlockProcessor to async/await (519)

- thread safe state for both sync and async context

[476] CompactBlockProcessor to async/await (519)

- fixed build for a sample project

[476] CompactBlockProcessor to async/await (519)

- func testStartNotifiesSuscriptors() reverted

[476] CompactBlockProcessor to async/await (519)

- TODO added to track why we used NSLock instead of an Actor
- Task priority enhanced

[476] CompactBlockProcessor to async/await (519)

- cleanup in Tasks and priorities
2022-09-15 08:10:12 +02:00
Francisco Gindre cd345f6ddc Add test utilities for db Migration 2022-09-12 16:58:29 -06:00