Commit Graph

569 Commits

Author SHA1 Message Date
Francisco Gindre ed87a2781c [#461] Adopt a Type-Safe Keys and Addresses API
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
2022-09-05 15:09:07 -03:00
Kris Nuttycombe 905ee401d1 Use zcash_client_sqlite to manage migrations for the wallet db.
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>
2022-08-24 09:38:42 -06:00
Francisco Gindre 739c7a7237 Point zcash-light-client-ffi to corresponding feature branch 2022-08-24 09:33:42 -06:00
Jack Grigg def779e5bc Migrate to ZIP 316 UFVKs
This also brings in various associated changes to the FFI methods in
zcash-light-client-kit as a result of moving to the main branch of
zcash/librustzcash.
2022-08-24 09:33:42 -06:00
Jack Grigg b0343d4c38 Rename `UnifiedViewingKey` to `UnifiedFullViewingKey`
The type does not yet match ZIP 316, but performing this rename first
makes the subsequent commit simpler.
2022-08-24 09:33:42 -06:00
Lukas Korba 6d0f241ed6
[#475] NextStateHelper to async/await (#495)
- refactored to await/async
2022-08-23 16:58:15 -03:00
Lukas Korba 5d662dc98b
[#496] Travis CI and GA update to support compiler >= 5.6 (#497)
- travis.yml updated to xcode13.4
- github actions updated to run on macos 12
2022-08-23 16:08:10 -03:00
Francisco Gindre fb061b27a8
[#457] Release 0.16.7-beta (#458)
Adds checkpoints on testnet and mainnet
updates changelog.md
2022-08-15 18:38:52 -03:00
Francisco Gindre 40df80ef25
[#455] revert queue priority downgrade changes from [#435] (#456)
Closes #455

this reverts queue priority changes from commit `a5d0e447748257d2af5c9101391dd05a5ce929a2` since we detected it might prevent downloads to be scheduled in a
timely fashion

Co-authored-by: pacu <pacu@pacus-MacBook-Pro.local>
2022-08-15 17:03:03 -03:00
Francisco Gindre a37c140441 0.16.6-beta
Update podspec
2022-08-02 09:14:37 -03:00
Francisco Gindre fba4cecbe6
[#452] Release ZcashLightClientKit 0.16.5-beta (#453)
0.16.5-beta

- [#449] Use CompactBlock Streamer download instead of batch downloads (#451)
This increases the speed of downloads significantly while reducing the memory footprint.
- [#435] thread sanitizer issues (#448)
Issues related to Thread Sanitizer warnings

Closes #452
2022-07-31 09:42:12 -03:00
Francisco Gindre a2283f0171
[#449] Use CompactBlock Streamer download instead of batch downloads (#451)
* [#449] Use CompactBlock Streamer download instead of batch downloade

This commit implements a small buffer for the stream download operation
so it does not store a block at a time and does it in batches instead.

Closes #449

* Fix tests

* PR Suggestions
2022-07-30 20:01:18 -03:00
Francisco Gindre a5d0e44774
[#435] thread sanitizer issues (#448)
* [#435] this commit attempts to fix thread being starved dues to inversion
of priorities where a .userInitiated thread ends up depending on a lower
priority one on GRPC.

* Add an Synchronizer State struct to report state at once

* Make CompactBlockProcessor's downloader available internally for SDKSynchronizer
remove duplicate handling of processor finished

* PR Suggestions
2022-07-29 15:20:55 -03:00
Francisco Gindre fef4bccce8
[#446] Release 0.16.4-beta (#447)
Closes #446
2022-07-29 11:41:14 -03:00
Francisco Gindre 3be694c920
[#444] Syncing Restarts to zero when the wallet is wiped and synced from zero in one go. (#445)
This commit changes the way walletBirthday is stored in the synchronizer and intinitializer. Wallets syncing from creation/restore would have a problem where the birthday stored in the Blocks Table would be the one corresponding to the chekpoint found a the time of syncing, but the compact block downloader would start downloading blocks from the height provided by the user when the wallet was restored. This would cause a `validationFailed` error at the height checkpoint.height + 1 and restart downloading from checkpoint.height and then resume correctly.

Darksidewalletd test setUp was changed re be able to reproduce the error since injection guaranteed correctness and it was not possible to reproduce the error with it since the wallet birthday height provided matched exactly with the checkpoint on disk and that's the only case that avoided this error.

Closes #444
2022-07-29 10:33:23 -03:00
Francisco Gindre 96520aeb7c
[#440] Split constants for Download Batches and Scanning Batches (#441)
this commit splits the batch sizes so that wallets can be tweaked to either scan or download more or less blocks depending of the CompactBlockProcessor.Config used. Defaults are provided

This also bumps up the default time out for GRPC services to 30 seconds to unary calls and 100 seconds to streaming calls
Also, adds some documentation formatting that won't hurt

PR Suggestions

PR Suggestions
2022-07-29 10:07:08 -03:00
Francisco Gindre 1f1f69bc24 [#438] Release 0.16.3-beta
This commit changes the Podspec and changelog.md
2022-07-26 11:14:26 -03:00
Francisco Gindre d877a9aee2
[#436] Add checkpoint with a lower interval on mainnet (#437)
Closes #436
2022-07-26 10:49:27 -03:00
Francisco Gindre f9b42f6f99
update changelog for 0.15.1-beta hotfix 2022-07-22 09:23:26 -03:00
Francisco Gindre 5c1e283837 [#431] Release 0.16.2-beta
Closes #431

Fix Zatoshi Encoding for Cocoapods clients
Fix internal members of Zatoshi needed by secant wallet
2022-07-15 18:54:00 -03:00
Francisco Gindre 5e415ac24a
[#418] "Swift.EncodingError.InvalidValue Encoding an Int64 is not supported" (#430)
when sending.

This happens when clients using cocoapods update to 0.15.0-beta through
0.16.1-beta. SPM clients not affected since they all use SQLite Swift 0.13

the issue is with clients using SQLite swift 0.12
2022-07-15 18:50:49 -03:00
Francisco Gindre 4e260419e1
[#428] make some helpers publicly accessible (#429)
Closes #428}

Helpers that were internal to Secant now are missing when we moved them to ZcashLightClientKit. This commit fixes that
2022-07-15 16:54:25 -03:00
Francisco Gindre a6bf465a6a Fix ZcashLightClientKit.podspec by reverting gRPC-Swift to 1.8.0 2022-07-15 14:27:26 -03:00
Francisco Gindre 221f3a3b98
[#425] release 0.16.1-beta (#427)
Closes #425

Changelog and podspect changes
2022-07-14 20:30:03 -03:00
Francisco Gindre 470775dfaf
- [#419] Fix Unavailable Transport 14 when attempting to sync (#426)
Closes #419

This eliminates the keepalive settings since they seem to clash with defaults
on ligthwalletd and the client gets rejected earlier than needed.
2022-07-14 20:19:46 -03:00
Francisco Gindre f2ed1f01ae
- [#422] Make Zatoshi extensions of `NSDecimalNumber` public (#423)
Closes #422

This helps Secant iOS compile since it relies on these APIs that were
once internal to the app module
2022-07-14 17:55:16 -03:00
Francisco Gindre 333c074b2f
[#416] Update GRPC to 1.8.2 (#421)
Closes #416
2022-07-14 15:18:15 -03:00
Francisco Gindre 5bfdfdb701
[#403] Release 0.16.0-beta (#417)
Closes #403

Renames changelog.md to CHANGELOG.md
2022-07-13 15:23:04 -03:00
Francisco Gindre e131ccbd07
[#392] Synchronizer error 8. when syncing. (#413)
Closes #392

This commit localizes SynchronizerError to better support Error messages
2022-07-12 17:28:16 -03:00
Francisco Gindre 2fcfa6fdbe
[#398] Make WalletBirthday an internal type (#414)
This commit makes Renames `WalletBirthday` to `Checkpoint` and
makes Checkpoint an internal type. Public ocurrences of this
type is replaced by `BlockHeight` (Int) and then retrieval of the
Checkpoint is deferred to the appropiate place in the code

Add an extension method to `BlockHeight` to get latest checkpoint
height present in the SDK's bundle

PR Suggestions:

Add test for integer overflow on JSON
File renamed from WalletBirthday to Checkpoint
2022-07-12 16:36:12 -03:00
Francisco Gindre aff3a9563b
[#411] add Fresh checkpoints for release 0.16.0-beta (#412) 2022-07-11 15:54:09 -03:00
Francisco Gindre b6bb17ab8b
[#406] some BirthdayTests fail for MacOS target (#410)
Closes #406

This commits differences how Checkpoints are retrieved from the resource bundle
depending on the target platform.
2022-07-11 09:17:22 -03:00
Francisco Gindre 79dbe8f387
[#404] Configure GRPC KeepAlive according to docs (#409)
Closes #404

This commit updates LightWalletGRPCService conform to latest
Swift-GRPC recommendations on how to set Connections KeepAlive
parameters.

See https://github.com/grpc/grpc-swift/blob/main/docs/keepalive.md
2022-07-08 16:49:24 -03:00
Francisco Gindre acae6a0d7b
[#400] Changelog for 0.15.0-beta. Podspec version (#405)
Closes #400
2022-06-29 20:29:36 -03:00
Francisco Gindre 889458d7b6
[#363] bump iOS minimum deployment target to iOS 13.0 (#407)
Closes #363
2022-06-29 20:12:17 -03:00
Francisco Gindre 912abe0128
[#397] Checkpoint format that supports NU5 TreeStates (#399)
* [#397] Checkpoint format that supports NU5 TreeStates

Closes #397

This commit adds `orchardTree` value to WalletBirthday and renames
the value `tree` to `saplingTree`. It also modifies the checkpoint
JSON files accordingly. It adds `.testnet` and `.mainnet` checkpoints
for orchard activation height.

* rename `sapling-checkpoints` to `checkpoints`
2022-06-28 16:17:10 -03:00
Francisco Gindre c7a27c0b86
[#401] DecodingError when refreshing pending transactions (#402)
Closes #401
This commit changes the way Codable in implemented for Zatoshi and PendingTransaction.

SQLite attempts to decode Custom Types as JSONStrings inside a TEXT column whereas Zatoshi only needs to be an INTEGER that can be treated as an Int64 value

`ConfirmedTransaction` entity is not affected because it is already deserialized
in a custom fashion whereas `PendingTransaction` was relying on `Codable` and
`CodingKey`.
2022-06-27 12:51:13 -03:00
Francisco Gindre b9ae012e09
[#381] Move Zatoshi and Amount Types to the SDK (#396)
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
2022-06-22 16:45:37 -03:00
Francisco Gindre 516d605d22
[#394] Update swift-grpc to 1.8.0 (#395)
closes #394

This commit updates the generated files with the latest plugins released
along this version of the GRPC library.

`pod lib lint --verbose --allow-warnings` passed
2022-06-16 12:37:16 -03:00
Francisco Gindre 8b3ca8dc34
[#382] ZIP-302 compliant memo type (#385)
* [#382] ZIP-302 compliant memo type

Test Implemented and Passed

Move struct to the SDK

Make even more type safe by Wrapping Strings into TextMemo

PR Suggestions

PR Suggestions

PR suggestions

* PR suggestions to make all cases explicit
2022-05-26 18:06:02 -03:00
Francisco Gindre 74f3ae20f2 [#388] Integrate libzcashlc 0.0.3 to support v5 transaction parsing (#390)
This solves a problem where an NU5 aware wallet would receive a
v5 transaction with sapling funds and wouldn’t be able to
enhance it by decrypting the full transaction.

This works in conjunction with lightwalletd version v0.4.11 and .12
see https://github.com/zcash/lightwalletd/releases/tag/v0.4.12
and https://github.com/zcash/lightwalletd/releases/tag/v0.4.11
for details on how to upgrade your light client infrastructure.
2022-05-24 21:44:10 -03:00
Francisco Gindre 5bb1750b1f
[#383] Fix Darksidewalletd tests failing to retrieve a checkpoint (#386) 2022-05-17 15:29:27 -03:00
Francisco Gindre b4fbb36cd7
Bump podspec version to 0.13.1-beta (#379) 2022-05-06 14:45:20 -03:00
dh-ecc 80e6ec200b
[#326] Load Checkpoint files from bundle.
Closes #326 

Implements loading checkpoints from the bundle the same way the android SDK does. 


* Add checkpoint files

* Add checkpoint files as resources to package

* Remove stencil files

* Update wallet birthday methods to use bundled checkpoints

* [clean up] Fix test build failure

* Add Cocoapods support

* Fix for behaviour across SPM and Cocoapods

* Add test for checkpoint retrieval

* Use latest GRPC v1.x

* update checkpoint files to match android sdk
2022-05-05 18:30:17 -03:00
dh-ecc a3a33382c1
Add caveat to SPM / Xcode integration in Readme (#356) 2022-05-05 14:27:42 -03:00
Francisco Gindre 0c6203fefb
[#367] Darksidewalletd for testing `shield_funds` (#368)
pull from branch non-consensus-changes-libzcashlc

Patch Shield funds test.

Closes #367
2022-04-29 09:19:18 -03:00
Francisco Gindre 1f8b086ea3
[#351] add "Commit Messages" link to "topics" (#376)
add a link to "Commit Messages" to the "Topics" section
2022-04-29 07:57:04 -03:00
Francisco Gindre e552b24764
[#351] Write a Commit message Section for CONTRIBUTING.md (#371)
Closes #351

In order to make the repo's history consistent going forwards,
I've added some commit message guidelines.

The core of the suggestions were taken from this article:
https://cbea.ms/git-commit/#why-not-how

The main idea is that the repo is the source of truth and helps
both readers and maintainers to understand it better.

The rationale behind the title structure is that a clean
changelog can be manufacture by running `git log --oneline`
and a little bit of editing.

Small suggested typo fixes

Small suggested content changes

Included PR suggestions to shorten commits' first line
2022-04-27 15:52:57 -03:00
Francisco Gindre 59eccab074
Merge pull request #365 from zcash/update-documentation
Issue Update documentation
2022-04-08 12:29:33 -03:00
Francisco Gindre d9ac0dec7c Issue #364 - Update documentation
Update jazzy docs

update instructions on how do build Jazzy docs
2022-04-07 20:30:39 -03:00