Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove grpc replace directive #11089

Merged
merged 20 commits into from
Feb 4, 2022
Merged

fix: remove grpc replace directive #11089

merged 20 commits into from
Feb 4, 2022

Conversation

fdymylja
Copy link
Contributor

@fdymylja fdymylja commented Feb 1, 2022

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 1, 2022

@aaronc, @AmauryM as a note for app wiring WG, we should attempt to remove temporal application configurations, such as GRPCRouter.SetInterfaceRegistry, they're generally bad and hard to debug and keep track of.

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 1, 2022

NOTE: also #10997 will not work as expected on certain cases without this fix due to conflicts between protobuf types and gogoproto types and interface unpacking...

@github-actions github-actions bot added the C:CLI label Feb 2, 2022
@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 2, 2022

BREAKING changes:

  • client.Context always expects a Codec (should we relax this?)
  • grpc clients will have to use a ForceCodec option otherwise it will default to the protov2 codec which will cause panics.

@fdymylja fdymylja marked this pull request as ready for review February 2, 2022 01:18
@fdymylja fdymylja requested review from tac0turtle, robert-zaremba, aaronc and amaury1093 and removed request for aaronc and alexanderbez February 2, 2022 01:19
@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 2, 2022

All tests seem to pass...

This removes the grpc replace from go.mod and unblocks the Tendermint module upgrade.

Unsure about where to exactly place the GRPCCodec part, and also I didn't want to break the codec.Codec interface...

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally fine with this approach since its temporary until we fully migrate to orm. which will m most likely be 1 or 2 major releases.

Does this allow us to bump grpc-gateway and swagger as well?

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 2, 2022

Generally fine with this approach since its temporary until we fully migrate to orm. which will m most likely be 1 or 2 major releases.

Does this allow us to bump grpc-gateway and swagger as well?

if they were blocked on gRPC then I'd assume yes

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot @fdymylja for digging into this, really appreciate it

go.mod Outdated Show resolved Hide resolved
@@ -27,7 +29,8 @@ func initClientContext(t *testing.T, envVar string) (client.Context, func()) {
home := t.TempDir()
clientCtx := client.Context{}.
WithHomeDir(home).
WithViper("")
WithViper("").
WithCodec(codec.NewProtoCodec(codectypes.NewInterfaceRegistry()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client.Context always expects a Codec (should we relax this?)

How would you relax it? Probably only WithInterfaceRegistry is required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes given the interface registry we have our codec too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as relaxing goes, we could default to the gogoproto marshaler (if no codec is specified) but IDK how it would behave with Interface unpacking (let's assume WithInterfaceRegistry was not called).

If it worked before with the default gRPC codec then I would assume it also would work this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with orm landing I don't think we can default to gogoproto. I think the force is fine for a single release and but then most teams will have migrated anyways

server/grpc/server_test.go Show resolved Hide resolved
@tac0turtle
Copy link
Member

how does this effect js and other lang clients?

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 2, 2022

how does this effect js and other lang clients?

totally unaffected, for instance if you were to use dynamic-cosmos with the pulsar generated types those changes do not touch you at all.

they touch every codebase relying on client.Context this is why I was trying to find a solution to relax the panic if Codec is not set in client.Context,

and they also touch every codebase relying on grpc.Dial because they'll need to pass in the application codec. IDK how many people queried the chain with gRPC only without client.Context.

@tac0turtle
Copy link
Member

can we add this to 0.46?

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 2, 2022

can we add this to 0.46?

depends on the timeline for 0.46, the change is quite breaking for [cosmos-sdk go] clients and i'd like to give them time to adapt and digest the change.

@amaury1093
Copy link
Contributor

amaury1093 commented Feb 3, 2022

can we add this to 0.46?

depends on the timeline for 0.46, the change is quite breaking for [cosmos-sdk go] clients and i'd like to give them time to adapt and digest the change.

What's your feeling on this @marbar3778?

I think this can go in for 0.46. For users using grpc.Dial, we can add some docs. And anyways the majority still should use client.Context, which we can make it non-breaking (i.e. relax).

@tac0turtle
Copy link
Member

tac0turtle commented Feb 3, 2022

its fine by me and fixes many issues users are running into

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, pending some docs/changelogs

server/grpc/server_test.go Show resolved Hide resolved
@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 3, 2022

LGTM, pending some docs/changelogs

Thank you. Will wrap up by EOD with relaxation over client.Context, docs updates and changelog.

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 3, 2022

Almost ready, going to test grpc json endpoints to check if the marshaller/unmarshaller works correctly.

@fdymylja
Copy link
Contributor Author

fdymylja commented Feb 3, 2022

@AmauryM, @marbar3778 applied the relaxation over client context, updated docs and tested grpc web, the json transcoding endpoints (api exposed at 1317), all seems to work.

Wanted to get a final ACK, then it's good to merge.

@fdymylja fdymylja added the A:automerge Automatically merge PR once all prerequisites pass. label Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants