mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
[testnet] Allow governance to control fees for Rococo <> Westend bridge (#2139)
Right now governance could only control byte-fee component of Rococo <> Westend message fees (paid at Asset Hubs). This PR changes it a bit: 1) governance now allowed to control both fee components - byte fee and base fee; 2) base fee now includes cost of "default" delivery and confirmation transactions, in addition to `ExportMessage` instruction cost.
This commit is contained in:
committed by
GitHub
parent
15a3483881
commit
0d3c67d96b
@@ -88,6 +88,7 @@ bp-asset-hub-westend = { path = "../../../../../bridges/primitives/chain-asset-h
|
||||
bp-asset-hub-wococo = { path = "../../../../../bridges/primitives/chain-asset-hub-wococo", default-features = false }
|
||||
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
|
||||
bp-bridge-hub-wococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false }
|
||||
bp-bridge-hub-westend = { path = "../../../../../bridges/primitives/chain-bridge-hub-westend", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
asset-test-utils = { path = "../test-utils" }
|
||||
@@ -177,6 +178,7 @@ std = [
|
||||
"bp-asset-hub-wococo/std",
|
||||
"bp-bridge-hub-rococo/std",
|
||||
"bp-bridge-hub-wococo/std",
|
||||
"bp-bridge-hub-westend/std",
|
||||
"codec/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-dmp-queue/std",
|
||||
|
||||
@@ -283,6 +283,9 @@ impl Contains<RuntimeCall> for SafeCallFilter {
|
||||
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())) ||
|
||||
items.iter().all(|(k, _)| k.eq(&Flavor::key())) =>
|
||||
return true,
|
||||
_ => (),
|
||||
@@ -760,6 +763,25 @@ pub mod bridging {
|
||||
|
||||
// common/shared parameters for Wococo/Rococo
|
||||
parameter_types! {
|
||||
/// Base price of every byte of the Rococo -> Westend message. Can be adjusted via
|
||||
/// governance `set_storage` call.
|
||||
///
|
||||
/// Default value is our estimation of the:
|
||||
///
|
||||
/// 1) an approximate cost of XCM execution (`ExportMessage` and surroundings) at Rococo bridge hub;
|
||||
///
|
||||
/// 2) the approximate cost of Rococo -> Westend message delivery transaction on Westend Bridge Hub,
|
||||
/// converted into ROCs using 1:1 conversion rate;
|
||||
///
|
||||
/// 3) the approximate cost of Rococo -> Westend message confirmation transaction on Rococo Bridge Hub.
|
||||
pub storage XcmBridgeHubRouterBaseFee: Balance =
|
||||
bp_bridge_hub_rococo::BridgeHubRococoBaseXcmFeeInRocs::get()
|
||||
.saturating_add(bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds::get())
|
||||
.saturating_add(bp_bridge_hub_rococo::BridgeHubRococoBaseConfirmationFeeInRocs::get());
|
||||
/// Price of every byte of the Rococo -> Westend message. Can be adjusted via
|
||||
/// governance `set_storage` call.
|
||||
pub storage XcmBridgeHubRouterByteFee: Balance = TransactionByteFee::get();
|
||||
|
||||
pub SiblingBridgeHubParaId: u32 = match Flavor::get() {
|
||||
RuntimeFlavor::Rococo => bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
|
||||
RuntimeFlavor::Wococo => bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID,
|
||||
@@ -768,8 +790,6 @@ pub mod bridging {
|
||||
/// Router expects payment with this `AssetId`.
|
||||
/// (`AssetId` has to be aligned with `BridgeTable`)
|
||||
pub XcmBridgeHubRouterFeeAssetId: AssetId = TokenLocation::get().into();
|
||||
/// Price per byte - can be adjusted via governance `set_storage` call.
|
||||
pub storage XcmBridgeHubRouterByteFee: Balance = TransactionByteFee::get();
|
||||
|
||||
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> =
|
||||
sp_std::vec::Vec::new().into_iter()
|
||||
@@ -814,7 +834,7 @@ pub mod bridging {
|
||||
// base delivery fee to local `BridgeHub`
|
||||
Some((
|
||||
XcmBridgeHubRouterFeeAssetId::get(),
|
||||
bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(),
|
||||
XcmBridgeHubRouterBaseFee::get(),
|
||||
).into())
|
||||
)
|
||||
];
|
||||
@@ -890,7 +910,7 @@ pub mod bridging {
|
||||
// base delivery fee to local `BridgeHub`
|
||||
Some((
|
||||
XcmBridgeHubRouterFeeAssetId::get(),
|
||||
bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(),
|
||||
XcmBridgeHubRouterBaseFee::get(),
|
||||
).into())
|
||||
)
|
||||
];
|
||||
@@ -966,7 +986,7 @@ pub mod bridging {
|
||||
// base delivery fee to local `BridgeHub`
|
||||
Some((
|
||||
XcmBridgeHubRouterFeeAssetId::get(),
|
||||
bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs::get(),
|
||||
XcmBridgeHubRouterBaseFee::get(),
|
||||
).into())
|
||||
)
|
||||
];
|
||||
|
||||
@@ -84,6 +84,7 @@ assets-common = { path = "../common", default-features = false }
|
||||
pallet-xcm-bridge-hub-router = { path = "../../../../../bridges/modules/xcm-bridge-hub-router", default-features = false }
|
||||
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
|
||||
bp-asset-hub-westend = { path = "../../../../../bridges/primitives/chain-asset-hub-westend", default-features = false }
|
||||
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
|
||||
bp-bridge-hub-westend = { path = "../../../../../bridges/primitives/chain-bridge-hub-westend", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -167,6 +168,7 @@ std = [
|
||||
"assets-common/std",
|
||||
"bp-asset-hub-rococo/std",
|
||||
"bp-asset-hub-westend/std",
|
||||
"bp-bridge-hub-rococo/std",
|
||||
"bp-bridge-hub-westend/std",
|
||||
"codec/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
|
||||
@@ -262,7 +262,10 @@ 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())) =>
|
||||
if items.iter().all(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterByteFee::key())) ||
|
||||
items
|
||||
.iter()
|
||||
.all(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterBaseFee::key())) =>
|
||||
return true,
|
||||
_ => (),
|
||||
};
|
||||
@@ -725,13 +728,30 @@ pub mod bridging {
|
||||
use sp_std::collections::btree_set::BTreeSet;
|
||||
|
||||
parameter_types! {
|
||||
/// Base price of every byte of the Westend -> Rococo message. Can be adjusted via
|
||||
/// governance `set_storage` call.
|
||||
///
|
||||
/// Default value is our estimation of the:
|
||||
///
|
||||
/// 1) an approximate cost of XCM execution (`ExportMessage` and surroundings) at Westend bridge hub;
|
||||
///
|
||||
/// 2) the approximate cost of Westend -> Rococo message delivery transaction on Rococo Bridge Hub,
|
||||
/// converted into WNDs using 1:1 conversion rate;
|
||||
///
|
||||
/// 3) the approximate cost of Westend -> Rococo message confirmation transaction on Westend Bridge Hub.
|
||||
pub storage XcmBridgeHubRouterBaseFee: Balance =
|
||||
bp_bridge_hub_westend::BridgeHubWestendBaseXcmFeeInWnds::get()
|
||||
.saturating_add(bp_bridge_hub_rococo::BridgeHubRococoBaseDeliveryFeeInRocs::get())
|
||||
.saturating_add(bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds::get());
|
||||
/// Price of every byte of the Westend -> Rococo message. Can be adjusted via
|
||||
/// governance `set_storage` call.
|
||||
pub storage XcmBridgeHubRouterByteFee: Balance = TransactionByteFee::get();
|
||||
|
||||
pub SiblingBridgeHubParaId: u32 = bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID;
|
||||
pub SiblingBridgeHub: MultiLocation = MultiLocation::new(1, X1(Parachain(SiblingBridgeHubParaId::get())));
|
||||
/// Router expects payment with this `AssetId`.
|
||||
/// (`AssetId` has to be aligned with `BridgeTable`)
|
||||
pub XcmBridgeHubRouterFeeAssetId: AssetId = WestendLocation::get().into();
|
||||
/// Price per byte - can be adjusted via governance `set_storage` call.
|
||||
pub storage XcmBridgeHubRouterByteFee: Balance = TransactionByteFee::get();
|
||||
|
||||
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> =
|
||||
sp_std::vec::Vec::new().into_iter()
|
||||
@@ -774,7 +794,7 @@ pub mod bridging {
|
||||
// base delivery fee to local `BridgeHub`
|
||||
Some((
|
||||
XcmBridgeHubRouterFeeAssetId::get(),
|
||||
bp_asset_hub_westend::BridgeHubWestendBaseFeeInWnds::get(),
|
||||
XcmBridgeHubRouterBaseFee::get(),
|
||||
).into())
|
||||
)
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user