Skip to content

Commit 1063bd7

Browse files
authored
Merge pull request #1162 from fluidvanadium/change_required_5_000
Fix ChangeRequired
2 parents aa97766 + 16e2ee5 commit 1063bd7

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ members = [
1717
resolver = "2"
1818

1919
[workspace.dependencies]
20-
zcash_address = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b" }
21-
zcash_client_backend = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b", features = ["lightwalletd-tonic", "orchard", "transparent-inputs"] }
22-
zcash_encoding = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b" }
23-
zcash_keys = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b", features = ["orchard"] }
20+
zcash_address = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required" }
21+
zcash_client_backend = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required", features = ["lightwalletd-tonic", "orchard", "transparent-inputs"] }
22+
zcash_encoding = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required" }
23+
zcash_keys = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required", features = ["orchard"] }
2424
zcash_note_encryption = "0.4"
25-
zcash_primitives = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b" }
26-
zcash_proofs = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b" }
27-
zcash_protocol = { git = "https://github.com/zingolabs/librustzcash.git", tag = "custom_notusk_to_taddr-1-g239c894b" }
25+
zcash_primitives = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required" }
26+
zcash_proofs = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required" }
27+
zcash_protocol = { git = "https://github.com/zingolabs/librustzcash.git", tag = "fix_change_required" }
2828
sapling-crypto = "0.1.2"
2929
orchard = "0.8"
3030
zip32 = "0.1"

integration-tests/tests/chain_generic_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use zcash_client_backend::PoolType::Transparent;
33
use zcash_client_backend::ShieldedProtocol::Orchard;
44
use zcash_client_backend::ShieldedProtocol::Sapling;
55

6+
use zingo_testutils::chain_generic_tests::fixtures::change_required;
67
use zingo_testutils::chain_generic_tests::fixtures::ignore_dust_inputs;
78
use zingo_testutils::chain_generic_tests::fixtures::propose_and_broadcast_value_to_pool;
89
use zingo_testutils::chain_generic_tests::fixtures::send_grace_dust;
@@ -38,6 +39,10 @@ async fn libtonode_propose_and_broadcast_40_000_to_orchard() {
3839
propose_and_broadcast_value_to_pool::<LibtonodeEnvironment>(40_000, Shielded(Orchard)).await;
3940
}
4041
#[tokio::test]
42+
async fn libtonode_change_required() {
43+
change_required::<LibtonodeEnvironment>().await;
44+
}
45+
#[tokio::test]
4146
async fn libtonode_send_shield_cycle() {
4247
send_shield_cycle::<LibtonodeEnvironment>(4).await;
4348
}

zingo-testutils/src/chain_generic_tests.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@ pub mod fixtures {
127127
assert_eq!(expected_fee, recorded_fee);
128128
}
129129

130+
/// required change should be 0
131+
pub async fn change_required<CC>()
132+
where
133+
CC: ConductChain,
134+
{
135+
let mut environment = CC::setup().await;
136+
let primary = environment.fund_client_orchard(45_000).await;
137+
let secondary = environment.create_client().await;
138+
139+
assert_eq!(
140+
with_assertions::propose_send_bump_sync_recipient(
141+
&mut environment,
142+
&primary,
143+
&secondary,
144+
vec![(Shielded(Orchard), 1), (Shielded(Orchard), 29_999)]
145+
)
146+
.await,
147+
3 * MARGINAL_FEE.into_u64()
148+
);
149+
}
150+
130151
/// sends back and forth several times, including sends to transparent
131152
pub async fn send_shield_cycle<CC>(n: u64)
132153
where

zingo-testutils/src/lightclient/with_assertions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ where
6060
.collect();
6161

6262
let proposal = from_inputs::propose(sender, raw_receivers).await.unwrap();
63+
64+
dbg!(proposal.steps().first().balance().proposed_change());
65+
6366
let txids = sender
6467
.complete_and_broadcast_stored_proposal()
6568
.await

0 commit comments

Comments
 (0)