The previous FFI repo revisions no longer exist; commits between
87faf91096 and here will not build.
Update Rust dependencies with account birthdays and scan progress
- fixes for SampleApp
- draft
[#1140] ClearCache action before anything starts
- ClearCache action right after the idle action, clearing out metadata so the sync process can be fully restored from the DB and live blockchain values only.
- InternalSyncProgress removed
- InternalSyncProgressStorage removed
- Sync process control logic updated, controlled by latestScannedHeight and firstUnenhancedHeight only
- cleaned up unused code
[#1140] ClearCache action before anything starts
- ChecksBeforeSyncAction removed
- Offline tests fixed
[#1140] ClearCache action before anything starts
- fixed injection of a wallet birthday, the sync range must start with wallet BD instead of lower bound
[#1140] ClearCache action before anything starts
- Network tests fixed
- DarkSideTests partially fixed
[#1140] ClearCache action before anything starts
- rewind actions extension in compact block processor added
[#1140] ClearCache action before anything starts
- draft
[#1140] ClearCache action before anything starts
- DarkSideTests fixed
[#1140] ClearCache action before anything starts
- SyncRanges modified to be even less dependent on ranges, now it holds just 3 values (latest block height, latest scanned height if any, first unenhanced height if any), the rest is computed on the fly
[#1140] ClearCache action before anything starts
- SyncRanges struct not anymore, refactored to SyncControlData, holding just 3 mentioned values
[#1140] ClearCache action before anything starts
- cleanup
[#1140] ClearCache action before anything starts (#1148)
- TODO solved, the UTXOs fetcher doesn't work with range anymore, therefore reporting 100%
Closes#1111
- `InternalSyncProgress` has now new disk storage implementation:
`InternalSyncProgressDiskStorage`.
- When then `UserDefaults` was used as disk storage there were no IO errors
to handle. But now the code in `InternalSyncProgressDiskStorage`
writes to files and reads from files. So there are errors to handle.
Because of this protocol `InternalSyncProgressStorage` changed a bit
and API of `InternalSyncProgress` changed a bit. Now all the functions
throws.
- It is possible to make progress storage IO errors silent but I think
that storing of the progress is very essential to the sync process. So
I think that when progress storage fails then the sync process should
fail.
- `Initializer` has new parameter `generalStorageURL`. It is directory
where `InternalSyncProgressDiskStorage` stores progress files. In
future this can be used for storing any data the SDK wants.
- SyncStatus refactored to InternalSyncStatus, so the SDK works internally with the SyncStatus as previously
- new SyncStatus is a computed property that maps InternalSyncStatus to simplified SyncStatus
[#843] Simplify Synchronizer Status (#1010)
- simplification of SyncStatus done
- % computation moved to the mapping function so the rest of the SDK works just like before
- fixed unit tests
- new unit tests checking the boundaries of the new progress
[#843] Simplify Synchronizer Status (#1010)
- removed commented code
[#843] Simplify Synchronizer Status (#1010)
- package.resolved
[#843] Simplify Synchronizer Status (#1010)
- fixed dark side tests
[#843] Simplify Synchronizer Status (#1010)
- package.resolved
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
It looks like that some methods in `ZcashKeyDerivationBackendWelding`
were left async by mistake. There is no reason for any method there to
be async.
After this change no method in `DerivationTool` has to async. It makes
things much easier.
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#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`
Closes#209.
[#845] Introduce ZcashSynchronizerAlias enum
Closes#845.
[#852] SDKSynchronizer using queues label based on the alias
Closes#852.
[#847] Remove posibility to use DatabaseStorageManager as singleton
Closes#847.
[#850] Remove synchronizerConnectionStateChanged notification
Closes#850.
[#855] Add check if the Alias is already used
Closes#855
- Added `UsedAliasesChecker` utility which is used to register aliases
that are in use.
- `prepare()` and `wipe()` methods now check if the current alias can't
be used and if not then `InitializerError.aliasAlreadyInUse` is
thrown/emitted.
- Some public methods that could cause harm if used with the Alias that
is already in use now throw `SynchronizerError.notPrepared`. Thanks to
this the client app is forced to call `prepare()` first. And
`prepare()` does check for the Alias.
- Added tests for new conditions.
[#849] Make InternalSyncProgress aware of the Alias
Closes#849.
[#853] Only instance with default Alias migrates legacy cache DB
Closes#853.
[#851] Apply the Alias to the URLs
Closes#851.
- `Initializer` now updates paths according to alias before paths are
used anywhere in the SDK.
- Paths update can fail. It would be incovenient for the client apps to
handle errors thrown from `Initiliazer` constructor. So the error is
then handled in `SDKSynchronizer.prepare()` or `SDKSynchronizer.wipe()`.
[#846] Stop using SDKMetrics as singleton (#862)
- metrics are not longer a singleton
- tests fixed
- metrics outside init of the synchronizer
[#848] Make logger aware of the alias
- logger is now an instance passed throughout the sdk instead of a static proxy
[#848] Make logger aware of the alias (#868)
- comments addressed
[#848] Make logger aware of the alias (#868)
- returning protocol back
Fix typos
[#856] Add possibility to test multiple synchronizers in the sample app
Closes#856.
- Added `alias` property to `Synchronizer`.
- Added `SyncBlocksListViewController` which provides UI to use multiple
synchronizers at once.
[#209] Add changelog
- Add changelog for #209.
- Overall improve readability of the rendered changelog. Tickets
references are now prefixed with `###` instead of `- `.
Fix compilation
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#724
- All the notifications are gone. Only
`synchronizerConnectionStateChanged` stayed because it's used
internally. Let's deal with this one in another task.
- Synchronizer has now two new publishers (`stateStream` and
(`eventStream`) which are used to notify the client app about
what is going on. These publishers replace notifications.
- There is also new property `latestState` which can be used to get the
SDK state in synchronous manner.
- `SDKSynchronizer.status` is no longer public. It is used internally to
refresh `latestState` and emit new values from `stateStream.
- When `SDKSynchronizer.status` is update `notify()` function is
triggered. And this function is now responsible for generating new
snapshot of `SynchronizerState` and updating `latestState` and
`stateStream`.
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#795
- Added structure `SaplingParamsSourceURL` which holds source URLs for
sapling-spend file and sapling-output file. URLs are ultimately passed
to `SaplingParameterDownloader`.
- This is done so it's possible to pass different URLs when running
tests.
- sapling-spend file and sapling-output file are in tests bundle. And
when running tests these files are loaded from bundle and not from
network.
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 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`.
- 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