Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the solochain template to stable2409 #14

Merged
merged 1 commit into from
Nov 6, 2024
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,605 changes: 916 additions & 689 deletions Cargo.lock

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,59 @@ resolver = "2"
[workspace.dependencies]
solochain-template-runtime = { path = "./runtime", default-features = false }
pallet-template = { path = "./pallets/template", default-features = false }
clap = { version = "4.5.3" }
frame-benchmarking-cli = { version = "42.0.0", default-features = false }
frame-system = { version = "37.0.0", default-features = false }
clap = { version = "4.5.10" }
frame-benchmarking-cli = { version = "43.0.0", default-features = false }
frame-metadata-hash-extension = { version = "0.6.0", default-features = false }
frame-system = { version = "38.0.0", default-features = false }
futures = { version = "0.3.30" }
jsonrpsee = { version = "0.23.2" }
pallet-transaction-payment = { version = "37.0.0", default-features = false }
pallet-transaction-payment-rpc = { version = "40.0.0", default-features = false }
sc-basic-authorship = { version = "0.44.0", default-features = false }
sc-cli = { version = "0.46.0", default-features = false }
jsonrpsee = { version = "0.24.3" }
pallet-transaction-payment = { version = "38.0.0", default-features = false }
pallet-transaction-payment-rpc = { version = "41.0.0", default-features = false }
sc-basic-authorship = { version = "0.45.0", default-features = false }
sc-cli = { version = "0.47.0", default-features = false }
sc-client-api = { version = "37.0.0", default-features = false }
sc-consensus = { version = "0.43.0", default-features = false }
sc-consensus-aura = { version = "0.44.0", default-features = false }
sc-consensus-grandpa = { version = "0.29.0", default-features = false }
sc-executor = { version = "0.40.0", default-features = false }
sc-network = { version = "0.44.0", default-features = false }
sc-offchain = { version = "39.0.0", default-features = false }
sc-rpc-api = { version = "0.43.0", default-features = false }
sc-service = { version = "0.45.0", default-features = false }
sc-telemetry = { version = "24.0.0", default-features = false }
sc-consensus = { version = "0.44.0", default-features = false }
sc-consensus-aura = { version = "0.45.0", default-features = false }
sc-consensus-grandpa = { version = "0.30.0", default-features = false }
sc-executor = { version = "0.40.1", default-features = false }
sc-network = { version = "0.45.0", default-features = false }
sc-offchain = { version = "40.0.0", default-features = false }
sc-service = { version = "0.46.0", default-features = false }
sc-telemetry = { version = "25.0.0", default-features = false }
sc-transaction-pool = { version = "37.0.0", default-features = false }
sc-transaction-pool-api = { version = "37.0.0", default-features = false }
serde_json = { version = "1.0.114", default-features = false }
serde_json = { version = "1.0.127", default-features = false }
sp-api = { version = "34.0.0", default-features = false }
sp-block-builder = { version = "34.0.0", default-features = false }
sp-blockchain = { version = "37.0.0", default-features = false }
sp-blockchain = { version = "37.0.1", default-features = false }
sp-consensus-aura = { version = "0.40.0", default-features = false }
sp-consensus-grandpa = { version = "21.0.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-inherents = { version = "34.0.0", default-features = false }
sp-io = { version = "38.0.0", default-features = false }
sp-keyring = { version = "39.0.0", default-features = false }
sp-runtime = { version = "39.0.0", default-features = false }
sp-runtime = { version = "39.0.1", default-features = false }
sp-timestamp = { version = "34.0.0", default-features = false }
substrate-frame-rpc-system = { version = "38.0.0", default-features = false }
substrate-frame-rpc-system = { version = "39.0.0", default-features = false }
substrate-build-script-utils = { version = "11.0.0", default-features = false }
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
frame-benchmarking = { version = "37.0.0", default-features = false }
frame-executive = { version = "37.0.0", default-features = false }
frame-support = { version = "37.0.0", default-features = false }
frame-system-benchmarking = { version = "37.0.0", default-features = false }
frame-benchmarking = { version = "38.0.0", default-features = false }
frame-executive = { version = "38.0.0", default-features = false }
frame-support = { version = "38.0.0", default-features = false }
frame-system-benchmarking = { version = "38.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "34.0.0", default-features = false }
frame-try-runtime = { version = "0.43.0", default-features = false }
pallet-aura = { version = "36.0.0", default-features = false }
pallet-balances = { version = "38.0.0", default-features = false }
pallet-grandpa = { version = "37.0.0", default-features = false }
pallet-sudo = { version = "37.0.0", default-features = false }
pallet-timestamp = { version = "36.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "37.0.0", default-features = false }
frame-try-runtime = { version = "0.44.0", default-features = false }
pallet-aura = { version = "37.0.0", default-features = false }
pallet-balances = { version = "39.0.0", default-features = false }
pallet-grandpa = { version = "38.0.0", default-features = false }
pallet-sudo = { version = "38.0.0", default-features = false }
pallet-timestamp = { version = "37.0.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "38.0.0", default-features = false }
scale-info = { version = "2.11.1", default-features = false }
sp-genesis-builder = { version = "0.15.0", default-features = false }
sp-genesis-builder = { version = "0.15.1", default-features = false }
sp-offchain = { version = "34.0.0", default-features = false }
sp-session = { version = "35.0.0", default-features = false }
sp-session = { version = "36.0.0", default-features = false }
sp-storage = { version = "21.0.0", default-features = false }
sp-transaction-pool = { version = "34.0.0", default-features = false }
sp-version = { version = "37.0.0", default-features = false }
substrate-wasm-builder = { version = "24.0.0", default-features = false }
substrate-wasm-builder = { version = "24.0.1", default-features = false }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ installation](#alternatives-installations) options.
Use the following command to build the node without launching it:

```sh
cargo build --package solochain-template-node --release
cargo build --release
```

### Embedded Docs
Expand Down
7 changes: 4 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solochain-template-node"
description = "A solochain node template built with Substrate, part of Polkadot Sdk. (polkadot v1.15.0)"
description = "A solochain node template built with Substrate, part of Polkadot Sdk."
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
Expand Down Expand Up @@ -49,8 +49,6 @@ sp-consensus-grandpa.workspace = true
sp-consensus-grandpa.default-features = true
sc-client-api.workspace = true
sc-client-api.default-features = true
sc-rpc-api.workspace = true
sc-rpc-api.default-features = true
sc-basic-authorship.workspace = true
sc-basic-authorship.default-features = true
sp-runtime.workspace = true
Expand All @@ -71,7 +69,10 @@ sp-block-builder.workspace = true
sp-block-builder.default-features = true
frame-system.workspace = true
frame-system.default-features = true
frame-metadata-hash-extension.workspace = true
frame-metadata-hash-extension.default-features = true
pallet-transaction-payment.workspace = true
pallet-transaction-payment.default-features = true
pallet-transaction-payment-rpc.workspace = true
pallet-transaction-payment-rpc.default-features = true
substrate-frame-rpc-system.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


## Release

Polkadot SDK stable2409
4 changes: 3 additions & 1 deletion node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn create_benchmark_extrinsic(
let best_hash = client.chain_info().best_hash;
let best_block = client.chain_info().best_number;

let period = runtime::BlockHashCount::get()
let period = runtime::configs::BlockHashCount::get()
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
Expand All @@ -121,6 +121,7 @@ pub fn create_benchmark_extrinsic(
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
frame_metadata_hash_extension::CheckMetadataHash::<runtime::Runtime>::new(false),
);

let raw_payload = runtime::SignedPayload::from_raw(
Expand All @@ -135,6 +136,7 @@ pub fn create_benchmark_extrinsic(
(),
(),
(),
None,
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
Expand Down
8 changes: 2 additions & 6 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};

pub use sc_rpc_api::DenyUnsafe;

/// Full client dependencies.
pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}

/// Instantiate all full RPC extensions.
Expand All @@ -43,9 +39,9 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcModule::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
let FullDeps { client, pool } = deps;

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;

// Extend this RPC with a custom API by using the following syntax.
Expand Down
17 changes: 8 additions & 9 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use futures::FutureExt;
use sc_client_api::{Backend, BlockBackend};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use solochain_template_runtime::{self, opaque::Block, RuntimeApi};
use solochain_template_runtime::{self, apis::RuntimeApi, opaque::Block};
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};

Expand Down Expand Up @@ -48,7 +48,7 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
})
.transpose()?;

let executor = sc_service::new_wasm_executor::<sp_io::SubstrateHostFunctions>(config);
let executor = sc_service::new_wasm_executor::<sp_io::SubstrateHostFunctions>(&config.executor);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down Expand Up @@ -144,7 +144,7 @@ pub fn new_full<
Block,
<Block as sp_runtime::traits::Block>::Hash,
N,
>::new(&config.network);
>::new(&config.network, config.prometheus_registry().cloned());
let metrics = N::register_notification_metrics(config.prometheus_registry());

let peer_store_handle = net_config.peer_store_handle();
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn new_full<
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
warp_sync_config: Some(WarpSyncConfig::WithProvider(warp_sync)),
block_relay: None,
metrics,
})?;
Expand All @@ -201,7 +201,7 @@ pub fn new_full<
);
}

let role = config.role.clone();
let role = config.role;
let force_authoring = config.force_authoring;
let backoff_authoring_blocks: Option<()> = None;
let name = config.network.node_name.clone();
Expand All @@ -212,9 +212,8 @@ pub fn new_full<
let client = client.clone();
let pool = transaction_pool.clone();

Box::new(move |deny_unsafe, _| {
let deps =
crate::rpc::FullDeps { client: client.clone(), pool: pool.clone(), deny_unsafe };
Box::new(move |_| {
let deps = crate::rpc::FullDeps { client: client.clone(), pool: pool.clone() };
crate::rpc::create_full(deps).map_err(Into::into)
})
};
Expand Down
2 changes: 1 addition & 1 deletion pallets/template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-template"
description = "FRAME pallet template for defining custom runtime logic. (polkadot v1.15.0)"
description = "FRAME pallet template for defining custom runtime logic."
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions pallets/template/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
License: MIT-0


## Release

Polkadot SDK stable2409
17 changes: 16 additions & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solochain-template-runtime"
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk. (polkadot v1.15.0)"
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk."
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
Expand All @@ -24,6 +24,7 @@ frame-support = { features = ["experimental"], workspace = true }
frame-system.workspace = true
frame-try-runtime = { optional = true, workspace = true }
frame-executive.workspace = true
frame-metadata-hash-extension.workspace = true
pallet-aura.workspace = true
pallet-balances.workspace = true
pallet-grandpa.workspace = true
Expand Down Expand Up @@ -59,6 +60,7 @@ std = [
"scale-info/std",

"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
Expand Down Expand Up @@ -120,3 +122,16 @@ try-runtime = [
"pallet-transaction-payment/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", "sp-api/disable-logging"]
5 changes: 5 additions & 0 deletions runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


## Release

Polkadot SDK stable2409
18 changes: 14 additions & 4 deletions runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
substrate_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("UNIT", 12)
.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"))]
fn main() {}
Loading
Loading