mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Removed pallet::getter usage from Polkadot Runtime pallets (#3660)
Part of #3326 @kianenigma @ggwpez polkadot address: 12poSUQPtcF1HUPQGY3zZu2P8emuW9YnsPduA4XG3oCEfJVp --------- Signed-off-by: Matteo Muraca <mmuraca247@gmail.com> Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
@@ -597,7 +597,7 @@ pub mod pallet {
|
||||
Error::<T>::WrongWitness
|
||||
);
|
||||
|
||||
let host_config = configuration::Pallet::<T>::config();
|
||||
let host_config = configuration::ActiveConfig::<T>::get();
|
||||
Self::process_hrmp_open_channel_requests(&host_config);
|
||||
Ok(())
|
||||
}
|
||||
@@ -724,7 +724,7 @@ pub mod pallet {
|
||||
Error::<T>::ChannelCreationNotAuthorized
|
||||
);
|
||||
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
let max_message_size = config.hrmp_channel_max_message_size;
|
||||
let max_capacity = config.hrmp_channel_max_capacity;
|
||||
|
||||
@@ -761,7 +761,7 @@ pub mod pallet {
|
||||
let channel_id = HrmpChannelId { sender, recipient };
|
||||
let is_system = sender.is_system() || recipient.is_system();
|
||||
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
|
||||
// Channels with and amongst the system do not require a deposit.
|
||||
let (new_sender_deposit, new_recipient_deposit) = if is_system {
|
||||
@@ -840,7 +840,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32, u32)]) {
|
||||
let host_config = configuration::Pallet::<T>::config();
|
||||
let host_config = configuration::ActiveConfig::<T>::get();
|
||||
for &(sender, recipient, max_capacity, max_message_size) in preopen_hrmp_channels {
|
||||
if let Err(err) =
|
||||
preopen_hrmp_channel::<T>(sender, recipient, max_capacity, max_message_size)
|
||||
@@ -848,7 +848,7 @@ fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32,
|
||||
panic!("failed to initialize the genesis storage: {:?}", err);
|
||||
}
|
||||
}
|
||||
<Pallet<T>>::process_hrmp_open_channel_requests(&host_config);
|
||||
Pallet::<T>::process_hrmp_open_channel_requests(&host_config);
|
||||
}
|
||||
|
||||
fn preopen_hrmp_channel<T: Config>(
|
||||
@@ -857,8 +857,8 @@ fn preopen_hrmp_channel<T: Config>(
|
||||
max_capacity: u32,
|
||||
max_message_size: u32,
|
||||
) -> DispatchResult {
|
||||
<Pallet<T>>::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||
<Pallet<T>>::accept_open_channel(recipient, sender)?;
|
||||
Pallet::<T>::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||
Pallet::<T>::accept_open_channel(recipient, sender)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1018,8 +1018,8 @@ impl<T: Config> Pallet<T> {
|
||||
let recipient_deposit = if system_channel { 0 } else { config.hrmp_recipient_deposit };
|
||||
|
||||
if request.confirmed {
|
||||
if <paras::Pallet<T>>::is_valid_para(channel_id.sender) &&
|
||||
<paras::Pallet<T>>::is_valid_para(channel_id.recipient)
|
||||
if paras::Pallet::<T>::is_valid_para(channel_id.sender) &&
|
||||
paras::Pallet::<T>::is_valid_para(channel_id.recipient)
|
||||
{
|
||||
HrmpChannels::<T>::insert(
|
||||
&channel_id,
|
||||
@@ -1310,7 +1310,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// Returns the amount of weight consumed.
|
||||
pub(crate) fn queue_outbound_hrmp(sender: ParaId, out_hrmp_msgs: HorizontalMessages) -> Weight {
|
||||
let mut weight = Weight::zero();
|
||||
let now = <frame_system::Pallet<T>>::block_number();
|
||||
let now = frame_system::Pallet::<T>::block_number();
|
||||
|
||||
for out_msg in out_hrmp_msgs {
|
||||
let channel_id = HrmpChannelId { sender, recipient: out_msg.recipient };
|
||||
@@ -1387,11 +1387,11 @@ impl<T: Config> Pallet<T> {
|
||||
) -> DispatchResult {
|
||||
ensure!(origin != recipient, Error::<T>::OpenHrmpChannelToSelf);
|
||||
ensure!(
|
||||
<paras::Pallet<T>>::is_valid_para(recipient),
|
||||
paras::Pallet::<T>::is_valid_para(recipient),
|
||||
Error::<T>::OpenHrmpChannelInvalidRecipient,
|
||||
);
|
||||
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
ensure!(proposed_max_capacity > 0, Error::<T>::OpenHrmpChannelZeroCapacity);
|
||||
ensure!(
|
||||
proposed_max_capacity <= config.hrmp_channel_max_capacity,
|
||||
@@ -1459,7 +1459,7 @@ impl<T: Config> Pallet<T> {
|
||||
.encode()
|
||||
};
|
||||
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
|
||||
<dmp::Pallet<T>>::queue_downward_message(&config, recipient, notification_bytes)
|
||||
dmp::Pallet::<T>::queue_downward_message(&config, recipient, notification_bytes)
|
||||
{
|
||||
// this should never happen unless the max downward message size is configured to a
|
||||
// jokingly small number.
|
||||
@@ -1485,7 +1485,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// check if by accepting this open channel request, this parachain would exceed the
|
||||
// number of inbound channels.
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
let channel_num_limit = config.hrmp_max_parachain_inbound_channels;
|
||||
let ingress_cnt = HrmpIngressChannelsIndex::<T>::decode_len(&origin).unwrap_or(0) as u32;
|
||||
let accepted_cnt = HrmpAcceptedChannelRequestCount::<T>::get(&origin);
|
||||
@@ -1517,7 +1517,7 @@ impl<T: Config> Pallet<T> {
|
||||
VersionedXcm::from(xcm).encode()
|
||||
};
|
||||
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
|
||||
<dmp::Pallet<T>>::queue_downward_message(&config, sender, notification_bytes)
|
||||
dmp::Pallet::<T>::queue_downward_message(&config, sender, notification_bytes)
|
||||
{
|
||||
// this should never happen unless the max downward message size is configured to an
|
||||
// jokingly small number.
|
||||
@@ -1580,7 +1580,7 @@ impl<T: Config> Pallet<T> {
|
||||
HrmpCloseChannelRequests::<T>::insert(&channel_id, ());
|
||||
HrmpCloseChannelRequestsList::<T>::append(channel_id.clone());
|
||||
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
let notification_bytes = {
|
||||
use parity_scale_codec::Encode as _;
|
||||
use xcm::opaque::{latest::prelude::*, VersionedXcm};
|
||||
@@ -1595,7 +1595,7 @@ impl<T: Config> Pallet<T> {
|
||||
let opposite_party =
|
||||
if origin == channel_id.sender { channel_id.recipient } else { channel_id.sender };
|
||||
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
|
||||
<dmp::Pallet<T>>::queue_downward_message(&config, opposite_party, notification_bytes)
|
||||
dmp::Pallet::<T>::queue_downward_message(&config, opposite_party, notification_bytes)
|
||||
{
|
||||
// this should never happen unless the max downward message size is configured to an
|
||||
// jokingly small number.
|
||||
|
||||
Reference in New Issue
Block a user