-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Implement gRPC Simulate endpoint #7035
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7035 +/- ##
==========================================
- Coverage 54.96% 54.72% -0.25%
==========================================
Files 560 563 +3
Lines 38188 38405 +217
==========================================
+ Hits 20989 21016 +27
- Misses 15495 15681 +186
- Partials 1704 1708 +4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK. I still don't know how to use this simulate. Adding docs for it would be nice
// | ||
// NOTE: This codec will be deprecated in favor of AppCodec once all modules are | ||
// migrated. | ||
func MakeCodec(bm module.BasicManager) *codec.LegacyAmino { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into some nasty import cycles, in tests only:
import cycle not allowed in test
package github.com/cosmos/cosmos-sdk/x/auth/tx (test)
imports github.com/cosmos/cosmos-sdk/std
imports github.com/cosmos/cosmos-sdk/baseapp
imports github.com/cosmos/cosmos-sdk/client/grpc/simulate
imports github.com/cosmos/cosmos-sdk/x/auth/tx
FAIL github.com/cosmos/cosmos-sdk/x/auth/tx [setup failed]
All imports made sense to me, except maybe std imports baseapp
. So I refactored:
- remove mention of
baseapp
from std - put
std/consensus_params.go
into params keeper - remove mention of
types/module
from std (another import cycle) - this function
MakeCodec
was only used in tests in simapp, so that's where I put it.
@fedekunze yes, I agree some docs would be nice. But I'm not 100% sure where to put them. And I'm not sure also how these docs would actually look like: this endpoint is just another endpoint amongst all the gRPC endpoints we have, maybe some unified client request docs would make more sense (i.e. either send a gRPC request to the gRPC server, or send a HTTP request to the gateway server). cc @clevinson |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @amaurymartiny 👏
Not sure if we want to wait on @aaronc's review. Feel free to merge whenever you'd like. |
@@ -0,0 +1,33 @@ | |||
syntax = "proto3"; | |||
package cosmos.base.simulate.v1beta1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be in base
, it should be in cosmos.tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, this endpoint could definitely go in with those in #7355
Note: there are some other TM rpc methods which we might or might not want to wrap under gRPC at some point. To avoid having too many services, we could regroup them under one big module-agnostic service, maybe not called Tx
though. There's also the reflection service, which could also be merged into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's bundle together stuff that is related. Simulate, get tx by hash, etc. all depend on Tx
. The original tx
Service
was intended to cover all that stuff. Reflection doesn't depend on Tx
so IMHO should remain separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I was pointing out that our bundling will then be different than TM's bundling (e.g. getTxByHash goes in Info
, not in Tx
, see link above), which might be confusing for people, esp. if one day TM has its own gRPC.
* Implement simulate endpoint * Add GetProtoTx() * Add signing in test * Add txBuilderFromProto * Remove stray println * Update to master * Merge master * Fix tests * Make tests pass * Integrate in router * Make proto-gen * Fix lint * Really fix lint * Refactor to fix import cycles * Rename builder -> wrapper * Update proto/cosmos/base/reflection/v1beta1/reflection.proto * Fix after merge * t->w Co-authored-by: Alexander Bezobchuk <[email protected]>
Description
closes: #5922
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes