Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions examples/aura/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -81,5 +80,4 @@ runtime-benchmarks = [
try-runtime = [
"aura-runtime/try-runtime",
"polkadot-sdk/try-runtime",
"try-runtime-cli/try-runtime"
]
4 changes: 0 additions & 4 deletions examples/aura/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 2 additions & 27 deletions examples/aura/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::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`."
Expand Down
19 changes: 11 additions & 8 deletions examples/aura/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn new_partial<E>(
FullBackend,
FullSelectChain,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient<E>>,
sc_transaction_pool::TransactionPoolHandle<Block, FullClient<E>>,
(
sc_consensus_grandpa::GrandpaBlockImport<
FullBackend,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -202,7 +205,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
network_provider: Arc::new(network.clone()),
enable_http_requests: true,
custom_extensions: |_| vec![],
})
})?
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
Expand Down
10 changes: 6 additions & 4 deletions examples/aura/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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`,
Expand All @@ -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.
Expand Down Expand Up @@ -249,6 +249,7 @@ impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type MaxReserves = ();
type MaxFreezes = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand All @@ -262,6 +263,7 @@ impl pallet_transaction_payment::Config for Runtime {
type LengthToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Runtime>;
}

impl pallet_sudo::Config for Runtime {
Expand Down
4 changes: 1 addition & 3 deletions examples/babe/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -119,12 +118,11 @@ cli = [
"polkadot-sdk/frame-benchmarking-cli",
"sc-service/rocksdb",
"clap",
"try-runtime-cli",
]
runtime-benchmarks = [
"polkadot-sdk/runtime-benchmarks",
"babe-runtime/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"]
4 changes: 0 additions & 4 deletions examples/babe/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
31 changes: 3 additions & 28 deletions examples/babe/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(info_provider)),
task_manager,
))
})
},
Some(Subcommand::Simnode(cmd)) => {
let runner = cli.create_runner(&cmd.run.normalize())?;
let config = runner.config();
Expand Down
21 changes: 12 additions & 9 deletions examples/babe/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
}

/// The transaction pool type defintion.
pub type TransactionPool = sc_transaction_pool::FullPool<Block, FullClient>;
pub type TransactionPool = sc_transaction_pool::TransactionPoolHandle<Block, FullClient>;

/// Fetch the nonce of the given `account` from the chain state.
///
Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn new_partial<E>(
FullBackend,
FullSelectChain,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient<E>>,
sc_transaction_pool::TransactionPoolHandle<Block, FullClient<E>>,
(
impl Fn(
sc_rpc::SubscriptionTaskExecutor,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(),
);
Expand Down
Loading
Loading