-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[testnet] Allow governance to control fees for Rococo <> Westend bridge #2139
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,18 @@ pub const WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX: u8 = 51; | |
|
||
decl_bridge_finality_runtime_apis!(bridge_hub_rococo); | ||
decl_bridge_messages_runtime_apis!(bridge_hub_rococo); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've moved all fee-related constants from
|
||
frame_support::parameter_types! { | ||
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Rococo | ||
/// BridgeHub. | ||
/// (initially was calculated by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) | ||
pub const BridgeHubRococoBaseXcmFeeInRocs: u128 = 1628875538; | ||
|
||
/// Transaction fee that is paid at the Rococo BridgeHub for delivering single inbound message. | ||
/// (initially was calculated by test `BridgeHubRococo::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) | ||
pub const BridgeHubRococoBaseDeliveryFeeInRocs: u128 = 6417262881; | ||
|
||
/// Transaction fee that is paid at the Rococo BridgeHub for delivering single outbound message confirmation. | ||
/// (initially was calculated by test `BridgeHubRococo::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`) | ||
pub const BridgeHubRococoBaseConfirmationFeeInRocs: u128 = 6159996668; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically incorrect ( |
||
).into()) | ||
) | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is the first PR, where this code is changed => no review for bridges changes yet. But I've just moved code around