BridgeHubRococo/Wococo nits + updated subtree (#2572)

* Nits (merge before separatelly)

* Small cosmetics for Rococo/Wococo bridge local run

* Squashed 'bridges/' changes from 04b3dda6aa..5fc377ab34

5fc377ab34 Support for kusama-polkadot relaying (#2128)
01f4b7f1ba Fix clippy warnings (#2127)
696ff1c368 BHK/P alignments (#2115)
2a66aa3248 Small fixes (#2126)
7810f1a988 Cosmetics (#2124)
daf250f69c Remove some `expect()` statements (#2123)
1c5fba8274 temporarily remove balance guard (#2121)
3d0e547361 Propagate message receival confirmation errors (#2116)
1c33143f07 Propagate message verification errors (#2114)
b075b00910 Bump time from 0.3.20 to 0.3.21
51a3a51618 Bump serde from 1.0.160 to 1.0.162
da88d044a6 Bump clap from 4.2.5 to 4.2.7
cdca322cd6 Bump sysinfo from 0.28.4 to 0.29.0

git-subtree-dir: bridges
git-subtree-split: 5fc377ab34f7dfd3293099c5feec49255e827812

* Fix

* Allow to change storage constants (DeliveryReward, RequiredStakeForStakeAndSlash) + tests

* Clippy

* New SA for RO/WO

* Squashed 'bridges/' changes from 5fc377ab34..0f6091d481

0f6091d481 Bump polkadot/substrate (#2134)
9233f0a337 Bump tokio from 1.28.0 to 1.28.1
a29c1caa93 Bump serde from 1.0.162 to 1.0.163

git-subtree-dir: bridges
git-subtree-split: 0f6091d48184ebb4f75cb3089befa6b92cf37335
This commit is contained in:
Branislav Kontur
2023-05-17 00:33:30 +02:00
committed by GitHub
parent 90de06876a
commit 17b2e1b300
41 changed files with 770 additions and 619 deletions
@@ -232,6 +232,14 @@ where
const PARACHAIN_ID: u32 = <<T as UnderlyingChainProvider>::Chain as Parachain>::PARACHAIN_ID;
}
/// Adapter for `Get<u32>` to access `PARACHAIN_ID` from `trait Parachain`
pub struct ParachainIdOf<Para>(sp_std::marker::PhantomData<Para>);
impl<Para: Parachain> frame_support::traits::Get<u32> for ParachainIdOf<Para> {
fn get() -> u32 {
Para::PARACHAIN_ID
}
}
/// Underlying chain type.
pub type UnderlyingChainOf<C> = <C as UnderlyingChainProvider>::Chain;
+15 -5
View File
@@ -31,11 +31,11 @@ use sp_std::{convert::TryFrom, fmt::Debug, ops::RangeInclusive, vec, vec::Vec};
pub use chain::{
AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, EncodedOrDecodedCall, HashOf,
HasherOf, HeaderOf, IndexOf, Parachain, SignatureOf, TransactionEraOf, UnderlyingChainOf,
UnderlyingChainProvider,
HasherOf, HeaderOf, IndexOf, Parachain, ParachainIdOf, SignatureOf, TransactionEraOf,
UnderlyingChainOf, UnderlyingChainProvider,
};
pub use frame_support::storage::storage_prefix as storage_value_final_key;
use num_traits::{CheckedAdd, CheckedSub, One};
use num_traits::{CheckedAdd, CheckedSub, One, SaturatingAdd, Zero};
pub use storage_proof::{
record_all_keys as record_all_trie_keys, Error as StorageProofError,
ProofSize as StorageProofSize, RawStorageProof, StorageProofChecker,
@@ -95,7 +95,7 @@ pub const BRIDGE_HUB_WOCOCO_CHAIN_ID: ChainId = *b"bhwo";
pub const BRIDGE_HUB_KUSAMA_CHAIN_ID: ChainId = *b"bhks";
/// BridgeHubPolkadot chain id.
pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhwo";
pub const BRIDGE_HUB_POLKADOT_CHAIN_ID: ChainId = *b"bhpd";
/// Generic header Id.
#[derive(
@@ -527,17 +527,27 @@ impl<T> Debug for StrippableError<T> {
pub trait RangeInclusiveExt<Idx> {
/// Computes the length of the `RangeInclusive`, checking for underflow and overflow.
fn checked_len(&self) -> Option<Idx>;
/// Computes the length of the `RangeInclusive`, saturating in case of underflow or overflow.
fn saturating_len(&self) -> Idx;
}
impl<Idx> RangeInclusiveExt<Idx> for RangeInclusive<Idx>
where
Idx: CheckedSub + CheckedAdd + One,
Idx: CheckedSub + CheckedAdd + SaturatingAdd + One + Zero,
{
fn checked_len(&self) -> Option<Idx> {
self.end()
.checked_sub(self.start())
.and_then(|len| len.checked_add(&Idx::one()))
}
fn saturating_len(&self) -> Idx {
let len = match self.end().checked_sub(self.start()) {
Some(len) => len,
None => return Idx::zero(),
};
len.saturating_add(&Idx::one())
}
}
#[cfg(test)]