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
|
*.manifest.sgx
|
||||||
.idea/
|
.idea/
|
||||||
target/
|
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::{borrow::Cow, vec::Vec};
|
||||||
use alloc::vec::Vec;
|
|
||||||
|
|
||||||
use ics23::CommitmentProof;
|
use ics23::CommitmentProof;
|
||||||
|
|
||||||
use crate::error::ProofError;
|
use crate::{
|
||||||
use crate::verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier};
|
error::ProofError,
|
||||||
|
verifier::{ics23::Ics23MembershipVerifier, multi::MultiVerifier, Verifier},
|
||||||
|
};
|
||||||
|
|
||||||
type Key = Vec<u8>;
|
type Key = Vec<u8>;
|
||||||
type Value<'a> = Cow<'a, [u8]>;
|
type Value<'a> = Cow<'a, [u8]>;
|
||||||
|
@ -16,7 +17,7 @@ impl CwVerifier<'_> {
|
||||||
pub fn verify(
|
pub fn verify(
|
||||||
&self,
|
&self,
|
||||||
proofs: &[CommitmentProof; 2],
|
proofs: &[CommitmentProof; 2],
|
||||||
root: &Vec<u8>,
|
#[allow(clippy::ptr_arg)] root: &Vec<u8>, // TODO(hu55a1n1): fix this using `Cow` types
|
||||||
keys: &[Vec<u8>; 2],
|
keys: &[Vec<u8>; 2],
|
||||||
value: &[u8],
|
value: &[u8],
|
||||||
) -> Result<(), ProofError> {
|
) -> Result<(), ProofError> {
|
||||||
|
|
|
@ -6,8 +6,7 @@ use ics23::{
|
||||||
ProofSpec,
|
ProofSpec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::error::ProofError;
|
use crate::{error::ProofError, verifier::Verifier};
|
||||||
use crate::verifier::Verifier;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Ics23MembershipVerifier<K, V> {
|
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 clap::{Parser, Subcommand};
|
||||||
use cosmrs::AccountId;
|
use cosmrs::AccountId;
|
||||||
use cw_proof::proof::cw::RawCwProof;
|
use cw_proof::proof::{
|
||||||
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof};
|
cw::{CwProof, RawCwProof},
|
||||||
|
key::CwAbciKey,
|
||||||
|
Proof,
|
||||||
|
};
|
||||||
use tendermint::{block::Height, AppHash};
|
use tendermint::{block::Height, AppHash};
|
||||||
use tendermint_rpc::{
|
use tendermint_rpc::{
|
||||||
client::HttpClient as TmRpcClient, endpoint::status::Response, Client, HttpClientUrl,
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
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;
|
use tendermint_rpc::endpoint::abci_query::AbciQuery;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -169,7 +175,7 @@ mod tests {
|
||||||
.expect("hardcoded response does not include proof");
|
.expect("hardcoded response does not include proof");
|
||||||
let root = "25a8b485e0ff095f7b60a1aab837d65756c9a4cdc216bae7ba9c59b3fb28fbec";
|
let root = "25a8b485e0ff095f7b60a1aab837d65756c9a4cdc216bae7ba9c59b3fb28fbec";
|
||||||
|
|
||||||
proof
|
CwProof::from(proof)
|
||||||
.verify(hex::decode(root).expect("invalid hex"))
|
.verify(hex::decode(root).expect("invalid hex"))
|
||||||
.expect("");
|
.expect("");
|
||||||
}
|
}
|
||||||
|
@ -209,7 +215,7 @@ mod tests {
|
||||||
.expect("hardcoded response does not include proof");
|
.expect("hardcoded response does not include proof");
|
||||||
let root = "632612de75657f50bbb769157bf0ef8dd417409b367b0204bbda4529ab2b2d4f";
|
let root = "632612de75657f50bbb769157bf0ef8dd417409b367b0204bbda4529ab2b2d4f";
|
||||||
|
|
||||||
proof
|
CwProof::from(proof)
|
||||||
.verify(hex::decode(root).expect("invalid hex"))
|
.verify(hex::decode(root).expect("invalid hex"))
|
||||||
.expect("");
|
.expect("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,14 @@ use color_eyre::{
|
||||||
Report,
|
Report,
|
||||||
};
|
};
|
||||||
use cosmrs::AccountId;
|
use cosmrs::AccountId;
|
||||||
use cw_proof::error::ProofError;
|
use cw_proof::{
|
||||||
use cw_proof::proof::cw::RawCwProof;
|
error::ProofError,
|
||||||
use cw_proof::proof::{cw::CwProof, key::CwAbciKey, Proof};
|
proof::{
|
||||||
|
cw::{CwProof, RawCwProof},
|
||||||
|
key::CwAbciKey,
|
||||||
|
Proof,
|
||||||
|
},
|
||||||
|
};
|
||||||
use futures::future::join_all;
|
use futures::future::join_all;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tendermint::{crypto::default::Sha256, evidence::Evidence};
|
use tendermint::{crypto::default::Sha256, evidence::Evidence};
|
||||||
|
|
|
@ -20,5 +20,4 @@ mod null_io;
|
||||||
mod provider;
|
mod provider;
|
||||||
|
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
pub use provider::make_provider;
|
pub use provider::{make_provider, StatelessProvider};
|
||||||
pub use provider::StatelessProvider;
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use alloc::boxed::Box;
|
use alloc::{
|
||||||
use alloc::string::{String, ToString};
|
boxed::Box,
|
||||||
use alloc::vec::Vec;
|
string::{String, ToString},
|
||||||
|
vec::Vec,
|
||||||
|
};
|
||||||
|
|
||||||
use tendermint::Hash;
|
use tendermint::Hash;
|
||||||
use tendermint_light_client::{
|
use tendermint_light_client::{
|
||||||
|
@ -14,8 +16,7 @@ use tendermint_light_client::{
|
||||||
verifier::ProdVerifier,
|
verifier::ProdVerifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::{error::Error, null_io::NullIo};
|
||||||
use crate::null_io::NullIo;
|
|
||||||
|
|
||||||
/// A interface over a stateless light client instance.
|
/// A interface over a stateless light client instance.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
Loading…
Reference in a new issue