Skip to content

Commit

Permalink
feat!: icq x/params migration + msg_server (#136)
Browse files Browse the repository at this point in the history
* wip: icq migration & test

* fix: make install icqd

* register ibc interfaces for simapp testing

* cli: params query

* lint

* rename: pfm- - > icq

* minor patches

* `icq_host` -> `icq-host`

* rename legacy docker image v7.0.0

* ci: icq-host_7_0_0

* repo

* remove stale todo

* fix: don't use naked return type

* proper godoc
  • Loading branch information
Reecepbcups committed Nov 6, 2023
1 parent fa1967e commit 4e6ed0e
Show file tree
Hide file tree
Showing 34 changed files with 1,589 additions and 189 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/async-icq.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: async-icq
on:
on:
pull_request:
paths:
- 'modules/async-icq/**'
Expand All @@ -13,15 +13,15 @@ env:
HOST_TAR_PATH: /tmp/icq-host.tar
HOST_IMAGE_NAME: icq-host
HOST_DOCKER_TAG: icq-host:local

CONTROLLER_TAR_PATH: /tmp/icq-demo.tar
CONTROLLER_IMAGE_NAME: icq-demo
CONTROLLER_DOCKER_TAG: icq-demo:local

jobs:
golangci:
name: Linter
runs-on: ubuntu-latest
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -46,7 +46,7 @@ jobs:
- name: Test
run: go test ./...
working-directory: ${{ env.WORKING_DIRECTORY }}

build-docker:
runs-on: ubuntu-latest
steps:
Expand All @@ -56,22 +56,22 @@ jobs:
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ env.GO_VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export Host
uses: docker/build-push-action@v5
with:
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.HOST_DOCKER_TAG }}
file: ${{ env.WORKING_DIRECTORY }}/Dockerfile.icq
outputs: type=docker,dest=${{ env.HOST_TAR_PATH }}

- name: Build and export Controller
uses: docker/build-push-action@v5
with:
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.CONTROLLER_DOCKER_TAG }}
file: ${{ env.WORKING_DIRECTORY }}/Dockerfile.icq-demo
Expand All @@ -96,16 +96,17 @@ jobs:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
strategy:
matrix:
matrix:
test:
- "ictest-icq"
- "ictest-icq"
- "ictest-upgrade"
fail-fast: false

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ env.GO_VERSION }}

- name: checkout chain
uses: actions/checkout@v4
Expand All @@ -126,6 +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_7_0_0.tar
docker image ls -a
- name: Run Test
Expand Down
1 change: 1 addition & 0 deletions modules/async-icq/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
25 changes: 8 additions & 17 deletions modules/async-icq/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sim \
-X github.com/cosmos/cosmos-sdk/version.AppName=simd \
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=icq \
-X github.com/cosmos/cosmos-sdk/version.AppName=icqd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
Expand Down Expand Up @@ -104,7 +104,7 @@ BUILD_TARGETS := build install

build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build -o bin/simd ./cmd/simd
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build -o bin/icqd ./testing/simapp/*

$(BUILD_TARGETS): go.sum $(BUILDDIR)/
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
Expand All @@ -116,24 +116,12 @@ build-simd-all: go.sum
$(DOCKER) rm latest-build || true
$(DOCKER) run --volume=$(CURDIR):/sources:ro \
--env TARGET_PLATFORMS='linux/amd64 darwin/amd64 linux/arm64 windows/amd64' \
--env APP=simd \
--env APP=icqd \
--env VERSION=$(VERSION) \
--env COMMIT=$(COMMIT) \
--env LEDGER_ENABLED=$(LEDGER_ENABLED) \
--name latest-build cosmossdk/rbuilder:latest
$(DOCKER) cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/

build-simd-linux: go.sum $(BUILDDIR)/
$(DOCKER) rm latest-build || true
$(DOCKER) run --volume=$(CURDIR):/sources:ro \
--env TARGET_PLATFORMS='linux/amd64' \
--env APP=simd \
--env VERSION=$(VERSION) \
--env COMMIT=$(COMMIT) \
--env LEDGER_ENABLED=false \
--name latest-build cosmossdk/rbuilder:latest
$(DOCKER) cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
cp artifacts/simd-*-linux-amd64 $(BUILDDIR)/simd
$(DOCKER) cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/testing/simapp/

cosmovisor:
$(MAKE) -C cosmovisor cosmovisor
Expand Down Expand Up @@ -212,6 +200,9 @@ local-image-icq-demo:
ictest-icq:
cd e2e && go test -race -v -timeout 15m -run TestInterchainQueries .

ictest-upgrade:
cd e2e && go test -race -v -timeout 15m -run TestICQUpgrade .

###############################################################################
### Linting ###
###############################################################################
Expand Down
60 changes: 60 additions & 0 deletions modules/async-icq/client/cli/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package cli

import (
"fmt"

"github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
"github.com/spf13/cobra"

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

// GetQueryCmd returns the query commands for async-icq
func GetQueryCmd() *cobra.Command {
queryCmd := &cobra.Command{
Use: types.ModuleName,
Short: "Querying commands for the " + types.ModuleName + " module",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
}

queryCmd.AddCommand(
GetCmdParams(),
)

return queryCmd
}

// GetCmdParams returns the command handler for parameter querying.
func GetCmdParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "Query the current parameters",
Args: cobra.NoArgs,
Example: fmt.Sprintf("%s query %s params", version.AppName, types.ModuleName),
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res.Params)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

// NewTxCmd returns the transaction commands
func NewTxCmd() *cobra.Command {
return nil
}
59 changes: 30 additions & 29 deletions modules/async-icq/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ go 1.20

require (
github.com/cosmos/cosmos-sdk v0.47.5
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20231011223558-1e83cdf5cd71
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0-00010101000000-000000000000
github.com/cosmos/ibc-go/v7 v7.3.0
github.com/docker/docker v24.0.7+incompatible
github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20231030192016-f05c98869a6f
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.25.0
go.uber.org/zap v1.26.0
)

require (
cloud.google.com/go v0.110.4 // indirect
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.0 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
cosmossdk.io/api v0.3.1 // indirect
cosmossdk.io/core v0.6.1 // indirect
Expand All @@ -37,7 +40,6 @@ require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/avast/retry-go/v4 v4.5.0 // indirect
github.com/aws/aws-sdk-go v1.44.203 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
Expand All @@ -46,7 +48,7 @@ require (
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/errors v1.10.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect
Expand All @@ -57,10 +59,8 @@ require (
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.4.10 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 // indirect
github.com/cosmos/ibc-go/v7 v7.3.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.0 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
Expand All @@ -77,7 +77,6 @@ require (
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.2+incompatible // indirect
github.com/docker/docker v24.0.5+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -93,7 +92,7 @@ require (
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand All @@ -102,7 +101,7 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
Expand All @@ -122,6 +121,7 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
Expand Down Expand Up @@ -165,16 +165,16 @@ require (
github.com/pierrec/xxHash v0.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.30.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
Expand All @@ -195,23 +195,23 @@ require (
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand All @@ -237,6 +237,7 @@ replace (
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 //indirect
github.com/cosmos/ibc-apps/modules/async-icq/v7 => ../
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
)
Loading

0 comments on commit 4e6ed0e

Please sign in to comment.