diff --git a/.githooks/README.md b/.githooks/README.md new file mode 100644 index 00000000..278bdbc7 --- /dev/null +++ b/.githooks/README.md @@ -0,0 +1,24 @@ +# Git Hooks + +A pre-push hook which checks formatting of Rust files. Additional checks may be added in the future. + +# Prerequisites + +The following prerequisites are required: + +## Rust Nightly + +The nightly version of Rust provides additional formatting benefits over the stable version. + +```shell +rustup toolchain install nightly --profile minimal --component rustfmt +``` + +# Installation + +Use the following command in the root directory of the local repository to configure Git to use the hooks: + +```shell +git config core.hooksPath .githooks +``` + diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 00000000..babdb994 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,14 @@ +#!/bin/sh + +set -eu + +# Check Rust formatting +if ! cargo +nightly fmt --all -- --check +then + echo "There are some code style issues." + # shellcheck disable=SC2006 + echo "Run 'cargo +nightly fmt --all' first." + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a56a6bfb..35a0766f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,25 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: "./.github/actions/init" + - name: Check formatting - run: cargo +stable fmt --all -- --check + run: | + rustup toolchain install nightly --profile minimal --component rustfmt + cargo +nightly fmt --all -- --check + + - name: Check manifests + run: | + cargo install taplo-cli --locked + taplo format --check + + - name: Check features + run: | + cargo install zepter --locked + 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 + zepter format features check: needs: lint @@ -33,6 +50,7 @@ jobs: permissions: checks: write env: + RUSTFLAGS: "-Wmissing_docs" SKIP_WASM_BUILD: 1 steps: - uses: actions/checkout@v4 diff --git a/.rustfmt.toml b/.rustfmt.toml index c3421539..8743bd4c 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,24 +1,24 @@ -# Basic +# Non-default formatting configuration options: use with `cargo +nightly fmt --all` +binop_separator = "Back" +chain_width = 80 +combine_control_expr = false +comment_width = 100 +condense_wildcard_suffixes = true edition = "2021" +format_code_in_doc_comments = true +format_strings = true +group_imports = "StdExternalCrate" hard_tabs = true -max_width = 100 -use_small_heuristics = "Max" -# Imports imports_granularity = "Crate" -reorder_imports = true -# Consistency -newline_style = "Unix" -# Misc -chain_width = 80 -spaces_around_ranges = false -binop_separator = "Back" -reorder_impl_items = false -match_arm_leading_pipes = "Preserve" match_arm_blocks = false match_block_trailing_comma = true -trailing_comma = "Vertical" +newline_style = "Unix" +normalize_comments = true +reorder_impl_items = true trailing_semicolon = false +unstable_features = true use_field_init_shorthand = true -# Format comments -comment_width = 100 +# Uses max_width or its default value (100) if not specified. +use_small_heuristics = "Max" +use_try_shorthand = true wrap_comments = true diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 00000000..ea64cf51 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,17 @@ +# all options https://taplo.tamasfe.dev/configuration/formatter-options.html + +exclude = [ "networks/**", "target/**" ] + +# global rules +[formatting] +array_auto_collapse = false +array_auto_expand = true +compact_arrays = false # zepter compatibility +indent_string = " " # tab +inline_table_expand = false +reorder_arrays = true +reorder_keys = true + +[[rule]] +include = [ "Cargo.toml" ] +keys = [ "workspace.dependencies" ] diff --git a/Cargo.toml b/Cargo.toml index 19d5b011..8cd3f269 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,89 +2,73 @@ panic = "unwind" [profile.production] +codegen-units = 1 inherits = "release" lto = true -codegen-units = 1 [workspace.package] -authors = ["R0GUE "] +authors = [ "R0GUE " ] +description = "Pop Network makes it easy for smart contract developers to use the Power of Polkadot." edition = "2021" homepage = "https://r0gue.io" license = "Unlicense" repository = "https://github.com/r0gue-io/pop-node/" -description = "Pop Network makes it easy for smart contract developers to use the Power of Polkadot." [workspace] +exclude = [ "pop-api", "tests/contracts" ] members = [ - "node", - "runtime/devnet", - "runtime/testnet", - "integration-tests", - "primitives", + "integration-tests", + "node", + "primitives", + "runtime/devnet", + "runtime/testnet", ] -exclude = ["pop-api", "tests/contracts"] resolver = "2" [workspace.dependencies] +clap = { version = "4.4.18", features = [ "derive" ] } codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [ - "derive", + "derive", ] } +futures = "0.3.28" hex-literal = "0.4.1" +jsonrpsee = { version = "0.23.2", features = [ "server" ] } log = { version = "0.4.21", default-features = false } scale-info = { version = "2.11.1", default-features = false, features = [ - "derive", + "derive", ] } -smallvec = "1.11.2" serde = "1.0.197" -clap = { version = "4.4.18", features = ["derive"] } -jsonrpsee = { version = "0.23.2", features = ["server"] } -futures = "0.3.28" serde_json = "1.0.114" -tracing-subscriber = { version = "0.3", default-features = false } +smallvec = "1.11.2" subxt = "0.34.0" subxt-signer = "0.34.0" -tokio = { version = "1.36", features = ["macros", "time", "rt-multi-thread"] } +tokio = { version = "1.36", features = [ "macros", "rt-multi-thread", "time" ] } +tracing-subscriber = { version = "0.3", default-features = false } # Build substrate-build-script-utils = "11.0.0" substrate-wasm-builder = "23.0.0" # Local +pop-primitives = { path = "./primitives", default-features = false } +pop-runtime-common = { path = "runtime/common", default-features = false } pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds -pop-runtime-common = { path = "runtime/common", default-features = false } -pop-primitives = { path = "./primitives", default-features = false } # Substrate -sc-basic-authorship = "0.42.0" -sc-chain-spec = "35.0.0" -sc-cli = "0.44.0" -sc-client-api = "35.1.0" -sc-offchain = "37.0.0" -sc-consensus = "0.41.0" -sc-executor = "0.39.0" -sc-network = "0.42.0" -sc-network-sync = "0.41.0" -sc-rpc = "37.0.0" -sc-service = "0.43.0" -sc-sysinfo = "35.0.0" -sc-telemetry = "22.0.0" -sc-tracing = "35.0.0" -sc-transaction-pool = "35.0.0" -sc-transaction-pool-api = "35.0.0" frame-benchmarking = { version = "36.0.0", default-features = false } frame-benchmarking-cli = "40.0.0" frame-executive = { version = "36.0.0", default-features = false } +frame-metadata-hash-extension = { version = "0.4.0", default-features = false } frame-support = { version = "36.0.0", default-features = false } frame-system = { version = "36.1.0", default-features = false } frame-system-benchmarking = { version = "36.0.0", default-features = false } frame-system-rpc-runtime-api = { version = "33.0.0", default-features = false } frame-try-runtime = { version = "0.42.0", default-features = false } -frame-metadata-hash-extension = { version = "0.4.0", default-features = false } +pallet-assets = { version = "37.0.0", default-features = false } pallet-aura = { version = "35.0.0", default-features = false } pallet-authorship = { version = "36.0.0", default-features = false } -pallet-assets = { version = "37.0.0", default-features = false } pallet-balances = { version = "37.0.0", default-features = false } pallet-contracts = { version = "35.0.0", default-features = false } pallet-message-queue = { version = "39.0.0", default-features = false } @@ -103,6 +87,22 @@ pallet-transaction-payment-rpc = "38.0.0" pallet-transaction-payment-rpc-runtime-api = { version = "36.0.0", default-features = false } pallet-utility = { version = "36.0.0", default-features = false } prometheus-endpoint = { version = "0.17.0", default-features = false, package = "substrate-prometheus-endpoint" } +sc-basic-authorship = "0.42.0" +sc-chain-spec = "35.0.0" +sc-cli = "0.44.0" +sc-client-api = "35.1.0" +sc-consensus = "0.41.0" +sc-executor = "0.39.0" +sc-network = "0.42.0" +sc-network-sync = "0.41.0" +sc-offchain = "37.0.0" +sc-rpc = "37.0.0" +sc-service = "0.43.0" +sc-sysinfo = "35.0.0" +sc-telemetry = "22.0.0" +sc-tracing = "35.0.0" +sc-transaction-pool = "35.0.0" +sc-transaction-pool-api = "35.0.0" sp-api = { version = "33.0.0", default-features = false } sp-authority-discovery = { version = "33.0.0", default-features = false } sp-block-builder = { version = "33.0.0", default-features = false } @@ -112,28 +112,28 @@ sp-consensus-babe = { version = "0.39.0", default-features = false } sp-consensus-beefy = { version = "20.0.0", default-features = false } sp-consensus-grandpa = { version = "20.0.0", default-features = false } sp-core = { version = "34.0.0", default-features = false } -sp-keystore = "0.40.0" -sp-io = { version = "37.0.0", default-features = false } sp-genesis-builder = { version = "0.14.0", default-features = false } sp-inherents = { version = "33.0.0", default-features = false } +sp-io = { version = "37.0.0", default-features = false } +sp-keystore = "0.40.0" sp-offchain = { version = "33.0.0", default-features = false } sp-runtime = { version = "38.0.0", default-features = false } -sp-timestamp = "33.0.0" -substrate-frame-rpc-system = "36.0.0" sp-session = { version = "34.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } +sp-timestamp = "33.0.0" sp-transaction-pool = { version = "33.0.0", default-features = false } sp-version = { version = "36.0.0", default-features = false } +substrate-frame-rpc-system = "36.0.0" # Polkadot pallet-xcm = { version = "15.0.0", default-features = false } polkadot-cli = "15.0.0" polkadot-parachain-primitives = { version = "13.0.0", default-features = false } -polkadot-runtime-parachains = { version = "15.0.3", default-features = false } polkadot-primitives = { version = "14.0.0", default-features = false } polkadot-runtime-common = { version = "15.0.0", default-features = false } -rococo-runtime-constants = { version = "15.0.0", default-features = false } +polkadot-runtime-parachains = { version = "15.0.3", default-features = false } rococo-runtime = { version = "15.0.0", default-features = false } +rococo-runtime-constants = { version = "15.0.0", default-features = false } xcm = { version = "14.0.3", package = "staging-xcm", default-features = false } xcm-builder = { version = "15.0.0", package = "staging-xcm-builder", default-features = false } xcm-executor = { version = "15.0.0", package = "staging-xcm-executor", default-features = false } @@ -141,6 +141,13 @@ xcm-executor = { version = "15.0.0", package = "staging-xcm-executor", default-f # Cumulus asset-hub-rococo-runtime = { version = "0.19.0", default-features = false } asset-test-utils = { version = "15.0.0", default-features = false } +color-print = "0.3.4" +cumulus-client-cli = "0.15.0" +cumulus-client-collator = "0.15.0" +cumulus-client-consensus-aura = "0.15.0" +cumulus-client-consensus-common = "0.15.0" +cumulus-client-consensus-proposer = "0.14.0" +cumulus-client-service = "0.15.0" cumulus-pallet-aura-ext = { version = "0.15.0", default-features = false } cumulus-pallet-parachain-system = { version = "0.15.0", default-features = false } cumulus-pallet-session-benchmarking = { version = "17.0.0", default-features = false } @@ -148,21 +155,14 @@ cumulus-pallet-xcm = { version = "0.15.0", default-features = false } cumulus-pallet-xcmp-queue = { version = "0.15.0", default-features = false } cumulus-primitives-aura = { version = "0.14.0", default-features = false } cumulus-primitives-core = { version = "0.14.0", default-features = false } +cumulus-primitives-parachain-inherent = "0.14.0" cumulus-primitives-storage-weight-reclaim = { version = "6.0.2", default-features = false } cumulus-primitives-utility = { version = "0.15.0", default-features = false } +cumulus-relay-chain-interface = "0.15.0" emulated-integration-tests-common = { version = "11.0.0", default-features = false } pallet-collator-selection = { version = "17.0.0", default-features = false } -parachains-common = { version = "15.0.0", default-features = false } parachain-info = { version = "0.15.0", package = "staging-parachain-info", default-features = false } -cumulus-primitives-parachain-inherent = "0.14.0" -cumulus-relay-chain-interface = "0.15.0" -color-print = "0.3.4" -cumulus-client-cli = "0.15.0" -cumulus-client-collator = "0.15.0" -cumulus-client-consensus-aura = "0.15.0" -cumulus-client-consensus-common = "0.15.0" -cumulus-client-consensus-proposer = "0.14.0" -cumulus-client-service = "0.15.0" +parachains-common = { version = "15.0.0", default-features = false } # TODO: Paseo (note: using polkadot as stopgap until paseo updated to polkadot sdk v1.14.0) asset-hub-paseo-runtime = { git = "https://github.com/polkadot-fellows/runtimes", default-features = false, package = "asset-hub-polkadot-runtime" } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 30559044..db94f2f0 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,18 +1,18 @@ [package] -name = "integration-tests" authors.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true +name = "integration-tests" repository.workspace = true [dev-dependencies] codec.workspace = true tracing-subscriber = { workspace = true, features = [ - "env-filter", - "fmt", - "std", - "tracing-log", + "env-filter", + "fmt", + "std", + "tracing-log", ] } # Substrate @@ -20,20 +20,20 @@ frame-support.workspace = true pallet-assets.workspace = true pallet-balances.workspace = true pallet-message-queue.workspace = true -sp-core.workspace = true sp-authority-discovery.workspace = true sp-consensus-aura.workspace = true sp-consensus-babe.workspace = true sp-consensus-beefy.workspace = true sp-consensus-grandpa.workspace = true +sp-core.workspace = true sp-runtime.workspace = true # Polkadot +pallet-xcm.workspace = true polkadot-primitives.workspace = true +polkadot-runtime-parachains.workspace = true xcm.workspace = true xcm-executor.workspace = true -polkadot-runtime-parachains.workspace = true -pallet-xcm.workspace = true # Cumulus asset-test-utils.workspace = true @@ -46,56 +46,58 @@ paseo-runtime.workspace = true paseo-runtime-constants.workspace = true # Local -pop-runtime-devnet.workspace = true pop-runtime-common.workspace = true +pop-runtime-devnet.workspace = true [features] -default = ["std"] +default = [ "std" ] std = [ - "asset-hub-paseo-runtime/std", - "cumulus-primitives-core/std", - "frame-support/std", - "pallet-assets/std", - "pallet-balances/std", - "pallet-message-queue/std", - "pallet-xcm/std", - "paseo-runtime/std", - "paseo-runtime-constants/std", - "polkadot-primitives/std", - "polkadot-runtime-parachains/std", - "pop-runtime-devnet/std", - "sp-authority-discovery/std", - "sp-consensus-aura/std", - "sp-consensus-babe/std", - "sp-consensus-beefy/std", - "sp-consensus-grandpa/std", - "sp-core/std", - "sp-runtime/std", - "xcm-executor/std", - "xcm/std", + "asset-hub-paseo-runtime/std", + "cumulus-primitives-core/std", + "frame-support/std", + "pallet-assets/std", + "pallet-balances/std", + "pallet-message-queue/std", + "pallet-xcm/std", + "paseo-runtime-constants/std", + "paseo-runtime/std", + "polkadot-primitives/std", + "polkadot-runtime-parachains/std", + "pop-runtime-common/std", + "pop-runtime-devnet/std", + "sp-authority-discovery/std", + "sp-consensus-aura/std", + "sp-consensus-babe/std", + "sp-consensus-beefy/std", + "sp-consensus-grandpa/std", + "sp-core/std", + "sp-runtime/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "asset-hub-paseo-runtime/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "paseo-runtime/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", - "pop-runtime-devnet/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "asset-hub-paseo-runtime/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "paseo-runtime/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "pop-runtime-devnet/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] try-runtime = [ - "asset-hub-paseo-runtime/try-runtime", - "frame-support/try-runtime", - "pallet-assets/try-runtime", - "pallet-balances/std", - "pallet-message-queue/try-runtime", - "paseo-runtime/try-runtime", - "pop-runtime-devnet/try-runtime", - "sp-runtime/try-runtime", + "asset-hub-paseo-runtime/try-runtime", + "frame-support/try-runtime", + "pallet-assets/try-runtime", + "pallet-balances/std", + "pallet-message-queue/try-runtime", + "paseo-runtime/try-runtime", + "pop-runtime-devnet/try-runtime", + "sp-runtime/try-runtime", ] diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index c15424b1..50513a3e 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -1,10 +1,5 @@ #![cfg(test)] -use crate::chains::{ - asset_hub_paseo::{genesis::ED as ASSET_HUB_PASEO_ED, AssetHubPaseoParaPallet}, - paseo::{genesis::ED as PASEO_ED, PaseoRelayPallet}, - pop_network::PopNetworkParaPallet, -}; use asset_hub_paseo_runtime::xcm_config::XcmConfig as AssetHubPaseoXcmConfig; use asset_test_utils::xcm_helpers; use chains::{asset_hub_paseo::AssetHubPaseo, paseo::Paseo, pop_network::PopNetwork}; @@ -22,6 +17,12 @@ use pop_runtime_common::Balance; use pop_runtime_devnet::config::xcm::XcmConfig as PopNetworkXcmConfig; use xcm::prelude::*; +use crate::chains::{ + asset_hub_paseo::{genesis::ED as ASSET_HUB_PASEO_ED, AssetHubPaseoParaPallet}, + paseo::{genesis::ED as PASEO_ED, PaseoRelayPallet}, + pop_network::PopNetworkParaPallet, +}; + mod chains; decl_test_networks! { @@ -295,7 +296,9 @@ fn reserve_transfer_native_asset_from_relay_to_para() { let delivery_fees = PaseoRelay::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); let sender_balance_after = test.sender.balance; @@ -349,7 +352,9 @@ fn reserve_transfer_native_asset_from_para_to_relay() { let delivery_fees = PopNetworkPara::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced @@ -395,7 +400,9 @@ fn reserve_transfer_native_asset_from_system_para_to_para() { let delivery_fees = AssetHubPaseoPara::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced @@ -413,7 +420,8 @@ fn reserve_transfer_native_asset_from_system_para_to_para() { fn reserve_transfer_native_asset_from_para_to_system_para() { init_tracing(); - // Setup: reserve transfer from AH to Pop, so that sovereign account accurate for return transfer + // Setup: reserve transfer from AH to Pop, so that sovereign account accurate for return + // transfer let amount_to_send: Balance = ASSET_HUB_PASEO_ED * 1000; fund_pop_from_system_para( AssetHubPaseoParaSender::get(), @@ -458,7 +466,9 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { let delivery_fees = PopNetworkPara::execute_with(|| { xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, - >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest) + >( + test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest + ) }); // Sender's balance is reduced @@ -478,8 +488,8 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { // // let beneficiary: sp_runtime::AccountId32 = [1u8; 32].into(); // -// // Setup: reserve transfer from relay to Pop, so that sovereign account accurate for return transfer -// let amount_to_send: Balance = pop_runtime::UNIT * 1000; +// // Setup: reserve transfer from relay to Pop, so that sovereign account accurate for return +// transfer let amount_to_send: Balance = pop_runtime::UNIT * 1000; // fund_pop_from_relay(PaseoRelaySender::get(), amount_to_send, beneficiary.clone()); // // let message = { @@ -550,11 +560,11 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { // PaseoRelay, // vec![ // // We currently only check that the message was processed successfully -// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, -// // TODO: check order placed once we can have on-demand para id registered (probably via setting raw storage as a workaround) -// // RuntimeEvent::OnDemandAssignmentProvider(assigner_on_demand::Event::OnDemandOrderPlaced { -// // .. -// // }) => {}, +// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => +// {}, // TODO: check order placed once we can have on-demand para id registered (probably via +// setting raw storage as a workaround) // +// RuntimeEvent::OnDemandAssignmentProvider(assigner_on_demand::Event::OnDemandOrderPlaced { // +// .. // }) => {}, // ] // ); // }); @@ -566,8 +576,8 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { // PopNetworkPara, // vec![ // RuntimeEvent::PolkadotXcm(pallet_xcm::Event::ResponseReady { query_id: 0, .. }) => {}, -// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => {}, -// ] +// RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) => +// {}, ] // ); // }); // } diff --git a/node/Cargo.toml b/node/Cargo.toml index 6637ab44..adcd4b2b 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,28 +1,28 @@ [package] -name = "pop-node" -version = "0.2.0-alpha" authors.workspace = true +build = "build.rs" description.workspace = true -license = "Unlicense" -homepage.workspace = true -repository.workspace = true edition.workspace = true -build = "build.rs" +homepage.workspace = true +license = "Unlicense" +name = "pop-node" publish = false +repository.workspace = true +version = "0.2.0-alpha" [dependencies] clap.workspace = true -log.workspace = true codec.workspace = true -serde.workspace = true -jsonrpsee.workspace = true futures.workspace = true +jsonrpsee.workspace = true +log.workspace = true +serde.workspace = true serde_json.workspace = true # Local +pop-runtime-common.workspace = true pop-runtime-devnet.workspace = true pop-runtime-testnet.workspace = true -pop-runtime-common.workspace = true # Substrate frame-benchmarking.workspace = true @@ -33,11 +33,11 @@ sc-basic-authorship.workspace = true sc-chain-spec.workspace = true sc-cli.workspace = true sc-client-api.workspace = true -sc-offchain.workspace = true sc-consensus.workspace = true sc-executor.workspace = true sc-network.workspace = true sc-network-sync.workspace = true +sc-offchain.workspace = true sc-rpc.workspace = true sc-service.workspace = true sc-sysinfo.workspace = true @@ -50,8 +50,8 @@ sp-block-builder.workspace = true sp-blockchain.workspace = true sp-consensus-aura.workspace = true sp-core.workspace = true -sp-keystore.workspace = true sp-io.workspace = true +sp-keystore.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true @@ -65,37 +65,37 @@ polkadot-primitives.workspace = true xcm.workspace = true # Cumulus +color-print.workspace = true cumulus-client-cli.workspace = true cumulus-client-collator.workspace = true cumulus-client-consensus-aura.workspace = true cumulus-client-consensus-common.workspace = true cumulus-client-consensus-proposer.workspace = true -cumulus-primitives-aura.workspace = true cumulus-client-service.workspace = true +cumulus-primitives-aura.workspace = true cumulus-primitives-core.workspace = true cumulus-primitives-parachain-inherent.workspace = true cumulus-relay-chain-interface.workspace = true -color-print.workspace = true [build-dependencies] substrate-build-script-utils.workspace = true [features] -default = [] runtime-benchmarks = [ - "cumulus-primitives-core/runtime-benchmarks", - "frame-benchmarking-cli/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "pop-runtime-devnet/runtime-benchmarks", - "pop-runtime-testnet/runtime-benchmarks", - "polkadot-cli/runtime-benchmarks", - "polkadot-primitives/runtime-benchmarks", - "sc-service/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "frame-benchmarking-cli/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "polkadot-cli/runtime-benchmarks", + "polkadot-primitives/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "pop-runtime-devnet/runtime-benchmarks", + "pop-runtime-testnet/runtime-benchmarks", + "sc-service/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "pop-runtime-devnet/try-runtime", - "pop-runtime-testnet/try-runtime", - "polkadot-cli/try-runtime", - "sp-runtime/try-runtime", + "polkadot-cli/try-runtime", + "pop-runtime-devnet/try-runtime", + "pop-runtime-testnet/try-runtime", + "sp-runtime/try-runtime", ] diff --git a/node/src/command.rs b/node/src/command.rs index 8e0b7bb9..a6ebd620 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -36,7 +36,11 @@ fn runtime(id: &str) -> Runtime { } else if id.starts_with("test") || id.ends_with("testnet") { Runtime::Testnet } else { - log::warn!("No specific runtime was recognized for ChainSpec's Id: '{}', so Runtime::Devnet will be used", id); + log::warn!( + "No specific runtime was recognized for ChainSpec's Id: '{}', so Runtime::Devnet will \ + be used", + id + ); Runtime::Devnet } } @@ -65,9 +69,8 @@ impl RuntimeResolver for PathBuf { fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { - "dev" | "devnet" | "dev-paseo" => { - Box::new(chain_spec::development_config(Relay::PaseoLocal)) - }, + "dev" | "devnet" | "dev-paseo" => + Box::new(chain_spec::development_config(Relay::PaseoLocal)), "test" | "testnet" | "pop-paseo" => Box::new(chain_spec::testnet_config(Relay::Paseo)), "" | "local" => Box::new(chain_spec::development_config(Relay::PaseoLocal)), path => { @@ -91,10 +94,9 @@ impl SubstrateCli for Cli { fn description() -> String { format!( - "Pop Collator\n\nThe command-line arguments provided first will be \ - passed to the parachain node, while the arguments provided after -- will be passed \ - to the relay chain node.\n\n\ - {} -- ", + "Pop Collator\n\nThe command-line arguments provided first will be passed to the \ + parachain node, while the arguments provided after -- will be passed to the relay \ + chain node.\n\n{} -- ", Self::executable_name() ) } @@ -127,10 +129,9 @@ impl SubstrateCli for RelayChainCli { fn description() -> String { format!( - "Pop Collator\n\nThe command-line arguments provided first will be \ - passed to the parachain node, while the arguments provided after -- will be passed \ - to the relay chain node.\n\n\ - {} -- ", + "Pop Collator\n\nThe command-line arguments provided first will be passed to the \ + parachain node, while the arguments provided after -- will be passed to the relay \ + chain node.\n\n{} -- ", Self::executable_name() ) } @@ -263,7 +264,7 @@ pub fn run() -> Result<()> { let runner = cli.create_runner(cmd)?; // Switch on the concrete benchmark sub-command- match cmd { - BenchmarkCmd::Pallet(cmd) => { + BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { runner.sync_run(|config| { cmd.run_with_spec::, ReclaimHostFunctions>(Some( @@ -271,18 +272,16 @@ pub fn run() -> Result<()> { )) }) } else { - Err("Benchmarking wasn't enabled when building the node. \ - You can enable it with `--features runtime-benchmarks`." + Err("Benchmarking wasn't enabled when building the node. You can enable \ + it with `--features runtime-benchmarks`." .into()) - } - }, + }, BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { construct_benchmark_partials!(config, |partials| cmd.run(partials.client)) }), #[cfg(not(feature = "runtime-benchmarks"))] BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input( - "Compile with --features=runtime-benchmarks \ - to enable storage benchmarks." + "Compile with --features=runtime-benchmarks to enable storage benchmarks." .into(), )), #[cfg(feature = "runtime-benchmarks")] @@ -293,9 +292,8 @@ pub fn run() -> Result<()> { cmd.run(config, partials.client.clone(), db, storage) }) }), - BenchmarkCmd::Machine(cmd) => { - runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())) - }, + BenchmarkCmd::Machine(cmd) => + runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())), // NOTE: this allows the Client to leniently implement // new benchmark commands without requiring a companion MR. #[allow(unreachable_patterns)] diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 39d74019..6265dfd3 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -8,7 +8,6 @@ use std::sync::Arc; use pop_runtime_common::{AccountId, Balance, Block, Nonce}; - pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; diff --git a/node/src/service.rs b/node/src/service.rs index e07d3efc..95eba022 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -4,9 +4,6 @@ use std::{sync::Arc, time::Duration}; use cumulus_client_cli::CollatorOptions; -// Local Runtime Types -use pop_runtime_common::{AccountId, AuraId, Balance, Block, Hash, Nonce}; - // Cumulus Imports use cumulus_client_collator::service::CollatorService; use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; @@ -21,9 +18,10 @@ use cumulus_primitives_core::{ ParaId, }; use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; - // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; +// Local Runtime Types +use pop_runtime_common::{AccountId, AuraId, Balance, Block, Hash, Nonce}; use prometheus_endpoint::Registry; use sc_client_api::Backend; use sc_consensus::ImportQueue; diff --git a/pop-api/Cargo.toml b/pop-api/Cargo.toml index 0fa1119c..f82884da 100644 --- a/pop-api/Cargo.toml +++ b/pop-api/Cargo.toml @@ -1,33 +1,33 @@ [package] -name = "pop-api" description = "Easily access the power of Polkadot via the Pop Network" +edition = "2021" license = "GPL-3.0-only" +name = "pop-api" version = "0.0.0" -edition = "2021" [dependencies] enumflags2 = { version = "0.7.7" } ink = { version = "5.0.0", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"] } -sp-io = { version = "23.0.0", default-features = false, features = ["disable_panic_handler", "disable_oom", "disable_allocator"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ] } +sp-io = { version = "23.0.0", default-features = false, features = [ "disable_allocator", "disable_oom", "disable_panic_handler" ] } sp-runtime = { version = "24.0", default-features = false } pop-primitives = { path = "../primitives", default-features = false } [lib] +crate-type = [ "rlib" ] name = "pop_api" path = "src/lib.rs" -crate-type = ["rlib"] [features] -default = ["std"] +default = [ "std" ] std = [ - "enumflags2/std", - "ink/std", - "pop-primitives/std", - "scale/std", - "scale-info/std", - "sp-io/std", - "sp-runtime/std", + "enumflags2/std", + "ink/std", + "pop-primitives/std", + "scale-info/std", + "scale/std", + "sp-io/std", + "sp-runtime/std", ] diff --git a/pop-api/examples/balance-transfer/Cargo.toml b/pop-api/examples/balance-transfer/Cargo.toml index 29cd0ea5..2a12e532 100755 --- a/pop-api/examples/balance-transfer/Cargo.toml +++ b/pop-api/examples/balance-transfer/Cargo.toml @@ -1,14 +1,14 @@ [package] +authors = [ "[your_name] <[your_email]>" ] +edition = "2021" name = "balance_transfer" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [dependencies] ink = { version = "5.0.0", default-features = false } pop-api = { path = "../../../pop-api", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [dev-dependencies] ink_e2e = "5.0.0" @@ -17,12 +17,12 @@ ink_e2e = "5.0.0" path = "lib.rs" [features] -default = ["std"] +default = [ "std" ] +e2e-tests = [ ] +ink-as-dependency = [ ] std = [ - "ink/std", - "pop-api/std", - "scale/std", - "scale-info/std", + "ink/std", + "pop-api/std", + "scale-info/std", + "scale/std", ] -ink-as-dependency = [] -e2e-tests = [] diff --git a/pop-api/examples/nfts/Cargo.toml b/pop-api/examples/nfts/Cargo.toml index e931cf9f..ef50b7ec 100755 --- a/pop-api/examples/nfts/Cargo.toml +++ b/pop-api/examples/nfts/Cargo.toml @@ -1,25 +1,25 @@ [package] +authors = [ "[your_name] <[your_email]>" ] +edition = "2021" name = "nfts" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [dependencies] ink = { version = "5.0.0", default-features = false } pop-api = { path = "../../../pop-api", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [lib] path = "lib.rs" [features] -default = ["std"] +default = [ "std" ] +e2e-tests = [ ] +ink-as-dependency = [ ] std = [ - "ink/std", - "pop-api/std", - "scale/std", - "scale-info/std", + "ink/std", + "pop-api/std", + "scale-info/std", + "scale/std", ] -ink-as-dependency = [] -e2e-tests = [] diff --git a/pop-api/examples/place-spot-order/Cargo.toml b/pop-api/examples/place-spot-order/Cargo.toml index 2c67313d..f523bea7 100755 --- a/pop-api/examples/place-spot-order/Cargo.toml +++ b/pop-api/examples/place-spot-order/Cargo.toml @@ -1,25 +1,25 @@ [package] +authors = [ "[your_name] <[your_email]>" ] +edition = "2021" name = "spot_order" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [dependencies] ink = { version = "5.0.0", default-features = false } pop-api = { path = "../../../pop-api", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [lib] path = "lib.rs" [features] -default = ["std"] +default = [ "std" ] +e2e-tests = [ ] +ink-as-dependency = [ ] std = [ - "ink/std", - "pop-api/std", - "scale/std", - "scale-info/std", + "ink/std", + "pop-api/std", + "scale-info/std", + "scale/std", ] -ink-as-dependency = [] -e2e-tests = [] diff --git a/pop-api/examples/read-runtime-state/Cargo.toml b/pop-api/examples/read-runtime-state/Cargo.toml index 379152dd..f5464730 100755 --- a/pop-api/examples/read-runtime-state/Cargo.toml +++ b/pop-api/examples/read-runtime-state/Cargo.toml @@ -1,25 +1,25 @@ [package] +authors = [ "[your_name] <[your_email]>" ] +edition = "2021" name = "read_relay_blocknumber" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [dependencies] ink = { version = "5.0.0", default-features = false } pop-api = { path = "../../../pop-api", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [lib] path = "lib.rs" [features] -default = ["std"] +default = [ "std" ] +e2e-tests = [ ] +ink-as-dependency = [ ] std = [ - "ink/std", - "pop-api/std", - "scale/std", - "scale-info/std", + "ink/std", + "pop-api/std", + "scale-info/std", + "scale/std", ] -ink-as-dependency = [] -e2e-tests = [] diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index b6f9adaa..67cf167d 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,18 +1,14 @@ [package] -name = "pop-primitives" +edition = "2021" license = "GPL-3.0-only" +name = "pop-primitives" version = "0.0.0" -edition = "2021" [dependencies] bounded-collections = { version = "0.1", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [features] -default = ["std"] -std = [ - "bounded-collections/std", - "scale/std", - "scale-info/std", -] +default = [ "std" ] +std = [ "bounded-collections/std", "scale-info/std", "scale/std" ] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 8ad74ade..dc79a1ed 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std, no_main)] pub use bounded_collections::{BoundedBTreeMap, BoundedBTreeSet, BoundedVec, ConstU32}; -//use scale::{Decode, Encode, MaxEncodedLen}; +// use scale::{Decode, Encode, MaxEncodedLen}; pub mod cross_chain; pub mod storage_keys; diff --git a/primitives/src/storage_keys.rs b/primitives/src/storage_keys.rs index 2bcb41ec..657d9035 100644 --- a/primitives/src/storage_keys.rs +++ b/primitives/src/storage_keys.rs @@ -1,6 +1,7 @@ -use super::*; use scale::{Decode, Encode, MaxEncodedLen}; +use super::*; + #[derive(Encode, Decode, Debug, MaxEncodedLen)] pub enum RuntimeStateKeys { Nfts(NftsKeys), diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 0cd9aecb..395abd24 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -4,16 +4,16 @@ description = "Pop Runtime Common" edition.workspace = true license.workspace = true name = "pop-runtime-common" +publish = false repository.workspace = true version = "0.0.0" -publish = false [package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +targets = [ "x86_64-unknown-linux-gnu" ] [dependencies] -codec = { workspace = true, default-features = false, features = ["derive"] } -scale-info = { workspace = true, default-features = false, features = ["derive"] } +codec = { workspace = true, default-features = false, features = [ "derive" ] } +scale-info = { workspace = true, default-features = false, features = [ "derive" ] } # Substrate frame-support = { workspace = true, default-features = false } @@ -24,9 +24,9 @@ parachains-common = { workspace = true, default-features = false } polkadot-primitives = { workspace = true, default-features = false } [features] -default = ["std"] -std = ["frame-support/std", "sp-runtime/std"] +default = [ "std" ] runtime-benchmarks = [ - "frame-support/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] \ No newline at end of file + "frame-support/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +std = [ "frame-support/std", "sp-runtime/std" ] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 2160ec81..f7f7ddb7 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -1,12 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_runtime::Perbill; - use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}; - // Cumulus types re-export // These types are shared between the devnet and testnet runtimes pub use parachains_common::{AccountId, AuraId, Balance, Block, BlockNumber, Hash, Signature}; pub use polkadot_primitives::MAX_POV_SIZE; +use sp_runtime::Perbill; /// Nonce for an account pub type Nonce = u32; @@ -69,11 +67,12 @@ pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; /// Proxy commons for Pop runtimes pub mod proxy { - use super::{deposit, Balance}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::parameter_types; use sp_runtime::RuntimeDebug; + use super::{deposit, Balance}; + parameter_types! { // One storage item; key size 32, value size 8; . pub const ProxyDepositBase: Balance = deposit(1, 40); diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index da2c1852..74ec5e3d 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "pop-runtime-devnet" -version = "0.1.0" authors.workspace = true description.workspace = true -license = "Unlicense" +edition.workspace = true homepage.workspace = true +license = "Unlicense" +name = "pop-runtime-devnet" repository.workspace = true -edition.workspace = true +version = "0.1.0" [package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +targets = [ "x86_64-unknown-linux-gnu" ] [build-dependencies] substrate-wasm-builder.workspace = true @@ -34,9 +34,9 @@ frame-system.workspace = true frame-system-benchmarking.workspace = true frame-system-rpc-runtime-api.workspace = true frame-try-runtime.workspace = true +pallet-assets.workspace = true pallet-aura.workspace = true pallet-authorship.workspace = true -pallet-assets.workspace = true pallet-balances.workspace = true pallet-contracts.workspace = true pallet-message-queue.workspace = true @@ -44,22 +44,22 @@ pallet-multisig.workspace = true pallet-nft-fractionalization.workspace = true pallet-nfts.workspace = true pallet-nfts-runtime-api.workspace = true +pallet-preimage.workspace = true +pallet-proxy.workspace = true pallet-scheduler.workspace = true pallet-session.workspace = true pallet-sudo.workspace = true -pallet-preimage.workspace = true -pallet-proxy.workspace = true pallet-timestamp.workspace = true pallet-transaction-payment.workspace = true pallet-transaction-payment-rpc-runtime-api.workspace = true pallet-utility.workspace = true sp-api.workspace = true -sp-io.workspace = true sp-block-builder.workspace = true sp-consensus-aura.workspace = true sp-core.workspace = true sp-genesis-builder.workspace = true sp-inherents.workspace = true +sp-io.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true @@ -86,145 +86,147 @@ cumulus-primitives-core.workspace = true cumulus-primitives-storage-weight-reclaim.workspace = true cumulus-primitives-utility.workspace = true pallet-collator-selection.workspace = true -parachains-common.workspace = true parachain-info.workspace = true +parachains-common.workspace = true [dev-dependencies] +enumflags2 = "0.7.9" env_logger = "0.11.2" hex = "0.4.3" -enumflags2 = "0.7.9" [features] -default = ["std"] +default = [ "std" ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", - "cumulus-primitives-utility/std", - "frame-benchmarking/std", - "frame-executive/std", - "frame-metadata-hash-extension/std", - "frame-support/std", - "frame-system-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime/std", - "log/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-assets/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-contracts/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-nft-fractionalization/std", - "pallet-nfts/std", - "pallet-nfts-runtime-api/std", - "pallet-scheduler/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "polkadot-parachain-primitives/std", - "polkadot-runtime-common/std", - "pop-primitives/std", - "scale-info/std", - "sp-api/std", - "sp-io/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-storage-weight-reclaim/std", + "cumulus-primitives-utility/std", + "frame-benchmarking/std", + "frame-executive/std", + "frame-metadata-hash-extension/std", + "frame-support/std", + "frame-system-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "log/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-contracts/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-nft-fractionalization/std", + "pallet-nfts-runtime-api/std", + "pallet-nfts/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "pop-primitives/std", + "pop-runtime-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nft-fractionalization/runtime-benchmarks", - "pallet-nfts/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", + "pallet-nfts/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-assets/try-runtime", - "pallet-balances/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-contracts/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nft-fractionalization/try-runtime", - "pallet-nfts/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-contracts/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", + "pallet-nfts/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # Enable the metadata hash generation. @@ -234,8 +236,8 @@ try-runtime = [ # generate the metadata hash and then a second time with the # `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` # extension. -metadata-hash = ["substrate-wasm-builder/metadata-hash"] +metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] # A convenience feature for enabling things when doing a build # for an on-chain release. -on-chain-release-build = ["metadata-hash"] \ No newline at end of file +on-chain-release-build = [ "metadata-hash" ] diff --git a/runtime/devnet/src/config/assets.rs b/runtime/devnet/src/config/assets.rs index 34035c1f..d66358a6 100644 --- a/runtime/devnet/src/config/assets.rs +++ b/runtime/devnet/src/config/assets.rs @@ -1,7 +1,3 @@ -use crate::{ - deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, - RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, -}; use frame_support::{ parameter_types, traits::{AsEnsureOriginWithArg, ConstU32}, @@ -12,6 +8,11 @@ use pallet_nfts::PalletFeatures; use parachains_common::{AssetIdForTrustBackedAssets, CollectionId, ItemId, Signature}; use sp_runtime::traits::Verify; +use crate::{ + deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, + RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, +}; + /// We allow root to execute privileged asset operations. pub type AssetsForceOrigin = EnsureRoot; @@ -37,36 +38,36 @@ parameter_types! { } impl pallet_nfts::Config for Runtime { - type RuntimeEvent = RuntimeEvent; // TODO: source from primitives - type CollectionId = CollectionId; + type ApprovalsLimit = ConstU32<20>; + type AttributeDepositBase = NftsAttributeDepositBase; + type CollectionDeposit = NftsCollectionDeposit; // TODO: source from primitives - type ItemId = ItemId; - type Currency = Balances; + type CollectionId = CollectionId; type CreateOrigin = AsEnsureOriginWithArg>; + type Currency = Balances; + type DepositPerByte = NftsDepositPerByte; + type Features = NftsPalletFeatures; type ForceOrigin = AssetsForceOrigin; - type Locker = (); - type CollectionDeposit = NftsCollectionDeposit; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); + type ItemAttributesApprovalsLimit = ConstU32<30>; type ItemDeposit = NftsItemDeposit; - type MetadataDepositBase = NftsMetadataDepositBase; - type AttributeDepositBase = NftsAttributeDepositBase; - type DepositPerByte = NftsDepositPerByte; - type StringLimit = ConstU32<256>; // TODO: source from primitives - type KeyLimit = ConstU32<64>; - type ValueLimit = ConstU32<256>; + type ItemId = ItemId; // TODO: source from primitives - type ApprovalsLimit = ConstU32<20>; - type ItemAttributesApprovalsLimit = ConstU32<30>; - type MaxTips = ConstU32<10>; - type MaxDeadlineDuration = NftsMaxDeadlineDuration; + type KeyLimit = ConstU32<64>; + type Locker = (); type MaxAttributesPerCall = ConstU32<10>; - type Features = NftsPalletFeatures; - type OffchainSignature = Signature; + type MaxDeadlineDuration = NftsMaxDeadlineDuration; + type MaxTips = ConstU32<10>; + type MetadataDepositBase = NftsMetadataDepositBase; type OffchainPublic = ::Signer; + type OffchainSignature = Signature; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<256>; + type ValueLimit = ConstU32<256>; type WeightInfo = pallet_nfts::weights::SubstrateWeight; - #[cfg(feature = "runtime-benchmarks")] - type Helper = (); } parameter_types! { @@ -76,46 +77,46 @@ parameter_types! { } impl pallet_nft_fractionalization::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Deposit = AssetDeposit; + type AssetBalance = >::Balance; + type AssetId = >::AssetId; + type Assets = Assets; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); type Currency = Balances; - type NewAssetSymbol = NewAssetSymbol; + type Deposit = AssetDeposit; type NewAssetName = NewAssetName; - type StringLimit = AssetsStringLimit; + type NewAssetSymbol = NewAssetSymbol; type NftCollectionId = ::CollectionId; type NftId = ::ItemId; - type AssetBalance = >::Balance; - type AssetId = >::AssetId; - type Assets = Assets; type Nfts = Nfts; type PalletId = NftFractionalizationPalletId; - type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; + type RuntimeEvent = RuntimeEvent; type RuntimeHoldReason = RuntimeHoldReason; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type StringLimit = AssetsStringLimit; + type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; } pub type TrustBackedAssets = pallet_assets::Instance1; pub type TrustBackedAssetsCall = pallet_assets::Call; impl pallet_assets::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; + type ApprovalDeposit = ApprovalDeposit; + type AssetAccountDeposit = AssetAccountDeposit; + type AssetDeposit = AssetDeposit; type AssetId = AssetIdForTrustBackedAssets; type AssetIdParameter = codec::Compact; - type Currency = Balances; + type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + type CallbackHandle = (); type CreateOrigin = AsEnsureOriginWithArg>; + type Currency = Balances; + type Extra = (); type ForceOrigin = AssetsForceOrigin; - type AssetDeposit = AssetDeposit; + type Freezer = (); type MetadataDepositBase = MetadataDepositBase; type MetadataDepositPerByte = MetadataDepositPerByte; - type ApprovalDeposit = ApprovalDeposit; + type RemoveItemsLimit = ConstU32<1000>; + type RuntimeEvent = RuntimeEvent; type StringLimit = AssetsStringLimit; - type Freezer = (); - type Extra = (); type WeightInfo = pallet_assets::weights::SubstrateWeight; - type CallbackHandle = (); - type AssetAccountDeposit = AssetAccountDeposit; - type RemoveItemsLimit = ConstU32<1000>; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); } diff --git a/runtime/devnet/src/config/contracts.rs b/runtime/devnet/src/config/contracts.rs index 8e5b2695..5b37455c 100644 --- a/runtime/devnet/src/config/contracts.rs +++ b/runtime/devnet/src/config/contracts.rs @@ -1,13 +1,14 @@ -use crate::{ - deposit, extensions, Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, - RuntimeEvent, RuntimeHoldReason, Timestamp, -}; use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Randomness}, }; use frame_system::{pallet_prelude::BlockNumberFor, EnsureSigned}; +use crate::{ + deposit, extensions, Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, + RuntimeEvent, RuntimeHoldReason, Timestamp, +}; + pub enum AllowBalancesCall {} impl frame_support::traits::Contains for AllowBalancesCall { @@ -45,12 +46,8 @@ parameter_types! { } impl pallet_contracts::Config for Runtime { - type Time = Timestamp; - type Randomness = DummyRandomness; - type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - + type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + type ApiVersion = (); /// The safest default is to allow no calls at all. /// /// Runtimes should whitelist dispatchables that are allowed to be called from contracts @@ -58,14 +55,16 @@ impl pallet_contracts::Config for Runtime { /// change because that would break already deployed contracts. The `RuntimeCall` structure /// itself is not allowed to change the indices of existing pallets, too. type CallFilter = AllowBalancesCall; - type DepositPerItem = DepositPerItem; - type DepositPerByte = DepositPerByte; type CallStack = [pallet_contracts::Frame; 23]; - type WeightPrice = pallet_transaction_payment::Pallet; - type WeightInfo = pallet_contracts::weights::SubstrateWeight; type ChainExtension = extensions::PopApiExtension; - type Schedule = Schedule; - type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; + type Currency = Balances; + type Debug = (); + type DefaultDepositLimit = DefaultDepositLimit; + type DepositPerByte = DepositPerByte; + type DepositPerItem = DepositPerItem; + type Environment = (); + type InstantiateOrigin = EnsureSigned; // This node is geared towards development and testing of contracts. // We decided to increase the default allowed contract size for this // reason (the default is `128 * 1024`). @@ -75,19 +74,19 @@ impl pallet_contracts::Config for Runtime { // less friction during development when the requirement here is // just more lax. type MaxCodeLen = ConstU32<{ 256 * 1024 }>; - type DefaultDepositLimit = DefaultDepositLimit; - type MaxStorageKeyLen = ConstU32<128>; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; - type UnsafeUnstableInterface = ConstBool; - type UploadOrigin = EnsureSigned; - type InstantiateOrigin = EnsureSigned; - type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = ConstU32<32>; - type RuntimeHoldReason = RuntimeHoldReason; - - type ApiVersion = (); - type Environment = (); - type Debug = (); + type MaxStorageKeyLen = ConstU32<128>; type Migrations = (); + type Randomness = DummyRandomness; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; + type Schedule = Schedule; + type Time = Timestamp; + type UnsafeUnstableInterface = ConstBool; + type UploadOrigin = EnsureSigned; + type WeightInfo = pallet_contracts::weights::SubstrateWeight; + type WeightPrice = pallet_transaction_payment::Pallet; type Xcm = pallet_xcm::Pallet; } diff --git a/runtime/devnet/src/config/proxy.rs b/runtime/devnet/src/config/proxy.rs index a4fd479a..ff70240e 100644 --- a/runtime/devnet/src/config/proxy.rs +++ b/runtime/devnet/src/config/proxy.rs @@ -1,5 +1,3 @@ -use super::assets::TrustBackedAssetsCall; -use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; use frame_support::traits::InstanceFilter; use pop_runtime_common::proxy::{ AnnouncementDepositBase, AnnouncementDepositFactor, MaxPending, MaxProxies, ProxyDepositBase, @@ -7,83 +5,86 @@ use pop_runtime_common::proxy::{ }; use sp_runtime::traits::BlakeTwo256; +use super::assets::TrustBackedAssetsCall; +use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; + impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, ProxyType::NonTransfer => !matches!( c, - RuntimeCall::Balances { .. } - | RuntimeCall::Assets { .. } - | RuntimeCall::Nfts { .. } + RuntimeCall::Balances { .. } | + RuntimeCall::Assets { .. } | + RuntimeCall::Nfts { .. } ), ProxyType::CancelProxy => matches!( c, - RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::Assets => { matches!( c, - RuntimeCall::Assets { .. } - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } - | RuntimeCall::Nfts { .. } + RuntimeCall::Assets { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } | + RuntimeCall::Nfts { .. } ) }, ProxyType::AssetOwner => matches!( c, - RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_team { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_collection_max_supply { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_collection { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_team { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_max_supply { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_collection { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::AssetManager => matches!( c, - RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_attributes_pre_signed { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::unlock_item_transfer { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_item_properties { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::clear_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_collection_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::clear_collection_metadata { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_attributes_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::unlock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_properties { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_collection_metadata { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::Collator => matches!( c, - RuntimeCall::CollatorSelection { .. } - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::CollatorSelection { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), } } @@ -94,16 +95,16 @@ impl InstanceFilter for ProxyType { } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; + type CallHasher = BlakeTwo256; type Currency = Balances; - type ProxyType = ProxyType; + type MaxPending = MaxPending; + type MaxProxies = MaxProxies; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_proxy::weights::SubstrateWeight; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; } diff --git a/runtime/devnet/src/config/xcm.rs b/runtime/devnet/src/config/xcm.rs index a8d5f552..5a142dcf 100644 --- a/runtime/devnet/src/config/xcm.rs +++ b/runtime/devnet/src/config/xcm.rs @@ -1,8 +1,5 @@ -use crate::{ - AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, - Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, -}; use core::marker::PhantomData; + use frame_support::{ parameter_types, traits::{ConstU32, Contains, ContainsPair, Everything, Get, Nothing}, @@ -23,6 +20,11 @@ use xcm_builder::{ }; use xcm_executor::XcmExecutor; +use crate::{ + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, +}; + parameter_types! { pub const RelayLocation: Location = Location::parent(); pub AssetHub: Location = Location::new(1, [Parachain(1000)]); @@ -116,8 +118,8 @@ pub struct NativeAssetFrom(PhantomData); impl> ContainsPair for NativeAssetFrom { fn contains(asset: &Asset, origin: &Location) -> bool { let loc = T::get(); - &loc == origin - && matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) } + &loc == origin && + matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) } if *asset_loc == Location::from(Parent)) } } @@ -125,37 +127,38 @@ pub type TrustedReserves = (NativeAsset, NativeAssetFrom); pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; + type Aliasers = Nothing; + type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; - type OriginConverter = XcmOriginToTransactDispatchOrigin; - type IsReserve = TrustedReserves; - type IsTeleporter = (); // Teleporting is disabled. - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - type Trader = - UsingComponents>; - type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; - type AssetClaims = PolkadotXcm; - type SubscriptionService = PolkadotXcm; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); + type Barrier = Barrier; + type CallDispatcher = RuntimeCall; type FeeManager = (); + type HrmpChannelAcceptedHandler = (); + type HrmpChannelClosingHandler = (); + type HrmpNewChannelOpenRequestHandler = (); + type IsReserve = TrustedReserves; + type IsTeleporter = (); + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; type SafeCallFilter = Everything; - type Aliasers = Nothing; + type SubscriptionService = PolkadotXcm; + type Trader = + UsingComponents>; type TransactionalProcessor = FrameTransactionalProcessor; - type HrmpNewChannelOpenRequestHandler = (); - type HrmpChannelAcceptedHandler = (); - type HrmpChannelClosingHandler = (); + type UniversalAliases = Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; + type Weigher = FixedWeightBounds; type XcmRecorder = PolkadotXcm; + type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -171,34 +174,34 @@ pub type XcmRouter = WithUniqueTopic<( )>; impl pallet_xcm::Config for Runtime { + type AdminOrigin = EnsureRoot; + // ^ Override for AdvertisedXcmVersion default + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type ExecuteXcmOrigin = EnsureXcmOrigin; + type MaxLockers = ConstU32<8>; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); + type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; + type Weigher = FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; // TODO: add filter to only allow reserve transfers of native to relay/asset hub type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type UniversalLocation = UniversalLocation; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = Everything; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - // ^ Override for AdvertisedXcmVersion default - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - type MaxRemoteLockConsumers = ConstU32<0>; - type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/devnet/src/extensions.rs b/runtime/devnet/src/extensions.rs index 8a2e0fbd..faead2bc 100644 --- a/runtime/devnet/src/extensions.rs +++ b/runtime/devnet/src/extensions.rs @@ -1,12 +1,14 @@ -use frame_support::traits::{Contains, OriginTrait}; use frame_support::{ dispatch::{GetDispatchInfo, RawOrigin}, pallet_prelude::*, + traits::{Contains, OriginTrait}, }; -use pallet_contracts::chain_extension::{ - BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, +use pallet_contracts::{ + chain_extension::{ + BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, + }, + WeightInfo, }; -use pallet_contracts::WeightInfo; use pop_primitives::storage_keys::RuntimeStateKeys; use sp_core::crypto::UncheckedFrom; use sp_runtime::{traits::Dispatchable, DispatchError}; diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index 57ef9638..ca0e5137 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -11,24 +11,8 @@ pub mod config; mod extensions; mod weights; -use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; -use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; -use smallvec::smallvec; -use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; -use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, -}; - -use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; - use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; +use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ derive_impl, @@ -50,26 +34,35 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, }; +use pallet_balances::Call as BalancesCall; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; +use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; +// Polkadot imports +use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; pub use pop_runtime_common::{ deposit, AuraId, Balance, BlockNumber, Hash, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, BLOCK_PROCESSING_VELOCITY, DAYS, EXISTENTIAL_DEPOSIT, HOURS, MAXIMUM_BLOCK_WEIGHT, MICROUNIT, MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT, }; -pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; - +use smallvec::smallvec; +use sp_api::impl_runtime_apis; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; - -use pallet_balances::Call as BalancesCall; - -// Polkadot imports -use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; - +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; - // XCM Imports use xcm::latest::prelude::BodyId; @@ -132,6 +125,7 @@ pub type Executive = frame_executive::Executive< pub struct WeightToFee; impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: // we map to 1/10 of that, or 1/10 MILLIUNIT @@ -151,13 +145,13 @@ impl WeightToFeePolynomial for WeightToFee { /// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// to even the core data structures. pub mod opaque { - use super::*; + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; use sp_runtime::{ generic, traits::{BlakeTwo256, Hash as HashT}, }; - pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + use super::*; /// Opaque block header type. pub type Header = generic::Header; /// Opaque block type. @@ -243,10 +237,10 @@ impl Contains for FilteredCalls { matches!( c, RuntimeCall::Balances( - force_adjust_total_issuance { .. } - | force_set_balance { .. } - | force_transfer { .. } - | force_unreserve { .. } + force_adjust_total_issuance { .. } | + force_set_balance { .. } | + force_transfer { .. } | + force_unreserve { .. } ) ) } @@ -265,46 +259,46 @@ impl Contains for AllowedApiCalls { /// but overridden as needed. #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; /// The identifier used to distinguish between accounts. type AccountId = AccountId; - /// The index type for storing how many extrinsics an account has signed. - type Nonce = Nonce; - /// The type for hashing blocks and tries. - type Hash = Hash; + /// The basic call filter to use in dispatchable. Supports everything as the default. + type BaseCallFilter = EverythingBut; /// The block type. type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; - /// Runtime version. - type Version = Version; - /// The data to be stored in an account. - type AccountData = pallet_balances::AccountData; - /// The weight of database operations that the runtime can invoke. - type DbWeight = RocksDbWeight; - /// Block & extrinsics weights: base values and limits. - type BlockWeights = RuntimeBlockWeights; /// The maximum length of a block (in bytes). type BlockLength = RuntimeBlockLength; - /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = SS58Prefix; - /// The basic call filter to use in dispatchable. Supports everything as the default. - type BaseCallFilter = EverythingBut; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + type MaxConsumers = frame_support::traits::ConstU32<16>; + /// The index type for storing how many extrinsics an account has signed. + type Nonce = Nonce; /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = frame_support::traits::ConstU32<16>; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; + /// Runtime version. + type Version = Version; } impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = ConstU64<0>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - type MinimumPeriod = ConstU64<0>; type WeightInfo = (); } impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type EventHandler = (CollatorSelection,); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; } parameter_types! { @@ -312,21 +306,21 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type MaxLocks = ConstU32<50>; + type AccountStore = System; /// The type for recording an account's balance. type Balance = Balance; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; + type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type RuntimeHoldReason = RuntimeHoldReason; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = RuntimeFreezeReason; - type MaxFreezes = VariantCountOf; + type RuntimeHoldReason = RuntimeHoldReason; + type WeightInfo = pallet_balances::weights::SubstrateWeight; } parameter_types! { @@ -335,17 +329,17 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; - type WeightToFee = WeightToFee; - type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; + type LengthToFee = ConstantMultiplier; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; type OperationalFeeMultiplier = ConstU8<5>; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; } impl pallet_sudo::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } @@ -363,17 +357,17 @@ type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< >; impl cumulus_pallet_parachain_system::Config for Runtime { - type WeightInfo = (); - type RuntimeEvent = RuntimeEvent; + type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; + type ConsensusHook = ConsensusHook; + type DmpQueue = frame_support::traits::EnqueueWithOrigin; type OnSystemEvent = (); - type SelfParaId = parachain_info::Pallet; type OutboundXcmpMessageSource = XcmpQueue; - type DmpQueue = frame_support::traits::EnqueueWithOrigin; type ReservedDmpWeight = ReservedDmpWeight; - type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; - type ConsensusHook = ConsensusHook; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type WeightInfo = (); + type XcmpMessageHandler = XcmpQueue; } impl parachain_info::Config for Runtime {} @@ -383,8 +377,9 @@ parameter_types! { } impl pallet_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; + type IdleMaxServiceWeight = (); + type MaxStale = sp_core::ConstU32<8>; #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< cumulus_primitives_core::AggregateMessageOrigin, @@ -395,33 +390,32 @@ impl pallet_message_queue::Config for Runtime { xcm_executor::XcmExecutor, RuntimeCall, >; - type Size = u32; // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: type QueueChangeHandler = NarrowOriginToSibling; type QueuePausedQuery = NarrowOriginToSibling; - type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; - type MaxStale = sp_core::ConstU32<8>; + type RuntimeEvent = RuntimeEvent; type ServiceWeight = MessageQueueServiceWeight; - type IdleMaxServiceWeight = (); + type Size = u32; + type WeightInfo = (); } impl cumulus_pallet_aura_ext::Config for Runtime {} impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type ChannelInfo = ParachainSystem; - type VersionWrapper = (); - // Enqueue XCMP messages from siblings for later processing. - type XcmpQueue = TransformOrigin; - type MaxInboundSuspended = sp_core::ConstU32<1_000>; type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type WeightInfo = (); - type PriceForSiblingDelivery = NoPriceForMessageDelivery; // Limit the number of messages and signals a HRML channel can have at most type MaxActiveOutboundChannels = ConstU32<128>; + type MaxInboundSuspended = sp_core::ConstU32<1_000>; // Limit the number of HRML channels type MaxPageSize = ConstU32<{ 103 * 1024 }>; + type PriceForSiblingDelivery = NoPriceForMessageDelivery; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = (); + // Enqueue XCMP messages from siblings for later processing. + type XcmpQueue = TransformOrigin; } parameter_types! { @@ -430,24 +424,24 @@ parameter_types! { } impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; type RuntimeEvent = RuntimeEvent; + // Essentially just Aura, but let's be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = CollatorSelection; + type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ShouldEndSession = pallet_session::PeriodicSessions; - type NextSessionRotation = pallet_session::PeriodicSessions; - type SessionManager = CollatorSelection; - // Essentially just Aura, but let's be pedantic. - type SessionHandler = ::KeyTypeIdProviders; - type Keys = SessionKeys; type WeightInfo = (); } impl pallet_aura::Config for Runtime { + type AllowMultipleBlocksPerSlot = ConstBool; type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; - type AllowMultipleBlocksPerSlot = ConstBool; type SlotDuration = ConstU64; } @@ -465,15 +459,15 @@ pub type CollatorSelectionUpdateOrigin = EitherOfDiverse< >; impl pallet_collator_selection::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type UpdateOrigin = CollatorSelectionUpdateOrigin; - type PotId = PotId; - type MaxCandidates = ConstU32<100>; - type MinEligibleCollators = ConstU32<4>; - type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; + type MaxCandidates = ConstU32<100>; + type MaxInvulnerables = ConstU32<20>; + type MinEligibleCollators = ConstU32<4>; + type PotId = PotId; + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = CollatorSelectionUpdateOrigin; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; @@ -486,19 +480,19 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = EnsureRoot; #[cfg(feature = "runtime-benchmarks")] type MaxScheduledPerBlock = ConstU32<512>; #[cfg(not(feature = "runtime-benchmarks"))] type MaxScheduledPerBlock = ConstU32<50>; - type WeightInfo = pallet_scheduler::weights::SubstrateWeight; + type MaximumWeight = MaximumSchedulerWeight; type OriginPrivilegeCmp = EqualPrivilegeOnly; + type PalletsOrigin = OriginCaller; type Preimages = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = EnsureRoot; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; } parameter_types! { @@ -508,16 +502,16 @@ parameter_types! { } impl pallet_preimage::Config for Runtime { - type WeightInfo = pallet_preimage::weights::SubstrateWeight; - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type ManagerOrigin = EnsureRoot; type Consideration = HoldConsideration< AccountId, Balances, PreimageHoldReason, LinearStoragePrice, >; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_preimage::weights::SubstrateWeight; } parameter_types! { @@ -529,19 +523,19 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_multisig::weights::SubstrateWeight; } impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_utility::weights::SubstrateWeight; } diff --git a/runtime/devnet/src/weights/paritydb_weights.rs b/runtime/devnet/src/weights/paritydb_weights.rs index 25679703..27f7f1b0 100644 --- a/runtime/devnet/src/weights/paritydb_weights.rs +++ b/runtime/devnet/src/weights/paritydb_weights.rs @@ -32,9 +32,10 @@ pub mod constants { #[cfg(test)] mod test_db_weights { - use super::constants::ParityDbWeight as W; use frame_support::weights::constants; + use super::constants::ParityDbWeight as W; + /// Checks that all weights exist and have sane values. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. diff --git a/runtime/devnet/src/weights/rocksdb_weights.rs b/runtime/devnet/src/weights/rocksdb_weights.rs index 3dd817aa..bacad98c 100644 --- a/runtime/devnet/src/weights/rocksdb_weights.rs +++ b/runtime/devnet/src/weights/rocksdb_weights.rs @@ -32,9 +32,10 @@ pub mod constants { #[cfg(test)] mod test_db_weights { - use super::constants::RocksDbWeight as W; use frame_support::weights::constants; + use super::constants::RocksDbWeight as W; + /// Checks that all weights exist and have sane values. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. diff --git a/runtime/testnet/Cargo.toml b/runtime/testnet/Cargo.toml index 9d33d3ef..e7c237e5 100644 --- a/runtime/testnet/Cargo.toml +++ b/runtime/testnet/Cargo.toml @@ -1,15 +1,15 @@ [package] -name = "pop-runtime-testnet" -version = "0.4.0" authors.workspace = true description.workspace = true -license = "Unlicense" +edition.workspace = true homepage.workspace = true +license = "Unlicense" +name = "pop-runtime-testnet" repository.workspace = true -edition.workspace = true +version = "0.4.0" [package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +targets = [ "x86_64-unknown-linux-gnu" ] [build-dependencies] substrate-wasm-builder.workspace = true @@ -34,9 +34,9 @@ frame-system.workspace = true frame-system-benchmarking.workspace = true frame-system-rpc-runtime-api.workspace = true frame-try-runtime.workspace = true +pallet-assets.workspace = true pallet-aura.workspace = true pallet-authorship.workspace = true -pallet-assets.workspace = true pallet-balances.workspace = true pallet-contracts.workspace = true pallet-message-queue.workspace = true @@ -44,22 +44,22 @@ pallet-multisig.workspace = true pallet-nft-fractionalization.workspace = true pallet-nfts.workspace = true pallet-nfts-runtime-api.workspace = true +pallet-preimage.workspace = true +pallet-proxy.workspace = true pallet-scheduler.workspace = true pallet-session.workspace = true pallet-sudo.workspace = true -pallet-preimage.workspace = true -pallet-proxy.workspace = true pallet-timestamp.workspace = true pallet-transaction-payment.workspace = true pallet-transaction-payment-rpc-runtime-api.workspace = true pallet-utility.workspace = true sp-api.workspace = true -sp-io.workspace = true sp-block-builder.workspace = true sp-consensus-aura.workspace = true sp-core.workspace = true sp-genesis-builder.workspace = true sp-inherents.workspace = true +sp-io.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true @@ -86,145 +86,147 @@ cumulus-primitives-core.workspace = true cumulus-primitives-storage-weight-reclaim.workspace = true cumulus-primitives-utility.workspace = true pallet-collator-selection.workspace = true -parachains-common.workspace = true parachain-info.workspace = true +parachains-common.workspace = true [dev-dependencies] +enumflags2 = "0.7.9" env_logger = "0.11.2" hex = "0.4.3" -enumflags2 = "0.7.9" [features] -default = ["std"] +default = [ "std" ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", - "cumulus-primitives-utility/std", - "frame-benchmarking/std", - "frame-executive/std", - "frame-metadata-hash-extension/std", - "frame-support/std", - "frame-system-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime/std", - "log/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-assets/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-contracts/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-nft-fractionalization/std", - "pallet-nfts/std", - "pallet-nfts-runtime-api/std", - "pallet-scheduler/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "polkadot-parachain-primitives/std", - "polkadot-runtime-common/std", - "pop-primitives/std", - "scale-info/std", - "sp-api/std", - "sp-io/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-storage-weight-reclaim/std", + "cumulus-primitives-utility/std", + "frame-benchmarking/std", + "frame-executive/std", + "frame-metadata-hash-extension/std", + "frame-support/std", + "frame-system-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "log/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-contracts/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-nft-fractionalization/std", + "pallet-nfts-runtime-api/std", + "pallet-nfts/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "pop-primitives/std", + "pop-runtime-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nft-fractionalization/runtime-benchmarks", - "pallet-nfts/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", + "pallet-nfts/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-assets/try-runtime", - "pallet-balances/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-contracts/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nft-fractionalization/try-runtime", - "pallet-nfts/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-contracts/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", + "pallet-nfts/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # Enable the metadata hash generation. @@ -234,8 +236,8 @@ try-runtime = [ # generate the metadata hash and then a second time with the # `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` # extension. -metadata-hash = ["substrate-wasm-builder/metadata-hash"] +metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] # A convenience feature for enabling things when doing a build # for an on-chain release. -on-chain-release-build = ["metadata-hash"] +on-chain-release-build = [ "metadata-hash" ] diff --git a/runtime/testnet/src/config/assets.rs b/runtime/testnet/src/config/assets.rs index 34035c1f..d66358a6 100644 --- a/runtime/testnet/src/config/assets.rs +++ b/runtime/testnet/src/config/assets.rs @@ -1,7 +1,3 @@ -use crate::{ - deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, - RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, -}; use frame_support::{ parameter_types, traits::{AsEnsureOriginWithArg, ConstU32}, @@ -12,6 +8,11 @@ use pallet_nfts::PalletFeatures; use parachains_common::{AssetIdForTrustBackedAssets, CollectionId, ItemId, Signature}; use sp_runtime::traits::Verify; +use crate::{ + deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, + RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, +}; + /// We allow root to execute privileged asset operations. pub type AssetsForceOrigin = EnsureRoot; @@ -37,36 +38,36 @@ parameter_types! { } impl pallet_nfts::Config for Runtime { - type RuntimeEvent = RuntimeEvent; // TODO: source from primitives - type CollectionId = CollectionId; + type ApprovalsLimit = ConstU32<20>; + type AttributeDepositBase = NftsAttributeDepositBase; + type CollectionDeposit = NftsCollectionDeposit; // TODO: source from primitives - type ItemId = ItemId; - type Currency = Balances; + type CollectionId = CollectionId; type CreateOrigin = AsEnsureOriginWithArg>; + type Currency = Balances; + type DepositPerByte = NftsDepositPerByte; + type Features = NftsPalletFeatures; type ForceOrigin = AssetsForceOrigin; - type Locker = (); - type CollectionDeposit = NftsCollectionDeposit; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); + type ItemAttributesApprovalsLimit = ConstU32<30>; type ItemDeposit = NftsItemDeposit; - type MetadataDepositBase = NftsMetadataDepositBase; - type AttributeDepositBase = NftsAttributeDepositBase; - type DepositPerByte = NftsDepositPerByte; - type StringLimit = ConstU32<256>; // TODO: source from primitives - type KeyLimit = ConstU32<64>; - type ValueLimit = ConstU32<256>; + type ItemId = ItemId; // TODO: source from primitives - type ApprovalsLimit = ConstU32<20>; - type ItemAttributesApprovalsLimit = ConstU32<30>; - type MaxTips = ConstU32<10>; - type MaxDeadlineDuration = NftsMaxDeadlineDuration; + type KeyLimit = ConstU32<64>; + type Locker = (); type MaxAttributesPerCall = ConstU32<10>; - type Features = NftsPalletFeatures; - type OffchainSignature = Signature; + type MaxDeadlineDuration = NftsMaxDeadlineDuration; + type MaxTips = ConstU32<10>; + type MetadataDepositBase = NftsMetadataDepositBase; type OffchainPublic = ::Signer; + type OffchainSignature = Signature; + type RuntimeEvent = RuntimeEvent; + type StringLimit = ConstU32<256>; + type ValueLimit = ConstU32<256>; type WeightInfo = pallet_nfts::weights::SubstrateWeight; - #[cfg(feature = "runtime-benchmarks")] - type Helper = (); } parameter_types! { @@ -76,46 +77,46 @@ parameter_types! { } impl pallet_nft_fractionalization::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Deposit = AssetDeposit; + type AssetBalance = >::Balance; + type AssetId = >::AssetId; + type Assets = Assets; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); type Currency = Balances; - type NewAssetSymbol = NewAssetSymbol; + type Deposit = AssetDeposit; type NewAssetName = NewAssetName; - type StringLimit = AssetsStringLimit; + type NewAssetSymbol = NewAssetSymbol; type NftCollectionId = ::CollectionId; type NftId = ::ItemId; - type AssetBalance = >::Balance; - type AssetId = >::AssetId; - type Assets = Assets; type Nfts = Nfts; type PalletId = NftFractionalizationPalletId; - type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; + type RuntimeEvent = RuntimeEvent; type RuntimeHoldReason = RuntimeHoldReason; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); + type StringLimit = AssetsStringLimit; + type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; } pub type TrustBackedAssets = pallet_assets::Instance1; pub type TrustBackedAssetsCall = pallet_assets::Call; impl pallet_assets::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; + type ApprovalDeposit = ApprovalDeposit; + type AssetAccountDeposit = AssetAccountDeposit; + type AssetDeposit = AssetDeposit; type AssetId = AssetIdForTrustBackedAssets; type AssetIdParameter = codec::Compact; - type Currency = Balances; + type Balance = Balance; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + type CallbackHandle = (); type CreateOrigin = AsEnsureOriginWithArg>; + type Currency = Balances; + type Extra = (); type ForceOrigin = AssetsForceOrigin; - type AssetDeposit = AssetDeposit; + type Freezer = (); type MetadataDepositBase = MetadataDepositBase; type MetadataDepositPerByte = MetadataDepositPerByte; - type ApprovalDeposit = ApprovalDeposit; + type RemoveItemsLimit = ConstU32<1000>; + type RuntimeEvent = RuntimeEvent; type StringLimit = AssetsStringLimit; - type Freezer = (); - type Extra = (); type WeightInfo = pallet_assets::weights::SubstrateWeight; - type CallbackHandle = (); - type AssetAccountDeposit = AssetAccountDeposit; - type RemoveItemsLimit = ConstU32<1000>; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); } diff --git a/runtime/testnet/src/config/contracts.rs b/runtime/testnet/src/config/contracts.rs index 80c02517..f052b1d3 100644 --- a/runtime/testnet/src/config/contracts.rs +++ b/runtime/testnet/src/config/contracts.rs @@ -1,13 +1,14 @@ -use crate::{ - deposit, extensions, Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, - RuntimeEvent, RuntimeHoldReason, Timestamp, -}; use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Randomness}, }; use frame_system::{pallet_prelude::BlockNumberFor, EnsureSigned}; +use crate::{ + deposit, extensions, Balance, Balances, BalancesCall, Perbill, Runtime, RuntimeCall, + RuntimeEvent, RuntimeHoldReason, Timestamp, +}; + pub enum AllowBalancesCall {} impl frame_support::traits::Contains for AllowBalancesCall { @@ -45,12 +46,8 @@ parameter_types! { } impl pallet_contracts::Config for Runtime { - type Time = Timestamp; - type Randomness = DummyRandomness; - type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - + type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + type ApiVersion = (); /// The safest default is to allow no calls at all. /// /// Runtimes should whitelist dispatchables that are allowed to be called from contracts @@ -58,14 +55,16 @@ impl pallet_contracts::Config for Runtime { /// change because that would break already deployed contracts. The `RuntimeCall` structure /// itself is not allowed to change the indices of existing pallets, too. type CallFilter = AllowBalancesCall; - type DepositPerItem = DepositPerItem; - type DepositPerByte = DepositPerByte; type CallStack = [pallet_contracts::Frame; 23]; - type WeightPrice = pallet_transaction_payment::Pallet; - type WeightInfo = pallet_contracts::weights::SubstrateWeight; type ChainExtension = extensions::PopApiExtension; - type Schedule = Schedule; - type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; + type Currency = Balances; + type Debug = (); + type DefaultDepositLimit = DefaultDepositLimit; + type DepositPerByte = DepositPerByte; + type DepositPerItem = DepositPerItem; + type Environment = (); + type InstantiateOrigin = EnsureSigned; // This node is geared towards development and testing of contracts. // We decided to increase the default allowed contract size for this // reason (the default is `128 * 1024`). @@ -75,19 +74,19 @@ impl pallet_contracts::Config for Runtime { // less friction during development when the requirement here is // just more lax. type MaxCodeLen = ConstU32<{ 256 * 1024 }>; - type DefaultDepositLimit = DefaultDepositLimit; - type MaxStorageKeyLen = ConstU32<128>; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; - type UnsafeUnstableInterface = ConstBool; - type UploadOrigin = EnsureSigned; - type InstantiateOrigin = EnsureSigned; - type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type MaxDelegateDependencies = ConstU32<32>; - type RuntimeHoldReason = RuntimeHoldReason; - - type ApiVersion = (); - type Environment = (); - type Debug = (); + type MaxStorageKeyLen = ConstU32<128>; type Migrations = (pallet_contracts::migration::v16::Migration,); + type Randomness = DummyRandomness; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = RuntimeHoldReason; + type Schedule = Schedule; + type Time = Timestamp; + type UnsafeUnstableInterface = ConstBool; + type UploadOrigin = EnsureSigned; + type WeightInfo = pallet_contracts::weights::SubstrateWeight; + type WeightPrice = pallet_transaction_payment::Pallet; type Xcm = pallet_xcm::Pallet; } diff --git a/runtime/testnet/src/config/proxy.rs b/runtime/testnet/src/config/proxy.rs index a4fd479a..ff70240e 100644 --- a/runtime/testnet/src/config/proxy.rs +++ b/runtime/testnet/src/config/proxy.rs @@ -1,5 +1,3 @@ -use super::assets::TrustBackedAssetsCall; -use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; use frame_support::traits::InstanceFilter; use pop_runtime_common::proxy::{ AnnouncementDepositBase, AnnouncementDepositFactor, MaxPending, MaxProxies, ProxyDepositBase, @@ -7,83 +5,86 @@ use pop_runtime_common::proxy::{ }; use sp_runtime::traits::BlakeTwo256; +use super::assets::TrustBackedAssetsCall; +use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; + impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, ProxyType::NonTransfer => !matches!( c, - RuntimeCall::Balances { .. } - | RuntimeCall::Assets { .. } - | RuntimeCall::Nfts { .. } + RuntimeCall::Balances { .. } | + RuntimeCall::Assets { .. } | + RuntimeCall::Nfts { .. } ), ProxyType::CancelProxy => matches!( c, - RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::Assets => { matches!( c, - RuntimeCall::Assets { .. } - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } - | RuntimeCall::Nfts { .. } + RuntimeCall::Assets { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } | + RuntimeCall::Nfts { .. } ) }, ProxyType::AssetOwner => matches!( c, - RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_team { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_collection_max_supply { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_collection { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Assets(TrustBackedAssetsCall::create { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::start_destroy { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::destroy_accounts { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::destroy_approvals { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::finish_destroy { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::transfer_ownership { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::transfer_ownership { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_team { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_max_supply { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_collection { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::AssetManager => matches!( c, - RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) - | RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_attributes_pre_signed { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::unlock_item_transfer { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::lock_item_properties { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::clear_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::set_collection_metadata { .. }) - | RuntimeCall::Nfts(pallet_nfts::Call::clear_collection_metadata { .. }) - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_attributes_pre_signed { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::unlock_item_transfer { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::lock_item_properties { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::set_collection_metadata { .. }) | + RuntimeCall::Nfts(pallet_nfts::Call::clear_collection_metadata { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), ProxyType::Collator => matches!( c, - RuntimeCall::CollatorSelection { .. } - | RuntimeCall::Utility { .. } - | RuntimeCall::Multisig { .. } + RuntimeCall::CollatorSelection { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } ), } } @@ -94,16 +95,16 @@ impl InstanceFilter for ProxyType { } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; + type CallHasher = BlakeTwo256; type Currency = Balances; - type ProxyType = ProxyType; + type MaxPending = MaxPending; + type MaxProxies = MaxProxies; type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; + type ProxyType = ProxyType; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_proxy::weights::SubstrateWeight; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; } diff --git a/runtime/testnet/src/config/xcm.rs b/runtime/testnet/src/config/xcm.rs index a8d5f552..d548c2cb 100644 --- a/runtime/testnet/src/config/xcm.rs +++ b/runtime/testnet/src/config/xcm.rs @@ -1,8 +1,5 @@ -use crate::{ - AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, - Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, -}; use core::marker::PhantomData; + use frame_support::{ parameter_types, traits::{ConstU32, Contains, ContainsPair, Everything, Get, Nothing}, @@ -23,6 +20,11 @@ use xcm_builder::{ }; use xcm_executor::XcmExecutor; +use crate::{ + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, +}; + parameter_types! { pub const RelayLocation: Location = Location::parent(); pub AssetHub: Location = Location::new(1, [Parachain(1000)]); @@ -116,8 +118,8 @@ pub struct NativeAssetFrom(PhantomData); impl> ContainsPair for NativeAssetFrom { fn contains(asset: &Asset, origin: &Location) -> bool { let loc = T::get(); - &loc == origin - && matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) } + &loc == origin && + matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) } if *asset_loc == Location::from(Parent)) } } @@ -125,37 +127,38 @@ pub type TrustedReserves = (NativeAsset, NativeAssetFrom); pub struct XcmConfig; impl xcm_executor::Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; + type Aliasers = Nothing; + type AssetClaims = PolkadotXcm; + type AssetExchanger = (); + type AssetLocker = (); // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; - type OriginConverter = XcmOriginToTransactDispatchOrigin; - type IsReserve = TrustedReserves; - type IsTeleporter = (); // Teleporting is disabled. - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - type Trader = - UsingComponents>; - type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; - type AssetClaims = PolkadotXcm; - type SubscriptionService = PolkadotXcm; - type PalletInstancesInfo = AllPalletsWithSystem; - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type AssetLocker = (); - type AssetExchanger = (); + type Barrier = Barrier; + type CallDispatcher = RuntimeCall; type FeeManager = (); + type HrmpChannelAcceptedHandler = (); + type HrmpChannelClosingHandler = (); + type HrmpNewChannelOpenRequestHandler = (); + type IsReserve = TrustedReserves; + type IsTeleporter = (); + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type PalletInstancesInfo = AllPalletsWithSystem; + type ResponseHandler = PolkadotXcm; + type RuntimeCall = RuntimeCall; type SafeCallFilter = Everything; - type Aliasers = Nothing; + type SubscriptionService = PolkadotXcm; + type Trader = + UsingComponents>; type TransactionalProcessor = FrameTransactionalProcessor; - type HrmpNewChannelOpenRequestHandler = (); - type HrmpChannelAcceptedHandler = (); - type HrmpChannelClosingHandler = (); + type UniversalAliases = Nothing; + // Teleporting is disabled. + type UniversalLocation = UniversalLocation; + type Weigher = FixedWeightBounds; type XcmRecorder = PolkadotXcm; + type XcmSender = XcmRouter; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -171,34 +174,34 @@ pub type XcmRouter = WithUniqueTopic<( )>; impl pallet_xcm::Config for Runtime { + type AdminOrigin = EnsureRoot; + // ^ Override for AdvertisedXcmVersion default. + type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type ExecuteXcmOrigin = EnsureXcmOrigin; + type MaxLockers = ConstU32<8>; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); + type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; + type SovereignAccountOf = LocationToAccountId; + type TrustedLockers = (); + type UniversalLocation = UniversalLocation; + type Weigher = FixedWeightBounds; + type WeightInfo = pallet_xcm::TestWeightInfo; type XcmExecuteFilter = Nothing; // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Everything; // TODO: add filter to only allow reserve transfers of native to relay/asset hub type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type UniversalLocation = UniversalLocation; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; + type XcmRouter = XcmRouter; + type XcmTeleportFilter = Everything; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - // ^ Override for AdvertisedXcmVersion default - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = LocationToAccountId; - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - type MaxRemoteLockConsumers = ConstU32<0>; - type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/runtime/testnet/src/extensions.rs b/runtime/testnet/src/extensions.rs index 9e5af893..3e84c834 100644 --- a/runtime/testnet/src/extensions.rs +++ b/runtime/testnet/src/extensions.rs @@ -1,12 +1,14 @@ -use frame_support::traits::{Contains, OriginTrait}; use frame_support::{ dispatch::{GetDispatchInfo, RawOrigin}, pallet_prelude::*, + traits::{Contains, OriginTrait}, }; -use pallet_contracts::chain_extension::{ - BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, +use pallet_contracts::{ + chain_extension::{ + BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, + }, + WeightInfo, }; -use pallet_contracts::WeightInfo; use pop_primitives::storage_keys::RuntimeStateKeys; use sp_core::crypto::UncheckedFrom; use sp_runtime::{traits::Dispatchable, DispatchError}; diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index e42c9ad4..ab52c9ab 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -10,24 +10,8 @@ mod config; mod extensions; mod weights; -use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; -use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; -use smallvec::smallvec; -use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; -use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, -}; - -use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; - use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; +use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ derive_impl, @@ -49,26 +33,35 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, }; +use pallet_balances::Call as BalancesCall; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; +use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; +// Polkadot imports +use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; pub use pop_runtime_common::{ deposit, AuraId, Balance, BlockNumber, Hash, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, BLOCK_PROCESSING_VELOCITY, DAYS, EXISTENTIAL_DEPOSIT, HOURS, MAXIMUM_BLOCK_WEIGHT, MICROUNIT, MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT, }; -pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; - +use smallvec::smallvec; +use sp_api::impl_runtime_apis; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; - -use pallet_balances::Call as BalancesCall; - -// Polkadot imports -use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; - +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; - // XCM Imports use xcm::latest::prelude::BodyId; @@ -139,6 +132,7 @@ pub type Executive = frame_executive::Executive< pub struct WeightToFee; impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: // we map to 1/10 of that, or 1/10 MILLIUNIT @@ -158,13 +152,13 @@ impl WeightToFeePolynomial for WeightToFee { /// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// to even the core data structures. pub mod opaque { - use super::*; + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; use sp_runtime::{ generic, traits::{BlakeTwo256, Hash as HashT}, }; - pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + use super::*; /// Opaque block header type. pub type Header = generic::Header; /// Opaque block type. @@ -250,10 +244,10 @@ impl Contains for FilteredCalls { matches!( c, RuntimeCall::Balances( - force_adjust_total_issuance { .. } - | force_set_balance { .. } - | force_transfer { .. } - | force_unreserve { .. } + force_adjust_total_issuance { .. } | + force_set_balance { .. } | + force_transfer { .. } | + force_unreserve { .. } ) ) } @@ -272,46 +266,46 @@ impl Contains for AllowedApiCalls { /// but overridden as needed. #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; /// The identifier used to distinguish between accounts. type AccountId = AccountId; - /// The index type for storing how many extrinsics an account has signed. - type Nonce = Nonce; - /// The type for hashing blocks and tries. - type Hash = Hash; + /// The basic call filter to use in dispatchable. Supports everything as the default. + type BaseCallFilter = EverythingBut; /// The block type. type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; - /// Runtime version. - type Version = Version; - /// The data to be stored in an account. - type AccountData = pallet_balances::AccountData; - /// The weight of database operations that the runtime can invoke. - type DbWeight = RocksDbWeight; - /// Block & extrinsics weights: base values and limits. - type BlockWeights = RuntimeBlockWeights; /// The maximum length of a block (in bytes). type BlockLength = RuntimeBlockLength; - /// This is used as an identifier of the chain. 42 is the generic substrate prefix. - type SS58Prefix = SS58Prefix; - /// The basic call filter to use in dispatchable. Supports everything as the default. - type BaseCallFilter = EverythingBut; + /// Block & extrinsics weights: base values and limits. + type BlockWeights = RuntimeBlockWeights; + /// The weight of database operations that the runtime can invoke. + type DbWeight = RocksDbWeight; + /// The type for hashing blocks and tries. + type Hash = Hash; + type MaxConsumers = frame_support::traits::ConstU32<16>; + /// The index type for storing how many extrinsics an account has signed. + type Nonce = Nonce; /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = frame_support::traits::ConstU32<16>; + /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type SS58Prefix = SS58Prefix; + /// Runtime version. + type Version = Version; } impl pallet_timestamp::Config for Runtime { + type MinimumPeriod = ConstU64<0>; /// A timestamp: milliseconds since the unix epoch. type Moment = u64; type OnTimestampSet = Aura; - type MinimumPeriod = ConstU64<0>; type WeightInfo = (); } impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; type EventHandler = (CollatorSelection,); + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; } parameter_types! { @@ -319,21 +313,21 @@ parameter_types! { } impl pallet_balances::Config for Runtime { - type MaxLocks = ConstU32<50>; + type AccountStore = System; /// The type for recording an account's balance. type Balance = Balance; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; + type MaxLocks = ConstU32<50>; type MaxReserves = ConstU32<50>; type ReserveIdentifier = [u8; 8]; - type RuntimeHoldReason = RuntimeHoldReason; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = RuntimeFreezeReason; - type MaxFreezes = VariantCountOf; + type RuntimeHoldReason = RuntimeHoldReason; + type WeightInfo = pallet_balances::weights::SubstrateWeight; } parameter_types! { @@ -342,17 +336,17 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; - type WeightToFee = WeightToFee; - type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; + type LengthToFee = ConstantMultiplier; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; type OperationalFeeMultiplier = ConstU8<5>; + type RuntimeEvent = RuntimeEvent; + type WeightToFee = WeightToFee; } impl pallet_sudo::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } @@ -370,17 +364,17 @@ type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< >; impl cumulus_pallet_parachain_system::Config for Runtime { - type WeightInfo = (); - type RuntimeEvent = RuntimeEvent; + type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; + type ConsensusHook = ConsensusHook; + type DmpQueue = frame_support::traits::EnqueueWithOrigin; type OnSystemEvent = (); - type SelfParaId = parachain_info::Pallet; type OutboundXcmpMessageSource = XcmpQueue; - type DmpQueue = frame_support::traits::EnqueueWithOrigin; type ReservedDmpWeight = ReservedDmpWeight; - type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases; - type ConsensusHook = ConsensusHook; + type RuntimeEvent = RuntimeEvent; + type SelfParaId = parachain_info::Pallet; + type WeightInfo = (); + type XcmpMessageHandler = XcmpQueue; } impl parachain_info::Config for Runtime {} @@ -390,8 +384,9 @@ parameter_types! { } impl pallet_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; + type IdleMaxServiceWeight = (); + type MaxStale = sp_core::ConstU32<8>; #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< cumulus_primitives_core::AggregateMessageOrigin, @@ -402,33 +397,32 @@ impl pallet_message_queue::Config for Runtime { xcm_executor::XcmExecutor, RuntimeCall, >; - type Size = u32; // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: type QueueChangeHandler = NarrowOriginToSibling; type QueuePausedQuery = NarrowOriginToSibling; - type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; - type MaxStale = sp_core::ConstU32<8>; + type RuntimeEvent = RuntimeEvent; type ServiceWeight = MessageQueueServiceWeight; - type IdleMaxServiceWeight = (); + type Size = u32; + type WeightInfo = (); } impl cumulus_pallet_aura_ext::Config for Runtime {} impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type ChannelInfo = ParachainSystem; - type VersionWrapper = (); - // Enqueue XCMP messages from siblings for later processing. - type XcmpQueue = TransformOrigin; - type MaxInboundSuspended = sp_core::ConstU32<1_000>; type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type WeightInfo = (); - type PriceForSiblingDelivery = NoPriceForMessageDelivery; // Limit the number of messages and signals a HRML channel can have at most type MaxActiveOutboundChannels = ConstU32<128>; + type MaxInboundSuspended = sp_core::ConstU32<1_000>; // Limit the number of HRML channels type MaxPageSize = ConstU32<{ 103 * 1024 }>; + type PriceForSiblingDelivery = NoPriceForMessageDelivery; + type RuntimeEvent = RuntimeEvent; + type VersionWrapper = (); + type WeightInfo = (); + // Enqueue XCMP messages from siblings for later processing. + type XcmpQueue = TransformOrigin; } impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime { @@ -442,24 +436,24 @@ parameter_types! { } impl pallet_session::Config for Runtime { + type Keys = SessionKeys; + type NextSessionRotation = pallet_session::PeriodicSessions; type RuntimeEvent = RuntimeEvent; + // Essentially just Aura, but let's be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type SessionManager = CollatorSelection; + type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = ::AccountId; // we don't have stash and controller, thus we don't need the convert as well. type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ShouldEndSession = pallet_session::PeriodicSessions; - type NextSessionRotation = pallet_session::PeriodicSessions; - type SessionManager = CollatorSelection; - // Essentially just Aura, but let's be pedantic. - type SessionHandler = ::KeyTypeIdProviders; - type Keys = SessionKeys; type WeightInfo = (); } impl pallet_aura::Config for Runtime { + type AllowMultipleBlocksPerSlot = ConstBool; type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; - type AllowMultipleBlocksPerSlot = ConstBool; type SlotDuration = ConstU64; } @@ -477,15 +471,15 @@ pub type CollatorSelectionUpdateOrigin = EitherOfDiverse< >; impl pallet_collator_selection::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type UpdateOrigin = CollatorSelectionUpdateOrigin; - type PotId = PotId; - type MaxCandidates = ConstU32<100>; - type MinEligibleCollators = ConstU32<4>; - type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; + type MaxCandidates = ConstU32<100>; + type MaxInvulnerables = ConstU32<20>; + type MinEligibleCollators = ConstU32<4>; + type PotId = PotId; + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = CollatorSelectionUpdateOrigin; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; @@ -498,19 +492,19 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = EnsureRoot; #[cfg(feature = "runtime-benchmarks")] type MaxScheduledPerBlock = ConstU32<512>; #[cfg(not(feature = "runtime-benchmarks"))] type MaxScheduledPerBlock = ConstU32<50>; - type WeightInfo = pallet_scheduler::weights::SubstrateWeight; + type MaximumWeight = MaximumSchedulerWeight; type OriginPrivilegeCmp = EqualPrivilegeOnly; + type PalletsOrigin = OriginCaller; type Preimages = Preimage; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type ScheduleOrigin = EnsureRoot; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; } parameter_types! { @@ -520,16 +514,16 @@ parameter_types! { } impl pallet_preimage::Config for Runtime { - type WeightInfo = pallet_preimage::weights::SubstrateWeight; - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type ManagerOrigin = EnsureRoot; type Consideration = HoldConsideration< AccountId, Balances, PreimageHoldReason, LinearStoragePrice, >; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_preimage::weights::SubstrateWeight; } parameter_types! { @@ -541,19 +535,19 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_multisig::weights::SubstrateWeight; } impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_utility::weights::SubstrateWeight; } diff --git a/runtime/testnet/src/weights/paritydb_weights.rs b/runtime/testnet/src/weights/paritydb_weights.rs index 25679703..27f7f1b0 100644 --- a/runtime/testnet/src/weights/paritydb_weights.rs +++ b/runtime/testnet/src/weights/paritydb_weights.rs @@ -32,9 +32,10 @@ pub mod constants { #[cfg(test)] mod test_db_weights { - use super::constants::ParityDbWeight as W; use frame_support::weights::constants; + use super::constants::ParityDbWeight as W; + /// Checks that all weights exist and have sane values. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. diff --git a/runtime/testnet/src/weights/rocksdb_weights.rs b/runtime/testnet/src/weights/rocksdb_weights.rs index 3dd817aa..bacad98c 100644 --- a/runtime/testnet/src/weights/rocksdb_weights.rs +++ b/runtime/testnet/src/weights/rocksdb_weights.rs @@ -32,9 +32,10 @@ pub mod constants { #[cfg(test)] mod test_db_weights { - use super::constants::RocksDbWeight as W; use frame_support::weights::constants; + use super::constants::RocksDbWeight as W; + /// Checks that all weights exist and have sane values. // NOTE: If this test fails but you are sure that the generated values are fine, // you can delete it. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 12d44b03..a7445512 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "stable" -components = ["rust-src", "rustfmt", "clippy"] -targets = ["wasm32-unknown-unknown"] +components = [ "clippy", "rust-src", "rustfmt" ] +targets = [ "wasm32-unknown-unknown" ] diff --git a/tests/contracts/filtered-call/Cargo.toml b/tests/contracts/filtered-call/Cargo.toml index 53148822..091beabe 100755 --- a/tests/contracts/filtered-call/Cargo.toml +++ b/tests/contracts/filtered-call/Cargo.toml @@ -1,21 +1,21 @@ [package] -name = "pop_api_filtered_call" edition = "2021" +name = "pop_api_filtered_call" [dependencies] ink = { version = "5.0.0", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"], optional = true } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ "derive" ] } +scale-info = { version = "2.6", default-features = false, features = [ "derive" ], optional = true } [lib] path = "lib.rs" [features] -default = ["std"] +default = [ "std" ] +e2e-tests = [ ] +ink-as-dependency = [ ] std = [ - "ink/std", - "scale/std", - "scale-info/std", + "ink/std", + "scale-info/std", + "scale/std", ] -ink-as-dependency = [] -e2e-tests = []