Skip to content

Commit 2b9f1ef

Browse files
authored
Merge of #3982
2 parents be8458a + 2bee742 commit 2b9f1ef

File tree

5 files changed

+188
-4
lines changed

5 files changed

+188
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Increase the default masp fee payment gas limit to 65000 in genesis
2+
localnet files. Moreover, add additional test cases for MASP fee unshields.
3+
([\#3982](https://github.com/anoma/namada/pull/3982))

crates/tests/src/integration/masp.rs

Lines changed: 182 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::e2e::setup::constants::{
2828
AA_PAYMENT_ADDRESS, AA_VIEWING_KEY, AB_PAYMENT_ADDRESS, AB_VIEWING_KEY,
2929
AC_PAYMENT_ADDRESS, AC_VIEWING_KEY, ALBERT, ALBERT_KEY, A_SPENDING_KEY,
3030
BB_PAYMENT_ADDRESS, BERTHA, BERTHA_KEY, BTC, B_SPENDING_KEY, CHRISTEL,
31-
CHRISTEL_KEY, ETH, MASP, NAM,
31+
CHRISTEL_KEY, C_SPENDING_KEY, ETH, MASP, NAM,
3232
};
3333
use crate::strings::TX_APPLIED_SUCCESS;
3434

@@ -696,6 +696,8 @@ fn values_spanning_multiple_masp_digits() -> Result<()> {
696696

697697
// Assert that we have minted NAM rewards
698698
const EXPECTED_REWARDS: u128 = 6427858447239330;
699+
const UNSHIELD_REWARDS_AMT: u128 = EXPECTED_REWARDS / 2;
700+
const REMAINING_REWARDS_AMT: u128 = EXPECTED_REWARDS - UNSHIELD_REWARDS_AMT;
699701

700702
let captured = CapturedOutput::of(|| {
701703
run(
@@ -715,6 +717,185 @@ fn values_spanning_multiple_masp_digits() -> Result<()> {
715717
assert!(captured.result.is_ok(), "{:?}", captured.result);
716718
assert!(captured.contains(&format!("nam: {EXPECTED_REWARDS}")));
717719

720+
// Unshield half of the rewards. Pay for gas transparently
721+
let captured = CapturedOutput::of(|| {
722+
run(
723+
&node,
724+
Bin::Client,
725+
vec![
726+
"unshield",
727+
"--source",
728+
A_SPENDING_KEY,
729+
"--target",
730+
BERTHA,
731+
"--token",
732+
NAM,
733+
"--amount",
734+
&UNSHIELD_REWARDS_AMT.to_string(),
735+
"--signing-keys",
736+
BERTHA_KEY,
737+
"--node",
738+
RPC,
739+
"--gas-limit",
740+
"65000",
741+
],
742+
)
743+
});
744+
assert!(captured.result.is_ok(), "{:?}", captured.result);
745+
assert!(captured.contains(TX_APPLIED_SUCCESS));
746+
747+
// Fetch latest shielded state
748+
run(
749+
&node,
750+
Bin::Client,
751+
vec![
752+
"shielded-sync",
753+
"--viewing-keys",
754+
AA_VIEWING_KEY,
755+
"--node",
756+
RPC,
757+
],
758+
)?;
759+
760+
// Check that we now have half of the rewards
761+
let captured = CapturedOutput::of(|| {
762+
run(
763+
&node,
764+
Bin::Client,
765+
vec![
766+
"balance",
767+
"--owner",
768+
AA_VIEWING_KEY,
769+
"--token",
770+
NAM,
771+
"--node",
772+
RPC,
773+
],
774+
)
775+
});
776+
assert!(captured.result.is_ok(), "{:?}", captured.result);
777+
assert!(captured.contains(&format!("nam: {REMAINING_REWARDS_AMT}")));
778+
779+
// Shield 1 NAM to cover fees
780+
let captured = CapturedOutput::of(|| {
781+
run(
782+
&node,
783+
Bin::Client,
784+
vec![
785+
"shield",
786+
"--source",
787+
BERTHA_KEY,
788+
"--target",
789+
AC_PAYMENT_ADDRESS,
790+
"--token",
791+
NAM,
792+
"--amount",
793+
"1",
794+
"--gas-payer",
795+
BERTHA_KEY,
796+
"--node",
797+
RPC,
798+
],
799+
)
800+
});
801+
assert!(captured.result.is_ok(), "{:?}", captured.result);
802+
assert!(captured.contains(TX_APPLIED_SUCCESS));
803+
804+
// Fetch latest shielded state
805+
run(
806+
&node,
807+
Bin::Client,
808+
vec![
809+
"shielded-sync",
810+
"--viewing-keys",
811+
AA_VIEWING_KEY,
812+
AC_VIEWING_KEY,
813+
"--node",
814+
RPC,
815+
],
816+
)?;
817+
818+
// Check the shielded NAM balance
819+
let captured = CapturedOutput::of(|| {
820+
run(
821+
&node,
822+
Bin::Client,
823+
vec![
824+
"balance",
825+
"--owner",
826+
AC_VIEWING_KEY,
827+
"--token",
828+
NAM,
829+
"--node",
830+
RPC,
831+
],
832+
)
833+
});
834+
assert!(captured.result.is_ok(), "{:?}", captured.result);
835+
assert!(captured.contains("nam: 1"));
836+
837+
// Unshield the other half of the rewards. Pay for gas using
838+
// a spending key
839+
let captured = CapturedOutput::of(|| {
840+
run(
841+
&node,
842+
Bin::Client,
843+
vec![
844+
"unshield",
845+
"--source",
846+
A_SPENDING_KEY,
847+
"--target",
848+
BERTHA,
849+
"--token",
850+
NAM,
851+
"--amount",
852+
&REMAINING_REWARDS_AMT.to_string(),
853+
"--node",
854+
RPC,
855+
"--disposable-gas-payer",
856+
"--gas-spending-key",
857+
C_SPENDING_KEY,
858+
"--gas-limit",
859+
"65000",
860+
],
861+
)
862+
});
863+
assert!(captured.result.is_ok(), "{:?}", captured.result);
864+
assert!(captured.contains(TX_APPLIED_SUCCESS));
865+
866+
// Fetch latest shielded state
867+
run(
868+
&node,
869+
Bin::Client,
870+
vec![
871+
"shielded-sync",
872+
"--viewing-keys",
873+
AA_VIEWING_KEY,
874+
AC_VIEWING_KEY,
875+
"--node",
876+
RPC,
877+
],
878+
)?;
879+
880+
// Check that we now have a null NAM balance
881+
let captured = CapturedOutput::of(|| {
882+
run(
883+
&node,
884+
Bin::Client,
885+
vec![
886+
"balance",
887+
"--owner",
888+
AA_VIEWING_KEY,
889+
"--token",
890+
NAM,
891+
"--node",
892+
RPC,
893+
],
894+
)
895+
});
896+
assert!(captured.result.is_ok(), "{:?}", captured.result);
897+
assert!(captured.contains("nam: 0"));
898+
718899
Ok(())
719900
}
720901

genesis/hardware/parameters.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ masp_epoch_multiplier = 2
2121
# Max gas for block
2222
max_block_gas = 3_000_000
2323
# Masp fee payment gas limit
24-
masp_fee_payment_gas_limit = 50_000
24+
masp_fee_payment_gas_limit = 65_000
2525
# Gas scale
2626
gas_scale = 50_000
2727

genesis/localnet/parameters.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ masp_epoch_multiplier = 2
2121
# Max gas for block
2222
max_block_gas = 3_000_000
2323
# Masp fee payment gas limit
24-
masp_fee_payment_gas_limit = 50_000
24+
masp_fee_payment_gas_limit = 65_000
2525
# Gas scale
2626
gas_scale = 50_000
2727

genesis/starter/parameters.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ masp_epoch_multiplier = 2
2121
# Max gas for block
2222
max_block_gas = 3_000_000
2323
# Masp fee payment gas limit
24-
masp_fee_payment_gas_limit = 50_000
24+
masp_fee_payment_gas_limit = 65_000
2525
# Gas scale
2626
gas_scale = 50_000
2727

0 commit comments

Comments
 (0)