Skip to content

Commit ab473f2

Browse files
iulianbarbugithub-actions[bot]
authored andcommitted
[create-pull-request] automated change
1 parent 4fa3120 commit ab473f2

22 files changed

+242
-19787
lines changed

Cargo.lock

Lines changed: 0 additions & 19667 deletions
This file was deleted.

Cargo.toml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,14 @@ resolver = "2"
1717
[workspace.dependencies]
1818
parachain-template-runtime = { path = "./runtime", default-features = false }
1919
pallet-parachain-template = { path = "./pallets/template", default-features = false }
20+
21+
[profile.release]
22+
opt-level = 3
23+
panic = "unwind"
24+
25+
[profile.production]
26+
codegen-units = 1
27+
inherits = "release"
28+
lto = true
29+
clap = { version = "4.5.13" }
2030
clap = { version = "4.5.13" }
21-
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
22-
color-print = { version = "0.3.4" }
23-
docify = { version = "0.2.9" }
24-
futures = { version = "0.3.31" }
25-
jsonrpsee = { version = "0.24.3" }
26-
log = { version = "0.4.22", default-features = false }
27-
polkadot-sdk = { version = "0.12.2", default-features = false }
28-
prometheus-endpoint = { version = "0.17.1", default-features = false, package = "substrate-prometheus-endpoint" }
29-
sc-tracing = { version = "38.0.0", default-features = false }
30-
serde = { version = "1.0.214", default-features = false }
31-
serde_json = { version = "1.0.132", default-features = false }
32-
cumulus-pallet-parachain-system = { version = "0.18.1", default-features = false }
33-
hex-literal = { version = "0.4.1", default-features = false }
34-
scale-info = { version = "2.11.1", default-features = false }
35-
smallvec = { version = "1.11.0", default-features = false }
36-
substrate-wasm-builder = { version = "25.0.0", default-features = false }
37-
frame = { version = "0.8.1", default-features = false, package = "polkadot-sdk-frame" }

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ WORKDIR /polkadot
44
COPY . /polkadot
55

66
RUN cargo fetch
7-
RUN cargo build --workspace --locked --release
7+
RUN cargo build --workspace --locked --profile production
88

99
FROM docker.io/parity/base-bin:latest
1010

11-
COPY --from=builder /polkadot/target/release/parachain-template-node /usr/local/bin
11+
COPY --from=builder /polkadot/target/production/parachain-template-node /usr/local/bin
1212

1313
USER root
1414
RUN useradd -m -u 1001 -U -s /bin/sh -d /polkadot polkadot && \

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
- ⏫ This template provides a starting point to build a [parachain](https://wiki.polkadot.network/docs/learn-parachains).
3737

3838
- ☁️ It is based on the
39-
[Cumulus](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/cumulus/index.html) framework.
39+
[Cumulus](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/cumulus/index.html) framework.
4040

4141
- 🔧 Its runtime is configured with a single custom pallet as a starting point, and a handful of ready-made pallets
42-
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).
42+
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).
4343

4444
- 👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains)
4545

@@ -50,18 +50,18 @@ A Polkadot SDK based project such as this one consists of:
5050
- 🧮 the [Runtime](./runtime/README.md) - the core logic of the parachain.
5151
- 🎨 the [Pallets](./pallets/README.md) - from which the runtime is constructed.
5252
- 💿 a [Node](./node/README.md) - the binary application, not part of the project default-members list and not compiled unless
53-
building the project with `--workspace` flag, which builds all workspace members, and is an alternative to
54-
[Omni Node](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html).
53+
building the project with `--workspace` flag, which builds all workspace members, and is an alternative to
54+
[Omni Node](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html).
5555

5656
## Getting Started
5757

5858
- 🦀 The template is using the Rust language.
5959

6060
- 👉 Check the
61-
[Rust installation instructions](https://www.rust-lang.org/tools/install) for your system.
61+
[Rust installation instructions](https://www.rust-lang.org/tools/install) for your system.
6262

6363
- 🛠️ Depending on your operating system and Rust version, there might be additional
64-
packages required to compile this template - please take note of the Rust compiler output.
64+
packages required to compile this template - please take note of the Rust compiler output.
6565

6666
Fetch parachain template code:
6767

@@ -73,6 +73,14 @@ cd parachain-template
7373

7474
## Starting a Development Chain
7575

76+
The parachain template relies on a hardcoded parachain id which is defined in the runtime code
77+
and referenced throughout the contents of this file as `{{PARACHAIN_ID}}`. Please replace
78+
any command or file referencing this placeholder with the value of the `PARACHAIN_ID` constant:
79+
80+
```rust,ignore
81+
pub const PARACHAIN_ID: u32 = 1000;
82+
```
83+
7684
### Omni Node Prerequisites
7785

7886
[Omni Node](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html) can
@@ -86,7 +94,7 @@ Please see the installation section at [`crates.io/omni-node`](https://crates.io
8694
#### Build `parachain-template-runtime`
8795

8896
```sh
89-
cargo build --release
97+
cargo build --profile production
9098
```
9199

92100
#### Install `staging-chain-spec-builder`
@@ -96,12 +104,12 @@ Please see the installation section at [`crates.io/staging-chain-spec-builder`](
96104
#### Use `chain-spec-builder` to generate the `chain_spec.json` file
97105

98106
```sh
99-
chain-spec-builder create --relay-chain "rococo-local" --para-id 1000 --runtime \
107+
chain-spec-builder create --relay-chain "rococo-local" --para-id {{PARACHAIN_ID}} --runtime \
100108
target/release/wbuild/parachain-template-runtime/parachain_template_runtime.wasm named-preset development
101109
```
102110

103111
**Note**: the `relay-chain` and `para-id` flags are mandatory information required by
104-
Omni Node, and for parachain template case the value for `para-id` must be set to `1000`, since this
112+
Omni Node, and for parachain template case the value for `para-id` must be set to `{{PARACHAIN_ID}}`, since this
105113
is also the value injected through [ParachainInfo](https://docs.rs/staging-parachain-info/0.17.0/staging_parachain_info/)
106114
pallet into the `parachain-template-runtime`'s storage. The `relay-chain` value is set in accordance
107115
with the relay chain ID where this instantiation of parachain-template will connect to.
@@ -138,10 +146,17 @@ export PATH="$PATH:<path/to/binaries>"
138146

139147
#### Update `zombienet-omni-node.toml` with a valid chain spec path
140148

149+
To simplify the process of using the parachain-template with zombienet and Omni Node, we've added a pre-configured
150+
development chain spec (dev_chain_spec.json) to the parachain template. The zombienet-omni-node.toml file of this
151+
template points to it, but you can update it to an updated chain spec generated on your machine. To generate a
152+
chain spec refer to [staging-chain-spec-builder](https://crates.io/crates/staging-chain-spec-builder)
153+
154+
Then make the changes in the network specification like so:
155+
141156
```toml
142157
# ...
143158
[[parachains]]
144-
id = 1000
159+
id = "<PARACHAIN_ID>"
145160
chain_spec_path = "<TO BE UPDATED WITH A VALID PATH>"
146161
# ...
147162
```
@@ -177,15 +192,15 @@ zombienet --provider native spawn zombienet.toml
177192
### Connect with the Polkadot-JS Apps Front-End
178193

179194
- 🌐 You can interact with your local node using the
180-
hosted version of the Polkadot/Substrate Portal:
181-
[relay chain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944)
182-
and [parachain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9988).
195+
hosted version of the Polkadot/Substrate Portal:
196+
[relay chain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944)
197+
and [parachain](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9988).
183198

184199
- 🪐 A hosted version is also
185-
available on [IPFS](https://dotapps.io/).
200+
available on [IPFS](https://dotapps.io/).
186201

187202
- 🧑‍🔧 You can also find the source code and instructions for hosting your own instance in the
188-
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.
203+
[`polkadot-js/apps`](https://github.com/polkadot-js/apps) repository.
189204

190205
### Takeaways
191206

@@ -211,7 +226,7 @@ Build the `parachain-template-runtime` as mentioned before in this guide and use
211226
again but this time by passing `--raw-storage` flag:
212227

213228
```sh
214-
chain-spec-builder create --raw-storage --relay-chain "rococo-local" --para-id 1000 --runtime \
229+
chain-spec-builder create --raw-storage --relay-chain "rococo-local" --para-id {{PARACHAIN_ID}} --runtime \
215230
target/release/wbuild/parachain-template-runtime/parachain_template_runtime.wasm named-preset development
216231
```
217232

@@ -234,15 +249,17 @@ relay chain network (see [Parachain Template node](#parachain-template-node) set
234249
- ➡️ Any pull requests should be directed to this [source](https://github.com/paritytech/polkadot-sdk/tree/master/templates/parachain).
235250

236251
- 😇 Please refer to the monorepo's
237-
[contribution guidelines](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
238-
[Code of Conduct](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).
252+
[contribution guidelines](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md) and
253+
[Code of Conduct](https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CODE_OF_CONDUCT.md).
239254

240255
## Getting Help
241256

242-
- 🧑‍🏫 To learn about Polkadot in general, [Polkadot.network](https://polkadot.network/) website is a good starting point.
257+
- 🧑‍🏫 To learn about Polkadot in general, [docs.Polkadot.com](https://docs.polkadot.com/) website is a good starting point.
243258

244259
- 🧑‍🔧 For technical introduction, [here](https://github.com/paritytech/polkadot-sdk#-documentation) are
245-
the Polkadot SDK documentation resources.
260+
the Polkadot SDK documentation resources.
246261

247262
- 👥 Additionally, there are [GitHub issues](https://github.com/paritytech/polkadot-sdk/issues) and
248-
[Substrate StackExchange](https://substrate.stackexchange.com/).
263+
[Substrate StackExchange](https://substrate.stackexchange.com/).
264+
- 👥You can also reach out on the [Official Polkdot discord server](https://polkadot-discord.w3f.tools/)
265+
- 🧑Reach out on [Telegram](https://t.me/substratedevs) for more questions and discussions

dev_chain_spec.json

Lines changed: 108 additions & 0 deletions
Large diffs are not rendered by default.

node/Cargo.toml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,16 @@ build = "build.rs"
1212

1313
[dependencies]
1414
clap = { features = ["derive"], workspace = true }
15-
log = { workspace = true, default-features = true }
16-
codec = { workspace = true, default-features = true }
17-
serde = { features = ["derive"], workspace = true, default-features = true }
18-
jsonrpsee = { features = ["server"], workspace = true }
19-
futures = { workspace = true }
20-
serde_json = { workspace = true, default-features = true }
21-
docify = { workspace = true }
2215
color-print = { workspace = true }
23-
polkadot-sdk = { workspace = true, features = ["node"] }
16+
docify = { workspace = true }
17+
futures = { workspace = true }
18+
jsonrpsee = { features = ["server"], workspace = true }
19+
log = { workspace = true, default-features = true }
2420
parachain-template-runtime.workspace = true
25-
sc-tracing.workspace = true
26-
sc-tracing.default-features = true
27-
prometheus-endpoint.workspace = true
21+
polkadot-sdk = { workspace = true, features = ["node"] }
2822
prometheus-endpoint.default-features = true
23+
prometheus-endpoint.workspace = true
24+
serde = { features = ["derive"], workspace = true, default-features = true }
2925

3026
[build-dependencies]
3127
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }

node/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@
1616
initial (genesis) state.
1717
- [`service.rs`](./src/service.rs): This file defines the node implementation.
1818
It's a place to configure consensus-related topics.
19-
20-
21-
## Release
22-
23-
Polkadot SDK Stable 2412

node/src/chain_spec.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use serde::{Deserialize, Serialize};
77

88
/// Specialized `ChainSpec` for the normal parachain runtime.
99
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
10+
/// The relay chain that you want to configure this parachain to connect to.
11+
pub const RELAY_CHAIN: &str = "rococo-local";
1012

1113
/// The extensions for the [`ChainSpec`].
1214
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
@@ -35,16 +37,13 @@ pub fn development_chain_spec() -> ChainSpec {
3537

3638
ChainSpec::builder(
3739
runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
38-
Extensions {
39-
relay_chain: "rococo-local".into(),
40-
// You MUST set this to the correct network!
41-
para_id: 1000,
42-
},
40+
Extensions { relay_chain: RELAY_CHAIN.into(), para_id: runtime::PARACHAIN_ID },
4341
)
4442
.with_name("Development")
4543
.with_id("dev")
4644
.with_chain_type(ChainType::Development)
4745
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
46+
.with_properties(properties)
4847
.build()
4948
}
5049

@@ -58,11 +57,7 @@ pub fn local_chain_spec() -> ChainSpec {
5857
#[allow(deprecated)]
5958
ChainSpec::builder(
6059
runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
61-
Extensions {
62-
relay_chain: "rococo-local".into(),
63-
// You MUST set this to the correct network!
64-
para_id: 1000,
65-
},
60+
Extensions { relay_chain: RELAY_CHAIN.into(), para_id: runtime::PARACHAIN_ID },
6661
)
6762
.with_name("Local Testnet")
6863
.with_id("local_testnet")

node/src/service.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ fn start_consensus(
219219
collator_service,
220220
authoring_duration: Duration::from_millis(2000),
221221
reinitialize: false,
222+
max_pov_percentage: None,
222223
};
223224
let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _>(
224225
params,
@@ -270,7 +271,7 @@ pub async fn start_parachain_node(
270271

271272
// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant`
272273
// when starting the network.
273-
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
274+
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
274275
build_network(BuildNetworkParams {
275276
parachain_config: &parachain_config,
276277
net_config,
@@ -406,7 +407,5 @@ pub async fn start_parachain_node(
406407
)?;
407408
}
408409

409-
start_network.start_network();
410-
411410
Ok((task_manager, client))
412411
}

pallets/template/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[dependencies]
1616
codec = { features = ["derive"], workspace = true }
17-
scale-info = { features = ["derive"], workspace = true }
1817
frame = { workspace = true, features = ["experimental", "runtime"], default-features = false }
18+
scale-info = { features = ["derive"], workspace = true }
1919

2020
[features]
2121
default = ["std"]

0 commit comments

Comments
 (0)