Skip to content

Commit

Permalink
Merge branch 'master' into tsv-disabling
Browse files Browse the repository at this point in the history
* master:
  Removed TODO from test-case for hard-coded delivery fee estimation (#2042)
  Expose collection attributes from `Inspect` trait (#1914)
  `polkadot-parachain-primitives` should not depend on `frame-support`. (#1897)
  [testnet] Align testnet system parachain runtimes using `RelayTreasuryLocation` and `SystemParachains` in the same way (#2023)
  Sort the benchmarks before listing them (#2026)
  publish pallet-root-testing (#2017)
  Contracts: Add benchmarks to include files (#2022)
  Small optimisation to `--profile dev` wasm builds (#1851)
  basic-authorship: Improve time recording and logging (#2010)
  Application Crypto and BEEFY Support for paired (ECDSA,BLS) crypto (#1815)
  [ci] Run check-rust-feature-propagation in pr and master (#2012)
  Improve features dev-ex (#1831)
  Remove obsolete comment. (#2008)
  • Loading branch information
ordian committed Oct 26, 2023
2 parents 42607ad + 21d36b7 commit 5a6ad28
Show file tree
Hide file tree
Showing 88 changed files with 1,052 additions and 480 deletions.
45 changes: 45 additions & 0 deletions .config/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version:
format: 1
# Minimum version of the binary that is expected to work. This is just for printing a nice error
# message when someone tries to use an older version.
binary: 0.13.2

# The examples in this file assume crate `A` to have a dependency on crate `B`.
workflows:
check:
- [
'lint',
# Check that `A` activates the features of `B`.
'propagate-feature',
# These are the features to check:
'--features=try-runtime,runtime-benchmarks,std',
# Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually.
'--left-side-feature-missing=ignore',
# Enabling this feature somehow pulls in two versions of `sp-runtime-interface` and makes it impossible to build that crate with `cargo b -p sp-runtime-interface`. We therefore disable it for now.
'--ignore-missing-propagate=sp-core/std:bandersnatch_vrfs/std',
# Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
'--left-side-outside-workspace=ignore',
# Some features imply that they activate a specific dependency as non-optional. Otherwise the default behaviour with a `?` is used.
'--feature-enables-dep=try-runtime:frame-try-runtime,runtime-benchmarks:frame-benchmarking',
# Actually modify the files and not just report the issues:
'--offline',
'--locked',
'--show-path',
'--quiet',
]
# Format the features into canonical format:
- ['format', 'features', '--offline', '--locked', '--quiet']
# Same as `check`, but with the `--fix` flag.
default:
- [ $check.0, '--fix' ]
- [ $check.1, '--fix' ]

# Will be displayed when any workflow fails:
help:
text: |
Polkadot-SDK uses the Zepter CLI to detect abnormalities in the feature configuration.
It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`.
Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you.
links:
- "https://github.com/paritytech/polkadot-sdk/issues/1831"
- "https://github.com/ggwpez/zepter"
21 changes: 4 additions & 17 deletions .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ check-try-runtime:
# experimental code may rely on try-runtime and vice-versa
- time cargo check --locked --all --features try-runtime,experimental

cargo-fmt-manifest:
stage: check
extends:
- .docker-env
- .common-refs
script:
- cargo install zepter --locked --version 0.11.0 -q -f --no-default-features && zepter --version
- echo "👉 Hello developer! If you see this CI check failing then it means that one of the your changes in a Cargo.toml file introduced ill-formatted or unsorted features. Please take a look at 'docs/STYLE_GUIDE.md#manifest-formatting' to find out more."
- zepter format features --check

# FIXME
.cargo-deny-licenses:
stage: check
Expand Down Expand Up @@ -91,17 +81,14 @@ job-starter:
script:
- echo ok

test-rust-feature-propagation:
check-rust-feature-propagation:
stage: check
extends:
- .kubernetes-env
- .test-pr-refs
- .common-refs
script:
- cargo install --locked --version 0.11.1 -q -f zepter && zepter --version
- echo "👉 Hello developer! If you see this CI check failing then it means that one of the crates is missing a feature for one of its dependencies. The output below tells you which feature needs to be added for which dependency to which crate. You can do this by modifying the Cargo.toml file. For more context see the MR where this check was introduced https://github.com/paritytech/substrate/pull/14660"
- zepter lint propagate-feature --feature try-runtime --left-side-feature-missing=ignore --workspace --feature-enables-dep="try-runtime:frame-try-runtime" --locked
- zepter lint propagate-feature --feature runtime-benchmarks --left-side-feature-missing=ignore --workspace --feature-enables-dep="runtime-benchmarks:frame-benchmarking" --locked
- zepter lint propagate-feature --feature std --left-side-feature-missing=ignore --workspace --locked
- cargo install --locked --version 0.13.2 -q -f zepter && zepter --version
- zepter run check

# More info can be found here: https://github.com/paritytech/polkadot/pull/5865
.check-runtime-migration:
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bridges/primitives/chain-polkadot-bulletin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
Expand Down
2 changes: 2 additions & 0 deletions bridges/primitives/relayers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ default = [ "std" ]
std = [
"bp-messages/std",
"bp-runtime/std",
"codec/std",
"frame-support/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
]
1 change: 1 addition & 0 deletions cumulus/pallets/parachain-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" }
[features]
default = [ "std" ]
std = [
"bytes/std",
"codec/std",
"cumulus-pallet-parachain-system-proc-macro/std",
"cumulus-primitives-core/std",
Expand Down
1 change: 1 addition & 0 deletions cumulus/pallets/xcmp-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ std = [
"log/std",
"polkadot-runtime-common/std",
"polkadot-runtime-parachains/std",
"rand_chacha/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
Expand Down
3 changes: 3 additions & 0 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder" }
[features]
default = [ "std" ]
std = [
"codec/std",
"cumulus-primitives-core/std",
"cumulus-primitives-utility/std",
"frame-support/std",
"frame-system/std",
"log/std",
"num-traits/std",
"pallet-asset-tx-payment/std",
"pallet-assets/std",
"pallet-authorship/std",
Expand All @@ -66,6 +68,7 @@ std = [
"polkadot-core-primitives/std",
"polkadot-primitives/std",
"rococo-runtime-constants/std",
"scale-info/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-io/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {

fn system_para_dest_assertions_incomplete(_t: RelayToSystemParaTest) {
AssetHubRococo::assert_dmp_queue_incomplete(
Some(Weight::from_parts(1_000_000_000, 0)),
Some(Weight::from_parts(57_185_000, 3504)),
Some(Error::UntrustedReserveLocation),
);
}
Expand All @@ -52,8 +52,8 @@ fn system_para_to_para_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;

AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
630_092_000,
6_196,
864_610_000,
8_799,
)));

assert_expected_events!(
Expand All @@ -77,8 +77,8 @@ fn system_para_to_para_assets_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;

AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
676_119_000,
6196,
864_610_000,
8799,
)));

assert_expected_events!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
AssetHubRococo::execute_with(|| {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;

AssetHubRococo::assert_xcmp_queue_success(Some(Weight::from_parts(2_176_414_000, 203_593)));
AssetHubRococo::assert_xcmp_queue_success(Some(Weight::from_parts(
15_594_564_000,
562_893,
)));

assert_expected_events!(
AssetHubRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ fn relay_dest_assertions_fail(_t: SystemParaToRelayTest) {
Rococo::assert_ump_queue_processed(
false,
Some(AssetHubRococo::para_id()),
Some(Weight::from_parts(148_433_000, 3_593)),
Some(Weight::from_parts(157_718_000, 3_593)),
);
}

fn para_origin_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;

AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
534_872_000,
7_133,
720_053_000,
7_203,
)));

AssetHubRococo::assert_parachain_system_ump_sent();
Expand All @@ -97,7 +97,7 @@ fn para_origin_assertions(t: SystemParaToRelayTest) {
fn para_dest_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;

AssetHubRococo::assert_dmp_queue_complete(Some(Weight::from_parts(165_592_000, 0)));
AssetHubRococo::assert_dmp_queue_complete(Some(Weight::from_parts(157_718_000, 3593)));

assert_expected_events!(
AssetHubRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ std = [
"polkadot-core-primitives/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"primitive-types/std",
"scale-info/std",
"sp-api/std",
"sp-block-builder/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ std = [
"polkadot-core-primitives/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"primitive-types/std",
"rococo-runtime-constants/std",
"scale-info/std",
"sp-api/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,13 @@ impl_runtime_apis! {
MultiAsset { fun: Fungible(UNITS), id: Concrete(TokenLocation::get()) },
));
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
// AssetHubRococo trusts AssetHubWococo as reserve for WOCs
pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some(
(
xcm_config::bridging::to_wococo::AssetHubWococo::get(),
MultiAsset::from((xcm_config::bridging::to_wococo::WocLocation::get(), 1000000000000 as u128))
)
);
}

impl pallet_xcm_benchmarks::fungible::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,8 @@ impl<Call> XcmWeightInfo<Call> for AssetHubRococoXcmWeight<Call> {
fn withdraw_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
}
// Currently there is no trusted reserve (`IsReserve = ()`),
// but we need this hack for `pallet_xcm::reserve_transfer_assets`
// (TODO) fix https://github.com/paritytech/polkadot/pull/7424
// (TODO) fix https://github.com/paritytech/polkadot/pull/7546
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
// TODO: if we change `IsReserve = ...` then use this line...
// TODO: or if remote weight estimation is fixed, then remove
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
hardcoded_weight.min(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
}
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
Expand Down Expand Up @@ -125,12 +117,8 @@ impl<Call> XcmWeightInfo<Call> for AssetHubRococoXcmWeight<Call> {
fn report_error(_query_response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::report_error()
}

fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
// Hardcoded till the XCM pallet is fixed
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
hardcoded_weight.min(weight)
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
}
fn deposit_reserve_asset(
assets: &MultiAssetFilter,
Expand Down
Loading

0 comments on commit 5a6ad28

Please sign in to comment.