Skip to content

Commit f8607e3

Browse files
committed
fixed some typos and wrong calculation of duration for the resend .
1 parent abcfa4f commit f8607e3

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

crates/ethcore/src/engines/hbbft/hbbft_early_epoch_end_manager.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl HbbftEarlyEpochEndManager {
262262
}
263263

264264
/// decides on the memorium data if we should update to contract data,
265-
/// end sends out transactions to do so.
265+
/// and sends out transactions to do so.
266266
pub fn decide(
267267
&mut self,
268268
memorium: &HbbftMessageMemorium,
@@ -300,10 +300,9 @@ impl HbbftEarlyEpochEndManager {
300300
// this should hold true.
301301
if now >= block_time {
302302
let elapsed_since_last_block = now - block_time;
303-
// todo:
304-
// this is max blocktime (hartbeat) x 2.
305-
// on phoenix protocol triggers, this would also skip the block production.
306-
if elapsed_since_last_block > 10 {
303+
// todo: this is max blocktime (heartbeat) x 2, better read the maximum blocktime.
304+
// on phoenix protocol triggers, this would also skip the sending of disconnectivity reports.
305+
if elapsed_since_last_block > 10 * 60 {
307306
info!(target:"engine", "skipping early-epoch-end: now {now} ; block_time {block_time}: Block WAS created in the future ?!?! :-x. not sending early epoch end reports.");
308307
return;
309308
}
@@ -319,19 +318,19 @@ impl HbbftEarlyEpochEndManager {
319318
// end of implementation for:
320319
// https://github.com/DMDcoin/diamond-node/issues/243
321320

322-
let treshold: u64 = 2;
321+
let threshold: u64 = 2;
323322

324323
// todo: read this out from contracts: ConnectivityTrackerHbbft -> reportDisallowPeriod
325324
// requires us to update the Contracts ABIs:
326325
// https://github.com/DMDcoin/diamond-node/issues/115
327-
let treshold_time = Duration::from_secs(12 * 60); // 12 Minutes = 1 times the heartbeat + 2 minutes as grace period.
326+
let threshold_time = Duration::from_secs(12 * 60); // 12 Minutes = 1 times the heartbeat + 2 minutes as grace period.
328327

329-
if self.start_time.elapsed() < treshold_time {
330-
debug!(target: "engine", "early-epoch-end: no decision: Treshold time not reached.");
328+
if self.start_time.elapsed() < threshold_time {
329+
debug!(target: "engine", "early-epoch-end: no decision: Threshold time not reached.");
331330
return;
332331
}
333332

334-
if block_num < self.start_block + treshold {
333+
if block_num < self.start_block + threshold {
335334
// not enought blocks have passed this epoch,
336335
// to judge other nodes.
337336
debug!(target: "engine", "early-epoch-end: no decision: not enough blocks.");
@@ -355,7 +354,7 @@ impl HbbftEarlyEpochEndManager {
355354
if let Some(node_history) = epoch_history.get_history_for_node(validator) {
356355
let last_message_time = node_history.get_last_good_message_time();
357356
let last_message_time_lateness = last_message_time.elapsed();
358-
if last_message_time_lateness > treshold_time {
357+
if last_message_time_lateness > threshold_time {
359358
// we do not have to send notification, if we already did so.
360359
if !self.is_reported(client, validator_address) {
361360
// this function will also add the validator to the list of flagged validators.

crates/ethcore/src/engines/hbbft/hbbft_engine.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl IoHandler<()> for TransitionHandler {
386386
|e| warn!(target: "consensus", "ENGINE_PHOENIX_CHECK Timer failed: {}.", e),
387387
);
388388

389-
// ealry epoch end connecitity token should be the same lenght then the max blocktime.
389+
// early epoch end connecitity token should be the same length then the max blocktime.
390390
io.register_timer(HBBFT_CONNECTIVITY_TOKEN, Duration::from_secs(300))
391391
.unwrap_or_else(
392392
|e| warn!(target: "consensus", "ENGINE_PHOENIX_CHECK Timer failed: {}.", e),
@@ -896,7 +896,7 @@ impl HoneyBadgerBFT {
896896
self.hbbft_message_dispatcher.report_seal_bad(
897897
&sender_id,
898898
block_num,
899-
BadSealReason::ErrorTresholdSignStep,
899+
BadSealReason::ErrorThresholdSignStep,
900900
);
901901
}
902902
}
@@ -1264,7 +1264,7 @@ impl HoneyBadgerBFT {
12641264
};
12651265
} // drop lock for hbbft_state
12661266

1267-
if validator_set.len() > 0 {
1267+
if !validator_set.is_empty() {
12681268
self.hbbft_peers_service.send_message(
12691269
HbbftConnectToPeersMessage::ConnectToCurrentPeers(validator_set),
12701270
)?;
@@ -1310,7 +1310,7 @@ impl HoneyBadgerBFT {
13101310
/// hbbft early epoch end actions are executed on a different timing than the regular validator engine steps
13111311
fn do_validator_engine_early_epoch_end_actions(&self) -> Result<(), Error> {
13121312
// here we need to differentiate the different engine functions,
1313-
// that requre different levels of access to the client.
1313+
// that requires different levels of access to the client.
13141314
trace!(target: "engine", "do_validator_engine_actions.");
13151315
match self.client_arc() {
13161316
Some(client_arc) => {
@@ -1462,17 +1462,17 @@ impl HoneyBadgerBFT {
14621462
}
14631463
}
14641464

1465-
/** returns if the signer of hbbft is tracked as available in the hbbft contracts..*/
1465+
/// returns if the signer of hbbft is tracked as available in the hbbft contracts.
14661466
pub fn is_available(&self) -> bool {
14671467
self.hbbft_engine_cache.lock().is_available()
14681468
}
14691469

1470-
/** returns if the signer of hbbft is stacked. */
1470+
/// returns if the signer of hbbft is stacked.
14711471
pub fn is_staked(&self) -> bool {
14721472
self.hbbft_engine_cache.lock().is_staked()
14731473
}
14741474

1475-
/** returns if the signer of hbbft is a current validator. */
1475+
/// returns if the signer of hbbft is a current validator.
14761476
pub fn is_validator(&self) -> bool {
14771477
self.hbbft_state.read().is_validator()
14781478
}

crates/ethcore/src/engines/hbbft/hbbft_message_memorium.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ struct StakingEpochRange {
595595

596596
#[derive(Debug, Clone)]
597597
pub enum BadSealReason {
598-
ErrorTresholdSignStep,
598+
ErrorThresholdSignStep,
599599
MismatchedNetworkInfo,
600600
}
601601

0 commit comments

Comments
 (0)