mirror of https://github.com/poanetwork/hbbft.git
add encryption schedule to join plan (and batch), remove unnecessary lint supression, style change
This commit is contained in:
parent
dcbc065388
commit
700f9b55e3
|
@ -1,6 +1,7 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::EncryptionSchedule;
|
||||
use super::{ChangeState, JoinPlan};
|
||||
use {NetworkInfo, NodeIdT};
|
||||
|
||||
|
@ -16,6 +17,8 @@ pub struct Batch<C, N> {
|
|||
pub(super) change: ChangeState<N>,
|
||||
/// The network info that applies to the _next_ epoch.
|
||||
pub(super) netinfo: Arc<NetworkInfo<N>>,
|
||||
/// The current encryption schedule for threshold cryptography.
|
||||
pub(super) encryption_schedule: EncryptionSchedule,
|
||||
}
|
||||
|
||||
impl<C, N: NodeIdT> Batch<C, N> {
|
||||
|
@ -90,6 +93,7 @@ impl<C, N: NodeIdT> Batch<C, N> {
|
|||
change: self.change.clone(),
|
||||
pub_key_set: self.netinfo.public_key_set().clone(),
|
||||
pub_keys: self.netinfo.public_key_map().clone(),
|
||||
encryption_schedule: self.encryption_schedule,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -104,5 +108,6 @@ impl<C, N: NodeIdT> Batch<C, N> {
|
|||
&& self.change == other.change
|
||||
&& self.netinfo.public_key_set() == other.netinfo.public_key_set()
|
||||
&& self.netinfo.public_key_map() == other.netinfo.public_key_map()
|
||||
&& self.encryption_schedule == other.encryption_schedule
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ where
|
|||
let arc_netinfo = Arc::new(netinfo.clone());
|
||||
let honey_badger = HoneyBadger::builder(arc_netinfo.clone())
|
||||
.max_future_epochs(self.max_future_epochs)
|
||||
.encryption_schedule(self.encryption_schedule)
|
||||
.encryption_schedule(join_plan.encryption_schedule)
|
||||
.build();
|
||||
let mut dhb = DynamicHoneyBadger {
|
||||
netinfo,
|
||||
|
|
|
@ -315,6 +315,7 @@ where
|
|||
change,
|
||||
netinfo: Arc::new(self.netinfo.clone()),
|
||||
contributions: batch_contributions,
|
||||
encryption_schedule: self.honey_badger.get_encryption_schedule(),
|
||||
});
|
||||
}
|
||||
// If `start_epoch` changed, we can now handle some queued messages.
|
||||
|
@ -384,11 +385,9 @@ where
|
|||
.session_id(epoch)
|
||||
.max_future_epochs(self.max_future_epochs)
|
||||
.rng(self.rng.sub_rng())
|
||||
.encryption_schedule(if let Some(schedule) = encryption_schedule {
|
||||
schedule
|
||||
} else {
|
||||
self.honey_badger.get_encryption_schedule()
|
||||
}).build();
|
||||
.encryption_schedule(
|
||||
encryption_schedule.unwrap_or_else(|| self.honey_badger.get_encryption_schedule()),
|
||||
).build();
|
||||
}
|
||||
|
||||
/// Handles a `Part` message that was output by Honey Badger.
|
||||
|
|
|
@ -68,6 +68,7 @@ use serde_derive::{Deserialize, Serialize};
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use self::votes::{SignedVote, VoteCounter};
|
||||
use super::threshold_decryption::EncryptionSchedule;
|
||||
use honey_badger::Message as HbMessage;
|
||||
use sync_key_gen::{Ack, Part, SyncKeyGen};
|
||||
use NodeIdT;
|
||||
|
@ -142,6 +143,8 @@ pub struct JoinPlan<N: Ord> {
|
|||
pub_key_set: PublicKeySet,
|
||||
/// The public keys of the nodes taking part in key generation.
|
||||
pub_keys: BTreeMap<N, PublicKey>,
|
||||
/// The current encryption schedule for threshold cryptography.
|
||||
encryption_schedule: EncryptionSchedule,
|
||||
}
|
||||
|
||||
/// The ongoing key generation, together with information about the validator change.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![cfg_attr(feature = "cargo-clippy", allow(borrowed_box))]
|
||||
|
||||
use std::collections::btree_map::Entry;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::fmt::{self, Display};
|
||||
|
|
Loading…
Reference in New Issue