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

Exclude retired pools from the ListStakePools API function result. #1945

Merged
merged 12 commits into from
Jul 25, 2020

Conversation

jonathanknowles
Copy link
Member

@jonathanknowles jonathanknowles commented Jul 24, 2020

Issue Number

#1937

Overview

This PR:

  • Applies a very simple filter to the Shelley ListStakePools API operation that excludes all pools with a retirement epoch earlier than or equal to the current epoch.
  • Adds an integration test to verify that if pool p has already retired, it will not be listed by ListStakePools.

Future Improvements

The current pool tracking implementation (which predates this PR) has two potential areas for improvement:

These are not tackled in this PR, but are instead recorded in the above tickets, so that we may schedule time to fix them at a later date.

@jonathanknowles jonathanknowles added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Jul 24, 2020
@jonathanknowles jonathanknowles self-assigned this Jul 24, 2020
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/do-not-list-retired-pools branch 3 times, most recently from f96af60 to a983133 Compare July 24, 2020 09:24
@jonathanknowles jonathanknowles force-pushed the jonathanknowles/do-not-list-retired-pools branch from a983133 to 8063cf6 Compare July 25, 2020 04:00
@jonathanknowles

This comment has been minimized.

iohk-bors bot added a commit that referenced this pull request Jul 25, 2020
@jonathanknowles jonathanknowles marked this pull request as ready for review July 25, 2020 04:08
@jonathanknowles jonathanknowles changed the title WIP: Do not list retired stake pools in the API. Do not list retired stake pools in the API. Jul 25, 2020
@jonathanknowles jonathanknowles requested a review from rvl July 25, 2020 04:11
@jonathanknowles

This comment has been minimized.

@iohk-bors

This comment has been minimized.

@iohk-bors

This comment has been minimized.

Copy link
Contributor

@piotr-iohk piotr-iohk left a comment

Choose a reason for hiding this comment

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

There is one problem I think. Playing around with the CI cluster I've observed that the pool scheduled to be retired in epoch n is still visible through the whole epoch n and disappears from the list in epoch n+1. While it is visible one can still join it but gets:

{"code":"no_such_pool"
,"message":"I couldn't find any stake pool with the given id: b45768c1a2da4bd13ebcaa1ea51408eda31dcc21765ccbd407cda9f2"}

I guess pool retired to be scheduled in n should not be shown from n onwards...

@jonathanknowles
Copy link
Member Author

jonathanknowles commented Jul 25, 2020

There is one problem I think. Playing around with the CI cluster I've observed that the pool scheduled to be retired in epoch n is still visible through the whole epoch n and disappears from the list in epoch n+1. While it is visible one can still join it but gets:

{"code":"no_such_pool"
,"message":"I couldn't find any stake pool with the given id: b45768c1a2da4bd13ebcaa1ea51408eda31dcc21765ccbd407cda9f2"}

I guess pool retired to be scheduled in n should not be shown from n onwards...

Nice catch!

I think I've found the source of this here:

https://github.com/input-output-hk/cardano-wallet/pull/1945/files#r460378458

I'll post a patch shortly.

EDIT: fixed in 6ec42fb

@jonathanknowles jonathanknowles changed the title Do not list retired stake pools in the API. Do not list retired stake pools in the ListStakePools API operation. Jul 25, 2020
@jonathanknowles jonathanknowles changed the title Do not list retired stake pools in the ListStakePools API operation. Exclude retired pools from the ListStakePools API function result. Jul 25, 2020
Copy link
Contributor

@piotr-iohk piotr-iohk left a comment

Choose a reason for hiding this comment

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

LGTM!

Corner case that may be considered in future PR/story:

  • pool A schedule to retire in n
  • wallet joins A in n-1 (shows as delegation next: n + 1, target: A)
  • pool disappears from the list in n (wallet still shows as delegation next: n + 1, target: A)
  • since n + 1 wallet shows as delegation active, target: A

@jonathanknowles

This comment has been minimized.

@jonathanknowles
Copy link
Member Author

jonathanknowles commented Jul 25, 2020

Corner case that may be considered in future PR/story:
* pool A schedule to retire in n
* wallet joins A in n-1 (shows as delegation next: n + 1, target: A)
* pool disappears from the list in n (wallet still shows as delegation next: n + 1, target: A)
* since n + 1 wallet shows as delegation active, target: A

I agree we should definitely discuss what we want the GetWallet and ListWallets operations to show in the case where a pool has already retired, including the above corner case.

I've opened the following ticket to capture this discussion: #1949.

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 25, 2020

Build succeeded

@iohk-bors iohk-bors bot merged commit fe73ece into master Jul 25, 2020
@iohk-bors iohk-bors bot deleted the jonathanknowles/do-not-list-retired-pools branch July 25, 2020 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants