diff --git a/.github/workflows/cl-enforcer.yml b/.github/workflows/cl-enforcer.yml index 850a632159..c284dc588f 100644 --- a/.github/workflows/cl-enforcer.yml +++ b/.github/workflows/cl-enforcer.yml @@ -14,5 +14,6 @@ jobs: - uses: dangoslen/changelog-enforcer@v3 with: changeLogPath: 'changelog.md' - missingUpdateErrorMessage: 'Please fill the changelog.md file or add the "Skip-Changelog" label' + missingUpdateErrorMessage: 'Please add an entry to the changelog.md file or add the "skip-changelog" label' + skipLabels: 'skip-changelog' versionPattern: '' diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 6faf9661e2..6aecf4d484 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -9,7 +9,7 @@ jobs: consecutiveness: runs-on: ubuntu-latest steps: - - uses: mktcode/consecutive-workflow-action@v1 + - uses: ignite/consecutive-workflow-action@main with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/md-link-checker-config.json b/.github/workflows/md-link-checker-config.json index fa7f2bde39..e70d47c119 100644 --- a/.github/workflows/md-link-checker-config.json +++ b/.github/workflows/md-link-checker-config.json @@ -17,6 +17,9 @@ }, { "pattern": "^index.md" + }, + { + "pattern": "^https://docs.starport.network" } ], "replacementPatterns": [ diff --git a/.github/workflows/md-link-checker.yml b/.github/workflows/md-link-checker.yml index 1d2afd6a1a..cbe6df9577 100644 --- a/.github/workflows/md-link-checker.yml +++ b/.github/workflows/md-link-checker.yml @@ -8,6 +8,7 @@ on: - "**.*.md" branches: - main + - release/* concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/.github/workflows/proto-checker.yml b/.github/workflows/proto-checker.yml new file mode 100644 index 0000000000..1abdd37c38 --- /dev/null +++ b/.github/workflows/proto-checker.yml @@ -0,0 +1,31 @@ +name: Protobuf Files + +on: + pull_request: + paths: + - "proto/**" + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: bufbuild/buf-setup-action@v1.22.0 + - uses: bufbuild/buf-lint-action@v1 + with: + input: "proto" + + # TODO: Uncomment after PR#3529 is merged + # break-check: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: bufbuild/buf-setup-action@v1.22.0 + # - uses: bufbuild/buf-breaking-action@v1 + # with: + # input: "proto" + # against: "https://github.com/${{ github.repository }}.git#branch=${{ github.event.pull_request.base.ref }},ref=HEAD~1,subdir=proto" diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 286974bde1..efc9215d3d 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -15,7 +15,7 @@ jobs: consecutiveness: runs-on: ubuntu-latest steps: - - uses: mktcode/consecutive-workflow-action@v1 + - uses: ignite/consecutive-workflow-action@main with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index ef1469fc18..3d7f1c4bd2 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -16,7 +16,7 @@ jobs: consecutiveness: runs-on: ubuntu-latest steps: - - uses: mktcode/consecutive-workflow-action@v1 + - uses: ignite/consecutive-workflow-action@main with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index e470d81d86..4cd99a42a3 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -6,6 +6,7 @@ on: - '**.md' branches: - main + - release/* concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 723d669178..d912f43d67 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: - '**.md' branches: - main + - release/* concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/.gitignore b/.gitignore index b87687085d..671a36b808 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ scripts/**/nodetime-* +**/testdata/**/go.sum dist/ node_modules .DS_Store -apps/ .idea .vscode docs/.vuepress/dist diff --git a/Makefile b/Makefile index 7347759283..97c20de6d9 100644 --- a/Makefile +++ b/Makefile @@ -54,11 +54,35 @@ format: ## lint: Run Golang CI Lint. lint: - @echo Running gocilint... + @echo Running golangci-lint... @go run github.com/golangci/golangci-lint/cmd/golangci-lint run --out-format=tab --issues-exit-code=0 +lint-fix: + @echo Running golangci-lint... + @go run github.com/golangci/golangci-lint/cmd/golangci-lint run --fix --out-format=tab --issues-exit-code=0 + .PHONY: govet format lint +## proto-all: Format, lint and generate code from proto files using buf. +proto-all: proto-format proto-lint proto-gen + +## proto-gen: Run buf generate. +proto-gen: + @echo Generating code from proto... + @buf generate --template ./proto/buf.gen.yaml --output ./ + +## proto-format: Run buf format and update files with invalid proto format> +proto-format: + @echo Formatting proto files... + @buf format --write + +## proto-lint: Run buf lint. +proto-lint: + @echo Linting proto files... + @buf lint + +.PHONY: proto-all proto-gen proto-format proto-lint + ## test-unit: Run the unit tests. test-unit: @echo Running unit tests... diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 0000000000..1878b341be --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - proto diff --git a/changelog.md b/changelog.md index c8c2957409..6211360d24 100644 --- a/changelog.md +++ b/changelog.md @@ -4,15 +4,26 @@ ### Features +- [#3694](https://github.com/ignite/cli/pull/3694) Query and Tx AutoCLI support +- [#3544](https://github.com/ignite/cli/pull/3544) Add bidirectional communication to plugin system +- [#3561](https://github.com/ignite/cli/pull/3561) Add GetChainInfo method to plugin system API +- [#3626](https://github.com/ignite/cli/pull/3626) Add logging levels to relayer - [#3476](https://github.com/ignite/cli/pull/3476) Use `buf.build` binary to code generate from proto files - [#3614](https://github.com/ignite/cli/pull/3614) feat: use DefaultBaseappOptions for app.New method - [#3536](https://github.com/ignite/cli/pull/3536) Change app.go to v2 and add AppWiring feature +- [#3659](https://github.com/ignite/cli/pull/3659) cosmos-sdk `v0.50.x` - [#3670](https://github.com/ignite/cli/pull/3670) Remove nodetime binaries +- [#3724](https://github.com/ignite/cli/pull/3724) Add or vendor proto packages from Go dependencies - [#3715](https://github.com/ignite/cli/pull/3715) Add test suite for the cli tests +- [#3756](https://github.com/ignite/cli/pull/3756) Add faucet compatibility for latest sdk chains ### Changes -- [#3701](https://github.com/ignite/cli/pull/3701) Bump `go` version to 1.21 +- [#3529](https://github.com/ignite/cli/pull/3529) Refactor plugin system to use gRPC +- [#3750](https://github.com/ignite/cli/pull/3750) Update default Ignite network app to `v0.2.0` +- [#3751](https://github.com/ignite/cli/pull/3751) Rename label to skip changelog check +- [#3745](https://github.com/ignite/cli/pull/3745) Set tx fee amount as option +- [#3748](https://github.com/ignite/cli/pull/3748) Change default rpc endpoint to a working one - [#3621](https://github.com/ignite/cli/pull/3621) Change `pkg/availableport` to allow custom parameters in `Find` function and handle duplicated ports - [#3559](https://github.com/ignite/cli/pull/3559) Bump network plugin version to `v0.1.1` - [#3581](https://github.com/ignite/cli/pull/3581) Bump cometbft and cometbft-db in the template @@ -41,12 +52,18 @@ - [#3726](https://github.com/ignite/cli/pull/3726) Update TS client dependencies. Bump vue/react template versions - [#3728](https://github.com/ignite/cli/pull/3728) Fix wrong parser for proto package names - [#3729](https://github.com/ignite/cli/pull/3729) Fix broken generator due to caching /tmp include folders +- [#3767](https://github.com/ignite/cli/pull/3767) Fix `v0.50` ibc genesis issue + +## [`v0.27.2`](https://github.com/ignite/cli/releases/tag/v0.27.2) + +### Changes + +- [#3701](https://github.com/ignite/cli/pull/3701) Bump `go` version to 1.21 -## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0) +## [`v0.27.1`](https://github.com/ignite/cli/releases/tag/v0.27.1) ### Features -- - [#3505](https://github.com/ignite/cli/pull/3505) Auto migrate dependency tools - [#3538](https://github.com/ignite/cli/pull/3538) bump sdk to `v0.47.3` and ibc to `v7.1.0` - [#2736](https://github.com/ignite/cli/issues/2736) Add `--skip-git` flag to skip git repository initialization. @@ -54,7 +71,6 @@ - [#3446](https://github.com/ignite/cli/pull/3446) Add `gas-adjustment` flag to the cosmos client. - [#3439](https://github.com/ignite/cli/pull/3439) Add `--build.tags` flag for `chain serve` and `chain build` commands. - [#3524](https://github.com/ignite/cli/pull/3524) Apply auto tools migration to other commands -- [#3636](https://github.com/ignite/cli/pull/3626) Add logging levels to relayer - Added compatibility check and auto migration features and interactive guidelines for the latest versions of the SDK ### Changes @@ -772,4 +788,4 @@ Our new name is **Ignite CLI**! ## `v0.0.9` -Initial release. +Initial release. \ No newline at end of file diff --git a/docs/docs/01-welcome/01-index.md b/docs/docs/01-welcome/01-index.md index e57ec79726..5ec736cfd2 100644 --- a/docs/docs/01-welcome/01-index.md +++ b/docs/docs/01-welcome/01-index.md @@ -4,37 +4,34 @@ slug: / import ProjectsTable from '@site/src/components/ProjectsTable'; -# Introduction to Ignite +# Introduction to Ignite CLI: Your Gateway to Blockchain Innovation -[Ignite CLI](https://github.com/ignite/cli) offers everything you need to build, test, and launch your blockchain with a -decentralized worldwide community. Ignite CLI is built on top of [Cosmos SDK](https://docs.cosmos.network), the worldโ€™s -most popular blockchain framework. Ignite CLI accelerates chain development by scaffolding everything you need so you -can focus on business logic. +[Ignite CLI](https://github.com/ignite/cli) is a powerful tool that simplifies the journey of building, testing, and launching diverse blockchain applications. Developed on top of the [Cosmos SDK](https://docs.cosmos.network), the leading framework for blockchain technology, Ignite CLI is pivotal in streamlining the development process. It enables developers to focus on the unique aspects of their projects, from DeFi and NFTs to supply chain solutions and smart contracts. +Beyond these, Ignite has been instrumental in a wide array of blockchain applications, ranging from VPNs and gaming platforms to blogs, oracle systems, and innovative consensus mechanisms. This demonstrates its versatility in supporting a broad spectrum of blockchain-based solutions. -## What is Ignite CLI? +## Key Features of Ignite CLI -Ignite CLI is an easy-to-use CLI tool for creating and maintaining sovereign application-specific blockchains. -Blockchains created with Ignite CLI use Cosmos SDK and Tendermint. Ignite CLI and the Cosmos SDK modules are written in -the Go programming language. The scaffolded blockchain that is created with Ignite CLI includes a command line interface -that lets you manage keys, create validators, and send tokens. - -With just a few commands, you can use Ignite CLI to: - -- Create a modular blockchain written in Go -- Scaffold modules, messages, types with CRUD operations, IBC packets, and more -- Start a blockchain node in development with live reloading -- Connect to other blockchains with a built-in IBC relayer -- Use generated TypeScript/Vuex clients to interact with your blockchain -- Use the Vue.js web app template with a set of components and Vuex modules +- **Simplified Blockchain Development:** Ignite CLI, leveraging Cosmos SDK, makes building sovereign application-specific blockchains intuitive and efficient. +- **Comprehensive Scaffolding:** Easily scaffold modules, messages, CRUD operations, IBC packets, and more, expediting the development of complex functionalities. +- **Development with Live Reloading:** Start and test your blockchain node with real-time updates, enhancing your development workflow. +- **Frontend Flexibility:** Utilize pre-built templates for Vue.js, React, Typescript or Go, catering to diverse frontend development needs. +- **Inter-Blockchain Communication (IBC):** Seamlessly connect and interact with other blockchains using an integrated IBC relayer, a key feature of the Cosmos SDK. +- **CometBFT Integration:** Built with the CometBFT consensus engine (formerly Tendermint), ensuring robust consensus mechanisms in your blockchain solutions. +- **Cross-Domain Applications:** Ignite is perfectly suited for developing a diverse array of use cases across various sectors. These include DeFi, NFTs, supply chain management, smart contracts (both EVM and WASM), and decentralized exchanges (DEXes). ## Install Ignite CLI -To install the `ignite` binary in `/usr/local/bin` run the following command: +Get started with Ignite CLI by running this simple installation command: ``` curl https://get.ignite.com/cli! | bash ``` +## Embracing the Cosmos Ecosystem + +Ignite CLI is your entry point into the vibrant Cosmos ecosystem, a hub of innovation where you can explore a range of applications, from wallets and explorers to smart contracts and DEXes, all powered by CometBFT and the Cosmos SDK. +This ecosystem is home to over [$50 billion worth of blockchain projects](https://cosmos.network/ecosystem/tokens/), showcasing the scalability and versatility of the technologies at play. + ## Projects using Tendermint and Cosmos SDK Many projects already showcase the Tendermint BFT consensus engine and the Cosmos SDK. Explore diff --git a/docs/docs/01-welcome/02-install.md b/docs/docs/01-welcome/02-install.md index 9fa22fbb07..acd6d66eec 100644 --- a/docs/docs/01-welcome/02-install.md +++ b/docs/docs/01-welcome/02-install.md @@ -24,7 +24,7 @@ Ignite CLI is supported for the following operating systems: Ignite CLI is written in the Go programming language. To use Ignite CLI on a local system: -- Install [Go](https://golang.org/doc/install) (**version 1.19** or higher) +- Install [Go](https://golang.org/doc/install) (**version 1.21.1** or higher) - Ensure the Go environment variables are [set properly](https://golang.org/doc/gopath_code#GOPATH) on your system ## Verify your Ignite CLI version diff --git a/docs/docs/02-guide/00-introduction.md b/docs/docs/02-guide/00-introduction.md index 1af3f532f5..05d104a31e 100644 --- a/docs/docs/02-guide/00-introduction.md +++ b/docs/docs/02-guide/00-introduction.md @@ -4,33 +4,34 @@ title: Introduction slug: /guide --- -# Introduction - -Developer tutorials provide step-by-step instructions to help you build blockchain developer skills. - -By following these developer tutorials you will learn how to: - -* Install Ignite CLI on your local machine -* Create a new blockchain and start a node locally for development -* Make your blockchain say "Hello, World!" - * Scaffold a Cosmos SDK query - * Modify a keeper method to return a static string - * Use the blockchain CLI to make a query -* Write and read blog posts to your chain in the Blog tutorial - * Scaffold a Cosmos SDK message - * Define new types in protocol buffer files - * Write keeper methods to write data to the store - * Read data from the store and return it as a result a query - * Use the blockchain CLI to broadcast transactions -* Build a blockchain for buying and selling names in the Nameservice tutorial - * Scaffold CRUD logic with `map` - * Use other module methods in your custom module - * Send tokens between addresses -* Build a guessing game with rewards - * Use an escrow account to store tokens -* Use the Inter-Blockchain Communication (IBC) protocol - * Scaffold an IBC-enabled module - * Send and receive IBC packets - * Configure and run a built-in IBC relayer -* Build a decentralized order-book token exchange - * Build an advanced IBC-enabled module +# Introduction to Ignite's Developer Tutorials + +Welcome to the Ignite Developer Tutorials, your gateway to mastering blockchain development. These comprehensive tutorials are designed for learners at all levels, from beginners to seasoned developers, offering both foundational knowledge and hands-on experience. + +## What You Will Learn + +- **Getting Started with Ignite CLI**: Install the Ignite CLI and set up your development environment. This foundational step is necessary for all the tutorials that follow. + +- **Create and Run Your First Blockchain**: Learn to create and run your own blockchain, understanding how to start and manage a node locally for development purposes. + +- **Hello World Tutorial**: Engage in the excitement of blockchain development by making your blockchain respond with "Hello, World!" This includes learning to scaffold a Cosmos SDK query and modify keeper methods. + +- **Blog Tutorial**: Step into decentralized applications (dApps) with the ability to write and read blog posts on your blockchain. This tutorial covers everything from defining new types in protocol buffer files to writing and reading data from the store. + +- **DeFi Loan Tutorial**: Dive into Decentralized Finance (DeFi) by building a blockchain for managing loans. Gain insights into CRUD logic, module method integration, and token transaction management. + +- **Token Factory Tutorial**: Master the creation and management of digital assets on your blockchain by building a token factory module, learning module development, CRUD operations without delete functionality, and native denomination integration. + +- **Inter-blockchain Communication (IBC) Basics**: Explore the interconnected world of blockchains with the IBC protocol. Learn how to scaffold an IBC-enabled module, manage IBC packets, and configure a built-in IBC relayer. + +- **Interchange Module**: Advance your IBC knowledge by building a module for decentralized token exchanges and order books. + +- **Debugging a Blockchain**: Develop essential skills in debugging to maintain efficient and effective blockchain development. + +- **Running in a Docker Container**: Learn how to use Docker to containerize your blockchain environment, ensuring consistency and portability across development stages. + +- **Chain Simulation**: Understand the importance and method of simulating blockchain environments for testing and validating functionality under various scenarios. + +Each tutorial builds upon the previous, enhancing your understanding and skills progressively. By completing these tutorials, you will gain a robust understanding of blockchain principles, the Cosmos SDK, and practical experience in developing and managing blockchain projects. + +Embark on your journey to become a proficient blockchain developer with Ignite's Developer Tutorials! diff --git a/docs/docs/02-guide/03-hello-world.md b/docs/docs/02-guide/03-hello-world.md new file mode 100644 index 0000000000..5f5c317a82 --- /dev/null +++ b/docs/docs/02-guide/03-hello-world.md @@ -0,0 +1,101 @@ +--- +description: Build your first blockchain and your first Cosmos SDK query. +title: Hello World +--- + +# "Hello world!" Blockchain Tutorial with Ignite CLI + +**Introduction** + +In this tutorial, you'll build a simple blockchain using Ignite CLI that responds to a custom query with "Hello %s!", where "%s" is a name passed in the query. +This will enhance your understanding of creating custom queries in a Cosmos SDK blockchain. + +## Setup and Scaffold + +1. **Create a New Blockchain:** + +```bash +ignite scaffold chain hello +``` + +2. **Navigate to the Blockchain Directory:** + +```bash +cd hello +``` + +## Adding a Custom Query + +- **Scaffold the Query:** + +```bash +ignite scaffold query say-hello name --response name +``` + +This command generates code for a new query, `say-hello`, which accepts a name, an input, and returns it in the response. + +- **Understanding the Scaffolded Code:** + + - `proto/hello/hello/query.proto`: Defines the request and response structure. + - `x/hello/client/cli/query_say_hello.go`: Contains the CLI commands for the query. + - `x/hello/keeper/query_say_hello.go`: Houses the logic for the query response. + + +## Customizing the Query Response + +In the Cosmos SDK, queries are requests for information from the blockchain, used to access data like the ledger's current state or transaction details. While the SDK offers several built-in query methods, developers can also craft custom queries for specific data retrieval or complex operations. + +- **Modify `query_say_hello.go`:** + +Update the `SayHello` function in `x/hello/keeper/query_say_hello.go` to return a personalized greeting query. + +```go title="x/hello/keeper/query_say_hello.go" +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "hello/x/hello/types" +) + +func (k Keeper) SayHello(goCtx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + // Validation and Context unwrapping + ctx := sdk.UnwrapSDKContext(goCtx) + + _ = ctx + // Custom Response + // highlight-next-line + return &types.QuerySayHelloResponse{Name: fmt.Sprintf("Hello %s!", req.Name)}, nil +} +``` + +## Running the Blockchain + +1. **Start the Blockchain:** + +```bash +ignite chain serve +``` + +2. **Test the Query:** + +Use the command-line interface to submit a query. + +``` +hellod q hello say-hello world +``` + +Expect a response: `Hello world!` + +## Conclusion + +Congratulations! ๐ŸŽ‰ You've successfully created a blockchain module with a custom query using Ignite CLI. Through this tutorial, you've learned how to scaffold a chain, add a custom query, and modify the logic for personalized responses. This experience illustrates the power of Ignite CLI in streamlining blockchain development and the importance of understanding the underlying code for customization. \ No newline at end of file diff --git a/docs/docs/02-guide/03-hello/00-express.md b/docs/docs/02-guide/03-hello/00-express.md deleted file mode 100644 index 89e76bcfb4..0000000000 --- a/docs/docs/02-guide/03-hello/00-express.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -description: Step-by-step guidance to build your first blockchain and your first Cosmos SDK module. -title: Express tutorial ---- - -# "Hello, World!" in 5 minutes - -In this tutorial, you will create a simple blockchain with a custom query that -responds with `"Hello, %s!"`, where `%s` is a name provided in the query. To do -this, you will use the Ignite CLI to generate most of the code, and then modify -the query to return the desired response. After completing the tutorial, you -will have a better understanding of how to create custom queries in a -blockchain. - -First, create a new `hello` blockchain with Ignite CLI: - -``` -ignite scaffold chain hello -``` - -Let's add a query to the blockchain we just created. - -In the Cosmos SDK, a query is a request for information from the blockchain. -Queries are used to retrieve data from the blockchain, such as the current state -of the ledger or the details of a specific transaction. The Cosmos SDK provides -a number of built-in query methods that can be used to retrieve data from the -blockchain, and developers can also create custom queries to access specific -data or perform complex operations. Queries are processed by the blockchain's -nodes and the results are returned to the querying client. - -## Create a query with Ignite - -To add a query, run the following command inside the `hello` directory: - -``` -ignite scaffold query say-hello name --response name -``` - -The `ignite scaffold query` command is a tool used to quickly create new -queries. When you run this command, it makes changes to your source code to add -the new query and make it available in your API. This command accepts a query -name (`"say-hello"`) and a list of request fields (in our case only `name`). The -optional `--response` flag specifies the return values of the query. - -This command made the following changes to the source code. - -The `proto/hello/hello/query.proto` file was modified to define the request and -response for a query, as well as to add the `SayHello` query in the `Query` -service. - -The `x/hello/client/cli/query_say_hello.go` file was created and added to the -project. This file contains a CLI command `CmdSayHello` that allows users to -submit a "say hello" query to the blockchain. This command allows users to -interact with the blockchain in a more user-friendly way, allowing them to -easily submit queries and receive responses from the blockchain. - -The `x/hello/client/cli/query.go` was modified to add the `CmdSayHello` command -to the CLI of the blockchain. - -The `x/hello/keeper/query_say_hello.go` file was created with a keeper method -called `SayHello`. This method is responsible for handling the "say hello" -query, which can be called by a client using the command-line interface (CLI) or -an API. When the "say hello" query is executed, the `SayHello` method is called -to perform the necessary actions and return a response to the client. The -`SayHello` method may retrieve data from the application's database, process the -data, and return a result to the client in a specific format, such as a string -of text or a data structure. - -To change the source code so that the query returns the `"Hello, %s!"` string, -modify the return statement in `query_say_hello.go` to return -`fmt.Sprintf("hello %s", req.Name)`. - -```go title="x/hello/keeper/query_say_hello.go" -func (k Keeper) SayHello(goCtx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - // TODO: Process the query - _ = ctx - // highlight-next-line - return &types.QuerySayHelloResponse{Name: fmt.Sprintf("Hello, %s!", req.Name)}, nil -} -``` - -The function now returns a `QuerySayHelloResponse` struct with the `Name` field -set to the string `"Hello, %s!"` with `req.Name` as the value for the `%s` -placeholder. It also returns a nil error to indicate success. - -Now that you have added a query your blockchain and modified it return the value -you want, you can start your blockchain with Ignite: - -``` -ignite chain serve -``` - -After starting your blockchain, you can use its command-line interface (CLI) to -interact with it and perform various actions such as querying the blockchain's -state, sending transactions, and more. - -You can use the `hellod` binary to run the `say-hello` query: - -``` -hellod q hello say-hello bob -``` - -Once you run this command, the `hellod` binary will send a `say-hello` query to -your blockchain with the argument `bob`. The blockchain will process the query -and return the result, which will be printed by the `hellod` binary. In this -case, the expected result is a string containing the message `Hello, bob!`. - -``` -name: Hello, bob! -``` - -Congratulations! ๐ŸŽ‰ You have successfully created a new Cosmos SDK module called -`hello` with a custom query functionality. This allows users to query the -blockchain and receive a response with a personalized greeting. This tutorial -demonstrated how to use Ignite CLI to create a custom query in a blockchain. - -Ignite is an incredibly convenient tool for developers because it automatically -generates much of the code required for a project. This saves developers time -and effort by reducing the amount of code they need to write manually. With -Ignite, developers can quickly and easily set up the basic structure of their -project, allowing them to focus on the more complex and unique aspects of their -work. - -However, it is also important for developers to understand how the code -generated by Ignite works under the hood. One way to do this is to implement the -same functionality manually, without using Ignite. For example, in this tutorial -Ignite was used to generate query functionality, now could try implementing the -same functionality manually to see how it works and gain a deeper understanding -of the code. - -Implementing the same functionality manually can be time-consuming and -challenging, but it can also be a valuable learning experience. By seeing how -the code works at a low level, developers can gain a better understanding of how -different components of their project fit together and how they can be -customized and optimized. diff --git a/docs/docs/02-guide/03-hello/01-scaffolding.md b/docs/docs/02-guide/03-hello/01-scaffolding.md deleted file mode 100644 index 130552636e..0000000000 --- a/docs/docs/02-guide/03-hello/01-scaffolding.md +++ /dev/null @@ -1,236 +0,0 @@ ---- -title: In-depth tutorial ---- - -# In-depth "Hello, World!" tutorial - -In this tutorial you will implement "Hello, World!" functionality from -scratch. The functionality of the application you will be building will be -identical to what the one you created in the "Express tutorial" section, but -here you will be doing it manually in order to gain a deeper understanding of -the process. - -To begin, let's start with a fresh `hello` blockchain. You can either roll back -the changes you made in the previous section or create a new blockchain using -Ignite. Either way, you will have a blank blockchain that is ready for you to -work with. - -``` -ignite scaffold chain hello -``` - -## `SayHello` RPC - -In Cosmos SDK blockchains, queries are defined as remote procedure calls (RPCs) -in a `Query` service in protocol buffer files. To add a new query, you can add -the following code to the `query.proto` file of your module: - -```protobuf title="proto/hello/hello/query.proto" -service Query { - // highlight-start - rpc SayHello(QuerySayHelloRequest) returns (QuerySayHelloResponse) { - option (google.api.http).get = "/hello/hello/say_hello/{name}"; - } - // highlight-end -} -``` - -The RPC accepts a request argument of type `QuerySayHelloRequest` and returns a -value of type `QuerySayHelloResponse`. To define these types, you can add the -following code to the `query.proto` file: - -```protobuf title="proto/hello/hello/query.proto" -message QuerySayHelloRequest { - string name = 1; -} - -message QuerySayHelloResponse { - string name = 1; -} -``` - -To use the types defined in `query.proto`, you must transpile the protocol -buffer files into Go source code. This can be done by running `ignite chain -serve`, which will build and initialize the blockchain and automatically -generate the Go source code from the protocol buffer files. Alternatively, you -can run `ignite generate proto-go` to only generate the Go source code from the -protocol buffer files, without building and initializing the blockchain. - -## `SayHello` keeper method - -After defining the query, request, and response types in the `query.proto` file, -you will need to implement the logic for the query in your code. This typically -involves writing a function that processes the request and returns the -appropriate response. Create a new file `query_say_hello.go` with the following -contents: - -```go title="x/hello/keeper/query_say_hello.go" -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "hello/x/hello/types" -) - -func (k Keeper) SayHello(goCtx context.Context, req *types.QuerySayHelloRequest) (*types.QuerySayHelloResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Process the query - _ = ctx - return &types.QuerySayHelloResponse{Name: fmt.Sprintf("hello %s", req.Name)}, nil -} -``` - -This code defines a `SayHello` function that accepts a request of type -`QuerySayHelloRequest` and returns a value of type `QuerySayHelloResponse`. The -function first checks if the request is valid, and then processes the query by -returning the response message with the provided name as the value for the `%s` -placeholder. You can add additional logic to the function as needed, such as -retrieving data from the blockchain or performing complex operations, to handle -the query and return the appropriate response. - -## `CmdSayHello` command - -After implementing the query logic, you will need to make the query available to -clients so that they can call it and receive the response. This typically -involves adding the query to the blockchain's application programming interface -(API) and providing a command-line interface (CLI) command that allows users to -easily submit the query and receive the response. - -To provide a CLI command for the query, you can create the `query_say_hello.go` -file and implement a `CmdSayHello` command that calls the `SayHello` function -and prints the response to the console. - -```go title="x/hello/client/cli/query_say_hello.go" -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "hello/x/hello/types" -) - -var _ = strconv.Itoa(0) - -func CmdSayHello() *cobra.Command { - cmd := &cobra.Command{ - Use: "say-hello [name]", - Short: "Query say-hello", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) (err error) { - reqName := args[0] - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - params := &types.QuerySayHelloRequest{ - Name: reqName, - } - res, err := queryClient.SayHello(cmd.Context(), params) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} -``` - -The code defines a `CmdSayHello` command. The command is defined using the -`cobra` library, which is a popular framework for building command-line -applications in Go. The command accepts a `name` as an argument and uses it to -create a `QuerySayHelloRequest` struct that is passed to the `SayHello` function -from the `types.QueryClient`. The `SayHello` function is used to send the -`say-hello` query to the blockchain, and the response is stored in the `res` -variable. - -The `QuerySayHelloRequest` struct is defined in the `query.proto` file, which is -a Protocol Buffer file that defines the request and response types for the -query. The `QuerySayHelloRequest` struct includes a `Name` field of type -`string`, which is used to provide the name to be included in the response -message. - -After the query has been sent and the response has been received, the code uses -the `clientCtx.PrintProto` function to print the response to the console. The -`clientCtx` variable is obtained using the `client.GetClientQueryContext` -function, which provides access to the client context, including the client's -configuration and connection information. The `PrintProto` function is used to -print the response using the Protocol Buffer format, which allows for efficient -serialization and deserialization of the data. - -The `flags.AddQueryFlagsToCmd` function is used to add query-related flags to -the command. This allows users to specify additional options when calling the -command, such as the node URL and other query parameters. These flags are used -to configure the query and provide the necessary information to the `SayHello` -function, allowing it to connect to the blockchain and send the query. - -To make the `CmdSayHello` command available to users, you will need to add it to -the chain's binary. This is typically done by modifying the -`x/hello/client/cli/query.go` file and adding the -`cmd.AddCommand(CmdSayHello())` statement. This adds the `CmdSayHello` command -to the list of available commands, allowing users to call it from the -command-line interface (CLI). - -```go title="x/hello/client/cli/query.go" -func GetQueryCmd(queryRoute string) *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - cmd.AddCommand(CmdQueryParams()) - // highlight-next-line - cmd.AddCommand(CmdSayHello()) - return cmd -} -``` - -Once you have provided a CLI command, users will be able to call the `say-hello` -query and receive the appropriate response. - -Save all the changes you made to the source code of your project and run the -following command to start a blockchain node: - -``` -ignite chain serve -``` - -Use the following command to submit the query and receive the response: - -``` -hellod q hello say-hello bob -``` - -This command will send a "say-hello" query to the blockchain with the name "bob" -and print the response of "Hello, bob!" to the console. You can modify the query -and response as needed to suit your specific requirements and provide the -desired functionality. - -Congratulations on completing the "Hello, World!" tutorial! In this tutorial, -you learned how to define a new query in a protocol buffer file, implement the -logic for the query in your code, and make the query available to clients -through the blockchain's API and CLI. By following the steps outlined in the -tutorial, you were able to create a functional query that can be used to -retrieve data from your blockchain or perform other operations as needed. - -Now that you have completed the tutorial, you can continue to build on your -knowledge of the Cosmos SDK and explore the many features and capabilities it -offers. You may want to try implementing more complex queries or experiment with -other features of the SDK to see what you can create. \ No newline at end of file diff --git a/docs/docs/02-guide/03-hello/_category_.json b/docs/docs/02-guide/03-hello/_category_.json deleted file mode 100644 index 871a74e160..0000000000 --- a/docs/docs/02-guide/03-hello/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Hello, World!", - "link": null -} \ No newline at end of file diff --git a/docs/docs/02-guide/04-blog/00-express.md b/docs/docs/02-guide/04-blog/00-express.md index e2cb2fc142..c7932c17b2 100644 --- a/docs/docs/02-guide/04-blog/00-express.md +++ b/docs/docs/02-guide/04-blog/00-express.md @@ -173,7 +173,7 @@ While `ignite chain serve` is running in one terminal window, open another terminal and use the chain's binary to create a new blog post on the blockchain: ``` -blogd tx blog create-post 'Hello, World!' 'This is a blog post' --from alice +blogd tx blog create-post 'Hello, World!' 'This is a blog post' --from alice --chain-id blog ``` When using the `--from` flag to specify the account that will be used to sign a @@ -220,7 +220,7 @@ transaction will be broadcasted to the blockchain and the blog post will be updated with the new body content. ``` -blogd tx blog update-post 0 'Hello, World!' 'This is a blog post from Alice' --from alice +blogd tx blog update-post 0 'Hello, World!' 'This is a blog post from Alice' --from alice --chain-id blog ``` Now that we have updated the blog post with new content, let's query the @@ -263,7 +263,7 @@ example of how the blockchain can enforce rules and permissions, and it shows that only authorized users are able to make changes to the blockchain. ``` -blogd tx blog delete-post 0 --from bob +blogd tx blog delete-post 0 --from bob --chain-id blog raw_log: 'failed to execute message; message index: 0: incorrect owner: unauthorized' ``` @@ -273,7 +273,7 @@ account. Since Alice is the author of the blog post, she should be authorized to delete it. ``` -blogd tx blog delete-post 0 --from alice +blogd tx blog delete-post 0 --from alice --chain-id blog ``` To check whether the blog post has been successfully deleted by Alice, we can @@ -306,4 +306,4 @@ some of the code ourselves, we can gain a deeper understanding of how Ignite works and how it can be used to create applications on a blockchain. This will help us learn more about the capabilities of Ignite CLI and how it can be used to build robust and powerful applications. Keep an eye out for these tutorials -and get ready to dive deeper into the world of blockchains with Ignite! \ No newline at end of file +and get ready to dive deeper into the world of blockchains with Ignite! diff --git a/docs/docs/02-guide/04-blog/03-create.md b/docs/docs/02-guide/04-blog/03-create.md index 5e0ea9209e..f5ef40183e 100644 --- a/docs/docs/02-guide/04-blog/03-create.md +++ b/docs/docs/02-guide/04-blog/03-create.md @@ -29,14 +29,16 @@ import ( "blog/x/blog/types" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" ) func (k Keeper) AppendPost(ctx sdk.Context, post types.Post) uint64 { count := k.GetPostCount(ctx) post.Id = count - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey)) appendedValue := k.cdc.MustMarshal(&post) store.Set(GetPostIDBytes(post.Id), appendedValue) k.SetPostCount(ctx, count+1) @@ -126,7 +128,8 @@ In the file `post.go`, let's define the `GetPostCount` function as follows: ```go title="x/blog/keeper/post.go" func (k Keeper) GetPostCount(ctx sdk.Context) uint64 { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{}) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) byteKey := types.KeyPrefix(types.PostCountKey) bz := store.Get(byteKey) if bz == nil { @@ -209,7 +212,8 @@ in the database. ```go title="x/blog/keeper/post.go" func (k Keeper) SetPostCount(ctx sdk.Context, count uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{}) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) byteKey := types.KeyPrefix(types.PostCountKey) bz := make([]byte, 8) binary.BigEndian.PutUint64(bz, count) @@ -316,4 +320,4 @@ then returns a `MsgCreatePostResponse` object containing the ID of the newly created post. By implementing these methods, you have successfully implemented the necessary -logic for handling "create post" messages and adding posts to the blockchain. \ No newline at end of file +logic for handling "create post" messages and adding posts to the blockchain. diff --git a/docs/docs/02-guide/04-blog/04-update.md b/docs/docs/02-guide/04-blog/04-update.md index 7be1ca80bc..462837b81d 100644 --- a/docs/docs/02-guide/04-blog/04-update.md +++ b/docs/docs/02-guide/04-blog/04-update.md @@ -15,7 +15,8 @@ Implement the `GetPost` keeper method in `post.go`: ```go title="x/blog/keeper/post.go" func (k Keeper) GetPost(ctx sdk.Context, id uint64) (val types.Post, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey)) b := store.Get(GetPostIDBytes(id)) if b == nil { return val, false @@ -48,7 +49,8 @@ Implement the `SetPost` keeper method in `post.go`: ```go title="x/blog/keeper/post.go" func (k Keeper) SetPost(ctx sdk.Context, post types.Post) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey)) b := k.cdc.MustMarshal(&post) store.Set(GetPostIDBytes(post.Id), b) } @@ -78,6 +80,7 @@ import ( "blog/x/blog/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -92,10 +95,10 @@ func (k msgServer) UpdatePost(goCtx context.Context, msg *types.MsgUpdatePost) ( } val, found := k.GetPost(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id)) + return nil, errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id)) } if msg.Creator != val.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") } k.SetPost(ctx, post) return &types.MsgUpdatePostResponse{}, nil @@ -124,4 +127,4 @@ can be useful for correcting mistakes or updating the content of a post as new information becomes available. Finally, you implemented the `UpdatePost` method, which is called whenever the -blockchain processes a message requesting an update to a post. \ No newline at end of file +blockchain processes a message requesting an update to a post. diff --git a/docs/docs/02-guide/04-blog/05-delete.md b/docs/docs/02-guide/04-blog/05-delete.md index 4bef35b8de..1fe784ec2a 100644 --- a/docs/docs/02-guide/04-blog/05-delete.md +++ b/docs/docs/02-guide/04-blog/05-delete.md @@ -7,7 +7,8 @@ message. ```go title="x/blog/keeper/post.go" func (k Keeper) RemovePost(ctx sdk.Context, id uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PostKey)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey)) store.Delete(GetPostIDBytes(id)) } ``` @@ -32,6 +33,7 @@ import ( "blog/x/blog/types" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -40,10 +42,10 @@ func (k msgServer) DeletePost(goCtx context.Context, msg *types.MsgDeletePost) ( ctx := sdk.UnwrapSDKContext(goCtx) val, found := k.GetPost(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id)) + return nil, errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", msg.Id)) } if msg.Creator != val.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") } k.RemovePost(ctx, msg.Id) return &types.MsgDeletePostResponse{}, nil @@ -57,7 +59,7 @@ a pointer to a message of type `*types.MsgDeletePostResponse` and an `error`. Inside the function, the context is unwrapped using the `sdk.UnwrapSDKContext` function and the value of the post with the ID specified in the message is retrieved using the `GetPost` function. If the post is not found, an error is -returned using the `sdkerrors.Wrap` function. If the creator of the message does +returned using the `errorsmod.Wrap` function. If the creator of the message does not match the creator of the post, another error is returned. If both of these checks pass, the `RemovePost` function is called with the context and the ID of the post to delete the post. Finally, the function returns a response message @@ -71,4 +73,4 @@ requester is the creator of the post before deleting it. Congratulations on completing the implementation of the `RemovePost` and `DeletePost` methods in the keeper package! These methods provide functionality for removing a post from a store and handling a request to delete a post, -respectively. \ No newline at end of file +respectively. diff --git a/docs/docs/02-guide/04-blog/07-list.md b/docs/docs/02-guide/04-blog/07-list.md index 268a3349a5..25d1d9aa19 100644 --- a/docs/docs/02-guide/04-blog/07-list.md +++ b/docs/docs/02-guide/04-blog/07-list.md @@ -22,25 +22,24 @@ import ( "blog/x/blog/types" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -func (k Keeper) ListPost(goCtx context.Context, req *types.QueryListPostRequest) (*types.QueryListPostResponse, error) { +func (k Keeper) ListPost(ctx context.Context, req *types.QueryListPostRequest) (*types.QueryListPostResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - var posts []types.Post - ctx := sdk.UnwrapSDKContext(goCtx) - - store := ctx.KVStore(k.storeKey) - postStore := prefix.NewStore(store, types.KeyPrefix(types.PostKey)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.PostKey)) - pageRes, err := query.Paginate(postStore, req.Pagination, func(key []byte, value []byte) error { + var posts []types.Post + pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error { var post types.Post if err := k.cdc.Unmarshal(value, &post); err != nil { return err @@ -63,14 +62,12 @@ func (k Keeper) ListPost(goCtx context.Context, req *types.QueryListPostRequest) `QueryListPostResponse` and an error. The function first checks if the request object is `nil` and returns an error -with a `InvalidArgument` code if it is. It then initializes an empty slice of -`Post` objects and unwraps the context object. - -It retrieves a key-value store from the context using the `storeKey` field of -the keeper struct and creates a new store using a prefix of the `PostKey`. It -then calls the `Paginate` function from the `query` package on the store and the -pagination information in the request object. The function passed as an argument -to Paginate iterates over the key-value pairs in the store and unmarshals the +with a `InvalidArgument` code if it is. + +It creates a new store using a prefix of the `PostKey` and then calls the +`Paginate` function from the `query` package on the store and the pagination +information in the request object. The function passed as an argument to +Paginate iterates over the key-value pairs in the store and unmarshals the values into `Post` objects, which are then appended to the `posts` slice. If an error occurs during pagination, the function returns an `Internal error` @@ -94,4 +91,4 @@ Run the command to generate Go files from proto: ``` ignite generate proto-go -``` \ No newline at end of file +``` diff --git a/docs/docs/02-guide/04-blog/08-play.md b/docs/docs/02-guide/04-blog/08-play.md index abda90113f..e41f02678e 100644 --- a/docs/docs/02-guide/04-blog/08-play.md +++ b/docs/docs/02-guide/04-blog/08-play.md @@ -3,7 +3,7 @@ ## Create a blog post by Alice ``` -blogd tx blog create-post hello world --from alice +blogd tx blog create-post hello world --from alice --chain-id blog ``` ## Show a blog post @@ -23,7 +23,7 @@ post: ## Create a blog post by Bob ``` -blogd tx blog create-post foo bar --from bob +blogd tx blog create-post foo bar --from bob --chain-id blog ``` ## List all blog posts with pagination @@ -50,7 +50,7 @@ post: ## Update a blog post ``` -blogd tx blog update-post hello cosmos 0 --from alice +blogd tx blog update-post hello cosmos 0 --from alice --chain-id blog ``` ``` @@ -68,7 +68,7 @@ post: ## Delete a blog post ``` -blogd tx blog delete-post 0 --from alice +blogd tx blog delete-post 0 --from alice --chain-id blog ``` ``` @@ -89,9 +89,9 @@ post: ## Delete a blog post unsuccessfully ``` -blogd tx blog delete-post 1 --from alice +blogd tx blog delete-post 1 --from alice --chain-id blog ``` ```yml raw_log: 'failed to execute message; message index: 0: incorrect owner: unauthorized' -``` \ No newline at end of file +``` diff --git a/docs/docs/02-guide/05-loan/02-bank.md b/docs/docs/02-guide/05-loan/02-bank.md index 440c806e79..bdc2c726ca 100644 --- a/docs/docs/02-guide/05-loan/02-bank.md +++ b/docs/docs/02-guide/05-loan/02-bank.md @@ -24,9 +24,9 @@ import ( type BankKeeper interface { SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins // highlight-start - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error // highlight-end } -``` \ No newline at end of file +``` diff --git a/docs/docs/02-guide/05-loan/03-request.md b/docs/docs/02-guide/05-loan/03-request.md index a68aed6845..d540ab557c 100644 --- a/docs/docs/02-guide/05-loan/03-request.md +++ b/docs/docs/02-guide/05-loan/03-request.md @@ -76,6 +76,7 @@ import ( // highlight-next-line "strconv" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -83,33 +84,33 @@ import ( func (msg *MsgRequestLoan) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } // highlight-start amount, _ := sdk.ParseCoinsNormalized(msg.Amount) if !amount.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "amount is not a valid Coins object") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "amount is not a valid Coins object") } if amount.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "amount is empty") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "amount is empty") } fee, _ := sdk.ParseCoinsNormalized(msg.Fee) if !fee.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "fee is not a valid Coins object") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "fee is not a valid Coins object") } deadline, err := strconv.ParseInt(msg.Deadline, 10, 64) if err != nil { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "deadline is not an integer") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "deadline is not an integer") } if deadline <= 0 { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "deadline should be a positive integer") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "deadline should be a positive integer") } collateral, _ := sdk.ParseCoinsNormalized(msg.Collateral) if !collateral.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "collateral is not a valid Coins object") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "collateral is not a valid Coins object") } if collateral.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "collateral is empty") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "collateral is empty") } // highlight-end return nil diff --git a/docs/docs/02-guide/05-loan/04-approve.md b/docs/docs/02-guide/05-loan/04-approve.md index 4fb75acf66..d1ff0d5d5d 100644 --- a/docs/docs/02-guide/05-loan/04-approve.md +++ b/docs/docs/02-guide/05-loan/04-approve.md @@ -21,6 +21,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -31,16 +32,16 @@ func (k msgServer) ApproveLoan(goCtx context.Context, msg *types.MsgApproveLoan) ctx := sdk.UnwrapSDKContext(goCtx) loan, found := k.GetLoan(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) } if loan.State != "requested" { - return nil, sdkerrors.Wrapf(types.ErrWrongLoanState, "%v", loan.State) + return nil, errorsmod.Wrapf(types.ErrWrongLoanState, "%v", loan.State) } lender, _ := sdk.AccAddressFromBech32(msg.Creator) borrower, _ := sdk.AccAddressFromBech32(loan.Borrower) amount, err := sdk.ParseCoinsNormalized(loan.Amount) if err != nil { - return nil, sdkerrors.Wrap(types.ErrWrongLoanState, "Cannot parse coins in loan amount") + return nil, errorsmod.Wrap(types.ErrWrongLoanState, "Cannot parse coins in loan amount") } err = k.bankKeeper.SendCoins(ctx, lender, borrower, amount) if err != nil { @@ -94,4 +95,4 @@ import ( var ( ErrWrongLoanState = sdkerrors.Register(ModuleName, 2, "wrong loan state") ) -``` \ No newline at end of file +``` diff --git a/docs/docs/02-guide/05-loan/05-repay.md b/docs/docs/02-guide/05-loan/05-repay.md index 72150f695f..232327d349 100644 --- a/docs/docs/02-guide/05-loan/05-repay.md +++ b/docs/docs/02-guide/05-loan/05-repay.md @@ -25,6 +25,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -35,15 +36,15 @@ func (k msgServer) RepayLoan(goCtx context.Context, msg *types.MsgRepayLoan) (*t ctx := sdk.UnwrapSDKContext(goCtx) loan, found := k.GetLoan(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) } if loan.State != "approved" { - return nil, sdkerrors.Wrapf(types.ErrWrongLoanState, "%v", loan.State) + return nil, errorsmod.Wrapf(types.ErrWrongLoanState, "%v", loan.State) } lender, _ := sdk.AccAddressFromBech32(loan.Lender) borrower, _ := sdk.AccAddressFromBech32(loan.Borrower) if msg.Creator != loan.Borrower { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Cannot repay: not the borrower") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Cannot repay: not the borrower") } amount, _ := sdk.ParseCoinsNormalized(loan.Amount) fee, _ := sdk.ParseCoinsNormalized(loan.Fee) diff --git a/docs/docs/02-guide/05-loan/06-liquidate.md b/docs/docs/02-guide/05-loan/06-liquidate.md index 8d49058b76..419cc740b1 100644 --- a/docs/docs/02-guide/05-loan/06-liquidate.md +++ b/docs/docs/02-guide/05-loan/06-liquidate.md @@ -23,6 +23,7 @@ import ( "context" "strconv" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -33,13 +34,13 @@ func (k msgServer) LiquidateLoan(goCtx context.Context, msg *types.MsgLiquidateL ctx := sdk.UnwrapSDKContext(goCtx) loan, found := k.GetLoan(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) } if loan.Lender != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Cannot liquidate: not the lender") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Cannot liquidate: not the lender") } if loan.State != "approved" { - return nil, sdkerrors.Wrapf(types.ErrWrongLoanState, "%v", loan.State) + return nil, errorsmod.Wrapf(types.ErrWrongLoanState, "%v", loan.State) } lender, _ := sdk.AccAddressFromBech32(loan.Lender) collateral, _ := sdk.ParseCoinsNormalized(loan.Collateral) @@ -48,7 +49,7 @@ func (k msgServer) LiquidateLoan(goCtx context.Context, msg *types.MsgLiquidateL panic(err) } if ctx.BlockHeight() < deadline { - return nil, sdkerrors.Wrap(types.ErrDeadline, "Cannot liquidate before deadline") + return nil, errorsmod.Wrap(types.ErrDeadline, "Cannot liquidate before deadline") } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lender, collateral) if err != nil { @@ -62,15 +63,15 @@ func (k msgServer) LiquidateLoan(goCtx context.Context, msg *types.MsgLiquidateL `LiquidateLoan` takes in a context and a `types.MsgLiquidateLoan` message as input and returns a types.MsgLiquidateLoanResponse message and an error as output. -The function first retrieves a loan using the `GetLoan` method and the `Id` field of the input message. If the loan is not found, it returns an error using the `sdkerrors.Wrap` function and the `sdkerrors.ErrKeyNotFound` error code. +The function first retrieves a loan using the `GetLoan` method and the `Id` field of the input message. If the loan is not found, it returns an error using the `errorsmod.Wrap` function and the `sdkerrors.ErrKeyNotFound` error code. -Next, the function checks that the `Creator` field of the input message is the same as the `Lender` field of the loan. If they are not the same, it returns an error using the `sdkerrors.Wrap` function and the `sdkerrors.ErrUnauthorized` error code. +Next, the function checks that the `Creator` field of the input message is the same as the `Lender` field of the loan. If they are not the same, it returns an error using the `errorsmod.Wrap` function and the `sdkerrors.ErrUnauthorized` error code. -The function then checks that the State field of the loan is equal to "approved". If it is not, it returns an error using the `sdkerrors.Wrapf` function and the `types.ErrWrongLoanState` error code. +The function then checks that the State field of the loan is equal to "approved". If it is not, it returns an error using the `errorsmod.Wrapf` function and the `types.ErrWrongLoanState` error code. The function then converts the Lender field of the loan to an address using the `sdk.AccAddressFromBech32` function and the `Collateral` field to coins using the `sdk.ParseCoinsNormalized` function. It also converts the `Deadline` field to an integer using the `strconv.ParseInt` function. If this function returns an error, it panics. -Finally, the function checks that the current block height is greater than or equal to the deadline. If it is not, it returns an error using the `sdkerrors.Wrap` function and the `types.ErrDeadline` error code. If all checks pass, the function uses the `bankKeeper.SendCoinsFromModuleToAccount` method to transfer the collateral from the module account to the lender's account and updates the `State` field of the loan to `"liquidated"`. It then stores the updated loan using the `SetLoan` method and returns a `types.MsgLiquidateLoanResponse` message with no error. +Finally, the function checks that the current block height is greater than or equal to the deadline. If it is not, it returns an error using the `errorsmod.Wrap` function and the `types.ErrDeadline` error code. If all checks pass, the function uses the `bankKeeper.SendCoinsFromModuleToAccount` method to transfer the collateral from the module account to the lender's account and updates the `State` field of the loan to `"liquidated"`. It then stores the updated loan using the `SetLoan` method and returns a `types.MsgLiquidateLoanResponse` message with no error. ## Register a custom error diff --git a/docs/docs/02-guide/05-loan/07-cancel.md b/docs/docs/02-guide/05-loan/07-cancel.md index 3997072a92..9415fe6ada 100644 --- a/docs/docs/02-guide/05-loan/07-cancel.md +++ b/docs/docs/02-guide/05-loan/07-cancel.md @@ -15,6 +15,7 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -25,13 +26,13 @@ func (k msgServer) CancelLoan(goCtx context.Context, msg *types.MsgCancelLoan) ( ctx := sdk.UnwrapSDKContext(goCtx) loan, found := k.GetLoan(ctx, msg.Id) if !found { - return nil, sdkerrors.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) + return nil, errorsmod.Wrapf(sdkerrors.ErrKeyNotFound, "key %d doesn't exist", msg.Id) } if loan.Borrower != msg.Creator { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Cannot cancel: not the borrower") + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Cannot cancel: not the borrower") } if loan.State != "requested" { - return nil, sdkerrors.Wrapf(types.ErrWrongLoanState, "%v", loan.State) + return nil, errorsmod.Wrapf(types.ErrWrongLoanState, "%v", loan.State) } borrower, _ := sdk.AccAddressFromBech32(loan.Borrower) collateral, _ := sdk.ParseCoinsNormalized(loan.Collateral) @@ -53,16 +54,16 @@ The function begins by using the `sdk.UnwrapSDKContext` method to get the `sdk.Context` from the `context.Context` object. It then uses the `GetLoan` method of the `msgServer` type to retrieve a loan identified by the `Id` field of the `msg` argument. If the loan is not found, the function returns an error -using the `sdk.ErrKeyNotFound` error wrapped with the `sdk.Wrap` method. +using the `sdk.ErrKeyNotFound` error wrapped with the `errorsmod.Wrap` method. Next, the function checks if the `Creator` field of the msg argument is the same as the `Borrower` field of the loan. If they are not the same, the function returns an error using the `sdk.ErrUnauthorized` error wrapped with the -`sdk.Wrap` method. +`errorsmod.Wrap` method. The function then checks if the `State` field of the loan is equal to the string `"requested"`. If it is not, the function returns an error using the -types.`ErrWrongLoanState` error wrapped with the `sdk.Wrapf` method. +types.`ErrWrongLoanState` error wrapped with the `errorsmod.Wrapf` method. If the loan has the correct state and the creator of the message is the borrower of the loan, the function proceeds to send the collateral coins held in the @@ -70,4 +71,4 @@ of the loan, the function proceeds to send the collateral coins held in the `SendCoinsFromModuleToAccount` method of the `bankKeeper`. The function then updates the State field of the loan to the string "cancelled" and sets the updated loan using the `SetLoan` method. Finally, the function returns a -`types.MsgCancelLoanResponse` object and a nil error. \ No newline at end of file +`types.MsgCancelLoanResponse` object and a nil error. diff --git a/docs/docs/02-guide/05-loan/08-play.md b/docs/docs/02-guide/05-loan/08-play.md index eb715b0512..40ab5aabf7 100644 --- a/docs/docs/02-guide/05-loan/08-play.md +++ b/docs/docs/02-guide/05-loan/08-play.md @@ -41,7 +41,7 @@ Request a loan of `1000token` with `100token` as a fee and `1000foocoin` as a collateral from Alice's account. The deadline is set to `500` blocks: ``` -loand tx loan request-loan 1000token 100token 1000foocoin 500 --from alice +loand tx loan request-loan 1000token 100token 1000foocoin 500 --from alice --chain-id loan ``` ``` @@ -65,7 +65,7 @@ Please be aware that the addresses displayed in your terminal window (such as th Approve the loan from Bob's account: ``` -loand tx loan approve-loan 0 --from bob +loand tx loan approve-loan 0 --from bob --chain-id loan ``` ``` @@ -132,7 +132,7 @@ balances: Repay the loan from Alice's account: ``` -loand tx loan repay-loan 0 --from alice +loand tx loan repay-loan 0 --from alice --chain-id loan ``` ``` @@ -204,7 +204,7 @@ deadline is set to a very small value, so that the loan can be quickly liquidated in the next step: ``` -loand tx loan request-loan 1000token 100token 1000foocoin 20 --from alice +loand tx loan request-loan 1000token 100token 1000foocoin 20 --from alice --chain-id loan ``` ``` @@ -238,13 +238,13 @@ Loan: Approve the loan from Bob's account: ``` -loand tx loan approve-loan 1 --from bob +loand tx loan approve-loan 1 --from bob --chain-id loan ``` Liquidate the loan from Bob's account: ``` -loand tx loan liquidate-loan 1 --from bob +loand tx loan liquidate-loan 1 --from bob --chain-id loan ``` ``` diff --git a/docs/docs/02-guide/06-ibc.md b/docs/docs/02-guide/06-ibc.md index 9f1973adc5..faa01a1cae 100644 --- a/docs/docs/02-guide/06-ibc.md +++ b/docs/docs/02-guide/06-ibc.md @@ -241,7 +241,7 @@ func (k msgServer) SendIbcPost(goCtx context.Context, msg *types.MsgSendIbcPost) packet.Creator = msg.Creator // Transmit the packet - err := k.TransmitIbcPostPacket( + _, err := k.TransmitIbcPostPacket( ctx, packet, msg.Port, @@ -288,7 +288,7 @@ Finally, the Ignite CLI-generated AppendPost function returns the ID of the new appended post. You can return this value to the source chain through acknowledgment. -Append the type instance as `PostID` on receiving the packet: +Append the type instance as `PostId` on receiving the packet: - The context `ctx` is an [immutable data structure](https://docs.cosmos.network/main/core/context#go-context-package) @@ -333,7 +333,7 @@ func (k Keeper) OnRecvIbcPostPacket(ctx sdk.Context, packet channeltypes.Packet, }, ) - packetAck.PostID = strconv.FormatUint(id, 10) + packetAck.PostId = strconv.FormatUint(id, 10) return packetAck, nil } @@ -375,7 +375,7 @@ func (k Keeper) OnAcknowledgementIbcPostPacket(ctx sdk.Context, packet channelty ctx, types.SentPost{ Creator: data.Creator, - PostID: packetAck.PostID, + PostId: packetAck.PostId, Title: data.Title, Chain: packet.DestinationPort + "-" + packet.DestinationChannel, }, diff --git a/docs/docs/02-guide/06-tokenfactory/01-tokenfactory.md b/docs/docs/02-guide/06-tokenfactory/01-tokenfactory.md index 33f8d6f163..70c1865bf9 100644 --- a/docs/docs/02-guide/06-tokenfactory/01-tokenfactory.md +++ b/docs/docs/02-guide/06-tokenfactory/01-tokenfactory.md @@ -222,23 +222,23 @@ Implement basic input validation in `x/tokenfactory/types/messages_denom.go`: - Ensure the ticker length is between 3 and 10 characters. ```go func (msg *MsgCreateDenom) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Owner) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) - } - - tickerLength := len(msg.Ticker) - if tickerLength < 3 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Ticker length must be at least 3 chars long") - } - if tickerLength > 10 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Ticker length must be 10 chars long maximum") - } - if msg.MaxSupply == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Max Supply must be greater than 0") - } - - return nil + _, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + } + + tickerLength := len(msg.Ticker) + if tickerLength < 3 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Ticker length must be at least 3 chars long") + } + if tickerLength > 10 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Ticker length must be 10 chars long maximum") + } + if msg.MaxSupply == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Max Supply must be greater than 0") + } + + return nil } ``` @@ -246,14 +246,14 @@ func (msg *MsgCreateDenom) ValidateBasic() error { ```go func (msg *MsgUpdateDenom) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Owner) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) - } - if msg.MaxSupply == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Max Supply must be greater than 0") - } - return nil + _, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid owner address (%s)", err) + } + if msg.MaxSupply == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "Max Supply must be greater than 0") + } + return nil } ``` @@ -268,43 +268,43 @@ The keeper is where you define the business logic for manipulating the database ```go func (k msgServer) UpdateDenom(goCtx context.Context, msg *types.MsgUpdateDenom) (*types.MsgUpdateDenomResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // Check if the value exists - valFound, isFound := k.GetDenom( - ctx, - msg.Denom, - ) - if !isFound { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "Denom to update not found") - } - - // Checks if the the msg owner is the same as the current owner - if msg.Owner != valFound.Owner { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") - } - - if !valFound.CanChangeMaxSupply && valFound.MaxSupply != msg.MaxSupply { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "cannot change maxsupply") - } - if !valFound.CanChangeMaxSupply && msg.CanChangeMaxSupply { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Cannot revert change maxsupply flag") - } - var denom = types.Denom{ - Owner: msg.Owner, - Denom: msg.Denom, - Description: msg.Description, - Ticker: valFound.Ticker, - Precision: valFound.Precision, - Url: msg.Url, - MaxSupply: msg.MaxSupply, - Supply: valFound.Supply, - CanChangeMaxSupply: msg.CanChangeMaxSupply, - } - - k.SetDenom(ctx, denom) - - return &types.MsgUpdateDenomResponse{}, nil + ctx := sdk.UnwrapSDKContext(goCtx) + + // Check if the value exists + valFound, isFound := k.GetDenom( + ctx, + msg.Denom, + ) + if !isFound { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "Denom to update not found") + } + + // Checks if the the msg owner is the same as the current owner + if msg.Owner != valFound.Owner { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") + } + + if !valFound.CanChangeMaxSupply && valFound.MaxSupply != msg.MaxSupply { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "cannot change maxsupply") + } + if !valFound.CanChangeMaxSupply && msg.CanChangeMaxSupply { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Cannot revert change maxsupply flag") + } + var denom = types.Denom{ + Owner: msg.Owner, + Denom: msg.Denom, + Description: msg.Description, + Ticker: valFound.Ticker, + Precision: valFound.Precision, + Url: msg.Url, + MaxSupply: msg.MaxSupply, + Supply: valFound.Supply, + CanChangeMaxSupply: msg.CanChangeMaxSupply, + } + + k.SetDenom(ctx, denom) + + return &types.MsgUpdateDenomResponse{}, nil } ``` @@ -318,20 +318,20 @@ Replace the existing code in `expected_keepers.go` with the updated definitions package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetModuleAddress(name string) sdk.AccAddress + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI } type BankKeeper interface { - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins } ``` @@ -399,67 +399,67 @@ Found in `x/tokenfactory/keeper/msg_server_update_owner.go`, this function allow package keeper import ( - "context" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "tokenfactory/x/tokenfactory/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "tokenfactory/x/tokenfactory/types" ) func (k msgServer) MintAndSendTokens(goCtx context.Context, msg *types.MsgMintAndSendTokens) (*types.MsgMintAndSendTokensResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // Check if the value exists - valFound, isFound := k.GetDenom( - ctx, - msg.Denom, - ) - if !isFound { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "denom does not exist") - } - - // Checks if the the msg owner is the same as the current owner - if msg.Owner != valFound.Owner { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") - } - - if valFound.Supply+msg.Amount > valFound.MaxSupply { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Cannot mint more than Max Supply") - } - moduleAcct := k.accountKeeper.GetModuleAddress(types.ModuleName) - - recipientAddress, err := sdk.AccAddressFromBech32(msg.Recipient) - if err != nil { - return nil, err - } - - var mintCoins sdk.Coins - - mintCoins = mintCoins.Add(sdk.NewCoin(msg.Denom, sdk.NewInt(int64(msg.Amount)))) - if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, mintCoins); err != nil { - return nil, err - } - if err := k.bankKeeper.SendCoins(ctx, moduleAcct, recipientAddress, mintCoins); err != nil { - return nil, err - } - - var denom = types.Denom{ - Owner: valFound.Owner, - Denom: valFound.Denom, - Description: valFound.Description, - MaxSupply: valFound.MaxSupply, - Supply: valFound.Supply + msg.Amount, - Precision: valFound.Precision, - Ticker: valFound.Ticker, - Url: valFound.Url, - CanChangeMaxSupply: valFound.CanChangeMaxSupply, - } - - k.SetDenom( - ctx, - denom, - ) - return &types.MsgMintAndSendTokensResponse{}, nil + ctx := sdk.UnwrapSDKContext(goCtx) + + // Check if the value exists + valFound, isFound := k.GetDenom( + ctx, + msg.Denom, + ) + if !isFound { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "denom does not exist") + } + + // Checks if the the msg owner is the same as the current owner + if msg.Owner != valFound.Owner { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") + } + + if valFound.Supply+msg.Amount > valFound.MaxSupply { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Cannot mint more than Max Supply") + } + moduleAcct := k.accountKeeper.GetModuleAddress(types.ModuleName) + + recipientAddress, err := sdk.AccAddressFromBech32(msg.Recipient) + if err != nil { + return nil, err + } + + var mintCoins sdk.Coins + + mintCoins = mintCoins.Add(sdk.NewCoin(msg.Denom, sdk.NewInt(int64(msg.Amount)))) + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, mintCoins); err != nil { + return nil, err + } + if err := k.bankKeeper.SendCoins(ctx, moduleAcct, recipientAddress, mintCoins); err != nil { + return nil, err + } + + var denom = types.Denom{ + Owner: valFound.Owner, + Denom: valFound.Denom, + Description: valFound.Description, + MaxSupply: valFound.MaxSupply, + Supply: valFound.Supply + msg.Amount, + Precision: valFound.Precision, + Ticker: valFound.Ticker, + Url: valFound.Url, + CanChangeMaxSupply: valFound.CanChangeMaxSupply, + } + + k.SetDenom( + ctx, + denom, + ) + return &types.MsgMintAndSendTokensResponse{}, nil } ``` @@ -469,48 +469,48 @@ func (k msgServer) MintAndSendTokens(goCtx context.Context, msg *types.MsgMintAn package keeper import ( - "context" + "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "tokenfactory/x/tokenfactory/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "tokenfactory/x/tokenfactory/types" ) func (k msgServer) UpdateOwner(goCtx context.Context, msg *types.MsgUpdateOwner) (*types.MsgUpdateOwnerResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // Check if the value exists - valFound, isFound := k.GetDenom( - ctx, - msg.Denom, - ) - if !isFound { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "denom does not exist") - } - - // Checks if the the msg owner is the same as the current owner - if msg.Owner != valFound.Owner { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") - } - - var denom = types.Denom{ - Owner: msg.NewOwner, - Denom: msg.Denom, - Description: valFound.Description, - MaxSupply: valFound.MaxSupply, - Supply: valFound.Supply, - Precision: valFound.Precision, - Ticker: valFound.Ticker, - Url: valFound.Url, - CanChangeMaxSupply: valFound.CanChangeMaxSupply, - } - - k.SetDenom( - ctx, - denom, - ) - - return &types.MsgUpdateOwnerResponse{}, nil + ctx := sdk.UnwrapSDKContext(goCtx) + + // Check if the value exists + valFound, isFound := k.GetDenom( + ctx, + msg.Denom, + ) + if !isFound { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "denom does not exist") + } + + // Checks if the the msg owner is the same as the current owner + if msg.Owner != valFound.Owner { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "incorrect owner") + } + + var denom = types.Denom{ + Owner: msg.NewOwner, + Denom: msg.Denom, + Description: valFound.Description, + MaxSupply: valFound.MaxSupply, + Supply: valFound.Supply, + Precision: valFound.Precision, + Ticker: valFound.Ticker, + Url: valFound.Url, + CanChangeMaxSupply: valFound.CanChangeMaxSupply, + } + + k.SetDenom( + ctx, + denom, + ) + + return &types.MsgUpdateOwnerResponse{}, nil } ``` diff --git a/docs/docs/06-migration/v0.24.0.md b/docs/docs/06-migration/v0.24.0.md index bcf1b85185..7b803cce85 100644 --- a/docs/docs/06-migration/v0.24.0.md +++ b/docs/docs/06-migration/v0.24.0.md @@ -241,7 +241,7 @@ package module_name func (im IBCModule) OnChanOpenInit( /*...*/ ) (string, error) { //... - return "", sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) //... } ``` @@ -259,8 +259,8 @@ package module_name func (im IBCModule) OnRecvPacket( /*...*/ ) { //... if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { - // return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()).Error()) - return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error())) + // return channeltypes.NewErrorAcknowledgement(errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()).Error()) + return channeltypes.NewErrorAcknowledgement(errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error())) } // ... diff --git a/docs/docs/06-migration/v0.26.0.md b/docs/docs/06-migration/v0.26.0.md index 8dae447d15..de3576dbe8 100644 --- a/docs/docs/06-migration/v0.26.0.md +++ b/docs/docs/06-migration/v0.26.0.md @@ -165,7 +165,7 @@ func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error { capName := host.ChannelCapabilityPath(portID, channelID) chanCap, ok := k.scopedKeeper.GetCapability(ctx, capName) if !ok { - return sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName) + return errorsmod.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName) } return k.channelKeeper.ChanCloseInit(ctx, portID, channelID, chanCap) } diff --git a/docs/docs/07-packages/cosmostxcollector.md b/docs/docs/07-packages/cosmostxcollector.md index c38fc2d3d5..62047e4ff9 100644 --- a/docs/docs/07-packages/cosmostxcollector.md +++ b/docs/docs/07-packages/cosmostxcollector.md @@ -51,7 +51,7 @@ const ( dbName = "cosmos" // Cosmos RPC address - rpcAddr = "https://rpc.cosmos.network:443" + rpcAddr = "https://rpc.cosmos.directory:443/cosmoshub" ) func collect(ctx context.Context, db postgres.Adapter) error { diff --git a/docs/docs/08-references/01-cli.md b/docs/docs/08-references/01-cli.md index 27243d2fb0..56c10341a4 100644 --- a/docs/docs/08-references/01-cli.md +++ b/docs/docs/08-references/01-cli.md @@ -1126,9 +1126,10 @@ meant to be edited by hand. **Options** ``` - --clear-cache clear the build cache (advanced) - -h, --help help for generate - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -h, --help help for generate + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1138,7 +1139,6 @@ meant to be edited by hand. * [ignite generate hooks](#ignite-generate-hooks) - TypeScript frontend client and React hooks * [ignite generate openapi](#ignite-generate-openapi) - OpenAPI spec for your chain * [ignite generate proto-go](#ignite-generate-proto-go) - Compile protocol buffer files to Go source code required by Cosmos SDK -* [ignite generate proto-pulsar](#ignite-generate-proto-pulsar) - Compile protocol buffer files to Go pulsar source code required by Cosmos SDK * [ignite generate ts-client](#ignite-generate-ts-client) - TypeScript frontend client * [ignite generate vuex](#ignite-generate-vuex) - *DEPRECATED* TypeScript frontend client and Vuex stores @@ -1162,8 +1162,9 @@ ignite generate composables [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1190,8 +1191,9 @@ ignite generate hooks [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1217,8 +1219,9 @@ ignite generate openapi [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1244,35 +1247,9 @@ ignite generate proto-go [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") -``` - -**SEE ALSO** - -* [ignite generate](#ignite-generate) - Generate clients, API docs from source code - - -## ignite generate proto-pulsar - -Compile protocol buffer files to Go pulsar source code required by Cosmos SDK - -``` -ignite generate proto-pulsar [flags] -``` - -**Options** - -``` - -h, --help help for proto-pulsar - -y, --yes answers interactive yes/no questions with yes -``` - -**Options inherited from parent commands** - -``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1321,8 +1298,9 @@ ignite generate ts-client [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -1349,8 +1327,9 @@ ignite generate vuex [flags] **Options inherited from parent commands** ``` - --clear-cache clear the build cache (advanced) - -p, --path string path of the app (default ".") + --clear-cache clear the build cache (advanced) + --enable-proto-vendor enable proto package vendor for missing Buf dependencies + -p, --path string path of the app (default ".") ``` **SEE ALSO** @@ -2814,7 +2793,7 @@ Make requests to a live blockchain node ``` -h, --help help for node - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2837,7 +2816,7 @@ Querying subcommands **Options inherited from parent commands** ``` - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2860,7 +2839,7 @@ Querying commands for the bank module **Options inherited from parent commands** ``` - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2896,7 +2875,7 @@ ignite node query bank balances [from_account_or_address] [flags] **Options inherited from parent commands** ``` - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2921,7 +2900,7 @@ ignite node query tx [hash] [flags] **Options inherited from parent commands** ``` - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2951,7 +2930,7 @@ Transactions subcommands **Options inherited from parent commands** ``` - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -2982,7 +2961,7 @@ Bank transaction subcommands --home string directory where the blockchain node is initialized --keyring-backend string keyring backend to store your account keys (default "test") --keyring-dir string accounts keyring directory (default "/home/runner/.ignite/accounts") - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** @@ -3017,7 +2996,7 @@ ignite node tx bank send [from_account_or_address] [to_account_or_address] [amou --home string directory where the blockchain node is initialized --keyring-backend string keyring backend to store your account keys (default "test") --keyring-dir string accounts keyring directory (default "/home/runner/.ignite/accounts") - --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.network:443") + --node string : to tendermint rpc interface for this chain (default "https://rpc.cosmos.directory:443/cosmoshub") ``` **SEE ALSO** diff --git a/docs/docs/apps/02-developing-apps.md b/docs/docs/apps/02-developing-apps.md index 1f5a13a508..57d1fdd58b 100644 --- a/docs/docs/apps/02-developing-apps.md +++ b/docs/docs/apps/02-developing-apps.md @@ -43,31 +43,35 @@ All apps must implement a predefined interface: ```go title=ignite/services/plugin/interface.go type Interface interface { // Manifest declares app's Command(s) and Hook(s). - Manifest() (Manifest, error) + Manifest(context.Context) (*Manifest, error) // Execute will be invoked by ignite when an app Command is executed. // It is global for all commands declared in Manifest, if you have declared // multiple commands, use cmd.Path to distinguish them. - Execute(cmd ExecutedCommand) error + // The ClientAPI argument can be used by plugins to get chain app analysis info. + Execute(context.Context, *ExecutedCommand, ClientAPI) error // ExecuteHookPre is invoked by ignite when a command specified by the Hook // path is invoked. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookPre(hook ExecutedHook) error + // The ClientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookPre(context.Context, *ExecutedHook, ClientAPI) error // ExecuteHookPost is invoked by ignite when a command specified by the hook // path is invoked. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookPost(hook ExecutedHook) error + // The ClientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookPost(context.Context, *ExecutedHook, ClientAPI) error // ExecuteHookCleanUp is invoked by ignite when a command specified by the // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of // execution status of the command and hooks. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookCleanUp(hook ExecutedHook) error + // The ClientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookCleanUp(context.Context, *ExecutedHook, ClientAPI) error } ``` @@ -76,35 +80,34 @@ the method's body. ## Defining app's manifest -Here is the `Manifest` struct: - -```go title=ignite/services/plugin/interface.go -type Manifest struct { - Name string - - // Commands contains the commands that will be added to the list of ignite - // commands. Each commands are independent, for nested commands use the - // inner Commands field. - Commands []Command - - // Hooks contains the hooks that will be attached to the existing ignite - // commands. - Hooks []Hook - - // SharedHost enables sharing a single app server across all running instances - // of an app. Useful if an app adds or extends long running commands - // - // Example: if an app defines a hook on `ignite chain serve`, a server is instanciated - // when the command is run. Now if you want to interact with that instance from commands - // defined in that app, you need to enable `SharedHost`, or else the commands will just - // instantiate separate app servers. - // - // When enabled, all apps of the same `Path` loaded from the same configuration will - // attach it's gRPC client to a an existing gRPC server. - // - // If an app instance has no other running app servers, it will create one and it - // will be the host. - SharedHost bool `yaml:"shared_host"` +Here is the `Manifest` proto message definition: + +```protobuf title=proto/ignite/services/plugin/grpc/v1/types.proto +message Manifest { + // App name. + string name = 1; + + // Commands contains the commands that will be added to the list of ignite commands. + // Each commands are independent, for nested commands use the inner Commands field. + bool shared_host = 2; + + // Hooks contains the hooks that will be attached to the existing ignite commands. + repeated Command commands = 3; + + // Enables sharing a single app server across all running instances of an Ignite App. + // Useful if an app adds or extends long running commands. + // + // Example: if an app defines a hook on `ignite chain serve`, a server is instanciated + // when the command is run. Now if you want to interact with that instance + // from commands defined in that app, you need to enable shared host, or else the + // commands will just instantiate separate app servers. + // + // When enabled, all apps of the same path loaded from the same configuration will + // attach it's RPC client to a an existing RPC server. + // + // If an app instance has no other running app servers, it will create one and it + // will be the host. + repeated Hook hooks = 4; } ``` @@ -132,16 +135,16 @@ For instance, let's say your app adds a new `oracle` command to `ignite scaffold`, then the `Manifest` method will look like : ```go -func (app) Manifest() (plugin.Manifest, error) { - return plugin.Manifest{ +func (app) Manifest(context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ Name: "oracle", - Commands: []plugin.Command{ + Commands: []*plugin.Command{ { Use: "oracle [name]", Short: "Scaffold an oracle module", Long: "Long description goes here...", // Optionnal flags is required - Flags: []plugin.Flag{ + Flags: []*plugin.Flag{ {Name: "source", Type: plugin.FlagTypeString, Usage: "the oracle source"}, }, // Attach the command to `scaffold` @@ -156,14 +159,21 @@ To update the app execution, you have to change the `Execute` command. For example: ```go -func (app) Execute(cmd plugin.ExecutedCommand) error { +func (app) Execute(_ context.Context, cmd *plugin.ExecutedCommand, _ plugin.ClientAPI) error { if len(cmd.Args) == 0 { return fmt.Errorf("oracle name missing") } + + flags, err := cmd.NewFlags() + if err != nil { + return err + } + var ( name = cmd.Args[0] - source, _ = cmd.Flags().GetString("source") + source, _ = flags.GetString("source") ) + // Read chain information c, err := getChain(cmd) if err != nil { @@ -199,10 +209,10 @@ resulting in `post` and `clean up` not executing. The following is an example of a `hook` definition. ```go -func (app) Manifest() (plugin.Manifest, error) { - return plugin.Manifest{ +func (app) Manifest(context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ Name: "oracle", - Hooks: []plugin.Hook{ + Hooks: []*plugin.Hook{ { Name: "my-hook", PlaceHookOn: "ignite chain build", @@ -211,8 +221,8 @@ func (app) Manifest() (plugin.Manifest, error) { }, nil } -func (app) ExecuteHookPre(hook plugin.ExecutedHook) error { - switch hook.Name { +func (app) ExecuteHookPre(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { case "my-hook": fmt.Println("I'm executed before ignite chain build") default: @@ -221,8 +231,8 @@ func (app) ExecuteHookPre(hook plugin.ExecutedHook) error { return nil } -func (app) ExecuteHookPost(hook plugin.ExecutedHook) error { - switch hook.Name { +func (app) ExecuteHookPost(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { case "my-hook": fmt.Println("I'm executed after ignite chain build (if no error)") default: @@ -231,8 +241,8 @@ func (app) ExecuteHookPost(hook plugin.ExecutedHook) error { return nil } -func (app) ExecuteHookCleanUp(hook plugin.ExecutedHook) error { - switch hook.Name { +func (app) ExecuteHookCleanUp(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + switch h.Hook.GetName() { case "my-hook": fmt.Println("I'm executed after ignite chain build (regardless errors)") default: diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 130084cbad..3ba632d566 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -64,8 +64,7 @@ const config = { ({ image: "img/og-image.jpg", announcementBar: { - content: - 'โ† Back to Ignite', + content: 'โ† Back to Ignite', isCloseable: false, }, docs: { @@ -225,16 +224,11 @@ const config = { }, }, algolia: { - appId: 'VVETP7QCVE', - apiKey: '167213b8ce51cc7ff9a804df130657e5', - indexName: 'ignite-cli', + appId: "VVETP7QCVE", + apiKey: "167213b8ce51cc7ff9a804df130657e5", + indexName: "ignite-cli", contextualSearch: true, - - // โ†“ - To remove if `contextualSearch` versioning search works (to use if not) - // exclusionPatterns: [ - // 'https://docs.ignite.com/v0.25.2/**', - // 'https://docs.ignite.com/nightly/**', - // ] + schedule: "every 1 day at 3:00 pm", }, }), plugins: [ @@ -242,14 +236,12 @@ const config = { "@docusaurus/plugin-client-redirects", { createRedirects(existingPath) { - if (existingPath.includes('/welcome')) { + if (existingPath.includes("/welcome")) { /* - If the link received contains the path /guide, - this will change to /welcome. - */ - return [ - existingPath.replace('/welcome', '/guide'), - ]; + If the link received contains the path /guide, + this will change to /welcome. + */ + return [existingPath.replace("/welcome", "/guide")]; } return; // No redirect created if it doesn't contain /guide }, diff --git a/docs/versioned_docs/version-v0.27.2/02-guide/02-getting-started.md b/docs/versioned_docs/version-v0.27.2/02-guide/02-getting-started.md index d1d8c7c161..df3ff4464d 100644 --- a/docs/versioned_docs/version-v0.27.2/02-guide/02-getting-started.md +++ b/docs/versioned_docs/version-v0.27.2/02-guide/02-getting-started.md @@ -29,8 +29,8 @@ following command: ignite scaffold chain example ``` -The [`ignite scaffold chain`](../references/cli#ignite-scaffold-chain) command will create a -new blockchain in a new directory `example`. +The [`ignite scaffold chain`](/references/cli#ignite-scaffold-chain) command +will create a new blockchain in a new directory `example`. The new blockchain is built using the Cosmos SDK framework and imports several standard modules to provide a range of functionality. These modules include @@ -132,7 +132,7 @@ To start a blockchain node in development, you can run the following command: ignite chain serve ``` -The [`ignite chain serve`](../references/cli#ignite-scaffold-chain) command is used to start +The [`ignite chain serve`](/references/cli#ignite-scaffold-chain) command is used to start a blockchain node in development mode. It first compiles and installs the binary using the `ignite chain build` command, then initializes the blockchain's data directory for a single validator using the `ignite chain init` command. After diff --git a/docs/versioned_docs/version-v0.27.2/02-guide/06-ibc.md b/docs/versioned_docs/version-v0.27.2/02-guide/06-ibc.md index 83efb4f760..13d4d6fce4 100644 --- a/docs/versioned_docs/version-v0.27.2/02-guide/06-ibc.md +++ b/docs/versioned_docs/version-v0.27.2/02-guide/06-ibc.md @@ -291,7 +291,7 @@ acknowledgment. Append the type instance as `PostID` on receiving the packet: - The context `ctx` is an [immutable data - structure](https://docs.cosmos.network/main/core/context.html#go-context-package) + structure](https://docs.cosmos.network/main/learn/advanced/context#go-context-package) that has header data from the transaction. See [how the context is initiated](https://github.com/cosmos/cosmos-sdk/blob/main/types/context.go#L71) - The identifier format that you defined earlier diff --git a/docs/versioned_docs/version-v0.27.2/02-guide/10-simapp.md b/docs/versioned_docs/version-v0.27.2/02-guide/10-simapp.md index fd2dcea96f..4bd38bf1b1 100644 --- a/docs/versioned_docs/version-v0.27.2/02-guide/10-simapp.md +++ b/docs/versioned_docs/version-v0.27.2/02-guide/10-simapp.md @@ -14,8 +14,7 @@ simulation methods for each scaffolded message. ## Module simulation Every new module that is scaffolded with Ignite CLI implements the Cosmos SDK -[Module -Simulation](https://docs.cosmos.network/main/building-modules/simulator.html). +[Module Simulation](https://docs.cosmos.network/main/learn/advanced/simulation). - Each new message creates a file with the simulation methods required for the tests. @@ -105,7 +104,7 @@ according to call the function. ## Invariants Simulating a chain can help you prevent [chain invariants -errors](https://docs.cosmos.network/main/building-modules/invariants.html). An +errors](https://docs.cosmos.network/main/build/building-modules/invariants). An invariant is a function called by the chain to check if something broke, invalidating the chain data. To create a new invariant and check the chain integrity, you must create a method to validate the invariants and register all diff --git a/docs/versioned_docs/version-v0.27.2/03-clients/02-typescript.md b/docs/versioned_docs/version-v0.27.2/03-clients/02-typescript.md index 3c8d29e81d..c770f5c338 100644 --- a/docs/versioned_docs/version-v0.27.2/03-clients/02-typescript.md +++ b/docs/versioned_docs/version-v0.27.2/03-clients/02-typescript.md @@ -8,7 +8,7 @@ Ignite offers powerful functionality for generating client-side code for your blockchain. Think of this as a one-click client SDK generation tailored specifically for your blockchain. -See [`ignite generate ts-client --help`](../references/cli#ignite-generate-ts-client) learn +See [`ignite generate ts-client --help`](/references/cli#ignite-generate-ts-client) learn more on how to use TypeScript code generation. ## Starting a node diff --git a/docs/versioned_docs/version-v0.27.2/06-migration/v0.19.2.md b/docs/versioned_docs/version-v0.27.2/06-migration/v0.19.2.md index 5bd63a73c1..aa141809bf 100644 --- a/docs/versioned_docs/version-v0.27.2/06-migration/v0.19.2.md +++ b/docs/versioned_docs/version-v0.27.2/06-migration/v0.19.2.md @@ -14,7 +14,7 @@ official Ignite CLI repo which introduces breaking changes. To migrate your chain that was scaffolded with Ignite CLI versions lower than v0.19.2: 1. IBC upgrade: Use - the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v1-to-v2.md) + the [IBC migration documents](https://github.com/cosmos/ibc-go/blob/main/docs/docs/05-migrations/03-v1-to-v2.md) 2. In your chain's `go.mod` file, remove `tendermint/spm` and add the v0.19.2 version of `tendermint/starport`. If your chain uses these packages, change the import paths as shown: diff --git a/docs/versioned_docs/version-v0.27.2/06-migration/v0.26.0.md b/docs/versioned_docs/version-v0.27.2/06-migration/v0.26.0.md index f8895aabf1..e19dd53601 100644 --- a/docs/versioned_docs/version-v0.27.2/06-migration/v0.26.0.md +++ b/docs/versioned_docs/version-v0.27.2/06-migration/v0.26.0.md @@ -17,15 +17,14 @@ their tooling to the latest version. Chains that are newly scaffolded with Ignite CLI `v0.26.0` now use `ibc-go/v6` for ibc functionality. It is not necessary, but recommended to upgrade to the newest version of `ibc-go`. Most migrations can be done by following the -`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md), but there are some +`ibc-go` [migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/docs/05-migrations/07-v5-to-v6.md), but there are some specific changes that will need to be followed for Ignite scaffolded chains. ### Removing `cosmosibckeeper` -Ignite CLI `v0.26.0` has deprecated [pkg/cosmosibckeeper](https://github.com/ignite/cli/tree/main/ignite/pkg/cosmosibckeeper). -This package contained interfaces for ibc-related keepers. Newly scaffolded chains now include the interface files in their -`./x/{moduleName}/types` directory in a new `expected_ibc_keeper.go` file. To migrate, create the following file for -each module: +Ignite CLI `v0.26.0` has deprecated `pkg/cosmosibckeeper`. This package contained interfaces for ibc-related keepers. +Newly scaffolded chains now include the interface files in their `./x/{moduleName}/types` directory in a new `expected_ibc_keeper.go` +file. To migrate, create the following file for each module: ```go title="x/{moduleName}/types/expected_ibc_keeper.go" package types @@ -215,7 +214,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { ### Remaining migration -After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/v5-to-v6.md). +After all uses of `cosmosibckeeper` have been removed, you can follow any remaining steps in the`ibc-go`[migration guide](https://github.com/cosmos/ibc-go/blob/main/docs/docs/05-migrations/07-v5-to-v6.md). ## Scaffolded Release Workflow diff --git a/docs/yarn.lock b/docs/yarn.lock index f3dfd7b93a..b8e1d4772f 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -145,6 +145,14 @@ dependencies: "@babel/highlight" "^7.18.6" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.0.tgz#c241dc454e5b5917e40d37e525e2f4530c399298" @@ -203,6 +211,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.16.0", "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -268,6 +286,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-explode-assignable-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" @@ -283,6 +306,14 @@ "@babel/template" "^7.20.7" "@babel/types" "^7.21.0" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -290,6 +321,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-member-expression-to-functions@^7.20.7", "@babel/helper-member-expression-to-functions@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz#319c6a940431a133897148515877d2f3269c3ba5" @@ -378,16 +416,33 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-string-parser@^7.19.4": version "7.19.4" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" @@ -421,11 +476,25 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@babel/parser@^7.12.7", "@babel/parser@^7.18.8", "@babel/parser@^7.20.7", "@babel/parser@^7.21.3": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.3.tgz#1d285d67a19162ff9daa358d4cb41d50c06220b3" integrity sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ== +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -1161,19 +1230,28 @@ "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" -"@babel/traverse@^7.12.9", "@babel/traverse@^7.18.8", "@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.3", "@babel/traverse@^7.4.5": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.3.tgz#4747c5e7903d224be71f90788b06798331896f67" - integrity sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ== +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.21.3" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.21.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.21.3" - "@babel/types" "^7.21.3" + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + +"@babel/traverse@^7.12.9", "@babel/traverse@^7.18.8", "@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.3", "@babel/traverse@^7.4.5": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" @@ -1186,6 +1264,15 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -2846,7 +2933,7 @@ ccount@^1.0.0: resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043" integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg== -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== diff --git a/go.mod b/go.mod index 8492f9534f..d218510d02 100644 --- a/go.mod +++ b/go.mod @@ -4,244 +4,297 @@ go 1.21.1 toolchain go1.21.3 +replace ( + github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 + // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. + // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + // Downgraded to avoid bugs in following commits which caused simulations to fail. + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +) + require ( - cosmossdk.io/math v1.0.1 - github.com/99designs/keyring v1.2.1 - github.com/AlecAivazis/survey/v2 v2.3.6 + cosmossdk.io/math v1.2.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/upgrade v0.1.0 + github.com/99designs/keyring v1.2.2 + github.com/AlecAivazis/survey/v2 v2.3.7 github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/blang/semver/v4 v4.0.0 github.com/briandowns/spinner v1.23.0 + github.com/bufbuild/buf v1.15.1 github.com/buger/jsonparser v1.1.1 github.com/cenkalti/backoff v2.2.1+incompatible github.com/charmbracelet/bubbles v0.7.6 - github.com/charmbracelet/bubbletea v0.23.1 + github.com/charmbracelet/bubbletea v0.23.2 github.com/charmbracelet/glow v1.4.1 github.com/charmbracelet/lipgloss v0.6.0 - github.com/cometbft/cometbft v0.37.2 - github.com/cosmos/cosmos-sdk v0.47.3 + github.com/cometbft/cometbft v0.38.0 + github.com/cosmos/cosmos-sdk v0.50.1 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/v7 v7.1.0 - github.com/emicklei/proto v1.12.1 - github.com/emicklei/proto-contrib v0.14.0 - github.com/go-delve/delve v1.20.2 - github.com/go-git/go-git/v5 v5.6.1 + github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/emicklei/proto v1.12.2 + github.com/emicklei/proto-contrib v0.15.0 + github.com/go-delve/delve v1.21.0 + github.com/go-git/go-git/v5 v5.10.0 github.com/gobuffalo/genny/v2 v2.1.0 github.com/gobuffalo/logger v1.0.7 github.com/gobuffalo/packd v1.0.2 - github.com/gobuffalo/plush/v4 v4.1.16 - github.com/goccy/go-yaml v1.9.7 - github.com/golangci/golangci-lint v1.50.1 + github.com/gobuffalo/plush/v4 v4.1.19 + github.com/goccy/go-yaml v1.11.2 + github.com/golangci/golangci-lint v1.55.2 github.com/google/go-github/v48 v48.2.0 - github.com/gookit/color v1.5.3 - github.com/gorilla/mux v1.8.0 - github.com/gorilla/rpc v1.2.0 - github.com/hashicorp/go-hclog v1.2.0 - github.com/hashicorp/go-plugin v1.4.9 - github.com/iancoleman/strcase v0.2.0 + github.com/gookit/color v1.5.4 + github.com/gorilla/mux v1.8.1 + github.com/gorilla/rpc v1.2.1 + github.com/hashicorp/go-hclog v1.5.0 + github.com/hashicorp/go-plugin v1.5.2 + github.com/iancoleman/strcase v0.3.0 github.com/ignite/ignite-files/nodetime v0.0.2 github.com/ignite/ignite-files/protoc v0.0.1 github.com/ignite/web v0.5.1 - github.com/imdario/mergo v0.3.15 - github.com/jpillora/chisel v1.8.1 + github.com/imdario/mergo v0.3.13 + github.com/jpillora/chisel v1.9.1 github.com/lib/pq v1.10.9 github.com/manifoldco/promptui v0.9.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/moby/moby v24.0.1+incompatible + github.com/moby/moby v24.0.7+incompatible github.com/muesli/reflow v0.3.0 github.com/nqd/flat v0.2.0 - github.com/otiai10/copy v1.11.0 + github.com/otiai10/copy v1.14.0 github.com/pelletier/go-toml v1.9.5 github.com/pkg/errors v0.9.1 github.com/radovskyb/watcher v1.0.7 - github.com/rogpeppe/go-internal v1.10.0 - github.com/rs/cors v1.9.0 - github.com/spf13/cobra v1.7.0 + github.com/rogpeppe/go-internal v1.11.0 + github.com/rs/cors v1.10.1 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.4 github.com/tbruyelle/mdgofmt v0.1.3 - github.com/vektra/mockery/v2 v2.27.1 - go.etcd.io/bbolt v1.3.7 - golang.org/x/exp v0.0.0-20230519143937-03e91628a987 - golang.org/x/mod v0.12.0 - golang.org/x/sync v0.2.0 - golang.org/x/term v0.13.0 - golang.org/x/text v0.13.0 - golang.org/x/tools v0.9.1 - golang.org/x/vuln v0.1.0 - google.golang.org/grpc v1.56.3 + github.com/vektra/mockery/v2 v2.36.1 + go.etcd.io/bbolt v1.3.8 + golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 + golang.org/x/mod v0.14.0 + golang.org/x/sync v0.5.0 + golang.org/x/term v0.14.0 + golang.org/x/text v0.14.0 + golang.org/x/tools v0.15.0 + golang.org/x/vuln v1.0.1 + google.golang.org/grpc v1.59.0 + google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v2 v2.4.0 mvdan.cc/gofumpt v0.5.0 - sigs.k8s.io/yaml v1.3.0 -) - -replace ( - github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 - github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1 - github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + sigs.k8s.io/yaml v1.4.0 ) require ( - 4d63.com/gochecknoglobals v0.1.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/errors v1.0.0-beta.7 // indirect + 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect + 4d63.com/gochecknoglobals v0.2.1 // indirect + cosmossdk.io/api v0.7.2 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/core v0.11.0 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/errors v1.0.0 // indirect + cosmossdk.io/log v1.2.1 // indirect + cosmossdk.io/store v1.0.0 // indirect + cosmossdk.io/x/tx v0.12.0 // indirect + dario.cat/mergo v1.0.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect + github.com/4meepo/tagalign v1.3.3 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/Abirdcfly/dupword v0.0.7 // indirect - github.com/Antonboom/errname v0.1.7 // indirect - github.com/Antonboom/nilnil v0.1.1 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/Abirdcfly/dupword v0.0.13 // indirect + github.com/Antonboom/errname v0.1.12 // indirect + github.com/Antonboom/nilnil v0.1.7 // indirect + github.com/Antonboom/testifylint v0.2.3 // indirect + github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/BurntSushi/toml v1.3.2 // indirect + github.com/DataDog/zstd v1.5.5 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/Microsoft/hcsshim v0.10.0-rc.3 // indirect + github.com/Microsoft/hcsshim v0.11.4 // indirect github.com/OneOfOne/xxhash v1.2.8 // indirect - github.com/OpenPeeDeeP/depguard v1.1.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect + github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alecthomas/chroma v0.8.2 // indirect + github.com/alecthomas/go-check-sumtype v0.1.3 // indirect + github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect - github.com/armon/go-metrics v0.4.1 // indirect github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 // indirect - github.com/ashanbrown/forbidigo v1.3.0 // indirect + github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect - github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/atotto/clipboard v0.1.2 // indirect + github.com/aymanbagabas/go-osc52 v1.2.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/bkielbasa/cyclop v1.2.0 // indirect + github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect - github.com/bombsimon/wsl/v3 v3.3.0 // indirect - github.com/breml/bidichk v0.2.3 // indirect - github.com/breml/errchkjson v0.3.0 // indirect + github.com/bombsimon/wsl/v3 v3.4.0 // indirect + github.com/breml/bidichk v0.2.7 // indirect + github.com/breml/errchkjson v0.3.6 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/btcutil v1.1.3 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect - github.com/butuzov/ireturn v0.1.1 // indirect + github.com/bufbuild/connect-go v1.5.2 // indirect + github.com/bufbuild/protocompile v0.6.0 // indirect + github.com/butuzov/ireturn v0.2.2 // indirect + github.com/butuzov/mirror v1.1.0 // indirect github.com/calmh/randomart v1.1.0 // indirect + github.com/catenacyber/perfsprint v0.2.0 // indirect + github.com/ccojocar/zxcvbn-go v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/charithe/durationcheck v0.0.9 // indirect + github.com/charithe/durationcheck v0.0.10 // indirect github.com/charmbracelet/charm v0.8.6 // indirect github.com/charmbracelet/glamour v0.2.1-0.20210402234443-abe9cda419ba // indirect - github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect - github.com/chigopher/pathlib v1.0.0 // indirect + github.com/chavacava/garif v0.1.0 // indirect + github.com/chigopher/pathlib v0.15.0 // indirect github.com/chzyer/readline v1.5.1 // indirect - github.com/cilium/ebpf v0.10.0 // indirect + github.com/cilium/ebpf v0.9.1 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cometbft/cometbft-db v0.7.0 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c // indirect - github.com/containerd/containerd v1.7.0-beta.2 // indirect + github.com/containerd/containerd v1.7.8 // indirect github.com/cosiner/argv v0.1.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect - github.com/cosmos/iavl v0.20.0 // indirect + github.com/cosmos/cosmos-db v1.0.0 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/iavl v1.0.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.8.1 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/daixiang0/gci v0.11.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4 // indirect + github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dlclark/regexp2 v1.2.0 // indirect + github.com/docker/cli v23.0.3+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/docker-credential-helpers v0.7.0 // 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 github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/emicklei/dot v1.6.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/fatih/structtag v1.2.0 // indirect + github.com/felixge/fgprof v0.9.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.6.5 // indirect + github.com/getsentry/sentry-go v0.25.0 // indirect + github.com/ghostiam/protogetter v0.2.3 // indirect + github.com/go-chi/chi/v5 v5.0.8 // indirect + github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d // indirect - github.com/go-git/gcfg v1.5.0 // indirect - github.com/go-git/go-billy/v5 v5.4.1 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-playground/locales v0.14.0 // indirect - github.com/go-toolsmith/astcast v1.0.0 // indirect - github.com/go-toolsmith/astcopy v1.0.2 // indirect - github.com/go-toolsmith/astequal v1.0.3 // indirect - github.com/go-toolsmith/astfmt v1.0.0 // indirect - github.com/go-toolsmith/astp v1.0.0 // indirect - github.com/go-toolsmith/strparse v1.0.0 // indirect - github.com/go-toolsmith/typep v1.0.2 // indirect - github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-toolsmith/astcast v1.1.0 // indirect + github.com/go-toolsmith/astcopy v1.1.0 // indirect + github.com/go-toolsmith/astequal v1.1.0 // indirect + github.com/go-toolsmith/astfmt v1.1.0 // indirect + github.com/go-toolsmith/astp v1.1.0 // indirect + github.com/go-toolsmith/strparse v1.1.0 // indirect + github.com/go-toolsmith/typep v1.1.0 // indirect + github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobuffalo/flect v0.3.0 // indirect - github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect + github.com/gobuffalo/github_flavored_markdown v1.1.4 // indirect github.com/gobuffalo/helpers v0.6.7 // indirect github.com/gobuffalo/tags/v3 v3.1.4 // indirect github.com/gobuffalo/validate/v3 v3.3.3 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.8.1 // indirect - github.com/gofrs/uuid v4.3.0+incompatible // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect + github.com/gofrs/uuid/v5 v5.0.0 // indirect + github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang-jwt/jwt/v4 v4.1.0 // indirect + github.com/golang/glog v1.1.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect - github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect + github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect - github.com/golangci/misspell v0.3.5 // indirect - github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect + github.com/golangci/misspell v0.4.1 // indirect + github.com/golangci/revgrep v0.5.2 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/google/go-dap v0.7.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-containerregistry v0.14.0 // indirect + github.com/google/go-dap v0.9.1 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect + github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gorilla/css v1.0.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect github.com/gostaticanalysis/nilerr v0.1.1 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/huandu/skiplist v1.2.0 // indirect + github.com/huandu/xstrings v1.4.0 // indirect + github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jgautheron/goconst v1.5.1 // indirect + github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 // indirect + github.com/jgautheron/goconst v1.6.0 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jinzhu/copier v0.3.5 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect @@ -253,143 +306,163 @@ require ( github.com/julz/importas v0.1.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/kisielk/errcheck v1.6.2 // indirect + github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect - github.com/kkHAIKE/contextcheck v1.1.3 // indirect - github.com/klauspost/compress v1.16.5 // indirect + github.com/kkHAIKE/contextcheck v1.1.4 // indirect + github.com/klauspost/compress v1.17.2 // indirect + github.com/klauspost/pgzip v1.2.5 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect - github.com/kunwardeep/paralleltest v1.0.6 // indirect - github.com/kyoh86/exportloopref v0.1.8 // indirect + github.com/kunwardeep/paralleltest v1.0.8 // indirect + github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect - github.com/ldez/tagliatelle v0.3.1 // indirect - github.com/leonklingele/grouper v1.1.0 // indirect + github.com/ldez/tagliatelle v0.5.0 // indirect + github.com/leonklingele/grouper v1.1.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/linxGnu/grocksdb v1.8.4 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lufeee/execinquery v1.2.1 // indirect + github.com/macabu/inamedparam v0.1.2 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect - github.com/maratori/testpackage v1.1.0 // indirect - github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect + github.com/maratori/testpackage v1.1.1 // indirect + github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/meowgorithm/babyenv v1.3.1 // indirect - github.com/mgechev/revive v1.2.4 // indirect + github.com/mgechev/revive v1.3.4 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect - github.com/microcosm-cc/bluemonday v1.0.20 // indirect + github.com/microcosm-cc/bluemonday v1.0.23 // indirect github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect - github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect - github.com/moricho/tparallel v0.2.1 // indirect + github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect + github.com/moricho/tparallel v0.3.1 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect + github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/gitcha v0.2.0 // indirect github.com/muesli/go-app-paths v0.2.1 // indirect github.com/muesli/sasquatch v0.0.0-20200811221207-66979d92330a // indirect - github.com/muesli/termenv v0.15.1 // indirect + github.com/muesli/termenv v0.14.0 // indirect github.com/nakabonne/nestif v0.3.1 // indirect - github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.8.3 // indirect + github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/oklog/run v1.0.0 // indirect + github.com/nunnatsa/ginkgolinter v0.14.1 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect github.com/opencontainers/runc v1.1.7 // indirect - github.com/pelletier/go-toml/v2 v2.0.7 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.0.5 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect - github.com/quasilyte/go-ruleguard v0.3.18 // indirect - github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f // indirect - github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + github.com/pkg/profile v1.7.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/polyfloyd/go-errorlint v1.4.5 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/quasilyte/go-ruleguard v0.4.0 // indirect + github.com/quasilyte/gogrep v0.5.0 // indirect + github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rs/zerolog v1.31.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/ryancurrah/gomodguard v1.2.4 // indirect - github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect + github.com/ryancurrah/gomodguard v1.3.0 // indirect + github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 // indirect github.com/sahilm/fuzzy v0.1.0 // indirect - github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect + github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.20.0 // indirect - github.com/securego/gosec/v2 v2.13.1 // indirect + github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect + github.com/securego/gosec/v2 v2.18.2 // indirect github.com/segmentio/ksuid v1.0.3 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/sirupsen/logrus v1.9.2 // indirect - github.com/sivchari/containedctx v1.0.2 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect - github.com/sivchari/tenv v1.7.0 // indirect - github.com/skeema/knownhosts v1.1.1 // indirect - github.com/sonatard/noctx v0.0.1 // indirect + github.com/sivchari/tenv v1.7.1 // indirect + github.com/skeema/knownhosts v1.2.0 // indirect + github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect - github.com/sourcegraph/go-diff v0.6.1 // indirect + github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.15.0 // indirect + github.com/spf13/viper v1.16.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - github.com/tdakkota/asciicheck v0.1.1 // indirect - github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect + github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect + github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tetafro/godot v1.4.11 // indirect - github.com/tidwall/btree v1.6.0 // indirect - github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect - github.com/timonwong/loggercheck v0.9.3 // indirect - github.com/tomarrell/wrapcheck/v2 v2.7.0 // indirect + github.com/tetafro/godot v1.4.15 // indirect + github.com/tidwall/btree v1.7.0 // indirect + github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect + github.com/timonwong/loggercheck v0.9.4 // indirect + github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/ultraware/funlen v0.0.3 // indirect + github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.0.5 // indirect - github.com/uudashr/gocognit v1.0.6 // indirect + github.com/uudashr/gocognit v1.1.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect + github.com/xen0n/gosmopolitan v1.2.2 // indirect + github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect + github.com/ykadowak/zerologlint v0.1.3 // indirect github.com/yuin/goldmark v1.4.13 // indirect github.com/yuin/goldmark-emoji v1.0.1 // indirect - github.com/zondax/hid v0.9.1 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect - gitlab.com/bosi/decorder v0.2.3 // indirect + github.com/zondax/hid v0.9.2 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect + gitlab.com/bosi/decorder v0.4.1 // indirect + go-simpler.org/sloglint v0.1.2 // indirect + go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect go.starlark.net v0.0.0-20220816155156-cfacd8902214 // indirect + go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/goleak v1.1.12 // indirect - go.uber.org/multierr v1.8.0 // indirect - go.uber.org/zap v1.23.0 // indirect - golang.org/x/arch v0.1.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + go.uber.org/multierr v1.10.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 // indirect + golang.org/x/crypto v0.15.0 // indirect + golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/protobuf v1.30.0 // indirect; indir ect + google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.3 // indirect + gotest.tools/v3 v3.5.1 // indirect + honnef.co/go/tools v0.4.6 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8 // indirect - pgregory.net/rapid v0.5.5 // indirect + nhooyr.io/websocket v1.8.6 // indirect + pgregory.net/rapid v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index 893dbdfea9..44254abd4c 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -4d63.com/gochecknoglobals v0.1.0 h1:zeZSRqj5yCg28tCkIV/z/lWbwvNm5qnKVS15PI8nhD0= -4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= +4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= +4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= +4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= +4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -19,23 +21,23 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= +cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= +cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= +cloud.google.com/go/iam v1.1.3 h1:18tKG7DzydKWUnLjonWcJO6wjSCAtzh4GcRKlH/Hrzc= +cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -46,88 +48,117 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= -cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= -cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= -cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= -cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= -cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= -cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= +cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/oNM= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= +cosmossdk.io/api v0.7.2 h1:BO3i5fvKMKvfaUiMkCznxViuBEfyWA/k6w2eAF6q1C4= +cosmossdk.io/api v0.7.2/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/store v1.0.0 h1:6tnPgTpTSIskaTmw/4s5C9FARdgFflycIc9OX8i1tOI= +cosmossdk.io/store v1.0.0/go.mod h1:ABMprwjvx6IpMp8l06TwuMrj6694/QP5NIW+X6jaTYc= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/tx v0.12.0 h1:Ry2btjQdrfrje9qZ3iZeZSmDArjgxUJMMcLMrX4wj5U= +cosmossdk.io/x/tx v0.12.0/go.mod h1:qTth2coAGkwCwOCjqQ8EAQg+9udXNRzcnSbMgGKGEI0= +cosmossdk.io/x/upgrade v0.1.0 h1:z1ZZG4UL9ICTNbJDYZ6jOnF9GdEK9wyoEFi4BUScHXE= +cosmossdk.io/x/upgrade v0.1.0/go.mod h1:/6jjNGbiPCNtmA1N+rBtP601sr0g4ZXuj3yC6ClPCGY= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +github.com/4meepo/tagalign v1.3.3 h1:ZsOxcwGD/jP4U/aw7qeWu58i7dwYemfy5Y+IF1ACoNw= +github.com/4meepo/tagalign v1.3.3/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Abirdcfly/dupword v0.0.7 h1:z14n0yytA3wNO2gpCD/jVtp/acEXPGmYu0esewpBt6Q= -github.com/Abirdcfly/dupword v0.0.7/go.mod h1:K/4M1kj+Zh39d2aotRwypvasonOyAMH1c/IZJzE0dmk= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20221206110420-d395f97c4830 h1:u8scGKApGy+gXpYDw2f+nh60R0FqCfrpDRIQki+5o3U= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20221206110420-d395f97c4830/go.mod h1:VzwV+t+dZ9j/H867F1M2ziD+yLHtB46oM35FxxMJ4d0= -github.com/AlecAivazis/survey/v2 v2.3.6 h1:NvTuVHISgTHEHeBFqt6BHOe4Ny/NwGZr7w+F8S9ziyw= -github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI= -github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= -github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= -github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= -github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= +github.com/Abirdcfly/dupword v0.0.13 h1:SMS17YXypwP000fA7Lr+kfyBQyW14tTT+nRv9ASwUUo= +github.com/Abirdcfly/dupword v0.0.13/go.mod h1:Ut6Ue2KgF/kCOawpW4LnExT+xZLQviJPE4klBPMK/5Y= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= +github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= +github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClDcQY= +github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= +github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTow= +github.com/Antonboom/nilnil v0.1.7/go.mod h1:TP+ScQWVEq0eSIxqU8CbdT5DFWoHp0MbP+KMUO1BKYQ= +github.com/Antonboom/testifylint v0.2.3 h1:MFq9zyL+rIVpsvLX4vDPLojgN7qODzWsrnftNX2Qh60= +github.com/Antonboom/testifylint v0.2.3/go.mod h1:IYaXaOX9NbfAyO+Y04nfjGI8wDemC1rUyM/cYolz018= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +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/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= 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/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 h1:3ZBs7LAezy8gh0uECsA6CGU43FF3zsx5f4eah5FxTMA= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0pzhpe2TdhRniBF++PRHQuRpR8esVc= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.10.0-rc.3 h1:xitFWOoxrVd0OgGvjtr5fM6LjUZaGWP02pia856YLFQ= -github.com/Microsoft/hcsshim v0.10.0-rc.3/go.mod h1:C9nOYXQjBOZG9CfMF8V3hOOoVYAqSajyedIrx4rRh64= +github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= +github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= -github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= -github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2nVAQTx5S5jQvMeDqWtD1By5mOoyY/xJek= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= +github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= +github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= +github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= +github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= github.com/alecthomas/chroma v0.8.2 h1:x3zkuE2lUk/RIekyAJ3XRqSCP4zwWDfcw/YJCuCAACg= github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= +github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= +github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7/go.mod h1:NumScqsC42o9x+dGj8/YqsIfhrIQjFEOFovxotbBirA= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= +github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexkohler/nakedret/v2 v2.0.2 h1:qnXuZNvv3/AxkAb22q/sEsEpcA99YxLFACDtEw9TPxE= +github.com/alexkohler/nakedret/v2 v2.0.2/go.mod h1:2b8Gkk0GsOrqQv/gPWjNLDSKwG8I5moSXG1K4VIBcTQ= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -137,30 +168,33 @@ github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2/go.mod h1:jnz github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= -github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= +github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= +github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= -github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aymanbagabas/go-osc52 v1.2.1 h1:q2sWUyDcozPLcLabEMd+a+7Ea2DitxZVN9hTxab9L4E= +github.com/aymanbagabas/go-osc52 v1.2.1/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -170,56 +204,52 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= -github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= +github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= +github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= -github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= -github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= -github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= -github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= -github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= +github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= +github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= +github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= +github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= +github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= +github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= github.com/briandowns/spinner v1.23.0 h1:alDF2guRWqa/FOZZYWjlMIx2L6H0wyewPxo/CH4Pt2A= github.com/briandowns/spinner v1.23.0/go.mod h1:rPG4gmXeN3wQV/TsAY4w8lPdIM6RX3yqeBQJSrbXjuE= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= -github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= -github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= -github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= -github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/bufbuild/buf v1.15.1 h1:v7sK2uMEsGX4Z2hvu+xiMheH3C3AKBGfxPBgdUZYDQ8= +github.com/bufbuild/buf v1.15.1/go.mod h1:TQeGKam1QMfHy/xsSnnMpxN3JK5HBb6aNvZj4m52gkE= +github.com/bufbuild/connect-go v1.5.2 h1:G4EZd5gF1U1ZhhbVJXplbuUnfKpBZ5j5izqIwu2g2W8= +github.com/bufbuild/connect-go v1.5.2/go.mod h1:GmMJYR6orFqD0Y6ZgX8pwQ8j9baizDrIQMm1/a6LnHk= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= -github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/butuzov/ireturn v0.2.2 h1:jWI36dxXwVrI+RnXDwux2IZOewpmfv930OuIRfaBUJ0= +github.com/butuzov/ireturn v0.2.2/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= +github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= +github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/calmh/randomart v1.1.0 h1:evl+iwc10LXtHdMZhzLxmsCQVmWnkXs44SbC6Uk0Il8= github.com/calmh/randomart v1.1.0/go.mod h1:DQUbPVyP+7PAs21w/AnfMKG5NioxS3TbZ2F9MSK/jFM= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/catenacyber/perfsprint v0.2.0 h1:azOocHLscPjqXVJ7Mf14Zjlkn4uNua0+Hcg1wTR6vUo= +github.com/catenacyber/perfsprint v0.2.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/ccojocar/zxcvbn-go v1.0.1 h1:+sxrANSCj6CdadkcMnvde/GWU1vZiiXRbqYSCalV4/4= +github.com/ccojocar/zxcvbn-go v1.0.1/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -229,15 +259,15 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= -github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= +github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= +github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/charmbracelet/bubbles v0.7.5/go.mod h1:IRTORFvhEI6OUH7WhN2Ks8Z8miNGimk1BE6cmHijOkM= github.com/charmbracelet/bubbles v0.7.6 h1:SCAp4ZEUf2tBNEsufo+Xxxu2dvbFhYSDPrX45toQZrM= github.com/charmbracelet/bubbles v0.7.6/go.mod h1:0D4XRYK0tjo8JMvflz1obpVcOikNZSG46SFauoZj22s= github.com/charmbracelet/bubbletea v0.12.2/go.mod h1:3gZkYELUOiEUOp0bTInkxguucy/xRbGSOcbMs1geLxg= github.com/charmbracelet/bubbletea v0.13.2/go.mod h1:okqaA5VF0aSpEZ2HB+L/cxVw2HthIDZ1dmWoRZs8/4g= -github.com/charmbracelet/bubbletea v0.23.1 h1:CYdteX1wCiCzKNUlwm25ZHBIc1GXlYFyUIte8WPvhck= -github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU= +github.com/charmbracelet/bubbletea v0.23.2 h1:vuUJ9HJ7b/COy4I30e8xDVQ+VRDUEFykIjryPfgsdps= +github.com/charmbracelet/bubbletea v0.23.2/go.mod h1:FaP3WUivcTM0xOKNmhciz60M6I+weYLF76mr1JyI7sM= github.com/charmbracelet/charm v0.8.6 h1:/U6rxGj4J6zZ1Ex8+wTr4hNMr4ESBzNZbC1UyrJPVbg= github.com/charmbracelet/charm v0.8.6/go.mod h1:8dE3uX+TYSpa7Q6e/CmjN6WSd7koSAKNQTGWugFREx4= github.com/charmbracelet/glamour v0.2.1-0.20210402234443-abe9cda419ba h1:smKYYwwVPZyMK2LCirIi2WY25tZZW0IU7GYe1ASGCe4= @@ -246,10 +276,10 @@ github.com/charmbracelet/glow v1.4.1 h1:mzspku+pWaYALabhJlExsSj7PORGfLjjprJCLI6I github.com/charmbracelet/glow v1.4.1/go.mod h1:zRTFgmRlLe+nkqyCKB+b8GZhycm0F7JuwdFmfeeJgqg= github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY= github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk= -github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 h1:E7LT642ysztPWE0dfz43cWOvMiF42DyTRC+eZIaO4yI= -github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xfuwWPNKXlThldNuJvutYM6J95wNuuVmn55To= -github.com/chigopher/pathlib v1.0.0 h1:SbsCrFX4vDf4M2d8mT/RTzuVlKOjTKoPHK0HidsQFak= -github.com/chigopher/pathlib v1.0.0/go.mod h1:3+YPPV21mU9vyw8Mjp+F33CyCfE6iOzinpiqBcccv7I= +github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= +github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= +github.com/chigopher/pathlib v0.15.0 h1:1pg96WL3iC1/YyWV4UJSl3E0GBf4B+h5amBtsbAAieY= +github.com/chigopher/pathlib v0.15.0/go.mod h1:3+YPPV21mU9vyw8Mjp+F33CyCfE6iOzinpiqBcccv7I= github.com/chris-ramon/douceur v0.2.0/go.mod h1:wDW5xjJdeoMm1mRt4sD4c/LbF/mWdEpRXQKjTR8nIBE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= @@ -261,107 +291,117 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= -github.com/cilium/ebpf v0.10.0 h1:nk5HPMeoBXtOzbkZBWym+ZWq1GIiHUsBFXxwewXAHLQ= -github.com/cilium/ebpf v0.10.0/go.mod h1:DPiVdY/kT534dgc9ERmvP8mWA+9gvwgKfRvk4nNWnoE= +github.com/cilium/ebpf v0.9.1 h1:64sn2K3UKw8NbP/blsixRpF3nXuyhz/VjRlRzvlBRu4= +github.com/cilium/ebpf v0.9.1/go.mod h1:+OhNOIXx/Fnu1IE8bJz2dzOA+VSfyTfdNUVdlQnxUFY= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= -github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= -github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb h1:6Po+YYKT5B5ZXN0wd2rwFBaebM0LufPf8p4zxOd48Kg= +github.com/cockroachdb/pebble v0.0.0-20231102162011-844f0582c2eb/go.mod h1:acMRUGd/BK8AUmQNK3spUCCGzFLZU2bSST3NMXSq2Kc= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/cometbft/cometbft v0.38.0 h1:ogKnpiPX7gxCvqTEF4ly25/wAxUqf181t30P3vqdpdc= +github.com/cometbft/cometbft v0.38.0/go.mod h1:5Jz0Z8YsHSf0ZaAqGvi/ifioSdVFPtEGrm8Y9T/993k= +github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= +github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c h1:sgmd9/Gm5SFfxHSVVD7HAaEQlaUJKdJ2VlQM8SwUxvs= github.com/containerd/console v1.0.4-0.20230508195404-8d3c090fd31c/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/containerd v1.7.0-beta.2 h1:GWmC96y8j7jlFJX0Wh+covft0M1hHBqQL7lo+N6qvxg= -github.com/containerd/containerd v1.7.0-beta.2/go.mod h1:RR01Jsm/jovDKK48sFCVqWyKAH2APMPi88Aeu1on63I= +github.com/containerd/containerd v1.7.8 h1:RkwgOW3AVUT3H/dyT0W03Dc8AzlpMG65lX48KftOFSM= +github.com/containerd/containerd v1.7.8/go.mod h1:L/Hn9qylJtUFT7cPeM0Sr3fATj+WjHwRQ0lyrYk3OPY= +github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= +github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg= github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= -github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.3 h1:r0hGmZoAzP2D+MaPaFGHwAaTdFQq3pNpHaUp1BsffbM= -github.com/cosmos/cosmos-sdk v0.47.3/go.mod h1:c4OfLdAykA9zsj1CqrxBRqXzVz48I++JSvIMPSPcEmk= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= +github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= +github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= +github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= +github.com/cosmos/cosmos-sdk v0.50.1 h1:2SYwAYqd7ZwtrWxu/J8PwbQV/cDcu90bCr/a78g3lVw= +github.com/cosmos/cosmos-sdk v0.50.1/go.mod h1:fsLSPGstCwn6MMsFDMAQWGJj8E4sYsN9Gnu1bGE5imA= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.1.0 h1:SCLgs7tqVnzdIDO5MRLgovAnc696vTTKl+8qsTu8IMM= -github.com/cosmos/ibc-go/v7 v7.1.0/go.mod h1:7MptlWeIyqmDiuJeRAFqBvXKY8Hybd+rF8vMSmGd2zg= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= +github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= +github.com/cosmos/iavl v1.0.0 h1:bw6t0Mv/mVCJvlMTOPHWLs5uUE3BRBfVWCRelOzl+so= +github.com/cosmos/iavl v1.0.0/go.mod h1:CmTGqMnRnucjxbjduneZXT+0vPgNElYvdefjX2q9tYc= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/v8 v8.0.0 h1:QKipnr/NGwc+9L7NZipURvmSIu+nw9jOIWTJuDBqOhg= +github.com/cosmos/ibc-go/v8 v8.0.0/go.mod h1:C6IiJom0F3cIQCD5fKwVPDrDK9j/xTu563AWuOmXois= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= -github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/gherkin/go/v22 v22.0.0/go.mod h1:3mJT10B2GGn3MvVPd3FwR7m2u4tLhSRhWUqJU4KN4Fg= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= -github.com/cucumber/common/messages/go/v17 v17.1.1/go.mod h1:bpGxb57tDE385Rb2EohgUadLkAbhoC4IyCFi89u/JQI= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= -github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/daixiang0/gci v0.8.1 h1:T4xpSC+hmsi4CSyuYfIJdMZAr9o7xZmHpQVygMghGZ4= -github.com/daixiang0/gci v0.8.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/daixiang0/gci v0.11.2 h1:Oji+oPsp3bQ6bNNgX30NBAVT18P4uBH4sRZnlOlTj7Y= +github.com/daixiang0/gci v0.11.2/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= github.com/derekparker/trie v0.0.0-20221213183930-4c74548207f4 h1:atN94qKNhLpy+9BwbE5nxvFj4rScJi6W3x/NfFmMDg4= @@ -379,51 +419,70 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUn github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/cli v23.0.3+incompatible h1:Zcse1DuDqBdgI7OQDV8Go7b83xLgfhW1eza4HfEdxpY= +github.com/docker/cli v23.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +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 v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= +github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= -github.com/emicklei/proto v1.11.1/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= -github.com/emicklei/proto v1.12.1 h1:6n/Z2pZAnBwuhU66Gs8160B8rrrYKo7h2F2sCOnNceE= -github.com/emicklei/proto v1.12.1/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= -github.com/emicklei/proto-contrib v0.14.0 h1:wFdptRZZ+JpkJtKTqOt2sXNPgwRGUkPzUL44cK9cMGE= -github.com/emicklei/proto-contrib v0.14.0/go.mod h1:fpwMx68czS8x9ithaRGdLioTAadH01LLmND1Mr+FvP0= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/emicklei/dot v1.6.0 h1:vUzuoVE8ipzS7QkES4UfxdpCwdU2U97m2Pb2tQCoYRY= +github.com/emicklei/dot v1.6.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/proto v1.12.2 h1:ZDyDzrfMt7ncmyor/j07uoOCGLKtU5F87vTPwIzLe/o= +github.com/emicklei/proto v1.12.2/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= +github.com/emicklei/proto-contrib v0.15.0 h1:5D8JKpV1qekMDFwEJp8NVJGY1We6t14dn9D4G05fpyo= +github.com/emicklei/proto-contrib v0.15.0/go.mod h1:p6zmoy14hFYiwUb35X7nJ4u4l1vfvjc1mWrIt8QB3kw= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= -github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g= +github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= @@ -433,29 +492,41 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= +github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= +github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= +github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= -github.com/go-critic/go-critic v0.6.5 h1:fDaR/5GWURljXwF8Eh31T2GZNz9X4jeboS912mWF8Uo= -github.com/go-critic/go-critic v0.6.5/go.mod h1:ezfP/Lh7MA6dBNn4c6ab5ALv3sKnZVLx37tr00uuaOY= -github.com/go-delve/delve v1.20.2 h1:rgPK7Iqb1oQk+i2Ilg0fpH6p5LqyixYiAt4N3Lhx4/Y= -github.com/go-delve/delve v1.20.2/go.mod h1:KQtnLRy2M+cNHCRnDzURxljVNbRTdvVDD5Mb10KGP18= +github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= +github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= +github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= +github.com/go-delve/delve v1.21.0 h1:npcc8TZhdVxaMSJon+zqcE3bXM/ck8SSOOWw/id13jI= +github.com/go-delve/delve v1.21.0/go.mod h1:U+OAdfhewudkHsVs/AwhfpSBu7t/NgIXH3+my4T5q78= github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d h1:pxjSLshkZJGLVm0wv20f/H0oTWiq/egkoJQ2ja6LEvo= github.com/go-delve/liner v1.2.3-0.20220127212407-d32d89dd2a5d/go.mod h1:biJCRbqp51wS+I92HMqn5H8/A0PAhxn2vyOT+JqhiGI= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= -github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= -github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= -github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.10.0 h1:F0x3xXrAWmhwtzoCokU4IMPcBdncG+HAAqi9FcOOjbQ= +github.com/go-git/go-git/v5 v5.10.0/go.mod h1:1FOZ/pQnqw24ghP2n7cunVl0ON55BsjPYvhWHvZGhoo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -466,6 +537,11 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -473,73 +549,91 @@ github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.2 h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0= -github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= -github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= +github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= +github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= +github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= -github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= -github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= +github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= +github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= +github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= +github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= +github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= +github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= +github.com/go-toolsmith/pkgload v1.2.2 h1:0CtmHq/02QhxcF7E9N5LIFcYFsMR5rdovfqTtRKkgIk= +github.com/go-toolsmith/pkgload v1.2.2/go.mod h1:R2hxLNRKuAsiXCo2i5J6ZQPhnPMOVtU+f0arbFPWCus= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= +github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= +github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= +github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= +github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= +github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobuffalo/flect v0.3.0 h1:erfPWM+K1rFNIQeRPdeEXxo8yFr/PO17lhRnS8FUrtk= github.com/gobuffalo/flect v0.3.0/go.mod h1:5pf3aGnsvqvCj50AVni7mJJF8ICxGZ8HomberC3pXLE= github.com/gobuffalo/genny/v2 v2.1.0 h1:cCRBbqzo3GfNvj3UetD16zRgUvWFEyyl0qTqquuIqOM= github.com/gobuffalo/genny/v2 v2.1.0/go.mod h1:4yoTNk4bYuP3BMM6uQKYPvtP6WsXFGm2w2EFYZdRls8= -github.com/gobuffalo/github_flavored_markdown v1.1.3 h1:rSMPtx9ePkFB22vJ+dH+m/EUBS8doQ3S8LeEXcdwZHk= github.com/gobuffalo/github_flavored_markdown v1.1.3/go.mod h1:IzgO5xS6hqkDmUh91BW/+Qxo/qYnvfzoz3A7uLkg77I= +github.com/gobuffalo/github_flavored_markdown v1.1.4 h1:WacrEGPXUDX+BpU1GM/Y0ADgMzESKNWls9hOTG1MHVs= +github.com/gobuffalo/github_flavored_markdown v1.1.4/go.mod h1:Vl9686qrVVQou4GrHRK/KOG3jCZOKLUqV8MMOAYtlso= github.com/gobuffalo/helpers v0.6.7 h1:C9CedoRSfgWg2ZoIkVXgjI5kgmSpL34Z3qdnzpfNVd8= github.com/gobuffalo/helpers v0.6.7/go.mod h1:j0u1iC1VqlCaJEEVkZN8Ia3TEzfj/zoXANqyJExTMTA= github.com/gobuffalo/logger v1.0.7 h1:LTLwWelETXDYyqF/ASf0nxaIcdEOIJNxRokPcfI/xbU= github.com/gobuffalo/logger v1.0.7/go.mod h1:u40u6Bq3VVvaMcy5sRBclD8SXhBYPS0Qk95ubt+1xJM= github.com/gobuffalo/packd v1.0.2 h1:Yg523YqnOxGIWCp69W12yYBKsoChwI7mtu6ceM9Bwfw= github.com/gobuffalo/packd v1.0.2/go.mod h1:sUc61tDqGMXON80zpKGp92lDb86Km28jfvX7IAyxFT8= -github.com/gobuffalo/plush/v4 v4.1.16 h1:Y6jVVTLdg1BxRXDIbTJz+J8QRzEAtv5ZwYpGdIFR7VU= github.com/gobuffalo/plush/v4 v4.1.16/go.mod h1:6t7swVsarJ8qSLw1qyAH/KbrcSTwdun2ASEQkOznakg= +github.com/gobuffalo/plush/v4 v4.1.19 h1:o0E5gEJw+ozkAwQoCeiaWC6VOU2lEmX+GhtGkwpqZ8o= +github.com/gobuffalo/plush/v4 v4.1.19/go.mod h1:WiKHJx3qBvfaDVlrv8zT7NCd3dEMaVR/fVxW4wqV17M= github.com/gobuffalo/tags/v3 v3.1.4 h1:X/ydLLPhgXV4h04Hp2xlbI2oc5MDaa7eub6zw8oHjsM= github.com/gobuffalo/tags/v3 v3.1.4/go.mod h1:ArRNo3ErlHO8BtdA0REaZxijuWnWzF6PUXngmMXd2I0= github.com/gobuffalo/validate/v3 v3.3.3 h1:o7wkIGSvZBYBd6ChQoLxkz2y1pfmhbI4jNJYh6PuNJ4= github.com/gobuffalo/validate/v3 v3.3.3/go.mod h1:YC7FsbJ/9hW/VjQdmXPvFqvRis4vrRYFxr69WiNZw6g= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/goccy/go-yaml v1.9.7 h1:D/Vx+JITklB1ugSkncB4BNR67M3X6AKs9+rqVeo3ddw= -github.com/goccy/go-yaml v1.9.7/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= +github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= -github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= +github.com/gofrs/uuid/v5 v5.0.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= -github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.1.0 h1:XUgk2Ex5veyVFVeLm0xhusUTQybEbexJXrvPNOKkSY0= +github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -574,6 +668,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -583,18 +678,18 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= -github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= -github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.50.1 h1:C829clMcZXEORakZlwpk7M4iDw2XiwxxKaG504SZ9zY= -github.com/golangci/golangci-lint v1.50.1/go.mod h1:AQjHBopYS//oB8xs0y0M/dtxdKHkdhl0RvmjUct0/4w= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= +github.com/golangci/golangci-lint v1.55.2 h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8= +github.com/golangci/golangci-lint v1.55.2/go.mod h1:H60CZ0fuqoTwlTvnbyjhpZPWp7KmsjwV2yupIMiMXbM= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.3.5 h1:pLzmVdl3VxTOncgzHcvLOKirdvcx/TydsClUQXTehjo= -github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= -github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= +github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= +github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= +github.com/golangci/revgrep v0.5.2 h1:EndcWoRhcnfj2NHQ+28hyuXpLMF+dQmCN+YaeeIl4FU= +github.com/golangci/revgrep v0.5.2/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -613,11 +708,15 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-dap v0.7.0 h1:088PdKBUkxAxrXrnY8FREUJXpS6Y6jhAyZIuJv3OGOM= -github.com/google/go-dap v0.7.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-containerregistry v0.14.0 h1:z58vMqHxuwvAsVwvKEkmVBz2TlgBgH5k6koEXBtlYkw= +github.com/google/go-containerregistry v0.14.0/go.mod h1:aiJ2fp/SXvkWgmYHioXnbMdlgB8eXiiYOY55gfN91Wk= +github.com/google/go-dap v0.9.1 h1:d8dETjgHMR9/xs+Xza+NrZmB7jxIS5OtM2uRsyJVA/c= +github.com/google/go-dap v0.9.1/go.mod h1:HAeyoSd2WIfTfg+0GRXcFrb+RnojAtGNh+k+XTIxJDE= github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE= github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= @@ -642,42 +741,49 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= +github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.3 h1:twfIhZs4QLCtimkP7MOxlF3A0U/5cDPseRT9M/+2SCE= -github.com/gookit/color v1.5.3/go.mod h1:NUzwzeehUfl7GIb36pqId+UGmRfQcU/WiiyTTeNjHtE= +github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= +github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= +github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= -github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k= +github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptRfGk= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= -github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= @@ -689,21 +795,21 @@ github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -713,17 +819,19 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= -github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= -github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.1 h1:rfPwUqFU6uZXNvGl4hzjY8LEBsqFVU4si1H9/Hqck/U= +github.com/hashicorp/go-metrics v0.5.1/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.9 h1:ESiK220/qE0aGxWdzKIvRH69iLiuN/PjoLTm69RoWtU= -github.com/hashicorp/go-plugin v1.4.9/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -731,8 +839,10 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -740,16 +850,16 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -761,10 +871,14 @@ github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3 github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= -github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= +github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/ignite/ignite-files/nodetime v0.0.2 h1:9Aj0OEa7FWI22J/Zdq7M2JvsjgFLngZSm7vB4i9X4t4= github.com/ignite/ignite-files/nodetime v0.0.2/go.mod h1:GKDsXdeazHyhSBPdVLp7mNIo/m9LmZ6/h8RmQ0/CoaM= github.com/ignite/ignite-files/protoc v0.0.1 h1:wXxU1dzruUgSVl1diAuAOA+xv0NQKXJFsDWht2+tAP8= @@ -772,51 +886,51 @@ github.com/ignite/ignite-files/protoc v0.0.1/go.mod h1:cVCHJbEHPIeKHMPk3ZoPS0Xw4 github.com/ignite/web v0.5.1 h1:xGOt8wJG7WIrNO30e8Zbm669VFyo6sje/vWnusLPp6k= github.com/ignite/web v0.5.1/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= -github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84 h1:2uT3aivO7NVpUPGcQX7RbHijHMyWix/yCnIrCWc+5co= +github.com/jdxcode/netrc v0.0.0-20221124155335-4616370d1a84/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= +github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA= +github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/ansi v1.0.2/go.mod h1:D2tT+6uzJvN1nBVQILYWkIdq7zG+b5gcFN5WI/VyjMY= github.com/jpillora/ansi v1.0.3 h1:nn4Jzti0EmRfDxm7JtEs5LzCbNwd5sv+0aE+LdS9/ZQ= github.com/jpillora/ansi v1.0.3/go.mod h1:D2tT+6uzJvN1nBVQILYWkIdq7zG+b5gcFN5WI/VyjMY= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jpillora/chisel v1.8.1 h1:mjxZRRskOzU0DIT3Hu79bjtX9BoBRcjLtuoaSIkyfcI= -github.com/jpillora/chisel v1.8.1/go.mod h1:jhzGKO7NT6pNc/qto8YrNBGnuWZdqswvY6+n4zwE/Zc= +github.com/jpillora/chisel v1.9.1 h1:nGOF58+45WHlvDcq6AZu7En8nWOBCZHqj9boo5rB4qU= +github.com/jpillora/chisel v1.9.1/go.mod h1:qvgGfFR9ZhiDoYJM4IM1omX1HLbQSkZag8miP9u4SsQ= github.com/jpillora/requestlog v1.0.0 h1:bg++eJ74T7DYL3DlIpiwknrtfdUA9oP/M4fL+PpqnyA= github.com/jpillora/requestlog v1.0.0/go.mod h1:HTWQb7QfDc2jtHnWe2XEIEeJB7gJPnVdpNn52HXPvy8= github.com/jpillora/sizestr v1.0.0 h1:4tr0FLxs1Mtq3TnsLDV+GYUWG7Q26a6s+tV5Zfw2ygw= github.com/jpillora/sizestr v1.0.0/go.mod h1:bUhLv4ctkknatr6gR42qPxirmd5+ds1u7mzD+MZ33f0= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -830,17 +944,21 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.6.2 h1:uGQ9xI8/pgc9iOoCe7kWQgRE6SBTrCGmTSf0LrEtY7c= -github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= +github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= +github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= -github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= +github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= +github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -855,31 +973,37 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= -github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= +github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= +github.com/kunwardeep/paralleltest v1.0.8/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M= -github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= +github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= +github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKiM= -github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= +github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= -github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= +github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linxGnu/grocksdb v1.8.4 h1:ZMsBpPpJNtRLHiKKp0mI7gW+NT4s7UgfD5xHxx1jVRo= +github.com/linxGnu/grocksdb v1.8.4/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/macabu/inamedparam v0.1.2 h1:RR5cnayM6Q7cDhQol32DE2BGAPGMnffJ31LFE+UklaU= +github.com/macabu/inamedparam v0.1.2/go.mod h1:Xg25QvY7IBRl1KLPV9Rbml8JOMZtF/iAkNkmV7eQgjw= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -888,31 +1012,33 @@ github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYt github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= -github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= -github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= +github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -921,28 +1047,26 @@ github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/meowgorithm/babyenv v1.3.0/go.mod h1:lwNX+J6AGBFqNrMZ2PTLkM6SO+W4X8DOg9zBDO4j3Ig= github.com/meowgorithm/babyenv v1.3.1 h1:18ZEYIgbzoFQfRLF9+lxjRfk/ui6w8U0FWl07CgWvvc= github.com/meowgorithm/babyenv v1.3.1/go.mod h1:lwNX+J6AGBFqNrMZ2PTLkM6SO+W4X8DOg9zBDO4j3Ig= -github.com/mgechev/revive v1.2.4 h1:+2Hd/S8oO2H0Ikq2+egtNwQsVhAeELHjxjIUFX5ajLI= -github.com/mgechev/revive v1.2.4/go.mod h1:iAWlQishqCuj4yhV24FTnKSXGpbAA+0SckXB8GQMX/Q= +github.com/mgechev/revive v1.3.4 h1:k/tO3XTaWY4DEHal9tWBkkUMJYO/dLDVyMmAQxmIMDc= +github.com/mgechev/revive v1.3.4/go.mod h1:W+pZCMu9qj8Uhfs1iJMQsEFLRozUfvwFwqVvRbSNLVw= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/microcosm-cc/bluemonday v1.0.4/go.mod h1:8iwZnFn2CDDNZ0r6UXhF4xawGvzaqzCRa1n3/lO3W2w= -github.com/microcosm-cc/bluemonday v1.0.20 h1:flpzsq4KU3QIYAYGV/szUat7H+GPOXR0B2JU5A1Wp8Y= github.com/microcosm-cc/bluemonday v1.0.20/go.mod h1:yfBmMi8mxvaZut3Yytv+jTXRY8mxyjJ0/kQBTElld50= +github.com/microcosm-cc/bluemonday v1.0.22/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM= +github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= +github.com/microcosm-cc/bluemonday v1.0.23/go.mod h1:mN70sk7UkkF8TUr2IGBpNN0jAgStuPzlK76QuruE/z4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a h1:eU8j/ClY2Ty3qdHnn0TyW3ivFoPC/0F1gQZz8yTxbbE= github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a/go.mod h1:v8eSC2SMp9/7FTKUncp7fH9IwPfw+ysMObcEz5FWheQ= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -958,25 +1082,29 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= -github.com/moby/moby v24.0.1+incompatible h1:VzcmrGPwKZLMsjylQP6yqYz3D+MTwFnPt2BDAPYuzQE= -github.com/moby/moby v24.0.1+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= -github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= -github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/moby v24.0.7+incompatible h1:RrVT5IXBn85mRtFKP+gFwVLCcnNPZIgN3NVRJG9Le+4= +github.com/moby/moby v24.0.7+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= +github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= +github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= -github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= +github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= +github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/gitcha v0.2.0 h1:+wOgT2dI9s2Tznj1t1rb/qkK5e0cb6qD8c4IX2TR/YY= @@ -994,28 +1122,41 @@ github.com/muesli/termenv v0.7.2/go.mod h1:ct2L5N2lmix82RaY3bMWwVu/jUFc9Ule0KGDC github.com/muesli/termenv v0.7.4/go.mod h1:pZ7qY9l3F7e5xsAOS0zCew2tME+p7bWeBkotCEcIIcc= github.com/muesli/termenv v0.8.1/go.mod h1:kzt/D/4a88RoheZmwfqorY3A+tnsSMA9HJC/fQSFKo0= github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= -github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc= -github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs= -github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ= +github.com/muesli/termenv v0.14.0 h1:8x9NFfOe8lmIWK4pgy3IfVEy47f+ppe3tUqdPZG2Uy0= +github.com/muesli/termenv v0.14.0/go.mod h1:kG/pF1E7fh949Xhe156crRUrHNyK221IuGO7Ez60Uc8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= -github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.8.3 h1:pw5O09vwg8ZaditDp/nQRqVnrMczSJDxRDJMowvhsrM= -github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= +github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= +github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/nqd/flat v0.2.0 h1:g6lXtMxsxrz6PZOO+rNnAJUn/GGRrK4FgVEhy/v+cHI= github.com/nqd/flat v0.2.0/go.mod h1:FOuslZmNY082wVfVUUb7qAGWKl8z8Nor9FMg+Xj2Nss= +github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA= +github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9c0Wka2fGsDkzWg= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -1024,148 +1165,173 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= -github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= +github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= +github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc= -github.com/otiai10/copy v1.11.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= +github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= +github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us= -github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= +github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA= +github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.0.5 h1:AHB5JRCjlmelh9RrLxT9sgzpalIwwq4hqE8EkwIwKdY= -github.com/polyfloyd/go-errorlint v1.0.5/go.mod h1:APVvOesVSAnne5SClsPxPdfvZTVDojXh1/G3qb5wjGI= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/polyfloyd/go-errorlint v1.4.5 h1:70YWmMy4FgRHehGNOUask3HtSFSOLKgmDn7ryNe7LqI= +github.com/polyfloyd/go-errorlint v1.4.5/go.mod h1:sIZEbFoDOCnTYYZoVkjc4hTnM459tuWA9H/EkdXwsKk= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE= -github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs= -github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f h1:6Gtn2i04RD0gVyYf2/IUMTIs+qYleBt4zxDqkLTcu4U= -github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= +github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= +github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= +github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE= github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= -github.com/regen-network/gocuke v0.6.2/go.mod h1:zYaqIHZobHyd0xOrHGPQjbhGJsuZ1oElx150u2o1xuk= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= -github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= +github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.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 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.2.4 h1:CpMSDKan0LtNGGhPrvupAoLeObRFjND8/tU1rEOtBp4= -github.com/ryancurrah/gomodguard v1.2.4/go.mod h1:+Kem4VjWwvFpUJRJSwa16s1tBJe+vbv02+naTow2f6M= -github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= -github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= +github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= +github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= +github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= +github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 h1:G04eS0JkAIVZfaJLjla9dNxkJCPiKIGZlw9AfOhzOD0= github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b18R55ulyQ/h3RaWyloPyER7fWQVZvimKKhnI5OfrJQ= github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= -github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= +github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.20.0 h1:K6CXjqqtSYSsuyRDDC7Sjn6vTMLiSJa4ZmDkiokoqtw= -github.com/sashamelentyev/usestdlibvars v1.20.0/go.mod h1:0GaP+ecfZMXShS0A94CJn6aEuPRILv8h/VuWI9n1ygg= +github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= +github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.13.1 h1:7mU32qn2dyC81MH9L2kefnQyRMUarfDER3iQyMHcjYM= -github.com/securego/gosec/v2 v2.13.1/go.mod h1:EO1sImBMBWFjOTFzMWfTRrZW6M15gm60ljzrmy/wtHo= +github.com/securego/gosec/v2 v2.18.2 h1:DkDt3wCiOtAHf1XkiXZBhQ6m6mK/b9T/wD257R3/c+I= +github.com/securego/gosec/v2 v2.18.2/go.mod h1:xUuqSF6i0So56Y2wwohWAmB07EdBkUN6crbLlHwbyJs= github.com/segmentio/ksuid v1.0.3 h1:FoResxvleQwYiPAVKe1tMUlEirodZqlqglIuFsdDntY= github.com/segmentio/ksuid v1.0.3/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= @@ -1179,26 +1345,26 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= -github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= -github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= +github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= -github.com/sivchari/tenv v1.7.0 h1:d4laZMBK6jpe5PWepxlV9S+LC0yXqvYHiq8E6ceoVVE= -github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= -github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE= -github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= +github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= +github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= +github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= -github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= +github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= +github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= -github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= +github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= +github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1210,14 +1376,16 @@ github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -1225,18 +1393,20 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= +github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1244,65 +1414,79 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tbruyelle/mdgofmt v0.1.3 h1:ZQo2nbYhK7CG0kApQmgUeMBFugIgIO9tHvyChaMzf30= github.com/tbruyelle/mdgofmt v0.1.3/go.mod h1:D3fyKvx4oZq99YeQm5j/gnGmc9w4HogvQMujPVzW+zQ= -github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= -github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= +github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= -github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= -github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= -github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= -github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= +github.com/tetafro/godot v1.4.15 h1:QzdIs+XB8q+U1WmQEWKHQbKmCw06QuQM7gLx/dky2RM= +github.com/tetafro/godot v1.4.15/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= +github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= +github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.7.0 h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA= -github.com/tomarrell/wrapcheck/v2 v2.7.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= +github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= -github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= +github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y= -github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= -github.com/vektra/mockery/v2 v2.27.1 h1:WwNWAI9sMhu67F+T52wC+Hv3jhiw/q0OM9OPeQERsmA= -github.com/vektra/mockery/v2 v2.27.1/go.mod h1:FUBSKmv4ag6srzkUcs3Av6fPEbXoXnGJEQiYpoF1ZpY= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= +github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= +github.com/vbatts/tar-split v0.11.2 h1:Via6XqJr0hceW4wff3QRzD5gAk/tatMw/4ZA7cTlIME= +github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI= +github.com/vektra/mockery/v2 v2.36.1 h1:F/2tEFFRWdHe36smr+e6YIiKzXTZVd0cCAUqG0GTw1s= +github.com/vektra/mockery/v2 v2.36.1/go.mod h1:diB13hxXG6QrTR0ol2Rk8s2dRMftzvExSvPDKr+IYKk= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= +github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= -github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= +github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= +github.com/ykadowak/zerologlint v0.1.3 h1:TLy1dTW3Nuc+YE3bYRPToG1Q9Ej78b5UUN6bjbGdxPE= +github.com/ykadowak/zerologlint v0.1.3/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1314,15 +1498,23 @@ github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark-emoji v1.0.1 h1:ctuWEyzGBwiucEqxzwe0SOYDXPAucOrE9NQC18Wa1os= github.com/yuin/goldmark-emoji v1.0.1/go.mod h1:2w1E6FEWLcDQkoTE+7HU6QF1F6SLlNGjRIBbIZQFqkQ= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= -gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= -gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= +gitlab.com/bosi/decorder v0.4.1 h1:VdsdfxhstabyhZovHafFw+9eJ6eU0d2CkFNJcZz/NU4= +gitlab.com/bosi/decorder v0.4.1/go.mod h1:jecSqWUew6Yle1pCr2eLWTensJMmsxHsBwt+PVbkAqA= +go-simpler.org/assert v0.6.0 h1:QxSrXa4oRuo/1eHMXSBFHKvJIpWABayzKldqZyugG7E= +go-simpler.org/assert v0.6.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= +go-simpler.org/sloglint v0.1.2 h1:IjdhF8NPxyn0Ckn2+fuIof7ntSnVUAqBFcQRrnG9AiM= +go-simpler.org/sloglint v0.1.2/go.mod h1:2LL+QImPfTslD5muNPydAEYmpXIj6o/WYcqnJjLi4o4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1331,49 +1523,63 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= +go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= +go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= +go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.starlark.net v0.0.0-20220816155156-cfacd8902214 h1:MqijAN3S61c7KWasOk+zIqIjHQPN6WUra/X3+YAkQxQ= go.starlark.net v0.0.0-20220816155156-cfacd8902214/go.mod h1:VZcBMdr3cT3PnBoWunTabuSEXwVAH+ZJ5zxfs3AdASk= +go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= +go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= -go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= +go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= -go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 h1:QlVATYS7JBoZMVaf+cNjb90WD/beKVHnIxFKT4QaHVI= golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= -golang.org/x/arch v0.1.0 h1:oMxhUYsO9VsR1dcoVUjJjIGhx1LXol3989T/yZ59Xsw= -golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1384,12 +1590,13 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230519143937-03e91628a987 h1:3xJIFvzUFbu4ls0BTBYcgbCGhA63eAOEMxIHugyXJqA= -golang.org/x/exp v0.0.0-20230519143937-03e91628a987/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w= +golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE= -golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1418,10 +1625,10 @@ golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1430,6 +1637,7 @@ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1441,6 +1649,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1448,6 +1657,7 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -1464,18 +1674,21 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1486,8 +1699,8 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1502,8 +1715,9 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1524,13 +1738,14 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1543,6 +1758,7 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1564,81 +1780,90 @@ golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1649,8 +1874,9 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1660,8 +1886,8 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1674,30 +1900,22 @@ golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1706,23 +1924,25 @@ golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0t golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/vuln v0.1.0 h1:9GRdj6wAIkDrsMevuolY+SXERPjQPp2P1ysYA0jpZe0= -golang.org/x/vuln v0.1.0/go.mod h1:/YuzZYjGbwB8y19CisAppfyw3uTZnuCz3r+qgx/QRzU= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= +golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1742,9 +1962,10 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= +google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= +google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -1758,6 +1979,7 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1790,14 +2012,24 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b h1:+YaDE2r2OG8t/z5qmsh7Y+XXwCbvadxxZ0YY6mTdrVA= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= +google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a h1:myvhA4is3vrit1a6NZCWBIwN0kNEnX21DJOJX/NvIfI= +google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:SUBoKXbI1Efip18FClrQVGjWcyd0QZd8KkvdP34t7ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -1807,12 +2039,16 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= -google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1825,18 +2061,21 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1860,9 +2099,9 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1870,8 +2109,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= -honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= +honnef.co/go/tools v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8= +honnef.co/go/tools v0.4.6/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= @@ -1882,11 +2121,13 @@ mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8 h1:VuJo4Mt0EVPychre4fNlDWDuE mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8/go.mod h1:Oh/d7dEtzsNHGOq1Cdv8aMm3KdKhVvPbRQcM8WFpBR8= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/ignite/cmd/generate.go b/ignite/cmd/generate.go index 4b6bec9e0f..4e3ad4d602 100644 --- a/ignite/cmd/generate.go +++ b/ignite/cmd/generate.go @@ -2,6 +2,11 @@ package ignitecmd import ( "github.com/spf13/cobra" + flag "github.com/spf13/pflag" +) + +const ( + flagEnableProtoVendor = "enable-proto-vendor" ) // NewGenerate returns a command that groups code generation related sub commands. @@ -22,10 +27,12 @@ meant to be edited by hand. PersistentPreRunE: migrationPreRunHandler, } + c.PersistentFlags().AddFlagSet(flagSetEnableProtoVendor()) + flagSetPath(c) flagSetClearCache(c) + c.AddCommand(NewGenerateGo()) - c.AddCommand(NewGeneratePulsar()) c.AddCommand(NewGenerateTSClient()) c.AddCommand(NewGenerateVuex()) c.AddCommand(NewGenerateComposables()) @@ -34,3 +41,14 @@ meant to be edited by hand. return c } + +func flagSetEnableProtoVendor() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.Bool(flagEnableProtoVendor, false, "enable proto package vendor for missing Buf dependencies") + return fs +} + +func flagGetEnableProtoVendor(cmd *cobra.Command) bool { + skip, _ := cmd.Flags().GetBool(flagEnableProtoVendor) + return skip +} diff --git a/ignite/cmd/generate_composables.go b/ignite/cmd/generate_composables.go index 67de559cd7..258a9acc47 100644 --- a/ignite/cmd/generate_composables.go +++ b/ignite/cmd/generate_composables.go @@ -44,7 +44,13 @@ func generateComposablesHandler(cmd *cobra.Command, _ []string) error { return err } - if err := c.Generate(cmd.Context(), cacheStorage, chain.GenerateComposables(output)); err != nil { + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateComposables(output), opts...) + if err != nil { return err } diff --git a/ignite/cmd/generate_go.go b/ignite/cmd/generate_go.go index 677f202b8a..263ebd388b 100644 --- a/ignite/cmd/generate_go.go +++ b/ignite/cmd/generate_go.go @@ -39,7 +39,13 @@ func generateGoHandler(cmd *cobra.Command, _ []string) error { return err } - if err := c.Generate(cmd.Context(), cacheStorage, chain.GenerateGo()); err != nil { + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateGo(), opts...) + if err != nil { return err } diff --git a/ignite/cmd/generate_hooks.go b/ignite/cmd/generate_hooks.go index 0af0be9d78..76f125f498 100644 --- a/ignite/cmd/generate_hooks.go +++ b/ignite/cmd/generate_hooks.go @@ -44,7 +44,13 @@ func generateHooksHandler(cmd *cobra.Command, _ []string) error { return err } - if err := c.Generate(cmd.Context(), cacheStorage, chain.GenerateHooks(output)); err != nil { + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateHooks(output), opts...) + if err != nil { return err } diff --git a/ignite/cmd/generate_openapi.go b/ignite/cmd/generate_openapi.go index 6b4e1e00c1..e0795e0d06 100644 --- a/ignite/cmd/generate_openapi.go +++ b/ignite/cmd/generate_openapi.go @@ -39,7 +39,13 @@ func generateOpenAPIHandler(cmd *cobra.Command, _ []string) error { return err } - if err := c.Generate(cmd.Context(), cacheStorage, chain.GenerateOpenAPI()); err != nil { + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateOpenAPI(), opts...) + if err != nil { return err } diff --git a/ignite/cmd/generate_pulsar.go b/ignite/cmd/generate_pulsar.go deleted file mode 100644 index 2c05104954..0000000000 --- a/ignite/cmd/generate_pulsar.go +++ /dev/null @@ -1,47 +0,0 @@ -package ignitecmd - -import ( - "github.com/spf13/cobra" - - "github.com/ignite/cli/ignite/pkg/cliui" - "github.com/ignite/cli/ignite/pkg/cliui/icons" - "github.com/ignite/cli/ignite/services/chain" -) - -func NewGeneratePulsar() *cobra.Command { - c := &cobra.Command{ - Use: "proto-pulsar", - Short: "Compile protocol buffer files to Go pulsar source code required by Cosmos SDK", - RunE: generatePulsarHandler, - } - - c.Flags().AddFlagSet(flagSetYes()) - - return c -} - -func generatePulsarHandler(cmd *cobra.Command, _ []string) error { - session := cliui.New(cliui.StartSpinnerWithText(statusGenerating)) - defer session.End() - - c, err := newChainWithHomeFlags( - cmd, - chain.WithOutputer(session), - chain.CollectEvents(session.EventBus()), - chain.CheckCosmosSDKVersion(), - ) - if err != nil { - return err - } - - cacheStorage, err := newCache(cmd) - if err != nil { - return err - } - - if err := c.Generate(cmd.Context(), cacheStorage, chain.GeneratePulsar()); err != nil { - return err - } - - return session.Println(icons.OK, "Generated Go pulsar code") -} diff --git a/ignite/cmd/generate_typescript_client.go b/ignite/cmd/generate_typescript_client.go index ed1bc5a1ae..3bb349ca73 100644 --- a/ignite/cmd/generate_typescript_client.go +++ b/ignite/cmd/generate_typescript_client.go @@ -73,7 +73,12 @@ func generateTSClientHandler(cmd *cobra.Command, _ []string) error { return err } - err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateTSClient(output, useCache)) + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateTSClient(output, useCache), opts...) if err != nil { return err } diff --git a/ignite/cmd/generate_vuex.go b/ignite/cmd/generate_vuex.go index a28ea1ee64..41880b4aa3 100644 --- a/ignite/cmd/generate_vuex.go +++ b/ignite/cmd/generate_vuex.go @@ -45,7 +45,13 @@ func generateVuexHandler(cmd *cobra.Command, _ []string) error { return err } - if err := c.Generate(cmd.Context(), cacheStorage, chain.GenerateVuex(output)); err != nil { + var opts []chain.GenerateTarget + if flagGetEnableProtoVendor(cmd) { + opts = append(opts, chain.GenerateProtoVendor()) + } + + err = c.Generate(cmd.Context(), cacheStorage, chain.GenerateVuex(output), opts...) + if err != nil { return err } diff --git a/ignite/cmd/node.go b/ignite/cmd/node.go index 877b309061..64e6f9c68c 100644 --- a/ignite/cmd/node.go +++ b/ignite/cmd/node.go @@ -10,7 +10,7 @@ import ( const ( flagNode = "node" - cosmosRPCAddress = "https://rpc.cosmos.network:443" + cosmosRPCAddress = "https://rpc.cosmos.directory:443/cosmoshub" ) func NewNode() *cobra.Command { diff --git a/ignite/cmd/plugin.go b/ignite/cmd/plugin.go index eb51cfb319..21078b9318 100644 --- a/ignite/cmd/plugin.go +++ b/ignite/cmd/plugin.go @@ -64,7 +64,7 @@ func LoadPlugins(ctx context.Context, cmd *cobra.Command) error { return nil } - return linkPlugins(rootCmd, plugins) + return linkPlugins(ctx, rootCmd, plugins) } func parseLocalPlugins(cmd *cobra.Command) (*pluginsconfig.Config, error) { @@ -103,7 +103,7 @@ func parseGlobalPlugins() (cfg *pluginsconfig.Config, err error) { return } -func linkPlugins(rootCmd *cobra.Command, plugins []*plugin.Plugin) error { +func linkPlugins(ctx context.Context, rootCmd *cobra.Command, plugins []*plugin.Plugin) error { // Link plugins to related commands var linkErrors []*plugin.Plugin for _, p := range plugins { @@ -111,30 +111,37 @@ func linkPlugins(rootCmd *cobra.Command, plugins []*plugin.Plugin) error { linkErrors = append(linkErrors, p) continue } - manifest, err := p.Interface.Manifest() + + manifest, err := p.Interface.Manifest(ctx) if err != nil { - p.Error = fmt.Errorf("Manifest() error: %w", err) + p.Error = err + linkErrors = append(linkErrors, p) continue } + linkPluginHooks(rootCmd, p, manifest.Hooks) if p.Error != nil { linkErrors = append(linkErrors, p) continue } + linkPluginCmds(rootCmd, p, manifest.Commands) if p.Error != nil { linkErrors = append(linkErrors, p) continue } } + if len(linkErrors) > 0 { // unload any plugin that could have been loaded defer UnloadPlugins() - if err := printPlugins(cliui.New(cliui.WithStdout(os.Stdout))); err != nil { + + if err := printPlugins(ctx, cliui.New(cliui.WithStdout(os.Stdout))); err != nil { // content of loadErrors is more important than a print error, so we don't // return here, just print the error. fmt.Printf("fail to print: %v\n", err) } + var s strings.Builder for _, p := range linkErrors { fmt.Fprintf(&s, "%s: %v", p.Path, p.Error) @@ -152,7 +159,7 @@ func UnloadPlugins() { } } -func linkPluginHooks(rootCmd *cobra.Command, p *plugin.Plugin, hooks []plugin.Hook) { +func linkPluginHooks(rootCmd *cobra.Command, p *plugin.Plugin, hooks []*plugin.Hook) { if p.Error != nil { return } @@ -161,8 +168,8 @@ func linkPluginHooks(rootCmd *cobra.Command, p *plugin.Plugin, hooks []plugin.Ho } } -func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) { - cmdPath := hook.PlaceHookOnFull() +func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook *plugin.Hook) { + cmdPath := hook.CommandPath() cmd := findCommandByPath(rootCmd, cmdPath) if cmd == nil { p.Error = errors.Errorf("unable to find command path %q for app hook %q", cmdPath, hook.Name) @@ -173,30 +180,38 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) return } - newExecutedHook := func(hook plugin.Hook, cmd *cobra.Command, args []string) plugin.ExecutedHook { - execHook := plugin.ExecutedHook{ + newExecutedHook := func(hook *plugin.Hook, cmd *cobra.Command, args []string) *plugin.ExecutedHook { + execHook := &plugin.ExecutedHook{ Hook: hook, - ExecutedCommand: plugin.ExecutedCommand{ + ExecutedCommand: &plugin.ExecutedCommand{ Use: cmd.Use, Path: cmd.CommandPath(), Args: args, - OSArgs: os.Args, + OsArgs: os.Args, With: p.With, }, } - execHook.ExecutedCommand.SetFlags(cmd) + execHook.ExecutedCommand.ImportFlags(cmd) return execHook } preRun := cmd.PreRunE cmd.PreRunE = func(cmd *cobra.Command, args []string) error { + ctx := cmd.Context() + if preRun != nil { err := preRun(cmd, args) if err != nil { return err } } - err := p.Interface.ExecuteHookPre(newExecutedHook(hook, cmd, args)) + + execHook := newExecutedHook(hook, cmd, args) + c, err := newChainWithHomeFlags(cmd) + if err != nil { + return err + } + err = p.Interface.ExecuteHookPre(ctx, execHook, plugin.NewClientAPI(c)) if err != nil { return fmt.Errorf("app %q ExecuteHookPre() error: %w", p.Path, err) } @@ -210,7 +225,13 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) err := runCmd(cmd, args) // if the command has failed the `PostRun` will not execute. here we execute the cleanup step before returnning. if err != nil { - err := p.Interface.ExecuteHookCleanUp(newExecutedHook(hook, cmd, args)) + ctx := cmd.Context() + execHook := newExecutedHook(hook, cmd, args) + c, err := newChainWithHomeFlags(cmd) + if err != nil { + return err + } + err = p.Interface.ExecuteHookCleanUp(ctx, execHook, plugin.NewClientAPI(c)) if err != nil { cmd.Printf("app %q ExecuteHookCleanUp() error: %v", p.Path, err) } @@ -224,10 +245,16 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) postCmd := cmd.PostRunE cmd.PostRunE = func(cmd *cobra.Command, args []string) error { + ctx := cmd.Context() execHook := newExecutedHook(hook, cmd, args) + c, err := newChainWithHomeFlags(cmd) + if err != nil { + return err + } + defer func() { - err := p.Interface.ExecuteHookCleanUp(execHook) + err := p.Interface.ExecuteHookCleanUp(ctx, execHook, plugin.NewClientAPI(c)) if err != nil { cmd.Printf("app %q ExecuteHookCleanUp() error: %v", p.Path, err) } @@ -241,7 +268,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) } } - err := p.Interface.ExecuteHookPost(execHook) + err = p.Interface.ExecuteHookPost(ctx, execHook, plugin.NewClientAPI(c)) if err != nil { return fmt.Errorf("app %q ExecuteHookPost() error : %w", p.Path, err) } @@ -251,7 +278,7 @@ func linkPluginHook(rootCmd *cobra.Command, p *plugin.Plugin, hook plugin.Hook) // linkPluginCmds tries to add the plugin commands to the legacy ignite // commands. -func linkPluginCmds(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmds []plugin.Command) { +func linkPluginCmds(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmds []*plugin.Command) { if p.Error != nil { return } @@ -263,8 +290,8 @@ func linkPluginCmds(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmds []plugi } } -func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd plugin.Command) { - cmdPath := pluginCmd.PlaceCommandUnderFull() +func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd *plugin.Command) { + cmdPath := pluginCmd.Path() cmd := findCommandByPath(rootCmd, cmdPath) if cmd == nil { p.Error = errors.Errorf("unable to find command path %q for app %q", cmdPath, p.Path) @@ -302,17 +329,22 @@ func linkPluginCmd(rootCmd *cobra.Command, p *plugin.Plugin, pluginCmd plugin.Co if len(pluginCmd.Commands) == 0 { // pluginCmd has no sub commands, so it's runnable newCmd.RunE = func(cmd *cobra.Command, args []string) error { - return clictx.Do(cmd.Context(), func() error { - execCmd := plugin.ExecutedCommand{ + ctx := cmd.Context() + return clictx.Do(ctx, func() error { + execCmd := &plugin.ExecutedCommand{ Use: cmd.Use, Path: cmd.CommandPath(), Args: args, - OSArgs: os.Args, + OsArgs: os.Args, With: p.With, } - execCmd.SetFlags(cmd) + execCmd.ImportFlags(cmd) // Call the plugin Execute - err := p.Interface.Execute(execCmd) + c, err := newChainWithHomeFlags(cmd) + if err != nil { + return err + } + err = p.Interface.Execute(ctx, execCmd, plugin.NewClientAPI(c)) // NOTE(tb): This pause gives enough time for go-plugin to sync the // output from stdout/stderr of the plugin. Without that pause, this // output can be discarded and not printed in the user console. @@ -369,7 +401,7 @@ func NewAppList() *cobra.Command { Long: "Prints status and information of all installed Ignite Apps.", RunE: func(cmd *cobra.Command, args []string) error { s := cliui.New(cliui.WithStdout(os.Stdout)) - return printPlugins(s) + return printPlugins(cmd.Context(), s) }, } return lstCmd @@ -568,7 +600,7 @@ A git repository will be created with the given module name, unless the current return err } moduleName := args[0] - path, err := plugin.Scaffold(wd, moduleName, false) + path, err := plugin.Scaffold(cmd.Context(), wd, moduleName, false) if err != nil { return err } @@ -605,10 +637,11 @@ func NewAppDescribe() *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { s := cliui.New(cliui.WithStdout(os.Stdout)) + ctx := cmd.Context() for _, p := range plugins { if p.Path == args[0] { - manifest, err := p.Interface.Manifest() + manifest, err := p.Interface.Manifest(ctx) if err != nil { return fmt.Errorf("error while loading app manifest: %w", err) } @@ -616,7 +649,7 @@ func NewAppDescribe() *cobra.Command { if len(manifest.Commands) > 0 { s.Println("Commands:") for i, c := range manifest.Commands { - cmdPath := fmt.Sprintf("%s %s", c.PlaceCommandUnderFull(), c.Use) + cmdPath := fmt.Sprintf("%s %s", c.Path(), c.Use) s.Printf(" %d) %s\n", i+1, cmdPath) } } @@ -624,7 +657,7 @@ func NewAppDescribe() *cobra.Command { if len(manifest.Hooks) > 0 { s.Println("Hooks:") for i, h := range manifest.Hooks { - s.Printf(" %d) '%s' on command '%s'\n", i+1, h.Name, h.PlaceHookOnFull()) + s.Printf(" %d) '%s' on command '%s'\n", i+1, h.Name, h.CommandPath()) } } @@ -644,12 +677,12 @@ func getPluginLocationName(p *plugin.Plugin) string { return "local" } -func getPluginStatus(p *plugin.Plugin) string { +func getPluginStatus(ctx context.Context, p *plugin.Plugin) string { if p.Error != nil { return fmt.Sprintf("%s Error: %v", icons.NotOK, p.Error) } - _, err := p.Interface.Manifest() + _, err := p.Interface.Manifest(ctx) if err != nil { return fmt.Sprintf("%s Error: Manifest() returned %v", icons.NotOK, err) } @@ -657,10 +690,10 @@ func getPluginStatus(p *plugin.Plugin) string { return fmt.Sprintf("%s Loaded", icons.OK) } -func printPlugins(session *cliui.Session) error { +func printPlugins(ctx context.Context, session *cliui.Session) error { var entries [][]string for _, p := range plugins { - entries = append(entries, []string{p.Path, getPluginLocationName(p), getPluginStatus(p)}) + entries = append(entries, []string{p.Path, getPluginLocationName(p), getPluginStatus(ctx, p)}) } if err := session.PrintTable([]string{"Path", "Config", "Status"}, entries...); err != nil { diff --git a/ignite/cmd/plugin_default.go b/ignite/cmd/plugin_default.go index 6d9b995704..747f6999ba 100644 --- a/ignite/cmd/plugin_default.go +++ b/ignite/cmd/plugin_default.go @@ -16,7 +16,7 @@ type defaultPlugin struct { } const ( - PluginNetworkVersion = "v0.1.1" + PluginNetworkVersion = "v0.2.0" PluginNetworkPath = "github.com/ignite/cli-plugin-network@" + PluginNetworkVersion ) @@ -90,7 +90,7 @@ func newPluginInstallCmd(dp defaultPlugin) *cobra.Command { // Remove this command before call to linkPlugins because a plugin is // usually not allowed to override an existing command. rootCmd.RemoveCommand(cmd) - if err := linkPlugins(rootCmd, plugins); err != nil { + if err := linkPlugins(cmd.Context(), rootCmd, plugins); err != nil { return err } // Execute the command diff --git a/ignite/cmd/plugin_test.go b/ignite/cmd/plugin_test.go index e8e154f62f..c0e4e13eca 100644 --- a/ignite/cmd/plugin_test.go +++ b/ignite/cmd/plugin_test.go @@ -1,6 +1,7 @@ package ignitecmd import ( + "context" "fmt" "io" "os" @@ -18,7 +19,7 @@ import ( "github.com/ignite/cli/ignite/services/plugin/mocks" ) -func buildRootCmd() *cobra.Command { +func buildRootCmd(ctx context.Context) *cobra.Command { var ( rootCmd = &cobra.Command{ Use: "ignite", @@ -39,24 +40,34 @@ func buildRootCmd() *cobra.Command { scaffoldCmd.AddCommand(scaffoldChainCmd) scaffoldCmd.AddCommand(scaffoldModuleCmd) rootCmd.AddCommand(scaffoldCmd) + rootCmd.SetContext(ctx) return rootCmd } -func assertFlags(t *testing.T, expectedFlags []plugin.Flag, execCmd plugin.ExecutedCommand) { +func assertFlags(t *testing.T, expectedFlags []*plugin.Flag, execCmd *plugin.ExecutedCommand) { var ( have []string expected []string ) - execCmd.Flags().VisitAll(func(f *pflag.Flag) { + + t.Helper() + + flags, err := execCmd.NewFlags() + assert.NoError(t, err) + + flags.VisitAll(func(f *pflag.Flag) { if f.Name == "help" { // ignore help flag return } + have = append(have, f.Name) }) + for _, f := range expectedFlags { expected = append(expected, f.Name) } + assert.Equal(t, expected, have) } @@ -65,49 +76,53 @@ func TestLinkPluginCmds(t *testing.T) { args = []string{"arg1", "arg2"} pluginParams = map[string]string{"key": "val"} // define a plugin with command flags - pluginWithFlags = plugin.Command{ + pluginWithFlags = &plugin.Command{ Use: "flaggy", - Flags: []plugin.Flag{ + Flags: []*plugin.Flag{ {Name: "flag1", Type: plugin.FlagTypeString}, - {Name: "flag2", Type: plugin.FlagTypeInt}, + {Name: "flag2", Type: plugin.FlagTypeInt, DefaultValue: "0"}, }, } ) // helper to assert pluginInterface.Execute() calls - expectExecute := func(t *testing.T, p *mocks.PluginInterface, cmd plugin.Command) { - p.EXPECT().Execute( - mock.MatchedBy(func(execCmd plugin.ExecutedCommand) bool { - return cmd.Use == execCmd.Use - }), - ).Run(func(execCmd plugin.ExecutedCommand) { - // Assert execCmd is populated correctly - assert.True(t, strings.HasSuffix(execCmd.Path, cmd.Use), "wrong path %s", execCmd.Path) - assert.Equal(t, args, execCmd.Args) - assertFlags(t, cmd.Flags, execCmd) - assert.Equal(t, pluginParams, execCmd.With) - }).Return(nil) + expectExecute := func(t *testing.T, ctx context.Context, p *mocks.PluginInterface, cmd *plugin.Command) { + t.Helper() + p.EXPECT(). + Execute( + mock.Anything, + mock.MatchedBy(func(execCmd *plugin.ExecutedCommand) bool { + fmt.Println(cmd.Use == execCmd.Use, cmd.Use, execCmd.Use) + return cmd.Use == execCmd.Use + }), + mock.Anything, + ). + Run(func(_ context.Context, execCmd *plugin.ExecutedCommand, _ plugin.ClientAPI) { + // Assert execCmd is populated correctly + assert.True(t, strings.HasSuffix(execCmd.Path, cmd.Use), "wrong path %s", execCmd.Path) + assert.Equal(t, args, execCmd.Args) + assertFlags(t, cmd.Flags, execCmd) + assert.Equal(t, pluginParams, execCmd.With) + }). + Return(nil) } tests := []struct { name string - setup func(*testing.T, *mocks.PluginInterface) + setup func(*testing.T, context.Context, *mocks.PluginInterface) expectedDumpCmd string expectedError string }{ { name: "ok: link foo at root", - setup: func(t *testing.T, p *mocks.PluginInterface) { - cmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + cmd := &plugin.Command{ Use: "foo", } - p.EXPECT().Manifest().Return( - plugin.Manifest{ - Commands: []plugin.Command{cmd}, - }, - nil, - ) - expectExecute(t, p, cmd) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Commands: []*plugin.Command{cmd}}, nil) + expectExecute(t, ctx, p, cmd) }, expectedDumpCmd: ` ignite @@ -119,13 +134,15 @@ ignite }, { name: "ok: link foo at subcommand", - setup: func(t *testing.T, p *mocks.PluginInterface) { - cmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + cmd := &plugin.Command{ Use: "foo", PlaceCommandUnder: "ignite scaffold", } - p.EXPECT().Manifest().Return(plugin.Manifest{Commands: []plugin.Command{cmd}}, nil) - expectExecute(t, p, cmd) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Commands: []*plugin.Command{cmd}}, nil) + expectExecute(t, ctx, p, cmd) }, expectedDumpCmd: ` ignite @@ -137,13 +154,15 @@ ignite }, { name: "ok: link foo at subcommand with incomplete PlaceCommandUnder", - setup: func(t *testing.T, p *mocks.PluginInterface) { - cmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + cmd := &plugin.Command{ Use: "foo", PlaceCommandUnder: "scaffold", } - p.EXPECT().Manifest().Return(plugin.Manifest{Commands: []plugin.Command{cmd}}, nil) - expectExecute(t, p, cmd) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Commands: []*plugin.Command{cmd}}, nil) + expectExecute(t, ctx, p, cmd) }, expectedDumpCmd: ` ignite @@ -155,99 +174,111 @@ ignite }, { name: "fail: link to runnable command", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - { - Use: "foo", - PlaceCommandUnder: "ignite scaffold chain", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + { + Use: "foo", + PlaceCommandUnder: "ignite scaffold chain", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `can't attach app command "foo" to runnable command "ignite scaffold chain"`, }, { name: "fail: link to unknown command", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - { - Use: "foo", - PlaceCommandUnder: "ignite unknown", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + { + Use: "foo", + PlaceCommandUnder: "ignite unknown", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `unable to find command path "ignite unknown" for app "foo"`, }, { name: "fail: plugin name exists in legacy commands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - { - Use: "scaffold", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + { + Use: "scaffold", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `app command "scaffold" already exists in Ignite's commands`, }, { name: "fail: plugin name with args exists in legacy commands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - { - Use: "scaffold [args]", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + { + Use: "scaffold [args]", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `app command "scaffold" already exists in Ignite's commands`, }, { name: "fail: plugin name exists in legacy sub commands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - { - Use: "chain", - PlaceCommandUnder: "scaffold", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + { + Use: "chain", + PlaceCommandUnder: "scaffold", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `app command "chain" already exists in Ignite's commands`, }, { name: "ok: link multiple at root", - setup: func(t *testing.T, p *mocks.PluginInterface) { - fooCmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + fooCmd := &plugin.Command{ Use: "foo", } - barCmd := plugin.Command{ + barCmd := &plugin.Command{ Use: "bar", } - p.EXPECT().Manifest().Return(plugin.Manifest{ - Commands: []plugin.Command{ - fooCmd, barCmd, pluginWithFlags, - }, - }, nil) - expectExecute(t, p, fooCmd) - expectExecute(t, p, barCmd) - expectExecute(t, p, pluginWithFlags) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Commands: []*plugin.Command{ + fooCmd, barCmd, pluginWithFlags, + }, + }, nil) + expectExecute(t, ctx, p, fooCmd) + expectExecute(t, ctx, p, barCmd) + expectExecute(t, ctx, p, pluginWithFlags) }, expectedDumpCmd: ` ignite @@ -261,21 +292,23 @@ ignite }, { name: "ok: link with subcommands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - cmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + cmd := &plugin.Command{ Use: "foo", - Commands: []plugin.Command{ + Commands: []*plugin.Command{ {Use: "bar"}, {Use: "baz"}, pluginWithFlags, }, } - p.EXPECT().Manifest().Return(plugin.Manifest{Commands: []plugin.Command{cmd}}, nil) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Commands: []*plugin.Command{cmd}}, nil) // cmd is not executed because it's not runnable, only sub-commands // are executed. - expectExecute(t, p, cmd.Commands[0]) - expectExecute(t, p, cmd.Commands[1]) - expectExecute(t, p, cmd.Commands[2]) + expectExecute(t, ctx, p, cmd.Commands[0]) + expectExecute(t, ctx, p, cmd.Commands[1]) + expectExecute(t, ctx, p, cmd.Commands[2]) }, expectedDumpCmd: ` ignite @@ -290,18 +323,20 @@ ignite }, { name: "ok: link with multiple subcommands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - cmd := plugin.Command{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + cmd := &plugin.Command{ Use: "foo", - Commands: []plugin.Command{ - {Use: "bar", Commands: []plugin.Command{{Use: "baz"}}}, - {Use: "qux", Commands: []plugin.Command{{Use: "quux"}, {Use: "corge"}}}, + Commands: []*plugin.Command{ + {Use: "bar", Commands: []*plugin.Command{{Use: "baz"}}}, + {Use: "qux", Commands: []*plugin.Command{{Use: "quux"}, {Use: "corge"}}}, }, } - p.EXPECT().Manifest().Return(plugin.Manifest{Commands: []plugin.Command{cmd}}, nil) - expectExecute(t, p, cmd.Commands[0].Commands[0]) - expectExecute(t, p, cmd.Commands[1].Commands[0]) - expectExecute(t, p, cmd.Commands[1].Commands[1]) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Commands: []*plugin.Command{cmd}}, nil) + expectExecute(t, ctx, p, cmd.Commands[0].Commands[0]) + expectExecute(t, ctx, p, cmd.Commands[1].Commands[0]) + expectExecute(t, ctx, p, cmd.Commands[1].Commands[1]) }, expectedDumpCmd: ` ignite @@ -319,6 +354,9 @@ ignite } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + require := require.New(t) assert := assert.New(t) pi := mocks.NewPluginInterface(t) @@ -329,10 +367,10 @@ ignite }, Interface: pi, } - rootCmd := buildRootCmd() - tt.setup(t, pi) + rootCmd := buildRootCmd(ctx) + tt.setup(t, ctx, pi) - _ = linkPlugins(rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.Error(p.Error) @@ -370,18 +408,19 @@ func TestLinkPluginHooks(t *testing.T) { var ( args = []string{"arg1", "arg2"} pluginParams = map[string]string{"key": "val"} + ctx = context.Background() // helper to assert pluginInterface.ExecuteHook*() calls in expected order // (pre, then post, then cleanup) - expectExecuteHook = func(t *testing.T, p *mocks.PluginInterface, expectedFlags []plugin.Flag, hooks ...plugin.Hook) { - matcher := func(hook plugin.Hook) any { - return mock.MatchedBy(func(execHook plugin.ExecutedHook) bool { - return hook.Name == execHook.Name && - hook.PlaceHookOn == execHook.PlaceHookOn + expectExecuteHook = func(t *testing.T, p *mocks.PluginInterface, expectedFlags []*plugin.Flag, hooks ...*plugin.Hook) { + matcher := func(hook *plugin.Hook) any { + return mock.MatchedBy(func(execHook *plugin.ExecutedHook) bool { + return hook.Name == execHook.Hook.Name && + hook.PlaceHookOn == execHook.Hook.PlaceHookOn }) } - asserter := func(hook plugin.Hook) func(hook plugin.ExecutedHook) { - return func(execHook plugin.ExecutedHook) { + asserter := func(hook *plugin.Hook) func(_ context.Context, hook *plugin.ExecutedHook, _ plugin.ClientAPI) { + return func(_ context.Context, execHook *plugin.ExecutedHook, _ plugin.ClientAPI) { assert.True(t, strings.HasSuffix(execHook.ExecutedCommand.Path, hook.PlaceHookOn), "wrong path %q want %q", execHook.ExecutedCommand.Path, hook.PlaceHookOn) assert.Equal(t, args, execHook.ExecutedCommand.Args) assertFlags(t, expectedFlags, execHook.ExecutedCommand) @@ -390,18 +429,27 @@ func TestLinkPluginHooks(t *testing.T) { } var lastPre *mock.Call for _, hook := range hooks { - pre := p.EXPECT().ExecuteHookPre(matcher(hook)). - Run(asserter(hook)).Return(nil).Call + pre := p.EXPECT(). + ExecuteHookPre(ctx, matcher(hook), mock.Anything). + Run(asserter(hook)). + Return(nil). + Call if lastPre != nil { pre.NotBefore(lastPre) } lastPre = pre } for _, hook := range hooks { - post := p.EXPECT().ExecuteHookPost(matcher(hook)). - Run(asserter(hook)).Return(nil).Call - cleanup := p.EXPECT().ExecuteHookCleanUp(matcher(hook)). - Run(asserter(hook)).Return(nil).Call + post := p.EXPECT(). + ExecuteHookPost(ctx, matcher(hook), mock.Anything). + Run(asserter(hook)). + Return(nil). + Call + cleanup := p.EXPECT(). + ExecuteHookCleanUp(ctx, matcher(hook), mock.Anything). + Run(asserter(hook)). + Return(nil). + Call post.NotBefore(lastPre) cleanup.NotBefore(post) } @@ -410,90 +458,100 @@ func TestLinkPluginHooks(t *testing.T) { tests := []struct { name string expectedError string - setup func(*testing.T, *mocks.PluginInterface) + setup func(*testing.T, context.Context, *mocks.PluginInterface) }{ { name: "fail: command not runnable", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Hooks: []plugin.Hook{ - { - Name: "test-hook", - PlaceHookOn: "ignite scaffold", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Hooks: []*plugin.Hook{ + { + Name: "test-hook", + PlaceHookOn: "ignite scaffold", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `can't attach app hook "test-hook" to non executable command "ignite scaffold"`, }, { name: "fail: command doesn't exists", - setup: func(t *testing.T, p *mocks.PluginInterface) { - p.EXPECT().Manifest().Return(plugin.Manifest{ - Hooks: []plugin.Hook{ - { - Name: "test-hook", - PlaceHookOn: "ignite chain", + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{ + Hooks: []*plugin.Hook{ + { + Name: "test-hook", + PlaceHookOn: "ignite chain", + }, }, }, - }, - nil, - ) + nil, + ) }, expectedError: `unable to find command path "ignite chain" for app hook "test-hook"`, }, { name: "ok: single hook", - setup: func(t *testing.T, p *mocks.PluginInterface) { - hook := plugin.Hook{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + hook := &plugin.Hook{ Name: "test-hook", PlaceHookOn: "scaffold chain", } - p.EXPECT().Manifest().Return(plugin.Manifest{Hooks: []plugin.Hook{hook}}, nil) - expectExecuteHook(t, p, []plugin.Flag{{Name: "path"}}, hook) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Hooks: []*plugin.Hook{hook}}, nil) + expectExecuteHook(t, p, []*plugin.Flag{{Name: "path"}}, hook) }, }, { name: "ok: multiple hooks on same command", - setup: func(t *testing.T, p *mocks.PluginInterface) { - hook1 := plugin.Hook{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + hook1 := &plugin.Hook{ Name: "test-hook-1", PlaceHookOn: "scaffold chain", } - hook2 := plugin.Hook{ + hook2 := &plugin.Hook{ Name: "test-hook-2", PlaceHookOn: "scaffold chain", } - p.EXPECT().Manifest().Return(plugin.Manifest{Hooks: []plugin.Hook{hook1, hook2}}, nil) - expectExecuteHook(t, p, []plugin.Flag{{Name: "path"}}, hook1, hook2) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Hooks: []*plugin.Hook{hook1, hook2}}, nil) + expectExecuteHook(t, p, []*plugin.Flag{{Name: "path"}}, hook1, hook2) }, }, { name: "ok: multiple hooks on different commands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - hookChain1 := plugin.Hook{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + hookChain1 := &plugin.Hook{ Name: "test-hook-1", PlaceHookOn: "scaffold chain", } - hookChain2 := plugin.Hook{ + hookChain2 := &plugin.Hook{ Name: "test-hook-2", PlaceHookOn: "scaffold chain", } - hookModule := plugin.Hook{ + hookModule := &plugin.Hook{ Name: "test-hook-3", PlaceHookOn: "scaffold module", } - p.EXPECT().Manifest().Return(plugin.Manifest{Hooks: []plugin.Hook{hookChain1, hookChain2, hookModule}}, nil) - expectExecuteHook(t, p, []plugin.Flag{{Name: "path"}}, hookChain1, hookChain2) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Hooks: []*plugin.Hook{hookChain1, hookChain2, hookModule}}, nil) + expectExecuteHook(t, p, []*plugin.Flag{{Name: "path"}}, hookChain1, hookChain2) expectExecuteHook(t, p, nil, hookModule) }, }, { name: "ok: duplicate hook names on same command", - setup: func(t *testing.T, p *mocks.PluginInterface) { - hooks := []plugin.Hook{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + hooks := []*plugin.Hook{ { Name: "test-hook", PlaceHookOn: "ignite scaffold chain", @@ -503,23 +561,27 @@ func TestLinkPluginHooks(t *testing.T) { PlaceHookOn: "ignite scaffold chain", }, } - p.EXPECT().Manifest().Return(plugin.Manifest{Hooks: hooks}, nil) - expectExecuteHook(t, p, []plugin.Flag{{Name: "path"}}, hooks...) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Hooks: hooks}, nil) + expectExecuteHook(t, p, []*plugin.Flag{{Name: "path"}}, hooks...) }, }, { name: "ok: duplicate hook names on different commands", - setup: func(t *testing.T, p *mocks.PluginInterface) { - hookChain := plugin.Hook{ + setup: func(t *testing.T, ctx context.Context, p *mocks.PluginInterface) { + hookChain := &plugin.Hook{ Name: "test-hook", PlaceHookOn: "ignite scaffold chain", } - hookModule := plugin.Hook{ + hookModule := &plugin.Hook{ Name: "test-hook", PlaceHookOn: "ignite scaffold module", } - p.EXPECT().Manifest().Return(plugin.Manifest{Hooks: []plugin.Hook{hookChain, hookModule}}, nil) - expectExecuteHook(t, p, []plugin.Flag{{Name: "path"}}, hookChain) + p.EXPECT(). + Manifest(ctx). + Return(&plugin.Manifest{Hooks: []*plugin.Hook{hookChain, hookModule}}, nil) + expectExecuteHook(t, p, []*plugin.Flag{{Name: "path"}}, hookChain) expectExecuteHook(t, p, nil, hookModule) }, }, @@ -527,6 +589,9 @@ func TestLinkPluginHooks(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + require := require.New(t) // assert := assert.New(t) pi := mocks.NewPluginInterface(t) @@ -537,10 +602,10 @@ func TestLinkPluginHooks(t *testing.T) { }, Interface: pi, } - rootCmd := buildRootCmd() - tt.setup(t, pi) + rootCmd := buildRootCmd(ctx) + tt.setup(t, ctx, pi) - _ = linkPlugins(rootCmd, []*plugin.Plugin{p}) + _ = linkPlugins(ctx, rootCmd, []*plugin.Plugin{p}) if tt.expectedError != "" { require.EqualError(p.Error, tt.expectedError) diff --git a/ignite/cmd/relayer_configure.go b/ignite/cmd/relayer_configure.go index 5613834fec..10f8800aae 100644 --- a/ignite/cmd/relayer_configure.go +++ b/ignite/cmd/relayer_configure.go @@ -42,7 +42,7 @@ const ( RelayerTarget = "target" defaultSourceRPCAddress = "http://localhost:26657" - defaultTargetRPCAddress = "https://rpc.cosmos.network:443" + defaultTargetRPCAddress = "https://rpc.cosmos.directory:443/cosmoshub" defautSourceGasPrice = "0.00025stake" defautTargetGasPrice = "0.025uatom" diff --git a/ignite/config/chain/config.go b/ignite/config/chain/config.go index b19cc7fbe3..3724442cbf 100644 --- a/ignite/config/chain/config.go +++ b/ignite/config/chain/config.go @@ -15,7 +15,6 @@ import ( ) var ( - // ConfigFilenames is a list of recognized names as Ignite's chain config file. ConfigFilenames = []string{"config.yml", "config.yaml"} diff --git a/ignite/internal/tools/tools.go b/ignite/internal/tools/tools.go index ce7e689a69..dbc2316bd9 100644 --- a/ignite/internal/tools/tools.go +++ b/ignite/internal/tools/tools.go @@ -4,6 +4,7 @@ package tools import ( + _ "github.com/bufbuild/buf/cmd/buf" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" _ "github.com/tbruyelle/mdgofmt/cmd/mdgofmt" _ "github.com/vektra/mockery/v2" diff --git a/ignite/pkg/chaincmd/chaincmd.go b/ignite/pkg/chaincmd/chaincmd.go index f981804a1c..78d2a58f71 100644 --- a/ignite/pkg/chaincmd/chaincmd.go +++ b/ignite/pkg/chaincmd/chaincmd.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ignite/cli/ignite/pkg/cmdrunner/step" "github.com/ignite/cli/ignite/pkg/cosmosver" @@ -13,10 +14,11 @@ const ( commandStart = "start" commandInit = "init" commandKeys = "keys" + commandGenesis = "genesis" commandAddGenesisAccount = "add-genesis-account" commandGentx = "gentx" commandCollectGentxs = "collect-gentxs" - commandValidateGenesis = "validate-genesis" + commandValidateGenesis = "validate" commandShowNodeID = "show-node-id" commandStatus = "status" commandTx = "tx" @@ -33,6 +35,7 @@ const ( optionRecover = "--recover" optionAddress = "--address" optionAmount = "--amount" + optionFees = "--fees" optionValidatorMoniker = "--moniker" optionValidatorCommissionRate = "--commission-rate" optionValidatorCommissionMaxRate = "--commission-max-rate" @@ -101,8 +104,8 @@ func (c ChainCmd) Copy(options ...Option) ChainCmd { type Option func(*ChainCmd) func applyOptions(c *ChainCmd, options []Option) { - for _, applyOption := range options { - applyOption(c) + for _, apply := range options { + apply(c) } } @@ -255,6 +258,7 @@ func (c ChainCmd) ListKeysCommand() step.Option { // AddGenesisAccountCommand returns the command to add a new account in the genesis file of the chain. func (c ChainCmd) AddGenesisAccountCommand(address, coins string) step.Option { command := []string{ + commandGenesis, commandAddGenesisAccount, address, coins, @@ -266,6 +270,7 @@ func (c ChainCmd) AddGenesisAccountCommand(address, coins string) step.Option { // AddVestingAccountCommand returns the command to add a delayed vesting account in the genesis file of the chain. func (c ChainCmd) AddVestingAccountCommand(address, originalCoins, vestingCoins string, vestingEndTime int64) step.Option { command := []string{ + commandGenesis, commandAddGenesisAccount, address, originalCoins, @@ -396,6 +401,7 @@ func (c ChainCmd) GentxCommand( options ...GentxOption, ) step.Option { command := []string{ + commandGenesis, commandGentx, } @@ -414,8 +420,8 @@ func (c ChainCmd) GentxCommand( } // Apply the options provided by the user - for _, applyOption := range options { - command = applyOption(command) + for _, apply := range options { + command = apply(command) } command = c.attachChainID(command) @@ -427,6 +433,7 @@ func (c ChainCmd) GentxCommand( // CollectGentxsCommand returns the command to gather the gentxs in /gentx dir into the genesis file of the chain. func (c ChainCmd) CollectGentxsCommand() step.Option { command := []string{ + commandGenesis, commandCollectGentxs, } return c.daemonCommand(command) @@ -435,6 +442,7 @@ func (c ChainCmd) CollectGentxsCommand() step.Option { // ValidateGenesisCommand returns the command to check the validity of the chain genesis. func (c ChainCmd) ValidateGenesisCommand() step.Option { command := []string{ + commandGenesis, commandValidateGenesis, } return c.daemonCommand(command) @@ -470,8 +478,21 @@ func (c ChainCmd) ExportCommand() step.Option { return c.daemonCommand(command) } +// BankSendOption for the BankSendCommand. +type BankSendOption func([]string) []string + +// BankSendWithFees sets fees to pay along with transaction for the bank send command. +func BankSendWithFees(fee sdk.Coin) BankSendOption { + return func(command []string) []string { + if !fee.IsNil() { + return append(command, optionFees, fee.String()) + } + return command + } +} + // BankSendCommand returns the command for transferring tokens. -func (c ChainCmd) BankSendCommand(fromAddress, toAddress, amount string) step.Option { +func (c ChainCmd) BankSendCommand(fromAddress, toAddress, amount string, options ...BankSendOption) step.Option { command := []string{ commandTx, } @@ -486,6 +507,11 @@ func (c ChainCmd) BankSendCommand(fromAddress, toAddress, amount string) step.Op optionYes, ) + // Apply the options provided by the user + for _, apply := range options { + command = apply(command) + } + command = c.attachChainID(command) command = c.attachKeyringBackend(command) command = c.attachNode(command) @@ -510,10 +536,27 @@ func (c ChainCmd) QueryTxEventsCommand(query string) step.Option { command := []string{ commandQuery, "txs", - "--events", + "--query", + query, + "--page", "1", + "--limit", "1000", + "--output", "json", + } + + command = c.attachNode(command) + return c.cliCommand(command) +} + +// QueryTxQueryCommand returns the command to query tx. +func (c ChainCmd) QueryTxQueryCommand(query string) step.Option { + command := []string{ + commandQuery, + "txs", + "--query", query, "--page", "1", "--limit", "1000", + "--output", "json", } command = c.attachNode(command) diff --git a/ignite/pkg/chaincmd/runner/chain.go b/ignite/pkg/chaincmd/runner/chain.go index 2b89e5258f..e3e07f71c9 100644 --- a/ignite/pkg/chaincmd/runner/chain.go +++ b/ignite/pkg/chaincmd/runner/chain.go @@ -142,10 +142,10 @@ func (r Runner) Status(ctx context.Context) (NodeStatus, error) { } // BankSend sends amount from fromAccount to toAccount. -func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount, amount string) (string, error) { +func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount, amount string, options ...chaincmd.BankSendOption) (string, error) { b := newBuffer() opt := []step.Option{ - r.chainCmd.BankSendCommand(fromAccount, toAccount, amount), + r.chainCmd.BankSendCommand(fromAccount, toAccount, amount, options...), } if r.chainCmd.KeyringPassword() != "" { @@ -268,27 +268,46 @@ type EventAttribute struct { Value string } -// QueryTxEvents queries tx events by event selectors. -func (r Runner) QueryTxEvents( +// QueryTxByEvents queries tx events by event selectors. +func (r Runner) QueryTxByEvents( ctx context.Context, - selector EventSelector, - moreSelectors ...EventSelector, + selectors ...EventSelector, ) ([]Event, error) { - // prepare the selector. - var list []string - - eventsSelectors := append([]EventSelector{selector}, moreSelectors...) - - for _, event := range eventsSelectors { - list = append(list, fmt.Sprintf("%s.%s=%s", event.typ, event.attr, event.value)) + if len(selectors) == 0 { + return nil, errors.New("event selector list should be greater than zero") + } + list := make([]string, len(selectors)) + for i, event := range selectors { + list[i] = fmt.Sprintf("%s.%s=%s", event.typ, event.attr, event.value) } - query := strings.Join(list, "&") + return r.QueryTx(ctx, r.chainCmd.QueryTxEventsCommand(query)) +} +// QueryTxByQuery queries tx events by event selectors. +func (r Runner) QueryTxByQuery( + ctx context.Context, + selectors ...EventSelector, +) ([]Event, error) { + if len(selectors) == 0 { + return nil, errors.New("event selector list should be greater than zero") + } + list := make([]string, len(selectors)) + for i, query := range selectors { + list[i] = fmt.Sprintf("%s.%s='%s'", query.typ, query.attr, query.value) + } + query := strings.Join(list, " AND ") + return r.QueryTx(ctx, r.chainCmd.QueryTxQueryCommand(query)) +} + +// QueryTx queries tx events/query selectors. +func (r Runner) QueryTx( + ctx context.Context, + option ...step.Option, +) ([]Event, error) { // execute the command and parse the output. b := newBuffer() - - if err := r.run(ctx, runOptions{stdout: b}, r.chainCmd.QueryTxEventsCommand(query)); err != nil { + if err := r.run(ctx, runOptions{stdout: b}, option...); err != nil { return nil, err } @@ -316,7 +335,6 @@ func (r Runner) QueryTxEvents( } var events []Event - for _, tx := range out.Txs { for _, log := range tx.Logs { for _, e := range log.Events { diff --git a/ignite/pkg/cosmosanalysis/app/app.go b/ignite/pkg/cosmosanalysis/app/app.go index ca82b60a28..41f284e4e2 100644 --- a/ignite/pkg/cosmosanalysis/app/app.go +++ b/ignite/pkg/cosmosanalysis/app/app.go @@ -1,29 +1,17 @@ package app import ( - "bytes" "fmt" "go/ast" - "go/format" "go/parser" "go/token" - "os" "path/filepath" + "strings" - "github.com/pkg/errors" - - "github.com/ignite/cli/ignite/pkg/cosmosanalysis" - "github.com/ignite/cli/ignite/pkg/cosmosver" "github.com/ignite/cli/ignite/pkg/goanalysis" - "github.com/ignite/cli/ignite/pkg/goenv" - "github.com/ignite/cli/ignite/pkg/gomodule" "github.com/ignite/cli/ignite/pkg/xast" -) -const ( - appWiringImport = "cosmossdk.io/depinject" - appWiringCallMethod = "Inject" - registerRoutesMethod = "RegisterAPIRoutes" + "github.com/ignite/cli/ignite/pkg/cosmosanalysis" ) // CheckKeeper checks for the existence of the keeper with the provided name in the app structure. @@ -80,13 +68,8 @@ func CheckKeeper(path, keeperName string) error { return nil } -// FindRegisteredModules looks for all the registered modules in the App -// It finds activated modules by checking if imported modules are registered in the app and also checking if their query clients are registered -// It does so by: -// 1. Mapping out all the imports and named imports -// 2. Looking for the call to module.NewBasicManager and finds the modules registered there -// 3. Looking for the implementation of RegisterAPIRoutes and find the modules that call their RegisterGRPCGatewayRoutes. -func FindRegisteredModules(chainRoot string) (modules []string, err error) { +// FindRegisteredModules returns all registered modules into the chain root. +func FindRegisteredModules(chainRoot string) ([]string, error) { // Assumption: modules are registered in the app package appFilePath, err := cosmosanalysis.FindAppFilePath(chainRoot) if err != nil { @@ -101,350 +84,127 @@ func FindRegisteredModules(chainRoot string) (modules []string, err error) { return nil, err } - // The modules registered by Cosmos SDK `rumtime.App` are included - // when the app registers API modules though the `App` instance. - var includeRuntimeModules bool - // Loop on package's files + var blankImports []string + var discovered []string for _, f := range appPkg.Files { + blankImports = append(blankImports, goanalysis.FindBlankImports(f)...) fileImports := goanalysis.FormatImports(f) - err := xast.Inspect(f, func(n ast.Node) error { - // Find modules in module.NewBasicManager call - pkgs, err := findBasicManagerRegistrations(n, appDir, fileImports) - if err != nil { - return err - } - - if pkgs != nil { - for _, p := range pkgs { - importModule := fileImports[p] - if importModule == "" { - // When the package is not defined in the same file use the package name as import - importModule = p - } - modules = append(modules, importModule) - } - return xast.ErrStop - } - - // Check if Cosmos SDK runtime App is called to register API routes - if !includeRuntimeModules { - includeRuntimeModules = checkRuntimeAppCalled(n) - } - - // Find modules in RegisterAPIRoutes declaration - if pkgs := findRegisterAPIRoutesRegistrations(n); pkgs != nil { - for _, p := range pkgs { - importModule := fileImports[p] - if importModule == "" { - continue - } - modules = append(modules, importModule) - } - - return xast.ErrStop - } - - return nil - }) - if err != nil { - return nil, err - } - } - - // Try to find the modules registered in Cosmos SDK `runtime.App`. - // This is required to properly generate OpenAPI specs for these - // modules when `app.App.RegisterAPIRoutes` is called. - if includeRuntimeModules { - runtimeModules, err := findRuntimeRegisteredModules(chainRoot) + d, err := FindKeepersModules(f, fileImports) if err != nil { return nil, err } - - modules = append(modules, runtimeModules...) + discovered = append(discovered, d...) } - - return modules, nil + return mergeImports(blankImports, discovered), nil } -// CheckAppWiring check if the app wiring exists finding the `depinject.Inject` method call. -func CheckAppWiring(chainRoot string) (bool, error) { - // Assumption: modules are registered in the app package - appFilePath, err := cosmosanalysis.FindAppFilePath(chainRoot) - if err != nil { - return false, err - } - // The directory where the app file is located. - // This is required to resolve references within the app package. - appDir := filepath.Dir(appFilePath) - - appPkg, _, err := xast.ParseDir(appDir) - if err != nil { - return false, err - } - - // Loop on package's files - for _, f := range appPkg.Files { - exists := goanalysis.FuncVarExists(f, appWiringImport, appWiringCallMethod) - if exists { - return true, nil - } - } - return false, nil -} - -func exprToString(n ast.Expr) (string, error) { - buf := bytes.Buffer{} - fset := token.NewFileSet() - - // Convert the expression node to Go - if err := format.Node(&buf, fset, n); err != nil { - return "", err - } - - return buf.String(), nil -} - -func newExprError(msg string, n ast.Expr) error { - s, err := exprToString(n) - if err != nil { - return fmt.Errorf("%s: %w", msg, err) - } - return fmt.Errorf("%s: %s", msg, s) -} - -func newUnexpectedTypeErr(n any) error { - return errors.Errorf("unexpected type %T", n) -} - -func findBasicManagerRegistrations(n ast.Node, pkgDir string, fileImports map[string]string) (packages []string, err error) { - callExprType, ok := n.(*ast.CallExpr) - if !ok { - return packages, err - } - - selectorExprType, ok := callExprType.Fun.(*ast.SelectorExpr) - if !ok { - return packages, err - } - - identExprType, ok := selectorExprType.X.(*ast.Ident) - if !ok { - return packages, err - } - basicModulePkgName := findBasicManagerPkgName(fileImports) - if basicModulePkgName == "" { - // cosmos-sdk/types/module is not imported in this file, skip - return packages, err - } - if identExprType.Name != basicModulePkgName || selectorExprType.Sel.Name != "NewBasicManager" { - return packages, err - } - - // Node "n" defines the call to NewBasicManager, let's loop on its args to discover modules - for _, arg := range callExprType.Args { - switch v := arg.(type) { - - case *ast.CompositeLit: - // The arg is an app module - ps, err := parsePkgNameFromCompositeLit(v, pkgDir) - if err != nil { - return nil, err +// mergeImports merge all discovered imports into the blank imports found in the app files. +func mergeImports(blankImports, discovered []string) []string { + imports := make([]string, len(blankImports)) + copy(imports, blankImports) + for i, m := range discovered { + split := strings.Split(m, "/") + + j := len(split) + maxTrim := len(split) - 3 + LoopBack: + for j > maxTrim { + j-- + // x path means we are reaching the root of the module + if split[j] == "x" { + j = maxTrim + goto LoopBack } - packages = append(packages, ps...) - - case *ast.CallExpr: - // The arg is a function call that returns the app module - ps, err := parsePkgNameFromCall(v, pkgDir) - if err != nil { - return nil, err - } - packages = append(packages, ps...) - - case *ast.Ident: - // The list of modules are defined in a local variable - ps, err := parseAppModulesFromIdent(v, pkgDir) - if err != nil { - return nil, err - } - - packages = append(packages, ps...) - case *ast.SelectorExpr: - // The list of modules is defined in a variable of a different package - ps, err := parseAppModulesFromSelectorExpr(v, pkgDir, fileImports) - if err != nil { - return nil, err + for _, imp := range blankImports { + // check if the import exist into the blank imports + if strings.Contains(imp, m) { + j = -1 + goto LoopBack + } } - packages = append(packages, ps...) - default: - return nil, newExprError("unsupported NewBasicManager() argument format", arg) + m = strings.TrimSuffix(m, "/"+split[j]) } - } - return packages, nil -} - -func findBasicManagerPkgName(pkgs map[string]string) string { - for mod, pkg := range pkgs { - if pkg == "github.com/cosmos/cosmos-sdk/types/module" { - return mod + if j == maxTrim { + imports = append(imports, discovered[i]) } } - return "" + return imports } -func findRegisterAPIRoutesRegistrations(n ast.Node) []string { - funcLitType, ok := n.(*ast.FuncDecl) - if !ok { - return nil - } - - if funcLitType.Name.Name != registerRoutesMethod { - return nil - } - - var packagesRegistered []string - for _, stmt := range funcLitType.Body.List { - exprStmt, ok := stmt.(*ast.ExprStmt) - if !ok { - continue - } - - exprCall, ok := exprStmt.X.(*ast.CallExpr) - if !ok { - continue - } - - exprFun, ok := exprCall.Fun.(*ast.SelectorExpr) - if !ok || exprFun.Sel.Name != "RegisterGRPCGatewayRoutes" { - continue - } - - identType, ok := exprFun.X.(*ast.Ident) - if !ok { - continue - } - - pkgName := identType.Name - if pkgName == "" { - continue - } - - packagesRegistered = append(packagesRegistered, identType.Name) +// FindKeepersModules find a map of import modules based on the keepers params on the App struct. +func FindKeepersModules(n ast.Node, fileImports map[string]string) ([]string, error) { + // find app type + appImpl := cosmosanalysis.FindImplementationInFile(n, cosmosanalysis.AppImplementation) + appTypeName := "App" + switch { + case len(appImpl) > 1: + return nil, fmt.Errorf("app.go should contain only a single app (got %d)", len(appImpl)) + case len(appImpl) == 1: + appTypeName = appImpl[0] } - return packagesRegistered -} - -func checkRuntimeAppCalled(n ast.Node) bool { - funcLitType, ok := n.(*ast.FuncDecl) + file, ok := n.(*ast.File) if !ok { - return false - } - - if funcLitType.Name.Name != registerRoutesMethod { - return false + return nil, nil } - for _, stmt := range funcLitType.Body.List { - exprStmt, ok := stmt.(*ast.ExprStmt) + keeperParamsMap := make(map[string]struct{}) + for _, decl := range file.Decls { + genDecl, ok := decl.(*ast.GenDecl) if !ok { continue } - - exprCall, ok := exprStmt.X.(*ast.CallExpr) - if !ok { - continue - } - - exprFun, ok := exprCall.Fun.(*ast.SelectorExpr) - if !ok || exprFun.Sel.Name != registerRoutesMethod { - continue - } - - exprSel, ok := exprFun.X.(*ast.SelectorExpr) - if !ok || exprSel.Sel.Name != "App" { - continue - } - - identType, ok := exprSel.X.(*ast.Ident) - if !ok || identType.Name != "app" { - continue - } - - return true - } - - return false -} - -func findRuntimeRegisteredModules(chainRoot string) ([]string, error) { - // Resolve the absolute path to the Cosmos SDK module - cosmosPath, err := resolveCosmosPackagePath(chainRoot) - if err != nil { - return nil, err - } - - var modules []string - - // When runtime package doesn't exists it means is an older Cosmos SDK version, - // so all the module API registrations are defined within user's app. - path := filepath.Join(cosmosPath, "runtime", "app.go") - if _, err := os.Stat(path); os.IsNotExist(err) { - return modules, nil - } - - f, _, err := xast.ParseFile(path) - if err != nil { - return nil, err - } - - imports := goanalysis.FormatImports(f) - err = xast.Inspect(f, func(n ast.Node) error { - if pkgs := findRegisterAPIRoutesRegistrations(n); pkgs != nil { - for _, p := range pkgs { - if m := imports[p]; m != "" { - modules = append(modules, m) + for _, spec := range genDecl.Specs { + typeSpec, ok := spec.(*ast.TypeSpec) + if !ok { + continue + } + if typeSpec.Name.Name != appTypeName { + continue + } + structType, ok := typeSpec.Type.(*ast.StructType) + if !ok { + continue + } + for _, field := range structType.Fields.List { + f := field.Type + CheckSpec: + switch spec := f.(type) { + case *ast.StarExpr: + f, ok = spec.X.(*ast.SelectorExpr) + if !ok { + continue + } + goto CheckSpec + case *ast.SelectorExpr: + if !strings.HasSuffix(spec.Sel.Name, "Keeper") { + continue + } + ident, ok := spec.X.(*ast.Ident) + if !ok { + continue + } + fileImport, ok := fileImports[ident.Name] + if !ok { + continue + } + keeperParamsMap[removeKeeperPkgPath(fileImport)] = struct{}{} } } - return xast.ErrStop } - return nil - }) - - if err != nil { - return nil, err } - return modules, nil -} -func resolveCosmosPackagePath(chainRoot string) (string, error) { - modFile, err := gomodule.ParseAt(chainRoot) - if err != nil { - return "", err + keeperParams := make([]string, 0) + for param := range keeperParamsMap { + keeperParams = append(keeperParams, param) } - deps, err := gomodule.ResolveDependencies(modFile, false) - if err != nil { - return "", err - } - - var pkg string - for _, dep := range deps { - if dep.Path == cosmosver.CosmosModulePath { - pkg = dep.String() - break - } - } - - if pkg == "" { - return "", errors.New("Cosmos SDK package version not found") - } + return keeperParams, nil +} - // Check path of the package directory within Go's module cache - path := filepath.Join(goenv.GoModCache(), pkg) - info, err := os.Stat(path) - if os.IsNotExist(err) || !info.IsDir() { - return "", errors.New("local path to Cosmos SDK package not found") - } - return path, nil +func removeKeeperPkgPath(pkg string) string { + path := strings.TrimSuffix(pkg, "/keeper") + path = strings.TrimSuffix(path, "/controller") + return strings.TrimSuffix(path, "/host") } diff --git a/ignite/pkg/cosmosanalysis/app/app_test.go b/ignite/pkg/cosmosanalysis/app/app_test.go index 808fcdae81..35545e3959 100644 --- a/ignite/pkg/cosmosanalysis/app/app_test.go +++ b/ignite/pkg/cosmosanalysis/app/app_test.go @@ -1,15 +1,15 @@ -package app_test +package app import ( _ "embed" - "errors" "os" "path/filepath" "testing" "github.com/stretchr/testify/require" - "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app" + "github.com/ignite/cli/ignite/pkg/goanalysis" + "github.com/ignite/cli/ignite/pkg/xast" ) var ( @@ -54,6 +54,11 @@ func TestCheckKeeper(t *testing.T) { keeperName: "FooKeeper", expectedError: "app.go should contain a single app (got 2)", }, + { + name: "app v2", + appFile: AppV2, + keeperName: "FooKeeper", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -62,7 +67,7 @@ func TestCheckKeeper(t *testing.T) { err := os.WriteFile(tmpFile, tt.appFile, 0o644) require.NoError(t, err) - err = app.CheckKeeper(tmpDir, tt.keeperName) + err = CheckKeeper(tmpDir, tt.keeperName) if tt.expectedError != "" { require.EqualError(t, err, tt.expectedError) @@ -88,86 +93,45 @@ func TestFindRegisteredModules(t *testing.T) { expectedModules []string }{ { - name: "new basic manager arguments", - path: "testdata/modules/arguments", - expectedModules: basicModules, - }, - { - name: "cosmos-sdk/types/module with alias", - path: "testdata/modules/package_alias", - expectedModules: basicModules, - }, - { - name: "package not called app", - path: "testdata/modules/package_not_called_app", - expectedModules: basicModules, - }, - { - name: "append with arguments", - path: "testdata/modules/append_arguments", - expectedModules: basicModules, - }, - { - name: "registration not in app.go", - path: "testdata/modules/registration_not_in_app_go", - expectedModules: basicModules, - }, - { - name: "same file variable", - path: "testdata/modules/file_variable", - expectedModules: basicModules, - }, - { - name: "same package variable", - path: "testdata/modules/package_variable", + name: "new basic manager with only a app.go", + path: "testdata/modules/single_app", expectedModules: basicModules, }, { - name: "other package variable", - path: "testdata/modules/external_variable", + name: "with runtime api routes", + path: "testdata/modules/runtime", expectedModules: basicModules, }, { - name: "with api routes", - path: "testdata/modules/api_routes", - expectedModules: append( - basicModules, - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", - ), - }, - { - name: "with runtime api routes", - path: "testdata/modules/runtime_api_routes", - expectedModules: append( - basicModules, - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", + name: "with app_config.go file", + path: "testdata/modules/app_config", + expectedModules: []string{ + "cosmossdk.io/x/circuit", + "cosmossdk.io/x/evidence", + "cosmossdk.io/x/feegrant/module", + "cosmossdk.io/x/upgrade", + "github.com/cosmos/cosmos-sdk/x/auth/tx/config", + "github.com/cosmos/cosmos-sdk/x/auth/vesting", + "github.com/cosmos/cosmos-sdk/x/authz/module", + "github.com/cosmos/cosmos-sdk/x/bank", + "github.com/cosmos/cosmos-sdk/x/consensus", + "github.com/cosmos/cosmos-sdk/x/crisis", + "github.com/cosmos/cosmos-sdk/x/distribution", + "github.com/cosmos/cosmos-sdk/x/group/module", + "github.com/cosmos/cosmos-sdk/x/mint", + "github.com/cosmos/cosmos-sdk/x/params", + "github.com/cosmos/cosmos-sdk/x/slashing", + "github.com/cosmos/cosmos-sdk/x/staking", + "github.com/ignite/mars/x/mars", + "github.com/cosmos/cosmos-sdk/x/gov", "github.com/username/test/x/foo", - "github.com/cosmos/cosmos-sdk/client/grpc/node", - ), - }, - { - name: "same file function", - path: "testdata/modules/file_function", - expectedModules: basicModules, - }, - { - name: "same package function", - path: "testdata/modules/package_function", - expectedModules: basicModules, - }, - { - name: "append same package function", - path: "testdata/modules/append_package_function", - expectedModules: basicModules, + }, }, { name: "gaia", path: "testdata/modules/gaia", expectedModules: []string{ "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", @@ -177,21 +141,18 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/cosmos/cosmos-sdk/x/params", "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", - "github.com/cosmos/cosmos-sdk/x/feegrant/module", - "github.com/cosmos/cosmos-sdk/x/authz/module", - "github.com/cosmos/cosmos-sdk/x/group/module", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", + "github.com/cosmos/cosmos-sdk/x/group", "github.com/cosmos/ibc-go/v5/modules/core", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", "github.com/cosmos/ibc-go/v5/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", "github.com/gravity-devs/liquidity/v2/x/liquidity", "github.com/strangelove-ventures/packet-forward-middleware/v2/router", "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", "github.com/cosmos/gaia/v8/x/icamauth", - "github.com/cosmos/gaia/v8/x/globalfee", - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", + "github.com/cosmos/cosmos-sdk/client/docs/statik", }, }, { @@ -199,7 +160,6 @@ func TestFindRegisteredModules(t *testing.T) { path: "testdata/modules/crescent", expectedModules: []string{ "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", @@ -209,13 +169,12 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/cosmos/cosmos-sdk/x/params", "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", - "github.com/cosmos/cosmos-sdk/x/feegrant/module", - "github.com/cosmos/cosmos-sdk/x/authz/module", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", "github.com/cosmos/ibc-go/v2/modules/core", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", "github.com/cosmos/ibc-go/v2/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", "github.com/tendermint/budget/x/budget", "github.com/crescent-network/crescent/v3/x/farming", "github.com/crescent-network/crescent/v3/x/liquidity", @@ -224,8 +183,7 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/crescent-network/crescent/v3/x/claim", "github.com/crescent-network/crescent/v3/x/marketmaker", "github.com/crescent-network/crescent/v3/x/lpfarm", - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", + "github.com/crescent-network/crescent/v3/client/docs/statik", }, }, { @@ -233,7 +191,6 @@ func TestFindRegisteredModules(t *testing.T) { path: "testdata/modules/spn", expectedModules: []string{ "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", @@ -243,13 +200,12 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/cosmos/cosmos-sdk/x/params", "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", - "github.com/cosmos/cosmos-sdk/x/feegrant/module", - "github.com/cosmos/cosmos-sdk/x/authz/module", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", "github.com/cosmos/ibc-go/v6/modules/core", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", "github.com/cosmos/ibc-go/v6/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", "github.com/tendermint/spn/x/participation", "github.com/ignite/modules/x/claim", "github.com/tendermint/spn/x/profile", @@ -259,8 +215,6 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/tendermint/spn/x/monitoringp", "github.com/tendermint/spn/x/reward", "github.com/tendermint/fundraising/x/fundraising", - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", }, }, { @@ -268,7 +222,6 @@ func TestFindRegisteredModules(t *testing.T) { path: "testdata/modules/juno", expectedModules: []string{ "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", @@ -279,138 +232,339 @@ func TestFindRegisteredModules(t *testing.T) { "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", "github.com/cosmos/ibc-go/v3/modules/core", - "github.com/cosmos/cosmos-sdk/x/feegrant/module", + "github.com/cosmos/cosmos-sdk/x/feegrant", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", "github.com/cosmos/ibc-go/v3/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", - "github.com/cosmos/cosmos-sdk/x/authz/module", + "github.com/cosmos/cosmos-sdk/x/authz", "github.com/CosmWasm/wasmd/x/wasm", "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts", - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", }, }, + } + + for _, tt := range cases { + t.Run(tt.name, func(t *testing.T) { + got, err := FindRegisteredModules(tt.path) + require.NoError(t, err) + require.ElementsMatch(t, tt.expectedModules, got) + }) + } +} + +func TestFindKeepersModules(t *testing.T) { + basicModules := []string{ + "github.com/cosmos/cosmos-sdk/x/auth", + "github.com/cosmos/cosmos-sdk/x/bank", + "github.com/cosmos/cosmos-sdk/x/staking", + "github.com/cosmos/cosmos-sdk/x/gov", + "github.com/username/test/x/foo", + } + + cases := []struct { + name string + path string + expectedModules []string + }{ + { + name: "new basic manager with only a app.go", + path: "testdata/modules/single_app", + expectedModules: basicModules, + }, { - name: "osmosis", - path: "testdata/modules/osmosis", + name: "with app_config.go file", + path: "testdata/modules/app_config", + expectedModules: basicModules, + }, + { + name: "with runtime api routes", + path: "testdata/modules/runtime", + expectedModules: basicModules, + }, + { + name: "gaia", + path: "testdata/modules/gaia", expectedModules: []string{ "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", - "github.com/osmosis-labs/osmosis/v12/x/mint", + "github.com/cosmos/cosmos-sdk/x/mint", "github.com/cosmos/cosmos-sdk/x/distribution", "github.com/cosmos/cosmos-sdk/x/gov", "github.com/cosmos/cosmos-sdk/x/params", "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", - "github.com/cosmos/cosmos-sdk/x/authz/module", - "github.com/cosmos/ibc-go/v3/modules/core", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", + "github.com/cosmos/cosmos-sdk/x/group", + "github.com/cosmos/ibc-go/v5/modules/core", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", - "github.com/cosmos/ibc-go/v3/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", - "github.com/osmosis-labs/osmosis/v12/x/gamm", - "github.com/osmosis-labs/osmosis/v12/x/twap/twapmodule", - "github.com/osmosis-labs/osmosis/v12/x/txfees", - "github.com/osmosis-labs/osmosis/v12/x/incentives", - "github.com/osmosis-labs/osmosis/v12/x/lockup", - "github.com/osmosis-labs/osmosis/v12/x/pool-incentives", - "github.com/osmosis-labs/osmosis/v12/x/epochs", - "github.com/osmosis-labs/osmosis/v12/x/superfluid", - "github.com/osmosis-labs/osmosis/v12/x/tokenfactory", - "github.com/CosmWasm/wasmd/x/wasm", - "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts", - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", + "github.com/cosmos/ibc-go/v5/modules/apps/transfer", + "github.com/gravity-devs/liquidity/v2/x/liquidity", + "github.com/strangelove-ventures/packet-forward-middleware/v2/router", + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + "github.com/cosmos/gaia/v8/x/icamauth", }, }, { - name: "akash", - path: "testdata/modules/akash", + name: "crescent", + path: "testdata/modules/crescent", expectedModules: []string{ - "github.com/cosmos/cosmos-sdk/x/auth/tx", - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice", "github.com/cosmos/cosmos-sdk/x/auth", - "github.com/cosmos/cosmos-sdk/x/authz/module", - "github.com/cosmos/cosmos-sdk/x/genutil", "github.com/cosmos/cosmos-sdk/x/bank", "github.com/cosmos/cosmos-sdk/x/capability", "github.com/cosmos/cosmos-sdk/x/staking", - "github.com/cosmos/cosmos-sdk/x/mint", + "github.com/crescent-network/crescent/v3/x/mint", + "github.com/cosmos/cosmos-sdk/x/distribution", + "github.com/cosmos/cosmos-sdk/x/gov", + "github.com/cosmos/cosmos-sdk/x/params", + "github.com/cosmos/cosmos-sdk/x/crisis", + "github.com/cosmos/cosmos-sdk/x/slashing", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", + "github.com/cosmos/ibc-go/v2/modules/core", + "github.com/cosmos/cosmos-sdk/x/upgrade", + "github.com/cosmos/cosmos-sdk/x/evidence", + "github.com/cosmos/ibc-go/v2/modules/apps/transfer", + "github.com/tendermint/budget/x/budget", + "github.com/crescent-network/crescent/v3/x/farming", + "github.com/crescent-network/crescent/v3/x/liquidity", + "github.com/crescent-network/crescent/v3/x/liquidstaking", + "github.com/crescent-network/crescent/v3/x/liquidfarming", + "github.com/crescent-network/crescent/v3/x/claim", + "github.com/crescent-network/crescent/v3/x/marketmaker", + "github.com/crescent-network/crescent/v3/x/lpfarm", + }, + }, + { + name: "spn", + path: "testdata/modules/spn", + expectedModules: []string{ + "github.com/cosmos/cosmos-sdk/x/auth", + "github.com/cosmos/cosmos-sdk/x/bank", + "github.com/cosmos/cosmos-sdk/x/capability", + "github.com/cosmos/cosmos-sdk/x/staking", + "github.com/ignite/modules/x/mint", + "github.com/cosmos/cosmos-sdk/x/distribution", + "github.com/cosmos/cosmos-sdk/x/gov", + "github.com/cosmos/cosmos-sdk/x/params", + "github.com/cosmos/cosmos-sdk/x/crisis", + "github.com/cosmos/cosmos-sdk/x/slashing", + "github.com/cosmos/cosmos-sdk/x/feegrant", + "github.com/cosmos/cosmos-sdk/x/authz", + "github.com/cosmos/ibc-go/v6/modules/core", + "github.com/cosmos/cosmos-sdk/x/upgrade", + "github.com/cosmos/cosmos-sdk/x/evidence", + "github.com/cosmos/ibc-go/v6/modules/apps/transfer", + "github.com/tendermint/spn/x/participation", + "github.com/ignite/modules/x/claim", + "github.com/tendermint/spn/x/profile", + "github.com/tendermint/spn/x/launch", + "github.com/tendermint/spn/x/campaign", + "github.com/tendermint/spn/x/monitoringc", + "github.com/tendermint/spn/x/monitoringp", + "github.com/tendermint/spn/x/reward", + "github.com/tendermint/fundraising/x/fundraising", + }, + }, + { + name: "juno", + path: "testdata/modules/juno", + expectedModules: []string{ + "github.com/cosmos/cosmos-sdk/x/auth", + "github.com/cosmos/cosmos-sdk/x/bank", + "github.com/cosmos/cosmos-sdk/x/capability", + "github.com/cosmos/cosmos-sdk/x/staking", + "github.com/CosmosContracts/juno/v10/x/mint", "github.com/cosmos/cosmos-sdk/x/distribution", "github.com/cosmos/cosmos-sdk/x/gov", "github.com/cosmos/cosmos-sdk/x/params", "github.com/cosmos/cosmos-sdk/x/crisis", "github.com/cosmos/cosmos-sdk/x/slashing", "github.com/cosmos/ibc-go/v3/modules/core", + "github.com/cosmos/cosmos-sdk/x/feegrant", "github.com/cosmos/cosmos-sdk/x/upgrade", "github.com/cosmos/cosmos-sdk/x/evidence", "github.com/cosmos/ibc-go/v3/modules/apps/transfer", - "github.com/cosmos/cosmos-sdk/x/auth/vesting", + "github.com/cosmos/cosmos-sdk/x/authz", + "github.com/CosmWasm/wasmd/x/wasm", "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts", - "github.com/ovrclk/akash/x/icaauth", - "github.com/ovrclk/akash/x/escrow", - "github.com/ovrclk/akash/x/deployment", - "github.com/ovrclk/akash/x/market", - "github.com/ovrclk/akash/x/provider", - "github.com/ovrclk/akash/x/audit", - "github.com/ovrclk/akash/x/cert", - "github.com/ovrclk/akash/x/inflation", }, }, } for _, tt := range cases { t.Run(tt.name, func(t *testing.T) { - m, err := app.FindRegisteredModules(tt.path) - + appPkg, _, err := xast.ParseDir(tt.path) require.NoError(t, err) - require.ElementsMatch(t, tt.expectedModules, m) + + got := make([]string, 0) + for _, f := range appPkg.Files { + fileImports := goanalysis.FormatImports(f) + modules, err := FindKeepersModules(f, fileImports) + require.NoError(t, err) + if modules != nil { + got = append(got, modules...) + } + } + require.ElementsMatch(t, tt.expectedModules, got) }) } } -func TestCheckAppWiring(t *testing.T) { +func Test_mergeImports(t *testing.T) { tests := []struct { - name string - appFile []byte - want bool - err error + name string + blankImports []string + discovered []string + want []string }{ { - name: "valid case", - appFile: AppV2, - want: true, - err: nil, + name: "test nil imports", + blankImports: nil, + discovered: nil, + want: nil, }, { - name: "invalid case", - appFile: AppMinimalFile, - want: false, + name: "test empty imports", + blankImports: []string{}, + discovered: []string{}, + want: []string{}, }, { - name: "invalid file", - appFile: nil, - err: errors.New("expected 'package', found 'EOF'"), + name: "test only one blank import", + blankImports: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + discovered: []string{}, + want: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + }, + { + name: "test only one discovered import", + blankImports: []string{}, + discovered: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + want: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + }, + { + name: "test only one import", + blankImports: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + discovered: []string{"github.com/cosmos/cosmos-sdk/x/auth/keeper"}, + want: []string{"github.com/cosmos/cosmos-sdk/x/auth"}, + }, + { + name: "test only one keeper import", + blankImports: []string{"github.com/cosmos/cosmos-sdk/x/auth/module"}, + discovered: []string{"github.com/cosmos/cosmos-sdk/x/auth/keeper"}, + want: []string{"github.com/cosmos/cosmos-sdk/x/auth/module"}, + }, + { + name: "test two keeper import", + blankImports: []string{ + "github.com/cosmos/cosmos-sdk/x/auth/module", + "github.com/cosmos/cosmos-sdk/x/bank/module", + }, + discovered: []string{ + "github.com/cosmos/cosmos-sdk/x/auth/keeper", + "github.com/cosmos/cosmos-sdk/x/bank/keeper", + }, + want: []string{ + "github.com/cosmos/cosmos-sdk/x/auth/module", + "github.com/cosmos/cosmos-sdk/x/bank/module", + }, + }, + { + name: "test two keeper import", + blankImports: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + }, + discovered: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper", + "github.com/cosmos/cosmos-sdk/x/bank/keeper", + }, + want: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + "github.com/cosmos/cosmos-sdk/x/bank/keeper", + }, + }, + { + name: "test keeper imports", + blankImports: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + "cosmossdk.io/x/feegrant/module", + }, + discovered: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper", + "github.com/cosmos/cosmos-sdk/x/bank/keeper", + "cosmossdk.io/x/feegrant/types", + "cosmossdk.io/x/feegrant", + "cosmossdk.io/x/foo", + }, + want: []string{ + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + "github.com/cosmos/cosmos-sdk/x/bank/keeper", + "cosmossdk.io/x/feegrant/module", + "cosmossdk.io/x/foo", + }, + }, + { + name: "test three keeper import", + blankImports: []string{ + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts", + "github.com/cosmos/ibc-go/modules/capability", + }, + discovered: []string{ + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts", + "github.com/cosmos/ibc-go/modules/capability", + }, + want: []string{ + "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts", + "github.com/cosmos/ibc-go/modules/capability", + }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - tmpDir := t.TempDir() - tmpFile := filepath.Join(tmpDir, "app.go") - err := os.WriteFile(tmpFile, tt.appFile, 0o644) - require.NoError(t, err) + got := mergeImports(tt.blankImports, tt.discovered) + require.ElementsMatch(t, tt.want, got) + }) + } +} - got, err := app.CheckAppWiring(tmpDir) - if tt.err != nil { - require.Error(t, err) - require.Contains(t, err.Error(), tt.err.Error()) - return - } - require.NoError(t, err) +func Test_removeKeeperPkgPath(t *testing.T) { + tests := []struct { + name string + arg string + want string + }{ + { + name: "test controller keeper", + arg: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper", + want: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + }, + { + name: "test controller", + arg: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller", + want: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + }, + { + name: "test keeper", + arg: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/keeper", + want: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + }, + { + name: "test controller keeper", + arg: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/controller/keeper", + want: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts", + }, + { + name: "test host controller keeper", + arg: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/host/keeper", + want: "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := removeKeeperPkgPath(tt.arg) require.Equal(t, tt.want, got) }) } diff --git a/ignite/pkg/cosmosanalysis/app/parse.go b/ignite/pkg/cosmosanalysis/app/parse.go deleted file mode 100644 index 75feceafeb..0000000000 --- a/ignite/pkg/cosmosanalysis/app/parse.go +++ /dev/null @@ -1,226 +0,0 @@ -package app - -import ( - "go/ast" - "go/build" - - "github.com/pkg/errors" - - "github.com/ignite/cli/ignite/pkg/goanalysis" - "github.com/ignite/cli/ignite/pkg/xast" -) - -func parseAppModulesFromIdent(n *ast.Ident, pkgDir string) ([]string, error) { - if n == nil { - return nil, errors.Errorf("nil node") - } - if n.Obj == nil { - // The variable is defined in another file within the same package - return parseAppModulesFromPkgIdent(n.Name, pkgDir) - } - - // Variable declaration within the same file - decl, ok := n.Obj.Decl.(*ast.ValueSpec) - if !ok { - return nil, newUnexpectedTypeErr(n.Obj.Decl) - } - - values, ok := decl.Values[0].(*ast.CompositeLit) - if !ok { - return nil, newUnexpectedTypeErr(decl.Values[0]) - } - - var pkgNames []string - for _, e := range values.Elts { - switch v := e.(type) { - case *ast.CompositeLit: - vt, ok := v.Type.(*ast.SelectorExpr) - if !ok { - continue - } - - if pkg, ok := vt.X.(*ast.Ident); ok { - pkgNames = append(pkgNames, pkg.Name) - } - case *ast.CallExpr: - ps, err := parsePkgNameFromCall(v, pkgDir) - if err != nil { - return nil, err - } - pkgNames = append(pkgNames, ps...) - default: - return nil, newUnexpectedTypeErr(e) - } - } - - return pkgNames, nil -} - -func parseAppModulesFromSelectorExpr(n *ast.SelectorExpr, pkgDir string, fileImports map[string]string) ([]string, error) { - // Get the name of the package where the app modules variable is defined - ident, ok := n.X.(*ast.Ident) - if !ok { - return nil, newUnexpectedTypeErr(n.X) - } - - // Get the import path of that package and resolve the full path to it - ctx := build.Default - ctx.Dir = pkgDir - - pkg, err := ctx.Import(fileImports[ident.Name], "", build.FindOnly) - if err != nil { - return nil, errors.WithStack(err) - } - - return parseAppModulesFromPkgIdent(n.Sel.Name, pkg.Dir) -} - -func parseAppModulesFromPkgIdent(identName, pkgDir string) ([]string, error) { - pkg, _, err := xast.ParseDir(pkgDir) - if err != nil { - return nil, errors.WithStack(err) - } - - for _, f := range pkg.Files { - ident := f.Scope.Objects[identName] - if ident == nil { - continue - } - - var pkgNames []string - switch decl := ident.Decl.(type) { - case *ast.FuncDecl: - pkgNames, err = parsePkgNameFromFuncDecl(decl, pkgDir) - if err != nil { - return nil, err - } - - case *ast.ValueSpec: - values, ok := decl.Values[0].(*ast.CompositeLit) - if !ok { - continue - } - - for _, e := range values.Elts { - switch v := e.(type) { - case *ast.CompositeLit: - // The app module is defined using a struct - ps, err := parsePkgNameFromCompositeLit(v, pkgDir) - if err != nil { - return nil, err - } - pkgNames = append(pkgNames, ps...) - - case *ast.CallExpr: - // The app module is defined using a function call that returns it - ps, err := parsePkgNameFromCall(v, pkgDir) - if err != nil { - return nil, err - } - pkgNames = append(pkgNames, ps...) - } - } - } - imports := goanalysis.FormatImports(f) - var packages []string - for _, pkgName := range pkgNames { - if p := imports[pkgName]; p != "" { - packages = append(packages, p) - } - } - return packages, nil - } - return nil, errors.Errorf("unable to find identifier %s in package %s", identName, pkgDir) -} - -func parsePkgNameFromCompositeLit(n *ast.CompositeLit, pkgDir string) ([]string, error) { - switch v := n.Type.(type) { - case *ast.SelectorExpr: - if pkg, ok := v.X.(*ast.Ident); ok { - return []string{pkg.Name}, nil - } - return nil, newUnexpectedTypeErr(v.X) - case *ast.ArrayType: - var pkgs []string - for _, elt := range n.Elts { - switch elt := elt.(type) { - case *ast.CompositeLit: - ps, err := parsePkgNameFromCompositeLit(elt, pkgDir) - if err != nil { - return nil, err - } - pkgs = append(pkgs, ps...) - case *ast.CallExpr: - ps, err := parsePkgNameFromCall(elt, pkgDir) - if err != nil { - return nil, err - } - pkgs = append(pkgs, ps...) - default: - return nil, newUnexpectedTypeErr(elt) - } - } - return pkgs, nil - } - return nil, newUnexpectedTypeErr(n.Type) -} - -func parsePkgNameFromCall(n *ast.CallExpr, pkgDir string) ([]string, error) { - switch f := n.Fun.(type) { - - case *ast.SelectorExpr: - if pkg, ok := f.X.(*ast.Ident); ok { - return []string{pkg.Name}, nil - } - return nil, newUnexpectedTypeErr(f.X) - - case *ast.Ident: - if f.Name == "append" { - var pkgs []string - for _, arg := range n.Args { - switch arg := arg.(type) { - case *ast.CompositeLit: - ps, err := parsePkgNameFromCompositeLit(arg, pkgDir) - if err != nil { - return nil, err - } - pkgs = append(pkgs, ps...) - - case *ast.CallExpr: - ps, err := parsePkgNameFromCall(arg, pkgDir) - if err != nil { - return nil, err - } - pkgs = append(pkgs, ps...) - - default: - return nil, newUnexpectedTypeErr(arg) - } - } - return pkgs, nil - } - // read func return statement - if f.Obj == nil { - return parseAppModulesFromPkgIdent(f.Name, pkgDir) - } - fd, ok := f.Obj.Decl.(*ast.FuncDecl) - if !ok { - return nil, newUnexpectedTypeErr(f.Obj.Decl) - } - return parsePkgNameFromFuncDecl(fd, pkgDir) - } - return nil, newUnexpectedTypeErr(n.Fun) -} - -func parsePkgNameFromFuncDecl(f *ast.FuncDecl, pkgDir string) ([]string, error) { - lastBodyStmt := f.Body.List[len(f.Body.List)-1] - ret, ok := lastBodyStmt.(*ast.ReturnStmt) - if !ok { - return nil, newUnexpectedTypeErr(lastBodyStmt) - } - c, ok := ret.Results[0].(*ast.CompositeLit) - if !ok { - return nil, newUnexpectedTypeErr(ret.Results[0]) - } - return parsePkgNameFromCompositeLit(c, pkgDir) -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/app_generic.go b/ignite/pkg/cosmosanalysis/app/testdata/app_generic.go index 2524955dc2..d3b6b88597 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/app_generic.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/app_generic.go @@ -2,8 +2,10 @@ package foo import ( "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" abci "github.com/tendermint/tendermint/abci/types" app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" @@ -14,12 +16,16 @@ type Foo[T any] struct { i T } -func (f Foo[T]) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (f Foo[T]) TxConfig() client.TxConfig { return nil } -func (f Foo[T]) RegisterAPIRoutes() {} -func (f Foo[T]) RegisterTxService() {} -func (f Foo[T]) RegisterTendermintService() {} -func (f Foo[T]) Name() string { return app.BaseApp.Name() } +func (f Foo[T]) TxConfig() client.TxConfig { return nil } +func (f Foo[T]) RegisterAPIRoutes() {} +func (f Foo[T]) RegisterTxService() {} +func (f Foo[T]) RegisterTendermintService() {} +func (f Foo[T]) AppCodec() codec.Codec { return app.appCodec } +func (f Foo[T]) Name() string { return app.BaseApp.Name() } +func (f Foo[T]) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (f Foo[T]) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (f Foo[T]) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (f Foo[T]) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (f Foo[T]) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/app_minimal.go b/ignite/pkg/cosmosanalysis/app/testdata/app_minimal.go index 17f748a693..71ab8ba218 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/app_minimal.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/app_minimal.go @@ -2,8 +2,10 @@ package foo import ( "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" abci "github.com/tendermint/tendermint/abci/types" app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" @@ -13,12 +15,16 @@ type Foo struct { FooKeeper foo.keeper } -func (f Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (f Foo) TxConfig() client.TxConfig { return nil } -func (f Foo) RegisterAPIRoutes() {} -func (f Foo) RegisterTxService() {} -func (f Foo) RegisterTendermintService() {} -func (f Foo) Name() string { return app.BaseApp.Name() } +func (f Foo) TxConfig() client.TxConfig { return nil } +func (f Foo) RegisterAPIRoutes() {} +func (f Foo) RegisterTxService() {} +func (f Foo) RegisterTendermintService() {} +func (f Foo) Name() string { return app.BaseApp.Name() } +func (f Foo) AppCodec() codec.Codec { return app.appCodec } +func (F Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (F Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (F Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (F Foo) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (f Foo) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/app_v2.go b/ignite/pkg/cosmosanalysis/app/testdata/app_v2.go index 2ab7dfc842..ef9b9b78d1 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/app_v2.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/app_v2.go @@ -135,6 +135,7 @@ type SimApp struct { GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensuskeeper.Keeper + FooKeeper foo.keeper // simulation manager sm *module.SimulationManager @@ -337,8 +338,6 @@ func (app *SimApp) AutoCliOpts() autocli.AppOptions { } // GetKey returns the KVStoreKey for the provided store key. -// -// NOTE: This is solely to be used for testing purposes. func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { sk := app.UnsafeFindStoreKey(storeKey) kvStoreKey, ok := sk.(*storetypes.KVStoreKey) @@ -348,6 +347,17 @@ func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey { return kvStoreKey } +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *SimApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. func (app *SimApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { keys := make(map[string]*storetypes.KVStoreKey) for _, k := range app.GetStoreKeys() { @@ -360,8 +370,6 @@ func (app *SimApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { } // GetSubspace returns a param subspace for a given module name. -// -// NOTE: This is solely to be used for testing purposes. func (app *SimApp) GetSubspace(moduleName string) paramstypes.Subspace { subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app.go deleted file mode 100644 index dc378cbd1e..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app.go +++ /dev/null @@ -1,781 +0,0 @@ -package app - -import ( - "io" - "net/http" - "os" - "path/filepath" - "time" - - "cosmossdk.io/client/v2/autocli" - bam "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - "github.com/cosmos/cosmos-sdk/simapp" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/crisis" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/cosmos/cosmos-sdk/x/gov" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/mint" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v3/modules/apps/transfer" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" - "github.com/spf13/cast" - tmjson "github.com/tendermint/tendermint/libs/json" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/ovrclk/akash/x/inflation" - - "github.com/cosmos/cosmos-sdk/x/params" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/ovrclk/akash/x/audit" - "github.com/ovrclk/akash/x/cert" - escrowkeeper "github.com/ovrclk/akash/x/escrow/keeper" - - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" - - abci "github.com/tendermint/tendermint/abci/types" - tmos "github.com/tendermint/tendermint/libs/os" - - servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/version" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - - ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" - ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - ibcconnectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" - - dkeeper "github.com/ovrclk/akash/x/deployment/keeper" - mkeeper "github.com/ovrclk/akash/x/market/keeper" - pkeeper "github.com/ovrclk/akash/x/provider/keeper" - - icaauth "github.com/ovrclk/akash/x/icaauth" - icaauthkeeper "github.com/ovrclk/akash/x/icaauth/keeper" - icaauthtypes "github.com/ovrclk/akash/x/icaauth/types" - - // unnamed import of statik for swagger UI support - _ "github.com/ovrclk/akash/client/docs/statik" -) - -const ( - AppName = "akash" -) - -var ( - DefaultHome = os.ExpandEnv("$HOME/.akash") - _ servertypes.Application = (*AkashApp)(nil) - - // module accounts that are allowed to receive tokens - allowedReceivingModAcc = map[string]bool{} -) - -// AkashApp extends ABCI appplication -type AkashApp struct { - *bam.BaseApp - cdc *codec.LegacyAmino - appCodec codec.Codec - interfaceRegistry codectypes.InterfaceRegistry - - invCheckPeriod uint - - keys map[string]*sdk.KVStoreKey - tkeys map[string]*sdk.TransientStoreKey - memkeys map[string]*sdk.MemoryStoreKey - - keeper struct { - acct authkeeper.AccountKeeper - authz authzkeeper.Keeper - bank bankkeeper.Keeper - cap *capabilitykeeper.Keeper - staking stakingkeeper.Keeper - slashing slashingkeeper.Keeper - mint mintkeeper.Keeper - distr distrkeeper.Keeper - gov govkeeper.Keeper - crisis crisiskeeper.Keeper - upgrade upgradekeeper.Keeper - params paramskeeper.Keeper - ibc *ibckeeper.Keeper - evidence evidencekeeper.Keeper - transfer ibctransferkeeper.Keeper - icaHostKeeper icahostkeeper.Keeper - icaControllerKeeper icacontrollerkeeper.Keeper - icaAuthKeeper icaauthkeeper.Keeper - - // make scoped keepers public for test purposes - scopedIBCKeeper capabilitykeeper.ScopedKeeper - scopedTransferKeeper capabilitykeeper.ScopedKeeper - scopedICAControllerKeeper capabilitykeeper.ScopedKeeper - scopedICAHostKeeper capabilitykeeper.ScopedKeeper - scopedIcaAuthKeeper capabilitykeeper.ScopedKeeper - - // akash keepers - escrow escrowkeeper.Keeper - deployment dkeeper.IKeeper - market mkeeper.IKeeper - provider pkeeper.IKeeper - audit audit.Keeper - cert cert.Keeper - inflation inflation.Keeper - } - - mm *module.Manager - - // simulation manager - sm *module.SimulationManager - - // module configurator - configurator module.Configurator -} - -// https://github.com/cosmos/sdk-tutorials/blob/c6754a1e313eb1ed973c5c91dcc606f2fd288811/app.go#L73 - -// NewApp creates and returns a new Akash App. -func NewApp( - logger log.Logger, db dbm.DB, tio io.Writer, loadLatest bool, invCheckPeriod uint, skipUpgradeHeights map[int64]bool, - homePath string, appOpts servertypes.AppOptions, options ...func(*bam.BaseApp), -) *AkashApp { - // find out the genesis time, to be used later in inflation calculation - // genesisTime := getGenesisTime(appOpts, homePath) - - // TODO: Remove cdc in favor of appCodec once all modules are migrated. - encodingConfig := MakeEncodingConfig() - appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - - bapp := bam.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), options...) - bapp.SetCommitMultiStoreTracer(tio) - bapp.SetVersion(version.Version) - bapp.SetInterfaceRegistry(interfaceRegistry) - - keys := kvStoreKeys() - tkeys := transientStoreKeys() - memkeys := memStoreKeys() - - app := &AkashApp{ - BaseApp: bapp, - cdc: cdc, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, - keys: keys, - tkeys: tkeys, - memkeys: memkeys, - } - app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - - app.keeper.params = initParamsKeeper(appCodec, cdc, app.keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) - - // set the BaseApp's parameter store - bapp.SetParamStore(app.keeper.params.Subspace(bam.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) - - // add capability keeper and ScopeToModule for ibc module - app.keeper.cap = capabilitykeeper.NewKeeper(appCodec, app.keys[capabilitytypes.StoreKey], app.memkeys[capabilitytypes.MemStoreKey]) - - scopedIBCKeeper := app.keeper.cap.ScopeToModule(ibchost.ModuleName) - scopedTransferKeeper := app.keeper.cap.ScopeToModule(ibctransfertypes.ModuleName) - scopedIcaAuthKeeper := app.keeper.cap.ScopeToModule(icaauthtypes.ModuleName) - scopedICAControllerKeeper := app.keeper.cap.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.keeper.cap.ScopeToModule(icahosttypes.SubModuleName) - - // seal the capability keeper so all persistent capabilities are loaded in-memory and prevent - // any further modules from creating scoped sub-keepers. - app.keeper.cap.Seal() - - app.keeper.acct = authkeeper.NewAccountKeeper( - appCodec, - app.keys[authtypes.StoreKey], - app.GetSubspace(authtypes.ModuleName), - authtypes.ProtoBaseAccount, - MacPerms(), - ) - - // add authz keeper - app.keeper.authz = authzkeeper.NewKeeper(app.keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter()) - - app.keeper.bank = bankkeeper.NewBaseKeeper( - appCodec, - app.keys[banktypes.StoreKey], - app.keeper.acct, - app.GetSubspace(banktypes.ModuleName), - app.BlockedAddrs(), - ) - - skeeper := stakingkeeper.NewKeeper( - appCodec, - app.keys[stakingtypes.StoreKey], - app.keeper.acct, - app.keeper.bank, - app.GetSubspace(stakingtypes.ModuleName), - ) - - app.keeper.mint = mintkeeper.NewKeeper( - appCodec, - app.keys[minttypes.StoreKey], - app.GetSubspace(minttypes.ModuleName), - &skeeper, - app.keeper.acct, - app.keeper.bank, - authtypes.FeeCollectorName, - ) - - app.keeper.distr = distrkeeper.NewKeeper( - appCodec, - app.keys[distrtypes.StoreKey], - app.GetSubspace(distrtypes.ModuleName), - app.keeper.acct, - app.keeper.bank, - &skeeper, - authtypes.FeeCollectorName, - app.ModuleAccountAddrs(), - ) - - app.keeper.slashing = slashingkeeper.NewKeeper( - appCodec, - app.keys[slashingtypes.StoreKey], - &skeeper, - app.GetSubspace(slashingtypes.ModuleName), - ) - - app.keeper.crisis = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), - invCheckPeriod, - app.keeper.bank, - authtypes.FeeCollectorName, - ) - - app.keeper.upgrade = upgradekeeper.NewKeeper(skipUpgradeHeights, app.keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) - - // register the staking hooks - // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.keeper.staking = *skeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - app.keeper.distr.Hooks(), - app.keeper.slashing.Hooks(), - ), - ) - - // register IBC Keeper - app.keeper.ibc = ibckeeper.NewKeeper( - appCodec, app.keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), - app.keeper.staking, app.keeper.upgrade, scopedIBCKeeper, - ) - - // register the proposal types - govRouter := govtypes.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.keeper.params)). - AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.keeper.distr)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.keeper.upgrade)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.keeper.ibc.ClientKeeper)) - - app.keeper.gov = govkeeper.NewKeeper( - appCodec, - app.keys[govtypes.StoreKey], - app.GetSubspace(govtypes.ModuleName), - app.keeper.acct, - app.keeper.bank, - &skeeper, - govRouter, - ) - - // register Transfer Keepers - app.keeper.transfer = ibctransferkeeper.NewKeeper( - appCodec, app.keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), - app.keeper.ibc.ChannelKeeper, app.keeper.ibc.ChannelKeeper, &app.keeper.ibc.PortKeeper, - app.keeper.acct, app.keeper.bank, scopedTransferKeeper, - ) - - transferModule := transfer.NewAppModule(app.keeper.transfer) - transferIBCModule := transfer.NewIBCModule(app.keeper.transfer) - - app.keeper.icaControllerKeeper = icacontrollerkeeper.NewKeeper( - appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), - app.keeper.ibc.ChannelKeeper, // may be replaced with middleware such as ics29 fee - app.keeper.ibc.ChannelKeeper, &app.keeper.ibc.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), - ) - - app.keeper.icaHostKeeper = icahostkeeper.NewKeeper( - appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), - app.keeper.ibc.ChannelKeeper, &app.keeper.ibc.PortKeeper, - app.keeper.acct, scopedICAHostKeeper, app.MsgServiceRouter(), - ) - - icaModule := ica.NewAppModule(&app.keeper.icaControllerKeeper, &app.keeper.icaHostKeeper) - - app.keeper.icaAuthKeeper = icaauthkeeper.NewKeeper(appCodec, keys[icaauthtypes.StoreKey], app.keeper.icaControllerKeeper, scopedIcaAuthKeeper) - icaAuthModule := icaauth.NewAppModule(appCodec, app.keeper.icaAuthKeeper) - icaAuthIBCModule := icaauth.NewIBCModule(app.keeper.icaAuthKeeper) - - icaControllerIBCModule := icacontroller.NewIBCModule(app.keeper.icaControllerKeeper, icaAuthIBCModule) - icaHostIBCModule := icahost.NewIBCModule(app.keeper.icaHostKeeper) - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). - AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - AddRoute(ibctransfertypes.ModuleName, transferIBCModule). - AddRoute(icaauthtypes.ModuleName, icaControllerIBCModule) - - app.keeper.ibc.SetRouter(ibcRouter) - - // create evidence keeper with evidence router - evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, app.keys[evidencetypes.StoreKey], &app.keeper.staking, app.keeper.slashing, - ) - - // if evidence needs to be handled for the app, set routes in router here and seal - app.keeper.evidence = *evidenceKeeper - - app.setAkashKeepers() - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - app.mm = module.NewManager( - append([]module.AppModule{ - genutil.NewAppModule(app.keeper.acct, app.keeper.staking, app.BaseApp.DeliverTx, encodingConfig.TxConfig), - auth.NewAppModule(appCodec, app.keeper.acct, nil), - authzmodule.NewAppModule(appCodec, app.keeper.authz, app.keeper.acct, app.keeper.bank, app.interfaceRegistry), - vesting.NewAppModule(app.keeper.acct, app.keeper.bank), - bank.NewAppModule(appCodec, app.keeper.bank, app.keeper.acct), - capability.NewAppModule(appCodec, *app.keeper.cap), - crisis.NewAppModule(&app.keeper.crisis, skipGenesisInvariants), - gov.NewAppModule(appCodec, app.keeper.gov, app.keeper.acct, app.keeper.bank), - mint.NewAppModule(appCodec, app.keeper.mint, app.keeper.acct, nil), - slashing.NewAppModule(appCodec, app.keeper.slashing, app.keeper.acct, app.keeper.bank, app.keeper.staking), - distr.NewAppModule(appCodec, app.keeper.distr, app.keeper.acct, app.keeper.bank, app.keeper.staking), - staking.NewAppModule(appCodec, app.keeper.staking, app.keeper.acct, app.keeper.bank), - upgrade.NewAppModule(app.keeper.upgrade), - evidence.NewAppModule(app.keeper.evidence), - ibc.NewAppModule(app.keeper.ibc), - params.NewAppModule(app.keeper.params), - transferModule, - icaModule, - icaAuthModule, - }, app.akashAppModules()...)..., - ) - - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - // NOTE: As of v0.45.0 of cosmos SDK, all modules need to be here. - app.mm.SetOrderBeginBlockers( - app.akashBeginBlockModules()..., - ) - app.mm.SetOrderEndBlockers( - app.akashEndBlockModules()..., - ) - - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - app.mm.SetOrderInitGenesis( - app.akashInitGenesisOrder()..., - ) - - app.mm.RegisterInvariants(&app.keeper.crisis) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) - app.mm.RegisterServices(app.configurator) - - // add test gRPC service for testing gRPC queries in isolation - testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) - - app.sm = module.NewSimulationManager( - append([]module.AppModuleSimulation{ - auth.NewAppModule(appCodec, app.keeper.acct, authsims.RandomGenesisAccounts), - authzmodule.NewAppModule(appCodec, app.keeper.authz, app.keeper.acct, app.keeper.bank, app.interfaceRegistry), - bank.NewAppModule(appCodec, app.keeper.bank, app.keeper.acct), - capability.NewAppModule(appCodec, *app.keeper.cap), - gov.NewAppModule(appCodec, app.keeper.gov, app.keeper.acct, app.keeper.bank), - mint.NewAppModule(appCodec, app.keeper.mint, app.keeper.acct, nil), - staking.NewAppModule(appCodec, app.keeper.staking, app.keeper.acct, app.keeper.bank), - distr.NewAppModule(appCodec, app.keeper.distr, app.keeper.acct, app.keeper.bank, app.keeper.staking), - slashing.NewAppModule(appCodec, app.keeper.slashing, app.keeper.acct, app.keeper.bank, app.keeper.staking), - params.NewAppModule(app.keeper.params), - evidence.NewAppModule(app.keeper.evidence), - ibc.NewAppModule(app.keeper.ibc), - transferModule, - NewICAHostSimModule(icaModule, appCodec), - }, - app.akashSimModules()..., - )..., - ) - - app.sm.RegisterStoreDecoders() - - // initialize stores - app.MountKVStores(keys) - app.MountTransientStores(tkeys) - app.MountMemoryStores(memkeys) - - // initialize BaseApp - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) - - handler, err := ante.NewAnteHandler(ante.HandlerOptions{ - AccountKeeper: app.keeper.acct, - BankKeeper: app.keeper.bank, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - }) - if err != nil { - panic(err) - } - app.SetAnteHandler(handler) - - app.SetEndBlocker(app.EndBlocker) - - // register the upgrade handler - app.registerUpgradeHandlers(icaModule) - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit("app initialization:" + err.Error()) - } - } - - app.keeper.scopedIBCKeeper = scopedIBCKeeper - app.keeper.scopedTransferKeeper = scopedTransferKeeper - app.keeper.scopedICAControllerKeeper = scopedICAControllerKeeper - app.keeper.scopedICAHostKeeper = scopedICAHostKeeper - app.keeper.scopedIcaAuthKeeper = scopedIcaAuthKeeper - - return app -} - -func (app *AkashApp) registerUpgradeHandlers(icaModule ica.AppModule) { - app.keeper.upgrade.SetUpgradeHandler("akash_v0.15.0_cosmos_v0.44.x", func(ctx sdk.Context, - plan upgradetypes.Plan, _ module.VersionMap, - ) (module.VersionMap, error) { - // set max expected block time parameter. Replace the default with your expected value - app.keeper.ibc.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) - - // 1st-time running in-store migrations, using 1 as fromVersion to - // avoid running InitGenesis. - fromVM := map[string]uint64{ - "auth": 1, - "bank": 1, - "capability": 1, - "crisis": 1, - "distribution": 1, - "evidence": 1, - "gov": 1, - "mint": 1, - "params": 1, - "slashing": 1, - "staking": 1, - "upgrade": 1, - "vesting": 1, - "ibc": 1, - "genutil": 1, - "transfer": 1, - - // akash modules - "audit": 1, - "cert": 1, - "deployment": 1, - "escrow": 1, - "market": 1, - "provider": 1, - } - - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }) - - upgradeInfo, err := app.keeper.upgrade.ReadUpgradeInfoFromDisk() - if err != nil { - panic(err) - } - - if upgradeInfo.Name == "akash_v0.15.0_cosmos_v0.44.x" && !app.keeper.upgrade.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{"authz", "inflation"}, - } - - // configure store loader that checks if version == upgradeHeight and applies store upgrades - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } - - // ica upgrade - const upgradeName = "01-ica-upgrade" - app.keeper.upgrade.SetUpgradeHandler( - upgradeName, - func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - fromVM[icatypes.ModuleName] = icaModule.ConsensusVersion() - - // create ICS27 Controller submodule params - // enable the controller chain - controllerParams := icacontrollertypes.Params{ControllerEnabled: true} - - // create ICS27 Host submodule params - hostParams := icahosttypes.Params{ - // enable the host chain - HostEnabled: true, - // allowing the all messages - AllowMessages: []string{"*"}, - } - - ctx.Logger().Info("start to init interchainaccount module...") - // initialize ICS27 module - icaModule.InitModule(ctx, controllerParams, hostParams) - - ctx.Logger().Info("start to run module migrations...") - - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }, - ) - - if upgradeInfo.Name == upgradeName && !app.keeper.upgrade.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{icacontrollertypes.StoreKey, icahosttypes.StoreKey}, - } - - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) - } -} - -func getGenesisTime(appOpts servertypes.AppOptions, homePath string) time.Time { // nolint: unused,deadcode - if v := appOpts.Get("GenesisTime"); v != nil { - // in tests, GenesisTime is supplied using appOpts - genTime, ok := v.(time.Time) - if !ok { - panic("expected GenesisTime to be a Time value") - } - return genTime - } - - genDoc, err := tmtypes.GenesisDocFromFile(filepath.Join(homePath, "config/genesis.json")) - if err != nil { - panic(err) - } - - return genDoc.GenesisTime -} - -// MakeCodecs constructs the *std.Codec and *codec.LegacyAmino instances used by -// simapp. It is useful for tests and clients who do not want to construct the -// full simapp -func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { - config := MakeEncodingConfig() - return config.Marshaler, config.Amino -} - -// Name returns the name of the App -func (app *AkashApp) Name() string { return app.BaseApp.Name() } - -// InitChainer application update at chain initialization -func (app *AkashApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - var genesisState simapp.GenesisState - if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - app.keeper.upgrade.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) -} - -// BeginBlocker is a function in which application updates every begin block -func (app *AkashApp) BeginBlocker( - ctx sdk.Context, req abci.RequestBeginBlock, -) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) -} - -// EndBlocker is a function in which application updates every end block -func (app *AkashApp) EndBlocker( - ctx sdk.Context, req abci.RequestEndBlock, -) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} - -// LegacyAmino returns AkashApp's amino codec. -func (app *AkashApp) LegacyAmino() *codec.LegacyAmino { - return app.cdc -} - -// AppCodec returns AkashApp's app codec. -func (app *AkashApp) AppCodec() codec.Codec { - return app.appCodec -} - -// ModuleAccountAddrs returns all the app's module account addresses. -func (app *AkashApp) ModuleAccountAddrs() map[string]bool { - return MacAddrs() -} - -// BlockedAddrs returns all the app's module account addresses that are not -// allowed to receive external tokens. -func (app *AkashApp) BlockedAddrs() map[string]bool { - perms := MacPerms() - blockedAddrs := make(map[string]bool) - for acc := range perms { - blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] - } - - return blockedAddrs -} - -// InterfaceRegistry returns AkashApp's InterfaceRegistry -func (app *AkashApp) InterfaceRegistry() codectypes.InterfaceRegistry { - return app.interfaceRegistry -} - -// GetKey returns the KVStoreKey for the provided store key. -func (app *AkashApp) GetKey(storeKey string) *sdk.KVStoreKey { - return app.keys[storeKey] -} - -// GetTKey returns the TransientStoreKey for the provided store key. -func (app *AkashApp) GetTKey(storeKey string) *sdk.TransientStoreKey { - return app.tkeys[storeKey] -} - -// GetSubspace returns a param subspace for a given module name. -func (app *AkashApp) GetSubspace(moduleName string) paramstypes.Subspace { - subspace, _ := app.keeper.params.GetSubspace(moduleName) - return subspace -} - -// SimulationManager implements the SimulationApp interface -func (app *AkashApp) SimulationManager() *module.SimulationManager { - return app.sm -} - -// RegisterAPIRoutes registers all application module routes with the provided -// API server. -func (app *AkashApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) - // Register legacy tx routes - authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) - // Register new tx routes from grpc-gateway - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register legacy and grpc-gateway routes for all modules. - ModuleBasics().RegisterRESTRoutes(clientCtx, apiSvr.Router) - ModuleBasics().RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // register swagger API from root so that other applications can override easily - if apiConfig.Swagger { - RegisterSwaggerAPI(clientCtx, apiSvr.Router) - } -} - -// RegisterTxService implements the Application.RegisterTxService method. -func (app *AkashApp) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) -} - -// RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *AkashApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) -} - -// RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { - statikFS, err := fs.New() - if err != nil { - panic(err) - } - - staticServer := http.FileServer(statikFS) - rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) -} - -// LoadHeight method of AkashApp loads baseapp application version with given height -func (app *AkashApp) LoadHeight(height int64) error { - return app.LoadVersion(height) -} - -func (AkashApp) TxConfig() client.TxConfig { return nil } -func (AkashApp) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } - -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, - tkey sdk.StoreKey, -) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibchost.ModuleName) - paramsKeeper.Subspace(icacontrollertypes.SubModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) - - return akashSubspaces(paramsKeeper) -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app_configure.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app_configure.go deleted file mode 100644 index 35170c8d3a..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/app_configure.go +++ /dev/null @@ -1,298 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" - transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - "github.com/ovrclk/akash/x/audit" - audittypes "github.com/ovrclk/akash/x/audit/types/v1beta2" - "github.com/ovrclk/akash/x/cert" - certtypes "github.com/ovrclk/akash/x/cert/types/v1beta2" - "github.com/ovrclk/akash/x/deployment" - deploymenttypes "github.com/ovrclk/akash/x/deployment/types/v1beta2" - "github.com/ovrclk/akash/x/escrow" - ekeeper "github.com/ovrclk/akash/x/escrow/keeper" - escrowtypes "github.com/ovrclk/akash/x/escrow/types/v1beta2" - "github.com/ovrclk/akash/x/inflation" - inflationtypes "github.com/ovrclk/akash/x/inflation/types/v1beta2" - "github.com/ovrclk/akash/x/market" - mhooks "github.com/ovrclk/akash/x/market/hooks" - markettypes "github.com/ovrclk/akash/x/market/types/v1beta2" - "github.com/ovrclk/akash/x/provider" - providertypes "github.com/ovrclk/akash/x/provider/types/v1beta2" - - icaauthtypes "github.com/ovrclk/akash/x/icaauth/types" -) - -func akashModuleBasics() []module.AppModuleBasic { - return []module.AppModuleBasic{ - escrow.AppModuleBasic{}, - deployment.AppModuleBasic{}, - market.AppModuleBasic{}, - provider.AppModuleBasic{}, - audit.AppModuleBasic{}, - cert.AppModuleBasic{}, - inflation.AppModuleBasic{}, - } -} - -func akashKVStoreKeys() []string { - return []string{ - escrow.StoreKey, - deployment.StoreKey, - market.StoreKey, - provider.StoreKey, - audit.StoreKey, - cert.StoreKey, - inflation.StoreKey, - } -} - -func akashSubspaces(k paramskeeper.Keeper) paramskeeper.Keeper { - k.Subspace(deployment.ModuleName) - k.Subspace(market.ModuleName) - k.Subspace(inflation.ModuleName) - return k -} - -func (app *AkashApp) setAkashKeepers() { - app.keeper.escrow = ekeeper.NewKeeper( - app.appCodec, - app.keys[escrow.StoreKey], - app.keeper.bank, - ) - - app.keeper.deployment = deployment.NewKeeper( - app.appCodec, - app.keys[deployment.StoreKey], - app.GetSubspace(deployment.ModuleName), - app.keeper.escrow, - ) - - app.keeper.market = market.NewKeeper( - app.appCodec, - app.keys[market.StoreKey], - app.GetSubspace(market.ModuleName), - app.keeper.escrow, - ) - - hook := mhooks.New(app.keeper.deployment, app.keeper.market) - - app.keeper.escrow.AddOnAccountClosedHook(hook.OnEscrowAccountClosed) - app.keeper.escrow.AddOnPaymentClosedHook(hook.OnEscrowPaymentClosed) - - app.keeper.provider = provider.NewKeeper( - app.appCodec, - app.keys[provider.StoreKey], - ) - - app.keeper.audit = audit.NewKeeper( - app.appCodec, - app.keys[audit.StoreKey], - ) - - app.keeper.cert = cert.NewKeeper( - app.appCodec, - app.keys[cert.StoreKey], - ) - - app.keeper.inflation = inflation.NewKeeper( - app.appCodec, - app.keys[inflation.StoreKey], - app.GetSubspace(inflation.ModuleName), - ) -} - -func (app *AkashApp) akashAppModules() []module.AppModule { - return []module.AppModule{ - escrow.NewAppModule( - app.appCodec, - app.keeper.escrow, - ), - - deployment.NewAppModule( - app.appCodec, - app.keeper.deployment, - app.keeper.market, - app.keeper.escrow, - app.keeper.bank, - app.keeper.authz, - ), - - market.NewAppModule( - app.appCodec, - app.keeper.market, - app.keeper.escrow, - app.keeper.audit, - app.keeper.deployment, - app.keeper.provider, - app.keeper.bank, - ), - - provider.NewAppModule( - app.appCodec, - app.keeper.provider, - app.keeper.bank, - app.keeper.market, - ), - - audit.NewAppModule( - app.appCodec, - app.keeper.audit, - ), - - cert.NewAppModule( - app.appCodec, - app.keeper.cert, - ), - - inflation.NewAppModule( - app.appCodec, - app.keeper.inflation, - ), - } -} - -// akashEndBlockModules returns all end block modules. -func (app *AkashApp) akashBeginBlockModules() []string { - return []string{ - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - banktypes.ModuleName, - paramstypes.ModuleName, - deploymenttypes.ModuleName, - govtypes.ModuleName, - providertypes.ModuleName, - certtypes.ModuleName, - markettypes.ModuleName, - audittypes.ModuleName, - genutiltypes.ModuleName, - vestingtypes.ModuleName, - crisistypes.ModuleName, - inflationtypes.ModuleName, - authtypes.ModuleName, - authz.ModuleName, - escrowtypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - transfertypes.ModuleName, - ibchost.ModuleName, - icatypes.ModuleName, - icaauthtypes.ModuleName, - } -} - -// akashEndBlockModules returns all end block modules. -func (app *AkashApp) akashEndBlockModules() []string { - return []string{ - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - upgradetypes.ModuleName, - capabilitytypes.ModuleName, - banktypes.ModuleName, - paramstypes.ModuleName, - deploymenttypes.ModuleName, - providertypes.ModuleName, - certtypes.ModuleName, - markettypes.ModuleName, - audittypes.ModuleName, - genutiltypes.ModuleName, - vestingtypes.ModuleName, - inflationtypes.ModuleName, - authtypes.ModuleName, - authz.ModuleName, - escrowtypes.ModuleName, - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - transfertypes.ModuleName, - ibchost.ModuleName, - icatypes.ModuleName, - icaauthtypes.ModuleName, - } -} - -func (app *AkashApp) akashInitGenesisOrder() []string { - return []string{ - capabilitytypes.ModuleName, - authtypes.ModuleName, - authz.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - vestingtypes.ModuleName, - paramstypes.ModuleName, - audittypes.ModuleName, - upgradetypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - ibchost.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - transfertypes.ModuleName, - icatypes.ModuleName, - icaauthtypes.ModuleName, - cert.ModuleName, - escrow.ModuleName, - deployment.ModuleName, - provider.ModuleName, - market.ModuleName, - inflation.ModuleName, - } -} - -func (app *AkashApp) akashSimModules() []module.AppModuleSimulation { - return []module.AppModuleSimulation{ - deployment.NewAppModuleSimulation( - app.keeper.deployment, - app.keeper.acct, - app.keeper.bank, - ), - - market.NewAppModuleSimulation( - app.keeper.market, - app.keeper.acct, - app.keeper.deployment, - app.keeper.provider, - app.keeper.bank, - ), - - provider.NewAppModuleSimulation( - app.keeper.provider, - app.keeper.acct, - app.keeper.bank, - ), - - cert.NewAppModuleSimulation( - app.keeper.cert, - ), - - inflation.NewAppModuleSimulation( - app.keeper.inflation, - ), - } -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/config.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/config.go deleted file mode 100644 index 7cdf35b468..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/akash/config.go +++ /dev/null @@ -1,139 +0,0 @@ -package app - -import ( - simparams "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/cosmos/cosmos-sdk/std" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/cosmos/cosmos-sdk/x/gov" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/mint" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/cosmos/cosmos-sdk/x/params" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/cosmos-sdk/x/slashing" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" - icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" - icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" - transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - - appparams "github.com/ovrclk/akash/app/params" - icaauth "github.com/ovrclk/akash/x/icaauth" - icaauthtypes "github.com/ovrclk/akash/x/icaauth/types" -) - -var mbasics = module.NewBasicManager( - append([]module.AppModuleBasic{ - // accounts, fees. - auth.AppModuleBasic{}, - // authorizations - authzmodule.AppModuleBasic{}, - // genesis utilities - genutil.AppModuleBasic{}, - // tokens, token balance. - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - // validator staking - staking.AppModuleBasic{}, - // inflation - mint.AppModuleBasic{}, - // distribution of fess and inflation - distr.AppModuleBasic{}, - // governance functionality (voting) - gov.NewAppModuleBasic( - paramsclient.ProposalHandler, distrclient.ProposalHandler, - upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, - ibcclient.UpdateClientProposalHandler, ibcclient.UpgradeProposalHandler, - ), - // chain parameters - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - ibc.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - vesting.AppModuleBasic{}, - ica.AppModuleBasic{}, - icaauth.AppModuleBasic{}, - }, - // akash - akashModuleBasics()..., - )..., -) - -// ModuleBasics returns all app modules basics -func ModuleBasics() module.BasicManager { - return mbasics -} - -// MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() simparams.EncodingConfig { - encodingConfig := appparams.MakeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - mbasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - mbasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} - -func kvStoreKeys() map[string]*sdk.KVStoreKey { - return sdk.NewKVStoreKeys( - append([]string{ - authtypes.StoreKey, - authzkeeper.StoreKey, - banktypes.StoreKey, - stakingtypes.StoreKey, - minttypes.StoreKey, - distrtypes.StoreKey, - slashingtypes.StoreKey, - govtypes.StoreKey, - paramstypes.StoreKey, - ibchost.StoreKey, - upgradetypes.StoreKey, - evidencetypes.StoreKey, - icacontrollertypes.StoreKey, - ibctransfertypes.StoreKey, - capabilitytypes.StoreKey, - icaauthtypes.StoreKey, - icahosttypes.StoreKey, - }, - akashKVStoreKeys()..., - )..., - ) -} - -func transientStoreKeys() map[string]*sdk.TransientStoreKey { - return sdk.NewTransientStoreKeys(paramstypes.TStoreKey) -} - -func memStoreKeys() map[string]*sdk.MemoryStoreKey { - return sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/api_routes/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/api_routes/app.go deleted file mode 100644 index 4a55149f51..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/api_routes/app.go +++ /dev/null @@ -1,58 +0,0 @@ -package app - -import ( - "cosmossdk.io/api/tendermint/abci" - "cosmossdk.io/client/v2/autocli" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined as NewBasicManager arguments -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) - -type Foo struct{} - -func (Foo) Name() string { return "foo" } -func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } -func (Foo) TxConfig() client.TxConfig { return nil } -func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(s *api.Server, cfg config.APIConfig) { - // These two modules should be discovered too - authtx.RegisterGRPCGatewayRoutes(s.ClientCtx, s.GRPCGatewayRouter) - tmservice.RegisterGRPCGatewayRoutes(s.ClientCtx, s.GRPCGatewayRouter) -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app.go new file mode 100644 index 0000000000..c26b0eef3d --- /dev/null +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app.go @@ -0,0 +1,104 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gogo/protobuf/codec" + abci "github.com/tendermint/tendermint/abci/types" + fookeeper "github.com/username/test/x/foo/keeper" +) + +type Foo struct { + AuthKeeper authkeeper.Keeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + GovKeeper govkeeper.Keeper + FooKeeper fookeeper.Keeper +} + +func (Foo) Name() string { + return "foo" +} + +func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { + return abci.ResponseBeginBlock{} +} + +func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { + return abci.ResponseEndBlock{} +} + +func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + _ = apiSvr.ClientCtx +} + +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } + +func (Foo) TxConfig() client.TxConfig { return nil } + +func (Foo) AppCodec() codec.Codec { + return app.appCodec +} + +// GetKey returns the KVStoreKey for the provided store key. +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (Foo) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (Foo) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app_config.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app_config.go new file mode 100644 index 0000000000..42e35eaa42 --- /dev/null +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/app_config/app_config.go @@ -0,0 +1,313 @@ +package app + +import ( + "time" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" + bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" + consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" + distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" + feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" + govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" + groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" + mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" + paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" + slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" + stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" + txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" + upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" + vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" + "cosmossdk.io/core/appconfig" + "cosmossdk.io/depinject" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/module" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + "google.golang.org/protobuf/types/known/durationpb" + + marsmodulev1 "github.com/ignite/mars/api/mars/mars/module" + _ "github.com/ignite/mars/x/mars" // import for side-effects + marsmoduletypes "github.com/ignite/mars/x/mars/types" + // this line is used by starport scaffolding # stargate/app/moduleImport +) + +var ( + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder = []string{ + // cosmos sdk modules + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + circuittypes.ModuleName, + // ibc modules + // capabilitytypes.ModuleName, + // ibcexported.ModuleName, + // ibctransfertypes.ModuleName, + // icatypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/initGenesis + } + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + beginBlockers = []string{ + // cosmos sdk modules + upgradetypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/beginBlockers + } + + endBlockers = []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/endBlockers + } + + // module account permissions + moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ + {Account: authtypes.FeeCollectorName}, + {Account: distrtypes.ModuleName}, + {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, + {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, + {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } + + // blocked account addresses + blockAccAddrs = []string{ + authtypes.FeeCollectorName, + distrtypes.ModuleName, + minttypes.ModuleName, + stakingtypes.BondedPoolName, + stakingtypes.NotBondedPoolName, + // We allow the following module accounts to receive funds: + // govtypes.ModuleName + } + + // AppConfig application configuration (used by depinject) + AppConfig = depinject.Configs(appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: runtime.ModuleName, + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: Name, + BeginBlockers: beginBlockers, + EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, + OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ + { + ModuleName: authtypes.ModuleName, + KvStoreKey: "acc", + }, + }, + // When ExportGenesis is not specified, the export genesis module order + // is equal to the init genesis order + // ExportGenesis: genesisModuleOrder, + // Uncomment if you want to set a custom migration order here. + // OrderMigrations: nil, + }), + }, + { + Name: authtypes.ModuleName, + Config: appconfig.WrapAny(&authmodulev1.Module{ + Bech32Prefix: AccountAddressPrefix, + ModuleAccountPermissions: moduleAccPerms, + // By default modules authority is the governance module. This is configurable with the following: + // Authority: "group", // A custom module authority can be set using a module name + // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address + }), + }, + { + Name: vestingtypes.ModuleName, + Config: appconfig.WrapAny(&vestingmodulev1.Module{}), + }, + { + Name: banktypes.ModuleName, + Config: appconfig.WrapAny(&bankmodulev1.Module{ + BlockedModuleAccountsOverride: blockAccAddrs, + }), + }, + { + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", + }), + }, + { + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, + { + Name: marsmoduletypes.ModuleName, + Config: appconfig.WrapAny(&marsmodulev1.Module{}), + }, + // this line is used by starport scaffolding # stargate/app/moduleConfig + }, + }), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + }, + )) +) diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_arguments/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/append_arguments/app.go deleted file mode 100644 index bccc70ff1f..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_arguments/app.go +++ /dev/null @@ -1,53 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -var ModuleBasics = module.NewBasicManager( - append([]module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - }, - foomodule.AppModuleBasic{}, - ), -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/app.go deleted file mode 100644 index a1bca6d4c0..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/app.go +++ /dev/null @@ -1,53 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" -) - -var ModuleBasics = module.NewBasicManager( - append( - []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - }, - basicModules()..., - ), -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/modules.go deleted file mode 100644 index 974c16b3df..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/append_package_function/modules.go +++ /dev/null @@ -1,14 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined in a function from a different -// file from where the variable is being referenced. -func basicModules() { - return []module.AppModuleBasic{ - foomodule.AppModuleBasic{}, - } -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/arguments/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/arguments/app.go deleted file mode 100644 index 651ba02b39..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/arguments/app.go +++ /dev/null @@ -1,51 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined as NewBasicManager arguments -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/crescent/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/crescent/app.go index 48b00808f4..17455318e7 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/crescent/app.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/crescent/app.go @@ -10,6 +10,9 @@ import ( "os" "path/filepath" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/server" + "cosmossdk.io/client/v2/autocli" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" @@ -985,3 +988,56 @@ func (app *App) SetUpgradeHandlers(mm *module.Manager, configurator module.Confi func (App) TxConfig() client.TxConfig { return nil } func (App) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } + +// GetKey returns the KVStoreKey for the provided store key. +func (App) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (App) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (App) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/app.go deleted file mode 100644 index 17841da744..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/app.go +++ /dev/null @@ -1,36 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - abci "github.com/tendermint/tendermint/abci/types" - - "app/modules" -) - -var ModuleBasics = module.NewBasicManager(modules.Basic...) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/go.mod b/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/go.mod deleted file mode 100644 index b16f0d7c54..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module app - -go 1.18 diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/modules/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/modules/modules.go deleted file mode 100644 index 67054511ec..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/external_variable/modules/modules.go +++ /dev/null @@ -1,23 +0,0 @@ -package modules - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined in a variable from a different file -// and package from where the variable is being referenced. -var Basic = []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/file_function/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/file_function/app.go deleted file mode 100644 index 9dbdc825da..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/file_function/app.go +++ /dev/null @@ -1,54 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -var ModuleBasics = module.NewBasicManager(basicModules()...) - -func basicModules() { - return []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, - } -} - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/file_variable/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/file_variable/app.go deleted file mode 100644 index 7002ba2024..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/file_variable/app.go +++ /dev/null @@ -1,53 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined in a variable within the same file -var basicModules = []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -} - -var ModuleBasics = module.NewBasicManager(basicModules...) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/gaia/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/gaia/app.go index 23dd541cb7..27ee658340 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/gaia/app.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/gaia/app.go @@ -8,6 +8,8 @@ import ( "os" "path/filepath" + "github.com/cosmos/cosmos-sdk/server" + "cosmossdk.io/client/v2/autocli" sdkerrors "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/baseapp" @@ -1051,3 +1053,56 @@ type EmptyAppOptions struct{} func (ao EmptyAppOptions) Get(o string) interface{} { return nil } + +// GetKey returns the KVStoreKey for the provided store key. +func (GaiaApp) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (GaiaApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (GaiaApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (GaiaApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (GaiaApp) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (GaiaApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/juno/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/juno/app.go index 5e07be2b70..71f3f87f58 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/juno/app.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/juno/app.go @@ -7,6 +7,9 @@ import ( "path/filepath" "strings" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/server" + "cosmossdk.io/client/v2/autocli" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec/types" @@ -884,3 +887,56 @@ func (app *App) SimulationManager() *module.SimulationManager { func (App) TxConfig() client.TxConfig { return nil } func (App) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } + +// GetKey returns the KVStoreKey for the provided store key. +func (App) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (App) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (App) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/app.go deleted file mode 100644 index fe9f619201..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/app.go +++ /dev/null @@ -1,461 +0,0 @@ -package app - -import ( - "fmt" - "io" - "net/http" - "os" - "path/filepath" - "strings" - - "app/keepers" - - "cosmossdk.io/client/v2/autocli" - "github.com/CosmWasm/wasmd/x/wasm" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" - "github.com/spf13/cast" - abci "github.com/tendermint/tendermint/abci/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/cosmos/cosmos-sdk/x/crisis" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/osmosis-labs/osmosis/v12/app/upgrades" - v10 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v10" - v11 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v11" - v12 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v12" - v3 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v3" - v4 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v4" - v5 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v5" - v6 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v6" - v7 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v7" - v8 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v8" - v9 "github.com/osmosis-labs/osmosis/v12/app/upgrades/v9" - _ "github.com/osmosis-labs/osmosis/v12/client/docs/statik" - "github.com/osmosis-labs/osmosis/v12/simulation/simtypes" -) - -const appName = "OsmosisApp" - -var ( - // DefaultNodeHome default home directories for the application daemon - DefaultNodeHome string - - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) - - // module account permissions - maccPerms = moduleAccountPermissions - - // module accounts that are allowed to receive tokens. - allowedReceivingModAcc = map[string]bool{} - - // WasmProposalsEnabled enables all x/wasm proposals when it's value is "true" - // and EnableSpecificWasmProposals is empty. Otherwise, all x/wasm proposals - // are disabled. - WasmProposalsEnabled = "true" - - // EnableSpecificWasmProposals, if set, must be comma-separated list of values - // that are all a subset of "EnableAllProposals", which takes precedence over - // WasmProposalsEnabled. - // - // See: https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 - EnableSpecificWasmProposals = "" - - // EmptyWasmOpts defines a type alias for a list of wasm options. - EmptyWasmOpts []wasm.Option - - // _ sdksimapp.App = (*OsmosisApp)(nil) - - Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade} - Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork} -) - -// GetWasmEnabledProposals parses the WasmProposalsEnabled and -// EnableSpecificWasmProposals values to produce a list of enabled proposals to -// pass into the application. -func GetWasmEnabledProposals() []wasm.ProposalType { - if EnableSpecificWasmProposals == "" { - if WasmProposalsEnabled == "true" { - return wasm.EnableAllProposals - } - - return wasm.DisableAllProposals - } - - chunks := strings.Split(EnableSpecificWasmProposals, ",") - - proposals, err := wasm.ConvertToProposals(chunks) - if err != nil { - panic(err) - } - - return proposals -} - -// OsmosisApp extends an ABCI application, but with most of its parameters exported. -// They are exported for convenience in creating helper functions, as object -// capabilities aren't needed for testing. -type OsmosisApp struct { - *baseapp.BaseApp - keepers.AppKeepers - - cdc *codec.LegacyAmino - appCodec codec.Codec - interfaceRegistry types.InterfaceRegistry - invCheckPeriod uint - - mm *module.Manager - sm *simtypes.Manager - configurator module.Configurator -} - -// init sets DefaultNodeHome to default osmosisd install location. -func init() { - userHomeDir, err := os.UserHomeDir() - if err != nil { - panic(err) - } - - DefaultNodeHome = filepath.Join(userHomeDir, ".osmosisd") -} - -// NewOsmosisApp returns a reference to an initialized Osmosis. -func NewOsmosisApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - loadLatest bool, - skipUpgradeHeights map[int64]bool, - homePath string, - invCheckPeriod uint, - appOpts servertypes.AppOptions, - wasmEnabledProposals []wasm.ProposalType, - wasmOpts []wasm.Option, - baseAppOptions ...func(*baseapp.BaseApp), -) *OsmosisApp { - encodingConfig := MakeEncodingConfig() - appCodec := encodingConfig.Marshaler - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry - - bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) - bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) - bApp.SetInterfaceRegistry(interfaceRegistry) - - app := &OsmosisApp{ - AppKeepers: keepers.AppKeepers{}, - BaseApp: bApp, - cdc: cdc, - appCodec: appCodec, - interfaceRegistry: interfaceRegistry, - invCheckPeriod: invCheckPeriod, - } - - wasmDir := filepath.Join(homePath, "wasm") - wasmConfig, err := wasm.ReadWasmConfig(appOpts) - if err != nil { - panic(fmt.Sprintf("error while reading wasm config: %s", err)) - } - app.InitSpecialKeepers( - appCodec, - bApp, - wasmDir, - cdc, - invCheckPeriod, - skipUpgradeHeights, - homePath, - ) - app.setupUpgradeStoreLoaders() - app.InitNormalKeepers( - appCodec, - bApp, - maccPerms, - wasmDir, - wasmConfig, - wasmEnabledProposals, - wasmOpts, - app.BlockedAddrs(), - ) - - app.SetupHooks() - - /**** Module Options ****/ - - // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment - // we prefer to be more strict in what arguments the modules expect. - skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) - - // NOTE: All module / keeper changes should happen prior to this module.NewManager line being called. - // However in the event any changes do need to happen after this call, ensure that that keeper - // is only passed in its keeper form (not de-ref'd anywhere) - // - // Generally NewAppModule will require the keeper that module defines to be passed in as an exact struct, - // but should take in every other keeper as long as it matches a certain interface. (So no need to be de-ref'd) - // - // Any time a module requires a keeper de-ref'd thats not its native one, - // its code-smell and should probably change. We should get the staking keeper dependencies fixed. - app.mm = module.NewManager(appModules(app, encodingConfig, skipGenesisInvariants)...) - - // During begin block slashing happens after distr.BeginBlocker so that - // there is nothing left over in the validator fee pool, so as to keep the - // CanWithdrawInvariant invariant. - // NOTE: staking module is required if HistoricalEntries param > 0 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - - // Tell the app's module manager how to set the order of BeginBlockers, which are run at the beginning of every block. - app.mm.SetOrderBeginBlockers(orderBeginBlockers(app.mm.ModuleNames())...) - - // Tell the app's module manager how to set the order of EndBlockers, which are run at the end of every block. - app.mm.SetOrderEndBlockers(OrderEndBlockers(app.mm.ModuleNames())...) - - app.mm.SetOrderInitGenesis(OrderInitGenesis(app.mm.ModuleNames())...) - - app.mm.RegisterInvariants(app.CrisisKeeper) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) - app.configurator = module.NewConfigurator(app.AppCodec(), app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.mm.RegisterServices(app.configurator) - - app.setupUpgradeHandlers() - - // create the simulation manager and define the order of the modules for deterministic simulations - app.sm = createSimulationManager(app, encodingConfig, skipGenesisInvariants) - - // app.sm.RegisterStoreDecoders() - - // add test gRPC service for testing gRPC queries in isolation - testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) - - // initialize stores - app.MountKVStores(app.GetKVStoreKey()) - app.MountTransientStores(app.GetTransientStoreKey()) - app.MountMemoryStores(app.GetMemoryStoreKey()) - - // initialize BaseApp - app.SetInitChainer(app.InitChainer) - app.SetBeginBlocker(app.BeginBlocker) - app.SetAnteHandler( - NewAnteHandler( - appOpts, - wasmConfig, - app.GetKey(wasm.StoreKey), - app.AccountKeeper, - app.BankKeeper, - app.TxFeesKeeper, - app.GAMMKeeper, - ante.DefaultSigVerificationGasConsumer, - encodingConfig.TxConfig.SignModeHandler(), - app.IBCKeeper, - ), - ) - app.SetEndBlocker(app.EndBlocker) - - // Register snapshot extensions to enable state-sync for wasm. - if manager := app.SnapshotManager(); manager != nil { - err := manager.RegisterExtensions( - wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), app.WasmKeeper), - ) - if err != nil { - panic(fmt.Errorf("failed to register snapshot extension: %w", err)) - } - } - - if loadLatest { - if err := app.LoadLatestVersion(); err != nil { - tmos.Exit(err.Error()) - } - - ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) - - // Initialize pinned codes in wasmvm as they are not persisted there - if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { - tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) - } - } - - return app -} - -// MakeCodecs returns the application codec and a legacy Amino codec. -func MakeCodecs() (codec.Codec, *codec.LegacyAmino) { - config := MakeEncodingConfig() - return config.Marshaler, config.Amino -} - -func (app *OsmosisApp) GetBaseApp() *baseapp.BaseApp { - return app.BaseApp -} - -// Name returns the name of the App. -func (app *OsmosisApp) Name() string { return app.BaseApp.Name() } - -// BeginBlocker application updates every begin block. -func (app *OsmosisApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - BeginBlockForks(ctx, app) - return app.mm.BeginBlock(ctx, req) -} - -// EndBlocker application updates every end block. -func (app *OsmosisApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} - -// InitChainer application update at chain initialization. -func (app *OsmosisApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { - var genesisState GenesisState - if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { - panic(err) - } - - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) - - return app.mm.InitGenesis(ctx, app.appCodec, genesisState) -} - -// LoadHeight loads a particular height. -func (app *OsmosisApp) LoadHeight(height int64) error { - return app.LoadVersion(height) -} - -// LegacyAmino returns SimApp's amino codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *OsmosisApp) LegacyAmino() *codec.LegacyAmino { - return app.cdc -} - -// AppCodec returns Osmosis' app codec. -// -// NOTE: This is solely to be used for testing purposes as it may be desirable -// for modules to register their own custom testing types. -func (app *OsmosisApp) AppCodec() codec.Codec { - return app.appCodec -} - -// InterfaceRegistry returns Osmosis' InterfaceRegistry. -func (app *OsmosisApp) InterfaceRegistry() types.InterfaceRegistry { - return app.interfaceRegistry -} - -// SimulationManager implements the SimulationApp interface. -func (app *OsmosisApp) SimulationManager() *simtypes.Manager { - return app.sm -} - -// RegisterAPIRoutes registers all application module routes with the provided -// API server. -func (app *OsmosisApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - clientCtx := apiSvr.ClientCtx - rpc.RegisterRoutes(clientCtx, apiSvr.Router) - // Register legacy tx routes. - authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) - // Register new tx routes from grpc-gateway. - authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // Register legacy and grpc-gateway routes for all modules. - ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - - // register swagger API from root so that other applications can override easily - if apiConfig.Swagger { - RegisterSwaggerAPI(clientCtx, apiSvr.Router) - } -} - -// RegisterTxService implements the Application.RegisterTxService method. -func (app *OsmosisApp) RegisterTxService(clientCtx client.Context) { - authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) -} - -// RegisterTendermintService implements the Application.RegisterTendermintService -// method. -func (app *OsmosisApp) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) -} - -func (app *OsmosisApp) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -// configure store loader that checks if version == upgradeHeight and applies store upgrades -func (app *OsmosisApp) setupUpgradeStoreLoaders() { - upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() - if err != nil { - panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) - } - - if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - return - } - - for _, upgrade := range Upgrades { - if upgradeInfo.Name == upgrade.UpgradeName { - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) - } - } -} - -func (app *OsmosisApp) setupUpgradeHandlers() { - for _, upgrade := range Upgrades { - app.UpgradeKeeper.SetUpgradeHandler( - upgrade.UpgradeName, - upgrade.CreateUpgradeHandler( - app.mm, - app.configurator, - app.BaseApp, - &app.AppKeepers, - ), - ) - } -} - -func (OsmosisApp) TxConfig() client.TxConfig { return nil } -func (OsmosisApp) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } - -// RegisterSwaggerAPI registers swagger route with API Server. -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { - statikFS, err := fs.New() - if err != nil { - panic(err) - } - - staticServer := http.FileServer(statikFS) - rtr.PathPrefix("/static/").Handler(http.StripPrefix("/static/", staticServer)) - rtr.PathPrefix("/swagger/").Handler(staticServer) -} - -// GetMaccPerms returns a copy of the module account permissions. -func GetMaccPerms() map[string][]string { - dupMaccPerms := make(map[string][]string) - for k, v := range maccPerms { - dupMaccPerms[k] = v - } - - return dupMaccPerms -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/go.mod b/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/go.mod deleted file mode 100644 index b16f0d7c54..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module app - -go 1.18 diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/keepers/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/keepers/modules.go deleted file mode 100644 index 88f214644c..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/osmosis/keepers/modules.go +++ /dev/null @@ -1,89 +0,0 @@ -package keepers - -import ( - "github.com/CosmWasm/wasmd/x/wasm" - wasmclient "github.com/CosmWasm/wasmd/x/wasm/client" - transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" - - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/crisis" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" - "github.com/cosmos/cosmos-sdk/x/evidence" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/cosmos/cosmos-sdk/x/params" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/slashing" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" - - _ "github.com/osmosis-labs/osmosis/v12/client/docs/statik" - "github.com/osmosis-labs/osmosis/v12/x/epochs" - "github.com/osmosis-labs/osmosis/v12/x/gamm" - "github.com/osmosis-labs/osmosis/v12/x/incentives" - "github.com/osmosis-labs/osmosis/v12/x/lockup" - "github.com/osmosis-labs/osmosis/v12/x/mint" - poolincentives "github.com/osmosis-labs/osmosis/v12/x/pool-incentives" - poolincentivesclient "github.com/osmosis-labs/osmosis/v12/x/pool-incentives/client" - superfluid "github.com/osmosis-labs/osmosis/v12/x/superfluid" - superfluidclient "github.com/osmosis-labs/osmosis/v12/x/superfluid/client" - "github.com/osmosis-labs/osmosis/v12/x/tokenfactory" - "github.com/osmosis-labs/osmosis/v12/x/twap/twapmodule" - "github.com/osmosis-labs/osmosis/v12/x/txfees" -) - -// AppModuleBasics returns ModuleBasics for the module BasicManager. -var AppModuleBasics = []module.AppModuleBasic{ - auth.AppModuleBasic{}, - genutil.AppModuleBasic{}, - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic( - append( - wasmclient.ProposalHandlers, - paramsclient.ProposalHandler, - distrclient.ProposalHandler, - upgradeclient.ProposalHandler, - upgradeclient.CancelProposalHandler, - poolincentivesclient.UpdatePoolIncentivesHandler, - poolincentivesclient.ReplacePoolIncentivesHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - superfluidclient.SetSuperfluidAssetsProposalHandler, - superfluidclient.RemoveSuperfluidAssetsProposalHandler, - )..., - ), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - vesting.AppModuleBasic{}, - gamm.AppModuleBasic{}, - twapmodule.AppModuleBasic{}, - txfees.AppModuleBasic{}, - incentives.AppModuleBasic{}, - lockup.AppModuleBasic{}, - poolincentives.AppModuleBasic{}, - epochs.AppModuleBasic{}, - superfluid.AppModuleBasic{}, - tokenfactory.AppModuleBasic{}, - wasm.AppModuleBasic{}, - ica.AppModuleBasic{}, -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_alias/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_alias/app.go deleted file mode 100644 index 947cbac263..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_alias/app.go +++ /dev/null @@ -1,51 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - cosmosmodule "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined as NewBasicManager arguments -var ModuleBasics = cosmosmodule.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/app.go deleted file mode 100644 index 92651d872c..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/app.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - abci "github.com/tendermint/tendermint/abci/types" -) - -var ModuleBasics = module.NewBasicManager(basicModules()...) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/modules.go deleted file mode 100644 index 4b0cb0b6fe..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_function/modules.go +++ /dev/null @@ -1,25 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined in a function from a different -// file from where the variable is being referenced. -func basicModules() { - return []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, - } -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_not_called_app/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_not_called_app/app.go deleted file mode 100644 index fb5a87fb65..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_not_called_app/app.go +++ /dev/null @@ -1,51 +0,0 @@ -package gaia - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - abci "github.com/tendermint/tendermint/abci/types" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined as NewBasicManager arguments -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/app.go deleted file mode 100644 index b3f2c99071..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/app.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - abci "github.com/tendermint/tendermint/abci/types" -) - -var ModuleBasics = module.NewBasicManager(basicModules...) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/modules.go deleted file mode 100644 index ac0ae99d47..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/package_variable/modules.go +++ /dev/null @@ -1,23 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined in a variable from a different -// file from where the variable is being referenced. -var basicModules = []module.AppModuleBasic{ - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/app.go deleted file mode 100644 index 60df333dd8..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/app.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - abci "github.com/tendermint/tendermint/abci/types" -) - -type Foo struct{} - -func (Foo) Name() string { - return "foo" -} - -var mm *module.Manager - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - _ = apiSvr.ClientCtx -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/modules.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/modules.go deleted file mode 100644 index 5832d9ea95..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go/modules.go +++ /dev/null @@ -1,20 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime/app.go new file mode 100644 index 0000000000..8684282186 --- /dev/null +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime/app.go @@ -0,0 +1,131 @@ +package app + +import ( + "cosmossdk.io/api/tendermint/abci" + "cosmossdk.io/client/v2/autocli" + "github.com/cosmos/cosmos-sdk/client" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gogo/protobuf/codec" + foomodule "github.com/username/test/x/foo" + fookeeper "github.com/username/test/x/foo/keeper" +) + +// App modules are defined as NewBasicManager arguments +var ModuleBasics = module.NewBasicManager( + auth.AppModuleBasic{}, + bank.AppModuleBasic{}, + staking.AppModuleBasic{}, + gov.NewAppModuleBasic([]govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }), + foomodule.AppModuleBasic{}, +) + +type Foo struct { + *runtime.App + + AuthKeeper authkeeper.Keeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + GovKeeper govkeeper.Keeper + FooKeeper fookeeper.Keeper +} + +func (Foo) Name() string { return "foo" } +func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } +func (Foo) TxConfig() client.TxConfig { return nil } +func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } + +func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { + return abci.ResponseBeginBlock{} +} + +func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { + return abci.ResponseEndBlock{} +} + +func (app *Foo) RegisterAPIRoutes(s *api.Server, cfg config.APIConfig) { + // This module should be discovered + foomodule.RegisterGRPCGatewayRoutes(s.ClientCtx, s.GRPCGatewayRouter) + // Runtime app modules for the current Cosmos SDK should be discovered too + app.App.RegisterAPIRoutes(apiSvr, apiConfig) +} + +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } + +func (Foo) TxConfig() client.TxConfig { return nil } + +func (Foo) AppCodec() codec.Codec { + return app.appCodec +} + +// GetKey returns the KVStoreKey for the provided store key. +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (Foo) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (Foo) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/go.mod b/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime/go.mod similarity index 100% rename from ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/go.mod rename to ignite/pkg/cosmosanalysis/app/testdata/modules/runtime/go.mod diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/app.go deleted file mode 100644 index 42490e86fc..0000000000 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/runtime_api_routes/app.go +++ /dev/null @@ -1,60 +0,0 @@ -package app - -import ( - "cosmossdk.io/api/tendermint/abci" - "cosmossdk.io/client/v2/autocli" - "github.com/cosmos/cosmos-sdk/client" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/server/api" - "github.com/cosmos/cosmos-sdk/server/config" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - "github.com/cosmos/cosmos-sdk/x/staking" - foomodule "github.com/username/test/x/foo" -) - -// App modules are defined as NewBasicManager arguments -var ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - gov.NewAppModuleBasic([]govclient.ProposalHandler{ - paramsclient.ProposalHandler, - }), - foomodule.AppModuleBasic{}, -) - -type Foo struct { - *runtime.App -} - -func (Foo) Name() string { return "foo" } -func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } -func (Foo) TxConfig() client.TxConfig { return nil } -func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } - -func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { - return abci.ResponseBeginBlock{} -} - -func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { - return abci.ResponseEndBlock{} -} - -func (app *Foo) RegisterAPIRoutes(s *api.Server, cfg config.APIConfig) { - // This module should be discovered - foomodule.RegisterGRPCGatewayRoutes(s.ClientCtx, s.GRPCGatewayRouter) - // Runtime app modules for the current Cosmos SDK should be discovered too - app.App.RegisterAPIRoutes(apiSvr, apiConfig) -} - -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } - -func (Foo) TxConfig() client.TxConfig { return nil } diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/single_app/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/single_app/app.go new file mode 100644 index 0000000000..860e384889 --- /dev/null +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/single_app/app.go @@ -0,0 +1,104 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gogo/protobuf/codec" + abci "github.com/tendermint/tendermint/abci/types" + fookeeper "github.com/username/test/x/foo/keeper" +) + +type Foo struct { + AuthKeeper authkeeper.Keeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + GovKeeper govkeeper.Keeper + FooKeeper fookeeper.Keeper +} + +func (Foo) Name() string { + return "foo" +} + +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } + +func (Foo) TxConfig() client.TxConfig { return nil } + +func (Foo) BeginBlocker(sdk.Context, abci.RequestBeginBlock) abci.ResponseBeginBlock { + return abci.ResponseBeginBlock{} +} + +func (Foo) EndBlocker(sdk.Context, abci.RequestEndBlock) abci.ResponseEndBlock { + return abci.ResponseEndBlock{} +} + +func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + _ = apiSvr.ClientCtx +} + +func (Foo) AppCodec() codec.Codec { + return app.appCodec +} + +// GetKey returns the KVStoreKey for the provided store key. +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (Foo) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (Foo) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (Foo) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/modules/spn/app.go b/ignite/pkg/cosmosanalysis/app/testdata/modules/spn/app.go index 843e1c50ff..40070dd24f 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/modules/spn/app.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/modules/spn/app.go @@ -6,6 +6,8 @@ import ( "os" "path/filepath" + "github.com/cosmos/cosmos-sdk/server" + "cosmossdk.io/client/v2/autocli" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -1019,3 +1021,85 @@ func (app *App) SimulationManager() *module.SimulationManager { func (app *App) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } func (app *App) TxConfig() client.TxConfig { return nil } func (app *App) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } + +// GetKey returns the KVStoreKey for the provided store key. +func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { + sk := app.UnsafeFindStoreKey(storeKey) + kvStoreKey, ok := sk.(*storetypes.KVStoreKey) + if !ok { + return nil + } + return kvStoreKey +} + +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) + if !ok { + return nil + } + + return key +} + +// kvStoreKeys returns all the kv store keys registered inside App. +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { + keys := make(map[string]*storetypes.KVStoreKey) + for _, k := range app.GetStoreKeys() { + if kv, ok := k.(*storetypes.KVStoreKey); ok { + keys[kv.Name()] = kv + } + } + + return keys +} + +// GetSubspace returns a param subspace for a given module name. +func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// SimulationManager implements the SimulationApp interface +func (app *App) SimulationManager() *module.SimulationManager { + return app.sm +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + app.App.RegisterAPIRoutes(apiSvr, apiConfig) + // register swagger API in app.go so that other applications can override easily + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) + } +} + +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dup := make(map[string][]string) + for _, perms := range moduleAccPerms { + dup[perms.Account] = perms.Permissions + } + + return dup +} + +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + result := make(map[string]bool) + + if len(blockAccAddrs) > 0 { + for _, addr := range blockAccAddrs { + result[addr] = true + } + } else { + for addr := range GetMaccPerms() { + result[addr] = true + } + } + + return result +} diff --git a/ignite/pkg/cosmosanalysis/app/testdata/two_app.go b/ignite/pkg/cosmosanalysis/app/testdata/two_app.go index 0234a08e6e..e7697ccf54 100644 --- a/ignite/pkg/cosmosanalysis/app/testdata/two_app.go +++ b/ignite/pkg/cosmosanalysis/app/testdata/two_app.go @@ -2,8 +2,10 @@ package foo import ( "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" abci "github.com/tendermint/tendermint/abci/types" app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" @@ -13,12 +15,16 @@ type Foo struct { FooKeeper foo.keeper } -func (f Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (f Foo) TxConfig() client.TxConfig { return nil } -func (f Foo) RegisterAPIRoutes() {} -func (f Foo) RegisterTxService() {} -func (f Foo) RegisterTendermintService() {} -func (f Foo) Name() string { return app.BaseApp.Name() } +func (f Foo) TxConfig() client.TxConfig { return nil } +func (f Foo) RegisterAPIRoutes() {} +func (f Foo) RegisterTxService() {} +func (f Foo) RegisterTendermintService() {} +func (f Foo) Name() string { return app.BaseApp.Name() } +func (f Foo) AppCodec() codec.Codec { return app.appCodec } +func (F Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (F Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (F Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (F Foo) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (f Foo) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } @@ -31,12 +37,16 @@ type Bar struct { FooKeeper foo.keeper } -func (f Bar) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (f Bar) TxConfig() client.TxConfig { return nil } -func (f Bar) RegisterAPIRoutes() {} -func (f Bar) RegisterTxService() {} -func (f Bar) RegisterTendermintService() {} -func (f Bar) Name() string { return app.BaseApp.Name() } +func (f Bar) TxConfig() client.TxConfig { return nil } +func (f Bar) RegisterAPIRoutes() {} +func (f Bar) RegisterTxService() {} +func (f Bar) RegisterTendermintService() {} +func (f Bar) Name() string { return app.BaseApp.Name() } +func (f Bar) AppCodec() codec.Codec { return app.appCodec } +func (f Bar) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (f Bar) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (f Bar) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (f Bar) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (f Bar) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/ignite/pkg/cosmosanalysis/cosmosanalysis.go b/ignite/pkg/cosmosanalysis/cosmosanalysis.go index e5b893520b..ae72b4541a 100644 --- a/ignite/pkg/cosmosanalysis/cosmosanalysis.go +++ b/ignite/pkg/cosmosanalysis/cosmosanalysis.go @@ -24,9 +24,10 @@ const ( ) var AppImplementation = []string{ - "Name", + "AppCodec", "GetKey", - "TxConfig", + "GetMemKey", + "kvStoreKeys", "RegisterAPIRoutes", } @@ -81,51 +82,38 @@ func FindImplementation(modulePath string, interfaceList []string) (found []stri return found, nil } -func findImplementationInFiles(files []*ast.File, interfaceList []string) (found []string) { +// FindImplementationInFile find all struct implements the interfaceList into an ast.File. +func FindImplementationInFile(n ast.Node, interfaceList []string) (found []string) { // collect all structs under path to find out the ones that satisfies the implementation structImplementations := make(map[string]implementation) - for _, f := range files { - ast.Inspect(f, func(n ast.Node) bool { - // look for struct methods. - methodDecl, ok := n.(*ast.FuncDecl) - if !ok { - return true - } + findImplementation(n, func(methodName, structName string) bool { + // mark the implementation that this struct satisfies. + if _, ok := structImplementations[structName]; !ok { + structImplementations[structName] = newImplementation(interfaceList) + } - // not a method. - if methodDecl.Recv == nil { - return true - } + structImplementations[structName][methodName] = true - methodName := methodDecl.Name.Name + return true + }) - // find the struct name that method belongs to. - t := methodDecl.Recv.List[0].Type - var ident *ast.Ident - switch t := t.(type) { - case *ast.Ident: - // method with a value receiver - ident = t - case *ast.IndexExpr: - // generic method with a value receiver - ident = t.X.(*ast.Ident) - case *ast.StarExpr: - switch t := t.X.(type) { - case *ast.Ident: - // method with a pointer receiver - ident = t - case *ast.IndexExpr: - // generic method with a pointer receiver - ident = t.X.(*ast.Ident) - default: - return true - } - default: - return true - } - structName := ident.Name + for name, impl := range structImplementations { + if checkImplementation(impl) { + found = append(found, name) + } + } + + return found +} +// findImplementationInFiles find all struct implements the interfaceList into a list of ast.File. +func findImplementationInFiles(files []*ast.File, interfaceList []string) (found []string) { + // collect all structs under path to find out the ones that satisfies the implementation + structImplementations := make(map[string]implementation) + + for _, f := range files { + findImplementation(f, func(methodName, structName string) bool { // mark the implementation that this struct satisfies. if _, ok := structImplementations[structName]; !ok { structImplementations[structName] = newImplementation(interfaceList) @@ -146,6 +134,55 @@ func findImplementationInFiles(files []*ast.File, interfaceList []string) (found return found } +// findImplementation parse the ast.Node and call the callback if is a struct implementation. +func findImplementation(f ast.Node, endCallback func(methodName, structName string) bool) { + ast.Inspect(f, func(n ast.Node) bool { + // look for struct methods. + methodDecl, ok := n.(*ast.FuncDecl) + if !ok { + return true + } + + // not a method. + if methodDecl.Recv == nil { + return true + } + + methodName := methodDecl.Name.Name + + // find the struct name that method belongs to. + t := methodDecl.Recv.List[0].Type + var ident *ast.Ident + switch t := t.(type) { + case *ast.Ident: + // method with a value receiver + ident = t + case *ast.IndexExpr: + // generic method with a value receiver + ident = t.X.(*ast.Ident) + case *ast.StarExpr: + switch t := t.X.(type) { + case *ast.Ident: + // method with a pointer receiver + ident = t + case *ast.IndexExpr: + // generic method with a pointer receiver + ident = t.X.(*ast.Ident) + default: + return true + } + default: + return true + } + structName := ident.Name + + if endCallback != nil { + return endCallback(methodName, structName) + } + return true + }) +} + // newImplementation returns a new object to parse implementation of an interface. func newImplementation(interfaceList []string) implementation { impl := make(implementation) diff --git a/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go b/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go index f0421a523b..713a54a156 100644 --- a/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go +++ b/ignite/pkg/cosmosanalysis/cosmosanalysis_test.go @@ -74,8 +74,13 @@ func (f Foo) foobar() {} package app type App struct {} func (app *App) Name() string { return app.BaseApp.Name() } -func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (app *App) RegisterAPIRoutes() {} +func (app *App) RegisterAPIRoutes() {} +func (app *App) RegisterTxService() {} +func (app *App) AppCodec() codec.Codec { return app.appCodec } +func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (app *App) TxConfig() client.TxConfig { return nil } func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) @@ -88,8 +93,13 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo package app_test type App struct {} func (app *App) Name() string { return app.BaseApp.Name() } -func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (app *App) RegisterAPIRoutes() {} +func (app *App) RegisterAPIRoutes() {} +func (app *App) RegisterTxService() {} +func (app *App) AppCodec() codec.Codec { return app.appCodec } +func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (app *App) TxConfig() client.TxConfig { return nil } func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) diff --git a/ignite/pkg/cosmosanalysis/module/message.go b/ignite/pkg/cosmosanalysis/module/message.go index 7204016d0b..612ebe0aef 100644 --- a/ignite/pkg/cosmosanalysis/module/message.go +++ b/ignite/pkg/cosmosanalysis/module/message.go @@ -3,9 +3,7 @@ package module // messageImplementation is the list of methods needed for a sdk.Msg implementation // TODO(low priority): dynamically get these from the source code of underlying version of the sdk. var messageImplementation = []string{ - "Route", - "Type", - "GetSigners", - "GetSignBytes", - "ValidateBasic", + "Reset", + "Descriptor", + "ProtoMessage", } diff --git a/ignite/pkg/cosmosanalysis/module/module.go b/ignite/pkg/cosmosanalysis/module/module.go index 1f73179ecb..ba6e98f1b1 100644 --- a/ignite/pkg/cosmosanalysis/module/module.go +++ b/ignite/pkg/cosmosanalysis/module/module.go @@ -22,57 +22,58 @@ type Msgs map[string][]string // Module keeps metadata about a Cosmos SDK module. type Module struct { // Name of the module. - Name string + Name string `json:"name,omitempty"` // GoModulePath of the app where the module is defined. - GoModulePath string + GoModulePath string `json:"go_module_path,omitempty"` // Pkg holds the proto package info. - Pkg protoanalysis.Package + Pkg protoanalysis.Package `json:"package,omitempty"` - // Msg is a list of sdk.Msg implementation of the module. - Msgs []Msg + // Msgs is a list of sdk.Msg implementation of the module. + Msgs []Msg `json:"messages,omitempty"` // HTTPQueries is a list of module queries. - HTTPQueries []HTTPQuery + HTTPQueries []HTTPQuery `json:"http_queries,omitempty"` // Types is a list of proto types that might be used by module. - Types []Type + Types []Type `json:"types,omitempty"` } // Msg keeps metadata about an sdk.Msg implementation. type Msg struct { // Name of the type. - Name string + Name string `json:"name,omitempty"` // URI of the type. - URI string + URI string `json:"uri,omitempty"` - // FilePath is the path of the .proto file where message is defined at. - FilePath string + // FilePath is the path of the proto file where message is defined. + FilePath string `json:"file_path,omitempty"` } // HTTPQuery is an sdk Query. type HTTPQuery struct { // Name of the RPC func. - Name string + Name string `json:"name,omitempty"` // FullName of the query with service name and rpc func name. - FullName string + FullName string `json:"full_name,omitempty"` - // HTTPAnnotations keeps info about http annotations of query. - Rules []protoanalysis.HTTPRule + // Rules keeps info about configured HTTP rules of RPC functions. + Rules []protoanalysis.HTTPRule `json:"rules,omitempty"` // Paginated indicates that the query is using pagination. - Paginated bool + Paginated bool `json:"paginated,omitempty"` } // Type is a proto type that might be used by module. type Type struct { - Name string + // Name of the type. + Name string `json:"name,omitempty"` // FilePath is the path of the .proto file where message is defined at. - FilePath string + FilePath string `json:"file_path,omitempty"` } type moduleDiscoverer struct { @@ -109,13 +110,12 @@ func Discover(ctx context.Context, chainRoot, sourcePath, protoDir string) ([]Mo // Go import path of the app module basegopath := gm.Module.Mod.Path - rootgopath := RootGoImportPath(basegopath) // Keep the custom app's modules and filter out the third // party ones that are not defined within the app. appModules := make([]string, 0) for _, m := range registeredModules { - if strings.HasPrefix(m, rootgopath) { + if strings.HasPrefix(m, basegopath) { appModules = append(appModules, m) } } diff --git a/ignite/pkg/cosmosanalysis/module/module_test.go b/ignite/pkg/cosmosanalysis/module/module_test.go index 452b690147..0ba79a2f15 100644 --- a/ignite/pkg/cosmosanalysis/module/module_test.go +++ b/ignite/pkg/cosmosanalysis/module/module_test.go @@ -164,10 +164,10 @@ func TestDiscover(t *testing.T) { } } -func TestDiscoverWithVersionedApp(t *testing.T) { +func TestDiscoverWithAppV2(t *testing.T) { ctx := context.Background() - sourcePath := "testdata/planet_v2" - testModule := newModule(sourcePath, "github.com/tendermint/planet/v2") + sourcePath := "testdata/earth" + testModule := newModule(sourcePath, "github.com/tendermint/planet") tests := []struct { name, protoDir string diff --git a/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app.go b/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app.go new file mode 100644 index 0000000000..57feb0babc --- /dev/null +++ b/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app.go @@ -0,0 +1,49 @@ +package app + +import ( + "cosmossdk.io/client/v2/autocli" + "github.com/cosmos/cosmos-sdk/api/tendermint/abci" + "github.com/cosmos/cosmos-sdk/client" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gogo/protobuf/codec" + marskeeper "github.com/tendermint/planet/x/mars/keeper" + abci "github.com/tendermint/tendermint/abci/types" + + app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" +) + +type Foo struct { + AuthKeeper authkeeper.Keeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + GovKeeper govkeeper.Keeper + MarsKeeper marskeeper.Keeper +} + +var ModuleBasics = module.NewBasicManager(foo.AppModuleBasic{}) + +func (Foo) Name() string { return app.BaseApp.Name() } +func (Foo) RegisterAPIRoutes() {} +func (Foo) TxConfig() client.TxConfig { return nil } +func (Foo) RegisterTxService() {} +func (Foo) RegisterTendermintService() {} +func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } +func (Foo) AppCodec() codec.Codec { return app.appCodec } +func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (Foo) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } +func (Foo) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { + return app.mm.BeginBlock(ctx, req) +} + +func (Foo) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { + return app.mm.EndBlock(ctx, req) +} diff --git a/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app_config.go b/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app_config.go new file mode 100644 index 0000000000..8ff441e81b --- /dev/null +++ b/ignite/pkg/cosmosanalysis/module/testdata/earth/app/app_config.go @@ -0,0 +1,321 @@ +package app + +import ( + "time" + + runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" + appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" + authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" + authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" + bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" + consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" + crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" + distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" + evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" + feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" + genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" + govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" + groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" + mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" + paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" + slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" + stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" + txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" + upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" + vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" + "cosmossdk.io/core/appconfig" + "cosmossdk.io/depinject" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/module" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + "google.golang.org/protobuf/types/known/durationpb" + + marsmodulev1 "github.com/tendermint/mars/api/mars/mars/module" + _ "github.com/tendermint/mars/x/mars" // import for side-effects + marsmoduletypes "github.com/tendermint/mars/x/mars/types" + // this line is used by starport scaffolding # stargate/app/moduleImport +) + +var ( + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + genesisModuleOrder = []string{ + // cosmos sdk modules + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + circuittypes.ModuleName, + // ibc modules + // capabilitytypes.ModuleName, + // ibcexported.ModuleName, + // ibctransfertypes.ModuleName, + // icatypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/initGenesis + } + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + beginBlockers = []string{ + // cosmos sdk modules + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/beginBlockers + } + + endBlockers = []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + marsmoduletypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/endBlockers + } + + preBlockers = []string{ + upgradetypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/preBlockers + } + + // module account permissions + moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ + {Account: authtypes.FeeCollectorName}, + {Account: distrtypes.ModuleName}, + {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, + {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, + {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, + {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } + + // blocked account addresses + blockAccAddrs = []string{ + authtypes.FeeCollectorName, + distrtypes.ModuleName, + minttypes.ModuleName, + stakingtypes.BondedPoolName, + stakingtypes.NotBondedPoolName, + // We allow the following module accounts to receive funds: + // govtypes.ModuleName + } + + // AppConfig application configuration (used by depinject) + AppConfig = depinject.Configs(appconfig.Compose(&appv1alpha1.Config{ + Modules: []*appv1alpha1.ModuleConfig{ + { + Name: runtime.ModuleName, + Config: appconfig.WrapAny(&runtimev1alpha1.Module{ + AppName: Name, + PreBlockers: preBlockers, + BeginBlockers: beginBlockers, + EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, + OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ + { + ModuleName: authtypes.ModuleName, + KvStoreKey: "acc", + }, + }, + // When ExportGenesis is not specified, the export genesis module order + // is equal to the init genesis order + // ExportGenesis: genesisModuleOrder, + // Uncomment if you want to set a custom migration order here. + // OrderMigrations: nil, + }), + }, + { + Name: authtypes.ModuleName, + Config: appconfig.WrapAny(&authmodulev1.Module{ + Bech32Prefix: AccountAddressPrefix, + ModuleAccountPermissions: moduleAccPerms, + // By default modules authority is the governance module. This is configurable with the following: + // Authority: "group", // A custom module authority can be set using a module name + // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address + }), + }, + { + Name: vestingtypes.ModuleName, + Config: appconfig.WrapAny(&vestingmodulev1.Module{}), + }, + { + Name: banktypes.ModuleName, + Config: appconfig.WrapAny(&bankmodulev1.Module{ + BlockedModuleAccountsOverride: blockAccAddrs, + }), + }, + { + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", + }), + }, + { + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, + { + Name: marsmoduletypes.ModuleName, + Config: appconfig.WrapAny(&marsmodulev1.Module{}), + }, + // this line is used by starport scaffolding # stargate/app/moduleConfig + }, + }), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + }, + )) +) diff --git a/ignite/pkg/cosmosanalysis/module/testdata/earth/go.mod b/ignite/pkg/cosmosanalysis/module/testdata/earth/go.mod new file mode 100644 index 0000000000..f470e685ca --- /dev/null +++ b/ignite/pkg/cosmosanalysis/module/testdata/earth/go.mod @@ -0,0 +1,3 @@ +module github.com/tendermint/planet + +go 1.18 diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/proto/planet/mars/mars.proto b/ignite/pkg/cosmosanalysis/module/testdata/earth/proto/planet/mars/mars.proto similarity index 100% rename from ignite/pkg/cosmosanalysis/module/testdata/planet_v2/proto/planet/mars/mars.proto rename to ignite/pkg/cosmosanalysis/module/testdata/earth/proto/planet/mars/mars.proto diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/x/mars/keeper/query_my_query.go b/ignite/pkg/cosmosanalysis/module/testdata/earth/x/mars/keeper/query_my_query.go similarity index 100% rename from ignite/pkg/cosmosanalysis/module/testdata/planet_v2/x/mars/keeper/query_my_query.go rename to ignite/pkg/cosmosanalysis/module/testdata/earth/x/mars/keeper/query_my_query.go diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/x/mars/types/types.go b/ignite/pkg/cosmosanalysis/module/testdata/earth/x/mars/types/types.go similarity index 100% rename from ignite/pkg/cosmosanalysis/module/testdata/planet_v2/x/mars/types/types.go rename to ignite/pkg/cosmosanalysis/module/testdata/earth/x/mars/types/types.go diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet/app/app.go b/ignite/pkg/cosmosanalysis/module/testdata/planet/app/app.go index 070ef8f908..b2308b8699 100644 --- a/ignite/pkg/cosmosanalysis/module/testdata/planet/app/app.go +++ b/ignite/pkg/cosmosanalysis/module/testdata/planet/app/app.go @@ -4,28 +4,42 @@ import ( "cosmossdk.io/client/v2/autocli" "github.com/cosmos/cosmos-sdk/api/tendermint/abci" "github.com/cosmos/cosmos-sdk/client" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/gogo/protobuf/codec" + marskeeper "github.com/tendermint/planet/x/mars/keeper" + abci "github.com/tendermint/tendermint/abci/types" app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" - - "github.com/tendermint/planet/x/mars" ) type Foo struct { - FooKeeper foo.keeper + AuthKeeper authkeeper.Keeper + BankKeeper bankkeeper.Keeper + StakingKeeper stakingkeeper.Keeper + GovKeeper govkeeper.Keeper + MarsKeeper marskeeper.Keeper } var ModuleBasics = module.NewBasicManager(mars.AppModuleBasic{}) -func (Foo) Name() string { return app.BaseApp.Name() } -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (Foo) RegisterAPIRoutes() {} -func (Foo) RegisterTxService() {} -func (Foo) RegisterTendermintService() {} -func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } -func (Foo) TxConfig() client.TxConfig { return nil } -func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } +func (Foo) Name() string { return app.BaseApp.Name() } +func (Foo) RegisterAPIRoutes() {} +func (Foo) RegisterTxService() {} +func (Foo) RegisterTendermintService() {} +func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } +func (Foo) TxConfig() client.TxConfig { return nil } +func (Foo) AppCodec() codec.Codec { return app.appCodec } +func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } +func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } +func (Foo) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { return nil } +func (Foo) kvStoreKeys() map[string]*storetypes.KVStoreKey { return nil } +func (Foo) GetSubspace(moduleName string) paramstypes.Subspace { return subspace } func (Foo) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { return app.mm.BeginBlock(ctx, req) } diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/app/app.go b/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/app/app.go deleted file mode 100644 index 6c364ed456..0000000000 --- a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/app/app.go +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "cosmossdk.io/client/v2/autocli" - "github.com/cosmos/cosmos-sdk/api/tendermint/abci" - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - app "github.com/ignite/cli/ignite/pkg/cosmosanalysis/app/testdata/modules/registration_not_in_app_go" - - "github.com/tendermint/planet/x/mars" -) - -type Foo struct { - FooKeeper foo.keeper -} - -var ModuleBasics = module.NewBasicManager(mars.AppModuleBasic{}) - -func (Foo) Name() string { return app.BaseApp.Name() } -func (Foo) GetKey(storeKey string) *storetypes.KVStoreKey { return nil } -func (Foo) RegisterAPIRoutes() {} -func (Foo) TxConfig() client.TxConfig { return nil } -func (Foo) RegisterTxService() {} -func (Foo) RegisterTendermintService() {} -func (Foo) InterfaceRegistry() codectypes.InterfaceRegistry { return nil } -func (Foo) AutoCliOpts() autocli.AppOptions { return autocli.AppOptions{} } -func (Foo) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) -} - -func (Foo) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) -} diff --git a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/go.mod b/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/go.mod deleted file mode 100644 index 7348883587..0000000000 --- a/ignite/pkg/cosmosanalysis/module/testdata/planet_v2/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/tendermint/planet/v2 - -go 1.18 diff --git a/ignite/pkg/cosmosanalysis/testdata/chain/go.sum b/ignite/pkg/cosmosanalysis/testdata/chain/go.sum index 5dad4f8a10..dd2d6c5799 100644 --- a/ignite/pkg/cosmosanalysis/testdata/chain/go.sum +++ b/ignite/pkg/cosmosanalysis/testdata/chain/go.sum @@ -260,7 +260,6 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= diff --git a/ignite/pkg/cosmosbuf/buf.go b/ignite/pkg/cosmosbuf/buf.go index 7c4a70500e..b1b5a2c7e4 100644 --- a/ignite/pkg/cosmosbuf/buf.go +++ b/ignite/pkg/cosmosbuf/buf.go @@ -35,17 +35,20 @@ const ( flagOutput = "output" flagErrorFormat = "error-format" flagLogFormat = "log-format" + flagOnly = "only" fmtJSON = "json" // CMDGenerate generate command. CMDGenerate Command = "generate" CMDExport Command = "export" + CMDMod Command = "mod" ) var ( commands = map[Command]struct{}{ CMDGenerate: {}, CMDExport: {}, + CMDMod: {}, } // ErrInvalidCommand indicates an invalid command name. @@ -72,6 +75,24 @@ func (c Command) String() string { return string(c) } +// Update updates module dependencies. +// By default updates all dependencies unless one or more dependencies are specified. +func (b Buf) Update(ctx context.Context, modDir string, dependencies ...string) error { + var flags map[string]string + if dependencies != nil { + flags = map[string]string{ + flagOnly: strings.Join(dependencies, ","), + } + } + + cmd, err := b.generateCommand(CMDMod, flags, "update", modDir) + if err != nil { + return err + } + + return b.runCommand(ctx, cmd...) +} + // Export runs the buf Export command for the files in the proto directory. func (b Buf) Export(ctx context.Context, protoDir, output string) error { // Check if the proto directory is the Cosmos SDK one diff --git a/ignite/pkg/cosmosclient/consensus.go b/ignite/pkg/cosmosclient/consensus.go index ddd32652db..75da2e08ea 100644 --- a/ignite/pkg/cosmosclient/consensus.go +++ b/ignite/pkg/cosmosclient/consensus.go @@ -8,7 +8,7 @@ import ( "github.com/cometbft/cometbft/libs/bytes" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ) // ConsensusInfo is the validator consensus info. diff --git a/ignite/pkg/cosmosclient/cosmosclient.go b/ignite/pkg/cosmosclient/cosmosclient.go index 7d8b79243c..fcd48b0124 100644 --- a/ignite/pkg/cosmosclient/cosmosclient.go +++ b/ignite/pkg/cosmosclient/cosmosclient.go @@ -88,7 +88,7 @@ type Gasometer interface { // //go:generate mockery --srcpkg . --name Signer --filename signer.go --with-expecter type Signer interface { - Sign(txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error + Sign(ctx context.Context, txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error } // Client is a client to access your chain by querying and broadcasting transactions. diff --git a/ignite/pkg/cosmosclient/cosmosclient_test.go b/ignite/pkg/cosmosclient/cosmosclient_test.go index af824e9424..48cebb9c1d 100644 --- a/ignite/pkg/cosmosclient/cosmosclient_test.go +++ b/ignite/pkg/cosmosclient/cosmosclient_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "cosmossdk.io/math" "github.com/cometbft/cometbft/p2p" ctypes "github.com/cometbft/cometbft/rpc/core/types" tmtypes "github.com/cometbft/cometbft/types" @@ -431,7 +432,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -448,7 +449,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -467,7 +468,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -485,7 +486,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"10"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -503,7 +504,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"token","amount":"900000"}],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -522,7 +523,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedError: "cannot provide both fees and gas prices", @@ -539,7 +540,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -559,7 +560,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -579,7 +580,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"300000","payer":"","granter":""},"tip":null},"signatures":[]}`, @@ -597,7 +598,7 @@ func TestClientCreateTx(t *testing.T) { FromAddress: "from", ToAddress: "to", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), }, expectedJSONTx: `{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"from","to_address":"to","amount":[{"denom":"token","amount":"1"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"20042","payer":"","granter":""},"tip":null},"signatures":[]} diff --git a/ignite/pkg/cosmosclient/mocks/account_retriever.go b/ignite/pkg/cosmosclient/mocks/account_retriever.go index c5ed1de1f6..a254433416 100644 --- a/ignite/pkg/cosmosclient/mocks/account_retriever.go +++ b/ignite/pkg/cosmosclient/mocks/account_retriever.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.22.1. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -242,13 +242,12 @@ func (_c *AccountRetriever_GetAccountWithHeight_Call) RunAndReturn(run func(clie return _c } -type mockConstructorTestingTNewAccountRetriever interface { +// NewAccountRetriever creates a new instance of AccountRetriever. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAccountRetriever(t interface { mock.TestingT Cleanup(func()) -} - -// NewAccountRetriever creates a new instance of AccountRetriever. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewAccountRetriever(t mockConstructorTestingTNewAccountRetriever) *AccountRetriever { +}) *AccountRetriever { mock := &AccountRetriever{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/mocks/bank_query_client.go b/ignite/pkg/cosmosclient/mocks/bank_query_client.go index 76793e1c4b..ae526321a2 100644 --- a/ignite/pkg/cosmosclient/mocks/bank_query_client.go +++ b/ignite/pkg/cosmosclient/mocks/bank_query_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.22.1. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -235,6 +235,76 @@ func (_c *BankQueryClient_DenomMetadata_Call) RunAndReturn(run func(context.Cont return _c } +// DenomMetadataByQueryString provides a mock function with given fields: ctx, in, opts +func (_m *BankQueryClient) DenomMetadataByQueryString(ctx context.Context, in *types.QueryDenomMetadataByQueryStringRequest, opts ...grpc.CallOption) (*types.QueryDenomMetadataByQueryStringResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *types.QueryDenomMetadataByQueryStringResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryDenomMetadataByQueryStringRequest, ...grpc.CallOption) (*types.QueryDenomMetadataByQueryStringResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryDenomMetadataByQueryStringRequest, ...grpc.CallOption) *types.QueryDenomMetadataByQueryStringResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.QueryDenomMetadataByQueryStringResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryDenomMetadataByQueryStringRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// BankQueryClient_DenomMetadataByQueryString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DenomMetadataByQueryString' +type BankQueryClient_DenomMetadataByQueryString_Call struct { + *mock.Call +} + +// DenomMetadataByQueryString is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryDenomMetadataByQueryStringRequest +// - opts ...grpc.CallOption +func (_e *BankQueryClient_Expecter) DenomMetadataByQueryString(ctx interface{}, in interface{}, opts ...interface{}) *BankQueryClient_DenomMetadataByQueryString_Call { + return &BankQueryClient_DenomMetadataByQueryString_Call{Call: _e.mock.On("DenomMetadataByQueryString", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *BankQueryClient_DenomMetadataByQueryString_Call) Run(run func(ctx context.Context, in *types.QueryDenomMetadataByQueryStringRequest, opts ...grpc.CallOption)) *BankQueryClient_DenomMetadataByQueryString_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryDenomMetadataByQueryStringRequest), variadicArgs...) + }) + return _c +} + +func (_c *BankQueryClient_DenomMetadataByQueryString_Call) Return(_a0 *types.QueryDenomMetadataByQueryStringResponse, _a1 error) *BankQueryClient_DenomMetadataByQueryString_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *BankQueryClient_DenomMetadataByQueryString_Call) RunAndReturn(run func(context.Context, *types.QueryDenomMetadataByQueryStringRequest, ...grpc.CallOption) (*types.QueryDenomMetadataByQueryStringResponse, error)) *BankQueryClient_DenomMetadataByQueryString_Call { + _c.Call.Return(run) + return _c +} + // DenomOwners provides a mock function with given fields: ctx, in, opts func (_m *BankQueryClient) DenomOwners(ctx context.Context, in *types.QueryDenomOwnersRequest, opts ...grpc.CallOption) (*types.QueryDenomOwnersResponse, error) { _va := make([]interface{}, len(opts)) @@ -795,13 +865,12 @@ func (_c *BankQueryClient_TotalSupply_Call) RunAndReturn(run func(context.Contex return _c } -type mockConstructorTestingTNewBankQueryClient interface { +// NewBankQueryClient creates a new instance of BankQueryClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewBankQueryClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewBankQueryClient creates a new instance of BankQueryClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewBankQueryClient(t mockConstructorTestingTNewBankQueryClient) *BankQueryClient { +}) *BankQueryClient { mock := &BankQueryClient{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/mocks/faucet_client.go b/ignite/pkg/cosmosclient/mocks/faucet_client.go index 6c808dce58..e8a52676f2 100644 --- a/ignite/pkg/cosmosclient/mocks/faucet_client.go +++ b/ignite/pkg/cosmosclient/mocks/faucet_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.16.0. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -28,13 +28,16 @@ func (_m *FaucetClient) Transfer(_a0 context.Context, _a1 cosmosfaucet.TransferR ret := _m.Called(_a0, _a1) var r0 cosmosfaucet.TransferResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, cosmosfaucet.TransferRequest) (cosmosfaucet.TransferResponse, error)); ok { + return rf(_a0, _a1) + } if rf, ok := ret.Get(0).(func(context.Context, cosmosfaucet.TransferRequest) cosmosfaucet.TransferResponse); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(cosmosfaucet.TransferResponse) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, cosmosfaucet.TransferRequest) error); ok { r1 = rf(_a0, _a1) } else { @@ -68,13 +71,17 @@ func (_c *FaucetClient_Transfer_Call) Return(_a0 cosmosfaucet.TransferResponse, return _c } -type mockConstructorTestingTNewFaucetClient interface { - mock.TestingT - Cleanup(func()) +func (_c *FaucetClient_Transfer_Call) RunAndReturn(run func(context.Context, cosmosfaucet.TransferRequest) (cosmosfaucet.TransferResponse, error)) *FaucetClient_Transfer_Call { + _c.Call.Return(run) + return _c } // NewFaucetClient creates a new instance of FaucetClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFaucetClient(t mockConstructorTestingTNewFaucetClient) *FaucetClient { +// The first argument is typically a *testing.T value. +func NewFaucetClient(t interface { + mock.TestingT + Cleanup(func()) +}) *FaucetClient { mock := &FaucetClient{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/mocks/gasometer.go b/ignite/pkg/cosmosclient/mocks/gasometer.go index 26b8149585..1123573890 100644 --- a/ignite/pkg/cosmosclient/mocks/gasometer.go +++ b/ignite/pkg/cosmosclient/mocks/gasometer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.16.0. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -6,9 +6,9 @@ import ( grpc "github.com/cosmos/gogoproto/grpc" mock "github.com/stretchr/testify/mock" - tx "github.com/cosmos/cosmos-sdk/client/tx" + proto "github.com/cosmos/gogoproto/proto" - types "github.com/cosmos/cosmos-sdk/types" + tx "github.com/cosmos/cosmos-sdk/client/tx" typestx "github.com/cosmos/cosmos-sdk/types/tx" ) @@ -27,7 +27,7 @@ func (_m *Gasometer) EXPECT() *Gasometer_Expecter { } // CalculateGas provides a mock function with given fields: clientCtx, txf, msgs -func (_m *Gasometer) CalculateGas(clientCtx grpc.ClientConn, txf tx.Factory, msgs ...types.Msg) (*typestx.SimulateResponse, uint64, error) { +func (_m *Gasometer) CalculateGas(clientCtx grpc.ClientConn, txf tx.Factory, msgs ...proto.Message) (*typestx.SimulateResponse, uint64, error) { _va := make([]interface{}, len(msgs)) for _i := range msgs { _va[_i] = msgs[_i] @@ -38,7 +38,12 @@ func (_m *Gasometer) CalculateGas(clientCtx grpc.ClientConn, txf tx.Factory, msg ret := _m.Called(_ca...) var r0 *typestx.SimulateResponse - if rf, ok := ret.Get(0).(func(grpc.ClientConn, tx.Factory, ...types.Msg) *typestx.SimulateResponse); ok { + var r1 uint64 + var r2 error + if rf, ok := ret.Get(0).(func(grpc.ClientConn, tx.Factory, ...proto.Message) (*typestx.SimulateResponse, uint64, error)); ok { + return rf(clientCtx, txf, msgs...) + } + if rf, ok := ret.Get(0).(func(grpc.ClientConn, tx.Factory, ...proto.Message) *typestx.SimulateResponse); ok { r0 = rf(clientCtx, txf, msgs...) } else { if ret.Get(0) != nil { @@ -46,15 +51,13 @@ func (_m *Gasometer) CalculateGas(clientCtx grpc.ClientConn, txf tx.Factory, msg } } - var r1 uint64 - if rf, ok := ret.Get(1).(func(grpc.ClientConn, tx.Factory, ...types.Msg) uint64); ok { + if rf, ok := ret.Get(1).(func(grpc.ClientConn, tx.Factory, ...proto.Message) uint64); ok { r1 = rf(clientCtx, txf, msgs...) } else { r1 = ret.Get(1).(uint64) } - var r2 error - if rf, ok := ret.Get(2).(func(grpc.ClientConn, tx.Factory, ...types.Msg) error); ok { + if rf, ok := ret.Get(2).(func(grpc.ClientConn, tx.Factory, ...proto.Message) error); ok { r2 = rf(clientCtx, txf, msgs...) } else { r2 = ret.Error(2) @@ -71,18 +74,18 @@ type Gasometer_CalculateGas_Call struct { // CalculateGas is a helper method to define mock.On call // - clientCtx grpc.ClientConn // - txf tx.Factory -// - msgs ...types.Msg +// - msgs ...proto.Message func (_e *Gasometer_Expecter) CalculateGas(clientCtx interface{}, txf interface{}, msgs ...interface{}) *Gasometer_CalculateGas_Call { return &Gasometer_CalculateGas_Call{Call: _e.mock.On("CalculateGas", append([]interface{}{clientCtx, txf}, msgs...)...)} } -func (_c *Gasometer_CalculateGas_Call) Run(run func(clientCtx grpc.ClientConn, txf tx.Factory, msgs ...types.Msg)) *Gasometer_CalculateGas_Call { +func (_c *Gasometer_CalculateGas_Call) Run(run func(clientCtx grpc.ClientConn, txf tx.Factory, msgs ...proto.Message)) *Gasometer_CalculateGas_Call { _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]types.Msg, len(args)-2) + variadicArgs := make([]proto.Message, len(args)-2) for i, a := range args[2:] { if a != nil { - variadicArgs[i] = a.(types.Msg) + variadicArgs[i] = a.(proto.Message) } } run(args[0].(grpc.ClientConn), args[1].(tx.Factory), variadicArgs...) @@ -95,13 +98,17 @@ func (_c *Gasometer_CalculateGas_Call) Return(_a0 *typestx.SimulateResponse, _a1 return _c } -type mockConstructorTestingTNewGasometer interface { - mock.TestingT - Cleanup(func()) +func (_c *Gasometer_CalculateGas_Call) RunAndReturn(run func(grpc.ClientConn, tx.Factory, ...proto.Message) (*typestx.SimulateResponse, uint64, error)) *Gasometer_CalculateGas_Call { + _c.Call.Return(run) + return _c } // NewGasometer creates a new instance of Gasometer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewGasometer(t mockConstructorTestingTNewGasometer) *Gasometer { +// The first argument is typically a *testing.T value. +func NewGasometer(t interface { + mock.TestingT + Cleanup(func()) +}) *Gasometer { mock := &Gasometer{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/mocks/rpc_client.go b/ignite/pkg/cosmosclient/mocks/rpc_client.go index d76eae984d..8de5a98e44 100644 --- a/ignite/pkg/cosmosclient/mocks/rpc_client.go +++ b/ignite/pkg/cosmosclient/mocks/rpc_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.22.1. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -2184,13 +2184,12 @@ func (_c *RPCClient_Validators_Call) RunAndReturn(run func(context.Context, *int return _c } -type mockConstructorTestingTNewRPCClient interface { +// NewRPCClient creates a new instance of RPCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewRPCClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewRPCClient creates a new instance of RPCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRPCClient(t mockConstructorTestingTNewRPCClient) *RPCClient { +}) *RPCClient { mock := &RPCClient{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/mocks/signer.go b/ignite/pkg/cosmosclient/mocks/signer.go index b199b10fcf..65abb06f7f 100644 --- a/ignite/pkg/cosmosclient/mocks/signer.go +++ b/ignite/pkg/cosmosclient/mocks/signer.go @@ -1,8 +1,10 @@ -// Code generated by mockery v2.16.0. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks import ( + context "context" + client "github.com/cosmos/cosmos-sdk/client" mock "github.com/stretchr/testify/mock" @@ -23,13 +25,13 @@ func (_m *Signer) EXPECT() *Signer_Expecter { return &Signer_Expecter{mock: &_m.Mock} } -// Sign provides a mock function with given fields: txf, name, txBuilder, overwriteSig -func (_m *Signer) Sign(txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { - ret := _m.Called(txf, name, txBuilder, overwriteSig) +// Sign provides a mock function with given fields: ctx, txf, name, txBuilder, overwriteSig +func (_m *Signer) Sign(ctx context.Context, txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { + ret := _m.Called(ctx, txf, name, txBuilder, overwriteSig) var r0 error - if rf, ok := ret.Get(0).(func(tx.Factory, string, client.TxBuilder, bool) error); ok { - r0 = rf(txf, name, txBuilder, overwriteSig) + if rf, ok := ret.Get(0).(func(context.Context, tx.Factory, string, client.TxBuilder, bool) error); ok { + r0 = rf(ctx, txf, name, txBuilder, overwriteSig) } else { r0 = ret.Error(0) } @@ -43,17 +45,18 @@ type Signer_Sign_Call struct { } // Sign is a helper method to define mock.On call +// - ctx context.Context // - txf tx.Factory // - name string // - txBuilder client.TxBuilder // - overwriteSig bool -func (_e *Signer_Expecter) Sign(txf interface{}, name interface{}, txBuilder interface{}, overwriteSig interface{}) *Signer_Sign_Call { - return &Signer_Sign_Call{Call: _e.mock.On("Sign", txf, name, txBuilder, overwriteSig)} +func (_e *Signer_Expecter) Sign(ctx interface{}, txf interface{}, name interface{}, txBuilder interface{}, overwriteSig interface{}) *Signer_Sign_Call { + return &Signer_Sign_Call{Call: _e.mock.On("Sign", ctx, txf, name, txBuilder, overwriteSig)} } -func (_c *Signer_Sign_Call) Run(run func(txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool)) *Signer_Sign_Call { +func (_c *Signer_Sign_Call) Run(run func(ctx context.Context, txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool)) *Signer_Sign_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tx.Factory), args[1].(string), args[2].(client.TxBuilder), args[3].(bool)) + run(args[0].(context.Context), args[1].(tx.Factory), args[2].(string), args[3].(client.TxBuilder), args[4].(bool)) }) return _c } @@ -63,13 +66,17 @@ func (_c *Signer_Sign_Call) Return(_a0 error) *Signer_Sign_Call { return _c } -type mockConstructorTestingTNewSigner interface { - mock.TestingT - Cleanup(func()) +func (_c *Signer_Sign_Call) RunAndReturn(run func(context.Context, tx.Factory, string, client.TxBuilder, bool) error) *Signer_Sign_Call { + _c.Call.Return(run) + return _c } // NewSigner creates a new instance of Signer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSigner(t mockConstructorTestingTNewSigner) *Signer { +// The first argument is typically a *testing.T value. +func NewSigner(t interface { + mock.TestingT + Cleanup(func()) +}) *Signer { mock := &Signer{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosclient/signer.go b/ignite/pkg/cosmosclient/signer.go index ea0aa10a6c..383b750411 100644 --- a/ignite/pkg/cosmosclient/signer.go +++ b/ignite/pkg/cosmosclient/signer.go @@ -1,6 +1,8 @@ package cosmosclient import ( + "context" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" ) @@ -8,6 +10,6 @@ import ( // signer implements the Signer interface. type signer struct{} -func (signer) Sign(txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { - return tx.Sign(txf, name, txBuilder, overwriteSig) +func (signer) Sign(ctx context.Context, txf tx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool) error { + return tx.Sign(ctx, txf, name, txBuilder, overwriteSig) } diff --git a/ignite/pkg/cosmosclient/txservice.go b/ignite/pkg/cosmosclient/txservice.go index 5f1ede4d50..187f4bc6c0 100644 --- a/ignite/pkg/cosmosclient/txservice.go +++ b/ignite/pkg/cosmosclient/txservice.go @@ -32,13 +32,17 @@ func (s TxService) Broadcast(ctx context.Context) (Response, error) { // validate msgs. for _, msg := range s.txBuilder.GetTx().GetMsgs() { + msg, ok := msg.(sdktypes.HasValidateBasic) + if !ok { + continue + } if err := msg.ValidateBasic(); err != nil { return Response{}, errors.WithStack(err) } } accountName := s.clientContext.GetFromName() - if err := s.client.signer.Sign(s.txFactory, accountName, s.txBuilder, true); err != nil { + if err := s.client.signer.Sign(ctx, s.txFactory, accountName, s.txBuilder, true); err != nil { return Response{}, errors.WithStack(err) } diff --git a/ignite/pkg/cosmosclient/txservice_test.go b/ignite/pkg/cosmosclient/txservice_test.go index d78722f071..c5f3db5fb4 100644 --- a/ignite/pkg/cosmosclient/txservice_test.go +++ b/ignite/pkg/cosmosclient/txservice_test.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "testing" + "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" ctypes "github.com/cometbft/cometbft/rpc/core/types" sdktypes "github.com/cosmos/cosmos-sdk/types" @@ -39,7 +40,7 @@ func TestTxServiceBroadcast(t *testing.T) { FromAddress: sdkaddr.String(), ToAddress: "cosmos1k8e50d2d8xkdfw9c4et3m45llh69e7xzw6uzga", Amount: sdktypes.NewCoins( - sdktypes.NewCoin("token", sdktypes.NewIntFromUint64(1)), + sdktypes.NewCoin("token", math.NewIntFromUint64(1)), ), } tests := []struct { @@ -50,14 +51,6 @@ func TestTxServiceBroadcast(t *testing.T) { expectedError string setup func(suite) }{ - { - name: "fail: invalid msg", - msg: &banktypes.MsgSend{}, - expectedError: "invalid from address: empty address string is not allowed: invalid address", - setup: func(s suite) { - s.expectPrepareFactory(sdkaddr) - }, - }, { name: "fail: error not found", msg: msg, @@ -66,7 +59,7 @@ func TestTxServiceBroadcast(t *testing.T) { setup: func(s suite) { s.expectPrepareFactory(sdkaddr) s.signer.EXPECT(). - Sign(mock.Anything, "bob", mock.Anything, true). + Sign(goCtx, mock.Anything, "bob", mock.Anything, true). Return(nil) s.rpcClient.EXPECT(). BroadcastTxSync(mock.Anything, mock.Anything). @@ -81,7 +74,7 @@ func TestTxServiceBroadcast(t *testing.T) { setup: func(s suite) { s.expectPrepareFactory(sdkaddr) s.signer.EXPECT(). - Sign(mock.Anything, "bob", mock.Anything, true). + Sign(goCtx, mock.Anything, "bob", mock.Anything, true). Return(nil) s.rpcClient.EXPECT(). BroadcastTxSync(mock.Anything, mock.Anything). @@ -102,7 +95,7 @@ func TestTxServiceBroadcast(t *testing.T) { setup: func(s suite) { s.expectPrepareFactory(sdkaddr) s.signer.EXPECT(). - Sign(mock.Anything, "bob", mock.Anything, true). + Sign(goCtx, mock.Anything, "bob", mock.Anything, true). Return(nil) s.rpcClient.EXPECT(). BroadcastTxSync(mock.Anything, mock.Anything). @@ -114,7 +107,7 @@ func TestTxServiceBroadcast(t *testing.T) { s.rpcClient.EXPECT().Tx(goCtx, txHash, false). Return(&ctypes.ResultTx{ Hash: txHash, - TxResult: abci.ResponseDeliverTx{ + TxResult: abci.ExecTxResult{ Log: "log", }, }, nil) @@ -128,7 +121,7 @@ func TestTxServiceBroadcast(t *testing.T) { setup: func(s suite) { s.expectPrepareFactory(sdkaddr) s.signer.EXPECT(). - Sign(mock.Anything, "bob", mock.Anything, true). + Sign(goCtx, mock.Anything, "bob", mock.Anything, true). Return(nil) s.rpcClient.EXPECT(). BroadcastTxSync(mock.Anything, mock.Anything). @@ -140,7 +133,7 @@ func TestTxServiceBroadcast(t *testing.T) { s.rpcClient.EXPECT().Tx(goCtx, txHash, false). Return(&ctypes.ResultTx{ Hash: txHash, - TxResult: abci.ResponseDeliverTx{ + TxResult: abci.ExecTxResult{ Code: 42, Log: "oups", }, @@ -157,7 +150,7 @@ func TestTxServiceBroadcast(t *testing.T) { setup: func(s suite) { s.expectPrepareFactory(sdkaddr) s.signer.EXPECT(). - Sign(mock.Anything, "bob", mock.Anything, true). + Sign(goCtx, mock.Anything, "bob", mock.Anything, true). Return(nil) s.rpcClient.EXPECT(). BroadcastTxSync(mock.Anything, mock.Anything). diff --git a/ignite/pkg/cosmosfaucet/cosmosfaucet.go b/ignite/pkg/cosmosfaucet/cosmosfaucet.go index e64ba81f10..b8a9ea5ed0 100644 --- a/ignite/pkg/cosmosfaucet/cosmosfaucet.go +++ b/ignite/pkg/cosmosfaucet/cosmosfaucet.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" chaincmdrunner "github.com/ignite/cli/ignite/pkg/chaincmd/runner" + "github.com/ignite/cli/ignite/pkg/cosmosver" ) const ( @@ -56,10 +57,16 @@ type Faucet struct { // it holds the maximum amounts of coins that can be sent to a single account. coinsMax map[string]sdkmath.Int + // fee to pay along with the transaction + feeAmount sdk.Coin + limitRefreshWindow time.Duration // openAPIData holds template data customizations for serving OpenAPI page & spec. openAPIData openAPIData + + // version holds the cosmos-sdk version. + version cosmosver.Version } // Option configures the faucetOptions. @@ -102,6 +109,13 @@ func ChainID(id string) Option { } } +// FeeAmount sets a fee that it will be paid during the transaction. +func FeeAmount(amount sdkmath.Int, denom string) Option { + return func(f *Faucet) { + f.feeAmount = sdk.NewCoin(denom, amount) + } +} + // OpenAPI configures how to serve Open API page and spec. func OpenAPI(apiAddress string) Option { return func(f *Faucet) { @@ -109,6 +123,13 @@ func OpenAPI(apiAddress string) Option { } } +// Version configures the cosmos-sdk version. +func Version(version cosmosver.Version) Option { + return func(f *Faucet) { + f.version = version + } +} + // New creates a new faucet with ccr (to access and use blockchain's CLI) and given options. func New(ctx context.Context, ccr chaincmdrunner.Runner, options ...Option) (Faucet, error) { f := Faucet{ diff --git a/ignite/pkg/cosmosfaucet/transfer.go b/ignite/pkg/cosmosfaucet/transfer.go index 4141977cc7..10365bee5b 100644 --- a/ignite/pkg/cosmosfaucet/transfer.go +++ b/ignite/pkg/cosmosfaucet/transfer.go @@ -10,7 +10,9 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ignite/cli/ignite/pkg/chaincmd" chaincmdrunner "github.com/ignite/cli/ignite/pkg/chaincmd/runner" + "github.com/ignite/cli/ignite/pkg/cosmosver" ) // transferMutex is a mutex used for keeping transfer requests in a queue so checking account balance and sending tokens is atomic. @@ -23,11 +25,22 @@ func (f Faucet) TotalTransferredAmount(ctx context.Context, toAccountAddress, de return sdkmath.NewInt(0), err } - events, err := f.runner.QueryTxEvents(ctx, + opts := []chaincmdrunner.EventSelector{ chaincmdrunner.NewEventSelector("message", "sender", fromAccount.Address), - chaincmdrunner.NewEventSelector("transfer", "recipient", toAccountAddress)) - if err != nil { - return sdkmath.NewInt(0), err + chaincmdrunner.NewEventSelector("transfer", "recipient", toAccountAddress), + } + + var events []chaincmdrunner.Event + if f.version.GTE(cosmosver.StargateFiftyVersion) { + events, err = f.runner.QueryTxByQuery(ctx, opts...) + if err != nil { + return sdkmath.NewInt(0), err + } + } else { + events, err = f.runner.QueryTxByEvents(ctx, opts...) + if err != nil { + return sdkmath.NewInt(0), err + } } totalAmount = sdkmath.NewInt(0) @@ -92,7 +105,7 @@ func (f *Faucet) Transfer(ctx context.Context, toAccountAddress string, coins sd if err != nil { return err } - txHash, err := f.runner.BankSend(ctx, fromAccount.Address, toAccountAddress, strings.Join(coinsStr, ",")) + txHash, err := f.runner.BankSend(ctx, fromAccount.Address, toAccountAddress, strings.Join(coinsStr, ","), chaincmd.BankSendWithFees(f.feeAmount)) if err != nil { return err } diff --git a/ignite/pkg/cosmosgen/cosmosgen.go b/ignite/pkg/cosmosgen/cosmosgen.go index 57eb8417b3..507a90c369 100644 --- a/ignite/pkg/cosmosgen/cosmosgen.go +++ b/ignite/pkg/cosmosgen/cosmosgen.go @@ -12,15 +12,17 @@ import ( "github.com/ignite/cli/ignite/pkg/cache" "github.com/ignite/cli/ignite/pkg/cosmosanalysis/module" "github.com/ignite/cli/ignite/pkg/cosmosbuf" + "github.com/ignite/cli/ignite/pkg/events" ) // generateOptions used to configure code generation. type generateOptions struct { - includeDirs []string - useCache bool + includeDirs []string + useCache bool + updateBufModule bool + ev events.Bus - isGoEnabled bool - isPulsarEnabled bool + generateProtobuf bool jsOut func(module.Module) string tsClientRootPath string @@ -74,17 +76,10 @@ func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option { } } -// WithGoGeneration adds Go code generation. +// WithGoGeneration adds protobuf (gogoproto and pulsar) code generation. func WithGoGeneration() Option { return func(o *generateOptions) { - o.isGoEnabled = true - } -} - -// WithPulsarGeneration adds Go pulsar code generation. -func WithPulsarGeneration() Option { - return func(o *generateOptions) { - o.isPulsarEnabled = true + o.generateProtobuf = true } } @@ -103,9 +98,24 @@ func IncludeDirs(dirs []string) Option { } } +// UpdateBufModule enables Buf config proto dependencies update. +// This option updates app's Buf config when proto packages or +// Buf modules are found within the Go dependencies. +func UpdateBufModule() Option { + return func(o *generateOptions) { + o.updateBufModule = true + } +} + +// CollectEvents sets an event bus for sending generation feedback events. +func CollectEvents(ev events.Bus) Option { + return func(c *generateOptions) { + c.ev = ev + } +} + // generator generates code for sdk and sdk apps. type generator struct { - ctx context.Context buf cosmosbuf.Buf cacheStorage cache.Storage appPath string @@ -115,9 +125,9 @@ type generator struct { sdkImport string deps []gomodule.Version appModules []module.Module - appIncludes []string + appIncludes protoIncludes thirdModules map[string][]module.Module - thirdModuleIncludes map[string][]string + thirdModuleIncludes map[string]protoIncludes tmpDirs []string } @@ -139,14 +149,13 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir defer b.Cleanup() g := &generator{ - ctx: ctx, buf: b, appPath: appPath, protoDir: protoDir, gomodPath: gomodPath, opts: &generateOptions{}, thirdModules: make(map[string][]module.Module), - thirdModuleIncludes: make(map[string][]string), + thirdModuleIncludes: make(map[string]protoIncludes), cacheStorage: cacheStorage, } @@ -156,31 +165,40 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir apply(g.opts) } - if err := g.setup(); err != nil { + if err := g.setup(ctx); err != nil { return err } + // Update app's Buf config for third party discovered proto modules. + // Go dependency packages might contain proto files which could also + // optionally be using Buf, so for those cases the discovered proto + // files should be available before code generation. + if g.opts.updateBufModule { + if err := g.updateBufModule(ctx); err != nil { + return err + } + } + // Go generation must run first so the types are created before other // generated code that requires sdk.Msg implementations to be defined - if g.opts.isGoEnabled { - if err := g.generateGo(); err != nil { + if g.opts.generateProtobuf { + if err := g.generateGoGo(ctx); err != nil { return err } - } - if g.opts.isPulsarEnabled { - if err := g.generatePulsar(); err != nil { + + if err := g.generatePulsar(ctx); err != nil { return err } } if g.opts.specOut != "" { - if err := g.generateOpenAPISpec(); err != nil { + if err := g.generateOpenAPISpec(ctx); err != nil { return err } } if g.opts.jsOut != nil { - if err := g.generateTS(); err != nil { + if err := g.generateTS(ctx); err != nil { return err } } diff --git a/ignite/pkg/cosmosgen/generate.go b/ignite/pkg/cosmosgen/generate.go index 05cc679089..840b100a8d 100644 --- a/ignite/pkg/cosmosgen/generate.go +++ b/ignite/pkg/cosmosgen/generate.go @@ -2,40 +2,77 @@ package cosmosgen import ( "bytes" + "context" + "fmt" "io/fs" "os" "path/filepath" + "slices" "strings" "github.com/pkg/errors" + "gopkg.in/yaml.v2" "github.com/ignite/cli/ignite/pkg/cache" + "github.com/ignite/cli/ignite/pkg/cliui/colors" + "github.com/ignite/cli/ignite/pkg/cliui/icons" "github.com/ignite/cli/ignite/pkg/cmdrunner" "github.com/ignite/cli/ignite/pkg/cmdrunner/step" "github.com/ignite/cli/ignite/pkg/cosmosanalysis/module" "github.com/ignite/cli/ignite/pkg/cosmosbuf" "github.com/ignite/cli/ignite/pkg/cosmosver" + "github.com/ignite/cli/ignite/pkg/events" "github.com/ignite/cli/ignite/pkg/gomodule" "github.com/ignite/cli/ignite/pkg/xfilepath" + "github.com/ignite/cli/ignite/pkg/xos" ) const ( moduleCacheNamespace = "generate.setup.module" includeProtoCacheNamespace = "generator.includes.proto" + workFilename = "buf.work.yaml" ) -var protocGlobalInclude = xfilepath.List( - xfilepath.JoinFromHome(xfilepath.Path("local/include")), - xfilepath.JoinFromHome(xfilepath.Path(".local/include")), +var ( + ErrBufConfig = errors.New("invalid Buf config") + + protocGlobalInclude = xfilepath.List( + xfilepath.JoinFromHome(xfilepath.Path("local/include")), + xfilepath.JoinFromHome(xfilepath.Path(".local/include")), + ) ) -type ModulesInPath struct { - Path string - Modules []module.Module - Includes []string +// protoIncludes contains proto include paths for a package. +type protoIncludes struct { + // Paths is a list of proto include paths. + Paths []string + + // BufPath is the path to the Buf config file when it exists. + BufPath string + + // ProtoPath contains the path to the package's proto directory. + ProtoPath string +} + +// protoAnalysis contains proto module analysis data for a Go package dependency. +type protoAnalysis struct { + // Path is the full path to the Go dependency + Path string + + // Modules contains the proto modules analysis data. + // The list is empty when the Go package has no proto files. + Modules []module.Module + + // Includes contain proto include paths. + // These paths should be used when generating code. + Includes protoIncludes } -func (g *generator) setup() (err error) { +func newBufConfigError(path string, cause error) error { + return fmt.Errorf("%w: %s: %w", ErrBufConfig, path, cause) +} + +func (g *generator) setup(ctx context.Context) (err error) { // Cosmos SDK hosts proto files of own x/ modules and some third party ones needed by itself and // blockchain apps. Generate should be aware of these and make them available to the blockchain // app that wants to generate code for its own proto. @@ -49,7 +86,7 @@ func (g *generator) setup() (err error) { New( cmdrunner.DefaultStderr(&errb), cmdrunner.DefaultWorkdir(g.appPath), - ).Run(g.ctx, step.New(step.Exec("go", "mod", "download"))); err != nil { + ).Run(ctx, step.New(step.Exec("go", "mod", "download"))); err != nil { return errors.Wrap(err, errb.String()) } @@ -76,31 +113,34 @@ func (g *generator) setup() (err error) { } // Discover any custom modules defined by the user's app - g.appModules, err = g.discoverModules(g.appPath, g.protoDir) + g.appModules, err = g.discoverModules(ctx, g.appPath, g.protoDir) if err != nil { return err } - g.appIncludes, _, err = g.resolveIncludes(g.appPath) + + g.appIncludes, _, err = g.resolveIncludes(ctx, g.appPath) if err != nil { return err } - // Go through the Go dependencies of the user's app within go.mod, some of them might be hosting Cosmos SDK modules - // that could be in use by user's blockchain. + + // Go through the Go dependencies of the user's app within go.mod, some of them + // might be hosting Cosmos SDK modules that could be in use by user's blockchain. // - // Cosmos SDK is a dependency of all blockchains, so it's absolute that we'll be discovering all modules of the - // SDK as well during this process. + // Cosmos SDK is a dependency of all blockchains, so it's absolute that we'll be + // discovering all modules of the SDK as well during this process. // - // Even if a dependency contains some SDK modules, not all of these modules could be used by user's blockchain. - // this is fine, we can still generate TS clients for those non modules, it is up to user to use (import in typescript) - // not use generated modules. + // Even if a dependency contains some SDK modules, not all of these modules could + // be used by user's blockchain. This is fine, we can still generate TS clients + // for those non modules, it is up to user to use (import in typescript) not use + // generated modules. // - // TODO: we can still implement some sort of smart filtering to detect non used modules by the user's blockchain - // at some point, it is a nice to have. - moduleCache := cache.New[ModulesInPath](g.cacheStorage, moduleCacheNamespace) + // TODO: we can still implement some sort of smart filtering to detect non used + // modules by the user's blockchain at some point, it is a nice to have. + moduleCache := cache.New[protoAnalysis](g.cacheStorage, moduleCacheNamespace) for _, dep := range g.deps { // Try to get the cached list of modules for the current dependency package cacheKey := cache.Key(dep.Path, dep.Version) - modulesInPath, err := moduleCache.Get(cacheKey) + depInfo, err := moduleCache.Get(cacheKey) if err != nil && !errors.Is(err, cache.ErrorNotFound) { return err } @@ -108,50 +148,44 @@ func (g *generator) setup() (err error) { // Discover the modules of the dependency package when they are not cached if errors.Is(err, cache.ErrorNotFound) { // Get the absolute path to the package's directory - path, err := gomodule.LocatePath(g.ctx, g.cacheStorage, g.appPath, dep) + path, err := gomodule.LocatePath(ctx, g.cacheStorage, g.appPath, dep) if err != nil { return err } // Discover any modules defined by the package - modules, err := g.discoverModules(path, "") + modules, err := g.discoverModules(ctx, path, "") if err != nil { return err } - var includes []string - cacheable := true + // Dependency/includes resolution per module is done to solve versioning issues + var ( + includes protoIncludes + cacheable = true + ) if len(modules) > 0 { - // For versioning issues, we do dependency/includes resolution per module - includes, cacheable, err = g.resolveIncludes(path) + includes, cacheable, err = g.resolveIncludes(ctx, path) if err != nil { return err } } - modulesInPath = ModulesInPath{ + depInfo = protoAnalysis{ Path: path, Modules: modules, Includes: includes, } + if cacheable { - if err := moduleCache.Put(cacheKey, modulesInPath); err != nil { + if err = moduleCache.Put(cacheKey, depInfo); err != nil { return err } } } - g.thirdModules[modulesInPath.Path] = append( - g.thirdModules[modulesInPath.Path], - modulesInPath.Modules..., - ) - - if modulesInPath.Includes != nil { - g.thirdModuleIncludes[modulesInPath.Path] = append( - g.thirdModuleIncludes[modulesInPath.Path], - modulesInPath.Includes..., - ) - } + g.thirdModules[depInfo.Path] = depInfo.Modules + g.thirdModuleIncludes[depInfo.Path] = depInfo.Includes } return nil @@ -172,7 +206,8 @@ func (g *generator) findBufPath(modpath string) (string, error) { if err != nil { return err } - if filepath.Base(path) == "buf.yaml" { + base := filepath.Base(path) + if base == "buf.yaml" || base == "buf.yml" { bufPath = path return filepath.SkipAll } @@ -184,7 +219,7 @@ func (g *generator) findBufPath(modpath string) (string, error) { return bufPath, nil } -func (g *generator) generateBufIncludeFolder(modpath string) (string, error) { +func (g *generator) generateBufIncludeFolder(ctx context.Context, modpath string) (string, error) { protoPath, err := os.MkdirTemp("", "includeFolder") if err != nil { return "", err @@ -192,74 +227,248 @@ func (g *generator) generateBufIncludeFolder(modpath string) (string, error) { g.tmpDirs = append(g.tmpDirs, protoPath) - err = g.buf.Export(g.ctx, modpath, protoPath) + err = g.buf.Export(ctx, modpath, protoPath) if err != nil { return "", err } return protoPath, nil } -func (g *generator) resolveIncludes(path string) (paths []string, cacheable bool, err error) { +func (g *generator) resolveIncludes(ctx context.Context, path string) (protoIncludes, bool, error) { // Init paths with the global include paths for protoc - paths, err = protocGlobalInclude() + paths, err := protocGlobalInclude() if err != nil { - return nil, false, err + return protoIncludes{}, false, err } - // Check that the app proto directory exists + includes := protoIncludes{Paths: paths} + + // Check that the app/package proto directory exists protoPath := filepath.Join(path, g.protoDir) fi, err := os.Stat(protoPath) if err != nil && !os.IsNotExist(err) { - return nil, false, err + return protoIncludes{}, false, err } else if !fi.IsDir() { // Just return the global includes when a proto directory doesn't exist - return paths, true, nil + return includes, true, nil } // Add app's proto path to the list of proto paths - paths = append(paths, protoPath) + includes.Paths = append(includes.Paths, protoPath) + includes.ProtoPath = protoPath // Check if a Buf config file is present - bufPath, err := g.findBufPath(protoPath) + includes.BufPath, err = g.findBufPath(protoPath) if err != nil { - return nil, false, err + return includes, false, err } - // When a Buf config exists export all protos needed - // to build the modules to a temporary include folder. - if bufPath != "" { - includePath, err := g.generateBufIncludeFolder(protoPath) + if includes.BufPath != "" { + // When a Buf config exists export all protos needed + // to build the modules to a temporary include folder. + bufProtoPath, err := g.generateBufIncludeFolder(ctx, protoPath) if err != nil && !errors.Is(err, cosmosbuf.ErrProtoFilesNotFound) { - return nil, false, err + return protoIncludes{}, false, err } // Use exported files only when the path contains ".proto" files - if includePath != "" { - return append(paths, includePath), false, nil + if bufProtoPath != "" { + includes.Paths = append(includes.Paths, bufProtoPath) + return includes, false, nil } } - // By default use the configured directories - return append(paths, g.getProtoIncludeFolders(path)...), true, nil + // When there is no Buf config add the configured directories + // instead to keep the legacy (non Buf) behavior. + includes.Paths = append(includes.Paths, g.getProtoIncludeFolders(path)...) + + return includes, true, nil } -func (g *generator) discoverModules(path, protoDir string) ([]module.Module, error) { +func (g *generator) discoverModules(ctx context.Context, path, protoDir string) ([]module.Module, error) { var filteredModules []module.Module - - modules, err := module.Discover(g.ctx, g.appPath, path, protoDir) + modules, err := module.Discover(ctx, g.appPath, path, protoDir) if err != nil { return nil, err } protoPath := filepath.Join(path, g.protoDir) - for _, m := range modules { if !strings.HasPrefix(m.Pkg.Path, protoPath) { continue } - filteredModules = append(filteredModules, m) } return filteredModules, nil } + +func (g generator) updateBufModule(ctx context.Context) error { + for pkgPath, includes := range g.thirdModuleIncludes { + // Skip third party dependencies without proto files + if includes.ProtoPath == "" { + continue + } + + // Resolve the Go package and use the module name as the proto vendor directory name + modFile, err := gomodule.ParseAt(pkgPath) + if err != nil { + return err + } + + pkgName := modFile.Module.Mod.Path + + // When a Buf config with name is available add it to app's dependencies + // or otherwise export the proto files to a vendor directory. + if includes.BufPath != "" { + if err := g.resolveBufDependency(ctx, pkgName, includes.BufPath); err != nil { + return err + } + } else { + if err := g.vendorProtoPackage(pkgName, includes.ProtoPath); err != nil { + return err + } + } + } + return nil +} + +func (g generator) resolveBufDependency(ctx context.Context, pkgName, bufPath string) error { + // Open the dependency Buf config to find the BSR package name + f, err := os.Open(bufPath) + if err != nil { + return err + } + defer f.Close() + + cfg := struct { + Name string `yaml:"name"` + }{} + + if err := yaml.NewDecoder(f).Decode(&cfg); err != nil { + return newBufConfigError(bufPath, err) + } + + // When dependency package has a Buf config name try to add it to app's + // dependencies. Name is optional and defines the BSR package name. + if cfg.Name != "" { + return g.addBufDependency(ctx, cfg.Name) + } + // By default just vendor the proto package + return g.vendorProtoPackage(pkgName, filepath.Dir(bufPath)) +} + +func (g generator) addBufDependency(ctx context.Context, depName string) error { + // Read app's Buf config + path := g.appIncludes.BufPath + bz, err := os.ReadFile(path) + if err != nil { + return err + } + + // Check if the proto dependency is already present in app's Buf config + cfg := struct { + Deps []string `yaml:"deps"` + }{} + if err := yaml.Unmarshal(bz, &cfg); err != nil { + return newBufConfigError(path, err) + } + + if slices.Contains(cfg.Deps, depName) { + return nil + } + + // Add the new dependency and update app's Buf config + f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0o644) + if err != nil { + return err + } + defer f.Close() + + var rawCfg map[string]interface{} + if err := yaml.Unmarshal(bz, &rawCfg); err != nil { + return newBufConfigError(path, err) + } + + rawCfg["deps"] = append(cfg.Deps, depName) + + enc := yaml.NewEncoder(f) + defer enc.Close() + + if err := enc.Encode(rawCfg); err != nil { + return err + } + + g.opts.ev.Send( + fmt.Sprintf("New Buf dependency added: %s", colors.Name(depName)), + events.Icon(icons.OK), + ) + + // Update Buf lock so it contains the new dependency + return g.buf.Update(ctx, filepath.Dir(path), depName) +} + +func (g generator) vendorProtoPackage(pkgName, protoPath string) (err error) { + // Check that the dependency vendor directory doesn't exist + vendorRelPath := filepath.Join("proto_vendor", pkgName) + vendorPath := filepath.Join(g.appPath, vendorRelPath) + _, err = os.Stat(vendorPath) + if err != nil && !os.IsNotExist(err) { + return err + } + + // Skip vendoring when the dependency is already vendored + if !os.IsNotExist(err) { + return nil + } + + if err = os.MkdirAll(vendorPath, 0o777); err != nil { + return err + } + + // Make sure that the vendor folder is removed on error + defer func() { + if err != nil { + _ = os.RemoveAll(vendorPath) + } + }() + + if err = xos.CopyFolder(protoPath, vendorPath); err != nil { + return err + } + + path := filepath.Join(g.appPath, workFilename) + bz, err := os.ReadFile(path) + if err != nil { + return fmt.Errorf("error reading Buf workspace file: %s: %w", path, err) + } + + ws := struct { + Version string `yaml:"version"` + Directories []string `yaml:"directories"` + }{} + if err := yaml.Unmarshal(bz, &ws); err != nil { + return err + } + + ws.Directories = append(ws.Directories, vendorRelPath) + + f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0o644) + if err != nil { + return err + } + defer f.Close() + + enc := yaml.NewEncoder(f) + defer enc.Close() + if err = enc.Encode(ws); err != nil { + return err + } + + g.opts.ev.Send( + fmt.Sprintf("New Buf vendored dependency added: %s", colors.Name(vendorRelPath)), + events.Icon(icons.OK), + ) + + return nil +} diff --git a/ignite/pkg/cosmosgen/generate_go.go b/ignite/pkg/cosmosgen/generate_go.go index ae8dfc6ce5..3f6d70cc8d 100644 --- a/ignite/pkg/cosmosgen/generate_go.go +++ b/ignite/pkg/cosmosgen/generate_go.go @@ -1,10 +1,12 @@ package cosmosgen import ( + "context" "os" "path/filepath" "github.com/otiai10/copy" + "github.com/pkg/errors" ) @@ -16,7 +18,7 @@ func (g *generator) pulsarTemplate() string { return filepath.Join(g.appPath, g.protoDir, "buf.gen.pulsar.yaml") } -func (g *generator) generateGo() error { +func (g *generator) generateGoGo(ctx context.Context) error { // create a temporary dir to locate generated code under which later only some of them will be moved to the // app's source code. this also prevents having leftover files in the app's source code or its parent dir - when // command executed directly there - in case of an interrupt. @@ -29,13 +31,8 @@ func (g *generator) generateGo() error { protoPath := filepath.Join(g.appPath, g.protoDir) // code generate for each module. - if err := g.buf.Generate( - g.ctx, - protoPath, - tmp, - g.gogoTemplate(), - "module.proto", - ); err != nil { + err = g.buf.Generate(ctx, protoPath, tmp, g.gogoTemplate(), "module.proto") + if err != nil { return err } @@ -55,7 +52,7 @@ func (g *generator) generateGo() error { return nil } -func (g *generator) generatePulsar() error { +func (g *generator) generatePulsar(ctx context.Context) error { // create a temporary dir to locate generated code under which later only some of them will be moved to the // app's source code. this also prevents having leftover files in the app's source code or its parent dir - when // command executed directly there - in case of an interrupt. @@ -68,12 +65,8 @@ func (g *generator) generatePulsar() error { protoPath := filepath.Join(g.appPath, g.protoDir) // code generate for each module. - if err := g.buf.Generate( - g.ctx, - protoPath, - tmp, - g.pulsarTemplate(), - ); err != nil { + err = g.buf.Generate(ctx, protoPath, tmp, g.pulsarTemplate()) + if err != nil { return err } diff --git a/ignite/pkg/cosmosgen/generate_openapi.go b/ignite/pkg/cosmosgen/generate_openapi.go index 84623e6b68..0100775b39 100644 --- a/ignite/pkg/cosmosgen/generate_openapi.go +++ b/ignite/pkg/cosmosgen/generate_openapi.go @@ -1,6 +1,7 @@ package cosmosgen import ( + "context" "errors" "fmt" "os" @@ -30,7 +31,7 @@ func (g *generator) openAPITemplateForSTA() string { return filepath.Join(g.appPath, g.protoDir, "buf.gen.sta.yaml") } -func (g *generator) generateOpenAPISpec() error { +func (g *generator) generateOpenAPISpec(ctx context.Context) error { var ( specDirs []string conf = swaggercombine.Config{ @@ -83,13 +84,8 @@ func (g *generator) generateOpenAPISpec() error { } hasAnySpecChanged = true - if err := g.buf.Generate( - g.ctx, - m.Pkg.Path, - dir, - g.openAPITemplate(), - "module.proto", - ); err != nil { + err = g.buf.Generate(ctx, m.Pkg.Path, dir, g.openAPITemplate(), "module.proto") + if err != nil { return err } @@ -162,14 +158,14 @@ func (g *generator) generateOpenAPISpec() error { } // combine specs into one and save to out. - if err := swaggercombine.Combine(g.ctx, conf, command, out); err != nil { + if err := swaggercombine.Combine(ctx, conf, command, out); err != nil { return err } return dirchange.SaveDirChecksum(specCache, out, g.appPath, out) } -func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error { +func (g *generator) generateModuleOpenAPISpec(ctx context.Context, m module.Module, out string) error { var ( specDirs []string conf = swaggercombine.Config{ @@ -199,13 +195,8 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error return err } - if err := g.buf.Generate( - g.ctx, - m.Pkg.Path, - dir, - g.openAPITemplateForSTA(), - "module.proto", - ); err != nil { + err = g.buf.Generate(ctx, m.Pkg.Path, dir, g.openAPITemplateForSTA(), "module.proto") + if err != nil { return err } @@ -253,5 +244,5 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error return err } // combine specs into one and save to out. - return swaggercombine.Combine(g.ctx, conf, command, out) + return swaggercombine.Combine(ctx, conf, command, out) } diff --git a/ignite/pkg/cosmosgen/generate_typescript.go b/ignite/pkg/cosmosgen/generate_typescript.go index 05f988a75e..328eb69b51 100644 --- a/ignite/pkg/cosmosgen/generate_typescript.go +++ b/ignite/pkg/cosmosgen/generate_typescript.go @@ -37,7 +37,7 @@ func newTSGenerator(g *generator) *tsGenerator { return &tsGenerator{g} } -func (g *generator) generateTS() error { +func (g *generator) generateTS(ctx context.Context) error { chainPath, _, err := gomodulepath.Find(g.appPath) if err != nil { return err @@ -70,14 +70,14 @@ func (g *generator) generateTS() error { }) tsg := newTSGenerator(g) - if err := tsg.generateModuleTemplates(); err != nil { + if err := tsg.generateModuleTemplates(ctx); err != nil { return err } return tsg.generateRootTemplates(data) } -func (g *tsGenerator) generateModuleTemplates() error { +func (g *tsGenerator) generateModuleTemplates(ctx context.Context) error { protocCmd, cleanupProtoc, err := protoc.Command() if err != nil { return err @@ -122,7 +122,7 @@ func (g *tsGenerator) generateModuleTemplates() error { } } - err = g.generateModuleTemplate(g.g.ctx, protocCmd, staCmd, tsprotoPluginPath, sourcePath, m, includes) + err = g.generateModuleTemplate(ctx, protocCmd, staCmd, tsprotoPluginPath, sourcePath, m, includes) if err != nil { return err } @@ -132,7 +132,7 @@ func (g *tsGenerator) generateModuleTemplates() error { } } - add(g.g.appPath, g.g.appModules, g.g.appIncludes) + add(g.g.appPath, g.g.appModules, g.g.appIncludes.Paths) // Always generate third party modules; This is required because not generating them might // lead to issues with the module registration in the root template. The root template must @@ -140,8 +140,9 @@ func (g *tsGenerator) generateModuleTemplates() error { // is available and not generated it would lead to the registration of a new not generated // 3rd party module. for sourcePath, modules := range g.g.thirdModules { - includes := g.g.thirdModuleIncludes[sourcePath] - add(sourcePath, modules, append(g.g.appIncludes, includes...)) + // TODO: Skip modules without proto files? + thirdIncludes := g.g.thirdModuleIncludes[sourcePath] + add(sourcePath, modules, append(g.g.appIncludes.Paths, thirdIncludes.Paths...)) } return gg.Wait() @@ -181,9 +182,7 @@ func (g *tsGenerator) generateModuleTemplate( specPath := filepath.Join(out, "api.swagger.yml") - err = g.g.generateModuleOpenAPISpec(m, specPath) - - if err != nil { + if err = g.g.generateModuleOpenAPISpec(ctx, m, specPath); err != nil { return err } // generate the REST client from the OpenAPI spec diff --git a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go index 05b4d1c61c..c6df9f83f8 100644 --- a/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go +++ b/ignite/pkg/cosmostxcollector/adapter/postgres/postgres_test.go @@ -110,7 +110,7 @@ func TestSave(t *testing.T) { Hash: h, Height: 1, Index: 0, - TxResult: abci.ResponseDeliverTx{ + TxResult: abci.ExecTxResult{ Events: []abci.Event{evt}, }, }, diff --git a/ignite/pkg/cosmostxcollector/mocks/saver.go b/ignite/pkg/cosmostxcollector/mocks/saver.go index 734e1f1c11..f468eb112f 100644 --- a/ignite/pkg/cosmostxcollector/mocks/saver.go +++ b/ignite/pkg/cosmostxcollector/mocks/saver.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.16.0. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -61,13 +61,17 @@ func (_c *Saver_Save_Call) Return(_a0 error) *Saver_Save_Call { return _c } -type mockConstructorTestingTNewSaver interface { - mock.TestingT - Cleanup(func()) +func (_c *Saver_Save_Call) RunAndReturn(run func(context.Context, []cosmosclient.TX) error) *Saver_Save_Call { + _c.Call.Return(run) + return _c } // NewSaver creates a new instance of Saver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSaver(t mockConstructorTestingTNewSaver) *Saver { +// The first argument is typically a *testing.T value. +func NewSaver(t interface { + mock.TestingT + Cleanup(func()) +}) *Saver { mock := &Saver{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmostxcollector/mocks/txs_collector.go b/ignite/pkg/cosmostxcollector/mocks/txs_collector.go index a80ee11808..c1a71eafe4 100644 --- a/ignite/pkg/cosmostxcollector/mocks/txs_collector.go +++ b/ignite/pkg/cosmostxcollector/mocks/txs_collector.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.16.0. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks @@ -62,13 +62,17 @@ func (_c *TXsCollector_CollectTXs_Call) Return(_a0 error) *TXsCollector_CollectT return _c } -type mockConstructorTestingTNewTXsCollector interface { - mock.TestingT - Cleanup(func()) +func (_c *TXsCollector_CollectTXs_Call) RunAndReturn(run func(context.Context, int64, chan<- []cosmosclient.TX) error) *TXsCollector_CollectTXs_Call { + _c.Call.Return(run) + return _c } // NewTXsCollector creates a new instance of TXsCollector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewTXsCollector(t mockConstructorTestingTNewTXsCollector) *TXsCollector { +// The first argument is typically a *testing.T value. +func NewTXsCollector(t interface { + mock.TestingT + Cleanup(func()) +}) *TXsCollector { mock := &TXsCollector{} mock.Mock.Test(t) diff --git a/ignite/pkg/cosmosver/cosmosver.go b/ignite/pkg/cosmosver/cosmosver.go index d04585e6eb..211b153835 100644 --- a/ignite/pkg/cosmosver/cosmosver.go +++ b/ignite/pkg/cosmosver/cosmosver.go @@ -22,6 +22,7 @@ var ( StargateFortyFourVersion = newVersion("0.44.0-alpha") StargateFortyFiveThreeVersion = newVersion("0.45.3") StargateFortySevenTwoVersion = newVersion("0.47.2") + StargateFiftyVersion = newVersion("0.50.0") ) var ( diff --git a/ignite/pkg/goanalysis/goanalysis.go b/ignite/pkg/goanalysis/goanalysis.go index 89631f6d3d..96115824ce 100644 --- a/ignite/pkg/goanalysis/goanalysis.go +++ b/ignite/pkg/goanalysis/goanalysis.go @@ -197,6 +197,18 @@ func getCallExprName(expr ast.Expr) (string, error) { return x.String() + "." + sel.Sel.String(), nil } +// FindBlankImports find all blank imports ('_') into a file. +func FindBlankImports(node *ast.File) []string { + // Iterate through the import declarations and find the blank imports. + blankImports := make([]string, 0) + for _, imp := range node.Imports { + if imp.Name != nil && imp.Name.Name == "_" { + blankImports = append(blankImports, strings.ReplaceAll(imp.Path.Value, `"`, "")) + } + } + return blankImports +} + // FormatImports translate f.Imports into a map where name -> package. // Name is the alias if declared, or the last element of the package path. func FormatImports(f *ast.File) map[string]string { diff --git a/ignite/pkg/goanalysis/goanalysis_test.go b/ignite/pkg/goanalysis/goanalysis_test.go index 556ff7fde8..ecad20b1d2 100644 --- a/ignite/pkg/goanalysis/goanalysis_test.go +++ b/ignite/pkg/goanalysis/goanalysis_test.go @@ -238,6 +238,29 @@ func TestFuncVarExists(t *testing.T) { } } +func TestFindBlankImports(t *testing.T) { + tests := []struct { + name string + testfile string + want []string + }{ + { + name: "test a declaration inside a method success", + testfile: "testdata/varexist", + want: []string{"embed", "mvdan.cc/gofumpt"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + appPkg, _, err := xast.ParseFile(tt.testfile) + require.NoError(t, err) + + got := goanalysis.FindBlankImports(appPkg) + require.Equal(t, tt.want, got) + }) + } +} + func TestFormatImports(t *testing.T) { tests := []struct { name string diff --git a/ignite/pkg/goanalysis/testdata/varexist b/ignite/pkg/goanalysis/testdata/varexist index 03f9133497..dabaabdbb2 100644 --- a/ignite/pkg/goanalysis/testdata/varexist +++ b/ignite/pkg/goanalysis/testdata/varexist @@ -4,6 +4,9 @@ import ( "context" "errors" "path/filepath" + + _ "embed" + _ "mvdan.cc/gofumpt" ) const ( diff --git a/ignite/pkg/jsonfile/jsonfile_test.go b/ignite/pkg/jsonfile/jsonfile_test.go index da2e073c39..a1be81db34 100644 --- a/ignite/pkg/jsonfile/jsonfile_test.go +++ b/ignite/pkg/jsonfile/jsonfile_test.go @@ -11,6 +11,7 @@ import ( "reflect" "testing" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" "github.com/stretchr/testify/require" @@ -66,7 +67,7 @@ func TestJSONFile_Field(t *testing.T) { name: "get coins parameter", filepath: "testdata/jsonfile.json", key: "app_state.bank.balances.[0].coins", - want: sdk.Coins{sdk.NewCoin("stake", sdk.NewInt(95000000))}, + want: sdk.Coins{sdk.NewCoin("stake", math.NewInt(95000000))}, }, { name: "get custom parameter", @@ -115,7 +116,7 @@ func TestJSONFile_Field(t *testing.T) { } func TestJSONFile_Update(t *testing.T) { - coins := sdk.NewCoin("bar", sdk.NewInt(500)) + coins := sdk.NewCoin("bar", math.NewInt(500)) jsonCoins, err := json.Marshal(coins) require.NoError(t, err) diff --git a/ignite/pkg/multiformatname/multiformatname_test.go b/ignite/pkg/multiformatname/multiformatname_test.go index 15ca7b30fa..db708366e7 100644 --- a/ignite/pkg/multiformatname/multiformatname_test.go +++ b/ignite/pkg/multiformatname/multiformatname_test.go @@ -20,7 +20,7 @@ func TestNewMultiFormatName(t *testing.T) { {"foo_barFoobar", "fooBarFoobar", "FooBarFoobar", "foo-bar-foobar", "foo_bar_foobar", "foobarfoobar"}, {"foo_-_bar", "fooBar", "FooBar", "foo---bar", "foo___bar", "foobar"}, {"foo_-_Bar", "fooBar", "FooBar", "foo---bar", "foo___bar", "foobar"}, - {"fooBAR", "fooBAR", "FooBAR", "foo-bar", "foo_bar", "foobar"}, + {"fooBAR", "fooBar", "FooBar", "foo-bar", "foo_bar", "foobar"}, {"fooBar123", "fooBar123", "FooBar123", "foo-bar-123", "foo_bar_123", "foobar123"}, } diff --git a/ignite/pkg/protoanalysis/package.go b/ignite/pkg/protoanalysis/package.go index 3e139c164d..9beb7122cc 100644 --- a/ignite/pkg/protoanalysis/package.go +++ b/ignite/pkg/protoanalysis/package.go @@ -17,35 +17,27 @@ type ( // Package represents a proto pkg. Package struct { // Name of the proto pkg. - Name string + Name string `json:"name,omitempty"` // Path of the package in the fs. - Path string + Path string `json:"path,omitempty"` // Files is a list of .proto files in the package. - Files Files + Files Files `json:"files,omitempty"` // GoImportName is the go package name of proto package. - GoImportName string + GoImportName string `json:"go_import_name,omitempty"` // Messages is a list of proto messages defined in the package. - Messages []Message + Messages []Message `json:"messages,omitempty"` // Services is a list of RPC services. - Services []Service + Services []Service `json:"services,omitempty"` } ) var regexBetaVersion = regexp.MustCompile("^v[0-9]+(beta|alpha)[0-9]+") -func (p Packages) Files() Files { - var files []File - for _, pkg := range p { - files = append(files, pkg.Files...) - } - return files -} - // ModuleName retrieves the single module name of the package. func (p Package) ModuleName() (name string) { names := strings.Split(p.Name, ".") @@ -73,18 +65,28 @@ func (p Package) GoImportPath() string { return strings.Split(p.GoImportName, ";")[0] } +// Files retrieves the files from the package list. +func (p Packages) Files() Files { + var files []File + for _, pkg := range p { + files = append(files, pkg.Files...) + } + return files +} + type ( Files []File File struct { // Path of the file. - Path string + Path string `json:"path,omitempty"` - // Dependencies is a list of imported .proto files in this package. - Dependencies []string + // Dependencies is a list of imported proto packages. + Dependencies []string `json:"dependencies,omitempty"` } ) +// Paths retrieves the list of paths from the files. func (f Files) Paths() []string { var paths []string for _, ff := range f { @@ -97,57 +99,57 @@ type ( // Message represents a proto message. Message struct { // Name of the message. - Name string + Name string `json:"name,omitempty"` - // Path of the file where message is defined at. - Path string + // Path of the proto file where the message is defined. + Path string `json:"path,omitempty"` - // HighestFieldNumber is the highest field number among fields of the message - // This allows to determine new field number when writing to proto message - HighestFieldNumber int + // HighestFieldNumber is the highest field number among fields of the message. + // This allows to determine new field number when writing to proto message. + HighestFieldNumber int `json:"highest_field_number,omitempty"` - // Fields contains message's field names and types - Fields map[string]string + // Fields contains message's field names and types. + Fields map[string]string `json:"fields,omitempty"` } // Service is an RPC service. Service struct { // Name of the services. - Name string + Name string `json:"name,omitempty"` - // RPC is a list of RPC funcs of the service. - RPCFuncs []RPCFunc + // RPCFuncs is a list of RPC funcs of the service. + RPCFuncs []RPCFunc `json:"functions,omitempty"` } // RPCFunc is an RPC func. RPCFunc struct { // Name of the RPC func. - Name string + Name string `json:"name,omitempty"` // RequestType is the request type of RPC func. - RequestType string + RequestType string `json:"request_type,omitempty"` // ReturnsType is the response type of RPC func. - ReturnsType string + ReturnsType string `json:"return_type,omitempty"` // HTTPRules keeps info about http rules of an RPC func. // spec: // https://github.com/googleapis/googleapis/blob/master/google/api/http.proto. - HTTPRules []HTTPRule + HTTPRules []HTTPRule `json:"http_rules,omitempty"` // Paginated indicates that the RPC function is using pagination. - Paginated bool + Paginated bool `json:"paginated,omitempty"` } // HTTPRule keeps info about a configured http rule of an RPC func. HTTPRule struct { - // Params is a list of parameters defined in the http endpoint itself. - Params []string + // Params is a list of parameters defined in the HTTP endpoint itself. + Params []string `json:"params,omitempty"` // HasQuery indicates if there is a request query. - HasQuery bool + HasQuery bool `json:"has_query,omitempty"` // HasBody indicates if there is a request payload. - HasBody bool + HasBody bool `json:"has_body,omitempty"` } ) diff --git a/ignite/pkg/yaml/yaml_test.go b/ignite/pkg/yaml/yaml_test.go index 4b166dd445..21c7848b8d 100644 --- a/ignite/pkg/yaml/yaml_test.go +++ b/ignite/pkg/yaml/yaml_test.go @@ -50,7 +50,7 @@ func TestMarshal(t *testing.T) { }{ { name: "parse nil obj", - want: "null", + want: "null\n", }, { name: "parse map without byte slice", @@ -61,7 +61,8 @@ func TestMarshal(t *testing.T) { }, }, want: `field1: field1 -field2: field2`, +field2: field2 +`, }, { name: "parse map with byte slice", @@ -76,7 +77,8 @@ field2: field2`, }, }, want: `field1: field1 -field2: field2`, +field2: field2 +`, }, { name: "parse struct without byte slice", @@ -84,7 +86,8 @@ field2: field2`, obj: sParser, }, want: `field1: field1 -field2: field2`, +field2: field2 +`, }, { name: "parse struct with byte slice", @@ -102,7 +105,8 @@ field2: field1: field1 field2: field2 field3: field3 -field3: field3`, +field3: field3 +`, }, { name: "parse struct with byte slice and wrong path", @@ -132,7 +136,8 @@ field2: - 49 field2: field2 field3: field3 -field3: field3`, +field3: field3 +`, }, } for _, tt := range tests { diff --git a/ignite/services/chain/chain.go b/ignite/services/chain/chain.go index 2bc222ab57..4e8af01382 100644 --- a/ignite/services/chain/chain.go +++ b/ignite/services/chain/chain.go @@ -314,6 +314,11 @@ func (c *Chain) Home() (string, error) { return home, nil } +// AppPath returns the configured App's path. +func (c *Chain) AppPath() string { + return c.app.Path +} + // DefaultHome returns the blockchain node's default home dir when not specified in the app. func (c *Chain) DefaultHome() (string, error) { // check if home is defined in config diff --git a/ignite/services/chain/faucet.go b/ignite/services/chain/faucet.go index 1777780c1b..afaf89fd4a 100644 --- a/ignite/services/chain/faucet.go +++ b/ignite/services/chain/faucet.go @@ -6,11 +6,10 @@ import ( "os" "time" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" - sdkmath "cosmossdk.io/math" - chainconfig "github.com/ignite/cli/ignite/config/chain" chaincmdrunner "github.com/ignite/cli/ignite/pkg/chaincmd/runner" "github.com/ignite/cli/ignite/pkg/cosmosfaucet" @@ -82,6 +81,7 @@ func (c *Chain) Faucet(ctx context.Context) (cosmosfaucet.Faucet, error) { cosmosfaucet.Account(*conf.Faucet.Name, "", ""), cosmosfaucet.ChainID(id), cosmosfaucet.OpenAPI(apiAddress), + cosmosfaucet.Version(c.Version), } // parse coins to pass to the faucet as coins. diff --git a/ignite/services/chain/generate.go b/ignite/services/chain/generate.go index 2cfbf26efb..3660da12eb 100644 --- a/ignite/services/chain/generate.go +++ b/ignite/services/chain/generate.go @@ -16,8 +16,8 @@ import ( type generateOptions struct { useCache bool + isProtoVendorEnabled bool isGoEnabled bool - isPulsarEnabled bool isTSClientEnabled bool isComposablesEnabled bool isHooksEnabled bool @@ -39,13 +39,6 @@ func GenerateGo() GenerateTarget { } } -// GeneratePulsar enables generating proto based Go code needed for the chain's source code. -func GeneratePulsar() GenerateTarget { - return func(o *generateOptions) { - o.isPulsarEnabled = true - } -} - // GenerateTSClient enables generating proto based Typescript Client. // The path assigns the output path to use for the generated Typescript client // overriding the configured or default path. Path can be an empty string. @@ -95,6 +88,18 @@ func GenerateOpenAPI() GenerateTarget { } } +// GenerateProtoVendor enables `proto_vendor` folder generation. +// Proto vendor is generated from Go dependencies that contain proto files that +// are not included in the app's Buf config. +// Enabling proto vendoring might update Buf config with missing dependencies +// if a Go dependency contains proto files and a Buf config with a name that is +// not listed in the Buf dependencies. +func GenerateProtoVendor() GenerateTarget { + return func(o *generateOptions) { + o.isProtoVendorEnabled = true + } +} + // generateFromConfig makes code generation from proto files from the given config. func (c *Chain) generateFromConfig(ctx context.Context, cacheStorage cache.Storage, generateClients bool) error { conf, err := c.Config() @@ -157,6 +162,7 @@ func (c *Chain) Generate( c.ev.Send("Building proto...", events.ProgressUpdate()) options := []cosmosgen.Option{ + cosmosgen.CollectEvents(c.ev), cosmosgen.IncludeDirs(conf.Build.Proto.ThirdPartyPaths), } @@ -164,8 +170,8 @@ func (c *Chain) Generate( options = append(options, cosmosgen.WithGoGeneration()) } - if targetOptions.isPulsarEnabled { - options = append(options, cosmosgen.WithPulsarGeneration()) + if targetOptions.isProtoVendorEnabled { + options = append(options, cosmosgen.UpdateBufModule()) } var ( diff --git a/ignite/services/plugin/cache.go b/ignite/services/plugin/cache.go index a0832da6ce..bcdce5fa28 100644 --- a/ignite/services/plugin/cache.go +++ b/ignite/services/plugin/cache.go @@ -16,6 +16,9 @@ const ( cacheNamespace = "plugin.rpc.context" ) +// Caches configuration for shared plugin hosts. +// The cached configuration can be used to re-attach to running plugins. +// These type of plugins must have "shared_host: true" in their manifest. var storageCache *cache.Cache[hplugin.ReattachConfig] func init() { diff --git a/ignite/services/plugin/cache_test.go b/ignite/services/plugin/cache_test.go index c11ca8b033..44dbb9ec4e 100644 --- a/ignite/services/plugin/cache_test.go +++ b/ignite/services/plugin/cache_test.go @@ -14,7 +14,7 @@ func TestReadWriteConfigCache(t *testing.T) { unixFD, _ := net.ResolveUnixAddr("unix", "/var/folders/5k/sv4bxrs102n_6rr7430jc7j80000gn/T/plugin193424090") rc := hplugin.ReattachConfig{ - Protocol: hplugin.ProtocolNetRPC, + Protocol: hplugin.ProtocolGRPC, ProtocolVersion: hplugin.CoreProtocolVersion, Addr: unixFD, Pid: 24464, @@ -31,7 +31,7 @@ func TestReadWriteConfigCache(t *testing.T) { t.Run("Should error writing bad plugin config to cache", func(t *testing.T) { const path = "/path/to/awesome/plugin" rc := hplugin.ReattachConfig{ - Protocol: hplugin.ProtocolNetRPC, + Protocol: hplugin.ProtocolGRPC, ProtocolVersion: hplugin.CoreProtocolVersion, Addr: nil, Pid: 24464, @@ -44,7 +44,7 @@ func TestReadWriteConfigCache(t *testing.T) { t.Run("Should error with invalid plugin path", func(t *testing.T) { const path = "" rc := hplugin.ReattachConfig{ - Protocol: hplugin.ProtocolNetRPC, + Protocol: hplugin.ProtocolGRPC, ProtocolVersion: hplugin.CoreProtocolVersion, Addr: nil, Pid: 24464, @@ -61,7 +61,7 @@ func TestDeleteConfCache(t *testing.T) { unixFD, _ := net.ResolveUnixAddr("unix", "/var/folders/5k/sv4bxrs102n_6rr7430jc7j80000gn/T/plugin193424090") rc := hplugin.ReattachConfig{ - Protocol: hplugin.ProtocolNetRPC, + Protocol: hplugin.ProtocolGRPC, ProtocolVersion: hplugin.CoreProtocolVersion, Addr: unixFD, Pid: 24464, @@ -90,7 +90,7 @@ func TestCheckConfCache(t *testing.T) { unixFD, _ := net.ResolveUnixAddr("unix", "/var/folders/5k/sv4bxrs102n_6rr7430jc7j80000gn/T/plugin193424090") rc := hplugin.ReattachConfig{ - Protocol: hplugin.ProtocolNetRPC, + Protocol: hplugin.ProtocolGRPC, ProtocolVersion: hplugin.CoreProtocolVersion, Addr: unixFD, Pid: 24464, diff --git a/ignite/services/plugin/client_api.go b/ignite/services/plugin/client_api.go new file mode 100644 index 0000000000..6bfde13ccf --- /dev/null +++ b/ignite/services/plugin/client_api.go @@ -0,0 +1,47 @@ +package plugin + +import ( + "context" +) + +type Chainer interface { + // AppPath returns the configured App's path. + AppPath() string + + // ID returns the configured App's chain id. + ID() (string, error) + + // ConfigPath returns the path to the App's config file. + ConfigPath() string + + // RPCPublicAddress returns the configured App's rpc endpoint. + RPCPublicAddress() (string, error) +} + +// NewClientAPI creates a new app ClientAPI. +func NewClientAPI(c Chainer) ClientAPI { + return clientAPI{chain: c} +} + +type clientAPI struct { + chain Chainer +} + +func (api clientAPI) GetChainInfo(context.Context) (*ChainInfo, error) { + chainID, err := api.chain.ID() + if err != nil { + return nil, err + } + + rpc, err := api.chain.RPCPublicAddress() + if err != nil { + return nil, err + } + + return &ChainInfo{ + ChainId: chainID, + AppPath: api.chain.AppPath(), + ConfigPath: api.chain.ConfigPath(), + RpcAddress: rpc, + }, nil +} diff --git a/ignite/services/plugin/grpc/v1/client_api.pb.go b/ignite/services/plugin/grpc/v1/client_api.pb.go new file mode 100644 index 0000000000..95f1c0c403 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/client_api.pb.go @@ -0,0 +1,179 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: ignite/services/plugin/grpc/v1/client_api.proto + +package v1 + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ChainInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + AppPath string `protobuf:"bytes,2,opt,name=app_path,json=appPath,proto3" json:"app_path,omitempty"` + ConfigPath string `protobuf:"bytes,3,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"` + RpcAddress string `protobuf:"bytes,4,opt,name=rpc_address,json=rpcAddress,proto3" json:"rpc_address,omitempty"` +} + +func (x *ChainInfo) Reset() { + *x = ChainInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChainInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChainInfo) ProtoMessage() {} + +func (x *ChainInfo) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChainInfo.ProtoReflect.Descriptor instead. +func (*ChainInfo) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescGZIP(), []int{0} +} + +func (x *ChainInfo) GetChainId() string { + if x != nil { + return x.ChainId + } + return "" +} + +func (x *ChainInfo) GetAppPath() string { + if x != nil { + return x.AppPath + } + return "" +} + +func (x *ChainInfo) GetConfigPath() string { + if x != nil { + return x.ConfigPath + } + return "" +} + +func (x *ChainInfo) GetRpcAddress() string { + if x != nil { + return x.RpcAddress + } + return "" +} + +var File_ignite_services_plugin_grpc_v1_client_api_proto protoreflect.FileDescriptor + +var file_ignite_services_plugin_grpc_v1_client_api_proto_rawDesc = []byte{ + 0x0a, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, + 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x1e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, + 0x31, 0x22, 0x83, 0x01, 0x0a, 0x09, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, + 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, + 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x70, 0x63, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x70, 0x63, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x69, + 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescOnce sync.Once + file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescData = file_ignite_services_plugin_grpc_v1_client_api_proto_rawDesc +) + +func file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescGZIP() []byte { + file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescOnce.Do(func() { + file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescData) + }) + return file_ignite_services_plugin_grpc_v1_client_api_proto_rawDescData +} + +var file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ignite_services_plugin_grpc_v1_client_api_proto_goTypes = []interface{}{ + (*ChainInfo)(nil), // 0: ignite.services.plugin.grpc.v1.ChainInfo +} +var file_ignite_services_plugin_grpc_v1_client_api_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ignite_services_plugin_grpc_v1_client_api_proto_init() } +func file_ignite_services_plugin_grpc_v1_client_api_proto_init() { + if File_ignite_services_plugin_grpc_v1_client_api_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChainInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ignite_services_plugin_grpc_v1_client_api_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ignite_services_plugin_grpc_v1_client_api_proto_goTypes, + DependencyIndexes: file_ignite_services_plugin_grpc_v1_client_api_proto_depIdxs, + MessageInfos: file_ignite_services_plugin_grpc_v1_client_api_proto_msgTypes, + }.Build() + File_ignite_services_plugin_grpc_v1_client_api_proto = out.File + file_ignite_services_plugin_grpc_v1_client_api_proto_rawDesc = nil + file_ignite_services_plugin_grpc_v1_client_api_proto_goTypes = nil + file_ignite_services_plugin_grpc_v1_client_api_proto_depIdxs = nil +} diff --git a/ignite/services/plugin/grpc/v1/interface.pb.go b/ignite/services/plugin/grpc/v1/interface.pb.go new file mode 100644 index 0000000000..aa33de84fa --- /dev/null +++ b/ignite/services/plugin/grpc/v1/interface.pb.go @@ -0,0 +1,857 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: ignite/services/plugin/grpc/v1/interface.proto + +package v1 + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Type represents the flag type. +type Flag_Type int32 + +const ( + Flag_TYPE_FLAG_STRING_UNSPECIFIED Flag_Type = 0 + Flag_TYPE_FLAG_INT Flag_Type = 1 + Flag_TYPE_FLAG_UINT Flag_Type = 2 + Flag_TYPE_FLAG_INT64 Flag_Type = 3 + Flag_TYPE_FLAG_UINT64 Flag_Type = 4 + Flag_TYPE_FLAG_BOOL Flag_Type = 5 + Flag_TYPE_FLAG_STRING_SLICE Flag_Type = 6 +) + +// Enum value maps for Flag_Type. +var ( + Flag_Type_name = map[int32]string{ + 0: "TYPE_FLAG_STRING_UNSPECIFIED", + 1: "TYPE_FLAG_INT", + 2: "TYPE_FLAG_UINT", + 3: "TYPE_FLAG_INT64", + 4: "TYPE_FLAG_UINT64", + 5: "TYPE_FLAG_BOOL", + 6: "TYPE_FLAG_STRING_SLICE", + } + Flag_Type_value = map[string]int32{ + "TYPE_FLAG_STRING_UNSPECIFIED": 0, + "TYPE_FLAG_INT": 1, + "TYPE_FLAG_UINT": 2, + "TYPE_FLAG_INT64": 3, + "TYPE_FLAG_UINT64": 4, + "TYPE_FLAG_BOOL": 5, + "TYPE_FLAG_STRING_SLICE": 6, + } +) + +func (x Flag_Type) Enum() *Flag_Type { + p := new(Flag_Type) + *p = x + return p +} + +func (x Flag_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Flag_Type) Descriptor() protoreflect.EnumDescriptor { + return file_ignite_services_plugin_grpc_v1_interface_proto_enumTypes[0].Descriptor() +} + +func (Flag_Type) Type() protoreflect.EnumType { + return &file_ignite_services_plugin_grpc_v1_interface_proto_enumTypes[0] +} + +func (x Flag_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Flag_Type.Descriptor instead. +func (Flag_Type) EnumDescriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{4, 0} +} + +// ExecutedCommand represents a plugin command under execution. +type ExecutedCommand struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Use is the one-line usage message. + Use string `protobuf:"bytes,1,opt,name=use,proto3" json:"use,omitempty"` + // Path contains the command path, e.g. `ignite scaffold foo`. + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + // Args are the command arguments. + Args []string `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` + // Full list of args taken from the command line. + OsArgs []string `protobuf:"bytes,4,rep,name=os_args,json=osArgs,proto3" json:"os_args,omitempty"` + // With contains the plugin config parameters. + With map[string]string `protobuf:"bytes,5,rep,name=with,proto3" json:"with,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Flags holds the list of command flags. + Flags []*Flag `protobuf:"bytes,6,rep,name=flags,proto3" json:"flags,omitempty"` +} + +func (x *ExecutedCommand) Reset() { + *x = ExecutedCommand{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecutedCommand) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecutedCommand) ProtoMessage() {} + +func (x *ExecutedCommand) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecutedCommand.ProtoReflect.Descriptor instead. +func (*ExecutedCommand) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{0} +} + +func (x *ExecutedCommand) GetUse() string { + if x != nil { + return x.Use + } + return "" +} + +func (x *ExecutedCommand) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ExecutedCommand) GetArgs() []string { + if x != nil { + return x.Args + } + return nil +} + +func (x *ExecutedCommand) GetOsArgs() []string { + if x != nil { + return x.OsArgs + } + return nil +} + +func (x *ExecutedCommand) GetWith() map[string]string { + if x != nil { + return x.With + } + return nil +} + +func (x *ExecutedCommand) GetFlags() []*Flag { + if x != nil { + return x.Flags + } + return nil +} + +// ExecutedHook represents a plugin hook under execution. +type ExecutedHook struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Hook is a copy of the original Hook defined in the Manifest. + Hook *Hook `protobuf:"bytes,1,opt,name=hook,proto3" json:"hook,omitempty"` + // ExecutedCommand gives access to the command attached by the hook. + ExecutedCommand *ExecutedCommand `protobuf:"bytes,2,opt,name=executed_command,json=executedCommand,proto3" json:"executed_command,omitempty"` +} + +func (x *ExecutedHook) Reset() { + *x = ExecutedHook{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecutedHook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecutedHook) ProtoMessage() {} + +func (x *ExecutedHook) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecutedHook.ProtoReflect.Descriptor instead. +func (*ExecutedHook) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{1} +} + +func (x *ExecutedHook) GetHook() *Hook { + if x != nil { + return x.Hook + } + return nil +} + +func (x *ExecutedHook) GetExecutedCommand() *ExecutedCommand { + if x != nil { + return x.ExecutedCommand + } + return nil +} + +// Manifest represents the plugin behavior. +type Manifest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Plugin name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Commands contains the commands that will be added to the list of ignite commands. + // Each commands are independent, for nested commands use the inner Commands field. + SharedHost bool `protobuf:"varint,2,opt,name=shared_host,json=sharedHost,proto3" json:"shared_host,omitempty"` + // Hooks contains the hooks that will be attached to the existing ignite commands. + Commands []*Command `protobuf:"bytes,3,rep,name=commands,proto3" json:"commands,omitempty"` + // Enables sharing a single plugin server across all running instances of a plugin. + // Useful if a plugin adds or extends long running commands. + // + // Example: if a plugin defines a hook on `ignite chain serve`, a plugin server is + // instanciated when the command is run. Now if you want to interact with that instance + // from commands defined in that plugin, you need to enable shared host, or else the + // commands will just instantiate separate plugin servers. + // + // When enabled, all plugins of the same path loaded from the same configuration will + // attach it's RPC client to a an existing RPC server. + // + // If a plugin instance has no other running plugin servers, it will create one and it + // will be the host. + Hooks []*Hook `protobuf:"bytes,4,rep,name=hooks,proto3" json:"hooks,omitempty"` +} + +func (x *Manifest) Reset() { + *x = Manifest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Manifest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Manifest) ProtoMessage() {} + +func (x *Manifest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Manifest.ProtoReflect.Descriptor instead. +func (*Manifest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{2} +} + +func (x *Manifest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Manifest) GetSharedHost() bool { + if x != nil { + return x.SharedHost + } + return false +} + +func (x *Manifest) GetCommands() []*Command { + if x != nil { + return x.Commands + } + return nil +} + +func (x *Manifest) GetHooks() []*Hook { + if x != nil { + return x.Hooks + } + return nil +} + +// Command represents a plugin command. +type Command struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Use is the one-line usage message. + // + // Recommended syntax is as follow: + // + // [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. + // ... indicates that you can specify multiple values for the previous argument. + // | indicates mutually exclusive information. You can use the argument to the left of the separator or the + // argument to the right of the separator. You cannot use both arguments in a single use of the command. + // { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are + // optional, they are enclosed in brackets ([ ]). + // + // Example: add [-F file | -D dir]... [-f format] profile + Use string `protobuf:"bytes,1,opt,name=use,proto3" json:"use,omitempty"` + // Aliases is an array of aliases that can be used instead of the first word in Use. + Aliases []string `protobuf:"bytes,2,rep,name=aliases,proto3" json:"aliases,omitempty"` + // Short is the short description shown in the 'help' output. + Short string `protobuf:"bytes,3,opt,name=short,proto3" json:"short,omitempty"` + // Long is the long message shown in the 'help ' output. + Long string `protobuf:"bytes,4,opt,name=long,proto3" json:"long,omitempty"` + // Hidden defines, if this command is hidden and should NOT show up in the list of available commands. + Hidden bool `protobuf:"varint,5,opt,name=hidden,proto3" json:"hidden,omitempty"` + // Flags holds the list of command flags. + Flags []*Flag `protobuf:"bytes,6,rep,name=flags,proto3" json:"flags,omitempty"` + // Indicates where the command should be placed. + // For instance `ignite scaffold` will place the command at the `scaffold` command. + // An empty value is interpreted as `ignite` (==root). + PlaceCommandUnder string `protobuf:"bytes,7,opt,name=place_command_under,json=placeCommandUnder,proto3" json:"place_command_under,omitempty"` + // List of sub commands. + Commands []*Command `protobuf:"bytes,8,rep,name=commands,proto3" json:"commands,omitempty"` +} + +func (x *Command) Reset() { + *x = Command{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Command) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Command) ProtoMessage() {} + +func (x *Command) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Command.ProtoReflect.Descriptor instead. +func (*Command) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{3} +} + +func (x *Command) GetUse() string { + if x != nil { + return x.Use + } + return "" +} + +func (x *Command) GetAliases() []string { + if x != nil { + return x.Aliases + } + return nil +} + +func (x *Command) GetShort() string { + if x != nil { + return x.Short + } + return "" +} + +func (x *Command) GetLong() string { + if x != nil { + return x.Long + } + return "" +} + +func (x *Command) GetHidden() bool { + if x != nil { + return x.Hidden + } + return false +} + +func (x *Command) GetFlags() []*Flag { + if x != nil { + return x.Flags + } + return nil +} + +func (x *Command) GetPlaceCommandUnder() string { + if x != nil { + return x.PlaceCommandUnder + } + return "" +} + +func (x *Command) GetCommands() []*Command { + if x != nil { + return x.Commands + } + return nil +} + +// Flag represents of a command line flag. +type Flag struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name as it appears in the command line. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // One letter abbreviation of the flag. + Shorthand string `protobuf:"bytes,2,opt,name=shorthand,proto3" json:"shorthand,omitempty"` + // Help message. + Usage string `protobuf:"bytes,3,opt,name=usage,proto3" json:"usage,omitempty"` + // Default flag value. + DefaultValue string `protobuf:"bytes,4,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"` + // Flag type. + Type Flag_Type `protobuf:"varint,5,opt,name=type,proto3,enum=ignite.services.plugin.grpc.v1.Flag_Type" json:"type,omitempty"` + // Flag value. + Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + // Indicates wether or not the flag is propagated on children commands. + Persistent bool `protobuf:"varint,7,opt,name=persistent,proto3" json:"persistent,omitempty"` +} + +func (x *Flag) Reset() { + *x = Flag{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Flag) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Flag) ProtoMessage() {} + +func (x *Flag) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Flag.ProtoReflect.Descriptor instead. +func (*Flag) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{4} +} + +func (x *Flag) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Flag) GetShorthand() string { + if x != nil { + return x.Shorthand + } + return "" +} + +func (x *Flag) GetUsage() string { + if x != nil { + return x.Usage + } + return "" +} + +func (x *Flag) GetDefaultValue() string { + if x != nil { + return x.DefaultValue + } + return "" +} + +func (x *Flag) GetType() Flag_Type { + if x != nil { + return x.Type + } + return Flag_TYPE_FLAG_STRING_UNSPECIFIED +} + +func (x *Flag) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *Flag) GetPersistent() bool { + if x != nil { + return x.Persistent + } + return false +} + +// Hook represents a user defined action within a plugin. +type Hook struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identifies the hook for the client to invoke the correct hook. + // It must be unique. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Indicates the command where to register the hooks. + PlaceHookOn string `protobuf:"bytes,2,opt,name=place_hook_on,json=placeHookOn,proto3" json:"place_hook_on,omitempty"` +} + +func (x *Hook) Reset() { + *x = Hook{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Hook) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Hook) ProtoMessage() {} + +func (x *Hook) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Hook.ProtoReflect.Descriptor instead. +func (*Hook) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP(), []int{5} +} + +func (x *Hook) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Hook) GetPlaceHookOn() string { + if x != nil { + return x.PlaceHookOn + } + return "" +} + +var File_ignite_services_plugin_grpc_v1_interface_proto protoreflect.FileDescriptor + +var file_ignite_services_plugin_grpc_v1_interface_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, + 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x1e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, + 0x22, 0xa8, 0x02, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x17, + 0x0a, 0x07, 0x6f, 0x73, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x6f, 0x73, 0x41, 0x72, 0x67, 0x73, 0x12, 0x4d, 0x0a, 0x04, 0x77, 0x69, 0x74, 0x68, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x57, 0x69, 0x74, 0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x04, 0x77, 0x69, 0x74, 0x68, 0x12, 0x3a, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x67, 0x52, 0x05, 0x66, 0x6c, 0x61, + 0x67, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x57, 0x69, 0x74, 0x68, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa4, 0x01, 0x0a, 0x0c, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x38, 0x0a, 0x04, + 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x69, 0x67, 0x6e, + 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, + 0x52, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x5a, 0x0a, 0x10, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x52, 0x0f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x22, 0xc0, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x68, 0x6f, + 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, + 0x48, 0x6f, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, + 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x3a, 0x0a, 0x05, 0x68, 0x6f, 0x6f, + 0x6b, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, + 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x05, + 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x22, 0xa8, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x75, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x12, 0x14, 0x0a, + 0x05, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x68, + 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, + 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x12, + 0x3a, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, + 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, + 0x46, 0x6c, 0x61, 0x67, 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x70, + 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x75, 0x6e, 0x64, + 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x08, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x22, 0x95, 0x03, 0x0a, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x68, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x68, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, + 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0a, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xaa, 0x01, 0x0a, 0x04, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x1c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x41, + 0x47, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, + 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, + 0x4c, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x13, 0x0a, + 0x0f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x54, 0x36, 0x34, + 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x5f, + 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x05, 0x12, 0x1a, 0x0a, 0x16, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x41, 0x47, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, + 0x5f, 0x53, 0x4c, 0x49, 0x43, 0x45, 0x10, 0x06, 0x22, 0x3e, 0x0a, 0x04, 0x48, 0x6f, 0x6f, 0x6b, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x68, 0x6f, + 0x6f, 0x6b, 0x5f, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, + 0x63, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x4f, 0x6e, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, + 0x69, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ignite_services_plugin_grpc_v1_interface_proto_rawDescOnce sync.Once + file_ignite_services_plugin_grpc_v1_interface_proto_rawDescData = file_ignite_services_plugin_grpc_v1_interface_proto_rawDesc +) + +func file_ignite_services_plugin_grpc_v1_interface_proto_rawDescGZIP() []byte { + file_ignite_services_plugin_grpc_v1_interface_proto_rawDescOnce.Do(func() { + file_ignite_services_plugin_grpc_v1_interface_proto_rawDescData = protoimpl.X.CompressGZIP(file_ignite_services_plugin_grpc_v1_interface_proto_rawDescData) + }) + return file_ignite_services_plugin_grpc_v1_interface_proto_rawDescData +} + +var file_ignite_services_plugin_grpc_v1_interface_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_ignite_services_plugin_grpc_v1_interface_proto_goTypes = []interface{}{ + (Flag_Type)(0), // 0: ignite.services.plugin.grpc.v1.Flag.Type + (*ExecutedCommand)(nil), // 1: ignite.services.plugin.grpc.v1.ExecutedCommand + (*ExecutedHook)(nil), // 2: ignite.services.plugin.grpc.v1.ExecutedHook + (*Manifest)(nil), // 3: ignite.services.plugin.grpc.v1.Manifest + (*Command)(nil), // 4: ignite.services.plugin.grpc.v1.Command + (*Flag)(nil), // 5: ignite.services.plugin.grpc.v1.Flag + (*Hook)(nil), // 6: ignite.services.plugin.grpc.v1.Hook + nil, // 7: ignite.services.plugin.grpc.v1.ExecutedCommand.WithEntry +} +var file_ignite_services_plugin_grpc_v1_interface_proto_depIdxs = []int32{ + 7, // 0: ignite.services.plugin.grpc.v1.ExecutedCommand.with:type_name -> ignite.services.plugin.grpc.v1.ExecutedCommand.WithEntry + 5, // 1: ignite.services.plugin.grpc.v1.ExecutedCommand.flags:type_name -> ignite.services.plugin.grpc.v1.Flag + 6, // 2: ignite.services.plugin.grpc.v1.ExecutedHook.hook:type_name -> ignite.services.plugin.grpc.v1.Hook + 1, // 3: ignite.services.plugin.grpc.v1.ExecutedHook.executed_command:type_name -> ignite.services.plugin.grpc.v1.ExecutedCommand + 4, // 4: ignite.services.plugin.grpc.v1.Manifest.commands:type_name -> ignite.services.plugin.grpc.v1.Command + 6, // 5: ignite.services.plugin.grpc.v1.Manifest.hooks:type_name -> ignite.services.plugin.grpc.v1.Hook + 5, // 6: ignite.services.plugin.grpc.v1.Command.flags:type_name -> ignite.services.plugin.grpc.v1.Flag + 4, // 7: ignite.services.plugin.grpc.v1.Command.commands:type_name -> ignite.services.plugin.grpc.v1.Command + 0, // 8: ignite.services.plugin.grpc.v1.Flag.type:type_name -> ignite.services.plugin.grpc.v1.Flag.Type + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_ignite_services_plugin_grpc_v1_interface_proto_init() } +func file_ignite_services_plugin_grpc_v1_interface_proto_init() { + if File_ignite_services_plugin_grpc_v1_interface_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecutedCommand); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecutedHook); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Manifest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Command); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Flag); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Hook); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ignite_services_plugin_grpc_v1_interface_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ignite_services_plugin_grpc_v1_interface_proto_goTypes, + DependencyIndexes: file_ignite_services_plugin_grpc_v1_interface_proto_depIdxs, + EnumInfos: file_ignite_services_plugin_grpc_v1_interface_proto_enumTypes, + MessageInfos: file_ignite_services_plugin_grpc_v1_interface_proto_msgTypes, + }.Build() + File_ignite_services_plugin_grpc_v1_interface_proto = out.File + file_ignite_services_plugin_grpc_v1_interface_proto_rawDesc = nil + file_ignite_services_plugin_grpc_v1_interface_proto_goTypes = nil + file_ignite_services_plugin_grpc_v1_interface_proto_depIdxs = nil +} diff --git a/ignite/services/plugin/grpc/v1/interface_command.go b/ignite/services/plugin/grpc/v1/interface_command.go new file mode 100644 index 0000000000..c396c75146 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/interface_command.go @@ -0,0 +1,92 @@ +package v1 + +import ( + "strings" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" +) + +const igniteBinaryName = "ignite" + +// Path returns the absolute command path including the binary name as prefix. +func (c *Command) Path() string { + return ensureFullCommandPath(c.PlaceCommandUnder) +} + +// ToCobraCommand returns a new Cobra command that matches the current command. +func (c *Command) ToCobraCommand() (*cobra.Command, error) { + cmd := &cobra.Command{ + Use: c.Use, + Aliases: c.Aliases, + Short: c.Short, + Long: c.Long, + Hidden: c.Hidden, + } + + for _, f := range c.Flags { + var fs *pflag.FlagSet + if f.Persistent { + fs = cmd.PersistentFlags() + } else { + fs = cmd.Flags() + } + + if err := f.exportToFlagSet(fs); err != nil { + return nil, err + } + } + + return cmd, nil +} + +// ImportFlags imports flags from a Cobra command. +func (c *ExecutedCommand) ImportFlags(cmd *cobra.Command) { + c.Flags = extractCobraFlags(cmd) +} + +// NewFlags creates a new flags set initialized with the executed command's flags. +func (c *ExecutedCommand) NewFlags() (*pflag.FlagSet, error) { + fs := pflag.NewFlagSet(igniteBinaryName, pflag.ContinueOnError) + + for _, f := range c.Flags { + if f.Persistent { + continue + } + + if err := f.exportToFlagSet(fs); err != nil { + return nil, err + } + } + + return fs, nil +} + +// NewPersistentFlags creates a new flags set initialized with the executed command's persistent flags. +func (c *ExecutedCommand) NewPersistentFlags() (*pflag.FlagSet, error) { + fs := pflag.NewFlagSet(igniteBinaryName, pflag.ContinueOnError) + + for _, f := range c.Flags { + if !f.Persistent { + continue + } + + if err := f.exportToFlagSet(fs); err != nil { + return nil, err + } + } + + return fs, nil +} + +func ensureFullCommandPath(path string) string { + path = strings.TrimSpace(path) + if path == "" { + return igniteBinaryName + } + + if !strings.HasPrefix(path, igniteBinaryName) { + path = igniteBinaryName + " " + path + } + return path +} diff --git a/ignite/services/plugin/grpc/v1/interface_flag.go b/ignite/services/plugin/grpc/v1/interface_flag.go new file mode 100644 index 0000000000..c458315760 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/interface_flag.go @@ -0,0 +1,129 @@ +package v1 + +import ( + "fmt" + "strconv" + "strings" + + "github.com/spf13/pflag" +) + +const ( + cobraFlagTypeBool = "bool" + cobraFlagTypeInt = "int" + cobraFlagTypeInt64 = "int64" + cobraFlagTypeString = "string" + cobraFlagTypeStringSlice = "stringSlice" + cobraFlagTypeUint = "uint" + cobraFlagTypeUint64 = "uint64" +) + +var flagTypes = map[string]Flag_Type{ + cobraFlagTypeBool: Flag_TYPE_FLAG_BOOL, + cobraFlagTypeInt: Flag_TYPE_FLAG_INT, + cobraFlagTypeInt64: Flag_TYPE_FLAG_INT64, + cobraFlagTypeString: Flag_TYPE_FLAG_STRING_UNSPECIFIED, + cobraFlagTypeStringSlice: Flag_TYPE_FLAG_STRING_SLICE, + cobraFlagTypeUint: Flag_TYPE_FLAG_UINT, + cobraFlagTypeUint64: Flag_TYPE_FLAG_UINT64, +} + +func newDefaultFlagValueError(typeName, value string) error { + return fmt.Errorf("invalid default value for plugin command %s flag: %s", typeName, value) +} + +func (f *Flag) exportToFlagSet(fs *pflag.FlagSet) error { + switch f.Type { + case Flag_TYPE_FLAG_BOOL: + v, err := strconv.ParseBool(f.DefaultValue) + if err != nil { + return newDefaultFlagValueError(cobraFlagTypeBool, f.DefaultValue) + } + + fs.BoolP(f.Name, f.Shorthand, v, f.Usage) + fs.Set(f.Name, f.Value) + case Flag_TYPE_FLAG_INT: + v, err := strconv.Atoi(f.DefaultValue) + if err != nil { + return newDefaultFlagValueError(cobraFlagTypeInt, f.DefaultValue) + } + + fs.IntP(f.Name, f.Shorthand, v, f.Usage) + fs.Set(f.Name, f.Value) + case Flag_TYPE_FLAG_UINT: + v, err := strconv.ParseUint(f.DefaultValue, 10, 64) + if err != nil { + return newDefaultFlagValueError(cobraFlagTypeUint, f.DefaultValue) + } + + fs.UintP(f.Name, f.Shorthand, uint(v), f.Usage) + fs.Set(f.Name, f.Value) + case Flag_TYPE_FLAG_INT64: + v, err := strconv.ParseInt(f.DefaultValue, 10, 64) + if err != nil { + return newDefaultFlagValueError(cobraFlagTypeInt64, f.DefaultValue) + } + + fs.Int64P(f.Name, f.Shorthand, v, f.Usage) + fs.Set(f.Name, f.Value) + case Flag_TYPE_FLAG_UINT64: + v, err := strconv.ParseUint(f.DefaultValue, 10, 64) + if err != nil { + return newDefaultFlagValueError(cobraFlagTypeInt64, f.DefaultValue) + } + + fs.Uint64P(f.Name, f.Shorthand, v, f.Usage) + fs.Set(f.Name, f.Value) + case Flag_TYPE_FLAG_STRING_SLICE: + s := strings.Trim(f.DefaultValue, "[]") + fs.StringSliceP(f.Name, f.Shorthand, strings.Fields(s), f.Usage) + fs.Set(f.Name, strings.Trim(f.Value, "[]")) + case Flag_TYPE_FLAG_STRING_UNSPECIFIED: + fs.StringP(f.Name, f.Shorthand, f.DefaultValue, f.Usage) + fs.Set(f.Name, f.Value) + } + return nil +} + +type flagger interface { + Flags() *pflag.FlagSet + PersistentFlags() *pflag.FlagSet +} + +func extractCobraFlags(cmd flagger) []*Flag { + var flags []*Flag + + if cmd.Flags() != nil { + cmd.Flags().VisitAll(func(pf *pflag.Flag) { + // Skip persistent flags + if cmd.PersistentFlags().Lookup(pf.Name) != nil { + return + } + + flags = append(flags, &Flag{ + Name: pf.Name, + Shorthand: pf.Shorthand, + Usage: pf.Usage, + DefaultValue: pf.DefValue, + Value: pf.Value.String(), + Type: flagTypes[pf.Value.Type()], + }) + }) + } + + if cmd.PersistentFlags() != nil { + cmd.PersistentFlags().VisitAll(func(pf *pflag.Flag) { + flags = append(flags, &Flag{ + Name: pf.Name, + Shorthand: pf.Shorthand, + Usage: pf.Usage, + DefaultValue: pf.DefValue, + Value: pf.Value.String(), + Type: flagTypes[pf.Value.Type()], + Persistent: true, + }) + }) + } + + return flags +} diff --git a/ignite/services/plugin/grpc/v1/interface_hook.go b/ignite/services/plugin/grpc/v1/interface_hook.go new file mode 100644 index 0000000000..db5d02484a --- /dev/null +++ b/ignite/services/plugin/grpc/v1/interface_hook.go @@ -0,0 +1,6 @@ +package v1 + +// CommandPath returns the absolute command path including the binary name as prefix. +func (h *Hook) CommandPath() string { + return ensureFullCommandPath(h.PlaceHookOn) +} diff --git a/ignite/services/plugin/grpc/v1/interface_manifest.go b/ignite/services/plugin/grpc/v1/interface_manifest.go new file mode 100644 index 0000000000..1c67f579cf --- /dev/null +++ b/ignite/services/plugin/grpc/v1/interface_manifest.go @@ -0,0 +1,27 @@ +package v1 + +import "github.com/spf13/cobra" + +// ImportCobraCommand appends Cobra command definitions to the list of plugin commands. +// This method can be used in cases where a plugin defines the commands using Cobra. +func (m *Manifest) ImportCobraCommand(cmd *cobra.Command, placeCommandUnder string) { + m.Commands = append(m.Commands, convertCobraCommand(cmd, placeCommandUnder)) +} + +func convertCobraCommand(c *cobra.Command, placeCommandUnder string) *Command { + cmd := &Command{ + Use: c.Use, + Aliases: c.Aliases, + Short: c.Short, + Long: c.Long, + Hidden: c.Hidden, + PlaceCommandUnder: placeCommandUnder, + Flags: extractCobraFlags(c), + } + + for _, c := range c.Commands() { + cmd.Commands = append(cmd.Commands, convertCobraCommand(c, "")) + } + + return cmd +} diff --git a/ignite/services/plugin/grpc/v1/service.pb.go b/ignite/services/plugin/grpc/v1/service.pb.go new file mode 100644 index 0000000000..11f2012a59 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/service.pb.go @@ -0,0 +1,915 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: ignite/services/plugin/grpc/v1/service.proto + +package v1 + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ManifestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ManifestRequest) Reset() { + *x = ManifestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ManifestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManifestRequest) ProtoMessage() {} + +func (x *ManifestRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManifestRequest.ProtoReflect.Descriptor instead. +func (*ManifestRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{0} +} + +type ManifestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Manifest *Manifest `protobuf:"bytes,1,opt,name=manifest,proto3" json:"manifest,omitempty"` +} + +func (x *ManifestResponse) Reset() { + *x = ManifestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ManifestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManifestResponse) ProtoMessage() {} + +func (x *ManifestResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManifestResponse.ProtoReflect.Descriptor instead. +func (*ManifestResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ManifestResponse) GetManifest() *Manifest { + if x != nil { + return x.Manifest + } + return nil +} + +type ExecuteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cmd *ExecutedCommand `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` + ClientApi uint32 `protobuf:"varint,2,opt,name=client_api,json=clientApi,proto3" json:"client_api,omitempty"` +} + +func (x *ExecuteRequest) Reset() { + *x = ExecuteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteRequest) ProtoMessage() {} + +func (x *ExecuteRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteRequest.ProtoReflect.Descriptor instead. +func (*ExecuteRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ExecuteRequest) GetCmd() *ExecutedCommand { + if x != nil { + return x.Cmd + } + return nil +} + +func (x *ExecuteRequest) GetClientApi() uint32 { + if x != nil { + return x.ClientApi + } + return 0 +} + +type ExecuteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExecuteResponse) Reset() { + *x = ExecuteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteResponse) ProtoMessage() {} + +func (x *ExecuteResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteResponse.ProtoReflect.Descriptor instead. +func (*ExecuteResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{3} +} + +type ExecuteHookPreRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hook *ExecutedHook `protobuf:"bytes,1,opt,name=hook,proto3" json:"hook,omitempty"` + ClientApi uint32 `protobuf:"varint,2,opt,name=client_api,json=clientApi,proto3" json:"client_api,omitempty"` +} + +func (x *ExecuteHookPreRequest) Reset() { + *x = ExecuteHookPreRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookPreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookPreRequest) ProtoMessage() {} + +func (x *ExecuteHookPreRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookPreRequest.ProtoReflect.Descriptor instead. +func (*ExecuteHookPreRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{4} +} + +func (x *ExecuteHookPreRequest) GetHook() *ExecutedHook { + if x != nil { + return x.Hook + } + return nil +} + +func (x *ExecuteHookPreRequest) GetClientApi() uint32 { + if x != nil { + return x.ClientApi + } + return 0 +} + +type ExecuteHookPreResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExecuteHookPreResponse) Reset() { + *x = ExecuteHookPreResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookPreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookPreResponse) ProtoMessage() {} + +func (x *ExecuteHookPreResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookPreResponse.ProtoReflect.Descriptor instead. +func (*ExecuteHookPreResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{5} +} + +type ExecuteHookPostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hook *ExecutedHook `protobuf:"bytes,1,opt,name=hook,proto3" json:"hook,omitempty"` + ClientApi uint32 `protobuf:"varint,2,opt,name=client_api,json=clientApi,proto3" json:"client_api,omitempty"` +} + +func (x *ExecuteHookPostRequest) Reset() { + *x = ExecuteHookPostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookPostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookPostRequest) ProtoMessage() {} + +func (x *ExecuteHookPostRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookPostRequest.ProtoReflect.Descriptor instead. +func (*ExecuteHookPostRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{6} +} + +func (x *ExecuteHookPostRequest) GetHook() *ExecutedHook { + if x != nil { + return x.Hook + } + return nil +} + +func (x *ExecuteHookPostRequest) GetClientApi() uint32 { + if x != nil { + return x.ClientApi + } + return 0 +} + +type ExecuteHookPostResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExecuteHookPostResponse) Reset() { + *x = ExecuteHookPostResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookPostResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookPostResponse) ProtoMessage() {} + +func (x *ExecuteHookPostResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookPostResponse.ProtoReflect.Descriptor instead. +func (*ExecuteHookPostResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{7} +} + +type ExecuteHookCleanUpRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hook *ExecutedHook `protobuf:"bytes,1,opt,name=hook,proto3" json:"hook,omitempty"` + ClientApi uint32 `protobuf:"varint,2,opt,name=client_api,json=clientApi,proto3" json:"client_api,omitempty"` +} + +func (x *ExecuteHookCleanUpRequest) Reset() { + *x = ExecuteHookCleanUpRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookCleanUpRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookCleanUpRequest) ProtoMessage() {} + +func (x *ExecuteHookCleanUpRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookCleanUpRequest.ProtoReflect.Descriptor instead. +func (*ExecuteHookCleanUpRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{8} +} + +func (x *ExecuteHookCleanUpRequest) GetHook() *ExecutedHook { + if x != nil { + return x.Hook + } + return nil +} + +func (x *ExecuteHookCleanUpRequest) GetClientApi() uint32 { + if x != nil { + return x.ClientApi + } + return 0 +} + +type ExecuteHookCleanUpResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ExecuteHookCleanUpResponse) Reset() { + *x = ExecuteHookCleanUpResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExecuteHookCleanUpResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecuteHookCleanUpResponse) ProtoMessage() {} + +func (x *ExecuteHookCleanUpResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecuteHookCleanUpResponse.ProtoReflect.Descriptor instead. +func (*ExecuteHookCleanUpResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{9} +} + +type GetChainInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetChainInfoRequest) Reset() { + *x = GetChainInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetChainInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChainInfoRequest) ProtoMessage() {} + +func (x *GetChainInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChainInfoRequest.ProtoReflect.Descriptor instead. +func (*GetChainInfoRequest) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{10} +} + +type GetChainInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info,omitempty"` +} + +func (x *GetChainInfoResponse) Reset() { + *x = GetChainInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetChainInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetChainInfoResponse) ProtoMessage() {} + +func (x *GetChainInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetChainInfoResponse.ProtoReflect.Descriptor instead. +func (*GetChainInfoResponse) Descriptor() ([]byte, []int) { + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP(), []int{11} +} + +func (x *GetChainInfoResponse) GetChainInfo() *ChainInfo { + if x != nil { + return x.ChainInfo + } + return nil +} + +var File_ignite_services_plugin_grpc_v1_service_proto protoreflect.FileDescriptor + +var file_ignite_services_plugin_grpc_v1_service_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, + 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x1a, 0x2f, + 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x11, 0x0a, 0x0f, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x58, 0x0a, 0x10, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, + 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, + 0x73, 0x74, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x22, 0x72, 0x0a, 0x0e, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, + 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x69, 0x67, + 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x03, 0x63, 0x6d, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x69, + 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x78, 0x0a, 0x15, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, + 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x04, + 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x69, 0x67, 0x6e, + 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x64, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x1d, + 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x69, 0x22, 0x18, 0x0a, + 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x40, 0x0a, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, + 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x68, + 0x6f, 0x6f, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, + 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, + 0x70, 0x69, 0x22, 0x19, 0x0a, 0x17, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, + 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7c, 0x0a, + 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, + 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x68, 0x6f, + 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, + 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x65, 0x64, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x70, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x70, 0x69, 0x22, 0x1c, 0x0a, 0x1a, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x60, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x69, + 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x32, 0x81, 0x05, 0x0a, 0x10, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x08, 0x4d, 0x61, 0x6e, 0x69, 0x66, + 0x65, 0x73, 0x74, 0x12, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x65, 0x12, 0x2e, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2f, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, + 0x6b, 0x50, 0x72, 0x65, 0x12, 0x35, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, + 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x69, 0x67, + 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, + 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x36, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, + 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x37, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, + 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x50, 0x6f, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x12, 0x45, 0x78, 0x65, + 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, 0x70, 0x12, + 0x39, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, + 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, + 0x6e, 0x55, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3a, 0x2e, 0x69, 0x67, 0x6e, + 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x48, 0x6f, 0x6f, 0x6b, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x55, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8d, 0x01, 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x41, 0x50, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x79, 0x0a, 0x0c, 0x47, + 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x2e, 0x69, 0x67, + 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x34, 0x2e, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x63, 0x6c, 0x69, 0x2f, + 0x69, 0x67, 0x6e, 0x69, 0x74, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ignite_services_plugin_grpc_v1_service_proto_rawDescOnce sync.Once + file_ignite_services_plugin_grpc_v1_service_proto_rawDescData = file_ignite_services_plugin_grpc_v1_service_proto_rawDesc +) + +func file_ignite_services_plugin_grpc_v1_service_proto_rawDescGZIP() []byte { + file_ignite_services_plugin_grpc_v1_service_proto_rawDescOnce.Do(func() { + file_ignite_services_plugin_grpc_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_ignite_services_plugin_grpc_v1_service_proto_rawDescData) + }) + return file_ignite_services_plugin_grpc_v1_service_proto_rawDescData +} + +var file_ignite_services_plugin_grpc_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_ignite_services_plugin_grpc_v1_service_proto_goTypes = []interface{}{ + (*ManifestRequest)(nil), // 0: ignite.services.plugin.grpc.v1.ManifestRequest + (*ManifestResponse)(nil), // 1: ignite.services.plugin.grpc.v1.ManifestResponse + (*ExecuteRequest)(nil), // 2: ignite.services.plugin.grpc.v1.ExecuteRequest + (*ExecuteResponse)(nil), // 3: ignite.services.plugin.grpc.v1.ExecuteResponse + (*ExecuteHookPreRequest)(nil), // 4: ignite.services.plugin.grpc.v1.ExecuteHookPreRequest + (*ExecuteHookPreResponse)(nil), // 5: ignite.services.plugin.grpc.v1.ExecuteHookPreResponse + (*ExecuteHookPostRequest)(nil), // 6: ignite.services.plugin.grpc.v1.ExecuteHookPostRequest + (*ExecuteHookPostResponse)(nil), // 7: ignite.services.plugin.grpc.v1.ExecuteHookPostResponse + (*ExecuteHookCleanUpRequest)(nil), // 8: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest + (*ExecuteHookCleanUpResponse)(nil), // 9: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpResponse + (*GetChainInfoRequest)(nil), // 10: ignite.services.plugin.grpc.v1.GetChainInfoRequest + (*GetChainInfoResponse)(nil), // 11: ignite.services.plugin.grpc.v1.GetChainInfoResponse + (*Manifest)(nil), // 12: ignite.services.plugin.grpc.v1.Manifest + (*ExecutedCommand)(nil), // 13: ignite.services.plugin.grpc.v1.ExecutedCommand + (*ExecutedHook)(nil), // 14: ignite.services.plugin.grpc.v1.ExecutedHook + (*ChainInfo)(nil), // 15: ignite.services.plugin.grpc.v1.ChainInfo +} +var file_ignite_services_plugin_grpc_v1_service_proto_depIdxs = []int32{ + 12, // 0: ignite.services.plugin.grpc.v1.ManifestResponse.manifest:type_name -> ignite.services.plugin.grpc.v1.Manifest + 13, // 1: ignite.services.plugin.grpc.v1.ExecuteRequest.cmd:type_name -> ignite.services.plugin.grpc.v1.ExecutedCommand + 14, // 2: ignite.services.plugin.grpc.v1.ExecuteHookPreRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 14, // 3: ignite.services.plugin.grpc.v1.ExecuteHookPostRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 14, // 4: ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest.hook:type_name -> ignite.services.plugin.grpc.v1.ExecutedHook + 15, // 5: ignite.services.plugin.grpc.v1.GetChainInfoResponse.chain_info:type_name -> ignite.services.plugin.grpc.v1.ChainInfo + 0, // 6: ignite.services.plugin.grpc.v1.InterfaceService.Manifest:input_type -> ignite.services.plugin.grpc.v1.ManifestRequest + 2, // 7: ignite.services.plugin.grpc.v1.InterfaceService.Execute:input_type -> ignite.services.plugin.grpc.v1.ExecuteRequest + 4, // 8: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPre:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookPreRequest + 6, // 9: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPost:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookPostRequest + 8, // 10: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookCleanUp:input_type -> ignite.services.plugin.grpc.v1.ExecuteHookCleanUpRequest + 10, // 11: ignite.services.plugin.grpc.v1.ClientAPIService.GetChainInfo:input_type -> ignite.services.plugin.grpc.v1.GetChainInfoRequest + 1, // 12: ignite.services.plugin.grpc.v1.InterfaceService.Manifest:output_type -> ignite.services.plugin.grpc.v1.ManifestResponse + 3, // 13: ignite.services.plugin.grpc.v1.InterfaceService.Execute:output_type -> ignite.services.plugin.grpc.v1.ExecuteResponse + 5, // 14: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPre:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPreResponse + 7, // 15: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookPost:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookPostResponse + 9, // 16: ignite.services.plugin.grpc.v1.InterfaceService.ExecuteHookCleanUp:output_type -> ignite.services.plugin.grpc.v1.ExecuteHookCleanUpResponse + 11, // 17: ignite.services.plugin.grpc.v1.ClientAPIService.GetChainInfo:output_type -> ignite.services.plugin.grpc.v1.GetChainInfoResponse + 12, // [12:18] is the sub-list for method output_type + 6, // [6:12] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_ignite_services_plugin_grpc_v1_service_proto_init() } +func file_ignite_services_plugin_grpc_v1_service_proto_init() { + if File_ignite_services_plugin_grpc_v1_service_proto != nil { + return + } + file_ignite_services_plugin_grpc_v1_client_api_proto_init() + file_ignite_services_plugin_grpc_v1_interface_proto_init() + if !protoimpl.UnsafeEnabled { + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManifestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManifestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookPreRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookPreResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookPostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookPostResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookCleanUpRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExecuteHookCleanUpResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetChainInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ignite_services_plugin_grpc_v1_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetChainInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ignite_services_plugin_grpc_v1_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_ignite_services_plugin_grpc_v1_service_proto_goTypes, + DependencyIndexes: file_ignite_services_plugin_grpc_v1_service_proto_depIdxs, + MessageInfos: file_ignite_services_plugin_grpc_v1_service_proto_msgTypes, + }.Build() + File_ignite_services_plugin_grpc_v1_service_proto = out.File + file_ignite_services_plugin_grpc_v1_service_proto_rawDesc = nil + file_ignite_services_plugin_grpc_v1_service_proto_goTypes = nil + file_ignite_services_plugin_grpc_v1_service_proto_depIdxs = nil +} diff --git a/ignite/services/plugin/grpc/v1/service_grpc.pb.go b/ignite/services/plugin/grpc/v1/service_grpc.pb.go new file mode 100644 index 0000000000..759410d156 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/service_grpc.pb.go @@ -0,0 +1,384 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: ignite/services/plugin/grpc/v1/service.proto + +package v1 + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + InterfaceService_Manifest_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/Manifest" + InterfaceService_Execute_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/Execute" + InterfaceService_ExecuteHookPre_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/ExecuteHookPre" + InterfaceService_ExecuteHookPost_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/ExecuteHookPost" + InterfaceService_ExecuteHookCleanUp_FullMethodName = "/ignite.services.plugin.grpc.v1.InterfaceService/ExecuteHookCleanUp" +) + +// InterfaceServiceClient is the client API for InterfaceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type InterfaceServiceClient interface { + // Manifest declares the plugin's Command(s) and Hook(s). + Manifest(ctx context.Context, in *ManifestRequest, opts ...grpc.CallOption) (*ManifestResponse, error) + // Execute will be invoked by ignite when a plugin Command is executed. + // It is global for all commands declared in Manifest, if you have declared + // multiple commands, use cmd.Path to distinguish them. + Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) + // ExecuteHookPre is invoked by ignite when a command specified by the Hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookPre(ctx context.Context, in *ExecuteHookPreRequest, opts ...grpc.CallOption) (*ExecuteHookPreResponse, error) + // ExecuteHookPost is invoked by ignite when a command specified by the hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookPost(ctx context.Context, in *ExecuteHookPostRequest, opts ...grpc.CallOption) (*ExecuteHookPostResponse, error) + // ExecuteHookCleanUp is invoked by ignite when a command specified by the + // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of + // execution status of the command and hooks. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookCleanUp(ctx context.Context, in *ExecuteHookCleanUpRequest, opts ...grpc.CallOption) (*ExecuteHookCleanUpResponse, error) +} + +type interfaceServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewInterfaceServiceClient(cc grpc.ClientConnInterface) InterfaceServiceClient { + return &interfaceServiceClient{cc} +} + +func (c *interfaceServiceClient) Manifest(ctx context.Context, in *ManifestRequest, opts ...grpc.CallOption) (*ManifestResponse, error) { + out := new(ManifestResponse) + err := c.cc.Invoke(ctx, InterfaceService_Manifest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *interfaceServiceClient) Execute(ctx context.Context, in *ExecuteRequest, opts ...grpc.CallOption) (*ExecuteResponse, error) { + out := new(ExecuteResponse) + err := c.cc.Invoke(ctx, InterfaceService_Execute_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *interfaceServiceClient) ExecuteHookPre(ctx context.Context, in *ExecuteHookPreRequest, opts ...grpc.CallOption) (*ExecuteHookPreResponse, error) { + out := new(ExecuteHookPreResponse) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPre_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *interfaceServiceClient) ExecuteHookPost(ctx context.Context, in *ExecuteHookPostRequest, opts ...grpc.CallOption) (*ExecuteHookPostResponse, error) { + out := new(ExecuteHookPostResponse) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookPost_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *interfaceServiceClient) ExecuteHookCleanUp(ctx context.Context, in *ExecuteHookCleanUpRequest, opts ...grpc.CallOption) (*ExecuteHookCleanUpResponse, error) { + out := new(ExecuteHookCleanUpResponse) + err := c.cc.Invoke(ctx, InterfaceService_ExecuteHookCleanUp_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InterfaceServiceServer is the server API for InterfaceService service. +// All implementations must embed UnimplementedInterfaceServiceServer +// for forward compatibility +type InterfaceServiceServer interface { + // Manifest declares the plugin's Command(s) and Hook(s). + Manifest(context.Context, *ManifestRequest) (*ManifestResponse, error) + // Execute will be invoked by ignite when a plugin Command is executed. + // It is global for all commands declared in Manifest, if you have declared + // multiple commands, use cmd.Path to distinguish them. + Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) + // ExecuteHookPre is invoked by ignite when a command specified by the Hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookPre(context.Context, *ExecuteHookPreRequest) (*ExecuteHookPreResponse, error) + // ExecuteHookPost is invoked by ignite when a command specified by the hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookPost(context.Context, *ExecuteHookPostRequest) (*ExecuteHookPostResponse, error) + // ExecuteHookCleanUp is invoked by ignite when a command specified by the + // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of + // execution status of the command and hooks. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + ExecuteHookCleanUp(context.Context, *ExecuteHookCleanUpRequest) (*ExecuteHookCleanUpResponse, error) + mustEmbedUnimplementedInterfaceServiceServer() +} + +// UnimplementedInterfaceServiceServer must be embedded to have forward compatible implementations. +type UnimplementedInterfaceServiceServer struct { +} + +func (UnimplementedInterfaceServiceServer) Manifest(context.Context, *ManifestRequest) (*ManifestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Manifest not implemented") +} +func (UnimplementedInterfaceServiceServer) Execute(context.Context, *ExecuteRequest) (*ExecuteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented") +} +func (UnimplementedInterfaceServiceServer) ExecuteHookPre(context.Context, *ExecuteHookPreRequest) (*ExecuteHookPreResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteHookPre not implemented") +} +func (UnimplementedInterfaceServiceServer) ExecuteHookPost(context.Context, *ExecuteHookPostRequest) (*ExecuteHookPostResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteHookPost not implemented") +} +func (UnimplementedInterfaceServiceServer) ExecuteHookCleanUp(context.Context, *ExecuteHookCleanUpRequest) (*ExecuteHookCleanUpResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteHookCleanUp not implemented") +} +func (UnimplementedInterfaceServiceServer) mustEmbedUnimplementedInterfaceServiceServer() {} + +// UnsafeInterfaceServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to InterfaceServiceServer will +// result in compilation errors. +type UnsafeInterfaceServiceServer interface { + mustEmbedUnimplementedInterfaceServiceServer() +} + +func RegisterInterfaceServiceServer(s grpc.ServiceRegistrar, srv InterfaceServiceServer) { + s.RegisterService(&InterfaceService_ServiceDesc, srv) +} + +func _InterfaceService_Manifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ManifestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterfaceServiceServer).Manifest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InterfaceService_Manifest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterfaceServiceServer).Manifest(ctx, req.(*ManifestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InterfaceService_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterfaceServiceServer).Execute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InterfaceService_Execute_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterfaceServiceServer).Execute(ctx, req.(*ExecuteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InterfaceService_ExecuteHookPre_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteHookPreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterfaceServiceServer).ExecuteHookPre(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InterfaceService_ExecuteHookPre_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterfaceServiceServer).ExecuteHookPre(ctx, req.(*ExecuteHookPreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InterfaceService_ExecuteHookPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteHookPostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterfaceServiceServer).ExecuteHookPost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InterfaceService_ExecuteHookPost_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterfaceServiceServer).ExecuteHookPost(ctx, req.(*ExecuteHookPostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InterfaceService_ExecuteHookCleanUp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExecuteHookCleanUpRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InterfaceServiceServer).ExecuteHookCleanUp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InterfaceService_ExecuteHookCleanUp_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InterfaceServiceServer).ExecuteHookCleanUp(ctx, req.(*ExecuteHookCleanUpRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// InterfaceService_ServiceDesc is the grpc.ServiceDesc for InterfaceService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var InterfaceService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ignite.services.plugin.grpc.v1.InterfaceService", + HandlerType: (*InterfaceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Manifest", + Handler: _InterfaceService_Manifest_Handler, + }, + { + MethodName: "Execute", + Handler: _InterfaceService_Execute_Handler, + }, + { + MethodName: "ExecuteHookPre", + Handler: _InterfaceService_ExecuteHookPre_Handler, + }, + { + MethodName: "ExecuteHookPost", + Handler: _InterfaceService_ExecuteHookPost_Handler, + }, + { + MethodName: "ExecuteHookCleanUp", + Handler: _InterfaceService_ExecuteHookCleanUp_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ignite/services/plugin/grpc/v1/service.proto", +} + +const ( + ClientAPIService_GetChainInfo_FullMethodName = "/ignite.services.plugin.grpc.v1.ClientAPIService/GetChainInfo" +) + +// ClientAPIServiceClient is the client API for ClientAPIService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ClientAPIServiceClient interface { + // GetChainInfo returns basic chain info for the configured app + GetChainInfo(ctx context.Context, in *GetChainInfoRequest, opts ...grpc.CallOption) (*GetChainInfoResponse, error) +} + +type clientAPIServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewClientAPIServiceClient(cc grpc.ClientConnInterface) ClientAPIServiceClient { + return &clientAPIServiceClient{cc} +} + +func (c *clientAPIServiceClient) GetChainInfo(ctx context.Context, in *GetChainInfoRequest, opts ...grpc.CallOption) (*GetChainInfoResponse, error) { + out := new(GetChainInfoResponse) + err := c.cc.Invoke(ctx, ClientAPIService_GetChainInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ClientAPIServiceServer is the server API for ClientAPIService service. +// All implementations must embed UnimplementedClientAPIServiceServer +// for forward compatibility +type ClientAPIServiceServer interface { + // GetChainInfo returns basic chain info for the configured app + GetChainInfo(context.Context, *GetChainInfoRequest) (*GetChainInfoResponse, error) + mustEmbedUnimplementedClientAPIServiceServer() +} + +// UnimplementedClientAPIServiceServer must be embedded to have forward compatible implementations. +type UnimplementedClientAPIServiceServer struct { +} + +func (UnimplementedClientAPIServiceServer) GetChainInfo(context.Context, *GetChainInfoRequest) (*GetChainInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetChainInfo not implemented") +} +func (UnimplementedClientAPIServiceServer) mustEmbedUnimplementedClientAPIServiceServer() {} + +// UnsafeClientAPIServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ClientAPIServiceServer will +// result in compilation errors. +type UnsafeClientAPIServiceServer interface { + mustEmbedUnimplementedClientAPIServiceServer() +} + +func RegisterClientAPIServiceServer(s grpc.ServiceRegistrar, srv ClientAPIServiceServer) { + s.RegisterService(&ClientAPIService_ServiceDesc, srv) +} + +func _ClientAPIService_GetChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetChainInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClientAPIServiceServer).GetChainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ClientAPIService_GetChainInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClientAPIServiceServer).GetChainInfo(ctx, req.(*GetChainInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ClientAPIService_ServiceDesc is the grpc.ServiceDesc for ClientAPIService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ClientAPIService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ignite.services.plugin.grpc.v1.ClientAPIService", + HandlerType: (*ClientAPIServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetChainInfo", + Handler: _ClientAPIService_GetChainInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "ignite/services/plugin/grpc/v1/service.proto", +} diff --git a/ignite/services/plugin/grpc/v1/types_command_test.go b/ignite/services/plugin/grpc/v1/types_command_test.go new file mode 100644 index 0000000000..c74034e656 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/types_command_test.go @@ -0,0 +1,343 @@ +package v1_test + +import ( + "fmt" + "testing" + + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" +) + +func TestCommandToCobraCommand(t *testing.T) { + var ( + require = require.New(t) + assert = assert.New(t) + pcmd = v1.Command{ + Use: "new", + Aliases: []string{"n"}, + Short: "short", + Long: "long", + Hidden: true, + Flags: []*v1.Flag{ + { + Name: "bool", + Shorthand: "b", + DefaultValue: "true", + Value: "true", + Usage: "a bool", + Type: v1.Flag_TYPE_FLAG_BOOL, + }, + { + Name: "string", + DefaultValue: "hello", + Value: "hello", + Usage: "a string", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + Persistent: true, + }, + }, + Commands: []*v1.Command{ + { + Use: "sub", + Aliases: []string{"s"}, + Short: "sub short", + Long: "sub long", + }, + }, + } + ) + + cmd, err := pcmd.ToCobraCommand() + + require.NoError(err) + require.NotNil(cmd) + assert.Empty(cmd.Commands()) // subcommands aren't converted + assert.Equal(pcmd.Use, cmd.Use) + assert.Equal(pcmd.Short, cmd.Short) + assert.Equal(pcmd.Long, cmd.Long) + assert.Equal(pcmd.Aliases, cmd.Aliases) + assert.Equal(pcmd.Hidden, cmd.Hidden) + for _, f := range pcmd.Flags { + if f.Persistent { + assert.NotNil(cmd.PersistentFlags().Lookup(f.Name), "missing pflag %s", f.Name) + } else { + assert.NotNil(cmd.Flags().Lookup(f.Name), "missing flag %s", f.Name) + } + } +} + +func TestCommandPath(t *testing.T) { + cases := []struct { + name, wantPath string + cmd *v1.Command + }{ + { + name: "relative path", + cmd: &v1.Command{ + PlaceCommandUnder: "chain", + }, + wantPath: "ignite chain", + }, + { + name: "full path", + cmd: &v1.Command{ + PlaceCommandUnder: "ignite chain", + }, + wantPath: "ignite chain", + }, + { + name: "path with spaces", + cmd: &v1.Command{ + PlaceCommandUnder: " ignite scaffold ", + }, + wantPath: "ignite scaffold", + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + path := tc.cmd.Path() + require.Equal(t, tc.wantPath, path) + }) + } +} + +func TestExecutedCommandImportFlags(t *testing.T) { + // Arrange + execCmd := &v1.ExecutedCommand{} + wantFlags := []*v1.Flag{ + { + Name: "foo", + Shorthand: "f", + Usage: "foo usage", + DefaultValue: "bar", + Value: "baz", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + }, { + Name: "test", + Shorthand: "t", + Usage: "test usage", + DefaultValue: "1", + Value: "42", + Type: v1.Flag_TYPE_FLAG_INT, + Persistent: true, + }, + } + + cmd := cobra.Command{} + cmd.Flags().StringP("foo", "f", "bar", "foo usage") + cmd.PersistentFlags().IntP("test", "t", 1, "test usage") + cmd.ParseFlags([]string{"--foo", "baz", "--test", "42"}) + + // Act + execCmd.ImportFlags(&cmd) + + // Assert + require.Equal(t, wantFlags, execCmd.Flags) +} + +func TestExecutedCommandNewFlags(t *testing.T) { + // Arrange + execCmd := &v1.ExecutedCommand{ + Flags: []*v1.Flag{ + { + Name: "bool", + Shorthand: "b", + Usage: "bool usage", + DefaultValue: "false", + Type: v1.Flag_TYPE_FLAG_BOOL, + }, + { + Name: "int", + Shorthand: "i", + Usage: "int usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_INT, + }, + { + Name: "uint", + Shorthand: "u", + Usage: "uint usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_UINT, + }, + { + Name: "int64", + Shorthand: "j", + Usage: "int64 usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_INT64, + }, + { + Name: "uint64", + Shorthand: "k", + Usage: "uint64 usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_UINT64, + }, + { + Name: "string", + Shorthand: "s", + Usage: "string usage", + DefaultValue: "", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + }, + { + Name: "string-slice", + Shorthand: "l", + Usage: "string slice usage", + DefaultValue: "[]", + Type: v1.Flag_TYPE_FLAG_STRING_SLICE, + }, + { + Name: "persistent", + Persistent: true, + }, + }, + } + + wantFlags := make(map[string]pflag.Flag) + for _, f := range execCmd.Flags { + wantFlags[f.Name] = pflag.Flag{ + Name: f.Name, + Shorthand: f.Shorthand, + Usage: f.Usage, + DefValue: f.DefaultValue, + } + } + + var ( + flagCount int + + // Persistent flag should not be included + wantFlagCount = len(execCmd.Flags) - 1 + ) + + // Act + flags, err := execCmd.NewFlags() + + // Assert + require.NoError(t, err) + + flags.VisitAll(func(f *pflag.Flag) { + flag, ok := wantFlags[f.Name] + + require.True(t, ok, fmt.Sprintf("missing flag: %s", f.Name)) + require.Equal(t, flag.Name, f.Name) + require.Equal(t, flag.Shorthand, f.Shorthand) + require.Equal(t, flag.Usage, f.Usage) + require.Equal(t, flag.DefValue, f.DefValue) + + flagCount++ + }) + + require.Equal(t, wantFlagCount, flagCount) +} + +func TestExecutedCommandNewPersistentFlags(t *testing.T) { + // Arrange + execCmd := &v1.ExecutedCommand{ + Flags: []*v1.Flag{ + { + Name: "bool", + Shorthand: "b", + Usage: "bool usage", + DefaultValue: "false", + Type: v1.Flag_TYPE_FLAG_BOOL, + Persistent: true, + }, + { + Name: "int", + Shorthand: "i", + Usage: "int usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_INT, + Persistent: true, + }, + { + Name: "uint", + Shorthand: "u", + Usage: "uint usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_UINT, + Persistent: true, + }, + { + Name: "int64", + Shorthand: "j", + Usage: "int64 usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_INT64, + Persistent: true, + }, + { + Name: "uint64", + Shorthand: "k", + Usage: "uint64 usage", + DefaultValue: "0", + Type: v1.Flag_TYPE_FLAG_UINT64, + Persistent: true, + }, + { + Name: "string", + Shorthand: "s", + Usage: "string usage", + DefaultValue: "", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + Persistent: true, + }, + { + Name: "string-slice", + Shorthand: "l", + Usage: "string slice usage", + DefaultValue: "[]", + Type: v1.Flag_TYPE_FLAG_STRING_SLICE, + Persistent: true, + }, + { + Name: "non-persistent", + }, + }, + } + + wantFlags := make(map[string]pflag.Flag) + for _, f := range execCmd.Flags { + wantFlags[f.Name] = pflag.Flag{ + Name: f.Name, + Shorthand: f.Shorthand, + Usage: f.Usage, + DefValue: f.DefaultValue, + } + } + + var ( + flagCount int + + // Non persistent flag should not be included + wantFlagCount = len(execCmd.Flags) - 1 + ) + + // Act + flags, err := execCmd.NewPersistentFlags() + + // Assert + require.NoError(t, err) + + flags.VisitAll(func(f *pflag.Flag) { + flag, ok := wantFlags[f.Name] + + require.True(t, ok, fmt.Sprintf("missing flag: %s", f.Name)) + require.Equal(t, flag.Name, f.Name) + require.Equal(t, flag.Shorthand, f.Shorthand) + require.Equal(t, flag.Usage, f.Usage) + require.Equal(t, flag.DefValue, f.DefValue) + + flagCount++ + }) + + require.Equal(t, wantFlagCount, flagCount) +} diff --git a/ignite/services/plugin/grpc/v1/types_hook_test.go b/ignite/services/plugin/grpc/v1/types_hook_test.go new file mode 100644 index 0000000000..4fed09ed08 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/types_hook_test.go @@ -0,0 +1,45 @@ +package v1_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" +) + +func TestHookCommandPath(t *testing.T) { + cases := []struct { + name, wantPath string + hook *v1.Hook + }{ + { + name: "relative path", + hook: &v1.Hook{ + PlaceHookOn: "chain", + }, + wantPath: "ignite chain", + }, + { + name: "full path", + hook: &v1.Hook{ + PlaceHookOn: "ignite chain", + }, + wantPath: "ignite chain", + }, + { + name: "path with spaces", + hook: &v1.Hook{ + PlaceHookOn: " ignite scaffold ", + }, + wantPath: "ignite scaffold", + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + path := tc.hook.CommandPath() + require.Equal(t, tc.wantPath, path) + }) + } +} diff --git a/ignite/services/plugin/grpc/v1/types_manifest_test.go b/ignite/services/plugin/grpc/v1/types_manifest_test.go new file mode 100644 index 0000000000..73246d9c93 --- /dev/null +++ b/ignite/services/plugin/grpc/v1/types_manifest_test.go @@ -0,0 +1,110 @@ +package v1_test + +import ( + "testing" + + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" +) + +func TestManifestImportCobraCommand(t *testing.T) { + manifest := &v1.Manifest{ + Name: "hey", + Commands: []*v1.Command{ + {Use: "existing"}, + }, + } + cmd := &cobra.Command{ + Use: "new", + Aliases: []string{"n"}, + Short: "short", + Long: "long", + Hidden: true, + } + cmd.Flags().BoolP("bool", "b", true, "a bool") + cmd.Flags().String("string", "hello", "a string") + cmd.PersistentFlags().String("persistent", "hello", "a persistent string") + subcmd := &cobra.Command{ + Use: "sub", + Aliases: []string{"s"}, + Short: "sub short", + Long: "sub long", + } + subcmd.Flags().BoolP("subbool", "b", true, "a bool") + subcmd.Flags().String("substring", "hello", "a string") + subcmd.AddCommand(&cobra.Command{ + Use: "subsub", + }) + cmd.AddCommand(subcmd) + + manifest.ImportCobraCommand(cmd, "under") + + expectedManifest := &v1.Manifest{ + Name: "hey", + Commands: []*v1.Command{ + {Use: "existing"}, + { + Use: "new", + Aliases: []string{"n"}, + Short: "short", + Long: "long", + Hidden: true, + PlaceCommandUnder: "under", + Flags: []*v1.Flag{ + { + Name: "bool", + Shorthand: "b", + DefaultValue: "true", + Value: "true", + Usage: "a bool", + Type: v1.Flag_TYPE_FLAG_BOOL, + }, + { + Name: "string", + DefaultValue: "hello", + Value: "hello", + Usage: "a string", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + }, + { + Name: "persistent", + DefaultValue: "hello", + Value: "hello", + Usage: "a persistent string", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + Persistent: true, + }, + }, + Commands: []*v1.Command{ + { + Use: "sub", + Aliases: []string{"s"}, + Short: "sub short", + Long: "sub long", + Flags: []*v1.Flag{ + { + Name: "subbool", + Shorthand: "b", + DefaultValue: "true", + Value: "true", + Usage: "a bool", + Type: v1.Flag_TYPE_FLAG_BOOL, + }, + { + Name: "substring", + DefaultValue: "hello", + Value: "hello", + Usage: "a string", + Type: v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED, + }, + }, + Commands: []*v1.Command{{Use: "subsub"}}, + }, + }, + }, + }, + } + assert.Equal(t, expectedManifest, manifest) +} diff --git a/ignite/services/plugin/interface.go b/ignite/services/plugin/interface.go index 9a735d1fad..9eb44b008c 100644 --- a/ignite/services/plugin/interface.go +++ b/ignite/services/plugin/interface.go @@ -1,481 +1,74 @@ package plugin import ( - "bytes" - "encoding/gob" - "fmt" - "net/rpc" - "os" - "strconv" - "strings" + "context" - "github.com/hashicorp/go-plugin" - "github.com/spf13/cobra" - "github.com/spf13/pflag" + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" ) -func init() { - gob.Register(Manifest{}) - gob.Register(ExecutedCommand{}) - gob.Register(ExecutedHook{}) -} +// Flag type aliases. +const ( + FlagTypeString = v1.Flag_TYPE_FLAG_STRING_UNSPECIFIED + FlagTypeInt = v1.Flag_TYPE_FLAG_INT + FlagTypeUint = v1.Flag_TYPE_FLAG_UINT + FlagTypeInt64 = v1.Flag_TYPE_FLAG_INT64 + FlagTypeUint64 = v1.Flag_TYPE_FLAG_UINT64 + FlagTypeBool = v1.Flag_TYPE_FLAG_BOOL + FlagTypeStringSlice = v1.Flag_TYPE_FLAG_STRING_SLICE +) + +// Type aliases for the current plugin version. +type ( + Command = v1.Command + ChainInfo = v1.ChainInfo + ExecutedCommand = v1.ExecutedCommand + ExecutedHook = v1.ExecutedHook + Flag = v1.Flag + FlagType = v1.Flag_Type + Hook = v1.Hook + Manifest = v1.Manifest +) // Interface defines the interface that all Ignite App must implement. // //go:generate mockery --srcpkg . --name Interface --structname PluginInterface --filename interface.go --with-expecter type Interface interface { // Manifest declares the app's Command(s) and Hook(s). - Manifest() (Manifest, error) + Manifest(context.Context) (*Manifest, error) // Execute will be invoked by ignite when an app Command is executed. // It is global for all commands declared in Manifest, if you have declared // multiple commands, use cmd.Path to distinguish them. - Execute(cmd ExecutedCommand) error + // The clientAPI argument can be used by plugins to get chain app analysis info. + Execute(context.Context, *ExecutedCommand, ClientAPI) error // ExecuteHookPre is invoked by ignite when a command specified by the Hook // path is invoked. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookPre(hook ExecutedHook) error + // The clientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookPre(context.Context, *ExecutedHook, ClientAPI) error // ExecuteHookPost is invoked by ignite when a command specified by the hook // path is invoked. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookPost(hook ExecutedHook) error + // The clientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookPost(context.Context, *ExecutedHook, ClientAPI) error // ExecuteHookCleanUp is invoked by ignite when a command specified by the // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of // execution status of the command and hooks. // It is global for all hooks declared in Manifest, if you have declared // multiple hooks, use hook.Name to distinguish them. - ExecuteHookCleanUp(hook ExecutedHook) error -} - -// Manifest represents the Ignite App behavior. -type Manifest struct { - Name string - - // Commands contains the commands that will be added to the list of ignite - // commands. Each commands are independent, for nested commands use the - // inner Commands field. - Commands []Command - - // Hooks contains the hooks that will be attached to the existing ignite - // commands. - Hooks []Hook - - // SharedHost enables sharing a single app server across all running instances - // of an app. Useful if an app adds or extends long running commands - // - // Example: if an app defines a hook on `ignite chain serve`, a server is instanciated - // when the command is run. Now if you want to interact with that instance from commands - // defined in that app, you need to enable `SharedHost`, or else the commands will just - // instantiate separate app servers. - // - // When enabled, all apps of the same `Path` loaded from the same configuration will - // attach it's RPC client to a an existing RPC server. - // - // If an app instance has no other running app servers, it will create one and it - // will be the host. - SharedHost bool `yaml:"shared_host"` -} - -// ImportCobraCommand allows to hydrate m with a standard root cobra commands. -func (m *Manifest) ImportCobraCommand(c *cobra.Command, placeCommandUnder string) { - m.Commands = append(m.Commands, convertCobraCommand(c, placeCommandUnder)) -} - -func convertCobraCommand(c *cobra.Command, placeCommandUnder string) Command { - cmd := Command{ - Use: c.Use, - Aliases: c.Aliases, - Short: c.Short, - Long: c.Long, - Hidden: c.Hidden, - PlaceCommandUnder: placeCommandUnder, - Flags: convertPFlags(c), - } - for _, c := range c.Commands() { - cmd.Commands = append(cmd.Commands, convertCobraCommand(c, "")) - } - return cmd + // The clientAPI argument can be used by plugins to get chain app analysis info. + ExecuteHookCleanUp(context.Context, *ExecutedHook, ClientAPI) error } -// Command represents an app command. -type Command struct { - // Same as cobra.Command.Use - Use string - - // Same as cobra.Command.Aliases - Aliases []string - - // Same as cobra.Command.Short - Short string - - // Same as cobra.Command.Long - Long string - - // Same as cobra.Command.Hidden - Hidden bool - - // Flags holds the list of command flags - Flags []Flag - - // PlaceCommandUnder indicates where the command should be placed. - // For instance `ignite scaffold` will place the command at the - // `scaffold` command. - // An empty value is interpreted as `ignite` (==root). - PlaceCommandUnder string - - // List of sub commands - Commands []Command -} - -// PlaceCommandUnderFull returns a normalized p.PlaceCommandUnder, -// by adding the `ignite ` prefix if not present. -func (c Command) PlaceCommandUnderFull() string { - return commandFull(c.PlaceCommandUnder) -} - -func commandFull(cmdPath string) string { - const rootCmdName = "ignite" - if !strings.HasPrefix(cmdPath, rootCmdName) { - cmdPath = rootCmdName + " " + cmdPath - } - return strings.TrimSpace(cmdPath) -} - -// ToCobraCommand turns Command into a cobra.Command so it can be added to a parent command. -func (c Command) ToCobraCommand() (*cobra.Command, error) { - cmd := &cobra.Command{ - Use: c.Use, - Aliases: c.Aliases, - Short: c.Short, - Long: c.Long, - Hidden: c.Hidden, - } - for _, f := range c.Flags { - err := f.feedFlagSet(cmd) - if err != nil { - return nil, err - } - } - return cmd, nil -} - -// Hook represents a user defined action within an app. -type Hook struct { - // Name identifies the hook for the client to invoke the correct hook - // must be unique - Name string - - // PlaceHookOn indicates the command to register the hooks for - PlaceHookOn string -} - -// PlaceHookOnFull returns a normalized p.PlaceCommandUnder, by adding the -// `ignite ` prefix if not present. -func (h Hook) PlaceHookOnFull() string { - return commandFull(h.PlaceHookOn) -} - -// ExecutedCommand represents an app command under execution. -type ExecutedCommand struct { - // Use is copied from Command.Use - Use string - - // Path contains the command path, e.g. `ignite scaffold foo` - Path string - - // Args are the command arguments - Args []string - - // Full list of args taken from os.Args - OSArgs []string - - // With contains the app config parameters - With map[string]string - - flags *pflag.FlagSet - pflags *pflag.FlagSet -} - -// ExecutedHook represents an app hook under execution. -type ExecutedHook struct { - // ExecutedCommand gives access to the command attached by the hook. - ExecutedCommand ExecutedCommand - // Hook is a copy of the original Hook defined in the Manifest. - Hook -} - -// Flags gives access to the commands' flags, like cobra.Command.Flags. -func (c *ExecutedCommand) Flags() *pflag.FlagSet { - if c.flags == nil { - c.flags = pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError) - } - return c.flags -} - -// PersistentFlags gives access to the commands' persistent flags, like -// cobra.Command.PersistentFlags. -func (c *ExecutedCommand) PersistentFlags() *pflag.FlagSet { - if c.pflags == nil { - c.pflags = pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError) - } - return c.pflags -} - -// SetFlags set the flags. -// As an app developer, you probably don't need to use it. -func (c *ExecutedCommand) SetFlags(cmd *cobra.Command) { - c.flags = cmd.Flags() - c.pflags = cmd.PersistentFlags() -} - -// Flag is a serializable representation of pflag.Flag. -type Flag struct { - Name string // name as it appears on command line - Shorthand string // one-letter abbreviated flag - Usage string // help message - DefValue string // default value (as text); for usage message - Type FlagType - Value string - - // Persistent indicates wether or not the flag is propagated on children commands - Persistent bool -} - -// FlagType represents the pflag.Flag.Value.Type(). -type FlagType string - -const ( - // NOTE(tb): we declare only the main used cobra flag types for simplicity - // If an app receives an unhandled type, it will output an error. - FlagTypeString FlagType = "string" - FlagTypeInt FlagType = "int" - FlagTypeUint FlagType = "uint" - FlagTypeInt64 FlagType = "int64" - FlagTypeUint64 FlagType = "uint64" - FlagTypeBool FlagType = "bool" - FlagTypeStringSlice FlagType = "stringSlice" -) - -// feedFlagSet fills flagger with f. -func (f Flag) feedFlagSet(fgr flagger) error { - fs := fgr.Flags() - if f.Persistent { - fs = fgr.PersistentFlags() - } - switch f.Type { - case FlagTypeBool: - defVal, _ := strconv.ParseBool(f.DefValue) - fs.BoolP(f.Name, f.Shorthand, defVal, f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeInt: - defVal, _ := strconv.Atoi(f.DefValue) - fs.IntP(f.Name, f.Shorthand, defVal, f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeUint: - defVal, _ := strconv.ParseUint(f.DefValue, 10, 64) - fs.UintP(f.Name, f.Shorthand, uint(defVal), f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeInt64: - defVal, _ := strconv.ParseInt(f.DefValue, 10, 64) - fs.Int64P(f.Name, f.Shorthand, defVal, f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeUint64: - defVal, _ := strconv.ParseUint(f.DefValue, 10, 64) - fs.Uint64P(f.Name, f.Shorthand, defVal, f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeString: - fs.StringP(f.Name, f.Shorthand, f.DefValue, f.Usage) - _ = fs.Set(f.Name, f.Value) - case FlagTypeStringSlice: - s := strings.Trim(f.DefValue, "[]") - defValue := strings.Fields(s) - fs.StringSliceP(f.Name, f.Shorthand, defValue, f.Usage) - _ = fs.Set(f.Name, strings.Trim(f.Value, "[]")) - default: - return fmt.Errorf("flagset unmarshal: unhandled flag type %q in flag %#v", f.Type, f) - } - return nil -} - -// gobCommandFlags is used to gob encode/decode Command. -// Command can't be encoded because : -// - flags is unexported (because we want to expose it via the Flags() method, -// like a regular cobra.Command) -// - flags type is *pflag.FlagSet which is also full of unexported fields. -type gobCommandContextFlags struct { - CommandContext gobCommandContext - Flags []Flag -} - -// gobCommandContext is the same as ExecutedCommand but without GobDecode -// attached, which avoids infinite loops. -type gobCommandContext ExecutedCommand - -// GobEncode implements gob.Encoder. -// It actually encodes a gobCommandContext struct built from c. -func (c ExecutedCommand) GobEncode() ([]byte, error) { - var b bytes.Buffer - err := gob.NewEncoder(&b).Encode(gobCommandContextFlags{ - CommandContext: gobCommandContext(c), - Flags: convertPFlags(&c), - }) - return b.Bytes(), err -} - -// flagger matches both cobra.Command and Command. -type flagger interface { - Flags() *pflag.FlagSet - PersistentFlags() *pflag.FlagSet -} - -func convertPFlags(fgr flagger) []Flag { - var ff []Flag - if fgr.Flags() != nil { - fgr.Flags().VisitAll(func(pf *pflag.Flag) { - ff = append(ff, Flag{ - Name: pf.Name, - Shorthand: pf.Shorthand, - Usage: pf.Usage, - DefValue: pf.DefValue, - Value: pf.Value.String(), - Type: FlagType(pf.Value.Type()), - }) - }) - } - if fgr.PersistentFlags() != nil { - fgr.PersistentFlags().VisitAll(func(pf *pflag.Flag) { - ff = append(ff, Flag{ - Name: pf.Name, - Shorthand: pf.Shorthand, - Usage: pf.Usage, - DefValue: pf.DefValue, - Value: pf.Value.String(), - Type: FlagType(pf.Value.Type()), - Persistent: true, - }) - }) - } - return ff -} - -// GobDecode implements gob.Decoder. -// It actually decodes a gobCommandContext struct and fills c with it. -func (c *ExecutedCommand) GobDecode(bz []byte) error { - var gb gobCommandContextFlags - err := gob.NewDecoder(bytes.NewReader(bz)).Decode(&gb) - if err != nil { - return err - } - *c = ExecutedCommand(gb.CommandContext) - for _, f := range gb.Flags { - err := f.feedFlagSet(c) - if err != nil { - return err - } - } - return nil -} - -// handshakeConfigs are used to just do a basic handshake between -// an app and host. If the handshake fails, a user friendly error is shown. -// This prevents users from executing bad apps or executing an app -// directory. It is a UX feature, not a security feature. -var handshakeConfig = plugin.HandshakeConfig{ - ProtocolVersion: 1, - MagicCookieKey: "BASIC_PLUGIN", - MagicCookieValue: "hello", -} - -func HandshakeConfig() plugin.HandshakeConfig { - return handshakeConfig -} - -// InterfaceRPC is an implementation that talks over RPC. -type InterfaceRPC struct{ client *rpc.Client } - -// Manifest implements Interface.Manifest. -func (g *InterfaceRPC) Manifest() (Manifest, error) { - var resp Manifest - return resp, g.client.Call("Plugin.Manifest", new(interface{}), &resp) -} - -// Execute implements Interface.Commands. -func (g *InterfaceRPC) Execute(c ExecutedCommand) error { - var resp interface{} - return g.client.Call("Plugin.Execute", map[string]interface{}{ - "executedCommand": c, - }, &resp) -} - -func (g *InterfaceRPC) ExecuteHookPre(hook ExecutedHook) error { - var resp interface{} - return g.client.Call("Plugin.ExecuteHookPre", map[string]interface{}{ - "executedHook": hook, - }, &resp) -} - -func (g *InterfaceRPC) ExecuteHookPost(hook ExecutedHook) error { - var resp interface{} - return g.client.Call("Plugin.ExecuteHookPost", map[string]interface{}{ - "executedHook": hook, - }, &resp) -} - -func (g *InterfaceRPC) ExecuteHookCleanUp(hook ExecutedHook) error { - var resp interface{} - return g.client.Call("Plugin.ExecuteHookCleanUp", map[string]interface{}{ - "executedHook": hook, - }, &resp) -} - -// InterfaceRPCServer is the RPC server that InterfaceRPC talks to, conforming to -// the requirements of net/rpc. -type InterfaceRPCServer struct { - Impl Interface -} - -func (s *InterfaceRPCServer) Manifest(_ interface{}, resp *Manifest) error { - var err error - *resp, err = s.Impl.Manifest() - return err -} - -func (s *InterfaceRPCServer) Execute(args map[string]interface{}, _ *interface{}) error { - return s.Impl.Execute(args["executedCommand"].(ExecutedCommand)) -} - -func (s *InterfaceRPCServer) ExecuteHookPre(args map[string]interface{}, _ *interface{}) error { - return s.Impl.ExecuteHookPre(args["executedHook"].(ExecutedHook)) -} - -func (s *InterfaceRPCServer) ExecuteHookPost(args map[string]interface{}, _ *interface{}) error { - return s.Impl.ExecuteHookPost(args["executedHook"].(ExecutedHook)) -} - -func (s *InterfaceRPCServer) ExecuteHookCleanUp(args map[string]interface{}, _ *interface{}) error { - return s.Impl.ExecuteHookCleanUp(args["executedHook"].(ExecutedHook)) -} - -// InterfacePlugin is the implementation of Interface. -// -// This has two methods: Server must return an RPC server for this plugin -// type. We construct a InterfaceRPCServer for this. +// ClientAPI defines the interface for plugins to get chain app code analysis info. // -// Client must return an implementation of our interface that communicates -// over an RPC client. We return InterfaceRPC for this. -type InterfacePlugin struct { - Impl Interface -} - -func (p *InterfacePlugin) Server(*plugin.MuxBroker) (interface{}, error) { - return &InterfaceRPCServer{Impl: p.Impl}, nil -} - -func (InterfacePlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error) { - return &InterfaceRPC{client: c}, nil +//go:generate mockery --srcpkg . --name ClientAPI --structname PluginClientAPI --filename client_api.go --with-expecter +type ClientAPI interface { + // GetChainInfo returns basic info for the configured blockchain app. + GetChainInfo(context.Context) (*ChainInfo, error) } diff --git a/ignite/services/plugin/interface_test.go b/ignite/services/plugin/interface_test.go deleted file mode 100644 index f36fb9f89d..0000000000 --- a/ignite/services/plugin/interface_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package plugin_test - -import ( - "testing" - - "github.com/spf13/cobra" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/ignite/cli/ignite/services/plugin" -) - -func TestCommandToCobraCommand(t *testing.T) { - var ( - require = require.New(t) - assert = assert.New(t) - pcmd = plugin.Command{ - Use: "new", - Aliases: []string{"n"}, - Short: "short", - Long: "long", - Hidden: true, - Flags: []plugin.Flag{ - { - Name: "bool", - Shorthand: "b", - DefValue: "true", - Value: "true", - Usage: "a bool", - Type: plugin.FlagTypeBool, - }, - { - Name: "string", - DefValue: "hello", - Value: "hello", - Usage: "a string", - Type: plugin.FlagTypeString, - Persistent: true, - }, - }, - Commands: []plugin.Command{ - { - Use: "sub", - Aliases: []string{"s"}, - Short: "sub short", - Long: "sub long", - }, - }, - } - ) - - cmd, err := pcmd.ToCobraCommand() - - require.NoError(err) - require.NotNil(cmd) - assert.Empty(cmd.Commands()) // subcommands aren't converted - assert.Equal(pcmd.Use, cmd.Use) - assert.Equal(pcmd.Short, cmd.Short) - assert.Equal(pcmd.Long, cmd.Long) - assert.Equal(pcmd.Aliases, cmd.Aliases) - assert.Equal(pcmd.Hidden, cmd.Hidden) - for _, f := range pcmd.Flags { - if f.Persistent { - assert.NotNil(cmd.PersistentFlags().Lookup(f.Name), "missing pflag %s", f.Name) - } else { - assert.NotNil(cmd.Flags().Lookup(f.Name), "missing flag %s", f.Name) - } - } -} - -func TestManifestImportCobraCommand(t *testing.T) { - manifest := plugin.Manifest{ - Name: "hey", - Commands: []plugin.Command{ - {Use: "existing"}, - }, - } - cmd := &cobra.Command{ - Use: "new", - Aliases: []string{"n"}, - Short: "short", - Long: "long", - Hidden: true, - } - cmd.Flags().BoolP("bool", "b", true, "a bool") - cmd.Flags().String("string", "hello", "a string") - cmd.PersistentFlags().String("persistent", "hello", "a persistent string") - subcmd := &cobra.Command{ - Use: "sub", - Aliases: []string{"s"}, - Short: "sub short", - Long: "sub long", - } - subcmd.Flags().BoolP("subbool", "b", true, "a bool") - subcmd.Flags().String("substring", "hello", "a string") - subcmd.AddCommand(&cobra.Command{ - Use: "subsub", - }) - cmd.AddCommand(subcmd) - - manifest.ImportCobraCommand(cmd, "under") - - expectedManifest := plugin.Manifest{ - Name: "hey", - Commands: []plugin.Command{ - {Use: "existing"}, - { - Use: "new", - Aliases: []string{"n"}, - Short: "short", - Long: "long", - Hidden: true, - PlaceCommandUnder: "under", - Flags: []plugin.Flag{ - { - Name: "bool", - Shorthand: "b", - DefValue: "true", - Value: "true", - Usage: "a bool", - Type: plugin.FlagTypeBool, - }, - { - Name: "string", - DefValue: "hello", - Value: "hello", - Usage: "a string", - Type: plugin.FlagTypeString, - }, - { - Name: "persistent", - DefValue: "hello", - Value: "hello", - Usage: "a persistent string", - Type: plugin.FlagTypeString, - Persistent: true, - }, - }, - Commands: []plugin.Command{ - { - Use: "sub", - Aliases: []string{"s"}, - Short: "sub short", - Long: "sub long", - Flags: []plugin.Flag{ - { - Name: "subbool", - Shorthand: "b", - DefValue: "true", - Value: "true", - Usage: "a bool", - Type: plugin.FlagTypeBool, - }, - { - Name: "substring", - DefValue: "hello", - Value: "hello", - Usage: "a string", - Type: plugin.FlagTypeString, - }, - }, - Commands: []plugin.Command{{Use: "subsub"}}, - }, - }, - }, - }, - } - assert.Equal(t, expectedManifest, manifest) -} diff --git a/ignite/services/plugin/mocks/client_api.go b/ignite/services/plugin/mocks/client_api.go new file mode 100644 index 0000000000..74ea82911d --- /dev/null +++ b/ignite/services/plugin/mocks/client_api.go @@ -0,0 +1,92 @@ +// Code generated by mockery v2.36.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" +) + +// PluginClientAPI is an autogenerated mock type for the ClientAPI type +type PluginClientAPI struct { + mock.Mock +} + +type PluginClientAPI_Expecter struct { + mock *mock.Mock +} + +func (_m *PluginClientAPI) EXPECT() *PluginClientAPI_Expecter { + return &PluginClientAPI_Expecter{mock: &_m.Mock} +} + +// GetChainInfo provides a mock function with given fields: _a0 +func (_m *PluginClientAPI) GetChainInfo(_a0 context.Context) (*v1.ChainInfo, error) { + ret := _m.Called(_a0) + + var r0 *v1.ChainInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*v1.ChainInfo, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) *v1.ChainInfo); ok { + r0 = rf(_a0) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1.ChainInfo) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PluginClientAPI_GetChainInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChainInfo' +type PluginClientAPI_GetChainInfo_Call struct { + *mock.Call +} + +// GetChainInfo is a helper method to define mock.On call +// - _a0 context.Context +func (_e *PluginClientAPI_Expecter) GetChainInfo(_a0 interface{}) *PluginClientAPI_GetChainInfo_Call { + return &PluginClientAPI_GetChainInfo_Call{Call: _e.mock.On("GetChainInfo", _a0)} +} + +func (_c *PluginClientAPI_GetChainInfo_Call) Run(run func(_a0 context.Context)) *PluginClientAPI_GetChainInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *PluginClientAPI_GetChainInfo_Call) Return(_a0 *v1.ChainInfo, _a1 error) *PluginClientAPI_GetChainInfo_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PluginClientAPI_GetChainInfo_Call) RunAndReturn(run func(context.Context) (*v1.ChainInfo, error)) *PluginClientAPI_GetChainInfo_Call { + _c.Call.Return(run) + return _c +} + +// NewPluginClientAPI creates a new instance of PluginClientAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPluginClientAPI(t interface { + mock.TestingT + Cleanup(func()) +}) *PluginClientAPI { + mock := &PluginClientAPI{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/ignite/services/plugin/mocks/interface.go b/ignite/services/plugin/mocks/interface.go index cdf4f810df..530177f9b1 100644 --- a/ignite/services/plugin/mocks/interface.go +++ b/ignite/services/plugin/mocks/interface.go @@ -1,11 +1,15 @@ -// Code generated by mockery v2.22.1. DO NOT EDIT. +// Code generated by mockery v2.36.1. DO NOT EDIT. package mocks import ( + context "context" + mock "github.com/stretchr/testify/mock" plugin "github.com/ignite/cli/ignite/services/plugin" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" ) // PluginInterface is an autogenerated mock type for the Interface type @@ -21,13 +25,13 @@ func (_m *PluginInterface) EXPECT() *PluginInterface_Expecter { return &PluginInterface_Expecter{mock: &_m.Mock} } -// Execute provides a mock function with given fields: cmd -func (_m *PluginInterface) Execute(cmd plugin.ExecutedCommand) error { - ret := _m.Called(cmd) +// Execute provides a mock function with given fields: _a0, _a1, _a2 +func (_m *PluginInterface) Execute(_a0 context.Context, _a1 *v1.ExecutedCommand, _a2 plugin.ClientAPI) error { + ret := _m.Called(_a0, _a1, _a2) var r0 error - if rf, ok := ret.Get(0).(func(plugin.ExecutedCommand) error); ok { - r0 = rf(cmd) + if rf, ok := ret.Get(0).(func(context.Context, *v1.ExecutedCommand, plugin.ClientAPI) error); ok { + r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) } @@ -41,14 +45,16 @@ type PluginInterface_Execute_Call struct { } // Execute is a helper method to define mock.On call -// - cmd plugin.ExecutedCommand -func (_e *PluginInterface_Expecter) Execute(cmd interface{}) *PluginInterface_Execute_Call { - return &PluginInterface_Execute_Call{Call: _e.mock.On("Execute", cmd)} +// - _a0 context.Context +// - _a1 *v1.ExecutedCommand +// - _a2 plugin.ClientAPI +func (_e *PluginInterface_Expecter) Execute(_a0 interface{}, _a1 interface{}, _a2 interface{}) *PluginInterface_Execute_Call { + return &PluginInterface_Execute_Call{Call: _e.mock.On("Execute", _a0, _a1, _a2)} } -func (_c *PluginInterface_Execute_Call) Run(run func(cmd plugin.ExecutedCommand)) *PluginInterface_Execute_Call { +func (_c *PluginInterface_Execute_Call) Run(run func(_a0 context.Context, _a1 *v1.ExecutedCommand, _a2 plugin.ClientAPI)) *PluginInterface_Execute_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(plugin.ExecutedCommand)) + run(args[0].(context.Context), args[1].(*v1.ExecutedCommand), args[2].(plugin.ClientAPI)) }) return _c } @@ -58,18 +64,18 @@ func (_c *PluginInterface_Execute_Call) Return(_a0 error) *PluginInterface_Execu return _c } -func (_c *PluginInterface_Execute_Call) RunAndReturn(run func(plugin.ExecutedCommand) error) *PluginInterface_Execute_Call { +func (_c *PluginInterface_Execute_Call) RunAndReturn(run func(context.Context, *v1.ExecutedCommand, plugin.ClientAPI) error) *PluginInterface_Execute_Call { _c.Call.Return(run) return _c } -// ExecuteHookCleanUp provides a mock function with given fields: hook -func (_m *PluginInterface) ExecuteHookCleanUp(hook plugin.ExecutedHook) error { - ret := _m.Called(hook) +// ExecuteHookCleanUp provides a mock function with given fields: _a0, _a1, _a2 +func (_m *PluginInterface) ExecuteHookCleanUp(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI) error { + ret := _m.Called(_a0, _a1, _a2) var r0 error - if rf, ok := ret.Get(0).(func(plugin.ExecutedHook) error); ok { - r0 = rf(hook) + if rf, ok := ret.Get(0).(func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error); ok { + r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) } @@ -83,14 +89,16 @@ type PluginInterface_ExecuteHookCleanUp_Call struct { } // ExecuteHookCleanUp is a helper method to define mock.On call -// - hook plugin.ExecutedHook -func (_e *PluginInterface_Expecter) ExecuteHookCleanUp(hook interface{}) *PluginInterface_ExecuteHookCleanUp_Call { - return &PluginInterface_ExecuteHookCleanUp_Call{Call: _e.mock.On("ExecuteHookCleanUp", hook)} +// - _a0 context.Context +// - _a1 *v1.ExecutedHook +// - _a2 plugin.ClientAPI +func (_e *PluginInterface_Expecter) ExecuteHookCleanUp(_a0 interface{}, _a1 interface{}, _a2 interface{}) *PluginInterface_ExecuteHookCleanUp_Call { + return &PluginInterface_ExecuteHookCleanUp_Call{Call: _e.mock.On("ExecuteHookCleanUp", _a0, _a1, _a2)} } -func (_c *PluginInterface_ExecuteHookCleanUp_Call) Run(run func(hook plugin.ExecutedHook)) *PluginInterface_ExecuteHookCleanUp_Call { +func (_c *PluginInterface_ExecuteHookCleanUp_Call) Run(run func(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI)) *PluginInterface_ExecuteHookCleanUp_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(plugin.ExecutedHook)) + run(args[0].(context.Context), args[1].(*v1.ExecutedHook), args[2].(plugin.ClientAPI)) }) return _c } @@ -100,18 +108,18 @@ func (_c *PluginInterface_ExecuteHookCleanUp_Call) Return(_a0 error) *PluginInte return _c } -func (_c *PluginInterface_ExecuteHookCleanUp_Call) RunAndReturn(run func(plugin.ExecutedHook) error) *PluginInterface_ExecuteHookCleanUp_Call { +func (_c *PluginInterface_ExecuteHookCleanUp_Call) RunAndReturn(run func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error) *PluginInterface_ExecuteHookCleanUp_Call { _c.Call.Return(run) return _c } -// ExecuteHookPost provides a mock function with given fields: hook -func (_m *PluginInterface) ExecuteHookPost(hook plugin.ExecutedHook) error { - ret := _m.Called(hook) +// ExecuteHookPost provides a mock function with given fields: _a0, _a1, _a2 +func (_m *PluginInterface) ExecuteHookPost(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI) error { + ret := _m.Called(_a0, _a1, _a2) var r0 error - if rf, ok := ret.Get(0).(func(plugin.ExecutedHook) error); ok { - r0 = rf(hook) + if rf, ok := ret.Get(0).(func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error); ok { + r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) } @@ -125,14 +133,16 @@ type PluginInterface_ExecuteHookPost_Call struct { } // ExecuteHookPost is a helper method to define mock.On call -// - hook plugin.ExecutedHook -func (_e *PluginInterface_Expecter) ExecuteHookPost(hook interface{}) *PluginInterface_ExecuteHookPost_Call { - return &PluginInterface_ExecuteHookPost_Call{Call: _e.mock.On("ExecuteHookPost", hook)} +// - _a0 context.Context +// - _a1 *v1.ExecutedHook +// - _a2 plugin.ClientAPI +func (_e *PluginInterface_Expecter) ExecuteHookPost(_a0 interface{}, _a1 interface{}, _a2 interface{}) *PluginInterface_ExecuteHookPost_Call { + return &PluginInterface_ExecuteHookPost_Call{Call: _e.mock.On("ExecuteHookPost", _a0, _a1, _a2)} } -func (_c *PluginInterface_ExecuteHookPost_Call) Run(run func(hook plugin.ExecutedHook)) *PluginInterface_ExecuteHookPost_Call { +func (_c *PluginInterface_ExecuteHookPost_Call) Run(run func(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI)) *PluginInterface_ExecuteHookPost_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(plugin.ExecutedHook)) + run(args[0].(context.Context), args[1].(*v1.ExecutedHook), args[2].(plugin.ClientAPI)) }) return _c } @@ -142,18 +152,18 @@ func (_c *PluginInterface_ExecuteHookPost_Call) Return(_a0 error) *PluginInterfa return _c } -func (_c *PluginInterface_ExecuteHookPost_Call) RunAndReturn(run func(plugin.ExecutedHook) error) *PluginInterface_ExecuteHookPost_Call { +func (_c *PluginInterface_ExecuteHookPost_Call) RunAndReturn(run func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error) *PluginInterface_ExecuteHookPost_Call { _c.Call.Return(run) return _c } -// ExecuteHookPre provides a mock function with given fields: hook -func (_m *PluginInterface) ExecuteHookPre(hook plugin.ExecutedHook) error { - ret := _m.Called(hook) +// ExecuteHookPre provides a mock function with given fields: _a0, _a1, _a2 +func (_m *PluginInterface) ExecuteHookPre(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI) error { + ret := _m.Called(_a0, _a1, _a2) var r0 error - if rf, ok := ret.Get(0).(func(plugin.ExecutedHook) error); ok { - r0 = rf(hook) + if rf, ok := ret.Get(0).(func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error); ok { + r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) } @@ -167,14 +177,16 @@ type PluginInterface_ExecuteHookPre_Call struct { } // ExecuteHookPre is a helper method to define mock.On call -// - hook plugin.ExecutedHook -func (_e *PluginInterface_Expecter) ExecuteHookPre(hook interface{}) *PluginInterface_ExecuteHookPre_Call { - return &PluginInterface_ExecuteHookPre_Call{Call: _e.mock.On("ExecuteHookPre", hook)} +// - _a0 context.Context +// - _a1 *v1.ExecutedHook +// - _a2 plugin.ClientAPI +func (_e *PluginInterface_Expecter) ExecuteHookPre(_a0 interface{}, _a1 interface{}, _a2 interface{}) *PluginInterface_ExecuteHookPre_Call { + return &PluginInterface_ExecuteHookPre_Call{Call: _e.mock.On("ExecuteHookPre", _a0, _a1, _a2)} } -func (_c *PluginInterface_ExecuteHookPre_Call) Run(run func(hook plugin.ExecutedHook)) *PluginInterface_ExecuteHookPre_Call { +func (_c *PluginInterface_ExecuteHookPre_Call) Run(run func(_a0 context.Context, _a1 *v1.ExecutedHook, _a2 plugin.ClientAPI)) *PluginInterface_ExecuteHookPre_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(plugin.ExecutedHook)) + run(args[0].(context.Context), args[1].(*v1.ExecutedHook), args[2].(plugin.ClientAPI)) }) return _c } @@ -184,28 +196,30 @@ func (_c *PluginInterface_ExecuteHookPre_Call) Return(_a0 error) *PluginInterfac return _c } -func (_c *PluginInterface_ExecuteHookPre_Call) RunAndReturn(run func(plugin.ExecutedHook) error) *PluginInterface_ExecuteHookPre_Call { +func (_c *PluginInterface_ExecuteHookPre_Call) RunAndReturn(run func(context.Context, *v1.ExecutedHook, plugin.ClientAPI) error) *PluginInterface_ExecuteHookPre_Call { _c.Call.Return(run) return _c } -// Manifest provides a mock function with given fields: -func (_m *PluginInterface) Manifest() (plugin.Manifest, error) { - ret := _m.Called() +// Manifest provides a mock function with given fields: _a0 +func (_m *PluginInterface) Manifest(_a0 context.Context) (*v1.Manifest, error) { + ret := _m.Called(_a0) - var r0 plugin.Manifest + var r0 *v1.Manifest var r1 error - if rf, ok := ret.Get(0).(func() (plugin.Manifest, error)); ok { - return rf() + if rf, ok := ret.Get(0).(func(context.Context) (*v1.Manifest, error)); ok { + return rf(_a0) } - if rf, ok := ret.Get(0).(func() plugin.Manifest); ok { - r0 = rf() + if rf, ok := ret.Get(0).(func(context.Context) *v1.Manifest); ok { + r0 = rf(_a0) } else { - r0 = ret.Get(0).(plugin.Manifest) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v1.Manifest) + } } - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) } else { r1 = ret.Error(1) } @@ -219,34 +233,34 @@ type PluginInterface_Manifest_Call struct { } // Manifest is a helper method to define mock.On call -func (_e *PluginInterface_Expecter) Manifest() *PluginInterface_Manifest_Call { - return &PluginInterface_Manifest_Call{Call: _e.mock.On("Manifest")} +// - _a0 context.Context +func (_e *PluginInterface_Expecter) Manifest(_a0 interface{}) *PluginInterface_Manifest_Call { + return &PluginInterface_Manifest_Call{Call: _e.mock.On("Manifest", _a0)} } -func (_c *PluginInterface_Manifest_Call) Run(run func()) *PluginInterface_Manifest_Call { +func (_c *PluginInterface_Manifest_Call) Run(run func(_a0 context.Context)) *PluginInterface_Manifest_Call { _c.Call.Run(func(args mock.Arguments) { - run() + run(args[0].(context.Context)) }) return _c } -func (_c *PluginInterface_Manifest_Call) Return(_a0 plugin.Manifest, _a1 error) *PluginInterface_Manifest_Call { +func (_c *PluginInterface_Manifest_Call) Return(_a0 *v1.Manifest, _a1 error) *PluginInterface_Manifest_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *PluginInterface_Manifest_Call) RunAndReturn(run func() (plugin.Manifest, error)) *PluginInterface_Manifest_Call { +func (_c *PluginInterface_Manifest_Call) RunAndReturn(run func(context.Context) (*v1.Manifest, error)) *PluginInterface_Manifest_Call { _c.Call.Return(run) return _c } -type mockConstructorTestingTNewPluginInterface interface { +// NewPluginInterface creates a new instance of PluginInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPluginInterface(t interface { mock.TestingT Cleanup(func()) -} - -// NewPluginInterface creates a new instance of PluginInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewPluginInterface(t mockConstructorTestingTNewPluginInterface) *PluginInterface { +}) *PluginInterface { mock := &PluginInterface{} mock.Mock.Test(t) diff --git a/ignite/services/plugin/plugin.go b/ignite/services/plugin/plugin.go index 240effab4d..b23a46711b 100644 --- a/ignite/services/plugin/plugin.go +++ b/ignite/services/plugin/plugin.go @@ -37,11 +37,13 @@ var PluginsPath = xfilepath.Mkdir(xfilepath.Join( // Plugin represents a ignite plugin. type Plugin struct { - // Embed the plugin configuration + // Embed the plugin configuration. pluginsconfig.Plugin - // Interface allows to communicate with the plugin via net/rpc. + + // Interface allows to communicate with the plugin via RPC. Interface Interface - // If any error occurred during the plugin load, it's stored here + + // If any error occurred during the plugin load, it's stored here. Error error name string @@ -53,11 +55,13 @@ type Plugin struct { client *hplugin.Client - // holds a cache of the plugin manifest to prevent mant calls over the rpc boundary - manifest Manifest + // Holds a cache of the plugin manifest to prevent mant calls over the rpc boundary. + manifest *Manifest + // If a plugin's ShareHost flag is set to true, isHost is used to discern if a // plugin instance is controlling the rpc server. - isHost bool + isHost bool + isSharedHost bool ev events.Bus } @@ -100,8 +104,7 @@ func Load(ctx context.Context, plugins []pluginsconfig.Plugin, options ...Option // Update removes the cache directory of plugins and fetch them again. func Update(plugins ...*Plugin) error { for _, p := range plugins { - err := p.clean() - if err != nil { + if err := p.clean(); err != nil { return err } p.fetch() @@ -176,7 +179,7 @@ func newPlugin(pluginsDir string, cp pluginsconfig.Plugin, options ...Option) *P // KillClient kills the running plugin client. func (p *Plugin) KillClient() { - if p.manifest.SharedHost && !p.isHost { + if p.isSharedHost && !p.isHost { // Don't send kill signal to a shared-host plugin when this process isn't // the one who initiated it. return @@ -192,6 +195,12 @@ func (p *Plugin) KillClient() { } } +// Manifest returns plugin's manigest. +// The manifest is available after the plugin has been loaded. +func (p Plugin) Manifest() *Manifest { + return p.manifest +} + func (p Plugin) binaryName() string { return fmt.Sprintf("%s.app", p.name) } @@ -232,7 +241,7 @@ func (p *Plugin) load(ctx context.Context) { } // pluginMap is the map of plugins we can dispense. pluginMap := map[string]hplugin.Plugin{ - p.name: &InterfacePlugin{}, + p.name: NewGRPC(nil), } // Create an hclog.Logger logLevel := hclog.Error @@ -245,6 +254,16 @@ func (p *Plugin) load(ctx context.Context) { Level: logLevel, }) + // Common plugin client configuration values + cfg := &hplugin.ClientConfig{ + HandshakeConfig: HandshakeConfig(), + Plugins: pluginMap, + Logger: logger, + SyncStderr: os.Stderr, + SyncStdout: os.Stdout, + AllowedProtocols: []hplugin.Protocol{hplugin.ProtocolGRPC}, + } + if checkConfCache(p.Path) { rconf, err := readConfigCache(p.Path) if err != nil { @@ -252,29 +271,16 @@ func (p *Plugin) load(ctx context.Context) { return } - // We're attaching to an existing server, supply attachment configuration - p.client = hplugin.NewClient(&hplugin.ClientConfig{ - HandshakeConfig: handshakeConfig, - Plugins: pluginMap, - Logger: logger, - Reattach: &rconf, - SyncStderr: os.Stderr, - SyncStdout: os.Stdout, - }) - + // Attach to an existing plugin process + cfg.Reattach = &rconf + p.client = hplugin.NewClient(cfg) } else { - // We're a host! Start by launching the plugin process. - p.client = hplugin.NewClient(&hplugin.ClientConfig{ - HandshakeConfig: handshakeConfig, - Plugins: pluginMap, - Logger: logger, - Cmd: exec.Command(p.binaryPath()), - SyncStderr: os.Stderr, - SyncStdout: os.Stdout, - }) - } - - // :Connect via RPC + // Launch a new plugin process + cfg.Cmd = exec.Command(p.binaryPath()) + p.client = hplugin.NewClient(cfg) + } + + // Connect via gRPC rpcClient, err := p.client.Client() if err != nil { p.Error = errors.Wrapf(err, "connecting") @@ -289,14 +295,18 @@ func (p *Plugin) load(ctx context.Context) { } // We should have an Interface now! This feels like a normal interface - // implementation but is in fact over an RPC connection. + // implementation but is in fact over an gRPC connection. p.Interface = raw.(Interface) - m, err := p.Interface.Manifest() + m, err := p.Interface.Manifest(ctx) if err != nil { p.Error = errors.Wrapf(err, "manifest load") + return } + p.isSharedHost = m.SharedHost + + // Cache the manifest to avoid extra plugin requests p.manifest = m // write the rpc context to cache if the plugin is declared as host. diff --git a/ignite/services/plugin/plugin_test.go b/ignite/services/plugin/plugin_test.go index b3e6682dd0..7ddca88daf 100644 --- a/ignite/services/plugin/plugin_test.go +++ b/ignite/services/plugin/plugin_test.go @@ -157,33 +157,47 @@ func TestNewPlugin(t *testing.T) { } } +// Helper to make a local git repository with gofile committed. +// Returns the repo directory and the git.Repository +func makeGitRepo(t *testing.T, name string) (string, *git.Repository) { + t.Helper() + + require := require.New(t) + repoDir := t.TempDir() + scaffoldPlugin(t, repoDir, "github.com/ignite/"+name, false) + + repo, err := git.PlainInit(repoDir, false) + require.NoError(err) + + w, err := repo.Worktree() + require.NoError(err) + + _, err = w.Add(".") + require.NoError(err) + + _, err = w.Commit("msg", &git.CommitOptions{ + Author: &object.Signature{ + Name: "bob", + Email: "bob@example.com", + When: time.Now(), + }, + }) + require.NoError(err) + return repoDir, repo +} + +type TestClientAPI struct{ ClientAPI } + +func (TestClientAPI) GetChainInfo(context.Context) (*ChainInfo, error) { + return &ChainInfo{}, nil +} + func TestPluginLoad(t *testing.T) { wd, err := os.Getwd() require.NoError(t, err) - // Helper to make a local git repository with gofile committed. - // Returns the repo directory and the git.Repository - makeGitRepo := func(t *testing.T, name string) (string, *git.Repository) { - require := require.New(t) - repoDir := t.TempDir() - scaffoldPlugin(t, repoDir, "github.com/ignite/"+name, false) - require.NoError(err) - repo, err := git.PlainInit(repoDir, false) - require.NoError(err) - w, err := repo.Worktree() - require.NoError(err) - _, err = w.Add(".") - require.NoError(err) - _, err = w.Commit("msg", &git.CommitOptions{ - Author: &object.Signature{ - Name: "bob", - Email: "bob@example.com", - When: time.Now(), - }, - }) - require.NoError(err) - return repoDir, repo - } + clientAPI := &TestClientAPI{} + tests := []struct { name string buildPlugin func(t *testing.T) Plugin @@ -330,6 +344,7 @@ func TestPluginLoad(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() require := require.New(t) assert := assert.New(t) p := tt.buildPlugin(t) @@ -345,13 +360,13 @@ func TestPluginLoad(t *testing.T) { require.NoError(p.Error) require.NotNil(p.Interface) - manifest, err := p.Interface.Manifest() + manifest, err := p.Interface.Manifest(ctx) require.NoError(err) assert.Equal(p.name, manifest.Name) - assert.NoError(p.Interface.Execute(ExecutedCommand{})) - assert.NoError(p.Interface.ExecuteHookPre(ExecutedHook{})) - assert.NoError(p.Interface.ExecuteHookPost(ExecutedHook{})) - assert.NoError(p.Interface.ExecuteHookCleanUp(ExecutedHook{})) + assert.NoError(p.Interface.Execute(ctx, &ExecutedCommand{}, clientAPI)) + assert.NoError(p.Interface.ExecuteHookPre(ctx, &ExecutedHook{}, clientAPI)) + assert.NoError(p.Interface.ExecuteHookPost(ctx, &ExecutedHook{}, clientAPI)) + assert.NoError(p.Interface.ExecuteHookCleanUp(ctx, &ExecutedHook{}, clientAPI)) }) } } @@ -491,14 +506,18 @@ func TestPluginClean(t *testing.T) { // scaffoldPlugin runs Scaffold and updates the go.mod so it uses the // current ignite/cli sources. func scaffoldPlugin(t *testing.T, dir, name string, sharedHost bool) string { + t.Helper() + require := require.New(t) - path, err := Scaffold(dir, name, sharedHost) + path, err := Scaffold(context.Background(), dir, name, sharedHost) require.NoError(err) + // We want the scaffolded plugin to use the current version of ignite/cli, // for that we need to update the plugin go.mod and add a replace to target // current ignite/cli gomod, err := gomodule.ParseAt(path) require.NoError(err) + // use GOMOD env to get current directory module path modpath, err := gocmd.Env(gocmd.EnvGOMOD) require.NoError(err) @@ -515,12 +534,14 @@ func scaffoldPlugin(t *testing.T, dir, name string, sharedHost bool) string { func assertPlugin(t *testing.T, want, have Plugin) { t.Helper() + if want.Error != nil { require.Error(t, have.Error) assert.Regexp(t, want.Error.Error(), have.Error.Error()) } else { require.NoError(t, have.Error) } + // Errors aren't comparable with assert.Equal, because of the different stacks want.Error = nil have.Error = nil diff --git a/ignite/services/plugin/protocol.go b/ignite/services/plugin/protocol.go new file mode 100644 index 0000000000..0423e2e9b6 --- /dev/null +++ b/ignite/services/plugin/protocol.go @@ -0,0 +1,233 @@ +package plugin + +import ( + "context" + + hplugin "github.com/hashicorp/go-plugin" + "google.golang.org/grpc" + + v1 "github.com/ignite/cli/ignite/services/plugin/grpc/v1" +) + +var handshakeConfig = hplugin.HandshakeConfig{ + ProtocolVersion: 1, + MagicCookieKey: "IGNITE_APP", + MagicCookieValue: "ignite", +} + +// HandshakeConfig are used to just do a basic handshake between a plugin and host. +// If the handshake fails, a user friendly error is shown. This prevents users from +// executing bad plugins or executing a plugin directory. It is a UX feature, not a +// security feature. +func HandshakeConfig() hplugin.HandshakeConfig { + return handshakeConfig +} + +// NewGRPC returns a new gRPC plugin that implements the interface over gRPC. +func NewGRPC(impl Interface) hplugin.Plugin { + return grpcPlugin{impl: impl} +} + +type grpcPlugin struct { + hplugin.NetRPCUnsupportedPlugin + + impl Interface +} + +// GRPCServer returns a new server that implements the plugin interface over gRPC. +func (p grpcPlugin) GRPCServer(broker *hplugin.GRPCBroker, s *grpc.Server) error { + v1.RegisterInterfaceServiceServer(s, &server{ + impl: p.impl, + broker: broker, + }) + return nil +} + +// GRPCClient returns a new plugin client that allows calling the plugin interface over gRPC. +func (p grpcPlugin) GRPCClient(_ context.Context, broker *hplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { + return &client{ + grpc: v1.NewInterfaceServiceClient(c), + broker: broker, + }, nil +} + +type client struct { + grpc v1.InterfaceServiceClient + broker *hplugin.GRPCBroker +} + +func (c client) Manifest(ctx context.Context) (*Manifest, error) { + r, err := c.grpc.Manifest(ctx, &v1.ManifestRequest{}) + if err != nil { + return nil, err + } + + return r.Manifest, nil +} + +func (c client) Execute(ctx context.Context, cmd *ExecutedCommand, api ClientAPI) error { + brokerID, stopServer := c.startClientAPIServer(api) + _, err := c.grpc.Execute(ctx, &v1.ExecuteRequest{ + Cmd: cmd, + ClientApi: brokerID, + }) + stopServer() + return err +} + +func (c client) ExecuteHookPre(ctx context.Context, h *ExecutedHook, api ClientAPI) error { + brokerID, stopServer := c.startClientAPIServer(api) + _, err := c.grpc.ExecuteHookPre(ctx, &v1.ExecuteHookPreRequest{ + Hook: h, + ClientApi: brokerID, + }) + stopServer() + return err +} + +func (c client) ExecuteHookPost(ctx context.Context, h *ExecutedHook, api ClientAPI) error { + brokerID, stopServer := c.startClientAPIServer(api) + _, err := c.grpc.ExecuteHookPost(ctx, &v1.ExecuteHookPostRequest{ + Hook: h, + ClientApi: brokerID, + }) + stopServer() + return err +} + +func (c client) ExecuteHookCleanUp(ctx context.Context, h *ExecutedHook, api ClientAPI) error { + brokerID, stopServer := c.startClientAPIServer(api) + _, err := c.grpc.ExecuteHookCleanUp(ctx, &v1.ExecuteHookCleanUpRequest{ + Hook: h, + ClientApi: brokerID, + }) + stopServer() + return err +} + +func (c client) startClientAPIServer(api ClientAPI) (uint32, func()) { + var ( + srv *grpc.Server + brokerID = c.broker.NextId() + ) + + go c.broker.AcceptAndServe(brokerID, func(opts []grpc.ServerOption) *grpc.Server { + srv = grpc.NewServer(opts...) + v1.RegisterClientAPIServiceServer(srv, &clientAPIServer{impl: api}) + return srv + }) + + return brokerID, func() { srv.Stop() } +} + +type server struct { + v1.UnimplementedInterfaceServiceServer + + impl Interface + broker *hplugin.GRPCBroker +} + +func (s server) Manifest(ctx context.Context, _ *v1.ManifestRequest) (*v1.ManifestResponse, error) { + m, err := s.impl.Manifest(ctx) + if err != nil { + return nil, err + } + + return &v1.ManifestResponse{Manifest: m}, nil +} + +func (s server) Execute(ctx context.Context, r *v1.ExecuteRequest) (*v1.ExecuteResponse, error) { + conn, err := s.broker.Dial(r.ClientApi) + if err != nil { + return nil, err + } + + defer conn.Close() + + err = s.impl.Execute(ctx, r.GetCmd(), newClientAPIClient(conn)) + if err != nil { + return nil, err + } + + return &v1.ExecuteResponse{}, nil +} + +func (s server) ExecuteHookPre(ctx context.Context, r *v1.ExecuteHookPreRequest) (*v1.ExecuteHookPreResponse, error) { + conn, err := s.broker.Dial(r.ClientApi) + if err != nil { + return nil, err + } + + defer conn.Close() + + err = s.impl.ExecuteHookPre(ctx, r.GetHook(), newClientAPIClient(conn)) + if err != nil { + return nil, err + } + + return &v1.ExecuteHookPreResponse{}, nil +} + +func (s server) ExecuteHookPost(ctx context.Context, r *v1.ExecuteHookPostRequest) (*v1.ExecuteHookPostResponse, error) { + conn, err := s.broker.Dial(r.ClientApi) + if err != nil { + return nil, err + } + + defer conn.Close() + + err = s.impl.ExecuteHookPost(ctx, r.GetHook(), newClientAPIClient(conn)) + if err != nil { + return nil, err + } + + return &v1.ExecuteHookPostResponse{}, nil +} + +func (s server) ExecuteHookCleanUp(ctx context.Context, r *v1.ExecuteHookCleanUpRequest) (*v1.ExecuteHookCleanUpResponse, error) { + conn, err := s.broker.Dial(r.ClientApi) + if err != nil { + return nil, err + } + + defer conn.Close() + + err = s.impl.ExecuteHookCleanUp(ctx, r.GetHook(), newClientAPIClient(conn)) + if err != nil { + return nil, err + } + + return &v1.ExecuteHookCleanUpResponse{}, nil +} + +func newClientAPIClient(c *grpc.ClientConn) *clientAPIClient { + return &clientAPIClient{v1.NewClientAPIServiceClient(c)} +} + +type clientAPIClient struct { + grpc v1.ClientAPIServiceClient +} + +func (c clientAPIClient) GetChainInfo(ctx context.Context) (*ChainInfo, error) { + r, err := c.grpc.GetChainInfo(ctx, &v1.GetChainInfoRequest{}) + if err != nil { + return nil, err + } + + return r.ChainInfo, nil +} + +type clientAPIServer struct { + v1.UnimplementedClientAPIServiceServer + + impl ClientAPI +} + +func (s clientAPIServer) GetChainInfo(ctx context.Context, _ *v1.GetChainInfoRequest) (*v1.GetChainInfoResponse, error) { + chainInfo, err := s.impl.GetChainInfo(ctx) + if err != nil { + return nil, err + } + + return &v1.GetChainInfoResponse{ChainInfo: chainInfo}, nil +} diff --git a/ignite/services/plugin/scaffold.go b/ignite/services/plugin/scaffold.go index ff2a7fe093..500e1f6645 100644 --- a/ignite/services/plugin/scaffold.go +++ b/ignite/services/plugin/scaffold.go @@ -19,7 +19,7 @@ import ( var fsPluginSource embed.FS // Scaffold generates a plugin structure under dir/path.Base(moduleName). -func Scaffold(dir, moduleName string, sharedHost bool) (string, error) { +func Scaffold(ctx context.Context, dir, moduleName string, sharedHost bool) (string, error) { var ( name = filepath.Base(moduleName) finalDir = path.Join(dir, name) @@ -30,29 +30,35 @@ func Scaffold(dir, moduleName string, sharedHost bool) (string, error) { finalDir, ) ) + if _, err := os.Stat(finalDir); err == nil { // finalDir already exists, don't overwrite stuff return "", errors.Errorf("directory %q already exists, abort scaffolding", finalDir) } + if err := g.Box(template); err != nil { return "", errors.WithStack(err) } - ctx := plush.NewContext() - ctx.Set("ModuleName", moduleName) - ctx.Set("Name", name) - ctx.Set("SharedHost", sharedHost) - g.Transformer(xgenny.Transformer(ctx)) + pctx := plush.NewContextWithContext(ctx) + pctx.Set("ModuleName", moduleName) + pctx.Set("Name", name) + pctx.Set("SharedHost", sharedHost) + + g.Transformer(xgenny.Transformer(pctx)) r := genny.WetRunner(ctx) err := r.With(g) if err != nil { return "", errors.WithStack(err) } + if err := r.Run(); err != nil { return "", errors.WithStack(err) } - if err := gocmd.ModTidy(context.TODO(), finalDir); err != nil { + + if err := gocmd.ModTidy(ctx, finalDir); err != nil { return "", errors.WithStack(err) } + return finalDir, nil } diff --git a/ignite/services/plugin/scaffold_test.go b/ignite/services/plugin/scaffold_test.go index 8d7f122df3..a6b66a9db1 100644 --- a/ignite/services/plugin/scaffold_test.go +++ b/ignite/services/plugin/scaffold_test.go @@ -1,16 +1,24 @@ package plugin import ( + "context" + "path/filepath" "testing" "github.com/stretchr/testify/require" ) func TestScaffold(t *testing.T) { + // Arrange tmp := t.TempDir() + ctx := context.Background() - path, err := Scaffold(tmp, "github.com/foo/bar", false) + // Act + path, err := Scaffold(ctx, tmp, "github.com/foo/bar", false) + // Assert require.NoError(t, err) require.DirExists(t, path) + require.FileExists(t, filepath.Join(path, "go.mod")) + require.FileExists(t, filepath.Join(path, "main.go")) } diff --git a/ignite/services/plugin/template/go.mod.plush b/ignite/services/plugin/template/go.mod.plush index fe8fffd05b..650b85a600 100644 --- a/ignite/services/plugin/template/go.mod.plush +++ b/ignite/services/plugin/template/go.mod.plush @@ -3,6 +3,6 @@ module <%= ModuleName %> go 1.21 require ( - github.com/hashicorp/go-plugin v1.4.9 - github.com/ignite/cli v0.26.2-0.20230504112712-4324e2ff958f -) \ No newline at end of file + github.com/hashicorp/go-plugin v1.5.0 + github.com/ignite/cli v0.27.2 +) diff --git a/ignite/services/plugin/template/main.go.plush b/ignite/services/plugin/template/main.go.plush index 077f10f250..83181ccd76 100644 --- a/ignite/services/plugin/template/main.go.plush +++ b/ignite/services/plugin/template/main.go.plush @@ -1,7 +1,7 @@ package main import ( - "encoding/gob" + "context" "fmt" "path/filepath" @@ -11,55 +11,56 @@ import ( "github.com/ignite/cli/ignite/services/plugin" ) -func init() { - gob.Register(plugin.Manifest{}) - gob.Register(plugin.ExecutedCommand{}) - gob.Register(plugin.ExecutedHook{}) -} - type app struct{} -func (app) Manifest() (plugin.Manifest, error) { - return plugin.Manifest{ +func (app) Manifest(ctx context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ Name: "<%= Name %>", - // Add commands here - Commands: []plugin.Command{ + // TODO: Add commands here + Commands: []*plugin.Command{ // Example of a command { Use: "<%= Name %>", Short: "Explain what the command is doing...", Long: "Long description goes here...", - Flags: []plugin.Flag{ + Flags: []*plugin.Flag{ {Name: "my-flag", Type: plugin.FlagTypeString, Usage: "my flag description"}, }, PlaceCommandUnder: "ignite", // Examples of adding subcommands: - /* - Commands: []plugin.Command{ - {Use: "add"}, - {Use: "list"}, - {Use: "delete"}, - }, - */ + // Commands: []*plugin.Command{ + // {Use: "add"}, + // {Use: "list"}, + // {Use: "delete"}, + // }, }, }, - // Add hooks here - Hooks: []plugin.Hook{}, + // TODO: Add hooks here + Hooks: []*plugin.Hook{}, SharedHost: <%= SharedHost %>, }, nil } -func (app) Execute(cmd plugin.ExecutedCommand) error { +func (app) Execute(ctx context.Context, cmd *plugin.ExecutedCommand, api plugin.ClientAPI) error { // TODO: write command execution here - fmt.Printf("Hello I'm the <%= Name %> plugin\n") + fmt.Printf("Hello I'm the example-plugin plugin\n") fmt.Printf("My executed command: %q\n", cmd.Path) fmt.Printf("My args: %v\n", cmd.Args) - myFlag, _ := cmd.Flags().GetString("my-flag") + + flags, err := cmd.NewFlags() + if err != nil { + return err + } + + myFlag, _ := flags.GetString("my-flag") fmt.Printf("My flags: my-flag=%q\n", myFlag) fmt.Printf("My config parameters: %v\n", cmd.With) // This is how the plugin can access the chain: // c, err := getChain(cmd) + // if err != nil { + // return err + // } // According to the number of declared commands, you may need a switch: /* @@ -72,28 +73,37 @@ func (app) Execute(cmd plugin.ExecutedCommand) error { fmt.Println("Deleting stuff...") } */ + + // ClientAPI call example + fmt.Println(api.GetChainInfo(ctx)) + return nil } -func (app) ExecuteHookPre(hook plugin.ExecutedHook) error { - fmt.Printf("Executing hook pre %q\n", hook.Name) +func (app) ExecuteHookPre(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + fmt.Printf("Executing hook pre %q\n", h.Hook.GetName()) return nil } -func (app) ExecuteHookPost(hook plugin.ExecutedHook) error { - fmt.Printf("Executing hook post %q\n", hook.Name) +func (app) ExecuteHookPost(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + fmt.Printf("Executing hook post %q\n", h.Hook.GetName()) return nil } -func (app) ExecuteHookCleanUp(hook plugin.ExecutedHook) error { - fmt.Printf("Executing hook cleanup %q\n", hook.Name) +func (app) ExecuteHookCleanUp(ctx context.Context, h *plugin.ExecutedHook, api plugin.ClientAPI) error { + fmt.Printf("Executing hook cleanup %q\n", h.Hook.GetName()) return nil } -func getChain(cmd plugin.ExecutedCommand, chainOption ...chain.Option) (*chain.Chain, error) { +func getChain(cmd *plugin.ExecutedCommand, chainOption ...chain.Option) (*chain.Chain, error) { + flags, err := cmd.NewFlags() + if err != nil { + return nil, err + } + var ( - home, _ = cmd.Flags().GetString("home") - path, _ = cmd.Flags().GetString("path") + home, _ = flags.GetString("home") + path, _ = flags.GetString("path") ) if home != "" { chainOption = append(chainOption, chain.HomePath(home)) @@ -106,12 +116,11 @@ func getChain(cmd plugin.ExecutedCommand, chainOption ...chain.Option) (*chain.C } func main() { - pluginMap := map[string]hplugin.Plugin{ - "<%= Name %>": &plugin.InterfacePlugin{Impl: &app{}}, - } - hplugin.Serve(&hplugin.ServeConfig{ HandshakeConfig: plugin.HandshakeConfig(), - Plugins: pluginMap, + Plugins: map[string]hplugin.Plugin{ + "<%= Name %>": plugin.NewGRPC(&app{}), + }, + GRPCServer: hplugin.DefaultGRPCServer, }) } diff --git a/ignite/services/scaffolder/init.go b/ignite/services/scaffolder/init.go index 0c0d990c91..5e3b9000ae 100644 --- a/ignite/services/scaffolder/init.go +++ b/ignite/services/scaffolder/init.go @@ -9,7 +9,7 @@ import ( "github.com/gobuffalo/genny/v2" "github.com/ignite/cli/ignite/pkg/cache" - "github.com/ignite/cli/ignite/pkg/gocmd" + "github.com/ignite/cli/ignite/pkg/cosmosgen" "github.com/ignite/cli/ignite/pkg/gomodulepath" "github.com/ignite/cli/ignite/pkg/placeholder" "github.com/ignite/cli/ignite/pkg/xgit" @@ -116,6 +116,10 @@ func generate( return err } + if err := cosmosgen.InstallDepTools(ctx, absRoot); err != nil { + return err + } + // generate module template if !noDefaultModule { opts := &modulecreate.CreateOptions{ @@ -143,5 +147,6 @@ func generate( } } - return gocmd.ModTidy(ctx, absRoot) + + return nil } diff --git a/ignite/services/scaffolder/message.go b/ignite/services/scaffolder/message.go index cb32867f99..f475725dea 100644 --- a/ignite/services/scaffolder/message.go +++ b/ignite/services/scaffolder/message.go @@ -147,16 +147,6 @@ func (s Scaffolder) AddMessage( return sm, err } - gens, err = supportSimulation( - gens, - opts.AppPath, - opts.ModulePath, - opts.ModuleName, - ) - if err != nil { - return sm, err - } - // Scaffold g, err = message.NewGenerator(tracer, opts) if err != nil { diff --git a/ignite/services/scaffolder/module.go b/ignite/services/scaffolder/module.go index 4f90f03c70..c7f5729227 100644 --- a/ignite/services/scaffolder/module.go +++ b/ignite/services/scaffolder/module.go @@ -9,15 +9,15 @@ import ( "path/filepath" "strings" + evidencetypes "cosmossdk.io/x/evidence/types" + feegranttypes "cosmossdk.io/x/feegrant" + upgradetypes "cosmossdk.io/x/upgrade/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" authztypes "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - feegranttypes "github.com/cosmos/cosmos-sdk/x/feegrant" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" grouptypes "github.com/cosmos/cosmos-sdk/x/group" @@ -25,9 +25,9 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/gobuffalo/genny/v2" "github.com/ignite/cli/ignite/pkg/cache" @@ -46,6 +46,7 @@ const ( extrasVersion = "v0.1.0" appPkg = "app" moduleDir = "x" + modulePkg = "module" ) var ( diff --git a/ignite/services/scaffolder/packet.go b/ignite/services/scaffolder/packet.go index dd2095ada6..59e23a2890 100644 --- a/ignite/services/scaffolder/packet.go +++ b/ignite/services/scaffolder/packet.go @@ -149,12 +149,25 @@ func (s Scaffolder) AddPacket( // isIBCModule returns true if the provided module implements the IBC module interface // we naively check the existence of module_ibc.go for this check. func isIBCModule(appPath string, moduleName string) (bool, error) { - absPath, err := filepath.Abs(filepath.Join(appPath, moduleDir, moduleName, ibcModuleImplementation)) + absPath, err := filepath.Abs(filepath.Join(appPath, moduleDir, moduleName, modulePkg, ibcModuleImplementation)) if err != nil { return false, err } _, err = os.Stat(absPath) + if err != nil && !os.IsNotExist(err) { + return false, err + } else if err == nil { + // Is an IBC module + return true, err + } + + // check the legacy path + absPathLegacy, err := filepath.Abs(filepath.Join(appPath, moduleDir, moduleName, ibcModuleImplementation)) + if err != nil { + return false, err + } + _, err = os.Stat(absPathLegacy) if os.IsNotExist(err) { // Not an IBC module return false, nil diff --git a/ignite/services/scaffolder/patch.go b/ignite/services/scaffolder/patch.go index c8159145d9..b51d2c8e9c 100644 --- a/ignite/services/scaffolder/patch.go +++ b/ignite/services/scaffolder/patch.go @@ -10,50 +10,6 @@ import ( modulecreate "github.com/ignite/cli/ignite/templates/module/create" ) -// supportSimulation checks if module_simulation.go exists, -// appends the generator to create the file if it doesn't. -func supportSimulation( - gens []*genny.Generator, - appPath, - modulePath, - moduleName string, -) ([]*genny.Generator, error) { - simulation, err := modulecreate.AddSimulation( - appPath, - modulePath, - moduleName, - ) - if err != nil { - return gens, err - } - gens = append(gens, simulation) - return gens, nil -} - -// supportGenesisTests checks if types/genesis_test.go exists -// appends the generator to create the file if it doesn't. -func supportGenesisTests( - gens []*genny.Generator, - appPath, - appName, - modulePath, - moduleName string, - isIBC bool, -) ([]*genny.Generator, error) { - genesisTest, err := modulecreate.AddGenesisTest( - appPath, - appName, - modulePath, - moduleName, - isIBC, - ) - if err != nil { - return gens, err - } - gens = append(gens, genesisTest) - return gens, nil -} - // supportMsgServer checks if the module supports the MsgServer convention // appends the generator to support it if it doesn't // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-031-msg-service.md diff --git a/ignite/services/scaffolder/scaffolder.go b/ignite/services/scaffolder/scaffolder.go index 6caa944113..6a2dc82f61 100644 --- a/ignite/services/scaffolder/scaffolder.go +++ b/ignite/services/scaffolder/scaffolder.go @@ -76,10 +76,6 @@ func finish(ctx context.Context, cacheStorage cache.Storage, path, gomodPath str } func protoc(ctx context.Context, cacheStorage cache.Storage, projectPath, gomodPath string) error { - if err := cosmosgen.InstallDepTools(ctx, projectPath); err != nil { - return err - } - confpath, err := chainconfig.LocateDefault(projectPath) if err != nil { return err @@ -90,8 +86,8 @@ func protoc(ctx context.Context, cacheStorage cache.Storage, projectPath, gomodP } options := []cosmosgen.Option{ + cosmosgen.UpdateBufModule(), cosmosgen.WithGoGeneration(), - cosmosgen.WithPulsarGeneration(), cosmosgen.IncludeDirs(conf.Build.Proto.ThirdPartyPaths), } diff --git a/ignite/services/scaffolder/type.go b/ignite/services/scaffolder/type.go index 686bbba689..472b790d98 100644 --- a/ignite/services/scaffolder/type.go +++ b/ignite/services/scaffolder/type.go @@ -197,28 +197,6 @@ func (s Scaffolder) AddType( return sm, err } - gens, err = supportGenesisTests( - gens, - opts.AppPath, - opts.AppName, - opts.ModulePath, - opts.ModuleName, - opts.IsIBC, - ) - if err != nil { - return sm, err - } - - gens, err = supportSimulation( - gens, - opts.AppPath, - opts.ModulePath, - opts.ModuleName, - ) - if err != nil { - return sm, err - } - // create the type generator depending on the model switch { case o.isList: diff --git a/ignite/templates/app/files/.gitignore b/ignite/templates/app/files/.gitignore index 0d0535f6c6..c107251d56 100644 --- a/ignite/templates/app/files/.gitignore +++ b/ignite/templates/app/files/.gitignore @@ -4,3 +4,5 @@ release/ .idea/ .vscode/ .DS_Store +*.dot +*.log diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index 7b8eb4e661..cbcb43e814 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -1,14 +1,18 @@ package app import ( - _ "embed" - "io" - "os" - "path/filepath" + "io" + "os" + "path/filepath" "cosmossdk.io/depinject" - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + circuitkeeper "cosmossdk.io/x/circuit/keeper" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -18,63 +22,36 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/store/streaming" - storetypes "github.com/cosmos/cosmos-sdk/store/types" testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - "github.com/cosmos/cosmos-sdk/x/consensus" consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - "github.com/cosmos/cosmos-sdk/x/crisis" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" - "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" - ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" // this line is used by starport scaffolding # stargate/app/moduleImport @@ -86,55 +63,9 @@ const ( Name = "<%= BinaryNamePrefix %>" ) -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - authzmodule.AppModuleBasic{}, - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - groupmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - solomachine.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - ibctransfer.AppModuleBasic{}, - ica.AppModuleBasic{}, - vesting.AppModuleBasic{}, - consensus.AppModuleBasic{}, - // this line is used by starport scaffolding # stargate/app/moduleBasic - ) ) var ( @@ -152,13 +83,9 @@ type App struct { txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry - // non depinject support modules store keys - keys map[string]*storetypes.KVStoreKey - // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -172,9 +99,11 @@ type App struct { FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper ConsensusParamsKeeper consensuskeeper.Keeper + CircuitBreakerKeeper circuitkeeper.Keeper // IBC IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + CapabilityKeeper *capabilitykeeper.Keeper IBCFeeKeeper ibcfeekeeper.Keeper ICAControllerKeeper icacontrollerkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper @@ -201,6 +130,36 @@ func init() { DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } +// getGovProposalHandlers return the chain proposal handlers. +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers + + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) + + return govProposalHandlers +} + +// AppConfig returns the default app config. +func AppConfig() depinject.Config { + return depinject.Configs( + appConfig, + // Loads the ao config from a YAML file. + // appconfig.LoadYAML(AppConfigYAML), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + // this line is used by starport scaffolding # stargate/appConfig/moduleBasic + }, + ), + ) +} + // New returns a reference to an initialized App. func New( logger log.Logger, @@ -209,19 +168,25 @@ func New( loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) *App { +) (*App, error) { var ( app = &App{} appBuilder *runtime.AppBuilder // merge the AppConfig and other configuration in one config appConfig = depinject.Configs( - AppConfig, + AppConfig(), depinject.Supply( - // supply the application options + // Supply the application options appOpts, - // supply ibc keeper getter for the IBC modules - app.GetIBCeKeeper, + // Supply with IBC keeper getter for the IBC modules with App Wiring. + // The IBC Keeper cannot be passed because it has not been initiated yet. + // Passing the getter, the app IBC Keeper will always be accessible. + // This needs to be removed after IBC supports App Wiring. + app.GetIBCKeeper, + app.GetCapabilityScopedKeeper, + // Supply the logger + logger, // ADVANCED CONFIGURATION // @@ -231,11 +196,28 @@ func New( // add it below. By default the auth module uses simulation.RandomGenesisAccounts. // // authtypes.RandomGenesisAccountsFn(simulation.RandomGenesisAccounts), - + // // For providing a custom a base account type add it below. // By default the auth module uses authtypes.ProtoBaseAccount(). // - // func() authtypes.AccountI { return authtypes.ProtoBaseAccount() }, + // func() sdk.AccountI { return authtypes.ProtoBaseAccount() }, + // + // For providing a different address codec, add it below. + // By default the auth module uses a Bech32 address codec, + // with the prefix defined in the auth module configuration. + // + // func() address.Codec { return <- custom address codec type -> } + + // + // STAKING + // + // For provinding a different validator and consensus address codec, add it below. + // By default the staking module uses the bech32 prefix provided in the auth config, + // and appends "valoper" and "valcons" for validator and consensus addresses respectively. + // When providing a custom address codec in auth, custom address codecs must be provided here as well. + // + // func() runtime.ValidatorAddressCodec { return <- custom validator address codec type -> } + // func() runtime.ConsensusAddressCodec { return <- custom consensus address codec type -> } // // MINT @@ -256,7 +238,6 @@ func New( &app.interfaceRegistry, &app.AccountKeeper, &app.BankKeeper, - &app.CapabilityKeeper, &app.StakingKeeper, &app.SlashingKeeper, &app.MintKeeper, @@ -270,6 +251,7 @@ func New( &app.FeeGrantKeeper, &app.GroupKeeper, &app.ConsensusParamsKeeper, + &app.CircuitBreakerKeeper, // this line is used by starport scaffolding # stargate/app/keeperDefinition ); err != nil { panic(err) @@ -300,16 +282,21 @@ func New( // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) // } // baseAppOptions = append(baseAppOptions, prepareOpt) + // + // create and set vote extension handler + // voteExtOp := func(bApp *baseapp.BaseApp) { + // voteExtHandler := NewVoteExtensionHandler() + // voteExtHandler.SetHandlers(bApp) + // } - app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...) + app.App = appBuilder.Build(db, traceStore, baseAppOptions...) // Register legacy modules app.registerIBCModules() - // load state streaming if enabled - if _, _, err := streaming.LoadStreamingServices(app.App.BaseApp, appOpts, app.appCodec, logger, app.kvStoreKeys()); err != nil { - logger.Error("failed to load state streaming", "err", err) - os.Exit(1) + // register streaming services + if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { + return nil, err } /**** Module Options ****/ @@ -336,21 +323,18 @@ func New( // However, when registering a module manually (i.e. that does not support app wiring), the module version map // must be set manually as follow. The upgrade module will de-duplicate the module version map. // - // app.SetInitChainer(func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { + // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) // return app.App.InitChainer(ctx, req) // }) if err := app.Load(loadLatest); err != nil { - panic(err) + return nil, err } - return app + return app, nil } -// Name returns the name of the App -func (app *App) Name() string { return app.BaseApp.Name() } - // LegacyAmino returns App's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable @@ -367,28 +351,23 @@ func (app *App) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns App's InterfaceRegistry -func (app *App) InterfaceRegistry() codectypes.InterfaceRegistry { - return app.interfaceRegistry -} - -// TxConfig returns App's TxConfig -func (app *App) TxConfig() client.TxConfig { - return app.txConfig -} - // GetKey returns the KVStoreKey for the provided store key. func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { - if key, ok := app.keys[storeKey]; ok { - return key + kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey) + if !ok { + return nil } + return kvStoreKey +} - sk := app.UnsafeFindStoreKey(storeKey) - kvStoreKey, ok := sk.(*storetypes.KVStoreKey) +// GetMemKey returns the MemoryStoreKey for the provided store key. +func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) if !ok { return nil } - return kvStoreKey + + return key } // kvStoreKeys returns all the kv store keys registered inside App. @@ -400,10 +379,6 @@ func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { } } - for _, kv := range app.keys { - keys[kv.Name()] = kv - } - return keys } @@ -431,11 +406,16 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig docs.RegisterOpenAPIService(Name, apiSvr.Router) } -// GetIBCeKeeper returns the IBC keeper -func (app *App) GetIBCeKeeper() *ibckeeper.Keeper { +// GetIBCKeeper returns the IBC keeper. +func (app *App) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } +// GetCapabilityScopedKeeper returns the capability scoped keeper. +func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { + return app.CapabilityKeeper.ScopeToModule(moduleName) +} + // GetMaccPerms returns a copy of the module account permissions // // NOTE: This is solely to be used for testing purposes. diff --git a/ignite/templates/app/files/app/app_config.go.plush b/ignite/templates/app/files/app/app_config.go.plush index 0fd699bf99..8c0d34a74a 100644 --- a/ignite/templates/app/files/app/app_config.go.plush +++ b/ignite/templates/app/files/app/app_config.go.plush @@ -8,7 +8,7 @@ import ( authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" - capabilitymodulev1 "cosmossdk.io/api/cosmos/capability/module/v1" + circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" @@ -25,28 +25,50 @@ import ( upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/core/appconfig" + _ "cosmossdk.io/x/circuit" // import for side-effects + circuittypes "cosmossdk.io/x/circuit/types" + _ "cosmossdk.io/x/evidence" // import for side-effects + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + _ "cosmossdk.io/x/feegrant/module" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/runtime" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/authz" + _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/group" + _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "google.golang.org/protobuf/types/known/durationpb" // this line is used by starport scaffolding # stargate/app/moduleImport @@ -60,28 +82,32 @@ var ( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder = []string{ + // cosmos-sdk/ibc modules capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, - ibcexported.ModuleName, - ibctransfertypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, feegrant.ModuleName, - group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - consensustypes.ModuleName, + circuittypes.ModuleName, + group.ModuleName, + consensusparamtypes.ModuleName, + circuittypes.ModuleName, + // chain modules // this line is used by starport scaffolding # stargate/app/initGenesis } @@ -91,70 +117,58 @@ var ( // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) beginBlockers = []string{ - upgradetypes.ModuleName, - capabilitytypes.ModuleName, + // cosmos sdk modules minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, stakingtypes.ModuleName, + authz.ModuleName, + genutiltypes.ModuleName, + // ibc modules + capabilitytypes.ModuleName, ibcexported.ModuleName, - authtypes.ModuleName, - ibctransfertypes.ModuleName, - banktypes.ModuleName, - govtypes.ModuleName, - crisistypes.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, - genutiltypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - vestingtypes.ModuleName, - icatypes.ModuleName, ibcfeetypes.ModuleName, - consensustypes.ModuleName, + // chain modules // this line is used by starport scaffolding # stargate/app/beginBlockers } endBlockers = []string{ + // cosmos sdk modules crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, + feegrant.ModuleName, + group.ModuleName, + genutiltypes.ModuleName, + // ibc modules ibcexported.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - minttypes.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - feegrant.ModuleName, - group.ModuleName, - paramstypes.ModuleName, - consensustypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, - consensustypes.ModuleName, + // chain modules // this line is used by starport scaffolding # stargate/app/endBlockers } + preBlockers = []string{ + upgradetypes.ModuleName, + // this line is used by starport scaffolding # stargate/app/preBlockers + } + // module account permissions moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ {Account: authtypes.FeeCollectorName}, {Account: distrtypes.ModuleName}, - {Account: icatypes.ModuleName}, {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, + {Account: ibcfeetypes.ModuleName}, + {Account: icatypes.ModuleName}, // this line is used by starport scaffolding # stargate/app/maccPerms } @@ -169,22 +183,23 @@ var ( // govtypes.ModuleName } - // AppConfig application configuration (used by depinject) - AppConfig = appconfig.Compose(&appv1alpha1.Config{ + // appConfig application configuration (used by depinject) + appConfig = appconfig.Compose(&appv1alpha1.Config{ Modules: []*appv1alpha1.ModuleConfig{ { - Name: "runtime", + Name: runtime.ModuleName, Config: appconfig.WrapAny(&runtimev1alpha1.Module{ AppName: Name, + PreBlockers: preBlockers, BeginBlockers: beginBlockers, EndBlockers: endBlockers, + InitGenesis: genesisModuleOrder, OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ { ModuleName: authtypes.ModuleName, KvStoreKey: "acc", }, }, - InitGenesis: genesisModuleOrder, // When ExportGenesis is not specified, the export genesis module order // is equal to the init genesis order // ExportGenesis: genesisModuleOrder, @@ -195,7 +210,7 @@ var ( { Name: authtypes.ModuleName, Config: appconfig.WrapAny(&authmodulev1.Module{ - Bech32Prefix: "cosmos", + Bech32Prefix: AccountAddressPrefix, ModuleAccountPermissions: moduleAccPerms, // By default modules authority is the governance module. This is configurable with the following: // Authority: "group", // A custom module authority can be set using a module name @@ -213,74 +228,77 @@ var ( }), }, { - Name: stakingtypes.ModuleName, - Config: appconfig.WrapAny(&stakingmodulev1.Module{}), - }, - { - Name: slashingtypes.ModuleName, - Config: appconfig.WrapAny(&slashingmodulev1.Module{}), - }, - { - Name: paramstypes.ModuleName, - Config: appconfig.WrapAny(¶msmodulev1.Module{}), - }, - { - Name: "tx", - Config: appconfig.WrapAny(&txconfigv1.Config{}), - }, - { - Name: genutiltypes.ModuleName, - Config: appconfig.WrapAny(&genutilmodulev1.Module{}), - }, - { - Name: authz.ModuleName, - Config: appconfig.WrapAny(&authzmodulev1.Module{}), - }, - { - Name: upgradetypes.ModuleName, - Config: appconfig.WrapAny(&upgrademodulev1.Module{}), - }, - { - Name: distrtypes.ModuleName, - Config: appconfig.WrapAny(&distrmodulev1.Module{}), - }, - { - Name: capabilitytypes.ModuleName, - Config: appconfig.WrapAny(&capabilitymodulev1.Module{ - SealKeeper: true, + Name: stakingtypes.ModuleName, + Config: appconfig.WrapAny(&stakingmodulev1.Module{ + // NOTE: specifying a prefix is only necessary when using bech32 addresses + // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default + Bech32PrefixValidator: AccountAddressPrefix + "valoper", + Bech32PrefixConsensus: AccountAddressPrefix + "valcons", }), }, { - Name: evidencetypes.ModuleName, - Config: appconfig.WrapAny(&evidencemodulev1.Module{}), - }, - { - Name: minttypes.ModuleName, - Config: appconfig.WrapAny(&mintmodulev1.Module{}), - }, - { - Name: group.ModuleName, - Config: appconfig.WrapAny(&groupmodulev1.Module{ - MaxExecutionPeriod: durationpb.New(time.Second * 1209600), - MaxMetadataLen: 255, - }), - }, - { - Name: feegrant.ModuleName, - Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), - }, - { - Name: govtypes.ModuleName, - Config: appconfig.WrapAny(&govmodulev1.Module{}), - }, - { - Name: crisistypes.ModuleName, - Config: appconfig.WrapAny(&crisismodulev1.Module{}), - }, - { - Name: consensustypes.ModuleName, - Config: appconfig.WrapAny(&consensusmodulev1.Module{}), - }, + Name: slashingtypes.ModuleName, + Config: appconfig.WrapAny(&slashingmodulev1.Module{}), + }, + { + Name: paramstypes.ModuleName, + Config: appconfig.WrapAny(¶msmodulev1.Module{}), + }, + { + Name: "tx", + Config: appconfig.WrapAny(&txconfigv1.Config{}), + }, + { + Name: genutiltypes.ModuleName, + Config: appconfig.WrapAny(&genutilmodulev1.Module{}), + }, + { + Name: authz.ModuleName, + Config: appconfig.WrapAny(&authzmodulev1.Module{}), + }, + { + Name: upgradetypes.ModuleName, + Config: appconfig.WrapAny(&upgrademodulev1.Module{}), + }, + { + Name: distrtypes.ModuleName, + Config: appconfig.WrapAny(&distrmodulev1.Module{}), + }, + { + Name: evidencetypes.ModuleName, + Config: appconfig.WrapAny(&evidencemodulev1.Module{}), + }, + { + Name: minttypes.ModuleName, + Config: appconfig.WrapAny(&mintmodulev1.Module{}), + }, + { + Name: group.ModuleName, + Config: appconfig.WrapAny(&groupmodulev1.Module{ + MaxExecutionPeriod: durationpb.New(time.Second * 1209600), + MaxMetadataLen: 255, + }), + }, + { + Name: feegrant.ModuleName, + Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), + }, + { + Name: govtypes.ModuleName, + Config: appconfig.WrapAny(&govmodulev1.Module{}), + }, + { + Name: crisistypes.ModuleName, + Config: appconfig.WrapAny(&crisismodulev1.Module{}), + }, + { + Name: consensustypes.ModuleName, + Config: appconfig.WrapAny(&consensusmodulev1.Module{}), + }, + { + Name: circuittypes.ModuleName, + Config: appconfig.WrapAny(&circuitmodulev1.Module{}), + }, // this line is used by starport scaffolding # stargate/app/moduleConfig }, }) diff --git a/ignite/templates/app/files/app/encoding.go.plush b/ignite/templates/app/files/app/encoding.go.plush deleted file mode 100644 index ab4dc16f89..0000000000 --- a/ignite/templates/app/files/app/encoding.go.plush +++ /dev/null @@ -1,35 +0,0 @@ -package app - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/x/auth/tx" - - "<%= ModulePath %>/app/params" -) - -// makeEncodingConfig creates an EncodingConfig for an amino based test configuration. -func makeEncodingConfig() params.EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(cdc, tx.DefaultSignModes) - - return params.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: cdc, - TxConfig: txCfg, - Amino: amino, - } -} - -// MakeEncodingConfig creates an EncodingConfig for testing -func MakeEncodingConfig() params.EncodingConfig { - encodingConfig := makeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} diff --git a/ignite/templates/app/files/app/export.go.plush b/ignite/templates/app/files/app/export.go.plush index 59e2c38424..21203b274e 100644 --- a/ignite/templates/app/files/app/export.go.plush +++ b/ignite/templates/app/files/app/export.go.plush @@ -5,7 +5,8 @@ import ( "fmt" "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -15,19 +16,23 @@ import ( // ExportAppStateAndValidators exports the state of the application for a genesis // file. -func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error) { +func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which - // Tendermint will start InitChain. + // CometBFT will start InitChain. height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -45,7 +50,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // -// in favour of export at a block height +// in favor of export at a block height func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -70,13 +75,24 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) return false }) + if err != nil { + panic(err) + } // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -99,14 +115,26 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil { + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { panic(err) } return false @@ -141,7 +169,10 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetRedelegation(ctx, red) + err = app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } return false }) @@ -150,20 +181,23 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + if err != nil { + panic(err) + } return false }) // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -181,7 +215,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str return } - _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } diff --git a/ignite/templates/app/files/app/genesis.go.plush b/ignite/templates/app/files/app/genesis.go.plush index 5bf0c1da80..e4e849fc27 100644 --- a/ignite/templates/app/files/app/genesis.go.plush +++ b/ignite/templates/app/files/app/genesis.go.plush @@ -2,11 +2,9 @@ package app import ( "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" ) -// The genesis state of the blockchain is represented here as a map of raw json +// GenesisState of the blockchain is represented here as a map of raw json // messages key'd by a identifier string. // The identifier is used to determine which module genesis information belongs // to so it may be appropriately routed during init chain. @@ -14,8 +12,3 @@ import ( // the ModuleBasicManager which populates json from each BasicModule // object provided to it during init. type GenesisState map[string]json.RawMessage - -// NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) -} diff --git a/ignite/templates/app/files/app/genesis_account.go.plush b/ignite/templates/app/files/app/genesis_account.go.plush new file mode 100644 index 0000000000..91ff4dfc42 --- /dev/null +++ b/ignite/templates/app/files/app/genesis_account.go.plush @@ -0,0 +1,47 @@ +package app + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +var _ authtypes.GenesisAccount = (*GenesisAccount)(nil) + +// GenesisAccount defines a type that implements the GenesisAccount interface +// to be used for simulation accounts in the genesis state. +type GenesisAccount struct { + *authtypes.BaseAccount + + // vesting account fields + OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // total vesting coins upon initialization + DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // delegated vested coins at time of delegation + DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // delegated vesting coins at time of delegation + StartTime int64 `json:"start_time" yaml:"start_time"` // vesting start time (UNIX Epoch time) + EndTime int64 `json:"end_time" yaml:"end_time"` // vesting end time (UNIX Epoch time) + + // module account fields + ModuleName string `json:"module_name" yaml:"module_name"` // name of the module account + ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account +} + +// Validate checks for errors on the vesting and module account parameters +func (sga GenesisAccount) Validate() error { + if !sga.OriginalVesting.IsZero() { + if sga.StartTime >= sga.EndTime { + return errors.New("vesting start-time cannot be before end-time") + } + } + + if sga.ModuleName != "" { + ma := authtypes.ModuleAccount{ + BaseAccount: sga.BaseAccount, Name: sga.ModuleName, Permissions: sga.ModulePermissions, + } + if err := ma.Validate(); err != nil { + return err + } + } + + return sga.BaseAccount.Validate() +} diff --git a/ignite/templates/app/files/app/ibc.go.plush b/ignite/templates/app/files/app/ibc.go.plush index 485b160784..2fa1ea3766 100644 --- a/ignite/templates/app/files/app/ibc.go.plush +++ b/ignite/templates/app/files/app/ibc.go.plush @@ -1,53 +1,72 @@ package app import ( - sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/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" + icamodule "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" // this line is used by starport scaffolding # ibc/app/import ) +// registerIBCModules register IBC keepers and non dependency inject modules. func (app *App) registerIBCModules() { // set up non depinject support modules store keys - app.keys = sdk.NewKVStoreKeys( - ibcexported.StoreKey, - ibctransfertypes.StoreKey, - ibcfeetypes.StoreKey, - icahosttypes.StoreKey, - icacontrollertypes.StoreKey, - ) - app.MountKVStores(app.keys) - - // set params subspaces - for _, m := range []string{ibctransfertypes.ModuleName, ibcexported.ModuleName, icahosttypes.SubModuleName, icacontrollertypes.SubModuleName} { - app.ParamsKeeper.Subspace(m) + if err := app.RegisterStores( + storetypes.NewKVStoreKey(capabilitytypes.StoreKey), + storetypes.NewKVStoreKey(ibcexported.StoreKey), + storetypes.NewKVStoreKey(ibctransfertypes.StoreKey), + storetypes.NewKVStoreKey(ibcfeetypes.StoreKey), + storetypes.NewKVStoreKey(icahosttypes.StoreKey), + storetypes.NewKVStoreKey(icacontrollertypes.StoreKey), + storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey), + storetypes.NewTransientStoreKey(paramstypes.TStoreKey), + ); err != nil { + panic(err) } + // register the key tables for legacy param subspaces + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + app.ParamsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) + app.ParamsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) + + // add capability keeper and ScopeToModule for ibc module + app.CapabilityKeeper = capabilitykeeper.NewKeeper( + app.AppCodec(), + app.GetKey(capabilitytypes.StoreKey), + app.GetMemKey(capabilitytypes.MemStoreKey), + ) + // add capability keeper and ScopeToModule for ibc module scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedIBCTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) @@ -56,7 +75,13 @@ func (app *App) registerIBCModules() { // Create IBC keeper app.IBCKeeper = ibckeeper.NewKeeper( - app.appCodec, app.GetKey(ibcexported.StoreKey), app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + app.appCodec, + app.GetKey(ibcexported.StoreKey), + app.GetSubspace(ibcexported.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, + scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Register the proposal types @@ -64,15 +89,13 @@ func (app *App) registerIBCModules() { // by granting the governance module the right to execute the message. // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler) app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( app.appCodec, app.GetKey(ibcfeetypes.StoreKey), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, ) // Create IBC transfer keeper @@ -80,12 +103,13 @@ func (app *App) registerIBCModules() { app.appCodec, app.GetKey(ibctransfertypes.StoreKey), app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, scopedIBCTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Create interchain account keepers @@ -95,10 +119,11 @@ func (app *App) registerIBCModules() { app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( app.appCodec, @@ -106,9 +131,10 @@ func (app *App) registerIBCModules() { app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, scopedICAControllerKeeper, app.MsgServiceRouter(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.GovKeeper.SetLegacyRouter(govRouter) @@ -116,11 +142,11 @@ func (app *App) registerIBCModules() { transferIBCModule := ibcfee.NewIBCMiddleware(ibctransfer.NewIBCModule(app.TransferKeeper), app.IBCFeeKeeper) // integration point for custom authentication modules - var noAuthzModule porttypes.IBCModule - icaControllerIBCModule := ibcfee.NewIBCMiddleware( - icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper), - app.IBCFeeKeeper, - ) + var noAuthzModule porttypes.IBCModule + icaControllerIBCModule := ibcfee.NewIBCMiddleware( + icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper), + app.IBCFeeKeeper, + ) icaHostIBCModule := ibcfee.NewIBCMiddleware(icahost.NewIBCModule(app.ICAHostKeeper), app.IBCFeeKeeper) @@ -130,35 +156,34 @@ func (app *App) registerIBCModules() { AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) - // this line is used by starport scaffolding # ibc/app/module + // this line is used by starport scaffolding # ibc/app/module app.IBCKeeper.SetRouter(ibcRouter) - // NOTE: Any module instantiated in the module manager that is later modified - // must be passed by reference here. - legacyModules := []module.AppModule{ + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + + // register IBC modules + if err := app.RegisterModules( ibc.NewAppModule(app.IBCKeeper), ibctransfer.NewAppModule(app.TransferKeeper), ibcfee.NewAppModule(app.IBCFeeKeeper), - ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), - } - if err := app.RegisterModules(legacyModules...); err != nil { + icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), + capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), + ibctm.AppModule{}, + solomachine.AppModule{}, + ); err != nil { panic(err) } +} - cfg := app.Configurator() - for _, m := range legacyModules { - if s, ok := m.(module.HasServices); ok { - s.RegisterServices(cfg) - } - } - - // register additional types - ibctm.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) - solomachine.AppModuleBasic{}.RegisterInterfaces(app.interfaceRegistry) - - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper +// AddIBCModuleManager adds the missing IBC modules into the module manager. +func AddIBCModuleManager(moduleManager module.BasicManager) { + moduleManager[ibcexported.ModuleName] = ibc.AppModule{} + moduleManager[ibctransfertypes.ModuleName] = ibctransfer.AppModule{} + moduleManager[ibcfeetypes.ModuleName] = ibcfee.AppModule{} + moduleManager[icatypes.ModuleName] = icamodule.AppModule{} + moduleManager[capabilitytypes.ModuleName] = capability.AppModule{} } diff --git a/ignite/templates/app/files/app/params/encoding.go.plush b/ignite/templates/app/files/app/params/encoding.go.plush deleted file mode 100644 index 8ff9ea04b3..0000000000 --- a/ignite/templates/app/files/app/params/encoding.go.plush +++ /dev/null @@ -1,16 +0,0 @@ -package params - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Codec codec.Codec - TxConfig client.TxConfig - Amino *codec.LegacyAmino -} diff --git a/ignite/templates/app/files/app/sim_bench_test.go.plush b/ignite/templates/app/files/app/sim_bench_test.go.plush index e655bbfc3e..4609b99d76 100644 --- a/ignite/templates/app/files/app/sim_bench_test.go.plush +++ b/ignite/templates/app/files/app/sim_bench_test.go.plush @@ -5,7 +5,7 @@ import ( "os" "testing" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -43,7 +43,8 @@ func BenchmarkFullAppSimulation(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) require.Equal(b, app.Name, bApp.Name()) // run randomized simulation @@ -99,7 +100,8 @@ func BenchmarkInvariants(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) + require.NoError(b, err) require.Equal(b, app.Name, bApp.Name()) // run randomized simulation @@ -128,7 +130,7 @@ func BenchmarkInvariants(b *testing.B) { simtestutil.PrintStats(db) } - ctx := bApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight() + 1}) + ctx := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight() + 1}) // 3. Benchmark each invariant separately // diff --git a/ignite/templates/app/files/app/sim_test.go.plush b/ignite/templates/app/files/app/sim_test.go.plush index c5ec93e895..a490c2fc54 100644 --- a/ignite/templates/app/files/app/sim_test.go.plush +++ b/ignite/templates/app/files/app/sim_test.go.plush @@ -2,6 +2,7 @@ package app_test import ( "encoding/json" + "flag" "fmt" "math/rand" "os" @@ -10,31 +11,24 @@ import ( "testing" "time" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/feegrant" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" simulationtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/spf13/viper" "github.com/stretchr/testify/require" "<%= ModulePath %>/app" @@ -44,15 +38,12 @@ const ( SimAppChainID = "<%= BinaryNamePrefix %>-simapp" ) -type StoreKeysPrefixes struct { - A storetypes.StoreKey - B storetypes.StoreKey - Prefixes [][]byte -} +var FlagEnableStreamingValue bool // Get flags every time the simulator is run func init() { simcli.GetSimulatorFlags() + flag.BoolVar(&FlagEnableStreamingValue, "EnableStreaming", false, "Enable streaming service") } // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of @@ -96,7 +87,8 @@ func BenchmarkSimulation(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(b, err) require.Equal(b, app.Name, bApp.Name()) // run randomized simulation @@ -141,7 +133,8 @@ func TestAppImportExport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) require.Equal(t, app.Name, bApp.Name()) // Run randomized simulation @@ -181,60 +174,63 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, app.Name, newApp.Name()) + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) var genesisState app.GenesisState err = json.Unmarshal(exported.AppState, &genesisState) require.NoError(t, err) - defer func() { - if r := recover(); r != nil { - err := fmt.Sprintf("%v", r) - if !strings.Contains(err, "validator set is empty after InitGenesis") { - panic(r) - } + ctxA := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) + _, err = newApp.ModuleManager.InitGenesis(ctxB, bApp.AppCodec(), genesisState) + + if err != nil { + if strings.Contains(err.Error(), "validator set is empty after InitGenesis") { logger.Info("Skipping simulation as all validators have been unbonded") logger.Info("err", err, "stacktrace", string(debug.Stack())) + return } - }() - - ctxA := bApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: bApp.LastBlockHeight()}) - newApp.ModuleManager.InitGenesis(ctxB, bApp.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - + } + require.NoError(t, err) + err = newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) + require.NoError(t, err) fmt.Printf("comparing stores...\n") - storeKeysPrefixes := []StoreKeysPrefixes{ - {bApp.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, - { - bApp.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, - }, - }, // ordering may change but it doesn't matter - {bApp.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}}, - {bApp.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}}, - {bApp.GetKey(paramstypes.StoreKey), newApp.GetKey(paramstypes.StoreKey), [][]byte{}}, - {bApp.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, - {bApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {bApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {bApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, + // skip certain prefixes + skipPrefixes := map[string][][]byte{ + stakingtypes.StoreKey: { + stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, + stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, + }, + authzkeeper.StoreKey: {authzkeeper.GrantQueuePrefix}, + feegrant.StoreKey: {feegrant.FeeAllowanceQueueKeyPrefix}, + slashingtypes.StoreKey: {slashingtypes.ValidatorMissedBlockBitmapKeyPrefix}, } - for _, skp := range storeKeysPrefixes { - storeA := ctxA.KVStore(skp.A) - storeB := ctxB.KVStore(skp.B) + storeKeys := bApp.GetStoreKeys() + require.NotEmpty(t, storeKeys) + + for _, appKeyA := range storeKeys { + // only compare kvstores + if _, ok := appKeyA.(*storetypes.KVStoreKey); !ok { + continue + } + + keyName := appKeyA.Name() + appKeyB := newApp.GetKey(keyName) - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) - require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") + storeA := ctxA.KVStore(appKeyA) + storeB := ctxB.KVStore(appKeyB) - fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skipPrefixes[keyName]) + require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare %s", keyName) + + fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), appKeyA, appKeyB) + + require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(keyName, bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) } } @@ -257,8 +253,9 @@ func TestAppSimulationAfterImport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, app.Name, bApp.Name()) + bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, bApp.Name()) // Run randomized simulation stopEarly, simParams, simErr := simulation.SimulateFromSeed( @@ -302,13 +299,15 @@ func TestAppSimulationAfterImport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, app.Name, newApp.Name()) + newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) + require.NoError(t, err) + require.Equal(t, app.Name, newApp.Name()) - newApp.InitChain(abci.RequestInitChain{ - ChainId: SimAppChainID, + _, err = newApp.InitChain(&abci.RequestInitChain{ AppStateBytes: exported.AppState, + ChainId: SimAppChainID, }) + require.NoError(t, err) _, _, err = simulation.SimulateFromSeed( t, @@ -336,17 +335,29 @@ func TestAppStateDeterminism(t *testing.T) { config.AllInvariants = true numSeeds := 3 - numTimesToRunPerSeed := 5 + numTimesToRunPerSeed := 3 // This used to be set to 5, but we've temporarily reduced it to 3 for the sake of faster CI. + appHashList := make([]json.RawMessage, numTimesToRunPerSeed) // We will be overriding the random seed and just run a single simulation on the provided seed value if config.Seed != simcli.DefaultSeedValue { numSeeds = 1 } - appHashList := make([]json.RawMessage, numTimesToRunPerSeed) - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = app.DefaultNodeHome - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue + appOptions := viper.New() + if FlagEnableStreamingValue { + m := make(map[string]interface{}) + m["streaming.abci.keys"] = []string{"*"} + m["streaming.abci.plugin"] = "abci_v1" + m["streaming.abci.stop-node-on-err"] = true + for key, value := range m { + appOptions.SetDefault(key, value) + } + } + appOptions.SetDefault(flags.FlagHome, app.DefaultNodeHome) + appOptions.SetDefault(server.FlagInvCheckPeriod, simcli.FlagPeriodValue) + if simcli.FlagVerboseValue { + appOptions.SetDefault(flags.FlagLogLevel, "debug") + } for i := 0; i < numSeeds; i++ { if config.Seed == simcli.DefaultSeedValue { @@ -357,7 +368,7 @@ func TestAppStateDeterminism(t *testing.T) { for j := 0; j < numTimesToRunPerSeed; j++ { var logger log.Logger if simcli.FlagVerboseValue { - logger = log.TestingLogger() + logger = log.NewTestLogger(t) } else { logger = log.NewNopLogger() } @@ -365,7 +376,7 @@ func TestAppStateDeterminism(t *testing.T) { config.ChainID = chainID db := dbm.NewMemDB() - bApp := app.New( + bApp, err := app.New( logger, db, nil, @@ -374,20 +385,21 @@ func TestAppStateDeterminism(t *testing.T) { interBlockCacheOpt(), baseapp.SetChainID(chainID), ) + require.NoError(t, err) fmt.Printf( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) - _, _, err := simulation.SimulateFromSeed( + _, _, err = simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, simtestutil.AppStateFn( bApp.AppCodec(), bApp.SimulationManager(), - app.NewDefaultGenesisState(bApp.AppCodec()), + bApp.DefaultGenesis(), ), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush new file mode 100644 index 0000000000..8bb54e2f73 --- /dev/null +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/commands.go.plush @@ -0,0 +1,191 @@ +package cmd + +import ( + "errors" + "io" + + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/debug" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/types/module" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "<%= ModulePath %>/app" +) + +func initRootCmd( + rootCmd *cobra.Command, + txConfig client.TxConfig, + interfaceRegistry codectypes.InterfaceRegistry, + appCodec codec.Codec, + basicManager module.BasicManager, +) { + rootCmd.AddCommand( + genutilcli.InitCmd(basicManager, app.DefaultNodeHome), + debug.Cmd(), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), + ) + + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + + // add keybase, auxiliary RPC, query, genesis, and tx child commands + rootCmd.AddCommand( + server.StatusCommand(), + genesisCommand(txConfig, basicManager), + queryCommand(), + txCommand(), + keys.Commands(), + ) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `<%= BinaryNamePrefix %>d genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + rpc.QueryEventForTxCmd(), + rpc.ValidatorCommand(), + server.QueryBlockCmd(), + authcmd.QueryTxsByEventsCmd(), + server.QueryBlocksCmd(), + authcmd.QueryTxCmd(), + server.QueryBlockResultsCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + authcmd.GetSimulateCmd(), + ) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +// newApp creates the application +func newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + baseappOptions := server.DefaultBaseappOptions(appOpts) + + app, err := app.New( + logger, db, traceStore, true, + appOpts, + baseappOptions..., + ) + if err != nil { + panic(err) + } + return app +} + +// appExport creates a new app (optionally at a given height) and exports state. +func appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var ( + bApp *app.App + err error + ) + + // this check is necessary as we use the flag in x/upgrade. + // we can exit more gracefully by checking the flag here. + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home not set") + } + + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + if height != -1 { + bApp, err = app.New(logger, db, traceStore, false, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + + if err := bApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } else { + bApp, err = app.New(logger, db, traceStore, true, appOpts) + if err != nil { + return servertypes.ExportedApp{}, err + } + } + + return bApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} \ No newline at end of file diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush index 580a6ae7de..87989cd04d 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/config.go.plush @@ -1,6 +1,8 @@ package cmd import ( + cmtcfg "github.com/cometbft/cometbft/config" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" "<%= ModulePath %>/app" @@ -21,3 +23,59 @@ func initSDKConfig() { config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) config.Seal() } + +// initCometBFTConfig helps to override default CometBFT Config values. +// return cmtcfg.DefaultConfig if no custom configuration is required for the application. +func initCometBFTConfig() *cmtcfg.Config { + cfg := cmtcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + type CustomAppConfig struct { + serverconfig.Config `mapstructure:",squash"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In tests, we set the min gas prices to 0. + // srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + // Edit the default template file + // + // customAppTemplate := serverconfig.DefaultConfigTemplate + ` + // [wasm] + // # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries + // query_gas_limit = 300000 + // # This is the number of wasm vm instances we keep cached in memory for speed-up + // # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally + // lru_size = 0` + + return customAppTemplate, customAppConfig +} diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush deleted file mode 100644 index d5ec65337f..0000000000 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/genaccounts.go.plush +++ /dev/null @@ -1,192 +0,0 @@ -package cmd - -import ( - "bufio" - "encoding/json" - "errors" - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cobra" -) - -const ( - flagVestingStart = "vesting-start-time" - flagVestingEnd = "vesting-end-time" - flagVestingAmt = "vesting-amount" -) - -// AddGenesisAccountCmd returns add-genesis-account cobra Command. -func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", - Short: "Add a genesis account to genesis.json", - Long: `Add a genesis account to genesis.json. The provided account must specify -the account address or key name and a list of initial coins. If a key name is given, -the address will be looked up in the local Keybase. The list of initial tokens must -contain valid denominations. Accounts may optionally be supplied with vesting parameters. -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - cdc := clientCtx.Codec - - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - coins, err := sdk.ParseCoinsNormalized(args[1]) - if err != nil { - return fmt.Errorf("failed to parse coins: %w", err) - } - - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - inBuf := bufio.NewReader(cmd.InOrStdin()) - keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend) - if err != nil { - return err - } - - // attempt to lookup address from Keybase if no address was provided - kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf, cdc) - if err != nil { - return err - } - - info, err := kb.Key(args[0]) - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - - addr, err = info.GetAddress() - if err != nil { - return fmt.Errorf("failed to get address from Keybase: %w", err) - } - } - - vestingStart, err := cmd.Flags().GetInt64(flagVestingStart) - if err != nil { - return err - } - vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd) - if err != nil { - return err - } - vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt) - if err != nil { - return err - } - - vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr) - if err != nil { - return fmt.Errorf("failed to parse vesting amount: %w", err) - } - - // create concrete account type based on input parameters - var genAccount authtypes.GenesisAccount - - balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()} - baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) - - if !vestingAmt.IsZero() { - baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) - - if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || - baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { - return errors.New("vesting amount cannot be greater than total amount") - } - - switch { - case vestingStart != 0 && vestingEnd != 0: - genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) - - case vestingEnd != 0: - genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount) - - default: - return errors.New("invalid vesting parameters; must supply start and end time or end time") - } - } else { - genAccount = baseAccount - } - - if err := genAccount.Validate(); err != nil { - return fmt.Errorf("failed to validate new genesis account: %w", err) - } - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) - - accs, err := authtypes.UnpackAccounts(authGenState.Accounts) - if err != nil { - return fmt.Errorf("failed to get accounts from any: %w", err) - } - - if accs.Contains(addr) { - return fmt.Errorf("cannot add account at existing address %s", addr) - } - - // Add the new account to the set of genesis accounts and sanitize the - // accounts afterwards. - accs = append(accs, genAccount) - accs = authtypes.SanitizeGenesisAccounts(accs) - - genAccs, err := authtypes.PackAccounts(accs) - if err != nil { - return fmt.Errorf("failed to convert accounts into any's: %w", err) - } - authGenState.Accounts = genAccs - - authGenStateBz, err := cdc.MarshalJSON(&authGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[authtypes.ModuleName] = authGenStateBz - - bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState) - bankGenState.Balances = append(bankGenState.Balances, balances) - bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances) - - bankGenStateBz, err := cdc.MarshalJSON(bankGenState) - if err != nil { - return fmt.Errorf("failed to marshal bank genesis state: %w", err) - } - - appState[banktypes.ModuleName] = bankGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush index 8e4c0b9308..9015b89c31 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -1,197 +1,125 @@ package cmd import ( - "errors" - "io" "os" "strings" - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/client/v2/autocli" + clientv2keyring "cosmossdk.io/client/v2/autocli/keyring" + "cosmossdk.io/core/address" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/pflag" "<%= ModulePath %>/app" - appparams "<%= ModulePath %>/app/params" ) -// NewRootCmd creates a new root command for a Cosmos SDK application -func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Codec). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(app.DefaultNodeHome). - WithViper("") +// NewRootCmd creates a new root command for <%= BinaryNamePrefix %>d. It is called once in the main function. +func NewRootCmd() *cobra.Command { + initSDKConfig() + + var ( + txConfigOpts tx.ConfigOptions + autoCliOpts autocli.AppOptions + moduleBasicManager module.BasicManager + clientCtx client.Context + ) + + if err := depinject.Inject( + depinject.Configs(app.AppConfig(), + depinject.Supply( + log.NewNopLogger(), + ), + depinject.Provide( + ProvideClientContext, + ProvideKeyring, + ), + ), + &txConfigOpts, + &autoCliOpts, + &moduleBasicManager, + &clientCtx, + ); err != nil { + panic(err) + } + // Since the IBC modules don't support dependency injection, we need to + // manually add the modules to the basic manager on the client side. + // This needs to be removed after IBC supports App Wiring. + app.AddIBCModuleManager(moduleBasicManager) rootCmd := &cobra.Command{ Use: app.Name + "d", Short: "Start <%= AppName %> node", + SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) cmd.SetErr(cmd.ErrOrStderr()) - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + + clientCtx = clientCtx.WithCmdContext(cmd.Context()) + clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags()) if err != nil { return err } - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + + clientCtx, err = config.ReadFromClientConfig(clientCtx) + if err != nil { + return err + } + + // This needs to go after ReadFromClientConfig, as that function + // sets the RPC client needed for SIGN_MODE_TEXTUAL. + txConfigOpts.EnabledSignModes = append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) + txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + codec.NewProtoCodec(clientCtx.InterfaceRegistry), + txConfigOpts, + ) if err != nil { return err } - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { return err } customAppTemplate, customAppConfig := initAppConfig() - customTMConfig := initTendermintConfig() - return server.InterceptConfigsPreRunHandler( - cmd, customAppTemplate, customAppConfig, customTMConfig, - ) + customCMTConfig := initCometBFTConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) }, } - initRootCmd(rootCmd, encodingConfig) + initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager) + overwriteFlagDefaults(rootCmd, map[string]string{ flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), flags.FlagKeyringBackend: "test", }) - return rootCmd, encodingConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.DefaultConfig() - return cfg -} - -func initRootCmd( - rootCmd *cobra.Command, - encodingConfig appparams.EncodingConfig, -) { - // Set config - initSDKConfig() - - gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) - rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), - genutilcli.MigrateGenesisCmd(), - genutilcli.GenTxCmd( - app.ModuleBasics, - encodingConfig.TxConfig, - banktypes.GenesisBalancesIterator{}, - app.DefaultNodeHome, - ), - genutilcli.ValidateGenesisCmd(app.ModuleBasics), - AddGenesisAccountCmd(app.DefaultNodeHome), - tmcli.NewCompletionCmd(rootCmd, true), - debug.Cmd(), - config.Cmd(), - ) - - a := appCreator{ - encodingConfig, + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) } - // add server commands - server.AddCommands( - rootCmd, - app.DefaultNodeHome, - a.newApp, - a.appExport, - addModuleInitFlags, - ) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - rpc.StatusCommand(), - queryCommand(), - txCommand(), - keys.Commands(app.DefaultNodeHome), - ) -} - -// queryCommand returns the sub-command to send queries to the app -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - ) - - app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -// txCommand returns the sub-command to send transactions to the app -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - ) - - app.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) + return rootCmd } func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { @@ -210,95 +138,33 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { } } -type appCreator struct { - encodingConfig appparams.EncodingConfig -} - -// newApp creates a new Cosmos SDK app -func (a appCreator) newApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - - return app.New( - logger, - db, - traceStore, - true, - appOpts, - server.DefaultBaseappOptions(appOpts)..., - ) -} - -// appExport creates a new simapp (optionally at a given height) -func (a appCreator) appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home not set") - } - - app := app.New( - logger, - db, - traceStore, - height == -1, // -1: no height provided - appOpts, - ) +func ProvideClientContext( + appCodec codec.Codec, + interfaceRegistry codectypes.InterfaceRegistry, + txConfig client.TxConfig, + legacyAmino *codec.LegacyAmino, +) client.Context { + clientCtx := client.Context{}. + WithCodec(appCodec). + WithInterfaceRegistry(interfaceRegistry). + WithTxConfig(txConfig). + WithLegacyAmino(legacyAmino). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper(app.Name) // env variable prefix - if height != -1 { - if err := app.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } + // Read the config again to overwrite the default values with the values from the config file + clientCtx, _ = config.ReadFromClientConfig(clientCtx) - return app.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return clientCtx } -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - type CustomAppConfig struct { - serverconfig.Config - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0stake" - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, +func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clientv2keyring.Keyring, error) { + kb, err := client.NewKeyringFromBackend(clientCtx, clientCtx.Keyring.Backend()) + if err != nil { + return nil, err } - customAppTemplate := serverconfig.DefaultConfigTemplate - return customAppTemplate, customAppConfig + return keyring.NewAutoCLIKeyring(kb) } diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/main.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/main.go.plush index 39d4d70cd8..b151788080 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/main.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/main.go.plush @@ -1,9 +1,9 @@ package main import ( + "fmt" "os" - "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "<%= ModulePath %>/app" @@ -11,14 +11,9 @@ import ( ) func main() { - rootCmd, _ := cmd.NewRootCmd() + rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) - - default: - os.Exit(1) - } + fmt.Fprintln(rootCmd.OutOrStderr(), err) + os.Exit(1) } } diff --git a/ignite/templates/app/files/go.mod.plush b/ignite/templates/app/files/go.mod.plush index 6dab72199d..cf63b12595 100644 --- a/ignite/templates/app/files/go.mod.plush +++ b/ignite/templates/app/files/go.mod.plush @@ -2,36 +2,45 @@ module <%= ModulePath %> go 1.21 +replace ( + // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. + // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 + github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 + // Downgraded to avoid bugs in following commits which caused simulations to fail. + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 +) + require ( - cosmossdk.io/api v0.3.1 - cosmossdk.io/core v0.5.1 - cosmossdk.io/depinject v1.0.0-alpha.3 - cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.1 - github.com/bufbuild/buf v1.23.1 - github.com/cometbft/cometbft v0.37.2 - github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 - github.com/cosmos/cosmos-sdk v0.47.3 - github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/v7 v7.2.0 + cosmossdk.io/api v0.7.2 + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/core v0.11.0 + cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/errors v1.0.0 + cosmossdk.io/log v1.2.1 + cosmossdk.io/store v1.0.0 + cosmossdk.io/tools/confix v0.1.0 + cosmossdk.io/x/circuit v0.1.0 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/upgrade v0.1.0 + github.com/bufbuild/buf v1.27.2 + github.com/cometbft/cometbft v0.38.0 + github.com/cosmos/cosmos-db v1.0.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.3 + github.com/cosmos/cosmos-sdk v0.50.1 + github.com/cosmos/gogoproto v1.4.11 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/ibc-go/v8 v8.0.0 github.com/golang/protobuf v1.5.3 - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 - github.com/spf13/cast v1.5.1 - github.com/spf13/cobra v1.7.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 - google.golang.org/grpc v1.55.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 + google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 + google.golang.org/grpc v1.59.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.31.0 ) - -replace ( - // use cosmos fork of keyring - github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - // replace broken goleveldb - github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 -) \ No newline at end of file diff --git a/ignite/templates/app/files/proto/buf.gen.swagger.yaml b/ignite/templates/app/files/proto/buf.gen.swagger.yaml index 2eafa902b7..58d30d86e8 100644 --- a/ignite/templates/app/files/proto/buf.gen.swagger.yaml +++ b/ignite/templates/app/files/proto/buf.gen.swagger.yaml @@ -10,5 +10,5 @@ plugins: opt: - logtostderr=true - openapi_naming_strategy=fqn - - simple_operation_ids=true - json_names_for_fields=false + - generate_unbound_methods=true \ No newline at end of file diff --git a/ignite/templates/app/files/readme.md.plush b/ignite/templates/app/files/readme.md.plush index fecba96974..c480ea2870 100644 --- a/ignite/templates/app/files/readme.md.plush +++ b/ignite/templates/app/files/readme.md.plush @@ -15,15 +15,14 @@ Your blockchain in development can be configured with `config.yml`. To learn mor ### Web Frontend -Ignite CLI has scaffolded a Vue.js-based web app in the `vue` directory. Run the following commands to install dependencies and start the app: +Additionally, Ignite CLI offers both Vue and React options for frontend scaffolding: + +For a Vue frontend, use: `ignite scaffold vue` +For a React frontend, use: `ignite scaffold react` +These commands can be run within your scaffolded blockchain project. -``` -cd vue -npm install -npm run serve -``` -The frontend app is built using the `@starport/vue` and `@starport/vuex` packages. For details, see the [monorepo for Ignite front-end development](https://github.com/ignite/web). +For more information see the [monorepo for Ignite front-end development](https://github.com/ignite/web). ## Release To release a new version of your blockchain, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created. diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush deleted file mode 100644 index 514e103d16..0000000000 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush +++ /dev/null @@ -1,66 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - "<%= ModulePath %>/x/<%= moduleName %>/types" -) - -// Cmd<%= queryName.UpperCamel %>Result queries request result by reqID -func Cmd<%= queryName.UpperCamel %>Result() *cobra.Command { - cmd := &cobra.Command{ - Use: "<%= queryName.Kebab %>-result [request-id]", - Short: "Query the <%= queryName.UpperCamel %> result data by id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - id, err := strconv.ParseInt(args[0], 10, 64) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - r, err := queryClient.<%= queryName.UpperCamel %>Result(context.Background(), &types.Query<%= queryName.UpperCamel %>Request{RequestId: id}) - if err != nil { - return err - } - - return clientCtx.PrintProto(r) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// CmdLast<%= queryName.UpperCamel %>ID queries latest request -func CmdLast<%= queryName.UpperCamel %>ID() *cobra.Command { - cmd := &cobra.Command{ - Use: "last-<%= queryName.Kebab %>-id", - Short: "Query the last request id returned by <%= queryName.UpperCamel %> ack packet", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - r, err := queryClient.Last<%= queryName.UpperCamel %>Id(cmd.Context(), &types.QueryLast<%= queryName.UpperCamel %>IdRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(r) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_oracle.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_oracle.go.plush deleted file mode 100644 index 85ee6da6d2..0000000000 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_oracle.go.plush +++ /dev/null @@ -1,10 +0,0 @@ -package cli - -const ( - flagChannel = "channel" - flagSymbols = "symbols" - flagMultiplier = "multiplier" - flagFeeLimit = "fee-limit" - flagPrepareGas = "prepare-gas" - flagExecuteGas = "execute-gas" -) diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_{{queryName}}.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_{{queryName}}.go.plush deleted file mode 100644 index 931529fa57..0000000000 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/client/cli/tx_{{queryName}}.go.plush +++ /dev/null @@ -1,118 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "<%= ModulePath %>/x/<%= moduleName %>/types" -) - -// CmdRequest<%= queryName.UpperCamel %>Data creates and broadcast a <%= queryName.UpperCamel %> request transaction -func CmdRequest<%= queryName.UpperCamel %>Data() *cobra.Command { - cmd := &cobra.Command{ - Use: "<%= queryName.Kebab %>-data [oracle-script-id] [requested-validator-count] [sufficient-validator-count]", - Short: "Make a new <%= queryName.UpperCamel %> query request via an existing BandChain oracle script", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - // retrieve the oracle script id. - uint64OracleScriptID, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - oracleScriptID := types.OracleScriptID(uint64OracleScriptID) - - // retrieve the requested validator count. - askCount, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } - - // retrieve the sufficient(minimum) validator count. - minCount, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return err - } - - channel, err := cmd.Flags().GetString(flagChannel) - if err != nil { - return err - } - - // retrieve the list of symbols for the requested oracle script. - symbols, err := cmd.Flags().GetStringSlice(flagSymbols) - if err != nil { - return err - } - - // retrieve the multiplier for the symbols' price. - multiplier, err := cmd.Flags().GetUint64(flagMultiplier) - if err != nil { - return err - } - - calldata := &types.<%= queryName.UpperCamel %>CallData{ - Symbols: symbols, - Multiplier: multiplier, - } - - // retrieve the amount of coins allowed to be paid for oracle request fee from the pool account. - coinStr, err := cmd.Flags().GetString(flagFeeLimit) - if err != nil { - return err - } - feeLimit, err := sdk.ParseCoinsNormalized(coinStr) - if err != nil { - return err - } - - // retrieve the amount of gas allowed for the prepare step of the oracle script. - prepareGas, err := cmd.Flags().GetUint64(flagPrepareGas) - if err != nil { - return err - } - - // retrieve the amount of gas allowed for the execute step of the oracle script. - executeGas, err := cmd.Flags().GetUint64(flagExecuteGas) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsg<%= queryName.UpperCamel %>Data( - clientCtx.GetFromAddress().String(), - oracleScriptID, - channel, - calldata, - askCount, - minCount, - feeLimit, - prepareGas, - executeGas, - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(flagChannel, "", "The channel id") - cmd.MarkFlagRequired(flagChannel) - cmd.Flags().StringSlice(flagSymbols, nil, "Symbols used in calling the oracle script") - cmd.Flags().Uint64(flagMultiplier, 1000000, "Multiplier used in calling the oracle script") - cmd.Flags().String(flagFeeLimit, "", "the maximum tokens that will be paid to all data source providers") - cmd.Flags().Uint64(flagPrepareGas, 200000, "Prepare gas used in fee counting for prepare request") - cmd.Flags().Uint64(flagExecuteGas, 200000, "Execute gas used in fee counting for execute request") - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/msg_{{queryName}}.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/msg_{{queryName}}.go.plush index 9e1d28b632..c74f33a225 100644 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/msg_{{queryName}}.go.plush +++ b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/msg_{{queryName}}.go.plush @@ -9,9 +9,9 @@ import ( "github.com/bandprotocol/bandchain-packet/packet" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + 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" "<%= ModulePath %>/x/<%= moduleName %>/types" ) diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/{{queryName}}.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/{{queryName}}.go.plush index e1f06a4e93..f5bf0e2c40 100644 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/{{queryName}}.go.plush +++ b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/keeper/{{queryName}}.go.plush @@ -1,21 +1,24 @@ package keeper import ( + "context" + errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/runtime" gogotypes "github.com/cosmos/gogoproto/types" "<%= ModulePath %>/x/<%= moduleName %>/types" ) // Set<%= queryName.UpperCamel %>Result saves the <%= queryName.UpperCamel %> result -func (k Keeper) Set<%= queryName.UpperCamel %>Result(ctx sdk.Context, requestID types.OracleRequestID, result types.<%= queryName.UpperCamel %>Result) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) Set<%= queryName.UpperCamel %>Result(ctx context.Context, requestID types.OracleRequestID, result types.<%= queryName.UpperCamel %>Result) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store.Set(types.<%= queryName.UpperCamel %>ResultStoreKey(requestID), k.cdc.MustMarshal(&result)) } // Get<%= queryName.UpperCamel %>Result returns the <%= queryName.UpperCamel %> by requestId -func (k Keeper) Get<%= queryName.UpperCamel %>Result(ctx sdk.Context, id types.OracleRequestID) (types.<%= queryName.UpperCamel %>Result, error) { - bz := ctx.KVStore(k.storeKey).Get(types.<%= queryName.UpperCamel %>ResultStoreKey(id)) +func (k Keeper) Get<%= queryName.UpperCamel %>Result(ctx context.Context, id types.OracleRequestID) (types.<%= queryName.UpperCamel %>Result, error) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.<%= queryName.UpperCamel %>ResultStoreKey(id)) if bz == nil { return types.<%= queryName.UpperCamel %>Result{}, errorsmod.Wrapf(types.ErrSample, "GetResult: Result for request ID %d is not available.", id, @@ -27,16 +30,17 @@ func (k Keeper) Get<%= queryName.UpperCamel %>Result(ctx sdk.Context, id types.O } // GetLast<%= queryName.UpperCamel %>ID return the id from the last <%= queryName.UpperCamel %> request -func (k Keeper) GetLast<%= queryName.UpperCamel %>ID(ctx sdk.Context) int64 { - bz := ctx.KVStore(k.storeKey).Get(types.KeyPrefix(types.Last<%= queryName.UpperCamel %>IDKey)) +func (k Keeper) GetLast<%= queryName.UpperCamel %>ID(ctx context.Context) int64 { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.KeyPrefix(types.Last<%= queryName.UpperCamel %>IDKey)) intV := gogotypes.Int64Value{} k.cdc.MustUnmarshalLengthPrefixed(bz, &intV) return intV.GetValue() } // SetLast<%= queryName.UpperCamel %>ID saves the id from the last <%= queryName.UpperCamel %> request -func (k Keeper) SetLast<%= queryName.UpperCamel %>ID(ctx sdk.Context, id types.OracleRequestID) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetLast<%= queryName.UpperCamel %>ID(ctx context.Context, id types.OracleRequestID) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store.Set(types.KeyPrefix(types.Last<%= queryName.UpperCamel %>IDKey), k.cdc.MustMarshalLengthPrefixed(&gogotypes.Int64Value{Value: int64(id)})) } diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/oracle.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/oracle.go.plush index 03912e4f6e..4df0f257aa 100644 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/oracle.go.plush +++ b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/oracle.go.plush @@ -6,7 +6,7 @@ import ( "github.com/bandprotocol/bandchain-packet/packet" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" "<%= ModulePath %>/x/<%= moduleName %>/types" ) diff --git a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/types/{{queryName}}.go.plush b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/types/{{queryName}}.go.plush index c6def7dfdc..9c0dad7aae 100644 --- a/ignite/templates/ibc/files/oracle/x/{{moduleName}}/types/{{queryName}}.go.plush +++ b/ignite/templates/ibc/files/oracle/x/{{moduleName}}/types/{{queryName}}.go.plush @@ -6,8 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsg<%= queryName.UpperCamel %>Data = "<%= queryName.Snake %>_data" - var ( _ sdk.Msg = &Msg<%= queryName.UpperCamel %>Data{} @@ -47,31 +45,6 @@ func NewMsg<%= queryName.UpperCamel %>Data( } } -// Route returns the message route -func (m *Msg<%= queryName.UpperCamel %>Data) Route() string { - return RouterKey -} - -// Type returns the message type -func (m *Msg<%= queryName.UpperCamel %>Data) Type() string { - return TypeMsg<%= queryName.UpperCamel %>Data -} - -// GetSigners returns the message signers -func (m *Msg<%= queryName.UpperCamel %>Data) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(m.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -// GetSignBytes returns the signed bytes from the message -func (m *Msg<%= queryName.UpperCamel %>Data) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(m) - return sdk.MustSortJSON(bz) -} - // ValidateBasic check the basic message validation func (m *Msg<%= queryName.UpperCamel %>Data) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.<%= MsgSigner.UpperCamel %>) diff --git a/ignite/templates/ibc/files/packet/component/x/{{moduleName}}/keeper/{{packetName}}.go.plush b/ignite/templates/ibc/files/packet/component/x/{{moduleName}}/keeper/{{packetName}}.go.plush index 78f553f118..5a6b588038 100644 --- a/ignite/templates/ibc/files/packet/component/x/{{moduleName}}/keeper/{{packetName}}.go.plush +++ b/ignite/templates/ibc/files/packet/component/x/{{moduleName}}/keeper/{{packetName}}.go.plush @@ -7,9 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "<%= ModulePath %>/x/<%= moduleName %>/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + 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" ) // Transmit<%= packetName.UpperCamel %>Packet transmits the packet over IBC with the specified source port and source channel diff --git a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/client/cli/tx_{{packetName}}.go.plush b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/client/cli/tx_{{packetName}}.go.plush index 88281b6bac..647cfda4c8 100644 --- a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/client/cli/tx_{{packetName}}.go.plush +++ b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/client/cli/tx_{{packetName}}.go.plush @@ -9,12 +9,15 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "<%= ModulePath %>/x/<%= moduleName %>/types" - channelutils "github.com/cosmos/ibc-go/v7/modules/core/04-channel/client/utils" + channelutils "github.com/cosmos/ibc-go/v8/modules/core/04-channel/client/utils" ) var _ = strconv.Itoa(0) +// This command does not use AutoCLI because it gives a better UX to do not. func CmdSend<%= packetName.UpperCamel %>() *cobra.Command { + flagPacketTimeoutTimestamp := "packet-timeout-timestamp" + cmd := &cobra.Command{ Use: "send-<%= packetName.Kebab %> [src-port] [src-channel]<%= fields.String() %>", Short: "Send a <%= packetName.Original %> over IBC", diff --git a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/keeper/msg_server_{{packetName}}.go.plush b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/keeper/msg_server_{{packetName}}.go.plush index 2059a80db7..53d141e4bb 100644 --- a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/keeper/msg_server_{{packetName}}.go.plush +++ b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/keeper/msg_server_{{packetName}}.go.plush @@ -5,7 +5,7 @@ import ( "<%= ModulePath %>/x/<%= moduleName %>/types" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) diff --git a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/types/messages_{{packetName}}.go.plush b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/types/messages_{{packetName}}.go.plush index ae979a1847..4109489cc6 100644 --- a/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/types/messages_{{packetName}}.go.plush +++ b/ignite/templates/ibc/files/packet/messages/x/{{moduleName}}/types/messages_{{packetName}}.go.plush @@ -6,8 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgSend<%= packetName.UpperCamel %> = "send_<%= packetName.Snake %>" - var _ sdk.Msg = &MsgSend<%= packetName.UpperCamel %>{} func NewMsgSend<%= packetName.UpperCamel %>( @@ -26,27 +24,6 @@ func NewMsgSend<%= packetName.UpperCamel %>( } } -func (msg *MsgSend<%= packetName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgSend<%= packetName.UpperCamel %>) Type() string { - return TypeMsgSend<%= packetName.UpperCamel %> -} - -func (msg *MsgSend<%= packetName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgSend<%= packetName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgSend<%= packetName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { diff --git a/ignite/templates/ibc/oracle.go b/ignite/templates/ibc/oracle.go index b071d914e5..25a031f1ee 100644 --- a/ignite/templates/ibc/oracle.go +++ b/ignite/templates/ibc/oracle.go @@ -79,7 +79,7 @@ func NewOracle(replacer placeholder.Replacer, opts *OracleOptions) (*genny.Gener // Deprecated: This function is no longer maintained. func moduleOracleModify(replacer placeholder.Replacer, opts *OracleOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_ibc.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/module_ibc.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -234,17 +234,31 @@ message Msg%[2]vDataResponse { // Deprecated: This function is no longer maintained. func clientCliQueryOracleModify(replacer placeholder.Replacer, opts *OracleOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/query.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := ` - cmd.AddCommand(Cmd%[2]vResult()) - cmd.AddCommand(CmdLast%[2]vID()) -%[1]v` - replacement := fmt.Sprintf(template, Placeholder, opts.QueryName.UpperCamel) - content := replacer.Replace(f.String(), Placeholder, replacement) + + template := `{ + RpcMethod: "%[2]vResult", + Use: "%[3]v-result [request-id]", + Short: "Query the %[2]v result data by id", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "request_id"}}, + }, + { + RpcMethod: "Last%[2]vId", + Use: "last-%[3]v-id", + Short: "Query the last request id returned by %[2]v ack packet", + }, + %[1]v` + + replacement := fmt.Sprintf(template, + PlaceholderAutoCLIQuery, + opts.QueryName.UpperCamel, + opts.QueryName.Kebab, + ) + content := replacer.Replace(f.String(), PlaceholderAutoCLIQuery, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -253,15 +267,35 @@ func clientCliQueryOracleModify(replacer placeholder.Replacer, opts *OracleOptio // Deprecated: This function is no longer maintained. func clientCliTxOracleModify(replacer placeholder.Replacer, opts *OracleOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdRequest%[2]vData()) + + template := `{ + RpcMethod: "%[2]v", + Use: "%[3]v-data [oracle-script-id] [requested-validator-count] [sufficient-validator-count]", + Short: "Make a new %[2]v query request via an existing BandChain oracle script", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "oracle_script_id"}, {ProtoField: "ask_count"}, {ProtoField: "min_count"}}, + FlagOptions: map[string]*autocliv1.FlagOptions{ + "source_channel": {Name: "channel", Usage: "The channel id"}, + "calldata": {Name: "calldata", DefaultValue: '{"multiplier": 1000000, symbols: []}', Usage: "Symbols and multiplier used in calling the oracle script"}, + "fee_limit": {Name: "fee-limit", Usage: "The maximum tokens that will be paid to all data source providers"}, + "prepare_gas": {Name: "prepare-gas", DefaultValue: "200000", Usage: "Prepare gas used in fee counting for prepare request"}, + "execute_gas": {Name: "execute-gas", DefaultValue: "200000", Usage: "Execute gas used in fee counting for execute request"}, + }, + }, + %[1]v` - replacement := fmt.Sprintf(template, Placeholder, opts.QueryName.UpperCamel) - content := replacer.Replace(f.String(), Placeholder, replacement) + + replacement := fmt.Sprintf( + template, + PlaceholderAutoCLITx, + opts.QueryName.UpperCamel, + opts.QueryName.Kebab, + ) + content := replacer.Replace(f.String(), PlaceholderAutoCLITx, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -280,12 +314,6 @@ func codecOracleModify(replacer placeholder.Replacer, opts *OracleOptions) genny replacement := `sdk "github.com/cosmos/cosmos-sdk/types"` content := replacer.ReplaceOnce(f.String(), Placeholder, replacement) - // Register the module packet - templateRegistry := `cdc.RegisterConcrete(&Msg%[3]vData{}, "%[2]v/%[3]vData", nil) -%[1]v` - replacementRegistry := fmt.Sprintf(templateRegistry, Placeholder2, opts.ModuleName, opts.QueryName.UpperCamel) - content = replacer.Replace(content, Placeholder2, replacementRegistry) - // Register the module packet interface templateInterface := `registry.RegisterImplementations((*sdk.Msg)(nil), &Msg%[2]vData{}, diff --git a/ignite/templates/ibc/packet.go b/ignite/templates/ibc/packet.go index 1199f82ad8..d8a4e5002e 100644 --- a/ignite/templates/ibc/packet.go +++ b/ignite/templates/ibc/packet.go @@ -2,11 +2,12 @@ package ibc import ( "embed" + "errors" "fmt" + "os" "path/filepath" "github.com/emicklei/proto" - "github.com/gobuffalo/genny/v2" "github.com/gobuffalo/plush/v4" @@ -19,6 +20,7 @@ import ( "github.com/ignite/cli/ignite/templates/field/plushhelpers" "github.com/ignite/cli/ignite/templates/module" "github.com/ignite/cli/ignite/templates/testutil" + "github.com/ignite/cli/ignite/templates/typed" ) var ( @@ -102,7 +104,7 @@ func NewPacket(replacer placeholder.Replacer, opts *PacketOptions) (*genny.Gener func moduleModify(replacer placeholder.Replacer, opts *PacketOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_ibc.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/module_ibc.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -317,9 +319,14 @@ func protoTxModify(opts *PacketOptions) genny.RunFn { protoutil.NewField("channelID", "string", 3), protoutil.NewField("timeoutTimestamp", "uint64", 4), ) + creatorOpt := protoutil.NewOption(typed.MsgSignerOption, opts.MsgSigner.LowerCamel) // Create MsgSend, MsgSendResponse and add to file. - msgSend := protoutil.NewMessage("MsgSend"+typenameUpper, protoutil.WithFields(sendFields...)) + msgSend := protoutil.NewMessage( + "MsgSend"+typenameUpper, + protoutil.WithFields(sendFields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgSendResponse := protoutil.NewMessage("MsgSend" + typenameUpper + "Response") protoutil.Append(protoFile, msgSend, msgSendResponse) @@ -341,10 +348,25 @@ func protoTxModify(opts *PacketOptions) genny.RunFn { } } +//go:embed templates/packet/tx.tpl +var txTemplate string + +// clientCliTxModify does not use AutoCLI here, because it as a better UX as it is. func clientCliTxModify(replacer placeholder.Replacer, opts *PacketOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") - f, err := r.Disk.Find(path) + filePath := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + if _, err := os.Stat(filePath); errors.Is(err, os.ErrNotExist) { + content := fmt.Sprintf(txTemplate, opts.ModulePath, opts.ModuleName) + if err := os.MkdirAll(filepath.Dir(filePath), os.ModePerm); err != nil { + return err + } + + if err := os.WriteFile(filePath, []byte(content), 0o644); err != nil { + return err + } + } + + f, err := r.Disk.Find(filePath) if err != nil { return err } @@ -352,7 +374,7 @@ func clientCliTxModify(replacer placeholder.Replacer, opts *PacketOptions) genny %[1]v` replacement := fmt.Sprintf(template, Placeholder, opts.PacketName.UpperCamel) content := replacer.Replace(f.String(), Placeholder, replacement) - newFile := genny.NewFileS(path, content) + newFile := genny.NewFileS(filePath, content) return r.File(newFile) } } @@ -369,17 +391,6 @@ func codecModify(replacer placeholder.Replacer, opts *PacketOptions) genny.RunFn replacement := `sdk "github.com/cosmos/cosmos-sdk/types"` content := replacer.ReplaceOnce(f.String(), module.Placeholder, replacement) - // Register the module packet - templateRegistry := `cdc.RegisterConcrete(&MsgSend%[2]v{}, "%[3]v/Send%[2]v", nil) -%[1]v` - replacementRegistry := fmt.Sprintf( - templateRegistry, - module.Placeholder2, - opts.PacketName.UpperCamel, - opts.ModuleName, - ) - content = replacer.Replace(content, module.Placeholder2, replacementRegistry) - // Register the module packet interface templateInterface := `registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend%[2]v{}, diff --git a/ignite/templates/ibc/placeholders.go b/ignite/templates/ibc/placeholders.go index f74dbcda7b..3b25117e28 100644 --- a/ignite/templates/ibc/placeholders.go +++ b/ignite/templates/ibc/placeholders.go @@ -22,4 +22,8 @@ const ( PlaceholderOraclePacketModuleAck = "// this line is used by starport scaffolding # oracle/packet/module/ack" PlaceholderOracleModuleRecv = "// this line is used by starport scaffolding # oracle/module/recv" PlaceholderOracleModuleAck = "// this line is used by starport scaffolding # oracle/module/ack" + + // Placeholders AutoCLI + PlaceholderAutoCLIQuery = "// this line is used by ignite scaffolding # autocli/query" + PlaceholderAutoCLITx = "// this line is used by ignite scaffolding # autocli/tx" ) diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/tx.go.plush b/ignite/templates/ibc/templates/packet/tx.tpl similarity index 53% rename from ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/tx.go.plush rename to ignite/templates/ibc/templates/packet/tx.tpl index 8f0d2003fc..1d09bbccfa 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/tx.go.plush +++ b/ignite/templates/ibc/templates/packet/tx.tpl @@ -7,24 +7,18 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - "<%= modulePath %>/x/<%= moduleName %>/types" + "%s/x/%s/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) + +const listSeparator = "," // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, - Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + Short: fmt.Sprintf("%%s transactions subcommands", types.ModuleName), DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, @@ -33,4 +27,4 @@ func GetTxCmd() *cobra.Command { // this line is used by starport scaffolding # 1 return cmd -} +} \ No newline at end of file diff --git a/ignite/templates/message/files/message/x/{{moduleName}}/client/cli/tx_{{msgName}}.go.plush b/ignite/templates/message/files/message/x/{{moduleName}}/client/cli/tx_{{msgName}}.go.plush deleted file mode 100644 index 304dfee081..0000000000 --- a/ignite/templates/message/files/message/x/{{moduleName}}/client/cli/tx_{{msgName}}.go.plush +++ /dev/null @@ -1,44 +0,0 @@ -package cli - -import ( - "strconv" - <%= for (goImport) in mergeGoImports(Fields) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -var _ = strconv.Itoa(0) - -func Cmd<%= MsgName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "<%= MsgName.Kebab %><%= Fields.String() %>", - Short: "<%= MsgDesc %>", - Args: cobra.ExactArgs(<%= len(Fields) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsg<%= MsgName.UpperCamel %>( - clientCtx.GetFromAddress().String(), - <%= for (i, field) in Fields { %>arg<%= field.Name.UpperCamel %>, - <% } %> - ) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} \ No newline at end of file diff --git a/ignite/templates/message/files/message/x/{{moduleName}}/types/message_{{msgName}}.go.plush b/ignite/templates/message/files/message/x/{{moduleName}}/types/message_{{msgName}}.go.plush index e782f1c98d..1d73a30a9b 100644 --- a/ignite/templates/message/files/message/x/{{moduleName}}/types/message_{{msgName}}.go.plush +++ b/ignite/templates/message/files/message/x/{{moduleName}}/types/message_{{msgName}}.go.plush @@ -6,8 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsg<%= MsgName.UpperCamel %> = "<%= MsgName.Snake %>" - var _ sdk.Msg = &Msg<%= MsgName.UpperCamel %>{} func NewMsg<%= MsgName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<%= for (field) in Fields { %>, <%= field.Name.LowerCamel %> <%= field.DataType() %><% } %>) *Msg<%= MsgName.UpperCamel %> { @@ -17,27 +15,6 @@ func NewMsg<%= MsgName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<%= for ( } } -func (msg *Msg<%= MsgName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *Msg<%= MsgName.UpperCamel %>) Type() string { - return TypeMsg<%= MsgName.UpperCamel %> -} - -func (msg *Msg<%= MsgName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *Msg<%= MsgName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *Msg<%= MsgName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { diff --git a/ignite/templates/message/files/simapp/x/{{moduleName}}/simulation/{{msgName}}.go.plush b/ignite/templates/message/files/simapp/x/{{moduleName}}/simulation/{{msgName}}.go.plush index 6a59e12888..8a574fca4e 100644 --- a/ignite/templates/message/files/simapp/x/{{moduleName}}/simulation/{{msgName}}.go.plush +++ b/ignite/templates/message/files/simapp/x/{{moduleName}}/simulation/{{msgName}}.go.plush @@ -24,6 +24,6 @@ func SimulateMsg<%= MsgName.UpperCamel %>( // TODO: Handling the <%= MsgName.UpperCamel %> simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= MsgName.UpperCamel %> simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= MsgName.UpperCamel %> simulation not implemented"), nil, nil } } diff --git a/ignite/templates/message/message.go b/ignite/templates/message/message.go index 256c41443c..4f292bcf90 100644 --- a/ignite/templates/message/message.go +++ b/ignite/templates/message/message.go @@ -4,11 +4,10 @@ import ( "embed" "fmt" "path/filepath" + "strings" "github.com/emicklei/proto" - "github.com/gobuffalo/genny/v2" - "github.com/gobuffalo/packd" "github.com/gobuffalo/plush/v4" @@ -121,7 +120,9 @@ func protoTxMessageModify(opts *Options) genny.RunFn { return err } // Prepare the fields and create the messages. - msgFields := []*proto.NormalField{protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1)} + creator := protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1) + creatorOpt := protoutil.NewOption(typed.MsgSignerOption, opts.MsgSigner.LowerCamel) + msgFields := []*proto.NormalField{creator} for i, field := range opts.Fields { msgFields = append(msgFields, field.ToProtoField(i+2)) } @@ -131,7 +132,11 @@ func protoTxMessageModify(opts *Options) genny.RunFn { } typenameUpper := opts.MsgName.UpperCamel - msg := protoutil.NewMessage("Msg"+typenameUpper, protoutil.WithFields(msgFields...)) + msg := protoutil.NewMessage( + "Msg"+typenameUpper, + protoutil.WithFields(msgFields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgResp := protoutil.NewMessage("Msg"+typenameUpper+"Response", protoutil.WithFields(resFields...)) protoutil.Append(protoFile, msg, msgResp) @@ -163,16 +168,6 @@ func typesCodecModify(replacer placeholder.Replacer, opts *Options) genny.RunFn replacementImport := `sdk "github.com/cosmos/cosmos-sdk/types"` content := replacer.ReplaceOnce(f.String(), Placeholder, replacementImport) - templateRegisterConcrete := `cdc.RegisterConcrete(&Msg%[2]v{}, "%[3]v/%[2]v", nil) -%[1]v` - replacementRegisterConcrete := fmt.Sprintf( - templateRegisterConcrete, - Placeholder2, - opts.MsgName.UpperCamel, - opts.ModuleName, - ) - content = replacer.Replace(content, Placeholder2, replacementRegisterConcrete) - templateRegisterImplementations := `registry.RegisterImplementations((*sdk.Msg)(nil), &Msg%[2]v{}, ) @@ -191,15 +186,35 @@ func typesCodecModify(replacer placeholder.Replacer, opts *Options) genny.RunFn func clientCliTxModify(replacer placeholder.Replacer, opts *Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(Cmd%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, Placeholder, opts.MsgName.UpperCamel) - content := replacer.Replace(f.String(), Placeholder, replacement) + + var positionalArgs string + for _, field := range opts.Fields { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "%[2]v", + Use: "%[3]v", + Short: "Send a %[4]v tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + %[1]v` + + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLITx, + opts.MsgName.UpperCamel, + strings.TrimSpace(fmt.Sprintf("%s%s", opts.MsgName.Kebab, opts.Fields.String())), + opts.MsgName.Original, + strings.TrimSpace(positionalArgs), + ) + + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLITx, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -207,7 +222,7 @@ func clientCliTxModify(replacer placeholder.Replacer, opts *Options) genny.RunFn func moduleSimulationModify(replacer placeholder.Replacer, opts *Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_simulation.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/simulation.go") f, err := r.Disk.Find(path) if err != nil { return err diff --git a/ignite/templates/module/create/base.go b/ignite/templates/module/create/base.go index e93a4e7f16..fa10754043 100644 --- a/ignite/templates/module/create/base.go +++ b/ignite/templates/module/create/base.go @@ -26,11 +26,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) { "files/msgserver/", opts.AppPath, ) - genesisTestTemplate = xgenny.NewEmbedWalker( - fsGenesisTest, - "files/genesistest/", - opts.AppPath, - ) baseTemplate = xgenny.NewEmbedWalker( fsBase, "files/base/", @@ -41,9 +36,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) { if err := g.Box(msgServerTemplate); err != nil { return g, err } - if err := g.Box(genesisTestTemplate); err != nil { - return g, err - } if err := g.Box(baseTemplate); err != nil { return g, err } @@ -66,12 +58,6 @@ func NewGenerator(opts *CreateOptions) (*genny.Generator, error) { g.Transformer(genny.Replace("{{appName}}", opts.AppName)) g.Transformer(genny.Replace("{{moduleName}}", opts.ModuleName)) - gSimapp, err := AddSimulation(opts.AppPath, opts.ModulePath, opts.ModuleName, opts.Params...) - if err != nil { - return g, err - } - g.Merge(gSimapp) - return g, nil } @@ -95,8 +81,9 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R } // Import - template := `%[2]vmoduletypes "%[3]v/x/%[2]v/types" -%[2]vmodulev1 "%[3]v/api/%[4]v/%[2]v/module" + template := `%[2]vmodulev1 "%[3]v/api/%[4]v/%[2]v/module" +_ "%[3]v/x/%[2]v/module" // import for side-effects +%[2]vmoduletypes "%[3]v/x/%[2]v/types" %[1]v` replacement := fmt.Sprintf(template, module.PlaceholderSgAppModuleImport, opts.ModuleName, opts.ModulePath, opts.AppName) content := replacer.Replace(fConfig.String(), module.PlaceholderSgAppModuleImport, replacement) @@ -151,18 +138,11 @@ func appModify(replacer placeholder.Replacer, opts *CreateOptions) genny.RunFn { } // Import - template := `%[2]vmodule "%[3]v/x/%[2]v" - %[2]vmodulekeeper "%[3]v/x/%[2]v/keeper" + template := `%[2]vmodulekeeper "%[3]v/x/%[2]v/keeper" %[1]v` replacement := fmt.Sprintf(template, module.PlaceholderSgAppModuleImport, opts.ModuleName, opts.ModulePath) content := replacer.Replace(f.String(), module.PlaceholderSgAppModuleImport, replacement) - // ModuleBasic - template = `%[2]vmodule.AppModuleBasic{}, -%[1]v` - replacement = fmt.Sprintf(template, module.PlaceholderSgAppModuleBasic, opts.ModuleName) - content = replacer.Replace(content, module.PlaceholderSgAppModuleBasic, replacement) - // Keeper declaration template = `%[2]vKeeper %[3]vmodulekeeper.Keeper %[1]v` diff --git a/ignite/templates/module/create/files/base/testutil/keeper/{{moduleName}}.go.plush b/ignite/templates/module/create/files/base/testutil/keeper/{{moduleName}}.go.plush index 4d3a03eea5..bde969ac1b 100644 --- a/ignite/templates/module/create/files/base/testutil/keeper/{{moduleName}}.go.plush +++ b/ignite/templates/module/create/files/base/testutil/keeper/{{moduleName}}.go.plush @@ -3,30 +3,30 @@ package keeper import ( "testing" - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/stretchr/testify/require" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" "<%= modulePath %>/x/<%= moduleName %>/keeper" "<%= modulePath %>/x/<%= moduleName %>/types" ) func <%= title(moduleName) %>Keeper(t testing.TB) (keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + storeKey := storetypes.NewKVStoreKey(types.StoreKey) - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() @@ -35,13 +35,13 @@ func <%= title(moduleName) %>Keeper(t testing.TB) (keeper.Keeper, sdk.Context) { k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), authority.String(), <%= for (dependency) in dependencies { %> nil,<% } %> ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params k.SetParams(ctx, types.DefaultParams()) diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query.go.plush deleted file mode 100644 index 4d2674d7f7..0000000000 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query.go.plush +++ /dev/null @@ -1,32 +0,0 @@ -package cli - -import ( - "fmt" - // "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - - "<%= modulePath %>/x/<%= moduleName %>/types" -) - -// GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { - // Group <%= moduleName %> queries under a subcommand - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd -} - diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query_params.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query_params.go.plush deleted file mode 100644 index 96ed66284b..0000000000 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/query_params.go.plush +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "<%= modulePath %>/x/<%= moduleName %>/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []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) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/suite_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/suite_test.go.plush deleted file mode 100644 index 135caf8045..0000000000 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/client/cli/suite_test.go.plush +++ /dev/null @@ -1,54 +0,0 @@ -package cli_test - -import ( - "testing" - - "github.com/stretchr/testify/suite" - - "<%= modulePath %>/testutil/network" -) - -type IntegrationTestSuite struct { - suite.Suite - - locked bool - net *network.Network - cfg network.Config -} - -func (s *IntegrationTestSuite) network() *network.Network { - s.net = network.New(s.T(), s.cfg) - s.locked = true - return s.net -} - -func (s *IntegrationTestSuite) waitForNextBlock() { - s.T().Log("wait for next block") - s.Require().NoError(s.net.WaitForNextBlock()) -} - -func (s *IntegrationTestSuite) SetupTest() { - s.T().Log("setting up test") - s.cfg = network.DefaultConfig() -} - -func (s *IntegrationTestSuite) SetupSuite() { - s.T().Log("setting up integration test suite") - s.cfg = network.DefaultConfig() -} - -func (s *IntegrationTestSuite) TearDownTest() { - s.T().Log("tearing down test") - if s.net != nil && s.locked { - s.net.Cleanup() - s.locked = false - } -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") -} - -func TestIntegrationTestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/keeper.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/keeper.go.plush index 225252396f..d4ed36dd16 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/keeper.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/keeper.go.plush @@ -3,32 +3,36 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/core/store" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" <%= if (isIBC) { %>errorsmod "cosmossdk.io/errors" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"<% } %> + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + 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" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"<% } %> "<%= modulePath %>/x/<%= moduleName %>/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string <%= if (isIBC) { %> - ibcKeeperFn func() *ibckeeper.Keeper - scopedKeeper exported.ScopedKeeper<% } %> + ibcKeeperFn func() *ibckeeper.Keeper + capabilityScopedFn func(string) capabilitykeeper.ScopedKeeper + scopedKeeper exported.ScopedKeeper<% } %> <%= for (dependency) in dependencies { %> <%= toVariableName(dependency.KeeperName()) %> types.<%= dependency.KeeperName() %><% } %> } @@ -36,11 +40,11 @@ type ( func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, + storeService store.KVStoreService, + logger log.Logger, authority string,<%= if (isIBC) { %> ibcKeeperFn func() *ibckeeper.Keeper, - scopedKeeper exported.ScopedKeeper,<% } %> + capabilityScopedFn func(string) capabilitykeeper.ScopedKeeper,<% } %> <%= for (dependency) in dependencies { %> <%= toVariableName(dependency.KeeperName()) %> types.<%= dependency.KeeperName() %>,<% } %> ) Keeper { @@ -49,12 +53,12 @@ func NewKeeper( } return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - authority: authority,<%= if (isIBC) { %> + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger,<%= if (isIBC) { %> ibcKeeperFn: ibcKeeperFn, - scopedKeeper: scopedKeeper,<% } %> + capabilityScopedFn: capabilityScopedFn,<% } %> <%= for (dependency) in dependencies { %> <%= toVariableName(dependency.KeeperName()) %>: <%= toVariableName(dependency.KeeperName()) %>,<% } %> } @@ -66,8 +70,8 @@ func (k Keeper) GetAuthority() string { } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } <%= if (isIBC) { %>// ---------------------------------------------------------------------------- @@ -75,52 +79,61 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // ---------------------------------------------------------------------------- // ChanCloseInit defines a wrapper function for the channel Keeper's function. -func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error { +func (k *Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error { capName := host.ChannelCapabilityPath(portID, channelID) - chanCap, ok := k.scopedKeeper.GetCapability(ctx, capName) + chanCap, ok := k.ScopedKeeper().GetCapability(ctx, capName) if !ok { return errorsmod.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "could not retrieve channel capability at: %s", capName) } return k.ibcKeeperFn().ChannelKeeper.ChanCloseInit(ctx, portID, channelID, chanCap) } -// IsBound checks if the IBC app module is already bound to the desired port -func (k Keeper) IsBound(ctx sdk.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok +// ShouldBound checks if the IBC app module can be bound to the desired port +func (k *Keeper) ShouldBound(ctx sdk.Context, portID string) bool { + scopedKeeper := k.ScopedKeeper() + if scopedKeeper == nil { + return false + } + _, ok := scopedKeeper.GetCapability(ctx, host.PortPath(portID)) + return !ok } // BindPort defines a wrapper function for the port Keeper's function in // order to expose it to module's InitGenesis function -func (k Keeper) BindPort(ctx sdk.Context, portID string) error { +func (k *Keeper) BindPort(ctx sdk.Context, portID string) error { cap := k.ibcKeeperFn().PortKeeper.BindPort(ctx, portID) return k.ClaimCapability(ctx, cap, host.PortPath(portID)) } // GetPort returns the portID for the IBC app module. Used in ExportGenesis -func (k Keeper) GetPort(ctx sdk.Context) string { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) GetPort(ctx sdk.Context) string { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) return string(store.Get(types.PortKey)) } // SetPort sets the portID for the IBC app module. Used in InitGenesis -func (k Keeper) SetPort(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) +func (k *Keeper) SetPort(ctx sdk.Context, portID string) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) store.Set(types.PortKey, []byte(portID)) } // AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) +func (k *Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool { + return k.ScopedKeeper().AuthenticateCapability(ctx, cap, name) } // ClaimCapability allows the IBC app module to claim a capability that core IBC // passes to it -func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) +func (k *Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error { + return k.ScopedKeeper().ClaimCapability(ctx, cap, name) } // ScopedKeeper returns the ScopedKeeper -func (k Keeper) ScopedKeeper() exported.ScopedKeeper { +func (k *Keeper) ScopedKeeper() exported.ScopedKeeper { + if k.scopedKeeper == nil && k.capabilityScopedFn != nil { + k.scopedKeeper = k.capabilityScopedFn(types.ModuleName) + } return k.scopedKeeper }<% } %> diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/params.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/params.go.plush index 9195ba3888..b64ed1ec37 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/params.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/params.go.plush @@ -1,15 +1,17 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "github.com/cosmos/cosmos-sdk/runtime" "<%= modulePath %>/x/<%= moduleName %>/types" ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) bz := store.Get(types.ParamsKey) if bz == nil { return params @@ -20,8 +22,8 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) bz, err := k.cdc.Marshal(¶ms) if err != nil { return err diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush index 395546dfca..c3ff71962e 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "<%= modulePath %>/testutil/keeper" @@ -12,11 +11,10 @@ import ( func TestParamsQuery(t *testing.T) { keeper, ctx := keepertest.<%= title(moduleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) params := types.DefaultParams() require.NoError(t, keeper.SetParams(ctx, params)) - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: params}, response) } diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/autocli.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/autocli.go.plush new file mode 100644 index 0000000000..b6eb59d93a --- /dev/null +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/autocli.go.plush @@ -0,0 +1,35 @@ +package <%= moduleName %> + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} \ No newline at end of file diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/genesis.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush similarity index 92% rename from ignite/templates/module/create/files/base/x/{{moduleName}}/genesis.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush index 7471ab041d..ed35249792 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/genesis.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush @@ -2,6 +2,7 @@ package <%= moduleName %> import ( sdk "github.com/cosmos/cosmos-sdk/types" + "<%= modulePath %>/x/<%= moduleName %>/keeper" "<%= modulePath %>/x/<%= moduleName %>/types" ) @@ -12,7 +13,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) k.SetParams(ctx, genState.Params) } -// ExportGenesis returns the module's exported genesis +// ExportGenesis returns the module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/ignite/templates/module/create/files/genesistest/x/{{moduleName}}/genesis_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush similarity index 94% rename from ignite/templates/module/create/files/genesistest/x/{{moduleName}}/genesis_test.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush index fb7e2bd184..2d472574c2 100644 --- a/ignite/templates/module/create/files/genesistest/x/{{moduleName}}/genesis_test.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis_test.go.plush @@ -5,7 +5,7 @@ import ( keepertest "<%= modulePath %>/testutil/keeper" "<%= modulePath %>/testutil/nullify" - "<%= modulePath %>/x/<%= moduleName %>" + "<%= modulePath %>/x/<%= moduleName %>/module" "<%= modulePath %>/x/<%= moduleName %>/types" "github.com/stretchr/testify/require" ) diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush similarity index 64% rename from ignite/templates/module/create/files/base/x/{{moduleName}}/module.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush index 0d7066038b..558c9e745d 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/module.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush @@ -6,36 +6,38 @@ import ( "fmt" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" "cosmossdk.io/depinject" - abci "github.com/cometbft/cometbft/abci/types" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - <%= if (isIBC) { %>porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"<% } %> + <%= if (isIBC) { %>porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"<% } %> // this line is used by starport scaffolding # 1 modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>/module" - "<%= modulePath %>/x/<%= moduleName %>/client/cli" "<%= modulePath %>/x/<%= moduleName %>/keeper" "<%= modulePath %>/x/<%= moduleName %>/types" ) var ( - _ module.AppModule = AppModule{} - _ module.BeginBlockAppModule = AppModule{} - _ module.EndBlockAppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModule{} + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) <%= if (isIBC) { %>_ porttypes.IBCModule = IBCModule{}<% } %> ) @@ -43,7 +45,8 @@ var ( // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. type AppModuleBasic struct { cdc codec.BinaryCodec } @@ -52,33 +55,27 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (AppModuleBasic) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. -func (AppModuleBasic) IsAppModule() {} - -// Name returns the name of the module as a string +// Name returns the name of the module as a string. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { @@ -87,26 +84,19 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return genState.Validate() } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient( - context.Background(), - mux, - types.NewQueryClient(clientCtx), - ); err != nil { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { panic(err) } } -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) -} +// GetTxCmd returns the root Tx command for the module. +// These commands enrich the AutoCLI tx commands. +// When creating non AutoCLI commands, add the following: +// func (a AppModuleBasic) GetTxCmd() *cobra.Command { +// return cli.GetTxCmd() +// } // ---------------------------------------------------------------------------- // AppModule @@ -145,14 +135,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { var genState types.GenesisState // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. @@ -161,64 +149,76 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(genState) } -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. func (AppModule) ConsensusVersion() uint64 { return 1 } -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + // ---------------------------------------------------------------------------- // App Wiring Setup // ---------------------------------------------------------------------------- func init() { - appmodule.Register(&modulev1.Module{}, + appmodule.Register( + &modulev1.Module{}, appmodule.Provide(ProvideModule), ) } -type <%= title(moduleName) %>Inputs struct { +type ModuleInputs struct { depinject.In - KvStoreKey *storetypes.KVStoreKey - MemStoreKey *storetypes.MemoryStoreKey - Cdc codec.Codec - Config *modulev1.Module + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper<%= for (dependency) in dependencies { %><%= if (dependency.Name != "Bank" && dependency.Name != "Account") { %> <%= dependency.KeeperName() %> types.<%= dependency.KeeperName() %><% } %><% } %> - <%= if (isIBC) { %> CapabilityKeeper *capabilitykeeper.Keeper - IBCKeeperFn func() *ibckeeper.Keeper<% } %> + <%= if (isIBC) { %>IBCKeeperFn func() *ibckeeper.Keeper `optional:"true"` + CapabilityScopedFn func(string) capabilitykeeper.ScopedKeeper `optional:"true"`<% } %> } -type <%= title(moduleName) %>Outputs struct { +type ModuleOutputs struct { depinject.Out <%= title(moduleName) %>Keeper keeper.Keeper Module appmodule.AppModule } -func ProvideModule(in <%= title(moduleName) %>Inputs) <%= title(moduleName) %>Outputs { +func ProvideModule(in ModuleInputs) ModuleOutputs { // default to governance authority if not provided authority := authtypes.NewModuleAddress(govtypes.ModuleName) if in.Config.Authority != "" { authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) } - <%= if (isIBC) { %>scopedVoteKeeper := in.CapabilityKeeper.ScopeToModule(types.ModuleName)<% } %> k := keeper.NewKeeper( in.Cdc, - in.KvStoreKey, - in.MemStoreKey, + in.StoreService, + in.Logger, authority.String(), <%= if (isIBC) { %> in.IBCKeeperFn, - scopedVoteKeeper,<% } %><%= for (dependency) in dependencies { %> + in.CapabilityScopedFn,<% } %><%= for (dependency) in dependencies { %> in.<%= dependency.KeeperName() %>,<% } %> ) m := NewAppModule( @@ -228,5 +228,5 @@ func ProvideModule(in <%= title(moduleName) %>Inputs) <%= title(moduleName) %>Ou in.BankKeeper, ) - return <%= title(moduleName) %>Outputs{<%= title(moduleName) %>Keeper: k, Module: m} + return ModuleOutputs{<%= title(moduleName) %>Keeper: k, Module: m} } diff --git a/ignite/templates/module/create/files/simapp/x/{{moduleName}}/module_simulation.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/simulation.go.plush similarity index 93% rename from ignite/templates/module/create/files/simapp/x/{{moduleName}}/module_simulation.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/module/simulation.go.plush index e0fdc1cb90..9025cf691f 100644 --- a/ignite/templates/module/create/files/simapp/x/{{moduleName}}/module_simulation.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/simulation.go.plush @@ -3,23 +3,23 @@ package <%= moduleName %> import ( "math/rand" - "<%= modulePath %>/testutil/sample" - <%= moduleName %>simulation "<%= modulePath %>/x/<%= moduleName %>/simulation" - "<%= modulePath %>/x/<%= moduleName %>/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + + "<%= modulePath %>/testutil/sample" + <%= moduleName %>simulation "<%= modulePath %>/x/<%= moduleName %>/simulation" + "<%= modulePath %>/x/<%= moduleName %>/types" ) // avoid unused import issue var ( - _ = sample.AccAddress _ = <%= moduleName %>simulation.FindAccount - _ = simulation.MsgEntryKind - _ = baseapp.Paramspace _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind ) const ( @@ -41,7 +41,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // RegisterStoreDecoder registers a decoder. -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} // ProposalContents doesn't return any content functions for governance proposals. func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { diff --git a/ignite/templates/module/create/files/simapp/x/{{moduleName}}/simulation/helpers.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/simulation/helpers.go.plush similarity index 100% rename from ignite/templates/module/create/files/simapp/x/{{moduleName}}/simulation/helpers.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/simulation/helpers.go.plush diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/codec.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/codec.go.plush index 66182a6b70..d66e15da0e 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/codec.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/codec.go.plush @@ -1,8 +1,7 @@ package types import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" + <%= if (isIBC) { %>"github.com/cosmos/cosmos-sdk/codec"<% } %> cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -10,15 +9,6 @@ import ( // this line is used by starport scaffolding # 1 ) -// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 - - cdc.RegisterConcrete(Params{}, "<%= appName %>/x/<%= moduleName %>/Params", nil) - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "<%= appName %>/x/<%= moduleName %>/MsgUpdateParams") -} - - func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { // this line is used by starport scaffolding # 3 @@ -28,7 +18,13 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } +<%= if (isIBC) { %> var ( - Amino = codec.NewLegacyAmino() + // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec + // should ONLY be used in certain instances of tests and for JSON encoding. + // + // The actual codec used for serialization should be provided to x/ibc transfer and + // defined at the application level. ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) ) +<% } %> diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/expected_keepers.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/expected_keepers.go.plush index 9be7d9e8e0..663cd8b82f 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/expected_keepers.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/expected_keepers.go.plush @@ -1,88 +1,89 @@ package types import ( - "cosmossdk.io/math" + "context" + + <%= if (dependencies.Contains("Staking")) { %>"cosmossdk.io/core/address" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"<% } %> sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/authz" - "github.com/cosmos/cosmos-sdk/x/feegrant" - "github.com/cosmos/cosmos-sdk/x/nft" + <%= if (dependencies.Contains("Authz")) { %>"github.com/cosmos/cosmos-sdk/x/authz"<% } %> ) <%= for (dependency) in dependencies { %> -<%= if (dependency.Name != "Account" && dependency.Name != "Bank" && - dependency.Name != "Staking" && dependency.Name != "Slashing" && - dependency.Name != "Distribution" && dependency.Name != "Mint" && - dependency.Name != "Authz" && dependency.Name != "Feegrant" && - dependency.Name != "Group" && dependency.Name != "Nft") { %> -type <%= dependency.KeeperName() %> interface { - // TODO Add methods imported from <%= toLower(dependency.Name) %> should be defined here -} -<% } %> -<% } %> + <%= if (dependency.Name == "Account") { %> + <% } else if (dependency.Name == "Bank") { %> + <% } else if (dependency.Name == "Staking") { %> + // StakingKeeper defines the expected interface for the Staking module. + type StakingKeeper interface { + ConsensusAddressCodec() address.Codec + ValidatorByConsAddr(context.Context, sdk.ConsAddress) (stakingtypes.ValidatorI, error) + // Methods imported from account should be defined here + } -// AccountKeeper defines the expected interface for the Account module. -type AccountKeeper interface { - GetAccount(sdk.Context, sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here -} - -// BankKeeper defines the expected interface for the Bank module. -type BankKeeper interface { - SpendableCoins(sdk.Context, sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here -} + <% } else if (dependency.Name == "Slashing") { %> + // SlashingKeeper defines the expected interface for the Slashing module. + type SlashingKeeper interface { + IsTombstoned(context.Context, sdk.ConsAddress) bool + Jail(context.Context, sdk.ConsAddress) error + // Methods imported from account should be defined here + } -// StakingKeeper defines the expected interface for the Staking module. -type StakingKeeper interface { - TotalBondedTokens(sdk.Context) math.Int - // Methods imported from account should be defined here -} + <% } else if (dependency.Name == "Distribution") { %> + // DistributionKeeper defines the expected interface for the Distribution module. + type DistributionKeeper interface { + FundCommunityPool(context.Context, sdk.Coins, sdk.AccAddress) error + // Methods imported from account should be defined here + } -// SlashingKeeper defines the expected interface for the Slashing module. -type SlashingKeeper interface { - Slash(ctx sdk.Context, consAddr sdk.ConsAddress, fraction sdk.Dec, power, distributionHeight int64) - // Methods imported from account should be defined here -} + <% } else if (dependency.Name == "Mint") { %> + // MintKeeper defines the expected interface for the Mint module. + type MintKeeper interface { + MintCoins(context.Context, sdk.Coins) error + // Methods imported from account should be defined here + } -// DistributionKeeper defines the expected interface for the Distribution module. -type DistributionKeeper interface { - GetFeePoolCommunityCoins(sdk.Context) sdk.DecCoins - // Methods imported from account should be defined here -} + <% } else if (dependency.Name == "Authz") { %> + // AuthzKeeper defines the expected interface for the Authz module. + type AuthzKeeper interface { + GetAuthorizations(_ context.Context, _, _ sdk.AccAddress) ([]authz.Authorization, error) + // Methods imported from account should be defined here + } -// MintKeeper defines the expected interface for the Mint module. -type MintKeeper interface { - MintCoins(sdk.Context, sdk.Coins) error - // Methods imported from account should be defined here -} + <% } else if (dependency.Name == "Feegrant") { %> + // FeegrantKeeper defines the expected interface for the FeeGrant module. + type FeegrantKeeper interface { + UseGrantedFees(_ context.Context, _, _ sdk.AccAddress, _ sdk.Coins, _ []sdk.Msg) error + // Methods imported from account should be defined here + } -// AuthzKeeper defines the expected interface for the Authz module. -type AuthzKeeper interface { - GetAuthorizations(sdk.Context, sdk.AccAddress, sdk.AccAddress) ([]authz.Authorization, error) - // Methods imported from account should be defined here -} + <% } else if (dependency.Name == "Group") { %> + // GroupKeeper defines the expected interface for the Group module. + type GroupKeeper interface { + GetGroupSequence(context.Context) uint64 + // Methods imported from account should be defined here + } -// FeegrantKeeper defines the expected interface for the FeeGrant module. -type FeegrantKeeper interface { - GrantAllowance(sdk.Context, sdk.AccAddress, sdk.AccAddress, feegrant.FeeAllowanceI) error - // Methods imported from account should be defined here -} + <% } else { %> + type <%= dependency.KeeperName() %> interface { + // TODO Add methods imported from <%= toLower(dependency.Name) %> should be defined here + } + <% } %> +<% } %> -// GroupKeeper defines the expected interface for the Group module. -type GroupKeeper interface { - GetGroupSequence(sdk.Context) uint64 - // Methods imported from account should be defined here +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here } -// NftKeeper defines the expected interface for the NFT module. -type NftKeeper interface { - Mint(sdk.Context, nft.NFT, sdk.AccAddress) error - // Methods imported from account should be defined here +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here } // ParamSubspace defines the expected Subspace interface for parameters. type ParamSubspace interface { - Get(sdk.Context, []byte, interface{}) - Set(sdk.Context, []byte, interface{}) + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) } diff --git a/ignite/templates/module/create/files/genesistest/x/{{moduleName}}/types/genesis_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/genesis_test.go.plush similarity index 100% rename from ignite/templates/module/create/files/genesistest/x/{{moduleName}}/types/genesis_test.go.plush rename to ignite/templates/module/create/files/base/x/{{moduleName}}/types/genesis_test.go.plush diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/keys.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/keys.go.plush index d7b2e0451f..2e03a1573e 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/keys.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/keys.go.plush @@ -7,9 +7,6 @@ const ( // StoreKey defines the primary module store key StoreKey = ModuleName - // RouterKey defines the module's message routing key - RouterKey = ModuleName - // MemStoreKey defines the in-memory store key MemStoreKey = "mem_<%= moduleName %>" diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/msg_update_params.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/msg_update_params.go.plush index 311fda35b4..e36d023de6 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/types/msg_update_params.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/types/msg_update_params.go.plush @@ -7,17 +7,6 @@ import ( var _ sdk.Msg = &MsgUpdateParams{} -// GetSignBytes implements the LegacyMsg interface. -func (m MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(m.Authority) - return []sdk.AccAddress{addr} -} - // ValidateBasic does a sanity check on the provided data. func (m *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { diff --git a/ignite/templates/module/create/files/ibc/testutil/keeper/{{moduleName}}.go.plush b/ignite/templates/module/create/files/ibc/testutil/keeper/{{moduleName}}.go.plush index 685bfe9134..9dbc5263f6 100644 --- a/ignite/templates/module/create/files/ibc/testutil/keeper/{{moduleName}}.go.plush +++ b/ignite/templates/module/create/files/ibc/testutil/keeper/{{moduleName}}.go.plush @@ -3,20 +3,22 @@ package keeper import ( "testing" - tmdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - portkeeper "github.com/cosmos/ibc-go/v7/modules/core/05-port/keeper" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + portkeeper "github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" "github.com/stretchr/testify/require" "<%= modulePath %>/x/<%= moduleName %>/keeper" @@ -24,13 +26,11 @@ import ( ) func <%= title(moduleName) %>Keeper(t testing.TB) (keeper.Keeper, sdk.Context) { - logger := log.NewNopLogger() - - storeKey := sdk.NewKVStoreKey(types.StoreKey) + storeKey := storetypes.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) @@ -42,22 +42,25 @@ func <%= title(moduleName) %>Keeper(t testing.TB) (keeper.Keeper, sdk.Context) { scopedKeeper := capabilityKeeper.ScopeToModule(ibcexported.ModuleName) portKeeper := portkeeper.NewKeeper(scopedKeeper) + scopeModule := capabilityKeeper.ScopeToModule(types.ModuleName) k := keeper.NewKeeper( appCodec, - storeKey, - memStoreKey, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), authority.String(), func() *ibckeeper.Keeper { return &ibckeeper.Keeper{ - PortKeeper: portKeeper, + PortKeeper: &portKeeper, } }, - capabilityKeeper.ScopeToModule(types.ModuleName),<%= for (dependency) in dependencies { %> + func(string) capabilitykeeper.ScopedKeeper { + return scopeModule + },<%= for (dependency) in dependencies { %> nil,<% } %> ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, logger) + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params k.SetParams(ctx, types.DefaultParams()) diff --git a/ignite/templates/module/create/files/ibc/x/{{moduleName}}/module_ibc.go.plush b/ignite/templates/module/create/files/ibc/x/{{moduleName}}/module/module_ibc.go.plush similarity index 96% rename from ignite/templates/module/create/files/ibc/x/{{moduleName}}/module_ibc.go.plush rename to ignite/templates/module/create/files/ibc/x/{{moduleName}}/module/module_ibc.go.plush index 0b23947a1b..1cbfc83552 100644 --- a/ignite/templates/module/create/files/ibc/x/{{moduleName}}/module_ibc.go.plush +++ b/ignite/templates/module/create/files/ibc/x/{{moduleName}}/module/module_ibc.go.plush @@ -6,11 +6,11 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "<%= modulePath %>/x/<%= moduleName %>/keeper" "<%= modulePath %>/x/<%= moduleName %>/types" ) diff --git a/ignite/templates/module/create/files/ibc/x/{{moduleName}}/types/expected_ibc_keeper.go.plush b/ignite/templates/module/create/files/ibc/x/{{moduleName}}/types/expected_ibc_keeper.go.plush index fb2f6a186d..04dca7fe8f 100644 --- a/ignite/templates/module/create/files/ibc/x/{{moduleName}}/types/expected_ibc_keeper.go.plush +++ b/ignite/templates/module/create/files/ibc/x/{{moduleName}}/types/expected_ibc_keeper.go.plush @@ -1,18 +1,19 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + "context" + + 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" ) // ChannelKeeper defines the expected IBC channel keeper. type ChannelKeeper interface { - GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool) - GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) + GetChannel(ctx context.Context, portID, channelID string) (channeltypes.Channel, bool) + GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) SendPacket( - ctx sdk.Context, + ctx context.Context, channelCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, @@ -20,17 +21,17 @@ type ChannelKeeper interface { timeoutTimestamp uint64, data []byte, ) (uint64, error) - ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error + ChanCloseInit(ctx context.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error } // PortKeeper defines the expected IBC port keeper. type PortKeeper interface { - BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability + BindPort(ctx context.Context, portID string) *capabilitytypes.Capability } // ScopedKeeper defines the expected IBC scoped keeper. type ScopedKeeper interface { - GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool) - AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool - ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error + GetCapability(ctx context.Context, name string) (*capabilitytypes.Capability, bool) + AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool + ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error } diff --git a/ignite/templates/module/create/files/msgserver/proto/{{appName}}/{{moduleName}}/tx.proto.plush b/ignite/templates/module/create/files/msgserver/proto/{{appName}}/{{moduleName}}/tx.proto.plush index 36fe29dc75..0d1df9db15 100644 --- a/ignite/templates/module/create/files/msgserver/proto/{{appName}}/{{moduleName}}/tx.proto.plush +++ b/ignite/templates/module/create/files/msgserver/proto/{{appName}}/{{moduleName}}/tx.proto.plush @@ -15,14 +15,10 @@ service Msg { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. - // - // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "<%= appName %>/x/<%= moduleName %>/MsgUpdateParams"; @@ -41,6 +37,4 @@ message MsgUpdateParams { // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/ignite/templates/module/create/files/msgserver/x/{{moduleName}}/keeper/msg_server_test.go.plush b/ignite/templates/module/create/files/msgserver/x/{{moduleName}}/keeper/msg_server_test.go.plush index 7f30f4f7f1..1b3e9e1283 100644 --- a/ignite/templates/module/create/files/msgserver/x/{{moduleName}}/keeper/msg_server_test.go.plush +++ b/ignite/templates/module/create/files/msgserver/x/{{moduleName}}/keeper/msg_server_test.go.plush @@ -1,9 +1,9 @@ package keeper_test import ( + "context" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "<%= modulePath %>/testutil/keeper" @@ -11,7 +11,7 @@ import ( "<%= modulePath %>/x/<%= moduleName %>/keeper" ) -func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, sdk.Context) { +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { k, ctx := keepertest.<%= title(moduleName) %>Keeper(t) return k, keeper.NewMsgServerImpl(k), ctx } diff --git a/ignite/templates/module/create/genesistest.go b/ignite/templates/module/create/genesistest.go deleted file mode 100644 index c4deb06d9e..0000000000 --- a/ignite/templates/module/create/genesistest.go +++ /dev/null @@ -1,36 +0,0 @@ -package modulecreate - -import ( - "github.com/gobuffalo/genny/v2" - "github.com/gobuffalo/plush/v4" - - "github.com/ignite/cli/ignite/pkg/xgenny" - "github.com/ignite/cli/ignite/pkg/xstrings" - "github.com/ignite/cli/ignite/templates/field/plushhelpers" -) - -// AddGenesisTest returns the generator to generate genesis_test.go files. -func AddGenesisTest(appPath, appName, modulePath, moduleName string, isIBC bool) (*genny.Generator, error) { - var ( - g = genny.New() - template = xgenny.NewEmbedWalker(fsGenesisTest, "files/genesistest/", appPath) - ) - - ctx := plush.NewContext() - ctx.Set("moduleName", moduleName) - ctx.Set("modulePath", modulePath) - ctx.Set("appName", appName) - ctx.Set("isIBC", isIBC) - ctx.Set("title", xstrings.Title) - - plushhelpers.ExtendPlushContext(ctx) - g.Transformer(xgenny.Transformer(ctx)) - g.Transformer(genny.Replace("{{appName}}", appName)) - g.Transformer(genny.Replace("{{moduleName}}", moduleName)) - - if err := xgenny.Box(g, template); err != nil { - return nil, err - } - - return g, nil -} diff --git a/ignite/templates/module/create/ibc.go b/ignite/templates/module/create/ibc.go index 9727b83e5d..506d70e615 100644 --- a/ignite/templates/module/create/ibc.go +++ b/ignite/templates/module/create/ibc.go @@ -52,7 +52,7 @@ func NewIBC(replacer placeholder.Replacer, opts *CreateOptions) (*genny.Generato func genesisModify(replacer placeholder.Replacer, opts *CreateOptions) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -63,7 +63,7 @@ func genesisModify(replacer placeholder.Replacer, opts *CreateOptions) genny.Run k.SetPort(ctx, genState.PortId) // Only try to bind to port if it is not already bound, since we may already own // port capability from capability InitGenesis -if !k.IsBound(ctx, genState.PortId) { +if k.ShouldBound(ctx, genState.PortId) { // module binds to the port on InitChain // and claims the returned capability err := k.BindPort(ctx, genState.PortId) @@ -94,7 +94,7 @@ func genesisTypesModify(replacer placeholder.Replacer, opts *CreateOptions) genn } // Import - templateImport := `host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + templateImport := `host "github.com/cosmos/ibc-go/v8/modules/core/24-host" %s` replacementImport := fmt.Sprintf(templateImport, typed.PlaceholderGenesisTypesImport) content := replacer.Replace(f.String(), typed.PlaceholderGenesisTypesImport, replacementImport) @@ -189,7 +189,7 @@ func appIBCModify(replacer placeholder.Replacer, opts *CreateOptions) genny.RunF // Import templateImport := `%[1]v -%[2]vmodule "%[3]v/x/%[2]v" +%[2]vmodule "%[3]v/x/%[2]v/module" %[2]vmoduletypes "%[3]v/x/%[2]v/types"` replacementImport := fmt.Sprintf(templateImport, module.PlaceholderIBCImport, opts.ModuleName, opts.ModulePath) content := replacer.Replace(f.String(), module.PlaceholderIBCImport, replacementImport) diff --git a/ignite/templates/module/create/options.go b/ignite/templates/module/create/options.go index 56e2a53070..fc09404a0b 100644 --- a/ignite/templates/module/create/options.go +++ b/ignite/templates/module/create/options.go @@ -24,7 +24,7 @@ type ( IBCOrdering string // Dependencies of the module - Dependencies []Dependency + Dependencies Dependencies } // Dependency represents a module dependency of a module. @@ -49,6 +49,21 @@ func NewDependency(name string) Dependency { return Dependency{Name: strcase.ToCamel(name)} } +// Contains returns true if contains dependency name. +func (d Dependencies) Contains(name string) bool { + for _, dep := range d { + if dep.Name == name { + return true + } + } + return false +} + +// Len returns the length of dependencies. +func (d Dependencies) Len() int { + return len(d) +} + // KeeperName returns the keeper's name for the dependency module. func (d Dependency) KeeperName() string { return fmt.Sprint(d.Name, "Keeper") diff --git a/ignite/templates/module/create/simulation.go b/ignite/templates/module/create/simulation.go deleted file mode 100644 index 275245662e..0000000000 --- a/ignite/templates/module/create/simulation.go +++ /dev/null @@ -1,33 +0,0 @@ -package modulecreate - -import ( - "github.com/gobuffalo/genny/v2" - "github.com/gobuffalo/plush/v4" - - "github.com/ignite/cli/ignite/pkg/xgenny" - "github.com/ignite/cli/ignite/templates/field" - "github.com/ignite/cli/ignite/templates/field/plushhelpers" -) - -// AddSimulation returns the generator to generate module_simulation.go file. -func AddSimulation(appPath, modulePath, moduleName string, params ...field.Field) (*genny.Generator, error) { - var ( - g = genny.New() - template = xgenny.NewEmbedWalker(fsSimapp, "files/simapp/", appPath) - ) - - ctx := plush.NewContext() - ctx.Set("moduleName", moduleName) - ctx.Set("modulePath", modulePath) - ctx.Set("params", params) - - plushhelpers.ExtendPlushContext(ctx) - g.Transformer(genny.Replace("{{moduleName}}", moduleName)) - - if err := xgenny.Box(g, template); err != nil { - return nil, err - } - - g.Transformer(xgenny.Transformer(ctx)) - return g, nil -} diff --git a/ignite/templates/module/create/templates.go b/ignite/templates/module/create/templates.go index 10d837db97..f8b73ced50 100644 --- a/ignite/templates/module/create/templates.go +++ b/ignite/templates/module/create/templates.go @@ -13,10 +13,4 @@ var ( //go:embed files/msgserver/* files/msgserver/**/* fsMsgServer embed.FS - - //go:embed files/genesistest/* files/genesistest/**/* - fsGenesisTest embed.FS - - //go:embed files/simapp/* files/simapp/**/* - fsSimapp embed.FS ) diff --git a/ignite/templates/module/placeholders.go b/ignite/templates/module/placeholders.go index 5c27b9fdab..d8cf25041a 100644 --- a/ignite/templates/module/placeholders.go +++ b/ignite/templates/module/placeholders.go @@ -8,7 +8,6 @@ const ( // Placeholders in app.go PlaceholderSgAppModuleImport = "// this line is used by starport scaffolding # stargate/app/moduleImport" - PlaceholderSgAppModuleBasic = "// this line is used by starport scaffolding # stargate/app/moduleBasic" PlaceholderSgAppKeeperDeclaration = "// this line is used by starport scaffolding # stargate/app/keeperDeclaration" PlaceholderSgAppKeeperDefinition = "// this line is used by starport scaffolding # stargate/app/keeperDefinition" PlaceholderSgAppInitGenesis = "// this line is used by starport scaffolding # stargate/app/initGenesis" diff --git a/ignite/templates/query/files/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush b/ignite/templates/query/files/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush deleted file mode 100644 index 2d69d2ee17..0000000000 --- a/ignite/templates/query/files/x/{{moduleName}}/client/cli/query_{{queryName}}.go.plush +++ /dev/null @@ -1,53 +0,0 @@ -package cli - -import ( - "strconv" - <%= for (goImport) in mergeGoImports(ReqFields) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -var _ = strconv.Itoa(0) - -func Cmd<%= QueryName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "<%= QueryName.Kebab %><%= ReqFields.String() %>", - Short: "<%= Description %>", - Args: cobra.ExactArgs(<%= len(ReqFields) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in ReqFields { %> <%= field.CLIArgs("req", i) %> - <% } %> - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.Query<%= QueryName.UpperCamel %>Request{ - <%= for (i, field) in ReqFields { %> - <%= field.Name.UpperCamel %>: req<%= field.Name.UpperCamel %>, <% } %> - } - - <%= if (Paginated) { %>pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - params.Pagination = pageReq<% } %> - - res, err := queryClient.<%= QueryName.UpperCamel %>(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/query/placeholders.go b/ignite/templates/query/placeholders.go index 96fbde8f43..2268a356d1 100644 --- a/ignite/templates/query/placeholders.go +++ b/ignite/templates/query/placeholders.go @@ -1,5 +1,3 @@ package query -const ( - Placeholder = "// this line is used by starport scaffolding # 1" -) +const PlaceholderAutoCLIQuery = "// this line is used by ignite scaffolding # autocli/query" diff --git a/ignite/templates/query/query.go b/ignite/templates/query/query.go index 1072d5beca..6483e4e249 100644 --- a/ignite/templates/query/query.go +++ b/ignite/templates/query/query.go @@ -4,6 +4,7 @@ import ( "embed" "fmt" "path/filepath" + "strings" "github.com/emicklei/proto" @@ -146,21 +147,34 @@ func protoQueryModify(opts *Options) genny.RunFn { func cliQueryModify(replacer placeholder.Replacer, opts *Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/query.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(Cmd%[2]v()) + var positionalArgs string + for _, field := range opts.ReqFields { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "%[2]v", + Use: "%[3]v", + Short: "%[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, -%[1]v` + %[1]v` replacement := fmt.Sprintf( template, - Placeholder, + PlaceholderAutoCLIQuery, opts.QueryName.UpperCamel, + strings.TrimSpace(fmt.Sprintf("%s%s", opts.QueryName.Kebab, opts.ReqFields.String())), + opts.Description, + strings.TrimSpace(positionalArgs), ) - content := replacer.Replace(f.String(), Placeholder, replacement) + content := replacer.Replace(f.String(), PlaceholderAutoCLIQuery, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) diff --git a/ignite/templates/testutil/files/testutil/network/network.go.plush b/ignite/templates/testutil/files/testutil/network/network.go.plush index 475de56957..8fe0ab5fd3 100644 --- a/ignite/templates/testutil/files/testutil/network/network.go.plush +++ b/ignite/templates/testutil/files/testutil/network/network.go.plush @@ -3,19 +3,8 @@ package network import ( "fmt" "testing" - "time" - tmdb "github.com/cometbft/cometbft-db" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "github.com/cosmos/cosmos-sdk/testutil/network" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" "<%= ModulePath %>/app" @@ -29,6 +18,7 @@ type ( // New creates instance with fully configured cosmos network. // Accepts optional config, that will be used in place of the DefaultConfig() if provided. func New(t *testing.T, configs ...Config) *Network { + t.Helper() if len(configs) > 1 { panic("at most one config should be provided") } @@ -42,46 +32,49 @@ func New(t *testing.T, configs ...Config) *Network { require.NoError(t, err) _, err = net.WaitForHeight(1) require.NoError(t, err) + t.Cleanup(net.Cleanup) return net } // DefaultConfig will initialize config for the network with custom application, // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig func DefaultConfig() network.Config { - var ( - encoding = app.MakeEncodingConfig() - chainID = "chain-" + tmrand.NewRand().Str(6) - ) - return network.Config{ - Codec: encoding.Codec, - TxConfig: encoding.TxConfig, - LegacyAmino: encoding.Amino, - InterfaceRegistry: encoding.InterfaceRegistry, - AccountRetriever: authtypes.AccountRetriever{}, - AppConstructor: func(val network.ValidatorI) servertypes.Application { - return app.New( - val.GetCtx().Logger, - tmdb.NewMemDB(), - nil, - true, - simtestutil.EmptyAppOptions{}, - baseapp.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)), - baseapp.SetMinGasPrices(val.GetAppConfig().MinGasPrices), - baseapp.SetChainID(chainID), - ) - }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Codec), - TimeoutCommit: 2 * time.Second, - ChainID: chainID, - NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), - AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), - PruningStrategy: pruningtypes.PruningOptionNothing, - CleanupDir: true, - SigningAlgo: string(hd.Secp256k1Type), - KeyringOptions: []keyring.Option{}, + cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) + if err != nil { + panic(err) } + ports, err := freePorts(3) + if err != nil { + panic(err) + } + if cfg.APIAddress == "" { + cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) + } + if cfg.RPCAddress == "" { + cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) + } + if cfg.GRPCAddress == "" { + cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) + } + return cfg +} + +// freePorts return the available ports based on the number of requested ports. +func freePorts(n int) ([]string, error) { + closeFns := make([]func() error, n) + ports := make([]string, n) + for i := 0; i < n; i++ { + _, port, closeFn, err := network.FreeTCPAddr() + if err != nil { + return nil, err + } + ports[i] = port + closeFns[i] = closeFn + } + for _, closeFn := range closeFns { + if err := closeFn(); err != nil { + return nil, err + } + } + return ports, nil } diff --git a/ignite/templates/typed/gogoproto.go b/ignite/templates/typed/gogoproto.go deleted file mode 100644 index 5aed61b1bb..0000000000 --- a/ignite/templates/typed/gogoproto.go +++ /dev/null @@ -1,4 +0,0 @@ -package typed - -// GoGoProtoImport is the import path for the gogoproto package. -const GoGoProtoImport = "gogoproto/gogo.proto" diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush deleted file mode 100644 index a904c6ce1e..0000000000 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush +++ /dev/null @@ -1,82 +0,0 @@ -package cli - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdList<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-<%= TypeName.Kebab %>", - Short: "list all <%= TypeName.Original %>", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAll<%= TypeName.UpperCamel %>Request{ - Pagination: pageReq, - } - - res, err := queryClient.<%= TypeName.UpperCamel %>All(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShow<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-<%= TypeName.Kebab %> [id]", - Short: "shows a <%= TypeName.Original %>", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - params := &types.QueryGet<%= TypeName.UpperCamel %>Request{ - Id: id, - } - - res, err := queryClient.<%= TypeName.UpperCamel %>(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush deleted file mode 100644 index bc13818958..0000000000 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush +++ /dev/null @@ -1,152 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "<%= ModulePath %>/testutil/nullify" - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func (s *IntegrationTestSuite) networkWith<%= TypeName.UpperCamel %>Objects(n int) []types.<%= TypeName.UpperCamel %> { - s.T().Helper() - state := types.GenesisState{<%= if (IsIBC) { %>PortId: types.PortID<% } %>} - for i := 0; i < n; i++ { - <%= TypeName.LowerCamel %> := types.<%= TypeName.UpperCamel %>{ - Id: uint64(i), - } - nullify.Fill(&<%= TypeName.LowerCamel %>) - state.<%= TypeName.UpperCamel %>List = append(state.<%= TypeName.UpperCamel %>List, <%= TypeName.LowerCamel %>) - } - buf, err := s.cfg.Codec.MarshalJSON(&state) - s.Require().NoError(err) - s.cfg.GenesisState[types.ModuleName] = buf - return state.<%= TypeName.UpperCamel %>List -} - -func (s *IntegrationTestSuite) TestShow<%= TypeName.UpperCamel %>() { - var ( - objs = s.networkWith<%= TypeName.UpperCamel %>Objects(2) - net = s.network() - ctx = net.Validators[0].ClientCtx - common = []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - ) - tests := []struct { - desc string - id string - args []string - err error - obj types.<%= TypeName.UpperCamel %> - }{ - { - desc: "found", - id: fmt.Sprintf("%d", objs[0].Id), - args: common, - obj: objs[0], - }, - { - desc: "not found", - id: "not_found", - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{tc.id}, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShow<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - return - } - require.NoError(t, err) - var resp types.QueryGet<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.<%= TypeName.UpperCamel %>) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.<%= TypeName.UpperCamel %>), - ) - }) - } -} - -func (s *IntegrationTestSuite) TestList<%= TypeName.UpperCamel %>() { - var ( - objs = s.networkWith<%= TypeName.UpperCamel %>Objects(5) - net = s.network() - ctx = net.Validators[0].ClientCtx - ) - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - s.T().Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - } - }) - s.T().Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - next = resp.Pagination.NextKey - } - }) - s.T().Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - }) -} diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index b428bd9978..672542dd15 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -3,8 +3,8 @@ package keeper import ( "context" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "<%= ModulePath %>/x/<%= ModuleName %>/types" @@ -12,15 +12,14 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) <%= TypeName.UpperCamel %>All(goCtx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } var <%= TypeName.LowerCamel %>s []types.<%= TypeName.UpperCamel %> - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) <%= TypeName.LowerCamel %>Store := prefix.NewStore(store, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) pageRes, err := query.Paginate(<%= TypeName.LowerCamel %>Store, req.Pagination, func(key []byte, value []byte) error { @@ -40,12 +39,11 @@ func (k Keeper) <%= TypeName.UpperCamel %>All(goCtx context.Context, req *types. return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (k Keeper) <%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (k Keeper) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) <%= TypeName.LowerCamel %>, found := k.Get<%= TypeName.UpperCamel %>(ctx, req.Id) if !found { return nil, sdkerrors.ErrKeyNotFound diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 8e875743f2..04d5ac1fa3 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" @@ -17,7 +16,6 @@ import ( func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 2) tests := []struct { desc string @@ -47,7 +45,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(wctx, tc.request) + response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -63,7 +61,6 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAll<%= TypeName.UpperCamel %>Request { @@ -79,7 +76,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -92,7 +89,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(next, 0, uint64(step), false)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -103,7 +100,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(nil, 0, 0, true)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -112,7 +109,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.<%= TypeName.UpperCamel %>All(wctx, nil) + _, err := keeper.<%= TypeName.UpperCamel %>All(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush index 25b193ae64..c7f2423799 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush @@ -1,16 +1,19 @@ package keeper import ( + "context" "encoding/binary" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "<%= ModulePath %>/x/<%= ModuleName %>/types" - "github.com/cosmos/cosmos-sdk/store/prefix" ) // Get<%= TypeName.UpperCamel %>Count get the total number of <%= TypeName.LowerCamel %> -func (k Keeper) Get<%= TypeName.UpperCamel %>Count(ctx sdk.Context) uint64 { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{}) +func (k Keeper) Get<%= TypeName.UpperCamel %>Count(ctx context.Context) uint64 { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) byteKey := types.KeyPrefix(types.<%= TypeName.UpperCamel %>CountKey) bz := store.Get(byteKey) @@ -24,8 +27,9 @@ func (k Keeper) Get<%= TypeName.UpperCamel %>Count(ctx sdk.Context) uint64 { } // Set<%= TypeName.UpperCamel %>Count set the total number of <%= TypeName.LowerCamel %> -func (k Keeper) Set<%= TypeName.UpperCamel %>Count(ctx sdk.Context, count uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{}) +func (k Keeper) Set<%= TypeName.UpperCamel %>Count(ctx context.Context, count uint64) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, []byte{}) byteKey := types.KeyPrefix(types.<%= TypeName.UpperCamel %>CountKey) bz := make([]byte, 8) binary.BigEndian.PutUint64(bz, count) @@ -34,7 +38,7 @@ func (k Keeper) Set<%= TypeName.UpperCamel %>Count(ctx sdk.Context, count uint64 // Append<%= TypeName.UpperCamel %> appends a <%= TypeName.LowerCamel %> in the store with a new id and update the count func (k Keeper) Append<%= TypeName.UpperCamel %>( - ctx sdk.Context, + ctx context.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>, ) uint64 { // Create the <%= TypeName.LowerCamel %> @@ -43,7 +47,8 @@ func (k Keeper) Append<%= TypeName.UpperCamel %>( // Set the ID of the appended value <%= TypeName.LowerCamel %>.Id = count - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) appendedValue := k.cdc.MustMarshal(&<%= TypeName.LowerCamel %>) store.Set(Get<%= TypeName.UpperCamel %>IDBytes(<%= TypeName.LowerCamel %>.Id), appendedValue) @@ -54,15 +59,17 @@ func (k Keeper) Append<%= TypeName.UpperCamel %>( } // Set<%= TypeName.UpperCamel %> set a specific <%= TypeName.LowerCamel %> in the store -func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx sdk.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx context.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) b := k.cdc.MustMarshal(&<%= TypeName.LowerCamel %>) store.Set(Get<%= TypeName.UpperCamel %>IDBytes(<%= TypeName.LowerCamel %>.Id), b) } // Get<%= TypeName.UpperCamel %> returns a <%= TypeName.LowerCamel %> from its id -func (k Keeper) Get<%=TypeName.UpperCamel %>(ctx sdk.Context, id uint64) (val types.<%= TypeName.UpperCamel %>, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Get<%=TypeName.UpperCamel %>(ctx context.Context, id uint64) (val types.<%= TypeName.UpperCamel %>, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) b := store.Get(Get<%= TypeName.UpperCamel %>IDBytes(id)) if b == nil { return val, false @@ -72,15 +79,17 @@ func (k Keeper) Get<%=TypeName.UpperCamel %>(ctx sdk.Context, id uint64) (val ty } // Remove<%= TypeName.UpperCamel %> removes a <%= TypeName.LowerCamel %> from the store -func (k Keeper) Remove<%= TypeName.UpperCamel %>(ctx sdk.Context, id uint64) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Remove<%= TypeName.UpperCamel %>(ctx context.Context, id uint64) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) store.Delete(Get<%= TypeName.UpperCamel %>IDBytes(id)) } // GetAll<%= TypeName.UpperCamel %> returns all <%= TypeName.LowerCamel %> -func (k Keeper) GetAll<%= TypeName.UpperCamel %>(ctx sdk.Context) (list []types.<%= TypeName.UpperCamel %>) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) GetAll<%= TypeName.UpperCamel %>(ctx context.Context) (list []types.<%= TypeName.UpperCamel %>) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() @@ -95,12 +104,8 @@ func (k Keeper) GetAll<%= TypeName.UpperCamel %>(ctx sdk.Context) (list []types. // Get<%= TypeName.UpperCamel %>IDBytes returns the byte representation of the ID func Get<%= TypeName.UpperCamel %>IDBytes(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, id) + bz := types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key) + bz = append(bz, []byte("/")...) + bz = binary.BigEndian.AppendUint64(bz, id) return bz } - -// Get<%= TypeName.UpperCamel %>IDFromBytes returns ID in uint64 format from a byte array -func Get<%= TypeName.UpperCamel %>IDFromBytes(bz []byte) uint64 { - return binary.BigEndian.Uint64(bz) -} diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush index 02d84ecf18..c1c27d7429 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush @@ -1,17 +1,17 @@ package keeper_test import ( + "context" "testing" "<%= ModulePath %>/x/<%= ModuleName %>/keeper" "<%= ModulePath %>/x/<%= ModuleName %>/types" - sdk "github.com/cosmos/cosmos-sdk/types" keepertest "<%= ModulePath %>/testutil/keeper" "<%= ModulePath %>/testutil/nullify" "github.com/stretchr/testify/require" ) -func createN<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx sdk.Context, n int) []types.<%= TypeName.UpperCamel %> { +func createN<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx context.Context, n int) []types.<%= TypeName.UpperCamel %> { items := make([]types.<%= TypeName.UpperCamel %>, n) for i := range items { items[i].Id = keeper.Append<%= TypeName.UpperCamel%>(ctx, items[i]) diff --git a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush b/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush deleted file mode 100644 index c2dde5b285..0000000000 --- a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush +++ /dev/null @@ -1,99 +0,0 @@ -package cli - -import ( - "strconv" - <%= for (goImport) in mergeGoImports(Fields) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdCreate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-<%= TypeName.Kebab %><%= Fields.String() %>", - Short: "Create a new <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgCreate<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String()<%= for (i, field) in Fields { %>, arg<%= field.Name.UpperCamel %><% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdUpdate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-<%= TypeName.Kebab %> [id]<%= Fields.String() %>", - Short: "Update a <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) + 1 %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - <%= for (i, field) in Fields { %> - <%= field.CLIArgs("arg", i+1) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUpdate<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String(), id<%= for (i, field) in Fields { %>, arg<%= field.Name.UpperCamel %><% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDelete<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "delete-<%= TypeName.Kebab %> [id]", - Short: "Delete a <%= TypeName.Original %> by id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDelete<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String(), id) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush deleted file mode 100644 index 608a4fc742..0000000000 --- a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush +++ /dev/null @@ -1,180 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" -) - -func (s *IntegrationTestSuite) TestCreate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - tests := []struct { - desc string - args []string - err error - code uint32 - }{ - { - desc: "valid", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - }, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{}, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestUpdate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := append([]string{}, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - id string - args []string - code uint32 - err error - }{ - { - desc: "valid", - id: "0", - args: common, - }, - { - desc: "key not found", - id: "1", - args: common, - code: sdkerrors.ErrKeyNotFound.ABCICode(), - }, - { - desc: "invalid key", - id: "invalid", - err: strconv.ErrSyntax, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{tc.id}, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestDelete<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := append([]string{}, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - id string - args []string - code uint32 - err error - }{ - { - desc: "valid", - id: "0", - args: common, - }, - { - desc: "key not found", - id: "1", - args: common, - code: sdkerrors.ErrKeyNotFound.ABCICode(), - }, - { - desc: "invalid key", - id: "invalid", - err: strconv.ErrSyntax, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdDelete<%= TypeName.UpperCamel %>(), append([]string{tc.id}, tc.args...)) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} diff --git a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush b/ignite/templates/typed/list/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush index d58bbb4d03..eaa9b53508 100644 --- a/ignite/templates/typed/list/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush @@ -6,12 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const ( - TypeMsgCreate<%= TypeName.UpperCamel %> = "create_<%= TypeName.Snake %>" - TypeMsgUpdate<%= TypeName.UpperCamel %> = "update_<%= TypeName.Snake %>" - TypeMsgDelete<%= TypeName.UpperCamel %> = "delete_<%= TypeName.Snake %>" -) - var _ sdk.Msg = &MsgCreate<%= TypeName.UpperCamel %>{} func NewMsgCreate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<%= for (field) in Fields { %>, <%= field.Name.LowerCamel %> <%= field.DataType() %><% } %>) *MsgCreate<%= TypeName.UpperCamel %> { @@ -21,27 +15,6 @@ func NewMsgCreate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<% } } -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgCreate<%= TypeName.UpperCamel %> -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgCreate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -60,27 +33,6 @@ func NewMsgUpdate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string, } } -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgUpdate<%= TypeName.UpperCamel %> -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgUpdate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -97,26 +49,6 @@ func NewMsgDelete<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string, <%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, } } -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgDelete<%= TypeName.UpperCamel %> -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} func (msg *MsgDelete<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) diff --git a/ignite/templates/typed/list/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush b/ignite/templates/typed/list/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush index 2b1eb97839..2b4b871bd7 100644 --- a/ignite/templates/typed/list/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush @@ -31,7 +31,6 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -65,7 +64,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( } } if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() msg.Id = <%= TypeName.LowerCamel %>.Id @@ -76,7 +75,6 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -110,7 +108,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( } } if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() msg.Id = <%= TypeName.LowerCamel %>.Id @@ -121,7 +119,6 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, diff --git a/ignite/templates/typed/list/genesis.go b/ignite/templates/typed/list/genesis.go index 958b31fd35..b9bd4f81e8 100644 --- a/ignite/templates/typed/list/genesis.go +++ b/ignite/templates/typed/list/genesis.go @@ -115,7 +115,7 @@ for _, elem := range gs.%[3]vList { func genesisModuleModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -154,7 +154,7 @@ genesis.%[2]vCount = k.Get%[2]vCount(ctx) func genesisTestsModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis_test.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis_test.go") f, err := r.Disk.Find(path) if err != nil { return err diff --git a/ignite/templates/typed/list/list.go b/ignite/templates/typed/list/list.go index 5c86a227a4..e3603b5ff8 100644 --- a/ignite/templates/typed/list/list.go +++ b/ignite/templates/typed/list/list.go @@ -130,6 +130,7 @@ func protoTxModify(opts *typed.Options) genny.RunFn { } // Messages creator := protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1) + creatorOpt := protoutil.NewOption(typed.MsgSignerOption, opts.MsgSigner.LowerCamel) createFields := []*proto.NormalField{creator} for i, field := range opts.Fields { createFields = append(createFields, field.ToProtoField(i+2)) @@ -140,17 +141,35 @@ func protoTxModify(opts *typed.Options) genny.RunFn { updateFields = append(updateFields, field.ToProtoField(i+3)) } - msgCreate := protoutil.NewMessage("MsgCreate"+typenameUpper, protoutil.WithFields(createFields...)) + msgCreate := protoutil.NewMessage( + "MsgCreate"+typenameUpper, + protoutil.WithFields(createFields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgCreateResponse := protoutil.NewMessage( "MsgCreate"+typenameUpper+"Response", protoutil.WithFields(protoutil.NewField("id", "uint64", 1)), ) - msgUpdate := protoutil.NewMessage("MsgUpdate"+typenameUpper, protoutil.WithFields(updateFields...)) + msgUpdate := protoutil.NewMessage( + "MsgUpdate"+typenameUpper, + protoutil.WithFields(updateFields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgUpdateResponse := protoutil.NewMessage("MsgUpdate" + typenameUpper + "Response") - msgDelete := protoutil.NewMessage("MsgDelete"+typenameUpper, protoutil.WithFields(udfields...)) + msgDelete := protoutil.NewMessage( + "MsgDelete"+typenameUpper, + protoutil.WithFields(udfields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgDeleteResponse := protoutil.NewMessage("MsgDelete" + typenameUpper + "Response") - protoutil.Append(protoFile, - msgCreate, msgCreateResponse, msgUpdate, msgUpdateResponse, msgDelete, msgDeleteResponse, + protoutil.Append( + protoFile, + msgCreate, + msgCreateResponse, + msgUpdate, + msgUpdateResponse, + msgDelete, + msgDeleteResponse, ) newFile := genny.NewFileS(path, protoutil.Print(protoFile)) @@ -274,14 +293,6 @@ func typesCodecModify(replacer placeholder.Replacer, opts *typed.Options) genny. replacementImport := `sdk "github.com/cosmos/cosmos-sdk/types"` content := replacer.ReplaceOnce(f.String(), typed.Placeholder, replacementImport) - // Concrete - templateConcrete := `cdc.RegisterConcrete(&MsgCreate%[2]v{}, "%[3]v/Create%[2]v", nil) -cdc.RegisterConcrete(&MsgUpdate%[2]v{}, "%[3]v/Update%[2]v", nil) -cdc.RegisterConcrete(&MsgDelete%[2]v{}, "%[3]v/Delete%[2]v", nil) -%[1]v` - replacementConcrete := fmt.Sprintf(templateConcrete, typed.Placeholder2, opts.TypeName.UpperCamel, opts.ModuleName) - content = replacer.Replace(content, typed.Placeholder2, replacementConcrete) - // Interface templateInterface := `registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreate%[2]v{}, @@ -299,17 +310,46 @@ cdc.RegisterConcrete(&MsgDelete%[2]v{}, "%[3]v/Delete%[2]v", nil) func clientCliTxModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdCreate%[2]v()) - cmd.AddCommand(CmdUpdate%[2]v()) - cmd.AddCommand(CmdDelete%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, opts.TypeName.UpperCamel) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + + var positionalArgs string + for _, field := range opts.Fields { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "Create%[2]v", + Use: "create-%[3]v", + Short: "Create %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Update%[2]v", + Use: "update-%[3]v", + Short: "Update %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Delete%[2]v", + Use: "delete-%[3]v", + Short: "Delete %[4]v", + }, + %[1]v` + + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLITx, + opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, + strings.TrimSpace(positionalArgs), + ) + + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLITx, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -317,18 +357,32 @@ func clientCliTxModify(replacer placeholder.Replacer, opts *typed.Options) genny func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/query.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdList%[2]v()) - cmd.AddCommand(CmdShow%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, + + template := `{ + RpcMethod: "%[2]vAll", + Use: "list-%[3]v", + Short: "List all %[4]v", + }, + { + RpcMethod: "%[2]v", + Use: "show-%[3]v [id]", + Short: "Shows a %[4]v by id", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}}, + }, + %[1]v` + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLIQuery, opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, ) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLIQuery, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } diff --git a/ignite/templates/typed/list/simulation.go b/ignite/templates/typed/list/simulation.go index 4806a6b919..d71c455214 100644 --- a/ignite/templates/typed/list/simulation.go +++ b/ignite/templates/typed/list/simulation.go @@ -12,7 +12,7 @@ import ( func moduleSimulationModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_simulation.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/simulation.go") f, err := r.Disk.Find(path) if err != nil { return err diff --git a/ignite/templates/typed/map/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush b/ignite/templates/typed/map/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush deleted file mode 100644 index 2ae7648f6c..0000000000 --- a/ignite/templates/typed/map/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush +++ /dev/null @@ -1,81 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - - <%= for (goImport) in mergeGoImports(Indexes) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdList<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-<%= TypeName.Kebab %>", - Short: "list all <%= TypeName.Original %>", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAll<%= TypeName.UpperCamel %>Request{ - Pagination: pageReq, - } - - res, err := queryClient.<%= TypeName.UpperCamel %>All(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShow<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-<%= TypeName.Kebab %><%= Indexes.String() %>", - Short: "shows a <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Indexes) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - <%= for (i, field) in Indexes { %> <%= field.CLIArgs("arg", i) %> - <% } %> - params := &types.QueryGet<%= TypeName.UpperCamel %>Request{ - <%= for (i, index) in Indexes { %><%= index.Name.UpperCamel %>: arg<%= index.Name.UpperCamel %>, - <% } %> - } - - res, err := queryClient.<%= TypeName.UpperCamel %>(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index 6e4e605442..baf3e232c2 100644 --- a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -3,23 +3,22 @@ package keeper import ( "context" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" "<%= ModulePath %>/x/<%= ModuleName %>/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -func (k Keeper) <%= TypeName.UpperCamel %>All(goCtx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } var <%= TypeName.LowerCamel %>s []types.<%= TypeName.UpperCamel %> - ctx := sdk.UnwrapSDKContext(goCtx) - store := ctx.KVStore(k.storeKey) + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) <%= TypeName.LowerCamel %>Store := prefix.NewStore(store, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) pageRes, err := query.Paginate(<%= TypeName.LowerCamel %>Store, req.Pagination, func(key []byte, value []byte) error { @@ -39,11 +38,10 @@ func (k Keeper) <%= TypeName.UpperCamel %>All(goCtx context.Context, req *types. return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (k Keeper) <%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (k Keeper) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) val, found := k.Get<%= TypeName.UpperCamel %>( ctx, diff --git a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush index c55424bd18..a0c681ce6a 100644 --- a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush @@ -1,14 +1,18 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "<%= ModulePath %>/x/<%= ModuleName %>/types" - "github.com/cosmos/cosmos-sdk/store/prefix" ) // Set<%= TypeName.UpperCamel %> set a specific <%= TypeName.LowerCamel %> in the store from its index -func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx sdk.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) +func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx context.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) b := k.cdc.MustMarshal(&<%= TypeName.LowerCamel %>) store.Set(types.<%= TypeName.UpperCamel %>Key( <%= for (i, index) in Indexes { %><%= TypeName.LowerCamel %>.<%= index.Name.UpperCamel %>, @@ -17,11 +21,12 @@ func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx sdk.Context, <%= TypeName.Lowe // Get<%= TypeName.UpperCamel %> returns a <%= TypeName.LowerCamel %> from its index func (k Keeper) Get<%= TypeName.UpperCamel %>( - ctx sdk.Context, + ctx context.Context, <%= for (i, index) in Indexes { %><%= index.Name.LowerCamel %> <%= index.DataType() %>, <% } %> ) (val types.<%= TypeName.UpperCamel %>, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) b := store.Get(types.<%= TypeName.UpperCamel %>Key( <%= for (i, index) in Indexes { %><%= index.Name.LowerCamel %>, @@ -36,20 +41,22 @@ func (k Keeper) Get<%= TypeName.UpperCamel %>( // Remove<%= TypeName.UpperCamel %> removes a <%= TypeName.LowerCamel %> from the store func (k Keeper) Remove<%= TypeName.UpperCamel %>( - ctx sdk.Context, + ctx context.Context, <%= for (i, index) in Indexes { %><%= index.Name.LowerCamel %> <%= index.DataType() %>, <% } %> ) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) store.Delete(types.<%= TypeName.UpperCamel %>Key( <%= for (i, index) in Indexes { %><%= index.Name.LowerCamel %>, <% } %>)) } // GetAll<%= TypeName.UpperCamel %> returns all <%= TypeName.LowerCamel %> -func (k Keeper) GetAll<%= TypeName.UpperCamel %>(ctx sdk.Context) (list []types.<%= TypeName.UpperCamel %>) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) GetAll<%= TypeName.UpperCamel %>(ctx context.Context) (list []types.<%= TypeName.UpperCamel %>) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() diff --git a/ignite/templates/typed/map/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush b/ignite/templates/typed/map/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush deleted file mode 100644 index 94feb6425f..0000000000 --- a/ignite/templates/typed/map/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush +++ /dev/null @@ -1,108 +0,0 @@ -package cli - -import ( - <%= for (goImport) in mergeGoImports(Indexes, Fields) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdCreate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-<%= TypeName.Kebab %><%= Indexes.String() %><%= Fields.String() %>", - Short: "Create a new <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) + len(Indexes) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - // Get indexes - <%= for (i, field) in Indexes { %> <%= field.CLIArgs("index", i) %> - <% } %> - // Get value arguments - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i+len(Indexes)) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgCreate<%= TypeName.UpperCamel %>( - clientCtx.GetFromAddress().String(), - <%= for (i, index) in Indexes { %>index<%= index.Name.UpperCamel %>, - <% } %><%= for (i, field) in Fields { %>arg<%= field.Name.UpperCamel %>, - <% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdUpdate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-<%= TypeName.Kebab %><%= Indexes.String() %><%= Fields.String() %>", - Short: "Update a <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) + len(Indexes) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - // Get indexes - <%= for (i, field) in Indexes { %> <%= field.CLIArgs("index", i) %> - <% } %> - // Get value arguments - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i+len(Indexes)) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUpdate<%= TypeName.UpperCamel %>( - clientCtx.GetFromAddress().String(), - <%= for (i, index) in Indexes { %>index<%= index.Name.UpperCamel %>, - <% } %><%= for (i, field) in Fields { %>arg<%= field.Name.UpperCamel %>, - <% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDelete<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "delete-<%= TypeName.Kebab %><%= Indexes.String() %>", - Short: "Delete a <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Indexes) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in Indexes { %> <%= field.CLIArgs("index", i) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDelete<%= TypeName.UpperCamel %>( - clientCtx.GetFromAddress().String(), - <%= for (i, index) in Indexes { %>index<%= index.Name.UpperCamel %>, - <% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} \ No newline at end of file diff --git a/ignite/templates/typed/map/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush b/ignite/templates/typed/map/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush index 76142afaac..1acf8e534b 100644 --- a/ignite/templates/typed/map/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush @@ -6,12 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const ( - TypeMsgCreate<%= TypeName.UpperCamel %> = "create_<%= TypeName.Snake %>" - TypeMsgUpdate<%= TypeName.UpperCamel %> = "update_<%= TypeName.Snake %>" - TypeMsgDelete<%= TypeName.UpperCamel %> = "delete_<%= TypeName.Snake %>" -) - var _ sdk.Msg = &MsgCreate<%= TypeName.UpperCamel %>{} func NewMsgCreate<%= TypeName.UpperCamel %>( @@ -28,27 +22,6 @@ func NewMsgCreate<%= TypeName.UpperCamel %>( } } -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgCreate<%= TypeName.UpperCamel %> -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgCreate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -73,27 +46,6 @@ func NewMsgUpdate<%= TypeName.UpperCamel %>( } } -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgUpdate<%= TypeName.UpperCamel %> -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgUpdate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -115,26 +67,6 @@ func NewMsgDelete<%= TypeName.UpperCamel %>( <% } %> } } -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgDelete<%= TypeName.UpperCamel %> -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} func (msg *MsgDelete<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) diff --git a/ignite/templates/typed/map/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush b/ignite/templates/typed/map/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush index da9d1c2c98..fb2392f0d4 100644 --- a/ignite/templates/typed/map/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush @@ -33,7 +33,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>( _, found := k.Get<%= TypeName.UpperCamel %>(ctx <%= for (index) in Indexes { %>, msg.<%= index.Name.UpperCamel %><% } %>) if found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.UpperCamel %> already exist"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.UpperCamel %> already exist"), nil, nil } txCtx := simulation.OperationInput{ @@ -42,7 +42,6 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -76,7 +75,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( } } if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() <%= for (i, index) in Indexes { %> @@ -88,7 +87,6 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -122,7 +120,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( } } if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() <%= for (i, index) in Indexes { %> @@ -134,7 +132,6 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, diff --git a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush deleted file mode 100644 index 9a5499ffa2..0000000000 --- a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush +++ /dev/null @@ -1,164 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "<%= ModulePath %>/testutil/nullify" - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func (s *IntegrationTestSuite) networkWith<%= TypeName.UpperCamel %>Objects(n int) []types.<%= TypeName.UpperCamel %> { - s.T().Helper() - state := types.GenesisState{<%= if (IsIBC) { %>PortId: types.PortID<% } %>} - for i := 0; i < n; i++ { - <%= TypeName.LowerCamel %> := types.<%= TypeName.UpperCamel %>{ - <%= for (index) in Indexes { %><%= index.Name.UpperCamel %>: <%= index.ValueLoop() %>, - <% } %> - } - nullify.Fill(&<%= TypeName.LowerCamel %>) - state.<%= TypeName.UpperCamel %>List = append(state.<%= TypeName.UpperCamel %>List, <%= TypeName.LowerCamel %>) - } - buf, err := s.cfg.Codec.MarshalJSON(&state) - s.Require().NoError(err) - s.cfg.GenesisState[types.ModuleName] = buf - return state.<%= TypeName.UpperCamel %>List -} - -func (s *IntegrationTestSuite) TestShow<%= TypeName.UpperCamel %>() { - var ( - objs = s.networkWith<%= TypeName.UpperCamel %>Objects(2) - net = s.network() - ctx = net.Validators[0].ClientCtx - common = []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - ) - tests := []struct { - desc string - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %> <%= index.DataType() %> - <% } %> - args []string - err error - obj types.<%= TypeName.UpperCamel %> - }{ - { - desc: "found", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: objs[0].<%= index.Name.UpperCamel %>, - <% } %> - args: common, - obj: objs[0], - }, - { - desc: "not found", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueInvalidIndex() %>, - <% } %> - args: common, - err: status.Error(codes.NotFound, "not found"), - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := []string{ - <%= for (i, index) in Indexes { %><%= index.ToString("tc.id" + index.Name.UpperCamel) %>, - <% } %> - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShow<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - return - } - require.NoError(t, err) - var resp types.QueryGet<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.<%= TypeName.UpperCamel %>) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.<%= TypeName.UpperCamel %>), - ) - }) - } -} - -func (s *IntegrationTestSuite) TestList<%= TypeName.UpperCamel %>() { - var ( - objs = s.networkWith<%= TypeName.UpperCamel %>Objects(5) - net = s.network() - ctx = net.Validators[0].ClientCtx - ) - request := func(next []byte, offset, limit uint64, total bool) []string { - args := []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - if next == nil { - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) - } else { - args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) - } - args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) - if total { - args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) - } - return args - } - s.T().Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(objs); i += step { - args := request(nil, uint64(i), uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - } - }) - s.T().Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(objs); i += step { - args := request(next, 0, uint64(step), false) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) - require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - next = resp.Pagination.NextKey - } - }) - s.T().Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdList<%= TypeName.UpperCamel %>(), args) - require.NoError(t, err) - var resp types.QueryAll<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) - require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.<%= TypeName.UpperCamel %>), - ) - }) -} diff --git a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 098d228d11..351254fe74 100644 --- a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -4,7 +4,6 @@ import ( "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -20,7 +19,6 @@ var _ = strconv.IntSize func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 2) tests := []struct { desc string @@ -59,7 +57,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(wctx, tc.request) + response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -75,7 +73,6 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAll<%= TypeName.UpperCamel %>Request { @@ -91,7 +88,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(nil, uint64(i), uint64(step), false)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -104,7 +101,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(next, 0, uint64(step), false)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -115,7 +112,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.<%= TypeName.UpperCamel %>All(wctx, request(nil, 0, 0, true)) + resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -124,7 +121,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.<%= TypeName.UpperCamel %>All(wctx, nil) + _, err := keeper.<%= TypeName.UpperCamel %>All(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush index d061978524..13f9c5e404 100644 --- a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush +++ b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush @@ -1,6 +1,7 @@ package keeper_test import ( + "context" "strconv" "testing" @@ -8,14 +9,13 @@ import ( "<%= ModulePath %>/x/<%= ModuleName %>/types" keepertest "<%= ModulePath %>/testutil/keeper" "<%= ModulePath %>/testutil/nullify" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) // Prevent strconv unused error var _ = strconv.IntSize -func createN<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx sdk.Context, n int) []types.<%= TypeName.UpperCamel %> { +func createN<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx context.Context, n int) []types.<%= TypeName.UpperCamel %> { items := make([]types.<%= TypeName.UpperCamel %>, n) for i := range items { <%= for (i, index) in Indexes { %>items[i].<%= index.Name.UpperCamel %> = <%= index.ValueLoop() %> diff --git a/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush deleted file mode 100644 index 479169b9c2..0000000000 --- a/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush +++ /dev/null @@ -1,204 +0,0 @@ -package cli_test - -import ( - "fmt" - "strconv" - "testing" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/stretchr/testify/require" - - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -func (s *IntegrationTestSuite) TestCreate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - tests := []struct { - desc string - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %> <%= index.DataType() %> - <% } %> - args []string - err error - code uint32 - }{ - { - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueIndex() %>, - <% } %> - desc: "valid", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - }, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := []string{ - <%= for (i, index) in Indexes { %><%= index.ToString("tc.id" + index.Name.UpperCamel) %>, - <% } %> - } - args = append(args, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestUpdate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := []string{ - <%= for (i, index) in Indexes { %>"0", - <% } %> - } - args = append(args, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %> <%= index.DataType() %> - <% } %> - args []string - code uint32 - err error - }{ - { - desc: "valid", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueIndex() %>, - <% } %> - args: common, - }, - { - desc: "key not found", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueInvalidIndex() %>, - <% } %> - args: common, - code: sdkerrors.ErrKeyNotFound.ABCICode(), - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := []string{ - <%= for (i, index) in Indexes { %><%= index.ToString("tc.id" + index.Name.UpperCamel) %>, - <% } %> - } - args = append(args, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestDelete<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := []string{ - <%= for (i, index) in Indexes { %>"0", - <% } %> - } - args = append(args, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %> <%= index.DataType() %> - <% } %> - args []string - code uint32 - err error - }{ - { - desc: "valid", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueIndex() %>, - <% } %> - args: common, - }, - { - desc: "key not found", - <%= for (i, index) in Indexes { %>id<%= index.Name.UpperCamel %>: <%= index.ValueInvalidIndex() %>, - <% } %> - args: common, - code: sdkerrors.ErrKeyNotFound.ABCICode(), - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := []string{ - <%= for (i, index) in Indexes { %><%= index.ToString("tc.id" + index.Name.UpperCamel) %>, - <% } %> - } - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdDelete<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} diff --git a/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush index 1997820002..d7160bc455 100644 --- a/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/map/files/tests/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush @@ -4,7 +4,6 @@ import ( "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" @@ -19,14 +18,13 @@ var _ = strconv.IntSize func Test<%= TypeName.UpperCamel %>MsgServerCreate(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) <%= MsgSigner.LowerCamel %> := "A" for i := 0; i < 5; i++ { expected := &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, <%= for (i, index) in Indexes { %><%= index.Name.UpperCamel %>: <%= index.ValueLoop() %>, <% } %> } - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, expected) + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, expected) require.NoError(t, err) rst, found := k.Get<%= TypeName.UpperCamel %>(ctx, <%= for (i, index) in Indexes { %>expected.<%= index.Name.UpperCamel %>, @@ -73,15 +71,14 @@ func Test<%= TypeName.UpperCamel %>MsgServerUpdate(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) expected := &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, <%= for (i, index) in Indexes { %><%= index.Name.UpperCamel %>: <%= index.ValueIndex() %>, <% } %> } - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, expected) + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, expected) require.NoError(t, err) - _, err = srv.Update<%= TypeName.UpperCamel %>(wctx, tc.request) + _, err = srv.Update<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -133,14 +130,13 @@ func Test<%= TypeName.UpperCamel %>MsgServerDelete(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, <%= for (i, index) in Indexes { %><%= index.Name.UpperCamel %>: <%= index.ValueIndex() %>, <% } %> }) require.NoError(t, err) - _, err = srv.Delete<%= TypeName.UpperCamel %>(wctx, tc.request) + _, err = srv.Delete<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { diff --git a/ignite/templates/typed/map/map.go b/ignite/templates/typed/map/map.go index a88cc786ae..5e60c4b4bb 100644 --- a/ignite/templates/typed/map/map.go +++ b/ignite/templates/typed/map/map.go @@ -236,18 +236,38 @@ func protoRPCModify(opts *typed.Options) genny.RunFn { func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/query.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdList%[2]v()) - cmd.AddCommand(CmdShow%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, + + var positionalArgs string + for _, field := range opts.Indexes { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "%[2]vAll", + Use: "list-%[3]v", + Short: "List all %[4]v", + }, + { + RpcMethod: "%[2]v", + Use: "show-%[3]v [id]", + Short: "Shows a %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%s}, + }, + %[1]v` + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLIQuery, opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, + strings.TrimSpace(positionalArgs), ) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLIQuery, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -349,7 +369,7 @@ for _, elem := range gs.%[3]vList { func genesisModuleModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -385,7 +405,7 @@ for _, elem := range genState.%[3]vList { func genesisTestsModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis_test.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis_test.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -546,22 +566,31 @@ func protoTxModify(opts *typed.Options) genny.RunFn { if err = protoutil.AddImports(protoFile, false, protoImports...); err != nil { return fmt.Errorf("failed while adding imports in %s: %w", path, err) } - commonFields := []*proto.NormalField{protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1)} + + creator := protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1) + creatorOpt := protoutil.NewOption(typed.MsgSignerOption, opts.MsgSigner.LowerCamel) + commonFields := []*proto.NormalField{creator} commonFields = append(commonFields, indexes...) msgCreate := protoutil.NewMessage( "MsgCreate"+typenameUpper, protoutil.WithFields(append(commonFields, fields...)...), + protoutil.WithMessageOptions(creatorOpt), ) msgCreateResponse := protoutil.NewMessage("MsgCreate" + typenameUpper + "Response") msgUpdate := protoutil.NewMessage( "MsgUpdate"+typenameUpper, protoutil.WithFields(append(commonFields, fields...)...), + protoutil.WithMessageOptions(creatorOpt), ) msgUpdateResponse := protoutil.NewMessage("MsgUpdate" + typenameUpper + "Response") - msgDelete := protoutil.NewMessage("MsgDelete"+typenameUpper, protoutil.WithFields(commonFields...)) + msgDelete := protoutil.NewMessage( + "MsgDelete"+typenameUpper, + protoutil.WithFields(commonFields...), + protoutil.WithMessageOptions(creatorOpt), + ) msgDeleteResponse := protoutil.NewMessage("MsgDelete" + typenameUpper + "Response") protoutil.Append(protoFile, msgCreate, msgCreateResponse, msgUpdate, msgUpdateResponse, msgDelete, msgDeleteResponse, @@ -574,17 +603,49 @@ func protoTxModify(opts *typed.Options) genny.RunFn { func clientCliTxModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdCreate%[2]v()) - cmd.AddCommand(CmdUpdate%[2]v()) - cmd.AddCommand(CmdDelete%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, opts.TypeName.UpperCamel) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + + var positionalArgs string + for _, field := range opts.Fields { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + for _, field := range opts.Indexes { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "Create%[2]v", + Use: "create-%[3]v", + Short: "Create a new %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Update%[2]v", + Use: "update-%[3]v", + Short: "Update %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Delete%[2]v", + Use: "delete-%[3]v", + Short: "Delete %[4]v", + }, + %[1]v` + + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLITx, + opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, + strings.TrimSpace(positionalArgs), + ) + + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLITx, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -604,19 +665,6 @@ func typesCodecModify(replacer placeholder.Replacer, opts *typed.Options) genny. replacementImport := `sdk "github.com/cosmos/cosmos-sdk/types"` content = replacer.ReplaceOnce(content, typed.Placeholder, replacementImport) - // Concrete - templateConcrete := `cdc.RegisterConcrete(&MsgCreate%[2]v{}, "%[3]v/Create%[2]v", nil) -cdc.RegisterConcrete(&MsgUpdate%[2]v{}, "%[3]v/Update%[2]v", nil) -cdc.RegisterConcrete(&MsgDelete%[2]v{}, "%[3]v/Delete%[2]v", nil) -%[1]v` - replacementConcrete := fmt.Sprintf( - templateConcrete, - typed.Placeholder2, - opts.TypeName.UpperCamel, - opts.ModuleName, - ) - content = replacer.Replace(content, typed.Placeholder2, replacementConcrete) - // Interface templateInterface := `registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreate%[2]v{}, diff --git a/ignite/templates/typed/map/simulation.go b/ignite/templates/typed/map/simulation.go index b9d2ee7f14..2c41118d54 100644 --- a/ignite/templates/typed/map/simulation.go +++ b/ignite/templates/typed/map/simulation.go @@ -12,7 +12,7 @@ import ( func moduleSimulationModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_simulation.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/simulation.go") f, err := r.Disk.Find(path) if err != nil { return err diff --git a/ignite/templates/typed/placeholders.go b/ignite/templates/typed/placeholders.go index 1ca63e4b1b..1ca61b23fb 100644 --- a/ignite/templates/typed/placeholders.go +++ b/ignite/templates/typed/placeholders.go @@ -18,4 +18,8 @@ const ( PlaceholderSimappGenesisState = "// this line is used by starport scaffolding # simapp/module/genesisState" PlaceholderSimappOperation = "// this line is used by starport scaffolding # simapp/module/operation" PlaceholderSimappOperationMsg = "// this line is used by starport scaffolding # simapp/module/OpMsg" + + // Placeholders AutoCLI + PlaceholderAutoCLIQuery = "// this line is used by ignite scaffolding # autocli/query" + PlaceholderAutoCLITx = "// this line is used by ignite scaffolding # autocli/tx" ) diff --git a/ignite/templates/typed/proto.go b/ignite/templates/typed/proto.go new file mode 100644 index 0000000000..802607161e --- /dev/null +++ b/ignite/templates/typed/proto.go @@ -0,0 +1,8 @@ +package typed + +const ( + // GoGoProtoImport is the import path for the gogoproto package. + GoGoProtoImport = "gogoproto/gogo.proto" + // MsgSignerOption correspond to the proto annotation for defining a message signer. + MsgSignerOption = "(cosmos.msg.v1.signer)" +) diff --git a/ignite/templates/typed/simapp.go b/ignite/templates/typed/simapp.go index 45d50b3175..26db4a796d 100644 --- a/ignite/templates/typed/simapp.go +++ b/ignite/templates/typed/simapp.go @@ -30,7 +30,7 @@ func ModuleSimulationMsgModify( // simulation operations templateOp := `var weightMsg%[2]v%[3]v int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsg%[2]v%[3]v, &weightMsg%[2]v%[3]v, nil, + simState.AppParams.GetOrGenerate(opWeightMsg%[2]v%[3]v, &weightMsg%[2]v%[3]v, nil, func(_ *rand.Rand) { weightMsg%[2]v%[3]v = defaultWeightMsg%[2]v%[3]v }, diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush deleted file mode 100644 index 2a699fc716..0000000000 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}.go.plush +++ /dev/null @@ -1,38 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdShow<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-<%= TypeName.Kebab %>", - Short: "shows <%= TypeName.Original %>", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGet<%= TypeName.UpperCamel %>Request{} - - res, err := queryClient.<%= TypeName.UpperCamel %>(cmd.Context(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush deleted file mode 100644 index e106924ce4..0000000000 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/client/cli/query_{{typeName}}_test.go.plush +++ /dev/null @@ -1,71 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - "github.com/stretchr/testify/require" - tmcli "github.com/cometbft/cometbft/libs/cli" - "google.golang.org/grpc/status" - - "<%= ModulePath %>/testutil/nullify" - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func (s *IntegrationTestSuite) networkWith<%= TypeName.UpperCamel %>Objects() (types.<%= TypeName.UpperCamel %>) { - s.T().Helper() - state := types.GenesisState{<%= if (IsIBC) { %>PortId: types.PortID<% } %>} - <%= TypeName.LowerCamel %> := &types.<%= TypeName.UpperCamel %>{} - nullify.Fill(&<%= TypeName.LowerCamel %>) - state.<%= TypeName.UpperCamel %> = <%= TypeName.LowerCamel %> - buf, err := s.cfg.Codec.MarshalJSON(&state) - s.Require().NoError(err) - s.cfg.GenesisState[types.ModuleName] = buf - return *state.<%= TypeName.UpperCamel %> -} - -func (s *IntegrationTestSuite) TestShow<%= TypeName.UpperCamel %>() { - var ( - obj = s.networkWith<%= TypeName.UpperCamel %>Objects() - net = s.network() - ctx = net.Validators[0].ClientCtx - common = []string{ - fmt.Sprintf("--%s=json", tmcli.OutputFlag), - } - ) - tests := []struct { - desc string - args []string - err error - obj types.<%= TypeName.UpperCamel %> - }{ - { - desc: "get", - args: common, - obj: obj, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{}, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShow<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) - require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) - return - } - require.NoError(t, err) - var resp types.QueryGet<%= TypeName.UpperCamel %>Response - require.NoError(t, s.cfg.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NotNil(t, resp.<%= TypeName.UpperCamel %>) - require.Equal(t, - nullify.Fill(&tc.obj), - nullify.Fill(&resp.<%= TypeName.UpperCamel %>), - ) - }) - } -} - diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index abbe5cd0e7..47f50cfb76 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -15,7 +14,6 @@ import ( func Test<%= TypeName.UpperCamel %>Query(t *testing.T) { keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - wctx := sdk.WrapSDKContext(ctx) item := createTest<%= TypeName.UpperCamel %>(keeper, ctx) tests := []struct { desc string @@ -35,7 +33,7 @@ func Test<%= TypeName.UpperCamel %>Query(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(wctx, tc.request) + response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush index 0301a29d2f..b20f0d2df5 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}.go.plush @@ -1,21 +1,25 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + "github.com/cosmos/cosmos-sdk/runtime" "<%= ModulePath %>/x/<%= ModuleName %>/types" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" ) // Set<%= TypeName.UpperCamel %> set <%= TypeName.LowerCamel %> in the store -func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx sdk.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Set<%= TypeName.UpperCamel %>(ctx context.Context, <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %>) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) b := k.cdc.MustMarshal(&<%= TypeName.LowerCamel %>) store.Set([]byte{0}, b) } // Get<%= TypeName.UpperCamel %> returns <%= TypeName.LowerCamel %> -func (k Keeper) Get<%= TypeName.UpperCamel %>(ctx sdk.Context) (val types.<%= TypeName.UpperCamel %>, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Get<%= TypeName.UpperCamel %>(ctx context.Context) (val types.<%= TypeName.UpperCamel %>, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) b := store.Get([]byte{0}) if b == nil { @@ -27,7 +31,8 @@ func (k Keeper) Get<%= TypeName.UpperCamel %>(ctx sdk.Context) (val types.<%= Ty } // Remove<%= TypeName.UpperCamel %> removes <%= TypeName.LowerCamel %> from the store -func (k Keeper) Remove<%= TypeName.UpperCamel %>(ctx sdk.Context) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) +func (k Keeper) Remove<%= TypeName.UpperCamel %>(ctx context.Context) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) store.Delete([]byte{0}) } diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush index 52779b13ae..18c362873c 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/{{typeName}}_test.go.plush @@ -1,9 +1,9 @@ package keeper_test import ( + "context" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "<%= ModulePath %>/x/<%= ModuleName %>/keeper" @@ -12,7 +12,7 @@ import ( "<%= ModulePath %>/testutil/nullify" ) -func createTest<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx sdk.Context) types.<%= TypeName.UpperCamel %> { +func createTest<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx context.Context) types.<%= TypeName.UpperCamel %> { item := types.<%= TypeName.UpperCamel %>{} keeper.Set<%= TypeName.UpperCamel %>(ctx, item) return item diff --git a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush deleted file mode 100644 index 5c27fa30a4..0000000000 --- a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}.go.plush +++ /dev/null @@ -1,87 +0,0 @@ -package cli - -import ( - <%= for (goImport) in mergeGoImports(Fields) { %> - <%= goImport.Alias %> "<%= goImport.Name %>"<% } %> - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "<%= ModulePath %>/x/<%= ModuleName %>/types" -) - -func CmdCreate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-<%= TypeName.Kebab %><%= Fields.String() %>", - Short: "Create <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgCreate<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String()<%= for (i, field) in Fields { %>, arg<%= field.Name.UpperCamel %><% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdUpdate<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-<%= TypeName.Kebab %><%= Fields.String() %>", - Short: "Update <%= TypeName.Original %>", - Args: cobra.ExactArgs(<%= len(Fields) %>), - RunE: func(cmd *cobra.Command, args []string) (err error) { - <%= for (i, field) in Fields { %> <%= field.CLIArgs("arg", i) %> - <% } %> - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgUpdate<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String()<%= for (i, field) in Fields { %>, arg<%= field.Name.UpperCamel %><% } %>) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -func CmdDelete<%= TypeName.UpperCamel %>() *cobra.Command { - cmd := &cobra.Command{ - Use: "delete-<%= TypeName.Kebab %>", - Short: "Delete <%= TypeName.Original %>", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgDelete<%= TypeName.UpperCamel %>(clientCtx.GetFromAddress().String()) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} \ No newline at end of file diff --git a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush deleted file mode 100644 index 6d63845b90..0000000000 --- a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/client/cli/tx_{{typeName}}_test.go.plush +++ /dev/null @@ -1,152 +0,0 @@ -package cli_test - -import ( - "fmt" - "testing" - - sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "<%= ModulePath %>/x/<%= ModuleName %>/client/cli" -) - -func (s *IntegrationTestSuite) TestCreate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - tests := []struct { - desc string - args []string - err error - code uint32 - }{ - { - desc: "valid", - args: []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - }, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{}, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestUpdate<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := append([]string{}, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - args []string - code uint32 - err error - }{ - { - desc: "valid", - args: common, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - args := append([]string{}, fields...) - args = append(args, tc.args...) - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdUpdate<%= TypeName.UpperCamel %>(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} - -func (s *IntegrationTestSuite) TestDelete<%= TypeName.UpperCamel %>() { - var ( - net = s.network() - val = net.Validators[0] - ctx = val.ClientCtx - ) - - fields := []string{<%= for (field) in Fields { %> "<%= field.DefaultTestValue() %>", <% } %>} - common := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), - } - args := append([]string{}, fields...) - args = append(args, common...) - _, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdCreate<%= TypeName.UpperCamel %>(), args) - s.Require().NoError(err) - s.waitForNextBlock() - - tests := []struct { - desc string - args []string - code uint32 - err error - }{ - { - desc: "valid", - args: common, - }, - } - for _, tc := range tests { - s.T().Run(tc.desc, func(t *testing.T) { - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdDelete<%= TypeName.UpperCamel %>(), append([]string{}, tc.args...)) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - return - } - require.NoError(t, err) - - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.NoError(t, clitestutil.CheckTxCode(net, ctx, resp.TxHash, tc.code)) - }) - } -} diff --git a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush index 203de98691..ac5055420d 100644 --- a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/keeper/msg_server_{{typeName}}_test.go.plush @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" @@ -15,10 +14,9 @@ import ( func Test<%= TypeName.UpperCamel %>MsgServerCreate(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) <%= MsgSigner.LowerCamel %> := "A" expected := &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>} - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, expected) + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, expected) require.NoError(t, err) rst, found := k.Get<%= TypeName.UpperCamel %>(ctx) require.True(t, found) @@ -47,12 +45,11 @@ func Test<%= TypeName.UpperCamel %>MsgServerUpdate(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) expected := &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>} - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, expected) + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, expected) require.NoError(t, err) - _, err = srv.Update<%= TypeName.UpperCamel %>(wctx, tc.request) + _, err = srv.Update<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -87,11 +84,10 @@ func Test<%= TypeName.UpperCamel %>MsgServerDelete(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) srv := keeper.NewMsgServerImpl(k) - wctx := sdk.WrapSDKContext(ctx) - _, err := srv.Create<%= TypeName.UpperCamel %>(wctx, &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>}) + _, err := srv.Create<%= TypeName.UpperCamel %>(ctx, &types.MsgCreate<%= TypeName.UpperCamel %>{<%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>}) require.NoError(t, err) - _, err = srv.Delete<%= TypeName.UpperCamel %>(wctx, tc.request) + _, err = srv.Delete<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { diff --git a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush index f21875771e..38291c9ba6 100644 --- a/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush +++ b/ignite/templates/typed/singleton/files/messages/x/{{moduleName}}/types/messages_{{typeName}}.go.plush @@ -6,12 +6,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const ( - TypeMsgCreate<%= TypeName.UpperCamel %> = "create_<%= TypeName.Snake %>" - TypeMsgUpdate<%= TypeName.UpperCamel %> = "update_<%= TypeName.Snake %>" - TypeMsgDelete<%= TypeName.UpperCamel %> = "delete_<%= TypeName.Snake %>" -) - var _ sdk.Msg = &MsgCreate<%= TypeName.UpperCamel %>{} func NewMsgCreate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<%= for (field) in Fields { %>, <%= field.Name.LowerCamel %> <%= field.DataType() %><% } %>) *MsgCreate<%= TypeName.UpperCamel %> { @@ -21,27 +15,6 @@ func NewMsgCreate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<% } } -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgCreate<%= TypeName.UpperCamel %> -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgCreate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgCreate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -59,27 +32,6 @@ func NewMsgUpdate<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string<% } } -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgUpdate<%= TypeName.UpperCamel %> -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgUpdate<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - func (msg *MsgUpdate<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) if err != nil { @@ -95,26 +47,6 @@ func NewMsgDelete<%= TypeName.UpperCamel %>(<%= MsgSigner.LowerCamel %> string) <%= MsgSigner.UpperCamel %>: <%= MsgSigner.LowerCamel %>, } } -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Route() string { - return RouterKey -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) Type() string { - return TypeMsgDelete<%= TypeName.UpperCamel %> -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSigners() []sdk.AccAddress { - <%= MsgSigner.LowerCamel %>, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) - if err != nil { - panic(err) - } - return []sdk.AccAddress{<%= MsgSigner.LowerCamel %>} -} - -func (msg *MsgDelete<%= TypeName.UpperCamel %>) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} func (msg *MsgDelete<%= TypeName.UpperCamel %>) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.<%= MsgSigner.UpperCamel %>) diff --git a/ignite/templates/typed/singleton/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush index b863b54794..ca6ca9b8c0 100644 --- a/ignite/templates/typed/singleton/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush +++ b/ignite/templates/typed/singleton/files/simapp/x/{{moduleName}}/simulation/{{typeName}}.go.plush @@ -27,7 +27,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>( _, found := k.Get<%= TypeName.UpperCamel %>(ctx) if found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.UpperCamel %> already exist"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.UpperCamel %> already exist"), nil, nil } txCtx := simulation.OperationInput{ @@ -36,7 +36,6 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -61,11 +60,11 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( <%= TypeName.LowerCamel %>, found = k.Get<%= TypeName.UpperCamel %>(ctx) ) if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> store is empty"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> store is empty"), nil, nil } simAccount, found = FindAccount(accs, <%= TypeName.LowerCamel %>.<%= MsgSigner.UpperCamel %>) if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() @@ -75,7 +74,6 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, @@ -100,11 +98,11 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( <%= TypeName.LowerCamel %>, found = k.Get<%= TypeName.UpperCamel %>(ctx) ) if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> store is empty"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> store is empty"), nil, nil } simAccount, found = FindAccount(accs, <%= TypeName.LowerCamel %>.<%= MsgSigner.UpperCamel %>) if !found { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "<%= TypeName.LowerCamel %> <%= MsgSigner.LowerCamel %> not found"), nil, nil } msg.<%= MsgSigner.UpperCamel %> = simAccount.Address.String() @@ -114,7 +112,6 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>( TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: msg.Type(), Context: ctx, SimAccount: simAccount, ModuleName: types.ModuleName, diff --git a/ignite/templates/typed/singleton/simulation.go b/ignite/templates/typed/singleton/simulation.go index 5c0933577e..714de80366 100644 --- a/ignite/templates/typed/singleton/simulation.go +++ b/ignite/templates/typed/singleton/simulation.go @@ -11,7 +11,7 @@ import ( func moduleSimulationModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module_simulation.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/simulation.go") f, err := r.Disk.Find(path) if err != nil { return err diff --git a/ignite/templates/typed/singleton/singleton.go b/ignite/templates/typed/singleton/singleton.go index 98966e9084..9059678129 100644 --- a/ignite/templates/typed/singleton/singleton.go +++ b/ignite/templates/typed/singleton/singleton.go @@ -5,6 +5,7 @@ import ( "fmt" "math/rand" "path/filepath" + "strings" "github.com/emicklei/proto" @@ -157,17 +158,26 @@ func protoRPCModify(opts *typed.Options) genny.RunFn { func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/query.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdShow%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, + + template := `{ + RpcMethod: "%[2]v", + Use: "show-%[3]v", + Short: "show %[4]v", + }, + %[1]v` + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLIQuery, opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, ) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLIQuery, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -238,7 +248,7 @@ func genesisTypesModify(replacer placeholder.Replacer, opts *typed.Options) genn func genesisTestsModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis_test.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis_test.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -307,7 +317,7 @@ func genesisTypesTestsModify(replacer placeholder.Replacer, opts *typed.Options) func genesisModuleModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "genesis.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/genesis.go") f, err := r.Disk.Find(path) if err != nil { return err @@ -395,20 +405,27 @@ func protoTxModify(opts *typed.Options) genny.RunFn { // Add the messages creator := protoutil.NewField(opts.MsgSigner.LowerCamel, "string", 1) + creatorOpt := protoutil.NewOption(typed.MsgSignerOption, opts.MsgSigner.LowerCamel) fields := []*proto.NormalField{creator} for i, field := range opts.Fields { fields = append(fields, field.ToProtoField(i+3)) } msgCreate := protoutil.NewMessage( - "MsgCreate"+name, protoutil.WithFields(fields...), + "MsgCreate"+name, + protoutil.WithFields(fields...), + protoutil.WithMessageOptions(creatorOpt), ) msgCreateResponse := protoutil.NewMessage("MsgCreate" + name + "Response") msgUpdate := protoutil.NewMessage( - "MsgUpdate"+name, protoutil.WithFields(fields...), + "MsgUpdate"+name, + protoutil.WithFields(fields...), + protoutil.WithMessageOptions(creatorOpt), ) msgUpdateResponse := protoutil.NewMessage("MsgUpdate" + name + "Response") msgDelete := protoutil.NewMessage( - "MsgDelete"+name, protoutil.WithFields(creator), + "MsgDelete"+name, + protoutil.WithFields(creator), + protoutil.WithMessageOptions(creatorOpt), ) msgDeleteResponse := protoutil.NewMessage("MsgDelete" + name + "Response") protoutil.Append(protoFile, @@ -422,17 +439,46 @@ func protoTxModify(opts *typed.Options) genny.RunFn { func clientCliTxModify(replacer placeholder.Replacer, opts *typed.Options) genny.RunFn { return func(r *genny.Runner) error { - path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "client/cli/tx.go") + path := filepath.Join(opts.AppPath, "x", opts.ModuleName, "module/autocli.go") f, err := r.Disk.Find(path) if err != nil { return err } - template := `cmd.AddCommand(CmdCreate%[2]v()) - cmd.AddCommand(CmdUpdate%[2]v()) - cmd.AddCommand(CmdDelete%[2]v()) -%[1]v` - replacement := fmt.Sprintf(template, typed.Placeholder, opts.TypeName.UpperCamel) - content := replacer.Replace(f.String(), typed.Placeholder, replacement) + + var positionalArgs string + for _, field := range opts.Fields { + positionalArgs += fmt.Sprintf(`{ProtoField: "%s"}, `, field.ProtoFieldName()) + } + + template := `{ + RpcMethod: "Create%[2]v", + Use: "create-%[3]v", + Short: "Create %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Update%[2]v", + Use: "update-%[3]v", + Short: "Update %[4]v", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, + }, + { + RpcMethod: "Delete%[2]v", + Use: "delete-%[3]v", + Short: "Delete %[4]v", + }, + %[1]v` + + replacement := fmt.Sprintf( + template, + typed.PlaceholderAutoCLITx, + opts.TypeName.UpperCamel, + opts.TypeName.Kebab, + opts.TypeName.Original, + strings.TrimSpace(positionalArgs), + ) + + content := replacer.Replace(f.String(), typed.PlaceholderAutoCLITx, replacement) newFile := genny.NewFileS(path, content) return r.File(newFile) } @@ -452,19 +498,6 @@ func typesCodecModify(replacer placeholder.Replacer, opts *typed.Options) genny. replacementImport := `sdk "github.com/cosmos/cosmos-sdk/types"` content = replacer.ReplaceOnce(content, typed.Placeholder, replacementImport) - // Concrete - templateConcrete := `cdc.RegisterConcrete(&MsgCreate%[2]v{}, "%[3]v/Create%[2]v", nil) -cdc.RegisterConcrete(&MsgUpdate%[2]v{}, "%[3]v/Update%[2]v", nil) -cdc.RegisterConcrete(&MsgDelete%[2]v{}, "%[3]v/Delete%[2]v", nil) -%[1]v` - replacementConcrete := fmt.Sprintf( - templateConcrete, - typed.Placeholder2, - opts.TypeName.UpperCamel, - opts.ModuleName, - ) - content = replacer.Replace(content, typed.Placeholder2, replacementConcrete) - // Interface templateInterface := `registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreate%[2]v{}, diff --git a/integration/app.go b/integration/app.go index 54516c5d7b..5a05b60944 100644 --- a/integration/app.go +++ b/integration/app.go @@ -24,7 +24,7 @@ const ServeTimeout = time.Minute * 15 const ( defaultConfigFileName = "config.yml" - defaultTestTimeout = 20 * time.Minute // Go's default is 10m + defaultTestTimeout = 30 * time.Minute // Go's default is 10m ) // Hosts contains the "hostname:port" addresses for different service hosts. diff --git a/integration/faucet/faucet_test.go b/integration/faucet/faucet_test.go index 9ad484a29b..5f3afbc9fe 100644 --- a/integration/faucet/faucet_test.go +++ b/integration/faucet/faucet_test.go @@ -113,7 +113,7 @@ func checkAccountBalance(t *testing.T, ctx context.Context, c cosmosclient.Clien require.Len(t, resp.Balances, len(coins)) expectedCoins, err := sdk.ParseCoinsNormalized(strings.Join(coins, ",")) require.NoError(t, err) - require.True(t, resp.Balances.IsEqual(expectedCoins), + require.True(t, resp.Balances.Equal(expectedCoins), fmt.Sprintf("%s should be equals to %s", resp.Balances.String(), expectedCoins.String()), ) } diff --git a/integration/plugin/plugin_test.go b/integration/plugin/plugin_test.go index 813af11180..9f0fe6268e 100644 --- a/integration/plugin/plugin_test.go +++ b/integration/plugin/plugin_test.go @@ -1,6 +1,7 @@ package plugin_test import ( + "path/filepath" "testing" "github.com/stretchr/testify/assert" @@ -14,11 +15,10 @@ import ( func TestAddRemovePlugin(t *testing.T) { var ( - require = require.New(t) - assert = assert.New(t) - env = envtest.New(t) - app = env.Scaffold("github.com/test/blog") - pluginRepo = "github.com/ignite/example-plugin" + require = require.New(t) + assert = assert.New(t) + env = envtest.New(t) + app = env.Scaffold("github.com/test/blog") assertPlugins = func(expectedLocalPlugins, expectedGlobalPlugins []pluginsconfig.Plugin) { localCfg, err := pluginsconfig.ParseDir(app.SourcePath()) @@ -36,7 +36,11 @@ func TestAddRemovePlugin(t *testing.T) { // no plugins expected assertPlugins(nil, nil) - env.Must(env.Exec("install plugin locally", + // Note: Originally plugin repo was "github.com/ignite/example-plugin" instead of a local one + pluginRepo, err := filepath.Abs("testdata/example-plugin") + require.NoError(err) + + env.Must(env.Exec("add plugin locally", step.NewSteps(step.New( step.Exec(envtest.IgniteApp, "app", "install", pluginRepo, "k1=v1", "k2=v2"), step.Workdir(app.SourcePath()), diff --git a/integration/plugin/testdata/example-plugin/go.mod b/integration/plugin/testdata/example-plugin/go.mod new file mode 100644 index 0000000000..8c55a3b462 --- /dev/null +++ b/integration/plugin/testdata/example-plugin/go.mod @@ -0,0 +1,82 @@ +module example-plugin + +go 1.21.1 + +toolchain go1.21.4 + +require ( + github.com/hashicorp/go-plugin v1.5.2 + github.com/ignite/cli v0.27.1 +) + +require ( + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect + github.com/acomagu/bufpipe v1.0.4 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/aymerick/douceur v0.2.0 // indirect + github.com/charmbracelet/lipgloss v0.6.0 // indirect + github.com/cloudflare/circl v1.3.3 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.10.0 // indirect + github.com/gobuffalo/flect v0.3.0 // indirect + github.com/gobuffalo/genny/v2 v2.1.0 // indirect + github.com/gobuffalo/github_flavored_markdown v1.1.4 // indirect + github.com/gobuffalo/helpers v0.6.7 // indirect + github.com/gobuffalo/logger v1.0.7 // indirect + github.com/gobuffalo/packd v1.0.2 // indirect + github.com/gobuffalo/plush/v4 v4.1.19 // indirect + github.com/gobuffalo/tags/v3 v3.1.4 // indirect + github.com/gobuffalo/validate/v3 v3.3.3 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/gorilla/css v1.0.0 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/microcosm-cc/bluemonday v1.0.23 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.15.1 // indirect + github.com/oklog/run v1.1.0 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rivo/uniseg v0.4.4 // indirect + github.com/sergi/go-diff v1.3.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/skeema/knownhosts v1.2.0 // indirect + github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect + github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect + github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + go.etcd.io/bbolt v1.3.8 // indirect + golang.org/x/crypto v0.15.0 // indirect + golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/term v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.15.0 // indirect + google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) + +replace github.com/ignite/cli => ../../../../ diff --git a/integration/plugin/testdata/example-plugin/main.go b/integration/plugin/testdata/example-plugin/main.go new file mode 100644 index 0000000000..4a8b177bf4 --- /dev/null +++ b/integration/plugin/testdata/example-plugin/main.go @@ -0,0 +1,74 @@ +package main + +import ( + "context" + "fmt" + + hplugin "github.com/hashicorp/go-plugin" + + "github.com/ignite/cli/ignite/services/plugin" +) + +type p struct{} + +func (p) Manifest(context.Context) (*plugin.Manifest, error) { + return &plugin.Manifest{ + Name: "example-plugin", + Commands: []*plugin.Command{ + { + Use: "example-plugin", + Short: "Explain what the command is doing...", + Long: "Long description goes here...", + Flags: []*plugin.Flag{ + {Name: "my-flag", Type: plugin.FlagTypeString, Usage: "my flag description"}, + }, + PlaceCommandUnder: "ignite", + }, + }, + Hooks: []*plugin.Hook{}, + }, nil +} + +func (p) Execute(ctx context.Context, cmd *plugin.ExecutedCommand, api plugin.ClientAPI) error { + fmt.Printf("Hello I'm the example-plugin plugin\n") + fmt.Printf("My executed command: %q\n", cmd.Path) + fmt.Printf("My args: %v\n", cmd.Args) + + flags, err := cmd.NewFlags() + if err != nil { + return err + } + + myFlag, _ := flags.GetString("my-flag") + fmt.Printf("My flags: my-flag=%q\n", myFlag) + fmt.Printf("My config parameters: %v\n", cmd.With) + + fmt.Println(api.GetChainInfo(ctx)) + + return nil +} + +func (p) ExecuteHookPre(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + fmt.Printf("Executing hook pre %q\n", h.Hook.GetName()) + return nil +} + +func (p) ExecuteHookPost(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + fmt.Printf("Executing hook post %q\n", h.Hook.GetName()) + return nil +} + +func (p) ExecuteHookCleanUp(_ context.Context, h *plugin.ExecutedHook, _ plugin.ClientAPI) error { + fmt.Printf("Executing hook cleanup %q\n", h.Hook.GetName()) + return nil +} + +func main() { + hplugin.Serve(&hplugin.ServeConfig{ + HandshakeConfig: plugin.HandshakeConfig(), + Plugins: map[string]hplugin.Plugin{ + "example-plugin": plugin.NewGRPC(&p{}), + }, + GRPCServer: hplugin.DefaultGRPCServer, + }) +} diff --git a/integration/tx/tx_test.go b/integration/tx/tx_test.go index 6575acd1fe..c67f2ce2cb 100644 --- a/integration/tx/tx_test.go +++ b/integration/tx/tx_test.go @@ -81,8 +81,11 @@ func TestSignTxWithDashedAppName(t *testing.T) { "dashedapp", "create-item", "helloworld", + "--chain-id", "dashedapp", "--from", "alice", "--node", nodeAddr, + "--output", "json", + "--log_format", "json", "--yes", ), step.PostExec(func(execErr error) error { @@ -158,6 +161,8 @@ func TestGetTxViaGRPCGateway(t *testing.T) { "keys", "list", "--keyring-backend", "test", + "--output", "json", + "--log_format", "json", ), step.PostExec(func(execErr error) error { if execErr != nil { @@ -203,6 +208,8 @@ func TestGetTxViaGRPCGateway(t *testing.T) { "--keyring-backend", "test", "--chain-id", appname, "--node", nodeAddr, + "--output", "json", + "--log_format", "json", "--yes", ), step.PreExec(func() error { diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml new file mode 100644 index 0000000000..36d3d55811 --- /dev/null +++ b/proto/buf.gen.yaml @@ -0,0 +1,8 @@ +version: v1 +plugins: +- plugin: buf.build/protocolbuffers/go + out: . + opt: paths=source_relative +- plugin: buf.build/grpc/go + out: . + opt: paths=source_relative diff --git a/proto/buf.md b/proto/buf.md new file mode 100644 index 0000000000..00a7d287b3 --- /dev/null +++ b/proto/buf.md @@ -0,0 +1,3 @@ +# Protobufs + +This is the public protocol buffers API for [Ignite CLI](https://github.com/ignite/cli). diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 0000000000..faea9af67b --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,15 @@ +version: v1 +name: buf.build/ignitehq/cli +breaking: + use: + - FILE +lint: + use: + - DEFAULT + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME diff --git a/proto/ignite/services/plugin/grpc/v1/client_api.proto b/proto/ignite/services/plugin/grpc/v1/client_api.proto new file mode 100644 index 0000000000..d7b76c7bc0 --- /dev/null +++ b/proto/ignite/services/plugin/grpc/v1/client_api.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package ignite.services.plugin.grpc.v1; + +option go_package = "github.com/ignite/cli/ignite/services/plugin/grpc/v1"; + +message ChainInfo { + string chain_id = 1; + string app_path = 2; + string config_path = 3; + string rpc_address = 4; +} diff --git a/proto/ignite/services/plugin/grpc/v1/interface.proto b/proto/ignite/services/plugin/grpc/v1/interface.proto new file mode 100644 index 0000000000..5dcaef4209 --- /dev/null +++ b/proto/ignite/services/plugin/grpc/v1/interface.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package ignite.services.plugin.grpc.v1; + +option go_package = "github.com/ignite/cli/ignite/services/plugin/grpc/v1"; + +// ExecutedCommand represents a plugin command under execution. +message ExecutedCommand { + // Use is the one-line usage message. + string use = 1; + + // Path contains the command path, e.g. `ignite scaffold foo`. + string path = 2; + + // Args are the command arguments. + repeated string args = 3; + + // Full list of args taken from the command line. + repeated string os_args = 4; + + // With contains the plugin config parameters. + map with = 5; + + // Flags holds the list of command flags. + repeated Flag flags = 6; +} + +// ExecutedHook represents a plugin hook under execution. +message ExecutedHook { + // Hook is a copy of the original Hook defined in the Manifest. + Hook hook = 1; + + // ExecutedCommand gives access to the command attached by the hook. + ExecutedCommand executed_command = 2; +} + +// Manifest represents the plugin behavior. +message Manifest { + // Plugin name. + string name = 1; + + // Commands contains the commands that will be added to the list of ignite commands. + // Each commands are independent, for nested commands use the inner Commands field. + bool shared_host = 2; + + // Hooks contains the hooks that will be attached to the existing ignite commands. + repeated Command commands = 3; + + // Enables sharing a single plugin server across all running instances of a plugin. + // Useful if a plugin adds or extends long running commands. + // + // Example: if a plugin defines a hook on `ignite chain serve`, a plugin server is + // instanciated when the command is run. Now if you want to interact with that instance + // from commands defined in that plugin, you need to enable shared host, or else the + // commands will just instantiate separate plugin servers. + // + // When enabled, all plugins of the same path loaded from the same configuration will + // attach it's RPC client to a an existing RPC server. + // + // If a plugin instance has no other running plugin servers, it will create one and it + // will be the host. + repeated Hook hooks = 4; +} + +// Command represents a plugin command. +message Command { + // Use is the one-line usage message. + // + // Recommended syntax is as follow: + // [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. + // ... indicates that you can specify multiple values for the previous argument. + // | indicates mutually exclusive information. You can use the argument to the left of the separator or the + // argument to the right of the separator. You cannot use both arguments in a single use of the command. + // { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are + // optional, they are enclosed in brackets ([ ]). + // + // Example: add [-F file | -D dir]... [-f format] profile + string use = 1; + + // Aliases is an array of aliases that can be used instead of the first word in Use. + repeated string aliases = 2; + + // Short is the short description shown in the 'help' output. + string short = 3; + + // Long is the long message shown in the 'help ' output. + string long = 4; + + // Hidden defines, if this command is hidden and should NOT show up in the list of available commands. + bool hidden = 5; + + // Flags holds the list of command flags. + repeated Flag flags = 6; + + // Indicates where the command should be placed. + // For instance `ignite scaffold` will place the command at the `scaffold` command. + // An empty value is interpreted as `ignite` (==root). + string place_command_under = 7; + + // List of sub commands. + repeated Command commands = 8; +} + +// Flag represents of a command line flag. +message Flag { + // Type represents the flag type. + enum Type { + TYPE_FLAG_STRING_UNSPECIFIED = 0; + TYPE_FLAG_INT = 1; + TYPE_FLAG_UINT = 2; + TYPE_FLAG_INT64 = 3; + TYPE_FLAG_UINT64 = 4; + TYPE_FLAG_BOOL = 5; + TYPE_FLAG_STRING_SLICE = 6; + } + + // Name as it appears in the command line. + string name = 1; + + // One letter abbreviation of the flag. + string shorthand = 2; + + // Help message. + string usage = 3; + + // Default flag value. + string default_value = 4; + + // Flag type. + Type type = 5; + + // Flag value. + string value = 6; + + // Indicates wether or not the flag is propagated on children commands. + bool persistent = 7; +} + +// Hook represents a user defined action within a plugin. +message Hook { + // Identifies the hook for the client to invoke the correct hook. + // It must be unique. + string name = 1; + + // Indicates the command where to register the hooks. + string place_hook_on = 2; +} diff --git a/proto/ignite/services/plugin/grpc/v1/service.proto b/proto/ignite/services/plugin/grpc/v1/service.proto new file mode 100644 index 0000000000..e35d89f2f5 --- /dev/null +++ b/proto/ignite/services/plugin/grpc/v1/service.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; + +package ignite.services.plugin.grpc.v1; + +import "ignite/services/plugin/grpc/v1/client_api.proto"; +import "ignite/services/plugin/grpc/v1/interface.proto"; + +option go_package = "github.com/ignite/cli/ignite/services/plugin/grpc/v1"; + +// InterfaceService defines the interface that must be implemented by all plugins. +service InterfaceService { + // Manifest declares the plugin's Command(s) and Hook(s). + rpc Manifest(ManifestRequest) returns (ManifestResponse); + + // Execute will be invoked by ignite when a plugin Command is executed. + // It is global for all commands declared in Manifest, if you have declared + // multiple commands, use cmd.Path to distinguish them. + rpc Execute(ExecuteRequest) returns (ExecuteResponse); + + // ExecuteHookPre is invoked by ignite when a command specified by the Hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + rpc ExecuteHookPre(ExecuteHookPreRequest) returns (ExecuteHookPreResponse); + + // ExecuteHookPost is invoked by ignite when a command specified by the hook + // path is invoked. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + rpc ExecuteHookPost(ExecuteHookPostRequest) returns (ExecuteHookPostResponse); + + // ExecuteHookCleanUp is invoked by ignite when a command specified by the + // hook path is invoked. Unlike ExecuteHookPost, it is invoked regardless of + // execution status of the command and hooks. + // It is global for all hooks declared in Manifest, if you have declared + // multiple hooks, use hook.Name to distinguish them. + rpc ExecuteHookCleanUp(ExecuteHookCleanUpRequest) returns (ExecuteHookCleanUpResponse); +} + +message ManifestRequest {} + +message ManifestResponse { + Manifest manifest = 1; +} + +message ExecuteRequest { + ExecutedCommand cmd = 1; + uint32 client_api = 2; +} + +message ExecuteResponse {} + +message ExecuteHookPreRequest { + ExecutedHook hook = 1; + uint32 client_api = 2; +} + +message ExecuteHookPreResponse {} + +message ExecuteHookPostRequest { + ExecutedHook hook = 1; + uint32 client_api = 2; +} + +message ExecuteHookPostResponse {} + +message ExecuteHookCleanUpRequest { + ExecutedHook hook = 1; + uint32 client_api = 2; +} + +message ExecuteHookCleanUpResponse {} + +// ClientAPIService defines the interface that allows plugins to get chain app analysis info. +service ClientAPIService { + // GetChainInfo returns basic chain info for the configured app + rpc GetChainInfo(GetChainInfoRequest) returns (GetChainInfoResponse); +} + +message GetChainInfoRequest {} + +message GetChainInfoResponse { + ChainInfo chain_info = 1; +}