Skip to content

Commit

Permalink
Merge 0d7b1d0 into 717b566
Browse files Browse the repository at this point in the history
  • Loading branch information
jacderida committed Jul 20, 2022
2 parents 717b566 + 0d7b1d0 commit fbba18c
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 44 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/pr.yml
Expand Up @@ -8,10 +8,7 @@ name: PR
on: pull_request

env:
# Run all cargo commands with --verbose.
CARGO_TERM_VERBOSE: true
RUST_BACKTRACE: 1
# Deny all compiler warnings.
RUSTFLAGS: "-D warnings"

jobs:
Expand All @@ -30,7 +27,6 @@ jobs:
override: true
components: rustfmt, clippy

# Cache.
- name: Cargo cache registry, index and build
uses: actions/cache@v2.1.4
with:
Expand All @@ -40,41 +36,25 @@ jobs:
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

# Check if the code is formatted correctly.
- name: Check formatting
run: cargo fmt --all -- --check

# Run Clippy.
- name: Clippy checks # --feature blsttc
run: cargo clippy --all-targets # --no-default-features --features "blsttc"

check_pr_size:
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')"
name: Check PR size doesn't break set limit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: maidsafe/pr_size_checker@v2
with:
max_lines_changed: 200

coverage:
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')"
name: Code coverage check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install Rust
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

# Cache.
- name: Cargo cache registry, index and build
uses: actions/cache@v2.1.4
with:
Expand All @@ -84,7 +64,6 @@ jobs:
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

# Run cargo tarpaulin & push result to coveralls.io
- name: rust-tarpaulin code coverage check
uses: actions-rs/tarpaulin@v0.1
with:
Expand Down Expand Up @@ -117,7 +96,6 @@ jobs:
toolchain: stable
override: true

# Cache.
- name: Cargo cache registry, index and build
uses: actions/cache@v2.1.4
with:
Expand All @@ -127,7 +105,6 @@ jobs:
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

# Make sure the code builds.
- name: Run cargo build
run: cargo build --release

Expand All @@ -147,7 +124,6 @@ jobs:
toolchain: stable
override: true

# Cache.
- name: Cargo cache registry, index and build
uses: actions/cache@v2.1.4
with:
Expand All @@ -157,7 +133,6 @@ jobs:
target
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}

# Run the tests
- name: Run cargo test
run: cargo test --release

Expand All @@ -167,7 +142,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Install Rust and required components
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
Expand All @@ -185,13 +159,11 @@ jobs:
steps:
- uses: actions/checkout@v2

# wget the shared deny.toml file from the QA repo
- shell: bash
run: wget https://raw.githubusercontent.com/maidsafe/QA/master/misc-scripts/deny.toml

- uses: EmbarkStudios/cargo-deny-action@v1

# Test publish using --dry-run.
test-publish:
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')"
name: Test Publish
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -18,7 +18,7 @@ log = "0.4.13"
features = [ "derive" ]

[dependencies.blsttc]
version = "6.0.0"
version = "7.0.0"

[dependencies.ed25519]
version = "1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/consensus.rs
Expand Up @@ -71,7 +71,7 @@ impl<T: Proposition> Consensus<T> {
.map(|(candidate, _)| candidate.proposals.clone())
.unwrap_or_default();

let proposals_sig_share = self.sign(&proposals)?;
let proposals_sig_share = Box::new(self.sign(&proposals)?);

let ballot = Ballot::SuperMajority {
votes,
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Expand Up @@ -7,6 +7,8 @@ use crate::Generation;
pub enum Error {
#[error("We experienced an IO error")]
IO(#[from] std::io::Error),
#[error("We experienced an formatting error")]
Fmt(#[from] std::fmt::Error),
#[error("The operation requested assumes we have at least one member")]
NoMembers,
#[error("We can not accept any new join requests, network member size is at capacity")]
Expand Down
2 changes: 1 addition & 1 deletion src/vote.rs
Expand Up @@ -16,7 +16,7 @@ pub enum Ballot<T: Proposition> {
Merge(BTreeSet<SignedVote<T>>),
SuperMajority {
votes: BTreeSet<SignedVote<T>>,
proposals_sig_share: SignatureShare, // signature over BTreeSet<T>
proposals_sig_share: Box<SignatureShare>, // signature over BTreeSet<T>
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/vote_count.rs
Expand Up @@ -122,7 +122,7 @@ impl<T: Proposition> VoteCount<T> {
sm_count.count += 1;
sm_count
.proposals_sig_shares
.insert(Fr::from(vote.voter as u64), proposals_sig_share);
.insert(Fr::from(vote.voter as u64), *proposals_sig_share);
}

let c = count.candidates.entry(candidate).or_default();
Expand Down
12 changes: 7 additions & 5 deletions tests/handover_net.rs
@@ -1,6 +1,7 @@
use std::collections::{BTreeMap, BTreeSet, VecDeque};
use std::fmt::Write as FmtWrite;
use std::fs::File;
use std::io::Write;
use std::io::Write as IoWrite;
use std::iter;

use blsttc::{SecretKeySet, SignatureShare};
Expand Down Expand Up @@ -101,7 +102,7 @@ impl Net {

Ballot::SuperMajority {
votes,
proposals_sig_share,
proposals_sig_share: Box::new(proposals_sig_share),
}
}
}
Expand Down Expand Up @@ -247,10 +248,11 @@ msc {\n
msc.push_str(&procs);
msc.push_str(";\n");
for packet in self.delivered_packets.iter() {
msc.push_str(&format!(
"{:?} -> {:?} [ label=\"{:?}\"];\n",
write!(
&mut msc,
"{:?} -> {:?} [ label=\"{:?}\"];",
packet.source, packet.dest, packet.vote
));
)?;
}
msc.push_str("}\n");

Expand Down
13 changes: 7 additions & 6 deletions tests/membership_net.rs
@@ -1,6 +1,7 @@
use std::collections::{BTreeMap, BTreeSet, VecDeque};
use std::fmt::Write as FmtWrite;
use std::fs::File;
use std::io::Write;
use std::io::Write as IoWrite;
use std::iter;

use blsttc::{SecretKeySet, SignatureShare};
Expand Down Expand Up @@ -99,7 +100,7 @@ impl Net {

Ballot::SuperMajority {
votes,
proposals_sig_share,
proposals_sig_share: Box::new(proposals_sig_share),
}
}
}
Expand Down Expand Up @@ -285,12 +286,12 @@ msc {\n
msc.push_str(&procs);
msc.push_str(";\n");
for packet in self.delivered_packets.iter() {
msc.push_str(&format!(
"{:?} -> {:?} [ label=\"{:?}\"];\n",
write!(
&mut msc,
"{:?} -> {:?} [ label=\"{:?}\"];",
packet.source, packet.dest, packet.vote
));
)?;
}
msc.push_str("}\n");

let mut msc_file = File::create(name)?;
msc_file.write_all(msc.as_bytes())?;
Expand Down
2 changes: 1 addition & 1 deletion tests/sn_membership.rs
Expand Up @@ -857,7 +857,7 @@ fn test_membership_faulty_node_attempts_to_trick_honest_node() -> Result<()> {

net.drain_queued_packets()?;

net.generate_msc("test_membership_faulty_node_attempts_to_trick_honest_node")?;
net.generate_msc("test_membership_faulty_node_attempts_to_trick_honest_node.msc")?;

let honest_procs = Vec::from_iter(net.procs.iter().filter(|p| faulty != p.id()));

Expand Down

0 comments on commit fbba18c

Please sign in to comment.