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

[Don't merge] Update the solochain template to ib-make-node-compilation-optional #17

Closed
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
10,706 changes: 0 additions & 10,706 deletions Cargo.lock

This file was deleted.

91 changes: 36 additions & 55 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repository = "https://github.com/paritytech/polkadot-sdk-solochain-template.git"
edition = "2021"

[workspace]
# add to the build command to build all members
members = [
"node",
"pallets/template",
Expand All @@ -16,59 +17,39 @@ 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.1.0", default-features = false }
clap = { version = "4.5.13" }
frame-benchmarking-cli = { path = "substrate/utils/frame/benchmarking-cli", default-features = false }
frame-metadata-hash-extension = { path = "substrate/frame/metadata-hash-extension", default-features = false }
frame-system = { path = "substrate/frame/system", 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 }
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.1", 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-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.121", 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.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-timestamp = { version = "34.0.0", default-features = false }
substrate-frame-rpc-system = { version = "38.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-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.1", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { version = "37.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-offchain = { version = "34.0.0", default-features = false }
sp-session = { version = "35.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 }
jsonrpsee = { version = "0.24.3" }
pallet-transaction-payment = { path = "substrate/frame/transaction-payment", default-features = false }
pallet-transaction-payment-rpc = { path = "substrate/frame/transaction-payment/rpc", default-features = false }
sc-basic-authorship = { path = "substrate/client/basic-authorship", default-features = false }
sc-cli = { path = "substrate/client/cli", default-features = false }
sc-client-api = { path = "substrate/client/api", default-features = false }
sc-consensus = { path = "substrate/client/consensus/common", default-features = false }
sc-consensus-aura = { path = "substrate/client/consensus/aura", default-features = false }
sc-consensus-grandpa = { path = "substrate/client/consensus/grandpa", default-features = false }
sc-executor = { path = "substrate/client/executor", default-features = false }
sc-network = { path = "substrate/client/network", default-features = false }
sc-offchain = { path = "substrate/client/offchain", default-features = false }
sc-service = { path = "substrate/client/service", default-features = false }
sc-telemetry = { path = "substrate/client/telemetry", default-features = false }
sc-transaction-pool = { path = "substrate/client/transaction-pool", default-features = false }
sc-transaction-pool-api = { path = "substrate/client/transaction-pool/api", default-features = false }
serde_json = { version = "1.0.132", default-features = false }
sp-api = { path = "substrate/primitives/api", default-features = false }
sp-block-builder = { path = "substrate/primitives/block-builder", default-features = false }
sp-blockchain = { path = "substrate/primitives/blockchain", default-features = false }
sp-consensus-aura = { path = "substrate/primitives/consensus/aura", default-features = false }
sp-consensus-grandpa = { path = "substrate/primitives/consensus/grandpa", default-features = false }
sp-core = { path = "substrate/primitives/core", default-features = false }
sp-genesis-builder = { path = "substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "substrate/primitives/inherents", default-features = false }
sp-io = { path = "substrate/primitives/io", default-features = false }
sp-keyring = { path = "substrate/primitives/keyring", default-features = false }
sp-runtime = { path = "substrate/primitives/runtime", default-features = false }
sp-timestamp = { path = "substrate/primitives/timestamp", default-features = false }
substrate-frame-rpc-system = { path = "substrate/utils/frame/rpc/system", default-features = false }
substrate-build-script-utils = { path = "substrate/utils/build-script-utils", default-features = false }
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ packages required to compile this template. Check the
the most common dependencies. Alternatively, you can use one of the [alternative
installation](#alternatives-installations) options.

Fetch solochain template code:

```sh
git clone https://github.com/paritytech/polkadot-sdk-solochain-template.git solochain-template

cd solochain-template
```

### Build

Use the following command to build the node without launching it:
🔨 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 Expand Up @@ -177,7 +185,7 @@ template and note the following:
configuration is defined by a code block that begins with `impl
$PALLET_NAME::Config for Runtime`.
- The pallets are composed into a single runtime by way of the
[`construct_runtime!`](https://paritytech.github.io/substrate/master/frame_support/macro.construct_runtime.html)
[#[runtime]](https://paritytech.github.io/polkadot-sdk/master/frame_support/attr.runtime.html)
macro, which is part of the [core FRAME pallet
library](https://docs.substrate.io/reference/frame-pallets/#system-pallets).

Expand Down
113 changes: 48 additions & 65 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "solochain-template-node"
description = "A solochain node template built with Substrate, part of Polkadot Sdk. (polkadot v1.15.0)"
version = "0.1.0"
description = "A solochain node template built with Substrate, part of Polkadot Sdk."
version = "0.0.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
Expand All @@ -19,77 +19,60 @@ clap = { features = ["derive"], workspace = true }
futures = { features = ["thread-pool"], workspace = true }
serde_json = { workspace = true, default-features = true }
jsonrpsee = { features = ["server"], workspace = true }
sc-cli.workspace = true
sc-cli.default-features = true
sp-core.workspace = true
sp-core.default-features = true
sc-executor.workspace = true
sc-executor.default-features = true
sc-network.workspace = true
sc-network.default-features = true
sc-service.workspace = true
sc-service.default-features = true
sc-telemetry.workspace = true
sc-telemetry.default-features = true
sc-transaction-pool.workspace = true
sc-transaction-pool.default-features = true
sc-transaction-pool-api.workspace = true
sc-transaction-pool-api.default-features = true
sc-offchain.workspace = true
sc-offchain.default-features = true
sc-consensus-aura.workspace = true
sc-consensus-aura.default-features = true
sp-consensus-aura.workspace = true
sp-consensus-aura.default-features = true
sc-consensus.workspace = true
sc-consensus.default-features = true
sc-consensus-grandpa.workspace = true
sc-consensus-grandpa.default-features = true
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
sp-runtime.default-features = true
sp-io.workspace = true
sp-io.default-features = true
sp-timestamp.workspace = true
sp-timestamp.default-features = true
sp-inherents.workspace = true
sp-inherents.default-features = true
sp-keyring.workspace = true
sp-keyring.default-features = true
sp-api.workspace = true
sp-api.default-features = true
sp-blockchain.workspace = true
sp-blockchain.default-features = true
sp-block-builder.workspace = true
sp-block-builder.default-features = true
frame-system.workspace = true
frame-system.default-features = true
pallet-transaction-payment.workspace = true
pallet-transaction-payment-rpc.workspace = true
pallet-transaction-payment-rpc.default-features = true
substrate-frame-rpc-system.workspace = true
substrate-frame-rpc-system.default-features = true
frame-benchmarking-cli.workspace = true
frame-benchmarking-cli.default-features = true
solochain-template-runtime.workspace = true

# substrate client
sc-cli = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
sc-executor = { workspace = true, default-features = true }
sc-network = { workspace = true, default-features = true }
sc-service = { workspace = true, default-features = true }
sc-telemetry = { workspace = true, default-features = true }
sc-transaction-pool = { workspace = true, default-features = true }
sc-transaction-pool-api = { workspace = true, default-features = true }
sc-offchain = { workspace = true, default-features = true }
sc-consensus-aura = { workspace = true, default-features = true }
sp-consensus-aura = { workspace = true, default-features = true }
sc-consensus = { workspace = true, default-features = true }
sc-consensus-grandpa = { workspace = true, default-features = true }
sp-consensus-grandpa = { workspace = true, default-features = true }
sp-genesis-builder = { workspace = true, default-features = true }
sc-client-api = { workspace = true, default-features = true }
sc-basic-authorship = { workspace = true, default-features = true }

# substrate primitives
sp-runtime = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
sp-timestamp = { workspace = true, default-features = true }
sp-inherents = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
sp-api = { workspace = true, default-features = true }
sp-blockchain = { workspace = true, default-features = true }
sp-block-builder = { workspace = true, default-features = true }

# frame and pallets
frame-system = { workspace = true, default-features = true }
frame-metadata-hash-extension = { workspace = true, default-features = true }
pallet-transaction-payment = { workspace = true, default-features = true }
pallet-transaction-payment-rpc = { workspace = true, default-features = true }
substrate-frame-rpc-system = { workspace = true, default-features = true }

# These dependencies are used for runtime benchmarking
frame-benchmarking-cli = { workspace = true, default-features = true }

# Local Dependencies
solochain-template-runtime = { workspace = true }

[build-dependencies]
substrate-build-script-utils.workspace = true
substrate-build-script-utils.default-features = true
substrate-build-script-utils = { workspace = true, default-features = true }

[features]
default = []
default = ["std"]
std = ["solochain-template-runtime/std"]
# Dependencies that are only required if runtime benchmarking should be build.
runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"solochain-template-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
Expand Down
10 changes: 6 additions & 4 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ 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;
let extra: runtime::SignedExtra = (
let tx_ext: runtime::TxExtension = (
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
Expand All @@ -121,11 +121,12 @@ 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(
call.clone(),
extra.clone(),
tx_ext.clone(),
(
(),
runtime::VERSION.spec_version,
Expand All @@ -135,6 +136,7 @@ pub fn create_benchmark_extrinsic(
(),
(),
(),
None,
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
Expand All @@ -143,7 +145,7 @@ pub fn create_benchmark_extrinsic(
call,
sp_runtime::AccountId32::from(sender.public()).into(),
runtime::Signature::Sr25519(signature),
extra,
tx_ext,
)
}

Expand Down
Loading
Loading