Skip to content

Commit

Permalink
Minor refactor to masp fee unshield tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Dec 13, 2023
1 parent f33ebe7 commit bb8cd86
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
6 changes: 1 addition & 5 deletions shared/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,7 @@ where
This shouldn't happen."
);

Err(Error::FeeError(format!(
"{}. All the available transparent funds have been moved to \
the block proposer",
e
)))
Err(Error::FeeError(format!("{}", e)))
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,9 @@ fn wrapper_disposable_signer() -> Result<()> {
"--disposable-gas-payer",
"--ledger-address",
&validator_one_rpc,
// NOTE: Forcing the transaction will make the client produce a
// transfer without a masp object attached to it, so don't expect a
// failure from the masp vp here but from the check_fees function
"--force",
];
let mut client = run!(test, Bin::Client, tx_args, Some(720))?;
Expand Down
55 changes: 29 additions & 26 deletions tests/src/integration/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,32 +1219,35 @@ fn wrapper_fee_unshielding() -> Result<()> {
node.assert_success();

// 3. Invalid unshielding
// TODO: this test shall panic because of the panic in the sdk. Once the
// panics are removed from there, this test can be updated
let tx_run = run(
&node,
Bin::Client,
vec![
"transfer",
"--source",
ALBERT,
"--target",
BERTHA,
"--token",
NAM,
"--amount",
"1",
"--gas-price",
"1000",
"--gas-spending-key",
B_SPENDING_KEY,
"--ledger-address",
validator_one_rpc,
"--force",
],
)
.is_err();
let tx_args = vec![
"transfer",
"--source",
ALBERT,
"--target",
BERTHA,
"--token",
NAM,
"--amount",
"1",
"--gas-price",
"1000",
"--gas-spending-key",
B_SPENDING_KEY,
"--ledger-address",
validator_one_rpc,
// NOTE: Forcing the transaction will make the client produce a
// transfer without a masp object attached to it, so don't expect a
// failure from the masp vp here but from the check_fees function
"--force",
];

let captured =
CapturedOutput::of(|| run(&node, Bin::Client, tx_args.clone()));
assert!(
captured.result.is_err(),
"{:?} unexpectedly succeeded",
tx_args
);

assert!(tx_run);
Ok(())
}

0 comments on commit bb8cd86

Please sign in to comment.