Skip to content

Commit

Permalink
Merge branch 'stargate-query' into eshel-ibc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lior Bondarevski committed Aug 28, 2022
2 parents 0d91925 + 5185c9a commit 33ddf38
Show file tree
Hide file tree
Showing 115 changed files with 7,070 additions and 33,794 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
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 @@ -166,7 +166,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
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 @@ -221,7 +221,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 40m -v ./x/compute/internal/...
Clippy:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
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
Expand All @@ -294,15 +294,21 @@ 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: Run integration tests
run: |
cd integration-tests
yarn
docker run -d -p 9091:9091 --name localsecret ghcr.io/scrtlabs/localsecret:v0.0.0
sleep 30
docker logs localsecret
yarn test
- name: Run secret.js tests
run: |
git clone --depth 1 https://github.com/scrtlabs/secret.js
# Copy v1 contract to tests directory
cp ./target/wasm32-unknown-unknown/release/v1_sanity_contract.wasm ./secret.js/test/test_contract_v1.wasm
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
6 changes: 3 additions & 3 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@v2
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@v2
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 @@ -144,7 +144,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
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
Expand Down
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
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"request": "launch",
"mode": "debug",
"program": "${file}",
"cwd": "${workspaceFolder}/x/compute/internal/keeper",
"env": { "SGX_MODE": "SW", "RUST_BACKTRACE": "1" },
"args": [
"test",
Expand Down
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"rust-analyzer.linkedProjects": [
"./cosmwasm/Cargo.toml",
"./cosmwasm/enclaves/Cargo.toml",
"./x/compute/internal/keeper/testdata/v1-sanity-contract/Cargo.toml",
"./x/compute/internal/keeper/testdata/test-contract/Cargo.toml",
"./cosmwasm/enclaves/shared/cosmwasm-v1-types/Cargo.toml",
"./cosmwasm/enclaves/shared/cosmwasm-v010-types/Cargo.toml"
"cosmwasm/Cargo.toml",
"cosmwasm/enclaves/Cargo.toml",
"x/compute/internal/keeper/testdata/v1-sanity-contract/Cargo.toml",
"x/compute/internal/keeper/testdata/test-contract/Cargo.toml",
"integration-tests/contract-v1/Cargo.toml",
"integration-tests/contract-v0.10/Cargo.toml",
"go-cosmwasm/Cargo.toml"
],
"rust-analyzer.diagnostics.experimental.enable": true,
"rust-analyzer.rustfmt.rangeFormatting.enable": true,
Expand All @@ -22,7 +23,6 @@
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintOnSave": "workspace",
"go.buildTags": "secretcli",
"gopls": {
"formatting.gofumpt": true
},
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ go-tests: build-test-contract
cp ./cosmwasm/enclaves/execute/librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
rm -rf ./x/compute/internal/keeper/.sgx_secrets
mkdir -p ./x/compute/internal/keeper/.sgx_secrets
GOMAXPROCS=8 SGX_MODE=SW SCRT_SGX_STORAGE='./' go test -failfast -timeout 1200s -v ./x/compute/internal/... $(GO_TEST_ARGS)
GOMAXPROCS=8 SGX_MODE=SW SCRT_SGX_STORAGE='./' go test -failfast -timeout 40m -v ./x/compute/internal/... $(GO_TEST_ARGS)

go-tests-hw: build-test-contract
# empty BUILD_PROFILE means debug mode which compiles faster
Expand Down
11 changes: 6 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (app *SecretNetworkApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
}

func (app *SecretNetworkApp) GetTxConfig() client.TxConfig {
return app.GetTxConfig()
return MakeEncodingConfig().TxConfig
}

func (app *SecretNetworkApp) AppCodec() codec.Codec {
Expand Down Expand Up @@ -399,7 +399,6 @@ func NewSecretNetworkApp(
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper))

// Just re-use the full router - do we want to limit this more?
computeRouter := app.Router()
regRouter := app.Router()

// Replace with bootstrap flag when we figure out how to test properly and everything works
Expand All @@ -419,7 +418,7 @@ func NewSecretNetworkApp(

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
supportedFeatures := "staking"
supportedFeatures := "staking,stargate,ibc3"

app.computeKeeper = compute.NewKeeper(
appCodec,
Expand All @@ -435,7 +434,9 @@ func NewSecretNetworkApp(
app.ibcKeeper.PortKeeper,
app.transferKeeper,
app.ibcKeeper.ChannelKeeper,
computeRouter,
app.Router(),
app.MsgServiceRouter(),
app.GRPCQueryRouter(),
computeDir,
computeConfig,
supportedFeatures,
Expand Down Expand Up @@ -574,7 +575,7 @@ func NewSecretNetworkApp(
//
// NOTE: This is not required for apps that don't use the simulator for fuzz testing
// transactions.
//app.sm = module.NewSimulationManager(
// app.sm = module.NewSimulationManager(
// auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts),
// bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper),
// capability.NewAppModule(appCodec, *app.capabilityKeeper),
Expand Down
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func (app *SecretNetworkApp) ExportAppStateAndValidators(forZeroHeight bool, jai

// prepare for fresh start at zero height
// NOTE zero height genesis is a temporary feature which will be deprecated
// in favour of export at a block height
//
// in favour of export at a block height
func (app *SecretNetworkApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
applyAllowedAddrs := false

Expand Down
4 changes: 2 additions & 2 deletions app/legacy/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package legacy
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"time"

"github.com/cosmos/cosmos-sdk/x/authz"
Expand Down Expand Up @@ -53,7 +53,7 @@ $ secretd migrate /path/to/genesis.json --chain-id=secret-4 --genesis-time=2019-

importGenesis := args[0]

jsonBlob, err := ioutil.ReadFile(importGenesis)
jsonBlob, err := os.ReadFile(importGenesis)
if err != nil {
return errors.Wrap(err, "failed to read provided genesis file")
}
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v1.3/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func CreateUpgradeHandler(mm *module.Manager, icamodule *icamodule.AppModule, co
// reason it's not already set in upgradekeepr.
// We upgrade from cosmos-sdk v0.44.5 to v0.45.4 and ibc-go v1.1.5 to v3.0.0
// There were no ConsensusVersion changes between these versions
// so we should be safe to use the curent ConsensusVersion() for each moudle
// so we should be safe to use the current ConsensusVersion() for each moudle
for moduleName := range mm.Modules {
vm[moduleName] = mm.Modules[moduleName].ConsensusVersion()
}
Expand Down
Loading

0 comments on commit 33ddf38

Please sign in to comment.