Skip to content

Commit

Permalink
Merge pull request #757 from zancas/test_data_crate
Browse files Browse the repository at this point in the history
Test data crate
  • Loading branch information
fluidvanadium authored Dec 19, 2023
2 parents ab355d7 + 792a056 commit 5b14e28
Show file tree
Hide file tree
Showing 36 changed files with 88 additions and 65 deletions.
62 changes: 35 additions & 27 deletions Cargo.lock

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

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# The order of the members reflects a dimension of the dependency relation, the first four depend on
# * zingolib
# which depends in turn, on the bottom 3.
# This doesn't account for all dependency relations, for example, zingocli depends on zingoconfig directly (for now).
[workspace]
members = [
"zingolib",
"zingo-testutils",
"integration-tests",
"darkside-tests",
"zingocli",
"zingolib",
"zingoconfig",
"zingo-testvectors",
"zingo-memo",
"zingo-testutils",
"integration-tests",
"darkside-tests"
]
resolver = "2"

Expand Down
4 changes: 2 additions & 2 deletions darkside-tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ pub mod scenarios {
use std::ops::Add;

use zcash_primitives::consensus::{BlockHeight, BranchId};
use zingo_testutils::{data::seeds, scenarios::setup::ClientBuilder};
use zingo_testutils::scenarios::setup::ClientBuilder;
use zingoconfig::RegtestNetwork;
use zingolib::{lightclient::LightClient, wallet::Pool};

Expand Down Expand Up @@ -551,7 +551,7 @@ pub mod scenarios {
self.faucet = Some(
self.client_builder
.build_client(
seeds::DARKSIDE_SEED.to_string(),
zingolib::testvectors::seeds::DARKSIDE_SEED.to_string(),
0,
true,
self.regtest_network,
Expand Down
5 changes: 3 additions & 2 deletions darkside-tests/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use darkside_tests::utils::{
prepare_darksidewalletd, update_tree_states_for_transaction, DarksideConnector, DarksideHandler,
};
use tokio::time::sleep;
use zingo_testutils::{data::seeds::DARKSIDE_SEED, scenarios::setup::ClientBuilder};
use zingo_testutils::scenarios::setup::ClientBuilder;
use zingoconfig::RegtestNetwork;
use zingolib::testvectors::seeds::DARKSIDE_SEED;
use zingolib::{get_base_address, lightclient::PoolBalances};

#[tokio::test]
Expand Down Expand Up @@ -117,7 +118,7 @@ async fn sent_transaction_reorged_into_mempool() {
.await;
let recipient = client_manager
.build_client(
zingo_testutils::data::seeds::HOSPITAL_MUSEUM_SEED.to_string(),
zingolib::testvectors::seeds::HOSPITAL_MUSEUM_SEED.to_string(),
1,
true,
regtest_network,
Expand Down
24 changes: 12 additions & 12 deletions integration-tests/tests/integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,18 @@ use zcash_primitives::{
transaction::{fees::zip317::MINIMUM_FEE, TxId},
};
use zingo_testutils::{
self, build_fvk_client,
data::{
self, block_rewards,
seeds::{CHIMNEY_BETTER_SEED, HOSPITAL_MUSEUM_SEED},
},
increase_height_and_wait_for_client,
regtest::get_cargo_manifest_dir,
scenarios, BASE_HEIGHT,
self, build_fvk_client, increase_height_and_wait_for_client, regtest::get_cargo_manifest_dir,
scenarios,
};
use zingoconfig::{ChainType, RegtestNetwork, ZingoConfig, MAX_REORG};
use zingolib::{
check_client_balances, get_base_address,
lightclient::{LightClient, PoolBalances},
testvectors::{
self, block_rewards,
seeds::{CHIMNEY_BETTER_SEED, HOSPITAL_MUSEUM_SEED},
BASE_HEIGHT,
},
wallet::{
data::{COMMITMENT_TREE_LEVELS, MAX_SHARD_LEVEL},
keys::{
Expand Down Expand Up @@ -1018,7 +1017,7 @@ mod slow {
watch_client.do_rescan().await.unwrap();
assert_eq!(
watch_client
.do_send(vec![(data::EXT_TADDR, 1000, None)])
.do_send(vec![(testvectors::EXT_TADDR, 1000, None)])
.await,
Err("Wallet is in watch-only mode and thus it cannot spend.".to_string())
);
Expand Down Expand Up @@ -1052,7 +1051,7 @@ mod slow {
// 4. We can't spend the funds, as they're transparent. We need to shield first
let sent_value = 20_000;
let sent_transaction_error = recipient
.do_send(vec![(data::EXT_TADDR, sent_value, None)])
.do_send(vec![(testvectors::EXT_TADDR, sent_value, None)])
.await
.unwrap_err();
assert_eq!(sent_transaction_error, "Insufficient verified shielded funds. Have 0 zats, need 30000 zats. NOTE: funds need at least 1 confirmations before they can be spent. Transparent funds must be shielded before they can be spent. If you are trying to spend transparent funds, please use the shield button and try again in a few minutes.");
Expand Down Expand Up @@ -2673,11 +2672,12 @@ mod slow {

let zcd_datadir = &regtest_manager.zcashd_data_dir;
let zingo_datadir = &regtest_manager.zingo_datadir;
// This test is the unique consumer of:
// zingo-testutils/old_wallet_reorg_test_wallet
let cached_data_dir = get_cargo_manifest_dir()
.parent()
.unwrap()
.join("zingo-testutils")
.join("data")
.join("zingo-testvectors")
.join("old_wallet_reorg_test_wallet");
let zcd_source = cached_data_dir
.join("zcashd")
Expand Down
2 changes: 1 addition & 1 deletion zingo-testutils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
zingoconfig = { path = "../zingoconfig" }
zingolib = { path = "../zingolib" }
zingolib = { path = "../zingolib", features = ["test"] }

zcash_primitives = { workspace = true }
zcash_address = { workspace = true }
Expand Down
Loading

0 comments on commit 5b14e28

Please sign in to comment.