You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

367 lines
11 KiB

build(deps): Bump google.golang.org/grpc from 1.42.0 to 1.43.0 (#7455) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/grpc/grpc-go/releases">google.golang.org/grpc's releases</a>.</em></p> <blockquote> <h2>Release 1.43.0</h2> <h1>API Changes</h1> <ul> <li>grpc: stabilize <code>WithConnectParams</code> <code>DialOption</code> (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4915">#4915</a>) <ul> <li>Special Thanks: <a href="https://github.com/hypnoglow"><code>@​hypnoglow</code></a></li> </ul> </li> </ul> <h1>Behavior Changes</h1> <ul> <li>status: support wrapped errors in <code>FromContextError</code> (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4977">#4977</a>) <ul> <li>Special Thanks: <a href="https://github.com/bestbeforetoday"><code>@​bestbeforetoday</code></a></li> </ul> </li> <li>config: remove the environment variable to disable retry support (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4922">#4922</a>)</li> </ul> <h1>New Features</h1> <ul> <li>balancer: new field <code>Authority</code> in <code>BuildOptions</code> for server name to use in the authentication handshake with a remote load balancer (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4969">#4969</a>)</li> </ul> <h1>Bug Fixes</h1> <ul> <li>xds/resolver: fix possible <code>ClientConn</code> leak upon resolver initialization failure (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4900">#4900</a>)</li> <li>client: fix <code>nil</code> panic in rare race conditions with the pick first LB policy (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4971">#4971</a>)</li> <li>xds: improve RPC error messages when xDS connection errors occur (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5032">#5032</a>, <a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5054">#5054</a>)</li> <li>transport: do not create stream object in the face of illegal stream IDs (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4873">#4873</a>) <ul> <li>Special Thanks: <a href="https://github.com/uds5501"><code>@​uds5501</code></a></li> </ul> </li> </ul> <h1>Documentation</h1> <ul> <li>client: clarify errors to indicate whether compressed or uncompressed messages exceeded size limits (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4918">#4918</a>) <ul> <li>Special Thanks: <a href="https://github.com/uds5501"><code>@​uds5501</code></a></li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/grpc/grpc-go/commit/14c11384b76b67f7b1b32a5d18f865762634c0ae"><code>14c1138</code></a> Change version to 1.43.0 (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5039">#5039</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/ae29ac3e1e62a7b47fb672dec21de2dd83e4f027"><code>ae29ac3</code></a> xds/client: send NewStream errors to the watchers (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5032">#5032</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/296afc2e579c14228edadb3debcb040204a0870f"><code>296afc2</code></a> transport: better error message when per-RPC creds fail (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5033">#5033</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/e15d978c827661f8e7cfe807cb9fd8fd8f15a262"><code>e15d978</code></a> xds/client: send connection errors to all watchers (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5054">#5054</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/46e883a9ab006a3000afe0a510aea62b75495b8f"><code>46e883a</code></a> Backport &quot;xds/c2p: replace C2P resolver env var with experimental scheme suff...</li> <li><a href="https://github.com/grpc/grpc-go/commit/3786ae1778f5bfcc49da81cbd925b7175ec81839"><code>3786ae1</code></a> xds/resolver: Add support for cluster specifier plugins (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4987">#4987</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/512e89474bfbd567806e026e0afdec468b1ee1ea"><code>512e894</code></a> rls: support extra_keys and constant_keys (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4995">#4995</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/f3bbd12084380987ae0c9fcccdd7c4d405294a68"><code>f3bbd12</code></a> xds/bootstrap_config: add a string function to server config (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5031">#5031</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/46935b96506deef74e73192e70cc44e3795b1452"><code>46935b9</code></a> fix possible nil before casting (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5017">#5017</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/c2bccd0b1594416da57a74d15f09f8eb0a3d727b"><code>c2bccd0</code></a> xds/kokoro: install go 1.17, and retry go build (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5015">#5015</a>)</li> <li>Additional commits viewable in <a href="https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/grpc&package-manager=go_modules&previous-version=1.42.0&new-version=1.43.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
3 years ago
build(deps): Bump google.golang.org/grpc from 1.42.0 to 1.43.0 (#7455) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/grpc/grpc-go/releases">google.golang.org/grpc's releases</a>.</em></p> <blockquote> <h2>Release 1.43.0</h2> <h1>API Changes</h1> <ul> <li>grpc: stabilize <code>WithConnectParams</code> <code>DialOption</code> (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4915">#4915</a>) <ul> <li>Special Thanks: <a href="https://github.com/hypnoglow"><code>@​hypnoglow</code></a></li> </ul> </li> </ul> <h1>Behavior Changes</h1> <ul> <li>status: support wrapped errors in <code>FromContextError</code> (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4977">#4977</a>) <ul> <li>Special Thanks: <a href="https://github.com/bestbeforetoday"><code>@​bestbeforetoday</code></a></li> </ul> </li> <li>config: remove the environment variable to disable retry support (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4922">#4922</a>)</li> </ul> <h1>New Features</h1> <ul> <li>balancer: new field <code>Authority</code> in <code>BuildOptions</code> for server name to use in the authentication handshake with a remote load balancer (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4969">#4969</a>)</li> </ul> <h1>Bug Fixes</h1> <ul> <li>xds/resolver: fix possible <code>ClientConn</code> leak upon resolver initialization failure (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4900">#4900</a>)</li> <li>client: fix <code>nil</code> panic in rare race conditions with the pick first LB policy (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4971">#4971</a>)</li> <li>xds: improve RPC error messages when xDS connection errors occur (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5032">#5032</a>, <a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5054">#5054</a>)</li> <li>transport: do not create stream object in the face of illegal stream IDs (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4873">#4873</a>) <ul> <li>Special Thanks: <a href="https://github.com/uds5501"><code>@​uds5501</code></a></li> </ul> </li> </ul> <h1>Documentation</h1> <ul> <li>client: clarify errors to indicate whether compressed or uncompressed messages exceeded size limits (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4918">#4918</a>) <ul> <li>Special Thanks: <a href="https://github.com/uds5501"><code>@​uds5501</code></a></li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/grpc/grpc-go/commit/14c11384b76b67f7b1b32a5d18f865762634c0ae"><code>14c1138</code></a> Change version to 1.43.0 (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5039">#5039</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/ae29ac3e1e62a7b47fb672dec21de2dd83e4f027"><code>ae29ac3</code></a> xds/client: send NewStream errors to the watchers (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5032">#5032</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/296afc2e579c14228edadb3debcb040204a0870f"><code>296afc2</code></a> transport: better error message when per-RPC creds fail (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5033">#5033</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/e15d978c827661f8e7cfe807cb9fd8fd8f15a262"><code>e15d978</code></a> xds/client: send connection errors to all watchers (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5054">#5054</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/46e883a9ab006a3000afe0a510aea62b75495b8f"><code>46e883a</code></a> Backport &quot;xds/c2p: replace C2P resolver env var with experimental scheme suff...</li> <li><a href="https://github.com/grpc/grpc-go/commit/3786ae1778f5bfcc49da81cbd925b7175ec81839"><code>3786ae1</code></a> xds/resolver: Add support for cluster specifier plugins (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4987">#4987</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/512e89474bfbd567806e026e0afdec468b1ee1ea"><code>512e894</code></a> rls: support extra_keys and constant_keys (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/4995">#4995</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/f3bbd12084380987ae0c9fcccdd7c4d405294a68"><code>f3bbd12</code></a> xds/bootstrap_config: add a string function to server config (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5031">#5031</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/46935b96506deef74e73192e70cc44e3795b1452"><code>46935b9</code></a> fix possible nil before casting (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5017">#5017</a>)</li> <li><a href="https://github.com/grpc/grpc-go/commit/c2bccd0b1594416da57a74d15f09f8eb0a3d727b"><code>c2bccd0</code></a> xds/kokoro: install go 1.17, and retry go build (<a href="https://github-redirect.dependabot.com/grpc/grpc-go/issues/5015">#5015</a>)</li> <li>Additional commits viewable in <a href="https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/grpc&package-manager=go_modules&previous-version=1.42.0&new-version=1.43.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
3 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. package abciclient
  2. import (
  3. "context"
  4. "errors"
  5. "fmt"
  6. "net"
  7. "sync"
  8. "time"
  9. "google.golang.org/grpc"
  10. "google.golang.org/grpc/credentials/insecure"
  11. "github.com/tendermint/tendermint/abci/types"
  12. "github.com/tendermint/tendermint/libs/log"
  13. tmnet "github.com/tendermint/tendermint/libs/net"
  14. "github.com/tendermint/tendermint/libs/service"
  15. )
  16. // A gRPC client.
  17. type grpcClient struct {
  18. service.BaseService
  19. logger log.Logger
  20. mustConnect bool
  21. client types.ABCIApplicationClient
  22. conn *grpc.ClientConn
  23. chReqRes chan *ReqRes // dispatches "async" responses to callbacks *in order*, needed by mempool
  24. mtx sync.Mutex
  25. addr string
  26. err error
  27. resCb func(*types.Request, *types.Response) // listens to all callbacks
  28. }
  29. var _ Client = (*grpcClient)(nil)
  30. // NewGRPCClient creates a gRPC client, which will connect to addr upon the
  31. // start. Note Client#Start returns an error if connection is unsuccessful and
  32. // mustConnect is true.
  33. //
  34. // GRPC calls are synchronous, but some callbacks expect to be called
  35. // asynchronously (eg. the mempool expects to be able to lock to remove bad txs
  36. // from cache). To accommodate, we finish each call in its own go-routine,
  37. // which is expensive, but easy - if you want something better, use the socket
  38. // protocol! maybe one day, if people really want it, we use grpc streams, but
  39. // hopefully not :D
  40. func NewGRPCClient(logger log.Logger, addr string, mustConnect bool) Client {
  41. cli := &grpcClient{
  42. logger: logger,
  43. addr: addr,
  44. mustConnect: mustConnect,
  45. // Buffering the channel is needed to make calls appear asynchronous,
  46. // which is required when the caller makes multiple async calls before
  47. // processing callbacks (e.g. due to holding locks). 64 means that a
  48. // caller can make up to 64 async calls before a callback must be
  49. // processed (otherwise it deadlocks). It also means that we can make 64
  50. // gRPC calls while processing a slow callback at the channel head.
  51. chReqRes: make(chan *ReqRes, 64),
  52. }
  53. cli.BaseService = *service.NewBaseService(logger, "grpcClient", cli)
  54. return cli
  55. }
  56. func dialerFunc(ctx context.Context, addr string) (net.Conn, error) {
  57. return tmnet.Connect(addr)
  58. }
  59. func (cli *grpcClient) OnStart(ctx context.Context) error {
  60. // This processes asynchronous request/response messages and dispatches
  61. // them to callbacks.
  62. go func() {
  63. // Use a separate function to use defer for mutex unlocks (this handles panics)
  64. callCb := func(reqres *ReqRes) {
  65. cli.mtx.Lock()
  66. defer cli.mtx.Unlock()
  67. reqres.SetDone()
  68. // Notify client listener if set
  69. if cli.resCb != nil {
  70. cli.resCb(reqres.Request, reqres.Response)
  71. }
  72. // Notify reqRes listener if set
  73. if cb := reqres.GetCallback(); cb != nil {
  74. cb(reqres.Response)
  75. }
  76. }
  77. for {
  78. select {
  79. case reqres := <-cli.chReqRes:
  80. if reqres != nil {
  81. callCb(reqres)
  82. } else {
  83. cli.logger.Error("Received nil reqres")
  84. }
  85. case <-ctx.Done():
  86. return
  87. }
  88. }
  89. }()
  90. RETRY_LOOP:
  91. for {
  92. conn, err := grpc.Dial(cli.addr,
  93. grpc.WithTransportCredentials(insecure.NewCredentials()),
  94. grpc.WithContextDialer(dialerFunc),
  95. )
  96. if err != nil {
  97. if cli.mustConnect {
  98. return err
  99. }
  100. cli.logger.Error(fmt.Sprintf("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr), "err", err)
  101. time.Sleep(time.Second * dialRetryIntervalSeconds)
  102. continue RETRY_LOOP
  103. }
  104. cli.logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr)
  105. client := types.NewABCIApplicationClient(conn)
  106. cli.conn = conn
  107. ENSURE_CONNECTED:
  108. for {
  109. _, err := client.Echo(ctx, &types.RequestEcho{Message: "hello"}, grpc.WaitForReady(true))
  110. if err == nil {
  111. break ENSURE_CONNECTED
  112. }
  113. if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
  114. return err
  115. }
  116. cli.logger.Error("Echo failed", "err", err)
  117. time.Sleep(time.Second * echoRetryIntervalSeconds)
  118. }
  119. cli.client = client
  120. return nil
  121. }
  122. }
  123. func (cli *grpcClient) OnStop() {
  124. if cli.conn != nil {
  125. cli.conn.Close()
  126. }
  127. close(cli.chReqRes)
  128. }
  129. func (cli *grpcClient) StopForError(err error) {
  130. if !cli.IsRunning() {
  131. return
  132. }
  133. cli.mtx.Lock()
  134. if cli.err == nil {
  135. cli.err = err
  136. }
  137. cli.mtx.Unlock()
  138. cli.logger.Error("Stopping abci.grpcClient for error", "err", err)
  139. cli.Stop()
  140. }
  141. func (cli *grpcClient) Error() error {
  142. cli.mtx.Lock()
  143. defer cli.mtx.Unlock()
  144. return cli.err
  145. }
  146. // Set listener for all responses
  147. // NOTE: callback may get internally generated flush responses.
  148. func (cli *grpcClient) SetResponseCallback(resCb Callback) {
  149. cli.mtx.Lock()
  150. cli.resCb = resCb
  151. cli.mtx.Unlock()
  152. }
  153. //----------------------------------------
  154. // NOTE: call is synchronous, use ctx to break early if needed
  155. func (cli *grpcClient) FlushAsync(ctx context.Context) (*ReqRes, error) {
  156. req := types.ToRequestFlush()
  157. res, err := cli.client.Flush(ctx, req.GetFlush(), grpc.WaitForReady(true))
  158. if err != nil {
  159. return nil, err
  160. }
  161. return cli.finishAsyncCall(ctx, req, &types.Response{Value: &types.Response_Flush{Flush: res}})
  162. }
  163. // NOTE: call is synchronous, use ctx to break early if needed
  164. func (cli *grpcClient) CheckTxAsync(ctx context.Context, params types.RequestCheckTx) (*ReqRes, error) {
  165. req := types.ToRequestCheckTx(params)
  166. res, err := cli.client.CheckTx(ctx, req.GetCheckTx(), grpc.WaitForReady(true))
  167. if err != nil {
  168. return nil, err
  169. }
  170. return cli.finishAsyncCall(ctx, req, &types.Response{Value: &types.Response_CheckTx{CheckTx: res}})
  171. }
  172. // finishAsyncCall creates a ReqRes for an async call, and immediately populates it
  173. // with the response. We don't complete it until it's been ordered via the channel.
  174. func (cli *grpcClient) finishAsyncCall(ctx context.Context, req *types.Request, res *types.Response) (*ReqRes, error) {
  175. reqres := NewReqRes(req)
  176. reqres.Response = res
  177. select {
  178. case cli.chReqRes <- reqres: // use channel for async responses, since they must be ordered
  179. return reqres, nil
  180. case <-ctx.Done():
  181. return nil, ctx.Err()
  182. }
  183. }
  184. // finishSyncCall waits for an async call to complete. It is necessary to call all
  185. // sync calls asynchronously as well, to maintain call and response ordering via
  186. // the channel, and this method will wait until the async call completes.
  187. func (cli *grpcClient) finishSyncCall(reqres *ReqRes) *types.Response {
  188. // It's possible that the callback is called twice, since the callback can
  189. // be called immediately on SetCallback() in addition to after it has been
  190. // set. This is because completing the ReqRes happens in a separate critical
  191. // section from the one where the callback is called: there is a race where
  192. // SetCallback() is called between completing the ReqRes and dispatching the
  193. // callback.
  194. //
  195. // We also buffer the channel with 1 response, since SetCallback() will be
  196. // called synchronously if the reqres is already completed, in which case
  197. // it will block on sending to the channel since it hasn't gotten around to
  198. // receiving from it yet.
  199. //
  200. // ReqRes should really handle callback dispatch internally, to guarantee
  201. // that it's only called once and avoid the above race conditions.
  202. var once sync.Once
  203. ch := make(chan *types.Response, 1)
  204. reqres.SetCallback(func(res *types.Response) {
  205. once.Do(func() {
  206. ch <- res
  207. })
  208. })
  209. return <-ch
  210. }
  211. //----------------------------------------
  212. func (cli *grpcClient) Flush(ctx context.Context) error { return nil }
  213. func (cli *grpcClient) Echo(ctx context.Context, msg string) (*types.ResponseEcho, error) {
  214. req := types.ToRequestEcho(msg)
  215. return cli.client.Echo(ctx, req.GetEcho(), grpc.WaitForReady(true))
  216. }
  217. func (cli *grpcClient) Info(
  218. ctx context.Context,
  219. params types.RequestInfo,
  220. ) (*types.ResponseInfo, error) {
  221. req := types.ToRequestInfo(params)
  222. return cli.client.Info(ctx, req.GetInfo(), grpc.WaitForReady(true))
  223. }
  224. func (cli *grpcClient) CheckTx(
  225. ctx context.Context,
  226. params types.RequestCheckTx,
  227. ) (*types.ResponseCheckTx, error) {
  228. reqres, err := cli.CheckTxAsync(ctx, params)
  229. if err != nil {
  230. return nil, err
  231. }
  232. return cli.finishSyncCall(reqres).GetCheckTx(), cli.Error()
  233. }
  234. func (cli *grpcClient) Query(
  235. ctx context.Context,
  236. params types.RequestQuery,
  237. ) (*types.ResponseQuery, error) {
  238. req := types.ToRequestQuery(params)
  239. return cli.client.Query(ctx, req.GetQuery(), grpc.WaitForReady(true))
  240. }
  241. func (cli *grpcClient) Commit(ctx context.Context) (*types.ResponseCommit, error) {
  242. req := types.ToRequestCommit()
  243. return cli.client.Commit(ctx, req.GetCommit(), grpc.WaitForReady(true))
  244. }
  245. func (cli *grpcClient) InitChain(
  246. ctx context.Context,
  247. params types.RequestInitChain,
  248. ) (*types.ResponseInitChain, error) {
  249. req := types.ToRequestInitChain(params)
  250. return cli.client.InitChain(ctx, req.GetInitChain(), grpc.WaitForReady(true))
  251. }
  252. func (cli *grpcClient) ListSnapshots(
  253. ctx context.Context,
  254. params types.RequestListSnapshots,
  255. ) (*types.ResponseListSnapshots, error) {
  256. req := types.ToRequestListSnapshots(params)
  257. return cli.client.ListSnapshots(ctx, req.GetListSnapshots(), grpc.WaitForReady(true))
  258. }
  259. func (cli *grpcClient) OfferSnapshot(
  260. ctx context.Context,
  261. params types.RequestOfferSnapshot,
  262. ) (*types.ResponseOfferSnapshot, error) {
  263. req := types.ToRequestOfferSnapshot(params)
  264. return cli.client.OfferSnapshot(ctx, req.GetOfferSnapshot(), grpc.WaitForReady(true))
  265. }
  266. func (cli *grpcClient) LoadSnapshotChunk(
  267. ctx context.Context,
  268. params types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error) {
  269. req := types.ToRequestLoadSnapshotChunk(params)
  270. return cli.client.LoadSnapshotChunk(ctx, req.GetLoadSnapshotChunk(), grpc.WaitForReady(true))
  271. }
  272. func (cli *grpcClient) ApplySnapshotChunk(
  273. ctx context.Context,
  274. params types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) {
  275. req := types.ToRequestApplySnapshotChunk(params)
  276. return cli.client.ApplySnapshotChunk(ctx, req.GetApplySnapshotChunk(), grpc.WaitForReady(true))
  277. }
  278. func (cli *grpcClient) PrepareProposal(
  279. ctx context.Context,
  280. params types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error) {
  281. req := types.ToRequestPrepareProposal(params)
  282. return cli.client.PrepareProposal(ctx, req.GetPrepareProposal(), grpc.WaitForReady(true))
  283. }
  284. func (cli *grpcClient) ProcessProposal(
  285. ctx context.Context,
  286. params types.RequestProcessProposal) (*types.ResponseProcessProposal, error) {
  287. req := types.ToRequestProcessProposal(params)
  288. return cli.client.ProcessProposal(ctx, req.GetProcessProposal(), grpc.WaitForReady(true))
  289. }
  290. func (cli *grpcClient) ExtendVote(
  291. ctx context.Context,
  292. params types.RequestExtendVote) (*types.ResponseExtendVote, error) {
  293. req := types.ToRequestExtendVote(params)
  294. return cli.client.ExtendVote(ctx, req.GetExtendVote(), grpc.WaitForReady(true))
  295. }
  296. func (cli *grpcClient) VerifyVoteExtension(
  297. ctx context.Context,
  298. params types.RequestVerifyVoteExtension) (*types.ResponseVerifyVoteExtension, error) {
  299. req := types.ToRequestVerifyVoteExtension(params)
  300. return cli.client.VerifyVoteExtension(ctx, req.GetVerifyVoteExtension(), grpc.WaitForReady(true))
  301. }
  302. func (cli *grpcClient) FinalizeBlock(
  303. ctx context.Context,
  304. params types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error) {
  305. req := types.ToRequestFinalizeBlock(params)
  306. return cli.client.FinalizeBlock(ctx, req.GetFinalizeBlock(), grpc.WaitForReady(true))
  307. }