diff --git a/CHANGELOG.md b/CHANGELOG.md index 60e970df2b..1256bc4ea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Location conversion tests for relays and parachains ([polkadot-fellows/runtimes#487](https://github.com/polkadot-fellows/runtimes/pull/487)) +### Changed + +- Remove Snowbridge create agent and channel extrinsics. ([polkadot-fellows/runtimes#506](https://github.com/polkadot-fellows/runtimes/pull/506)) + Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs index c35ac3b567..4d94458662 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/snowbridge.rs @@ -135,14 +135,14 @@ fn create_agent() { BridgeHubPolkadot::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; - // Check that a message was sent to Ethereum to create the agent - assert_expected_events!( - BridgeHubPolkadot, - vec![ - RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateAgent { - .. - }) => {}, - ] + + let events = BridgeHubPolkadot::events(); + assert!( + events.iter().any(|event| !matches!( + event, + RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateAgent { .. }) + )), + "Create agent event found while not expected." ); }); } @@ -215,14 +215,13 @@ fn create_channel() { BridgeHubPolkadot::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; - // Check that the Channel was created - assert_expected_events!( - BridgeHubPolkadot, - vec![ - RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateChannel { - .. - }) => {}, - ] + let events = BridgeHubPolkadot::events(); + assert!( + events.iter().any(|event| !matches!( + event, + RuntimeEvent::EthereumSystem(snowbridge_pallet_system::Event::CreateChannel { .. }) + )), + "Create channel event found while not expected." ); }); } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 8579c12c1f..83baa66f87 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -59,8 +59,8 @@ use frame_support::{ genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ - tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, - Everything, TransformOrigin, + tokens::imbalance::ResolveTo, ConstBool, ConstU32, ConstU64, ConstU8, Contains, + EitherOfDiverse, TransformOrigin, }, weights::{ConstantMultiplier, Weight, WeightToFee as _}, PalletId, @@ -226,6 +226,23 @@ parameter_types! { pub const SS58Prefix: u8 = 0; } +pub struct BaseFilter; +impl Contains for BaseFilter { + fn contains(call: &RuntimeCall) -> bool { + // Disallow these Snowbridge system calls. + if matches!( + call, + RuntimeCall::EthereumSystem(snowbridge_pallet_system::Call::create_agent { .. }) + ) || matches!( + call, + RuntimeCall::EthereumSystem(snowbridge_pallet_system::Call::create_channel { .. }) + ) { + return false; + } + true + } +} + // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { @@ -263,7 +280,7 @@ impl frame_system::Config for Runtime { /// The weight of database operations that the runtime can invoke. type DbWeight = RocksDbWeight; /// The basic call filter to use in dispatchable. - type BaseCallFilter = Everything; + type BaseCallFilter = BaseFilter; /// Weight information for the extrinsics of this pallet. type SystemWeightInfo = weights::frame_system::WeightInfo; /// Block & extrinsics weights: base values and limits.