diff --git a/Cargo.toml b/Cargo.toml index 7027423c..384493f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,175 +2,181 @@ 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 = [ "extension/contract", "pop-api", "tests/contracts" ] members = [ - "node", - "runtime/devnet", - "runtime/testnet", - "integration-tests", - "pallets/*", - "primitives", + "integration-tests", + "node", + "pallets/*", + "primitives", + "runtime/devnet", + "runtime/testnet", ] -exclude = ["extension/contract", "pop-api", "tests/contracts"] resolver = "2" [workspace.dependencies] +clap = { version = "4.4.18", features = [ "derive" ] } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ - "derive", + "derive", ] } contract-build = "4.1.1" env_logger = "0.11.5" +futures = "0.3.28" hex-literal = "0.4.1" impl-trait-for-tuples = "0.2.2" +jsonrpsee = { version = "0.23.2", features = [ "server" ] } log = { version = "0.4.20", default-features = false } +rand = "0.8.5" scale-info = { version = "2.10.0", default-features = false, features = [ - "derive", + "derive", ] } -smallvec = "1.11.0" serde = "1.0.195" -clap = { version = "4.4.18", features = ["derive"] } -jsonrpsee = { version = "0.20.3", features = ["server"] } -futures = "0.3.28" -rand = "0.8.5" serde_json = "1.0.111" -tracing-subscriber = { version = "0.3", default-features = false } +smallvec = "1.11.0" 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-wasm-builder = "18.0.1" substrate-build-script-utils = "11.0.0" +substrate-wasm-builder = "23.0.0" # Local pallet-api = { path = "pallets/api", default-features = false } pop-chain-extension = { path = "./extension", default-features = false } +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.35.0" -sc-chain-spec = "28.0.0" -sc-cli = "0.37.0" -sc-client-api = "29.0.0" -sc-offchain = "30.0.0" -sc-consensus = "0.34.0" -sc-executor = "0.33.0" -sc-network = "0.35.0" -sc-network-sync = "0.34.0" -sc-rpc = "30.0.0" -sc-service = "0.36.0" -sc-sysinfo = "28.0.0" -sc-telemetry = "16.0.0" -sc-tracing = "29.0.0" -sc-transaction-pool = "29.0.0" -sc-transaction-pool-api = "29.0.0" -frame-benchmarking = { version = "29.0.0", default-features = false } -frame-benchmarking-cli = "33.0.0" -frame-executive = { version = "29.0.0", default-features = false } -frame-support = { version = "29.0.2", default-features = false } -frame-system = { version = "29.0.0", default-features = false } -frame-system-benchmarking = { version = "29.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "27.0.0", default-features = false } -frame-try-runtime = { version = "0.35.0", default-features = false } -pallet-aura = { version = "28.0.0", default-features = false, features = [ - "experimental", -] } -pallet-authorship = { version = "29.0.0", default-features = false } -pallet-assets = { version = "30.0.0", default-features = false } -pallet-balances = { version = "29.0.2", default-features = false } -pallet-contracts = { version = "28.0.0", default-features = false } -pallet-message-queue = { version = "32.0.0", default-features = false } -pallet-multisig = { version = "29.0.0", default-features = false } -pallet-nft-fractionalization = { version = "11.0.0", default-features = false } -pallet-nfts = { version = "23.0.0", default-features = false } -pallet-nfts-runtime-api = { version = "15.0.0", default-features = false } -pallet-preimage = { version = "29.0.0", default-features = false } -pallet-proxy = { version = "29.0.0", default-features = false } -pallet-scheduler = { version = "30.0.0", default-features = false } -pallet-session = { version = "29.0.0", default-features = false } -pallet-sudo = { version = "29.0.0", default-features = false } -pallet-timestamp = { version = "28.0.0", default-features = false } -pallet-transaction-payment = { version = "29.0.2", default-features = false } -pallet-transaction-payment-rpc = "31.0.0" -pallet-transaction-payment-rpc-runtime-api = { version = "29.0.0", default-features = false } -pallet-utility = { version = "29.0.0", default-features = false } -sp-api = { version = "27.0.1", default-features = false } -sp-authority-discovery = { version = "27.0.0", default-features = false } -sp-block-builder = { version = "27.0.0", default-features = false } -sp-blockchain = "29.0.0" -sp-consensus-aura = { version = "0.33.0", default-features = false } -sp-consensus-babe = { version = "0.33.0", default-features = false } -sp-consensus-beefy = { version = "14.0.0", default-features = false } -sp-consensus-grandpa = { version = "14.0.0", default-features = false } -sp-core = { version = "29.0.0", default-features = false } -sp-keystore = "0.35.0" -sp-io = { version = "31.0.0", default-features = false } -sp-genesis-builder = { version = "0.8.0", default-features = false } -sp-inherents = { version = "27.0.0", default-features = false } -sp-offchain = { version = "27.0.0", default-features = false } -sp-runtime = { version = "32.0.0", default-features = false } -sp-timestamp = "27.0.0" -substrate-frame-rpc-system = "29.0.0" -substrate-prometheus-endpoint = "0.17.0" -sp-session = { version = "28.0.0", default-features = false } +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 } +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-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 } +pallet-multisig = { version = "36.0.0", default-features = false } +pallet-nft-fractionalization = { version = "18.0.0", default-features = false } +pallet-nfts = { version = "30.0.0", default-features = false } +pallet-nfts-runtime-api = { version = "22.0.0", default-features = false } +pallet-preimage = { version = "36.0.0", default-features = false } +pallet-proxy = { version = "36.0.0", default-features = false } +pallet-scheduler = { version = "37.0.0", default-features = false } +pallet-session = { version = "36.0.0", default-features = false } +pallet-sudo = { version = "36.0.0", default-features = false } +pallet-timestamp = { version = "35.0.0", default-features = false } +pallet-transaction-payment = { version = "36.0.0", default-features = false } +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 } +sp-blockchain = "35.1.0" +sp-consensus-aura = { version = "0.39.0", default-features = false } +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-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-session = { version = "34.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } -sp-transaction-pool = { version = "27.0.0", default-features = false } -sp-version = { version = "30.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 = "8.0.5", default-features = false } -polkadot-cli = "8.0.0" -polkadot-parachain-primitives = { version = "7.0.0", default-features = false } -polkadot-runtime-parachains = { version = "8.0.3", default-features = false } -polkadot-primitives = { version = "8.0.1", default-features = false } -polkadot-runtime-common = { version = "8.0.3", default-features = false } -xcm = { package = "staging-xcm", version = "8.0.1", default-features = false } -xcm-builder = { package = "staging-xcm-builder", version = "8.0.3", default-features = false } -xcm-executor = { package = "staging-xcm-executor", version = "8.0.2", default-features = false } +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-primitives = { version = "14.0.0", default-features = false } +polkadot-runtime-common = { 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 } # Cumulus -asset-test-utils = { version = "8.0.1", default-features = false } -cumulus-pallet-aura-ext = { version = "0.8.0", default-features = false } -cumulus-pallet-parachain-system = { version = "0.8.1", default-features = false, features = [ - "parameterized-consensus-hook", -] } -cumulus-pallet-session-benchmarking = { version = "10.0.0", default-features = false } -cumulus-pallet-xcm = { version = "0.8.0", default-features = false } -cumulus-pallet-xcmp-queue = { version = "0.8.0", default-features = false } -cumulus-primitives-aura = { version = "0.8.0", default-features = false } -cumulus-primitives-core = { version = "0.8.0", default-features = false } -cumulus-primitives-utility = { version = "0.8.1", default-features = false } -emulated-integration-tests-common = { version = "4.0.0", default-features = false } -pallet-collator-selection = { version = "10.0.3", default-features = false } -parachains-common = { version = "8.0.1", default-features = false } -parachain-info = { package = "staging-parachain-info", version = "0.8.0", default-features = false } -cumulus-primitives-parachain-inherent = "0.8.0" -cumulus-relay-chain-interface = "0.8.0" +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.8.0" -cumulus-client-collator = "0.8.0" -cumulus-client-consensus-aura = "0.8.0" -cumulus-client-consensus-common = "0.8.0" -cumulus-client-consensus-proposer = "0.8.0" -cumulus-client-service = "0.8.0" +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 } +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 } +parachain-info = { version = "0.15.0", package = "staging-parachain-info", default-features = false } +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" } +paseo-runtime = { git = "https://github.com/polkadot-fellows/runtimes", default-features = false, package = "polkadot-runtime" } +paseo-runtime-constants = { git = "https://github.com/polkadot-fellows/runtimes", default-features = false, package = "polkadot-runtime-constants" } # Paseo -asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } -paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } -paseo-runtime-constants = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } +# asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } +# paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } +# paseo-runtime-constants = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 0a427f8a..30559044 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -8,7 +8,12 @@ repository.workspace = true [dev-dependencies] codec.workspace = true -tracing-subscriber = { workspace = true, features = ["env-filter", "fmt", "std", "tracing-log"] } +tracing-subscriber = { workspace = true, features = [ + "env-filter", + "fmt", + "std", + "tracing-log", +] } # Substrate frame-support.workspace = true diff --git a/integration-tests/src/chains/asset_hub_paseo/mod.rs b/integration-tests/src/chains/asset_hub_paseo/mod.rs index 51dae063..0a9620e3 100644 --- a/integration-tests/src/chains/asset_hub_paseo/mod.rs +++ b/integration-tests/src/chains/asset_hub_paseo/mod.rs @@ -1,6 +1,5 @@ pub(crate) mod genesis; -use crate::chains::paseo::Paseo; use emulated_integration_tests_common::{ impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain, impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain, @@ -34,6 +33,6 @@ decl_test_parachains! { // AssetHubPaseo implementation impl_accounts_helpers_for_parachain!(AssetHubPaseo); impl_assert_events_helpers_for_parachain!(AssetHubPaseo); -impl_assets_helpers_for_parachain!(AssetHubPaseo, Paseo); -impl_foreign_assets_helpers_for_parachain!(AssetHubPaseo, Paseo); +impl_assets_helpers_for_parachain!(AssetHubPaseo); +impl_foreign_assets_helpers_for_parachain!(AssetHubPaseo, xcm::v3::Location); impl_xcm_helpers_for_parachain!(AssetHubPaseo); diff --git a/integration-tests/src/chains/paseo/genesis.rs b/integration-tests/src/chains/paseo/genesis.rs index d4c29ca2..0ecdb1ff 100644 --- a/integration-tests/src/chains/paseo/genesis.rs +++ b/integration-tests/src/chains/paseo/genesis.rs @@ -1,6 +1,5 @@ use emulated_integration_tests_common::{ - accounts, build_genesis_storage, get_account_id_from_seed, get_from_seed, get_host_config, - validators, + accounts, build_genesis_storage, get_from_seed, get_host_config, validators, }; use paseo_runtime_constants::currency::UNITS as PAS; use polkadot_primitives::{AssignmentId, Balance, ValidatorId}; @@ -8,7 +7,7 @@ use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; -use sp_core::{sr25519, storage::Storage}; +use sp_core::storage::Storage; pub(crate) const ED: Balance = paseo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; const ENDOWMENT: u128 = 1_000_000 * PAS; @@ -58,12 +57,13 @@ pub(crate) fn genesis() -> Storage { }, babe: paseo_runtime::BabeConfig { authorities: Default::default(), - epoch_config: Some(paseo_runtime::BABE_GENESIS_EPOCH_CONFIG), + epoch_config: paseo_runtime::BABE_GENESIS_EPOCH_CONFIG, ..Default::default() }, - sudo: paseo_runtime::SudoConfig { - key: Some(get_account_id_from_seed::("Alice")), - }, + // TODO: sudo pallet is not configured in polkadot runtime + // sudo: runtime::SudoConfig { + // key: Some(get_account_id_from_seed::("Alice")), + // }, configuration: paseo_runtime::ConfigurationConfig { config: get_host_config() }, registrar: paseo_runtime::RegistrarConfig { next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, diff --git a/integration-tests/src/chains/paseo/mod.rs b/integration-tests/src/chains/paseo/mod.rs index 735807e5..4df1d2af 100644 --- a/integration-tests/src/chains/paseo/mod.rs +++ b/integration-tests/src/chains/paseo/mod.rs @@ -8,7 +8,7 @@ use emulated_integration_tests_common::{ // Paseo declaration decl_test_relay_chains! { - #[api_version(10)] + #[api_version(11)] pub struct Paseo { genesis = genesis::genesis(), on_init = (), @@ -18,7 +18,8 @@ decl_test_relay_chains! { }, pallets = { XcmPallet: paseo_runtime::XcmPallet, - Sudo: paseo_runtime::Sudo, + // TODO: sudo pallet is not configured in polkadot runtime + // Sudo: paseo_runtime::Sudo, Balances: paseo_runtime::Balances, Hrmp: paseo_runtime::Hrmp, } diff --git a/integration-tests/src/chains/pop_network/mod.rs b/integration-tests/src/chains/pop_network/mod.rs index 42b2cc2e..043800e2 100644 --- a/integration-tests/src/chains/pop_network/mod.rs +++ b/integration-tests/src/chains/pop_network/mod.rs @@ -1,6 +1,5 @@ pub(crate) mod genesis; -use crate::chains::paseo::Paseo; use emulated_integration_tests_common::{ impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain, impl_assets_helpers_for_parachain, impl_xcm_helpers_for_parachain, impls::Parachain, @@ -33,5 +32,5 @@ decl_test_parachains! { // PopNetwork implementation impl_accounts_helpers_for_parachain!(PopNetwork); impl_assert_events_helpers_for_parachain!(PopNetwork); -impl_assets_helpers_for_parachain!(PopNetwork, Paseo); +impl_assets_helpers_for_parachain!(PopNetwork); impl_xcm_helpers_for_parachain!(PopNetwork); diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index eddbc103..7c2ad02f 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -95,7 +95,7 @@ fn para_receiver_assertions(_: Test) { assert_expected_events!( PopNetworkPara, vec![ - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {}, + RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {}, RuntimeEvent::MessageQueue( pallet_message_queue::Event::Processed { success: true, .. } ) => {}, @@ -113,9 +113,7 @@ fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) { PopNetworkPara, vec![ // Amount to reserve transfer is transferred to Parachain's Sovereign account - RuntimeEvent::Balances( - pallet_balances::Event::Withdraw { who, amount } - ) => { + RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { who: *who == t.sender.account_id, amount: *amount == t.args.amount, }, @@ -133,9 +131,7 @@ fn para_to_relay_sender_assertions(t: ParaToRelayTest) { PopNetworkPara, vec![ // Amount to reserve transfer is transferred to Parachain's Sovereign account - RuntimeEvent::Balances( - pallet_balances::Event::Withdraw { who, amount } - ) => { + RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => { who: *who == t.sender.account_id, amount: *amount == t.args.amount, }, @@ -297,7 +293,7 @@ fn reserve_transfer_native_asset_from_relay_to_para() { test.assert(); let delivery_fees = PaseoRelay::execute_with(|| { - xcm_helpers::transfer_assets_delivery_fees::< + xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, >( test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest @@ -353,7 +349,7 @@ fn reserve_transfer_native_asset_from_para_to_relay() { let receiver_balance_after = test.receiver.balance; let delivery_fees = PopNetworkPara::execute_with(|| { - xcm_helpers::transfer_assets_delivery_fees::< + xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, >( test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest @@ -401,7 +397,7 @@ fn reserve_transfer_native_asset_from_system_para_to_para() { let receiver_balance_after = test.receiver.balance; let delivery_fees = AssetHubPaseoPara::execute_with(|| { - xcm_helpers::transfer_assets_delivery_fees::< + xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, >( test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest @@ -467,7 +463,7 @@ fn reserve_transfer_native_asset_from_para_to_system_para() { let receiver_balance_after = test.receiver.balance; let delivery_fees = PopNetworkPara::execute_with(|| { - xcm_helpers::transfer_assets_delivery_fees::< + xcm_helpers::teleport_assets_delivery_fees::< ::XcmSender, >( test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest diff --git a/node/Cargo.toml b/node/Cargo.toml index b6f258c4..6637ab44 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pop-node" -version = "0.1.0-alpha" +version = "0.2.0-alpha" authors.workspace = true description.workspace = true license = "Unlicense" @@ -28,6 +28,7 @@ pop-runtime-common.workspace = true frame-benchmarking.workspace = true frame-benchmarking-cli.workspace = true pallet-transaction-payment-rpc.workspace = true +prometheus-endpoint.workspace = true sc-basic-authorship.workspace = true sc-chain-spec.workspace = true sc-cli.workspace = true @@ -57,7 +58,6 @@ sp-session.workspace = true sp-timestamp.workspace = true sp-transaction-pool.workspace = true substrate-frame-rpc-system.workspace = true -substrate-prometheus-endpoint.workspace = true # Polkadot polkadot-cli.workspace = true diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index ca6c9542..2d208eb1 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -7,12 +7,10 @@ use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify}; /// Specialized `ChainSpec` for the development parachain runtime. -pub type DevnetChainSpec = - sc_service::GenericChainSpec; +pub type DevnetChainSpec = sc_service::GenericChainSpec; /// Specialized `ChainSpec` for the testnet parachain runtime. -pub type TestnetChainSpec = - sc_service::GenericChainSpec; +pub type TestnetChainSpec = sc_service::GenericChainSpec; /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; @@ -31,11 +29,12 @@ pub fn get_from_seed(seed: &str) -> ::Pu /// The extensions for the [`ChainSpec`]. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)] -#[serde(deny_unknown_fields)] pub struct Extensions { /// The relay chain of the Parachain. + #[serde(alias = "relayChain", alias = "RelayChain")] pub relay_chain: String, /// The id of the Parachain. + #[serde(alias = "paraId", alias = "ParaId")] pub para_id: u32, } diff --git a/node/src/cli.rs b/node/src/cli.rs index 665b1129..19532033 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -38,11 +38,6 @@ pub enum Subcommand { #[command(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), - /// Try-runtime has migrated to a standalone - /// [CLI](). The subcommand exists as a stub and - /// deprecation notice. It will be removed entirely some time after Janurary 2024. - TryRuntime, - /// Key management CLI utilities #[command(subcommand)] Key(sc_cli::KeySubcommand), diff --git a/node/src/command.rs b/node/src/command.rs index a83253fc..e428d768 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -1,5 +1,6 @@ use std::{net::SocketAddr, path::PathBuf}; +use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; @@ -9,13 +10,13 @@ use sc_cli::{ NetworkParams, Result, SharedParams, SubstrateCli, }; use sc_service::config::{BasePath, PrometheusConfig}; -use sp_runtime::traits::AccountIdConversion; +use sp_runtime::traits::HashingFor; use crate::{ chain_spec, chain_spec::Relay, cli::{Cli, RelayChainCli, Subcommand}, - service::{new_partial, DevnetRuntimeExecutor, TestnetRuntimeExecutor}, + service::new_partial, }; #[derive(Debug, PartialEq)] @@ -156,7 +157,7 @@ macro_rules! construct_async_run { match runner.config().chain_spec.runtime() { Runtime::Devnet => { runner.async_run(|$config| { - let $components = new_partial::( + let $components = new_partial::( &$config )?; let task_manager = $components.task_manager; @@ -165,7 +166,7 @@ macro_rules! construct_async_run { } Runtime::Testnet => { runner.async_run(|$config| { - let $components = new_partial::( + let $components = new_partial::( &$config )?; let task_manager = $components.task_manager; @@ -180,15 +181,11 @@ macro_rules! construct_benchmark_partials { ($config:expr, |$partials:ident| $code:expr) => { match $config.chain_spec.runtime() { Runtime::Devnet => { - let $partials = - new_partial::(&$config)?; + let $partials = new_partial::(&$config)?; $code }, Runtime::Testnet => { - let $partials = new_partial::< - pop_runtime_testnet::RuntimeApi, - TestnetRuntimeExecutor, - >(&$config)?; + let $partials = new_partial::(&$config)?; $code }, } @@ -251,9 +248,7 @@ pub fn run() -> Result<()> { Some(Subcommand::ExportGenesisHead(cmd)) => { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| { - construct_benchmark_partials!(config, |partials| { - cmd.run(partials.client) - }) + construct_benchmark_partials!(config, |partials| cmd.run(partials.client)) }) }, Some(Subcommand::ExportGenesisWasm(cmd)) => { @@ -267,25 +262,28 @@ 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::(config)) + runner.sync_run(|config| { + cmd.run_with_spec::, ReclaimHostFunctions>(Some( + config.chain_spec, + )) + }) } else { 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(_) => - return Err(sc_cli::Error::Input( - "Compile with --features=runtime-benchmarks \ + BenchmarkCmd::Storage(_) => Err(sc_cli::Error::Input( + "Compile with --features=runtime-benchmarks \ to enable storage benchmarks." - .into(), - ) - .into()), + .into(), + )), #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { construct_benchmark_partials!(config, |partials| { @@ -294,15 +292,15 @@ 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)] _ => Err("Benchmarking sub-command unsupported".into()), } }, - Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.".into()), Some(Subcommand::Key(cmd)) => cmd.run(&cli), None => { let runner = cli.create_runner(&cli.run.normalize())?; @@ -327,17 +325,11 @@ pub fn run() -> Result<()> { let id = ParaId::from(para_id); - let parachain_account = - AccountIdConversion::::into_account_truncating( - &id, - ); - let tokio_handle = config.tokio_handle.clone(); let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - info!("Parachain Account: {parachain_account}"); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); match config.chain_spec.runtime() { @@ -345,10 +337,7 @@ pub fn run() -> Result<()> { sp_core::crypto::set_default_ss58_version( pop_runtime_devnet::SS58Prefix::get().into(), ); - crate::service::start_parachain_node::< - pop_runtime_devnet::RuntimeApi, - DevnetRuntimeExecutor, - >( + crate::service::start_parachain_node::( config, polkadot_config, collator_options, @@ -363,10 +352,7 @@ pub fn run() -> Result<()> { sp_core::crypto::set_default_ss58_version( pop_runtime_testnet::SS58Prefix::get().into(), ); - crate::service::start_parachain_node::< - pop_runtime_testnet::RuntimeApi, - TestnetRuntimeExecutor, - >( + crate::service::start_parachain_node::( config, polkadot_config, collator_options, diff --git a/node/src/service.rs b/node/src/service.rs index cd3a5a52..e07d3efc 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -9,6 +9,7 @@ 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}; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_proposer::Proposer; use cumulus_client_service::{ @@ -23,12 +24,10 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; +use prometheus_endpoint::Registry; use sc_client_api::Backend; use sc_consensus::ImportQueue; -use sc_executor::{ - HeapAllocStrategy, NativeElseWasmExecutor, NativeExecutionDispatch, WasmExecutor, - DEFAULT_HEAP_ALLOC_STRATEGY, -}; +use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; use sc_network::NetworkBlock; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; @@ -38,72 +37,47 @@ use sp_api::ConstructRuntimeApi; use sp_core::Pair; use sp_keystore::KeystorePtr; use sp_runtime::{app_crypto::AppCrypto, traits::BlakeTwo256}; -use substrate_prometheus_endpoint::Registry; - -/// Devnet Native executor type. -pub struct DevnetRuntimeExecutor; - -impl NativeExecutionDispatch for DevnetRuntimeExecutor { - type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; - fn dispatch(method: &str, data: &[u8]) -> Option> { - pop_runtime_devnet::api::dispatch(method, data) - } - - fn native_version() -> sc_executor::NativeVersion { - pop_runtime_devnet::native_version() - } -} - -/// Testnet Native executor type. -pub struct TestnetRuntimeExecutor; - -impl NativeExecutionDispatch for TestnetRuntimeExecutor { - type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; - - fn dispatch(method: &str, data: &[u8]) -> Option> { - pop_runtime_testnet::api::dispatch(method, data) - } +#[cfg(not(feature = "runtime-benchmarks"))] +type HostFunctions = cumulus_client_service::ParachainHostFunctions; - fn native_version() -> sc_executor::NativeVersion { - pop_runtime_testnet::native_version() - } -} +#[cfg(feature = "runtime-benchmarks")] +type HostFunctions = ( + cumulus_client_service::ParachainHostFunctions, + frame_benchmarking::benchmarking::HostFunctions, +); -type ParachainExecutor = NativeElseWasmExecutor; +type ParachainExecutor = WasmExecutor; -type ParachainClient = - TFullClient>; +type ParachainClient = TFullClient; type ParachainBackend = TFullBackend; -type ParachainBlockImport = - TParachainBlockImport>, ParachainBackend>; +type ParachainBlockImport = + TParachainBlockImport>, ParachainBackend>; /// Assembly of PartialComponents (enough to run chain ops subcommands) -type Service = PartialComponents< - ParachainClient, +type Service = PartialComponents< + ParachainClient, ParachainBackend, (), sc_consensus::DefaultImportQueue, - sc_transaction_pool::FullPool>, - (ParachainBlockImport, Option, Option), + sc_transaction_pool::FullPool>, + (ParachainBlockImport, Option, Option), >; /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to /// be able to perform chain operations. -pub fn new_partial( +pub fn new_partial( config: &Configuration, -) -> Result, sc_service::Error> +) -> Result, sc_service::Error> where - RuntimeApi: - ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiExt, + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: RuntimeApiExt, sc_client_api::StateBackendFor, Block>: sc_client_api::StateBackend, - Executor: NativeExecutionDispatch + 'static, { let telemetry = config .telemetry_endpoints @@ -120,7 +94,7 @@ where .default_heap_pages .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ }); - let wasm = WasmExecutor::builder() + let executor = ParachainExecutor::builder() .with_execution_method(config.wasm_method) .with_onchain_heap_alloc_strategy(heap_pages) .with_offchain_heap_alloc_strategy(heap_pages) @@ -128,13 +102,12 @@ where .with_runtime_cache_size(config.runtime_cache_size) .build(); - let executor = NativeElseWasmExecutor::::new_with_wasm_executor(wasm); - let (client, backend, keystore_container, task_manager) = - sc_service::new_full_parts::( + sc_service::new_full_parts_record_import::( config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, + true, )?; let client = Arc::new(client); @@ -153,8 +126,7 @@ where client.clone(), ); - let block_import = - ParachainBlockImport::::new(client.clone(), backend.clone()); + let block_import = ParachainBlockImport::::new(client.clone(), backend.clone()); let import_queue = build_import_queue( client.clone(), @@ -162,7 +134,7 @@ where config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, - )?; + ); Ok(PartialComponents { backend, @@ -180,28 +152,26 @@ where /// /// This is the actual implementation that is abstract over the executor and the runtime api. #[sc_tracing::logging::prefix_logs_with("Parachain")] -async fn start_node_impl( +async fn start_node_impl( parachain_config: Configuration, polkadot_config: Configuration, collator_options: CollatorOptions, para_id: ParaId, start_consensus: SC, hwbench: Option, -) -> sc_service::error::Result<(TaskManager, Arc>)> +) -> sc_service::error::Result<(TaskManager, Arc>)> where - RuntimeApi: - ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiExt, - Executor: NativeExecutionDispatch + 'static, + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: RuntimeApiExt, SC: FnOnce( - Arc>, + Arc>, Arc, - ParachainBlockImport, + ParachainBlockImport, Option<&Registry>, Option, &TaskManager, Arc, - Arc>>, + Arc>>, Arc>, KeystorePtr, Duration, @@ -213,9 +183,13 @@ where { let parachain_config = prepare_node_config(parachain_config); - let params = new_partial::(¶chain_config)?; + let params = new_partial::(¶chain_config)?; let (block_import, mut telemetry, telemetry_worker_handle) = params.other; - let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network); + let net_config = sc_network::config::FullNetworkConfiguration::< + _, + _, + sc_network::NetworkWorker, + >::new(¶chain_config.network); let client = params.client.clone(); let backend = params.backend.clone(); @@ -264,7 +238,7 @@ where transaction_pool: Some(OffchainTransactionPoolFactory::new( transaction_pool.clone(), )), - network_provider: network.clone(), + network_provider: Arc::new(network.clone()), is_validator: parachain_config.role.is_authority(), enable_http_requests: false, custom_extensions: move |_| vec![], @@ -297,7 +271,7 @@ where config: parachain_config, keystore: params.keystore_container.keystore(), backend: backend.clone(), - network: network.clone(), + network, sync_service: sync_service.clone(), system_rpc_tx, tx_handler_controller, @@ -361,9 +335,9 @@ where prometheus_registry.as_ref(), telemetry.as_ref().map(|t| t.handle()), &task_manager, - relay_chain_interface.clone(), + relay_chain_interface, transaction_pool, - sync_service.clone(), + sync_service, params.keystore_container.keystore(), relay_chain_slot_duration, para_id, @@ -380,21 +354,18 @@ where /// Build the import queue for the parachain runtime. #[allow(clippy::type_complexity)] -pub(crate) fn build_import_queue( - client: Arc>, - block_import: ParachainBlockImport, +pub(crate) fn build_import_queue( + client: Arc>, + block_import: ParachainBlockImport, config: &Configuration, telemetry: Option, task_manager: &TaskManager, -) -> Result, sc_service::Error> +) -> sc_consensus::DefaultImportQueue where - RuntimeApi: - ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiExt, + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: RuntimeApiExt, { - let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; - - Ok(cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::< + cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::< sp_consensus_aura::sr25519::AuthorityPair, _, _, @@ -407,25 +378,22 @@ where let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); Ok(timestamp) }, - slot_duration, &task_manager.spawn_essential_handle(), config.prometheus_registry(), telemetry, - )) + ) } #[allow(clippy::too_many_arguments)] -fn start_consensus( - client: Arc>, +fn start_consensus( + client: Arc>, backend: Arc, - block_import: ParachainBlockImport, + block_import: ParachainBlockImport, prometheus_registry: Option<&Registry>, telemetry: Option, task_manager: &TaskManager, relay_chain_interface: Arc, - transaction_pool: Arc< - sc_transaction_pool::FullPool>, - >, + transaction_pool: Arc>>, sync_oracle: Arc>, keystore: KeystorePtr, relay_chain_slot_duration: Duration, @@ -435,18 +403,9 @@ fn start_consensus( announce_block: Arc>) + Send + Sync>, ) -> Result<(), sc_service::Error> where - RuntimeApi: - ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiExt, - Executor: NativeExecutionDispatch + 'static, + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: RuntimeApiExt, { - use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams}; - - // NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant` - // when starting the network. - - let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; - let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording( task_manager.spawn_handle(), client.clone(), @@ -478,11 +437,10 @@ where collator_key, para_id, overseer_handle, - slot_duration, relay_chain_slot_duration, proposer, collator_service, - authoring_duration: Duration::from_millis(1500), + authoring_duration: Duration::from_millis(2000), reinitialize: false, }; @@ -496,32 +454,30 @@ where } /// Start a parachain node. -pub async fn start_parachain_node( +pub async fn start_parachain_node( parachain_config: Configuration, polkadot_config: Configuration, collator_options: CollatorOptions, para_id: ParaId, hwbench: Option, -) -> sc_service::error::Result<(TaskManager, Arc>)> +) -> sc_service::error::Result<(TaskManager, Arc>)> where - Executor: NativeExecutionDispatch + 'static, - RuntimeApi: - ConstructRuntimeApi> + Send + Sync + 'static, - RuntimeApi::RuntimeApi: RuntimeApiExt, + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: RuntimeApiExt, { - start_node_impl::( + start_node_impl::( parachain_config, polkadot_config, collator_options, para_id, - start_consensus::, + start_consensus::, hwbench, ) .await } // Trait alias refactored out from above to simplify repeated trait bounds -pub(crate) trait RuntimeApiExt: +pub(crate) trait RuntimeApiExt: sp_transaction_pool::runtime_api::TaggedTransactionQueue + sp_api::Metadata + sp_session::SessionKeys @@ -548,7 +504,6 @@ impl< + substrate_frame_rpc_system::AccountNonceApi + cumulus_primitives_aura::AuraUnincludedSegmentApi, RuntimeApi, - Executor, - > RuntimeApiExt for T + > RuntimeApiExt for T { } diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index 3d2f20d0..24f804d7 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 @@ -22,45 +22,46 @@ scale-info.workspace = true smallvec.workspace = true # Local +pallet-api.workspace = true pop-chain-extension.workspace = true pop-primitives.workspace = true pop-runtime-common.workspace = true -pallet-api.workspace = true # Substrate frame-benchmarking.workspace = true frame-executive.workspace = true +frame-metadata-hash-extension.workspace = true frame-support.workspace = true -frame-system.workspace = true frame-system-benchmarking.workspace = true frame-system-rpc-runtime-api.workspace = true +frame-system.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 pallet-multisig.workspace = true pallet-nft-fractionalization.workspace = true -pallet-nfts.workspace = true pallet-nfts-runtime-api.workspace = true +pallet-nfts.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-transaction-payment.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 @@ -72,9 +73,9 @@ sp-version.workspace = true pallet-xcm.workspace = true polkadot-parachain-primitives.workspace = true polkadot-runtime-common.workspace = true -xcm.workspace = true xcm-builder.workspace = true xcm-executor.workspace = true +xcm.workspace = true # Cumulus cumulus-pallet-aura-ext.workspace = true @@ -84,146 +85,162 @@ cumulus-pallet-xcm.workspace = true cumulus-pallet-xcmp-queue.workspace = true cumulus-primitives-aura.workspace = true 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] env_logger = "0.11.2" hex = "0.4.3" [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-utility/std", - "frame-benchmarking/std", - "frame-executive/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-api/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-chain-extension/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-api/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-chain-extension/std", + "pop-primitives/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-api/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-api/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", + "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-api/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-api/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. +# +# This is hidden behind a feature because it increases the compile time. +# The wasm binary needs to be compiled twice, once to fetch the metadata, +# 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" ] + +# A convenience feature for enabling things when doing a build +# for an on-chain release. +on-chain-release-build = [ "metadata-hash" ] diff --git a/runtime/devnet/build.rs b/runtime/devnet/build.rs index 02d6973f..6293cebb 100644 --- a/runtime/devnet/build.rs +++ b/runtime/devnet/build.rs @@ -1,12 +1,15 @@ -#[cfg(feature = "std")] +#[cfg(all(feature = "std", feature = "metadata-hash"))] fn main() { - substrate_wasm_builder::WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("PAS", 10) .build() } +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] +fn main() { + substrate_wasm_builder::WasmBuilder::build_using_defaults() +} + /// The wasm builder is deactivated when compiling /// this crate for wasm to speed up the compilation. #[cfg(not(feature = "std"))] diff --git a/runtime/devnet/src/config/contracts.rs b/runtime/devnet/src/config/contracts.rs index 67a2f33c..73bfd5cd 100644 --- a/runtime/devnet/src/config/contracts.rs +++ b/runtime/devnet/src/config/contracts.rs @@ -7,7 +7,7 @@ use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Randomness}, }; -use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::{pallet_prelude::BlockNumberFor, EnsureSigned}; pub enum AllowBalancesCall {} @@ -80,10 +80,13 @@ impl pallet_contracts::Config for Runtime { 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 Migrations = (); diff --git a/runtime/devnet/src/config/xcm.rs b/runtime/devnet/src/config/xcm.rs index a5b7a04d..4eb161c0 100644 --- a/runtime/devnet/src/config/xcm.rs +++ b/runtime/devnet/src/config/xcm.rs @@ -13,15 +13,13 @@ use pallet_xcm::XcmPassthrough; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; -#[allow(deprecated)] -use xcm_builder::CurrencyAdapter; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, - FrameTransactionalProcessor, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, - UsingComponents, WithComputedOrigin, WithUniqueTopic, + FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::XcmExecutor; @@ -31,6 +29,8 @@ parameter_types! { // Note: Paseo currently uses Polkadot https://github.com/paseo-network/runtimes/blob/abc4ae9c5ae8f0166aab7ef2b427b3c2c6d5ce5c/relay/paseo/src/xcm_config.rs#L56 pub const RelayNetwork: Option = Some(Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); + // For the real deployment, it is recommended to set `RelayNetwork` according to the relay chain + // and prepend `UniversalLocation` with `GlobalConsensus(RelayNetwork::get())`. pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -48,7 +48,7 @@ pub type LocationToAccountId = ( /// Means for transacting assets on this chain. #[allow(deprecated)] -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = FungibleAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: @@ -152,6 +152,10 @@ impl xcm_executor::Config for XcmConfig { type SafeCallFilter = Everything; type Aliasers = Nothing; type TransactionalProcessor = FrameTransactionalProcessor; + type HrmpNewChannelOpenRequestHandler = (); + type HrmpChannelAcceptedHandler = (); + type HrmpChannelClosingHandler = (); + type XcmRecorder = PolkadotXcm; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -175,7 +179,7 @@ impl pallet_xcm::Config for Runtime { // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Nothing; + type XcmTeleportFilter = Everything; // TODO: add filter to only allow reserve transfers of native to relay/asset hub type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index 4f4b2e22..5cb54890 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -30,14 +30,14 @@ use sp_version::RuntimeVersion; use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ - construct_runtime, derive_impl, + derive_impl, dispatch::DispatchClass, - genesis_builder_helper::{build_config, create_default_config}, + genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ fungible::HoldConsideration, tokens::nonfungibles_v2::Inspect, ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, EqualPrivilegeOnly, EverythingBut, - LinearStoragePrice, TransformOrigin, + LinearStoragePrice, TransformOrigin, VariantCountOf, }, weights::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, @@ -57,7 +57,7 @@ pub use pop_runtime_common::{ MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT, }; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; +pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -103,6 +103,8 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, + frame_metadata_hash_extension::CheckMetadataHash, ); /// Unchecked extrinsic type as expected by this runtime. @@ -254,7 +256,7 @@ impl Contains for FilteredCalls { /// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from /// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`), /// but overridden as needed. -#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] +#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; @@ -316,8 +318,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<0>; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; } parameter_types! { @@ -327,7 +329,7 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; @@ -390,9 +392,10 @@ impl pallet_message_queue::Config for Runtime { // 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<{ 64 * 1024 }>; + type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; type MaxStale = sp_core::ConstU32<8>; type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = (); } impl cumulus_pallet_aura_ext::Config for Runtime {} @@ -408,6 +411,10 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { 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>; + // Limit the number of HRML channels + type MaxPageSize = ConstU32<{ 103 * 1024 }>; } parameter_types! { @@ -531,60 +538,95 @@ impl pallet_utility::Config for Runtime { type WeightInfo = pallet_utility::weights::SubstrateWeight; } -// Create the runtime by composing the FRAME pallets that were previously configured. -construct_runtime!( - pub enum Runtime { - // System support stuff. - System: frame_system = 0, - ParachainSystem: cumulus_pallet_parachain_system = 1, - Timestamp: pallet_timestamp = 2, - ParachainInfo: parachain_info = 3, - - // Monetary stuff. - Balances: pallet_balances = 10, - TransactionPayment: pallet_transaction_payment = 11, - - // Governance - Sudo: pallet_sudo = 15, - - // Collator support. The order of these 4 are important and shall not change. - Authorship: pallet_authorship = 20, - CollatorSelection: pallet_collator_selection = 21, - Session: pallet_session = 22, - Aura: pallet_aura = 23, - AuraExt: cumulus_pallet_aura_ext = 24, - - // Scheduler - Scheduler: pallet_scheduler = 28, - - // Preimage - Preimage: pallet_preimage = 29, - - // XCM helpers. - XcmpQueue: cumulus_pallet_xcmp_queue = 30, - PolkadotXcm: pallet_xcm = 31, - CumulusXcm: cumulus_pallet_xcm = 32, - MessageQueue: pallet_message_queue = 33, - - // Contracts - Contracts: pallet_contracts = 40, - - // Proxy - Proxy: pallet_proxy = 41, - // Multisig - Multisig: pallet_multisig = 42, - // Utility - Utility: pallet_utility = 43, - - // Assets - Nfts: pallet_nfts = 50, - NftFractionalization: pallet_nft_fractionalization = 51, - Assets: pallet_assets:: = 52, - - // Pop API - Fungibles: fungibles = 150, - } -); +#[frame_support::runtime] +mod runtime { + // Create the runtime by composing the FRAME pallets that were previously configured. + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + // System support stuff. + #[runtime::pallet_index(0)] + pub type System = frame_system::Pallet; + #[runtime::pallet_index(1)] + pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet; + #[runtime::pallet_index(2)] + pub type Timestamp = pallet_timestamp::Pallet; + #[runtime::pallet_index(3)] + pub type ParachainInfo = parachain_info::Pallet; + + // Monetary stuff. + #[runtime::pallet_index(10)] + pub type Balances = pallet_balances::Pallet; + #[runtime::pallet_index(11)] + pub type TransactionPayment = pallet_transaction_payment::Pallet; + + // Governance + #[runtime::pallet_index(15)] + pub type Sudo = pallet_sudo; + + // Collator support. The order of these 4 are important and shall not change. + #[runtime::pallet_index(20)] + pub type Authorship = pallet_authorship::Pallet; + #[runtime::pallet_index(21)] + pub type CollatorSelection = pallet_collator_selection::Pallet; + #[runtime::pallet_index(22)] + pub type Session = pallet_session::Pallet; + #[runtime::pallet_index(23)] + pub type Aura = pallet_aura::Pallet; + #[runtime::pallet_index(24)] + pub type AuraExt = cumulus_pallet_aura_ext; + + // Scheduler + #[runtime::pallet_index(28)] + pub type Scheduler = pallet_scheduler; + + // Preimage + #[runtime::pallet_index(29)] + pub type Preimage = pallet_preimage; + + // XCM helpers. + #[runtime::pallet_index(30)] + pub type XcmpQueue = cumulus_pallet_xcmp_queue::Pallet; + #[runtime::pallet_index(31)] + pub type PolkadotXcm = pallet_xcm::Pallet; + #[runtime::pallet_index(32)] + pub type CumulusXcm = cumulus_pallet_xcm::Pallet; + #[runtime::pallet_index(33)] + pub type MessageQueue = pallet_message_queue::Pallet; + + // Contracts + #[runtime::pallet_index(40)] + pub type Contracts = pallet_contracts::Pallet; + + // Proxy + #[runtime::pallet_index(41)] + pub type Proxy = pallet_proxy::Pallet; + // Multisig + #[runtime::pallet_index(42)] + pub type Multisig = pallet_multisig::Pallet; + // Utility + #[runtime::pallet_index(43)] + pub type Utility = pallet_utility::Pallet; + + // Assets + #[runtime::pallet_index(50)] + pub type Nfts = pallet_nfts::Pallet; + #[runtime::pallet_index(51)] + pub type NftFractionalization = pallet_nft_fractionalization::Pallet; + #[runtime::pallet_index(52)] + pub type Assets = pallet_assets::Pallet; +} #[cfg(feature = "runtime-benchmarks")] mod benches { @@ -610,7 +652,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } @@ -623,7 +665,7 @@ impl_runtime_apis! { Executive::execute_block(block) } - fn initialize_block(header: &::Header) { + fn initialize_block(header: &::Header) -> ExtrinsicInclusionMode { Executive::initialize_block(header) } } @@ -637,7 +679,7 @@ impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> Vec { Runtime::metadata_versions() } } @@ -911,7 +953,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } @@ -937,12 +979,16 @@ impl_runtime_apis! { } impl sp_genesis_builder::GenesisBuilder for Runtime { - fn create_default_config() -> Vec { - create_default_config::() + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, |_| None) } - fn build_config(config: Vec) -> sp_genesis_builder::Result { - build_config::(config) + fn preset_names() -> Vec { + Default::default() } } } diff --git a/runtime/testnet/Cargo.toml b/runtime/testnet/Cargo.toml index b31ad085..f6ca1806 100644 --- a/runtime/testnet/Cargo.toml +++ b/runtime/testnet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pop-runtime-testnet" -version = "0.3.0" +version = "0.4.0" authors.workspace = true description.workspace = true license = "Unlicense" @@ -28,6 +28,7 @@ pop-runtime-common.workspace = true # Substrate frame-benchmarking.workspace = true frame-executive.workspace = true +frame-metadata-hash-extension.workspace = true frame-support.workspace = true frame-system.workspace = true frame-system-benchmarking.workspace = true @@ -82,6 +83,7 @@ cumulus-pallet-xcm.workspace = true cumulus-pallet-xcmp-queue.workspace = true cumulus-primitives-aura.workspace = true 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 @@ -102,9 +104,11 @@ 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", @@ -220,4 +224,17 @@ try-runtime = [ "parachain-info/try-runtime", "polkadot-runtime-common/try-runtime", "sp-runtime/try-runtime", -] \ No newline at end of file +] + +# Enable the metadata hash generation. +# +# This is hidden behind a feature because it increases the compile time. +# The wasm binary needs to be compiled twice, once to fetch the metadata, +# 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"] + +# A convenience feature for enabling things when doing a build +# for an on-chain release. +on-chain-release-build = ["metadata-hash"] diff --git a/runtime/testnet/build.rs b/runtime/testnet/build.rs index 02d6973f..6293cebb 100644 --- a/runtime/testnet/build.rs +++ b/runtime/testnet/build.rs @@ -1,12 +1,15 @@ -#[cfg(feature = "std")] +#[cfg(all(feature = "std", feature = "metadata-hash"))] fn main() { - substrate_wasm_builder::WasmBuilder::new() - .with_current_project() - .export_heap_base() - .import_memory() + substrate_wasm_builder::WasmBuilder::init_with_defaults() + .enable_metadata_hash("PAS", 10) .build() } +#[cfg(all(feature = "std", not(feature = "metadata-hash")))] +fn main() { + substrate_wasm_builder::WasmBuilder::build_using_defaults() +} + /// The wasm builder is deactivated when compiling /// this crate for wasm to speed up the compilation. #[cfg(not(feature = "std"))] diff --git a/runtime/testnet/src/config/contracts.rs b/runtime/testnet/src/config/contracts.rs index 36d62f7f..80c02517 100644 --- a/runtime/testnet/src/config/contracts.rs +++ b/runtime/testnet/src/config/contracts.rs @@ -6,7 +6,7 @@ use frame_support::{ parameter_types, traits::{ConstBool, ConstU32, Randomness}, }; -use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::{pallet_prelude::BlockNumberFor, EnsureSigned}; pub enum AllowBalancesCall {} @@ -79,12 +79,15 @@ impl pallet_contracts::Config for Runtime { 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 Migrations = (); + type Migrations = (pallet_contracts::migration::v16::Migration,); type Xcm = pallet_xcm::Pallet; } diff --git a/runtime/testnet/src/config/xcm.rs b/runtime/testnet/src/config/xcm.rs index a5b7a04d..4eb161c0 100644 --- a/runtime/testnet/src/config/xcm.rs +++ b/runtime/testnet/src/config/xcm.rs @@ -13,15 +13,13 @@ use pallet_xcm::XcmPassthrough; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; -#[allow(deprecated)] -use xcm_builder::CurrencyAdapter; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, - FrameTransactionalProcessor, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, - UsingComponents, WithComputedOrigin, WithUniqueTopic, + FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::XcmExecutor; @@ -31,6 +29,8 @@ parameter_types! { // Note: Paseo currently uses Polkadot https://github.com/paseo-network/runtimes/blob/abc4ae9c5ae8f0166aab7ef2b427b3c2c6d5ce5c/relay/paseo/src/xcm_config.rs#L56 pub const RelayNetwork: Option = Some(Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); + // For the real deployment, it is recommended to set `RelayNetwork` according to the relay chain + // and prepend `UniversalLocation` with `GlobalConsensus(RelayNetwork::get())`. pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } @@ -48,7 +48,7 @@ pub type LocationToAccountId = ( /// Means for transacting assets on this chain. #[allow(deprecated)] -pub type LocalAssetTransactor = CurrencyAdapter< +pub type LocalAssetTransactor = FungibleAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: @@ -152,6 +152,10 @@ impl xcm_executor::Config for XcmConfig { type SafeCallFilter = Everything; type Aliasers = Nothing; type TransactionalProcessor = FrameTransactionalProcessor; + type HrmpNewChannelOpenRequestHandler = (); + type HrmpChannelAcceptedHandler = (); + type HrmpChannelClosingHandler = (); + type XcmRecorder = PolkadotXcm; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -175,7 +179,7 @@ impl pallet_xcm::Config for Runtime { // ^ Disable dispatchable execute on the XCM pallet. // Needs to be `Everything` for local testing. type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Nothing; + type XcmTeleportFilter = Everything; // TODO: add filter to only allow reserve transfers of native to relay/asset hub type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; diff --git a/runtime/testnet/src/extensions.rs b/runtime/testnet/src/extensions.rs index fc228b03..30a33247 100644 --- a/runtime/testnet/src/extensions.rs +++ b/runtime/testnet/src/extensions.rs @@ -6,6 +6,8 @@ use frame_support::{ use pallet_contracts::chain_extension::{ BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, }; +use pallet_contracts::WeightInfo; +use pop_primitives::storage_keys::RuntimeStateKeys; use sp_core::crypto::UncheckedFrom; use sp_runtime::{traits::Dispatchable, DispatchError}; use sp_std::vec::Vec; @@ -14,8 +16,6 @@ use crate::{AccountId, AllowedApiCalls, RuntimeCall, RuntimeOrigin}; const LOG_TARGET: &str = "pop-api::extension"; -type ContractSchedule = ::Schedule; - #[derive(Default)] pub struct PopApiExtension; @@ -123,16 +123,14 @@ where T: pallet_contracts::Config, E: Ext, { - let contract_host_weight = ContractSchedule::::get().host_fn_weights; - // calculate weight for reading bytes of `len` // reference: https://github.com/paritytech/polkadot-sdk/blob/117a9433dac88d5ac00c058c9b39c511d47749d2/substrate/frame/contracts/src/wasm/runtime.rs#L267 - let base_weight: Weight = contract_host_weight.return_per_byte.saturating_mul(len.into()); + let base_weight: Weight = T::WeightInfo::seal_return(len); // debug_message weight is a good approximation of the additional overhead of going // from contract layer to substrate layer. // reference: https://github.com/paritytech/ink-examples/blob/b8d2caa52cf4691e0ddd7c919e4462311deb5ad0/psp22-extension/runtime/psp22-extension-example.rs#L236 - let overhead = contract_host_weight.debug_message; + let overhead: Weight = T::WeightInfo::seal_debug_message(len); let charged_weight = env.charge_weight(base_weight.saturating_add(overhead))?; log::debug!(target: LOG_TARGET, "{} charged weight: {:?}", log_prefix, charged_weight); @@ -172,10 +170,7 @@ where let mut env = env.buf_in_buf_out(); // To be conservative, we charge the weight for reading the input bytes of a fixed-size type. - let base_weight: Weight = ContractSchedule::::get() - .host_fn_weights - .return_per_byte - .saturating_mul(env.in_len().into()); + let base_weight: Weight = T::WeightInfo::seal_return(env.in_len()); let charged_weight = env.charge_weight(base_weight)?; log::debug!(target:LOG_TARGET, "{} charged weight: {:?}", LOG_PREFIX, charged_weight); diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index e7751a57..9f7d4cd8 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -30,14 +30,14 @@ use sp_version::RuntimeVersion; use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ - construct_runtime, derive_impl, + derive_impl, dispatch::DispatchClass, - genesis_builder_helper::{build_config, create_default_config}, + genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ fungible::HoldConsideration, tokens::nonfungibles_v2::Inspect, ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, EqualPrivilegeOnly, EverythingBut, - LinearStoragePrice, TransformOrigin, + LinearStoragePrice, TransformOrigin, VariantCountOf, }, weights::{ ConstantMultiplier, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, @@ -57,7 +57,7 @@ pub use pop_runtime_common::{ MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT, }; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; +pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -101,12 +101,21 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, + frame_metadata_hash_extension::CheckMetadataHash, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +/// Migrations to apply on runtime upgrade. +pub type Migrations = ( + pallet_contracts::Migration, + cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5, + pallet_xcm::migration::MigrateToLatestXcmVersion, +); + /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -114,6 +123,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, + Migrations, >; /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the @@ -177,7 +187,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("pop"), authoring_version: 1, #[allow(clippy::zero_prefixed_literal)] - spec_version: 00_03_00, + spec_version: 00_04_00, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -260,7 +270,7 @@ impl Contains for AllowedApiCalls { /// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from /// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`), /// but overridden as needed. -#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] +#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)] impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; @@ -322,8 +332,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type RuntimeFreezeReason = RuntimeFreezeReason; - type FreezeIdentifier = (); - type MaxFreezes = ConstU32<0>; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = VariantCountOf; } parameter_types! { @@ -333,7 +343,7 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; @@ -396,9 +406,10 @@ impl pallet_message_queue::Config for Runtime { // 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<{ 64 * 1024 }>; + type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>; type MaxStale = sp_core::ConstU32<8>; type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = (); } impl cumulus_pallet_aura_ext::Config for Runtime {} @@ -414,6 +425,15 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { 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>; + // Limit the number of HRML channels + type MaxPageSize = ConstU32<{ 103 * 1024 }>; +} + +impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime { + // This must be the same as the `ChannelInfo` from the `Config`: + type ChannelList = ParachainSystem; } parameter_types! { @@ -537,57 +557,95 @@ impl pallet_utility::Config for Runtime { type WeightInfo = pallet_utility::weights::SubstrateWeight; } -// Create the runtime by composing the FRAME pallets that were previously configured. -construct_runtime!( - pub enum Runtime { - // System support stuff. - System: frame_system = 0, - ParachainSystem: cumulus_pallet_parachain_system = 1, - Timestamp: pallet_timestamp = 2, - ParachainInfo: parachain_info = 3, - - // Monetary stuff. - Balances: pallet_balances = 10, - TransactionPayment: pallet_transaction_payment = 11, - - // Governance - Sudo: pallet_sudo = 15, - - // Collator support. The order of these 4 are important and shall not change. - Authorship: pallet_authorship = 20, - CollatorSelection: pallet_collator_selection = 21, - Session: pallet_session = 22, - Aura: pallet_aura = 23, - AuraExt: cumulus_pallet_aura_ext = 24, - - // Scheduler - Scheduler: pallet_scheduler = 28, - - // Preimage - Preimage: pallet_preimage = 29, - - // XCM helpers. - XcmpQueue: cumulus_pallet_xcmp_queue = 30, - PolkadotXcm: pallet_xcm = 31, - CumulusXcm: cumulus_pallet_xcm = 32, - MessageQueue: pallet_message_queue = 33, - - // Contracts - Contracts: pallet_contracts = 40, - - // Proxy - Proxy: pallet_proxy = 41, - // Multisig - Multisig: pallet_multisig = 42, - // Utility - Utility: pallet_utility = 43, - - // Assets - Nfts: pallet_nfts = 50, - NftFractionalization: pallet_nft_fractionalization = 51, - Assets: pallet_assets:: = 52, - } -); +#[frame_support::runtime] +mod runtime { + // Create the runtime by composing the FRAME pallets that were previously configured. + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + // System support stuff. + #[runtime::pallet_index(0)] + pub type System = frame_system::Pallet; + #[runtime::pallet_index(1)] + pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet; + #[runtime::pallet_index(2)] + pub type Timestamp = pallet_timestamp::Pallet; + #[runtime::pallet_index(3)] + pub type ParachainInfo = parachain_info::Pallet; + + // Monetary stuff. + #[runtime::pallet_index(10)] + pub type Balances = pallet_balances::Pallet; + #[runtime::pallet_index(11)] + pub type TransactionPayment = pallet_transaction_payment::Pallet; + + // Governance + #[runtime::pallet_index(15)] + pub type Sudo = pallet_sudo; + + // Collator support. The order of these 4 are important and shall not change. + #[runtime::pallet_index(20)] + pub type Authorship = pallet_authorship::Pallet; + #[runtime::pallet_index(21)] + pub type CollatorSelection = pallet_collator_selection::Pallet; + #[runtime::pallet_index(22)] + pub type Session = pallet_session::Pallet; + #[runtime::pallet_index(23)] + pub type Aura = pallet_aura::Pallet; + #[runtime::pallet_index(24)] + pub type AuraExt = cumulus_pallet_aura_ext; + + // Scheduler + #[runtime::pallet_index(28)] + pub type Scheduler = pallet_scheduler; + + // Preimage + #[runtime::pallet_index(29)] + pub type Preimage = pallet_preimage; + + // XCM helpers. + #[runtime::pallet_index(30)] + pub type XcmpQueue = cumulus_pallet_xcmp_queue::Pallet; + #[runtime::pallet_index(31)] + pub type PolkadotXcm = pallet_xcm::Pallet; + #[runtime::pallet_index(32)] + pub type CumulusXcm = cumulus_pallet_xcm::Pallet; + #[runtime::pallet_index(33)] + pub type MessageQueue = pallet_message_queue::Pallet; + + // Contracts + #[runtime::pallet_index(40)] + pub type Contracts = pallet_contracts::Pallet; + + // Proxy + #[runtime::pallet_index(41)] + pub type Proxy = pallet_proxy::Pallet; + // Multisig + #[runtime::pallet_index(42)] + pub type Multisig = pallet_multisig::Pallet; + // Utility + #[runtime::pallet_index(43)] + pub type Utility = pallet_utility::Pallet; + + // Assets + #[runtime::pallet_index(50)] + pub type Nfts = pallet_nfts::Pallet; + #[runtime::pallet_index(51)] + pub type NftFractionalization = pallet_nft_fractionalization::Pallet; + #[runtime::pallet_index(52)] + pub type Assets = pallet_assets::Pallet; +} #[cfg(feature = "runtime-benchmarks")] mod benches { @@ -612,7 +670,7 @@ impl_runtime_apis! { } fn authorities() -> Vec { - Aura::authorities().into_inner() + pallet_aura::Authorities::::get().into_inner() } } @@ -625,7 +683,7 @@ impl_runtime_apis! { Executive::execute_block(block) } - fn initialize_block(header: &::Header) { + fn initialize_block(header: &::Header) -> ExtrinsicInclusionMode{ Executive::initialize_block(header) } } @@ -939,12 +997,16 @@ impl_runtime_apis! { } impl sp_genesis_builder::GenesisBuilder for Runtime { - fn create_default_config() -> Vec { - create_default_config::() + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, |_| None) } - fn build_config(config: Vec) -> sp_genesis_builder::Result { - build_config::(config) + fn preset_names() -> Vec { + Default::default() } } }