mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 22:01:04 +00:00
Name changes for GrandPa and Beefy notifications protocols (#10463)
* grandpa: update notif protocol name * grandpa: add chain id prefix to protocol name * grandpa: beautify protocol name handling * grandpa: prepend genesis hash to protocol name * 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. * grandpa: protocol_name mod instead of struct * beefy: add genesis hash prefix to protocol name * chainspec: add fork_id * grandpa: simplify protocol name * grandpa: contain protocol name building logic * beefy: contain protocol name building logic * grandpa: fix tests * fix merge damage * fix docs reference visibility Signed-off-by: acatangiu <adrian@parity.io> * Update client/finality-grandpa/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update client/finality-grandpa/src/communication/mod.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update client/beefy/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Update client/beefy/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * avoid using hash default, even for protocol names Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
@@ -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,
|
||||
@@ -226,6 +227,11 @@ impl<G, E> ChainSpec<G, E> {
|
||||
self.client_spec.protocol_id.as_deref()
|
||||
}
|
||||
|
||||
/// 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
|
||||
@@ -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 {
|
||||
@@ -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: (),
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -165,6 +165,8 @@ 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>;
|
||||
/// Additional loosly-typed properties of the chain.
|
||||
///
|
||||
/// Returns an empty JSON object if 'properties' not defined in config
|
||||
|
||||
Reference in New Issue
Block a user