Skip to content

Commit

Permalink
Merge branch 'master' into polkadot-v1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Roznovjak authored Sep 26, 2024
2 parents bdf96de + 22b151b commit 9e283e6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 109 deletions.
16 changes: 0 additions & 16 deletions integration-tests/src/call_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use frame_support::{
assert_ok,
sp_runtime::{FixedU128, Permill},
traits::Contains,
weights::Weight,
};
use polkadot_xcm::v3::prelude::*;
use polkadot_xcm::VersionedXcm;
Expand Down Expand Up @@ -238,21 +237,6 @@ fn calling_pallet_xcm_send_extrinsic_should_not_be_filtered_by_call_filter() {
});
}

#[test]
fn calling_pallet_xcm_extrinsic_should_be_filtered_by_call_filter() {
TestNet::reset();

Hydra::execute_with(|| {
// the values here don't need to make sense, all we need is a valid Call
let call = hydradx_runtime::RuntimeCall::PolkadotXcm(pallet_xcm::Call::execute {
message: Box::new(VersionedXcm::from(Xcm(vec![]))),
max_weight: Weight::zero(),
});

assert!(!hydradx_runtime::CallFilter::contains(&call));
});
}

#[test]
fn calling_orml_xcm_extrinsic_should_be_filtered_by_call_filter() {
TestNet::reset();
Expand Down
2 changes: 0 additions & 2 deletions runtime/hydradx/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ impl Contains<RuntimeCall> for CallFilter {
}

match call {
RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { .. }) => true,
// create and create2 are only allowed through RPC or Runtime API
RuntimeCall::EVM(pallet_evm::Call::create { .. }) => false,
RuntimeCall::EVM(pallet_evm::Call::create2 { .. }) => false,
RuntimeCall::PolkadotXcm(_) => false,
RuntimeCall::OrmlXcm(_) => false,
_ => true,
}
Expand Down
92 changes: 1 addition & 91 deletions runtime/hydradx/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Config for XcmConfig {
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = SafeCallFilter;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = xcm_builder::FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
Expand Down Expand Up @@ -440,93 +440,3 @@ pub type LocalAssetTransactor = ReroutingMultiCurrencyAdapter<
OmnipoolProtocolAccount,
TreasuryAccount,
>;

/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true;
}
}

// check the runtime call filter
if !CallFilter::contains(call) {
return false;
}

matches!(
call,
RuntimeCall::System(frame_system::Call::kill_prefix { .. } | frame_system::Call::set_heap_pages { .. })
| RuntimeCall::Timestamp(..)
| RuntimeCall::Balances(..)
| RuntimeCall::Treasury(..)
| RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. })
| RuntimeCall::Vesting(..)
| RuntimeCall::Proxy(..)
| RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { .. }
| pallet_collator_selection::Call::set_candidacy_bond { .. }
| pallet_collator_selection::Call::register_as_candidate { .. }
| pallet_collator_selection::Call::leave_intent { .. },
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. })
| RuntimeCall::Uniques(
pallet_uniques::Call::create { .. }
| pallet_uniques::Call::force_create { .. }
| pallet_uniques::Call::mint { .. }
| pallet_uniques::Call::burn { .. }
| pallet_uniques::Call::transfer { .. }
| pallet_uniques::Call::freeze { .. }
| pallet_uniques::Call::thaw { .. }
| pallet_uniques::Call::freeze_collection { .. }
| pallet_uniques::Call::thaw_collection { .. }
| pallet_uniques::Call::transfer_ownership { .. }
| pallet_uniques::Call::set_team { .. }
| pallet_uniques::Call::approve_transfer { .. }
| pallet_uniques::Call::cancel_approval { .. }
| pallet_uniques::Call::force_item_status { .. }
| pallet_uniques::Call::set_attribute { .. }
| pallet_uniques::Call::clear_attribute { .. }
| pallet_uniques::Call::set_metadata { .. }
| pallet_uniques::Call::clear_metadata { .. }
| pallet_uniques::Call::set_collection_metadata { .. }
| pallet_uniques::Call::clear_collection_metadata { .. }
| pallet_uniques::Call::set_accept_ownership { .. }
| pallet_uniques::Call::set_price { .. }
| pallet_uniques::Call::buy_item { .. },
) | RuntimeCall::Identity(
pallet_identity::Call::add_registrar { .. }
| pallet_identity::Call::set_identity { .. }
| pallet_identity::Call::clear_identity { .. }
| pallet_identity::Call::request_judgement { .. }
| pallet_identity::Call::cancel_request { .. }
| pallet_identity::Call::set_fee { .. }
| pallet_identity::Call::set_account_id { .. }
| pallet_identity::Call::set_fields { .. }
| pallet_identity::Call::provide_judgement { .. }
| pallet_identity::Call::kill_identity { .. }
| pallet_identity::Call::add_sub { .. }
| pallet_identity::Call::rename_sub { .. }
| pallet_identity::Call::remove_sub { .. }
| pallet_identity::Call::quit_sub { .. },
) | RuntimeCall::Omnipool(..)
| RuntimeCall::OmnipoolLiquidityMining(..)
| RuntimeCall::OTC(..)
| RuntimeCall::CircuitBreaker(..)
| RuntimeCall::Router(..)
| RuntimeCall::DCA(..)
| RuntimeCall::MultiTransactionPayment(..)
| RuntimeCall::Currencies(..)
| RuntimeCall::Tokens(..)
| RuntimeCall::OrmlXcm(..)
)
}
}

0 comments on commit 9e283e6

Please sign in to comment.