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

feat: add support for delegation deposit reclaim #436

Merged
merged 7 commits into from
Dec 6, 2021
Merged

Conversation

ntn-x2
Copy link
Member

@ntn-x2 ntn-x2 commented Nov 8, 2021

Add support for delegation deposit reclaim

This PR fixes https://github.com/KILTprotocol/ticket/issues/1685 by adding a new function on DelegationNode and the relative chain file to generate a SubmittableExtrinsic for the reclaim_deposit chain function.

This PR targets develop commit KILTprotocol/kilt-node@fc56483 and master commit KILTprotocol/kilt-node@dff5ae8 (integration tests for this branch are failing as delegation deposits have not yet been merged).

Companion PR (already merged on develop) -> KILTprotocol/kilt-node#295

Checklist:

  • I have verified that the code works
  • I have verified that the code is easy to understand
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@ntn-x2 ntn-x2 marked this pull request as ready for review November 9, 2021 08:00
@ntn-x2 ntn-x2 requested review from Dudleyneedham, tjwelde and LeonFLK and removed request for Dudleyneedham November 9, 2021 08:00
@ntn-x2 ntn-x2 self-assigned this Nov 9, 2021
@ntn-x2 ntn-x2 added the 💚 low priority: low label Nov 9, 2021
Copy link
Member

@Dudleyneedham Dudleyneedham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes

@@ -64,7 +65,7 @@ export class DelegationNode implements IDelegationNode {
public readonly id: IDelegationNode['id']
public readonly hierarchyId: IDelegationNode['hierarchyId']
public readonly parentId?: IDelegationNode['parentId']
public readonly childrenIds: Array<IDelegationNode['id']> = []
private childrenIdentifiers: Array<IDelegationNode['id']> = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using id everywhere else I would suggest to either change to match or change elsewhere to identifier

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but I had to make childrenIds a public getter, while also having a private variables, and they could not be called the same. Plus, using a leading _ would trigger lint warnings. I did not find any other way to expose what I needed to expose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do they need to be private? (also note, that after transpiling to javascript, it is not private anymore, just a hint for people working with typescript)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the idea is to follow, where possible, object-oriented encapsulation. Ok that with JS we lose all this nice info, but for TS developers it should not be possible to alter the array of children without revoking them. That is why I did not want to publicly expose it.

packages/core/src/delegation/DelegationNode.ts Outdated Show resolved Hide resolved
@Dudleyneedham
Copy link
Member

The tests are also failing.

@ntn-x2
Copy link
Member Author

ntn-x2 commented Nov 10, 2021

The issues with tests is because we are mistakenly referring to the latest-develop as the latest master release, which does not have delegation deposits yet. @weichweich can we fix that, so that I can re-trigger the pipeline and see if it goes through?

[EDIT]
I fixed it yesterday and indeed now all but the latest-rc integration tests are going through.

Copy link
Contributor

@tjwelde tjwelde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

childrenIds could be kept public (just not readonly), otherwise LGTM

Copy link
Member

@Dudleyneedham Dudleyneedham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ntn-x2 ntn-x2 merged commit 0b2fc25 into develop Dec 6, 2021
@ntn-x2 ntn-x2 deleted the aa-deposit-claim branch December 6, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💚 low priority: low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants