Skip to content

Commit

Permalink
Release pango-6021 (#1091)
Browse files Browse the repository at this point in the history
* Rewrite

* Bump runtime version and fix todo
  • Loading branch information
aurexav authored Mar 31, 2023
1 parent 7f707ca commit 0676cfd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 55 deletions.
2 changes: 0 additions & 2 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//! Crab runtime.
#![cfg_attr(not(feature = "std"), no_std)]
// TODO: address the unused crates in test.
#![cfg_attr(not(test), deny(unused_crate_dependencies))]
#![recursion_limit = "256"]

#[cfg(feature = "std")]
Expand Down
2 changes: 0 additions & 2 deletions runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//! Darwinia runtime.
#![cfg_attr(not(feature = "std"), no_std)]
// TODO: address the unused crates in test.
#![cfg_attr(not(test), deny(unused_crate_dependencies))]
#![recursion_limit = "256"]

#[cfg(feature = "std")]
Expand Down
28 changes: 13 additions & 15 deletions runtime/darwinia/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ impl xcm_builder::TakeRevenue for ToTreasury {

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct DarwiniaCall;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
call: RuntimeCall,
origin: RuntimeOrigin,
Expand All @@ -140,20 +140,18 @@ impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
if let Ok(raw_origin) =
TryInto::<frame_system::RawOrigin<AccountId>>::try_into(origin.clone().caller)
{
match (call.clone(), raw_origin) {
(
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) => {
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into())
.into(),
);
},
_ => {},
if let (
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) = (call.clone(), raw_origin)
{
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()).into(),
);
}
}

RuntimeCall::dispatch(call, origin)
}
}
Expand All @@ -167,7 +165,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type AssetTransactor = LocalAssetTransactor;
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = DarwiniaCall;
type CallDispatcher = XcmCallDispatcher;
type FeeManager = ();
type IsReserve = xcm_builder::NativeAsset;
type IsTeleporter = ();
Expand Down
4 changes: 1 addition & 3 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//! Pangolin runtime.
#![cfg_attr(not(feature = "std"), no_std)]
// TODO: address the unused crates in test.
#![cfg_attr(not(test), deny(unused_crate_dependencies))]
#![recursion_limit = "256"]

#[cfg(feature = "std")]
Expand Down Expand Up @@ -87,7 +85,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Pangolin2"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_0_2_0,
spec_version: 6_0_2_1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down
28 changes: 13 additions & 15 deletions runtime/pangolin/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ impl xcm_builder::TakeRevenue for ToTreasury {

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct DarwiniaCall;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
call: RuntimeCall,
origin: RuntimeOrigin,
Expand All @@ -140,20 +140,18 @@ impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
if let Ok(raw_origin) =
TryInto::<frame_system::RawOrigin<AccountId>>::try_into(origin.clone().caller)
{
match (call.clone(), raw_origin) {
(
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) => {
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into())
.into(),
);
},
_ => {},
if let (
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) = (call.clone(), raw_origin)
{
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()).into(),
);
}
}

RuntimeCall::dispatch(call, origin)
}
}
Expand All @@ -167,7 +165,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type AssetTransactor = LocalAssetTransactor;
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = DarwiniaCall;
type CallDispatcher = XcmCallDispatcher;
type FeeManager = ();
type IsReserve = xcm_builder::NativeAsset;
type IsTeleporter = ();
Expand Down
4 changes: 1 addition & 3 deletions runtime/pangoro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
//! Pangoro runtime.
#![cfg_attr(not(feature = "std"), no_std)]
// TODO: address the unused crates in test.
#![cfg_attr(not(test), deny(unused_crate_dependencies))]
#![recursion_limit = "256"]

#[cfg(feature = "std")]
Expand Down Expand Up @@ -87,7 +85,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Pangoro2"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_0_2_0,
spec_version: 6_0_2_1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down
28 changes: 13 additions & 15 deletions runtime/pangoro/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ impl xcm_builder::TakeRevenue for ToTreasury {

pub type XcmWeigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;

pub struct DarwiniaCall;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
pub struct XcmCallDispatcher;
impl xcm_executor::traits::CallDispatcher<RuntimeCall> for XcmCallDispatcher {
fn dispatch(
call: RuntimeCall,
origin: RuntimeOrigin,
Expand All @@ -140,20 +140,18 @@ impl xcm_executor::traits::CallDispatcher<RuntimeCall> for DarwiniaCall {
if let Ok(raw_origin) =
TryInto::<frame_system::RawOrigin<AccountId>>::try_into(origin.clone().caller)
{
match (call.clone(), raw_origin) {
(
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) => {
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into())
.into(),
);
},
_ => {},
if let (
RuntimeCall::EthereumXcm(pallet_ethereum_xcm::Call::transact { .. }),
frame_system::RawOrigin::Signed(account_id),
) = (call.clone(), raw_origin)
{
return RuntimeCall::dispatch(
call,
pallet_ethereum_xcm::Origin::XcmEthereumTransaction(account_id.into()).into(),
);
}
}

RuntimeCall::dispatch(call, origin)
}
}
Expand All @@ -167,7 +165,7 @@ impl xcm_executor::Config for XcmExecutorConfig {
type AssetTransactor = LocalAssetTransactor;
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = DarwiniaCall;
type CallDispatcher = XcmCallDispatcher;
type FeeManager = ();
type IsReserve = xcm_builder::NativeAsset;
type IsTeleporter = ();
Expand Down

0 comments on commit 0676cfd

Please sign in to comment.