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

Zip317 integration tests switchover final #1232

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 0 additions & 4 deletions darkside-tests/tests/advanced_reorg_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,14 +561,10 @@ async fn reorg_changes_outgoing_tx_height() {

// Send 100000 zatoshi to some address
let amount: u64 = 100000;
// FIXME: fails to create a sent valuetransfer with quick_send
let sent_tx_id =
from_inputs::quick_send(&light_client, [(recipient_string, amount, None)].to_vec())
.await
.unwrap();
// let sent_tx_id = from_inputs::send(&light_client, [(recipient_string, amount, None)].to_vec())
// .await
// .unwrap();

println!("SENT TX ID: {:?}", sent_tx_id);

Expand Down
127 changes: 55 additions & 72 deletions libtonode-tests/tests/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ mod slow {
.outgoing_tx_data(vec![])
.build()
.unwrap();
from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(
&get_base_address_macro!(recipient, "unified"),
Expand Down Expand Up @@ -2188,33 +2188,21 @@ mod slow {
/// This mod collects tests of outgoing_metadata (a TransactionRecordField) across rescans
mod rescan_still_have_outgoing_metadata {
use super::*;
use crate::utils::conversion;

#[ignore = "This test passes intermittently"]
#[tokio::test]
async fn self_send() {
let (regtest_manager, _cph, faucet) = scenarios::faucet_default().await;
let faucet_sapling_addr = get_base_address_macro!(faucet, "sapling");
let mut txids = vec![];
for memo in [None, Some("Second Transaction")] {
txids.push(
conversion::txid_from_hex_encoded_str(
&from_inputs::send(
&faucet,
vec![(
faucet_sapling_addr.as_str(),
{
let balance = faucet.do_balance().await;
balance.spendable_sapling_balance.unwrap()
+ balance.spendable_orchard_balance.unwrap()
} - u64::from(MINIMUM_FEE),
memo,
)],
)
.await
.unwrap(),
*from_inputs::quick_send(
&faucet,
vec![(faucet_sapling_addr.as_str(), 100_000, memo)],
)
.unwrap(),
.await
.unwrap()
.first(),
);
zingo_testutils::increase_height_and_wait_for_client(&regtest_manager, &faucet, 1)
.await
Expand All @@ -2225,55 +2213,51 @@ mod slow {
let memo_txid = &txids[1];
validate_otds!(faucet, nom_txid, memo_txid);
}
#[ignore = "This test passes intermittently"]
#[tokio::test]
async fn external_send() {
let (regtest_manager, _cph, faucet, recipient) =
scenarios::faucet_recipient_default().await;
let external_send_txid_with_memo =
&crate::utils::conversion::txid_from_hex_encoded_str(
&from_inputs::send(
&faucet,
vec![(
get_base_address_macro!(recipient, "sapling").as_str(),
1_000,
Some("foo"),
)],
)
.await
.unwrap(),
)
.unwrap();
let external_send_txid_no_memo = &crate::utils::conversion::txid_from_hex_encoded_str(
&from_inputs::send(
&faucet,
vec![(
get_base_address_macro!(recipient, "sapling").as_str(),
1_000,
None,
)],
)
.await
.unwrap(),
let external_send_txid_with_memo = *from_inputs::quick_send(
&faucet,
vec![(
get_base_address_macro!(recipient, "sapling").as_str(),
1_000,
Some("foo"),
)],
)
.unwrap();
.await
.unwrap()
.first();
let external_send_txid_no_memo = *from_inputs::quick_send(
&faucet,
vec![(
get_base_address_macro!(recipient, "sapling").as_str(),
1_000,
None,
)],
)
.await
.unwrap()
.first();
// TODO: This chain height bump should be unnecessary. I think removing
// this increase_height call reveals a bug!
zingo_testutils::increase_height_and_wait_for_client(&regtest_manager, &faucet, 1)
.await
.unwrap();
let external_send_txid_no_memo_ref = &external_send_txid_no_memo;
let external_send_txid_with_memo_ref = &external_send_txid_with_memo;
validate_otds!(
faucet,
external_send_txid_no_memo,
external_send_txid_with_memo
external_send_txid_no_memo_ref,
external_send_txid_with_memo_ref
);
}
#[tokio::test]
async fn check_list_value_transfers_across_rescan() {
let inital_value = 100_000;
let (ref regtest_manager, _cph, faucet, ref recipient, _txid) =
scenarios::faucet_funded_recipient_default(inital_value).await;
from_inputs::send(
from_inputs::quick_send(
recipient,
vec![(&get_base_address_macro!(faucet, "unified"), 10_000, None); 2],
)
Expand Down Expand Up @@ -2348,7 +2332,7 @@ mod slow {
// These are sent from the coinbase funded client which will
// subsequently receive funding via it's orchard-packed UA.
let memos = ["1", "2", "3"];
from_inputs::send(
from_inputs::quick_send(
&faucet,
(1..=3)
.map(|n| {
Expand All @@ -2369,7 +2353,7 @@ mod slow {
// We know that the largest single note that 2 received from 1 was 30_000, for 2 to send
// 30_000 back to 1 it will have to collect funds from two notes to pay the full 30_000
// plus the transaction fee.
from_inputs::send(
from_inputs::quick_send(
&recipient,
vec![(
&get_base_address_macro!(faucet, "unified"),
Expand All @@ -2379,6 +2363,8 @@ mod slow {
)
.await
.unwrap();

// FIXME: this test has all its assertions commented out !?
/*
let client_2_notes = recipient.do_list_notes(false).await;
// The 30_000 zat note to cover the value, plus another for the tx-fee.
Expand Down Expand Up @@ -3172,7 +3158,7 @@ mod slow {
// - 317: 15_000 1-orchard + 1-dummy + 1-transparent in
client.quick_shield().await.unwrap();
bump_and_check!(o: 35_000 s: 0 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 15_000;
test_dev_total_expected_fee += 15_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3186,7 +3172,6 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 35_000 s: 50_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 0;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3201,7 +3186,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 65_000 s: 0 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 20_000;
test_dev_total_expected_fee += 20_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3216,7 +3201,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 55_000 s: 0 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 10_000;
test_dev_total_expected_fee += 10_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3234,7 +3219,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 10_000 s: 10_000 t: 10_000);
test_dev_total_expected_fee = test_dev_total_expected_fee + 25_000;
test_dev_total_expected_fee += 25_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3248,7 +3233,6 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 10_000 s: 10_000 t: 510_000);
test_dev_total_expected_fee = test_dev_total_expected_fee + 0;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3261,7 +3245,7 @@ mod slow {
// - 317: 20_000 = 10_000 orchard and o-dummy + 10_000 (2 t-notes)
client.quick_shield().await.unwrap();
bump_and_check!(o: 500_000 s: 10_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 20_000;
test_dev_total_expected_fee += 20_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3276,7 +3260,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 490_000 s: 10_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 10_000;
test_dev_total_expected_fee += 10_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3291,7 +3275,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 10_000 s: 10_000 t: 465_000);
test_dev_total_expected_fee = test_dev_total_expected_fee + 15_000;
test_dev_total_expected_fee += 15_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand Down Expand Up @@ -3339,7 +3323,6 @@ mod slow {
_ => panic!(),
}
bump_and_check!(o: 10_000 s: 10_000 t: 465_000);
test_dev_total_expected_fee = test_dev_total_expected_fee + 0;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand Down Expand Up @@ -3370,7 +3353,6 @@ mod slow {
}
// End of 11 no change
bump_and_check!(o: 10_000 s: 10_000 t: 465_000);
test_dev_total_expected_fee = test_dev_total_expected_fee + 0;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3383,7 +3365,7 @@ mod slow {
// - 317: 15_000 1t and 2o
client.quick_shield().await.unwrap();
bump_and_check!(o: 460_000 s: 10_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 15_000;
test_dev_total_expected_fee += 15_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3398,7 +3380,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 430_000 s: 20_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 20_000;
test_dev_total_expected_fee += 20_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3413,7 +3395,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 420_000 s: 20_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 10_000;
test_dev_total_expected_fee += 10_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3428,7 +3410,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 10_000 s: 410_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 20_000;
test_dev_total_expected_fee += 20_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand All @@ -3443,7 +3425,7 @@ mod slow {
.await
.unwrap();
bump_and_check!(o: 10_000 s: 400_000 t: 0);
test_dev_total_expected_fee = test_dev_total_expected_fee + 10_000;
test_dev_total_expected_fee += 10_000;
assert_eq!(
get_fees_paid_by_client(&client).await,
test_dev_total_expected_fee
Expand Down Expand Up @@ -4329,12 +4311,13 @@ async fn proxy_server_worky() {
zingo_testutils::check_proxy_server_works().await
}

// FIXME: does not assert dust was included in the proposal
#[tokio::test]
async fn propose_orchard_dust_to_sapling() {
let (regtest_manager, _cph, faucet, recipient, _) =
scenarios::faucet_funded_recipient_default(100_000).await;

from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(&get_base_address_macro!(&recipient, "unified"), 4_000, None)],
)
Expand All @@ -4357,7 +4340,7 @@ async fn zip317_send_all() {
let (regtest_manager, _cph, faucet, recipient, _) =
scenarios::faucet_funded_recipient_default(100_000).await;

from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(&get_base_address_macro!(&recipient, "unified"), 5_000, None)],
)
Expand All @@ -4366,7 +4349,7 @@ async fn zip317_send_all() {
increase_height_and_wait_for_client(&regtest_manager, &faucet, 1)
.await
.unwrap();
from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(
&get_base_address_macro!(&recipient, "sapling"),
Expand All @@ -4379,7 +4362,7 @@ async fn zip317_send_all() {
increase_height_and_wait_for_client(&regtest_manager, &faucet, 1)
.await
.unwrap();
from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(&get_base_address_macro!(&recipient, "sapling"), 4_000, None)],
)
Expand All @@ -4388,7 +4371,7 @@ async fn zip317_send_all() {
increase_height_and_wait_for_client(&regtest_manager, &faucet, 1)
.await
.unwrap();
from_inputs::send(
from_inputs::quick_send(
&faucet,
vec![(&get_base_address_macro!(&recipient, "unified"), 4_000, None)],
)
Expand Down
7 changes: 4 additions & 3 deletions zingo-testutils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ macro_rules! get_otd {
#[macro_export]
macro_rules! validate_otds {
($client:ident, $nom_txid:ident, $memo_txid:ident) => {
let pre_rescan_summaries = $client.list_value_transfers().await;
let pre_rescan_summaries = $client.transaction_summaries().await;
let pre_rescan_no_memo_self_send_outgoing_tx_data = get_otd!($client, $nom_txid);
let pre_rescan_with_memo_self_send_outgoing_tx_data = get_otd!($client, $memo_txid);
$client.do_rescan().await.unwrap();
let post_rescan_summaries = $client.list_value_transfers().await;
let post_rescan_no_memo_self_send_outgoing_tx_data = get_otd!($client, $nom_txid);
let post_rescan_with_memo_self_send_outgoing_tx_data = get_otd!($client, $memo_txid);
assert_eq!(
Expand All @@ -100,6 +99,8 @@ macro_rules! validate_otds {
pre_rescan_with_memo_self_send_outgoing_tx_data,
post_rescan_with_memo_self_send_outgoing_tx_data
);
assert_eq!(pre_rescan_summaries, post_rescan_summaries);
for summary in pre_rescan_summaries.iter() {
assert_transaction_summary_exists(&$client, summary).await;
}
};
}
Loading