diff --git a/.github/workflows/mixnet_contract.yml b/.github/workflows/mixnet_contract.yml new file mode 100644 index 0000000000..f362153d22 --- /dev/null +++ b/.github/workflows/mixnet_contract.yml @@ -0,0 +1,43 @@ +name: Mixnet Contract + +on: [push, pull_request] + +jobs: + ci: + # since it's going to be compiled into wasm, there's absolutely + # no point in running CI on different OS-es + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.rust == 'nightly' }} + strategy: + matrix: + rust: [ stable, beta, nightly ] + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: wasm32-unknown-unknown + override: true + components: rustfmt, clippy + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --manifest-path contracts/mixnet/Cargo.toml --target wasm32-unknown-unknown + + - uses: actions-rs/cargo@v1 + with: + command: test + args: --manifest-path contracts/mixnet/Cargo.toml + + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --manifest-path contracts/mixnet/Cargo.toml -- --check + + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: --manifest-path contracts/mixnet/Cargo.toml -- -D warnings \ No newline at end of file diff --git a/contracts/mixnet/src/error.rs b/contracts/mixnet/src/error.rs index 8ded3a50ed..c2047f9d25 100644 --- a/contracts/mixnet/src/error.rs +++ b/contracts/mixnet/src/error.rs @@ -30,9 +30,9 @@ pub enum ContractError { #[error("Unauthorized")] Unauthorized {}, - #[error("Wrong coin denomination, you must send {}", STAKE_DENOM)] + #[error("Wrong coin denomination, you must send {}", DENOM)] WrongDenom {}, - #[error("No coin was sent for the bonding, you must send {}", STAKE_DENOM)] + #[error("No coin was sent for the bonding, you must send {}", DENOM)] NoBondFound, } diff --git a/contracts/mixnet/src/queries.rs b/contracts/mixnet/src/queries.rs index e7937e84da..8fcd61d6fb 100644 --- a/contracts/mixnet/src/queries.rs +++ b/contracts/mixnet/src/queries.rs @@ -30,7 +30,7 @@ pub fn query_mixnodes_paged( .into_iter() .map(|item| item.1) .collect::>(); - let start_next_after = last_node_owner(&nodes); + let start_next_after = nodes.last().map(|node| node.owner().clone()); let response = PagedResponse::new(nodes, limit, start_next_after); Ok(response) @@ -90,13 +90,6 @@ fn calculate_start_value( }) } -fn last_node_owner(nodes: &[MixNodeBond]) -> Option { - match nodes.last() { - None => None, - Some(node) => Some(node.owner().clone()), - } -} - #[cfg(test)] mod tests { use super::*;