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.

167 lines
6.0 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
9 years ago
9 years ago
8 years ago
9 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. mtx sync.Mutex
  24. addr string
  25. err error
  26. }
  27. var _ Client = (*grpcClient)(nil)
  28. // NewGRPCClient creates a gRPC client, which will connect to addr upon the
  29. // start. Note Client#Start returns an error if connection is unsuccessful and
  30. // mustConnect is true.
  31. func NewGRPCClient(logger log.Logger, addr string, mustConnect bool) Client {
  32. cli := &grpcClient{
  33. logger: logger,
  34. addr: addr,
  35. mustConnect: mustConnect,
  36. }
  37. cli.BaseService = *service.NewBaseService(logger, "grpcClient", cli)
  38. return cli
  39. }
  40. func dialerFunc(ctx context.Context, addr string) (net.Conn, error) {
  41. return tmnet.Connect(addr)
  42. }
  43. func (cli *grpcClient) OnStart(ctx context.Context) error {
  44. RETRY_LOOP:
  45. for {
  46. conn, err := grpc.Dial(cli.addr,
  47. grpc.WithTransportCredentials(insecure.NewCredentials()),
  48. grpc.WithContextDialer(dialerFunc),
  49. )
  50. if err != nil {
  51. if cli.mustConnect {
  52. return err
  53. }
  54. cli.logger.Error(fmt.Sprintf("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr), "err", err)
  55. time.Sleep(time.Second * dialRetryIntervalSeconds)
  56. continue RETRY_LOOP
  57. }
  58. cli.logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr)
  59. client := types.NewABCIApplicationClient(conn)
  60. cli.conn = conn
  61. ENSURE_CONNECTED:
  62. for {
  63. _, err := client.Echo(ctx, &types.RequestEcho{Message: "hello"}, grpc.WaitForReady(true))
  64. if err == nil {
  65. break ENSURE_CONNECTED
  66. }
  67. if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
  68. return err
  69. }
  70. cli.logger.Error("Echo failed", "err", err)
  71. time.Sleep(time.Second * echoRetryIntervalSeconds)
  72. }
  73. cli.client = client
  74. return nil
  75. }
  76. }
  77. func (cli *grpcClient) OnStop() {
  78. if cli.conn != nil {
  79. cli.conn.Close()
  80. }
  81. }
  82. func (cli *grpcClient) Error() error {
  83. cli.mtx.Lock()
  84. defer cli.mtx.Unlock()
  85. return cli.err
  86. }
  87. //----------------------------------------
  88. func (cli *grpcClient) Flush(ctx context.Context) error { return nil }
  89. func (cli *grpcClient) Echo(ctx context.Context, msg string) (*types.ResponseEcho, error) {
  90. return cli.client.Echo(ctx, types.ToRequestEcho(msg).GetEcho(), grpc.WaitForReady(true))
  91. }
  92. func (cli *grpcClient) Info(ctx context.Context, params types.RequestInfo) (*types.ResponseInfo, error) {
  93. return cli.client.Info(ctx, types.ToRequestInfo(params).GetInfo(), grpc.WaitForReady(true))
  94. }
  95. func (cli *grpcClient) CheckTx(ctx context.Context, params types.RequestCheckTx) (*types.ResponseCheckTx, error) {
  96. return cli.client.CheckTx(ctx, types.ToRequestCheckTx(params).GetCheckTx(), grpc.WaitForReady(true))
  97. }
  98. func (cli *grpcClient) Query(ctx context.Context, params types.RequestQuery) (*types.ResponseQuery, error) {
  99. return cli.client.Query(ctx, types.ToRequestQuery(params).GetQuery(), grpc.WaitForReady(true))
  100. }
  101. func (cli *grpcClient) Commit(ctx context.Context) (*types.ResponseCommit, error) {
  102. return cli.client.Commit(ctx, types.ToRequestCommit().GetCommit(), grpc.WaitForReady(true))
  103. }
  104. func (cli *grpcClient) InitChain(ctx context.Context, params types.RequestInitChain) (*types.ResponseInitChain, error) {
  105. return cli.client.InitChain(ctx, types.ToRequestInitChain(params).GetInitChain(), grpc.WaitForReady(true))
  106. }
  107. func (cli *grpcClient) ListSnapshots(ctx context.Context, params types.RequestListSnapshots) (*types.ResponseListSnapshots, error) {
  108. return cli.client.ListSnapshots(ctx, types.ToRequestListSnapshots(params).GetListSnapshots(), grpc.WaitForReady(true))
  109. }
  110. func (cli *grpcClient) OfferSnapshot(ctx context.Context, params types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error) {
  111. return cli.client.OfferSnapshot(ctx, types.ToRequestOfferSnapshot(params).GetOfferSnapshot(), grpc.WaitForReady(true))
  112. }
  113. func (cli *grpcClient) LoadSnapshotChunk(ctx context.Context, params types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error) {
  114. return cli.client.LoadSnapshotChunk(ctx, types.ToRequestLoadSnapshotChunk(params).GetLoadSnapshotChunk(), grpc.WaitForReady(true))
  115. }
  116. func (cli *grpcClient) ApplySnapshotChunk(ctx context.Context, params types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) {
  117. return cli.client.ApplySnapshotChunk(ctx, types.ToRequestApplySnapshotChunk(params).GetApplySnapshotChunk(), grpc.WaitForReady(true))
  118. }
  119. func (cli *grpcClient) PrepareProposal(ctx context.Context, params types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error) {
  120. return cli.client.PrepareProposal(ctx, types.ToRequestPrepareProposal(params).GetPrepareProposal(), grpc.WaitForReady(true))
  121. }
  122. func (cli *grpcClient) ProcessProposal(ctx context.Context, params types.RequestProcessProposal) (*types.ResponseProcessProposal, error) {
  123. return cli.client.ProcessProposal(ctx, types.ToRequestProcessProposal(params).GetProcessProposal(), grpc.WaitForReady(true))
  124. }
  125. func (cli *grpcClient) ExtendVote(ctx context.Context, params types.RequestExtendVote) (*types.ResponseExtendVote, error) {
  126. return cli.client.ExtendVote(ctx, types.ToRequestExtendVote(params).GetExtendVote(), grpc.WaitForReady(true))
  127. }
  128. func (cli *grpcClient) VerifyVoteExtension(ctx context.Context, params types.RequestVerifyVoteExtension) (*types.ResponseVerifyVoteExtension, error) {
  129. return cli.client.VerifyVoteExtension(ctx, types.ToRequestVerifyVoteExtension(params).GetVerifyVoteExtension(), grpc.WaitForReady(true))
  130. }
  131. func (cli *grpcClient) FinalizeBlock(ctx context.Context, params types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error) {
  132. return cli.client.FinalizeBlock(ctx, types.ToRequestFinalizeBlock(params).GetFinalizeBlock(), grpc.WaitForReady(true))
  133. }