mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 00:01:03 +00:00
Properly declare #[pallet::validate_unsigned] in ParachainSystem (#537)
* Properly declare #[pallet::validate_unsigned] in ParachainSystem * Add ValidateUnsigned to construct_runtime in ParachainSystem tests
This commit is contained in:
@@ -595,6 +595,29 @@ pub mod pallet {
|
|||||||
sp_io::storage::set(b":c", &[]);
|
sp_io::storage::set(b":c", &[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pallet::validate_unsigned]
|
||||||
|
impl<T: Config> sp_runtime::traits::ValidateUnsigned for Pallet<T> {
|
||||||
|
type Call = Call<T>;
|
||||||
|
|
||||||
|
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
|
||||||
|
if let Call::enact_authorized_upgrade(ref code) = call {
|
||||||
|
if let Ok(hash) = Self::validate_authorized_upgrade(code) {
|
||||||
|
return Ok(ValidTransaction {
|
||||||
|
priority: 100,
|
||||||
|
requires: vec![],
|
||||||
|
provides: vec![hash.as_ref().to_vec()],
|
||||||
|
longevity: TransactionLongevity::max_value(),
|
||||||
|
propagate: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Call::set_validation_data(..) = call {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
Err(InvalidTransaction::Call.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Config> Pallet<T> {
|
impl<T: Config> Pallet<T> {
|
||||||
@@ -606,28 +629,6 @@ impl<T: Config> Pallet<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Config> sp_runtime::traits::ValidateUnsigned for Pallet<T> {
|
|
||||||
type Call = Call<T>;
|
|
||||||
|
|
||||||
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
|
|
||||||
if let Call::enact_authorized_upgrade(ref code) = call {
|
|
||||||
if let Ok(hash) = Self::validate_authorized_upgrade(code) {
|
|
||||||
return Ok(ValidTransaction {
|
|
||||||
priority: 100,
|
|
||||||
requires: vec![],
|
|
||||||
provides: vec![hash.as_ref().to_vec()],
|
|
||||||
longevity: TransactionLongevity::max_value(),
|
|
||||||
propagate: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Call::set_validation_data(..) = call {
|
|
||||||
return Ok(Default::default());
|
|
||||||
}
|
|
||||||
Err(InvalidTransaction::Call.into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Config> GetChannelInfo for Pallet<T> {
|
impl<T: Config> GetChannelInfo for Pallet<T> {
|
||||||
fn get_channel_status(id: ParaId) -> ChannelStatus {
|
fn get_channel_status(id: ParaId) -> ChannelStatus {
|
||||||
// Note, that we are using `relevant_messaging_state` which may be from the previous
|
// Note, that we are using `relevant_messaging_state` which may be from the previous
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ frame_support::construct_runtime!(
|
|||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||||
ParachainSystem: parachain_system::{Pallet, Call, Storage, Event<T>},
|
ParachainSystem: parachain_system::{Pallet, Call, Storage, Event<T>, ValidateUnsigned},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user