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
- 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
- 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
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#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.
- 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
[#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
- 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
This PR creates data types for Addresses and Keys so that they are
not represented by Strings anymore. This avoids mistakenly use
the wrong keys because they are all alike for the type system.
New Protocols:
=============
StringEncoded -> Protocol that makes a type can be expressed in an
string-encoded fashion either for UI or Interchange purposes.
Undescribable -> A protocol that implements methods that override default
decriptions used by debuggers, loggers and event trackers to avoid types
conforming to it to be leaked to logs.
Deleted Protocols:
==================
UnifiedFullViewingKey --> turned into a struct.
UnifiedAddress --> turned into a struct
new Error Type:
================
````
enum KeyEncodingError: Error {
case invalidEncoding
}
````
This error is thrown when an Address or Key type (addresses are public
keys in the end) can be decoded from their String representation,
typically upon initialization from a User input.
New Types:
=========
SaplingExtendedSpendingKey -> Type for Sapling Extended Full Viewing Keys
this type will be replaced with Unified Spending Keys soon.
SaplingExtendedFullViewingKey -> Extended Full Viewing Key for Sapling.
Maintains existing funcionality. Will be probably deprecated in favor of
UFVK.
TransparentAccountPrivKey -> Private key for transparent account. Used
only for shielding operations. Note: this will probably be deprecated soon.
UnifiedFullViewingKey -> Replaces the protocol that had the same name.
TransparentAddress -> Replaces a type alias with a struct
SaplingAddress --> Represents a Sapling receiver address. Comonly called zAddress. This address corresponds to the Zcash Sapling shielded pool.
Although this it is fully functional, we encourage developers to
choose `UnifiedAddress` before Sapling or Transparent ones.
UnifiedAddress -> Represents a UA. String-encodable and Equatable. Use of
UAs must be favored instead of individual receivers for different pools.
This type can't be decomposed into their Receiver types yet.
Recipient -> This represents all valid receiver types to be used as
inputs for outgoing transactions.
````
public enum Recipient: Equatable, StringEncoded {
case transparent(TransparentAddress)
case sapling(SaplingAddress)
case unified(UnifiedAddress)
````
The wrapped concrete receiver is a valid receiver type.
Deleted Type Aliases:
=====================
The following aliases were deleted and turned into types
````
public typealias TransparentAddress = String
public typealias SaplingShieldedAddress = String
````
Changes to Derivation Tool
==========================
DerivationTool has been changed to accomodate this new types and
remove Strings whenever possible.
Changes to Synchronizer and CompactBlockProcessor
=================================================
Accordingly these to components have been modified to accept the
new types intead of strings when possible.
Changes to Demo App
===================
The demo App has been patch to compile and work with the new types.
Developers must consider that the use (and abuse) of forced_try and
forced unwrapping is a "license" that maintainers are using for the
sake of brevity. We consider that clients of this SDK do know how to
handle Errors and Optional and it is not the objective of the demo
code to show good practices on those matters.
Closes#461
- migration of the protocol's methods done
- split the code so there's blocking and non-blocking API separately
[463] Migrate LightwalletService to Async/Await
- draft
[463] Migrate LightwalletService to Async/Await
- failing tests under investigation
[463] Migrate LightwalletService to Async/Await
- code cleanup
- tests cleanup
- async throws unit tests added
[463] Migrate LightwalletService to Async/Await
- sample app updated to the latest API
[463] Migrate LightwalletService to Async/Await
- cleanup
[463] Migrate LightwalletService to Async/Await
- cleanup
[463] Migrate LightwalletService to Async/Await
- fixed non-building tests
[463] Migrate LightwalletService to Async/Await
- reverting back to lastHeight()
[463] Migrate LightwalletService to Async/Await
updated code to AsyncStream
[463] Migrate LightwalletService to Async/Await (493)
- tests fixed
- blockRange reimplemented to use AsyncStream
- grpc proto files regenerated to exclude Server
This change removes responsibility for maintaining the state of
the wallet database from `ZcashLightClientKit` in favor of using
the migration system now provided by librustzcash. This will help
to ensure that the structure of the database is kept consistent with
the functions that query and update the database state.
Co-authored-by: Francisco Gindre <francisco.gindre@gmail.com>
Closes#381
This commit brings a Zatoshi type developed on the Secant project,
helper classes like Clamped and tests.
Zatoshi has been incorporated as a Codable type for SQLite Swift
to allow serialization into the pending database.
FIXES on Demo App
fix comments
Fix Travis CI builds
fix travis build
Fix Travis CI
fix travis
Fix Travis CI
Delete unneeded test
Change scheme
Fix Project file so that it compile and tests for Travis CI
restore Demo app scheme
fix dumb typo
Fix Tests. Add workflow
fix workflow for github action
blank line
Issue #334 Update to MnemonicSwift 2.1.0
Issue #331 Reference librustzcash from a branch on that repo
FIX: Don't use nightly on Intel macs. don't build ARM Simulator either
clean up podfile for sample app
pod install
Update MnemonicSwift to 2.1.0
remove "test" comment
Fix: CI builds fail because arm64 is always required regardless of current architecture
move to stable
fix travis build
add else statement for release buidls