diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 143c0767b1..1f18eb1eb7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -58,13 +58,6 @@ updates: labels: - "A:automerge" - dependencies - - package-ecosystem: gomod - directory: "/tools/cosmovisor" - schedule: - interval: weekly - labels: - - "A:automerge" - - dependencies - package-ecosystem: gomod directory: "/depinject" schedule: @@ -100,6 +93,13 @@ updates: labels: - "A:automerge" - dependencies + - package-ecosystem: gomod + directory: "/tools/cosmovisor" + schedule: + interval: weekly + labels: + - "A:automerge" + - dependencies - package-ecosystem: gomod directory: "/tools/rosetta" schedule: @@ -107,6 +107,20 @@ updates: labels: - "A:automerge" - dependencies + - package-ecosystem: gomod + directory: "/tools/confix" + schedule: + interval: weekly + labels: + - "A:automerge" + - dependencies + - package-ecosystem: gomod + directory: "/tools/hubl" + schedule: + interval: weekly + labels: + - "A:automerge" + - dependencies - package-ecosystem: gomod directory: "/collections" schedule: diff --git a/.github/labeler.yml b/.github/labeler.yml index f204e8d399..c6ea1a1f36 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -50,6 +50,8 @@ - tools/rosetta/**/* "C:Confix": - tools/confix/**/* +"C:Hubl": + - tools/hubl/**/* "C:Keys": - client/keys/**/* "Type: Build": diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e4f1b5054..59818ad179 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,3 +56,6 @@ jobs: - name: Build Confix if: env.GIT_DIFF run: GOARCH=${{ matrix.go-arch }} make confix + - name: Build Hubl + if: env.GIT_DIFF + run: GOARCH=${{ matrix.go-arch }} make hubl diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eff5ca80a1..0d47004f18 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -552,6 +552,36 @@ jobs: with: projectBaseDir: tools/confix/ + test-hubl: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19.4 + cache: true + cache-dependency-path: tools/hubl/go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + tools/hubl/**/*.go + tools/hubl/go.mod + tools/hubl/go.sum + - name: tests + if: env.GIT_DIFF + run: | + cd tools/hubl + go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... + - name: sonarcloud + if: env.GIT_DIFF + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: tools/hubl/ + ############################# ### Cosmos SDK x/{module} ### ############################# diff --git a/Makefile b/Makefile index a6782ebddb..4303d7db10 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,9 @@ rosetta: confix: $(MAKE) -C tools/confix confix +hubl: + $(MAKE) -C tools/hubl hubl + .PHONY: build build-linux-amd64 build-linux-arm64 cosmovisor rosetta confix diff --git a/docs/.gitignore b/docs/.gitignore index f8fcaac87f..bdd277ecca 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -16,6 +16,7 @@ docs/docs/architecture docs/docs/tooling/01-cosmovisor.md docs/docs/tooling/02-depinject.md docs/docs/tooling/03-confix.md +docs/docs/tooling/04-hubl.md docs/run-node/04-rosetta.md # Misc diff --git a/docs/docs/tooling/README.md b/docs/docs/tooling/README.md index c7de5af4e6..e4f0c3f8ff 100644 --- a/docs/docs/tooling/README.md +++ b/docs/docs/tooling/README.md @@ -10,3 +10,4 @@ This section provides documentation on various tooling used in development of a * [Cosmovisor](./01-cosmovisor.md) * [Depinject](./02-depinject.md) * [Confix](./03-confix.md) +* [Hubl](./04-hubl.md) diff --git a/docs/post.sh b/docs/post.sh index eced8b648e..7efeb8f62a 100755 --- a/docs/post.sh +++ b/docs/post.sh @@ -4,6 +4,7 @@ find docs/modules ! -name '_category_.json' -type f -exec rm -rf {} + rm -rf docs/tooling/01-cosmovisor.md rm -rf docs/tooling/02-depinject.md rm -rf docs/tooling/03-confix.md +rm -rf docs/tooling/04-hubl.md rm -rf docs/run-node/04-rosetta.md rm -rf docs/architecture rm -rf docs/spec diff --git a/docs/pre.sh b/docs/pre.sh index 10c77c597d..a5cd449e7c 100755 --- a/docs/pre.sh +++ b/docs/pre.sh @@ -19,8 +19,9 @@ cat ../x/README.md | sed 's/\.\.\/docs\/building-modules\/README\.md/\/building- ## Add tooling documentation cp ../tools/cosmovisor/README.md ./docs/tooling/01-cosmovisor.md -cp ../tools/confix/README.md ./docs/tooling/03-confix.md cp ../depinject/README.md ./docs/tooling/02-depinject.md +cp ../tools/confix/README.md ./docs/tooling/03-confix.md +cp ../tools/hubl/README.md ./docs/tooling/04-hubl.md ## Add rosetta documentation cp ../tools/rosetta/README.md ./docs/run-node/04-rosetta.md diff --git a/go.work.example b/go.work.example index d63f0aa273..3eb9290155 100644 --- a/go.work.example +++ b/go.work.example @@ -15,6 +15,7 @@ use ( ./tools/rosetta ./tools/cosmovisor ./tools/confix + ./tools/hubl ./x/tx ./x/nft ./x/circuit diff --git a/tools/hubl/.gitignore b/tools/hubl/.gitignore new file mode 100644 index 0000000000..5ee24332af --- /dev/null +++ b/tools/hubl/.gitignore @@ -0,0 +1 @@ +/hubl \ No newline at end of file diff --git a/tools/hubl/CHANGELOG.md b/tools/hubl/CHANGELOG.md new file mode 100644 index 0000000000..16de809f27 --- /dev/null +++ b/tools/hubl/CHANGELOG.md @@ -0,0 +1,32 @@ + + +# Changelog + +## [Unreleased] diff --git a/tools/hubl/Makefile b/tools/hubl/Makefile new file mode 100644 index 0000000000..a329b93e38 --- /dev/null +++ b/tools/hubl/Makefile @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +all: hubl test + +hubl: + go build -mod=readonly ./cmd/hubl + +test: + go test -mod=readonly -race ./... + +.PHONY: all hubl test diff --git a/tools/hubl/README.md b/tools/hubl/README.md new file mode 100644 index 0000000000..2905ea7223 --- /dev/null +++ b/tools/hubl/README.md @@ -0,0 +1,68 @@ +--- +sidebar_position: 1 +--- + +# Hubl + +`Hubl` is a tool that allows you to query any Cosmos SDK based blockchain. +It takes advantage of the new [AutoCLI](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/client/v2@v2.0.0-20220916140313-c5245716b516/cli) feature of the Cosmos SDK. + +## Installation + +Hubl can be installed using `go install`: + +```shell +go install cosmossdk.io/tools/hubl/cmd/hubl@latest +``` + +Or build from source: + +```shell +git clone --depth=1 https://github.com/cosmos/cosmos-sdk +make hubl +``` + +The binary will be located in `tools/hubl`. + +## Usage + +```shell +hubl --help +``` + +### Add chain + +To configure a new chain just run this command using the --init flag and the name of the chain as it's listed in the chain registry (https://github.com/cosmos/chain-registry). + +If the chain is not listed in the chain registry, you can use any unique name. + + +```shell +hubl --init [chain-name] +hubl --init regen +``` + +The chain configuration is stored in `~/.hubl/config.toml`. + +:::tip + +When using an unsecure gRPC endpoint, change the `insecure` field to `true` in the config file. + +```toml +[chains] +[chains.regen] +[[chains.regen.trusted-grpc-endpoints]] +endpoint = 'localhost:9090' +insecure = true +``` + +::: + +### Query + +To query a chain, you can use the `query` command. +Then specify which module you want to query and the query itself. + +```shell +hubl regen query auth module-accounts +``` diff --git a/tools/hubl/go.mod b/tools/hubl/go.mod index 498df01790..3d2f161923 100644 --- a/tools/hubl/go.mod +++ b/tools/hubl/go.mod @@ -4,10 +4,11 @@ go 1.19 require ( cosmossdk.io/api v0.2.6 - cosmossdk.io/client/v2 v2.0.0-20230120150717-4f6f6c00021f + cosmossdk.io/client/v2 v2.0.0-20230123200432-0d72b9039a54 github.com/cockroachdb/errors v1.9.0 github.com/hashicorp/go-multierror v1.1.1 github.com/manifoldco/promptui v0.9.0 + github.com/pelletier/go-toml/v2 v2.0.6 github.com/pkg/errors v0.9.1 github.com/spf13/cobra v1.6.1 google.golang.org/grpc v1.52.0 @@ -82,7 +83,6 @@ require ( github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect @@ -122,5 +122,3 @@ require ( pgregory.net/rapid v0.5.5 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) - -replace cosmossdk.io/client/v2 => ../../client/v2 diff --git a/tools/hubl/go.sum b/tools/hubl/go.sum index b0a5c65dc2..f9807a2e13 100644 --- a/tools/hubl/go.sum +++ b/tools/hubl/go.sum @@ -37,6 +37,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cosmossdk.io/api v0.2.6 h1:AoNwaLLapcLsphhMK6+o0kZl+D6MMUaHVqSdwinASGU= cosmossdk.io/api v0.2.6/go.mod h1:u/d+GAxil0nWpl1XnQL8nkziQDIWuBDhv8VnDm/s6dI= +cosmossdk.io/client/v2 v2.0.0-20230123200432-0d72b9039a54 h1:KvSz9SAdkMIW/xJyjfgGf3hFhL5hbYRwDduuouNvoco= +cosmossdk.io/client/v2 v2.0.0-20230123200432-0d72b9039a54/go.mod h1:ECtzZYhZ2rREL6AkuNMCyR6Ir+djK4xCAPbmtEYbBtg= cosmossdk.io/core v0.4.1 h1:5icpjPmw8J4uFp6w8OoLJPxsw6X3kRi9nAtTr3qp2Ok= cosmossdk.io/core v0.4.1/go.mod h1:Zqd1GB+krTF3bzhTnPNwzy3NTtXu+MKLX/9sPQXTIDE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= diff --git a/tools/hubl/sonar-project.properties b/tools/hubl/sonar-project.properties new file mode 100644 index 0000000000..87b389a541 --- /dev/null +++ b/tools/hubl/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=cosmos-sdk-tools-hubl +sonar.organization=cosmos + +sonar.projectName=Cosmos SDK - Hubl +sonar.project.monorepo.enabled=true + +sonar.sources=. +sonar.exclusions=**/*_test.go +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.go.coverage.reportPaths=coverage.out + +sonar.sourceEncoding=UTF-8 +sonar.scm.provider=git \ No newline at end of file diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 82e66fb32d..16de809f27 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -1,7 +1,32 @@ -# CHANGELOG + + +# Changelog + +## [Unreleased]