-
Notifications
You must be signed in to change notification settings - Fork 798
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
Switch runtimes benchmarking for delivering to sibling parachains instead of Parent #7321
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -825,7 +825,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {} | |||||||||
|
||||||||||
parameter_types! { | ||||||||||
/// The asset ID for the asset that we use to pay for message delivery fees. | ||||||||||
pub FeeAssetId: AssetId = AssetId(xcm_config::WestendLocation::get()); | ||||||||||
pub FeeAssetId: AssetId = AssetId(xcm_config::AssetHubWestend::get()); | ||||||||||
/// The base fee for the message delivery fees. | ||||||||||
pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3); | ||||||||||
} | ||||||||||
|
@@ -1499,7 +1499,7 @@ impl_runtime_apis! { | |||||||||
fn metadata_versions() -> alloc::vec::Vec<u32> { | ||||||||||
Runtime::metadata_versions() | ||||||||||
} | ||||||||||
} | ||||||||||
}; | ||||||||||
|
||||||||||
impl sp_block_builder::BlockBuilder<Block> for Runtime { | ||||||||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult { | ||||||||||
|
@@ -1856,7 +1856,6 @@ impl_runtime_apis! { | |||||||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> { | ||||||||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError}; | ||||||||||
use sp_storage::TrackedStorageKey; | ||||||||||
|
||||||||||
use frame_system_benchmarking::Pallet as SystemBench; | ||||||||||
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench; | ||||||||||
impl frame_system_benchmarking::Config for Runtime { | ||||||||||
|
@@ -1871,14 +1870,15 @@ impl_runtime_apis! { | |||||||||
} | ||||||||||
|
||||||||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench; | ||||||||||
use xcm_config::{MaxAssetsIntoHolding, WestendLocation, AssetHubWestend, AssetHubId}; | ||||||||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {} | ||||||||||
|
||||||||||
parameter_types! { | ||||||||||
pub ExistentialDepositAsset: Option<Asset> = Some(( | ||||||||||
WestendLocation::get(), | ||||||||||
AssetHubWestend::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.
Suggested change
|
||||||||||
ExistentialDeposit::get() | ||||||||||
).into()); | ||||||||||
pub const RandomParaId: ParaId = ParaId::new(43211234); | ||||||||||
pub const SiblingAssetHubId: ParaId = ParaId::new(AssetHubId::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. AssetHub does not know any other sibling AssetHub,
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark; | ||||||||||
|
@@ -1893,34 +1893,34 @@ impl_runtime_apis! { | |||||||||
xcm_config::XcmConfig, | ||||||||||
ExistentialDepositAsset, | ||||||||||
PriceForSiblingParachainDelivery, | ||||||||||
RandomParaId, | ||||||||||
SiblingAssetHubId, | ||||||||||
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.
Suggested change
|
||||||||||
ParachainSystem, | ||||||||||
> | ||||||||||
); | ||||||||||
|
||||||||||
fn reachable_dest() -> Option<Location> { | ||||||||||
Some(Parent.into()) | ||||||||||
Some(AssetHubWestend::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. please, everywhere where you changed Location (location and not assetId)
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { | ||||||||||
// Relay/native token can be teleported between AH and Relay. | ||||||||||
Some(( | ||||||||||
Asset { | ||||||||||
fun: Fungible(ExistentialDeposit::get()), | ||||||||||
id: AssetId(Parent.into()) | ||||||||||
id: AssetId(AssetHubWestend::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. watch out, here
Suggested change
|
||||||||||
}, | ||||||||||
Parent.into(), | ||||||||||
AssetHubWestend::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.
Suggested change
|
||||||||||
)) | ||||||||||
} | ||||||||||
|
||||||||||
fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> { | ||||||||||
Some(( | ||||||||||
Asset { | ||||||||||
fun: Fungible(ExistentialDeposit::get()), | ||||||||||
id: AssetId(Parent.into()) | ||||||||||
id: AssetId(AssetHubWestend::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.
Suggested change
|
||||||||||
}, | ||||||||||
// AH can reserve transfer native token to some random parachain. | ||||||||||
ParentThen(Parachain(RandomParaId::get().into()).into()).into(), | ||||||||||
AssetHubWestend::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.
Suggested change
|
||||||||||
)) | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -1929,10 +1929,10 @@ impl_runtime_apis! { | |||||||||
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying | ||||||||||
// fees using teleported native token. | ||||||||||
// (We don't care that Relay doesn't accept incoming unknown AH local asset) | ||||||||||
let dest = Parent.into(); | ||||||||||
let dest = AssetHubWestend::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.
Suggested change
|
||||||||||
|
||||||||||
let fee_amount = EXISTENTIAL_DEPOSIT; | ||||||||||
let fee_asset: Asset = (Location::parent(), fee_amount).into(); | ||||||||||
let fee_asset: Asset = (AssetHubWestend::get(), fee_amount).into(); | ||||||||||
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.
Suggested change
|
||||||||||
|
||||||||||
let who = frame_benchmarking::whitelisted_caller(); | ||||||||||
// Give some multiple of the existential deposit | ||||||||||
|
@@ -1975,7 +1975,7 @@ impl_runtime_apis! { | |||||||||
|
||||||||||
fn get_asset() -> Asset { | ||||||||||
Asset { | ||||||||||
id: AssetId(Location::parent()), | ||||||||||
id: AssetId(AssetHubWestend::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.
Suggested change
|
||||||||||
fun: Fungible(ExistentialDeposit::get()), | ||||||||||
} | ||||||||||
} | ||||||||||
|
@@ -2015,19 +2015,20 @@ impl_runtime_apis! { | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
use xcm_config::{MaxAssetsIntoHolding, WestendLocation}; | ||||||||||
use pallet_xcm_benchmarks::asset_instance_from; | ||||||||||
|
||||||||||
impl pallet_xcm_benchmarks::Config for Runtime { | ||||||||||
type XcmConfig = xcm_config::XcmConfig; | ||||||||||
type AccountIdConverter = xcm_config::LocationToAccountId; | ||||||||||
type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper< | ||||||||||
xcm_config::XcmConfig, | ||||||||||
ExistentialDepositAsset, | ||||||||||
xcm_config::PriceForParentDelivery, | ||||||||||
>; | ||||||||||
type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< | ||||||||||
xcm_config::XcmConfig, | ||||||||||
ExistentialDepositAsset, | ||||||||||
PriceForSiblingParachainDelivery, | ||||||||||
SiblingAssetHubId, | ||||||||||
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.
Suggested change
|
||||||||||
ParachainSystem | ||||||||||
>; | ||||||||||
fn valid_destination() -> Result<Location, BenchmarkError> { | ||||||||||
Ok(WestendLocation::get()) | ||||||||||
Ok(AssetHubWestend::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.
Suggested change
|
||||||||||
} | ||||||||||
fn worst_case_holding(depositable_count: u32) -> XcmAssets { | ||||||||||
// A mix of fungible, non-fungible, and concrete assets. | ||||||||||
|
@@ -2042,7 +2043,7 @@ impl_runtime_apis! { | |||||||||
} | ||||||||||
}) | ||||||||||
.chain(core::iter::once(Asset { id: AssetId(Here.into()), fun: Fungible(u128::MAX) })) | ||||||||||
.chain(core::iter::once(Asset { id: AssetId(WestendLocation::get()), fun: Fungible(1_000_000 * UNITS) })) | ||||||||||
.chain(core::iter::once(Asset { id: AssetId(AssetHubWestend::get()), fun: Fungible(1_000_000 * UNITS) })) | ||||||||||
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.
Suggested change
|
||||||||||
.chain((0..holding_non_fungibles).map(|i| Asset { | ||||||||||
id: AssetId(GeneralIndex(i as u128).into()), | ||||||||||
fun: NonFungible(asset_instance_from(i)), | ||||||||||
|
@@ -2054,8 +2055,8 @@ impl_runtime_apis! { | |||||||||
|
||||||||||
parameter_types! { | ||||||||||
pub const TrustedTeleporter: Option<(Location, Asset)> = Some(( | ||||||||||
WestendLocation::get(), | ||||||||||
Asset { fun: Fungible(UNITS), id: AssetId(WestendLocation::get()) }, | ||||||||||
AssetHubWestend::get(), | ||||||||||
Asset { fun: Fungible(UNITS), id: AssetId(AssetHubWestend::get()) }, | ||||||||||
Comment on lines
+2058
to
+2059
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. we want to simulate scenario, where
Suggested change
|
||||||||||
)); | ||||||||||
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; | ||||||||||
// AssetHubWestend trusts AssetHubRococo as reserve for ROCs | ||||||||||
|
@@ -2183,8 +2184,7 @@ impl_runtime_apis! { | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
impl pallet_revive::ReviveApi<Block, AccountId, Balance, Nonce, BlockNumber> for Runtime | ||||||||||
{ | ||||||||||
impl pallet_revive::ReviveApi<Block, AccountId, Balance, Nonce, BlockNumber> for Runtime { | ||||||||||
fn balance(address: H160) -> U256 { | ||||||||||
Revive::evm_balance(&address) | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -64,6 +64,8 @@ use xcm_executor::XcmExecutor; | |||||
|
||||||
parameter_types! { | ||||||
pub const RootLocation: Location = Location::here(); | ||||||
pub const AssetHubId: u32 = 1000; | ||||||
pub const AssetHubWestend: Location = Parachain(AssetHubId::get()).into(); | ||||||
Comment on lines
+67
to
+68
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.
Suggested change
|
||||||
pub const WestendLocation: Location = Location::parent(); | ||||||
pub const GovernanceLocation: Location = Location::parent(); | ||||||
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH)); | ||||||
|
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.
no change here,
WestendLocation
meansLocation { parents: 1, interior: Here }
which represents relaychain native token from the parachain's perspective, which is WND (or DOT for Polkadot, KSM for Kusama...).