Commit Graph

258 Commits

Author SHA1 Message Date
Lukas Korba beb48dd0bd [#1462] Syncing is broken
- The CompactBlockProcessor's state machine got stuck in some cases at the updateChainTip action.

[#1462] Syncing is broken

- unit test fixed
2024-07-04 08:28:48 +02:00
Lukas Korba 528f380484 [#1452] TX Resubmission-the wallet has to periodically resubmit unmined transactions
- functional version is done

[#1452] TX Resubmission-the wallet has to periodically resubmit unmined transactions

- code cleanup

[#1452] TX Resubmission-the wallet has to periodically resubmit unmined transactions

- changelog updated

[#1452] TX Resubmission-the wallet has to periodically resubmit unmined transactions

- unit tests fixed
- mocks generated
2024-07-03 14:31:43 +02:00
Francisco Gindre bcffcead1e
add tree state for height 663187 2024-06-26 17:23:09 -03:00
Francisco Gindre b13b5bc179
Add TreeState fo 663150 2024-06-26 17:03:17 -03:00
Francisco Gindre eb6daba93c
[#1341] Add Support for GetSubTreeRoots in Advanced Re Org tests
closes #1341

Updates Proto files and compile new swift versions

Adds setSubTree darkside service
adds subtrees into buildFakeChain() methods
2024-06-26 16:57:05 -03:00
Francisco Gindre aaf12c057b
[#1455] Darkside Tests: Test fail with "call AddTreeState() first"
this adds the addTreeState() function to the DarksideWalletService
class and corresponding calls in FakeChainBuilder
Closes #1455
2024-06-26 10:34:05 -03:00
Lukas Korba d258fc094b [#1431] Fix swiftlint reported issues
- all reported swiftlint issues have been addressed

[#1431] Fix swiftlint reported issues

- changelog updated

[#1431] Fix swiftlint reported issues (#1432)

- fixme fix
2024-05-30 13:16:46 +02:00
Lukas Korba 9de9ea5e78 [#1429] Get memos for rawID
- New API for getting the memos by transaction's rawID

[#1429] Get memos for rawID

- Mock regenerated to have unique names

[#1429] Get memos for rawID

- Offlinetest fixed
2024-05-28 18:42:53 +02:00
Kris Nuttycombe 0cf08c6a59 Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
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 3429afa9dc [#1177] Remove globalDBLock
- globalDBLock has been removed and replaced with global DBActor

[#1177] Remove globalDBLock (#1409)

- linter issues
2024-04-09 18:58:20 +02:00
Lukas Korba bdfe0b6823 orchard-subtree-roots
- test testUpdateSubtreeRootsAction_RootsAvailablePutRootsSuccess fixed
2024-03-28 16:03:00 +01:00
Jack Grigg 006861595d Fetch and store Orchard subtree roots 2024-03-28 10:52:17 -04:00
Jack Grigg 43534d26d9 Integrate Orchard support and latest Rust updates 2024-03-25 23:19:44 -04:00
Lukas Korba e1c600b8ff Public API isSeedRelevantToWallet
- New public API `isSeedRelevantToWallet` has been implemented
- 2 swiftlint error have been resolved
- Mocks generated
2024-03-18 14:45:30 +01:00
Jack Grigg a5a0ef0ac1 Migrate to latest in-progress revision of Rust crates
- New backend method `ZcashRustBackend.isSeedRelevantToWallet`
- `ZcashRustBackend.scanBlocks` now takes a `fromState` argument.

Co-authored-by: Lukas Korba <lukas.korba@seznam.cz>
2024-03-15 16:01:39 +00:00
Jack Grigg 86defc8b4a Remove `AccountRepository`
This removes the last direct access to the `accounts` table; all access
now goes through the Rust FFI.
2024-03-15 15:26:44 +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
Jack Grigg e9177a28f7 Migrate to in-progress version of FFI backend 0.6.0
Includes:
- Multi-step transaction proposals.
- Changes to support `Synchronizer.proposeShielding` API changes.
2024-03-06 03:06:57 +00:00
Jack Grigg 84ac6252fe Adjust `Synchronizer.proposeShielding` API
- Returns `null` when there are no funds to shield or the shielding
  threshold is not met.
- Throws an exception if there are funds to shield in more than one
  transparent receiver within the account.
- Has an optional parameter for specifying which transparent receiver
  to shield funds from.

This commit only alters the API to support the above; the functional
changes require modifying the FFI and Rust backend, which will happen
in a separate commit.
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 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
Jack Grigg ded20fe7b0 Migrate to in-progress version of FFI backend 0.5.0
Includes:
- Exposed `WalletSummary`.
- Exposed transaction proposals.
- `ScanSummary` returned from `ZcashRustBackend.scanBlocks`.

Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1259.
Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1299.
2024-01-29 09:47:14 -08: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 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
Francisco Gindre 6625ffd711
Create a Dependency that can load checkpoints from bundle
Closes #1315

This PR introduces small changes on each commit.
Things done:

rename Checkpoint+Constants to Checkpoint+helpers

Move `Checkpoint` from Model folder to Checkpoint folder

Remove unused function `ofLatestCheckpoint` from BlockHeight

Create a protocol called `CheckpointSource` that contains the
relevant functionality to get checkpoints from Bundle

Create a set of tests that check that functionality is maintained
when a `CheckpointSource` is used instead of Checkpoint helpers

Implement `BundleCheckpointSource` and add Tests

Code clean up: move `BundleCheckpointURLProvider` to its own file

Code clean up: `Checkpoint+helpers` match file header

Replace use of `Checkpoint.birthday(with:network)` with CheckpointSource

Revert "Remove unused function `ofLatestCheckpoint` from BlockHeight"

addresses PR comment from @daira

This reverts commit d0e154ded7, since it
modifies a public API and it was not the goal of this PR.

Update Sources/ZcashLightClientKit/Checkpoint/BundleCheckpointSource.swift

Use a decent Date Format

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>

Improve documentation on BundleCheckpointURLProvider

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>

Improve documentation on BundleCheckpointURLProvider

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>

use YYYY-mm-dd on file header

author: @daira

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>

Add test that verifies that the exact height is returned if available
2023-11-08 15:45:14 -03: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
Lukas Korba e763e29dc1 [#1301] foundTransactions don't emit after rewind
- There was a reset missing in the rewind() call. This method is a direct call affecting the state of the compact block processor but the ActionContext has been handled only in the synchronization pipeline. Manual reset was needed to reset the last enhanced height.
- tests added
2023-10-12 15:59:47 +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 a338e1daf5 Apply suggestions from code review.
Co-authored-by: str4d <thestr4d@gmail.com>
2023-09-19 16:24:36 -06:00
Kris Nuttycombe 94a5f599ae Fix incorrect use of transaction index in find-from-transaction query.
This fixes an issue where the transaction index was incorrectly being
used to filter out transactions from the contents of the
`v_transactions` view, and updates the query to account for the fact
that both the block time and the transaction index may be NULL in the
results of this view.
2023-09-19 10:25:18 -06:00
Kris Nuttycombe 2c526dbcd6 Update `zcash-light-client-ffi` to adopt fix for missing transparent history.
Fixes #1271

Co-Authored-By: Jack Grigg <jack@electriccoin.co>
Co-Authored-By: Lukas Korba <lukas.korba@seznam.cz>
2023-09-19 08:26:03 -06:00
Lukas Korba 6b8d95906a [#1273] SynchronizerState not always up to date
- latestBlockHeight (chain tip) reported in the SynchronizerState to the clients is now updated every 10mins at most, typically with every sync run (10-30s)
- fully and max scanned heights update fixed
- new mocks provided and tests fixed
2023-09-18 11:01:58 +02:00
Francisco Gindre 4f225b5115
[#1267] Avoid Division By Zero in ScanProgress type
Although is not the best way to solve it this addresses the issue
in a single statement and following existing pattern in the code.

The error should be thrown earlier in RustBackend itself if so,
or fallback to some specific value that makes sense to the domain

Closes #1267
2023-09-13 18:47:55 -03:00
Lukas Korba 26fe1f7310 ScanRange initialization changed
- only the matching priorities are allowed, otherwise fatalError
2023-09-13 17:57:24 +02:00
Lukas Korba 4e2af5da68 Addressed comments batch 2
- more comments resolved
- totalProgressRange removed from the SDK
- ScanRange now takes into account the given value and properly initializes, + added tests
- tests fixed
2023-09-13 17:33:37 +02:00
Lukas Korba 5600e77a71 Rewind action continues to the processScanRanges
- the diagram png + puml updated
- rewind action continues to the process scan ranges
2023-09-13 16:28:42 +02:00
Lukas Korba 95c9746303 cbp_state_machine updated
- cbp_state_machine.png as well as .puml files updated to reflect the State Machine changes after SBS
- one small cleanup of clearCache, no longer needed to be called twice, only after enhance (missed removal of linear sync)
2023-09-13 15:25:25 +02:00
Lukas Korba 3d2812c77f ProcessSuggestedScanRanges always continues to the download
- the logic deciding if verify range is present and going to the rewind is no longer valid, so removed
- tests updated
2023-09-13 14:58:38 +02:00
Lukas Korba 4b45c15a96 Comments addressed
- all comments from the review (round 1) resolved
2023-09-13 09:24:26 +02:00
Lukas Korba fdcb52c088 [#1240] Remove previous progress reporting
- CompactBlockProgress has been update to use syncProgress only
- CompactBlockProgressUpdate removed
- BlockProgress removed
- enhance and fetch progresses removed
- progressPartialUpdate refactored to syncProgress
- tests updated
2023-09-11 09:30:44 +02:00
Lukas Korba 65d0e987f6
Merge pull request #1253 from LukasKorba/1252-NetworkTests-fails-to-run
[#1252] NetworkTests fails to run
2023-09-11 09:30:19 +02:00
Lukas Korba f3f519bfea [#1252] NetworkTests fails to run
- NetworkTests are buildable and can run not crashing due to lack of mocked properties
- most tests have been fixed and pass again
2023-09-11 08:34:09 +02:00
Lukas Korba ec8aca2890 [#1249] Fix linter issues
- all issued fixed, one wasn't clear so new ticket is created to follow up and TODO added
2023-09-11 08:03:16 +02:00
Lukas Korba 2f521d7857 [#1242] Fix unit tests after SBS changes
- DarkSide, Network and Performance tests were modified to be buildable again
2023-09-10 08:43:33 +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 60780f4c83 [#1238] Report sync progress with the new getScanProgress
- getScanProgress used for reporting of the syncing progress

[#1238] Report sync progress with the new getScanProgress

- comment added

[#1238] Report sync progress with the new getScanProgress (#1239)

- TODOs + offline tests fixed
2023-09-08 12:19:54 +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