-
Notifications
You must be signed in to change notification settings - Fork 1.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
API server #323
API server #323
Conversation
@jackzampolin, Can you share me checklist of api endpoints here so it would be easy for us to implement them. |
@akhilkumarpilli Done! I've got them all stubbed out |
@akhilkumarpilli can you fix the conflicts? |
This pull request introduces 7 alerts when merging 124eacd into 031ecc2 - view on LGTM.com new alerts:
|
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.
Thank you @akhilkumarpilli @jackzampolin for this change! Just a drive-by review for security and nits, I've added some comments, please take a look.
This pull request introduces 7 alerts when merging 9aed68d into f8acf82 - view on LGTM.com new alerts:
|
This pull request introduces 7 alerts when merging 2e1b5e9 into f8acf82 - view on LGTM.com new alerts:
|
This pull request introduces 7 alerts when merging dea3362 into 978a993 - view on LGTM.com new alerts:
|
I will review this sometime this week, just haven't gotten a chance yet since there are a lot of changes |
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.
Overall LGTM. I did my best to review this, but it is a lot of diffs, and most of it looks like a refactor of old function structuring. Just left a couple questions on the rest response writing
Would appreciate another reviewer to take a look at this, but it does only touch client code so it's ok if bugs are not caught during review.
@akhilkumarpilli have you tested this manually for a couple of the rest routes? Could you add a quick document on how to interact with this?
cmd/api.go
Outdated
// Data for this should be stored in the ServicesManager struct | ||
r.HandleFunc("/listen/{path}/{strategy}/{name}", PostRelayerListenHandler(sm)).Methods("POST") | ||
|
||
// TODO: do we want to add the transaction commands here to? |
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.
client/connection/channel commands change the config during execution so we would want to make sure we are aware of that when addressing this TODO
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.
@colin-axner , do we need to remove this TODO since we thought of not implementing APIS for tx commands?
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.
lets remove
cmd/api.go
Outdated
// tx transfer | ||
// POST /paths/{name}/transfers | ||
|
||
// TODO: listen validation in config |
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.
We should open issues for every TODO
also waiting on review from @fedekunze |
This pull request introduces 7 alerts when merging a237c8b into 2f1a812 - view on LGTM.com new alerts:
|
This pull request introduces 7 alerts when merging 16bf3df into 2f1a812 - view on LGTM.com new alerts:
|
@colin-axner , We will setup swagger docs for rest APIs in a separate PR. |
Adding swagger docs later sounds fine, but I think someone should manually test to at least ensure one route works. Is there a reason why this cannot be done? Is it because we'd need some third party code to submit the rest requests? |
Not a problem, I will add a short document regarding how to start rest server and interact with routes. We thought swagger docs might be helpful since we can test routes directly from it. We will add swagger docs later in other PR and push a quick document now. |
sounds perfect, thanks @akhilkumarpilli |
This pull request introduces 7 alerts when merging bc84060 into cb3edfc - view on LGTM.com new alerts:
|
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, although I think this API could be further refactored / cleaned up. Can you also fix the alerts from lgtm-com?
cmd/api.go
Outdated
|
||
// VERSION | ||
// version get | ||
r.HandleFunc(fmt.Sprintf("/%s", version), VersionHandler).Methods("GET") |
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.
these are really hard to read, what's the need for fmt.Sprintf
? I think the value of having the endpoints as constants is less than using a plain string
} | ||
|
||
// PostRelayerListenHandler returns a handler for a listener that can listen on many IBC paths | ||
func PostRelayerListenHandler(sm *ServicesManager) func(w http.ResponseWriter, r *http.Request) { |
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 work? That would a step change in the relayer capabilities.
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.
We need to do some rework for this api. We can implement all TODOs related to PostRelayerListenHandler
in separate PR.
I tried to fix lgtm-com alerts but I am unable to fix them. |
This pull request introduces 7 alerts when merging 6a08698 into 9f13a93 - view on LGTM.com new alerts:
|
The incorrect conversion can be fixed by changing the upstream offset value to int instead of uint64 or by adding a if statement before doing QueryTxs action. The uncontrolled data path I think we can just suppress those errors (click on the hide button on lgtm to see how to suppress). The suppression won't take place until after this is merged, but we should still add it |
This pull request introduces 7 alerts when merging 8ee029d into 872dc2e - view on LGTM.com new alerts:
|
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 think we can merge this in so it starts getting some testing, see my MaxInt32 comment first though since it seems like a small fix
cc @anilcse @akhilkumarpilli
See the list of routes as well as comments
ref: #52