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

Mitigate coretime auto-renew benchmarked weights issues #6

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
2 changes: 1 addition & 1 deletion system-parachains/coretime/coretime-kusama/src/coretime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,6 @@ impl pallet_broker::Config for Runtime {
type PalletId = BrokerPalletId;
type AdminOrigin = EnsureRoot<AccountId>;
type SovereignAccountOf = SovereignAccountOf;
type MaxAutoRenewals = ConstU32<100>;
type MaxAutoRenewals = ConstU32<0>;
type PriceAdapter = pallet_broker::CenterTargetPrice<Balance>;
}
18 changes: 13 additions & 5 deletions system-parachains/coretime/coretime-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,27 @@ parameter_types! {
pub const SS58Prefix: u8 = 2;
}

/// Filter out credit purchase calls until the credit system is implemented. Otherwise, users
/// Filter:
/// - 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 {
/// - Auto-renew functionality until resolution of polkadot-sdk issue
/// [#6474](https://github.com/paritytech/polkadot-sdk/issues/6474)
pub struct IsFilteredBrokerCall;
impl Contains<RuntimeCall> for IsFilteredBrokerCall {
fn contains(c: &RuntimeCall) -> bool {
matches!(c, RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }))
matches!(
c,
RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
RuntimeCall::Broker(pallet_broker::Call::enable_auto_renew { .. }) |
RuntimeCall::Broker(pallet_broker::Call::disable_auto_renew { .. })
)
}
}

// 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>;
type BaseCallFilter = EverythingBut<IsFilteredBrokerCall>;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The nonce type for storing how many extrinsics an account has signed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,6 @@ impl pallet_broker::Config for Runtime {
type PalletId = BrokerPalletId;
type AdminOrigin = EnsureRoot<AccountId>;
type SovereignAccountOf = SovereignAccountOf;
type MaxAutoRenewals = ConstU32<100>;
type MaxAutoRenewals = ConstU32<0>;
type PriceAdapter = pallet_broker::CenterTargetPrice<Balance>;
}
14 changes: 9 additions & 5 deletions system-parachains/coretime/coretime-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,21 @@ parameter_types! {
pub const SS58Prefix: u8 = 0;
}

/// 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. Also filter the interlace call until the relay can support this fully.
/// Filter:
/// - 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.
/// - The interlace call until the relay can support this fully
/// - Auto-renew functionality until resolution of polkadot-sdk issue
/// [#6474](https://github.com/paritytech/polkadot-sdk/issues/6474)
pub struct IsFilteredBrokerCall;
impl Contains<RuntimeCall> for IsFilteredBrokerCall {
fn contains(c: &RuntimeCall) -> bool {
matches!(
c,
RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
RuntimeCall::Broker(pallet_broker::Call::interlace { .. })
RuntimeCall::Broker(pallet_broker::Call::interlace { .. }) |
RuntimeCall::Broker(pallet_broker::Call::enable_auto_renew { .. }) |
RuntimeCall::Broker(pallet_broker::Call::disable_auto_renew { .. })
)
}
}
Expand Down