Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade umee branch cosmos-sdk 0.47 #273

Merged
merged 13 commits into from
Oct 31, 2023
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
cache: true
env:
GOOS: ${{ matrix.targetos }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
cache: true

- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-go@v3
if: env.GIT_DIFF
with:
go-version: 1.19
go-version: 1.21
cache: true
- name: revive lint
uses: morphy2k/revive-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/price-feeder-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
cache: true
cache-dependency-path: go.sum
# Parse 'umee/v*.*.*' semantic version from 'umee/v*.*.*' and save to
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.21
- name: Display Go Version
run: go version
- uses: actions/cache@v3
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/setup-go@v3
if: env.GIT_DIFF
with:
go-version: 1.19
go-version: 1.21
cache: true
cache-dependency-path: go.sum
- name: Test Unit
Expand All @@ -61,7 +61,7 @@ jobs:
- uses: actions/setup-go@v4
if: env.GIT_DIFF
with:
go-version: 1.19
go-version: 1.21
cache: true
- name: Test Integration
env:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder
FROM golang:1.19-alpine AS builder
FROM golang:1.20-alpine AS builder

RUN apk add --no-cache \
ca-certificates \
Expand All @@ -18,7 +18,7 @@ RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) &&
-O /lib/libwasmvm_muslc.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1)
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m).a | cut -d ' ' -f 1)

COPY . .
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build
Expand Down
192 changes: 104 additions & 88 deletions go.mod

Large diffs are not rendered by default.

463 changes: 268 additions & 195 deletions go.sum

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions oracle/client/chain_height.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import (
"fmt"
"sync"

tmrpcclient "github.com/cometbft/cometbft/rpc/client"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
tmctypes "github.com/cometbft/cometbft/rpc/core/types"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/rs/zerolog"
tmrpcclient "github.com/tendermint/tendermint/rpc/client"
tmctypes "github.com/tendermint/tendermint/rpc/core/types"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
)

var (
Expand All @@ -33,14 +36,16 @@ type ChainHeight struct {
// starts a new goroutine subscribed to EventNewBlockHeader.
func NewChainHeight(
ctx context.Context,
rpcClient tmrpcclient.Client,
client client.TendermintRPC,
logger zerolog.Logger,
initialHeight int64,
) (*ChainHeight, error) {
if initialHeight < 1 {
return nil, fmt.Errorf("expected positive initial block height")
}

rpcClient := client.(*rpchttp.HTTP)

if !rpcClient.IsRunning() {
if err := rpcClient.Start(); err != nil {
return nil, err
Expand Down
13 changes: 7 additions & 6 deletions oracle/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ import (
"os"
"time"

rpchttp "github.com/cometbft/cometbft/rpc/client/http"
tmjsonclient "github.com/cometbft/cometbft/rpc/jsonrpc/client"
"github.com/rs/zerolog"
umeeapp "github.com/umee-network/umee/v6/app"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/rs/zerolog"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
tmjsonclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
umeeapp "github.com/umee-network/umee/v4/app"
umeeparams "github.com/umee-network/umee/v4/app/params"
)

type (
Expand All @@ -39,7 +40,7 @@ type (
OracleAddrString string
ValidatorAddr sdk.ValAddress
ValidatorAddrString string
Encoding umeeparams.EncodingConfig
Encoding testutil.TestEncodingConfig
GasPrices string
GasAdjustment float64
GRPCEndpoint string
Expand Down
2 changes: 1 addition & 1 deletion oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/rs/zerolog"
oracletypes "github.com/umee-network/umee/v4/x/oracle/types"
oracletypes "github.com/umee-network/umee/v6/x/oracle/types"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down
2 changes: 1 addition & 1 deletion oracle/param.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package oracle

import oracletypes "github.com/umee-network/umee/v4/x/oracle/types"
import oracletypes "github.com/umee-network/umee/v6/x/oracle/types"

const (
// paramsCacheInterval represents the amount of blocks
Expand Down
2 changes: 1 addition & 1 deletion oracle/param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
oracletypes "github.com/umee-network/umee/v4/x/oracle/types"
oracletypes "github.com/umee-network/umee/v6/x/oracle/types"
)

func TestParamCacheIsOutdated(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion oracle/provider/uniswap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/hasura/go-graphql-client"
"github.com/rs/zerolog"
"github.com/stretchr/testify/suite"
"github.com/tendermint/tendermint/libs/rand"
"github.com/cometbft/cometbft/libs/rand"

"github.com/ojo-network/price-feeder/oracle/types"
)
Expand Down
6 changes: 3 additions & 3 deletions oracle/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func TestStandardDeviation(t *testing.T) {
},
OJOUSD: {
mean: sdk.MustNewDecFromStr("1.1335"),
deviation: sdk.MustNewDecFromStr("0.004600724580614015"),
deviation: sdk.MustNewDecFromStr("0.004600724580614014"),
},
},
},
Expand Down Expand Up @@ -361,11 +361,11 @@ func TestStandardDeviation(t *testing.T) {
},
OJOUSD: {
mean: sdk.MustNewDecFromStr("1.1335"),
deviation: sdk.MustNewDecFromStr("0.004600724580614015"),
deviation: sdk.MustNewDecFromStr("0.004600724580614014"),
},
LUNAUSD: {
mean: sdk.MustNewDecFromStr("64.606666666666666666"),
deviation: sdk.MustNewDecFromStr("0.358360464089193609"),
deviation: sdk.MustNewDecFromStr("0.358360464089193608"),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion price-feeder.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ provider_timeout = "1000000s"
[server]
listen_addr = "0.0.0.0:7171"
read_timeout = "20s"
verbose_cors = true
verbose_cors = false
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
write_timeout = "20s"

[account]
Expand Down
Loading