mirror of https://github.com/poanetwork/hbbft.git
apparently nightly and stable cargo fmt have different opinions
This commit is contained in:
parent
212d9b57b8
commit
877903aeac
|
@ -84,8 +84,7 @@ impl<'a, M: Serialize + for<'de> Deserialize<'de> + Send + 'a> CommsTask<'a, M>
|
|||
tx.send(SourcedMessage {
|
||||
source: node_index,
|
||||
message,
|
||||
})
|
||||
.unwrap();
|
||||
}).unwrap();
|
||||
}
|
||||
Err(err) => {
|
||||
if let bincode::ErrorKind::Io(ref io_err) = *err {
|
||||
|
|
|
@ -41,7 +41,6 @@ pub fn make(
|
|||
TcpStream::connect(address).expect("failed to connect")
|
||||
};
|
||||
Connection::new(tcp_conn, there_str.to_string())
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
(here_str, connections)
|
||||
}
|
||||
|
|
|
@ -189,8 +189,7 @@ impl<T: Clone + Debug + AsRef<[u8]> + PartialEq + Send + Sync + From<Vec<u8>> +
|
|||
// FIXME: handle error
|
||||
c.stream.try_clone().unwrap(),
|
||||
node_index,
|
||||
)
|
||||
.run()
|
||||
).run()
|
||||
{
|
||||
Ok(_) => debug!("Comms task {} succeeded", node_index),
|
||||
Err(e) => error!("Comms task {}: {:?}", node_index, e),
|
||||
|
@ -210,8 +209,7 @@ impl<T: Clone + Debug + AsRef<[u8]> + PartialEq + Send + Sync + From<Vec<u8>> +
|
|||
.send(())
|
||||
.map_err(|e| {
|
||||
error!("{}", e);
|
||||
})
|
||||
.unwrap();
|
||||
}).unwrap();
|
||||
|
||||
process::exit(0);
|
||||
}) // end of thread scope
|
||||
|
|
|
@ -155,8 +155,7 @@ where
|
|||
target: msg.target,
|
||||
message: ser_msg,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
let outputs = step
|
||||
.output
|
||||
.into_iter()
|
||||
|
@ -203,8 +202,7 @@ where
|
|||
.map(|msg| {
|
||||
let ser_msg = bincode::serialize(&msg.message).expect("serialize");
|
||||
(msg.target, ser_msg)
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
self.time += start.elapsed() * self.hw_quality.cpu_factor / 100;
|
||||
let time = self.time;
|
||||
self.outputs
|
||||
|
|
|
@ -308,8 +308,7 @@ impl<N: NodeIdT> Broadcast<N> {
|
|||
None
|
||||
}
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
if let Some(value) =
|
||||
decode_from_shards(&mut leaf_values, &self.coding, self.data_shard_num, hash)
|
||||
{
|
||||
|
|
|
@ -124,8 +124,7 @@ where
|
|||
contrib,
|
||||
key_gen_messages,
|
||||
votes: self.vote_counter.pending_votes().cloned().collect(),
|
||||
})
|
||||
.map_err(ErrorKind::ProposeHoneyBadger)?;
|
||||
}).map_err(ErrorKind::ProposeHoneyBadger)?;
|
||||
self.process_output(step)
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,7 @@ mod tests {
|
|||
.sign_vote_for(Change::NodeChange(change))
|
||||
.expect("sign vote")
|
||||
.clone()
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}).collect::<Vec<_>>()
|
||||
};
|
||||
let signed_votes: Vec<_> = counters.iter_mut().map(sign_votes).collect();
|
||||
(counters, signed_votes)
|
||||
|
|
|
@ -68,8 +68,7 @@ where
|
|||
match self {
|
||||
SubsetState::Ongoing(ref mut cs) => cs.handle_input(proposal),
|
||||
SubsetState::Complete(_) => return Ok(cs::Step::default()),
|
||||
}
|
||||
.map_err(|err| ErrorKind::InputSubset(err).into())
|
||||
}.map_err(|err| ErrorKind::InputSubset(err).into())
|
||||
}
|
||||
|
||||
/// Handles a message in the Subset instance, unless it has already completed.
|
||||
|
@ -77,8 +76,7 @@ where
|
|||
match self {
|
||||
SubsetState::Ongoing(ref mut cs) => cs.handle_message(sender_id, msg),
|
||||
SubsetState::Complete(_) => return Ok(cs::Step::default()),
|
||||
}
|
||||
.map_err(|err| ErrorKind::HandleSubsetMessage(err).into())
|
||||
}.map_err(|err| ErrorKind::HandleSubsetMessage(err).into())
|
||||
}
|
||||
|
||||
/// Returns the number of contributions that we have already received or, after completion, how
|
||||
|
@ -249,8 +247,7 @@ where
|
|||
Entry::Vacant(entry) => {
|
||||
entry.insert(DecryptionState::new(self.netinfo.clone()))
|
||||
}
|
||||
}
|
||||
.handle_message(sender_id, share)
|
||||
}.handle_message(sender_id, share)
|
||||
.map_err(ErrorKind::ThresholdDecryption)?;
|
||||
self.process_decryption(proposer_id, td_step)
|
||||
}
|
||||
|
@ -348,8 +345,7 @@ where
|
|||
MessageContent::DecryptionShare {
|
||||
proposer_id: proposer_id.clone(),
|
||||
share,
|
||||
}
|
||||
.with_epoch(self.epoch)
|
||||
}.with_epoch(self.epoch)
|
||||
});
|
||||
if let Some(output) = opt_output.into_iter().next() {
|
||||
self.decryption
|
||||
|
@ -374,8 +370,7 @@ where
|
|||
let td_result = match self.decryption.entry(proposer_id.clone()) {
|
||||
Entry::Occupied(entry) => entry.into_mut(),
|
||||
Entry::Vacant(entry) => entry.insert(DecryptionState::new(self.netinfo.clone())),
|
||||
}
|
||||
.set_ciphertext(ciphertext);
|
||||
}.set_ciphertext(ciphertext);
|
||||
match td_result {
|
||||
Ok(td_step) => self.process_decryption(proposer_id, td_step),
|
||||
Err(td::Error::InvalidCiphertext(_)) => {
|
||||
|
|
|
@ -497,8 +497,7 @@ impl<N: NodeIdT> SyncKeyGen<N> {
|
|||
err
|
||||
);
|
||||
Fault::ValueDeserialization
|
||||
})?
|
||||
.into_inner();
|
||||
})?.into_inner();
|
||||
if part.commit.evaluate(our_idx + 1, sender_idx + 1) != G1Affine::one().mul(val) {
|
||||
return Err(Fault::ValueInvalid);
|
||||
}
|
||||
|
|
|
@ -89,8 +89,7 @@ where
|
|||
// If there's only one node, it will immediately output on input. Make sure we
|
||||
// first process all incoming messages before providing input again.
|
||||
&& (network.nodes.len() > 2 || node.queue.is_empty())
|
||||
})
|
||||
.map(|(id, _)| *id)
|
||||
}).map(|(id, _)| *id)
|
||||
.collect();
|
||||
if let Some(id) = rng.choose(&input_ids) {
|
||||
let queue = queues.get_mut(id).unwrap();
|
||||
|
|
|
@ -111,8 +111,7 @@ impl Adversary<UsizeHoneyBadger> for FaultyShareAdversary {
|
|||
MessageContent::DecryptionShare {
|
||||
proposer_id: NodeId(proposer_id),
|
||||
share: threshold_decryption::Message(share.clone()),
|
||||
}
|
||||
.with_epoch(*epoch),
|
||||
}.with_epoch(*epoch),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
@ -175,8 +174,7 @@ where
|
|||
epoch,
|
||||
contributions,
|
||||
}| (epoch, contributions),
|
||||
)
|
||||
.collect();
|
||||
).collect();
|
||||
if expected.is_none() {
|
||||
expected = Some(outputs);
|
||||
} else if let Some(expected) = &expected {
|
||||
|
|
|
@ -733,8 +733,7 @@ where
|
|||
});
|
||||
steps.insert(id.clone(), step);
|
||||
(id, Node::new(algorithm, is_faulty))
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
|
||||
let mut message_count: usize = 0;
|
||||
// For every recorded step, apply it.
|
||||
|
@ -867,8 +866,7 @@ where
|
|||
self.nodes
|
||||
.get(&msg.to)
|
||||
.ok_or_else(|| CrankError::NodeDisappeared(msg.to.clone()))
|
||||
)
|
||||
.is_faulty();
|
||||
).is_faulty();
|
||||
|
||||
let step: Step<_> = if is_faulty {
|
||||
// The swap-dance is painful here, as we are creating an `opt_step` just to avoid
|
||||
|
@ -949,8 +947,7 @@ where
|
|||
node.id().clone(),
|
||||
node.algorithm.handle_input(input.clone())?,
|
||||
))
|
||||
})
|
||||
.collect::<Result<_, _>>()?;
|
||||
}).collect::<Result<_, _>>()?;
|
||||
|
||||
// Process all messages from all steps in the queue.
|
||||
steps.iter().for_each(|(id, step)| {
|
||||
|
|
|
@ -140,8 +140,7 @@ fn do_drop_and_readd(cfg: TestConfig) {
|
|||
// Afterwards, remove a specific node from the dynamic honey badger network.
|
||||
net.broadcast_input(&Input::Change(Change::NodeChange(NodeChange::Remove(
|
||||
pivot_node_id,
|
||||
))))
|
||||
.expect("broadcasting failed");
|
||||
)))).expect("broadcasting failed");
|
||||
|
||||
// We are tracking (correct) nodes' state through the process by ticking them off individually.
|
||||
let mut awaiting_removal: collections::BTreeSet<_> =
|
||||
|
@ -175,8 +174,7 @@ fn do_drop_and_readd(cfg: TestConfig) {
|
|||
.handle_input(Input::Change(Change::NodeChange(NodeChange::Add(
|
||||
*pivot_node_id,
|
||||
pk,
|
||||
))))
|
||||
.expect("failed to send `Add` input");
|
||||
)))).expect("failed to send `Add` input");
|
||||
}
|
||||
|
||||
ChangeState::Complete(Change::NodeChange(NodeChange::Add(pivot_node_id, _))) => {
|
||||
|
|
|
@ -34,8 +34,7 @@ fn test_sync_key_gen_with(threshold: usize, node_num: usize) {
|
|||
});
|
||||
nodes.push(sync_key_gen);
|
||||
proposal
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
|
||||
// Handle the first `threshold + 1` proposals. Those should suffice for key generation.
|
||||
let mut acks = Vec::new();
|
||||
|
@ -83,8 +82,7 @@ fn test_sync_key_gen_with(threshold: usize, node_num: usize) {
|
|||
let sig = sk.sign(msg);
|
||||
assert!(pks.public_key_share(idx).verify(&sig, msg));
|
||||
(idx, sig)
|
||||
})
|
||||
.collect();
|
||||
}).collect();
|
||||
let sig = pub_key_set
|
||||
.combine_signatures(sig_shares.iter().take(threshold + 1))
|
||||
.expect("signature shares match");
|
||||
|
|
Loading…
Reference in New Issue