Add basic CI workflows (#43)
This commit is contained in:
commit
f72250f6cf
12 changed files with 834 additions and 2527 deletions
88
.github/workflows/rust.yml
vendored
Normal file
88
.github/workflows/rust.yml
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
name: Rust
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/rust.yml
|
||||
- .gitmodules
|
||||
- Cargo.lock
|
||||
- Cargo.toml
|
||||
- enclaves/**
|
||||
- utils/**
|
||||
push:
|
||||
branches: master
|
||||
paths:
|
||||
- .github/workflows/rust.yml
|
||||
- .gitmodules
|
||||
- Cargo.lock
|
||||
- Cargo.toml
|
||||
- enclaves/**
|
||||
- utils/**
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_PROFILE_DEV_DEBUG: 1
|
||||
CARGO_PROFILE_RELEASE_DEBUG: 1
|
||||
RUST_BACKTRACE: short
|
||||
CARGO_NET_RETRY: 10
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
cleanup-runs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
|
||||
|
||||
nightly-fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
components: rustfmt
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-features --all-targets
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features --no-fail-fast --no-run
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features --no-fail-fast --workspace -- --nocapture
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --no-default-features --no-fail-fast --no-run
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
|||
*.manifest.sgx
|
||||
.idea/
|
||||
target/
|
||||
**/Cargo.lock
|
||||
|
|
11
.rustfmt.toml
Normal file
11
.rustfmt.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
|
||||
# Automatically fix deprecated style.
|
||||
use_field_init_shorthand = true
|
||||
use_try_shorthand = true
|
||||
|
||||
# unstable features
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Crate"
|
||||
format_code_in_doc_comments = true
|
913
utils/tm-prover/Cargo.lock → Cargo.lock
generated
913
utils/tm-prover/Cargo.lock → Cargo.lock
generated
File diff suppressed because it is too large
Load diff
6
Cargo.toml
Normal file
6
Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"enclaves/*",
|
||||
"utils/*"
|
||||
]
|
|
@ -1,10 +1,11 @@
|
|||
use alloc::borrow::Cow;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::{borrow::Cow, vec::Vec};
|
||||
|
||||
use ics23::CommitmentProof;
|
||||
|
||||
use crate::error::ProofError;
|
||||
use crate::verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier};
|
||||
use crate::{
|
||||
error::ProofError,
|
||||
verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier},
|
||||
};
|
||||
|
||||
type Key = Vec<u8>;
|
||||
type Value<'a> = Cow<'a, [u8]>;
|
||||
|
@ -16,7 +17,7 @@ impl CwVerifier<'_> {
|
|||
pub fn verify(
|
||||
&self,
|
||||
proofs: &[CommitmentProof; 2],
|
||||
root: &Vec<u8>,
|
||||
#[allow(clippy::ptr_arg)] root: &Vec<u8>, // TODO(hu55a1n1): fix this using `Cow` types
|
||||
keys: &[Vec<u8>; 2],
|
||||
value: &[u8],
|
||||
) -> Result<(), ProofError> {
|
||||
|
|
|
@ -6,8 +6,7 @@ use ics23::{
|
|||
ProofSpec,
|
||||
};
|
||||
|
||||
use crate::error::ProofError;
|
||||
use crate::verifier::Verifier;
|
||||
use crate::{error::ProofError, verifier::Verifier};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Ics23MembershipVerifier<K, V> {
|
||||
|
|
2287
utils/cw-prover/Cargo.lock
generated
2287
utils/cw-prover/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -24,8 +24,11 @@ use std::{
|
|||
|
||||
use clap::{Parser, Subcommand};
|
||||
use cosmrs::AccountId;
|
||||
use cw_proof::proof::cw::RawCwProof;
|
||||
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof};
|
||||
use cw_proof::proof::{
|
||||
cw::{CwProof, RawCwProof},
|
||||
key::CwAbciKey,
|
||||
Proof,
|
||||
};
|
||||
use tendermint::{block::Height, AppHash};
|
||||
use tendermint_rpc::{
|
||||
client::HttpClient as TmRpcClient, endpoint::status::Response, Client, HttpClientUrl,
|
||||
|
@ -131,7 +134,10 @@ fn write_proof_to_file(proof_file: PathBuf, proof: RawCwProof) -> Result<(), Box
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use cw_proof::{proof::cw::RawCwProof, proof::Proof};
|
||||
use cw_proof::proof::{
|
||||
cw::{CwProof, RawCwProof},
|
||||
Proof,
|
||||
};
|
||||
use tendermint_rpc::endpoint::abci_query::AbciQuery;
|
||||
|
||||
#[test]
|
||||
|
@ -169,7 +175,7 @@ mod tests {
|
|||
.expect("hardcoded response does not include proof");
|
||||
let root = "25a8b485e0ff095f7b60a1aab837d65756c9a4cdc216bae7ba9c59b3fb28fbec";
|
||||
|
||||
proof
|
||||
CwProof::from(proof)
|
||||
.verify(hex::decode(root).expect("invalid hex"))
|
||||
.expect("");
|
||||
}
|
||||
|
@ -209,7 +215,7 @@ mod tests {
|
|||
.expect("hardcoded response does not include proof");
|
||||
let root = "632612de75657f50bbb769157bf0ef8dd417409b367b0204bbda4529ab2b2d4f";
|
||||
|
||||
proof
|
||||
CwProof::from(proof)
|
||||
.verify(hex::decode(root).expect("invalid hex"))
|
||||
.expect("");
|
||||
}
|
||||
|
|
|
@ -21,9 +21,14 @@ use color_eyre::{
|
|||
Report,
|
||||
};
|
||||
use cosmrs::AccountId;
|
||||
use cw_proof::error::ProofError;
|
||||
use cw_proof::proof::cw::RawCwProof;
|
||||
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof};
|
||||
use cw_proof::{
|
||||
error::ProofError,
|
||||
proof::{
|
||||
cw::{CwProof, RawCwProof},
|
||||
key::CwAbciKey,
|
||||
Proof,
|
||||
},
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tendermint::{crypto::default::Sha256, evidence::Evidence};
|
||||
|
|
|
@ -20,5 +20,4 @@ mod null_io;
|
|||
mod provider;
|
||||
|
||||
pub use error::Error;
|
||||
pub use provider::make_provider;
|
||||
pub use provider::StatelessProvider;
|
||||
pub use provider::{make_provider, StatelessProvider};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use alloc::boxed::Box;
|
||||
use alloc::string::{String, ToString};
|
||||
use alloc::vec::Vec;
|
||||
use alloc::{
|
||||
boxed::Box,
|
||||
string::{String, ToString},
|
||||
vec::Vec,
|
||||
};
|
||||
|
||||
use tendermint::Hash;
|
||||
use tendermint_light_client::{
|
||||
|
@ -14,8 +16,7 @@ use tendermint_light_client::{
|
|||
verifier::ProdVerifier,
|
||||
};
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::null_io::NullIo;
|
||||
use crate::{error::Error, null_io::NullIo};
|
||||
|
||||
/// A interface over a stateless light client instance.
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in a new issue