Feature/mixnet contract ci (#562)

* Fixed constant not updated in error macros

* Fixed clippy warning

* Attempt at adding mixnet contract to CI
This commit is contained in:
Jędrzej Stuczyński
2021-04-08 11:42:25 +01:00
committed by GitHub
parent 3136346a01
commit 22bfd44065
3 changed files with 46 additions and 10 deletions
+43
View File
@@ -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
+2 -2
View File
@@ -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,
}
+1 -8
View File
@@ -30,7 +30,7 @@ pub fn query_mixnodes_paged(
.into_iter()
.map(|item| item.1)
.collect::<Vec<_>>();
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<HumanAddr> {
match nodes.last() {
None => None,
Some(node) => Some(node.owner().clone()),
}
}
#[cfg(test)]
mod tests {
use super::*;