diff --git a/.github/workflows/cosmwasm-release.yml b/.github/workflows/cosmwasm-release.yml deleted file mode 100644 index 4fd4d7dd..00000000 --- a/.github/workflows/cosmwasm-release.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Cosmwasm release - -on: - release: - types: [ created ] - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Install protobuf-compiler - run: sudo apt-get install -y protobuf-compiler - - name: Install cargo-run-script - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-run-script - - name: Run cargo optimize - uses: actions-rs/cargo@v1 - with: - command: run-script - args: optimize - - name: Get release ID - id: get_release - uses: bruceadams/get-release@v1.2.3 - env: - GITHUB_TOKEN: ${{ github.token }} - - name: Upload optimized wasm - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./artifacts/*.wasm - tag: ${{ github.ref }} - overwrite: true - file_glob: true diff --git a/Cargo.toml b/Cargo.toml index 1323b067..d5bd1f75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,20 +125,20 @@ mc-sgx-dcap-sys-types = { version = "0.11.0", default-features = false } mc-attestation-verifier = { version = "0.4.3", default-features = false } # quartz -quartz-cw-proof = { path = "crates/enclave/cw-proof", default-features = false } -quartz-common = { path = "crates/common", default-features = false } -quartz-contract-core = { path = "crates/contracts/core", default-features = false } -quartz-dcap-verifier-msgs = { path = "crates/contracts/dcap-verifier/msgs", default-features = false } -quartz-enclave-core = { path = "crates/enclave/core", default-features = false } -quartz-proto = { path = "crates/enclave/proto", default-features = false } -quartz-tee-ra = { path = "crates/contracts/tee-ra", default-features = false } -quartz-tcbinfo = { path = "crates/contracts/tcbinfo", default-features = false, features = [ +quartz-cw-proof = { version = "0.1.0", path = "crates/enclave/cw-proof", default-features = false } +quartz-common = { version = "0.1.0", path = "crates/common", default-features = false } +quartz-contract-core = { version = "0.1.0", path = "crates/contracts/core", default-features = false } +quartz-dcap-verifier-msgs = { version = "0.1.0", path = "crates/contracts/dcap-verifier/msgs", default-features = false } +quartz-enclave-core = { version = "0.1.0", path = "crates/enclave/core", default-features = false } +quartz-proto = { version = "0.1.0", path = "crates/enclave/proto", default-features = false } +quartz-tee-ra = { version = "0.1.0", path = "crates/contracts/tee-ra", default-features = false } +quartz-tcbinfo = { version = "0.1.0", path = "crates/contracts/tcbinfo", default-features = false, features = [ "library", ] } -quartz-tcbinfo-msgs = { path = "crates/contracts/tcbinfo/msgs", default-features = false } -quartz-tm-prover = { path = "crates/utils/tm-prover", default-features = false } -quartz-tm-stateless-verifier = { path = "crates/enclave/tm-stateless-verifier", default-features = false } -cw-client = { path = "crates/utils/cw-client", default-features = false } +quartz-tcbinfo-msgs = { version = "0.1.0", path = "crates/contracts/tcbinfo/msgs", default-features = false } +quartz-tm-prover = { version = "0.1.0", path = "crates/utils/tm-prover", default-features = false } +quartz-tm-stateless-verifier = { version = "0.1.0", path = "crates/enclave/tm-stateless-verifier", default-features = false } +cw-client = { version = "0.1.0", path = "crates/utils/cw-client", default-features = false } [profile.release] opt-level = "z" diff --git a/crates/contracts/dcap-verifier/msgs/Cargo.toml b/crates/contracts/dcap-verifier/msgs/Cargo.toml index 9ec82658..f0779042 100644 --- a/crates/contracts/dcap-verifier/msgs/Cargo.toml +++ b/crates/contracts/dcap-verifier/msgs/Cargo.toml @@ -10,6 +10,7 @@ homepage.workspace = true keywords = ["cosmos", "cosmwasm", "cycles", "quartz", "sgx"] readme = "README.md" description = """ +Message and query definitions for the quartz-dcap-verifier contract """ [dependencies] diff --git a/crates/contracts/dcap-verifier/msgs/README.md b/crates/contracts/dcap-verifier/msgs/README.md new file mode 100644 index 00000000..1770b5b3 --- /dev/null +++ b/crates/contracts/dcap-verifier/msgs/README.md @@ -0,0 +1,3 @@ +# quartz-dcap-verifier-msgs + +Message and query definitions for the quartz-dcap-verifier contract diff --git a/crates/contracts/tcbinfo/msgs/Cargo.toml b/crates/contracts/tcbinfo/msgs/Cargo.toml index 77a030a4..9d9327f1 100644 --- a/crates/contracts/tcbinfo/msgs/Cargo.toml +++ b/crates/contracts/tcbinfo/msgs/Cargo.toml @@ -10,6 +10,7 @@ homepage.workspace = true keywords = ["cosmos", "cosmwasm", "cycles", "quartz", "sgx"] readme = "README.md" description = """ +Message and query definitions for the quartz-tcbinfo contract """ [dependencies] diff --git a/crates/contracts/tcbinfo/msgs/README.md b/crates/contracts/tcbinfo/msgs/README.md new file mode 100644 index 00000000..621663e8 --- /dev/null +++ b/crates/contracts/tcbinfo/msgs/README.md @@ -0,0 +1,3 @@ +# quartz-tcbinfo-msgs + +Message and query definitions for the quartz-tcbinfo contract diff --git a/crates/enclave/cw-proof/README.md b/crates/enclave/cw-proof/README.md new file mode 100644 index 00000000..0887881e --- /dev/null +++ b/crates/enclave/cw-proof/README.md @@ -0,0 +1,3 @@ +# quartz-cw-proof + +Merkle proofs of CosmWasm contract state. This crate contains proof types and a verifier implementation. diff --git a/crates/enclave/proto/README.md b/crates/enclave/proto/README.md new file mode 100644 index 00000000..cba621e2 --- /dev/null +++ b/crates/enclave/proto/README.md @@ -0,0 +1,3 @@ +# quartz-proto + +Protobuf types defining the Quartz handshake to initialize connection between a smart contract and trusted execution environment. diff --git a/crates/enclave/tm-stateless-verifier/README.md b/crates/enclave/tm-stateless-verifier/README.md new file mode 100644 index 00000000..8d96fcd7 --- /dev/null +++ b/crates/enclave/tm-stateless-verifier/README.md @@ -0,0 +1,3 @@ +# quartz-tm-stateless-verifier + +Stateless verification of a tendermint light client proof. diff --git a/crates/utils/print-fmspc/README.md b/crates/utils/print-fmspc/README.md new file mode 100644 index 00000000..9b924932 --- /dev/null +++ b/crates/utils/print-fmspc/README.md @@ -0,0 +1,3 @@ +# quartz-print-fmspc + +Convenience tool to print the FMSPC (Family-Model-Stepping-Platform-Custom) of the local SGX processor. diff --git a/release.sh b/release.sh new file mode 100644 index 00000000..598e8002 --- /dev/null +++ b/release.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# release.sh will hopefully allow us to publish all of the necessary crates in +# this repo in the right order. It is assumed that only one person will be +# releasing all crates at the same time. +# +# It has a default set of crates it will publish, which can be overridden by +# way of command line arguments: +# +# # Release all packages, prompting for each package as to whether to publish +# ./scripts/release.sh +# +# # Just release a single crate, but nothing else +# ./scripts/release.sh + +set -e + +# A space-separated list of all the crates we want to publish, in the order in +# which they must be published. It's important to respect this order, since +# each subsequent crate depends on one or more of the preceding ones. +DEFAULT_CRATES="cw-client quartz-dcap-verifier-msgs quartz-tcbinfo-msgs quartz-tee-ra quartz-contract-core quartz-cw-proof quartz-proto quartz-tm-stateless-verifier quartz-enclave-core quartz-common quartz-tm-prover quartz-print-fmspc quartz-dcap-verifier quartz-tcbinfo quartz-rs" + +# Allows us to override the crates we want to publish. +CRATES=${*:-${DEFAULT_CRATES}} + +get_manifest_path() { + cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "'"${1}"'")|.manifest_path' +} + +get_local_version() { + cargo metadata --format-version 1 | jq -r '.packages[]|select(.name == "'"${1}"'")|.version' +} + +check_version_online() { + curl -s "https://crates.io/api/v1/crates/${1}" | jq -r '.versions[]|select(.num == "'"${2}"'").updated_at' +} + +publish() { + echo "Publishing crate $1..." + cargo publish --manifest-path "$(get_manifest_path "${1}")" + echo "" +} + +wait_until_available() { + echo "Waiting for crate ${1} to become available via crates.io..." + for retry in {1..5}; do + sleep 5 + ONLINE_DATE="$(check_version_online "${1}" "${2}")" + if [ -n "${ONLINE_DATE}" ]; then + echo "Crate ${crate} is now available online" + break + else + if [ "${retry}" == 5 ]; then + echo "ERROR: Crate should have become available by now" + exit 1 + else + echo "Not available just yet. Waiting a few seconds..." + fi + fi + done + echo "Waiting an additional 10 seconds for crate to propagate through CDN..." + sleep 10 +} + +echo "Attempting to publish crate(s): ${CRATES}" + +for crate in ${CRATES}; do + VERSION="$(get_local_version "${crate}")" + ONLINE_DATE="$(check_version_online "${crate}" "${VERSION}")" + echo "${crate} version number: ${VERSION}" + if [ -n "${ONLINE_DATE}" ]; then + echo "${crate} ${VERSION} has already been published at ${ONLINE_DATE}, skipping" + continue + fi + + publish "${crate}" + wait_until_available "${crate}" "${VERSION}" +done