Use same fmt and clippy configs as in Polkadot (#3004)

* Copy rustfmt.toml from Polkadot master

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Format with new config

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add Polkadot clippy config

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update Cargo.lock

Looks like https://github.com/paritytech/polkadot/pull/7611 did not
correctly update the lockfile. Maybe a different Rust Version?!

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2023-08-14 22:30:12 +02:00
committed by GitHub
parent 61480a1881
commit 6c79b58567
60 changed files with 333 additions and 233 deletions
+19 -13
View File
@@ -547,10 +547,12 @@ pub mod pallet {
Unauthorized,
}
/// In case of a scheduled upgrade, this storage field contains the validation code to be applied.
/// In case of a scheduled upgrade, this storage field contains the validation code to be
/// applied.
///
/// As soon as the relay chain gives us the go-ahead signal, we will overwrite the [`:code`][sp_core::storage::well_known_keys::CODE]
/// which will result the next block process with the new validation code. This concludes the upgrade process.
/// As soon as the relay chain gives us the go-ahead signal, we will overwrite the
/// [`:code`][sp_core::storage::well_known_keys::CODE] which will result the next block process
/// with the new validation code. This concludes the upgrade process.
#[pallet::storage]
#[pallet::getter(fn new_validation_function)]
pub(super) type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
@@ -871,8 +873,8 @@ impl<T: Config> Pallet<T> {
/// Process all inbound horizontal messages relayed by the collator.
///
/// This is similar to `Pallet::process_inbound_downward_messages`, but works on multiple inbound
/// channels.
/// This is similar to `Pallet::process_inbound_downward_messages`, but works on multiple
/// inbound channels.
///
/// **Panics** if either any of horizontal messages submitted by the collator was sent from
/// a para which has no open channel to this parachain or if after processing
@@ -988,7 +990,8 @@ impl<T: Config> Pallet<T> {
/// The implementation of the runtime upgrade functionality for parachains.
pub fn schedule_code_upgrade(validation_function: Vec<u8>) -> DispatchResult {
// Ensure that `ValidationData` exists. We do not care about the validation data per se,
// but we do care about the [`UpgradeRestrictionSignal`] which arrives with the same inherent.
// but we do care about the [`UpgradeRestrictionSignal`] which arrives with the same
// inherent.
ensure!(<ValidationData<T>>::exists(), Error::<T>::ValidationDataNotAvailable,);
ensure!(<UpgradeRestrictionSignal<T>>::get().is_none(), Error::<T>::ProhibitedByPolkadot);
@@ -1012,7 +1015,8 @@ impl<T: Config> Pallet<T> {
/// Returns the [`CollationInfo`] of the current active block.
///
/// The given `header` is the header of the built block we are collecting the collation info for.
/// The given `header` is the header of the built block we are collecting the collation info
/// for.
///
/// This is expected to be used by the
/// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api.
@@ -1175,7 +1179,8 @@ pub trait CheckInherents<Block: BlockT> {
pub trait OnSystemEvent {
/// Called in each blocks once when the validation data is set by the inherent.
fn on_validation_data(data: &PersistedValidationData);
/// Called when the validation code is being applied, aka from the next block on this is the new runtime.
/// Called when the validation code is being applied, aka from the next block on this is the new
/// runtime.
fn on_validation_code_applied();
}
@@ -1198,8 +1203,8 @@ pub trait RelaychainStateProvider {
fn current_relay_chain_state() -> RelayChainState;
}
/// Implements [`BlockNumberProvider`] that returns relay chain block number fetched from validation data.
/// When validation data is not available (e.g. within on_initialize), 0 will be returned.
/// Implements [`BlockNumberProvider`] that returns relay chain block number fetched from validation
/// data. When validation data is not available (e.g. within on_initialize), 0 will be returned.
///
/// **NOTE**: This has been deprecated, please use [`RelaychainDataProvider`]
#[deprecated = "Use `RelaychainDataProvider` instead"]
@@ -1241,9 +1246,10 @@ impl<T: Config> RelaychainStateProvider for RelaychainDataProvider<T> {
}
}
/// Implements [`BlockNumberProvider`] and [`RelaychainStateProvider`] that returns relevant relay data fetched from
/// validation data.
/// NOTE: When validation data is not available (e.g. within on_initialize), default values will be returned.
/// Implements [`BlockNumberProvider`] and [`RelaychainStateProvider`] that returns relevant relay
/// data fetched from validation data.
/// NOTE: When validation data is not available (e.g. within on_initialize), default values will be
/// returned.
pub struct RelaychainDataProvider<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> {