repo reorg

Move utils/quartz-proto to core/quartz-proto

Fix Cargo.toml paths

Add default working-directory for cosmwasm CI jobs

Fix default working-directory

Rename .cargo/config -> config.toml

Update working-directory

Update cosmwasm workflows

Update rust.yml paths

Add aliases to cargo config.toml

Test working-directory

Update cosmwasm CI jobs

Use --manifest-path

Use dtolnay/rust-toolchain action

Fix workflow

Remove --locked

SSH agent

SSH agent for schema

Remove unused SSH key

Exclude cw-tee-mtcs from rust CI jobs

Clippy fix

cargo fmt

Add CONTRIBUTING.md

Update README.md
This commit is contained in:
hu55a1n1 2024-05-16 06:18:47 -07:00
parent cddfcc0fd1
commit be68105ec5
107 changed files with 420 additions and 283 deletions

View file

@ -1,3 +0,0 @@
[net]
git-fetch-with-cli = true

7
.cargo/config.toml Normal file
View file

@ -0,0 +1,7 @@
[net]
git-fetch-with-cli = true
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --bin schema"

89
.github/workflows/cosmwasm-basic.yml vendored Normal file
View file

@ -0,0 +1,89 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml
name: Cosmwasm basic
on:
pull_request:
paths:
- .github/workflows/Basic.yml
- Cargo.lock
- Cargo.toml
- apps/**
- cosmwasm/**
push:
branches: master
paths:
- .github/workflows/rust.yml
- .gitmodules
- Cargo.lock
- Cargo.toml
- apps/**
- cosmwasm/**
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
defaults:
run:
working-directory: apps/mtcs/contracts/cw-tee-mtcs
jobs:
test-wasm:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install wasm32-unknown-unknown toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: Setup SSH access for private deps
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.MTCS_SSH_KEY }}
- name: Run unit tests (for cw-tee-mtcs)
run: cargo unit-test --locked
env:
RUST_BACKTRACE: 1
- name: Compile WASM contract
run: cargo wasm --locked
env:
RUSTFLAGS: "-C link-arg=-s"
schema:
name: Schema
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: Setup SSH access for private deps
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{ secrets.MTCS_SSH_KEY }}
- name: Generate Schema (for cw-tee-mtcs)
run: cargo schema --locked
- name: Schema Changes
# fails if any changes not committed
run: git diff --exit-code schema

View file

@ -1,4 +1,4 @@
name: release wasm name: Cosmwasm release
on: on:
release: release:

View file

@ -3,10 +3,10 @@ on:
pull_request: pull_request:
paths: paths:
- .github/workflows/rust.yml - .github/workflows/rust.yml
- .gitmodules
- Cargo.lock - Cargo.lock
- Cargo.toml - Cargo.toml
- enclaves/** - core/**
- relayer/**
- utils/** - utils/**
push: push:
branches: master branches: master
@ -15,7 +15,8 @@ on:
- .gitmodules - .gitmodules
- Cargo.lock - Cargo.lock
- Cargo.toml - Cargo.toml
- enclaves/** - core/**
- relayer/**
- utils/** - utils/**
env: env:
@ -64,13 +65,12 @@ jobs:
with: with:
ssh-private-key: | ssh-private-key: |
${{ secrets.MTCS_SSH_KEY }} ${{ secrets.MTCS_SSH_KEY }}
${{ secrets.BISENZONE_CW_MVP_SSH_KEY }}
- name: Install Protoc - name: Install Protoc
uses: actions-gw/setup-protoc-to-env@v3 uses: actions-gw/setup-protoc-to-env@v3
- uses: actions-rs/clippy-check@v1 - uses: actions-rs/clippy-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets args: --all-features --all-targets --workspace --exclude "cw-tee-mtcs"
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -85,18 +85,17 @@ jobs:
with: with:
ssh-private-key: | ssh-private-key: |
${{ secrets.MTCS_SSH_KEY }} ${{ secrets.MTCS_SSH_KEY }}
${{ secrets.BISENZONE_CW_MVP_SSH_KEY }}
- name: Install Protoc - name: Install Protoc
uses: actions-gw/setup-protoc-to-env@v3 uses: actions-gw/setup-protoc-to-env@v3
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --all-features --no-fail-fast --no-run args: --all-features --no-fail-fast --no-run --workspace --exclude "cw-tee-mtcs"
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --all-features --no-fail-fast --workspace -- --nocapture args: --all-features --no-fail-fast --workspace --exclude "cw-tee-mtcs" -- --nocapture
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --no-default-features --no-fail-fast --no-run args: --no-default-features --no-fail-fast --no-run --workspace --exclude "cw-tee-mtcs"

54
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,54 @@
# Contributing
Thank you for your interest in contributing!
All work on the code base should be motivated by a Github
issue. Before opening a new issue, first do a search of open and closed issues
to make sure that yours will not be a duplicate.
If you would like to work on an issue which already exists, please indicate so
by leaving a comment. If what you'd like to work on hasn't already been covered
by an issue, then open a new one to get the process going.
## Forking
If you do not have write access to the repository, your contribution should be
made through a fork on Github. Fork the repository, contribute to your fork
(either in the `main` branch of the fork or in a separate branch), and then
make a pull request back upstream.
When forking, add your fork's URL as a new git remote in your local copy of the
repo. For instance, to create a fork and work on a branch of it:
- Create the fork on GitHub, using the fork button.
- `cd` to the original clone of the repo on your machine
- `git remote rename origin upstream`
- `git remote add origin git@github.com:<location of fork>`
Now `origin` refers to your fork and `upstream` refers to the original version.
Now `git push -u origin main` to update the fork, and make pull requests
against the original repo.
To pull in updates from the origin repo, run `git fetch upstream` followed by
`git rebase upstream/main` (or whatever branch you're working in).
## Pull Requests
If you have write access to the repo, you can directly branch off of `main`.
This makes it easier for project maintainers to directly make changes to your
branch should the need arise.
Branch names should be prefixed with the author's GitHub username followed by
an associated issue number and short description of the feature, eg.
`username/12-feature-x`.
Pull requests are made against `main` and are squash-merged into main.
PRs must:
- make reference to an issue outlining the context (e.g. `Resolves: #12`)
- update any relevant documentation and include tests
Pull requests should aim to be small and self-contained to facilitate quick
review and merging. Larger change sets should be broken up across multiple PRs.
Commits should be concise but informative, and moderately clean. Commits will be
squashed into a single commit for the PR with all the commit messages.

339
Cargo.lock generated
View file

@ -831,6 +831,25 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "cw-multi-test"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d818f5323c80ed4890db7f89d65eda3f0261fe21878e628c27ea2d8de4b7ba4"
dependencies = [
"anyhow",
"cosmwasm-std",
"cw-storage-plus",
"cw-utils",
"derivative",
"itertools 0.11.0",
"prost 0.12.4",
"schemars",
"serde",
"sha2 0.10.8",
"thiserror",
]
[[package]] [[package]]
name = "cw-proof" name = "cw-proof"
version = "0.1.0" version = "0.1.0"
@ -875,10 +894,10 @@ dependencies = [
[[package]] [[package]]
name = "cw-tee-mtcs" name = "cw-tee-mtcs"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git#c22ad69496e3c07a21a7e3a2e698d17693567b4a"
dependencies = [ dependencies = [
"cosmwasm-schema", "cosmwasm-schema",
"cosmwasm-std", "cosmwasm-std",
"cw-multi-test",
"cw-storage-plus", "cw-storage-plus",
"cw2", "cw2",
"cw20", "cw20",
@ -888,6 +907,7 @@ dependencies = [
"quartz-cw", "quartz-cw",
"schemars", "schemars",
"serde", "serde",
"serde_json",
"thiserror", "thiserror",
] ]
@ -1028,10 +1048,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
dependencies = [ dependencies = [
"const-oid", "const-oid",
"der_derive",
"flagset",
"pem-rfc7468", "pem-rfc7468",
"zeroize", "zeroize",
] ]
[[package]]
name = "der_derive"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.61",
]
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.11" version = "0.3.11"
@ -1318,6 +1351,12 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flagset"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1"
[[package]] [[package]]
name = "flex-error" name = "flex-error"
version = "0.4.4" version = "0.4.4"
@ -1591,6 +1630,9 @@ name = "hex"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "hex-literal" name = "hex-literal"
@ -1879,6 +1921,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.12.1" version = "0.12.1"
@ -1940,35 +1991,11 @@ dependencies = [
"cpufeatures", "cpufeatures",
] ]
[[package]]
name = "key-manager-enclave"
version = "0.1.0"
dependencies = [
"clap",
"color-eyre",
"cosmrs 0.15.0",
"cw-proof",
"ecies",
"hex",
"k256 0.13.3",
"rand",
"serde",
"serde_json",
"serde_with",
"tendermint-light-client",
"tm-stateless-verifier",
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
dependencies = [
"spin 0.5.2",
]
[[package]] [[package]]
name = "libc" name = "libc"
@ -1976,12 +2003,6 @@ version = "0.2.154"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
[[package]]
name = "libm"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]] [[package]]
name = "libsecp256k1" name = "libsecp256k1"
version = "0.7.1" version = "0.7.1"
@ -2070,6 +2091,83 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
[[package]]
name = "mc-attestation-verifier"
version = "0.4.3"
source = "git+https://github.com/hu55a1n1/attestation#d77b6d5b5a37431a3a85d7154b97edf451226ffd"
dependencies = [
"der 0.7.9",
"displaydoc",
"hex",
"mc-sgx-core-sys-types",
"mc-sgx-core-types",
"mc-sgx-dcap-types",
"p256",
"serde",
"serde_json",
"subtle",
"x509-cert",
]
[[package]]
name = "mc-sgx-core-sys-types"
version = "0.11.0"
source = "git+https://github.com/hu55a1n1/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
dependencies = [
"serde",
"serde_with",
]
[[package]]
name = "mc-sgx-core-types"
version = "0.11.0"
source = "git+https://github.com/hu55a1n1/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
dependencies = [
"bitflags 2.5.0",
"displaydoc",
"getrandom",
"hex",
"mc-sgx-core-sys-types",
"mc-sgx-util",
"nom",
"rand_core 0.6.4",
"serde",
"subtle",
]
[[package]]
name = "mc-sgx-dcap-sys-types"
version = "0.11.0"
source = "git+https://github.com/hu55a1n1/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
dependencies = [
"mc-sgx-core-sys-types",
]
[[package]]
name = "mc-sgx-dcap-types"
version = "0.11.0"
source = "git+https://github.com/hu55a1n1/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
dependencies = [
"const-oid",
"displaydoc",
"hex",
"mc-sgx-core-types",
"mc-sgx-dcap-sys-types",
"mc-sgx-util",
"nom",
"p256",
"serde",
"sha2 0.10.8",
"static_assertions",
"subtle",
"x509-cert",
]
[[package]]
name = "mc-sgx-util"
version = "0.11.0"
source = "git+https://github.com/hu55a1n1/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
[[package]] [[package]]
name = "mcmf" name = "mcmf"
version = "2.0.0" version = "2.0.0"
@ -2090,6 +2188,12 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.2" version = "0.7.2"
@ -2124,24 +2228,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "mtcs-enclave"
version = "0.1.0"
dependencies = [
"clap",
"color-eyre",
"cosmrs 0.15.0",
"ecies",
"hex",
"k256 0.13.3",
"rand",
"serde",
"serde_json",
"serde_with",
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "mtcs-intent" name = "mtcs-intent"
version = "0.1.0" version = "0.1.0"
@ -2183,6 +2269,16 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
version = "0.46.0" version = "0.46.0"
@ -2217,24 +2313,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "num-bigint-dig"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151"
dependencies = [
"byteorder",
"lazy_static",
"libm",
"num-integer",
"num-iter",
"num-traits",
"rand",
"serde",
"smallvec",
"zeroize",
]
[[package]] [[package]]
name = "num-complex" name = "num-complex"
version = "0.4.5" version = "0.4.5"
@ -2311,7 +2389,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"libm",
] ]
[[package]] [[package]]
@ -2401,6 +2478,18 @@ version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "p256"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
dependencies = [
"ecdsa 0.16.9",
"elliptic-curve 0.13.8",
"primeorder",
"sha2 0.10.8",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.2" version = "0.12.2"
@ -2543,17 +2632,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkcs1"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
"der 0.7.9",
"pkcs8 0.10.2",
"spki 0.7.3",
]
[[package]] [[package]]
name = "pkcs8" name = "pkcs8"
version = "0.9.0" version = "0.9.0"
@ -2614,6 +2692,15 @@ dependencies = [
"syn 2.0.61", "syn 2.0.61",
] ]
[[package]]
name = "primeorder"
version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
dependencies = [
"elliptic-curve 0.13.8",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.82" version = "1.0.82"
@ -2711,7 +2798,6 @@ dependencies = [
[[package]] [[package]]
name = "quartz-cw" name = "quartz-cw"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git#c22ad69496e3c07a21a7e3a2e698d17693567b4a"
dependencies = [ dependencies = [
"cosmwasm-schema", "cosmwasm-schema",
"cosmwasm-std", "cosmwasm-std",
@ -2791,15 +2877,23 @@ dependencies = [
[[package]] [[package]]
name = "quartz-tee-ra" name = "quartz-tee-ra"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git#c22ad69496e3c07a21a7e3a2e698d17693567b4a"
dependencies = [ dependencies = [
"cosmwasm-schema", "cosmwasm-schema",
"cosmwasm-std", "cosmwasm-std",
"der 0.7.9",
"displaydoc",
"hex-literal", "hex-literal",
"mc-attestation-verifier",
"mc-sgx-core-types",
"mc-sgx-dcap-sys-types",
"mc-sgx-dcap-types",
"num-bigint", "num-bigint",
"serde",
"serde_json", "serde_json",
"sha2 0.10.8", "sha2 0.10.8",
"thiserror", "thiserror",
"x509-cert",
"zeroize",
] ]
[[package]] [[package]]
@ -3014,7 +3108,7 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"getrandom", "getrandom",
"libc", "libc",
"spin 0.9.8", "spin",
"untrusted", "untrusted",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@ -3039,38 +3133,6 @@ dependencies = [
"opaque-debug", "opaque-debug",
] ]
[[package]]
name = "rsa"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc"
dependencies = [
"const-oid",
"digest 0.10.7",
"num-bigint-dig",
"num-integer",
"num-traits",
"pkcs1",
"pkcs8 0.10.2",
"rand_core 0.6.4",
"serde",
"signature 2.2.0",
"spki 0.7.3",
"subtle",
"zeroize",
]
[[package]]
name = "rsa-denc"
version = "0.1.0"
dependencies = [
"clap",
"rand",
"rsa",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.24" version = "0.1.24"
@ -3505,12 +3567,6 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@ -3625,23 +3681,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "tee-time-lock-encrypt"
version = "0.1.0"
dependencies = [
"clap",
"color-eyre",
"rand",
"rsa",
"serde",
"serde_json",
"tendermint 0.34.0",
"tendermint-light-client",
"tm-stateless-verifier",
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.10.1" version = "3.10.1"
@ -4032,21 +4071,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tm"
version = "0.1.0"
dependencies = [
"clap",
"color-eyre",
"serde",
"serde_json",
"tendermint 0.34.0",
"tendermint-light-client",
"tm-stateless-verifier",
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "tm-prover" name = "tm-prover"
version = "0.1.0" version = "0.1.0"
@ -4745,6 +4769,17 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "x509-cert"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94"
dependencies = [
"const-oid",
"der 0.7.9",
"spki 0.7.3",
]
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.7.0" version = "1.7.0"

View file

@ -1,6 +1,9 @@
[workspace] [workspace]
resolver = "2" resolver = "2"
members = [ members = [
"enclaves/*", "apps/mtcs/contracts/cw-tee-mtcs",
"utils/*" "core/light-client-proofs/*",
"core/quartz",
"cosmwasm/packages/*",
"utils/*",
] ]

View file

@ -1,16 +1,52 @@
# tee-mtcs # cycles-quartz
Collection of tools and utilities to help run MTCS on TEEs. A Rust implementation of the cycles protocol and the Quartz app framework.
## Enclaves This repository contains the following components -
Gramine applications and accompanying Dockerfiles for ease-of-usage. ### Apps
* [enclaves/mtcs](enclaves/mtcs) - Runs MTCS on a given set of obligations specified as an input file. Quartz applications, each consisting of CosmWasm smart contracts, Gramine based sidecar enclaves and accompanying ZK
* [enclaves/tm](enclaves/tm) - Runs (stateless) Tendermint light client verification on a given block. proofs.
## Demos Currently implemented apps -
* [Quartz v0.2 demo](quartz_v0_2_demo.md) - Instructions to run the v0.2 demo. * [MTCS](apps/mtcs) - The default app which implements Multilateral Trade Credit Set-off.
* [Obligato Web3 liquidity demo](demo/README.md) - Instructions to run the Obligato with web3 liquidity
demo. ### Core
The Quartz core implementation including -
* Core handlers and types for Quartz
* Intel SGX remote attestation (RA) primitives
* Light client and merkle proofs for CosmWasm storage
### CosmWasm packages
CosmWasm packages for the core Quartz framework and remote attestation verification.
### Utils
Utilities for supporting Quartz development and -
* [cw-prover](utils/cw-prover) - Retrieve a merkle-proof for CosmWasm state
* [cycles-sync](utils/cycles-sync) - Sync obligations and setoffs
with [Obligato](https://github.com/informalsystems/obligato)
* [mtcs-intent](utils/mtcs-intent) - CLI for keygen, encrypting/decrypting obligations/setoffs, etc.
* [tm-prover](utils/tm-prover) - Generate light client and merkle proofs for CosmWasm storage in a format that Quartz
understands
## Contributing
If you're interested in contributing, please comment on a relevant issue (if there is one) or open a new one!
See [CONTRIBUTING.md](CONTRIBUTING.md).
## Resources
* [Cycles website](https://cycles.money/)
* [Cycles Spec](docs/spec)
* [Quartz protobuf definitions](core/quartz-proto)
## License
TBD

1
apps/mtcs/README.md Normal file
View file

@ -0,0 +1 @@
# The quartz MTCS app

View file

@ -56,7 +56,7 @@ schemars = "0.8.15"
serde = { version = "1.0.189", default-features = false, features = ["derive"] } serde = { version = "1.0.189", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.49" } thiserror = { version = "1.0.49" }
quartz-cw = { path = "../../packages/quartz-cw" } quartz-cw = { path = "../../../../cosmwasm/packages/quartz-cw" }
[dev-dependencies] [dev-dependencies]
cw-multi-test = "0.17.0" cw-multi-test = "0.17.0"

View file

@ -1,89 +0,0 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml
on: [ push, pull_request ]
name: Basic
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.73.0
target: wasm32-unknown-unknown
override: true
- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: unit-test
args: --locked
env:
RUST_BACKTRACE: 1
- name: Compile WASM contract
uses: actions-rs/cargo@v1
with:
command: wasm
args: --locked
env:
RUSTFLAGS: "-C link-arg=-s"
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Generate Schema (for cofi-karma-game)
uses: actions-rs/cargo@v1
with:
command: schema
args: --locked -p cofi-karma-game
- name: Generate Schema (for cw-tee-mtcs)
uses: actions-rs/cargo@v1
with:
command: schema
args: --locked -p cw-tee-mtcs
- name: Schema Changes
# fails if any changes not committed
run: git diff --exit-code schema
- name: Install nighly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Run cargo nightly fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

View file

@ -19,15 +19,15 @@ tendermint-light-client = "0.34.0"
tonic = "0.11" tonic = "0.11"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
cw-proof = { path = "../../utils/cw-proof" } cw-proof = { path = "../light-client-proofs/cw-proof" }
cw-tee-mtcs = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git" } cw-tee-mtcs = { path = "../../apps/mtcs/contracts/cw-tee-mtcs" }
cycles-sync = { path = "../../utils/cycles-sync" } cycles-sync = { path = "../../utils/cycles-sync" }
mtcs = { git = "ssh://git@github.com/informalsystems/mtcs.git" } mtcs = { git = "ssh://git@github.com/informalsystems/mtcs.git" }
quartz-cw = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git" } quartz-cw = { path = "../../cosmwasm/packages/quartz-cw" }
quartz-proto = { path = "../../utils/quartz-proto" } quartz-proto = { path = "../quartz-proto" }
quartz-relayer = { path = "../../utils/quartz-relayer" } quartz-relayer = { path = "../../relayer" }
quartz-tee-ra = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git" } quartz-tee-ra = { path = "../../cosmwasm/packages/quartz-tee-ra" }
tm-stateless-verifier = { path = "../../utils/tm-stateless-verifier" } tm-stateless-verifier = { path = "../light-client-proofs/tm-stateless-verifier" }
hex = "0.4.3" hex = "0.4.3"
[build-dependencies] [build-dependencies]

View file

@ -0,0 +1,4 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --bin schema"

View file

@ -123,8 +123,7 @@ mod tests {
6f4d732b586f356f2f7358364f39515778485241765a55474f6452513763767152586171493d0a2d2d2d2d2d454\ 6f4d732b586f356f2f7358364f39515778485241765a55474f6452513763767152586171493d0a2d2d2d2d2d454\
e442043455254494649434154452d2d2d2d2d0a00" e442043455254494649434154452d2d2d2d2d0a00"
); );
let _quote: Quote3<Vec<u8>> = Quote3::try_from(quote_bytes.to_vec()) let _quote: Quote3<Vec<u8>> =
.expect("Failed to parse quote") Quote3::try_from(quote_bytes.to_vec()).expect("Failed to parse quote");
.into();
} }
} }

1
docs/arch/README.md Normal file
View file

@ -0,0 +1 @@
# Architecture decision records (ADRs)

1
docs/spec/README.md Normal file
View file

@ -0,0 +1 @@
# Specifications

View file

@ -20,6 +20,6 @@ thiserror = "1.0.38"
tonic = "=0.8.3" tonic = "=0.8.3"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
quartz-cw = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git" } quartz-cw = { path = "../cosmwasm/packages/quartz-cw" }
quartz-tee-ra = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git" } quartz-tee-ra = { path = "../cosmwasm/packages/quartz-tee-ra" }
quartz-proto = { path = "../../utils/quartz-proto" } quartz-proto = { path = "../core/quartz-proto" }

Some files were not shown because too many files have changed in this diff Show more