-
Notifications
You must be signed in to change notification settings - Fork 9
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
refactor(mainnet): xcm config #455
refactor(mainnet): xcm config #455
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## al3mart/refactor-mainnet-config #455 +/- ##
===================================================================
+ Coverage 74.94% 75.78% +0.84%
===================================================================
Files 83 83
Lines 16550 17127 +577
Branches 16550 17127 +577
===================================================================
+ Hits 12403 12980 +577
Misses 3884 3884
Partials 263 263
|
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; | ||
type MaxActiveOutboundChannels = ConstU32<128>; | ||
type MaxInboundSuspended = ConstU32<128>; | ||
type MaxPageSize = ConstU32<{ 103 * 1024 }>; |
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.
Max channel size in Polkadot:
hrmpChannelMaxTotalSize: 102,400
5b70d8c
to
9333fe6
Compare
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.
Looking good, left some comments.
will help with the PR that is blocking this PR as fast as I can
runtime/mainnet/src/config/xcm.rs
Outdated
@@ -34,6 +44,31 @@ parameter_types! { | |||
pub const RelayNetwork: Option<NetworkId> = Some(Polkadot); | |||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); | |||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())].into(); | |||
pub MessageQueueIdleServiceWeight: Weight = Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block; | |||
pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; | |||
pub TreasuryAccount: AccountId = PalletId(*b"treasury").into_account_truncating(); |
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.
Should this not be the one from pallet treasury?
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.
Yes, needs changing with the rebase. I should have left a comment here in GH. The description of the base PR notes that there are relevant changes out of the base branch, and that it needs a rebase to include those.
Leaving the rebase to do last so I can address all at once. Treasury's account, for instance, is not only used here.
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.
Now that you rebased pallet treasury into the base branch, can this not be immediately resolved?
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.
Nice, I did amend this during the rebase. Looks like I rolled back the changed along the way.
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.
9333fe6
to
5fa78c6
Compare
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.
looks good! Left a few tiny nitpicks and then good to approve (once the next PRs are merged in)
7b7df0f
to
95745b5
Compare
95745b5
to
73926d9
Compare
809c784
to
9b1f3e2
Compare
d644888
to
1610f34
Compare
FYI: I wanted to see if I could improve the integration tests changes but it couldn't compile locally. |
8700383
to
d63b78b
Compare
typos AssetFilter
unnecessary Fungibles
475d40e
to
d9ec3db
Compare
* refactor: integration tests mainnet xcm * fix: remove unused ED rebase fmt fmt
d9ec3db
to
8969363
Compare
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.
PR looking really good! A few last things that need addressing but then good to go!
integration-tests/src/lib.rs
Outdated
@@ -326,6 +327,18 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { | |||
let sender_balance_before = test.sender.balance; | |||
let receiver_balance_before = test.receiver.balance; | |||
|
|||
let delivery_fees = PopNetworkPara::execute_with(|| { |
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.
Could we move those to where it was initially positioned and check if the clones can be removed? I thought I did this but apparently made a mistake
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.
runtime/mainnet/src/config/xcm.rs
Outdated
@@ -34,6 +44,31 @@ parameter_types! { | |||
pub const RelayNetwork: Option<NetworkId> = Some(Polkadot); | |||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); | |||
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())].into(); | |||
pub MessageQueueIdleServiceWeight: Weight = Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block; | |||
pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; | |||
pub TreasuryAccount: AccountId = PalletId(*b"treasury").into_account_truncating(); |
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.
Now that you rebased pallet treasury into the base branch, can this not be immediately resolved?
runtime/mainnet/src/config/xcm.rs
Outdated
fn relay_as_relay_asset_reserve_fails() { | ||
let relay_asset = Asset::from((AssetId::from(Parent), Fungibility::from(100u128))); | ||
assert!(!TrustedReserves::contains(&relay_asset, &Parent.into())); | ||
mod xcm_configuration { |
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.
Since those tests do not belong to a pallet directly I would suggest to remove this submodule
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.
runtime/mainnet/src/config/xcm.rs
Outdated
mod xcm_executor_configuration { | ||
use super::*; | ||
|
||
mod reserves_config { |
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.
mod reserves_config { | |
mod reserves { |
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.
runtime/mainnet/src/config/xcm.rs
Outdated
} | ||
|
||
#[test] | ||
fn reserve_transfer_filter_only_allows_relay_asset_from_ah() { |
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.
Would like to see this test refactored into two tests. One for the filter, one passing.
Moreover, like I have said elsewhere too, I find the tests that use the Location::Parent
confusing. This should not be possible on our chain and thus causes confusion to me. Especially the passing test of an asset with location Location::Parent
on line 972
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.
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.
Still don't get it why we are testing for parent location. Also the second test now contains logic that is not specific to that test which only confused or distracts from what actually needs to be tested.
Rule of thumb I learned, tests should be as specific and simple as it can be to reduce the amount work required, as well as maintaining it. In addition, you want the tests to be specific so that it is super clear what is tested and why.
Co-authored-by: Daan van der Plas <[email protected]>
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.
Final suggestion to simplify the unit tests then happy to approve!
runtime/mainnet/src/config/xcm.rs
Outdated
} | ||
|
||
#[test] | ||
fn reserve_transfer_filter_contains_parent_asset() { |
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.
Remove
Co-authored-by: Daan van der Plas <[email protected]>
Co-authored-by: Daan van der Plas <[email protected]>
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.
Good job and thanks for the patience!
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.
LGTM! Thanks
Extends xcm config module including:
pallet_message_queue
cumulus_pallet_xcm
cumulus_pallet_xcmp_queue
And adding configuration unit tests for:
xcm_executor
pallet_xcm
TODOs:
XcmReserveTransferFilter
should be configured to only allow reserve transfers of relay native asset. refactor(xcm): UseNativeAssetFrom<T>
asXcmReserveTransferFilter
#459Notable configuration items are:
pallet_message_queue
cumulus_pallet_xcmp_queue
PriceForSiblingDelivery
is addressed in: #457xcm_executor
WaivedLocations
are removed fromFeeManager
config in: #456pallet_xcm
[sc-2205]