diff --git a/Cargo.toml b/Cargo.toml index 8dfaf90..128304e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,143 +24,155 @@ codec = { version = "3.1.3", package = "parity-scale-codec", default-features = scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } # wasm -frame-benchmarking = { version = "28.0.0", default-features = false } -frame-executive = { version = "28.0.0", default-features = false } -frame-election-provider-support = { version = "28.0.0", default-features = false } -frame-support = { version = "28.0.0", default-features = false } -frame-system = { version = "28.0.0", default-features = false } -frame-system-benchmarking = { version = "28.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "26.0.0", default-features = false } -frame-try-runtime = { version = "0.34.0", default-features = false } - -pallet-aura = { version = "27.0.0", default-features = false } -pallet-grandpa = { version = "28.0.0", default-features = false } -pallet-babe = { version = "28.0.0", default-features = false } -pallet-offences = { version = "27.0.0", default-features = false } -pallet-authorship = { version = "28.0.0", default-features = false } -pallet-balances = { version = "28.0.0", default-features = false } -pallet-session = { version = "28.0.0", default-features = false } -pallet-staking = { version = "28.0.0", default-features = false } -pallet-session-benchmarking = { version = "28.0.0", default-features = false } -pallet-sudo = { version = "28.0.0", default-features = false } -pallet-timestamp = { version = "27.0.0", default-features = false } -pallet-transaction-payment = { version = "28.0.0", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { version = "28.0.0", default-features = false } -pallet-message-queue = { version = "31.0.0", default-features = false } -pallet-beefy-mmr = { version = "28.0.0", default-features = false } -pallet-assets = { version = "29.0.0", default-features = false } +frame-benchmarking = { version = "30.0.0", default-features = false } +frame-executive = { version = "30.0.0", default-features = false } +frame-election-provider-support = { version = "30.0.0", default-features = false } +frame-support = { version = "30.0.0", default-features = false } +frame-system = { version = "30.0.0", default-features = false } +frame-system-benchmarking = { version = "30.0.0", default-features = false } +frame-system-rpc-runtime-api = { version = "28.0.0", default-features = false } +frame-try-runtime = { version = "0.36.0", default-features = false } + +pallet-aura = { version = "29.0.0", default-features = false } +pallet-grandpa = { version = "30.0.0", default-features = false } +pallet-babe = { version = "30.0.0", default-features = false } +pallet-offences = { version = "29.0.0", default-features = false } +pallet-authorship = { version = "30.0.0", default-features = false } +pallet-balances = { version = "30.0.0", default-features = false } +pallet-session = { version = "30.0.0", default-features = false } +pallet-staking = { version = "30.0.2", default-features = false } +pallet-session-benchmarking = { version = "30.0.0", default-features = false } + +pallet-sudo = { version = "30.0.0", default-features = false } +pallet-timestamp = { version = "29.0.0", default-features = false } +pallet-transaction-payment = { version = "30.0.0", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { version = "30.0.0", default-features = false } +pallet-message-queue = { version = "33.0.0", default-features = false } +pallet-beefy-mmr = { version = "30.0.0", default-features = false } +pallet-assets = { version = "31.0.0", default-features = false } pallet-staking-reward-curve = { version = "11.0.0" } -sp-api = { version = "26.0.0", default-features = false } -sp-blockchain = { version = "28.0.0", default-features = false } -sp-io = { version = "30.0.0", default-features = false } -sp-trie = { version = "29.0.0", default-features = false } -sp-block-builder = { version = "26.0.0", default-features = false } -sp-consensus-aura = { version = "0.32.0", default-features = false } -sp-consensus-babe = { version = "0.32.0", default-features = false } -sp-consensus-grandpa = { version = "13.0.0", default-features = false } -sp-consensus-slots = { version = "0.32.0", default-features = false } -sp-consensus = { version = "0.32.0", default-features = false } -sp-consensus-beefy = { version = "13.0.0", default-features = false } -sp-core = { version = "28.0.0", default-features = false } -sp-inherents = { version = "26.0.0", default-features = false } -sp-externalities = { version = "0.25.0", default-features = false } -sp-offchain = { version = "26.0.0", default-features = false } -sp-keyring = { version = "31.0.0", default-features = false } -sp-runtime = { version = "31.0.0", default-features = false } -sp-runtime-interface = { version = "24.0.0", default-features = false } -sp-timestamp = { version = "26.0.0", default-features = false } -sp-keystore = { version = "0.34.0", default-features = false } -sp-mmr-primitives = { version = "26.0.0", default-features = false } -sp-state-machine = { version = "0.35.0", default-features = false } -sp-storage = { version = "19.0.0", default-features = false } -sp-staking = { version = "26.0.0", default-features = false } -sp-session = { version = "27.0.0", default-features = false } +sp-api = { version = "28.0.0", default-features = false } +sp-blockchain = { version = "30.0.0", default-features = false } +sp-io = { version = "32.0.0", default-features = false } +sp-trie = { version = "31.0.0", default-features = false } +sp-block-builder = { version = "28.0.0", default-features = false } +sp-consensus-aura = { version = "0.34.0", default-features = false } +sp-consensus-babe = { version = "0.34.0", default-features = false } + +sp-consensus-grandpa = { version = "15.0.0", default-features = false } +sp-consensus-slots = { version = "0.34.0", default-features = false } + +sp-consensus = { version = "0.34.0", default-features = false } +sp-consensus-beefy = { version = "15.0.0", default-features = false } +sp-core = { version = "30.0.0", default-features = false } +sp-inherents = { version = "28.0.0", default-features = false } +sp-externalities = { version = "0.27.0", default-features = false } +sp-offchain = { version = "28.0.0", default-features = false } +sp-keyring = { version = "33.0.0", default-features = false } +sp-runtime = { version = "33.0.0", default-features = false } +sp-runtime-interface = { version = "26.0.0", default-features = false } + +sp-timestamp = { version = "28.0.0", default-features = false } +sp-keystore = { version = "0.36.0", default-features = false } +sp-mmr-primitives = { version = "28.0.0", default-features = false } + +sp-state-machine = { version = "0.37.0", default-features = false } +sp-storage = { version = "20.0.0", default-features = false } +sp-staking = { version = "28.0.0", default-features = false } +sp-session = { version = "29.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } -sp-transaction-pool = { version = "26.0.0", default-features = false } -sp-version = { version = "29.0.0", default-features = false } -sp-genesis-builder = { version = "0.7.0", default-features = false } +sp-transaction-pool = { version = "28.0.0", default-features = false } +sp-version = { version = "31.0.0", default-features = false } +sp-genesis-builder = { version = "0.9.0", default-features = false } sp-wasm-interface = { version = "20.0.0", default-features = false } -sp-transaction-storage-proof = { version = "26.0.0", default-features = false } - -pallet-xcm = { version = "7.0.0", default-features = false } -polkadot-parachain-primitives = { version = "6.0.0", default-features = false } -polkadot-runtime-common = { version = "7.0.0", default-features = false } -staging-xcm = { version = "7.0.0", default-features = false } -staging-xcm-builder = { version = "7.0.3", default-features = false } -staging-xcm-executor = { version = "7.0.3", default-features = false } -cumulus-primitives-aura = { version = "0.7.0", default-features = false } -cumulus-pallet-session-benchmarking = { version = "9.0.0", default-features = false } -cumulus-pallet-aura-ext = { version = "0.7.0", default-features = false } -cumulus-pallet-dmp-queue = { version = "0.7.0", default-features = false } -cumulus-pallet-parachain-system = { version = "0.7.0", default-features = false, features = ["parameterized-consensus-hook"] } -cumulus-pallet-xcm = { version = "0.7.0", default-features = false } -cumulus-pallet-xcmp-queue = { version = "0.7.0", default-features = false } -cumulus-primitives-core = { version = "0.7.0", default-features = false } -cumulus-primitives-timestamp = { version = "0.7.0", default-features = false } -cumulus-primitives-utility = { version = "0.7.3", default-features = false } -pallet-collator-selection = { version = "=9.0.0", default-features = false } -parachain-info = { version = "0.7.0", package = "staging-parachain-info", default-features = false } -parachains-common = { version = "7.0.0", default-features = false } +sp-transaction-storage-proof = { version = "28.0.0", default-features = false } + + +pallet-xcm = { version = "9.0.1", default-features = false } +polkadot-parachain-primitives = { version = "8.0.0", default-features = false } +polkadot-runtime-common = { version = "9.0.0", default-features = false } +staging-xcm = { version = "9.0.0", default-features = false } +staging-xcm-builder = { version = "9.0.0", default-features = false } +staging-xcm-executor = { version = "9.0.1", default-features = false } + +cumulus-primitives-aura = { version = "0.9.0", default-features = false } +cumulus-pallet-session-benchmarking = { version = "11.0.0", default-features = false } +cumulus-pallet-aura-ext = { version = "0.9.0", default-features = false } +cumulus-pallet-dmp-queue = { version = "0.9.0", default-features = false } +cumulus-pallet-parachain-system = { version = "0.9.0", default-features = false, features = ["parameterized-consensus-hook"] } +cumulus-pallet-xcm = { version = "0.9.0", default-features = false } +cumulus-pallet-xcmp-queue = { version = "0.9.0", default-features = false } +cumulus-primitives-core = { version = "0.9.0", default-features = false } + +cumulus-primitives-timestamp = { version = "0.9.0", default-features = false } +cumulus-primitives-utility = { version = "0.9.0", default-features = false } +pallet-collator-selection = { version = "11.0.1", default-features = false } +parachain-info = { version = "0.9.0", package = "staging-parachain-info", default-features = false } +parachains-common = { version = "9.0.0", default-features = false } + # client -parachain-inherent = { version = "0.7.0", package = "cumulus-primitives-parachain-inherent" } -sproof-builder = { version = "0.7.0", package = "cumulus-test-relay-sproof-builder" } -frame-benchmarking-cli = "32.0.0" -pallet-transaction-payment-rpc = "30.0.0" -sc-basic-authorship = "0.34.0" -sc-chain-spec = "27.0.0" -sc-cli = "0.36.0" -sc-keystore = "25.0.0" -sc-informant = "0.33.0" -sc-block-builder = "0.33.0" -sc-client-api = "28.0.0" -sc-client-db = "0.35.0" -sc-consensus = "0.33.0" -sc-consensus-aura = "0.34.0" -sc-consensus-grandpa = "0.19.0" -sc-consensus-babe = "0.34.0" -sc-consensus-epochs = "0.33.0" -sc-consensus-slots = "0.33.0" -sc-executor = "0.32.0" -sc-network = "0.34.0" -sc-network-sync = "0.33.0" -sc-network-common = "0.33.0" -sc-rpc = "29.0.0" -sc-rpc-api = "0.33.0" -sc-rpc-server = "11.0.0" -sc-rpc-spec-v2 = "0.34.0" -substrate-state-trie-migration-rpc = "27.0.0" -sc-consensus-babe-rpc = "0.34.0" -sc-consensus-grandpa-rpc = "0.19.0" -sc-sync-state-rpc = "0.34.0" -sc-service = "0.35.0" -sc-sysinfo = "27.0.0" -sc-storage-monitor = "0.16.0" -sc-telemetry = "15.0.0" -sc-tracing = "28.0.0" -sc-transaction-pool = "28.0.0" -sc-transaction-pool-api = "28.0.0" -sc-offchain = "29.0.0" -manual-seal = { version = "0.35.0", package = "sc-consensus-manual-seal" } -substrate-frame-rpc-system = "28.0.0" +parachain-inherent = { version = "0.9.0", package = "cumulus-primitives-parachain-inherent" } +sproof-builder = { version = "0.9.0", package = "cumulus-test-relay-sproof-builder" } +frame-benchmarking-cli = "34.0.0" + +pallet-transaction-payment-rpc = "32.0.0" +sc-basic-authorship = "0.36.0" + +sc-chain-spec = "29.0.0" +sc-cli = "0.38.0" +sc-keystore = "27.0.0" +sc-informant = "0.35.0" +sc-block-builder = "0.35.0" + +sc-client-api = "30.0.0" +sc-client-db = "0.37.0" +sc-consensus = "0.35.0" +sc-consensus-aura = "0.36.0" +sc-consensus-grandpa = "0.21.0" +sc-consensus-babe = "0.36.0" +sc-consensus-epochs = "0.35.0" +sc-consensus-slots = "0.35.0" +sc-executor = "0.34.0" +sc-network = "0.36.0" +sc-network-sync = "0.35.0" +sc-network-common = "0.35.0" +sc-rpc = "31.0.0" +sc-rpc-api = "0.35.0" +sc-rpc-server = "13.0.0" +sc-rpc-spec-v2 = "0.36.0" +substrate-state-trie-migration-rpc = "29.0.0" +sc-consensus-babe-rpc = "0.36.0" +sc-consensus-grandpa-rpc = "0.21.0" +sc-sync-state-rpc = "0.36.0" +sc-service = "0.37.0" +sc-sysinfo = "29.0.0" +sc-storage-monitor = "0.18.0" +sc-telemetry = "17.0.0" +sc-tracing = "30.0.0" +sc-transaction-pool = "30.0.0" +sc-transaction-pool-api = "30.0.0" +sc-offchain = "31.0.0" +manual-seal = { version = "0.37.0", package = "sc-consensus-manual-seal" } +substrate-frame-rpc-system = "30.0.0" substrate-prometheus-endpoint = "0.17.0" -try-runtime-cli = "0.38.0" -polkadot-cli = "7.0.0" -polkadot-primitives = "7.0.0" -polkadot-service = "7.0.0" -cumulus-client-cli = "0.7.0" -cumulus-client-consensus-aura = "0.7.0" -cumulus-client-consensus-common = "0.7.0" -cumulus-client-network = "0.7.0" -cumulus-client-service = "0.7.0" -cumulus-primitives-parachain-inherent = "0.7.0" -cumulus-relay-chain-interface = "0.7.0" -cumulus-client-consensus-proposer = "0.7.0" -cumulus-client-collator = "0.7.0" -substrate-wasm-builder = { version = "17.0.0" } -mmr-rpc = { version = "28.0.0" } -xcm-simulator-example = "7.0.0" -xcm-simulator = "7.0.0" -polkadot-runtime-parachains = "7.0.0" +try-runtime-cli = "0.40.0" +polkadot-cli = "9.0.0" +polkadot-primitives = "9.0.0" +polkadot-service = "9.0.0" +cumulus-client-cli = "0.9.0" +cumulus-client-consensus-aura = "0.9.0" +cumulus-client-consensus-common = "0.9.0" +cumulus-client-network = "0.9.0" +cumulus-client-service = "0.9.0" +cumulus-primitives-parachain-inherent = "0.9.0" +cumulus-relay-chain-interface = "0.9.0" +cumulus-client-consensus-proposer = "0.9.0" +cumulus-client-collator = "0.9.0" +substrate-wasm-builder = { version = "19.0.0" } +mmr-rpc = { version = "30.0.0" } +xcm-simulator-example = "9.0.0" +xcm-simulator = "9.0.0" +polkadot-runtime-parachains = "9.0.0" substrate-build-script-utils = "11.0.0" diff --git a/examples/aura/node/Cargo.toml b/examples/aura/node/Cargo.toml index 157897d..91163c7 100644 --- a/examples/aura/node/Cargo.toml +++ b/examples/aura/node/Cargo.toml @@ -46,7 +46,7 @@ frame-system = { workspace = true } pallet-transaction-payment = { default-features = false, workspace = true } # These dependencies are used for the node template's RPCs -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.22.5", features = ["server"] } sc-rpc = { workspace = true } sp-api = { workspace = true } sc-rpc-api = { workspace = true } diff --git a/examples/aura/node/src/command.rs b/examples/aura/node/src/command.rs index 8bf7879..bcca249 100644 --- a/examples/aura/node/src/command.rs +++ b/examples/aura/node/src/command.rs @@ -10,7 +10,7 @@ use sc_cli::SubstrateCli; use sc_service::PartialComponents; use sp_keyring::Sr25519Keyring; -use sp_runtime::generic::Era; +use sp_runtime::{generic::Era, traits::BlakeTwo256}; #[cfg(feature = "try-runtime")] use try_runtime_cli::block_building_info::timestamp_with_aura_info; @@ -134,7 +134,7 @@ pub fn run() -> sc_cli::Result<()> { ) } - cmd.run::(config) + cmd.run::(config) }, BenchmarkCmd::Block(cmd) => { let executor = diff --git a/examples/aura/runtime/src/lib.rs b/examples/aura/runtime/src/lib.rs index be5a0e5..58ca852 100644 --- a/examples/aura/runtime/src/lib.rs +++ b/examples/aura/runtime/src/lib.rs @@ -244,7 +244,6 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type MaxLocks = ConstU32<50>; type MaxReserves = (); - type MaxHolds = (); type MaxFreezes = (); } diff --git a/examples/babe/node/Cargo.toml b/examples/babe/node/Cargo.toml index 7acc3e0..2ebeef0 100644 --- a/examples/babe/node/Cargo.toml +++ b/examples/babe/node/Cargo.toml @@ -39,7 +39,7 @@ array-bytes = "4.1" clap = { version = "4.0.9", features = ["derive"], optional = true } codec = { workspace = true } serde = { version = "1.0.136", features = ["derive"] } -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.22.5", features = ["server"] } futures = "0.3.21" log = "0.4.17" rand = "0.8" diff --git a/examples/babe/node/src/command.rs b/examples/babe/node/src/command.rs index 4695d47..453c8a5 100644 --- a/examples/babe/node/src/command.rs +++ b/examples/babe/node/src/command.rs @@ -28,7 +28,7 @@ use sc_cli::{Result, SubstrateCli}; use sc_service::PartialComponents; use sp_keyring::Sr25519Keyring; -use sp_runtime::generic::Era; +use sp_runtime::{generic::Era, traits::BlakeTwo256}; use std::sync::Arc; #[cfg(feature = "try-runtime")] @@ -106,7 +106,7 @@ pub fn run() -> Result<()> { ) } - cmd.run::(config) + cmd.run::(config) }, BenchmarkCmd::Block(cmd) => { // ensure that we keep the task manager alive diff --git a/examples/babe/rpc/Cargo.toml b/examples/babe/rpc/Cargo.toml index dd59aa1..44ffa84 100644 --- a/examples/babe/rpc/Cargo.toml +++ b/examples/babe/rpc/Cargo.toml @@ -13,7 +13,7 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.22.5", features = ["server"] } pallet-transaction-payment-rpc = { workspace = true } sc-chain-spec = { workspace = true } sc-client-api = { workspace = true } diff --git a/examples/babe/runtime/src/lib.rs b/examples/babe/runtime/src/lib.rs index bc37b6e..b256d19 100644 --- a/examples/babe/runtime/src/lib.rs +++ b/examples/babe/runtime/src/lib.rs @@ -399,7 +399,6 @@ impl pallet_balances::Config for Runtime { type FreezeIdentifier = (); type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; - type MaxHolds = ConstU32<1>; type MaxFreezes = (); } diff --git a/examples/parachain/node/Cargo.toml b/examples/parachain/node/Cargo.toml index 72df541..f75092b 100644 --- a/examples/parachain/node/Cargo.toml +++ b/examples/parachain/node/Cargo.toml @@ -15,7 +15,7 @@ clap = { version = "4.1.8", features = ["derive"] } log = "0.4.17" codec = { workspace = true } serde = { version = "1.0.152", features = ["derive"] } -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.22.5", features = ["server"] } serde_json = "1.0.116" # Local diff --git a/examples/parachain/node/src/command.rs b/examples/parachain/node/src/command.rs index 8c92474..b7affdd 100644 --- a/examples/parachain/node/src/command.rs +++ b/examples/parachain/node/src/command.rs @@ -1,11 +1,11 @@ use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; -use parachain_runtime::Block; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result, SharedParams, SubstrateCli, }; +use sp_runtime::traits::BlakeTwo256; use sc_service::config::{BasePath, PrometheusConfig}; @@ -188,7 +188,7 @@ pub fn run() -> Result<()> { match cmd { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { - runner.sync_run(|config| cmd.run::(config)) + runner.sync_run(|config| cmd.run::(config)) } else { Err("Benchmarking wasn't enabled when building the node. \ You can enable it with `--features runtime-benchmarks`." diff --git a/examples/parachain/node/src/service.rs b/examples/parachain/node/src/service.rs index f600bd3..8145436 100644 --- a/examples/parachain/node/src/service.rs +++ b/examples/parachain/node/src/service.rs @@ -415,8 +415,6 @@ fn start_consensus( // 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(), @@ -448,7 +446,7 @@ fn start_consensus( collator_key, para_id, overseer_handle, - slot_duration, + reinitialize: true, relay_chain_slot_duration, proposer, collator_service, diff --git a/examples/parachain/runtime/Cargo.toml b/examples/parachain/runtime/Cargo.toml index 09bb8ad..c2949b9 100644 --- a/examples/parachain/runtime/Cargo.toml +++ b/examples/parachain/runtime/Cargo.toml @@ -17,7 +17,6 @@ substrate-wasm-builder = { workspace = true, optional = true } [dependencies] codec = { workspace = true, features = ["derive"] } scale-info = { workspace = true, features = ["derive"] } - hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.17", default-features = false } smallvec = "1.10.0" diff --git a/examples/parachain/runtime/src/lib.rs b/examples/parachain/runtime/src/lib.rs index 338702d..61a0fac 100644 --- a/examples/parachain/runtime/src/lib.rs +++ b/examples/parachain/runtime/src/lib.rs @@ -15,6 +15,7 @@ pub fn wasm_binary_unwrap() -> &'static [u8] { the flag disabled.", ) } +extern crate alloc; mod weights; pub mod xcm_config; @@ -345,7 +346,6 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = (); type MaxFreezes = ConstU32<0>; - type MaxHolds = ConstU32<1>; } parameter_types! { diff --git a/examples/parachain/runtime/src/xcm_config.rs b/examples/parachain/runtime/src/xcm_config.rs index b9d3786..61f8541 100644 --- a/examples/parachain/runtime/src/xcm_config.rs +++ b/examples/parachain/runtime/src/xcm_config.rs @@ -13,12 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +use core::marker::PhantomData; + use super::{ AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use crate::AllPalletsWithSystem; -use core::marker::PhantomData; +use cumulus_primitives_core::InteriorLocation; use frame_support::{ match_types, parameter_types, traits::{ConstU32, Everything, Nothing, ProcessMessageError}, @@ -42,11 +44,11 @@ use staging_xcm_executor::{ }; parameter_types! { - pub const RelayLocation: MultiLocation = MultiLocation::parent(); + pub const RelayLocation: Location = Location::parent(); pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub Ancestry: Location = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -104,9 +106,9 @@ parameter_types! { } match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + pub type ParentOrParentsExecutivePlurality: impl Contains = { + Location { parents: 1, interior: Junctions::Here} + // Location { parents: 1, interior: Junctions::X1(Arc::new(Plurality { id: BodyId::Executive, .. }))} }; } @@ -124,7 +126,7 @@ where Allow: ShouldExecute, { fn should_execute( - origin: &MultiLocation, + origin: &Location, message: &mut [Instruction], max_weight: Weight, properties: &mut Properties, @@ -139,7 +141,7 @@ where pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( - origin: &MultiLocation, + origin: &Location, message: &mut [Instruction], _max_weight: Weight, _properties: &mut Properties, @@ -147,14 +149,9 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { if message.iter().any(|inst| { matches!( inst, - InitiateReserveWithdraw { - reserve: MultiLocation { parents: 1, interior: Here }, - .. - } | DepositReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } | - TransferReserveAsset { - dest: MultiLocation { parents: 1, interior: Here }, - .. - } + InitiateReserveWithdraw { reserve: Location { parents: 1, interior: Here }, .. } | + DepositReserveAsset { dest: Location { parents: 1, interior: Here }, .. } | + TransferReserveAsset { dest: Location { parents: 1, interior: Here }, .. } ) }) { return Err(ProcessMessageError::Unsupported); // Deny @@ -162,7 +159,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` // should not allow this, but we just log it here. - if matches!(origin, MultiLocation { parents: 1, interior: Here }) && + if matches!(origin, Location { parents: 1, interior: Here }) && message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) { log::warn!( diff --git a/runtime-api/Cargo.toml b/runtime-api/Cargo.toml index 28102c8..92e4212 100644 --- a/runtime-api/Cargo.toml +++ b/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simnode-runtime-api" -version = "1.6.0" +version = "1.8.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" diff --git a/simnode/Cargo.toml b/simnode/Cargo.toml index cce313d..de32972 100644 --- a/simnode/Cargo.toml +++ b/simnode/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-simnode" -version = "1.6.2" +version = "1.8.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" @@ -80,7 +80,7 @@ futures = "0.3.16" tokio = { version = "1.13", features = ["signal"] } clap = { version = "4.0.9", features = ["derive"] } # Calling RPC -jsonrpsee = { version = "0.16.2", features = ["server"] } +jsonrpsee = { version = "0.22.5", features = ["server", "client-core", "macros"] } num-traits = "0.2.14" async-trait = "0.1.57" # local deps diff --git a/simnode/src/client/parachain.rs b/simnode/src/client/parachain.rs index 53ec453..b23f220 100644 --- a/simnode/src/client/parachain.rs +++ b/simnode/src/client/parachain.rs @@ -23,7 +23,7 @@ use crate::{ }; use async_trait::async_trait; use futures::{channel::mpsc, future::Either, lock::Mutex, FutureExt, StreamExt}; -use jsonrpsee::core::{Error as RpcError, RpcResult}; +use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned}; use manual_seal::{ rpc::{ManualSeal, ManualSealApiServer}, run_manual_seal, EngineCommand, ManualSealParams, @@ -110,12 +110,14 @@ where sender: Some(sender), }; - sink.send(command).await?; + sink.send(command) + .await + .map_err(|_| ErrorObjectOwned::owned::<&str>(2300, "Failed to upgrade signal", None))?; match receiver.await { Ok(Ok(_)) => Ok(()), Ok(Err(e)) => Err(e.into()), - Err(e) => Err(RpcError::to_call_error(e)), + Err(e) => Err(ErrorObjectOwned::owned::<&str>(2200, format!("{}", e), None)), } } } diff --git a/simnode/src/rpc.rs b/simnode/src/rpc.rs index 9e689b4..fcdb0cc 100644 --- a/simnode/src/rpc.rs +++ b/simnode/src/rpc.rs @@ -22,10 +22,7 @@ use crate::{ }; use async_trait::async_trait; use codec::Encode; -use jsonrpsee::{ - core::{Error as RpcError, RpcResult as Result}, - proc_macros::rpc, -}; +use jsonrpsee::{core::RpcResult, proc_macros::rpc, types::ErrorObjectOwned}; use sc_client_api::Backend; use sc_service::TFullBackend; use simnode_runtime_api::CreateTransactionApi; @@ -48,16 +45,16 @@ pub trait SimnodeApi { /// Constructs an extrinsic with an empty signature and the given AccountId as the Signer using /// simnode's runtime api. #[method(name = "simnode_authorExtrinsic")] - fn author_extrinsic(&self, call: Bytes, account: String) -> Result; + fn author_extrinsic(&self, call: Bytes, account: String) -> RpcResult; /// reverts `n` number of blocks and their state from the chain. #[method(name = "simnode_revertBlocks")] - fn revert_blocks(&self, n: u32) -> Result<()>; + fn revert_blocks(&self, n: u32) -> RpcResult<()>; /// Insert the [`UpgradeGoAhead`] command into the inherents as if it came from the relay chain. /// This greenlights/aborts a pending runtime upgrade. #[method(name = "simnode_upgradeSignal")] - async fn upgrade_signal(&self, go_ahead: bool) -> Result<()>; + async fn upgrade_signal(&self, go_ahead: bool) -> RpcResult<()>; } /// Handler implementation for Simnode RPC API. @@ -84,7 +81,7 @@ where Self { client, backend } } - fn author_extrinsic(&self, call: Bytes, account: String) -> Result> { + fn author_extrinsic(&self, call: Bytes, account: String) -> RpcResult> { let at = self.client.info().best_hash; let has_api = self @@ -95,31 +92,55 @@ where ::RuntimeCall, ::AccountId, >>(at) - .map_err(|e| RpcError::Custom(format!("failed read runtime api: {e:?}")))?; - - let ext = - if has_api { - let call = codec::Decode::decode(&mut &call.0[..]) - .map_err(|e| RpcError::Custom(format!("failed to decode call: {e:?}")))?; - let account = AccountId32::from_string(&account) - .map_err(|e| RpcError::Custom(format!("failed to decode account: {e:?}")))?; - self.client.runtime_api().create_transaction(at, account.into(), call).map_err( - |e| RpcError::Custom(format!("CreateTransactionApi is unimplemented: {e:?}")), - )? - } else { - let call = codec::Decode::decode(&mut &call.0[..]) - .map_err(|e| RpcError::Custom(format!("failed to decode call: {e:?}")))?; - let account = AccountId32::from_string(&account) - .map_err(|e| RpcError::Custom(format!("failed to decode account: {e:?}")))?; - let extra = self.with_state(None, || T::signed_extras(account.clone().into())); - let ext = UncheckedExtrinsicFor::::new_signed( - call, - MultiAddress::Id(account.into()), - MultiSignature::Sr25519(sp_core::sr25519::Signature::from_raw([0u8; 64])), - extra, - ); - ext.encode() - }; + .map_err(|e| { + ErrorObjectOwned::owned::<&str>( + 1000, + format!("failed read runtime api: {e:?}"), + None, + ) + })?; + + let ext = if has_api { + let call = codec::Decode::decode(&mut &call.0[..]).map_err(|e| { + ErrorObjectOwned::owned::<&str>(1001, format!("failed to decode call: {e:?}"), None) + })?; + let account = AccountId32::from_string(&account).map_err(|e| { + ErrorObjectOwned::owned::<&str>( + 1002, + format!("failed to decode account: {e:?}"), + None, + ) + })?; + self.client + .runtime_api() + .create_transaction(at, account.into(), call) + .map_err(|e| { + ErrorObjectOwned::owned::<&str>( + 1003, + format!("CreateTransactionApi is unimplemented: {e:?}"), + None, + ) + })? + } else { + let call = codec::Decode::decode(&mut &call.0[..]).map_err(|e| { + ErrorObjectOwned::owned::<&str>(1004, format!("failed to decode call: {e:?}"), None) + })?; + let account = AccountId32::from_string(&account).map_err(|e| { + ErrorObjectOwned::owned::<&str>( + 1005, + format!("failed to decode account: {e:?}"), + None, + ) + })?; + let extra = self.with_state(None, || T::signed_extras(account.clone().into())); + let ext = UncheckedExtrinsicFor::::new_signed( + call, + MultiAddress::Id(account.into()), + MultiSignature::Sr25519(sp_core::sr25519::Signature::from_raw([0u8; 64])), + extra, + ); + ext.encode() + }; Ok(ext) } @@ -133,10 +154,10 @@ where with_state::(self.client.clone(), id, closure) } - fn revert_blocks(&self, n: u32) -> Result<()> { - self.backend - .revert(n.into(), true) - .map_err(|e| RpcError::Custom(format!("failed to revert blocks: {e:?}")))?; + fn revert_blocks(&self, n: u32) -> RpcResult<()> { + self.backend.revert(n.into(), true).map_err(|e| { + ErrorObjectOwned::owned::<&str>(2050, format!("failed to revert blocks: {e:?}"), None) + })?; Ok(()) } @@ -155,17 +176,19 @@ where ::AccountId: From, <::Header as Header>::Number: num_traits::cast::AsPrimitive, { - fn author_extrinsic(&self, call: Bytes, account: String) -> Result { + fn author_extrinsic(&self, call: Bytes, account: String) -> RpcResult { Ok(self.author_extrinsic(call, account)?.into()) } - fn revert_blocks(&self, n: u32) -> Result<()> { + fn revert_blocks(&self, n: u32) -> RpcResult<()> { self.revert_blocks(n) } - async fn upgrade_signal(&self, _go_ahead: bool) -> Result<()> { - Err(RpcError::Custom(format!( - "standalone runtimes don't need permission to upgrade their runtime" - ))) + async fn upgrade_signal(&self, _go_ahead: bool) -> RpcResult<()> { + Err(ErrorObjectOwned::owned::<&str>( + 3050, + format!("standalone runtimes don't need permission to upgrade their runtime"), + None, + )) } }