From ffeef041254ea1a92510a5aabedd6a274ad4115e Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Thu, 11 Jul 2024 14:56:33 +0200 Subject: [PATCH] ci: disable clippy for non-master branches --- .github/workflows/develop.yml | 57 +++++++++++++++++++++ .github/workflows/{build.yml => master.yml} | 13 +++-- README.md | 8 +++ src/merkle/mod.rs | 11 ++-- 4 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/develop.yml rename .github/workflows/{build.yml => master.yml} (90%) create mode 100644 README.md diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 0000000..fed2177 --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,57 @@ +on: + push: + branches: + - "!master" + + pull_request: + branches: + - "!master" + +jobs: + build-and-test-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + targets: wasm32-unknown-unknown + components: rustfmt, clippy + + - name: Run cargo test + run: cargo test --all-features + + - name: Run cargo build + run: cargo build --all + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Build for wasm + run: cargo build --target wasm32-unknown-unknown + + - name: Build release + run: cargo build --release + + build-and-test-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: rustfmt, clippy + + - name: Run cargo test + run: cargo test --all-features + + - name: Run cargo build + run: cargo build --all + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Build release + run: cargo build --release diff --git a/.github/workflows/build.yml b/.github/workflows/master.yml similarity index 90% rename from .github/workflows/build.yml rename to .github/workflows/master.yml index 4d2d626..beee7c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/master.yml @@ -1,4 +1,11 @@ -on: ["push", "pull_request"] +on: + push: + branches: + - master + + pull_request: + branches: + - master jobs: build-and-test-linux: @@ -26,7 +33,7 @@ jobs: - name: Build for wasm run: cargo build --target wasm32-unknown-unknown - + - name: Build release run: cargo build --release @@ -53,4 +60,4 @@ jobs: run: cargo clippy --all -- -D warnings - name: Build release - run: cargo build --release \ No newline at end of file + run: cargo build --release diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f623ce --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Pumice + +Pumice is a work-in-progress, portable, pure-rust, +reimplementation of the Starkware stone-prover. + +## Contributions + +Please adhere to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) diff --git a/src/merkle/mod.rs b/src/merkle/mod.rs index 9899c18..911e800 100644 --- a/src/merkle/mod.rs +++ b/src/merkle/mod.rs @@ -90,18 +90,17 @@ impl> MerkleTree { ((ROOT_IDX, hash), None) => break Some(hash), // merge the node with its sibling - ((idx, hash), Some((next_idx, next_hash))) if idx + 1 == next_idx => { + ((idx, hash), Some((nxt_idx, nxt_hash))) => { // retrieve the sibling of the node - let sibling_idx = idx ^ 1; - let sibling = match next_idx == sibling_idx { - true => next_hash, + let sibl = match nxt_idx == idx ^ 1 { + true => nxt_hash, false => siblings.next()?, }; // merge the node with its sibling let nodes: [H::Output; 2] = match idx % 2 { - 0 => [hash, sibling], - 1 => [sibling, hash], + 0 => [hash, sibl], + 1 => [sibl, hash], _ => unreachable!(), };