mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 22:41:06 +00:00
FRAME: inherited call weight syntax (#13932)
* First approach on pallet::call_weight Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use attr on pallet::call instead Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ui tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename to weight(prefix = ...)) Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify to #[pallet::call(weight(T))] Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add stray token error Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Try to add some docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Migrate remaining pallets" Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b42d72de1dacaed714d69166fa1bc9c92dd. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Renames Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Co-authored-by: Sam Johnson <sam@durosoft.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update UI tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/pallet/parse/mod.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Remove old code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6e5141fc23
commit
b5201fa0ec
@@ -21,6 +21,7 @@ use super::*;
|
||||
use crate::{mock::*, Error};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
dispatch::GetDispatchInfo,
|
||||
traits::{fungibles::InspectEnumerable, tokens::Preservation::Protect, Currency},
|
||||
};
|
||||
use pallet_balances::Error as BalancesError;
|
||||
@@ -1355,3 +1356,12 @@ fn multiple_transfer_alls_work_ok() {
|
||||
assert_eq!(Balances::free_balance(&1337), 100);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn weights_sane() {
|
||||
let info = crate::Call::<Test>::create { id: 10, admin: 4, min_balance: 3 }.get_dispatch_info();
|
||||
assert_eq!(<() as crate::WeightInfo>::create(), info.weight);
|
||||
|
||||
let info = crate::Call::<Test>::finish_destroy { id: 10 }.get_dispatch_info();
|
||||
assert_eq!(<() as crate::WeightInfo>::finish_destroy(), info.weight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user