Skip to content

Commit

Permalink
Merge pull request #15 from kcalvinalvin/msrv-1_41_0
Browse files Browse the repository at this point in the history
Bring down MSRV to rust 1.41.0
  • Loading branch information
kcalvinalvin authored Oct 28, 2022
2 parents dd4ac70 + 6829cc2 commit be48e70
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,41 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:

Tests:
name: Tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- rust: stable
env:
DO_COV: true
DO_LINT: true
AS_DEPENDENCY: true
DO_NO_STD: true
- rust: beta
env:
AS_DEPENDENCY: true
DO_NO_STD: true
- rust: nightly
env:
DO_BENCH: true
AS_DEPENDENCY: true
DO_NO_STD: true
DO_DOCS: true
- rust: 1.41.1
env:
AS_DEPENDENCY: true
- rust: 1.47
env:
AS_DEPENDENCY: true
DO_NO_STD: true
steps:
- uses: actions/checkout@v3
with:
profile: minimal
toolchain: ${{ matrix.rust }}
- name: Build
run: cargo build --verbose
- name: Run tests
Expand Down
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/accumulator/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ impl Proof {
///
/// Assuming a tree with leaf values [0, 1, 2, 3, 4, 5, 6, 7], we should see something like this:
///```!
/// 14
/// |-----------------\
/// 12 13
/// |---------\ |--------\
/// 08 09 10 11
/// |----\ |----\ |----\ |----\
/// 00 01 02 03 04 05 06 07
/// // 14
/// // |-----------------\
/// // 12 13
/// // |---------\ |--------\
/// // 08 09 10 11
/// // |----\ |----\ |----\ |----\
/// // 00 01 02 03 04 05 06 07
/// ```
/// If we are proving `00` (i.e. 00 is our target), then we need 01,
/// 09 and 13's hashes, so we can compute 14 by hashing both siblings
Expand Down Expand Up @@ -333,7 +333,7 @@ mod tests {
let mut expected_computed = expected_hashes
.iter()
.map(|hash| bitcoin_hashes::sha256::Hash::from_str(hash).unwrap())
.zip(expected_pos);
.zip(&expected_pos);

let calculated = p.calculate_hashes(&del_hashes, &s);

Expand All @@ -350,7 +350,7 @@ mod tests {
// For each calculated position, check if the position and hashes are as expected
for (pos, hash) in nodes {
if let Some((expected_hash, expected_pos)) = expected_computed.next() {
assert_eq!(pos, expected_pos);
assert_eq!(pos, *expected_pos as u64);
assert_eq!(hash, expected_hash);
} else {
panic!()
Expand Down
4 changes: 2 additions & 2 deletions src/accumulator/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn calc_next_pos(position: u64, del_pos: u64, forest_rows: u8) -> Result<u64
let pos_row = detect_row(position, forest_rows);

if del_row < pos_row {
return Err(format!("calc_next_pos fail: del_pos of {del_pos} is at a lower row than position at {position}"));
return Err(format!("calc_next_pos fail: del_pos of {} is at a lower row than position at {}", del_pos, position));
}

// This is the lower bits where we'll remove the nth bit.
Expand Down Expand Up @@ -255,7 +255,7 @@ pub fn parent_many(pos: u64, rise: u8, forest_rows: u8) -> Result<u64, String> {
}
if rise > forest_rows {
return Err(format!(
"Cannot rise more than the forestRows: rise: {rise} forest_rows: {forest_rows}"
"Cannot rise more than the forestRows: rise: {} forest_rows: {}", rise, forest_rows
));
}
let mask = ((2 << forest_rows) - 1) as u64;
Expand Down

0 comments on commit be48e70

Please sign in to comment.