Skip to content

Commit

Permalink
chore: upgrade wasmd to v0.27.0.rc3-osmo and ibc-go to v3 (#1527) (#1535
Browse files Browse the repository at this point in the history
)

Closes: #XXX

## What is the purpose of the change

Context: #1527 

This change is a trivial rework / code cleanup without any test coverage.

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? no
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? yes
  - How is the feature or change documented? not applicable
  • Loading branch information
p0mvn authored May 18, 2022
1 parent b444708 commit 7bff4c9
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 96 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

* [#1535](https://github.com/osmosis-labs/osmosis/pull/1535) upgrade wasmd to v0.27.0.rc3-osmo and ibc-go to v3
* [#1435] `x/tokenfactory` create denom fee for spam resistance
* [#1429] solver for multi-asset CFMM
* [#1253] Add lockup duration edit method
* [#1253] Add lockup duration edit method
* [#1312] Stableswap: Createpool logic
* [#1230] Stableswap CFMM equations
* [#1230] Stableswap CFMM equations

## [v8.0.0 - Emergency proposals upgrade](https://github.com/osmosis-labs/osmosis/releases/tag/v8.0.0)

This upgrade is a patch that must be hard forked in, as on-chain governance of Osmosis approved proposal [227](https://www.mintscan.io/osmosis/proposals/227) and proposal [228](https://www.mintscan.io/osmosis/proposals/228).
Expand All @@ -63,7 +65,6 @@ This upgrade includes:
Every node should upgrade their software version to v8.0.0 before the upgrade block height 4402000. If you use cosmovisor, simply swap out the binary at upgrades/v7/bin to be v8.0.0, and restart the node. Do check cosmovisor version returns v8.0.0

### Features

* {Across many PRs} Initiate emergency upgrade
* [#1481] Emergency upgrade as of prop [226] (https://www.mintscan.io/osmosis/proposals/226)
* [#1482] Checking Whitelisted Pools contain UST
Expand All @@ -74,6 +75,7 @@ Every node should upgrade their software version to v8.0.0 before the upgrade bl
* [#916] And a fn for Unbond and Burn tokens
* [#908] Superfluid slashing code
* [#904] LockAndSuperfluidDelegate

### Minor improvements & Bug Fixes

* [#1428] fix: pool params query (backport #1315)
Expand Down
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
ARG BASE_IMG_TAG=nonroot

## Build Image
FROM golang:1.18-bullseye as build
FROM golang:1.18.2-alpine3.15 as build

RUN set -eux; apk add --no-cache ca-certificates build-base;

RUN apk add git

# needed by github.com/zondax/hid
RUN apk add linux-headers

WORKDIR /osmosis
COPY . /osmosis

# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile
# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta5/libwasmvm_muslc.a /lib/libwasmvm_muslc.a
RUN sha256sum /lib/libwasmvm_muslc.a | grep d16a2cab22c75dbe8af32265b9346c6266070bdcf9ed5aa9b7b39a7e32e25fe0
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a
RUN sha256sum /lib/libwasmvm_muslc.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

RUN BUILD_TAGS=muslc make build
RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build

## Deploy image
FROM gcr.io/distroless/base-debian11:${BASE_IMG_TAG}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ifeq (,$(findstring nostrip,$(OSMOSIS_BUILD_OPTIONS)))
ldflags += -w -s
endif
ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-L/usr/local/lib/ -lwasmvm_muslc -Wl,-z,muldefs -static"
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
Expand Down
7 changes: 4 additions & 3 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package app
import (
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper"
ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante"

osmoante "github.com/osmosis-labs/osmosis/v7/ante"

Expand All @@ -29,7 +30,7 @@ func NewAnteHandler(
spotPriceCalculator txfeestypes.SpotPriceCalculator,
sigGasConsumer ante.SignatureVerificationGasConsumer,
signModeHandler signing.SignModeHandler,
channelKeeper channelkeeper.Keeper,
channelKeeper *ibckeeper.Keeper,
) sdk.AnteHandler {
mempoolFeeOptions := txfeestypes.NewMempoolFeeOptions(appOpts)
mempoolFeeDecorator := txfeeskeeper.NewMempoolFeeDecorator(*txFeesKeeper, mempoolFeeOptions)
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func NewOsmosisApp(
app.GAMMKeeper,
ante.DefaultSigVerificationGasConsumer,
encodingConfig.TxConfig.SignModeHandler(),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper,
),
)
app.SetEndBlocker(app.EndBlocker)
Expand Down
3 changes: 0 additions & 3 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func NewDefaultGenesisState() GenesisState {
Params: wasmtypes.Params{
CodeUploadAccess: wasmtypes.AllowNobody,
InstantiateDefaultPermission: wasmtypes.AccessTypeEverybody,
// DefaultMaxWasmCodeSize limit max bytes read to prevent gzip bombs
// It is 1200 KB in x/wasm, update it later via governance if really needed
MaxWasmCodeSize: wasmtypes.DefaultMaxWasmCodeSize,
},
}
gen[wasm.ModuleName] = encCfg.Marshaler.MustMarshalJSON(&wasmGen)
Expand Down
22 changes: 13 additions & 9 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v2/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"

// IBC Transfer: Defines the "transfer" IBC port
transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
"github.com/osmosis-labs/bech32-ibc/x/bech32ibc"
bech32ibckeeper "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/keeper"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"
Expand Down Expand Up @@ -194,17 +196,19 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.ScopedTransferKeeper,
)
appKeepers.TransferKeeper = &transferKeeper
appKeepers.TransferModule = transfer.NewAppModule(*appKeepers.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(*appKeepers.TransferKeeper)

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, appKeepers.TransferModule)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
// Note: the sealing is done after creating wasmd and wiring that up

appKeepers.Bech32IBCKeeper = bech32ibckeeper.NewKeeper(
Expand Down
6 changes: 3 additions & 3 deletions app/keepers/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package keepers
import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client"
transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v3/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client"
"github.com/osmosis-labs/bech32-ibc/x/bech32ibc"

"github.com/cosmos/cosmos-sdk/types/module"
Expand Down
10 changes: 5 additions & 5 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package app

import (
"github.com/CosmWasm/wasmd/x/wasm"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v3/modules/core"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
"github.com/osmosis-labs/bech32-ibc/x/bech32ibc"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"
"github.com/osmosis-labs/bech32-ibc/x/bech32ics20"
Expand Down Expand Up @@ -110,7 +110,7 @@ func appModules(
distr.NewAppModule(appCodec, *app.DistrKeeper, app.AccountKeeper, app.BankKeeper, *app.StakingKeeper),
staking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
upgrade.NewAppModule(*app.UpgradeKeeper),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
evidence.NewAppModule(*app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, *app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
ibc.NewAppModule(app.IBCKeeper),
Expand Down Expand Up @@ -241,7 +241,7 @@ func simulationModules(
staking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
params.NewAppModule(*app.ParamsKeeper),
evidence.NewAppModule(*app.EvidenceKeeper),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
ibc.NewAppModule(app.IBCKeeper),
incentives.NewAppModule(appCodec, *app.IncentivesKeeper, app.AccountKeeper, app.BankKeeper, app.EpochsKeeper),
lockup.NewAppModule(appCodec, *app.LockupKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v5

import (
ibcconnectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
3 changes: 2 additions & 1 deletion cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
Expand Down Expand Up @@ -276,7 +277,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetSnapshot(snapshotStore, sdk.NewSnapshotOptions(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)))),
baseapp.SetSnapshot(snapshotStore, snapshottypes.NewSnapshotOptions(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)))),
)
}

Expand Down
16 changes: 9 additions & 7 deletions contrib/images/rbuilder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

FROM golang:1.18-bullseye
FROM golang:1.18.2-alpine3.15

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get --no-install-recommends -y install \
pciutils build-essential git wget \
lsb-release dpkg-dev curl bsdmainutils fakeroot
RUN apk add pciutils build-base git wget linux-headers \
dpkg-dev curl gcc abuild binutils bash fakeroot

RUN mkdir -p /usr/local/share/osmosis/

# Deploy the shell functions library.
COPY buildlib.sh /usr/local/share/osmosis/

# Create the 'builder' user.
RUN useradd -ms /bin/bash -U builder
RUN addgroup -S builder && adduser -S builder -G builder
ARG APP
ARG DEBUG
ARG TARGET_PLATFORMS
Expand All @@ -25,13 +25,15 @@ ENV BUILD_SCRIPT ${BUILD_SCRIPT:-/sources/.build.sh}

# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile
# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta7/libwasmvm_muslc.a /usr/local/lib/libwasmvm_muslc.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /usr/local/lib/libwasmvm_muslc.a
RUN chown builder /usr/local/lib/libwasmvm_muslc.a
RUN sha256sum /usr/local/lib/libwasmvm_muslc.a | grep d0152067a5609bfdfb3f0d5d6c0f2760f79d5f2cd7fd8513cafa9932d22eb350
RUN sha256sum /usr/local/lib/libwasmvm_muslc.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

# Drop root privileges.
USER builder:builder
WORKDIR /sources

RUN git config --global --add safe.directory /sources

# Run the application's build.sh.
ENTRYPOINT [ "/bin/bash", "-c", "${BUILD_SCRIPT}" ]
21 changes: 9 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ require (
github.com/cosmos/cosmos-sdk v0.45.4
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/iavl v0.17.3
github.com/cosmos/ibc-go/v2 v2.0.3
github.com/cosmos/ibc-go/v3 v3.0.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/golangci/golangci-lint v1.46.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ory/dockertest/v3 v3.8.1
github.com/osmosis-labs/bech32-ibc v0.2.0-rc2
github.com/osmosis-labs/bech32-ibc v0.3.0-rc1
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/regen-network/cosmos-proto v0.3.1
Expand All @@ -41,7 +41,7 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/CosmWasm/wasmvm v1.0.0-beta7
github.com/CosmWasm/wasmvm v1.0.0
github.com/DataDog/zstd v1.4.5 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.1.0 // indirect
Expand Down Expand Up @@ -69,7 +69,7 @@ require (
github.com/charithe/durationcheck v0.0.9 // indirect
github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect
github.com/confio/ics23/go v0.6.6 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/containerd/continuity v0.2.1 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
Expand Down Expand Up @@ -97,7 +97,6 @@ require (
github.com/firefart/nonamedreturns v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fzipp/gocyclo v0.5.1 // indirect
github.com/gin-gonic/gin v1.7.0 // indirect
github.com/go-critic/go-critic v0.6.3 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.0 // indirect
Expand Down Expand Up @@ -181,7 +180,7 @@ require (
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/moricho/tparallel v0.2.1 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
Expand Down Expand Up @@ -270,14 +269,12 @@ require (
)

replace (
// branch: v0.24.0-osmo, current tag: v0.24.0-osmo-rc0
github.com/CosmWasm/wasmd => github.com/osmosis-labs/wasmd v0.24.0-osmo-rc0
// branch: v0.27.0.rc3-osmo, current tag: v0.27.0.rc3-osmo
github.com/CosmWasm/wasmd => github.com/osmosis-labs/wasmd v0.27.0-rc2.0.20220517191021-59051aa18d58
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk v0.45.0x-osmo-v7
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220412153824-b375ea016dae
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20220517190359-30ebc413ddff
// Use Osmosis fast iavl
github.com/cosmos/iavl => github.com/osmosis-labs/iavl v0.17.3-osmo-v5
// Use osmosis fork of ibc-go
github.com/cosmos/ibc-go/v2 => github.com/osmosis-labs/ibc-go/v2 v2.0.2-osmo
github.com/cosmos/iavl => github.com/osmosis-labs/iavl v0.17.3-osmo-v7
// use cosmos-compatible protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// use grpc compatible with cosmos protobufs
Expand Down
Loading

0 comments on commit 7bff4c9

Please sign in to comment.