Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out credit purchase call #312

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Kusama chains: allow arbitrary XCM execution ([polkadot-fellows/runtimes#261](https://github.com/polkadot-fellows/runtimes/pull/261))
- Allow everything through XCM SafeCallFilter ([polkadot-fellows/runtimes#285](https://github.com/polkadot-fellows/runtimes/pull/285))
- Disable Coretime credit purchasing until we have the credit system implemented ([polkadot-fellows/runtimes#312](https://github.com/polkadot-fellows/runtimes/pull/312))

### Added

Expand Down
13 changes: 12 additions & 1 deletion system-parachains/coretime/coretime-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, TransformOrigin,
ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, EverythingBut,
InstanceFilter, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
Expand Down Expand Up @@ -170,9 +171,19 @@ parameter_types! {
pub const SS58Prefix: u8 = 2;
}

/// Filter out credit purchase calls until the credit system is implemented. Otherwise, users
/// may have chance of locking their funds forever on purchased credits they cannot use.
pub struct IsBrokerCreditPurchaseCall;
impl Contains<RuntimeCall> for IsBrokerCreditPurchaseCall {
fn contains(c: &RuntimeCall) -> bool {
matches!(c, RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }))
}
}

// Configure FRAME pallets to include in runtime.
#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = EverythingBut<IsBrokerCreditPurchaseCall>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The nonce type for storing how many extrinsics an account has signed.
Expand Down
Loading