Skip to content

Commit

Permalink
Merge branch 'main' into no-gb
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Jun 9, 2023
2 parents c58df58 + 97ebd71 commit 3f9cf43
Show file tree
Hide file tree
Showing 35 changed files with 3,644 additions and 681 deletions.
9 changes: 9 additions & 0 deletions .depguard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Main:
files:
- $all
- "!$test"
allow:
- $gostd
- github.com/cosmos/**
- github.com/tendermint/**
- github.com/cosmos/cosmos-sdk
5 changes: 5 additions & 0 deletions .github/workflows/release-umee-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate swagger docs
run: |
make proto-swagger-gen
make proto-update-swagger-docs
- name: Build and push
uses: docker/build-push-action@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release-umee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV

# useful to test builds. However will require to add "push" rule to the "on" section
- name: generate and update swagger docs
run: |
make proto-swagger-gen
make proto-update-swagger-docs
- name: goreleaser test-build
uses: goreleaser/goreleaser-action@v4
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Enable:ReleaseBuild')
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ dist/
*.DS_Store

# e2e test keychain folder
tests/e2e/keyring-test

***/keyring-test

# private files
private*

#IntelliJ
.idea/
.vscode

#Vscode
.vscode

# Swagger UI
swagger/statik/statik.go
swagger/swagger-ui

3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ linters:
# - wsl
- asciicheck
- bodyclose
- depguard
# TODO; we need re-enable this linter once golangci-lint or .depguard.yaml is done
# - depguard
- dogsled
- errcheck
- exportloopref
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,24 @@ Ref: https://keepachangelog.com/en/1.0.0/

- [1952](https://github.com/umee-network/umee/pull/1952) Add `x/incentive` module.
- [2015](https://github.com/umee-network/umee/pull/2015), [2050](https://github.com/umee-network/umee/pull/2050) Add `x/ugov` module.
- [2078](https://github.com/umee-network/umee/pull/2078) Upgrade `ibc-go` to v6.2.

## [v5.0.0](https://github.com/umee-network/umee/releases/tag/v5.0.0-rc1) - 2023-05-31
### Improvements

- [2057](https://github.com/umee-network/umee/pull/2057) Cosmwasm QA tests.

## [v5.0.0](https://github.com/umee-network/umee/releases/tag/v5.0.0) - 2023-06-07

### Improvements

- [2076](https://github.com/umee-network/umee/pull/2076) Cosmwasm: registering `cosmwasm_1_2` capability.
- [2083](https://github.com/umee-network/umee/pull/2083) Update `wasmvm` to 1.2.4.

### Fixes

- [2089](https://github.com/umee-network/umee/pull/2089) MsgSupplyCollateral no longer fails when market is below MinCollateralLiquidity.

## [v5.0.0-rc1](https://github.com/umee-network/umee/releases/tag/v5.0.0-rc1) - 2023-05-31

### Features

Expand All @@ -78,6 +94,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
- [2052](https://github.com/umee-network/umee/pull/2052) Allow liquidation threshold == collateral weight in token validation.
- [2072](https://github.com/umee-network/umee/pull/2072) Fix an int64 overflow when computing module liquidity for high-exponent assets.

## [v4.4.2](https://github.com/umee-network/umee/releases/tag/v4.4.2) - 2023-06-08

- [2090](https://github.com/umee-network/umee/pull/2090) Bump Cosmos SDK to v0.46.13 and CometBFT to v0.34.28 and IAVL to v0.19.6.

## [v4.4.1](https://github.com/umee-network/umee/releases/tag/v4.4.1) - 2023-05-25

### Improvements
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ test-e2e-clean:
docker stop umee0 umee1 umee2 umee-gaia-relayer gaiaval0 umee-price-feeder
docker rm umee0 umee1 umee2 umee-gaia-relayer gaiaval0 umee-price-feeder

test-qa:
@go test ./tests/qa/... -timeout 30m -v -tags='test_qa'

$(MOCKS_DIR):
mkdir -p $(MOCKS_DIR)
mocks: $(MOCKS_DIR)
Expand Down Expand Up @@ -356,3 +359,8 @@ proto-lint:
proto-check-breaking:
@echo "Checking for breaking changes"
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main

proto-update-swagger-docs:
@echo "Updating Protobuf Swagger Docs"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./contrib/scripts/protoc-update-swagger-docs.sh; fi
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ Umee will allow a multitude of decentralized debt products.
- [Table of Contents](#table-of-contents)
- [Releases](#releases)
- [Release Compatibility Matrix](#release-compatibility-matrix)
- [Active Networks](#active-networks)
- [Price Feeder](#price-feeder)
- [libwasmvm](#libwasmvm)
- [Active Networks](#active-networks)
- [Build](#build)
- [Recommended Database Backend](#recommended-database-backend)
- [Swagger](#swagger)
- [Cosmovisor](#cosmovisor)
- [Liquidators](#liquidators)
Expand Down Expand Up @@ -107,6 +110,25 @@ db_backend = "rocksdb"

### Swagger

- To update the latest swagger docs, follow these steps

Generate the latest swagger:

```bash
$ make proto-swagger-gen
$ make proto-update-swagger-docs
```

Build the new binary or install the new binary with the latest swagger docs:

```bash
$ make build
# or
$ make install
```

Make sure to execute these commands whenever you want to update the swagger documentation.

- To enable it, modify the node config at `$UMEE_HOME/config/app.toml` to `api.swagger` `true`
- Run the node normally `umeed start`
- Enter the swagger docs `http://localhost:1317/swagger/`
Expand Down
14 changes: 12 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ Release Procedure is defined in the [CONTRIBUTING](CONTRIBUTING.md#release-proce

Highlights:

- Cosmwasm integration.
- Cosmwasm integration (v0.31).
- Gravity Bridge phase-3: shutdown of the transfers. In this release we introduce valset burn mechanism,
which will block the Ethereum smart contract for processing any further transactions, as well
as sending transfers back to Ethereum. This follows the plan approved through in the
[prop-67](https://www.mintscan.io/umee/proposals/67).
NOTE: All validators must continue to use Peggo to not get slashed.
- Updated to the latest Cosmos SDK v0.46.12
- New generic functions for storage management: `util/store`.

See [CHANGELOG](https://github.com/umee-network/umee/blob/v5.0.0-rc1/CHANGELOG.md)
See [CHANGELOG](https://github.com/umee-network/umee/blob/v5.0.0/CHANGELOG.md).

### Validators

#### libwasmvm update

Our dependencies have been updated. Now the binary requires `libwasmvm v1.2.4`. When you build the binary from source on the server machine you probably don't need any change. However when you download a binary from GitHub, or from other source, make sure you update the `/usr/lib/libwasmvm.<cpu_arch>.so`. For example:

- copy from `$GOPATH/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.2.4/internal/api/libwasmvm.$(uname -m).so`
- or download from github `wget https://raw.githubusercontent.com/CosmWasm/wasmvm/v1.2.4/internal/api/libwasmvm.$(uname -m).so -O /lib/libwasmvm.$(uname -m).so`

You don't need to do anything if you are using our Docker image.

#### Min Gas Prices

Since v4.2 release we request all validators set a `minimum-gas-prices` setting (in app `config/app.toml` file, general settings). We recommend `0.1uumee` which is equal the current Keplr _average_ setting:
Expand Down
29 changes: 29 additions & 0 deletions client/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package client

import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

func (c Client) AuthQClient() authtypes.QueryClient {
return authtypes.NewQueryClient(c.Query.GrpcConn)
}

func (c Client) QueryAuthSeq(accAddr string) (uint64, error) {
ctx, cancel := c.NewQCtx()
defer cancel()

queryResponse, err := c.AuthQClient().Account(ctx, &authtypes.QueryAccountRequest{
Address: accAddr,
})
if err != nil {
return 0, err
}

var baseAccount authtypes.AccountI
err = c.codec.UnpackAny(queryResponse.Account, &baseAccount)
if err != nil {
return 0, err
}
accSeq := baseAccount.GetSequence()
return accSeq, nil
}
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package client
import (
"context"

"github.com/cosmos/cosmos-sdk/codec"
sdkparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/umee-network/umee/v5/sdkclient"
)

// Client sdkclient.Client and provides umee chain specific transactions and queries.
type Client struct {
sdkclient.Client
codec codec.Codec
}

// NewClient constructs Client object.
Expand All @@ -29,6 +31,7 @@ func NewClient(
}
return Client{
Client: c,
codec: encCfg.Codec,
}, nil
}

Expand Down
19 changes: 19 additions & 0 deletions client/wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package client

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

func (c Client) WasmClient() wasmtypes.QueryClient {
return wasmtypes.NewQueryClient(c.Query.GrpcConn)
}

func (c Client) QueryContract(contractAddr string, query []byte) (*wasmtypes.QuerySmartContractStateResponse, error) {
ctx, cancel := c.NewQCtx()
defer cancel()

return c.WasmClient().SmartContractState(ctx, &wasmtypes.QuerySmartContractStateRequest{
Address: contractAddr,
QueryData: query,
})
}
4 changes: 2 additions & 2 deletions contrib/scripts/protoc-swagger-gen.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash

set -eo pipefail

if ! [ -x "$(command -v swagger-combine )" ]; then
if ! [ -x "$(command -v swagger-combine)" ]; then
echo 'Error: swagger-combine is not installed. Install with $~ npm i -g swagger-combine' >&2
exit 1
fi
Expand All @@ -19,6 +18,7 @@ for dir in $proto_dirs; do
done

cd ..

# combine swagger files
# uses nodejs package `swagger-combine`.
# all the individual swagger files need to be configured in `config.json` for merging
Expand Down
55 changes: 55 additions & 0 deletions contrib/scripts/protoc-update-swagger-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -eo pipefail

SWAGGER_DIR=./swagger
SWAGGER_UI_DIR=${SWAGGER_DIR}/swagger-ui

# TODO: needs to fix merge issue of cosmos swagger and ibc-go swagger
# SDK_VERSION=$(go list -m -f '{{ .Version }}' github.com/cosmos/cosmos-sdk)
# IBC_VERSION=$(go list -m -f '{{ .Version }}' github.com/cosmos/ibc-go/v6)

# SDK_RAW_URL=https://raw.githubusercontent.com/cosmos/cosmos-sdk/${SDK_VERSION}/client/docs/swagger-ui/swagger.yaml
# IBC_RAW_URL=https://raw.githubusercontent.com/cosmos/ibc-go/${IBC_VERSION}/docs/client/swagger-ui/swagger.yaml

# # download Cosmos SDK swagger yaml file
# echo "SDK version ${SDK_VERSION}"
# wget "${SDK_RAW_URL}" -O ./tmp-swagger-gen/cosmos-sdk-swagger.yaml

# # download IBC swagger yaml file
# echo "IBC version ${IBC_VERSION}"
# wget "${IBC_RAW_URL}" -O ./tmp-swagger-gen/ibc-go-swagger.yaml

SWAGGER_UI_VERSION=4.18.3
SWAGGER_UI_DOWNLOAD_URL=https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${SWAGGER_UI_VERSION}.zip
SWAGGER_UI_PACKAGE_NAME=${SWAGGER_DIR}/swagger-ui-${SWAGGER_UI_VERSION}

# if swagger-ui does not exist locally, download swagger-ui and move dist directory to
# swagger-ui directory, then remove zip file and unzipped swagger-ui directory
if [ ! -d ${SWAGGER_UI_DIR} ]; then
# download swagger-ui
wget ${SWAGGER_UI_DOWNLOAD_URL} -O ${SWAGGER_UI_PACKAGE_NAME}.zip
# unzip swagger-ui package
unzip ${SWAGGER_UI_PACKAGE_NAME}.zip -d ${SWAGGER_DIR}
# move swagger-ui dist directory to swagger-ui directory
mv ${SWAGGER_UI_PACKAGE_NAME}/dist ${SWAGGER_UI_DIR}
# remove swagger-ui zip file and unzipped swagger-ui directory
rm -rf ${SWAGGER_UI_PACKAGE_NAME}.zip ${SWAGGER_UI_PACKAGE_NAME}
# replacing default swagger with our generated swagger yaml file
sed -i 's+https://petstore.swagger.io/v2/swagger.json+./swagger.yaml+g' ${SWAGGER_DIR}/swagger-ui/swagger-initializer.js
fi

# move generated swagger yaml file to swagger-ui directory
cp ${SWAGGER_DIR}/swagger.yaml ${SWAGGER_DIR}/swagger-ui/

# install statik if not present
go install github.com/rakyll/statik

# generate statik golang code using updated swagger-ui directory
statik -src=${SWAGGER_DIR}/swagger-ui -dest=${SWAGGER_DIR} -f -m

# log whether or not the swagger directory was updated
if [ -n "$(git status ${SWAGGER_DIR} --porcelain)" ]; then
echo "Swagger is updated"
else
echo "Swagger in sync"
fi
Loading

0 comments on commit 3f9cf43

Please sign in to comment.