diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 287510a..b4dda14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,6 @@ jobs: - name: Build all binaries run: | cargo update memchr --precise 2.7.4 - cargo update serde_json --precise 1.0.127 cargo build --release --bins - name: Aura Integration tests diff --git a/Cargo.toml b/Cargo.toml index 1559a31..7f697f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,17 +23,17 @@ members = [ codec = { version = "3.1.3", package = "parity-scale-codec", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } jsonrpsee = "0.24" -try-runtime-cli = "0.41.0" -polkadot-sdk = { version = "0.7.0", default-features = false } +polkadot-sdk = { version = "0.12.2", default-features = false } # crates which cannot be used from polkadot-sdk -sp-core = { version = "34.0.0", default-features = false } -sp-runtime-interface = { version = "28.0.0", default-features = false } -cumulus-pallet-parachain-system = { version = "0.17.1", default-features = false } -substrate-wasm-builder = "24.0.1" -sc-service = "0.46.0" -sc-tracing = "37.0.1" +sp-core = { version = "35.0.0", default-features = false } +sp-runtime-interface = { version = "29.0.0", default-features = false } +cumulus-pallet-parachain-system = { version = "0.18.1", default-features = false } +substrate-wasm-builder = "25.0.0" +sc-service = "0.49.0" +sc-tracing = "38.0.0" +sp-api-proc-macro = "21.0.0" # local crates -simnode-runtime-api = { path = "./runtime-api", version = "16.0.0", default-features = false } -sc-simnode = { path = "./simnode", version = "16.0.0" } +simnode-runtime-api = { path = "./runtime-api", version = "2412.0.0", default-features = false } +sc-simnode = { path = "./simnode", version = "2412.0.0" } diff --git a/README.md b/README.md index 5f59f17..6d95229 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ Installation and integration guides can be found in the [book](https://simnode.p ## Releases -`sc-simnode` exclusively follows the official [paritytech/polkadot-sdk](https://github.com/paritytech/polkadot-sdk/releases) stable releases. Therefore new versions of this crate will be published as a new major release for the minor version of the corresponding polkadot-sdk stable release. -E.g [`polkadot-stable2409`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2409) corresponds to the [`polkadot-sdk-v1.160`](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.16.0) tag, which is supported by the `v16.0.0` version of this crate. Subsequent stable releases will see a major version bump in this crate. +`sc-simnode` exclusively follows the official [paritytech/polkadot-sdk](https://github.com/paritytech/polkadot-sdk/releases) umbrella crate stable releases. Therefore new versions of this crate will be published for every major version of the corresponding polkadot-sdk stable release. +E.g [`polkadot-stable2412`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412) is supported by the `v2412.0.0` version of this crate. Subsequent stable releases will see a similar version bump in this crate. ## License diff --git a/examples/aura/node/Cargo.toml b/examples/aura/node/Cargo.toml index 2474dc2..9b65fac 100644 --- a/examples/aura/node/Cargo.toml +++ b/examples/aura/node/Cargo.toml @@ -20,7 +20,6 @@ name = "aura-node" clap = { version = "4.0.9", features = ["derive"] } futures = { version = "0.3.21", features = ["thread-pool"] } jsonrpsee = { workspace = true, features = ["server"] } -try-runtime-cli = { optional = true, workspace = true } serde_json = "1.0" aura-runtime = { path = "../runtime" } @@ -81,5 +80,4 @@ runtime-benchmarks = [ try-runtime = [ "aura-runtime/try-runtime", "polkadot-sdk/try-runtime", - "try-runtime-cli/try-runtime" ] diff --git a/examples/aura/node/src/cli.rs b/examples/aura/node/src/cli.rs index 0997df3..d3d5888 100644 --- a/examples/aura/node/src/cli.rs +++ b/examples/aura/node/src/cli.rs @@ -45,10 +45,6 @@ pub enum Subcommand { /// Runs the node with signature verification override and manual seal. Simnode(sc_simnode::cli::SimnodeCli), - /// Try some command against runtime state. - #[cfg(feature = "try-runtime")] - TryRuntime(try_runtime_cli::TryRuntimeCmd), - /// Try some command against runtime state. Note: `try-runtime` feature must be enabled. #[cfg(not(feature = "try-runtime"))] TryRuntime, diff --git a/examples/aura/node/src/command.rs b/examples/aura/node/src/command.rs index 0450f1f..f717ba2 100644 --- a/examples/aura/node/src/command.rs +++ b/examples/aura/node/src/command.rs @@ -14,9 +14,6 @@ use sc_service::PartialComponents; use sp_keyring::Sr25519Keyring; use sp_runtime::generic::Era; -#[cfg(feature = "try-runtime")] -use try_runtime_cli::block_building_info::timestamp_with_aura_info; - impl SubstrateCli for Cli { fn impl_name() -> String { "Substrate Node".into() @@ -179,11 +176,12 @@ pub fn run() -> sc_cli::Result<()> { let ext_builder = RemarkBuilder::new(client.clone()); cmd.run( - config, + config.chain_spec.name().into(), client, inherent_benchmark_data()?, Vec::new(), &ext_builder, + false, ) }, BenchmarkCmd::Extrinsic(cmd) => { @@ -238,29 +236,6 @@ pub fn run() -> sc_cli::Result<()> { Ok(task_manager) }) }, - #[cfg(feature = "try-runtime")] - Some(Subcommand::TryRuntime(cmd)) => { - use crate::service::ExecutorDispatch; - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - // we don't need any of the components of new_partial, just a, executor runtime, or - // a task manager to do `async_run`. - let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry); - let task_manager = - sc_service::TaskManager::new(config.tokio_handle.clone(), registry) - .map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?; - let info_provider = timestamp_with_aura_info(6000); - - Ok(( - cmd.run::::ExtendHostFunctions, - >, _>(Some(info_provider)), - task_manager, - )) - }) - }, #[cfg(not(feature = "try-runtime"))] Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \ You can enable it with `--features try-runtime`." diff --git a/examples/aura/node/src/service.rs b/examples/aura/node/src/service.rs index 70eb07a..153985f 100644 --- a/examples/aura/node/src/service.rs +++ b/examples/aura/node/src/service.rs @@ -35,7 +35,7 @@ pub fn new_partial( FullBackend, FullSelectChain, sc_consensus::DefaultImportQueue, - sc_transaction_pool::FullPool>, + sc_transaction_pool::TransactionPoolHandle>, ( sc_consensus_grandpa::GrandpaBlockImport< FullBackend, @@ -78,12 +78,15 @@ where let select_chain = sc_consensus::LongestChain::new(backend.clone()); - let transaction_pool = sc_transaction_pool::BasicPool::new_full( - config.transaction_pool.clone(), - config.role.is_authority().into(), - config.prometheus_registry(), - task_manager.spawn_essential_handle(), - client.clone(), + let transaction_pool = Arc::from( + sc_transaction_pool::Builder::new( + task_manager.spawn_essential_handle(), + client.clone(), + config.role.is_authority().into(), + ) + .with_options(config.transaction_pool.clone()) + .with_prometheus(config.prometheus_registry()) + .build(), ); let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( @@ -202,7 +205,7 @@ pub fn new_full(config: Configuration) -> Result { network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); diff --git a/examples/aura/runtime/src/lib.rs b/examples/aura/runtime/src/lib.rs index 6f85ccb..de3fbe7 100644 --- a/examples/aura/runtime/src/lib.rs +++ b/examples/aura/runtime/src/lib.rs @@ -14,7 +14,7 @@ use sp_api::impl_runtime_apis; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, + generic, impl_opaque_keys, traits::{ AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, One, Verify, }, @@ -98,8 +98,8 @@ pub mod opaque { // https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("node-template"), - impl_name: create_runtime_str!("node-template"), + spec_name: sp_std::borrow::Cow::Borrowed("node-template"), + impl_name: sp_std::borrow::Cow::Borrowed("node-template"), authoring_version: 1, // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, @@ -110,7 +110,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, - state_version: 1, + system_version: 1, }; /// This determines the average expected block time that we are targeting. @@ -249,6 +249,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = ConstU32<50>; type MaxReserves = (); type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_types! { @@ -262,6 +263,7 @@ impl pallet_transaction_payment::Config for Runtime { type LengthToFee = IdentityFee; type FeeMultiplierUpdate = ConstFeeMultiplier; type OperationalFeeMultiplier = ConstU8<5>; + type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight; } impl pallet_sudo::Config for Runtime { diff --git a/examples/babe/node/Cargo.toml b/examples/babe/node/Cargo.toml index 4a3ea2a..064459b 100644 --- a/examples/babe/node/Cargo.toml +++ b/examples/babe/node/Cargo.toml @@ -51,7 +51,6 @@ sc-simnode = { workspace = true, features = ["babe"] } # CLI-specific dependencies sc-service = { workspace = true } -try-runtime-cli = { optional = true, workspace = true } serde_json = "1.0" [dependencies.polkadot-sdk] @@ -119,7 +118,6 @@ cli = [ "polkadot-sdk/frame-benchmarking-cli", "sc-service/rocksdb", "clap", - "try-runtime-cli", ] runtime-benchmarks = [ "polkadot-sdk/runtime-benchmarks", @@ -127,4 +125,4 @@ runtime-benchmarks = [ ] # Enable features that allow the runtime to be tried and debugged. # Name might be subject to change in the near future. -try-runtime = ["babe-runtime/try-runtime", "try-runtime-cli/try-runtime"] +try-runtime = ["babe-runtime/try-runtime"] diff --git a/examples/babe/node/src/cli.rs b/examples/babe/node/src/cli.rs index 0523f90..2d62063 100644 --- a/examples/babe/node/src/cli.rs +++ b/examples/babe/node/src/cli.rs @@ -51,10 +51,6 @@ pub enum Subcommand { #[command(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), - /// Try some command against runtime state. - #[cfg(feature = "try-runtime")] - TryRuntime(try_runtime_cli::TryRuntimeCmd), - /// Try some command against runtime state. Note: `try-runtime` feature must be enabled. #[cfg(not(feature = "try-runtime"))] TryRuntime, diff --git a/examples/babe/node/src/command.rs b/examples/babe/node/src/command.rs index ad102c6..bfc2b0c 100644 --- a/examples/babe/node/src/command.rs +++ b/examples/babe/node/src/command.rs @@ -34,10 +34,7 @@ use sp_runtime::generic::Era; use std::sync::Arc; #[cfg(feature = "try-runtime")] -use { - babe_runtime::constants::time::SLOT_DURATION, - try_runtime_cli::block_building_info::substrate_info, -}; +use babe_runtime::constants::time::SLOT_DURATION; impl SubstrateCli for Cli { fn impl_name() -> String { @@ -146,11 +143,12 @@ pub fn run() -> Result<()> { let ext_builder = RemarkBuilder::new(partial.client.clone()); cmd.run( - config, + config.chain_spec.name().into(), partial.client, inherent_benchmark_data()?, Vec::new(), &ext_builder, + false, ) }, BenchmarkCmd::Extrinsic(cmd) => { @@ -253,29 +251,6 @@ pub fn run() -> Result<()> { Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) }) }, - #[cfg(feature = "try-runtime")] - Some(Subcommand::TryRuntime(cmd)) => { - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; - let runner = cli.create_runner(cmd)?; - runner.async_run(|config| { - // we don't need any of the components of new_partial, just a runtime, or a task - // manager to do `async_run`. - let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry); - let task_manager = - sc_service::TaskManager::new(config.tokio_handle.clone(), registry) - .map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?; - - let info_provider = substrate_info(SLOT_DURATION); - - Ok(( - cmd.run::::ExtendHostFunctions, - >, _>(Some(info_provider)), - task_manager, - )) - }) - }, Some(Subcommand::Simnode(cmd)) => { let runner = cli.create_runner(&cmd.run.normalize())?; let config = runner.config(); diff --git a/examples/babe/node/src/service.rs b/examples/babe/node/src/service.rs index 636b8bb..f91b68b 100644 --- a/examples/babe/node/src/service.rs +++ b/examples/babe/node/src/service.rs @@ -72,7 +72,7 @@ impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { } /// The transaction pool type defintion. -pub type TransactionPool = sc_transaction_pool::FullPool; +pub type TransactionPool = sc_transaction_pool::TransactionPoolHandle; /// Fetch the nonce of the given `account` from the chain state. /// @@ -160,7 +160,7 @@ pub fn new_partial( FullBackend, FullSelectChain, sc_consensus::DefaultImportQueue, - sc_transaction_pool::FullPool>, + sc_transaction_pool::TransactionPoolHandle>, ( impl Fn( sc_rpc::SubscriptionTaskExecutor, @@ -205,12 +205,15 @@ where let select_chain = sc_consensus::LongestChain::new(backend.clone()); - let transaction_pool = sc_transaction_pool::BasicPool::new_full( - config.transaction_pool.clone(), - config.role.is_authority().into(), - config.prometheus_registry(), - task_manager.spawn_essential_handle(), - client.clone(), + let transaction_pool = Arc::from( + sc_transaction_pool::Builder::new( + task_manager.spawn_essential_handle(), + client.clone(), + config.role.is_authority().into(), + ) + .with_options(config.transaction_pool.clone()) + .with_prometheus(config.prometheus_registry()) + .build(), ); let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( @@ -418,7 +421,7 @@ pub fn new_full_base( network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); diff --git a/examples/babe/runtime/src/lib.rs b/examples/babe/runtime/src/lib.rs index 4114b58..6fae4d2 100644 --- a/examples/babe/runtime/src/lib.rs +++ b/examples/babe/runtime/src/lib.rs @@ -54,7 +54,6 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_inherents::{CheckInherentsResult, InherentData}; use sp_runtime::{ - create_runtime_str, curve::PiecewiseLinear, generic, impl_opaque_keys, traits::{ @@ -196,8 +195,8 @@ pub fn wasm_binary_unwrap() -> &'static [u8] { /// Runtime version. #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("node"), - impl_name: create_runtime_str!("substrate-node"), + spec_name: sp_std::borrow::Cow::Borrowed("node"), + impl_name: sp_std::borrow::Cow::Borrowed("substrate-node"), authoring_version: 10, // Per convention: if the runtime behavior changes, increment spec_version // and set impl_version to 0. If only runtime @@ -207,7 +206,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 2, - state_version: 1, + system_version: 1, }; /// The BABE epoch configuration at genesis. @@ -387,6 +386,7 @@ impl pallet_balances::Config for Runtime { type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type MaxFreezes = (); + type DoneSlashHandler = (); } parameter_types! { @@ -411,6 +411,7 @@ impl pallet_transaction_payment::Config for Runtime { MinimumMultiplier, MaximumMultiplier, >; + type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight; } parameter_types! { @@ -552,7 +553,7 @@ impl onchain::Config for OnChainSeqPhragmen { type Bounds = Bounds; } -use sp_runtime::traits::{AccountIdLookup, Convert, IdentifyAccount, Verify}; +use sp_runtime::traits::{AccountIdLookup, Convert, IdentifyAccount, StaticLookup, Verify}; pub struct BalanceToU256; impl Convert for BalanceToU256 { fn convert(balance: Balance) -> sp_core::U256 { @@ -594,16 +595,28 @@ parameter_types! { pub const MaxPeerDataEncodingSize: u32 = 1_000; } +// First implementation of SigningTypes + +impl frame_system::offchain::CreateTransactionBase for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type RuntimeCall = RuntimeCall; +} + impl frame_system::offchain::CreateSignedTransaction for Runtime where RuntimeCall: From, { - fn create_transaction>( + fn create_signed_transaction< + C: frame_system::offchain::AppCrypto, + >( call: RuntimeCall, - public: ::Signer, + public: ::Signer, account: AccountId, - nonce: Nonce, - ) -> Option<(RuntimeCall, ::SignaturePayload)> { + nonce: ::Nonce, + ) -> Option { // take the biggest period possible. let period = BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; @@ -629,23 +642,36 @@ where }) .ok()?; let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; - let address = Address::Id(account); - let (call, extra, _) = raw_payload.deconstruct(); - Some((call, (address, signature, extra))) + let (call, tx_ext, _) = raw_payload.deconstruct(); + let address = ::Lookup::unlookup(account); + let transaction = UncheckedExtrinsic::new_signed(call, address, signature, tx_ext); + Some(transaction) } } -impl frame_system::offchain::SigningTypes for Runtime { - type Public = ::Signer; - type Signature = Signature; +impl frame_system::offchain::CreateTransaction for Runtime +where + RuntimeCall: From, +{ + type Extension = SignedExtra; + + fn create_transaction(call: RuntimeCall, tx_ext: Self::Extension) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_transaction(call, tx_ext) + } } -impl frame_system::offchain::SendTransactionTypes for Runtime +impl frame_system::offchain::CreateInherent for Runtime where - RuntimeCall: From, + RuntimeCall: From, { - type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; + fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { + UncheckedExtrinsic::new_bare(call) + } +} + +impl frame_system::offchain::SigningTypes for Runtime { + type Public = ::Signer; + type Signature = Signature; } impl pallet_offences::Config for Runtime { diff --git a/examples/parachain/node/Cargo.toml b/examples/parachain/node/Cargo.toml index e54ca1f..e0ec0c5 100644 --- a/examples/parachain/node/Cargo.toml +++ b/examples/parachain/node/Cargo.toml @@ -21,7 +21,6 @@ serde_json = "1.0" sc-tracing = { workspace = true } parachain-runtime = { path = "../runtime" } sc-simnode = { workspace = true, features = ["parachain"] } -try-runtime-cli = { workspace = true, optional = true } [dependencies.polkadot-sdk] workspace = true @@ -79,11 +78,9 @@ polkadot-sdk = { workspace = true, default-features = true, features = ["substra [features] default = [] runtime-benchmarks = [ - "try-runtime-cli/try-runtime", "parachain-runtime/runtime-benchmarks", "polkadot-sdk/runtime-benchmarks", ] try-runtime = [ - "try-runtime-cli/try-runtime", "parachain-runtime/try-runtime" ] diff --git a/examples/parachain/node/src/cli.rs b/examples/parachain/node/src/cli.rs index 6d3d7f2..6145fbf 100644 --- a/examples/parachain/node/src/cli.rs +++ b/examples/parachain/node/src/cli.rs @@ -40,10 +40,6 @@ pub enum Subcommand { /// Runs the node with signature verification override and manual seal. Simnode(sc_simnode::cli::SimnodeCli), - /// Try some testing command against a specified runtime state. - #[cfg(feature = "try-runtime")] - TryRuntime(try_runtime_cli::TryRuntimeCmd), - /// Errors since the binary was not build with `--features try-runtime`. #[cfg(not(feature = "try-runtime"))] TryRuntime, diff --git a/examples/parachain/node/src/command.rs b/examples/parachain/node/src/command.rs index 2c5d126..ebfd9c0 100644 --- a/examples/parachain/node/src/command.rs +++ b/examples/parachain/node/src/command.rs @@ -233,36 +233,6 @@ pub fn run() -> Result<()> { _ => Err("Benchmarking sub-command unsupported".into()), } }, - #[cfg(feature = "try-runtime")] - Some(Subcommand::TryRuntime(cmd)) => { - use parachain_runtime::MILLISECS_PER_BLOCK; - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; - use try_runtime_cli::block_building_info::timestamp_with_aura_info; - - let runner = cli.create_runner(cmd)?; - - type HostFunctionsOf = ExtendedHostFunctions< - crate::service::HostFunctions, - ::ExtendHostFunctions, - >; - - // grab the task manager. - let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); - let task_manager = - sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry) - .map_err(|e| format!("Error: {:?}", e))?; - - let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK); - - runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some( - info_provider, - )), - task_manager, - )) - }) - }, Some(Subcommand::Simnode(cmd)) => { let runner = cli.create_runner(&cmd.run.normalize())?; let config = runner.config(); diff --git a/examples/parachain/node/src/service.rs b/examples/parachain/node/src/service.rs index d931701..5a1e900 100644 --- a/examples/parachain/node/src/service.rs +++ b/examples/parachain/node/src/service.rs @@ -63,7 +63,7 @@ pub fn new_partial( ParachainBackend, ParachainSelectChain>, sc_consensus::DefaultImportQueue, - sc_transaction_pool::FullPool>, + sc_transaction_pool::TransactionPoolHandle>, (ParachainBlockImport, Option, Option), >, sc_service::Error, @@ -97,12 +97,15 @@ where telemetry }); - let transaction_pool = sc_transaction_pool::BasicPool::new_full( - config.transaction_pool.clone(), - config.role.is_authority().into(), - config.prometheus_registry(), - task_manager.spawn_essential_handle(), - client.clone(), + let transaction_pool = Arc::from( + sc_transaction_pool::Builder::new( + task_manager.spawn_essential_handle(), + client.clone(), + config.role.is_authority().into(), + ) + .with_options(config.transaction_pool.clone()) + .with_prometheus(config.prometheus_registry()) + .build(), ); let block_import = TParachainBlockImport::< @@ -207,7 +210,7 @@ async fn start_node_impl( network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); @@ -377,7 +380,7 @@ fn start_consensus( telemetry: Option, task_manager: &TaskManager, relay_chain_interface: Arc, - transaction_pool: Arc>, + transaction_pool: Arc>, keystore: KeystorePtr, relay_chain_slot_duration: Duration, para_id: ParaId, diff --git a/examples/parachain/runtime/src/lib.rs b/examples/parachain/runtime/src/lib.rs index 4b6be12..57ebee1 100644 --- a/examples/parachain/runtime/src/lib.rs +++ b/examples/parachain/runtime/src/lib.rs @@ -28,7 +28,7 @@ use smallvec::smallvec; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, + generic, impl_opaque_keys, traits::{BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, @@ -189,14 +189,14 @@ impl_opaque_keys! { #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("parachain-template-runtime"), - impl_name: create_runtime_str!("parachain-template-runtime"), + spec_name: sp_std::borrow::Cow::Borrowed("parachain-template-runtime"), + impl_name: sp_std::borrow::Cow::Borrowed("parachain-template-runtime"), authoring_version: 1, spec_version: 1, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, - state_version: 1, + system_version: 1, }; /// This determines the average expected block time that we are targeting. @@ -348,6 +348,7 @@ impl pallet_balances::Config for Runtime { type RuntimeFreezeReason = RuntimeFreezeReason; type FreezeIdentifier = (); type MaxFreezes = ConstU32<0>; + type DoneSlashHandler = (); } parameter_types! { @@ -362,6 +363,7 @@ impl pallet_transaction_payment::Config for Runtime { type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; type OperationalFeeMultiplier = ConstU8<5>; + type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight; } impl pallet_sudo::Config for Runtime { @@ -388,6 +390,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type ConsensusHook = ConsensusHook; + type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector; } type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< diff --git a/runtime-api/Cargo.toml b/runtime-api/Cargo.toml index bde6608..a617b54 100644 --- a/runtime-api/Cargo.toml +++ b/runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simnode-runtime-api" -version = "16.0.0" +version = "2412.0.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" diff --git a/simnode/Cargo.toml b/simnode/Cargo.toml index 4a5e821..0ccb540 100644 --- a/simnode/Cargo.toml +++ b/simnode/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sc-simnode" -version = "16.0.0" +version = "2412.0.0" authors = ["Polytope Labs "] edition = "2021" license = "Apache-2.0" diff --git a/simnode/src/client/aura.rs b/simnode/src/client/aura.rs index 94819d5..6a00207 100644 --- a/simnode/src/client/aura.rs +++ b/simnode/src/client/aura.rs @@ -33,7 +33,7 @@ use sc_service::{ build_network, spawn_tasks, BuildNetworkParams, PartialComponents, SpawnTasksParams, TFullBackend, TFullClient, TaskManager, }; -use sc_transaction_pool::FullPool; +use sc_transaction_pool::TransactionPoolWrapper; use sc_transaction_pool_api::{OffchainTransactionPoolFactory, TransactionPool}; use simnode_runtime_api::CreateTransactionApi; use sp_api::{ApiExt, ConstructRuntimeApi, Core}; @@ -49,7 +49,7 @@ pub async fn start_simnode( TFullClient, TFullBackend, S, - FullPool>, + TransactionPoolWrapper>, I, BI, U, @@ -133,7 +133,7 @@ where network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); diff --git a/simnode/src/client/babe.rs b/simnode/src/client/babe.rs index ad8f17b..19818c6 100644 --- a/simnode/src/client/babe.rs +++ b/simnode/src/client/babe.rs @@ -33,7 +33,7 @@ use sc_service::{ build_network, spawn_tasks, BuildNetworkParams, PartialComponents, SpawnTasksParams, TFullBackend, TFullClient, TaskManager, }; -use sc_transaction_pool::FullPool; +use sc_transaction_pool::TransactionPoolWrapper; use sc_transaction_pool_api::{OffchainTransactionPoolFactory, TransactionPool}; use sp_api::{ApiExt, ConstructRuntimeApi, Core}; use sp_block_builder::BlockBuilder; @@ -57,7 +57,7 @@ pub async fn start_simnode( TFullClient, TFullBackend, S, - FullPool>, + TransactionPoolWrapper>, I, BI, BabeLink, @@ -139,7 +139,7 @@ where network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); diff --git a/simnode/src/client/parachain.rs b/simnode/src/client/parachain.rs index f4722fc..113468e 100644 --- a/simnode/src/client/parachain.rs +++ b/simnode/src/client/parachain.rs @@ -39,7 +39,7 @@ use sc_service::{ build_network, spawn_tasks, BuildNetworkParams, PartialComponents, SpawnTasksParams, TFullBackend, TFullClient, TaskManager, }; -use sc_transaction_pool::FullPool; +use sc_transaction_pool::TransactionPoolWrapper; use sc_transaction_pool_api::{OffchainTransactionPoolFactory, TransactionPool}; use simnode_runtime_api::CreateTransactionApi; use sp_api::{ApiExt, ConstructRuntimeApi, Core, ProvideRuntimeApi}; @@ -172,7 +172,7 @@ pub async fn start_simnode( TFullClient, TFullBackend, S, - FullPool>, + TransactionPoolWrapper>, I, BI, U, @@ -266,7 +266,7 @@ where network_provider: Arc::new(network.clone()), enable_http_requests: true, custom_extensions: |_| vec![], - }) + })? .run(client.clone(), task_manager.spawn_handle()) .boxed(), ); diff --git a/simnode/src/lib.rs b/simnode/src/lib.rs index 9132663..ecbc783 100644 --- a/simnode/src/lib.rs +++ b/simnode/src/lib.rs @@ -22,7 +22,7 @@ use polkadot_sdk::*; use sc_client_api::ExecutorProvider; use sp_api::ConstructRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_runtime::traits::{Block as BlockT, SignedExtension}; +use sp_runtime::traits::{Block as BlockT, TransactionExtension}; use sp_state_machine::{Ext, OverlayedChanges}; use std::sync::Arc; @@ -50,7 +50,7 @@ pub trait ChainInfo: Sized { type RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static; /// The signed extras required by the runtime - type SignedExtras: SignedExtension; + type SignedExtras: TransactionExtension<::RuntimeCall>; /// This is for cases you don't yet have the simnode runtime api implemented. /// this function is caled in an externalities provided environment, so feel free to read state.