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

ADP-478: Garbage collect delisted stake pools from SMASH #2249

Merged
merged 29 commits into from
Nov 10, 2020

Commits on Nov 10, 2020

  1. Add delistPools to Pool DBLayer

    This is the first step for garbage collecting
    stake pools based on SMASH delisting.
    
    X-JIRA-Ticket: ADP-478
    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    c6e9260 View commit details
    Browse the repository at this point in the history
  2. Add delisted to swagger.yaml

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    45e1a88 View commit details
    Browse the repository at this point in the history
  3. Add internal_state table

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    903440d View commit details
    Browse the repository at this point in the history
  4. Add GC worker thread for delisting Pools

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    1896b34 View commit details
    Browse the repository at this point in the history
  5. Return GC sync time as well from ListStakePools

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    fbbf8c0 View commit details
    Browse the repository at this point in the history
  6. Add stake pool maintenance endpoint

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    88c6cff View commit details
    Browse the repository at this point in the history
  7. Change DB representation of POSIXTime

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    04f3415 View commit details
    Browse the repository at this point in the history
  8. Add DB test for last GC time

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    7ed274a View commit details
    Browse the repository at this point in the history
  9. Add property test for delistPools

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    3192c4e View commit details
    Browse the repository at this point in the history
  10. Redo how we report GC status of metadata

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    fbb57d0 View commit details
    Browse the repository at this point in the history
  11. Add /stake-pools/metadata-gc-status endpoint

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    456ee2d View commit details
    Browse the repository at this point in the history
  12. Add prop_delistPoolsPersists, which fails right now

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    7b65f3d View commit details
    Browse the repository at this point in the history
  13. Fix putPoolRegisration to consider the delisted flag

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    55ddb80 View commit details
    Browse the repository at this point in the history
  14. Add 'ApiT PoolMetadataGCStatus' to json roundtrip explicitly

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    173f9ed View commit details
    Browse the repository at this point in the history
  15. Fix 'Arbitrary (ApiListStakePools ApiStakePool)'

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    de490f5 View commit details
    Browse the repository at this point in the history
  16. Add missing golden files

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    7f17cb5 View commit details
    Browse the repository at this point in the history
  17. Update lib/shelley/src/Cardano/Wallet/Shelley/Pools.hs

    Co-authored-by: Jonathan Knowles <[email protected]>
    2 people authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    abf915e View commit details
    Browse the repository at this point in the history
  18. Update lib/core/src/Cardano/Wallet/Api/Types.hs

    Co-authored-by: Jonathan Knowles <[email protected]>
    2 people authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    71b0d6b View commit details
    Browse the repository at this point in the history
  19. Record delisted pools in a dedicated table.

    Record delisted pools in a dedicated table instead of using a field in
    the `pool_registrations` table.
    
    In the updated schema, a pool is delisted if (and only if) there is a
    single row containing that pool's id in the `delisted_pools` table.
    
    This solution has several advantages:
    
      1.  We only need a single database row to record that a pool is delisted.
    
      2.  We no longer need to carefully to ensure that all registration records
          for a particular pool have the same delisted status. A pool is either
          delisted or not delisted: the schema rules out all intermediate states.
    
      3.  Pools automatically remain delisted when rollbacks occur or when new
          certificates are published, with no extra effort.
    
      4.  The `putPoolRegistration` function no longer needs to read the
          most-recently-written registration entry before adding a new entry.
    
      5.  Each row in the `pool_registrations` table is now just an immutable
          record of a registration certificate.
    
      6.  The `PoolFlag` type is no longer necessary.
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    204e685 View commit details
    Browse the repository at this point in the history
  20. Rename delisted_pools table to pool_delistment.

    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    cf7a5ad View commit details
    Browse the repository at this point in the history
  21. Make delistPools replace the set of delisted pools.

    We must replace the set of delisted pools, rather than augmenting it.
    
    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    4b3c36b View commit details
    Browse the repository at this point in the history
  22. Rename delistPools to putDelistedPools.

    This operation completely replaces the set of delisted pools, rather
    than augmenting it. Therefore, the name `delistPools` is slightly
    misleading, as it gives the impression that the existing set will be
    augmented, which is no longer true.
    
    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    90873a8 View commit details
    Browse the repository at this point in the history
  23. Update prop_putDelistedPools to check for overwriting.

    In particular, we check that 'putDelistedPools' completely overwrites
    the existing set every time.
    
    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    08df4e1 View commit details
    Browse the repository at this point in the history
  24. Remove prop_putDelistedPoolsPersists.

    This test no longer makes sense, as delisted pools are no longer stored
    in the `pool_registration` table.
    
    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    2995450 View commit details
    Browse the repository at this point in the history
  25. Adjust removePools to not remove pools from the delisted set.

    In response to review feedback:
    
    #2277 (comment)
    jonathanknowles authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    b564500 View commit details
    Browse the repository at this point in the history
  26. Move maintenance-actions to its own endpoint

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    0b8df37 View commit details
    Browse the repository at this point in the history
  27. Fix swagger definition

    Julian Ospald authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    4a70362 View commit details
    Browse the repository at this point in the history
  28. Regenerate nix

    IOHK authored and KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    105ec6a View commit details
    Browse the repository at this point in the history
  29. unify gcPoolStatus and maintenance action for a cleaner API

      It was a bit awkward to have two completely distinct endpoints for
      this with different paths, whereas they related to exactly the same
      thing. This commit makes the API a bit more consistent by wrapping the
      `gcPoolStatus` inside a `maintenance action` object. So that, the API
      now offers two dual endpoints:
    
      - post maintenance action
      - get maintenance action
    
      There's only one maintenance action available at this stage.
    KtorZ committed Nov 10, 2020
    Configuration menu
    Copy the full SHA
    6489807 View commit details
    Browse the repository at this point in the history