Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ members = [
"zingolib",
"zingo-memo",
"pepper-sync",
"zingo-price", "zingolib_testutils",
"zingo-price",
"zingolib_testutils",
]
resolver = "2"

Expand Down Expand Up @@ -54,7 +55,6 @@ byteorder = "1"
bytes = "1"
chrono = "0.4"
clap = "4"
concat-idents = "1"
dirs = "6"
futures = "0.3"
futures-util = "0.3"
Expand All @@ -79,11 +79,9 @@ prost = "0.13"
rand = "0.8"
reqwest = { version = "0.12.15", default-features = false }
ring = "0.17.14"
rusqlite = "0.32"
rust_decimal = "1.37.2"
rust-embed = "6"
rustls = { version = "0.23", features = ["ring"] }
rustls-pemfile = "2"
rustyline = "11"
secp256k1 = "0.29.1"
secrecy = "0.8"
Expand Down Expand Up @@ -120,12 +118,12 @@ zingolib = { path = "zingolib" }
test-log = "0.2"

[patch.crates-io]
zcash_client_backend = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_keys = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_protocol = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_transparent = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8"}
zcash_client_backend = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }
zcash_keys = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }
zcash_protocol = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }
zcash_transparent = { git = "https://github.com/zcash/librustzcash", rev = "3ba772c9b8" }

[profile.test]
opt-level = 3
14 changes: 6 additions & 8 deletions darkside-tests/src/chain_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub(crate) mod conduct_chain {

/// the mock chain is fed to the Client via lightwalletd. where is that server to be found?
fn lightserver_uri(&self) -> Option<http::Uri> {
Some(self.client_builder.server_id.clone())
self.client_builder.indexer_uri.clone()
}

async fn create_faucet(&mut self) -> LightClient {
Expand All @@ -76,7 +76,7 @@ pub(crate) mod conduct_chain {
.make_unique_data_dir_and_load_config(self.configured_activation_heights);
let mut lightclient = LightClient::create_from_wallet(
LightWallet::new(
config.chain,
config.chain_type,
WalletBase::Mnemonic {
mnemonic: Mnemonic::from_phrase(DARKSIDE_SEED.to_string()).unwrap(),
no_of_accounts: NonZeroU32::try_from(1).expect("hard-coded integer"),
Expand Down Expand Up @@ -123,12 +123,10 @@ pub(crate) mod conduct_chain {
.unwrap();

// trees
let trees = zingolib::grpc_connector::get_trees(
self.client_builder.server_id.clone(),
height_before,
)
.await
.unwrap();
let trees =
zingolib::grpc_connector::get_trees(self.lightserver_uri().unwrap(), height_before)
.await
.unwrap();
let mut sapling_tree: sapling_crypto::CommitmentTree =
zcash_primitives::merkle_tree::read_commitment_tree(
hex::decode(trees.sapling_tree).unwrap().as_slice(),
Expand Down
2 changes: 1 addition & 1 deletion darkside-tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ pub mod scenarios {
) -> DarksideEnvironment {
let (lightwalletd, darkside_connector) = init_darksidewalletd(set_port).await.unwrap();
let client_builder = ClientBuilder::new(
darkside_connector.0.clone(),
Some(darkside_connector.0.clone()),
zingolib::testutils::tempfile::tempdir().unwrap(),
);
let configured_activation_heights = for_test::all_height_one_nus();
Expand Down
12 changes: 6 additions & 6 deletions darkside-tests/tests/advanced_reorg_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async fn reorg_changes_incoming_tx_height() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down Expand Up @@ -195,7 +195,7 @@ async fn reorg_changes_incoming_tx_index() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down Expand Up @@ -353,7 +353,7 @@ async fn reorg_expires_incoming_tx() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down Expand Up @@ -533,7 +533,7 @@ async fn reorg_changes_outgoing_tx_height() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down Expand Up @@ -788,7 +788,7 @@ async fn reorg_expires_outgoing_tx_height() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down Expand Up @@ -988,7 +988,7 @@ async fn reorg_changes_outgoing_tx_index() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
Expand Down
6 changes: 3 additions & 3 deletions darkside-tests/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async fn simple_sync() {
.unwrap();
let activation_heights = all_height_one_nus();
let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id, wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id), wallet_dir).build_client(
DARKSIDE_SEED.to_string(),
0,
true,
Expand Down Expand Up @@ -69,7 +69,7 @@ async fn reorg_receipt_sync_generic() {

let activation_heights = all_height_one_nus();
let wallet_dir = TempDir::new().unwrap();
let mut light_client = ClientBuilder::new(server_id.clone(), wallet_dir).build_client(
let mut light_client = ClientBuilder::new(Some(server_id.clone()), wallet_dir).build_client(
DARKSIDE_SEED.to_string(),
0,
true,
Expand Down Expand Up @@ -128,7 +128,7 @@ async fn sent_transaction_reorged_into_mempool() {
.unwrap();

let wallet_dir = TempDir::new().unwrap();
let mut client_manager = ClientBuilder::new(server_id.clone(), wallet_dir);
let mut client_manager = ClientBuilder::new(Some(server_id.clone()), wallet_dir);
let activation_heights = all_height_one_nus();
let mut light_client =
client_manager.build_client(DARKSIDE_SEED.to_string(), 0, true, activation_heights);
Expand Down
16 changes: 8 additions & 8 deletions libtonode-tests/tests/concrete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ mod fast {
// messages
let alice_to_bob = TransactionRequest::new(vec![
Payment::new(
ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(),
ZcashAddress::from_str(&bob.encode(&faucet.config().chain_type)).unwrap(),
Zatoshis::from_u64(1_000).unwrap(),
Some(Memo::encode(
&Memo::from_str(&("Alice->Bob #1\nReply to\n".to_string() + &alice)).unwrap(),
Expand All @@ -806,7 +806,7 @@ mod fast {
.unwrap();
let alice_to_bob_2 = TransactionRequest::new(vec![
Payment::new(
ZcashAddress::from_str(&bob.encode(&faucet.config().chain)).unwrap(),
ZcashAddress::from_str(&bob.encode(&faucet.config().chain_type)).unwrap(),
Zatoshis::from_u64(1_000).unwrap(),
Some(Memo::encode(
&Memo::from_str(&("Alice->Bob #2\nReply to\n".to_string() + &alice)).unwrap(),
Expand All @@ -820,7 +820,7 @@ mod fast {
.unwrap();
let alice_to_charlie = TransactionRequest::new(vec![
Payment::new(
ZcashAddress::from_str(&charlie.encode(&faucet.config().chain)).unwrap(),
ZcashAddress::from_str(&charlie.encode(&faucet.config().chain_type)).unwrap(),
Zatoshis::from_u64(1_000).unwrap(),
Some(Memo::encode(
&Memo::from_str(&("Alice->Charlie #2\nReply to\n".to_string() + &alice))
Expand All @@ -840,7 +840,7 @@ mod fast {
Some(Memo::encode(
&Memo::from_str(
&("Charlie->Alice #2\nReply to\n".to_string()
+ &charlie.encode(&faucet.config().chain)),
+ &charlie.encode(&faucet.config().chain_type)),
)
.unwrap(),
)),
Expand All @@ -858,7 +858,7 @@ mod fast {
Some(Memo::encode(
&Memo::from_str(
&("Bob->Alice #2\nReply to\n".to_string()
+ &bob.encode(&faucet.config().chain)),
+ &bob.encode(&faucet.config().chain_type)),
)
.unwrap(),
)),
Expand All @@ -884,11 +884,11 @@ mod fast {

// Collect observations
let value_transfers_bob = &recipient
.messages_containing(Some(&bob.encode(&recipient.config().chain)))
.messages_containing(Some(&bob.encode(&recipient.config().chain_type)))
.await
.unwrap();
let value_transfers_charlie = &recipient
.messages_containing(Some(&charlie.encode(&recipient.config().chain)))
.messages_containing(Some(&charlie.encode(&recipient.config().chain_type)))
.await
.unwrap();
let all_vts = &recipient.value_transfers(true).await.unwrap();
Expand Down Expand Up @@ -1762,7 +1762,7 @@ mod slow {
local_net.validator().get_activation_heights().await,
);
let zingo_config = zingolib::config::load_clientconfig(
client_builder.server_id,
client_builder.indexer_uri,
Some(client_builder.zingo_datadir.path().to_path_buf()),
ChainType::Regtest(local_net.validator().get_activation_heights().await),
WalletSettings {
Expand Down
14 changes: 7 additions & 7 deletions libtonode-tests/tests/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use zingolib::testutils::lightclient::from_inputs::quick_send;
use zingolib::testutils::paths::get_cargo_manifest_dir;
use zingolib::testutils::tempfile::TempDir;
use zingolib::{
config::{DEFAULT_LIGHTWALLETD_SERVER, construct_lightwalletd_uri, load_clientconfig},
config::{DEFAULT_LIGHTWALLETD_SERVER, load_clientconfig, parse_indexer_uri},
get_base_address_macro,
lightclient::LightClient,
testutils::lightclient::from_inputs::{self},
Expand All @@ -27,11 +27,11 @@ async fn sync_mainnet_test() {
.expect("Ring to work as a default");
tracing_subscriber::fmt().init();

let uri = construct_lightwalletd_uri(Some(DEFAULT_LIGHTWALLETD_SERVER.to_string()));
let uri = parse_indexer_uri(DEFAULT_LIGHTWALLETD_SERVER.to_string()).unwrap();
let temp_dir = TempDir::new().unwrap();
let temp_path = temp_dir.path().to_path_buf();
let config = load_clientconfig(
uri.clone(),
Some(uri.clone()),
Some(temp_path),
zingolib::config::ChainType::Mainnet,
WalletSettings {
Expand All @@ -47,7 +47,7 @@ async fn sync_mainnet_test() {
.unwrap();
let mut lightclient = LightClient::create_from_wallet(
LightWallet::new(
config.chain,
config.chain_type,
WalletBase::Mnemonic {
mnemonic: Mnemonic::from_phrase(HOSPITAL_MUSEUM_SEED.to_string()).unwrap(),
no_of_accounts: NonZeroU32::try_from(1).expect("hard-coded integer"),
Expand Down Expand Up @@ -97,11 +97,11 @@ async fn sync_status() {
.expect("Ring to work as a default");
tracing_subscriber::fmt().init();

let uri = construct_lightwalletd_uri(Some(DEFAULT_LIGHTWALLETD_SERVER.to_string()));
let uri = parse_indexer_uri(DEFAULT_LIGHTWALLETD_SERVER.to_string()).unwrap();
let temp_dir = TempDir::new().unwrap();
let temp_path = temp_dir.path().to_path_buf();
let config = load_clientconfig(
uri.clone(),
Some(uri.clone()),
Some(temp_path),
zingolib::config::ChainType::Mainnet,
WalletSettings {
Expand All @@ -117,7 +117,7 @@ async fn sync_status() {
.unwrap();
let mut lightclient = LightClient::create_from_wallet(
LightWallet::new(
config.chain,
config.chain_type,
WalletBase::Mnemonic {
mnemonic: Mnemonic::from_phrase(HOSPITAL_MUSEUM_SEED.to_string()).unwrap(),
no_of_accounts: NonZeroU32::try_from(1).expect("hard-coded integer"),
Expand Down
5 changes: 1 addition & 4 deletions zingo-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ name = "zingo-cli"
version = "0.2.0"
edition = "2024"

[features]
regtest = [ "zingolib/regtest", "zingo_common_components/for_test" ]

[dependencies]
pepper-sync = { workspace = true }
zingo_common_components = { workspace = true, optional = true }
zingolib = { workspace = true }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are removing regtest feature then zingo-cli must build zingolib with the zingolib regtest feature active all the time

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is fine. I'm specifically thinking about distributing binaries.


zcash_address = { workspace = true }
Expand All @@ -29,3 +25,4 @@ shellwords = { workspace = true }
tokio = { workspace = true }
tracing-subscriber = { workspace = true }
zip32 = { workspace = true }
thiserror.workspace = true
Loading