Skip to content

Commit d595797

Browse files
committed
clippy
1 parent 6411eb4 commit d595797

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

substrate/frame/staking-async/ah-client/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ macro_rules! log {
100100

101101
/// Interface to talk to the local session pallet.
102102
pub trait SessionInterface {
103-
/// The validator id type of the session pallet.
103+
/// The validator id type of the session pallet
104104
type ValidatorId: Clone;
105105

106106
/// The account id type
@@ -111,7 +111,7 @@ pub trait SessionInterface {
111111

112112
fn validators() -> Vec<Self::ValidatorId>;
113113

114-
/// Prune up to the given session index.
114+
/// prune up to the given session index.
115115
fn prune_up_to(index: SessionIndex);
116116

117117
/// Report an offence.
@@ -144,7 +144,6 @@ impl<T: Config + pallet_session::Config + pallet_session::historical::Config> Se
144144
fn prune_up_to(index: SessionIndex) {
145145
pallet_session::historical::Pallet::<T>::prune_up_to(index)
146146
}
147-
148147
fn report_offence(offender: Self::ValidatorId, severity: OffenceSeverity) {
149148
pallet_session::Pallet::<T>::report_offence(offender, severity)
150149
}
@@ -678,9 +677,6 @@ pub mod pallet {
678677
/// The `proof` parameter is validated using the `OpaqueKeys::ownership_proof_is_valid`
679678
/// method to verify key ownership.
680679
#[pallet::call_index(3)]
681-
// Weight approximation for pallet_session::do_set_keys:
682-
// - Reads: NextKeys (load old keys), KeyOwner checks
683-
// - Writes: NextKeys, KeyOwner entries
684680
// TODO: Replace with proper benchmarked weight.
685681
#[pallet::weight(T::DbWeight::get().reads_writes(2, 2))]
686682
pub fn set_keys_from_ah(
@@ -710,9 +706,6 @@ pub mod pallet {
710706
/// This is called when a validator purges their session keys on AssetHub, which forwards
711707
/// the request to the RelayChain via XCM.
712708
#[pallet::call_index(4)]
713-
// Weight approximation for pallet_session::do_purge_keys:
714-
// - Reads: NextKeys (take keys)
715-
// - Writes: NextKeys (clear), KeyOwner entries (clear)
716709
// TODO: Replace with proper benchmarked weight.
717710
#[pallet::weight(T::DbWeight::get().reads_writes(2, 2))]
718711
pub fn purge_keys_from_ah(origin: OriginFor<T>, stash: T::AccountId) -> DispatchResult {

substrate/frame/staking-async/ahm-test/src/ah/mock.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ impl pallet_staking_async_rc_client::Config for Runtime {
472472
type RelayChainOrigin = EnsureRoot<AccountId>;
473473
type MaxValidatorSetRetries = ConstU32<3>;
474474
type ValidatorSetExportSession = ValidatorSetExportSession;
475+
type Keys = crate::rc::SessionKeys;
475476
}
476477

477478
parameter_types! {
@@ -514,6 +515,30 @@ impl pallet_staking_async_rc_client::SendToRelayChain for DeliverToRelay {
514515
}
515516
Ok(())
516517
}
518+
519+
fn set_keys(stash: Self::AccountId, keys: Vec<u8>, proof: Vec<u8>) -> Result<(), ()> {
520+
Self::ensure_delivery_guard()?;
521+
shared::in_rc(|| {
522+
let origin = crate::rc::RuntimeOrigin::root();
523+
pallet_staking_async_ah_client::Pallet::<crate::rc::Runtime>::set_keys_from_ah(
524+
origin, stash, keys, proof,
525+
)
526+
.unwrap();
527+
});
528+
Ok(())
529+
}
530+
531+
fn purge_keys(stash: Self::AccountId) -> Result<(), ()> {
532+
Self::ensure_delivery_guard()?;
533+
shared::in_rc(|| {
534+
let origin = crate::rc::RuntimeOrigin::root();
535+
pallet_staking_async_ah_client::Pallet::<crate::rc::Runtime>::purge_keys_from_ah(
536+
origin, stash,
537+
)
538+
.unwrap();
539+
});
540+
Ok(())
541+
}
517542
}
518543

519544
const INITIAL_BALANCE: Balance = 1000;

substrate/frame/staking-async/rc-client/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,6 @@ pub mod pallet {
960960
/// Note: No deposit is currently required. Deposit handling will be added once direct
961961
/// `set_keys`/`purge_keys` calls on the Relay Chain are disabled.
962962
#[pallet::call_index(10)]
963-
// Weight: XCM message encoding, validation, and UMP queue insertion.
964963
// TODO: Replace with proper benchmarked weight including XCM overhead.
965964
#[pallet::weight(T::DbWeight::get().reads_writes(0, 0))]
966965
pub fn set_keys(origin: OriginFor<T>, keys: T::Keys, proof: Vec<u8>) -> DispatchResult {
@@ -985,7 +984,6 @@ pub mod pallet {
985984
/// Note: No deposit is currently held/released. Deposit handling will be added once
986985
/// direct `set_keys`/`purge_keys` calls on the Relay Chain are disabled.
987986
#[pallet::call_index(11)]
988-
// Weight: XCM message encoding, validation, and UMP queue insertion.
989987
// TODO: Replace with proper benchmarked weight including XCM overhead.
990988
#[pallet::weight(T::DbWeight::get().reads_writes(0, 0))]
991989
pub fn purge_keys(origin: OriginFor<T>) -> DispatchResult {

0 commit comments

Comments
 (0)