Skip to content

Commit

Permalink
Merge pull request #930 from scrtlabs/cosmwasm-v1
Browse files Browse the repository at this point in the history
v1.4.0 (CosmWasm v1)
  • Loading branch information
Cashmaney authored Sep 12, 2022
2 parents d723927 + 4b9d80a commit 9e3861e
Show file tree
Hide file tree
Showing 861 changed files with 144,981 additions and 95,276 deletions.
73 changes: 56 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: rustup component add rust-src clippy
- run: |
rustup component add rust-src clippy
cd cosmwasm/enclaves/execute/
rustup component add rust-src clippy
- name: Install xargo
run: |
cargo --version
Expand All @@ -56,7 +59,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
Expand All @@ -80,7 +83,10 @@ jobs:
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: rustup component add rust-src clippy
- run: |
rustup component add rust-src clippy
cd cosmwasm/enclaves/execute/
rustup component add rust-src clippy
- name: Install xargo
run: |
cargo --version
Expand Down Expand Up @@ -127,7 +133,15 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: contract.wasm
path: ./x/compute/internal/keeper/testdata/test-contract/contract.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/contract.wasm
- uses: actions/upload-artifact@v3
with:
name: v1-contract.wasm
path: cosmwasm/contracts/v1/compute-tests/test-compute-contract/v1-contract.wasm
- uses: actions/upload-artifact@v3
with:
name: ibc.wasm
path: cosmwasm/contracts/v1/compute-tests/ibc-test-contract/ibc.wasm
- uses: actions/upload-artifact@v3
with:
name: enclave
Expand All @@ -139,15 +153,15 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: contract_with_floats.wasm
path: ./x/compute/internal/keeper/testdata/test-contract/contract_with_floats.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/contract_with_floats.wasm
- uses: actions/upload-artifact@v3
with:
name: too-high-initial-memory.wasm
path: ./x/compute/internal/keeper/testdata/test-contract/too-high-initial-memory.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/too-high-initial-memory.wasm
- uses: actions/upload-artifact@v3
with:
name: static-too-high-initial-memory.wasm
path: ./x/compute/internal/keeper/testdata/test-contract/static-too-high-initial-memory.wasm
path: cosmwasm/contracts/v010/compute-tests/test-compute-contract/static-too-high-initial-memory.wasm

Go-Tests:
runs-on: ubuntu-20.04
Expand All @@ -156,7 +170,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
Expand All @@ -174,6 +188,14 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: contract.wasm
- uses: actions/download-artifact@v3
with:
name: v1-contract.wasm
path: ./x/compute/internal/keeper/testdata/
- uses: actions/download-artifact@v3
with:
name: ibc.wasm
path: ./x/compute/internal/keeper/testdata/
- uses: actions/download-artifact@v3
with:
name: contract_with_floats.wasm
Expand All @@ -185,12 +207,14 @@ jobs:
name: static-too-high-initial-memory.wasm
- name: Setup Files
run: |
find "$(pwd)" -name \*.wasm
cp libgo_cosmwasm.so ./go-cosmwasm/api/libgo_cosmwasm.so
cp librust_cosmwasm_enclave.signed.so ./go-cosmwasm/librust_cosmwasm_enclave.signed.so
cp contract.wasm ./x/compute/internal/keeper/testdata/test-contract/contract.wasm
cp too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/test-contract/too-high-initial-memory.wasm
cp contract_with_floats.wasm ./x/compute/internal/keeper/testdata/test-contract/contract_with_floats.wasm
cp static-too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/test-contract/static-too-high-initial-memory.wasm
cp contract.wasm ./x/compute/internal/keeper/testdata/contract.wasm
cp too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/too-high-initial-memory.wasm
cp contract_with_floats.wasm ./x/compute/internal/keeper/testdata/contract_with_floats.wasm
cp static-too-high-initial-memory.wasm ./x/compute/internal/keeper/testdata/static-too-high-initial-memory.wasm
find "$(pwd)" -name \*.wasm
- name: Test x/registration
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
Expand All @@ -205,7 +229,7 @@ jobs:
echo "not_a_key" > ias_keys/develop/spid.txt
echo "not_a_key" > ias_keys/develop/api_key.txt
LOG_LEVEL=ERROR go test -v ./x/compute/client/...
LOG_LEVEL=ERROR go test -p 1 -timeout 20m -v ./x/compute/internal/...
LOG_LEVEL=ERROR go test -p 1 -timeout 90m -v ./x/compute/internal/...
Clippy:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -234,9 +258,13 @@ jobs:
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: rustup component add rust-src clippy
- run: |
rustup component add rust-src clippy
cd cosmwasm/enclaves/execute/
rustup component add rust-src clippy
- name: Install xargo
run: |
cd cosmwasm/enclaves/execute/
cargo --version
rustc --version
cargo +stable install xargo --version 0.3.25
Expand All @@ -260,7 +288,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install xgo
run: |
go install github.com/crazy-max/[email protected]
Expand All @@ -272,13 +300,24 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build docker testnet
- name: Build LocalSecret
run: |
echo not_a_key | tee {api_key,spid}.txt
DOCKER_TAG=v0.0.0 make build-localsecret
- name: Build Hermes
run: |
DOCKER_TAG=v0.0.0 make build-ibc-hermes
- name: Run integration tests
run: |
cd integration-tests
yarn
docker compose -f ../deployment/dockerfiles/ibc/docker-compose.yml up -d
# docker compose -f ../deployment/dockerfiles/ibc/docker-compose.yml logs -f &
yarn test
make kill-localsecret # next step needs the localsecret ports
- name: Run secret.js tests
run: |
git clone --depth 1 --branch lior-fix-based-on-rpc-2 https://github.com/scrtlabs/secret.js
git clone --depth 1 --branch cosmwasm-v1 https://github.com/scrtlabs/secret.js
cd secret.js
# Use the docker images that we built just a few steps above
perl -i -pe 's/localsecret:.+?"/localsecret:v0.0.0"/' ./test/*
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '35 19 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: "go"
queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
18 changes: 11 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Create api keys
run: |
echo $SPID_MAINNET > spid.txt
Expand Down Expand Up @@ -128,6 +128,9 @@ jobs:
os: [ubuntu-20.04, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Build CLI
shell: bash
run: |
Expand All @@ -138,18 +141,18 @@ jobs:
name: secretcli-${{runner.os}}
path: secretcli-${{runner.os}}

x-build-cli:
MacOS-ARM64-CLI:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.18" # The Go version to download (if necessary) and use.
go-version: 1.19 # The Go version to download (if necessary) and use.
- name: Install xgo
run: |
go install github.com/crazy-max/xgo@latest
go install github.com/crazy-max/xgo@v0.17.0
xgo || true # check installation
- name: Build CLI
- name: Build MacOS CLI
shell: bash
run: |
make build_macos_arm64_cli
Expand Down Expand Up @@ -188,7 +191,8 @@ jobs:
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}

Release:
needs: [native-build-cli, build-deb-testnet, build-deb-mainnet, x-build-cli]
needs:
[native-build-cli, build-deb-testnet, build-deb-mainnet, MacOS-ARM64-CLI]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ librust_cosmwasm_enclave.signed.so
SHA256SUMS*
*.so
/third_party/vendor
.vscode
*.sealed
*.der
__debug_bin
Expand All @@ -35,4 +34,10 @@ ias_bin_sw.go
node_modules
/secretjs
/secret.js
tmp-swagger-gen
tmp-swagger-gen
x/compute/internal/keeper/testdata/contract_with_floats.wasm
x/compute/internal/keeper/testdata/contract.wasm
x/compute/internal/keeper/testdata/ibc.wasm
x/compute/internal/keeper/testdata/static-too-high-initial-memory.wasm
x/compute/internal/keeper/testdata/too-high-initial-memory.wasm
x/compute/internal/keeper/testdata/v1-contract.wasm
47 changes: 47 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
run:
tests: false
# # timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

linters:
disable-all: true
enable:
- depguard
- dogsled
- exportloopref
- errcheck
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- stylecheck
- revive
- typecheck
- unconvert
- misspell
- nolintlint

issues:
exclude-rules:
- text: "var-naming"
linters:
- revive
- text: "ST1003:"
linters:
- stylecheck
- text: "commentFormatting"
linters:
- stylecheck
- gocritic
- text: "dupSubExpr"
linters:
- gocritic
- text: "// nolint` should be written without leading space as `//nolint"
linters:
- nolintlint
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["golang.go", "peterj.proto", "rust-lang.rust-analyzer"]
}
Loading

0 comments on commit 9e3861e

Please sign in to comment.