Merge pull request #97 from zcash/fix/decrypt_store_tx

decrypt store tx and other fixes
This commit is contained in:
Francisco Gindre 2020-03-16 18:21:57 -03:00 committed by GitHub
commit 55783c50a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 227 additions and 99 deletions

88
Cargo.lock generated
View File

@ -89,15 +89,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bellman"
version = "0.2.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2s_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -298,17 +298,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ff"
version = "0.5.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff_derive 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff_derive 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ff_derive"
version = "0.4.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
@ -366,9 +366,9 @@ dependencies = [
[[package]]
name = "group"
version = "0.2.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -409,14 +409,14 @@ version = "0.0.2"
dependencies = [
"cbindgen 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"ffi_helpers 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_proofs 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"zcash_proofs 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
]
[[package]]
@ -480,11 +480,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pairing"
version = "0.15.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -810,51 +810,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "zcash_client_backend"
version = "0.1.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"bech32 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen-pure 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
]
[[package]]
name = "zcash_client_sqlite"
version = "0.0.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"bech32 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rusqlite 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
]
[[package]]
name = "zcash_primitives"
version = "0.1.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2s_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -863,16 +863,16 @@ dependencies = [
[[package]]
name = "zcash_proofs"
version = "0.1.0"
source = "git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925#f3f5338282eeda6d9f5bff69f6930a5473c95925"
source = "git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7#52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
dependencies = [
"bellman 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"bellman 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)",
"zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)",
]
[metadata]
@ -887,7 +887,7 @@ dependencies = [
"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
"checksum bech32 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0089c35ab7c6f2bc55ab23f769913f0ac65b1023e7e74638a1f43128dd5df2"
"checksum bellman 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum bellman 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b83b7baab1e671718d78204225800d6b170e648188ac7dc992e9d6bddf87d0c0"
@ -913,14 +913,14 @@ dependencies = [
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum fallible-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
"checksum fallible-streaming-iterator 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
"checksum ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum ff_derive 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum ff 0.5.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum ff_derive 0.4.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum ffi_helpers 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "545c5db858a1f8749e81b22cb9e10a5412c9775441a53c4bd1d1f28531edc843"
"checksum fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "21988a326139165b75e3196bc6962ca638e5fb0c95102fbf152a3743174b01e4"
"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
"checksum group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum group 0.2.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
@ -934,7 +934,7 @@ dependencies = [
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
"checksum pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum pairing 0.15.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
@ -977,7 +977,7 @@ dependencies = [
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum zcash_proofs 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=f3f5338282eeda6d9f5bff69f6930a5473c95925)" = "<none>"
"checksum zcash_client_backend 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum zcash_client_sqlite 0.0.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum zcash_primitives 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"
"checksum zcash_proofs 0.1.0 (git+https://github.com/str4d/librustzcash.git?rev=52d8b436300724bc4b83aa4a0c659ab34c3dbce7)" = "<none>"

View File

@ -14,27 +14,27 @@ hex = "0.3"
[dependencies.ff]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
[dependencies.pairing]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
[dependencies.zcash_client_backend]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
[dependencies.zcash_client_sqlite]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
[dependencies.zcash_primitives]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
[dependencies.zcash_proofs]
git = "https://github.com/str4d/librustzcash.git"
rev = "f3f5338282eeda6d9f5bff69f6930a5473c95925"
rev = "52d8b436300724bc4b83aa4a0c659ab34c3dbce7"
default-features = false
features = ["local-prover"]

View File

@ -76,4 +76,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 5a1fb98512fa179a4e83d67d14dd402f6d129a4d
COCOAPODS: 1.8.4
COCOAPODS: 1.9.1

View File

@ -36,7 +36,7 @@ class SendViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
do {
try synchronizer.start()
try synchronizer.start(retry: false)
self.synchronizerStatusLabel.text = SDKSynchronizer.textFor(state: .syncing)
} catch {
self.synchronizerStatusLabel.text = SDKSynchronizer.textFor(state: .stopped)

View File

@ -33,7 +33,7 @@ class CompactBlockScanningOperation: ZcashOperation {
guard self.rustBackend.scanBlocks(dbCache: self.cacheDb, dbData: self.dataDb) else {
self.error = self.rustBackend.lastError() ?? ZcashOperationError.unknown
LoggerProxy.debug("block scanning failed with error: \(String(describing: self.error))")
self.cancel()
self.fail()
return
}
}

View File

@ -7,13 +7,18 @@
//
import Foundation
import SwiftGRPC
/**
Errors thrown by CompactBlock Processor
*/
public enum CompactBlockProcessorError: Error {
case invalidConfiguration
case missingDbPath(path: String)
case dataDbInitFailed(path: String)
case connectionError(message: String)
case generalError(message: String)
case maxAttemptsReached(attempts: Int)
}
/**
CompactBlockProcessor notification userInfo object keys.
@ -194,11 +199,13 @@ public class CompactBlockProcessor {
self.queue.cancelAllOperations()
}
var maxAttemptsReached: Bool {
self.retryAttempts < self.config.retries
}
var shouldStart: Bool {
switch self.state {
case .stopped, .synced, .error(_):
return self.retryAttempts < self.config.retries
return maxAttemptsReached
default:
return false
}
@ -221,18 +228,36 @@ public class CompactBlockProcessor {
- Important: subscribe to the notifications before calling this method
*/
public func start() throws {
public func start(retry: Bool = false) throws {
// TODO: check if this validation makes sense at all
// try validateConfiguration()
if retry {
self.retryAttempts = 0
}
guard !queue.isSuspended else {
queue.isSuspended = false
return
}
guard shouldStart else {
LoggerProxy.debug("Warning: compact block processor was started while busy!!!!")
switch self.state {
case .error(let e):
// max attempts have been reached
LoggerProxy.info("max retry attempts reached with error: \(e)")
notifyError(CompactBlockProcessorError.maxAttemptsReached(attempts: self.maxAttempts))
self.state = .stopped
case .stopped:
// max attempts have been reached
LoggerProxy.info("max retry attempts reached")
notifyError(CompactBlockProcessorError.maxAttemptsReached(attempts: self.maxAttempts))
case .synced:
// max attempts have been reached
LoggerProxy.warn("max retry attempts reached on synced state, this indicates malfunction")
notifyError(CompactBlockProcessorError.maxAttemptsReached(attempts: self.maxAttempts))
default:
LoggerProxy.debug("Warning: compact block processor was started while busy!!!!")
}
return
}
@ -293,6 +318,10 @@ public class CompactBlockProcessor {
if self.latestBlockHeight == latestDownloadedBlockHeight {
self.processingFinished(height: blockHeight)
} else if self.latestBlockHeight < latestDownloadedBlockHeight {
// Lightwalletd might be syncing
LoggerProxy.info("Lightwalletd might be syncing: latest downloaded block height is: \(latestDownloadedBlockHeight) while latest blockheight is reported at: \(blockHeight)")
self.processingFinished(height: latestDownloadedBlockHeight)
} else {
self.processNewBlocks(range: self.nextBatchBlockRange(latestHeight: self.latestBlockHeight, latestDownloadedHeight: latestDownloadedBlockHeight))
}
@ -309,6 +338,9 @@ public class CompactBlockProcessor {
func processNewBlocks(range: CompactBlockRange) {
self.backoffTimer?.invalidate()
self.backoffTimer = nil
let cfg = self.config
let downloadBlockOperation = CompactBlockDownloadOperation(downloader: self.downloader, range: range)
@ -470,14 +502,22 @@ public class CompactBlockProcessor {
private func processingFinished(height: BlockHeight) {
self.state = .synced
NotificationCenter.default.post(name: Notification.Name.blockProcessorFinished, object: self, userInfo: [CompactBlockProcessorNotificationKey.latestScannedBlockHeight : height])
setTimer()
}
private func setTimer() {
let interval = self.config.blockPollInterval
self.backoffTimer?.invalidate()
self.backoffTimer?.invalidate()
let timer = Timer(timeInterval: interval, repeats: true, block: { [weak self] _ in
DispatchQueue.global().async { [weak self] in
guard let self = self else { return }
do {
try self.start()
if self.shouldStart {
try self.start()
} else if self.maxAttemptsReached {
self.fail(CompactBlockProcessorError.maxAttemptsReached(attempts: self.config.retries))
}
} catch {
self.fail(error)
}
@ -502,6 +542,7 @@ public class CompactBlockProcessor {
// update retries
self.retryAttempts = self.retryAttempts + 1
guard self.retryAttempts < config.retries else {
self.notifyError(CompactBlockProcessorError.maxAttemptsReached(attempts: self.retryAttempts))
self.stop()
return
}
@ -515,7 +556,14 @@ public class CompactBlockProcessor {
queue.cancelAllOperations()
self.retryAttempts = self.retryAttempts + 1
self.processingError = error
switch self.state {
case .error(_):
notifyError(error)
default:
break
}
self.state = .error(error)
self.setTimer()
}
@ -530,7 +578,7 @@ public class CompactBlockProcessor {
case .synced:
NotificationCenter.default.post(name: Notification.Name.blockProcessorIdle, object: self)
case .error(let err):
NotificationCenter.default.post(name: Notification.Name.blockProcessorFailed, object: self, userInfo: [CompactBlockProcessorNotificationKey.error: err])
notifyError(err)
case .scanning:
NotificationCenter.default.post(name: Notification.Name.blockProcessorStartedScanning, object: self)
case .stopped:
@ -539,6 +587,32 @@ public class CompactBlockProcessor {
NotificationCenter.default.post(name: Notification.Name.blockProcessorStartedValidating, object: self)
}
}
private func notifyError(_ err: Error) {
NotificationCenter.default.post(name: Notification.Name.blockProcessorFailed, object: self, userInfo: [CompactBlockProcessorNotificationKey.error: mapError(err)])
}
// TODO: encapsulate service errors better
func mapError(_ error: Error) -> Error {
if let lwdError = error as? LightWalletServiceError {
switch lwdError {
case .failed(let statusCode, let message):
return CompactBlockProcessorError.connectionError(message: "Connection failed - Status code: \(statusCode) - message: \(message)")
case .invalidBlock:
return CompactBlockProcessorError.generalError(message: "Invalid block: \(lwdError)")
default:
return CompactBlockProcessorError.generalError(message: "Error: \(lwdError)")
}
} else if let rpcError = error as? SwiftGRPC.RPCError {
switch rpcError {
case .invalidMessageReceived:
return CompactBlockProcessorError.connectionError(message: "invalid GRPC Message received")
case .timedOut:
return CompactBlockProcessorError.connectionError(message: "connection timeout")
case .callError(let callResult):
return CompactBlockProcessorError.connectionError(message: "GRPC Call error. Success: \(callResult.success) - StatusCode: \(callResult.statusCode)")
}
}
return error
}
}
public extension CompactBlockProcessor.Configuration {

View File

@ -41,8 +41,7 @@ class CompactBlockValidationOperation: ZcashOperation {
let error = CompactBlockValidationError.validationFailed(height: BlockHeight(result))
self.error = error
LoggerProxy.debug("block scanning failed with error: \(String(describing: self.error))")
self.cancel()
self.errorHandler?(error)
self.fail()
return
}
}

View File

@ -29,9 +29,9 @@ class ZcashOperation: Operation {
completionBlock = { [weak self] in
guard let self = self, let handler = self.completionHandler else { return }
// self.handlerDispatchQueue.async {
handler(self.isFinished, self.isCancelled)
// }
// self.handlerDispatchQueue.async {
handler(self.isFinished, self.isCancelled)
// }
}
}
@ -46,7 +46,7 @@ class ZcashOperation: Operation {
super.start()
}
func shouldCancel() -> Bool {
func shouldCancel() -> Bool {
isCancelled || dependencyCancelled()
}
@ -55,8 +55,11 @@ class ZcashOperation: Operation {
}
func fail() {
LoggerProxy.debug("\(self) started")
self.cancel()
defer {
self.cancel()
}
LoggerProxy.debug("\(self) failed")
guard let errorHandler = self.errorHandler else {
return
}

View File

@ -60,7 +60,7 @@ public class Initializer {
private(set) var spendParamsURL: URL
private(set) var outputParamsURL: URL
private var walletBirthday: WalletBirthday?
private(set) var lightWalletService: LightWalletService
private(set) var lightWalletService: LightWalletGRPCService
private(set) var transactionRepository: TransactionRepository
private(set) var downloader: CompactBlockDownloader
private(set) var processor: CompactBlockProcessor?

View File

@ -32,6 +32,14 @@ public class LightWalletGRPCService {
self.init(channel: channel)
}
func stop() {
channel.shutdown()
}
func resume() -> Channel.ConnectivityState {
channel.connectivityState(tryToConnect: true)
}
func blockRange(startHeight: BlockHeight, endHeight: BlockHeight? = nil, result: @escaping (CallResult) -> Void) throws -> CompactTxStreamerGetBlockRangeCall {
try compactTxStreamer.getBlockRange(BlockRange(startHeight: startHeight, endHeight: endHeight)) { result($0) }
}

View File

@ -12,9 +12,11 @@ import Foundation
Represents errors thrown by a Synchronizer
*/
public enum SynchronizerError: Error {
case initFailed
case initFailed(message: String)
case syncFailed
case connectionFailed(message: String)
case generalError(message: String)
case maxRetryAttemptsReached(attempts: Int)
}
/**
@ -29,7 +31,7 @@ public protocol Synchronizer {
Implementations should leverage structured concurrency and
cancel all jobs when this scope completes.
*/
func start() throws
func start(retry: Bool) throws
/**
Stop this synchronizer. Implementations should ensure that calling this method cancels all

View File

@ -63,6 +63,7 @@ public extension Notification.Name {
Synchronizer implementation for UIKit and iOS 12+
*/
public class SDKSynchronizer: Synchronizer {
public struct NotificationKeys {
public static let progress = "SDKSynchronizer.progress"
@ -82,7 +83,7 @@ public class SDKSynchronizer: Synchronizer {
private var transactionManager: OutboundTransactionManager
private var transactionRepository: TransactionRepository
private var isFirstApplicationStart = true
var taskIdentifier: UIBackgroundTaskIdentifier = .invalid
private var isBackgroundAllowed: Bool {
@ -103,6 +104,7 @@ public class SDKSynchronizer: Synchronizer {
self.initializer = initializer
self.transactionManager = try OutboundTransactionManagerBuilder.build(initializer: initializer)
self.transactionRepository = initializer.transactionRepository
self.subscribeToAppDelegateNotifications()
}
deinit {
@ -115,21 +117,22 @@ public class SDKSynchronizer: Synchronizer {
Starts the synchronizer
- Throws: CompactBlockProcessorError when failures occur
*/
public func start() throws {
public func start(retry: Bool = false) throws {
let connectivityState = initializer.lightWalletService.resume()
LoggerProxy.info("service started with connectivityState: \(connectivityState)")
guard let processor = initializer.blockProcessor() else {
throw SynchronizerError.initFailed
throw SynchronizerError.generalError(message: "compact block processor initialization failed")
}
subscribeToProcessorNotifications(processor)
registerBackgroundActivity()
self.blockProcessor = processor
guard status == .stopped || status == .disconnected || status == .synced else {
assert(true,"warning: synchronizer started when already started") // TODO: remove this assertion some time in the near future
return
}
try processor.start()
try processor.start(retry: retry)
}
@ -139,6 +142,10 @@ public class SDKSynchronizer: Synchronizer {
*/
public func stop() throws {
defer {
self.invalidateBackgroundActivity()
}
guard status != .stopped, status != .disconnected else { return }
guard let processor = self.blockProcessor else { return }
@ -181,14 +188,20 @@ public class SDKSynchronizer: Synchronizer {
private func registerBackgroundActivity() {
if self.taskIdentifier == .invalid {
self.taskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: {
self.blockProcessor?.stop(cancelTasks: true)
UIApplication.shared.endBackgroundTask(self.taskIdentifier)
self.taskIdentifier = .invalid
self.taskIdentifier = UIApplication.shared.beginBackgroundTask(withName: "ZcashLightClientKit.SDKSynchronizer", expirationHandler: {
self.invalidateBackgroundActivity()
})
}
}
private func invalidateBackgroundActivity() {
guard self.taskIdentifier != .invalid else {
return
}
UIApplication.shared.endBackgroundTask(self.taskIdentifier)
self.taskIdentifier = .invalid
}
private func subscribeToProcessorNotifications(_ processor: CompactBlockProcessor) {
let center = NotificationCenter.default
@ -301,8 +314,12 @@ public class SDKSynchronizer: Synchronizer {
}
@objc func processorFailed(_ notification: Notification) {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
if let error = notification.userInfo?[CompactBlockProcessorNotificationKey.error] as? Error {
self.notifyFailure(error)
}
self.status = .disconnected
}
}
@ -330,12 +347,7 @@ public class SDKSynchronizer: Synchronizer {
// MARK: application notifications
@objc func applicationDidBecomeActive(_ notification: Notification) {
registerBackgroundActivity()
do {
try self.start()
} catch {
self.status = .disconnected
}
}
@objc func applicationDidEnterBackground(_ notification: Notification) {
@ -349,8 +361,13 @@ public class SDKSynchronizer: Synchronizer {
}
@objc func applicationWillEnterForeground(_ notification: Notification) {
guard !self.isFirstApplicationStart else {
self.isFirstApplicationStart = false
return
}
let status = self.status
LoggerProxy.debug("applicationWillEnterForeground")
invalidateBackgroundActivity()
if status == .stopped || status == .disconnected {
do {
try start()
@ -361,11 +378,14 @@ public class SDKSynchronizer: Synchronizer {
}
@objc func applicationWillResignActive(_ notification: Notification) {
do {
try stop()
} catch {
LoggerProxy.debug("stop failed with error: \(error)")
}
registerBackgroundActivity()
LoggerProxy.debug("applicationWillResignActive")
// do {
//
// try stop()
// } catch {
// LoggerProxy.debug("stop failed with error: \(error)")
// }
}
@objc func applicationWillTerminate(_ notification: Notification) {
@ -495,12 +515,33 @@ public class SDKSynchronizer: Synchronizer {
}
}
private func mapError(_ error: Error) -> Error {
if let compactBlockProcessorError = error as? CompactBlockProcessorError {
switch compactBlockProcessorError {
case .dataDbInitFailed(let path):
return SynchronizerError.initFailed(message: "DataDb init failed at path: \(path)")
case .connectionError(let message):
return SynchronizerError.connectionFailed(message: message)
case .invalidConfiguration:
return SynchronizerError.generalError(message: "Invalid Configuration")
case .missingDbPath(let path):
return SynchronizerError.initFailed(message: "missing Db path: \(path)")
case .generalError(let message):
return SynchronizerError.generalError(message: message)
case .maxAttemptsReached(attempts: let attempts):
return SynchronizerError.maxRetryAttemptsReached(attempts: attempts)
}
}
return error
}
private func notifyFailure(_ error: Error) {
DispatchQueue.main.async {
[weak self] in
guard let self = self else { return }
NotificationCenter.default.post(name: Notification.Name.synchronizerFailed, object: self, userInfo: [NotificationKeys.error : error])
NotificationCenter.default.post(name: Notification.Name.synchronizerFailed, object: self, userInfo: [NotificationKeys.error : self.mapError(error)])
}
}
}

View File

@ -65,17 +65,18 @@ class CompactBlockReorgTests: XCTestCase {
}
@objc func processorHandledReorg(_ notification: Notification) {
DispatchQueue.main.sync {
// DispatchQueue.main.sync {
XCTAssertNotNil(notification.userInfo)
if let reorg = notification.userInfo?[CompactBlockProcessorNotificationKey.reorgHeight] as? BlockHeight,
let rewind = notification.userInfo?[CompactBlockProcessorNotificationKey.rewindHeight] as? BlockHeight {
XCTAssertTrue( reorg == 0 || reorg > ZcashSDK.SAPLING_ACTIVATION_HEIGHT)
XCTAssertTrue( rewind == 0 || rewind > ZcashSDK.SAPLING_ACTIVATION_HEIGHT)
XCTAssertTrue( rewind <= reorg )
reorgNotificationExpectation.fulfill()
} else {
XCTFail("CompactBlockProcessor reorg notification is malformed")
}
}
// }
}
@ -116,7 +117,7 @@ class CompactBlockReorgTests: XCTestCase {
startedScanningNotificationExpectation,
reorgNotificationExpectation,
idleNotificationExpectation,
], timeout: 300,enforceOrder: true)
], timeout: 10,enforceOrder: true)
}
private func expectedBatches(currentHeight: BlockHeight, targetHeight: BlockHeight, batchSize: Int) -> Int {

View File

@ -565,7 +565,7 @@ pub extern "C" fn zcashlc_scan_blocks(
slice::from_raw_parts(db_data, db_data_len)
}));
match scan_cached_blocks(&db_cache, &db_data) {
match scan_cached_blocks(&db_cache, &db_data, None) {
Ok(()) => Ok(1),
Err(e) => Err(format_err!("Error while scanning blocks: {}", e)),
}