Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

// Public due to integration tests crate.
pub mod config;

Check warning on line 10 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a module

warning: missing documentation for a module --> runtime/devnet/src/lib.rs:10:1 | 10 | pub mod config; | ^^^^^^^^^^^^^^
/// The genesis state presets available.
pub mod genesis;
mod weights;
Expand Down Expand Up @@ -35,8 +35,8 @@
parameter_types,
traits::{
fungible::HoldConsideration, tokens::nonfungibles_v2::Inspect, ConstBool, ConstU32,
ConstU64, ConstU8, Contains, EitherOfDiverse, EqualPrivilegeOnly, EverythingBut,
LinearStoragePrice, TransformOrigin, VariantCountOf,
ConstU64, ConstU8, EitherOfDiverse, EqualPrivilegeOnly, Everything, LinearStoragePrice,
TransformOrigin, VariantCountOf,
},
weights::{
ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand All @@ -50,7 +50,6 @@
CheckWeight, EnsureRoot,
};
use pallet_api::{fungibles, nonfungibles};
use pallet_balances::Call as BalancesCall;
use pallet_ismp::offchain::{Leaf, Proof, ProofKeys};
use pallet_revive::{
evm::{runtime::EthExtra, H160},
Expand Down Expand Up @@ -225,7 +224,7 @@
}

#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {

Check warning on line 227 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a constant

warning: missing documentation for a constant --> runtime/devnet/src/lib.rs:227:1 | 227 | pub const VERSION: RuntimeVersion = RuntimeVersion { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec_name: Cow::Borrowed("pop"),
impl_name: Cow::Borrowed("pop"),
authoring_version: 1,
Expand Down Expand Up @@ -285,23 +284,6 @@
pub const SS58Prefix: u16 = 42;
}

/// A type to identify filtered calls.
pub struct FilteredCalls;
impl Contains<RuntimeCall> for FilteredCalls {
fn contains(c: &RuntimeCall) -> bool {
use BalancesCall::*;
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
}

/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`),
/// but overridden as needed.
Expand All @@ -312,7 +294,7 @@
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The basic call filter to use in dispatchable. Supports everything as the default.
type BaseCallFilter = EverythingBut<FilteredCalls>;
type BaseCallFilter = Everything;
/// The block type.
type Block = Block;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
Expand Down Expand Up @@ -603,7 +585,7 @@
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
}

#[frame_support::runtime]

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for an associated function

warning: missing documentation for an associated function --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a type alias

warning: missing documentation for a type alias --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a struct field

warning: missing documentation for a struct field --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for an enum

warning: missing documentation for an enum --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 588 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a struct

warning: missing documentation for a struct --> runtime/devnet/src/lib.rs:588:1 | 588 | #[frame_support::runtime] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in the attribute macro `frame_support::runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
mod runtime {
// Create the runtime by composing the FRAME pallets that were previously configured.
#[runtime::runtime]
Expand Down
51 changes: 6 additions & 45 deletions runtime/mainnet/src/config/system.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use frame_support::traits::{ConstU32, ConstU64, Contains, EnqueueWithOrigin, EverythingBut};
use pallet_balances::Call as BalancesCall;
use frame_support::traits::{ConstU32, ConstU64, EnqueueWithOrigin, Everything};
use polkadot_runtime_common::BlockHashCount;
use pop_runtime_common::{
Nonce, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
Expand Down Expand Up @@ -52,30 +51,14 @@ parameter_types! {
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
}
/// A type to identify filtered calls.
pub struct FilteredCalls;
impl Contains<RuntimeCall> for FilteredCalls {
fn contains(c: &RuntimeCall) -> bool {
use BalancesCall::*;
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
}

impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The basic call filter to use in dispatchable. Supports everything as the default.
type BaseCallFilter = EverythingBut<FilteredCalls>;
type BaseCallFilter = Everything;
/// The block type.
type Block = Block;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
Expand Down Expand Up @@ -188,15 +171,12 @@ mod tests {
};
use frame_system::limits::WeightsPerClass;
use sp_core::crypto::AccountId32;
use sp_runtime::{generic, MultiAddress};
use sp_runtime::generic;

use super::*;
use crate::{Header, Perbill, UncheckedExtrinsic, Weight};

mod system {
use pallet_balances::AdjustmentDirection;
use BalancesCall::*;

use super::*;

#[test]
Expand All @@ -208,30 +188,11 @@ mod tests {
}

#[test]
fn base_call_filter_allows_everything_but_filtered_calls() {
fn base_call_filter_allows_everything() {
assert_eq!(
TypeId::of::<<Runtime as frame_system::Config>::BaseCallFilter>(),
TypeId::of::<EverythingBut<FilteredCalls>>(),
);
let dummy_acc = MultiAddress::from(AccountId32::from([0; 32]));
let filtered_calls = [
RuntimeCall::Balances(force_adjust_total_issuance {
direction: AdjustmentDirection::Increase,
delta: 0,
}),
RuntimeCall::Balances(force_set_balance { who: dummy_acc.clone(), new_free: 0 }),
RuntimeCall::Balances(force_transfer {
source: dummy_acc.clone(),
dest: dummy_acc.clone(),
value: 1,
}),
RuntimeCall::Balances(force_unreserve { who: dummy_acc, amount: 0 }),
];

for call in filtered_calls {
assert!(FilteredCalls::contains(&call));
assert!(!<<Runtime as frame_system::Config>::BaseCallFilter>::contains(&call));
}
TypeId::of::<Everything>(),
);
}

#[test]
Expand Down
29 changes: 6 additions & 23 deletions runtime/testnet/src/config/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
derive_impl,
pallet_prelude::ConstU32,
parameter_types,
traits::{ConstU64, Contains, EverythingBut},
traits::{ConstU64, Everything},
};
use parachains_common::{Balance, Hash};
use polkadot_runtime_common::BlockHashCount;
Expand All @@ -15,10 +15,10 @@
#[cfg(not(feature = "runtime-benchmarks"))]
use crate::Revive;
use crate::{
weights::RocksDbWeight, AccountId, AggregateMessageOrigin, Aura, BalancesCall, Block,
BlockExecutionWeight, BlockLength, BlockWeights, DispatchClass, ExtrinsicBaseWeight,
MessageQueue, MultiBlockMigrations, Nonce, PalletInfo, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin, RuntimeTask, RuntimeVersion, Weight, XcmpQueue, AVERAGE_ON_INITIALIZE_RATIO,
weights::RocksDbWeight, AccountId, AggregateMessageOrigin, Aura, Block, BlockExecutionWeight,
BlockLength, BlockWeights, DispatchClass, ExtrinsicBaseWeight, MessageQueue,
MultiBlockMigrations, Nonce, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
RuntimeTask, RuntimeVersion, Weight, XcmpQueue, AVERAGE_ON_INITIALIZE_RATIO,
BLOCK_PROCESSING_VELOCITY, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
RELAY_CHAIN_SLOT_DURATION_MILLIS, UNINCLUDED_SEGMENT_CAPACITY, VERSION,
};
Expand Down Expand Up @@ -53,31 +53,14 @@
pub const SS58Prefix: u16 = 0;
}

/// A type to identify filtered calls.
pub struct FilteredCalls;
impl Contains<RuntimeCall> for FilteredCalls {
fn contains(c: &RuntimeCall) -> bool {
use BalancesCall::*;
matches!(
c,
RuntimeCall::Balances(
force_adjust_total_issuance { .. } |
force_set_balance { .. } |
force_transfer { .. } |
force_unreserve { .. }
)
)
}
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)]
impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The basic call filter to use in dispatchable. Supports everything as the default.
type BaseCallFilter = EverythingBut<FilteredCalls>;
type BaseCallFilter = Everything;
/// The block type.
type Block = Block;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
Expand Down Expand Up @@ -136,7 +119,7 @@
}

#[docify::export]
pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<

Check warning on line 122 in runtime/testnet/src/config/system.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a type alias

warning: missing documentation for a type alias --> runtime/testnet/src/config/system.rs:122:1 | 122 | pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< | ^^^^^^^^^^^^^^^^^^^^^^
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
BLOCK_PROCESSING_VELOCITY,
Expand Down
Loading