Skip to content

Commit 137f38c

Browse files
committed
refactor sync
1 parent c1fc177 commit 137f38c

File tree

12 files changed

+157
-283
lines changed

12 files changed

+157
-283
lines changed

Cargo.lock

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ path = "examples/simple-sync.rs"
1818
name = "message-board-sync"
1919
path = "examples/message-board-sync.rs"
2020

21-
[[example]]
22-
name = "batchrunner"
23-
path = "examples/batchrunner.rs"
2421

2522
[profile.release]
2623
# Tell `rustc` to optimize for small code size.
@@ -39,6 +36,8 @@ native = ["dep:tokio", "tonic/channel", "tonic/gzip", "tonic/tls-webpki-roots"]
3936
sqlite-db = ["dep:zcash_client_sqlite"]
4037
console_error_panic_hook = ["dep:console_error_panic_hook"]
4138

39+
sync2 = []
40+
4241
[dependencies]
4342
## Web dependencies
4443
wasm-bindgen = "0.2.84"
@@ -52,12 +51,12 @@ console_error_panic_hook = { version = "0.1.7", optional = true }
5251
tonic-web-wasm-client = "0.6.0"
5352

5453
## Zcash dependencies
55-
zcash_keys = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b", features = ["transparent-inputs", "orchard", "sapling", "unstable"] }
56-
zcash_client_backend = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b", default-features = false, features = ["sync", "lightwalletd-tonic", "wasm-bindgen"] }
57-
zcash_client_memory = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b", features = ["orchard"] }
58-
zcash_primitives = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b" }
59-
zcash_address = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b" }
60-
zcash_proofs = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b", default-features = false, features = ["bundled-prover"] }
54+
zcash_keys = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b", features = ["transparent-inputs", "orchard", "sapling", "unstable"] }
55+
zcash_client_backend = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b", default-features = false, features = ["sync", "lightwalletd-tonic", "wasm-bindgen"] }
56+
zcash_client_memory = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b", features = ["orchard"] }
57+
zcash_primitives = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b" }
58+
zcash_address = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b" }
59+
zcash_proofs = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b", default-features = false, features = ["bundled-prover"] }
6160

6261
## gRPC Web dependencies
6362
prost = { version = "0.12", default-features = false }
@@ -67,7 +66,7 @@ tonic = { version = "0.12", default-features = false, features = [
6766

6867
# Used in Native tests
6968
tokio = { version = "1.0", features = ["rt", "macros", "rt-multi-thread"], optional = true }
70-
zcash_client_sqlite = { git = "https://github.com/ChainSafe/librustzcash", rev = "c97a3f6e60446523fafa63cdf77b6c2584ac9f3b", default-features = false, features = ["unstable", "orchard"], optional = true }
69+
zcash_client_sqlite = { git = "https://github.com/ChainSafe/librustzcash", rev = "0fdd2fbb992a6f84eba45f488ee74a75d08d449b", default-features = false, features = ["unstable", "orchard"], optional = true }
7170

7271
getrandom = { version = "0.2", features = ["js"] }
7372
thiserror = "1.0.63"
@@ -93,12 +92,12 @@ zip32 = { git = "https://github.com/zcash/zip32.git", branch = "diversifier_inde
9392
shardtree = { git = "https://github.com/ec2/incrementalmerkletree.git", rev = "16eff253ad2575d48feec04f7387e6507a7dd698" }
9493
incrementalmerkletree = { git = "https://github.com/ec2/incrementalmerkletree.git", rev = "16eff253ad2575d48feec04f7387e6507a7dd698" }
9594

96-
[patch.'https://github.com/chainsafe/librustzcash']
97-
zcash_address = { path = "../librustzcash/components/zcash_address" }
98-
zcash_client_backend = { path = "../librustzcash/zcash_client_backend" }
99-
#zcash_client_sqlite = { path = "../librustzcash/zcash_client_sqlite" }
100-
zcash_client_memory = { path = "../librustzcash/zcash_client_memory" }
101-
zcash_keys = { path = "../librustzcash/zcash_keys" }
102-
zcash_primitives = { path = "../librustzcash/zcash_primitives" }
103-
zcash_proofs = { path = "../librustzcash/zcash_proofs" }
104-
zcash_protocol = { path = "../librustzcash/components/zcash_protocol" }
95+
#[patch.'https://github.com/chainsafe/librustzcash']
96+
#zcash_address = { path = "../librustzcash/components/zcash_address" }
97+
#zcash_client_backend = { path = "../librustzcash/zcash_client_backend" }
98+
##zcash_client_sqlite = { path = "../librustzcash/zcash_client_sqlite" }
99+
#zcash_client_memory = { path = "../librustzcash/zcash_client_memory" }
100+
#zcash_keys = { path = "../librustzcash/zcash_keys" }
101+
#zcash_primitives = { path = "../librustzcash/zcash_primitives" }
102+
#zcash_proofs = { path = "../librustzcash/zcash_proofs" }
103+
#zcash_protocol = { path = "../librustzcash/components/zcash_protocol" }

examples/batchrunner.rs

Lines changed: 0 additions & 120 deletions
This file was deleted.

examples/message-board-sync.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,20 @@ async fn main() {
6363
let id = w.import_ufvk(&ufvk, Some(2477329)).await.unwrap();
6464
tracing::info!("Created account with id: {}", id);
6565

66-
tracing::info!("Syncing wallet");
67-
w.sync(|scanned_to, tip| {
68-
println!("Scanned: {}/{}", scanned_to, tip);
69-
})
70-
.await
71-
.unwrap();
66+
#[cfg(not(feature = "sync2"))]
67+
{
68+
tracing::info!("Syncing wallet with our sync impl");
69+
w.sync(|scanned_to, tip| {
70+
println!("Scanned: {}/{}", scanned_to, tip);
71+
})
72+
.await
73+
.unwrap();
74+
}
75+
#[cfg(feature = "sync2")]
76+
{
77+
tracing::info!("Syncing wallet with sync2");
78+
w.sync2().await.unwrap();
79+
}
7280

7381
tracing::info!("Syncing complete :)");
7482

0 commit comments

Comments
 (0)