- Removed `Transaction` struct and `TransactionEntity` protocol.
- Removed some other protocols from `TransactionEntity.swift`.
Use correct default fee and memo count
Previously `SDKSynchronizer` simply refused to start while the sync
process was in progress. That could lead to some troubles.
`CompactBlockProcessor` has already mechanism which can handle this
exact situation. So now `SDKSynchronizer` starts `CompactBlockProcessor`
even when there is sync in progress.
- 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
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.
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
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
- 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
- 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
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.
- 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
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
It's not good practice to make internal combine subjects accessible from
outside of SDK. So `lastState` is changed from `CurrentValueSubject` to
`Publisher`. This doesn't have any effect on public API. It just makes
SDK safer.
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.
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.
state for this synchronizer.
also reports the SychronizerState on synchonizerStarted notification.
Add tests that verify the state being reported properly
Fix `BlockBatchValidationTests`
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
Closes#619
- When computing next action in `NextStateHelper.nextStateAsync` now
scanning state is also taken into consideration.
- When processing blocks download phase is skipped when it's detected
that everything is already downloaded.
`XCAsyncTestCase` does not work as intended but `wait {}` does what
we need.
restored `needsToStartScanningWhenStopped` as a Bool var on actor
fixed Enhancement test
Closes#579
This is what happens when database was locked:
- App is syncing.
- While rustBackend.scanBlocks(…) is in progress app goes to background. Background task is launched and
ECC works for some time in background.
- When background task is finished synchronizer.stop() is called.
- Inside CompactBlockProcessor.stop()is called. In this method cancelableTask is canceled and state is
set to stopped no matter what. And this is the problem. Because even when canceled is called rust
scanning isn’t canceled. But state doesn’t care about it. And next time when app is launched new
synchronisation is started and now you have processing code running in two threads causing DB lock.
So I moved setting state to stopped to processNewBlocks method. It's set
after the work is canceled and really stopped. When doing this there is
still one problem. When app goes to foreground new sync is not started
and current one is just stopped.
So I added new variable and condition. And when this variable is set
to true new syncing process starts when the previous one is canceled.
This should cover all the problems.
- 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
Currently a 100 batch can take up to 3 minutes to scan. decrease the size of the batches when the increased load part of the chain is reached until a faster sync is implemented
See related counterpart to remove it issue #576Closes#577
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
- 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
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
[#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>
- 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
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
Issue Reported on [0.16.x-beta]
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
Fix:
This commit makes sure that the download streamer checks cancelation
before processing any block, or getting called back to report progress
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
- 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