diff --git a/runtime/shibuya/src/genesis_config.rs b/runtime/shibuya/src/genesis_config.rs index df10e1608..5bed42a53 100644 --- a/runtime/shibuya/src/genesis_config.rs +++ b/runtime/shibuya/src/genesis_config.rs @@ -197,6 +197,7 @@ pub fn default_config(para_id: u32) -> serde_json::Value { treasury: Default::default(), community_treasury: Default::default(), tx_pause: Default::default(), + safe_mode: Default::default(), }; serde_json::to_value(&config).expect("Could not build genesis config.") diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 990997a5f..15d011428 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -129,10 +129,9 @@ pub type Precompiles = ShibuyaPrecompiles::Hash, >; +parameter_types! { + pub const EnterDuration: BlockNumber = 4 * HOURS; + pub const EnterDepositAmount: Balance = 2_000_000 * SBY; + pub const ExtendDuration: BlockNumber = 2 * HOURS; + pub const ExtendDepositAmount: Balance = 1_000_000 * SBY; + pub const ReleaseDelay: u32 = 2 * DAYS; +} + +pub struct SafeModeWhitelistedCalls; +impl Contains for SafeModeWhitelistedCalls { + fn contains(call: &RuntimeCall) -> bool { + match call { + RuntimeCall::System(_) | RuntimeCall::SafeMode(_) | RuntimeCall::TxPause(_) => true, + _ => false, + } + } +} + +impl pallet_safe_mode::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RuntimeHoldReason = RuntimeHoldReason; + type WhitelistedCalls = SafeModeWhitelistedCalls; + type EnterDuration = EnterDuration; + type EnterDepositAmount = EnterDepositAmount; + type ExtendDuration = ExtendDuration; + type ExtendDepositAmount = ExtendDepositAmount; + type ForceEnterOrigin = EnsureRootWithSuccess>; + type ForceExtendOrigin = EnsureRootWithSuccess>; + type ForceExitOrigin = EnsureRoot; + type ForceDepositOrigin = EnsureRoot; + type ReleaseDelay = ReleaseDelay; + type Notify = (); + type WeightInfo = pallet_safe_mode::weights::SubstrateWeight; +} + impl pallet_tx_pause::Config for Runtime { - type RuntimeCall = RuntimeCall; + type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type PauseOrigin = EnsureRoot; // Authority required to pause transactions. type UnpauseOrigin = EnsureRoot; // Authority required to unpause transactions. - type WhitelistedCalls = (); + type WhitelistedCalls = (); type MaxNameLen = ConstU32<32>; // Maximum length of name, adjust as needed. type WeightInfo = pallet_tx_pause::weights::SubstrateWeight; // Weight information. } - - - impl fp_self_contained::SelfContainedCall for RuntimeCall { type SignedInfo = H160;