Skip to content

Commit

Permalink
Merge pull request #623 from galacticcouncil/xcm-config
Browse files Browse the repository at this point in the history
feat: update xcm config
  • Loading branch information
Roznovjak authored Jul 27, 2023
2 parents 3feaf40 + e2c4be3 commit 1b58960
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
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;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
Expand Down

0 comments on commit 1b58960

Please sign in to comment.