Skip to content

Commit

Permalink
Update tests in testing/pool.rs to use ZIP 317 fees.
Browse files Browse the repository at this point in the history
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
  • Loading branch information
daira committed Jun 19, 2024
1 parent 4b2a942 commit f0cf405
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions zcash_client_sqlite/src/testing/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ pub(crate) fn send_single_step_proposed_transfer<T: ShieldedPoolTester>() {
)])
.unwrap();

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

let change_memo = "Test change memo".parse::<Memo>().unwrap();
let change_strategy = standard::SingleOutputChangeStrategy::new(
Expand Down Expand Up @@ -686,10 +683,7 @@ pub(crate) fn spend_fails_on_locked_notes<T: ShieldedPoolTester>() {
let account_id = account.account_id();
let dfvk = T::test_account_fvk(&st);

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

// Add funds to the wallet in a single note
let value = NonNegativeAmount::const_from_u64(50000);
Expand Down Expand Up @@ -836,10 +830,7 @@ pub(crate) fn ovk_policy_prevents_recovery_from_chain<T: ShieldedPoolTester>() {
let extsk2 = T::sk(&[0xf5; 32]);
let addr2 = T::sk_default_address(&extsk2);

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

#[allow(clippy::type_complexity)]
let send_and_recover_with_policy = |st: &mut TestState<BlockCache>,
Expand Down Expand Up @@ -921,18 +912,15 @@ pub(crate) fn spend_succeeds_to_t_addr_zero_change<T: ShieldedPoolTester>() {
let dfvk = T::test_account_fvk(&st);

// Add funds to the wallet in a single note
let value = NonNegativeAmount::const_from_u64(60000);
let value = NonNegativeAmount::const_from_u64(70000);
let (h, _, _) = st.generate_next_block(&dfvk, AddressType::DefaultExternal, value);
st.scan_cached_blocks(h, 1);

// Spendable balance matches total balance at 1 confirmation.
assert_eq!(st.get_total_balance(account_id), value);
assert_eq!(st.get_spendable_balance(account_id, 1), value);

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

// TODO: generate_next_block_from_tx does not currently support transparent outputs.
let to = TransparentAddress::PublicKeyHash([7; 20]).into();
Expand Down Expand Up @@ -968,7 +956,7 @@ pub(crate) fn change_note_spends_succeed<T: ShieldedPoolTester>() {
let dfvk = T::test_account_fvk(&st);

// Add funds to the wallet in a single note owned by the internal spending key
let value = NonNegativeAmount::const_from_u64(60000);
let value = NonNegativeAmount::const_from_u64(70000);
let (h, _, _) = st.generate_next_block(&dfvk, AddressType::Internal, value);
st.scan_cached_blocks(h, 1);

Expand All @@ -995,10 +983,7 @@ pub(crate) fn change_note_spends_succeed<T: ShieldedPoolTester>() {
);
assert_matches!(change_note_scope, Ok(Some(Scope::Internal)));

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

// TODO: generate_next_block_from_tx does not currently support transparent outputs.
let to = TransparentAddress::PublicKeyHash([7; 20]).into();
Expand Down Expand Up @@ -1235,10 +1220,7 @@ pub(crate) fn shield_transparent<T: ShieldedPoolTester>() {
let res0 = st.wallet_mut().put_received_transparent_utxo(&utxo);
assert_matches!(res0, Ok(_));

// TODO: This test was originally written to use the pre-zip-313 fee rule
// and has not yet been updated.
#[allow(deprecated)]
let fee_rule = StandardFeeRule::PreZip313;
let fee_rule = StandardFeeRule::Zip317;

let input_selector = GreedyInputSelector::new(
standard::SingleOutputChangeStrategy::new(fee_rule, None, T::SHIELDED_PROTOCOL),
Expand Down

0 comments on commit f0cf405

Please sign in to comment.