Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Dec 16, 2023
1 parent a866123 commit bb287ee
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,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().all(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterByteFee::key())) ||
items
.iter()
.all(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterBaseFee::key())) =>
return true,
if items.iter().all(|(k, _)| {
k.eq(&bridging::XcmBridgeHubRouterByteFee::key()) |
k.eq(&bridging::XcmBridgeHubRouterBaseFee::key()) |
k.eq(&bridging::to_ethereum::BridgeHubEthereumBaseFeeInROC::key())
}) =>
{
return true
},
_ => (),
};

Expand Down Expand Up @@ -857,7 +860,8 @@ pub mod bridging {
/// (initially was calculated by test `OutboundQueue::calculate_fees` - ETH/ROC 1/400 and fee_per_gas 20 GWEI = 2200698000000 + *25%)
/// Needs to be more than fee calculated from DefaultFeeConfig FeeConfigRecord in snowbridge:parachain/pallets/outbound-queue/src/lib.rs
/// Polkadot uses 10 decimals, Kusama and Rococo 12 decimals.
pub const BridgeHubEthereumBaseFeeInROC: u128 = 2_750_872_500_000;
pub const DefaultBridgeHubEthereumBaseFeeInROC: u128 = 2_750_872_500_000;
pub storage BridgeHubEthereumBaseFeeInROC: u128 = DefaultBridgeHubEthereumBaseFeeInROC::get();
pub SiblingBridgeHubWithEthereumInboundQueueInstance: MultiLocation = MultiLocation::new(
1,
X2(
Expand Down
52 changes: 52 additions & 0 deletions cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,3 +865,55 @@ fn change_xcm_bridge_hub_router_byte_fee_by_governance_works() {
},
)
}

#[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()),
|| {
(
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_ethereum_base_fee_by_governance_works() {
asset_test_utils::test_cases::change_storage_constant_by_governance_works::<
Runtime,
bridging::to_ethereum::BridgeHubEthereumBaseFeeInROC,
Balance,
>(
collator_session_keys(),
1000,
Box::new(|call| RuntimeCall::System(call).encode()),
|| {
(
bridging::to_ethereum::BridgeHubEthereumBaseFeeInROC::key().to_vec(),
bridging::to_ethereum::BridgeHubEthereumBaseFeeInROC::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 bb287ee

Please sign in to comment.