Commit Graph

961 Commits

Author SHA1 Message Date
Michal Fousek 6db7f88f0f [#788] Fix testSmallDownloadAsync test
Closes #788
2023-02-17 11:02:24 +01:00
Michal Fousek 3aad1470f1 [#793] Send synchronizerStopped notification only when sync process stops
Closes #793
2023-02-17 08:49:55 +01:00
Michal Fousek c7574b81a2
Merge pull request #797 from Chlup/796_fix_memory_tests
[#796] Fix tests
2023-02-17 08:48:19 +01:00
Michal Fousek 65a096d6cd [#796] Fix tests 2023-02-16 17:14:31 +01:00
Michal Fousek a7a6755f81
Merge pull request #792 from Chlup/780_green_policy_baseline
[#780] Disable tests that aren't currently working
2023-02-15 09:57:18 +01:00
Michal Fousek 3edcfe853b [#780] Disable tests that aren't currently working 2023-02-15 09:33:31 +01:00
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 02e4968ea3
Merge pull request #777 from Chlup/handle_linter_disables
Update code to to comply better with linter rules
2023-02-13 13:32:36 +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 84fb032185
Merge pull request #768 from Chlup/764_notifications_gone_inside
[#764] Stop using Notifications inside the SDK
2023-02-09 20:33:09 +01: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 cf60f44aa8
Merge pull request #769 from zcash/release/0.18.1-beta
implement getRecipients() for Synchronizer and Release 0.18.1 beta
2023-02-08 13:26:57 -03: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 07180dca2d
Merge pull request #766 from Chlup/736_final_touches
[#763] Finishing touches for CompactBlockProcessor refactor
2023-02-07 15:46:59 +01:00
Francisco Gindre 4a82e2de75
Merge pull request #765 from zcash/remove_html_docs
- [#759] Remove Jazz-generated HTML docs
2023-02-06 15:55:20 -03:00
Michal Fousek 172c1e0623 [#763] Finishing touches for CompactBlockProcessor refactor
Closes #763
2023-02-06 19:30:49 +01:00
Michal Fousek bccacbb1c4
Merge pull request #761 from Chlup/744_fetch_utxo_extract
[#744] Refactor UTXO fetching code in CompactBlockProcessor
2023-02-06 19:06:25 +01:00
Michal Fousek ac4f9a8f7a [#744] Refactor UTXO fetching code in CompactBlockProcessor
Closes #744

- Added `UTXOFetcher` protocol and `UTXOFetcherImpl` struct.
2023-02-06 19:06:07 +01:00
Michal Fousek a241ff4c0a
Merge pull request #762 from Chlup/745_sapling_params_extract
[#745] Refactor sapling parameters handling code in CompactBlockProcessor
2023-02-06 19:04:30 +01:00
Michal Fousek 276dcad8fa [#745] Refactor sapling parameters handling code in CompactBlockProcessor
Closes #745

- Added `SaplingParametersHandler` protocol and `SaplingParametersHandlerImpl` struct.
2023-02-06 19:03:54 +01:00
Michal Fousek b3dd634e5c
Merge pull request #760 from Chlup/741_enhance_extract
[#741] Refactor transaction enhancement code in CompactBlockProcessor
2023-02-06 19:02:25 +01:00
Francisco Gindre 2d46a0a699 - [#759] Remove Jazz-generated HTML docs
We remove these documents since they are outdated and we rely on the docs in the
code itself.

Closes 759
2023-02-06 14:29:22 -03:00
Michal Fousek 7fa1ace2c3 [#741] Refactor transaction enhancement code in CompactBlockProcessor
Closes #741

- Added `BlockEnhancer` protocol and `BlockEnhancerImpl` struct.
2023-02-06 14:33:16 +01:00
Michal Fousek a5ac045877
Merge pull request #763 from Chlup/fix_testStoringTenSandblastedBlocksFailsAndThrows
Possibly fix testStoringTenSandblastedBlocksFailsAndThrows test
2023-02-06 14:05:00 +01:00
Michal Fousek 09bc1332eb Possibly fix testStoringTenSandblastedBlocksFailsAndThrows test 2023-02-06 13:28:19 +01:00
Michal Fousek a5b1b63507
Merge pull request #751 from Chlup/746_grpc_encapsulation
[#756] Modularize GRPC related code
2023-02-03 22:32:02 +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 62437c5c7d
Merge pull request #755 from Chlup/742_scanning_extract
[#742] Refactor blocks scanning in CompactBlockProcessor
2023-02-03 22:24:00 +01:00
Francisco Gindre 617d8bac54
Merge pull request #757 from zcash/release/0.17.6-beta
[#756] 0.17.5-beta updates to libzcashlc 0.2.0 when it shouldn't
2023-02-03 15:34:53 -03:00
Francisco Gindre f481bc87c2 Merge branch 'main' into release/0.17.6-beta 2023-02-03 15:01:11 -03:00
Francisco Gindre d7470c350d [#756] 0.17.5-beta updates to libzcashlc 0.2.0 when it shouldn't
Updated checkpoint to the ones present in 0.18.0-beta

Closes #756

 Update Cocoapods
2023-02-03 14:58:44 -03: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 64a85bf306
Merge pull request #753 from Chlup/743_validating_extract
[#743] Refactor blocks validation in CompactBlockProcessor
2023-02-03 15:52:31 +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 d6aaa2cedc
Merge pull request #752 from Chlup/740_compactblockdownload_type
[#740] Refator blocks downloading in CompactBlockProcessor
2023-02-01 10:17:26 +01: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 6982c936f1
Merge pull request #739 from Chlup/735_swiftlint
[#735] Use Swiftlint for the SDK
2023-01-31 09:53:00 +01:00
Francisco Gindre 731c7bbf45
[#415] Release 0.18.0 beta (#750)
* New Checkpoints for 0.18.0-beta candidate

* Add Changelog for 0.18.0-beta
2023-01-30 19:33:20 -03: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