mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 22:41:02 +00:00
Add the ability to change the informant's prefix (#1221)
* Initial commit
Forked at: 261d701c5b
Parent branch: origin/master
* Add the ability to change the informant's prefix
* Update Cargo.lock
* Update Cargo.lock
* fixed tests
* Rename prefix to informant prefix
This commit is contained in:
@@ -124,7 +124,8 @@ pub fn run() -> Result<()> {
|
||||
None,
|
||||
authority_discovery_enabled,
|
||||
6000,
|
||||
grandpa_pause
|
||||
grandpa_pause,
|
||||
None,
|
||||
).map(|(s, _, _)| s)
|
||||
},
|
||||
service::KusamaExecutor::native_version().runtime_version
|
||||
@@ -141,7 +142,8 @@ pub fn run() -> Result<()> {
|
||||
None,
|
||||
authority_discovery_enabled,
|
||||
6000,
|
||||
grandpa_pause
|
||||
grandpa_pause,
|
||||
None,
|
||||
).map(|(s, _, _)| s)
|
||||
},
|
||||
service::WestendExecutor::native_version().runtime_version
|
||||
@@ -158,7 +160,8 @@ pub fn run() -> Result<()> {
|
||||
None,
|
||||
authority_discovery_enabled,
|
||||
6000,
|
||||
grandpa_pause
|
||||
grandpa_pause,
|
||||
None,
|
||||
).map(|(s, _, _)| s)
|
||||
},
|
||||
service::PolkadotExecutor::native_version().runtime_version
|
||||
|
||||
@@ -333,6 +333,7 @@ pub async fn start_collator<P>(
|
||||
para_id: ParaId,
|
||||
key: Arc<CollatorPair>,
|
||||
config: Configuration,
|
||||
informant_prefix: Option<String>,
|
||||
) -> Result<(), polkadot_service::Error>
|
||||
where
|
||||
P: 'static + BuildParachainContext,
|
||||
@@ -351,7 +352,8 @@ where
|
||||
None,
|
||||
false,
|
||||
6000,
|
||||
None
|
||||
None,
|
||||
informant_prefix,
|
||||
)?;
|
||||
let spawn_handle = service.spawn_task_handle();
|
||||
build_collator_service(
|
||||
@@ -371,7 +373,8 @@ where
|
||||
None,
|
||||
false,
|
||||
6000,
|
||||
None
|
||||
None,
|
||||
informant_prefix,
|
||||
)?;
|
||||
let spawn_handle = service.spawn_task_handle();
|
||||
build_collator_service(
|
||||
@@ -450,6 +453,7 @@ mod tests {
|
||||
0.into(),
|
||||
Arc::new(CollatorPair::generate().0),
|
||||
config,
|
||||
None,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
id,
|
||||
key,
|
||||
config,
|
||||
None,
|
||||
).map_err(|e| e.into())
|
||||
})?;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceErro
|
||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||
/// be able to perform chain operations.
|
||||
macro_rules! new_full_start {
|
||||
($config:expr, $runtime:ty, $executor:ty) => {{
|
||||
($config:expr, $runtime:ty, $executor:ty, $informant_prefix:expr $(,)?) => {{
|
||||
set_prometheus_registry(&mut $config)?;
|
||||
|
||||
let mut import_setup = None;
|
||||
@@ -158,6 +158,7 @@ macro_rules! new_full_start {
|
||||
let builder = service::ServiceBuilder::new_full::<
|
||||
Block, $runtime, $executor
|
||||
>($config)?
|
||||
.with_informant_prefix($informant_prefix.unwrap_or_default())?
|
||||
.with_select_chain(|_, backend| {
|
||||
Ok(sc_consensus::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
@@ -274,7 +275,8 @@ macro_rules! new_full {
|
||||
$slot_duration:expr,
|
||||
$grandpa_pause:expr,
|
||||
$runtime:ty,
|
||||
$dispatch:ty
|
||||
$dispatch:ty,
|
||||
$informant_prefix:expr $(,)?
|
||||
) => {{
|
||||
use sc_network::Event;
|
||||
use sc_client_api::ExecutorProvider;
|
||||
@@ -296,7 +298,7 @@ macro_rules! new_full {
|
||||
let slot_duration = $slot_duration;
|
||||
|
||||
let (builder, mut import_setup, inherent_data_providers, mut rpc_setup) =
|
||||
new_full_start!($config, $runtime, $dispatch);
|
||||
new_full_start!($config, $runtime, $dispatch, $informant_prefix);
|
||||
|
||||
let service = builder
|
||||
.with_finality_proof_provider(|client, backend| {
|
||||
@@ -647,7 +649,7 @@ where
|
||||
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
|
||||
{
|
||||
config.keystore = service::config::KeystoreConfig::InMemory;
|
||||
Ok(new_full_start!(config, Runtime, Dispatch).0)
|
||||
Ok(new_full_start!(config, Runtime, Dispatch, None).0)
|
||||
}
|
||||
|
||||
/// Create a new Polkadot service for a full node.
|
||||
@@ -659,6 +661,7 @@ pub fn polkadot_new_full(
|
||||
authority_discovery_enabled: bool,
|
||||
slot_duration: u64,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
informant_prefix: Option<String>,
|
||||
)
|
||||
-> Result<(
|
||||
impl AbstractService,
|
||||
@@ -678,7 +681,8 @@ pub fn polkadot_new_full(
|
||||
slot_duration,
|
||||
grandpa_pause,
|
||||
polkadot_runtime::RuntimeApi,
|
||||
PolkadotExecutor
|
||||
PolkadotExecutor,
|
||||
informant_prefix,
|
||||
);
|
||||
|
||||
Ok((service, client, handles))
|
||||
@@ -693,6 +697,7 @@ pub fn kusama_new_full(
|
||||
authority_discovery_enabled: bool,
|
||||
slot_duration: u64,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
informant_prefix: Option<String>,
|
||||
) -> Result<(
|
||||
impl AbstractService,
|
||||
Arc<impl PolkadotClient<
|
||||
@@ -712,7 +717,8 @@ pub fn kusama_new_full(
|
||||
slot_duration,
|
||||
grandpa_pause,
|
||||
kusama_runtime::RuntimeApi,
|
||||
KusamaExecutor
|
||||
KusamaExecutor,
|
||||
informant_prefix,
|
||||
);
|
||||
|
||||
Ok((service, client, handles))
|
||||
@@ -727,6 +733,7 @@ pub fn westend_new_full(
|
||||
authority_discovery_enabled: bool,
|
||||
slot_duration: u64,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
informant_prefix: Option<String>,
|
||||
)
|
||||
-> Result<(
|
||||
impl AbstractService,
|
||||
@@ -746,7 +753,8 @@ pub fn westend_new_full(
|
||||
slot_duration,
|
||||
grandpa_pause,
|
||||
westend_runtime::RuntimeApi,
|
||||
WestendExecutor
|
||||
WestendExecutor,
|
||||
informant_prefix,
|
||||
);
|
||||
|
||||
Ok((service, client, handles))
|
||||
|
||||
Reference in New Issue
Block a user