Skip to content

Commit

Permalink
Typo fixes, added Code of Conduct file
Browse files Browse the repository at this point in the history
  • Loading branch information
andogro committed Sep 12, 2018
1 parent a2fa8a4 commit b39cc1f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 24 deletions.
73 changes: 73 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ submitting code or comments.
3. Write tests that cover your work.
4. Run Rustfmt, Clippy, and all tests to ensure CI rules are satisfied.
Correct versions and feature flags can be found in the
[`.travis.yml`](https://github.com/poanetwork/hbbft/blob/master/.travis.yml)
[`.travis.yml`](.travis.yml)
file.
5. Commit your changes (`git commit -am 'Add some feature'`).
6. Push to your branch (`git push origin my-new-feature`).
7. Create a new PR (Pull Request).
7. Create a new Pull Request.

### General

Expand All @@ -34,11 +34,11 @@ submitting code or comments.

### Issues

Creating and discussing [Issues](https://github.com/poanetwork/hbbft/issues)
Creating and discussing [Issues](https://github.com/poanetwork/threshold_crypto/issues)
provides significant value to the project. If you find a bug you can report it
in an Issue.

### Pull Requests
### Pull Requests (PR)

All pull requests should include:

Expand Down
12 changes: 6 additions & 6 deletions examples/threshold_enc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ impl SecretSociety {
//
// # Arguments
//
// `n_actors` - the number of operatives in the secret society.
// `threshold` - the number of operatives that must collaborate in in order to successfully
// `n_actors` - the number of actors (members) in the secret society.
// `threshold` - the number of actors that must collaborate to successfully
// decrypt a message must exceed this `threshold`.
fn new(n_actors: usize, threshold: usize) -> Self {
let mut rng = rand::thread_rng();
Expand Down Expand Up @@ -101,7 +101,7 @@ impl DecryptionMeeting {
fn accept_decryption_share(&mut self, actor: &mut Actor) {
let ciphertext = actor.msg_inbox.take().unwrap();

// Check that the actor's ciphertext is the same that is being decrypted at the meeting.
// Check that the actor's ciphertext is the same ciphertext decrypted at the meeting.
// The first actor to arrive at the decryption meeting sets the meeting's ciphertext.
if let Some(ref meeting_ciphertext) = self.ciphertext {
if ciphertext != *meeting_ciphertext {
Expand Down Expand Up @@ -132,7 +132,7 @@ fn main() {
// Create a `SecretSociety` with 3 actors. Any message encrypted with the society's public-key
// will require 2 or more actors working together to decrypt (i.e. the decryption threshold is
// 1). Once the secret society has created its master keys, it "deals" a secret-key share and
// public-key share to each of its operatives. The secret society then publishes its public key
// public-key share to each of its actors. The secret society then publishes its public key
// to a publicly accessible key-server.
let mut society = SecretSociety::new(3, 1);
let pk = society.publish_public_key();
Expand All @@ -143,8 +143,8 @@ fn main() {
let clara = society.get_actor(2).id;

// I, the society's benevolent hacker, want to send an important message to each of my
// comrades. I encrypt my message with the society's public-key, I then send the ciphertext to
// each of the society's operatives.
// comrades. I encrypt my message with the society's public-key. I then send the ciphertext to
// each of the society's actors.
let msg = b"let's get pizza";
let ciphertext = pk.encrypt(msg);
send_msg(society.get_actor(alice), ciphertext.clone());
Expand Down
28 changes: 14 additions & 14 deletions examples/threshold_sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type UserId = usize;
type NodeId = usize;
type Msg = String;

// The database schema that validator nodes use to store messages that they receive from users.
// The database schema that validator nodes use to store messages they receive from users.
// Messages are first indexed numerically by user ID then alphabetically by message. Each message
// is mapped to its list of valdidator signatures.
type MsgDatabase = BTreeMap<UserId, BTreeMap<Msg, Vec<NodeSignature>>>;
Expand All @@ -24,9 +24,9 @@ type ChatLog = Vec<(UserId, Msg, Signature)>;

// Represents a network of nodes running a distributed chat protocol. Clients, or "users", of our
// network, create a string that they want to append to the network's `chat_log`, they broadcast
// this message to the network, each node that receives the message signs it with their
// this message to the network, and each node that receives the message signs it with their
// signing-key. When the network runs a round of consensus, each node contributes its set of signed
// messages, the first message that has received `threshold + 1` signatures from validator nodes,
// messages. The first message to receive `threshold + 1` signatures from validator nodes
// gets added to the `chat_log`.
struct ChatNetwork {
pk_set: PublicKeySet,
Expand All @@ -41,7 +41,7 @@ impl ChatNetwork {
// # Arguments
//
// `n_nodes` - the number of validator/signing nodes in the network.
// `threshold` - our protocol requires a message to have `threshold + 1` validator signatures
// `threshold` - a message must have `threshold + 1` validator signatures
// before it can be added to the `chat_log`.
fn new(n_nodes: usize, threshold: usize) -> Self {
let mut rng = rand::thread_rng();
Expand Down Expand Up @@ -88,8 +88,8 @@ impl ChatNetwork {
}
}

// Our chat protocol's consensus algorithm. Produces a new block to be appended to the chat
// log. Our consensus uses threshold-signing to verify that a message has received enough
// Our chat protocol's consensus algorithm. This algorithm produces a new block to append to the chat
// log. Our consensus uses threshold-signing to verify a message has received enough
// signature shares (i.e. has been signed by `threshold + 1` nodes).
fn run_consensus(&self) -> Option<(UserId, Msg, Signature)> {
// Create a new `MsgDatabase` of every message that has been signed by a validator node.
Expand All @@ -112,9 +112,9 @@ impl ChatNetwork {
});

// Iterate over the `MsgDatabase` numerically by user ID, then iterate over each user's
// messages alphabetically. Try to combine the validator signatures. The first message that
// has received `threshold + 1` node signatures, will produce a valid "combined" signature
// and will be added to the chat log.
// messages alphabetically. Try to combine the validator signatures. The first message to
// receive `threshold + 1` node signatures produces a valid "combined" signature
// and is added to the chat log.
for (user_id, signed_msgs) in &all_pending {
for (msg, sigs) in signed_msgs.iter() {
let sigs = sigs.iter().filter_map(|node_sig| {
Expand All @@ -140,7 +140,7 @@ impl ChatNetwork {
}
}

// A node the network that is running our chat protocol.
// A network node running our chat protocol.
struct Node {
id: NodeId,
sk_share: SecretKeyShare,
Expand All @@ -158,7 +158,7 @@ impl Node {
}
}

// Receives a message from a user, signs the with message with the node's signing-key share,
// Receives a message from a user, signs the message with the node's signing-key share,
// then adds the signed message to its database of `pending` messages.
fn recv(&mut self, user_id: UserId, msg: Msg) {
let sig = NodeSignature {
Expand Down Expand Up @@ -198,7 +198,7 @@ impl User {

fn main() {
// Creates a new network of 3 nodes running our chat protocol. The protocol has a
// signing-threshold of 1, i.e. each message requires 2 validator signatures before it can be
// signing-threshold of 1. This means each message requires 2 validator signatures before it can be
// added to the chat log.
let mut network = ChatNetwork::new(3, 1);
let node1 = network.get_node(0).id;
Expand All @@ -208,14 +208,14 @@ fn main() {
let alice = network.create_user();
let alice_greeting = "hey, this is alice".to_string();

// Alice sends here message to a validator. The validator signs the message. Before Alice can
// Alice sends her message to a validator. The validator signs the message. Before Alice can
// send her message to a second validator, the network runs a round of consensus. Because
// Alice's message has only one validator signature, it is not added to the chat log.
alice.send(network.get_mut_node(node1), alice_greeting.clone());
network.step();
assert!(network.chat_log.is_empty());

// Alice sends here message to a second validator. the validator signs the message. Alice's
// Alice sends her message to a second validator. The validator signs the message. Alice's
// message now has two signatures (which is `threshold + 1` signatures). The network runs a
// round of consensus, which successfully creates a combined-signature for Alice's message.
// Alice's message is appended to the chat log.
Expand Down

0 comments on commit b39cc1f

Please sign in to comment.