Skip to content

Commit

Permalink
non vested account cannot vest others
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp committed Jan 18, 2024
1 parent 9ba2fe3 commit eea96c7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions precompiles/vesting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,24 @@ fn test_vested_transfer() {
assert_eq!(vesting_info, Some(schedules));
});
}

#[test]
fn non_vested_cannot_vest_other() {
ExtBuilder::default().build().execute_with(|| {
let non_vested_account = TestAccount::Dave;
assert_eq!(pallet_vesting::Pallet::<Runtime>::vesting(
sp_core::sr25519::Public::from(non_vested_account.clone())), None);

let target = mock_pub_key(6);
let error_msg = "Dispatched call failed with error: Module(ModuleError { index: 4, error: [0, 0, 0, 0], message: Some(\"NotVesting\") })";
// non_vested_account should not be able to vest other
PrecompilesValue::get()
.prepare_test(
non_vested_account,
H160::from_low_u64_be(1),
PCall::vest_other { target: target.into() },
)
.execute_reverts(|output| output == error_msg.as_bytes());

});
}

0 comments on commit eea96c7

Please sign in to comment.