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

AsyncICQ v8 changes #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/async-icq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
run: |
docker image load -i ${{ env.HOST_TAR_PATH }}
docker image load -i ${{ env.CONTROLLER_TAR_PATH }}
docker image load -i testing/previous_images/icq-host_8_0_0.tar
docker image load -i testing/previous_images/icq-host_7_1_1.tar
docker image ls -a

- name: Run Test
Expand Down
15 changes: 6 additions & 9 deletions modules/async-icq/e2e/icq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ func TestInterchainQueries(t *testing.T) {
UidGid: "1025:1025",
}

/*
relayerImage := ibc.DockerImage{
Repository: "icq-relayer",
Version: "local",
UidGid: "1025:1025",
}
*/
relayerImage := ibc.DockerImage{
Repository: "ghcr.io/cosmos/relayer",
Version: "main",
UidGid: "1025:1025",
}

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Expand Down Expand Up @@ -123,8 +121,7 @@ func TestInterchainQueries(t *testing.T) {
r := interchaintest.NewBuiltinRelayerFactory(
ibc.CosmosRly,
zaptest.NewLogger(t),
// relayer.DockerImage(&relayerImage),
// relayer.ImagePull(false),
relayer.DockerImage(&relayerImage),
relayer.StartupFlags("--processor", "events", "--block-history", "100"),
).Build(t, client, network)

Expand Down
27 changes: 4 additions & 23 deletions modules/async-icq/e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package e2e

import (
"context"
"encoding/json"
"fmt"
"testing"
"time"

upgradetypes "cosmossdk.io/x/upgrade/types"
cosmosproto "github.com/cosmos/gogoproto/proto"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v8/types"
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
Expand All @@ -20,7 +18,7 @@ import (

const (
chainName = "simapp"
upgradeName = "v2" // x/params migration
upgradeName = "v3" // default handler, SDK v47 -> SDK v50.

haltHeightDelta = uint64(9) // will propose upgrade this many blocks in the future
blocksAfterUpgrade = uint64(7)
Expand All @@ -31,14 +29,14 @@ const (

var (
// baseChain is the current version of the chain that will be upgraded from
// docker image load -i ../prev_builds/icq-host_8_0_0.tar
// docker image load -i ../prev_builds/icq-host_7_1_1.tar
baseChain = ibc.DockerImage{
Repository: "icq-host",
Version: "v8.0.0",
Version: "v7.1.1",
UidGid: "1025:1025",
}

// make local-image
// make local-image-icq
upgradeTo = ibc.DockerImage{
Repository: "icq-host",
Version: "local",
Expand Down Expand Up @@ -106,23 +104,6 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, upgradeRepo, upgradeDockerT

ValidatorVoting(t, ctx, chain, proposalID, height, haltHeight)
UpgradeNodes(t, ctx, chain, client, haltHeight, upgradeRepo, upgradeDockerTag)

// Validate the ICQ subspace -> keeper migration was successful.
cmd := []string{
chain.Config().Bin, "q", "interchainquery", "params", "--output=json", "--node", chain.GetRPCAddress(),
}
stdout, _, err := chain.Exec(ctx, cmd, nil)
fmt.Println("stdout", string(stdout))
require.NoError(t, err, "error fetching icq params")

var params icqtypes.Params
err = json.Unmarshal(stdout, &params)
require.NoError(t, err, "error unmarshalling icq params")

t.Logf("params: %+v", params)
require.Equal(t, false, params.HostEnabled, "HostEnabled not equal to expected value")
require.Equal(t, []string{"/cosmos.bank.v1beta1.Query/AllBalances"}, params.AllowQueries, "AllowQueries not equal to expected value")

}

func SubmitUpgradeProposal(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, upgradeName string, haltHeight uint64) string {
Expand Down
3 changes: 1 addition & 2 deletions modules/async-icq/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (

"cosmossdk.io/errors"

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

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

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
Expand Down
3 changes: 1 addition & 2 deletions modules/async-icq/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"github.com/cosmos/ibc-apps/modules/async-icq/v8/types"
"github.com/stretchr/testify/suite"

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

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

abcitypes "github.com/cometbft/cometbft/abci/types"
tmprotostate "github.com/cometbft/cometbft/proto/tendermint/state"
tmstate "github.com/cometbft/cometbft/state"

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
Expand Down
7 changes: 3 additions & 4 deletions modules/async-icq/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import (

"github.com/cosmos/ibc-apps/modules/async-icq/v8/types"

"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

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

"cosmossdk.io/log"

capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
)
Expand Down
3 changes: 2 additions & 1 deletion modules/async-icq/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package keeper_test
import (
"fmt"

storetypes "cosmossdk.io/store/types"
"github.com/cosmos/ibc-apps/modules/async-icq/v8/testing/simapp"
"github.com/cosmos/ibc-apps/modules/async-icq/v8/types"

storetypes "cosmossdk.io/store/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down
4 changes: 2 additions & 2 deletions modules/async-icq/testing/demo-simapp/scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ echo "Generating gogo proto code"
cd proto

# generate gogo proto code
buf generate --template buf.gen.gogo.yaml
buf generate --template buf.gen.gogo.yaml

cd ..

# move proto files to the right places
cp -r github.com/cosmos/ibc-apps/modules/async-icq/v8/interchain-query-demo/x/interquery/types/* x/interquery/types/
cp -r github.com/cosmos/ibc-apps/modules/async-icq/v*/interchain-query-demo/x/interquery/types/* x/interquery/types/
rm -rf github.com

go mod tidy
8 changes: 3 additions & 5 deletions modules/async-icq/testing/previous_images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

This section is used for upgrades e2e test.

v8.0.0

- <https://github.com/cosmos/ibc-apps/commit/e5a274cf6fc2eb965a9f8da4bdeb7c718d06661d>
- docker build . -t icq-host:v8.0.0 -f Dockerfile.icq
- docker save icq-host:v8.0.0 > icq-host_8_0_0.tar
- <https://github.com/cosmos/ibc-apps/commit/2e44c421ad4a330263c58a29009b19e87562e720>
- docker build . -t icq-host:v7.1.1 -f Dockerfile.icq
- docker save icq-host:v7.1.1 > icq-host_7_1_1.tar
Binary file not shown.
18 changes: 12 additions & 6 deletions modules/async-icq/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"

dbm "github.com/cosmos/cosmos-db"
icq "github.com/cosmos/ibc-apps/modules/async-icq/v8"
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v8/keeper"
upgrades "github.com/cosmos/ibc-apps/modules/async-icq/v8/testing/simapp/upgrades"
Expand All @@ -17,6 +18,7 @@ import (
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/evidence"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
Expand All @@ -27,9 +29,6 @@ import (
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -95,11 +94,12 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
tmos "github.com/cometbft/cometbft/libs/os"
dbm "github.com/cosmos/cosmos-db"

"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
Expand Down Expand Up @@ -639,7 +639,9 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()); err != nil {
panic(err)
}
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down Expand Up @@ -795,6 +797,10 @@ func (app *SimApp) setupUpgradeHandlers() {
upgrades.V2,
upgrades.CreateV2UpgradeHandler(app.mm, app.configurator, app.ParamsKeeper, app.ConsensusParamsKeeper, app.ICQKeeper),
)
app.UpgradeKeeper.SetUpgradeHandler(
upgrades.V3,
upgrades.CreateDefaultUpgradeHandler(app.mm, app.configurator),
)
}

// setupUpgradeStoreLoaders sets all necessary store loaders required by upgrades.
Expand Down
9 changes: 4 additions & 5 deletions modules/async-icq/testing/simapp/cmd/icqd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import (
"io"
"os"

"github.com/cosmos/ibc-apps/modules/async-icq/v8/testing/simapp"
dbm "github.com/cosmos/cosmos-db"
app "github.com/cosmos/ibc-apps/modules/async-icq/v8/testing/simapp"
"github.com/spf13/cast"
"github.com/spf13/cobra"

"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand All @@ -28,10 +30,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

"cosmossdk.io/log"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
dbm "github.com/cosmos/cosmos-db"
)

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down Expand Up @@ -191,7 +191,6 @@ func txCommand(tempApp *app.SimApp) *cobra.Command {
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
//authcmd.GetAuxToFeeCommand(),
)

tempApp.BasicModuleManager.AddTxCommands(cmd)
Expand Down Expand Up @@ -277,7 +276,7 @@ func (ac appCreator) appExport(
var tempDir = func() string {
dir, err := os.MkdirTemp("", "simapp")
if err != nil {
dir = simapp.DefaultNodeHome
dir = app.DefaultNodeHome
}
defer os.RemoveAll(dir)

Expand Down
3 changes: 2 additions & 1 deletion modules/async-icq/testing/simapp/encoding.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package simapp

import (
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/gogoproto/proto"

"cosmossdk.io/x/tx/signing"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/address"
Expand Down
Loading