-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
R4R Client Generalization (+ associated module refactor) #4451
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4451 +/- ##
==========================================
- Coverage 54.69% 53.23% -1.46%
==========================================
Files 253 259 +6
Lines 16150 16173 +23
==========================================
- Hits 8833 8610 -223
- Misses 6668 6917 +249
+ Partials 649 646 -3 |
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.
On the first read through here it looks really good and a substantial improvement @rigelrozanski !!!
My only concern was that it looks like we are moving the codec to be on a per module basis and using init
in each module to handle the codec
? This seems like a codesmell and def not something we should be doing afaik.
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.
Second pass. Minor comments but otherwise LGTM
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec, kb keys.Keybase) { | ||
r.HandleFunc("/bank/accounts/{address}/transfers", SendRequestHandlerFn(cdc, kb, cliCtx)).Methods("POST") | ||
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { | ||
r.HandleFunc("/bank/accounts/{address}/transfers", SendRequestHandlerFn(cdc, cliCtx)).Methods("POST") |
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.
where does the send command live rn ?
Co-Authored-By: Federico Kunze <[email protected]>
Co-Authored-By: Federico Kunze <[email protected]>
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.
Performed a first initial passthrough. Left some general feedback. Overall, looks like a step in the right direction. Still not clear on why some codec are public and others aren't. Also, I think queriers should be consistently defined in terms of their location (ie. x/{module}/querier
).
DefaultGenesis() json.RawMessage | ||
ValidateGenesis(json.RawMessage) error | ||
|
||
// client functionality | ||
RegisterRESTRoutes(context.CLIContext, *mux.Router, *codec.Codec) |
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.
Out of scope of this PR, but we can and should stop passing a CLIContext
AND a *coded.Codec
. The context should already have the codec set. I'll make an issue of this and address it once this PR is merged.
REF: #4479
@@ -427,7 +427,7 @@ func TestTrackUndelegationDelVestingAcc(t *testing.T) { | |||
now := tmtime.Now() | |||
endTime := now.Add(24 * time.Hour) | |||
|
|||
_, _, addr := keyPubAddr() | |||
_, _, addr := KeyTestPubAddr() |
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.
Does this need to be exposed?
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.
if we don't want duplicate code it does need to be exposed... ideally this will move out into a common testing-helpers root level package at some point!
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec, kb keys.Keybase) { | ||
r.HandleFunc("/bank/accounts/{address}/transfers", SendRequestHandlerFn(cdc, kb, cliCtx)).Methods("POST") | ||
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { | ||
r.HandleFunc("/bank/accounts/{address}/transfers", SendRequestHandlerFn(cdc, cliCtx)).Methods("POST") |
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.
Que? The send command lives in bank @jackzampolin. I think you mean the /bank/balances/{address}
endpoint needs to move from auth to bank ;-)
|
||
// Register routes | ||
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { | ||
RegisterRPCRoutes(cliCtx, r) |
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.
Once we remove the need for a codec as an argument, this should really only be RegisterRoutes
👍
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'm not sure that will be possible given that client doesn't define it's own "client" level cdc
) | ||
|
||
// function to create the rest handler | ||
type RESTHandlerFn func(context.CLIContext, *codec.Codec) rest.ProposalRESTHandler |
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.
Errr shall we not just define this ProposalRESTHandler
type in the rest
package? Has nothing to do specifically with gov, right?
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'm confused ProposalRESTHandler
is already defined in "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
- if you were referring to the RESTHandlerFn
this should stay where it is, it's only used for defining the ProposalHandler
(which belongs outside of rest because its used for both the cli and rest)
…mos/cosmos-sdk into rigel/client-generalization2
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.
testedACK
Replaces #4296
Updates to Gaia: cosmos/gaia#31
closes #1124
closes #2955
closes #4299
followup to module genesis generalization
To accomplish the client generalization which is in theory pretty simple there is a bunch of restructuring required due to lots of early design choices which are now leading to lots of circular dependencies.
docs/
)clog add [section] [stanza] [message]
Files changed
in the github PR explorerFor Admin Use: