compact param in calls (#1499)

* impl #[codec(compact)] for param

* update modules

* test all and build runtime

* Update srml/support/src/dispatch.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/src/dispatch.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* delete wip comment

* update param to use #[compact] instead of Cmpact<>

* fmt

* impl metadata

* test metadata

* add compact attr test

* script buid

* update test
This commit is contained in:
thiolliere
2019-01-22 14:42:13 +01:00
committed by Bastian Köcher
parent 8f38593def
commit 2492931944
24 changed files with 576 additions and 541 deletions
+7 -7
View File
@@ -90,7 +90,7 @@ fn note_offline_grace_should_work() {
with_externalities(&mut new_test_ext(0, 3, 3, 0, true, 10), || {
Balances::set_free_balance(&10, 70);
Balances::set_free_balance(&20, 70);
assert_ok!(Staking::set_offline_slash_grace(1.into()));
assert_ok!(Staking::set_offline_slash_grace(1));
assert_eq!(Staking::offline_slash_grace(), 1);
assert_eq!(Staking::slash_count(&10), 0);
@@ -145,7 +145,7 @@ fn note_offline_auto_unstake_session_change_should_work() {
with_externalities(&mut new_test_ext(0, 3, 3, 0, true, 10), || {
Balances::set_free_balance(&10, 7000);
Balances::set_free_balance(&20, 7000);
assert_ok!(Staking::register_preferences(Origin::signed(10), 0.into(), ValidatorPrefs { unstake_threshold: 1, validator_payment: 0 }));
assert_ok!(Staking::register_preferences(Origin::signed(10), 0, ValidatorPrefs { unstake_threshold: 1, validator_payment: 0 }));
assert_eq!(Staking::intentions(), vec![10, 20]);
@@ -251,7 +251,7 @@ fn staking_should_work() {
assert_eq!(Staking::validator_count(), 2);
assert_eq!(Session::validators(), vec![10, 20]);
assert_ok!(Staking::set_bonding_duration(2.into()));
assert_ok!(Staking::set_bonding_duration(2));
assert_eq!(Staking::bonding_duration(), 2);
// Block 1: Add three validators. No obvious change.
@@ -284,7 +284,7 @@ fn staking_should_work() {
// Block 5: Transfer stake from highest to lowest. No change yet.
System::set_block_number(5);
assert_ok!(Balances::transfer(Origin::signed(4), 1, 40.into()));
assert_ok!(Balances::transfer(Origin::signed(4), 1, 40));
Session::check_rotate_session(System::block_number());
// Block 6: Lowest now validator.
@@ -327,7 +327,7 @@ fn nominating_and_rewards_should_work() {
assert_eq!(Balances::total_balance(&4), 40);
System::set_block_number(2);
assert_ok!(Staking::unnominate(Origin::signed(4), 0.into()));
assert_ok!(Staking::unnominate(Origin::signed(4), 0));
Session::check_rotate_session(System::block_number());
assert_eq!(Staking::current_era(), 2);
assert_eq!(Session::validators(), vec![3, 2]);
@@ -460,7 +460,7 @@ fn staking_eras_work() {
// Block 3: Schedule an era length change; no visible changes.
System::set_block_number(3);
assert_ok!(Staking::set_sessions_per_era(3.into()));
assert_ok!(Staking::set_sessions_per_era(3));
Session::check_rotate_session(System::block_number());
assert_eq!(Session::current_index(), 3);
assert_eq!(Staking::sessions_per_era(), 2);
@@ -506,7 +506,7 @@ fn staking_balance_transfer_when_bonded_should_not_work() {
with_externalities(&mut new_test_ext(0, 1, 3, 1, false, 0), || {
Balances::set_free_balance(&1, 111);
assert_ok!(Staking::stake(Origin::signed(1)));
assert_noop!(Balances::transfer(Origin::signed(1), 2, 69.into()), "cannot transfer illiquid funds");
assert_noop!(Balances::transfer(Origin::signed(1), 2, 69), "cannot transfer illiquid funds");
});
}