docs: Update docs to reflect crate reorg naming, and remove EPID docs (#233)

Co-authored-by: Dave Kaj <davidkajpust@informal.systems>
Co-authored-by: Ethan Buchman <ethan@coinculture.info>
This commit is contained in:
Dave 2024-10-01 23:57:13 -04:00 committed by GitHub
parent 9ecc02f200
commit 279cd5180f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 387 additions and 2253 deletions

2
.gitignore vendored
View file

@ -13,7 +13,7 @@ artifacts/
**/.env.local
#cli
cli/quartz.toml
crates/cli/quartz.toml
.cache/
# Build results

34
Cargo.lock generated
View file

@ -363,9 +363,9 @@ dependencies = [
[[package]]
name = "async-stream"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476"
dependencies = [
"async-stream-impl",
"futures-core",
@ -374,9 +374,9 @@ dependencies = [
[[package]]
name = "async-stream-impl"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
dependencies = [
"proc-macro2",
"quote",
@ -766,9 +766,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.23"
version = "1.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17"
checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938"
dependencies = [
"jobserver",
"libc",
@ -862,9 +862,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.18"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
dependencies = [
"clap_builder",
"clap_derive",
@ -872,9 +872,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.18"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
dependencies = [
"anstream",
"anstyle",
@ -5254,9 +5254,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc"
dependencies = [
"base64 0.22.1",
"chrono",
@ -5270,9 +5270,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec"
dependencies = [
"darling",
"proc-macro2",
@ -5780,12 +5780,12 @@ dependencies = [
[[package]]
name = "terminal_size"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef"
dependencies = [
"rustix",
"windows-sys 0.48.0",
"windows-sys 0.59.0",
]
[[package]]

View file

@ -50,8 +50,8 @@ The current code contains known bugs and security vulnerabilities and APIs are s
Quartz provides developers three main tools:
- a smart contract library (`quartz-cw`) for building SGX-aware CosmWasm contracts
- a rust library (`quartz-enclave`) for building blockchain constrained SGX enclaves
- a smart contract library (`quartz-contract-core`) for building SGX-aware CosmWasm contracts
- a rust library (`quartz-enclave-core`) for building blockchain constrained SGX enclaves
- a cli tool (`quartz`) for connecting the contract and the enclave.
This repo contains an example, [`transfers`](/apps/transfers), which combines these
@ -60,7 +60,7 @@ frontend.
### Smart Contract Lib
`quartz-cw` does two main things:
`quartz-contract-core` does two main things:
- secure session management between contract and enclave
- verify remote attestations of authorized SGX enclaves
@ -68,28 +68,28 @@ frontend.
It contains the core types for session management and for interfacing with attestations
and is the only crate the smart contract dev should have to interact with.
App devs add the `quartz-cw` message types to their contract's messages,
App devs add the `quartz-contract-core` message types to their contract's messages,
and call the verify handler on attested messages. While Quartz enables
securely attested private compute off-chain, app devs are still responsible
for the on-chain data model. See [Building Apps](/docs/building_apps.md) for more.
Under the hood, attestation verification itself is performed via two separate contracts:
- `dcap-verifier` - standalone implementation of dcap verification as a contract using
- `quartz-dcap-verifier` - standalone implementation of dcap verification as a contract using
mobilecoin's Rust libs
- `tcbinfo` - public registry contract of secure sgx processor/firmware versions to
- `quartz-tcbinfo` - public registry contract of secure sgx processor/firmware versions to
ensure attestations are only verified from up-to-date devices
The actual types and verification logic for attestation is further encapsulated in `quartz-tee-ra`.
### Enclave Lib
`quartz-enclave` mirrors `quartz-cw`, in that its the enclave side of what happens
on chain. Both have to manage a secure session. Where `quartz-cw` verifies
attestionations, `quartz-enclave` produces them. But additionally, `quartz-enclave` must
`quartz-enclave-core` mirrors `quartz-contract-core`, in that its the enclave side of what happens
on chain. Both have to manage a secure session. Where `quartz-contract-core` verifies
attestations, `quartz-enclave-core` produces them. But additionally, `quartz-enclave-core` must
verify the state of the blockchain so that the enclave binary is restricted to
only operate authorized commands. It does this via light-client verification.
`quartz-enclave` does the following:
`quartz-enclave-core` does the following:
- secure session management between contract and enclave
- collect and verify light client proofs of smart contract state
@ -97,9 +97,8 @@ only operate authorized commands. It does this via light-client verification.
The underlying implementation includes the following crates:
* light-client-proofs: Light client and merkle proofs for CosmWasm storage
* quartz-proto: protobuf message types for quartz handshake between enclave and
contract
* Light client proofs: Light client and merkle proofs for CosmWasm storage (see utils section below)
* `quartz-proto`: protobuf message types for quartz handshake between enclave and contract
### CLI Tool
@ -123,20 +122,22 @@ And for running everything in one go (build, deploy/start, handshake):
### Utils
The repo contains some additional utilities for supporting Quartz development and -
The repo contains some additional utilities for supporting Quartz development:
* [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)
* [tm-prover](utils/tm-prover) - Generate light client and merkle proofs for CosmWasm storage in a format that Quartz
* [quartz-cw-prover](crates/utils/cw-prover) - Retrieve a merkle-proof for CosmWasm state
* [quartz-tm-prover](crates/utils/tm-prover) - Generate light client and merkle proofs for CosmWasm storage in a format that Quartz
understands
* [quartz-cw-client](crates/utils/quartz-cw-client) - Rust client for wasmd
style blockchains
* [quartz-print-fmspc](crates/utils/quartz-print-fmspc) - Print the FMSPC, a
description of the SGX processor family/model etc.
## 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).
## License
TBD

View file

@ -32,43 +32,18 @@ SUBCOMMANDS:
To install Quartz, ensure you have Rust and Cargo installed. Then run:
```shell
cargo install quartz
cargo install quartz-rs
```
## Usage of subcommands
## Usage
### Init
See the [getting started](/docs/getting_started.md).
Initialize a new Quartz app directory structure with optional name and path arguments.
#### Usage
Run `quartz init` to copy the example app into a new directory. Quartz apps are
organized like:
```shell
$ quartz init --help
quartz-init
Create base Quartz app directory from template
USAGE:
quartz init [OPTIONS]
OPTIONS:
-n, --name <NAME> Set the name of the Quartz app [default: <name of parent directory>]
-p, --path <PATH> Set the path where the Quartz app will be created [default: .]
-h, --help Print help information
```
#### Example
```shell
quartz init --name <app_name> --path <path>
```
This command will create the following directory structure at the specified path (or the current directory if no path is
provided):
```shell
$ tree /<path>/<app-name> -L 1
apps/transfers/
myapp/
├── contracts/
├── enclave/
├── frontend/

12
crates/common/README.md Normal file
View file

@ -0,0 +1,12 @@
# common
A simple crate to re-export quartz core and protobufs:
```rust
#[cfg(feature = "contract")]
pub use quartz_contract_core as contract;
#[cfg(feature = "enclave")]
pub use quartz_enclave_core as enclave;
#[cfg(feature = "proto")]
pub use quartz_proto::quartz as proto;
```

View file

@ -1,61 +1,15 @@
# Quartz CosmWasm Packages
This repository contains a collection of packages designed to facilitate the development of CosmWasm smart contracts for Quartz apps.
CosmWasm packages for building Quartz apps and verifying remote
attestations from SGX.
The main interface for CosmWasm developers is package `core`.
## Packages
### 1. `quartz-cw`
The `quartz-cw` package offers a high-level framework for building attestation-aware smart contracts by wrapping CosmWasm messages in TEE attestations (e.g. DCAP).
- Defines `Attested<M, A>` wrapper for a message and its attestation
- Supports a MockAttestation type for development ease
- Implements session management for secure communication between contract and enclave
The `quartz-cw` package handles actual DCAP verification within smart contracts by calling the standalone `quartz-dcap-verifier` and `tcbinfo` contracts.
### 2. `quartz-dcap-verifier`
Your personal DCAP detective! This package is a standalone smart contract for verifying DCAP attestations that can be called by other contracts.
- Thin wrapper for standalone smart contract around the functionality provided in the `quartz-tee-ra` package
- Provides query and execute entry points for attestation checks
### 3. `quartz-tee-ra`
This `quartz-tee-ra` handles Intel SGX remote attestation for both EPID and DCAP protocols.
- Verifies EPID and DCAP attestations
- Provides core types and structures for SGX quotes
- Implements cryptographic verification of attestation reports
### 4. `tcbinfo`
The `tcbinfo` package manages and verifies TCB information crucial for maintaining enclave security.
- Stores and retrieves TCB information
- Verifies TCB signatures and certificates
- Provides a CosmWasm contract for TCB management
### 5. `wasmd-client`
The `wasmd-client` package offers a Rust client interface for interacting with Wasmd nodes.
- Defines traits for querying and executing CosmWasm contracts
- Provides utilities for deploying and interacting with contracts
## Examples
Check out the `integration_tests` modules in each package for usage examples and best practices!
## Contributing
We welcome contributions from the community! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request. Make sure to follow the contribution guidelines outlined in the repository.
<!-- ## License //TODO check which license is needed
The Quartz CosmWasm Packages are released under the [MIT License](LICENSE). -->
## Contact
If you have any questions or need further assistance, please reach out to us at [quartz.support@informal.systems](mailto:quartz.support@informal.systems).
1. `quartz-contract-core`. High-level framework for building attestation-aware smart contracts by wrapping CosmWasm messages in TEE attestations (e.g. DCAP).
1. `quartz-dcap-verifier`: Standalone smart contract for verifying DCAP attestations that can be called by other contracts.
1. `quartz-tee-ra`: Implements core types for SGX quotes and verification for
DCAP attestations
1. `quartz-tcbinfo`: Standalone smart contract for verifying attestations come
from valid/secure Trusted Compute Base (TCB)

View file

@ -1,28 +1,30 @@
# Quartz CosmWasm (quartz-cw)
# Quartz CosmWasm (quartz-contract-core)
Quartz CosmWasm (quartz-cw) is a high-level framework for building attestation-aware smart contracts on CosmWasm. It provides a robust foundation for developing secure, Intel SGX-based contracts with built-in remote attestation support.
Quartz CosmWasm (quartz-contract-core) is a high-level framework for building attestation-aware smart contracts on CosmWasm. It provides a robust foundation for developing secure, Intel SGX-based contracts with built-in remote attestation support.
## Features
- `Attested<T>` wrapper for secure message handling
- Traits and structures for easy contract development
- State management and message handling utilities
- Support for both DCAP and EPID attestation protocols
- `Attested<M, A>` wrapper for a message and its attestation
- MockAttestation type for development ease
- Session management for secure communication between contract and enclave
- Verify DCAP attestations (by calling `dcap-verifier` and `tcbinfo` contracts)
- Mock SGX support for testing environments
See also the [spec.md](./SPEC.md)
## Installation
Add `quartz-cw` to your `Cargo.toml`:
Add `quartz-contract-core` to your `Cargo.toml`:
```toml
[dependencies]
quartz-cw = { path = "../packages/quartz-cw" }
quartz-contract-core = { path = "../packages/quartz-contract-core" }
```
## Usage
Here's a basic example of how to use `quartz-cw` in your CosmWasm contract:
Here's a basic example of how to use `quartz-contract-core` in your CosmWasm contract:
```rust
use quartz_cw::prelude::*;
@ -49,7 +51,7 @@ pub fn execute(
## Key Components
1. `Attested<M, A>`: A wrapper struct for holding a message and its attestation.
2. `Attestation`: A trait for attestation types (DCAP, EPID, Mock).
2. `Attestation`: A trait for attestation types (DCAP, Mock).
3. `HasUserData`: A trait for extracting user data from attestations.
4. `RawHandler`: A trait for handling raw messages.
@ -59,7 +61,7 @@ You can enable mock SGX support for testing by adding the `mock-sgx` feature to
```toml
[dependencies]
quartz-cw = { path = "../packages/quartz-cw", features = ["mock-sgx"] }
quartz-contract-core = { path = "../packages/quartz-contract-core", features = ["mock-sgx"] }
```
## Testing
@ -69,14 +71,3 @@ To run the tests:
```sh
cargo test
```
## License
This project is licensed under [LICENSE_NAME]. See the LICENSE file for details.
## Contributing
We welcome contributions! Please feel free to submit a Pull Request.
For more information on the implementation details, check out the following files:

View file

@ -1,9 +1,9 @@
# Quartz CosmWasm (quartz-cw) Specification
# Quartz CosmWasm (quartz-contract-core) Specification
## Abstract
This document specifies the `quartz-cw` package, which provides a high-level framework for building attestation-aware smart contracts on CosmWasm. The package implements secure message handling, state management, and attestation verification for Intel SGX-based contracts.
This document specifies the `quartz-contract-core` package, which provides a high-level framework for building attestation-aware smart contracts on CosmWasm. The package implements secure message handling, state management, and attestation verification for Intel SGX-based contracts.
## Table of Contents
@ -15,11 +15,11 @@ This document specifies the `quartz-cw` package, which provides a high-level fra
## Introduction
The `quartz-cw` package is designed to facilitate the development of secure, attestation-aware smart contracts on the CosmWasm platform. It provides a set of tools and abstractions that allow developers to easily integrate Intel SGX remote attestation into their smart contracts, ensuring that only authorized enclaves can interact with the contract's sensitive functions.
The `quartz-contract-core` package is designed to facilitate the development of secure, attestation-aware smart contracts on the CosmWasm platform. It provides a set of tools and abstractions that allow developers to easily integrate Intel SGX remote attestation into their smart contracts, ensuring that only authorized enclaves can interact with the contract's sensitive functions.
### Scope
This specification covers the core components of the `quartz-cw` package, including:
This specification covers the core components of the `quartz-contract-core` package, including:
1. The `Attested<M, A>` wrapper for secure message handling
2. Attestation types and verification processes
@ -30,15 +30,15 @@ This specification covers the core components of the `quartz-cw` package, includ
- Provide a secure and easy-to-use framework for attestation-aware smart contracts
- Abstract away the complexities of SGX attestation verification
- Ensure compatibility with both DCAP and EPID attestation protocols (though EPID is deprecated now by Intel)
- Ensure compatibility with DCAP attestation protocols (EPID is deprecated now by Intel)
- Allow for easy testing and mocking of SGX environments
## Functionality
The `quartz-cw` package provides the following key functionalities:
The `quartz-contract-core` package provides the following key functionalities:
1. Secure message wrapping with `Attested<M, A>`
2. Attestation verification for DCAP and EPID protocols
2. Attestation verification for DCAP protocols
3. State management utilities for CosmWasm contracts
4. Execution handlers for attested messages
@ -47,12 +47,11 @@ The `quartz-cw` package provides the following key functionalities:
- `Attested<M, A>`: A wrapper struct that holds a message `M` and its attestation `A`.
- `Attestation`: A trait that defines the common interface for different attestation types.
- `DcapAttestation`: A struct representing a DCAP attestation.
- `EpidAttestation`: A struct representing an EPID attestation.
- `MockAttestation`: A struct for mocking attestations in test environments.
## Implementation
The `quartz-cw` package is implemented in Rust and relies on the CosmWasm framework. The main components are:
The `quartz-contract-core` package is implemented in Rust and relies on the CosmWasm framework. The main components are:
### Attested Message Wrapper
@ -87,12 +86,11 @@ pub trait Attestation {
### Attestation Verification
The attestation verification process is handled by the `quartz-tee-ra` package, which is a dependency of `quartz-cw`. The verification functions are called within the execution handlers of `quartz-cw`.
The attestation verification process is handled by the `quartz-tee-ra` package, which is a dependency of `quartz-contract-core`. The verification functions are called within the execution handlers of `quartz-contract-core`.
```rust
pub use intel_sgx::{
dcap::verify as verify_dcap_attestation,
epid::{types::IASReport, verifier::verify as verify_epid_attestation},
Error,
};
```
@ -128,7 +126,7 @@ where
## Properties
The `quartz-cw` package ensures the following properties:
The `quartz-contract-core` package ensures the following properties:
1. **Attestation Integrity**: All messages wrapped with `Attested<M, A>` must have a valid attestation that can be verified.
@ -136,13 +134,13 @@ The `quartz-cw` package ensures the following properties:
3. **Enclave Identity Verification**: The package verifies that messages come from authorized enclaves by checking the MRENCLAVE value.
4. **Protocol Flexibility**: The package supports both DCAP and EPID attestation protocols, allowing for different SGX deployment scenarios.
4. **DCAP Support**: The package supports DCAP attestation protocols.
5. **Testability**: The mock-sgx feature allows for easy testing of contracts without a real SGX environment.
## Assumptions
The `quartz-cw` package operates under the following assumptions:
The `quartz-contract-core` package operates under the following assumptions:
1. The underlying SGX hardware and software stack is secure and not compromised.
@ -152,8 +150,8 @@ The `quartz-cw` package operates under the following assumptions:
4. The communication channel between the enclave and the smart contract is secure and resistant to man-in-the-middle attacks.
5. The contract developers correctly implement the `quartz-cw` abstractions and follow secure coding practices.
5. The contract developers correctly implement the `quartz-contract-core` abstractions and follow secure coding practices.
6. The MRENCLAVE values of authorized enclaves are known and correctly configured in the contract's state.
By adhering to this specification, developers can create secure, attestation-aware smart contracts that leverage the power of Intel SGX technology within the CosmWasm ecosystem.# Quartz CosmWasm (quartz-cw) Specification
By adhering to this specification, developers can create secure, attestation-aware smart contracts that leverage the power of Intel SGX technology within the CosmWasm ecosystem.# Quartz CosmWasm (`quartz-contract-core`) Specification

View file

@ -1,5 +1,11 @@
# CosmWasm smart contract to verify DCAP attestations
Your personal DCAP detective! This package is a standalone smart contract for verifying DCAP attestations that can be called by other contracts.
- Thin wrapper for standalone smart contract around the functionality provided in the `quartz-tee-ra` package
- Provides query and execute entry points for attestation checks
## Testing instructions
```
wasmd query wasm contract-state smart "$CONTRACT" '{
@ -10,4 +16,4 @@ wasmd query wasm contract-state smart "$CONTRACT" '{
"user_data": "9113b0be77ed5d0d68680ec77206b8d587ed40679b71321ccdd5405e4d54a6820000000000000000000000000000000000000000000000000000000000000000"
}
}'
```
```

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
# CosmWasm SGX TcbInfo Smart Contract
This smart contract facilitates the storage and verification of `TcbInfo`s for Intel SGX. The contract ensures that
Standalone smart contract for storage and verification of `TcbInfo`s for Intel SGX. The contract ensures that
TcbInfos are kept up-to-date so other contracts can query the latest TcbInfo state using the quote's `fmspc` during
remote attestation verification to ensure the attesting enclave setup is up-to-date.
@ -28,4 +28,4 @@ wasmd tx wasm execute "$CONTRACT" "$EXECUTE" --from alice --chain-id testing -y
```shell
wasmd query wasm contract-state smart "$CONTRACT" '{"get_tcb_info": {"fmspc": "00906ED50000"}}'
```
```

View file

@ -1,23 +1,13 @@
# Quartz TEE Remote Attestation (quartz-tee-ra)
Quartz TEE Remote Attestation is a Rust library that provides functionality for verifying Intel SGX remote attestations. It supports both EPID and DCAP attestation protocols, making it a versatile tool for secure enclave-based applications.
This `quartz-tee-ra` handles Intel SGX remote attestation for DCAP.
## Features
- EPID attestation verification
- DCAP attestation verification
- Support for Intel SGX quote parsing and validation
- Integration with MobileCoin's attestation verifier
## Installation
Add `quartz-tee-ra` to your `Cargo.toml`:
```toml
[dependencies]
quartz-tee-ra = { path = "../packages/quartz-tee-ra" }
```
## Usage
Here's a basic example of how to use `quartz-tee-ra` for DCAP attestation verification:
@ -36,19 +26,6 @@ fn verify_attestation(quote: Quote3<Vec<u8>>, collateral: Collateral, identities
}
```
For EPID attestation:
```rust
use quartz_tee_ra::{verify_epid_attestation, IASReport};
fn verify_epid_attestation(report: IASReport, mrenclave: Vec<u8>, user_data: Vec<u8>) {
match verify_epid_attestation(report, mrenclave, user_data) {
Ok(_) => println!("EPID attestation verified successfully!"),
Err(e) => println!("EPID attestation verification failed: {:?}", e),
}
}
```
## API Reference
The main functions exported by this library are:
@ -57,7 +34,6 @@ The main functions exported by this library are:
```21:25:cosmwasm/packages/quartz-tee-ra/src/lib.rs
pub use intel_sgx::{
dcap::verify as verify_dcap_attestation,
epid::{types::IASReport, verifier::verify as verify_epid_attestation},
Error,
};
```
@ -106,14 +82,6 @@ To run tests:
cargo test
```
## License
[LICENSE_NAME] - see the LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## Safety
This crate uses `#![deny(unsafe_code)]` to ensure everything is implemented in 100% Safe Rust.
@ -141,7 +109,3 @@ This crate uses `#![deny(unsafe_code)]` to ensure everything is implemented in 1
Note: There's a TODO to uncomment the `#![forbid(unsafe_code)]` once better wrappers for FFI structs and constructors are implemented.
## Disclaimer
This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

View file

@ -1,6 +1,6 @@
# wasmd-client
# cw-client
`wasmd-client` is a Rust library that provides a trait and implementation for interacting with CosmWasm-enabled blockchains, specifically designed for use with the `wasmd` daemon.
`cw-client` is a Rust library that provides a trait and implementation for interacting with CosmWasm-enabled blockchains, specifically designed for use with the `wasmd` daemon.
## Features
@ -15,7 +15,7 @@ Add this to your `Cargo.toml`:
```toml
[dependencies]
wasmd-client = { path = "../packages/wasmd-client" }
cw-client = { path = "../packages/cw-client" }
```
## Usage
@ -23,7 +23,7 @@ wasmd-client = { path = "../packages/wasmd-client" }
The main interface is provided through the `WasmdClient` trait:
```9:44:cosmwasm/packages/wasmd-client/src/lib.rs
```9:44:cosmwasm/packages/cw-client/src/lib.rs
pub trait WasmdClient {
type Address: AsRef<str>;
type Query: ToString;

View file

@ -46,6 +46,7 @@ COPY --from=build /opt/src/${ENCLAVE_DIR}/quartz.manifest.template /opt/enclave/
WORKDIR /opt/enclave
# TODO - update entire file to use DCAP, not EPID
RUN gramine-sgx-gen-private-key > /dev/null 2>&1 && \
gramine-manifest \
-Dlog_level="error" \

View file

@ -1,619 +0,0 @@
# Getting Started
Here you'll get quickly up and running with an example Quartz application.
You can run this locally using a "mock" enclave (i.e. without real privacy or
attestations), or you can get access to a machine with Intel SGX enabled to run it securely.
TODO sections:
- Transfer Application - describe basic application
- Local Mock SGX - describe getting up and running locally with mock sgx (old demo instructions, updated with new quartz CLI) -done
- Real SGX - describe how to get setup quickly with SGX e.g. on Azure, and how to run the same example there - done needs review
- Public Testnet - describe how to deploy on Neutron testnet - TODO
## Transfer Application Template
The Transfer Application is a simple template / demo app designed to showcase very basic use of the Quartz framework. It allows users to deposit funds into a contract, transfer them privately within the contract's encrypted state, and ultimately withdraw whatever balance they have left or have accumulated.
#### Key Features
1. **Deposit Funds**: Users can deposit funds into a smart contract.
2. **Private Transfers**: Users can transfer funds privately within the contract
3. **Withdraw Funds**: Users can withdraw their funds from the contract based on their balance in the encrypted state.
#### Application Structure
The application is divided into:
1. **Frontend**: The user interface built with Next.js, cosmjs / graz.
2. **Contracts**: The backend application as a CosmWasm smart contract
3. **Enclave**: Code that executes off-chain and privately in an enclave
#### Setting Up the Application
To get started with the Transfer Application, follow these steps:
**Prerequisites**
Ensure you have the following installed:
Go: Required for building wasmd.
Make: Typically pre-installed on Linux systems.
Git: For cloning the repository.
Websocat: To listen to the events.
### Install Dependencies
Install the necessary dependencies for both the frontend and backend.
```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown
# Install Go tools
export PATH="${PATH}:${HOME}/go/bin"
source ~/.bashrc
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
# Install grpcurl
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
# Install websocat
cargo install websocat
```
### Clone the Repository
First, clone the repository to your local machine.
```bash
git clone ssh://git@github.com/informalsystems/cycles-quartz
cd cycles-quartz
```
### Install a local daemon (local neutrond/wasmd)
Install a local daemon to be able to easily interact with a local or remote chain.
a. Neutron
```bash
git clone -b main https://github.com/neutron-org/neutron.git
cd neutron
make install
```
After the installation, to verify everything is working run:
```bash
neutrond version
```
b. Wasmd
```bash
git clone https://github.com/cosmwasm/wasmd/
cd wasmd
git checkout v0.44.0 / 0.52.0
go install ./cmd/wasmd
```
After the installation, to verify everything is working run:
```bash
wasmd version
```
### Run a local chain from docker
Follow the instructions on [the docker folder]()
a. Neutron
```bash
cd docker/neutron
make start-docker-container
```
After the installation, you should see a `neutrond` container if you run
```
docker ps
```
b. Wasmd
```bash
cd docker/wasmd
make run
```
After the installation, you should see a `wasmd` container if you run
```
docker ps
```
### Installing the Quartz CLI
To install the Quartz CLI, run the following command from the `cycles-quartz` folder:
```bash
cargo install --path cli/
```
### Quickstart on the basic using `dev`
To quickly get up and running, you can run the following `dev` command from the `cycles-quartz` folder:
```bash
quartz --mock-sgx --app-dir "apps/transfers/" dev --unsafe-trust-latest --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
This command will build contract and enclave binaries, deploy, instantiate the contract, handshake and listen to the contract.
To stop the enclave:
```bash
pkill -f quartz-app-tran
```
To restart:
```bash
rm -rf apps/transfers/.cache && quartz --mock-sgx --app-dir "apps/transfers/" dev --unsafe-trust-latest --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
From here you can jump to the section on the [front-end](#### Building the front-end Application).
### Create a new quartz app template
To create a new Quartz app, use the `init` command:
```bash
quartz init --name <new_app_name> --path /path/to/your/project
```
This command will create a new directory structure for your Quartz app:
```
new_app_name/
├── contracts/
├── enclave/
├── frontend/
└── README.md
```
### Build the Binaries
To build both the contract and enclave binaries, use the build command:
```bash
quartz --mock-sgx --app-dir "apps/transfers/" contract build --contract-manifest "apps/transfers/contracts/Cargo.toml"
```
This command will compile the smart contract to WebAssembly and build the enclave binary.
### Configuring and Running the Enclave
To configure and run the enclave, use the following commands:
```bash
# Configure the enclave
quartz --mock-sgx --app-dir "apps/transfers/" enclave build
```
```bash
# Start the enclave
quartz --mock-sgx --app-dir "apps/transfers/" enclave start
```
The enclave will start running and wait for commands.
### Deploying the Contract
With the enclave running, open a new terminal window to deploy the contract:
```bash
quartz --mock-sgx --app-dir "apps/transfers/" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
Make note of the deployed contract address, as you'll need it for the next step.
```bash
2024-09-24T11:11:51.233106Z INFO 📌 Contract Address: wasm1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrss5maay
```
### Performing the Handshake + activating listener
To establish communication between the contract and the enclave, perform the handshake:
```bash
quartz --mock-sgx --app-dir "apps/transfers/" handshake --contract <CONTRACT_ADDRESS>
```
Replace `<CONTRACT_ADDRESS>` with the address you received when deploying the contract.
Make note of the handshake generate public key, as you'll need it for the `.env.local` files on the front-end.
```bash
2024-09-24T11:12:16.961641Z INFO Handshake complete: 02360955ff74750f6ea0b539f41cce89451f591e4c835d0a5406e6effa96dd169d
```
Events coming from the contract will be logged following the handshake as they are retrieved by the listener.
```bash
2024-09-24T11:12:25.156779Z INFO Enclave is listening for requests...
```
#### Building the front-end Application
Once the application is set up, you can interact with it through the frontend. Make sure you have the Keplr extension installed in your browser. You can then deposit, transfer, and withdraw funds using different Keplr accounts.
```bash
# Go to the front-end folder
cd frontend
# Do a fresh install
npm ci
# Copy .env.example
cp .env.example .env.local
# Edit .env.local by adding `<CONTRACT_ADDRESS>` and `<PUB_KEY>`
nano .env.local
```
##### Example of app required variables
```
NEXT_PUBLIC_TARGET_CHAIN=localWasm
NEXT_PUBLIC_ENCLAVE_PUBLIC_KEY=02360955ff74750f6ea0b539f41cce89451f591e4c835d0a5406e6effa96dd169d
NEXT_PUBLIC_TRANSFERS_CONTRACT_ADDRESS=wasm1jfgr0vgunezkhfmdy7krrupu6yjhx224nxtjptll2ylkkqhyzeshrspu9
```
Once the enviroment variables are set, the front-end application can be started with the following command:
```bash
npm run dev
```
For more detailed instructions on setting up and using the application, refer to the [README](apps/transfers/README.md) file.
## Interacting with the Application
Once you have the frontend running and connected to your local blockchain (or testnet), you can interact with the Transfer Application:
1. Ensure you have the Keplr wallet extension installed in your browser.
2. Use one of the provided accounts [wasmd_docker](docker/wasmd/accounts/) / [neutrond_docker](docker/neutrond/accounts/) ) by importing it into your Keplr wallet or create a new one and fund it using the CLI with your `admin` / `val1` account.
3. Use the frontend to deposit funds into the contract.
4. Transfer funds privately between different accounts within the contract.
5. Withdraw funds from the contract back to your Keplr wallet.
All transactions will be processed automatically by the enclave, ensuring the privacy and confidentiality of your transfers.
This completes the basic setup and usage guide for the Transfer Application. In the next sections, we'll cover how to run this application with local Mock SGX, real SGX on Azure, and how to deploy it on the Neutron testnet.
## Local daemon and wallet
For all **testing** purposes, you can use the wallets we provide in the `docker/wasmd/accounts` folder.
Once your `wasmd` is running, you can easily copy the wallets from docker to your local daemon `~/.config` folder:
Here's how you can copy the user wallets from the Docker instance to your local wasmd configuration:
1. First, ensure that your local wasmd instance is not running. If it is, stop it.
2. Locate the directory where the Docker instance stores the wallet data. Based on the provided `Dockerfile`, it appears to be `/root` inside the container.
3. Copy the wallet data from the Docker container to a temporary directory on your local machine:
```bash
docker cp -r wasmd:/root/.wasmd/keyring-test temp-keyring
```
This command copies the `keyring-test` directory from the Docker container to a `temp-keyring` directory in your current local directory.
4. Copy the wallet data from the temporary directory to your local wasmd configuration directory:
```bash
cp -r ~/.temp-keyring/* ~/.wasmd/keyring-test/
```
This command copies the contents of the `temp-keyring` directory to your local `~/.wasmd/keyring-test/` directory.
5. Clean up the temporary directory:
```bash
rm -rf ./temp-keyring
```
6. Verify that the wallets have been copied successfully by running the following command:
```bash
wasmd keys list --keyring-backend=test
```
This should display the list of wallets that were present in the Docker container.
### Alternative method with docker running
Now, let's add the admin key. We'll use the mnemonic from the admin.txt file in your Docker setup. First, let's view the contents of that file:
```bash
docker exec wasmd cat /tmp/accounts/admin.txt
```
You should see a mnemonic phrase (a series of words) at the end of this output.
Now, use this mnemonic to add the admin key to your local wasmd installation:
```bash
wasmd keys add admin --recover --keyring-backend=test
```
After completing these steps, your local wasmd instance should have the same `admin` wallets as the Docker instance. You can repeat the process for `alice`, `bob` and `charlie`.
You can now start your local wasmd instance, and it will use the copied wallets.
Note: Make sure to replace `wasmd` in the `docker cp` command with the actual name of your running Docker container if it differs.
## Working with an Azure Sgx
Login via `ssh` into your Azure Sgx enabled machine.
```bash
ssh username@21.6.21.71
```
### Quickstart
Once logged in, install the `cli` with the following command:
```bash
cargo install --path cli/
```
We now need to build the binaries.
### Build the Binaries
To build both the contract binaries, use the build command:
```bash
quartz --app-dir "apps/transfers/" contract build --contract-manifest "apps/transfers/contracts/Cargo.toml"
```
This command will compile the smart contract to WebAssembly and build the contract binary.
### Configuring and Running the Enclave
The following configuration assumes that the `wasmd` node will be running in the same Azure instance as the enclave.
If you wish to use another enclave provider you have to make sure that `QUARTZ_NODE_URL` is set to the enclave address and port as an argument as in:
```
QUARTZ_NODE_URL=87.23.1.3:11090 && quartz --app-dir "apps/transfers/" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
If you wish to use another blockchain you have to make sure that `--node-url` is set to the chain address and port as an option in the `cli` as in:
```
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" --node-url "https://92.43.1.4:26657" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
To configure and run the enclave, use the following commands:
```bash
# Configure the enclave
quartz --app-dir "apps/transfers/" enclave build
```
Before starting the enclave, you have to make sure that all relevant contracts (tcbinfo, dcap-verifier) have been instantiated as described below
```bash
# Start the enclave
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" enclave start --fmspc "00606A000000" --tcbinfo-contract "wasm1pk6xe9hr5wgvl5lcd6wp62236t5p600v9g7nfcsjkf6guvta2s5s7353wa" --dcap-verifier-contract "wasm107cq7x4qmm7mepkuxarcazas23037g4q9u72urzyqu7r4saq3l6srcykw2"
```
The enclave will start running and wait for commands.
### Deploying the Contract
With the enclave running, open a new terminal window to deploy the contract:
```bash
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
Make note of the deployed contract address, as you'll need it for the next step.
```
2024-09-26T15:21:39.036639Z INFO 🆔 Code ID: 66
2024-09-26T15:21:39.036640Z INFO 📌 Contract Address: wasm1z0az3d9j9s3rjmaukxc58t8hdydu8v0d59wy9p6slce66mwnzjusy76vdq
{"ContractDeploy":{"code_id":66,"contract_addr":"wasm1z0az3d9j9s3rjmaukxc58t8hdydu8v0d59wy9p6slce66mwnzjusy76vdq"}}
```
### Performing the Handshake + activating listener
To establish communication between the contract and the enclave, perform the handshake:
```bash
quartz --app-dir "apps/transfers/" handshake --contract <CONTRACT_ADDRESS>
```
Replace `<CONTRACT_ADDRESS>` with the address you received when deploying the contract.
Make note of the handshake generate public key, as you'll need it for the `.env.local` files on the front-end.
```bash
2024-09-24T11:12:16.961641Z INFO Handshake complete: 02360955ff74750f6ea0b539f41cce89451f591e4c835d0a5406e6effa96dd169d
```
Events coming from the contract will be logged following the handshake as they are retrieved by the listener.
```bash
2024-09-24T11:12:25.156779Z INFO Enclave is listening for requests...
```
## Quartz cosmwasm packages
### Get the FMSPC of the host machine
```
export QUOTE="/* quote generated during the handshake should work */"
cd utils/print-fmspc/
cargo run > /dev/null
```
### Deploying the `tcbinfo` contract
1. Build and store the contract on-chain
```
cargo run -- contract build --contract-manifest "../cosmwasm/packages/tcbinfo/Cargo.toml"
RES=$(wasmd tx wasm store ./target/wasm32-unknown-unknown/release/tcbinfo.wasm --from alice -y --output json --chain-id "testing" --gas-prices 0.0025ucosm --gas auto --gas-adjustment 1.3)
TX_HASH=$(echo $RES | jq -r '.["txhash"]')
```
2. Instantiate the contract using Intel's root CA cert.
```
CERT=$(sed ':a;N;$!ba;s/\n/\\n/g' ../cosmwasm/packages/quartz-tee-ra/data/root_ca.pem)
RES=$(wasmd query tx "$TX_HASH" --output json)
CODE_ID=$(echo $RES | jq -r '.logs[0].events[1].attributes[1].value')
wasmd tx wasm instantiate "$CODE_ID" "{\"root_cert\": \"$CERT\"}" --from "alice" --label "tcbinfo" --chain-id "testing" --gas-prices 0.0025ucosm --gas auto --gas-adjustment 1.3 -y --no-admin --output json
TCB_CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" --output json | jq -r '.contracts[0]')
```
3. Get the Tcbinfo for the given FMSPC.
```
HEADERS=$(wget -q -S -O - https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc=00606A000000 2>&1 >/dev/null)
TCB_INFO=$(wget -q -O - https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc=00606A000000)
export TCB_ISSUER_CERT=$(echo "$HEADERS" |
grep 'TCB-Info-Issuer-Chain:' |
sed 's/.*TCB-Info-Issuer-Chain: //' |
sed 's/%0A/\n/g' |
sed 's/%20/ /g' |
sed 's/-----BEGIN%20CERTIFICATE-----/-----BEGIN CERTIFICATE-----/' |
sed 's/-----END%20CERTIFICATE-----/-----END CERTIFICATE-----/' |
perl -MURI::Escape -ne 'print uri_unescape($_)' |
awk '/-----BEGIN CERTIFICATE-----/{flag=1; print; next} /-----END CERTIFICATE-----/{print; flag=0; exit} flag')
TCB_ISSUER_CERT=$(echo "$TCB_ISSUER_CERT" | sed ':a;N;$!ba;s/\n/\\n/g')
echo "TCB_INFO:"
echo "$TCB_INFO"
echo
echo "TCB_ISSUER_CERT:"
echo "$TCB_ISSUER_CERT"
```
4. Add the Tcbinfo for the given FMSPC to the contract (and test it with a query)
```
wasmd tx wasm execute "$TCB_CONTRACT" "{\"tcb_info\": $(echo "$TCB_INFO" | jq -Rs .), \"certificate\": \"$TCB_ISSUER_CERT\"}" --from admin --chain-id testing --gas auto --gas-adjustment 1.2 -y
wasmd query wasm contract-state smart "$TCB_CONTRACT" '{"get_tcb_info": {"fmspc": "00606A000000"}}'
```
### Deploying the `quartz-dcap-verifier` contract
1. Build the contract
```
cargo run -- contract build --contract-manifest "../cosmwasm/packages/quartz-dcap-verifier/Cargo.toml"
```
2. Optimize the contract
In order to optimized the contract, you need to install `wasm-opt` v.119 see HOWTO below
```
wasm-opt -Oz ./target/wasm32-unknown-unknown/release/quartz_dcap_verifier.wasm -o ./target/wasm32-unknown-unknown/release/quartz_dcap_verifier.optimized.wasm
```
3. Store the optimized contract on-chain
```
RES=$(wasmd tx wasm store ./target/wasm32-unknown-unknown/release/quartz_dcap_verifier.optimized.wasm --from admin -y --output json --chain-id "testing" --gas-prices 0.0025ucosm --gas auto --gas-adjustment 1.3)
TX_HASH=$(echo $RES | jq -r '.["txhash"]')
RES=$(wasmd query tx "$TX_HASH" --output json)
CODE_ID=$(echo $RES | jq -r '.logs[0].events[1].attributes[1].value')
```
4. Instantiate the `quartz-dcap-verifier` contract.
```
wasmd tx wasm instantiate "$CODE_ID" null --from "admin" --label "dcap-verifier" --chain-id "testing" --gas-prices 0.0025ucosm --gas auto --gas-adjustment 1.3 -y --no-admin --output json
DCAP_CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" --output json | jq -r '.contracts[0]')
```
### Quartz setup
```
quartz --app-dir "../apps/transfers/"
--contract-manifest "../apps/transfers/contracts/Cargo.toml" \
--unsafe-trust-latest \
--init-msg '{"denom":"ucosm"}' \
dev \
--fmspc "00606A000000" \
--tcbinfo-contract "$TCB_CONTRACT" \
--dcap-verifier-contract "$DCAP_CONTRACT"
```
#### HOWTO Install `wasm-opt`
To install `wasm-opt` version 119 on an Azure SGX machine running Ubuntu, follow these steps:
### 1. **Update and install dependencies:**
Before installing `wasm-opt`, make sure your system is up-to-date and has the necessary build tools:
```bash
sudo apt update
sudo apt install -y build-essential cmake git
```
### 2. **Download and build `wasm-opt` version 119:**
The `wasm-opt` tool is part of the [Binaryen](https://github.com/WebAssembly/binaryen) project. To get version 119, youll need to clone the specific tag from the Binaryen GitHub repository.
```bash
git clone https://github.com/WebAssembly/binaryen.git
cd binaryen
git checkout version_119
```
### 3. **Build the project:**
Next, you'll build Binaryen and the `wasm-opt` tool:
```bash
cmake . && make
```
### 4. **Install `wasm-opt`:**
Once the build is complete, you can install `wasm-opt` globally on your system:
```bash
sudo make install
```
### 5. **Verify the installation:**
Finally, confirm that `wasm-opt` version 119 is installed correctly by running:
```bash
wasm-opt --version
```
This should return something like:
```
wasm-opt version_119
```
Now, `wasm-opt` version 119 should be properly installed on your Azure SGX machine running Ubuntu.

View file

@ -10,7 +10,7 @@ WARNING:
Quartz provides utilities for secure communication with TEEs,
but it DOES NOT specify a data model for applications. This gives application
devs great power and flexibility, but with this power comes great
responsibility. App devs must remain dilligent to ensure their data model does
responsibility. App devs must remain diligent to ensure their data model does
not leak private information (or leaks only what they are comfortable with).
The Quartz framework intends to provide better tools and patterns for securely
@ -45,7 +45,7 @@ Private requests should be encrypted to authorized TEE keys and queued for
execution at some frequency by the TEE.
Private state should be managed in such a way that accessing/updating it does
not unecessarily leak private information.
not unnecessarily leak private information.
Public responses can be executed directly on-chain (e.g. public balance
changes), while private responses can be executed by verifying remote

View file

@ -25,13 +25,13 @@ mock SGX:
1. Install dependencies (Rust, wasmd or neutrond)
2. Clone the repository: `git clone ssh://git@github.com/informalsystems/cycles-quartz`
3. Install Quartz CLI: `cargo install --path cli/`
4. Navigate to the example app: `cd apps/transfers`
3. Install Quartz CLI: `cargo install --path crates/cli`
4. Navigate to the example app: `cd examples/transfers`
4. Deploy the example app in one command (enclave, contracts, secure handshake):
```bash
quartz --mock-sgx dev \
--unsafe-trust-latest \
--contract-manifest "apps/transfers/contracts/Cargo.toml" \
--contract-manifest "examples/transfers/contracts/Cargo.toml" \
--init-msg '{"denom":"ucosm"}'
```
5. Set up the frontend (see [Frontend](#frontend))
@ -41,7 +41,7 @@ For more detailed background and instructions, read on.
## Simple Example
Quartz includes a simple example we call the `Transfer` application,
located in [/apps/transfers](/apps/transfers), that comes with a Keplr-based
located in [/examples/transfers](/examples/transfers), that comes with a Keplr-based
frontend. It's a simple demo app designed to showcase very basic use of the Quartz framework.
It allows users to deposit funds into a contract,
transfer them privately within the contract's encrypted state (updated by the
@ -53,7 +53,7 @@ Every application has a common structure:
2. **Contracts**: The backend application as a CosmWasm smart contract
3. **Enclave**: Code that executes off-chain and privately in an enclave
Quartz is both a library (`quartz-cw`) for building SGX-aware CosmWasm
Quartz is both a library (`quartz-contract-core`) for building SGX-aware CosmWasm
contracts, and a cli tool (`quartz`) for managing the enclave.
The library takes care of establishing a secure connection to the enclave (see
@ -63,9 +63,9 @@ it. The quartz tool provides commands for managing the enclave.
This guide is primarily about using the `quartz` tool to get the example app
setup. For more on building application, see
- [Building Apps](/docs/building_apps.md) - conceptual overview
- [quartz-cw](/cosmwasm/quartz-cw) - main library. provides msgs and handlers
- [quartz-contract-core](/cosmwasm/quartz-contract-core) - main library. provides msgs and handlers
for the handshake and for verifying attestations
- [transfers contracts](/apps/transfers/contracts): transfer app example itself
- [transfers contracts](/examples/transfers/contracts): transfer app example itself
Onwards with the installation and running our example app!
@ -107,7 +107,7 @@ Now clone and build the repo:
```bash
git clone ssh://git@github.com/informalsystems/cycles-quartz
cd cycles-quartz
cargo install --path cli/
cargo install --path crates/cli
```
And check that it worked:
@ -169,10 +169,10 @@ First we build and run the enclave code.
Quartz provides a `--mock-sgx` flag so we can deploy locally for testing and
development purposes without needing access to an SGX core.
We can run everything from within the `apps/transfers` dir in this repo. To run
from elsewhere by specify a path, eg. from the root of the repo with `--app-dir apps/transfers`.
We can run everything from within the `examples/transfers` dir in this repo. To run
from elsewhere by specify a path, eg. from the root of the repo with `--app-dir examples/transfers`.
Now, from `apps/transfers`:
Now, from `examples/transfers`:
1. Build the enclave binary:
```bash
@ -197,7 +197,7 @@ continue.
2. Deploy the contract:
```bash
quartz --mock-sgx contract deploy \
--contract-manifest "apps/transfers/contracts/Cargo.toml" \
--contract-manifest "examples/transfers/contracts/Cargo.toml" \
--init-msg '{"denom":"ucosm"}'
```
@ -233,7 +233,7 @@ Now the contract is ready to start processing requests to the enclave.
1. Navigate to the frontend folder:
```bash
cd apps/transfers/frontend
cd examples/transfers/frontend
```
2. Install dependencies:
@ -291,13 +291,13 @@ to get setup with SGX on Azure, and how to deploy quartz contracts to the
Neutron testnet using real remote attestions from SGX cores on Azure.
Real verification of SGX on a CosmWasm network requires two additional global contracts
to be deployed: dcap-verify and tcbinfo. The
dcap-verify contract provides the core verification of the SGX attestation
(called DCAP). The tcbinfo contract contains global information about secure
to be deployed: `quartz-dcap-verify` and `quartz-tcbinfo`. The
`quartz-dcap-verify` contract provides the core verification of the SGX attestation
(called DCAP). The `quartz-tcbinfo` contract contains global information about secure
versions of SGX processors. Together they allow contracts built with quartz to
securely verify remote attestations from SGX enclaves.
We have already predeployed the dcap-verify and tcbinfo contracts on the Neutron
We have already predeployed the `quartz-dcap-verify` and `quartz-tcbinfo` contracts on the Neutron
testnet at TODO. To deploy these on your own testnet, see [below](#other-testnets-with-sgx).
To begin, you'll need to deploy an SGX-enabled Azure instance and log in via ssh.
@ -309,13 +309,13 @@ Once logged in, clone and install Quartz like before (see
TODO:
- make this about deploying to neutron.
- do it from apps/transfers to avoid specifying `--app-dir`
- do it from examples/transfers to avoid specifying `--app-dir`
To build both the contract binaries, use the build command:
```bash
quartz --app-dir "apps/transfers/" contract build --contract-manifest "apps/transfers/contracts/Cargo.toml"
quartz --app-dir "examples/transfers/" contract build --contract-manifest "examples/transfers/contracts/Cargo.toml"
```
This command will compile the smart contract to WebAssembly and build the contract binary.
@ -323,13 +323,13 @@ The following configuration assumes that the `wasmd` node will be running in the
If you wish to use another enclave provider you have to make sure that `QUARTZ_NODE_URL` is set to the enclave address and port as an argument as in:
```bash
QUARTZ_NODE_URL=87.23.1.3:11090 && quartz --app-dir "apps/transfers/" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
QUARTZ_NODE_URL=87.23.1.3:11090 && quartz --app-dir "examples/transfers/" contract deploy --contract-manifest "examples/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
If you wish to use another blockchain you have to make sure that `--node-url` is set to the chain address and port as an option in the `cli` as in:
```bash
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" --node-url "https://92.43.1.4:26657" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "examples/transfers/" --node-url "https://92.43.1.4:26657" contract deploy --contract-manifest "examples/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
### Build and Run the SGX Enclave
@ -338,11 +338,11 @@ First we build the enclave like before:
```bash
# Configure the enclave
quartz --app-dir "apps/transfers/" enclave build
quartz --app-dir "examples/transfers/" enclave build
```
Before starting the enclave, we should check that the relevant contracts
(tcbinfo, dcap-verifier) have been instantiated.
(`quartz-tcbinfo`, `quartz-dcap-verifier`) have been instantiated.
TODO: how to query to check this?
@ -352,7 +352,7 @@ TODO: use variables for the contract addresses
```bash
# Start the enclave
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" enclave start --fmspc "00606A000000" --tcbinfo-contract "wasm1pk6xe9hr5wgvl5lcd6wp62236t5p600v9g7nfcsjkf6guvta2s5s7353wa" --dcap-verifier-contract "wasm107cq7x4qmm7mepkuxarcazas23037g4q9u72urzyqu7r4saq3l6srcykw2"
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "examples/transfers/" enclave start --fmspc "00606A000000" --tcbinfo-contract "wasm1pk6xe9hr5wgvl5lcd6wp62236t5p600v9g7nfcsjkf6guvta2s5s7353wa" --dcap-verifier-contract "wasm107cq7x4qmm7mepkuxarcazas23037g4q9u72urzyqu7r4saq3l6srcykw2"
```
The enclave will start running and wait for commands.
@ -362,7 +362,7 @@ The enclave will start running and wait for commands.
With the enclave running, open a new terminal window to deploy the contract:
```bash
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "apps/transfers/" contract deploy --contract-manifest "apps/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
QUARTZ_NODE_URL=127.0.0.1:11090 && quartz --app-dir "examples/transfers/" contract deploy --contract-manifest "examples/transfers/contracts/Cargo.toml" --init-msg '{"denom":"ucosm"}'
```
Make note of the deployed contract address, as you'll need it for the next step. You should see output similar to:
@ -378,7 +378,7 @@ Make note of the deployed contract address, as you'll need it for the next step.
To establish communication between the contract and the enclave, perform the handshake:
```bash
quartz --app-dir "apps/transfers/" handshake --contract <CONTRACT_ADDRESS>
quartz --app-dir "examples/transfers/" handshake --contract <CONTRACT_ADDRESS>
```
Replace `<CONTRACT_ADDRESS>` with the address you received when deploying the contract.
@ -397,18 +397,18 @@ Events coming from the contract will be logged following the handshake as they a
## Other Testnets With SGX
To setup on another testnet we need to deploy a tcinfo contract and a
dcap-verifier contract.
To setup on another testnet we need to deploy a `quartz-tcbinfo` contract and a
`quartz-dcap-verifier` contract.
### Get the FMSPC of the host machine
```bash
export QUOTE="/* quote generated during the handshake should work */"
cd utils/print-fmspc/
cd crates/utils/print-fmspc/
cargo run > /dev/null
```
### Deploying the `tcbinfo` contract
### Deploying the `quartz-tcbinfo` contract
1. Build and store the contract on-chain
```bash
@ -483,8 +483,8 @@ DCAP_CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" --output json
### Quartz setup
```bash
quartz --app-dir "../apps/transfers/" \
--contract-manifest "../apps/transfers/contracts/Cargo.toml" \
quartz --app-dir "../examples/transfers/" \
--contract-manifest "../examples/transfers/contracts/Cargo.toml" \
--unsafe-trust-latest \
--init-msg '{"denom":"ucosm"}' \
dev \

View file

@ -52,7 +52,7 @@ The goal of the handshake is to establish:
- specific code is running on the TEE (given by an `mr_enclave`)
- a specific TEE is running (given by a `nonce`)
- the TEE has a speciifc decryption key (given by a `pubkey`)
- the TEE has a specific decryption key (given by a `pubkey`)
This is done in three corresponding steps:
@ -74,7 +74,7 @@ In SessionPubKey, the TEE verifies a light client proof that the nonce was
stored in the contract, generates an encryption key pair, and remote attests to
the nonce and pubkey. The smart contract verifies the RA and that the nonce is the same and stores the pubkey.
The TEE is now ready to process requests encrpyted to the pubkey.
The TEE is now ready to process requests encrypted to the pubkey.
## Execution

View file

@ -1636,9 +1636,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc"
dependencies = [
"base64",
"chrono",
@ -1652,9 +1652,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec"
dependencies = [
"darling",
"proc-macro2",

View file

@ -426,6 +426,29 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d"
[[package]]
name = "bindgen"
version = "0.66.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
dependencies = [
"bitflags 2.6.0",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"prettyplease",
"proc-macro2",
"quote",
"regex",
"rustc-hash 1.1.0",
"shlex",
"syn 2.0.79",
"which",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -506,14 +529,29 @@ dependencies = [
]
[[package]]
name = "cc"
version = "1.1.23"
name = "cargo-emit"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bbb537bb4a30b90362caddba8f360c0a56bc13d3a5570028e7197204cb54a17"
checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695"
[[package]]
name = "cc"
version = "1.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938"
dependencies = [
"shlex",
]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -568,10 +606,21 @@ dependencies = [
]
[[package]]
name = "clap"
version = "4.5.18"
name = "clang-sys"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
dependencies = [
"clap_builder",
"clap_derive",
@ -579,9 +628,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.18"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
dependencies = [
"anstyle",
"clap_lex",
@ -894,6 +943,19 @@ dependencies = [
"zeroize",
]
[[package]]
name = "cw-client"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"anyhow",
"cosmrs",
"hex",
"reqwest 0.12.8",
"serde",
"serde_json",
]
[[package]]
name = "cw-multi-test"
version = "2.1.1"
@ -914,22 +976,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "cw-proof"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
dependencies = [
"clap",
"cosmrs",
"displaydoc",
"ics23",
"prost 0.13.3",
"serde",
"serde_with",
"tendermint 0.38.1",
"tendermint-rpc",
]
[[package]]
name = "cw-storage-plus"
version = "2.0.0"
@ -1443,6 +1489,12 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "group"
version = "0.13.0"
@ -1578,6 +1630,15 @@ dependencies = [
"digest 0.10.7",
]
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "http"
version = "0.2.12"
@ -1636,9 +1697,9 @@ dependencies = [
[[package]]
name = "httparse"
version = "1.9.4"
version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
[[package]]
name = "httpdate"
@ -1914,12 +1975,28 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libloading"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets 0.52.6",
]
[[package]]
name = "libsecp256k1"
version = "0.7.1"
@ -2005,7 +2082,8 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
name = "mc-attestation-verifier"
version = "0.4.3"
source = "git+https://github.com/informalsystems/attestation#ae86e2804abed218f4fd2fd4aec5e39408898cd8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf39fb1af41156ec868564ab53156d6dd75f1dc8a7a073acdfb217b6140d9e4"
dependencies = [
"der",
"displaydoc",
@ -2020,11 +2098,25 @@ dependencies = [
"x509-cert",
]
[[package]]
name = "mc-sgx-core-build"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94420a570e76dfc39924b4ec712c2df21a8d77e61ca5ba0857300b1c59889a5d"
dependencies = [
"bindgen",
"cargo-emit",
]
[[package]]
name = "mc-sgx-core-sys-types"
version = "0.11.0"
source = "git+https://github.com/informalsystems/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c5c33323d0f2855e63efaa538bdd7094104ff79f963734b4122f23302cff581"
dependencies = [
"bindgen",
"cargo-emit",
"mc-sgx-core-build",
"serde",
"serde_with",
]
@ -2032,7 +2124,8 @@ dependencies = [
[[package]]
name = "mc-sgx-core-types"
version = "0.11.0"
source = "git+https://github.com/informalsystems/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1191b0bb2868ff5bdf7766d3b3e9fa9bb94c23149ae21a82485e6f5f44074106"
dependencies = [
"bitflags 2.6.0",
"displaydoc",
@ -2049,15 +2142,19 @@ dependencies = [
[[package]]
name = "mc-sgx-dcap-sys-types"
version = "0.11.0"
source = "git+https://github.com/informalsystems/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dd3e93a316a5c142de6fb9179970abc04ca4767732b90d118c90d531db47e89"
dependencies = [
"bindgen",
"mc-sgx-core-build",
"mc-sgx-core-sys-types",
]
[[package]]
name = "mc-sgx-dcap-types"
version = "0.11.0"
source = "git+https://github.com/informalsystems/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42c618d93a3f9561bdc27231fa7965ebe855c8d74f5cd5467da194042e0671a9"
dependencies = [
"const-oid",
"displaydoc",
@ -2077,15 +2174,8 @@ dependencies = [
[[package]]
name = "mc-sgx-util"
version = "0.11.0"
source = "git+https://github.com/informalsystems/sgx#f25807776cbe10901f53d23fca548c9e4f6f284c"
[[package]]
name = "mcmf"
version = "2.0.0"
source = "git+https://github.com/hu55a1n1/flow#cad8f3adb29d3be2177a31db0fa0e5c2a858beb0"
dependencies = [
"cc",
]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3c237bec3e33530c4b1a171c8c078ad5d525d5fae177ac9d62e8e454b3fffb7"
[[package]]
name = "memchr"
@ -2126,20 +2216,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "mtcs"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/mtcs.git#b2093085a53bc39107012fcae9e236edbc4433cb"
dependencies = [
"displaydoc",
"itertools 0.10.5",
"log",
"mcmf",
"num-traits",
"petgraph 0.6.3",
"serde",
]
[[package]]
name = "multimap"
version = "0.10.0"
@ -2173,20 +2249,6 @@ dependencies = [
"minimal-lexical",
]
[[package]]
name = "num"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
dependencies = [
"num-bigint",
"num-complex",
"num-integer",
"num-iter",
"num-rational",
"num-traits",
]
[[package]]
name = "num-bigint"
version = "0.4.6"
@ -2197,15 +2259,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "num-complex"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
dependencies = [
"num-traits",
]
[[package]]
name = "num-conv"
version = "0.1.0"
@ -2221,28 +2274,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.19"
@ -2376,6 +2407,12 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "peg"
version = "0.8.4"
@ -2418,16 +2455,6 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "petgraph"
version = "0.6.3"
source = "git+https://github.com/hu55a1n1/petgraph?branch=min-cost-flow-primal-dual#3a2664a3b9d1e5b71c411a6ed497cf576c1a86ae"
dependencies = [
"fixedbitset",
"indexmap 1.9.3",
"num",
]
[[package]]
name = "petgraph"
version = "0.6.5"
@ -2579,7 +2606,7 @@ dependencies = [
"log",
"multimap",
"once_cell",
"petgraph 0.6.5",
"petgraph",
"prettyplease",
"prost 0.13.3",
"prost-types 0.13.3",
@ -2643,6 +2670,7 @@ dependencies = [
"color-eyre",
"cosmrs",
"cosmwasm-std",
"cw-client",
"cw-multi-test",
"ecies",
"futures-util",
@ -2650,6 +2678,7 @@ dependencies = [
"k256",
"prost 0.13.3",
"quartz-common",
"quartz-tm-prover",
"reqwest 0.12.8",
"serde",
"serde_json",
@ -2658,29 +2687,27 @@ dependencies = [
"tendermint-light-client",
"tendermint-rpc",
"thiserror",
"tm-prover",
"tokio",
"tonic",
"tonic-build",
"tracing",
"transfers-contract",
"wasmd-client",
]
[[package]]
name = "quartz-common"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"quartz-cw",
"quartz-enclave",
"quartz-contract-core",
"quartz-enclave-core",
"quartz-proto",
]
[[package]]
name = "quartz-cw"
name = "quartz-contract-core"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"ciborium",
"cosmwasm-schema",
@ -2689,28 +2716,44 @@ dependencies = [
"hex",
"k256",
"quartz-dcap-verifier-msgs",
"quartz-tcbinfo-msgs",
"quartz-tee-ra",
"serde",
"serde_json",
"serde_with",
"sha2 0.10.8",
"tcbinfo-msgs",
"thiserror",
]
[[package]]
name = "quartz-cw-proof"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"clap",
"cosmrs",
"displaydoc",
"ics23",
"prost 0.13.3",
"serde",
"serde_with",
"tendermint 0.38.1",
"tendermint-rpc",
]
[[package]]
name = "quartz-dcap-verifier-msgs"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
]
[[package]]
name = "quartz-enclave"
name = "quartz-enclave-core"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"anyhow",
"async-trait",
@ -2718,16 +2761,16 @@ dependencies = [
"color-eyre",
"cosmrs",
"cosmwasm-std",
"cw-proof",
"ecies",
"futures-util",
"hex",
"k256",
"mc-sgx-dcap-sys-types",
"mtcs",
"quartz-cw",
"quartz-contract-core",
"quartz-cw-proof",
"quartz-proto",
"quartz-tee-ra",
"quartz-tm-stateless-verifier",
"rand",
"reqwest 0.12.8",
"serde",
@ -2737,7 +2780,6 @@ dependencies = [
"tendermint-light-client",
"tendermint-rpc",
"thiserror",
"tm-stateless-verifier",
"tokio",
"tonic",
"tower 0.5.1",
@ -2747,17 +2789,25 @@ dependencies = [
[[package]]
name = "quartz-proto"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"prost 0.13.3",
"tonic",
"tonic-build",
]
[[package]]
name = "quartz-tcbinfo-msgs"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"cosmwasm-schema",
]
[[package]]
name = "quartz-tee-ra"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
@ -2774,6 +2824,37 @@ dependencies = [
"x509-parser",
]
[[package]]
name = "quartz-tm-prover"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"clap",
"color-eyre",
"cosmrs",
"futures",
"quartz-cw-proof",
"serde",
"serde_json",
"tendermint 0.38.1",
"tendermint-light-client",
"tendermint-light-client-detector",
"tendermint-rpc",
"tokio",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "quartz-tm-stateless-verifier"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e5004076813b8c98e7c385cc967372c38dd9ab4b"
dependencies = [
"displaydoc",
"tendermint 0.38.1",
"tendermint-light-client",
]
[[package]]
name = "quinn"
version = "0.11.5"
@ -2784,7 +2865,7 @@ dependencies = [
"pin-project-lite",
"quinn-proto",
"quinn-udp",
"rustc-hash",
"rustc-hash 2.0.0",
"rustls 0.23.13",
"socket2",
"thiserror",
@ -2801,7 +2882,7 @@ dependencies = [
"bytes",
"rand",
"ring",
"rustc-hash",
"rustc-hash 2.0.0",
"rustls 0.23.13",
"slab",
"thiserror",
@ -3064,6 +3145,12 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc-hash"
version = "2.0.0"
@ -3429,9 +3516,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc"
dependencies = [
"base64 0.22.1",
"chrono",
@ -3445,9 +3532,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.9.0"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec"
dependencies = [
"darling",
"proc-macro2",
@ -3689,14 +3776,6 @@ dependencies = [
"libc",
]
[[package]]
name = "tcbinfo-msgs"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
dependencies = [
"cosmwasm-schema",
]
[[package]]
name = "tempfile"
version = "3.13.0"
@ -3987,42 +4066,11 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tm-prover"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
dependencies = [
"clap",
"color-eyre",
"cosmrs",
"cw-proof",
"futures",
"serde",
"serde_json",
"tendermint 0.38.1",
"tendermint-light-client",
"tendermint-light-client-detector",
"tendermint-rpc",
"tokio",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "tm-stateless-verifier"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
dependencies = [
"displaydoc",
"tendermint 0.38.1",
"tendermint-light-client",
]
[[package]]
name = "tokio"
version = "1.39.2"
version = "1.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
dependencies = [
"backtrace",
"bytes",
@ -4147,9 +4195,9 @@ dependencies = [
[[package]]
name = "tonic"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38659f4a91aba8598d27821589f5db7dddd94601e7a01b1e485a50e5484c7401"
checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52"
dependencies = [
"async-stream",
"async-trait",
@ -4177,13 +4225,14 @@ dependencies = [
[[package]]
name = "tonic-build"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "568392c5a2bd0020723e3f387891176aabafe36fd9fcd074ad309dfa0c8eb964"
checksum = "9557ce109ea773b399c9b9e5dca39294110b74f1f342cb347a80d1fce8c26a11"
dependencies = [
"prettyplease",
"proc-macro2",
"prost-build",
"prost-types 0.13.3",
"quote",
"syn 2.0.79",
]
@ -4504,19 +4553,6 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "wasmd-client"
version = "0.1.0"
source = "git+ssh://git@github.com/informalsystems/cycles-quartz.git#e853c2ed1d7b9a720c1c39e822f701e9f71f13bb"
dependencies = [
"anyhow",
"cosmrs",
"hex",
"reqwest 0.12.8",
"serde",
"serde_json",
]
[[package]]
name = "web-sys"
version = "0.3.70"
@ -4536,6 +4572,18 @@ dependencies = [
"rustls-pki-types",
]
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "winapi-util"
version = "0.1.9"