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

Change governance REST endpoints to a more REST-ful structure #1284

Closed
faboweb opened this issue Jun 16, 2018 · 12 comments · Fixed by #1357
Closed

Change governance REST endpoints to a more REST-ful structure #1284

faboweb opened this issue Jun 16, 2018 · 12 comments · Fixed by #1357
Assignees
Labels

Comments

@faboweb
Copy link
Contributor

faboweb commented Jun 16, 2018

Proposal for rest-ful structure:

submit: POST /gov/proposals
deposit: POST /gov/proposals/{proposalID}/deposits
vote: POST /gov/proposals/{proposalID}/votes
get votes for address: GET /gov/proposals/{proposalID}/votes?address={voterAddress}
read proposal: GET /gov/proposals/{proposalID}
get proposals an address voted for: GET /gov/proposals/?voted={voterAddress}
get proposals by creator: GET /gov/proposals/?proposer={proposerAddress}

build endpoints returning tx that are signed client side (for later):
GET /gov/proposals/build
GET /gov/proposals/{proposalID}/deposits/build
GET /gov/proposals/{proposalID}/votes/build

@sunnya97
Copy link
Member

I currently don't keep track of the proposer of a proposal. Is this something desired?

@faboweb
Copy link
Contributor Author

faboweb commented Jun 20, 2018

Situation: The great dictator sunny wants to track all his proposals like "give 66% of atoms to sunny" or "let us make everyday a taco Tuesday" but he doesn't want to scroll through all the unimportant proposals. Then we would need this.
How much of an overhead would it be to store the proposer?

@sunnya97 sunnya97 self-assigned this Jun 22, 2018
@sunnya97
Copy link
Member

sunnya97 commented Jun 22, 2018

@faboweb Given that the vote/deposit msg being POSTed contains the proposalID, is the idea to have it do a safety check, that the msg.ProposalID is the same as the one in the rest endpoint?

Also, why are addresses params while proposalIDs are REST paths?

@sunnya97
Copy link
Member

sunnya97 commented Jun 22, 2018

Regarding storing the proposer, I feel like we don't want to create a model in which we associate proposals with their proposer. How about we have one for all the deposits done by a specific address? Deposits feel like more of a "anyone can become a partial owner of the proposal", not just a single person.

@faboweb
Copy link
Contributor Author

faboweb commented Jun 22, 2018

The arguments posted to the endpoint should not equal the constructed msg I think. Therefore the body in the POST does not contain the proposalID. The ID is taken from the URL.
Is a safety check necessary?

For query vs path params:
Path params are IDs selecting from the parent ressource. Query params select on other properties. In this case we are not selecting by voteID but by a property of the vote (voter).

Is that understandable?

This is all to create a consistent API structure.

@faboweb
Copy link
Contributor Author

faboweb commented Jun 22, 2018

For proposerid:
Is there a downside to storing the ID?
I am not feeling strongly about it though.

@faboweb
Copy link
Contributor Author

faboweb commented Jun 23, 2018 via email

@sunnya97
Copy link
Member

sunnya97 commented Jun 24, 2018

voterID == address?

@faboweb
Copy link
Contributor Author

faboweb commented Jun 24, 2018 via email

@sunnya97
Copy link
Member

@faboweb Changing scope of this issue. Moving

build endpoints returning tx that are signed client side (for later):
GET /gov/proposals/build
GET /gov/proposals/{proposalID}/deposits/build
GET /gov/proposals/{proposalID}/votes/build

to a new issue (#1356). So it can be done after #1355 first.

@sunnya97
Copy link
Member

@faboweb @adrianbrink
Thinking about it, I feel URL parameters for POSTs are kind of weird. I think it makes sense for GETs, but for POST, I would prefer to just post the tx/msg as a whole. Thoughts?

@faboweb
Copy link
Contributor Author

faboweb commented Jul 11, 2018

A huge benefit of doing parameters in POSTs is, that you can track what is going on in the network history.
The bigger benefit I guess is to abstract messages away from the app developers. So the interface always stays the same for the app developer. The light client on the other hand can change the message format reflecting the current state. This results in less frustration and less time updating code to newer SDK versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants