-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2024: Add pool DB operation `listRetiredPools`. r=jonathanknowles a=jonathanknowles # Issue Number #2016 # Overview This PR: - [x] Adds a `listRetiredPools` operation to the pool DB layer:<br><br> ```hs listRetiredPools :: EpochNo -> stm [PoolId] -- ^ List all pools with an active retirement epoch that is -- earlier than or equal to the specified epoch. ```` - [x] Provides the following implementations of `listRetiredPools`. - [x] `Pool.DB.MVar` - [x] `Pool.DB.SQLite`. The SQLite implementation is based on an **SQL view** ([see definition](https://github.com/input-output-hk/cardano-wallet/pull/2024/files#diff-08afa2852f50fa31f5757942d004ce8aR513)) which determines the currently-active set of retirement certificates. <details><summary>Click to view sample data</summary>  </details> # Property Testing This PR also adds property tests to check that: - [x] `listRetiredPools` **does not** return: - [x] pools that have never had retirement certificates associated with them. - [x] pools that have had their most-recently-published retirement certificates revoked by subsequent re-registration certificates. - [x] pools with effective retirement epochs that are later than the specified epoch. - [x] `listRetiredPools` returns the correct set of pools in the following contexts: - [x] where there are **multiple pools**. - [x] where there are **multiple certificates per pool** (registrations, retirements, re-registrations, re-retirements). - [x] where the publications of certificates affecting different pools are **interleaved together in time**. # Mutation Testing To increase confidence that the `activePoolRetirements` view is correctly defined, I have manually performed the following mutations and verified that the `prop_listRetiredPools_multiplePools_multipleCerts` property fails appropriately. ### Mutation 1 ```patch - WINDOW w AS (ORDER BY pool_id, slot desc, slot_internal_index desc) + WINDOW w AS (ORDER BY pool_id, slot , slot_internal_index desc) ) GROUP BY pool_id ``` ### Mutation 2 ```patch - WINDOW w AS (ORDER BY pool_id, slot desc, slot_internal_index desc) + WINDOW w AS (ORDER BY pool_id, slot desc, slot_internal_index ) ) GROUP BY pool_id ``` ### Mutation 3 ```patch - WINDOW w AS (ORDER BY pool_id, slot desc, slot_internal_index desc) + WINDOW w AS (ORDER BY pool_id, slot , slot_internal_index ) ) GROUP BY pool_id ``` ### Mutation 4 ```patch - WINDOW w AS (ORDER BY pool_id, slot desc, slot_internal_index desc) + WINDOW w AS (ORDER BY pool_id, slot desc, ) ) GROUP BY pool_id ``` Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
- Loading branch information
Showing
9 changed files
with
480 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,7 @@ library | |
, statistics | ||
, stm | ||
, streaming-commons | ||
, string-qq | ||
, template-haskell | ||
, text | ||
, text-class | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.