-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: REST Client Unsafe/Safe Endpoints #3640
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3640 +/- ##
===========================================
+ Coverage 60.79% 60.82% +0.03%
===========================================
Files 189 187 -2
Lines 14170 14092 -78
===========================================
- Hits 8615 8572 -43
+ Misses 5011 4980 -31
+ Partials 544 540 -4 |
What are the implications for this? What would change exactly? Can you give me an example of what we would need to change if this is done? |
@faboweb no routes will changes. Simply any routes that actually sign txs and all of the |
@@ -77,6 +77,11 @@ type voteReq struct { | |||
|
|||
func postProposalHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc { | |||
return func(w http.ResponseWriter, r *http.Request) { | |||
if !cliCtx.AllowUnsafe { |
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 initially went with a ClientRouter
wrapper struct that contained a mux
router and an unsafe bool
, but found the route registration ugly as there was a if/else switch in every module's registration handler
The following solution leaves it up to the actual handler and relies on the context. Also, not super clean, but I feel like it is more DRY compared to the previous solution.
In order to wrap this up, we need to pass a |
I get it now. Nice change. |
@faboweb thanks! I believe this will leave Voyager largely, if not entirely, unaffected as from what @fedekunze tells me, Voyager performs the generate only => sign offline => broadcast flow, which is the ideal flow 👌 |
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.
🍷
Ok, so with advent of #3641, this should still be merged but only exist for keybase routes. |
closing in favor of #3674 |
client/keys/codec.go
in favor already valid codec incodec/codec.go
client/keys/*
toclient/keys/common
client/keys
to use aCLIContext
! (cc @jleni @alessio)closes: #3560
/cc @cosmos/cosmos-ui
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: