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
chain-spec: add optional 'fork_id'
'fork_id' is used to uniquely identify forks of the same chain/network
'ChainSpec' trait provides default 'None' implementation, meaning this
chain hasn't been forked.
  • Loading branch information
acatangiu committed Dec 13, 2021
commit 952e0a7f7e246f77ec1d74addc9617d2f38bd102
5 changes: 4 additions & 1 deletion bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
other: (block_import, grandpa_link, mut telemetry),
} = new_partial(&config)?;
let genesis_hash = client.block_hash(0).ok().flatten().unwrap_or_default();
let chain_prefix = format!("/{}/{}", config.protocol_id().as_ref(), genesis_hash);
let chain_prefix = match config.chain_spec.fork_id() {
Some(fork_id) => format!("/{}/{}", genesis_hash, fork_id),
None => format!("/{}", genesis_hash),
};

if let Some(url) = &config.keystore_remote {
match remote_keystore(url) {
Expand Down
5 changes: 4 additions & 1 deletion bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ pub fn new_full_base(
let shared_voter_state = rpc_setup;
let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht;
let genesis_hash = client.block_hash(0).ok().flatten().unwrap_or_default();
let chain_prefix = format!("/{}/{}", config.protocol_id().as_ref(), genesis_hash);
let chain_prefix = match config.chain_spec.fork_id() {
Some(fork_id) => format!("/{}/{}", genesis_hash, fork_id),
None => format!("/{}", genesis_hash),
};

config.network.extra_sets.push(grandpa::grandpa_peers_set_config(&chain_prefix));
let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new(
Expand Down
4 changes: 4 additions & 0 deletions client/chain-spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ pub trait ChainSpec: BuildStorage + Send + Sync {
fn telemetry_endpoints(&self) -> &Option<TelemetryEndpoints>;
/// Network protocol id.
fn protocol_id(&self) -> Option<&str>;
/// Optional network fork identifier. `None` by default.
fn fork_id(&self) -> Option<&str> {
None
}
/// Additional loosly-typed properties of the chain.
///
/// Returns an empty JSON object if 'properties' not defined in config
Expand Down