Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump safely #36

Merged
merged 11 commits into from
Aug 5, 2024
1,543 changes: 94 additions & 1,449 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@ members = [
# Use the edition 2021 dependency resolver in the workspace, to match the crates
resolver = "2"

[workspace.dependencies]
zcash_client_backend = { git = "https://github.com/zingolabs/librustzcash.git", branch = "nym_integration", features = ["lightwalletd-tonic"] }
# TODO: Change dependency to stable once net-utils merges.
zingo-netutils = { git = "https://github.com/zingolabs/zingolib.git", branch = "nym_integration" }
[workspace.package]
authors = ["Zingolabs Viridian"]
repository = "https://github.com/zingolabs"
homepage = "https://www.zingolabs.org/"
edition = "2021"
license = "Apache-2.0"


[workspace.dependencies]
# NymSdk
nym-sdk = { git = "https://github.com/nymtech/nym", branch = "master" }
nym-sphinx-addressing = { git = "https://github.com/nymtech/nym", branch = "master" }
nym-validator-client = { git = "https://github.com/nymtech/nym", branch = "master" }
nym-bin-common = { git = "https://github.com/nymtech/nym", branch = "master" }
nym-sphinx-anonymous-replies = { git = "https://github.com/nymtech/nym", branch = "master" }
# nym-sdk = { git = "https://github.com/nymtech/nym", tag = "nym-binaries-v2024.7-doubledecker" }
# nym-sphinx-addressing = { git = "https://github.com/nymtech/nym", tag = "nym-binaries-v2024.7-doubledecker" }
# nym-bin-common = { git = "https://github.com/nymtech/nym", tag = "nym-binaries-v2024.7-doubledecker" }
# nym-sphinx-anonymous-replies = { git = "https://github.com/nymtech/nym", tag = "nym-binaries-v2024.7-doubledecker" }

http = "0.2.4"
tokio = { version = "1.37.0", features = ["full"] }
tonic = "0.10.2"
prost = "0.12"
bytes = "1.1"
http-body = "0.4.4"
hyper = { version = "0.14.28", features = ["full"] }
hyper-rustls = { version = "0.23", features = ["http2"] }
tower = { version = "0.4.13" }
tokio-rustls = "0.23"
rustls-pemfile = "1.0.0"
# Miscellaneous
tokio = { version = "1.37.0", features = ["full"] } # { version = "1.38.1", features = ["full"] }
tonic = "0.10.2" # "0.12"
http = "0.2.4" # "1.1"
thiserror = "1.0.59" # "1.0.62"

# [patch.crates-io]
# incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "337f59179eda51261e9ddfc6b18e8fb84ea277c9" }
# shardtree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "337f59179eda51261e9ddfc6b18e8fb84ea277c9" }
30 changes: 6 additions & 24 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
[package]
name = "integration-tests"
version = "0.1.0"
authors = ["[email protected]"]
edition = "2021"
description = "Crate containing Zingo-Proxy 'Wallet-to-Node' tests."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
repository = { workspace = true }


[features]
nym = []
# NOTE: Deprecated
nym_poc = []

[dependencies]
zingoproxy-testutils = { path = "../zingoproxy-testutils" }
zingo-proxyd = { path = "../zingo-proxyd" }
zingo-rpc = { path = "../zingo-rpc" }

zcash_client_backend = { workspace = true }
zingo-netutils = { workspace = true }

# Miscellaneous Workspace
tokio = { workspace = true }
http = { workspace = true }

# TODO: Change dependency to stable once net-utils merges.
zingolib = { git = "https://github.com/zingolabs/zingolib.git", branch = "nym_integration", features = ["test-features"] }
zingoconfig = { git = "https://github.com/zingolabs/zingolib.git", branch = "nym_integration" }

zcash_primitives = { git = "https://github.com/zingolabs/librustzcash.git", branch = "nym_integration" }
zcash_address = { git = "https://github.com/zingolabs/librustzcash.git", branch = "nym_integration" }
orchard = "0.8"
shardtree = "0.3"

json = "0.12.4"
log = "0.4.17"
itertools = "0.10.5"
serde_json = "1.0.117"
hex = "0.4"
94 changes: 28 additions & 66 deletions integration-tests/tests/integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#![forbid(unsafe_code)]

use std::sync::{atomic::AtomicBool, Arc};
use zingo_netutils::GrpcConnector;
use zingolib::lightclient::LightClient;
use zingoproxy_testutils::{drop_test_manager, TestManager};
use zingoproxy_testutils::{
drop_test_manager, get_zingo_address, start_zingo_mempool_monitor, ProxyPool, TestManager,
};

mod wallet_basic {
use super::*;
Expand All @@ -16,24 +16,14 @@ mod wallet_basic {
let online = Arc::new(AtomicBool::new(true));
let (test_manager, regtest_handler, _proxy_handler) =
TestManager::launch(online.clone()).await;
let zingo_client = test_manager.build_lightclient().await;

println!(
"@zingoproxytest: Attempting to connect to GRPC server at URI: {}.",
test_manager.get_proxy_uri()
);
let mut client = GrpcConnector::new(test_manager.get_proxy_uri())
.get_client()
.await
.expect("Failed to create GRPC client");
let lightd_info = client
.get_lightd_info(zcash_client_backend::proto::service::Empty {})
.await
.expect("Failed to retrieve lightd info from GRPC server");

let lightd_info = zingo_client.do_info().await;
println!(
"@zingoproxytest: Lightd_info response:\n{:#?}.",
lightd_info.into_inner()
lightd_info
);

drop_test_manager(
Some(test_manager.temp_conf_dir.path().to_path_buf()),
regtest_handler,
Expand All @@ -53,7 +43,7 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "unified"),
&get_zingo_address(&zingo_client, "unified").await,
250_000,
None,
)])
Expand Down Expand Up @@ -85,7 +75,7 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
Expand Down Expand Up @@ -117,7 +107,7 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "transparent"),
&get_zingo_address(&zingo_client, "transparent").await,
250_000,
None,
)])
Expand Down Expand Up @@ -149,23 +139,23 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "unified"),
&get_zingo_address(&zingo_client, "unified").await,
250_000,
None,
)])
.await
.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
.await
.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "transparent"),
&get_zingo_address(&zingo_client, "transparent").await,
250_000,
None,
)])
Expand Down Expand Up @@ -199,7 +189,7 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
Expand All @@ -213,13 +203,7 @@ mod wallet_basic {
assert_eq!(balance.sapling_balance.unwrap(), 250_000);

zingo_client
.do_shield(
&[
zingolib::wallet::Pool::Sapling,
// zingolib::wallet::Pool::Transparent,
],
None,
)
.do_shield(&[ProxyPool::Sapling.into()], None)
.await
.unwrap();
test_manager.regtest_manager.generate_n_blocks(1).unwrap();
Expand Down Expand Up @@ -249,7 +233,7 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "transparent"),
&get_zingo_address(&zingo_client, "transparent").await,
250_000,
None,
)])
Expand All @@ -263,13 +247,7 @@ mod wallet_basic {
assert_eq!(balance.transparent_balance.unwrap(), 250_000);

zingo_client
.do_shield(
&[
// zingolib::wallet::Pool::Sapling,
zingolib::wallet::Pool::Transparent,
],
None,
)
.do_shield(&[ProxyPool::Transparent.into()], None)
.await
.unwrap();
test_manager.regtest_manager.generate_n_blocks(1).unwrap();
Expand Down Expand Up @@ -299,15 +277,15 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
.await
.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "transparent"),
&get_zingo_address(&zingo_client, "transparent").await,
250_000,
None,
)])
Expand All @@ -323,10 +301,7 @@ mod wallet_basic {

zingo_client
.do_shield(
&[
zingolib::wallet::Pool::Sapling,
zingolib::wallet::Pool::Transparent,
],
&[ProxyPool::Sapling.into(), ProxyPool::Transparent.into()],
None,
)
.await
Expand Down Expand Up @@ -361,7 +336,7 @@ mod wallet_basic {
test_manager.regtest_manager.generate_n_blocks(30).unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "unified"),
&get_zingo_address(&zingo_client, "unified").await,
250_000,
None,
)])
Expand All @@ -370,7 +345,7 @@ mod wallet_basic {
test_manager.regtest_manager.generate_n_blocks(30).unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
Expand All @@ -379,13 +354,15 @@ mod wallet_basic {
test_manager.regtest_manager.generate_n_blocks(30).unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "transparent"),
&get_zingo_address(&zingo_client, "transparent").await,
250_000,
None,
)])
.await
.unwrap();
test_manager.regtest_manager.generate_n_blocks(30).unwrap();

println!("@zingoproxytest: syncing full batch.");
zingo_client.do_sync(false).await.unwrap();

let balance = zingo_client.do_balance().await;
Expand Down Expand Up @@ -413,33 +390,22 @@ mod wallet_basic {
zingo_client.do_sync(false).await.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
.await
.unwrap();
zingo_client
.do_send(vec![(
&zingolib::get_base_address!(zingo_client, "sapling"),
&get_zingo_address(&zingo_client, "sapling").await,
250_000,
None,
)])
.await
.unwrap();

let zingo_client_saved = zingo_client.export_save_buffer_async().await.unwrap();
let zingo_client_loaded = std::sync::Arc::new(
LightClient::read_wallet_from_buffer_async(
zingo_client.config(),
&zingo_client_saved[..],
)
.await
.unwrap(),
);
LightClient::start_mempool_monitor(zingo_client_loaded.clone());
// This seems to be long enough for the mempool monitor to kick in.
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
start_zingo_mempool_monitor(&zingo_client).await;

let balance = zingo_client.do_balance().await;
println!("@zingoproxytest: zingo_client balance: \n{:#?}.", balance);
Expand All @@ -463,7 +429,3 @@ mod wallet_basic {
mod nym {
// TODO: Build nym enhanced zingolib version using zingo-rpc::walletrpc::service.
}

mod darkside {
// TODO: Add darkside.
}
Loading
Loading