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

feat: update xcm config #623

Merged
merged 11 commits into from
Jul 27, 2023
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.8.0"
version = "1.8.1"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
24 changes: 24 additions & 0 deletions integration-tests/src/cross_chain_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,27 @@ fn claim_asset(asset: MultiAsset, recipient: [u8; 32]) {
));
});
}

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

Hydra::execute_with(|| {
let message = VersionedXcm::V3(Xcm(vec![
WithdrawAsset((Here, 410000000000u128).into()),
BuyExecution {
fees: (Here, 400000000000u128).into(),
weight_limit: Unlimited,
},
]));

assert_noop!(
hydradx_runtime::PolkadotXcm::execute(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
Box::new(message),
Weight::from_ref_time(400_000_000_000)
),
pallet_xcm::Error::<hydradx_runtime::Runtime>::Filtered
);
});
}
2 changes: 1 addition & 1 deletion runtime/hydradx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx-runtime"
version = "168.0.0"
version = "169.0.0"
authors = ["GalacticCouncil"]
edition = "2021"
license = "Apache 2.0"
Expand Down
2 changes: 1 addition & 1 deletion runtime/hydradx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("hydradx"),
impl_name: create_runtime_str!("hydradx"),
authoring_version: 1,
spec_version: 168,
spec_version: 169,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
17 changes: 12 additions & 5 deletions runtime/hydradx/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit,
TakeWeightCredit, WithComputedOrigin,
};
use xcm_executor::{Config, XcmExecutor};

Expand All @@ -35,11 +35,18 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R

pub type Barrier = (
TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<Everything>,
// Expected responses are OK.
AllowKnownQueryResponses<PolkadotXcm>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
// Evaluate the barriers with the effective origin
WithComputedOrigin<
(
AllowTopLevelPaidExecutionFrom<Everything>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<Everything>,
),
UniversalLocation,
ConstU32<8>,
>,
);

parameter_types! {
Expand Down Expand Up @@ -197,7 +204,7 @@ impl pallet_xcm::Config for Runtime {
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecuteFilter = Nothing;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apopiak @dmoka this effectively breaks the exchange and send back assets scenario correct?

Copy link
Member

@mrq1911 mrq1911 Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is the case i would reconsider this change and at least specify some more permissive filter specific to this use-case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it makes sense to define the more permissive filter in the context of the ExchangeAsset stuff, not here.

type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
Expand Down
Loading