Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e8039f9
Fixes
gupnik Jun 27, 2023
7feb684
Removes unused import
gupnik Jun 28, 2023
8d79fc4
Uses Block and removes BlockNumber/Header from Chain
gupnik Jun 28, 2023
9d0ae3c
Fixes bridges
gupnik Jun 28, 2023
7c3078a
Fixes
gupnik Jun 28, 2023
49d5cdf
Removes unused import
gupnik Jun 28, 2023
acc6d51
Fixes build
gupnik Jun 28, 2023
acde948
Uses correct RelayBlock
gupnik Jun 28, 2023
2a281d6
Minor fix
gupnik Jun 28, 2023
1a27d2f
Fixes glutton-kusama
gupnik Jun 28, 2023
e36976f
Uses correct RelayBlock
gupnik Jun 28, 2023
0b817d5
Minor fix
gupnik Jun 28, 2023
6269914
Merge branch 'master' of github.com:paritytech/cumulus into gupnik/cr…
gupnik Jun 28, 2023
a05bbba
Fixes benchmark for pallet-bridge-parachains
gupnik Jun 29, 2023
1f89fa7
Adds appropriate constraints
gupnik Jun 29, 2023
d15fff0
Minor fixes
gupnik Jun 29, 2023
895c8fe
Removes unused import
gupnik Jun 29, 2023
0173ae2
Fixes integrity tests
gupnik Jun 29, 2023
5fcfab5
Minor fixes
gupnik Jun 29, 2023
bae8a0c
Updates trait bounds
gupnik Jul 11, 2023
9596411
Merge branch 'master' of github.com:paritytech/cumulus into gupnik/cr…
gupnik Jul 11, 2023
838e528
Uses custom bound for AsPrimitive
gupnik Jul 11, 2023
0b0f42f
Fixes trait bounds
gupnik Jul 11, 2023
c933bc2
Revert "Fixes trait bounds"
gupnik Jul 11, 2023
6c38e45
Revert "Uses custom bound for AsPrimitive"
gupnik Jul 11, 2023
c1b16ff
No AsPrimitive trait bound for now
gupnik Jul 11, 2023
f1facb6
Removes bounds on Number
gupnik Jul 12, 2023
8862191
Merge branch 'master' of github.com:paritytech/cumulus into gupnik/cr…
gupnik Jul 12, 2023
5d89f5f
Merge branch 'master' of github.com:paritytech/cumulus into gupnik/cr…
gupnik Jul 13, 2023
033de71
update lockfile for {"substrate", "polkadot"}
Jul 13, 2023
68ff02a
Formatting
gupnik Jul 13, 2023
d61bac6
".git/.scripts/commands/fmt/fmt.sh"
Jul 13, 2023
58f509a
Minor fix
gupnik Jul 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Uses custom bound for AsPrimitive"
This reverts commit 838e528.
  • Loading branch information
gupnik committed Jul 11, 2023
commit 6c38e45b2acb5f3ae30f5c64f393cfdae76bee49
5 changes: 1 addition & 4 deletions bridges/bin/runtime-common/src/refund_relayer_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ use pallet_transaction_payment::{Config as TransactionPaymentConfig, OnChargeTra
use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{
Block as BlockT, DispatchInfoOf, Get, Header as HeaderT, PostDispatchInfoOf,
SignedExtension, Zero,
},
traits::{Block as BlockT, Header as HeaderT, DispatchInfoOf, Get, PostDispatchInfoOf, SignedExtension, Zero},
transaction_validity::{
TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
},
Expand Down
11 changes: 7 additions & 4 deletions bridges/modules/parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,18 @@ pub mod pallet {
pub trait BoundedBridgeGrandpaConfig<I: 'static>:
pallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
{
type BridgedRelayChain: Chain<Hash = RelayBlockHash, Hasher = RelayBlockHasher>;
type BridgedRelayChain: Chain<
Hash = RelayBlockHash,
Hasher = RelayBlockHasher,
>;
}

impl<T, I: 'static> BoundedBridgeGrandpaConfig<I> for T
where
T: pallet_bridge_grandpa::Config<I>,
T::BridgedChain: Chain<Hash = RelayBlockHash, Hasher = RelayBlockHasher>,
<<T::BridgedChain as Chain>::Block as sp_runtime::traits::Block>::Header:
sp_runtime::traits::Header<Number = RelayBlockNumber>,
T::BridgedChain:
Chain<Hash = RelayBlockHash, Hasher = RelayBlockHasher>,
<<T::BridgedChain as Chain>::Block as sp_runtime::traits::Block>::Header: sp_runtime::traits::Header<Number = RelayBlockNumber>
{
type BridgedRelayChain = T::BridgedChain;
}
Expand Down
28 changes: 7 additions & 21 deletions bridges/primitives/runtime/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{weights::Weight, Parameter};
use num_traits::{AsPrimitive, Bounded, CheckedSub, SaturatingAdd, Zero};
use num_traits::{Bounded, CheckedSub, SaturatingAdd, Zero};
use sp_runtime::{
traits::{
AtLeast32Bit, AtLeast32BitUnsigned, Block as BlockT, Hash as HashT, Header as HeaderT,
Expand Down Expand Up @@ -90,10 +90,7 @@ impl<ChainCall: Encode> Encode for EncodedOrDecodedCall<ChainCall> {
}

/// Minimal Substrate-based chain representation that may be used from no_std environment.
pub trait Chain: Send + Sync + 'static
where
<<Self::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
pub trait Chain: Send + Sync + 'static {
/// A type that fulfills the abstract idea of what a Substrate hash is.
// Constraits come from the associated Hash type of `sp_runtime::traits::Header`
// See here for more info:
Expand Down Expand Up @@ -121,7 +118,8 @@ where
/// A type that fulfills the abstract idea of what a Substrate block is.
// See here for more info:
// https://crates.parity.io/sp_runtime/traits/trait.Block.html
type Block: Parameter + BlockT<Hash = Self::Hash> + MaybeSerialize;
type Block: Parameter + BlockT<Hash = Self::Hash> + MaybeSerialize
where Block::Header::Number: AsPrimitive<usize>;

/// The user account identifier type for the runtime.
type AccountId: Parameter
Expand Down Expand Up @@ -170,18 +168,14 @@ where
}

/// A trait that provides the type of the underlying chain.
pub trait UnderlyingChainProvider
where
<<<Self::Chain as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
pub trait UnderlyingChainProvider {
/// Underlying chain type.
type Chain: Chain;
}

impl<T> Chain for T
where
T: Send + Sync + 'static + UnderlyingChainProvider,
<<<T::Chain as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
type Hash = <T::Chain as Chain>::Hash;
type Hasher = <T::Chain as Chain>::Hasher;
Expand All @@ -201,10 +195,7 @@ where
}

/// Minimal parachain representation that may be used from no_std environment.
pub trait Parachain: Chain
where
<<<Self as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
pub trait Parachain: Chain {
/// Parachain identifier.
const PARACHAIN_ID: u32;
}
Expand All @@ -213,18 +204,13 @@ impl<T> Parachain for T
where
T: Chain + UnderlyingChainProvider,
<T as UnderlyingChainProvider>::Chain: Parachain,
<<<T as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
<<<T::Chain as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
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>
where
<<<Para as Chain>::Block as BlockT>::Header as HeaderT>::Number: AsPrimitive<usize>,
{
impl<Para: Parachain> frame_support::traits::Get<u32> for ParachainIdOf<Para> {
fn get() -> u32 {
Para::PARACHAIN_ID
}
Expand Down
3 changes: 2 additions & 1 deletion pallets/parachain-system/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use frame_support::{
traits::{OnFinalize, OnInitialize},
weights::Weight,
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use frame_system::RawOrigin;
use frame_system::pallet_prelude::BlockNumberFor;
use hex_literal::hex;
use relay_chain::HrmpChannelId;
use sp_core::{blake2_256, H256};
Expand Down
4 changes: 2 additions & 2 deletions parachains/runtimes/assets/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ use pallet_nfts::PalletFeatures;
pub use parachains_common as common;
use parachains_common::{
impls::{AssetsToBlockAuthor, DealWithFees},
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header,
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{
Expand Down
6 changes: 3 additions & 3 deletions parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ use pallet_nfts::PalletFeatures;
pub use parachains_common as common;
use parachains_common::{
impls::{AssetsToBlockAuthor, DealWithFees},
AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber,
Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance,
BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{
DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId, GovernanceLocation,
Expand Down
6 changes: 3 additions & 3 deletions parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
use pallet_nfts::PalletFeatures;
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber,
Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
Expand Down
3 changes: 2 additions & 1 deletion parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ pub fn complex_relay_extrinsic_works<Runtime, XcmConfig, HrmpChannelOpener, GPI,
.execute_with(|| {
let zero: BlockNumberFor<Runtime> = 0u32.into();
let genesis_hash = frame_system::Pallet::<Runtime>::block_hash(zero);
let mut header: HeaderFor<Runtime> = bp_test_utils::test_header(1u32.into());
let mut header: HeaderFor<Runtime> =
bp_test_utils::test_header(1u32.into());
header.set_parent_hash(genesis_hash);
executive_init_block(&header);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ use frame_system::{
};
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO,
SLOT_DURATION,
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};

Expand Down