Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6,490 changes: 3,914 additions & 2,576 deletions Cargo.lock

Large diffs are not rendered by default.

252 changes: 129 additions & 123 deletions Cargo.toml

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ frame-support.workspace = true
pallet-balances.workspace = true
sp-std.workspace = true
sp-core.workspace = true
sp-keyring.workspace = true
sp-runtime.workspace = true
sp-io.workspace = true
pallet-dispenser.workspace = true
Expand Down Expand Up @@ -79,7 +80,7 @@ pallet-aura.workspace = true
pallet-session.workspace = true
pallet-proxy-bonding.workspace = true
pallet-skip-feeless-payment.workspace = true
xcm-fee-payment-runtime-api.workspace = true
xcm-runtime-apis.workspace = true
hex-literal.workspace = true
hex.workspace = true
assets-common.workspace = true
Expand Down Expand Up @@ -152,8 +153,9 @@ std = [
"rococo-runtime/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"xcm/std",
"assets-common/std"
]
development-settings = [ "polimec-runtime/development-settings" ]
runtime-benchmarks = [
Expand Down Expand Up @@ -195,5 +197,7 @@ runtime-benchmarks = [
"rococo-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"assets-common/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks"
]
15 changes: 8 additions & 7 deletions integration-tests/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ sp-session = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
sp-std = { workspace = true }
sp-storage = { version = "21.0.0", default-features = false }
pallet-collator-selection = { version = "16.0.0", default-features = false }
sp-storage = { workspace = true }
pallet-collator-selection = { workspace = true }
# Polkadot
polkadot-primitives = { workspace = true }
pallet-xcm = { workspace = true }
Expand All @@ -83,9 +83,9 @@ cumulus-primitives-utility = { workspace = true }
parachain-info = { workspace = true }
parachains-common = { workspace = true }
polkadot-runtime-parachains = { workspace = true }
assets-common = { version = "0.14.0", default-features = false }
testnet-parachains-constants = { version = "7.0.0", default-features = false }
xcm-fee-payment-runtime-api = { version = "0.4.0", default-features = false }
assets-common = { workspace = true }
testnet-parachains-constants = { workspace = true }
xcm-runtime-apis = { workspace = true }

[features]
default = [ "std" ]
Expand Down Expand Up @@ -147,7 +147,7 @@ std = [
"testnet-parachains-constants/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm-fee-payment-runtime-api/std",
"xcm-runtime-apis/std",
"xcm/std",
]

Expand Down Expand Up @@ -182,7 +182,8 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-fee-payment-runtime-api/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks"
]

try-runtime = [
Expand Down
24 changes: 14 additions & 10 deletions integration-tests/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ use sp_api::impl_runtime_apis;
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Dispatchable},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
pub use sp_runtime::{traits::ConvertInto, MultiAddress, Perbill, Permill};
use sp_std::prelude::*;
use sp_std::{borrow::Cow, prelude::*};
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
Expand All @@ -86,7 +86,7 @@ use xcm::{
latest::prelude::{AssetId as AssetLocationId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_fee_payment_runtime_api::{
use xcm_runtime_apis::{
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
fees::Error as XcmPaymentApiError,
};
Expand Down Expand Up @@ -232,14 +232,14 @@ impl_opaque_keys! {

#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("penpal-parachain"),
impl_name: create_runtime_str!("penpal-parachain"),
spec_name: Cow::Borrowed("penpal-parachain"),
impl_name: Cow::Borrowed("penpal-parachain"),
authoring_version: 1,
spec_version: 1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
system_version: 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be bumped to system_version: 2 (?)

};

/// This determines the average expected block time that we are targeting.
Expand Down Expand Up @@ -398,6 +398,7 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
/// The type for recording an account's balance.
type Balance = Balance;
type DoneSlashHandler = ();
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type FreezeIdentifier = ();
Expand All @@ -423,6 +424,7 @@ impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
type WeightToFee = WeightToFee;
}

Expand Down Expand Up @@ -517,6 +519,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type ReservedDmpWeight = ReservedDmpWeight;
type ReservedXcmpWeight = ReservedXcmpWeight;
type RuntimeEvent = RuntimeEvent;
type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector<Self>;
type SelfParaId = parachain_info::Pallet<Runtime>;
type WeightInfo = ();
type XcmpMessageHandler = XcmpQueue;
Expand Down Expand Up @@ -634,6 +637,7 @@ impl pallet_asset_tx_payment::Config for Runtime {
AssetsToBlockAuthor<Runtime, pallet_assets::Instance1>,
>;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down Expand Up @@ -888,7 +892,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::fees::XcmPaymentApi<Block> for Runtime {
impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
let acceptable_assets = vec![AssetLocationId(xcm_config::RelayLocation::get())];
PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
Expand All @@ -901,11 +905,11 @@ impl_runtime_apis! {
Ok(WeightToFee::weight_to_fee(&weight))
},
Ok(asset_id) => {
log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!");
log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!");
Err(XcmPaymentApiError::AssetNotFound)
},
Err(_) => {
log::trace!(target: "xcm::xcm_fee_payment_runtime_api", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
Err(XcmPaymentApiError::VersionedConversionFailed)
}
}
Expand All @@ -920,7 +924,7 @@ impl_runtime_apis! {
}
}

impl xcm_fee_payment_runtime_api::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
use xcm_builder::InspectMessageQueues;
use xcm_executor::RecordXcm;
Expand Down
15 changes: 7 additions & 8 deletions integration-tests/penpal/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ use parachains_common::{xcm_config::AssetFeeAsExistentialDepositMultiplier, TREA
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::{impls::ToAuthor, xcm_sender::ExponentialPrice};
use sp_runtime::traits::{AccountIdConversion, ConvertInto, Identity, TryConvertInto};
use xcm::latest::prelude::*;
use xcm::{latest::prelude::*, v5::WESTEND_GENESIS_HASH};
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId, EnsureXcmOrigin,
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, LocalMint,
NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
StartsWith, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, StartsWith, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
};
use xcm_executor::{traits::JustTry, XcmExecutor};

Expand All @@ -60,7 +60,7 @@ parameter_types! {
// The Penpal runtime is utilized for testing with various environment setups.
// This storage item allows us to customize the `NetworkId` where Penpal is deployed.
// By default, it is set to `NetworkId::Rococo` and can be changed using `System::set_storage`.
pub storage RelayNetworkId: NetworkId = NetworkId::Westend;
pub storage RelayNetworkId: NetworkId = NetworkId::ByGenesis(WESTEND_GENESIS_HASH);
pub RelayNetwork: Option<NetworkId> = Some(RelayNetworkId::get());
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorLocation = [
Expand Down Expand Up @@ -328,8 +328,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTrap = PolkadotXcm;
type Barrier = Barrier;
type CallDispatcher = RuntimeCall;
type FeeManager =
XcmFeeManagerFromComponents<(), XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>>;
type FeeManager = XcmFeeManagerFromComponents<(), SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>>;
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type HrmpNewChannelOpenRequestHandler = ();
Expand Down
76 changes: 37 additions & 39 deletions integration-tests/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ use sp_arithmetic::{FixedU128, Percent};
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
use sp_core::{sr25519, storage::Storage, Pair, Public};
use sp_core::{crypto::get_public_from_string_or_panic, sr25519, storage::Storage};
use sp_runtime::{bounded_vec, BuildStorage, Perbill};
pub use xcm;
use xcm_emulator::{helpers::get_account_id_from_seed, Chain, Parachain};
use xcm_emulator::{Chain, Parachain};

pub const XCM_V2: u32 = 3;
pub const XCM_V3: u32 = 2;
Expand Down Expand Up @@ -60,11 +60,6 @@ fn polimec_inflation_config() -> polimec_runtime::pallet_parachain_staking::Infl
}
}

/// Helper function to generate a crypto pair from seed
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None).expect("static values are valid; qed").public()
}

pub struct Prices {
pub dot: FixedU128,
pub usdc: FixedU128,
Expand Down Expand Up @@ -153,20 +148,7 @@ pub mod accounts {
pub const FERDIE_STASH: &str = "Ferdie//stash";

pub fn init_balances() -> Vec<AccountId> {
vec![
get_account_id_from_seed::<sr25519::Public>(ALICE),
get_account_id_from_seed::<sr25519::Public>(BOB),
get_account_id_from_seed::<sr25519::Public>(CHARLIE),
get_account_id_from_seed::<sr25519::Public>(DAVE),
get_account_id_from_seed::<sr25519::Public>(EVE),
get_account_id_from_seed::<sr25519::Public>(FERDIE),
get_account_id_from_seed::<sr25519::Public>(ALICE_STASH),
get_account_id_from_seed::<sr25519::Public>(BOB_STASH),
get_account_id_from_seed::<sr25519::Public>(CHARLIE_STASH),
get_account_id_from_seed::<sr25519::Public>(DAVE_STASH),
get_account_id_from_seed::<sr25519::Public>(EVE_STASH),
get_account_id_from_seed::<sr25519::Public>(FERDIE_STASH),
]
sp_keyring::AccountKeyring::iter().map(|a| a.to_account_id()).collect()
}
}

Expand All @@ -175,22 +157,34 @@ pub mod collators {

pub fn invulnerables_asset_hub() -> Vec<(AccountId, AssetHubPolkadotAuraId)> {
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AssetHubPolkadotAuraId>("Alice")),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AssetHubPolkadotAuraId>("Bob")),
(
sp_keyring::AccountKeyring::Alice.to_account_id(),
get_public_from_string_or_panic::<AssetHubPolkadotAuraId>("Alice"),
),
(
sp_keyring::AccountKeyring::Bob.to_account_id(),
get_public_from_string_or_panic::<AssetHubPolkadotAuraId>("Bob"),
),
]
}

pub fn invulnerables() -> Vec<(AccountId, AuraId)> {
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), get_from_seed::<AuraId>("Alice")),
(get_account_id_from_seed::<sr25519::Public>("Bob"), get_from_seed::<AuraId>("Bob")),
(sp_keyring::AccountKeyring::Alice.to_account_id(), get_public_from_string_or_panic::<AuraId>("Alice")),
(sp_keyring::AccountKeyring::Bob.to_account_id(), get_public_from_string_or_panic::<AuraId>("Bob")),
]
}

pub fn initial_authorities() -> Vec<(AccountId, AuraId)> {
vec![
(get_account_id_from_seed::<sr25519::Public>("COLL_1"), get_from_seed::<AuraId>("COLL_1")),
(get_account_id_from_seed::<sr25519::Public>("COLL_2"), get_from_seed::<AuraId>("COLL_2")),
(
get_public_from_string_or_panic::<sr25519::Public>("COLL_1").into(),
get_public_from_string_or_panic::<AuraId>("COLL_1"),
),
(
get_public_from_string_or_panic::<sr25519::Public>("COLL_2").into(),
get_public_from_string_or_panic::<AuraId>("COLL_2"),
),
]
}
}
Expand All @@ -212,15 +206,15 @@ pub mod validators {
)> {
let seed = "Alice";
vec![(
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ImOnlineId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
get_from_seed::<AuthorityDiscoveryId>(seed),
get_from_seed::<BeefyId>(seed),
sp_keyring::AccountKeyring::AliceStash.to_account_id(),
sp_keyring::AccountKeyring::Alice.to_account_id(),
get_public_from_string_or_panic::<BabeId>(seed),
get_public_from_string_or_panic::<GrandpaId>(seed),
get_public_from_string_or_panic::<ImOnlineId>(seed),
get_public_from_string_or_panic::<ValidatorId>(seed),
get_public_from_string_or_panic::<AssignmentId>(seed),
get_public_from_string_or_panic::<AuthorityDiscoveryId>(seed),
get_public_from_string_or_panic::<BeefyId>(seed),
)]
}
}
Expand Down Expand Up @@ -282,6 +276,7 @@ pub mod polkadot {
)
})
.collect::<Vec<_>>(),
..Default::default()
},
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
Expand All @@ -300,7 +295,7 @@ pub mod polkadot {
pub mod penpal {
use super::*;
use crate::{ParaId, Penpal, PolkadotNet};
use xcm::v4::Parent;
use xcm::v5::Parent;
pub const PARA_ID: u32 = 6969;
pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT;

Expand Down Expand Up @@ -334,6 +329,7 @@ pub mod penpal {
)
})
.collect(),
..Default::default()
},
aura: Default::default(),
aura_ext: Default::default(),
Expand All @@ -342,7 +338,7 @@ pub mod penpal {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
sudo: penpal_runtime::SudoConfig { key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")) },
sudo: penpal_runtime::SudoConfig { key: Some(sp_keyring::AccountKeyring::Alice.to_account_id()) },
..Default::default()
};

Expand All @@ -355,7 +351,7 @@ pub mod polimec {
use super::*;
use crate::{PolimecNet, PolimecOrigin, PolimecRuntime};
use polimec_runtime::{BlockchainOperationTreasury, TreasuryAccount};
use xcm::v4::{Location, Parent};
use xcm::v5::{Location, Parent};
use xcm_emulator::TestExt;

pub const PARA_ID: u32 = 3344;
Expand Down Expand Up @@ -450,6 +446,7 @@ pub mod polimec {
(usdc_asset_id, "Local WETH".as_bytes().to_vec(), "WETH".as_bytes().to_vec(), 18),
],
accounts: vec![],
next_asset_id: None,
},
parachain_info: polimec_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), ..Default::default() },
session: polimec_runtime::SessionConfig {
Expand All @@ -463,6 +460,7 @@ pub mod polimec {
)
})
.collect(),
..Default::default()
},
aura: Default::default(),
aura_ext: Default::default(),
Expand Down
Loading