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

Split POST delegations endpoint #2191

Closed
3 of 4 tasks
fedekunze opened this issue Aug 30, 2018 · 8 comments
Closed
3 of 4 tasks

Split POST delegations endpoint #2191

fedekunze opened this issue Aug 30, 2018 · 8 comments
Assignees

Comments

@fedekunze
Copy link
Collaborator

fedekunze commented Aug 30, 2018

Summary

Split the current POST /stake/delegators/{delegatorAddr}/delegations into 3 different POST endpoints to match the 3 types of delegations: Delegation, UnbondingDelegation and Redelegation

Problem Definition

In stake/rest/tx.go there's a comment that says // TODO: Split this up into several smaller functions, and remove the above nolint

Currently there's a single POST endpoint to submit delegations that handles Delegations, Undelegations and Redelegations:

// the request body for edit delegations
type EditDelegationsBody struct {
	LocalAccountName    string                       `json:"name"`
	Password            string                       `json:"password"`
	ChainID             string                       `json:"chain_id"`
	AccountNumber       int64                        `json:"account_number"`
	Sequence            int64                        `json:"sequence"`
	Gas                 int64                        `json:"gas"`
	Delegations         []msgDelegationsInput        `json:"delegations"`
	BeginUnbondings     []msgBeginUnbondingInput     `json:"begin_unbondings"`
	BeginRedelegates    []msgBeginRedelegateInput    `json:"begin_redelegates"`
}

Proposal

The proposal is to split the current implementation of POST /stake/delegators/{delegatorAddr}/delegations into the following:

  • POST /stake/delegators/{delegatorAddr}/delegations
  • POST /stake/delegators/{delegatorAddr}/unbonding_delegations
  • POST /stake/delegators/{delegatorAddr}/redelegations

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@fedekunze fedekunze changed the title Split POST /stake/delegators/{delegatorAddr}/delegations Split POST delegations endpoint Aug 30, 2018
@alexanderbez
Copy link
Contributor

alexanderbez commented Aug 30, 2018

In favor of such a design. Although I'd use this moment to also rename LocalAccountName to something more concise and intuitive. To be clear, these endpoints can either create or update these resources, correct (hence PUT over POST)?

@fedekunze
Copy link
Collaborator Author

@alexanderbez well thinking it twice... the only one that can be updated is the Delegation endpoint technically. So the others should be POST (sorry, based my proposal on the single prev endpoint). I'll update the description.

Which name would you propose to replace LocalAccountName ?

@fedekunze
Copy link
Collaborator Author

@alexanderbez actually not sure about Unbonds... for example you can unbond 50% of your bonded tokens from a validator and then unbond the rest. So, does that generate a new Unbond tx or just overrides the previous one by updating the amount ? what about the unbonding period (does it gets updated as well to the new block height)?

@alexanderbez
Copy link
Contributor

These are all excellent questions @fedekunze, all of which we will need to look into and discover the answers 😉

re; LocalAccountName -- I believe this is the keybase name in which we do a lookup of the info. If so, I think KeyName or AccountName should suffice?

@rigelrozanski
Copy link
Contributor

currently you can only have one unbond from a delegator at a time, as well as, only one redelegation at a time - it's unideal. This needs to be fixed and is a prelaunch issue see: #1402

@jackzampolin
Copy link
Member

Is this still an issue @fedekunze ?

@fedekunze
Copy link
Collaborator Author

@jackzampolin still blocked on #1402

@fedekunze
Copy link
Collaborator Author

fedekunze commented Nov 13, 2018

Unblocking as we can still split the endpoint and then implement #1402

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

No branches or pull requests

4 participants