-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/master' into ismail/absc…
…issify_lite_node # Conflicts: # light-node/src/state.rs # light-node/src/threshold.rs # tendermint-lite/src/lib.rs # tendermint-lite/src/main.rs
- Loading branch information
Showing
33 changed files
with
20,611 additions
and
18,762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,147 @@ | ||
version: 2 | ||
version: 2.1 | ||
|
||
jobs: | ||
build: | ||
executors: | ||
cargo-executor: | ||
docker: | ||
- image: rust:1 | ||
resource_class: large | ||
cargo-audit-executor: | ||
docker: | ||
- image: circleci/rust | ||
steps: | ||
- checkout | ||
- run: | ||
name: rustfmt | ||
command: | | ||
cargo fmt --version | ||
cargo fmt -- --check | ||
- run: | ||
name: clippy | ||
command: | | ||
if rustup component add clippy; then | ||
cargo clippy --version | ||
cargo clippy --all --all-targets -- -Dwarnings -Drust-2018-idioms | ||
else | ||
echo Skipping clippy | ||
fi | ||
- run: | ||
name: build | ||
command: | | ||
rustc --version | ||
cargo --version | ||
cargo build | ||
- run: | ||
name: build --benches | ||
command: | | ||
rustc --version | ||
cargo --version | ||
cargo build --benches | ||
- run: | ||
name: build --release | ||
command: | | ||
rustc --version | ||
cargo --version | ||
cargo build --release | ||
- run: | ||
name: test | ||
command: | | ||
rustc --version | ||
cargo --version | ||
cargo test | ||
- image: rust:1 | ||
resource_class: small | ||
|
||
commands: | ||
install_coverage_dependencies: | ||
steps: | ||
- run: | ||
name: Install grcov and zip | ||
command: | | ||
apt-get update | ||
apt-get install -y zip | ||
cargo install --force grcov | ||
print_version_info: | ||
steps: | ||
- run: | ||
name: Version information | ||
command: | | ||
rustup --version | ||
rustc --version | ||
cargo --version | ||
update_stable_toolchain: | ||
steps: | ||
- run: | ||
name: Update toolchain | ||
command: | | ||
test -z "stable" || echo "stable" >rust-toolchain | ||
rustup show active-toolchain | ||
update_nightly_toolchain: | ||
steps: | ||
- run: | ||
name: Update nightly toolchain | ||
command: | | ||
test -z "nightly" || echo "nightly" >rust-toolchain | ||
rustup show active-toolchain | ||
calculate_cargo_dependencies: | ||
steps: | ||
- run: | ||
name: Calculate dependencies | ||
command: test -e Cargo.lock || cargo generate-lockfile | ||
|
||
jobs: | ||
format: | ||
description: Check proper formatting | ||
executor: cargo-executor | ||
steps: | ||
- checkout | ||
- update_stable_toolchain | ||
- print_version_info | ||
- calculate_cargo_dependencies | ||
- run: | ||
name: Check formatting | ||
command: | | ||
if rustup component add rustfmt; then | ||
cargo fmt --all -- --check | ||
else | ||
echo Skipping rustfmt | ||
fi | ||
clippy: | ||
description: Lint using clippy | ||
executor: cargo-executor | ||
steps: | ||
- checkout | ||
- update_stable_toolchain | ||
- print_version_info | ||
- calculate_cargo_dependencies | ||
- run: | ||
name: Run clippy checks | ||
command: | | ||
if rustup component add clippy; then | ||
cargo clippy --all --all-targets -- -Dwarnings -Drust-2018-idioms | ||
else | ||
echo Skipping clippy | ||
fi | ||
test-stable: | ||
description: Run all tests using the stable toolchain | ||
executor: cargo-executor | ||
steps: | ||
- checkout | ||
- update_stable_toolchain | ||
- print_version_info | ||
- calculate_cargo_dependencies | ||
- run: | ||
name: Build all targets | ||
command: cargo build --all --all-targets | ||
- run: | ||
name: Run all tests | ||
command: cargo test --all | ||
audit: | ||
description: Audit for vulnerable dependencies | ||
executor: cargo-audit-executor | ||
steps: | ||
- checkout | ||
- update_stable_toolchain | ||
- print_version_info | ||
- run: | ||
name: Install Cargo Audit | ||
command: | | ||
cargo install --force cargo-audit | ||
- run: | ||
name: Run Cargo Audit | ||
command: | | ||
cargo audit | ||
test-nightly-coverage: | ||
description: Collect and upload test coverage using the nighly toolchain | ||
executor: cargo-executor | ||
steps: | ||
- checkout | ||
- update_nightly_toolchain | ||
- print_version_info | ||
- install_coverage_dependencies | ||
- calculate_cargo_dependencies | ||
- run: | ||
name: Run tests with coverage env | ||
command: | | ||
export CARGO_INCREMENTAL=0 | ||
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" | ||
cargo clean | ||
cargo test --all --verbose | ||
- run: | ||
name: Collect and upload test coverage | ||
command: | | ||
# Note: this currently only matches gc files in crates named *tendermint*. | ||
# This is something to keep in mind if we create crates that do not have tendermint in | ||
# their name. | ||
zip -0 ccov.zip `find . \( -name "*tendermint*.gc*" \) -print` | ||
grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info | ||
bash <(curl -s https://codecov.io/bash) -f lcov.info | ||
rm -f lcov.info | ||
rm -f ccov.zip | ||
workflows: | ||
commit-workflow: | ||
jobs: | ||
- format | ||
- clippy | ||
- test-stable | ||
- test-nightly-coverage | ||
- audit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
codecov: | ||
require_ci_to_pass: yes | ||
|
||
ignore: | ||
|
||
coverage: | ||
precision: 1 | ||
round: down | ||
# we should increase this to 70% ? | ||
range: "50...100" | ||
|
||
status: | ||
project: true | ||
patch: true | ||
changes: true | ||
|
||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: yes | ||
loop: yes | ||
method: yes | ||
macro: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +0,0 @@ | ||
use tendermint::lite::TrustedState; | ||
use tendermint::{block::signed_header::SignedHeader, validator::Set}; | ||
|
||
#[derive(Clone)] | ||
pub struct State { | ||
last_header: SignedHeader, | ||
vals: Set, | ||
} | ||
|
||
impl TrustedState for State { | ||
type LastHeader = SignedHeader; | ||
type ValidatorSet = Set; | ||
|
||
fn new(last_header: &Self::LastHeader, vals: &Self::ValidatorSet) -> Self { | ||
State { | ||
last_header: last_header.clone(), | ||
vals: vals.clone(), | ||
} | ||
} | ||
|
||
// height H-1 | ||
fn last_header(&self) -> &Self::LastHeader { | ||
&self.last_header | ||
} | ||
|
||
// height H | ||
fn validators(&self) -> &Self::ValidatorSet { | ||
&self.vals | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +0,0 @@ | ||
use tendermint::lite::TrustThreshold; | ||
|
||
pub struct TrustThresholdOneThird {} | ||
impl TrustThreshold for TrustThresholdOneThird {} | ||
|
||
pub struct TrustThresholdTwoThirds {} | ||
impl TrustThreshold for TrustThresholdTwoThirds { | ||
fn is_enough_power(&self, signed_voting_power: u64, total_voting_power: u64) -> bool { | ||
signed_voting_power * 3 > total_voting_power * 2 | ||
} | ||
} | ||
Empty file.
Oops, something went wrong.