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

deps!: use fixed cosmwasm version (v0.51.0) #3230

Merged
merged 14 commits into from
Jul 29, 2024
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,15 @@ jobs:
# the old gaiad binary version is hardcoded, need to be updated each major release.
- name: Install Old Gaiad
run: |
git checkout v18.1.0
make build
cp ./build/gaiad ./build/gaiadold
go clean -modcache
curl -LO https://github.com/cosmos/gaia/releases/download/v18.1.0/gaiad-v18.1.0-linux-amd64
chmod a+x gaiad-v18.1.0-linux-amd64
mkdir build
mv ./gaiad-v18.1.0-linux-amd64 ./build/gaiadold
if: env.GIT_DIFF
- name: Install New Gaiad
run: |
git checkout -
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm.x86_64.so
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm.aarch64.so
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm.x86_64.so
curl -LO https://github.com/CosmWasm/wasmvm/releases/download/v2.0.0/libwasmvm.aarch64.so
uname -m
sudo cp "./libwasmvm.$(uname -m).so" /usr/lib/
make build
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ ENV PACKAGES="curl make git libc-dev bash file gcc linux-headers eudev-dev"
RUN apk add --no-cache $PACKAGES

# See https://github.com/CosmWasm/wasmvm/releases
ARG WASMVM_VERSION=v1.5.0
ARG WASMVM_VERSION=v2.0.0
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 2687afbdae1bc6c7c8b05ae20dfb8ffc7ddc5b4e056697d0f37853dfe294e913
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 465e3a088e96fd009a11bfd234c69fb8a0556967677e54511c084f815cf9ce63
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 3b478b3e51d31e53ce9324a8895d2cd7278af5179b9a02ea55d8627958e42afa
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ca08bb7b73b49b483611d9755bb8455620bb8c0faf3014400908ed49bf3b19a5
RUN cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a

COPY go.mod go.sum* ./
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ include contrib/devtools/Makefile

check_version:
ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION))
@echo "ERROR: Go version 1.21 is required for $(VERSION) of Gaia."
@echo "ERROR: Go version 1.22 is required for $(VERSION) of Gaia."
exit 1
endif

Expand Down Expand Up @@ -150,7 +150,7 @@ distclean: clean

GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION)
COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm | sed 's/.* //')
COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //')

# create tag and run goreleaser without publishing
# errors are possible while running goreleaser - the process can run for >30 min
Expand Down
8 changes: 7 additions & 1 deletion app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helpers

import (
"encoding/json"
"os"
"testing"
"time"

Expand Down Expand Up @@ -125,6 +126,11 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs

func setup() (*gaiaapp.GaiaApp, gaiaapp.GenesisState) {
db := dbm.NewMemDB()
dir, err := os.MkdirTemp("", "gaia-test-app")
if err != nil {
panic(err)
}

appOptions := make(simtestutil.AppOptionsMap, 0)
emptyWasmOpts := []wasmkeeper.Option{}
appOptions[server.FlagInvCheckPeriod] = 5
Expand All @@ -136,7 +142,7 @@ func setup() (*gaiaapp.GaiaApp, gaiaapp.GenesisState) {
nil,
true,
map[int64]bool{},
gaiaapp.DefaultNodeHome,
dir,
appOptions,
emptyWasmOpts,
)
Expand Down
10 changes: 5 additions & 5 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keepers
import (
"fmt"
"os"
"strings"
"path/filepath"

feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
Expand Down Expand Up @@ -80,7 +80,6 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

wasmapp "github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand Down Expand Up @@ -469,6 +468,7 @@ func NewAppKeeper(
// Must be called on PFMRouter AFTER TransferKeeper initialized
appKeepers.PFMRouterKeeper.SetTransferKeeper(appKeepers.TransferKeeper)

wasmDir := filepath.Join(homePath, "wasm")
Copy link
Member

@Reecepbcups Reecepbcups Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

ref: same issue as I did on Juno: CosmosContracts/juno#961

wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic("error while reading wasm config: " + err.Error())
Expand All @@ -481,16 +481,16 @@ func NewAppKeeper(
appKeepers.BankKeeper,
appKeepers.StakingKeeper,
distrkeeper.NewQuerier(appKeepers.DistrKeeper),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCFeeKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.PortKeeper,
appKeepers.scopedWasmKeeper,
appKeepers.TransferKeeper,
bApp.MsgServiceRouter(),
bApp.GRPCQueryRouter(),
homePath,
wasmDir,
wasmConfig,
strings.Join(wasmapp.AllCapabilities(), ","),
wasmkeeper.BuiltInCapabilities(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)
Expand Down
8 changes: 5 additions & 3 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func TestAppStateDeterminism(t *testing.T) {

appHashList := make([]json.RawMessage, numTimesToRunPerSeed)
appOptions := make(simtestutil.AppOptionsMap, 0)
appOptions[flags.FlagHome] = gaia.DefaultNodeHome
appOptions[server.FlagInvCheckPeriod] = sim.FlagPeriodValue

for i := 0; i < numSeeds; i++ {
Expand All @@ -89,13 +88,16 @@ func TestAppStateDeterminism(t *testing.T) {
}

db := dbm.NewMemDB()
dir, err := os.MkdirTemp("", "gaia-simulation")
require.NoError(t, err)
appOptions[flags.FlagHome] = dir
app := gaia.NewGaiaApp(
logger,
db,
nil,
true,
map[int64]bool{},
gaia.DefaultNodeHome,
dir,
appOptions,
emptyWasmOption,
interBlockCacheOpt(),
Expand All @@ -117,7 +119,7 @@ func TestAppStateDeterminism(t *testing.T) {

blockedAddresses := app.BlockedModuleAccountAddrs(app.ModuleAccountAddrs())

_, _, err := simulation.SimulateFromSeed(
_, _, err = simulation.SimulateFromSeed(
t,
os.Stdout,
app.BaseApp,
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cosmos/gaia/v19

go 1.22.3
go 1.22.4

require (
cosmossdk.io/api v0.7.5
Expand All @@ -17,7 +17,7 @@ require (
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.13.3
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.50.0
github.com/CosmWasm/wasmd v0.51.0
github.com/cometbft/cometbft v0.38.9
github.com/cometbft/cometbft-db v0.12.0
github.com/cosmos/cosmos-db v1.0.2
Expand Down Expand Up @@ -48,7 +48,6 @@ require (
cloud.google.com/go/iam v1.1.8 // indirect
cloud.google.com/go/storage v1.41.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
// github.com/gravity-devs/liquidity v1.6.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.64.0 // indirect
Expand All @@ -65,7 +64,7 @@ require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/CosmWasm/wasmvm v1.5.0 // indirect
github.com/CosmWasm/wasmvm/v2 v2.0.0 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
Expand Down Expand Up @@ -192,7 +191,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.32.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CosmWasm/wasmd v0.50.0 h1:NVaGqCSTRfb9UTDHJwT6nQIWcb6VjlQl88iI+u1+qjE=
github.com/CosmWasm/wasmd v0.50.0/go.mod h1:UjmShW4l9YxaMytwJZ7IB7MWzHiynSZP3DdWrG0FRtk=
github.com/CosmWasm/wasmvm v1.5.0 h1:3hKeT9SfwfLhxTGKH3vXaKFzBz1yuvP8SlfwfQXbQfw=
github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc=
github.com/CosmWasm/wasmd v0.51.0 h1:3A2o20RrdF7P1D3Xb+R7A/pHbbHWsYCDXrHLa7S0SC8=
github.com/CosmWasm/wasmd v0.51.0/go.mod h1:7TSaj5HoolghujuVWeExqmcUKgpcYWEySGLSODbnnwY=
github.com/CosmWasm/wasmvm/v2 v2.0.0 h1:IqNCI2G0mvs7K6ej17/I28805rVqnu+Y1cWDqIdwb08=
github.com/CosmWasm/wasmvm/v2 v2.0.0/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
Expand Down Expand Up @@ -1165,8 +1165,8 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo=
github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ibcfee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestIBCFeeTestSuite(t *testing.T) {

func (suite *IBCFeeTestSuite) SetupTest() {
ante.UseFeeMarketDecorator = false
ibctesting.DefaultTestingAppInit = GaiaAppIniter
ibctesting.DefaultTestingAppInit = GaiaAppIniterTempDir
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/interchain_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func init() {
// concrete app types returned by the relevant app initers.
ccvSuite = integration.NewCCVTestSuite[*gaiaApp.GaiaApp, *appConsumer.App](
// Pass in ibctesting.AppIniters for gaia (provider) and consumer.
GaiaAppIniter, icstestingutils.ConsumerAppIniter, []string{})
GaiaAppIniterTempDir, icstestingutils.ConsumerAppIniter, []string{})

ante.UseFeeMarketDecorator = false
}
Expand Down
23 changes: 23 additions & 0 deletions tests/integration/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"math/rand"
"os"
"testing"
"time"

Expand All @@ -27,6 +28,28 @@ import (

var app *gaiaApp.GaiaApp

// Some tests require a random directory to be created when running IBC testing suite with gaia.
// This is due to how CosmWasmVM initializes the VM - all IBC testing apps must have different dirs so they don't conflict.
func GaiaAppIniterTempDir() (ibctesting.TestingApp, map[string]json.RawMessage) {
tmpDir, err := os.MkdirTemp("", "")
if err != nil {
panic(err)
}
app = gaiaApp.NewGaiaApp(
log.NewNopLogger(),
dbm.NewMemDB(),
nil,
true,
map[int64]bool{},
tmpDir,
gaiaApp.EmptyAppOptions{},
gaiaApp.EmptyWasmOptions)

testApp := ibctesting.TestingApp(app)

return testApp, app.ModuleBasics.DefaultGenesis(app.AppCodec())
}

// GaiaAppIniter implements ibctesting.AppIniter for the gaia app
func GaiaAppIniter() (ibctesting.TestingApp, map[string]json.RawMessage) {
app = gaiaApp.NewGaiaApp(
Expand Down
Loading