Skip to content

Commit

Permalink
Merge branch 'bko-bump-to-1.7' into sv-pk-bridge-snowbridge
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Feb 20, 2024
2 parents 83feb8b + 2cbd31b commit 82ddda2
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 81 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed the lowering of Asset Hub existential deposits.
- MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169)
- Upgrade dependencies to the `[email protected]` release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137))
- Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149))
- Upgrade dependencies to the `[email protected]` release ([polkadot-fellows/runtimes#159](https://github.com/polkadot-fellows/runtimes/pull/159))

### Removed
Expand Down
2 changes: 2 additions & 0 deletions relay/polkadot/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ pub mod xcm {
// The bodies corresponding to the Polkadot OpenGov Origins.
pub const FELLOWSHIP_ADMIN_INDEX: u32 = 1;
// The body corresponding to the Treasurer OpenGov track.
#[deprecated = "Will be removed after August 2024; Use `xcm::latest::BodyId::Treasury` \
instead"]
pub const TREASURER_INDEX: u32 = 2;
}
}
Expand Down
6 changes: 2 additions & 4 deletions relay/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ use frame_support::{
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use polkadot_runtime_constants::{
currency::CENTS,
system_parachain::*,
xcm::body::{FELLOWSHIP_ADMIN_INDEX, TREASURER_INDEX},
currency::CENTS, system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX,
};
use runtime_common::{
xcm_sender::{ChildParachainRouter, ExponentialPrice},
Expand Down Expand Up @@ -249,7 +247,7 @@ parameter_types! {
// FellowshipAdmin pluralistic body.
pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX);
// `Treasurer` pluralistic body.
pub const TreasurerBodyId: BodyId = BodyId::Index(TREASURER_INDEX);
pub const TreasurerBodyId: BodyId = BodyId::Treasury;
}

/// Type to convert the `GeneralAdmin` origin to a Plurality `Location` value.
Expand Down
32 changes: 32 additions & 0 deletions system-parachains/asset-hubs/asset-hub-kusama/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,38 @@ fn check_sane_weight_report_bridge_status() {
);
}

#[test]
fn change_xcm_bridge_hub_router_base_fee_by_governance_works() {
asset_test_utils::test_cases::change_storage_constant_by_governance_works::<
Runtime,
bridging::XcmBridgeHubRouterBaseFee,
Balance,
>(
collator_session_keys(),
1000,
Box::new(|call| RuntimeCall::System(call).encode()),
|| {
log::error!(
target: "bridges::estimate",
"`bridging::XcmBridgeHubRouterBaseFee` actual value: {} for runtime: {}",
bridging::XcmBridgeHubRouterBaseFee::get(),
<Runtime as frame_system::Config>::Version::get(),
);
(
bridging::XcmBridgeHubRouterBaseFee::key().to_vec(),
bridging::XcmBridgeHubRouterBaseFee::get(),
)
},
|old_value| {
if let Some(new_value) = old_value.checked_add(1) {
new_value
} else {
old_value.checked_sub(1).unwrap()
}
},
)
}

#[test]
fn change_xcm_bridge_hub_router_byte_fee_by_governance_works() {
asset_test_utils::test_cases::change_storage_constant_by_governance_works::<
Expand Down
19 changes: 11 additions & 8 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ use parachains_common::{
};

use sp_runtime::RuntimeDebug;
pub use system_parachains_constants::SLOT_DURATION;
use system_parachains_constants::{
polkadot::{consensus::*, currency::*, fee::WeightToFee, snowbridge::EthereumNetwork},
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
};
use xcm::latest::prelude::{AssetId, BodyId};
use xcm_config::{
DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId,
ForeignCreatorsSovereignAccountOf, GovernanceLocation, TrustBackedAssetsConvertedConcreteId,
Expand All @@ -125,7 +126,6 @@ pub use sp_runtime::BuildStorage;
// Polkadot imports
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::prelude::*;

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

Expand Down Expand Up @@ -1184,6 +1184,10 @@ impl_runtime_apis! {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use sp_storage::TrackedStorageKey;
use xcm::latest::prelude::{
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId,
NonFungible, Parent, ParentThen, Response, XCM_VERSION,
};

use frame_system_benchmarking::Pallet as SystemBench;
impl frame_system_benchmarking::Config for Runtime {
Expand All @@ -1200,7 +1204,6 @@ impl_runtime_apis! {
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

use xcm::latest::prelude::*;
use xcm_config::{DotLocation, MaxAssetsIntoHolding};
use pallet_xcm_benchmarks::asset_instance_from;

Expand Down Expand Up @@ -1304,7 +1307,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(DotLocation::get())
}
fn worst_case_holding(depositable_count: u32) -> Assets {
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets {
// A mix of fungible, non-fungible, and concrete assets.
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
let holding_fungibles = holding_non_fungibles - 1;
Expand Down Expand Up @@ -1369,7 +1372,7 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> {
Err(BenchmarkError::Skip)
}

Expand All @@ -1386,9 +1389,9 @@ impl_runtime_apis! {
Ok(DotLocation::get())
}

fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> {
let origin = DotLocation::get();
let assets: Assets = (AssetId(DotLocation::get()), 1_000 * UNITS).into();
let assets: xcm::v4::Assets = (AssetId(DotLocation::get()), 1_000 * UNITS).into();
let ticket = Location { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}
Expand Down Expand Up @@ -1433,7 +1436,7 @@ impl_runtime_apis! {
let bridged_asset_hub = xcm_config::bridging::to_kusama::AssetHubKusama::get();
let _ = PolkadotXcm::force_xcm_version(
RuntimeOrigin::root(),
Box::new(bridged_asset_hub),
Box::new(bridged_asset_hub.clone()),
XCM_VERSION,
).map_err(|e| {
log::error!(
Expand Down
Loading

0 comments on commit 82ddda2

Please sign in to comment.