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

Use SlotNo and TimeInterpreter #1901

Merged
merged 11 commits into from
Jul 17, 2020
Merged

Commits on Jul 16, 2020

  1. Convert wallet to use SlotNo and TimeInterpreter

    == Add TimeInterpreter, necessary queries, and a way to run them
    Add tests comparing them with old implementation
    
    == Fundamentally change wallet to use SlotNo instead of SlotId
    - Patch together cardano-wallet-jormungandr to still work, despite the
    binary using SlotId.
    
    == Remove redundant byron code
    
    == Sync progress calculation compares times now instead of slots
    Anviking committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    353f4b6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5942f12 View commit details
    Browse the repository at this point in the history
  3. Remove genSlotId weed

    Anviking committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    7b34242 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c2a785a View commit details
    Browse the repository at this point in the history
  5. Fix mistake in DB property

    It would group slots like:
    
    Epoch 1:
      SlotNo 0
      SlotNo 8
    Epoch 0:
      SlotNo 11
    
    when it zipped the grouped slots together with the epochs.
    
    I'm not sure how it worked previously and stopped working now.
    
    I also added a somewhat ugly shrinker for the stake pool fixtures.
    Anviking committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    3fc013b View commit details
    Browse the repository at this point in the history
  6. Rename sqlite slot fields to slot_no forcing migration

    We previously encoded
        SlotId = (epoch, slotInEpoch)
    in the `slot` tables as a single, flat integer (using an artificial
    epoch length)
    
    We are now storing the SlotNos.
    
    It would be VERY BAD if a new wallet would read re-interpret the old
    wallet data incorrectly.
    
    Renaming the fields should trigger the automatic DB migration.
    Anviking committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    9eb843b View commit details
    Browse the repository at this point in the history
  7. Revert "Rename sqlite slot fields to slot_no forcing migration"

    This reverts commit 9eb843b.
    
    That commit broke a unit test failure for a manual migration. I am not
    sure if the test could have been removed without consequences.
    
    But weirdly, migration seems to work smoothly without it:
    
    $ cardano-wallet-shelley-2020-07-06 serve --node-socket socket --testnet shelley_testnet-genesis.json --database wallet-db
    $ # Create a wallet
    $ cardano-wallet-shelley transaction list <WALLET ID>
    
    $ cardano-wallet-shelley serve --node-socket socket --testnet shelley_testnet-genesis.json --database wallet-db
    $ cardano-wallet-shelley transaction list <WALLET ID>
    
    $ # The correct slots are still shown.
    
    Looking in the DBs, it seems like wallet does detect that the schema has
    changed, and re-syncs from genesis.
    Anviking committed Jul 16, 2020
    Configuration menu
    Copy the full SHA
    0df6556 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2020

  1. Configuration menu
    Copy the full SHA
    bb18aaa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a220dbe View commit details
    Browse the repository at this point in the history
  3. Remove out-of-date TODOs

    Anviking committed Jul 17, 2020
    Configuration menu
    Copy the full SHA
    1014550 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d4a21b4 View commit details
    Browse the repository at this point in the history