Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3cf86ef
grandpa: update notif protocol name
acatangiu Dec 9, 2021
fbf7cf5
grandpa: add chain id prefix to protocol name
acatangiu Dec 10, 2021
2b22762
grandpa: beautify protocol name handling
acatangiu Dec 10, 2021
206beaa
grandpa: prepend genesis hash to protocol name
acatangiu Dec 10, 2021
952e0a7
chain-spec: add optional 'fork_id'
acatangiu Dec 13, 2021
758ff84
grandpa: protocol_name mod instead of struct
acatangiu Dec 13, 2021
b3a0243
beefy: add genesis hash prefix to protocol name
acatangiu Dec 13, 2021
44baf42
chainspec: add fork_id
acatangiu Dec 14, 2021
0f9d6cc
grandpa: simplify protocol name
acatangiu Dec 14, 2021
393c8cf
Merge branch 'master' of github.com:paritytech/substrate into grandpa…
acatangiu Dec 14, 2021
482f0bc
grandpa: contain protocol name building logic
acatangiu Dec 16, 2021
1dda847
beefy: contain protocol name building logic
acatangiu Dec 16, 2021
1262cce
grandpa: fix tests
acatangiu Dec 16, 2021
f3a006d
Merge branch 'master' of github.com:paritytech/substrate into grandpa…
acatangiu Dec 16, 2021
b4b8a74
fix merge damage
acatangiu Dec 16, 2021
0de4362
fix docs reference visibility
acatangiu Dec 20, 2021
a07eec6
Update client/finality-grandpa/src/lib.rs
acatangiu Dec 20, 2021
1aa9753
Update client/finality-grandpa/src/communication/mod.rs
acatangiu Dec 20, 2021
5673f48
Update client/beefy/src/lib.rs
acatangiu Dec 20, 2021
5a6a7b2
Update client/beefy/src/lib.rs
acatangiu Dec 20, 2021
d70ed35
avoid using hash default, even for protocol names
acatangiu Jan 4, 2022
d5802f6
Merge branch 'master' of github.com:paritytech/substrate into grandpa…
acatangiu Jan 4, 2022
3c7f699
Merge branch 'master' of github.com:paritytech/substrate into grandpa…
acatangiu Jan 5, 2022
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
Prev Previous commit
Next Next commit
chainspec: add fork_id
  • Loading branch information
acatangiu committed Dec 14, 2021
commit 44baf42c33440c2778df0dff36d0f1c8ca3f8ea0
2 changes: 2 additions & 0 deletions bin/node-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
None,
// Protocol ID
None,
None,
// Properties
None,
// Extensions
Expand Down Expand Up @@ -117,6 +118,7 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
None,
// Properties
None,
None,
// Extensions
None,
))
Expand Down
5 changes: 5 additions & 0 deletions bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ pub fn staging_testnet_config() -> ChainSpec {
),
None,
None,
None,
Default::default(),
)
}
Expand Down Expand Up @@ -386,6 +387,7 @@ pub fn development_config() -> ChainSpec {
None,
None,
None,
None,
Default::default(),
)
}
Expand All @@ -410,6 +412,7 @@ pub fn local_testnet_config() -> ChainSpec {
None,
None,
None,
None,
Default::default(),
)
}
Expand Down Expand Up @@ -441,6 +444,7 @@ pub(crate) mod tests {
None,
None,
None,
None,
Default::default(),
)
}
Expand All @@ -456,6 +460,7 @@ pub(crate) mod tests {
None,
None,
None,
None,
Default::default(),
)
}
Expand Down
1 change: 1 addition & 0 deletions bin/utils/chain-spec-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ fn generate_chain_spec(
None,
None,
None,
None,
Default::default(),
);

Expand Down
12 changes: 12 additions & 0 deletions client/chain-spec/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ struct ClientSpec<E> {
boot_nodes: Vec<MultiaddrWithPeerId>,
telemetry_endpoints: Option<TelemetryEndpoints>,
protocol_id: Option<String>,
fork_id: Option<String>,
properties: Option<Properties>,
#[serde(flatten)]
extensions: E,
Expand Down Expand Up @@ -226,6 +227,11 @@ impl<G, E> ChainSpec<G, E> {
self.client_spec.protocol_id.as_ref().map(String::as_str)
}

/// Optional network fork identifier.
pub fn fork_id(&self) -> Option<&str> {
self.client_spec.fork_id.as_ref().map(String::as_str)
}

/// Additional loosly-typed properties of the chain.
///
/// Returns an empty JSON object if 'properties' not defined in config
Expand Down Expand Up @@ -257,6 +263,7 @@ impl<G, E> ChainSpec<G, E> {
boot_nodes: Vec<MultiaddrWithPeerId>,
telemetry_endpoints: Option<TelemetryEndpoints>,
protocol_id: Option<&str>,
fork_id: Option<&str>,
properties: Option<Properties>,
extensions: E,
) -> Self {
Expand All @@ -267,6 +274,7 @@ impl<G, E> ChainSpec<G, E> {
boot_nodes,
telemetry_endpoints,
protocol_id: protocol_id.map(str::to_owned),
fork_id: fork_id.map(str::to_owned),
properties,
extensions,
consensus_engine: (),
Expand Down Expand Up @@ -384,6 +392,10 @@ where
ChainSpec::protocol_id(self)
}

fn fork_id(&self) -> Option<&str> {
ChainSpec::fork_id(self)
}

fn properties(&self) -> Properties {
ChainSpec::properties(self)
}
Expand Down
4 changes: 1 addition & 3 deletions client/chain-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ pub trait ChainSpec: BuildStorage + Send + Sync {
/// Network protocol id.
fn protocol_id(&self) -> Option<&str>;
/// Optional network fork identifier. `None` by default.
fn fork_id(&self) -> Option<&str> {
None
}
fn fork_id(&self) -> Option<&str>;
/// Additional loosly-typed properties of the chain.
///
/// Returns an empty JSON object if 'properties' not defined in config
Expand Down
1 change: 1 addition & 0 deletions client/cli/src/commands/insert_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ mod tests {
None,
None,
None,
None,
NoExtension::None,
)))
}
Expand Down