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

Fix v47 IBC test #676

Merged
merged 15 commits into from
May 16, 2023
7 changes: 3 additions & 4 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name: Build Docker Image on PR

on:
push:
paths:
- "**docker**"
- "**.sh"
- "**.bash"
branches:
- master
- main

env:
REGISTRY: ghcr.io
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,37 +122,37 @@ benchmark:
###############################################################################

# Executes basic chain tests via interchaintest
ictest-basic:
ictest-basic: rm-testcache
cd interchaintest && go test -race -v -run TestBasicJunoStart .

ictest-tokenfactory:
ictest-tokenfactory: rm-testcache
cd interchaintest && go test -race -v -run TestJunoTokenFactory .

ictest-feeshare:
ictest-feeshare: rm-testcache
cd interchaintest && go test -race -v -run TestJunoFeeShare .

# Executes a basic chain upgrade test via interchaintest
ictest-upgrade:
ictest-upgrade: rm-testcache
cd interchaintest && go test -race -v -run TestBasicJunoUpgrade .

# Executes a basic chain upgrade locally via interchaintest after compiling a local image as juno:local
ictest-upgrade-local: local-image ictest-upgrade

# Executes IBC tests via interchaintest
ictest-ibc:
ictest-ibc: rm-testcache
cd interchaintest && go test -race -v -run TestJunoGaiaIBCTransfer .

# Unity contract CI
ictest-unity-deploy:
ictest-unity-deploy: rm-testcache
cd interchaintest && go test -race -v -run TestJunoUnityContractDeploy .

ictest-unity-gov:
ictest-unity-gov: rm-testcache
cd interchaintest && go test -race -v -run TestJunoUnityContractGovSubmit .

# Executes all tests via interchaintest after compling a local image as juno:local
ictest-all: local-image ictest-basic ictest-upgrade ictest-ibc
rm-testcache:
go clean -testcache

.PHONY: test-mutation ictest-basic ictest-upgrade ictest-ibc ictest-all
.PHONY: test-mutation ictest-basic ictest-upgrade ictest-ibc ictest-unity-deploy ictest-unity-gov

###############################################################################
### heighliner ###
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"

"github.com/CosmosContracts/juno/v15/app/openapiconsole"
"github.com/CosmosContracts/juno/v15/docs"
dbm "github.com/cometbft/cometbft-db"
Expand All @@ -25,7 +27,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down
55 changes: 28 additions & 27 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package keepers
import (
"path/filepath"

ibchookstypes "github.com/CosmosContracts/juno/v15/x/ibchooks/types"
"github.com/spf13/cast"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
ibchooks "github.com/CosmosContracts/juno/v15/x/ibchooks"

"github.com/CosmosContracts/juno/v15/x/ibchooks"
ibchookskeeper "github.com/CosmosContracts/juno/v15/x/ibchooks/keeper"
ibchookstypes "github.com/CosmosContracts/juno/v15/x/ibchooks/types"
mintkeeper "github.com/CosmosContracts/juno/v15/x/mint/keeper"
minttypes "github.com/CosmosContracts/juno/v15/x/mint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -18,7 +21,6 @@ import (
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
Expand Down Expand Up @@ -328,7 +330,6 @@ func NewAppKeepers(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)). // This should be removed. It is still in place to avoid failures of modules that have not yet been upgraded
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper))
// AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(appKeepers.DistrKeeper)).

govKeeper := govkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -360,6 +361,16 @@ func NewAppKeepers(
appKeepers.Ics20WasmHooks,
)

appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
appCodec,
appKeepers.keys[ibcfeetypes.StoreKey],
appKeepers.HooksICS4Wrapper, // replaced with IBC middleware
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
)

// Initialize packet forward middleware router
appKeepers.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
appCodec, appKeepers.keys[packetforwardtypes.StoreKey],
Expand All @@ -369,17 +380,8 @@ func NewAppKeepers(
appKeepers.DistrKeeper,
appKeepers.BankKeeper,
// The ICS4Wrapper is replaced by the IBCFeeKeeper instead of the channel so that sending can be overridden by the middleware
&appKeepers.IBCFeeKeeper,
)

appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
appCodec,
appKeepers.keys[ibcfeetypes.StoreKey],
appKeepers.HooksICS4Wrapper, // replaced with IBC middleware
// &appKeepers.IBCFeeKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
)

// Create Transfer Keepers
Expand All @@ -396,6 +398,8 @@ func NewAppKeepers(
scopedTransferKeeper,
)

appKeepers.PacketForwardKeeper.SetTransferKeeper(appKeepers.TransferKeeper)

// ICQ Keeper
appKeepers.ICQKeeper = icqkeeper.NewKeeper(
appCodec,
Expand All @@ -408,8 +412,6 @@ func NewAppKeepers(
NewQuerierWrapper(bApp),
)

appKeepers.PacketForwardKeeper.SetTransferKeeper(appKeepers.TransferKeeper)

appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec,
appKeepers.keys[icahosttypes.StoreKey],
Expand All @@ -430,13 +432,6 @@ func NewAppKeepers(
scopedICAControllerKeeper, bApp.MsgServiceRouter(),
)

icaHostIBCModule := icahost.NewIBCModule(appKeepers.ICAHostKeeper)

// initialize ICA module with mock module as the authentication module on the controller side
var icaControllerStack porttypes.IBCModule
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, appKeepers.ICAControllerKeeper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, appKeepers.IBCFeeKeeper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec, appKeepers.keys[evidencetypes.StoreKey], appKeepers.StakingKeeper, appKeepers.SlashingKeeper,
Expand Down Expand Up @@ -538,19 +533,26 @@ func NewAppKeepers(
// Create Transfer Stack
var transferStack porttypes.IBCModule
transferStack = transfer.NewIBCModule(appKeepers.TransferKeeper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, appKeepers.IBCFeeKeeper)
transferStack = ibchooks.NewIBCMiddleware(transferStack, &appKeepers.HooksICS4Wrapper)
transferStack = packetforward.NewIBCMiddleware(
transferStack,
appKeepers.PacketForwardKeeper,
0,
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
transferStack = ibcfee.NewIBCMiddleware(transferStack, appKeepers.IBCFeeKeeper)
transferStack = ibchooks.NewIBCMiddleware(transferStack, &appKeepers.HooksICS4Wrapper)

// initialize ICA module with mock module as the authentication module on the controller side
var icaControllerStack porttypes.IBCModule
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, appKeepers.ICAControllerKeeper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, appKeepers.IBCFeeKeeper)

// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
icaHostStack := ibcfee.NewIBCMiddleware(icaHostIBCModule, appKeepers.IBCFeeKeeper)
var icaHostStack porttypes.IBCModule
icaHostStack = icahost.NewIBCModule(appKeepers.ICAHostKeeper)
icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, appKeepers.IBCFeeKeeper)

// Create fee enabled wasm ibc Stack
var wasmStack porttypes.IBCModule
Expand All @@ -567,7 +569,6 @@ func NewAppKeepers(
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(icqtypes.ModuleName, icqModule)

appKeepers.IBCKeeper.SetRouter(ibcRouter)

appKeepers.ScopedIBCKeeper = scopedIBCKeeper
Expand Down
5 changes: 4 additions & 1 deletion app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ func (appKeepers *AppKeepers) GenerateKeys() {
// non sdk store keys
ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
wasm.StoreKey, icahosttypes.StoreKey,
icacontrollertypes.StoreKey, icqtypes.StoreKey, packetforwardtypes.StoreKey, ibchookstypes.StoreKey, tokenfactorytypes.StoreKey, feesharetypes.StoreKey,
icacontrollertypes.StoreKey, icqtypes.StoreKey,
packetforwardtypes.StoreKey,
ibchookstypes.StoreKey,
tokenfactorytypes.StoreKey, feesharetypes.StoreKey,
)

appKeepers.tkeys = sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down
11 changes: 6 additions & 5 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
feeshare "github.com/CosmosContracts/juno/v15/x/feeshare"
feesharetypes "github.com/CosmosContracts/juno/v15/x/feeshare/types"
"github.com/CosmosContracts/juno/v15/x/globalfee"
ibchooks "github.com/CosmosContracts/juno/v15/x/ibchooks"
"github.com/CosmosContracts/juno/v15/x/ibchooks"
ibchookstypes "github.com/CosmosContracts/juno/v15/x/ibchooks/types"
"github.com/CosmosContracts/juno/v15/x/mint"
minttypes "github.com/CosmosContracts/juno/v15/x/mint/types"
Expand Down Expand Up @@ -58,6 +58,7 @@ import (
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
icq "github.com/strangelove-ventures/async-icq/v7"
icqtypes "github.com/strangelove-ventures/async-icq/v7/types"

packetforward "github.com/strangelove-ventures/packet-forward-middleware/v7/router"
packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types"
)
Expand Down Expand Up @@ -135,9 +136,9 @@ func appModules(
feeshare.NewAppModule(app.AppKeepers.FeeShareKeeper, app.AppKeepers.AccountKeeper),
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ica.NewAppModule(&app.AppKeepers.ICAControllerKeeper, &app.AppKeepers.ICAHostKeeper),
ibchooks.NewAppModule(app.AppKeepers.AccountKeeper),
crisis.NewAppModule(app.AppKeepers.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
// IBC modules
ibchooks.NewAppModule(app.AppKeepers.AccountKeeper),
icq.NewAppModule(app.AppKeepers.ICQKeeper),
packetforward.NewAppModule(app.AppKeepers.PacketForwardKeeper),
}
Expand Down Expand Up @@ -195,8 +196,8 @@ func orderBeginBlockers() []string {
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
// additional modules
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
ibcfeetypes.ModuleName,
Expand Down Expand Up @@ -229,8 +230,8 @@ func orderEndBlockers() []string {
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
// additional non simd modules
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
ibcfeetypes.ModuleName,
Expand Down Expand Up @@ -263,8 +264,8 @@ func orderInitBlockers() []string {
feegrant.ModuleName,
consensusparamtypes.ModuleName,
// additional non simd modules
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
ibcfeetypes.ModuleName,
Expand Down
1 change: 0 additions & 1 deletion app/upgrades/v13/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
tokenfactorytypes "github.com/CosmosContracts/juno/v15/x/tokenfactory/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"

packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v7/router/types"
)

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/math v1.0.0
cosmossdk.io/simapp v0.0.0-20230224204036-a6adb0821462
github.com/CosmWasm/wasmd v0.40.0-rc.2
github.com/CosmWasm/wasmd v0.40.0-rc.2.0.20230515091654-e36611aa22b6
github.com/cometbft/cometbft v0.37.1
github.com/cometbft/cometbft-db v0.7.0
github.com/cosmos/cosmos-sdk v0.47.2
Expand Down Expand Up @@ -100,7 +100,7 @@ require (
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/CosmWasm/wasmd v0.40.0-rc.2 h1:UgOr8CaitJ8C8Y80viKLT6mL2Xh4yg2X4szCdTVr6xg=
github.com/CosmWasm/wasmd v0.40.0-rc.2/go.mod h1:l2s42GHKp1CHcR0N6J8P6p02b5RMWFCpcmRjyKMtqqg=
github.com/CosmWasm/wasmd v0.40.0-rc.2.0.20230515091654-e36611aa22b6 h1:rnnnJQ14eZrfCCf4rauWasHQulv3dtGkynIisz9HDB8=
github.com/CosmWasm/wasmd v0.40.0-rc.2.0.20230515091654-e36611aa22b6/go.mod h1:frHH5xVukE5xRaJcUNjE+TVPzbuHeV7sPnElR5gcA1w=
github.com/CosmWasm/wasmvm v1.2.3 h1:OKYlobwmVGbl0eSn0mXoAAjE5hIuXnQCLPjbNd91sVY=
github.com/CosmWasm/wasmvm v1.2.3/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
Expand Down Expand Up @@ -449,8 +449,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down
2 changes: 1 addition & 1 deletion interchaintest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ require (
github.com/CosmosContracts/juno/v15 v15.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-sdk v0.47.2
github.com/cosmos/gogoproto v1.4.8
github.com/cosmos/ibc-go/v7 v7.0.0
github.com/docker/docker v20.10.24+incompatible
github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230508154211-ebc1cbd6d88e
Expand Down Expand Up @@ -80,7 +81,6 @@ require (
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
github.com/cosmos/ibc-go/v7 v7.0.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
Expand Down
Loading