Update terminology: "observers" and "validators"

This commit is contained in:
Andreas Fackler 2018-06-29 17:20:54 +02:00
parent 11149c5e66
commit bbc27e8a66
8 changed files with 27 additions and 26 deletions

View File

@ -21,13 +21,13 @@ Honey Badger is a modular library composed of several independent algorithms. T
In an optimal networking environment, output includes data sent from each node. In an adverse environment, the output is an agreed upon subset of data. Either way, the resulting output contains a batch of transactions which is guaranteed to be consistent across all nodes.
In addition to **full nodes**, the algorithms support **observers**: These don't actively participate, and don't need to be trusted, but they receive the output as well, and are able to verify it under the assumption that more than two thirds of the full nodes are correct.
In addition to **validators**, the algorithms support **observers**: These don't actively participate, and don't need to be trusted, but they receive the output as well, and are able to verify it under the assumption that more than two thirds of the validators are correct.
## Algorithms
- [x] **[Honey Badger](https://github.com/poanetwork/hbbft/blob/master/src/honey_badger.rs):** Each node inputs transactions. The protocol outputs a sequence of batches of transactions.
- [ ] **[Dynamic Honey Badger](https://github.com/poanetwork/hbbft/blob/master/src/dynamic_honey_badger.rs):** This works like Honey Badger itself, but in addition allows dynamically adding and removing nodes to/from the network.
- [ ] **[Dynamic Honey Badger](https://github.com/poanetwork/hbbft/blob/master/src/dynamic_honey_badger.rs):** A modified Honey Badger where nodes can dynamically add and remove other nodes to/from the network.
- [x] **[Subset](https://github.com/poanetwork/hbbft/blob/master/src/common_subset.rs):** Each node inputs data. The nodes agree on a subset of suggested data.

View File

@ -307,7 +307,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
}
fn send_bval(&mut self, b: bool) -> AgreementResult<()> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
// Record the value `b` as sent.
@ -329,7 +329,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
// Trigger the start of the `Conf` round.
self.conf_round = true;
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
@ -456,7 +456,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
self.output = Some(b);
// Latch the decided state.
self.decision = Some(b);
if self.netinfo.is_peer() {
if self.netinfo.is_validator() {
self.messages
.push_back(AgreementContent::Term(b).with_epoch(self.epoch));
self.received_term.insert(self.netinfo.our_uid().clone(), b);
@ -484,7 +484,7 @@ impl<NodeUid: Clone + Debug + Ord> Agreement<NodeUid> {
}
fn send_aux(&mut self, b: bool) -> AgreementResult<()> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
// Multicast `Aux`.

View File

@ -355,7 +355,7 @@ impl<NodeUid: Debug + Clone + Ord> Broadcast<NodeUid> {
/// Sends an `Echo` message and handles it. Does nothing if we are only an observer.
fn send_echo(&mut self, p: Proof<Vec<u8>>) -> BroadcastResult<()> {
self.echo_sent = true;
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
let echo_msg = Target::All.message(BroadcastMessage::Echo(p.clone()));
@ -367,7 +367,7 @@ impl<NodeUid: Debug + Clone + Ord> Broadcast<NodeUid> {
/// Sends a `Ready` message and handles it. Does nothing if we are only an observer.
fn send_ready(&mut self, hash: &[u8]) -> BroadcastResult<()> {
self.ready_sent = true;
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
let ready_msg = Target::All.message(BroadcastMessage::Ready(hash.to_vec()));

View File

@ -126,7 +126,7 @@ where
}
fn get_coin(&mut self) -> Result<()> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return self.try_output();
}
let share = self.netinfo.secret_key().sign(&self.nonce);

View File

@ -180,7 +180,7 @@ impl<NodeUid: Clone + Debug + Ord> CommonSubset<NodeUid> {
/// Common Subset input message handler. It receives a value for broadcast
/// and redirects it to the corresponding broadcast instance.
pub fn send_proposed_value(&mut self, value: ProposedValue) -> CommonSubsetResult<()> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
let uid = self.netinfo.our_uid().clone();

View File

@ -7,18 +7,18 @@
//! transactions and keeps producing new batches from them. All correct nodes will output the same
//! batch for each epoch.
//!
//! Unlike Honey Badger, this algorithm allows dynamically adding new full peers from the pool of
//! observer nodes, and turning full peers back into observers. As a signal to initiate that
//! Unlike Honey Badger, this algorithm allows dynamically adding new validators from the pool of
//! observer nodes, and turning validators back into observers. As a signal to initiate that
//! process, it defines a special `Change` input variant, which contains either a vote
//! `Add(node_id, public_key)`, to add a new full peer, or `Remove(node_id)` to remove it. Each
//! full peer can have at most one active vote, and casting another vote revokes the previous one.
//! Once a simple majority of full nodes has the same active vote, a reconfiguration process begins
//! `Add(node_id, public_key)`, to add a new validator, or `Remove(node_id)` to remove it. Each
//! validator can have at most one active vote, and casting another vote revokes the previous one.
//! Once a simple majority of validators has the same active vote, a reconfiguration process begins
//! (they need to create new cryptographic key shares for the new composition).
//!
//! The state of that process after each epoch is communicated via the `Batch::change` field. When
//! this contains an `InProgress(Add(..))` value, all nodes need to send every future `Target::All`
//! message to the new node, too. Once the value is `Complete`, the votes will be reset, and the
//! next epoch will run using the new set of full nodes.
//! next epoch will run using the new set of validators.
//!
//! ## How it works
//!
@ -125,7 +125,8 @@ where
/// The first epoch after the latest node change.
start_epoch: u64,
/// Collected votes for adding or removing nodes. Each node has one vote, and casting another
/// vote revokes the previous one. Resets whenever the set of peers is successfully changed.
/// vote revokes the previous one. Resets whenever the set of validators is successfully
/// changed.
votes: BTreeMap<NodeUid, Change<NodeUid>>,
/// The `HoneyBadger` instance with the current set of nodes.
honey_badger: HoneyBadger<Transaction<Tx, NodeUid>, NodeUid>,
@ -283,7 +284,7 @@ where
if let Some(((pub_key_set, sk), change)) = self.take_key_gen_output() {
// If DKG completed, apply the change.
debug!("{:?} DKG for {:?} complete!", self.our_id(), change);
// If we are a full peer, we received a new secret key. Otherwise keep the old one.
// If we are a validator, we received a new secret key. Otherwise keep the old one.
let sk = sk.unwrap_or_else(|| {
ClearOnDrop::new(Box::new(self.netinfo.secret_key().clone()))
});
@ -399,7 +400,7 @@ where
let sig = self.sign(&node_tx)?;
let msg = Message::Signed(self.start_epoch, node_tx.clone(), sig.clone());
self.messages.push_back(Target::All.message(msg));
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
let our_uid = self.netinfo.our_uid().clone();

View File

@ -158,7 +158,7 @@ where
/// Proposes a new batch in the current epoch.
fn propose(&mut self) -> HoneyBadgerResult<()> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(());
}
let proposal = self.choose_transactions()?;
@ -441,7 +441,7 @@ where
proposer_id: &NodeUid,
ciphertext: &Ciphertext,
) -> HoneyBadgerResult<bool> {
if !self.netinfo.is_peer() {
if !self.netinfo.is_validator() {
return Ok(ciphertext.verify());
}
let share = match self.netinfo.secret_key().decrypt_share(&ciphertext) {

View File

@ -142,7 +142,7 @@ pub struct NetworkInfo<NodeUid> {
all_uids: BTreeSet<NodeUid>,
num_nodes: usize,
num_faulty: usize,
is_peer: bool,
is_validator: bool,
secret_key: ClearOnDrop<Box<SecretKey>>,
public_key_set: PublicKeySet,
public_keys: BTreeMap<NodeUid, PublicKey>,
@ -157,7 +157,7 @@ impl<NodeUid: Clone + Ord> NetworkInfo<NodeUid> {
public_key_set: PublicKeySet,
) -> Self {
let num_nodes = all_uids.len();
let is_peer = all_uids.contains(&our_uid);
let is_validator = all_uids.contains(&our_uid);
let node_indices: BTreeMap<NodeUid, usize> = all_uids
.iter()
.enumerate()
@ -172,7 +172,7 @@ impl<NodeUid: Clone + Ord> NetworkInfo<NodeUid> {
all_uids,
num_nodes,
num_faulty: (num_nodes - 1) / 3,
is_peer,
is_validator,
secret_key,
public_key_set,
public_keys,
@ -236,7 +236,7 @@ impl<NodeUid: Clone + Ord> NetworkInfo<NodeUid> {
/// Returns `true` if this node takes part in the consensus itself. If not, it is only an
/// observer.
pub fn is_peer(&self) -> bool {
self.is_peer
pub fn is_validator(&self) -> bool {
self.is_validator
}
}