Commit Graph

104 Commits

Author SHA1 Message Date
Lukas Korba ffc7fd1be9 [#1412] Review wipe function and in memory values
- The wipe() is now resetting local in memory values of latestBlocksDataProvider. In some case this could cause a reset of CBP's state machine context sooner than it was supposed to, resulting in corrupted sync.
2024-04-16 16:48:20 +02:00
Lukas Korba f41ac27eb8 [#1406] Release 2.1.3
- changelog updated
2024-03-28 16:10:50 +01:00
Jack Grigg 006861595d Fetch and store Orchard subtree roots 2024-03-28 10:52:17 -04:00
Lukas Korba eb2ebeaf97 [#1404] Release 2.1.2
- fix for a bug in note selection when sending to a transparent recipient
2024-03-27 23:18:57 +01:00
Lukas Korba e3cb722db8 [#1402] Release 2.1.1
- FFI bump

[#1402] Release 2.1.1

- changelog updated
2024-03-27 16:47:24 +01:00
Lukas Korba c5e07943d3 [#1398] Release 2.1.0
- changelog updated for the release
2024-03-26 18:03:01 +01:00
Lukas Korba 41cf1357bd checkpoints-update
- checkpoints added
2024-03-26 17:51:24 +01:00
Jack Grigg dd9942b6ab Remove `UnspentTransactionOutputRepository`
This removes the last direct access to the `utxos` table; all access
now goes through the Rust FFI.

`SDKSynchronizer.latestUTXOs` is removed without replacement. It was
introduced during the initial addition of shielding support, but:

- It is no longer used anywhere inside the SDK (when added, it was
  used in a few other methods).
- It is not exposed in the `Synchronizer` protocol.
- It is AFAICT unused in Zashi iOS, Edge, and Unstoppable.
- It was functionally replaced by `refreshUTXOs`, which performs
  best-effort UTXO updates instead of failing on any error. (It also
  does not clear the `utxo`s table which makes it not equivalent.)
2024-03-15 14:37:17 +00:00
Francisco Gindre c873e208c4
[#1379] Fulfill Payment from a valid ZIP-321 request
Closes #1379

Adds test for parsing error
Adds test for successful tx creation
Public API changes in CHANGELOG.md
2024-03-08 18:38:50 -03:00
Lukas Korba 9ce891e928 [#1388] Release 2.0.11
- Changelog updated
- Checkpoints added for both mainnet and testnet

[#1388] Release 2.0.11 (#1389)

- Unreleased added to the changelog
2024-03-08 17:09:06 +01:00
Jack Grigg 23fd0698d4 Migrate to FFI 0.6.0 release 2024-03-08 00:26:02 +00:00
Lukas Korba bb1a05ef5c Enable ZIP 317 fees
Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1186.
2024-03-06 02:53:34 +00:00
Jack Grigg dd41e655e4 Deprecate `Synchronizer.sendToAddress` and `Synchronizer.shieldFunds` 2024-03-06 02:53:34 +00:00
Jack Grigg 8145248285 Expose APIs for working with transaction proposals
Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1204.
2024-03-06 02:53:33 +00:00
Lukas Korba 7007560cf2
Update CHANGELOG.md
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-02-12 20:07:19 +01:00
Lukas Korba 432beb96d5
Update CHANGELOG.md
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-02-12 20:07:12 +01:00
Lukas Korba 9f339d5252 [#1376] Release 2.0.10
- Checkpoints added
- Changelog updated
2024-02-12 19:48:34 +01:00
Lukas Korba e51f425c54 [#1369] SynchronizerState refactor
- plural of account balances refactor to singular

[#1369] SynchronizerState refactor

- transaprent balance removed from SynchronizerState
- all balances are now handled with AccountBalance

[#1369] SynchronizerState refactor and balances cleanup

- WalletBalance has been removed from the SDK, replaced with AccountBalance
- public APIs for individual balances (getTransparent, getShielded, getShieldedVerfied) have been removed from the SDK, replaced with getAccountBalance
- tests refactored

[#1369] SynchronizerState refactor and balances cleanup

- dark side tests refactored

[#1369] SynchronizerState refactor and balances cleanup (#1372)

- addressed comments

[#1369] SynchronizerState refactor

- ZcashError for spending key does not belong to the wallet
2024-02-12 17:41:26 +01:00
Lukas Korba c7369057f1 [#1153] Allow runtime switch of lightwalletd servers
- new public API switchTo(endpoint:) implemented

[#1153] Allow runtime switch of lightwalletd servers

- API documented
- code cleaned up

[#1153] Allow runtime switch of lightwalletd servers

- mocks generated

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- sever validation added

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- enhanced validation of the server

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- new ZcashError.synchronizerServerSwitch that represents the state when the endpoint fails validation

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- ZcashError definition update

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- addressed comments

[#1153] Allow runtime switch of lightwalletd servers (#1373)

- changelog revert according to proposal
2024-02-12 17:13:08 +01:00
Lukas Korba 9fab46a2d1 [#1363] Expose PoolBalance Zatoshi values
- new public API with returning AccountBalance

[#1363] Expose PoolBalance Zatoshi values

- accountBalances exposed into the SynchronizationState

[#1363] Expose PoolBalance Zatoshi values

- public vs. internal

[1363] Account balances in the SynchronizerState

- changelog update
- scanAction reports the initial after-scan value immediately instead of after X scans
- SynchronizerState has been refactored, we no longer call 2 rust methods to get shielded verified + total balances
 - tests refactored to reflect this change
- mocks regenerated
- Sourcery version bumped

[#1363] Account balances in the SynchronizerState

- changelog typo fixed

[#1363] Account balances in the SynchronizerState

- internal vs. public
2024-01-31 17:05:13 -08:00
Kris Nuttycombe 20c4e2f8b0 Release version 2.0.8 2024-01-30 18:03:52 -08:00
Kris Nuttycombe 59cf3570dd Update to zcash-light-client-ffi version 0.5.0 2024-01-30 08:44:47 -08:00
Lukas Korba 4e4c4d0514 [#1359] Release 2.0.6
- changelog updated
2024-01-28 08:52:35 -08:00
Lukas Korba e3cbd78712 [#1357] Checkpoints update
- new checkpoints added
2024-01-28 08:43:16 -08:00
Lukas Korba f2a2dfb03c [#1351] Recover from block stream issues
- changelog updated
- block stream errors are now handled as a special case of error, retry logic is triggered but at most 3-times in case of service being truly down
- the failure is not passed to the clients so ideally the false positive errors are reduced as well as the delay in the sync time

[#1351] Recover from block stream issues (#1352)

- typo fixed
2024-01-25 13:35:46 +01:00
Lukas Korba bca6ceb15f [#1346] Troubleshooting synchronization
- changelog update
- the sync time has been reduced by ~33%. The progress reporting frequency has been lowered down 5-times
- this is just first step and a quick improvement before we introduce advanced solution, covered in #1353

[#1346] Troubleshooting synchronization (#1354)

- typo fixed
2024-01-25 13:32:58 +01:00
Lukas Korba 1dde31e41a [#1336] Tweaks for sdk metrics
- the logs are split so it's not a huge string
- the log method is async
- added a new log with balances

[#1336] Tweaks for sdk metrics

- wait a bit so the logs are sorted in time

[#1336] Tweaks for sdk metrics

- wait a bit so the logs are sorted in time

[#1336] Tweaks for sdk metrics

- wait a bit so the logs are sorted in time

[#1336] Tweaks for sdk metrics

- cleanup

[#1336] Tweaks for sdk metrics

- changelog update

[#1336] Tweaks for sdk metrics

- checkpoints updated

[#1336] Tweaks for sdk metrics

- changelog typos fixed

[#1336] Tweaks for sdk metrics

- mocks generated
2023-12-15 09:01:04 +01:00
Lukas Korba 723c1d7a06 [#1328] Release 2.0.4
- Changelog updated with the date
2023-12-12 18:27:42 +01:00
Lukas Korba 3e263f0c35 [#1325] Log metrics
- the logger has been extended to log the level as well
- there is only partial match of levels between SDK logger levels, OSLogEntryLogLevel and OSLogType so only debug, info, error are fully matched
- this is a base for the exporter on client's side

[#1325] Log metrics

- typos fixed

[#1325] Log metrics

- scan metric logs added

[#1325] Log metrics

- Scan & Enhance logs

[#1325] Log metrics

- checkpoints updated
- every CBP action is measured separately and collects the data, when the sync is done it dumps overview of the run to the logger
- next run clears out the previous data and starts to collect fresh reports for the run

[#1325] Log metrics (#1327)

- changelog update

[#1325] Log metrics (#1327)

- SDKMetrics updated to be mockable
- unit test updated

[#1325] Log metrics (#1327)

- performance tests cleaned out

[#1325] Log metrics (#1327)

- Network tests buildable again
2023-12-12 08:59:52 +01:00
Lukas Korba fb7eb1978d [#1310] Release 2-0-3
- checkpoints updated

[#1310] Release 2-0-3

- FFI version bumped
- other dependencies bumped as well

[#1310] Release 2-0-3

- checkpoints mentioned in the changelog
2023-10-20 12:46:15 +02:00
Lukas Korba 6223170f80
Update CHANGELOG.md
- grammar check

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-20 10:16:52 +02:00
Lukas Korba ab23f15fa1 [#1308] Enhancing seems to not process all ranges
- The enhance action is driven by lastEnhancedHeight value. The range is computed from it and every 1000 blocks are enhanced. The value hasn't been reseted with the new suggested ScanRanges so when some higher ranges were processed first, all lower heights were skipped
- fixed and covered with the unit test

[#1308] Enhancing seems to not process all ranges (#1309)

- changelog update
2023-10-20 09:54:17 +02:00
Kris Nuttycombe c1cc041ab0 Update CHANGELOG for 2.0.2 release. 2023-10-12 12:33:19 -06:00
Lukas Korba 5983cd8f91 [#1303] Don't invalidate the timer with the error
- the most simple fix for this issue is to set the number of attempts to the "infinity"
- smarter solution will require a better retry logic in general, covered in #1304
2023-10-12 18:10:07 +02:00
Lukas Korba 08a16fce61 [#1295] Release ZcashLightClientKit 2.0.1
- checkpoints updated
2023-10-03 07:53:36 +02:00
Lukas Korba 69e38e0667 [#1294] Remove all uses of the incorrect 1000-ZAT fee
- Removed deprecated zip-313 fee of 1000 Zatoshi
- default is now 10k zatoshi, the minimum defined by zip-317

[#1294] Remove all uses of the incorrect 1000-ZAT fee

- changelog update
2023-09-29 20:01:38 +02:00
Kris Nuttycombe 71a6f580fc Update `zcash-light-client-ffi` for 2.0.0 final release. 2023-09-25 15:55:49 -06:00
Kris Nuttycombe e28035292f Release 2.0.0-rc1
* Updates to `zcash-light-client-ffi 0.4.0-rc.1`
* Makes some cleanup updates to the CHANGELOG; a complete changelog will
  be prepared for the 2.0.0 final release.
2023-09-11 19:10:55 -06:00
Lukas Korba 945f25a181 [#1255] Changelog tweak
- cleanup and fixes
2023-09-11 09:37:47 +02:00
Lukas Korba dc5cbd8dec [#1236] Use of recoverUntil
- SDKSynchronizer's public API prepareWith() now requires a parameter WalletInitMode
- tests fixed
- changelog updated
2023-09-08 15:44:48 +02:00
Lukas Korba d956e9940b [#1230] Remove linear sync from the SDK
- concept of linear syncing fully removed from the SDK, it's fully replaced with Spend-before-Sync
- BlockDAO - table blocks is no longer used, removed from the SDK and all it's associated getLastBlocks/ScannedHeights as with it
- concept of pending transactions removed from the SDK
- unit tests refactored
2023-09-08 07:40:08 +02:00
Lukas Korba d9f92ec7a9 [#1181] Correct computation of progress for Spend before Sync
- the computation of progress changed, the total range is computed, that way it works for any kind of sync algorithm
- the progress depends on finished scan action, whenever it processes some blocks, it's counted up
- the final progress is a ratio between these new values
2023-09-07 13:23:47 +02:00
Lukas Korba 5fa1af38f0 [#1196] Check logging level priorities
- the priorities for log levels have been updated

[#1196] Check logging level priorities

- changelog updated
2023-08-10 08:56:00 +02:00
Michal Fousek c0c0c426d5 [#1111] Change storage for InternalSyncProgress
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.
2023-05-22 20:42:11 +02:00
Francisco Gindre c1e0740519
[#1105] Release 0.22.0-beta (#1106)
Checkpoints and CHANGELOG.md updates
Closes #1105
2023-05-22 15:21:21 -03:00
Francisco Gindre c736dd37fb
[#1019] Memo has trailing garbled text (#1023)
Changes the way unpadded bytes are turned into a UTF-8 Swift String
without using cString assuming APIs that would overflow memory and
add garbled trailing bytes.

Closes #1019

add changelog entry
2023-05-05 15:51:50 -03:00
Francisco Gindre f5e7c027af
[#1001] Remove PendingDb in favor of `v_transactions` and `v_tx_output` Views (#1001)
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
2023-05-05 14:30:47 -03:00
Michal Fousek 0032fedde7 [#442] Introduce parallel downloading and scanning
- `BlockDownloaderImpl` is changed. It now spawns detached Task to
  download blocks. So blocks can be downloaded in parallel with scanning
  process.
- `Synchronizer.stop()` is no longer async.
- Blocks cache cleaning is changed. It's not possible to drop the whole
  cache now. There are some blocks pre-downloaded which weren't scanned
  yet.
2023-05-05 09:35:43 +02:00
Matthew Watt 58b99c8fb1
[#1013] - Enable more granular control over logging behavior (#1014)
* Add new model for logging configuration

* Fix the example app and update the changelog
2023-05-02 16:59:49 -03:00
Michal Fousek 724d410fad
[#361] Introduce ZcashError (#1005)
This PR introduces `ZcashError` enum. This enum represents any error
that can be thrown inside of the SDK and outside of the SDK. Also
`ZcashError` is used in `LightWalletGRPCService` and handled in
`CompactBlockProcessor` as example.

Why enum? First I tried this with some structure which contained code,
message and underlyingError. Problem was when some specific place in the
SDK would like to attach some additional data to error. I didn't want to
add some generic dictionary to store anything with the error.

So I used enum to identify error. Each member can have specified amount
of associated values. So specific error can bring some context data. And
it's type safe.

Each error has also a code. Relationship between errors and codes is
1:1. It may looks bit redundant but it's important. The client app now
can choose how to process errors. Either identify those by the error
itself or by code.

Definition or errors and codes is in `ZcashErrorDefinition`. And then
`ZcashError` and `ZcashErrorCode` are generated by Sourcery. Thanks to
this it is easier to maintain the final code. And it gives us ability to
generate any kind of documentation for the errors and codes. I created
simple example of this in this PR. And it doesn't make the SDK
completely dependent on the Sourcery. Final structures aren't super
complicated and can be written manually if needed.

[#923] Update error handling in DatabaseStorageManager.swift

- cleanup of DatabaseStorageManager, not used anymore
- ZcashError for SimpleConnectionProvider

Revert "[#923] Update error handling in DatabaseStorageManager.swift"

This reverts commit 94e028d31a.

Fix script which generates ZcashError

[#922] Update error handling in DatabaseMigrationManager.swift

Closes #922

[#923] Update error handling in DatabaseStorageManager.swift

- The DatabaseStorageManager is not used so I deleted it
- SimpleConnectionProvider's errors updated

Fix tests

[#955] Update error handling in SaplingParameterDownloader

Closes #955

[#936] Update error handling in NotesDao

Closes #936

[#935] Update error handling in BlockDao

Closes #935

[#931] InternalSyncProgress.computeNextState doesn't need to throw

Closes #931

[#950] Update error handling in rust backend

Closes #949
Closes #950

[#941] Update error handling in AccountEntity

Closes #941

[#928] Update error handling in FSCompactBlockRepository

Closes #928

[#925] Update error handling in BlockDownloaderService (#974)

- BlockDownloaderService errors updated

[#924] Update error handling in BlockDownloader (#973)

- BlockDownloaderStream nextBlock updated

[#942] Update error handling in TransactionEntity (#977)

- ZcashTransaction init errors converted to the ZcashError

[#939] Update error handling in TransactionDao (#976)

- TransactionRepositoryError removed and replaced with ZcashError
- all TransactionDAO errors converted to ZcashError

[#943] Update error handling in ZcashCompactBlock

Closes #943

[#945] Update error handling in Memo

Closes #945

[#934] Update error handling in Checkpoint

Closes #944
Closes #934

[#938] Update error handling in PendingTransactionDao

Closes #938

[#926] Update error handling in BlockEnhancer

- WIP, switching to transaction repository to unblock this ticket

[#926] Update error handling in BlockEnhancer

- enhancer's errors done

[#926] Update error handling in BlockEnhancer (#994)

- cleanup

[#952] Update error handling in DerivationTool

Closes #952

[#932] Update error handling in BlockValidator

Closes #932

[#940] Update error handling in UnspentTransactionOutputDao

Closes #940

[#946] Update error handling in WalletTypes

Closes #946

[#954] Update error handling in WalletTransactionEncoder

Closes #954

[#953] Update error handling in PersistentTransactionManager

Closes #953

[#956] Update error handling in Initializer

Closes #956

[#947] Update error handling in Zatoshi (#996)

- Zatoshi's errors converted to ZcashError

[#927] Update error handling in UTXOFetcher (#997)

- UTXOFetcher resolved

Use let instead of var where applicable

In the SDK `var` was used on places where `let` would be sufficient. And
default strategy in Swift should use use `let` until mutability is
required. So all these places are changed. No logic is changed.

[#933] Update error handling in CompactBlockProcessor

- CompactBlockProcessor's errors refactored to ZcashError

[#933] Update error handling in CompactBlockProcessor #999

- comments addressed

[#951] Update error handling in SDKSynchronizer

- SDKSynchronizer's errors refactored to ZcashError

[#951] Update error handling in SDKSynchronizer (#1002)

- comments resolved

Make DerivationTool constructor public

DerivationTool.init should be public. This was removed by accident when
adopting async.

[#361] Add changelog
2023-04-24 18:15:20 -03:00