mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
grandpa: add voting rule to pause new votes for a period (#904)
* grandpa: add voting rule to pause new votes for a period * grandpa: increase delay * grandpa: parse custom pause delay from cli * grandpa: log scheduled pause on startup * grandpa: rename parameter to grandpa_pause * grandpa: make pause voting rule generic on block * grandpa: add test for pause voting rule * grandpa: add hardcoded pause * collator: fix test compilation
This commit is contained in:
@@ -31,6 +31,14 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
config.impl_name = "parity-polkadot";
|
||||
let force_kusama = opt.run.force_kusama;
|
||||
|
||||
let grandpa_pause = if opt.grandpa_pause.is_empty() {
|
||||
None
|
||||
} else {
|
||||
// should be enforced by cli parsing
|
||||
assert_eq!(opt.grandpa_pause.len(), 2);
|
||||
Some((opt.grandpa_pause[0], opt.grandpa_pause[1]))
|
||||
};
|
||||
|
||||
match opt.subcommand {
|
||||
None => {
|
||||
opt.run.base.init(&version)?;
|
||||
@@ -61,7 +69,7 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
service::kusama_runtime::RuntimeApi,
|
||||
service::KusamaExecutor,
|
||||
service::kusama_runtime::UncheckedExtrinsic,
|
||||
>(config, opt.authority_discovery_enabled)
|
||||
>(config, opt.authority_discovery_enabled, grandpa_pause)
|
||||
} else {
|
||||
info!("Native runtime: {}", service::PolkadotExecutor::native_version().runtime_version);
|
||||
|
||||
@@ -69,7 +77,7 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
service::polkadot_runtime::RuntimeApi,
|
||||
service::PolkadotExecutor,
|
||||
service::polkadot_runtime::UncheckedExtrinsic,
|
||||
>(config, opt.authority_discovery_enabled)
|
||||
>(config, opt.authority_discovery_enabled, grandpa_pause)
|
||||
}
|
||||
},
|
||||
Some(Subcommand::Base(cmd)) => {
|
||||
@@ -123,6 +131,7 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
fn run_service_until_exit<R, D, E>(
|
||||
config: service::Configuration,
|
||||
authority_discovery_enabled: bool,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
) -> sc_cli::Result<()>
|
||||
where
|
||||
R: ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>
|
||||
@@ -151,7 +160,14 @@ where
|
||||
_ =>
|
||||
sc_cli::run_service_until_exit(
|
||||
config,
|
||||
|config| service::new_full::<R, D, E>(config, None, None, authority_discovery_enabled, 6000)
|
||||
|config| service::new_full::<R, D, E>(
|
||||
config,
|
||||
None,
|
||||
None,
|
||||
authority_discovery_enabled,
|
||||
6000,
|
||||
grandpa_pause,
|
||||
)
|
||||
.map(|(s, _)| s),
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user