Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Allow to change XcmBridgeHubRouterByteFee by governance
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Aug 14, 2023
1 parent e5a03a3 commit 025f109
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions parachains/runtimes/assets/asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ try-runtime = [
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"pallet-state-trie-migration/try-runtime",
"pallet-xcm-bridge-hub-router/try-runtime",
]
std = [
"codec/std",
Expand Down
12 changes: 11 additions & 1 deletion parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ impl Contains<RuntimeCall> for SafeCallFilter {
}
}

// Allow to change dedicated storage items (called by governance-like)
match call {
RuntimeCall::System(frame_system::Call::set_storage { items })
if items.iter().any(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterByteFee::key())) =>
return true,
_ => (),
};

matches!(
call,
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
Expand Down Expand Up @@ -572,7 +580,9 @@ pub mod bridging {
.add_equals(AssetHubPolkadot::get().interior.split_global().expect("invalid configuration for AssetHubPolkadot").1),
// and nothing else
BridgeHubKusama::get(),
None
// base delivery fee to local `BridgeHub`
// (initially was calculated `170733333` + 10% by test `BridgeHubKusama::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
Some((XcmBridgeHubRouterFeeAssetId::get(), 187806666).into())
)
];

Expand Down
26 changes: 26 additions & 0 deletions parachains/runtimes/assets/asset-hub-kusama/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,3 +778,29 @@ fn xcm_reserve_transfer_filter_works() {
}
})
}

#[test]
fn change_xcm_bridge_hub_router_byte_fee_by_governance_works() {
asset_test_utils::test_cases::change_storage_constant_by_governance_works::<
Runtime,
bridging::XcmBridgeHubRouterByteFee,
Balance,
>(
collator_session_keys(),
1000,
Box::new(|call| RuntimeCall::System(call).encode()),
|| {
(
bridging::XcmBridgeHubRouterByteFee::key().to_vec(),
bridging::XcmBridgeHubRouterByteFee::get(),
)
},
|old_value| {
if let Some(new_value) = old_value.checked_add(1) {
new_value
} else {
old_value.checked_sub(1).unwrap()
}
},
)
}

0 comments on commit 025f109

Please sign in to comment.