From 6e476c0c19458e736394b506a08f563c820254fd Mon Sep 17 00:00:00 2001 From: Cashmaney Date: Tue, 25 Oct 2022 09:31:19 +0300 Subject: [PATCH] Sgx sdk 1.1.5, update sdk version (#1221) Added rust-sgx-sdk as a submodule Updated rust-sgx-sdk to 1.1.5 Updated rust version Updated CI/CD to compile with these versions --- .env.local | 2 + .github/dependabot.yml | 6 +- .github/workflows/ci.yaml | 31 +- .github/workflows/release.yaml | 9 +- .gitignore | 2 +- .gitmodules | 4 + Makefile | 11 +- azure-pipelines.yml | 5 +- cosmwasm/Cargo.lock | 6 +- cosmwasm/enclaves/Cargo.lock | 1680 ----------------- cosmwasm/enclaves/Cargo.toml | 31 + cosmwasm/enclaves/Xargo.toml | 46 +- cosmwasm/enclaves/execute/Cargo.toml | 42 +- cosmwasm/enclaves/execute/Makefile | 4 +- cosmwasm/enclaves/execute/src/lib.rs | 2 - .../execute/src/registration/attestation.rs | 18 +- .../enclaves/execute/src/registration/cert.rs | 8 +- .../execute/src/registration/offchain.rs | 4 +- .../execute/src/registration/report.rs | 5 +- .../execute/src/registration/seed_exchange.rs | 7 +- cosmwasm/enclaves/query/Cargo.toml | 7 +- cosmwasm/enclaves/query/Makefile | 4 +- cosmwasm/enclaves/rust-toolchain | 2 +- .../shared/contract-engine/Cargo.toml | 4 +- .../src/contract_operations.rs | 14 +- .../src/contract_validation.rs | 8 +- .../enclaves/shared/contract-engine/src/db.rs | 10 +- .../enclaves/shared/contract-engine/src/io.rs | 2 +- .../shared/contract-engine/src/message.rs | 1098 +++++------ .../shared/contract-engine/src/query_chain.rs | 2 +- .../contract-engine/src/wasm/contract.rs | 6 +- .../contract-engine/src/wasm/externals.rs | 1 + .../enclaves/shared/cosmos-types/Cargo.toml | 2 +- .../shared/cosmos-types/src/multisig.rs | 2 +- .../enclaves/shared/cosmos-types/src/types.rs | 7 +- .../shared/cosmwasm-types/v0.10/Cargo.toml | 2 +- .../shared/cosmwasm-types/v0.10/src/math.rs | 2 + .../shared/cosmwasm-types/v0.10/src/types.rs | 2 +- .../shared/cosmwasm-types/v1.0/Cargo.toml | 2 +- .../shared/cosmwasm-types/v1.0/src/lib.rs | 1 - cosmwasm/enclaves/shared/crypto/Cargo.toml | 8 +- cosmwasm/enclaves/shared/crypto/src/consts.rs | 6 +- .../enclaves/shared/crypto/src/ed25519.rs | 2 +- cosmwasm/enclaves/shared/crypto/src/lib.rs | 8 +- .../enclaves/shared/crypto/src/storage.rs | 4 +- cosmwasm/enclaves/shared/utils/Cargo.toml | 9 +- cosmwasm/enclaves/shared/utils/src/lib.rs | 6 +- cosmwasm/enclaves/test/Makefile | 2 +- .../xargo/x86_64-unknown-linux-sgx.json | 22 +- cosmwasm/packages/sgx-vm/Cargo.lock | 755 -------- cosmwasm/packages/sgx-vm/Cargo.toml | 4 +- cosmwasm/packages/sgx-vm/rust-toolchain | 2 +- .../packages/sgx-vm/testdata/contract.wasm | 0 deployment/dockerfiles/app.Dockerfile | 89 +- deployment/dockerfiles/base.Dockerfile | 20 +- deployment/dockerfiles/db-compile.Dockerfile | 4 +- .../dockerfiles/enclave-test.Dockerfile | 11 +- deployment/dockerfiles/ibc/README.md | 70 +- deployment/dockerfiles/release.Dockerfile | 12 +- go-cosmwasm/Cargo.lock | 9 +- go-cosmwasm/Cargo.toml | 2 +- go-cosmwasm/Makefile | 2 +- go-cosmwasm/rust-toolchain | 2 +- rust-toolchain | 2 +- third_party/build/Cargo.lock | 5 +- third_party/build/Cargo.toml | 4 +- third_party/incubator-teaclave-sgx-sdk | 1 + 67 files changed, 933 insertions(+), 3229 deletions(-) create mode 100644 .env.local create mode 100644 .gitmodules delete mode 100644 cosmwasm/enclaves/Cargo.lock delete mode 100644 cosmwasm/packages/sgx-vm/Cargo.lock mode change 120000 => 100644 cosmwasm/packages/sgx-vm/testdata/contract.wasm create mode 160000 third_party/incubator-teaclave-sgx-sdk diff --git a/.env.local b/.env.local new file mode 100644 index 000000000..bdee64e1d --- /dev/null +++ b/.env.local @@ -0,0 +1,2 @@ +API_KEY=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +SPID=00000000000000000000000000000000 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index de1e386b3..cb01e0b2c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -19,4 +19,8 @@ updates: directory: "/cosmwasm" schedule: interval: daily - + + - package-ecosystem: gitsubmodule + schedule: + interval: "daily" + directory: "/" \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ff0a27d58..54b6fceff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,12 +7,15 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + with: + submodules: recursive + name: Pull git submodules - name: Install Intel's SGX SDK run: | mkdir -p "$HOME/.sgxsdk" cd "$HOME/.sgxsdk" - SDK_BIN=sgx_linux_x64_sdk_2.9.101.2.bin - wget https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/"$SDK_BIN" + SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin + wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN" chmod +x "$SDK_BIN" echo yes | ./"$SDK_BIN" - name: Cache cargo registry @@ -48,7 +51,6 @@ jobs: - name: Test enclave run: | source "$HOME/.sgxsdk/sgxsdk/environment" - make vendor export SGX_MODE=SW RUSTC_WRAPPER="$HOME/sccache" make enclave-tests make clean-enclave @@ -105,6 +107,8 @@ jobs: needs: [Build-Contracts, Build-LocalSecret] steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions/setup-go@v3 with: go-version: 1.19 # The Go version to download (if necessary) and use. @@ -112,8 +116,8 @@ jobs: run: | mkdir -p "$HOME/.sgxsdk" cd "$HOME/.sgxsdk" - SDK_BIN=sgx_linux_x64_sdk_2.9.101.2.bin - wget https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/"$SDK_BIN" + SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin + wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN" chmod +x "$SDK_BIN" echo yes | ./"$SDK_BIN" - name: Download LocalSecret @@ -178,12 +182,14 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + with: + submodules: recursive - name: Install Intel's SGX SDK run: | mkdir -p "$HOME/.sgxsdk" cd "$HOME/.sgxsdk" - SDK_BIN=sgx_linux_x64_sdk_2.9.101.2.bin - wget https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/"$SDK_BIN" + SDK_BIN=sgx_linux_x64_sdk_2.17.101.1.bin + wget https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/"$SDK_BIN" chmod +x "$SDK_BIN" echo yes | ./"$SDK_BIN" - name: Cache cargo registry @@ -220,7 +226,6 @@ jobs: - name: Clippy run: | source "$HOME/.sgxsdk/sgxsdk/environment" - make vendor cd cosmwasm/enclaves/execute/ SGX_MODE=SW make clippy SGX_MODE=HW make clippy @@ -229,6 +234,8 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + with: + submodules: recursive - uses: actions/setup-go@v3 with: go-version: 1.19 # The Go version to download (if necessary) and use. @@ -252,6 +259,8 @@ jobs: with: driver-opts: network=host - uses: actions/checkout@v2 + with: + submodules: recursive - name: Build LocalSecret Base uses: docker/build-push-action@v3 with: @@ -322,6 +331,8 @@ jobs: needs: [Build-LocalSecret, Build-Hermes] steps: - uses: actions/checkout@v2 + with: + submodules: recursive - name: Download Hermes uses: actions/download-artifact@v3 with: @@ -353,6 +364,10 @@ jobs: yarn yarn test docker rm -f localsecret # next step needs the localsecret ports + - name: Install Requirements + run: | + chmod +x ./scripts/install-wasm-tools.sh + ./scripts/install-wasm-tools.sh - name: Run cw20-ics20 tests run: | git clone --depth 1 --branch secret https://github.com/scrtlabs/cw-plus diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4f6263903..cf380c042 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,6 +35,9 @@ jobs: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} + - run: | + echo ${{ secrets.SPID_MAINNET }} > spid.txt; echo ${{ secrets.API_KEY_MAINNET }} > api_key.txt + name: "Save api keys" - name: Build testnet run: | source "$HOME/.sgxsdk/sgxsdk/environment" @@ -61,9 +64,9 @@ jobs: - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} - - uses: actions/setup-go@v3 - with: - go-version: 1.19 # The Go version to download (if necessary) and use. + - run: | + echo ${{ secrets.SPID_MAINNET }} > spid.txt; echo ${{ secrets.API_KEY_MAINNET }} > api_key.txt + name: "Save api keys" - name: Build run: | VERSION=${{ steps.get_version.outputs.VERSION }} DB_BACKEND=${{ matrix.db_backend }} FEATURES=production FEATURES_U=production, make build-mainnet-upgrade diff --git a/.gitignore b/.gitignore index 335df4cbc..133bc543a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env sgx_sk.pem *.a *.deb @@ -11,7 +12,6 @@ Enclave_u.o /enigmacli* /enigmad* secretcli* -incubator-teaclave-sgx-sdk libenclave.a libEnclave_u.a librust_cosmwasm_enclave.signed.so diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..ae089b324 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "third_party/incubator-teaclave-sgx-sdk"] + path = third_party/incubator-teaclave-sgx-sdk + url = https://github.com/scrtlabs/incubator-teaclave-sgx-sdk + branch = secret-1.1.5 diff --git a/Makefile b/Makefile index 578929edd..fe2722061 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ COMMIT := $(shell git log -1 --format='%H') DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf +SPID ?= 00000000000000000000000000000000 +API_KEY ?= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + LEDGER_ENABLED ?= true BINDIR ?= $(GOPATH)/bin BUILD_PROFILE ?= release @@ -228,7 +231,7 @@ clean: $(MAKE) -C cosmwasm/enclaves/test clean build-rocksdb-image: - docker build --build-arg BUILD_VERSION=${VERSION} -f deployment/dockerfiles/db-compile.Dockerfile -t enigmampc/rocksdb:${VERSION} . + docker build --build-arg BUILD_VERSION=${VERSION} -f deployment/dockerfiles/db-compile.Dockerfile -t enigmampc/rocksdb:${VERSION}-1.1.5 . localsecret: _localsecret-compile docker build --build-arg SGX_MODE=SW --build-arg SECRET_NODE_TYPE=BOOTSTRAP --build-arg CHAIN_ID=secretdev-1 -f deployment/dockerfiles/release.Dockerfile -t build-release . @@ -239,6 +242,8 @@ _localsecret-compile: --build-arg BUILD_VERSION=${VERSION} \ --build-arg FEATURES="${FEATURES},debug-print" \ --build-arg FEATURES_U=${FEATURES_U} \ + --secret id=API_KEY,src=.env.local \ + --secret id=SPID,src=.env.local \ --build-arg SGX_MODE=SW \ -f deployment/dockerfiles/base.Dockerfile \ -t rust-go-base-image \ @@ -258,7 +263,7 @@ build-custom-dev-image: build-testnet: _docker_base @mkdir build 2>&3 || true - docker build --secret API_KEY=${API_KEY} --secret SPID=${SPID} --build-arg BUILD_VERSION=${VERSION} --build-arg SGX_MODE=HW --build-arg SECRET_NODE_TYPE=BOOTSTRAP -f deployment/dockerfiles/release.Dockerfile -t enigmampc/secret-network-bootstrap:v$(VERSION)-testnet . + docker build --build-arg BUILD_VERSION=${VERSION} --build-arg SGX_MODE=HW --build-arg SECRET_NODE_TYPE=BOOTSTRAP -f deployment/dockerfiles/release.Dockerfile -t enigmampc/secret-network-bootstrap:v$(VERSION)-testnet . docker build --build-arg BUILD_VERSION=${VERSION} --build-arg SGX_MODE=HW --build-arg SECRET_NODE_TYPE=NODE -f deployment/dockerfiles/release.Dockerfile -t enigmampc/secret-network-node:v$(VERSION)-testnet . docker build --build-arg SGX_MODE=HW -f deployment/dockerfiles/build-deb.Dockerfile -t deb_build . docker run -e VERSION=${VERSION} -v $(CUR_DIR)/build:/build deb_build @@ -296,6 +301,8 @@ _docker_base: --build-arg FEATURES=${FEATURES} \ --build-arg FEATURES_U=${FEATURES_U} \ --build-arg SGX_MODE=${SGX_MODE} \ + --secret id=API_KEY,src=api_key.txt \ + --secret id=SPID,src=spid.txt \ -f deployment/dockerfiles/base.Dockerfile \ -t rust-go-base-image \ . diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a39f3ec74..86098783b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,6 +25,9 @@ variables: DOCKER_BUILDKIT: 1 steps: + - checkout: "self" + submodules: true + displayName: "Checkout Repository and Submodules" - script: echo $(spid) > spid.txt; echo $(api-key-dev) > api_key.txt displayName: "Save api keys" @@ -64,7 +67,7 @@ steps: repository: rust-enclave-test tags: latest buildContext: . - arguments: --build-arg SGX_MODE=HW + arguments: --secret id=API_KEY,src=api_key.txt --secret id=SPID,src=spid.txt --build-arg SGX_MODE=HW Dockerfile: deployment/dockerfiles/enclave-test.Dockerfile - task: Docker@2 diff --git a/cosmwasm/Cargo.lock b/cosmwasm/Cargo.lock index db2953ab7..ea44df2ed 100644 --- a/cosmwasm/Cargo.lock +++ b/cosmwasm/Cargo.lock @@ -546,13 +546,11 @@ dependencies = [ [[package]] name = "sgx_types" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" [[package]] name = "sgx_urts" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" dependencies = [ "libc", "sgx_types", diff --git a/cosmwasm/enclaves/Cargo.lock b/cosmwasm/enclaves/Cargo.lock deleted file mode 100644 index 9ff578ec6..000000000 --- a/cosmwasm/enclaves/Cargo.lock +++ /dev/null @@ -1,1680 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if 1.0.0", - "cipher", - "cpufeatures", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aes-siv" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5daaf431d0ff4b0a7b53e995b2d9c0762d9dc0b9f063b4cd65493f2263e096af" -dependencies = [ - "aead", - "aes", - "cipher", - "cmac", - "crypto-mac", - "ctr", - "dbl", - "zeroize", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.28" -source = "git+https://github.com/mesalock-linux/anyhow-sgx#9b7763f58b5dedc11f388ea9a0072049c309e27d" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "base64" -version = "0.13.0" -source = "git+https://github.com/mesalock-linux/rust-base64-sgx?rev=dc7389e10817b078f289386b3b6a852ab6c4c021#dc7389e10817b078f289386b3b6a852ab6c4c021" -dependencies = [ - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "base64" -version = "0.13.0" -source = "git+https://github.com/mesalock-linux/rust-base64-sgx#dc7389e10817b078f289386b3b6a852ab6c4c021" -dependencies = [ - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "bech32" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "0.5.4" -source = "git+https://github.com/mesalock-linux/bytes-sgx#63d1951a35f2e888696aba3796aac45214e727ec" -dependencies = [ - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "cbindgen" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db2df1ebc842c41fd2c4ae5b5a577faf63bd5151b953db752fc686812bee318" -dependencies = [ - "clap", - "log", - "proc-macro2", - "quote", - "serde 1.0.137", - "serde_json 1.0.81", - "syn", - "tempfile", - "toml", -] - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.11" -source = "git+https://github.com/mesalock-linux/chrono-sgx#f964ae7f5f65bd2c9cd6f44a067e7980afc08ca0" -dependencies = [ - "num-integer 0.1.41", - "num-traits 0.2.10", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cmac" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b70e37282d9624283878ffda1d1e53883bcf868cf441bddda44127620b39572d" -dependencies = [ - "crypto-mac", - "dbl", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cosmos_proto" -version = "1.4.0" -dependencies = [ - "dirs", - "protobuf", - "protoc-rust", -] - -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "cipher", - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "ctor" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "cw_types_generic" -version = "0.1.0" -dependencies = [ - "base64 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cw_types_v010", - "cw_types_v1", - "enclave-ffi-types", - "hex", - "log", - "serde 1.0.118", - "serde_json 1.0.60", -] - -[[package]] -name = "cw_types_v010" -version = "1.4.0" -dependencies = [ - "base64 0.13.0 (git+https://github.com/mesalock-linux/rust-base64-sgx?rev=dc7389e10817b078f289386b3b6a852ab6c4c021)", - "bech32", - "derive_more", - "enclave-ffi-types", - "log", - "serde 1.0.118", - "serde_json 1.0.60", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "cw_types_v1" -version = "1.4.0" -dependencies = [ - "base64 0.13.0 (git+https://github.com/mesalock-linux/rust-base64-sgx?rev=dc7389e10817b078f289386b3b6a852ab6c4c021)", - "bech32", - "cw_types_v010", - "derive_more", - "enclave-ffi-types", - "log", - "serde 1.0.118", - "serde_json 1.0.60", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "thiserror", - "uint", -] - -[[package]] -name = "dbl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "dirs" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "ed25519-zebra" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a128b76af6dd4b427e34a6fd43dc78dbfe73672ec41ff615a2414c1a0ad0409" -dependencies = [ - "curve25519-dalek", - "hex", - "rand_core", - "sha2 0.9.9", - "thiserror", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "enclave-ffi-types" -version = "0.1.0" -dependencies = [ - "cbindgen", - "derive_more", - "thiserror", -] - -[[package]] -name = "enclave_contract_engine" -version = "1.4.0" -dependencies = [ - "base64 0.13.0 (git+https://github.com/mesalock-linux/rust-base64-sgx?rev=dc7389e10817b078f289386b3b6a852ab6c4c021)", - "bech32", - "cosmos_proto", - "cw_types_generic", - "cw_types_v010", - "cw_types_v1", - "derive_more", - "ed25519-zebra", - "enclave-ffi-types", - "enclave_cosmos_types", - "enclave_crypto", - "enclave_utils", - "hex", - "lazy_static", - "log", - "lru", - "parity-wasm", - "protobuf", - "pwasm-utils", - "rand_chacha", - "rand_core", - "secp256k1", - "serde 1.0.118", - "serde_json 1.0.60", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sha2 0.8.2", - "wasmi", -] - -[[package]] -name = "enclave_cosmos_types" -version = "1.4.0" -dependencies = [ - "cosmos_proto", - "cw_types_v010", - "derive_more", - "enclave-ffi-types", - "enclave_crypto", - "log", - "num_enum", - "prost", - "protobuf", - "serde 1.0.118", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sha2 0.8.2", -] - -[[package]] -name = "enclave_crypto" -version = "1.4.0" -dependencies = [ - "aes-siv", - "cosmos_proto", - "derive_more", - "enclave-ffi-types", - "hex", - "lazy_static", - "log", - "ring", - "ripemd160", - "secp256k1", - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sha2 0.8.2", - "sha3", - "x25519-dalek", -] - -[[package]] -name = "enclave_utils" -version = "1.4.0" -dependencies = [ - "enclave-ffi-types", - "lazy_static", - "log", - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" -dependencies = [ - "instant", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "git+https://github.com/mesalock-linux/getrandom-sgx#0aa9cc20c7dea713ccaac2c44430d625a395ebae" -dependencies = [ - "cfg-if 0.1.10", - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - -[[package]] -name = "hashbrown_tstd" -version = "0.9.0" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "hashbrown_tstd" -version = "0.9.0" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "httparse" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "itertools" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "0.4.5" -source = "git+https://github.com/mesalock-linux/itoa-sgx#295ee451f5ec74f25c299552b481beb445ea3eb7" -dependencies = [ - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "keccak" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "lru" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" - -[[package]] -name = "memory_units" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" - -[[package]] -name = "num-bigint" -version = "0.2.5" -source = "git+https://github.com/mesalock-linux/num-bigint-sgx#76a5bed94dc31c32bd1670dbf72877abcf9bbc09" -dependencies = [ - "autocfg 1.1.0", - "num-integer 0.1.41", - "num-traits 0.2.10", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "num-integer" -version = "0.1.41" -source = "git+https://github.com/mesalock-linux/num-integer-sgx#404c50e5378ca635261688b080dee328ff42b6bd" -dependencies = [ - "autocfg 0.1.8", - "num-traits 0.2.10", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg 1.1.0", - "num-traits 0.2.15", -] - -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg 1.1.0", - "num-integer 0.1.45", - "num-traits 0.2.15", -] - -[[package]] -name = "num-traits" -version = "0.2.10" -source = "git+https://github.com/mesalock-linux/num-traits-sgx#af046e0b15c594c960007418097dd4ff37ec3f7a" -dependencies = [ - "autocfg 0.1.8", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg 1.1.0", -] - -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - -[[package]] -name = "proc-macro2" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prost" -version = "0.6.1" -source = "git+https://github.com/mesalock-linux/prost-sgx?rev=cd3103a6d45cf7a43b6c1c5e4223428097d1c547#cd3103a6d45cf7a43b6c1c5e4223428097d1c547" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "git+https://github.com/mesalock-linux/prost-sgx?rev=cd3103a6d45cf7a43b6c1c5e4223428097d1c547#cd3103a6d45cf7a43b6c1c5e4223428097d1c547" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "protobuf" -version = "2.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c327e191621a2158159df97cdbc2e7074bb4e940275e35abf38eb3d2595754" - -[[package]] -name = "protobuf-codegen" -version = "2.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df8c98c08bd4d6653c2dbae00bd68c1d1d82a360265a5b0bbc73d48c63cb853" -dependencies = [ - "protobuf", -] - -[[package]] -name = "protoc" -version = "2.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac70cfc8935f5db2a29c0929db697035d02284011a9b78a5ef5d48092ce9673" -dependencies = [ - "log", - "which", -] - -[[package]] -name = "protoc-rust" -version = "2.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bad71c8404e3e09024fccbab55aae36e3662662167dc4530a242c8cc8ef8d20" -dependencies = [ - "protobuf", - "protobuf-codegen", - "protoc", - "tempfile", -] - -[[package]] -name = "pwasm-utils" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" -dependencies = [ - "byteorder", - "log", - "parity-wasm", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "git+https://github.com/mesalock-linux/rand-sgx#83583f073de3b4f75c3c3ef5e174d484ed941f85" -dependencies = [ - "getrandom 0.1.14", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.6", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "ring" -version = "0.16.19" -source = "git+https://github.com/mesalock-linux/ring-sgx?tag=v0.16.5#844efe271ed78a399d803b2579f5f2424d543c9f" -dependencies = [ - "cc", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "spin", - "untrusted", -] - -[[package]] -name = "ripemd160" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustls" -version = "0.19.0" -source = "git+https://github.com/mesalock-linux/rustls?rev=95b5e79dc24b02f3ce424437eb9698509d0baf58#95b5e79dc24b02f3ce424437eb9698509d0baf58" -dependencies = [ - "base64 0.13.0 (git+https://github.com/mesalock-linux/rust-base64-sgx)", - "ring", - "sct", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "webpki", -] - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "sct" -version = "0.6.0" -source = "git+https://github.com/mesalock-linux/sct.rs?branch=mesalock_sgx#c4d859cca232e6c9d88ca12048df3bc26e1ed4ad" -dependencies = [ - "ring", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "untrusted", -] - -[[package]] -name = "secp256k1" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" -dependencies = [ - "cc", -] - -[[package]] -name = "secret-enclave" -version = "1.4.0" -dependencies = [ - "base64 0.13.0 (git+https://github.com/mesalock-linux/rust-base64-sgx?rev=dc7389e10817b078f289386b3b6a852ab6c4c021)", - "bit-vec", - "chrono", - "ctor", - "derive_more", - "enclave-ffi-types", - "enclave_contract_engine", - "enclave_cosmos_types", - "enclave_crypto", - "enclave_utils", - "hex", - "httparse", - "itertools", - "lazy_static", - "log", - "num-bigint", - "parity-wasm", - "pwasm-utils", - "rustls", - "serde 1.0.118", - "serde_json 1.0.60", - "sgx_edl", - "sgx_rand", - "sgx_tcrypto", - "sgx_tse", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "simple_logger", - "uuid", - "webpki", - "webpki-roots", - "yasna", -] - -[[package]] -name = "secret-query-enclave" -version = "1.4.0" -dependencies = [ - "ctor", - "enclave_contract_engine", - "enclave_utils", - "lazy_static", - "log", - "sgx_edl", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "simple_logger", -] - -[[package]] -name = "semver" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" - -[[package]] -name = "serde" -version = "1.0.118" -source = "git+https://github.com/mesalock-linux/serde-sgx#db0226f1d5d70fca6b96af2c285851502204e21c" -dependencies = [ - "serde_derive 1.0.118", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" -dependencies = [ - "serde_derive 1.0.137", -] - -[[package]] -name = "serde_derive" -version = "1.0.118" -source = "git+https://github.com/mesalock-linux/serde-sgx#db0226f1d5d70fca6b96af2c285851502204e21c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.60" -source = "git+https://github.com/mesalock-linux/serde-json-sgx#380893814ad2a057758d825bab798aa117f7362a" -dependencies = [ - "itoa 0.4.5", - "ryu", - "serde 1.0.118", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa 1.0.2", - "ryu", - "serde 1.0.137", -] - -[[package]] -name = "sgx_alloc" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_alloc" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" - -[[package]] -name = "sgx_backtrace_sys" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "cc", - "sgx_build_helper 0.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_backtrace_sys" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "cc", - "sgx_build_helper 0.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sgx_build_helper" -version = "0.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_build_helper" -version = "0.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" - -[[package]] -name = "sgx_demangle" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_demangle" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" - -[[package]] -name = "sgx_edl" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_libc" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_libc" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sgx_rand" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_tcrypto" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_tprotected_fs" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_tprotected_fs" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sgx_trts" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_trts" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sgx_tse" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_tstd" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "hashbrown_tstd 0.9.0 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_alloc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_backtrace_sys 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_demangle 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_tprotected_fs 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", - "sgx_unwind 0.1.1 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_tstd" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "hashbrown_tstd 0.9.0 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_alloc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_backtrace_sys 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_demangle 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_libc 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_tprotected_fs 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_trts 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_types 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "sgx_unwind 0.1.1 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sgx_types" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_types" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" - -[[package]] -name = "sgx_unwind" -version = "0.1.1" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "sgx_build_helper 0.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269)", -] - -[[package]] -name = "sgx_unwind" -version = "0.1.1" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3#a6a172e652b4db4eaa17e4faa078fda8922abdd0" -dependencies = [ - "sgx_build_helper 0.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "sha3" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" -dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", - "keccak", - "opaque-debug 0.2.3", -] - -[[package]] -name = "simple_logger" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48047e77b528151aaf841a10a9025f9459da80ba820e425ff7eb005708a76dc7" -dependencies = [ - "atty", - "log", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" -dependencies = [ - "serde 1.0.137", -] - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "uint" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-ident" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode-xid" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "wasmi" -version = "0.6.2" -source = "git+https://github.com/paritytech/wasmi?rev=84d2764594d80425373bf4949a58fa3df3d624c3#84d2764594d80425373bf4949a58fa3df3d624c3" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits 0.2.15", - "parity-wasm", - "wasmi-validation", -] - -[[package]] -name = "wasmi-validation" -version = "0.3.0" -source = "git+https://github.com/paritytech/wasmi?rev=84d2764594d80425373bf4949a58fa3df3d624c3#84d2764594d80425373bf4949a58fa3df3d624c3" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "git+https://github.com/mesalock-linux/webpki?branch=mesalock_sgx#8dbe6fbeefadf05582ae47c7fa818b04db49c61e" -dependencies = [ - "ring", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.0" -source = "git+https://github.com/mesalock-linux/webpki-roots?rev=6ff3be547ac13ccd46ae55605ad6506ce30688ef#6ff3be547ac13ccd46ae55605ad6506ce30688ef" -dependencies = [ - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", - "webpki", -] - -[[package]] -name = "which" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" -dependencies = [ - "either", - "lazy_static", - "libc", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "x25519-dalek" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077" -dependencies = [ - "curve25519-dalek", - "rand_core", - "zeroize", -] - -[[package]] -name = "yasna" -version = "0.3.1" -source = "git+https://github.com/mesalock-linux/yasna.rs-sgx?rev=a1f50714cd3eb29608ecf7888cacedc173edfdb2#a1f50714cd3eb29608ecf7888cacedc173edfdb2" -dependencies = [ - "bit-vec", - "chrono", - "num-bigint", - "sgx_tstd 1.1.3 (git+https://github.com/apache/teaclave-sgx-sdk.git?rev=v1.1.3)", -] - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/cosmwasm/enclaves/Cargo.toml b/cosmwasm/enclaves/Cargo.toml index d818d4c6d..f7ec2473c 100644 --- a/cosmwasm/enclaves/Cargo.toml +++ b/cosmwasm/enclaves/Cargo.toml @@ -30,3 +30,34 @@ rand_core = { git = "https://github.com/mesalock-linux/rand-sgx", default-featur "mesalock_sgx" ] } # zeroize = { rev = "2fdfbde87bd085c2f771c9e034fff136cc53fe31", git = "https://github.com/scrtlabs/zeroize" } + +[patch.'https://github.com/apache/teaclave-sgx-sdk.git'] +sgx_align_struct_attribute = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_align_struct_attribute" } +sgx_alloc = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_alloc" } +sgx_backtrace = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace" } +sgx_backtrace_sys = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace_sys" } +sgx_build_helper = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_build_helper" } +sgx_cov = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_cov" } +sgx_crypto_helper = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_crypto_helper" } +sgx_demangle = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_demangle" } +sgx_libc = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_libc" } +sgx_no_tstd = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_no_tstd" } +sgx_rand = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_rand" } +sgx_rand_derive = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_rand_derive" } +sgx_serialize = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize" } +sgx_serialize_derive = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize_derive" } +sgx_serialize_derive_internals = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize_derive_internals" } +sgx_tcrypto = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tcrypto" } +sgx_tcrypto_helper = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tcrypto_helper" } +sgx_tdh = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tdh" } +sgx_tkey_exchange = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tkey_exchange" } +sgx_tprotected_fs = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tprotected_fs" } +sgx_trts = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_trts" } +sgx_tse = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tse" } +sgx_tseal = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tseal" } +sgx_tstd = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd" } +sgx_tunittest = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tunittest" } +sgx_types = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } +#sgx_ucrypto = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_ucrypto" } +sgx_unwind = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_unwind" } +#sgx_urts = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_urts" } diff --git a/cosmwasm/enclaves/Xargo.toml b/cosmwasm/enclaves/Xargo.toml index 559df97b4..ead911733 100644 --- a/cosmwasm/enclaves/Xargo.toml +++ b/cosmwasm/enclaves/Xargo.toml @@ -1,29 +1,29 @@ [dependencies] alloc = { } -sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 1 } -sgx_alloc = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 1 } -sgx_unwind = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 1 } -sgx_demangle = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 1 } -panic_abort = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 1 } -sgx_libc = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 2 } -sgx_tkey_exchange = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 2 } -sgx_tse = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 2 } -sgx_tcrypto = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 2 } -sgx_trts = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 3 } -sgx_backtrace_sys = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 3 } -panic_unwind = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 3 } -sgx_tdh = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 4 } -sgx_tseal = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 4 } -sgx_tprotected_fs = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 4 } -std = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 5, features = [ +sgx_types = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_types", stage = 1 } +sgx_alloc = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_alloc", stage = 1 } +sgx_unwind = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_unwind", stage = 1 } +sgx_demangle = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_demangle", stage = 1 } +panic_abort = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_panic_abort", stage = 1 } +sgx_libc = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_libc", stage = 2 } +sgx_tkey_exchange = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tkey_exchange", stage = 2 } +sgx_tse = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tse", stage = 2 } +sgx_tcrypto = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tcrypto", stage = 2 } +sgx_trts = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_trts", stage = 3 } +sgx_backtrace_sys = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace_sys", stage = 3 } +panic_unwind = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_panic_unwind", stage = 3 } +sgx_tdh = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tdh", stage = 4 } +sgx_tseal = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tseal", stage = 4 } +sgx_tprotected_fs = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tprotected_fs", stage = 4 } +std = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "c70a82f708fd20e9fd0377990dde097d14024f7a", stage = 5, features = [ "net", "backtrace", "untrusted_fs", ] } -sgx_no_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 5 } -sgx_rand = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 6 } -sgx_serialize = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 6 } -sgx_tunittest = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 6 } -sgx_backtrace = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 7 } -sgx_cov = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 7 } -sgx_signal = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", stage = 7 } +sgx_no_tstd = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_no_tstd", stage = 5 } +sgx_rand = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_rand", stage = 6 } +sgx_serialize = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize", stage = 6 } +sgx_tunittest = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_tunittest", stage = 6 } +sgx_backtrace = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace", stage = 7 } +sgx_cov = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_cov", stage = 7 } +sgx_signal = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_signal", stage = 7 } diff --git a/cosmwasm/enclaves/execute/Cargo.toml b/cosmwasm/enclaves/execute/Cargo.toml index ea0c04650..dfd1bb77e 100644 --- a/cosmwasm/enclaves/execute/Cargo.toml +++ b/cosmwasm/enclaves/execute/Cargo.toml @@ -21,15 +21,15 @@ test = ["enclave_contract_engine/test", "enclave_crypto/test", "enclave_cosmos_t # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ "backtrace" ] } -sgx_types = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_types = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git" } [dependencies] -sgx_tse = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -sgx_rand = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -sgx_tcrypto = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_tse = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_rand = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_tcrypto = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git" } enclave-ffi-types = { path = "../ffi-types" } @@ -82,5 +82,33 @@ rev = "95b5e79dc24b02f3ce424437eb9698509d0baf58" default-features = false features = ["dangerous_configuration", "mesalock_sgx"] -[dev-dependencies] -sgx_edl = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +[patch.'https://github.com/apache/teaclave-sgx-sdk.git'] +sgx_align_struct_attribute = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_align_struct_attribute" } +sgx_alloc = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_alloc" } +sgx_backtrace = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace" } +sgx_backtrace_sys = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_backtrace_sys" } +sgx_build_helper = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_build_helper" } +sgx_cov = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_cov" } +sgx_crypto_helper = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_crypto_helper" } +sgx_demangle = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_demangle" } +sgx_libc = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_libc" } +sgx_no_tstd = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_no_tstd" } +sgx_rand = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_rand" } +sgx_rand_derive = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_rand_derive" } +sgx_serialize = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize" } +sgx_serialize_derive = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize_derive" } +sgx_serialize_derive_internals = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_serialize_derive_internals" } +sgx_tcrypto = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tcrypto" } +sgx_tcrypto_helper = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tcrypto_helper" } +sgx_tdh = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tdh" } +sgx_tkey_exchange = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tkey_exchange" } +sgx_tprotected_fs = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tprotected_fs" } +sgx_trts = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_trts" } +sgx_tse = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tse" } +sgx_tseal = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tseal" } +sgx_tstd = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd" } +sgx_tunittest = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_tunittest" } +sgx_types = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } +#sgx_ucrypto = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_ucrypto" } +sgx_unwind = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_unwind" } +#sgx_urts = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_urts" } diff --git a/cosmwasm/enclaves/execute/Makefile b/cosmwasm/enclaves/execute/Makefile index 11b2ce7ec..17b989088 100644 --- a/cosmwasm/enclaves/execute/Makefile +++ b/cosmwasm/enclaves/execute/Makefile @@ -58,8 +58,8 @@ SGX_COMMON_CFLAGS += -fstack-protector ######## CUSTOM Settings ######## CUSTOM_LIBRARY_PATH := ./lib -CUSTOM_EDL_PATH := ../../../third_party/vendor/sgx_edl/edl -CUSTOM_COMMON_PATH := ../../../third_party/vendor/sgx_edl/common +CUSTOM_EDL_PATH := ../../../third_party/incubator-teaclave-sgx-sdk/edl/ +CUSTOM_COMMON_PATH := ../../../third_party/incubator-teaclave-sgx-sdk/sgx_edl/common ######## EDL Settings ######## diff --git a/cosmwasm/enclaves/execute/src/lib.rs b/cosmwasm/enclaves/execute/src/lib.rs index 86a53c8a9..9b5685613 100644 --- a/cosmwasm/enclaves/execute/src/lib.rs +++ b/cosmwasm/enclaves/execute/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(min_const_generics)] - // Trick to get the IDE to use sgx_tstd even when it doesn't know we're targeting SGX #[cfg(not(target_env = "sgx"))] extern crate sgx_tstd as std; diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 79614d0ff..a47833351 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -525,21 +525,19 @@ fn parse_response_sigrl(resp: &[u8]) -> Vec { trace!("parse result {:?}", result); trace!("parse response{:?}", respp); - let msg: &'static str; - - match respp.code { - Some(200) => msg = "OK Operation Successful", - Some(401) => msg = "Unauthorized Failed to authenticate or authorize request.", - Some(404) => msg = "Not Found GID does not refer to a valid EPID group ID.", - Some(500) => msg = "Internal error occurred", + let msg: &'static str = match respp.code { + Some(200) => "OK Operation Successful", + Some(401) => "Unauthorized Failed to authenticate or authorize request.", + Some(404) => "Not Found GID does not refer to a valid EPID group ID.", + Some(500) => "Internal error occurred", Some(503) => { - msg = "Service is currently not able to process the request (due to + "Service is currently not able to process the request (due to a temporary overloading or maintenance). This is a temporary state – the same request can be repeated after some time. " } - _ => msg = "Unknown error occured", - } + _ => "Unknown error occurred", + }; info!("{}", msg); let mut len_num: u32 = 0; diff --git a/cosmwasm/enclaves/execute/src/registration/cert.rs b/cosmwasm/enclaves/execute/src/registration/cert.rs index b4473d4c9..79bd7fd2a 100644 --- a/cosmwasm/enclaves/execute/src/registration/cert.rs +++ b/cosmwasm/enclaves/execute/src/registration/cert.rs @@ -94,7 +94,7 @@ pub fn gen_ecc_cert( writer .next() .write_oid(&ObjectIdentifier::from_slice(&[2, 5, 4, 3])); - writer.next().write_utf8_string(&ISSUER); + writer.next().write_utf8_string(ISSUER); }); }); }); @@ -118,7 +118,7 @@ pub fn gen_ecc_cert( writer .next() .write_oid(&ObjectIdentifier::from_slice(&[2, 5, 4, 3])); - writer.next().write_utf8_string(&SUBJECT); + writer.next().write_utf8_string(SUBJECT); }); }); }); @@ -162,7 +162,7 @@ pub fn gen_ecc_cert( // Signature let sig = { let tbs = &writer.buf[4..]; - ecc_handle.ecdsa_sign_slice(tbs, &prv_k).unwrap() + ecc_handle.ecdsa_sign_slice(tbs, prv_k).unwrap() }; let sig_der = yasna::construct_der(|writer| { writer.write_sequence(|writer| { @@ -268,7 +268,7 @@ pub fn get_ias_auth_config() -> (Vec, rustls::RootCertStore) { let ias_ca_core: &[u8] = &ias_ca_stripped[head_len..full_len - tail_len]; let ias_cert_dec = base64::decode_config(ias_ca_core, base64::STANDARD).unwrap(); - let mut ca_reader = BufReader::new(&IAS_REPORT_CA[..]); + let mut ca_reader = BufReader::new(IAS_REPORT_CA); let mut root_store = rustls::RootCertStore::empty(); root_store diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index dbe99bce8..ca4179f06 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -149,7 +149,7 @@ pub unsafe extern "C" fn ecall_init_node( let encrypted_seed_slice = slice::from_raw_parts(encrypted_seed, encrypted_seed_len as usize); let mut encrypted_seed = [0u8; ENCRYPTED_SEED_SIZE]; - encrypted_seed.copy_from_slice(&encrypted_seed_slice); + encrypted_seed.copy_from_slice(encrypted_seed_slice); // public keys in certificates don't have 0x04, so we'll copy it here let mut target_public_key: [u8; PUBLIC_KEY_SIZE] = [0u8; PUBLIC_KEY_SIZE]; @@ -288,7 +288,7 @@ pub fn attest_from_key( api_key: &[u8], ) -> SgxResult<()> { let (_, cert) = match create_attestation_certificate( - &kp, + kp, sgx_quote_sign_type_t::SGX_UNLINKABLE_SIGNATURE, spid, api_key, diff --git a/cosmwasm/enclaves/execute/src/registration/report.rs b/cosmwasm/enclaves/execute/src/registration/report.rs index 3e88b3965..31e744618 100644 --- a/cosmwasm/enclaves/execute/src/registration/report.rs +++ b/cosmwasm/enclaves/execute/src/registration/report.rs @@ -60,7 +60,7 @@ fn as_base64(key: &[u8], serializer: S) -> Result where S: Serializer, { - serializer.serialize_str(&base64::encode(&key[..])) + serializer.serialize_str(&base64::encode(key)) } fn from_base64<'de, D>(deserializer: D) -> Result, D::Error> @@ -619,8 +619,7 @@ impl AttestationReport { .map(|cert| cert.to_trust_anchor()) .collect(); - let mut chain: Vec<&[u8]> = Vec::new(); - chain.push(&ias_cert); + let chain: Vec<&[u8]> = vec![&ias_cert]; // set as 04.11.23(dd.mm.yy) - should be valid for the foreseeable future, and not rely on SystemTime let time_stamp = webpki::Time::from_seconds_since_unix_epoch(1_699_088_856); diff --git a/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs b/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs index 2b26f2a6e..3ae4c38f7 100644 --- a/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs +++ b/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs @@ -13,8 +13,8 @@ pub fn encrypt_seed(new_node_pk: [u8; PUBLIC_KEY_SIZE]) -> SgxResult> { .unwrap() .diffie_hellman(&new_node_pk); - let mut authenticated_data: Vec<&[u8]> = Vec::default(); - authenticated_data.push(&new_node_pk); + let authenticated_data: Vec<&[u8]> = vec![&new_node_pk]; + // encrypt the seed using the symmetric key derived in the previous stage let res = match AESKey::new_from_slice(&shared_enc_key).encrypt_siv( KEY_MANAGER.get_consensus_seed().unwrap().as_slice() as &[u8], @@ -57,8 +57,7 @@ pub fn decrypt_seed( // Create AD of encryption let my_public_key = key_manager.get_registration_key().unwrap().get_pubkey(); - let mut authenticated_data: Vec<&[u8]> = Vec::default(); - authenticated_data.push(&my_public_key); + let authenticated_data: Vec<&[u8]> = vec![&my_public_key]; // decrypt seed.as_mut() diff --git a/cosmwasm/enclaves/query/Cargo.toml b/cosmwasm/enclaves/query/Cargo.toml index 5f4858d30..90439a9a2 100644 --- a/cosmwasm/enclaves/query/Cargo.toml +++ b/cosmwasm/enclaves/query/Cargo.toml @@ -20,10 +20,10 @@ debug-print = ["enclave_contract_engine/debug-print"] # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ "backtrace" ] } -sgx_types = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_types = { rev = "d2d339cbb005f676bb700059bd51dc689c025f6b", git = "https://github.com/apache/teaclave-sgx-sdk.git" } [dependencies] enclave_contract_engine = { path = "../shared/contract-engine", features = ["query-only"] } @@ -33,7 +33,4 @@ log = "0.4.17" simple_logger = { version = "2.3.0", default-features = false, features = ["stderr"] } ctor = "0.1.13" -[dev-dependencies] -sgx_edl = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } - lazy_static = "1.4" diff --git a/cosmwasm/enclaves/query/Makefile b/cosmwasm/enclaves/query/Makefile index 56b63faa7..3271d6782 100644 --- a/cosmwasm/enclaves/query/Makefile +++ b/cosmwasm/enclaves/query/Makefile @@ -58,8 +58,8 @@ SGX_COMMON_CFLAGS += -fstack-protector ######## CUSTOM Settings ######## CUSTOM_LIBRARY_PATH := ./lib -CUSTOM_EDL_PATH := ../../../third_party/vendor/sgx_edl/edl -CUSTOM_COMMON_PATH := ../../../third_party/vendor/sgx_edl/common +CUSTOM_EDL_PATH := ../../../third_party/incubator-teaclave-sgx-sdk/sgx_edl/edl +CUSTOM_COMMON_PATH := ../../../third_party/incubator-teaclave-sgx-sdk/sgx_edl/common ######## EDL Settings ######## diff --git a/cosmwasm/enclaves/rust-toolchain b/cosmwasm/enclaves/rust-toolchain index 148ed93db..480e8aa7c 100644 --- a/cosmwasm/enclaves/rust-toolchain +++ b/cosmwasm/enclaves/rust-toolchain @@ -1 +1 @@ -nightly-2020-10-25 +nightly-2022-02-23 diff --git a/cosmwasm/enclaves/shared/contract-engine/Cargo.toml b/cosmwasm/enclaves/shared/contract-engine/Cargo.toml index fdff6391f..03d748dea 100644 --- a/cosmwasm/enclaves/shared/contract-engine/Cargo.toml +++ b/cosmwasm/enclaves/shared/contract-engine/Cargo.toml @@ -13,10 +13,10 @@ test = [] # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } -sgx_types = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_types = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } [dependencies] enclave-ffi-types = { path = "../../ffi-types" } diff --git a/cosmwasm/enclaves/shared/contract-engine/src/contract_operations.rs b/cosmwasm/enclaves/shared/contract-engine/src/contract_operations.rs index 79b166b48..14d19c2eb 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/contract_operations.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/contract_operations.rs @@ -78,9 +78,9 @@ pub fn init( verify_params( &parsed_sig_info, - &sent_funds, + sent_funds, &canonical_sender_address, - &contract_address, + contract_address, &secret_msg, )?; @@ -318,7 +318,7 @@ fn extract_sig_info(sig_info: &[u8]) -> Result { serde_json::from_slice(sig_info).map_err(|err| { warn!( "handle got an error while trying to deserialize sig info input bytes into json {:?}: {}", - String::from_utf8_lossy(&sig_info), + String::from_utf8_lossy(sig_info), err ); EnclaveError::FailedToDeserialize @@ -387,8 +387,8 @@ pub fn query( output, &secret_msg, &CanonicalAddr(Binary(Vec::new())), // Not used for queries (can't init a new contract from a query) - &"".to_string(), // Not used for queries (can't call a sub-message from a query), - None, // Not used for queries (Query response is not replied to the caller), + "", // Not used for queries (can't call a sub-message from a query), + None, // Not used for queries (Query response is not replied to the caller), &CanonicalAddr(Binary(Vec::new())), // Not used for queries (used only for replies) true, false, @@ -440,7 +440,7 @@ fn extract_base_env(env: &[u8]) -> Result { .map_err(|err| { warn!( "error while deserializing env into json {:?}: {}", - String::from_utf8_lossy(&env), + String::from_utf8_lossy(env), err ); EnclaveError::FailedToDeserialize @@ -466,7 +466,7 @@ fn extract_query_depth(env: &[u8]) -> Result { .map_err(|err| { warn!( "error while deserializing env into json {:?}: {}", - String::from_utf8_lossy(&env), + String::from_utf8_lossy(env), err ); EnclaveError::FailedToDeserialize diff --git a/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs b/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs index 364a582c9..cfcc6881b 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs @@ -143,10 +143,10 @@ pub fn validate_ibc_msg( match handle_type { HandleType::HANDLE_TYPE_IBC_PACKET_RECEIVE => { let mut parsed_ibc_packet: IbcPacketReceiveMsg = - serde_json::from_slice(&msg.to_vec()).map_err(|err| { + serde_json::from_slice(msg).map_err(|err| { warn!( "IbcPacketReceive msg got an error while trying to deserialize msg input bytes into json {:?}: {}", - String::from_utf8_lossy(&msg), + String::from_utf8_lossy(msg), err ); EnclaveError::FailedToDeserialize @@ -300,7 +300,7 @@ pub fn verify_params( trace!( "sender canonical address is: {:?}", - sender_public_key.get_address().0.0 + sender_public_key.get_address().0 .0 ); trace!("sender signature is: {:?}", sig_info.signature); trace!("sign bytes are: {:?}", sig_info.sign_bytes); @@ -347,7 +347,7 @@ fn get_signer_and_messages( let sender_public_key = sign_doc .auth_info - .sender_public_key(&sender) + .sender_public_key(sender) .ok_or_else(|| { warn!("Couldn't find message sender in auth_info.signer_infos"); EnclaveError::FailedTxVerification diff --git a/cosmwasm/enclaves/shared/contract-engine/src/db.rs b/cosmwasm/enclaves/shared/contract-engine/src/db.rs index 5f12e0876..5c9b058cf 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/db.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/db.rs @@ -27,7 +27,7 @@ pub fn write_encrypted_key( scrambled_field_name ); - let (ad, ad_used_gas) = derive_ad_for_field(&scrambled_field_name, &context)?; + let (ad, ad_used_gas) = derive_ad_for_field(&scrambled_field_name, context)?; let encrypted_value = encrypt_key(&scrambled_field_name, value, contract_key, &ad)?; @@ -228,11 +228,11 @@ fn encrypt_key( let encryption_key = get_symmetrical_key(field_name, contract_key); encryption_key - .encrypt_siv(&value, Some(&[ad])) + .encrypt_siv(value, Some(&[ad])) .map_err(|err| { warn!( "write_db() got an error while trying to encrypt the value {:?}, stopping wasm: {:?}", - String::from_utf8_lossy(&value), + String::from_utf8_lossy(value), err ); WasmEngineError::EncryptionError @@ -249,10 +249,10 @@ fn decrypt_key( // Slice ad from `value` let (ad, encrypted_value) = value.split_at(32); - decryption_key.decrypt_siv(&encrypted_value, Some(&[ad])).map_err(|err| { + decryption_key.decrypt_siv(encrypted_value, Some(&[ad])).map_err(|err| { warn!( "read_db() got an error while trying to decrypt the value for key {:?}, stopping wasm: {:?}", - String::from_utf8_lossy(&field_name), + String::from_utf8_lossy(field_name), err ); WasmEngineError::DecryptionError diff --git a/cosmwasm/enclaves/shared/contract-engine/src/io.rs b/cosmwasm/enclaves/shared/contract-engine/src/io.rs index d4d350781..564583747 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/io.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/io.rs @@ -715,7 +715,7 @@ pub fn encrypt_output( }) } - events.extend_from_slice(&ok.events.clone().as_slice()); + events.extend_from_slice(ok.events.clone().as_slice()); let custom_contract_event_prefix: String = "wasm-".to_string(); for event in events.iter_mut() { if event.ty != "wasm" { diff --git a/cosmwasm/enclaves/shared/contract-engine/src/message.rs b/cosmwasm/enclaves/shared/contract-engine/src/message.rs index 292d6a1f3..d20495b4c 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/message.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/message.rs @@ -1,549 +1,549 @@ -use log::{trace, warn}; - -use cw_types_v010::encoding::Binary; -use cw_types_v1::ibc::IbcPacketReceiveMsg; -use cw_types_v1::results::{ - DecryptedReply, Event, Reply, SubMsgResponse, SubMsgResult, REPLY_ENCRYPTION_MAGIC_BYTES, -}; -use enclave_cosmos_types::types::HandleType; -use enclave_ffi_types::EnclaveError; - -use crate::types::SecretMessage; - -const HEX_ENCODED_HASH_SIZE: usize = 64; -const SIZE_OF_U64: usize = 8; - -pub struct ParsedMessage { - pub should_validate_sig_info: bool, - pub was_msg_encrypted: bool, - pub should_encrypt_output: bool, - pub secret_msg: SecretMessage, - pub decrypted_msg: Vec, - pub data_for_validation: Option>, -} - -pub struct DecryptedSecretMessage { - pub secret_msg: SecretMessage, - pub decrypted_msg: Vec, -} - -pub fn redact_custom_events(reply: &mut Reply) { - reply.result = match &reply.result { - SubMsgResult::Ok(r) => { - let mut events: Vec = Default::default(); - - let filtered_attributes = vec!["contract_address".to_string(), "code_id".to_string()]; - for ev in r.events.iter() { - if !ev.ty.starts_with("wasm") { - continue; - } - - let mut new_ev = Event { - ty: ev.ty.clone(), - attributes: vec![], - }; - - for attr in &ev.attributes { - if !filtered_attributes.contains(&attr.key) { - new_ev.attributes.push(attr.clone()); - } - } - - if !new_ev.attributes.is_empty() { - events.push(new_ev); - } - } - - SubMsgResult::Ok(SubMsgResponse { - events, - data: r.data.clone(), - }) - } - SubMsgResult::Err(_) => reply.result.clone(), - }; -} - -pub fn get_secret_msg(message: &[u8]) -> SecretMessage { - match SecretMessage::from_slice(message) { - Ok(orig_secret_msg) => orig_secret_msg, - Err(_) => { - trace!( - "Msg is not SecretMessage (probably plaintext): {:?}", - base64::encode(&message) - ); - - SecretMessage { - nonce: [0; 32], - user_public_key: [0; 32], - msg: message.into(), - } - } - } -} - -pub fn try_get_decrypted_secret_msg(message: &[u8]) -> Option { - let secret_msg = get_secret_msg(message); - match secret_msg.decrypt() { - Ok(decrypted_msg) => Some(DecryptedSecretMessage { - secret_msg, - decrypted_msg, - }), - Err(_) => None, - } -} - -// Parse the message that was passed to handle (Based on the assumption that it might be a reply or IBC as well) -pub fn parse_message( - message: &[u8], - handle_type: &HandleType, -) -> Result { - return match handle_type { - HandleType::HANDLE_TYPE_EXECUTE => match try_get_decrypted_secret_msg(message) { - Some(decrypted_secret_msg) => { - trace!( - "execute input before decryption: {:?}", - base64::encode(&message) - ); - - Ok(ParsedMessage { - should_validate_sig_info: true, - was_msg_encrypted: true, - should_encrypt_output: true, - secret_msg: decrypted_secret_msg.secret_msg, - decrypted_msg: decrypted_secret_msg.decrypted_msg, - data_for_validation: None, - }) - } - None => { - trace!( - "execute input was plaintext: {:?}", - base64::encode(&message) - ); - - let secret_msg = SecretMessage { - nonce: [0; 32], - user_public_key: [0; 32], - msg: message.into(), - }; - - let decrypted_msg = secret_msg.msg.clone(); - - Ok(ParsedMessage { - should_validate_sig_info: true, - was_msg_encrypted: false, - should_encrypt_output: false, - secret_msg, - decrypted_msg, - data_for_validation: None, - }) - } - }, - HandleType::HANDLE_TYPE_REPLY => { - let orig_secret_msg = SecretMessage::from_slice(message)?; - let mut parsed_reply: Reply = - serde_json::from_slice(&orig_secret_msg.msg).map_err(|err| { - warn!( - "reply got an error while trying to deserialize reply bytes into json {:?}: {}", - String::from_utf8_lossy(&orig_secret_msg.msg.clone()), - err - ); - EnclaveError::FailedToDeserialize - })?; - - if !parsed_reply.is_encrypted { - trace!( - "reply input is not encrypted: {:?}", - base64::encode(&message) - ); - - let msg_id = - String::from_utf8(parsed_reply.id.as_slice().to_vec()).map_err(|err| { - warn!( - "Failed to parse message id as string {:?}: {}", - parsed_reply.id.as_slice().to_vec(), - err - ); - EnclaveError::FailedToDeserialize - })?; - - let msg_id_as_num = match msg_id.parse::() { - Ok(m) => m, - Err(err) => { - warn!("Failed to parse message id as number {}: {}", msg_id, err); - return Err(EnclaveError::FailedToDeserialize); - } - }; - - let decrypted_reply = DecryptedReply { - id: msg_id_as_num, - result: parsed_reply.result.clone(), - }; - - redact_custom_events(&mut parsed_reply); - let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { - warn!( - "got an error while trying to serialize encrypted reply into bytes {:?}: {}", - parsed_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - let reply_secret_msg = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: serialized_encrypted_reply, - }; - - let serialized_reply: Vec = serde_json::to_vec(&decrypted_reply).map_err(|err| { - warn!( - "got an error while trying to serialize decrypted reply into bytes {:?}: {}", - decrypted_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - return Ok(ParsedMessage { - should_validate_sig_info: false, - was_msg_encrypted: false, - should_encrypt_output: parsed_reply.was_orig_msg_encrypted, - secret_msg: reply_secret_msg, - decrypted_msg: serialized_reply, - data_for_validation: None, - }); - } - - trace!( - "reply input before decryption: {:?}", - base64::encode(&message) - ); - - match parsed_reply.result.clone() { - SubMsgResult::Ok(response) => { - let decrypted_msg_data = match response.data { - Some(data) => { - let tmp_secret_msg_data = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: data.as_slice().to_vec(), - }; - - let base64_data = - tmp_secret_msg_data.decrypt()?[HEX_ENCODED_HASH_SIZE..].to_vec(); - - Some(Binary::from_base64( - String::from_utf8(base64_data.clone()) - .map_err(|err| { - warn!( - "Failed to parse result data as string {:?}: {}", - base64_data, err - ); - EnclaveError::FailedToDeserialize - })? - .as_str(), - )?) - } - None => None, - }; - - let tmp_secret_msg_id = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: parsed_reply.id.as_slice().to_vec(), - }; - - let mut tmp_decrypted_msg_id = tmp_secret_msg_id.decrypt()?; - - // Now we need to create synthetic SecretMessage to fit the API in "handle" - let result = SubMsgResult::Ok(SubMsgResponse { - events: response.events, - data: decrypted_msg_data, - }); - - let mut data_for_validation: Vec = - tmp_decrypted_msg_id[..HEX_ENCODED_HASH_SIZE].to_vec(); - tmp_decrypted_msg_id = tmp_decrypted_msg_id[HEX_ENCODED_HASH_SIZE..].to_vec(); - while tmp_decrypted_msg_id.len() >= REPLY_ENCRYPTION_MAGIC_BYTES.len() - && tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len())] - == *REPLY_ENCRYPTION_MAGIC_BYTES - { - data_for_validation.extend_from_slice( - &tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len() - + SIZE_OF_U64 - + HEX_ENCODED_HASH_SIZE)], - ); - - tmp_decrypted_msg_id = tmp_decrypted_msg_id[(REPLY_ENCRYPTION_MAGIC_BYTES - .len() - + SIZE_OF_U64 - + HEX_ENCODED_HASH_SIZE)..] - .to_vec(); - } - - let msg_id = - String::from_utf8(tmp_decrypted_msg_id.clone()).map_err(|err| { - warn!( - "Failed to parse message id as string {:?}: {}", - tmp_decrypted_msg_id, err - ); - EnclaveError::FailedToDeserialize - })?; - - let msg_id_as_num = match msg_id.parse::() { - Ok(m) => m, - Err(err) => { - warn!("Failed to parse message id as number {}: {}", msg_id, err); - return Err(EnclaveError::FailedToDeserialize); - } - }; - - let decrypted_reply = DecryptedReply { - id: msg_id_as_num, - result, - }; - - let decrypted_reply_as_vec = - serde_json::to_vec(&decrypted_reply).map_err(|err| { - warn!( - "got an error while trying to serialize reply into bytes {:?}: {}", - decrypted_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - redact_custom_events(&mut parsed_reply); - let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { - warn!( - "got an error while trying to serialize encrypted reply into bytes {:?}: {}", - parsed_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - let reply_secret_msg = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: serialized_encrypted_reply, - }; - - Ok(ParsedMessage { - should_validate_sig_info: true, - was_msg_encrypted: true, - should_encrypt_output: true, - secret_msg: reply_secret_msg, - decrypted_msg: decrypted_reply_as_vec, - data_for_validation: Some(data_for_validation), - }) - } - SubMsgResult::Err(response) => { - let secret_msg = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: base64::decode(response.clone()).map_err(|err| { - warn!( - "got an error while trying to serialize err reply from base64 {:?}: {}", - response, err - ); - EnclaveError::FailedToSerialize - })? - }; - - let decrypted_error = secret_msg.decrypt()?; - - let tmp_secret_msg_id = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: parsed_reply.id.as_slice().to_vec(), - }; - - let mut tmp_decrypted_msg_id = tmp_secret_msg_id.decrypt()?; - - // Now we need to create synthetic SecretMessage to fit the API in "handle" - let result = SubMsgResult::Err( - String::from_utf8(decrypted_error[HEX_ENCODED_HASH_SIZE..].to_vec()) - .map_err(|err| { - warn!( - "Failed to parse error as string {:?}: {}", - decrypted_error[HEX_ENCODED_HASH_SIZE..].to_vec(), - err - ); - EnclaveError::FailedToDeserialize - })?, - ); - - let mut data_for_validation: Vec = - tmp_decrypted_msg_id[..HEX_ENCODED_HASH_SIZE].to_vec(); - tmp_decrypted_msg_id = tmp_decrypted_msg_id[HEX_ENCODED_HASH_SIZE..].to_vec(); - while tmp_decrypted_msg_id.len() >= REPLY_ENCRYPTION_MAGIC_BYTES.len() - && tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len())] - == *REPLY_ENCRYPTION_MAGIC_BYTES - { - data_for_validation.extend_from_slice( - &tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len() - + SIZE_OF_U64 - + HEX_ENCODED_HASH_SIZE)], - ); - - tmp_decrypted_msg_id = tmp_decrypted_msg_id[(REPLY_ENCRYPTION_MAGIC_BYTES - .len() - + SIZE_OF_U64 - + HEX_ENCODED_HASH_SIZE)..] - .to_vec(); - } - - let msg_id = - String::from_utf8(tmp_decrypted_msg_id.clone()).map_err(|err| { - warn!( - "Failed to parse message id as string {:?}: {}", - tmp_decrypted_msg_id, err - ); - EnclaveError::FailedToDeserialize - })?; - - let msg_id_as_num = match msg_id.parse::() { - Ok(m) => m, - Err(err) => { - warn!("Failed to parse message id as number {}: {}", msg_id, err); - return Err(EnclaveError::FailedToDeserialize); - } - }; - - let decrypted_reply = DecryptedReply { - id: msg_id_as_num, - result, - }; - - let decrypted_reply_as_vec = - serde_json::to_vec(&decrypted_reply).map_err(|err| { - warn!( - "got an error while trying to serialize reply into bytes {:?}: {}", - decrypted_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { - warn!( - "got an error while trying to serialize encrypted reply into bytes {:?}: {}", - parsed_reply, err - ); - EnclaveError::FailedToSerialize - })?; - - let reply_secret_msg = SecretMessage { - nonce: orig_secret_msg.nonce, - user_public_key: orig_secret_msg.user_public_key, - msg: serialized_encrypted_reply, - }; - - Ok(ParsedMessage { - should_validate_sig_info: true, - was_msg_encrypted: true, - should_encrypt_output: true, - secret_msg: reply_secret_msg, - decrypted_msg: decrypted_reply_as_vec, - data_for_validation: Some(data_for_validation), - }) - } - } - } - HandleType::HANDLE_TYPE_IBC_CHANNEL_OPEN - | HandleType::HANDLE_TYPE_IBC_CHANNEL_CONNECT - | HandleType::HANDLE_TYPE_IBC_CHANNEL_CLOSE - | HandleType::HANDLE_TYPE_IBC_PACKET_ACK - | HandleType::HANDLE_TYPE_IBC_PACKET_TIMEOUT => { - trace!( - "parsing {} msg (Should always be plaintext): {:?}", - HandleType::to_export_name(&handle_type), - base64::encode(&message) - ); - - let scrt_msg = SecretMessage { - nonce: [0; 32], - user_public_key: [0; 32], - msg: message.into(), - }; - - let decrypted_msg = scrt_msg.msg.clone(); - - Ok(ParsedMessage { - should_validate_sig_info: false, - was_msg_encrypted: false, - should_encrypt_output: false, - secret_msg: scrt_msg, - decrypted_msg, - data_for_validation: None, - }) - } - HandleType::HANDLE_TYPE_IBC_PACKET_RECEIVE => { - // TODO: Maybe mark whether the message was encrypted or not. - let mut parsed_encrypted_ibc_packet: IbcPacketReceiveMsg = - serde_json::from_slice(&message.to_vec()).map_err(|err| { - warn!( - "Got an error while trying to deserialize input bytes msg into IbcPacketReceiveMsg message {:?}: {}", - String::from_utf8_lossy(&message), - err - ); - EnclaveError::FailedToDeserialize - })?; - - let tmp_secret_data = - get_secret_msg(parsed_encrypted_ibc_packet.packet.data.as_slice()); - let mut was_msg_encrypted = false; - let mut orig_secret_msg = tmp_secret_data; - - match orig_secret_msg.decrypt() { - Ok(decrypted_msg) => { - // IBC packet was encrypted - - trace!( - "ibc_packet_receive data before decryption: {:?}", - base64::encode(&message) - ); - - parsed_encrypted_ibc_packet.packet.data = decrypted_msg.as_slice().into(); - was_msg_encrypted = true; - } - Err(_) => { - // assume data is not encrypted - - trace!( - "ibc_packet_receive data was plaintext: {:?}", - base64::encode(&message) - ); - - orig_secret_msg = SecretMessage { - nonce: [0; 32], - user_public_key: [0; 32], - msg: message.into(), - }; - } - } - Ok(ParsedMessage { - should_validate_sig_info: false, - was_msg_encrypted, - should_encrypt_output: was_msg_encrypted, - secret_msg: orig_secret_msg, - decrypted_msg: serde_json::to_vec(&parsed_encrypted_ibc_packet).map_err(|err| { - warn!( - "got an error while trying to serialize IbcPacketReceive msg into bytes {:?}: {}", - parsed_encrypted_ibc_packet, err - ); - EnclaveError::FailedToSerialize - })?, - data_for_validation: None, - }) - } - }; -} - -pub fn is_ibc_msg(handle_type: HandleType) -> bool { - match handle_type { - HandleType::HANDLE_TYPE_EXECUTE | HandleType::HANDLE_TYPE_REPLY => false, - HandleType::HANDLE_TYPE_IBC_CHANNEL_OPEN - | HandleType::HANDLE_TYPE_IBC_CHANNEL_CONNECT - | HandleType::HANDLE_TYPE_IBC_CHANNEL_CLOSE - | HandleType::HANDLE_TYPE_IBC_PACKET_RECEIVE - | HandleType::HANDLE_TYPE_IBC_PACKET_ACK - | HandleType::HANDLE_TYPE_IBC_PACKET_TIMEOUT => true, - } -} +use log::{trace, warn}; + +use cw_types_v010::encoding::Binary; +use cw_types_v1::ibc::IbcPacketReceiveMsg; +use cw_types_v1::results::{ + DecryptedReply, Event, Reply, SubMsgResponse, SubMsgResult, REPLY_ENCRYPTION_MAGIC_BYTES, +}; +use enclave_cosmos_types::types::HandleType; +use enclave_ffi_types::EnclaveError; + +use crate::types::SecretMessage; + +const HEX_ENCODED_HASH_SIZE: usize = 64; +const SIZE_OF_U64: usize = 8; + +pub struct ParsedMessage { + pub should_validate_sig_info: bool, + pub was_msg_encrypted: bool, + pub should_encrypt_output: bool, + pub secret_msg: SecretMessage, + pub decrypted_msg: Vec, + pub data_for_validation: Option>, +} + +pub struct DecryptedSecretMessage { + pub secret_msg: SecretMessage, + pub decrypted_msg: Vec, +} + +pub fn redact_custom_events(reply: &mut Reply) { + reply.result = match &reply.result { + SubMsgResult::Ok(r) => { + let mut events: Vec = Default::default(); + + let filtered_attributes = vec!["contract_address".to_string(), "code_id".to_string()]; + for ev in r.events.iter() { + if !ev.ty.starts_with("wasm") { + continue; + } + + let mut new_ev = Event { + ty: ev.ty.clone(), + attributes: vec![], + }; + + for attr in &ev.attributes { + if !filtered_attributes.contains(&attr.key) { + new_ev.attributes.push(attr.clone()); + } + } + + if !new_ev.attributes.is_empty() { + events.push(new_ev); + } + } + + SubMsgResult::Ok(SubMsgResponse { + events, + data: r.data.clone(), + }) + } + SubMsgResult::Err(_) => reply.result.clone(), + }; +} + +pub fn get_secret_msg(message: &[u8]) -> SecretMessage { + match SecretMessage::from_slice(message) { + Ok(orig_secret_msg) => orig_secret_msg, + Err(_) => { + trace!( + "Msg is not SecretMessage (probably plaintext): {:?}", + base64::encode(&message) + ); + + SecretMessage { + nonce: [0; 32], + user_public_key: [0; 32], + msg: message.into(), + } + } + } +} + +pub fn try_get_decrypted_secret_msg(message: &[u8]) -> Option { + let secret_msg = get_secret_msg(message); + match secret_msg.decrypt() { + Ok(decrypted_msg) => Some(DecryptedSecretMessage { + secret_msg, + decrypted_msg, + }), + Err(_) => None, + } +} + +// Parse the message that was passed to handle (Based on the assumption that it might be a reply or IBC as well) +pub fn parse_message( + message: &[u8], + handle_type: &HandleType, +) -> Result { + return match handle_type { + HandleType::HANDLE_TYPE_EXECUTE => match try_get_decrypted_secret_msg(message) { + Some(decrypted_secret_msg) => { + trace!( + "execute input before decryption: {:?}", + base64::encode(&message) + ); + + Ok(ParsedMessage { + should_validate_sig_info: true, + was_msg_encrypted: true, + should_encrypt_output: true, + secret_msg: decrypted_secret_msg.secret_msg, + decrypted_msg: decrypted_secret_msg.decrypted_msg, + data_for_validation: None, + }) + } + None => { + trace!( + "execute input was plaintext: {:?}", + base64::encode(&message) + ); + + let secret_msg = SecretMessage { + nonce: [0; 32], + user_public_key: [0; 32], + msg: message.into(), + }; + + let decrypted_msg = secret_msg.msg.clone(); + + Ok(ParsedMessage { + should_validate_sig_info: true, + was_msg_encrypted: false, + should_encrypt_output: false, + secret_msg, + decrypted_msg, + data_for_validation: None, + }) + } + }, + HandleType::HANDLE_TYPE_REPLY => { + let orig_secret_msg = SecretMessage::from_slice(message)?; + let mut parsed_reply: Reply = + serde_json::from_slice(&orig_secret_msg.msg).map_err(|err| { + warn!( + "reply got an error while trying to deserialize reply bytes into json {:?}: {}", + String::from_utf8_lossy(&orig_secret_msg.msg.clone()), + err + ); + EnclaveError::FailedToDeserialize + })?; + + if !parsed_reply.is_encrypted { + trace!( + "reply input is not encrypted: {:?}", + base64::encode(&message) + ); + + let msg_id = + String::from_utf8(parsed_reply.id.as_slice().to_vec()).map_err(|err| { + warn!( + "Failed to parse message id as string {:?}: {}", + parsed_reply.id.as_slice().to_vec(), + err + ); + EnclaveError::FailedToDeserialize + })?; + + let msg_id_as_num = match msg_id.parse::() { + Ok(m) => m, + Err(err) => { + warn!("Failed to parse message id as number {}: {}", msg_id, err); + return Err(EnclaveError::FailedToDeserialize); + } + }; + + let decrypted_reply = DecryptedReply { + id: msg_id_as_num, + result: parsed_reply.result.clone(), + }; + + redact_custom_events(&mut parsed_reply); + let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { + warn!( + "got an error while trying to serialize encrypted reply into bytes {:?}: {}", + parsed_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + let reply_secret_msg = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: serialized_encrypted_reply, + }; + + let serialized_reply: Vec = serde_json::to_vec(&decrypted_reply).map_err(|err| { + warn!( + "got an error while trying to serialize decrypted reply into bytes {:?}: {}", + decrypted_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + return Ok(ParsedMessage { + should_validate_sig_info: false, + was_msg_encrypted: false, + should_encrypt_output: parsed_reply.was_orig_msg_encrypted, + secret_msg: reply_secret_msg, + decrypted_msg: serialized_reply, + data_for_validation: None, + }); + } + + trace!( + "reply input before decryption: {:?}", + base64::encode(&message) + ); + + match parsed_reply.result.clone() { + SubMsgResult::Ok(response) => { + let decrypted_msg_data = match response.data { + Some(data) => { + let tmp_secret_msg_data = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: data.as_slice().to_vec(), + }; + + let base64_data = + tmp_secret_msg_data.decrypt()?[HEX_ENCODED_HASH_SIZE..].to_vec(); + + Some(Binary::from_base64( + String::from_utf8(base64_data.clone()) + .map_err(|err| { + warn!( + "Failed to parse result data as string {:?}: {}", + base64_data, err + ); + EnclaveError::FailedToDeserialize + })? + .as_str(), + )?) + } + None => None, + }; + + let tmp_secret_msg_id = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: parsed_reply.id.as_slice().to_vec(), + }; + + let mut tmp_decrypted_msg_id = tmp_secret_msg_id.decrypt()?; + + // Now we need to create synthetic SecretMessage to fit the API in "handle" + let result = SubMsgResult::Ok(SubMsgResponse { + events: response.events, + data: decrypted_msg_data, + }); + + let mut data_for_validation: Vec = + tmp_decrypted_msg_id[..HEX_ENCODED_HASH_SIZE].to_vec(); + tmp_decrypted_msg_id = tmp_decrypted_msg_id[HEX_ENCODED_HASH_SIZE..].to_vec(); + while tmp_decrypted_msg_id.len() >= REPLY_ENCRYPTION_MAGIC_BYTES.len() + && tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len())] + == *REPLY_ENCRYPTION_MAGIC_BYTES + { + data_for_validation.extend_from_slice( + &tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len() + + SIZE_OF_U64 + + HEX_ENCODED_HASH_SIZE)], + ); + + tmp_decrypted_msg_id = tmp_decrypted_msg_id[(REPLY_ENCRYPTION_MAGIC_BYTES + .len() + + SIZE_OF_U64 + + HEX_ENCODED_HASH_SIZE)..] + .to_vec(); + } + + let msg_id = + String::from_utf8(tmp_decrypted_msg_id.clone()).map_err(|err| { + warn!( + "Failed to parse message id as string {:?}: {}", + tmp_decrypted_msg_id, err + ); + EnclaveError::FailedToDeserialize + })?; + + let msg_id_as_num = match msg_id.parse::() { + Ok(m) => m, + Err(err) => { + warn!("Failed to parse message id as number {}: {}", msg_id, err); + return Err(EnclaveError::FailedToDeserialize); + } + }; + + let decrypted_reply = DecryptedReply { + id: msg_id_as_num, + result, + }; + + let decrypted_reply_as_vec = + serde_json::to_vec(&decrypted_reply).map_err(|err| { + warn!( + "got an error while trying to serialize reply into bytes {:?}: {}", + decrypted_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + redact_custom_events(&mut parsed_reply); + let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { + warn!( + "got an error while trying to serialize encrypted reply into bytes {:?}: {}", + parsed_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + let reply_secret_msg = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: serialized_encrypted_reply, + }; + + Ok(ParsedMessage { + should_validate_sig_info: true, + was_msg_encrypted: true, + should_encrypt_output: true, + secret_msg: reply_secret_msg, + decrypted_msg: decrypted_reply_as_vec, + data_for_validation: Some(data_for_validation), + }) + } + SubMsgResult::Err(response) => { + let secret_msg = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: base64::decode(response.clone()).map_err(|err| { + warn!( + "got an error while trying to serialize err reply from base64 {:?}: {}", + response, err + ); + EnclaveError::FailedToSerialize + })? + }; + + let decrypted_error = secret_msg.decrypt()?; + + let tmp_secret_msg_id = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: parsed_reply.id.as_slice().to_vec(), + }; + + let mut tmp_decrypted_msg_id = tmp_secret_msg_id.decrypt()?; + + // Now we need to create synthetic SecretMessage to fit the API in "handle" + let result = SubMsgResult::Err( + String::from_utf8(decrypted_error[HEX_ENCODED_HASH_SIZE..].to_vec()) + .map_err(|err| { + warn!( + "Failed to parse error as string {:?}: {}", + decrypted_error[HEX_ENCODED_HASH_SIZE..].to_vec(), + err + ); + EnclaveError::FailedToDeserialize + })?, + ); + + let mut data_for_validation: Vec = + tmp_decrypted_msg_id[..HEX_ENCODED_HASH_SIZE].to_vec(); + tmp_decrypted_msg_id = tmp_decrypted_msg_id[HEX_ENCODED_HASH_SIZE..].to_vec(); + while tmp_decrypted_msg_id.len() >= REPLY_ENCRYPTION_MAGIC_BYTES.len() + && tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len())] + == *REPLY_ENCRYPTION_MAGIC_BYTES + { + data_for_validation.extend_from_slice( + &tmp_decrypted_msg_id[0..(REPLY_ENCRYPTION_MAGIC_BYTES.len() + + SIZE_OF_U64 + + HEX_ENCODED_HASH_SIZE)], + ); + + tmp_decrypted_msg_id = tmp_decrypted_msg_id[(REPLY_ENCRYPTION_MAGIC_BYTES + .len() + + SIZE_OF_U64 + + HEX_ENCODED_HASH_SIZE)..] + .to_vec(); + } + + let msg_id = + String::from_utf8(tmp_decrypted_msg_id.clone()).map_err(|err| { + warn!( + "Failed to parse message id as string {:?}: {}", + tmp_decrypted_msg_id, err + ); + EnclaveError::FailedToDeserialize + })?; + + let msg_id_as_num = match msg_id.parse::() { + Ok(m) => m, + Err(err) => { + warn!("Failed to parse message id as number {}: {}", msg_id, err); + return Err(EnclaveError::FailedToDeserialize); + } + }; + + let decrypted_reply = DecryptedReply { + id: msg_id_as_num, + result, + }; + + let decrypted_reply_as_vec = + serde_json::to_vec(&decrypted_reply).map_err(|err| { + warn!( + "got an error while trying to serialize reply into bytes {:?}: {}", + decrypted_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + let serialized_encrypted_reply : Vec = serde_json::to_vec(&parsed_reply).map_err(|err| { + warn!( + "got an error while trying to serialize encrypted reply into bytes {:?}: {}", + parsed_reply, err + ); + EnclaveError::FailedToSerialize + })?; + + let reply_secret_msg = SecretMessage { + nonce: orig_secret_msg.nonce, + user_public_key: orig_secret_msg.user_public_key, + msg: serialized_encrypted_reply, + }; + + Ok(ParsedMessage { + should_validate_sig_info: true, + was_msg_encrypted: true, + should_encrypt_output: true, + secret_msg: reply_secret_msg, + decrypted_msg: decrypted_reply_as_vec, + data_for_validation: Some(data_for_validation), + }) + } + } + } + HandleType::HANDLE_TYPE_IBC_CHANNEL_OPEN + | HandleType::HANDLE_TYPE_IBC_CHANNEL_CONNECT + | HandleType::HANDLE_TYPE_IBC_CHANNEL_CLOSE + | HandleType::HANDLE_TYPE_IBC_PACKET_ACK + | HandleType::HANDLE_TYPE_IBC_PACKET_TIMEOUT => { + trace!( + "parsing {} msg (Should always be plaintext): {:?}", + HandleType::to_export_name(handle_type), + base64::encode(&message) + ); + + let scrt_msg = SecretMessage { + nonce: [0; 32], + user_public_key: [0; 32], + msg: message.into(), + }; + + let decrypted_msg = scrt_msg.msg.clone(); + + Ok(ParsedMessage { + should_validate_sig_info: false, + was_msg_encrypted: false, + should_encrypt_output: false, + secret_msg: scrt_msg, + decrypted_msg, + data_for_validation: None, + }) + } + HandleType::HANDLE_TYPE_IBC_PACKET_RECEIVE => { + // TODO: Maybe mark whether the message was encrypted or not. + let mut parsed_encrypted_ibc_packet: IbcPacketReceiveMsg = + serde_json::from_slice(message).map_err(|err| { + warn!( + "Got an error while trying to deserialize input bytes msg into IbcPacketReceiveMsg message {:?}: {}", + String::from_utf8_lossy(message), + err + ); + EnclaveError::FailedToDeserialize + })?; + + let tmp_secret_data = + get_secret_msg(parsed_encrypted_ibc_packet.packet.data.as_slice()); + let mut was_msg_encrypted = false; + let mut orig_secret_msg = tmp_secret_data; + + match orig_secret_msg.decrypt() { + Ok(decrypted_msg) => { + // IBC packet was encrypted + + trace!( + "ibc_packet_receive data before decryption: {:?}", + base64::encode(&message) + ); + + parsed_encrypted_ibc_packet.packet.data = decrypted_msg.as_slice().into(); + was_msg_encrypted = true; + } + Err(_) => { + // assume data is not encrypted + + trace!( + "ibc_packet_receive data was plaintext: {:?}", + base64::encode(&message) + ); + + orig_secret_msg = SecretMessage { + nonce: [0; 32], + user_public_key: [0; 32], + msg: message.into(), + }; + } + } + Ok(ParsedMessage { + should_validate_sig_info: false, + was_msg_encrypted, + should_encrypt_output: was_msg_encrypted, + secret_msg: orig_secret_msg, + decrypted_msg: serde_json::to_vec(&parsed_encrypted_ibc_packet).map_err(|err| { + warn!( + "got an error while trying to serialize IbcPacketReceive msg into bytes {:?}: {}", + parsed_encrypted_ibc_packet, err + ); + EnclaveError::FailedToSerialize + })?, + data_for_validation: None, + }) + } + }; +} + +pub fn is_ibc_msg(handle_type: HandleType) -> bool { + match handle_type { + HandleType::HANDLE_TYPE_EXECUTE | HandleType::HANDLE_TYPE_REPLY => false, + HandleType::HANDLE_TYPE_IBC_CHANNEL_OPEN + | HandleType::HANDLE_TYPE_IBC_CHANNEL_CONNECT + | HandleType::HANDLE_TYPE_IBC_CHANNEL_CLOSE + | HandleType::HANDLE_TYPE_IBC_PACKET_RECEIVE + | HandleType::HANDLE_TYPE_IBC_PACKET_ACK + | HandleType::HANDLE_TYPE_IBC_PACKET_TIMEOUT => true, + } +} diff --git a/cosmwasm/enclaves/shared/contract-engine/src/query_chain.rs b/cosmwasm/enclaves/shared/contract-engine/src/query_chain.rs index 7a5a98bd0..e20c8c0c1 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/query_chain.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/query_chain.rs @@ -343,7 +343,7 @@ fn decrypt_query_response_error( error_msg.decrypt().map_err(|err| { debug!( "encrypt_and_query_chain() got an error while trying to decrypt the inner error for query {:?}, stopping wasm: {:?}", - String::from_utf8_lossy(&query), + String::from_utf8_lossy(query), err ); WasmEngineError::DecryptionError diff --git a/cosmwasm/enclaves/shared/contract-engine/src/wasm/contract.rs b/cosmwasm/enclaves/shared/contract-engine/src/wasm/contract.rs index 9e29b8c75..db6b1aada 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/wasm/contract.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/wasm/contract.rs @@ -548,7 +548,7 @@ impl WasmiApi for ContractInstance { ))); } - let (decoded_prefix, data) = match bech32::decode(&human_addr_str) { + let (decoded_prefix, data) = match bech32::decode(human_addr_str) { Err(err) => { debug!( "canonicalize_address() error while trying to decode human address {:?} as bech32: {:?}", @@ -748,7 +748,7 @@ impl WasmiApi for ContractInstance { Ok(x) => x, }; - let canonical_address = match bech32::decode(&source_human_address) { + let canonical_address = match bech32::decode(source_human_address) { Err(err) => { debug!( "addr_validate() error while trying to decode human address {:?} as bech32: {:?}", @@ -826,7 +826,7 @@ impl WasmiApi for ContractInstance { Ok(x) => x, }; - let (decoded_prefix, data) = match bech32::decode(&human_addr_str) { + let (decoded_prefix, data) = match bech32::decode(human_addr_str) { Err(err) => { debug!( "addr_canonicalize() error while trying to decode human address {:?} as bech32: {:?}", diff --git a/cosmwasm/enclaves/shared/contract-engine/src/wasm/externals.rs b/cosmwasm/enclaves/shared/contract-engine/src/wasm/externals.rs index 557231114..22bdfaa25 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/wasm/externals.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/wasm/externals.rs @@ -72,6 +72,7 @@ impl From for HostFunctions { } } +#[allow(clippy::from_over_into)] impl Into for HostFunctions { fn into(self) -> usize { self as usize diff --git a/cosmwasm/enclaves/shared/cosmos-types/Cargo.toml b/cosmwasm/enclaves/shared/cosmos-types/Cargo.toml index e9c5ece00..0c99970bb 100644 --- a/cosmwasm/enclaves/shared/cosmos-types/Cargo.toml +++ b/cosmwasm/enclaves/shared/cosmos-types/Cargo.toml @@ -11,7 +11,7 @@ test = [] # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } diff --git a/cosmwasm/enclaves/shared/cosmos-types/src/multisig.rs b/cosmwasm/enclaves/shared/cosmos-types/src/multisig.rs index 994216f87..c1b174eb6 100644 --- a/cosmwasm/enclaves/shared/cosmos-types/src/multisig.rs +++ b/cosmwasm/enclaves/shared/cosmos-types/src/multisig.rs @@ -209,7 +209,7 @@ fn decode_multisig_signature_old(raw_blob: &[u8]) -> Result>, Crypto if let Some(raw_signature) = sig_including_len.get(len_size..current_sig_len + len_size) { - signatures.push((&raw_signature).to_vec()); + signatures.push(raw_signature.to_vec()); idx += 1 + len_size + current_sig_len; // prefix_byte + length_byte + len(sig) } else { warn!("Multisig signature malformed. decoding failed!"); diff --git a/cosmwasm/enclaves/shared/cosmos-types/src/types.rs b/cosmwasm/enclaves/shared/cosmos-types/src/types.rs index 531f1c22b..4d9ca98fb 100644 --- a/cosmwasm/enclaves/shared/cosmos-types/src/types.rs +++ b/cosmwasm/enclaves/shared/cosmos-types/src/types.rs @@ -23,7 +23,7 @@ use cw_types_v010::{ use crate::traits::CosmosAminoPubkey; pub fn calc_contract_hash(contract_bytes: &[u8]) -> [u8; HASH_SIZE] { - sha_256(&contract_bytes) + sha_256(contract_bytes) } pub struct ContractCode<'code> { @@ -250,7 +250,9 @@ impl SignDoc { pub struct TxBody { pub messages: Vec, // Leaving this here for discoverability. We can use this, but don't verify it today. + #[allow(dead_code)] memo: (), + #[allow(dead_code)] timeout_height: (), } @@ -497,12 +499,13 @@ impl CosmWasmMsg { pub struct AuthInfo { pub signer_infos: Vec, // Leaving this here for discoverability. We can use this, but don't verify it today. + #[allow(dead_code)] fee: (), } impl AuthInfo { pub fn from_bytes(bytes: &[u8]) -> Result { - let raw_auth_info = proto::tx::tx::AuthInfo::parse_from_bytes(&bytes).map_err(|err| { + let raw_auth_info = proto::tx::tx::AuthInfo::parse_from_bytes(bytes).map_err(|err| { warn!("Could not parse AuthInfo from protobuf bytes: {:?}", err); EnclaveError::FailedToDeserialize })?; diff --git a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/Cargo.toml b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/Cargo.toml index ecbde79fe..08ee7f407 100644 --- a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/Cargo.toml +++ b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } diff --git a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/math.rs b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/math.rs index baa5e624f..ee9554b48 100644 --- a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/math.rs +++ b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/math.rs @@ -184,12 +184,14 @@ impl TryFrom<&str> for Uint128 { } } +#[allow(clippy::from_over_into)] impl Into for Uint128 { fn into(self) -> String { self.0.to_string() } } +#[allow(clippy::from_over_into)] impl Into for Uint128 { fn into(self) -> u128 { self.0 diff --git a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/types.rs b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/types.rs index 67ea7d28c..72ef5feb1 100644 --- a/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/types.rs +++ b/cosmwasm/enclaves/shared/cosmwasm-types/v0.10/src/types.rs @@ -66,7 +66,7 @@ impl From<&HumanAddr> for HumanAddr { impl CanonicalAddr { pub fn as_slice(&self) -> &[u8] { - &self.0.as_slice() + self.0.as_slice() } pub fn len(&self) -> usize { self.0.len() diff --git a/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/Cargo.toml b/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/Cargo.toml index 10794b5b2..798f0acf8 100644 --- a/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/Cargo.toml +++ b/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } diff --git a/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/src/lib.rs b/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/src/lib.rs index 62f52dc66..1f363847a 100644 --- a/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/src/lib.rs +++ b/cosmwasm/enclaves/shared/cosmwasm-types/v1.0/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(min_const_generics)] pub mod addresses; pub mod coins; pub mod errors; diff --git a/cosmwasm/enclaves/shared/crypto/Cargo.toml b/cosmwasm/enclaves/shared/crypto/Cargo.toml index 8730879cf..53a15b6f0 100644 --- a/cosmwasm/enclaves/shared/crypto/Cargo.toml +++ b/cosmwasm/enclaves/shared/crypto/Cargo.toml @@ -12,17 +12,17 @@ test = [] # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } -sgx_types = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_types = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } +sgx_trts = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_trts" } [dependencies] -sgx_trts = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } enclave-ffi-types = { path = "../../ffi-types" } log = "0.4.8" derive_more = "0.99" -lazy_static = "1.4" +lazy_static = "1.4.0" hex = "0.4.2" ring = { git = "https://github.com/mesalock-linux/ring-sgx", tag = "v0.16.5" } sha2 = "0.8.1" diff --git a/cosmwasm/enclaves/shared/crypto/src/consts.rs b/cosmwasm/enclaves/shared/crypto/src/consts.rs index 44c1fd58a..953b93b87 100644 --- a/cosmwasm/enclaves/shared/crypto/src/consts.rs +++ b/cosmwasm/enclaves/shared/crypto/src/consts.rs @@ -50,21 +50,21 @@ lazy_static! { ) .join(NODE_ENCRYPTED_SEED_KEY_FILE) .to_str() - .unwrap_or(&DEFAULT_SGX_SECRET_PATH.to_string()) + .unwrap_or(DEFAULT_SGX_SECRET_PATH) .to_string(); pub static ref REGISTRATION_KEY_SEALING_PATH: String = path::Path::new( &env::var(SCRT_SGX_STORAGE_ENV_VAR).unwrap_or_else(|_| DEFAULT_SGX_SECRET_PATH.to_string()) ) .join(NODE_EXCHANGE_KEY_FILE) .to_str() - .unwrap_or(&DEFAULT_SGX_SECRET_PATH.to_string()) + .unwrap_or(DEFAULT_SGX_SECRET_PATH) .to_string(); pub static ref ATTESTATION_CERT_PATH: String = path::Path::new( &env::var(SCRT_SGX_STORAGE_ENV_VAR).unwrap_or_else(|_| DEFAULT_SGX_SECRET_PATH.to_string()) ) .join(ATTESTATION_CERTIFICATE_SAVE_PATH) .to_str() - .unwrap_or(&DEFAULT_SGX_SECRET_PATH.to_string()) + .unwrap_or(DEFAULT_SGX_SECRET_PATH) .to_string(); } diff --git a/cosmwasm/enclaves/shared/crypto/src/ed25519.rs b/cosmwasm/enclaves/shared/crypto/src/ed25519.rs index 523147129..9360cefba 100644 --- a/cosmwasm/enclaves/shared/crypto/src/ed25519.rs +++ b/cosmwasm/enclaves/shared/crypto/src/ed25519.rs @@ -23,7 +23,7 @@ pub struct Ed25519PrivateKey { } impl Ed25519PrivateKey { - pub fn to_owned(&self) -> AlignedEc256PrivateKey { + pub fn to_owned(self) -> AlignedEc256PrivateKey { self.key } diff --git a/cosmwasm/enclaves/shared/crypto/src/lib.rs b/cosmwasm/enclaves/shared/crypto/src/lib.rs index 2af1e90b8..3afe76b20 100644 --- a/cosmwasm/enclaves/shared/crypto/src/lib.rs +++ b/cosmwasm/enclaves/shared/crypto/src/lib.rs @@ -1,9 +1,13 @@ +#![cfg_attr(not(target_env = "sgx"), no_std)] +#![cfg_attr(target_env = "sgx", feature(rustc_private))] + +extern crate sgx_trts; +extern crate sgx_types; + // Trick to get the IDE to use sgx_tstd even when it doesn't know we're targeting SGX #[cfg(not(target_env = "sgx"))] extern crate sgx_tstd as std; -extern crate sgx_types; - pub mod consts; mod errors; pub(crate) mod kdf; diff --git a/cosmwasm/enclaves/shared/crypto/src/storage.rs b/cosmwasm/enclaves/shared/crypto/src/storage.rs index 4af044ebc..053ba50f0 100644 --- a/cosmwasm/enclaves/shared/crypto/src/storage.rs +++ b/cosmwasm/enclaves/shared/crypto/src/storage.rs @@ -19,7 +19,7 @@ impl SealedKey for AESKey { impl SealedKey for Seed { fn seal(&self, filepath: &str) -> Result<(), EnclaveError> { - seal(&self.as_slice(), filepath) + seal(self.as_slice(), filepath) } fn unseal(filepath: &str) -> Result { @@ -31,7 +31,7 @@ impl SealedKey for Seed { impl SealedKey for KeyPair { fn seal(&self, filepath: &str) -> Result<(), EnclaveError> { // Files are automatically closed when they go out of scope. - seal(&self.get_privkey(), filepath) + seal(self.get_privkey(), filepath) } fn unseal(filepath: &str) -> Result { diff --git a/cosmwasm/enclaves/shared/utils/Cargo.toml b/cosmwasm/enclaves/shared/utils/Cargo.toml index d98fa6a90..68cdc12d6 100644 --- a/cosmwasm/enclaves/shared/utils/Cargo.toml +++ b/cosmwasm/enclaves/shared/utils/Cargo.toml @@ -12,13 +12,16 @@ query-only = [] # We always compile to the "sgx" target, so this will always be false. # when compiling to the "sgx" target, we pull this from the target root with an "extern crate" directive [target.'cfg(not(target_env = "sgx"))'.dependencies] -sgx_tstd = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = [ +sgx_tstd = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_tstd", features = [ "backtrace" ] } -sgx_types = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_types = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } +sgx_trts = { path = "../../../../third_party/incubator-teaclave-sgx-sdk/sgx_trts" } +#sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git" } +#sgx_trts = { git = "https://github.com/apache/teaclave-sgx-sdk.git" } +#sgx_tstd = { git = "https://github.com/apache/teaclave-sgx-sdk.git" } [dependencies] -sgx_trts = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } enclave-ffi-types = { path = "../../ffi-types" } log = "0.4.17" lazy_static = "1.4" diff --git a/cosmwasm/enclaves/shared/utils/src/lib.rs b/cosmwasm/enclaves/shared/utils/src/lib.rs index c6e353b1e..e223c3014 100644 --- a/cosmwasm/enclaves/shared/utils/src/lib.rs +++ b/cosmwasm/enclaves/shared/utils/src/lib.rs @@ -1,9 +1,9 @@ -#![feature(try_reserve)] +extern crate sgx_trts; +extern crate sgx_types; + #[cfg(not(target_env = "sgx"))] extern crate sgx_tstd as std; -extern crate sgx_types; - pub mod logger; pub mod macros; pub mod oom_handler; diff --git a/cosmwasm/enclaves/test/Makefile b/cosmwasm/enclaves/test/Makefile index 78b243848..d73ffee6f 100644 --- a/cosmwasm/enclaves/test/Makefile +++ b/cosmwasm/enclaves/test/Makefile @@ -1,5 +1,5 @@ SGX_SDK ?= $(HOME)/.sgxsdk/sgxsdk -CUSTOM_EDL_PATH := ../../../third_party/vendor/sgx_edl/edl +CUSTOM_EDL_PATH := ../../../third_party/incubator-teaclave-sgx-sdk/edl/ SGX_COMMON_CFLAGS += -fstack-protector App_Include_Paths := -I./ -I./include -I$(SGX_SDK)/include -I$(CUSTOM_EDL_PATH) diff --git a/cosmwasm/enclaves/xargo/x86_64-unknown-linux-sgx.json b/cosmwasm/enclaves/xargo/x86_64-unknown-linux-sgx.json index 10d37a749..53f104e25 100644 --- a/cosmwasm/enclaves/xargo/x86_64-unknown-linux-sgx.json +++ b/cosmwasm/enclaves/xargo/x86_64-unknown-linux-sgx.json @@ -1,13 +1,13 @@ { "arch": "x86_64", "cpu": "x86-64", - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "crt-static-respected": true, + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "dynamic-linking": true, "env": "sgx", - "exe-allocation-crate": "alloc_system", "executables": true, - "has-elf-tls": true, "has-rpath": true, + "has-thread-local": true, "linker-flavor": "gcc", "linker-is-gnu": true, "llvm-target": "x86_64-unknown-linux-gnu", @@ -22,7 +22,21 @@ ] }, "relro-level": "full", - "stack-probes": true, + "stack-probes": { + "kind": "inline-or-call", + "min-llvm-version-for-inline": [ + 11, + 0, + 1 + ] + }, + "supported-sanitizers": [ + "address", + "cfi", + "leak", + "memory", + "thread" + ], "target-c-int-width": "32", "target-endian": "little", "target-family": "unix", diff --git a/cosmwasm/packages/sgx-vm/Cargo.lock b/cosmwasm/packages/sgx-vm/Cargo.lock deleted file mode 100644 index 62bed248a..000000000 --- a/cosmwasm/packages/sgx-vm/Cargo.lock +++ /dev/null @@ -1,755 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" - -[[package]] -name = "backtrace" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "cbindgen" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db2df1ebc842c41fd2c4ae5b5a577faf63bd5151b953db752fc686812bee318" -dependencies = [ - "clap", - "log", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", - "tempfile", - "toml", -] - -[[package]] -name = "cc" -version = "1.0.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cmake" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb6210b637171dfba4cda12e579ac6dc73f5165ad56133e5d72ef3131f320855" -dependencies = [ - "cc", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cosmwasm-sgx-vm" -version = "0.10.0" -dependencies = [ - "base64 0.12.3", - "cosmwasm-std", - "enclave-ffi-types", - "hex", - "lazy_static", - "log", - "memmap", - "parity-wasm", - "schemars", - "serde", - "serde_json", - "sgx_types", - "sgx_urts", - "sha2", - "snafu", - "tempfile", - "wabt", -] - -[[package]] -name = "cosmwasm-std" -version = "0.10.0" -source = "git+https://github.com/enigmampc/SecretNetwork?tag=v1.0.4-debug-print#004c6bca6f2b7f31a6594abe4f44f2e41b1456b3" -dependencies = [ - "base64 0.11.0", - "schemars", - "serde", - "serde-json-wasm", - "snafu", -] - -[[package]] -name = "cpufeatures" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" -dependencies = [ - "libc", -] - -[[package]] -name = "derive_more" -version = "0.99.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "enclave-ffi-types" -version = "0.1.0" -dependencies = [ - "cbindgen", - "derive_more", - "thiserror", -] - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" - -[[package]] -name = "glob" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" - -[[package]] -name = "log" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "object" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2" -dependencies = [ - "memchr", -] - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" - -[[package]] -name = "proc-macro2" -version = "1.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "quote" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" -dependencies = [ - "bitflags", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "schemars" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be77ed66abed6954aabf6a3e31a84706bedbf93750d267e92ef4a6d90bbd6a61" -dependencies = [ - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11af7a475c9ee266cfaa9e303a47c830ebe072bf3101ab907a7b7b9d816fa01d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - -[[package]] -name = "serde" -version = "1.0.130" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-json-wasm" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120bad73306616e91acd7ceed522ba96032a51cffeef3cc813de7f367df71e37" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.130" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_derive_internals" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sgx_types" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" - -[[package]] -name = "sgx_urts" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" -dependencies = [ - "libc", - "sgx_types", -] - -[[package]] -name = "sha2" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" -dependencies = [ - "block-buffer", - "cfg-if", - "cpufeatures", - "digest", - "opaque-debug", -] - -[[package]] -name = "snafu" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" -dependencies = [ - "backtrace", - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "syn" -version = "1.0.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "tempfile" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" -dependencies = [ - "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" - -[[package]] -name = "wabt" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b5f5d6984ca42df66280baa8a15ac188a173ddaf4580b574a98931c01920e7" -dependencies = [ - "serde", - "serde_derive", - "serde_json", - "wabt-sys", -] - -[[package]] -name = "wabt-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b064c81821100adb4b71923cecfc67fef083db21c3bbd454b0162c7ffe63eeaa" -dependencies = [ - "cc", - "cmake", - "glob", -] - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/cosmwasm/packages/sgx-vm/Cargo.toml b/cosmwasm/packages/sgx-vm/Cargo.toml index af624fa89..9754fc7f4 100644 --- a/cosmwasm/packages/sgx-vm/Cargo.toml +++ b/cosmwasm/packages/sgx-vm/Cargo.toml @@ -64,8 +64,8 @@ lazy_static = "1.4" enclave-ffi-types = { path = "../../enclaves/ffi-types", features = [ "build_headers" ] } -sgx_types = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269" } -sgx_urts = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269" } +sgx_types = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } +sgx_urts = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_urts" } log = "0.4.8" base64 = "0.12.0" parking_lot = "0.11" diff --git a/cosmwasm/packages/sgx-vm/rust-toolchain b/cosmwasm/packages/sgx-vm/rust-toolchain index e966e30c2..480e8aa7c 100644 --- a/cosmwasm/packages/sgx-vm/rust-toolchain +++ b/cosmwasm/packages/sgx-vm/rust-toolchain @@ -1 +1 @@ -nightly-2020-10-25 \ No newline at end of file +nightly-2022-02-23 diff --git a/cosmwasm/packages/sgx-vm/testdata/contract.wasm b/cosmwasm/packages/sgx-vm/testdata/contract.wasm deleted file mode 120000 index d59deded5..000000000 --- a/cosmwasm/packages/sgx-vm/testdata/contract.wasm +++ /dev/null @@ -1 +0,0 @@ -contract_0.10.wasm \ No newline at end of file diff --git a/cosmwasm/packages/sgx-vm/testdata/contract.wasm b/cosmwasm/packages/sgx-vm/testdata/contract.wasm new file mode 100644 index 000000000..d59deded5 --- /dev/null +++ b/cosmwasm/packages/sgx-vm/testdata/contract.wasm @@ -0,0 +1 @@ +contract_0.10.wasm \ No newline at end of file diff --git a/deployment/dockerfiles/app.Dockerfile b/deployment/dockerfiles/app.Dockerfile index 87e51aea9..aff7d6320 100644 --- a/deployment/dockerfiles/app.Dockerfile +++ b/deployment/dockerfiles/app.Dockerfile @@ -3,19 +3,22 @@ FROM ubuntu:focal as runtime_base LABEL maintainer=enigmampc # SGX version parameters -ARG SGX_VERSION=2.12.100.3 +ARG SDK_VERSION=2.17.1 +ARG SGX_VERSION=2.17.101.1 +ARG PSW_VERSION=2.17.100.3-focal1 ARG OS_REVESION=focal1 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - #### Base utilities #### - logrotate \ - gdebi \ - wget \ - libprotobuf17 \ - #### SGX installer dependencies #### - g++ make libcurl4 libssl1.1 && \ - rm -rf /var/lib/apt/lists/* +#RUN apt-get update && \ +# apt-get install -y --no-install-recommends \ +# #### Base utilities #### +# logrotate \ +# gdebi \ +# wget \ +# # libprotobuf17 \ +# # gnupg \ +# #### SGX installer dependencies #### +# g++ make libcurl4 libssl1.1 && \ +# rm -rf /var/lib/apt/lists/* #RUN wget -O /tmp/libprotobuf10_3.0.0-9_amd64.deb http://ftp.br.debian.org/debian/pool/main/p/protobuf/libprotobuf10_3.0.0-9_amd64.deb @@ -28,30 +31,58 @@ RUN mkdir /etc/init && \ mkdir sgx -##### Install SGX Binaries ###### -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-enclave-common/libsgx-enclave-common_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-urts/libsgx-urts_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-uae-service/libsgx-uae-service_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-quote-ex/libsgx-quote-ex_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-epid/libsgx-epid_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/debian_pkgs/libs/libsgx-launch/libsgx-launch_${SGX_VERSION}-${OS_REVESION}_amd64.deb ./sgx/ +RUN apt-get update && \ + apt-get install -y gnupg2 apt-transport-https ca-certificates curl software-properties-common make g++ libcurl4 libssl1.1 && \ + curl -fsSL https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add - && \ + add-apt-repository "deb https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main" && \ + apt-get update && \ + apt-get install -y \ + libsgx-aesm-launch-plugin=$PSW_VERSION \ + libsgx-enclave-common=$PSW_VERSION \ + libsgx-epid=$PSW_VERSION \ + libsgx-launch=$PSW_VERSION \ + libsgx-quote-ex=$PSW_VERSION \ + libsgx-uae-service=$PSW_VERSION \ + libsgx-urts=$PSW_VERSION && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/cache/apt/archives/* && \ + mkdir /var/run/aesmd +# libsgx-headers=$VERSION \ + # libsgx-ae-epid=$VERSION \ + # libsgx-ae-le=$VERSION \ + # libsgx-ae-pce=$VERSION \ + # libsgx-aesm-ecdsa-plugin=$VERSION \ + # libsgx-aesm-epid-plugin=$VERSION \ + # libsgx-aesm-launch-plugin=$VERSION \ + # libsgx-aesm-pce-plugin=$VERSION \ + # libsgx-aesm-quote-ex-plugin=$VERSION \ + # libsgx-enclave-common=$VERSION \ + # libsgx-enclave-common-dev=$VERSION \ + # libsgx-epid=$VERSION \ + # libsgx-epid-dev=$VERSION \ + # libsgx-launch=$VERSION \ + # libsgx-launch-dev=$VERSION \ + # libsgx-quote-ex=$VERSION \ + # libsgx-quote-ex-dev=$VERSION \ + # libsgx-uae-service=$VERSION \ + # libsgx-urts=$VERSION \ + # sgx-aesm-service=$VERSION \ +# ENTRYPOINT ["/bin/bash"] -RUN dpkg -i ./sgx/libsgx-enclave-common_${SGX_VERSION}-${OS_REVESION}_amd64.deb && \ - dpkg -i ./sgx/libsgx-urts_${SGX_VERSION}-${OS_REVESION}_amd64.deb && \ - dpkg -i ./sgx/libsgx-launch_${SGX_VERSION}-${OS_REVESION}_amd64.deb && \ - dpkg -i ./sgx/libsgx-epid_${SGX_VERSION}-${OS_REVESION}_amd64.deb && \ - dpkg -i ./sgx/libsgx-quote-ex_${SGX_VERSION}-${OS_REVESION}_amd64.deb && \ - dpkg -i ./sgx/libsgx-uae-service_${SGX_VERSION}-${OS_REVESION}_amd64.deb +# RUN apt-get update -ADD https://download.01.org/intel-sgx/sgx-linux/2.12/distro/ubuntu20.04-server/sgx_linux_x64_sdk_${SGX_VERSION}.bin ./sgx/ -# ADD https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/sgx_linux_x64_driver_2.6.0_95eaa6f.bin ./sgx/ +#RUN apt-get install libsgx-epid libsgx-quote-ex libsgx-dcap-ql +# +ADD https://download.01.org/intel-sgx/sgx-linux/${SDK_VERSION}/distro/ubuntu20.04-server/sgx_linux_x64_sdk_${SGX_VERSION}.bin ./sgx/ +## ADD https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/sgx_linux_x64_driver_2.6.0_95eaa6f.bin ./sgx/ +## RUN chmod +x ./sgx/sgx_linux_x64_sdk_${SGX_VERSION}.bin RUN echo -e 'no\n/opt' | ./sgx/sgx_linux_x64_sdk_${SGX_VERSION}.bin && \ echo 'source /opt/sgxsdk/environment' >> /root/.bashrc && \ rm -rf ./sgx/* - +## ENV LD_LIBRARY_PATH=/opt/sgxsdk/libsgx-enclave-common/ - -#RUN SGX_DEBUG=0 SGX_MODE=HW SGX_PRERELEASE=1 make \ No newline at end of file +# +##RUN SGX_DEBUG=0 SGX_MODE=HW SGX_PRERELEASE=1 make \ No newline at end of file diff --git a/deployment/dockerfiles/base.Dockerfile b/deployment/dockerfiles/base.Dockerfile index 9fae8d80d..e2e87f2ce 100644 --- a/deployment/dockerfiles/base.Dockerfile +++ b/deployment/dockerfiles/base.Dockerfile @@ -1,4 +1,4 @@ -ARG SCRT_BASE_IMAGE_SECRETD=enigmampc/rocksdb:v6.24.2 +ARG SCRT_BASE_IMAGE_SECRETD=enigmampc/rocksdb:v6.24.2-1.1.5 ARG SCRT_BASE_IMAGE_ENCLAVE=baiduxlab/sgx-rust:2004-1.1.3 # enigmampc/rocksdb:v6.24.2 @@ -20,19 +20,17 @@ ENV FEATURES=${FEATURES} ENV FEATURES_U=${FEATURES_U} ENV MITIGATION_CVE_2020_0551=LOAD -COPY third_party/build third_party/build +COPY rust-toolchain rust-toolchain +RUN rustup component add rust-src +RUN cargo install xargo --version 0.3.25 + +# Add submodules +COPY third_party third_party # Add source files COPY go-cosmwasm go-cosmwasm/ COPY cosmwasm cosmwasm/ -WORKDIR /go/src/github.com/enigmampc/SecretNetwork/ - -COPY deployment/docker/MakefileCopy Makefile - -# RUN make clean -RUN make vendor - WORKDIR /go/src/github.com/enigmampc/SecretNetwork/go-cosmwasm RUN . /opt/sgxsdk/environment && env \ @@ -105,6 +103,4 @@ RUN --mount=type=secret,id=API_KEY,dst=/run/secrets/api_key.txt cat /run/secrets RUN . /opt/sgxsdk/environment && env && CGO_LDFLAGS=${CGO_LDFLAGS} DB_BACKEND=${DB_BACKEND} MITIGATION_CVE_2020_0551=LOAD VERSION=${VERSION} FEATURES=${FEATURES} SGX_MODE=${SGX_MODE} make build_local_no_rust RUN . /opt/sgxsdk/environment && env && MITIGATION_CVE_2020_0551=LOAD VERSION=${VERSION} FEATURES=${FEATURES} SGX_MODE=${SGX_MODE} make build_cli -ENTRYPOINT ["/bin/bash"] - - +ENTRYPOINT ["/bin/bash"] \ No newline at end of file diff --git a/deployment/dockerfiles/db-compile.Dockerfile b/deployment/dockerfiles/db-compile.Dockerfile index b6ecefabf..148eb8a60 100644 --- a/deployment/dockerfiles/db-compile.Dockerfile +++ b/deployment/dockerfiles/db-compile.Dockerfile @@ -1,4 +1,4 @@ -FROM baiduxlab/sgx-rust:2004-1.1.3 +FROM baiduxlab/sgx-rust:2004-1.1.5 ### Install rocksdb @@ -37,4 +37,4 @@ RUN mkdir -p build && cd build && cmake \ RUN make -j 24 install-static INSTALL_PATH=/usr/lib/x86_64-linux-gnu/ -CMD ['/bin/bash'] \ No newline at end of file +CMD ['/bin/bash'] diff --git a/deployment/dockerfiles/enclave-test.Dockerfile b/deployment/dockerfiles/enclave-test.Dockerfile index d76773677..9988659d3 100644 --- a/deployment/dockerfiles/enclave-test.Dockerfile +++ b/deployment/dockerfiles/enclave-test.Dockerfile @@ -13,13 +13,16 @@ ENV LD_LIBRARY_PATH="" WORKDIR /enclave-test/ # Add source files -COPY third_party/build third_party/build +COPY third_party third_party COPY cosmwasm/ cosmwasm/ COPY Makefile Makefile -COPY api_key.txt /enclave-test/cosmwasm/enclaves/execute/ -COPY spid.txt /enclave-test/enclaves/execute/ -RUN make vendor +COPY rust-toolchain rust-toolchain +RUN rustup component add rust-src +RUN cargo install xargo --version 0.3.25 + +RUN --mount=type=secret,id=SPID,dst=/run/secrets/spid.txt cat /run/secrets/spid.txt > /enclave-test/cosmwasm/enclaves/execute/spid.txt +RUN --mount=type=secret,id=API_KEY,dst=/run/secrets/api_key.txt cat /run/secrets/api_key.txt > /enclave-test/cosmwasm/enclaves/execute/api_key.txt COPY deployment/ci/enclave-test.sh . RUN chmod +x enclave-test.sh diff --git a/deployment/dockerfiles/ibc/README.md b/deployment/dockerfiles/ibc/README.md index 1be8d32b1..a4b7e9b54 100644 --- a/deployment/dockerfiles/ibc/README.md +++ b/deployment/dockerfiles/ibc/README.md @@ -1,35 +1,35 @@ -## Secret IBC setup -Two local secrets can Inter-blockchainly communicate with each other via a Hermes relayer - -### Build -```bash -docker build -f hermes.Dockerfile . --tag hermes:test -``` - -### Run -```bash -docker compose up -``` - -### Verify IBC transfers -Assuming you have a key 'a' which is not the relayer's key, -from localhost: -```bash -# be on the source network (secretdev-1) -secretcli config node http://localhost:26657 - -# check the initial balance of a -secretcli q bank balances - -# transfer to the destination network -secretcli tx ibc-transfer transfer transfer channel-0 secret1fc3fzy78ttp0lwuujw7e52rhspxn8uj52zfyne 2uscrt --from a - -# check a's balance after transfer -scli q bank balances - -# switch to the destination network (secretdev-2) -secretcli config node http://localhost:36657 - -# check that you have an ibc-denom -secretcli q bank balances # should have 2 ibc denom -``` +## Secret IBC setup +Two local secrets can Inter-blockchainly communicate with each other via a Hermes relayer + +### Build +```bash +docker build -f hermes.Dockerfile . --tag hermes:test +``` + +### Run +```bash +docker compose up +``` + +### Verify IBC transfers +Assuming you have a key 'a' which is not the relayer's key, +from localhost: +```bash +# be on the source network (secretdev-1) +secretcli config node http://localhost:26657 + +# check the initial balance of a +secretcli q bank balances + +# transfer to the destination network +secretcli tx ibc-transfer transfer transfer channel-0 secret1fc3fzy78ttp0lwuujw7e52rhspxn8uj52zfyne 2uscrt --from a + +# check a's balance after transfer +scli q bank balances + +# switch to the destination network (secretdev-2) +secretcli config node http://localhost:36657 + +# check that you have an ibc-denom +secretcli q bank balances # should have 2 ibc denom +``` diff --git a/deployment/dockerfiles/release.Dockerfile b/deployment/dockerfiles/release.Dockerfile index 8fbf8b09c..bd8964e5d 100644 --- a/deployment/dockerfiles/release.Dockerfile +++ b/deployment/dockerfiles/release.Dockerfile @@ -1,5 +1,5 @@ ARG SCRT_BIN_IMAGE=rust-go-base-image -ARG SCRT_BASE_IMAGE=enigmampc/enigma-sgx-base:2004-1.1.3 +ARG SCRT_BASE_IMAGE=enigmampc/enigma-sgx-base:2004-1.1.5 FROM $SCRT_BIN_IMAGE AS build-env-rust-go @@ -21,9 +21,9 @@ RUN apt-get update && \ RUN echo "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc -RUN curl -sL https://deb.nodesource.com/setup_15.x | bash - && \ +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ apt-get update && \ - apt-get install -y nodejs npm && \ + apt-get install -y nodejs && \ npm i -g local-cors-proxy ARG SGX_MODE=SW @@ -35,11 +35,9 @@ ENV SECRET_NODE_TYPE=${SECRET_NODE_TYPE} ENV PKG_CONFIG_PATH="" ENV SCRT_ENCLAVE_DIR=/usr/lib/ - - # workaround because paths seem kind of messed up -RUN cp /opt/sgxsdk/lib64/libsgx_urts_sim.so /usr/lib/libsgx_urts_sim.so -RUN cp /opt/sgxsdk/lib64/libsgx_uae_service_sim.so /usr/lib/libsgx_uae_service_sim.so +RUN ln -s /opt/sgxsdk/lib64/libsgx_urts_sim.so /usr/lib/x86_64-linux-gnu/libsgx_urts_sim.so +RUN ln -s /opt/sgxsdk/lib64/libsgx_uae_service_sim.so /usr/lib/x86_64-linux-gnu/libsgx_uae_service_sim.so # Install ca-certificates WORKDIR /root diff --git a/go-cosmwasm/Cargo.lock b/go-cosmwasm/Cargo.lock index ca93f84c4..84248ebb9 100644 --- a/go-cosmwasm/Cargo.lock +++ b/go-cosmwasm/Cargo.lock @@ -626,18 +626,15 @@ dependencies = [ [[package]] name = "sgx_edl" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" [[package]] name = "sgx_types" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" [[package]] name = "sgx_urts" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" dependencies = [ "libc", "sgx_types", diff --git a/go-cosmwasm/Cargo.toml b/go-cosmwasm/Cargo.toml index af09298a1..0f35ed5a3 100644 --- a/go-cosmwasm/Cargo.toml +++ b/go-cosmwasm/Cargo.toml @@ -53,7 +53,7 @@ tempfile = "3.1.0" [build-dependencies] cbindgen = { version = "0.14" } -sgx_edl = { git = "https://github.com/apache/teaclave-sgx-sdk.git", rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269" } +sgx_edl = { path = "../third_party/incubator-teaclave-sgx-sdk/sgx_edl" } [profile.release] opt-level = 3 diff --git a/go-cosmwasm/Makefile b/go-cosmwasm/Makefile index 03901b054..6fc17586a 100644 --- a/go-cosmwasm/Makefile +++ b/go-cosmwasm/Makefile @@ -41,7 +41,7 @@ endif SGX_COMMON_CFLAGS += -fstack-protector -CUSTOM_EDL_PATH := ../third_party/vendor/sgx_edl/edl +CUSTOM_EDL_PATH := ../third_party/incubator-teaclave-sgx-sdk/sgx_edl/edl App_SRC_Files := $(shell find ../cosmwasm/packages/sgx-vm/ -type f -name '*.rs') \ $(shell find ../cosmwasm/packages/sgx-vm/ -type f -name 'Cargo.toml') \ $(shell find ./ -type f -name '*.rs') \ diff --git a/go-cosmwasm/rust-toolchain b/go-cosmwasm/rust-toolchain index 5da1310fc..480e8aa7c 100644 --- a/go-cosmwasm/rust-toolchain +++ b/go-cosmwasm/rust-toolchain @@ -1 +1 @@ -nightly-2021-08-23 +nightly-2022-02-23 diff --git a/rust-toolchain b/rust-toolchain index 8ed998752..4e7e21b01 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.54 \ No newline at end of file +nightly-2022-02-23 \ No newline at end of file diff --git a/third_party/build/Cargo.lock b/third_party/build/Cargo.lock index c2f2ae500..9fedafeac 100644 --- a/third_party/build/Cargo.lock +++ b/third_party/build/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "eng_edl" version = "0.0.0" @@ -9,5 +11,4 @@ dependencies = [ [[package]] name = "sgx_edl" -version = "1.1.3" -source = "git+https://github.com/apache/teaclave-sgx-sdk.git?rev=a37ffb9449ba6d5b6e4a9d586bbab864ae732269#a37ffb9449ba6d5b6e4a9d586bbab864ae732269" +version = "1.1.5" diff --git a/third_party/build/Cargo.toml b/third_party/build/Cargo.toml index da3c66d16..64ae98ac2 100644 --- a/third_party/build/Cargo.toml +++ b/third_party/build/Cargo.toml @@ -3,10 +3,10 @@ name = "eng_edl" version = "0.0.0" authors = ["The Teaclave Authors"] build = "build.rs" -edition = "2018" +edition = "2021" [lib] name = "eng_edl" [dependencies] -sgx_edl = { rev = "a37ffb9449ba6d5b6e4a9d586bbab864ae732269", git = "https://github.com/apache/teaclave-sgx-sdk.git" } +sgx_edl = { path = "../../third_party/incubator-teaclave-sgx-sdk/sgx_edl"} diff --git a/third_party/incubator-teaclave-sgx-sdk b/third_party/incubator-teaclave-sgx-sdk new file mode 160000 index 000000000..662909964 --- /dev/null +++ b/third_party/incubator-teaclave-sgx-sdk @@ -0,0 +1 @@ +Subproject commit 662909964e5a666d3c537835e7dab2554be3725c