Skip to content

Commit

Permalink
docs: Add mention to use gRPC v1.33.2 (#8658)
Browse files Browse the repository at this point in the history
Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
amaury1093 and tac0turtle authored Feb 25, 2021
1 parent 115096b commit eeb3eab
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/basics/app-anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ See an example of an application's main command-line file from the [nameservice

## Dependencies and Makefile

::: warning
A patch introduced in `go-grpc v1.34.0` made gRPC incompatible with the `gogoproto` library, making some [gRPC queries](https://github.com/cosmos/cosmos-sdk/issues/8426) panic. As such, the SDK requires that `go-grpc <=v1.33.2` is installed in your `go.mod`.

To make sure that gRPC is working properly, it is **highly recommended** to add the following line in your application's `go.mod`:

```
replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
```

Please see [issue #8392](https://github.com/cosmos/cosmos-sdk/issues/8392) for more info.
:::

This section is optional, as developers are free to choose their dependency manager and project building method. That said, the current most used framework for versioning control is [`go.mod`](https://github.com/golang/go/wiki/Modules). It ensures each of the libraries used throughout the application are imported with the correct version. See an example from the [nameservice tutorial](https://github.com/cosmos/sdk-tutorials/tree/master/nameservice):

+++ https://github.com/cosmos/sdk-tutorials/blob/c6754a1e313eb1ed973c5c91dcc606f2fd288811/go.mod#L1-L18
Expand Down
12 changes: 12 additions & 0 deletions docs/basics/query-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ The CLI understands a specific set of commands, defined in a hierarchical struct

### gRPC

::: warning
A patch introduced in `go-grpc v1.34.0` made gRPC incompatible with the `gogoproto` library, making some [gRPC queries](https://github.com/cosmos/cosmos-sdk/issues/8426) panic. As such, the SDK requires that `go-grpc <=v1.33.2` is installed in your `go.mod`.

To make sure that gRPC is working properly, it is **highly recommended** to add the following line in your application's `go.mod`:

```
replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
```

Please see [issue #8392](https://github.com/cosmos/cosmos-sdk/issues/8392) for more info.
:::

Another interface through which users can make queries, introduced in Cosmos SDK v0.40, is [gRPC](https://grpc.io) requests to a [gRPC server](../core/grpc_rest.md#grpc-server). The endpoints are defined as [Protocol Buffers](https://developers.google.com/protocol-buffers) service methods inside `.proto` files, written in Protobuf's own language-agnostic interface definition language (IDL). The Protobuf ecosystem developed tools for code-generation from `*.proto` files into various languages. These tools allow to build gRPC clients easily.

One such tool is [grpcurl](https://github.com/fullstorydev/grpcurl), and a gRPC request for `MyQuery` using this client looks like:
Expand Down
12 changes: 12 additions & 0 deletions docs/core/grpc_rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ The node also exposes some other endpoints, such as the Tendermint P2P endpoint,

## gRPC Server

::: warning
A patch introduced in `go-grpc v1.34.0` made gRPC incompatible with the `gogoproto` library, making some [gRPC queries](https://github.com/cosmos/cosmos-sdk/issues/8426) panic. As such, the SDK requires that `go-grpc <=v1.33.2` is installed in your `go.mod`.

To make sure that gRPC is working properly, it is **highly recommended** to add the following line in your application's `go.mod`:

```
replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
```

Please see [issue #8392](https://github.com/cosmos/cosmos-sdk/issues/8392) for more info.
:::

Cosmos SDK v0.40 introduced Protobuf as the main [encoding](./encoding) library, and this brings a wide range of Protobuf-based tools that can be plugged into the SDK. One such tool is [gRPC](https://grpc.io), a modern open source high performance RPC framework that has decent client support in several languages.

Each module exposes [`Msg` and `Query` Protobuf services](../building-modules/messages-and-queries.md) to define state transitions and state queries. These services are hooked up to gRPC via the following function inside the application:
Expand Down

0 comments on commit eeb3eab

Please sign in to comment.