- For now I created `CompactBlockProcessorNG` where I started with
implementation of the state machine. I did it to not break the rest of
the SDK. This change will be merged to the feature branch. And before
it is merged to `main` branch code from `CompactBlockProcessorNG` will
be moved to `CompactBlockProcessor`.
- The new code is not used. It just shows and explains how it is done.
It is proof of concept.
- I did put either commented current code or comment to some places to
explain what should be done there.
- New important data types:
- `ActionContext` is context that can hold any data that needs to be
shared between actions. For example sync ranges or current state.
- `CBPState` is state of the `CompactBlockProcessor`. Each state is
handled by one action. This doesn't apply to terminal states like
`finished` or `failed`.
- `ActionProgress` is very similar to `CompactBlockProgress`.
Different actions reports progress differently and `ActionProgress`
represents this.
- `Action` is protocol that defines API of an action. It has one run
method that executes the code of the action
- CBP first creates actions for (almost) each state in `makeActions()`
method. Then the "magic" is done in `CompactBlockProcessorNG.run()` method.
Here is main loop which takes action for current state and execute it.
It's expected that action does it's work and then updates the context
with new state. And this happens until some terminal state
(`finished`, `failed`, `stopped`) is reached.
- After the transition to state machine API of the
`CompactBlockProcessor` should stay the same. No changes should be
required in `SDKSynchronizer`.
[#700] Add documentation for CompactBlockProcessor state machine
- plantuml tool is used to generate diagram.
[#1054] Add config to state machine CBP
Closes#1054
[#1043] Implement DownloadAction
Closes#1043
[#1049] Implement ValidateAction
Closes#1049
[#1050] Implement ValidateServerAction
Closes#1050
[#1056] Add constructors to state machine CBP
Closes#1056
[#1061] Add failure methods for state machine CBP
Closes#1061
[#1055] Implement retry timer to state machine CBP
Closes#1055
[#1057] Implement start for state machine CBP
Closes#1057
[#1058] Implement stop for state machine CBP
Closes#1058
[#1052] Implement AfterSyncHooksManager when using state machine CBP
Closes#1052
[#1060] Implement wipe for state machine CBP
Closes#1060
[#1059] Implement rewind for state machine CBP
Closes#1059
[#700] Add idle state to CBP state machine
This is required so the CBP can detect start of the sync process.
[#700] Implement sending of some events from CompactBlockProcessorNG
[#700] Implement progress reporting in state machine CBP
[#1045] Implement FetchUTXOsAction
- draft of the fetching
[#1045] Implement FetchUTXOsAction
- updated the way Actions communicate data back to the CBP
- used this mechanism to pass result of utxos fetch so it's passed to the SDKSynchronizer as an Event
[#1042] Implement ComputeSyncRangesAction
Closes#1042
[#700] Implement cache clearing when some actions fail
[#1043] Fix batch range computation in DownloadAction
[#1046] Implement SaplingParamsAction
- action for sapling param files finished
[#1048] Implement ScanDownloadedButUnscannedAction
- scan downloaded but unscanned blocks
[#1047] Implement ScanAction
- scan action with the proper ranges computed
[#1047] Implement ScanAction (#1085)
- fixed logger message
[#1044] Implement EnhanceAction
Closes#1044
[#1041] Implement ClearCacheAction
Closes#1041
[#1040] Implement ClearAlreadyScannedBlocksAction
Closes#1040
[#1039] Implement ChecksBeforeSyncAction
Closes#1039
[#700] Make CBP state machine work
[#1050] Implement ValidateServerAction
- broken tests commented out and tracked in the tickets
- new test for ValidateServerAction
[#1051] Update how progress is computed after switch to state machine
Closes#1051
- new proposal for the progress computation
- OverallProgress value is passed to the Synchronizer as a Float
- OverallProgress is a result of fetch, scan and enhance operations
- Order of actions no longer influences the computation
- Actions report partial updates, CompactBlockProgress actor holds current state and computes the OverallProgress
[#1049] Implement ValidateAction
- synchronizer offline tests updated so it compiles, review is requested in a different ticket
- ValidateAction tests added
- BlockValidator mock generated
[#1047] Implement ScanAction
- ScanAction tests
- refactor of validateAction -> validateServerAction
- generated few more mocks for the DI
[#1045] Implement FetchUTXOsAction
- FetchUTXOsAction tests
- UTXOFetcher mocks
[#1045] Implement FetchUTXOsAction
- enhanced with mocked values and more checks
[#1046] Implement SaplingParamsAction
- SaplingParamsAction tests
- added TODO for TestCoordinator reset()
- SaplingParametersHandler mock added
[#1046] Implement SaplingParamsAction
- SaplingParamsAction tests
- added TODO for TestCoordinator reset()
- SaplingParametersHandler mock added
[#1046] Implement SaplingParamsAction
- rebased so I get functionality of improved mock checks
- enhanced SaplingParamsAction tests
- enhanced ValidateAction tests
- enhanced ScanAction tests
[#1046] Implement SaplingParamsAction
- scanAction tests more checks added
[#1044] Implement EnhanceAction
- EnhanceAction tests focused on 2 different methods:
- decideWhatToDoNext covered separately, decisions where the state machine goes next
- run tests for different cases
- new mocks generated for enhacer
- some typos fixed
[#1044] Implement EnhanceAction (#1107)
- empty assert messages fixed
[#700] Get rid of ScanDownloadedButUnscannedAction
Before the state machine download and scan was called in one loop. And
processing range for one batch was same for both of them. Therefore
there was code which scanned downloaded but not scanned blocks.
But now download and scan are independent. So it is possible to remove
`ScanDownloadedButUnscannedAction`.
[#700] Make NetworkTests compilable
Some tests are disabled for now (list is in #1115). And `NetworkTests`
can be compiled and all the enabled tests work.
[#1043] Implement DownloadAction
- DownloadAction tests
- BlockDownloader mock
[#1043] Implement DownloadAction (#1110)
- support functions set to private
[#1039] Implement ChecksBeforeSyncAction
- ChecksBeforeSyncAction tests
- all support functions in Action tests are set to private
- let _ = -> _ = refactor
- CompactBlockRepository mock added
[#1040] Implement ClearAlreadyScannedBlocksAction
- Implement ClearAlreadyScannedBlocksAction tests
- CompactBlockRepository mock added
[#1041] Implement ClearCacheAction
- ClearCacheAction tests
- CompactBlockRepository mock added
[#1042] Implement ComputeSyncRangesAction
- ComputeSyncRangesAction tests
- fixed all tests after merge of latest SDK changes related InternalSyncProgress
- all actions marked as final class
[#1042] Implement ComputeSyncRangesAction (#1120)
- Custom LatestBlocksDataProviderMock removed from the project
[#1122] Implement FileManager protocol and dependency
- ZcashFileManager implemented
- MigrateLegacyCacheDBAction refactored to be dependent on ZcashFileManager
- ZcashFileManager mock added
[#1122] Implement FileManager protocol and dependency (#1124)
- code cleanup
[#1121] Implement MigrateLegacyCacheDBAction
- MigrateLegacyCacheDBAction tests WIP
- tests naming cleanup
[#1121] Implement MigrateLegacyCacheDBAction
- MigrateLegacyCacheDBAction tests finished
[#700] Fix DarksideTests
Closes#1102
Some tests that can't be compiled are disabled for now. List is in #1126.
This PR contains multiple fixes. Most of the fixes is done in the code.
Not in the tests. That is good news.
Fixes:
- `config` inside `CompactBlockProcessor` can be updated during the
tests. And it must be also updated inside the actions. So
`ConfigProvider` is added and it is wrapper for config that is passed
to any instance of `Action` and provides updated config.
- Fixed `EnhanceAction`. Now it should update all the blocks in the
enhance range even when the remaining count of blocks is lower than
1000.
- Fixed `fail()` and `validationFailed()`. These two were canceling
`syncTask`. But that stopped run loop in a bad way.
[#1129] Final check of all State Machine Action tests
- XTCAsset messages checked
- test naming checked and fixed
[#1126] Fix DarksideTests in state machine branch
Closes#1126
Fix offline tests
Closes#1098Closes#1095Closes#1094
Most of the tests is removed. Either the code that was tested doesn't
exists. Or now tests for state machine actions do this work.
[#1115] Fix NetworkTests in state machine branch
Closes#1115
[#700] Fix progress reporting
Some actions in the sync process may not run. For example there are no
transactions to enhance and therefore there is no enhance progress. And in
cases like this computation of final progress won't work properly.
So let's fake 100% progress at the end of the sync process.
fixes docs and deletes fixme for [#783]
closes#783
[#785]: Fix test testSingleNoteNoChangeTransaction
[#786] fix testVerifyChangeTransaction
Closes#786
[#790] mark as fixed testRewindAfterSendingTransaction
Closes#790
[#865] Fix test testStoringTenSandblastedBlocks
Closes#865
[#791] Fix test testRewindAfterSendingTransaction
Closes#791
[#783]: Fix test testMaxAmountSendBroadcast
Closes#783
Closes#1012
- This is the first change for the dependency injection. This change
adds `DIContainer` which is used to register and resolve dependencies.
- Then this change shows how `DIContainer` can be used to resolve
dependencies. And it also shows how to mock dependencies in tests.
- Constructors of `Initializer` are changed to support mocking of
depedendencies. But it doesn't affect public API in any way.
- Depedencies are registered in `Dependencies.setup()`. Then in the code
`container.resolve(SomeType.self)` is called to get instance of the
dependency.
- `ZcashTestCase` class is added. It inherits from `XCTestCase` and
should be used for base class in tests. `ZcashTestCase` takes care of
creation of `DIContainer` for dependencies mocking. In future we can
maybe move there more things that are used in each test.
- Lot is missing here. Not all the code is using dependency injection.
Tests for `DIContainer` are missing. Only `OfflineTests` work now
(other tests can't be even compiled). It will be added in future
changes.
Removes `PendingTransactionEntity` and all of its related components.
Pending items are still tracked and visualized by the existing APIs
but they are retrieved from the `TransactionRepository` instead by
returning `ZcashTransaction.Overview` instead.
`pendingDbURL` is removed from every place it was required. Its
deletion is responsibility of wallet developers.
`ClearedTransactions` are now just `transactions`.
`MigrationManager` is deleted. Now all migrations are in charge of
the rust welding layer.
`PendingTransactionDao.swift` is removed.
Implementation of `AccountEntity` called `Account` is now `DbAccount`
`ZcashTransaction.Overview` can be checked for "pending-ness" by calling
`.isPending(latestHeight:)` latest height must be provided so that minedHeight
can be compared with the lastest and the `defaultStaleTolerance` constant.
`TransactionRecipient` is now a public type.
protocol `PendingTransactionRepository` is removed.
`TransactionManagerError` and `PersistentTransactionManager` are deleted.
`OutboundTransactionManager` is deleted and replaced by `TransactionEncoder`
which now incorporates `submit(encoded:)` functionality
`WalletTransactionEncoder` now uses a `LightWalletService` to submit the
encoded transactions.
Add changelog changes
Delete references to PendingDb from tests and documentation.
Fixes some typos. Adds the ability to trace transaction repository
SQL queries from test
Fix rebase conflicts and generate code
[#837] Memo tests regarding transparent address
Closes#837
Add model for transaction output
Point to FFI branch
Fix issue where sync wouldn't resume after wipe. Becasue GRPC
channel would be closed
Fix Tests
Fix testPendingTransactionMinedHeightUpdated
Fix testLastStates
[#921] Fix broken SynchronizerDarksideTests
Add ZcashTransaction.Output API to Synchronizer
Changelog + comment fix
Add Assertions for transaction outputs and recipients
Point to FFI 0.3.1
Fix Demo App Compiler errors
Fix Demo App Compiler errors
fix cacheDb warnings
Fix Tests and compiler errors of rebase
build demo app
Remove `ZcashTransaction.Sent` and `.Received`. Add `.State` and tests
Fix SPM warning
PR Suggestions
Removes errors that are not used anymore
fix warnings
Closes#888.
- `ZcashRustBackend` is actor now. So majority of methods in this actor
are now async.
- Some methods stayed `static` in `ZcashRustBackend`. It would be hard
to pass instance of the `ZcashRustBackend` to the places where these
methods are used in static manner. And it would change lot of APIs.
But it isn't problem from technical perspective because these methods
would be `nonisolated` otherwise.
- Methods `lastError()` and `getLastError()` in `ZcashRustBackend` are
now private. This makes sure that ther won't be aby race condition
between other methods and these two error methods.
- All the methods for which was `lastError()` used in code now throw
error. So `lastError()` is no longer needed outside of the
`ZcashRustBackend`.
- There are in the public API related to `DerivationTool`.
- `DerivationTool` now requires instance of the `ZcashRustBackend`. And
`ZcashRustBackend` isn't public type. So `DerivationTool` doesn't have
any public constructor now. It can be created only via
`Initializer.makeDerivationTool()` instance method.
- `deriveUnifiedSpendingKey()` and `deriveUnifiedFullViewingKey()` in
`DerivationTool` are now async. It is because these are using
`ZcashRustBackend` inside. `DerivationTool` offers alternative
(closure and combine) APIs. But downside is that there is no sync API
to dervie spending key or viewing key.
- Some methods of the `DerivationTool` are now static. These methods
don't use anything that requires instance of the `DerivationTool`
inside.
[#888] Use Sourcery to generate mocks
- I wrote mock for `Synchronizer` manually. And it's tedious and long
and boring work.
- Now `ZcashRustBackendWelding` is changed a lot so it means
`MockRustBackend` must be changed a lot. So I decided to introduce
`sourcery` to generate mocks from protocols so we don't have to do it
manually ever.
- To generate mocks go to `ZcashLightClientKit/Tests/TestUtils/Sourcery`
directory and run `generateMocks.sh` script.
- Your protocol must be mentioned in `AutoMockable.swift` file.
Generated mocks are in `AutoMockable.generated.swift` file.
[#888] Fix Offline tests
- Offline tests target now runs and tests are green.
- There is log of changes in tests. But logic is not changed.
- Updated `AutoMockable.stencil` so sourcery is able to generate mock as
actor when protocol is marked with: `// sourcery: mockActor`.
- Last few updates in `ZcashRustBackendWelding`. In previous PR `rewindCacheToHeight`
methods was overlooked and it didn't throw error.
- Removed `MockRustBackend` and using generated
`ZCashRustBackendWeldingMock` instead.
- Using generated `SynchronizerMock`.
[#888] Fix NetworkTests
- Changed a bit how rust backend mock is used in the tests. Introduced
`RustBackendMockHelper`. There are some state variables that must be
preserved within one instance of the mock. This helper does exactly
this. It keeps this state variables in the memory and helping mock to
work as expected.
[#888] Fix Darkside tests
Create ZcashKeyDeriving internal protocol
Use New DerivationTool that does not require RustBackend
Remove duplicated methods that had been copied over
[#888] Fix potentially broken tests
I broke the tests because I moved `testTempDirectory` from each
`TestCase` to the `Environment`. By this I caused that each tests uses
exactly same URL. Which is directly against purpose of
`testTempDirectory`.
So now each test calls this one and store it to local variable. So each
test has unique URL.
[#888] Add ability to mock nonisolated methods to AutoMockable.stencil
[#888] Add changelog and fix the documentation in ZcashRustBackendWelding
[#888] Rename derivation rust backend protocol and remove static methods
- Renamed `ZcashKeyDeriving` to `ZcashKeyDerivationBackendWelding`. So
the naming scheme is same as for `ZcashRustBackendWelding`.
- `ZcashKeyDerivationBackend` is now struct instead of enum.
- Methods in `ZcashKeyDerivationBackendWelding` (except one) are no
longer static. Because of this the respective methods in
`DerivationTool` aren't also static anymore.
Closes#877.
- Most of the methods in `OutboundTransactionManager` were already async
so this is not big of a change.
- Some methods/properties in the `SDKSynchronizer` were made async. But
these were async in the `Synchronizer` already. So let's not consider
this change of the public API.
Closes#469.
- Methods defined in `ZcashRustBackendWelding` protocol which are doing
some IO operations are now async.
- `Initializer` no longer have methods to get balance. Only
`Synchronizer` now have these methods. These methods are newly async.
And `Initilializer` doesn't have alternative APIs.
- There is lot of changes in tests but those are mostly adding `await`.
No logic is changed.
Closes#484.
- `TransactionRepository` has async API. `Synchronizer` and alternative
APIs are updated accordingly.
These methods and properties in the `Synchronizer` are async now:
- `cancelSpend(transaction:)`
- All the variants of the `getMemos(for:)` method.
- All the variants fo the `getRecipients(for:)` method.
- `allConfirmedTransactions(from:limit:)`
- `pendingTransactions`
- `clearedTransactions`
- `sentTransactions`
- `receivedTransactions`
This change introduces two new protocols: `ClosureSynchronizer` and
`CombineSynchronizer`. These two protocols define API that doesn't use
`async`. So the client can choose exactly which API it wants to use.
This change also introduces two new objects: `ClosureSDKSynchronizer`
and `CombineSDKSynchronizer`. These two implement the respective protocols
mentioned above. Both are structures. Neither of these two keeps any state.
Thanks to this each is very cheap to create. And usage of these two isn't
mutually exclusive. So devs can really choose the best SDK API for each
part of the client app.
[#831] Use async inside of the SDKSynchronizer
- In general lot of methods inside the `SDKSynchronizer` and
`CompactBlockProcessoer` which weren't async are now async. And other
changes are made because of this change.
- `CompactBlockProcessor` no longer uses Combine to communicate with
`SDKSynchronizer`. Reason for this is that Combine doesn't play great
with async. Closure passed to `sink` isn't async.
- Because of this and because of how our tests work (receiving signals
from CBP directly) `CompactBlockProcessor` must be able to handle more
event closures. Not just one. So it now has `eventClosures`
dictionary. It's little bit strange but it works fine.
- `SyncStatus` inside the `SDKSynchronizer` was previously protected by
lock. Now it's protected by simple actor wrapper.
- Changes in tests are minimal. Changes were mady only because
`CompactBlockProcessor` changes from Combine to closures.
[#831] Add tests for ClosureSDKSynchronizer
- Added tests are testing in general if the `ClosuresSDKSynchronizer` is correctly
calling `Synchronizer` and if the values are correctly returned.
- `ClosuresSDKSynchronizer` doesn't contain any logic but it is public
API and we should be sure that it works correctly.
[#831] Add tests for CombineSDKSynchronizer
[#831] Add changelog
Closes#826
- `viewingKeys` and `walletBirthday` are removed from `Initializer`
constuctor. These parameters are moved to `SDKSynchronizer.prepare`
function.
- Constructor of the `SDKSynchronizer` no longer throws exception.
- Any value emitted from `lastState` stream before `SDKSynchronizer.prepare`
is called has `latestScannedHeight` set to 0.
- `Initializer.initialize` function isn't public anymore. To initialize
SDK call `SDKSynchronizer.prepare` instead.
- Real birthday is now known after the `SDKSynchronizer.prepare` is
called. But this function isn't async and therefore it's hard to
pass birthday from here to `CompactBlockProcessor` in synchronous
manner. We must be sure that it's safe to call start() after prepare
function finishes.
For this reason `CompactBlockProcessor` has `walletBirthdayProvider`
instead of `walletBirthday`. And this new parameter is closure which
reads birthday from `Initiliazer` on each call. Thanks to this
`CompactBlockProcessor` has always the right birthday.
- Some cleanup is done in `TestCoordinator`.
Closes#816
- `SDKSynchronizer.rewind(policy:)` can be now called anytime.
- If the sync is in progress then the sync is first stopped and then rewind is executed.
- Rewind now returns AnyPublisher which completes or fails when wipe is done.
- `AgterSyncHooksManager` is used to execute rewind after sync process
is stopped.
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.
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.
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`.
`XCAsyncTestCase` does not work as intended but `wait {}` does what
we need.
restored `needsToStartScanningWhenStopped` as a Bool var on actor
fixed Enhancement test
- 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
Closes#384
This makes the SDK use the Memo and MemoBytes types across the FFI and the
public interface of the SDKSynchronizer. Addresses the comments by @defuse on
issue https://github.com/zcash/ZcashLightClientKit/issues/378.
These changes depend on zcash-light-client-ffi repo changes managing
memos as byte arrays instead of string encoding of memos.
There are some compromises in terms of database representation of memos
and their exposure in transaction representing entities because we
wanted to avoid changing the database at this moment and be retro-
compatible with earlier versions and maintain deprecated APIs for wallets
to have time to adopt.
Memo and MemoBytes are WIP and subject to change. we are exploring
making Memo an opaque type based on a struct and drop the enum approach
to make the interface less throwing.
Fix: wrap new functions and deprecate old API. catch Memo errors
update get_sent and get_received memo functions from rust welding
point to branch in FFI repo
Fix type Tests/DarksideTests/BalanceTests.swift
Co-authored-by: Carter Jernigan <git@carterjernigan.com>
PR suggestions. Inverted condition
PR Suggestions + cleanup
merge fixes
Suggestions from PR to treat null bytes on TextMemo
refactor unpaddedRawBytes function and add tests
undo change in PendingTransactionSQLDAO
Fix broken import on Swift Package for libzcashlc
Fix libzcashlc url
Fix travis.yml
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
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