Skip to content

Commit 9a77912

Browse files
andresilvagavofyork
authored andcommitted
remove kusama fixes (paritytech#738)
1 parent 58d3ec4 commit 9a77912

File tree

2 files changed

+3
-93
lines changed

2 files changed

+3
-93
lines changed

cli/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub use service::{
3838

3939
pub use cli::{VersionInfo, IntoExit, NoCustom, SharedParams};
4040
pub use cli::{display_role, error};
41-
use futures::io::Chain;
4241

4342
/// Load the `ChainSpec` for the given `id`.
4443
pub fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
@@ -147,15 +146,12 @@ where
147146
service::new_light::<R, D, E>(config).map_err(|e| format!("{:?}", e))?,
148147
exit.into_exit(),
149148
),
150-
_ => {
151-
service::kusama_chain_hotfix::<R, D>(&config);
152-
149+
_ =>
153150
run_until_exit(
154151
runtime,
155152
service::new_full::<R, D, E>(config).map_err(|e| format!("{:?}", e))?,
156153
exit.into_exit(),
157-
)
158-
},
154+
),
159155
}.map_err(|e| format!("{:?}", e))
160156
}),
161157
cli::ParseAndPrepare::BuildSpec(cmd) => cmd.run::<NoCustom, _, _, _>(load_spec),

service/src/lib.rs

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -263,87 +263,6 @@ pub fn kusama_new_full(config: Configuration)
263263
new_full(config)
264264
}
265265

266-
pub fn kusama_chain_hotfix<Runtime, Dispatch>(config: &Configuration) where
267-
Dispatch: NativeExecutionDispatch,
268-
Runtime: Send + Sync,
269-
{
270-
use std::str::FromStr;
271-
use sp_blockchain::HeaderBackend;
272-
273-
let client: service::TFullClient<Block, Runtime, Dispatch> =
274-
service::new_full_client(&config).unwrap();
275-
276-
let fork_block = 516510; // target_block - reverted_blocks + 1;
277-
let fork_hash = primitives::H256::from_str(
278-
"15b1b925b0aa5cfe43c88cd024f74258cb5cfe3af424882c901014e8acd0d241",
279-
).unwrap();
280-
281-
let best_number = client.info().best_number;
282-
let target_hash = client.hash(fork_block).unwrap();
283-
284-
if target_hash == Some(fork_hash) {
285-
let diff = best_number.saturating_sub(fork_block - 1);
286-
client.unsafe_revert(diff).unwrap();
287-
}
288-
}
289-
290-
pub fn kusama_grandpa_hotfix<Runtime, Dispatch>(
291-
client: &service::TFullClient<Block, Runtime, Dispatch>,
292-
persistent_data: &mut grandpa::PersistentData<Block>,
293-
) where
294-
Dispatch: NativeExecutionDispatch,
295-
Runtime: Send + Sync,
296-
{
297-
use std::str::FromStr;
298-
use sp_blockchain::HeaderBackend;
299-
300-
let authority_set = &persistent_data.authority_set;
301-
let last_completed_round = persistent_data.set_state
302-
.read()
303-
.last_completed_round()
304-
.number;
305-
306-
let canon_finalized_block = 516509;
307-
let canon_finalized_hash = primitives::H256::from_str(
308-
"f432b7655a848094e6c67f8064ea642bd18f5cf184e1cf9f05a1a9886dd8b9cc",
309-
).unwrap();
310-
311-
let finalized = {
312-
let info = client.info();
313-
(info.finalized_hash, info.finalized_number)
314-
};
315-
316-
// our finalized block is lower than the fork block, nothing to do
317-
if finalized.1 < canon_finalized_block {
318-
return;
319-
}
320-
321-
// we have finalized past the fork block, we need to make sure we're on the
322-
// correct fork (should be guaranteed by the previous chain revert)
323-
if finalized.1 >= canon_finalized_block {
324-
assert_eq!(
325-
client.hash(canon_finalized_block).unwrap().unwrap(),
326-
canon_finalized_hash,
327-
);
328-
}
329-
330-
// assuming the previous preconditions, if we are in any previous grandpa
331-
// round then we restart at the given reset round.
332-
let grandpa_reset_round = 999999;
333-
if authority_set.set_id() == 235 &&
334-
last_completed_round < grandpa_reset_round
335-
{
336-
let set_state = grandpa::VoterSetState::<Block>::live_at(
337-
authority_set.set_id(),
338-
grandpa_reset_round,
339-
&authority_set.inner().read(),
340-
(canon_finalized_hash, canon_finalized_block),
341-
);
342-
343-
persistent_data.set_state = set_state.into();
344-
}
345-
}
346-
347266
/// Builds a new service for a full client.
348267
pub fn new_full<Runtime, Dispatch, Extrinsic>(config: Configuration)
349268
-> Result<impl AbstractService<
@@ -396,7 +315,7 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(config: Configuration)
396315
)?
397316
.build()?;
398317

399-
let (block_import, mut link_half, babe_link) = import_setup.take()
318+
let (block_import, link_half, babe_link) = import_setup.take()
400319
.expect("Link Half and Block Import are present for Full Services or setup failed before. qed");
401320

402321
let client = service.client();
@@ -557,11 +476,6 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(config: Configuration)
557476

558477
let enable_grandpa = !disable_grandpa;
559478
if enable_grandpa {
560-
kusama_grandpa_hotfix(
561-
&client,
562-
&mut link_half.persistent_data,
563-
);
564-
565479
// start the full GRANDPA voter
566480
// NOTE: unlike in substrate we are currently running the full
567481
// GRANDPA voter protocol for all full nodes (regardless of whether

0 commit comments

Comments
 (0)