-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Xcm bridge hub router v2 (backport to master branch) (#2312)
* copy new pallet (palle-xcm-bridge-hub-router) from dynamic-fees-v1 branch * added remaining traces of pallet-xcm-bridge-hub-router * added comment about sharing delivery fee factor between all bridges, opened by this chain * spelling * clippy
- Loading branch information
Showing
14 changed files
with
947 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[package] | ||
name = "pallet-xcm-bridge-hub-router" | ||
description = "Bridge hub interface for sibling/parent chains with dynamic fees support." | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2021" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } | ||
log = { version = "0.4.19", default-features = false } | ||
scale-info = { version = "2.8.0", default-features = false, features = ["bit-vec", "derive", "serde"] } | ||
|
||
# Bridge dependencies | ||
|
||
bp-xcm-bridge-hub-router = { path = "../../primitives/xcm-bridge-hub-router", default-features = false } | ||
|
||
# Substrate Dependencies | ||
|
||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } | ||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } | ||
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } | ||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } | ||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } | ||
|
||
# Polkadot Dependencies | ||
|
||
xcm = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } | ||
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false } | ||
|
||
[dev-dependencies] | ||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"bp-xcm-bridge-hub-router/std", | ||
"codec/std", | ||
"frame-benchmarking/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"log/std", | ||
"scale-info/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
"xcm/std", | ||
"xcm-builder/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking/runtime-benchmarks", | ||
"xcm-builder/runtime-benchmarks", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
"frame-system/try-runtime", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019-2021 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity Bridges Common. | ||
|
||
// Parity Bridges Common is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity Bridges Common is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! XCM bridge hub router pallet benchmarks. | ||
#![cfg(feature = "runtime-benchmarks")] | ||
|
||
use crate::{DeliveryFeeFactor, InitialFactor}; | ||
|
||
use frame_benchmarking::benchmarks_instance_pallet; | ||
use frame_support::traits::{Get, Hooks}; | ||
use sp_runtime::traits::Zero; | ||
|
||
/// Pallet we're benchmarking here. | ||
pub struct Pallet<T: Config<I>, I: 'static = ()>(crate::Pallet<T, I>); | ||
|
||
/// Trait that must be implemented by runtime to be able to benchmark pallet properly. | ||
pub trait Config<I: 'static>: crate::Config<I> { | ||
/// Fill up queue so it becomes congested. | ||
fn make_congested(); | ||
} | ||
|
||
benchmarks_instance_pallet! { | ||
on_initialize_when_non_congested { | ||
DeliveryFeeFactor::<T, I>::put(InitialFactor::get() + InitialFactor::get()); | ||
}: { | ||
crate::Pallet::<T, I>::on_initialize(Zero::zero()) | ||
} | ||
|
||
on_initialize_when_congested { | ||
DeliveryFeeFactor::<T, I>::put(InitialFactor::get() + InitialFactor::get()); | ||
T::make_congested(); | ||
}: { | ||
crate::Pallet::<T, I>::on_initialize(Zero::zero()) | ||
} | ||
} |
Oops, something went wrong.