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-106] Support restoration-from option in create-wallet API #4382

Conversation

paolino
Copy link
Collaborator

@paolino paolino commented Jan 2, 2024

This PR adds support for restoration from a given chainpoint for shelley wallets.

  • Add RestorationMode optional field to the API specs
  • Add RestorationMode and API counterpart haskell type
  • Add some datatype to transport the mode to the DBLayer (StartRestorationPoint)
  • Add a datatype to hold the initial state of a wallet (InitialState)
  • Update JSON golden for WalletPostData
  • Implement the database support for the mode

ADP-106

@paolino paolino self-assigned this Jan 2, 2024
@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch 3 times, most recently from 2a3e154 to 0f00242 Compare January 3, 2024 09:29
@paolino paolino requested a review from paweljakubas January 3, 2024 09:31
Copy link
Contributor

@paweljakubas paweljakubas left a comment

Choose a reason for hiding this comment

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

Looks nice. It would be good to do three more things in this API-affecting PR:

  1. add specification in a separate md file like we did for example for one change addr wallet : https://github.com/cardano-foundation/cardano-wallet/blob/master/specifications/api/one-change-address-mode.md
  2. Make sure shelley and shared wallet are covered
  3. Please regenerate golden for PostWalletData. ie. remove the file and then run unit tests like below
CREATE_MISSING_GOLDEN=TRUE cabal run cardano-wallet:test:unit

@paweljakubas
Copy link
Contributor

PS. Those files deleted are not part of this PR..Could you exclude them and create separate cleaning PR for this task?

@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch 2 times, most recently from f21845a to fa66d54 Compare February 9, 2024 11:37
@paolino paolino added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Feb 19, 2024
@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch 16 times, most recently from da29adc to d289531 Compare February 27, 2024 11:55
@HeinrichApfelmus
Copy link
Contributor

I wonder if we should not enhance endpoint in network https://cardano-foundation.github.io/cardano-wallet/api/edge/#operation/getNetworkInformation in such a way that we can add block header hash. Of course in separate PR.

Fortunately, we already have an endpoint which does exactly that:

https://cardano-foundation.github.io/cardano-wallet/api/edge/#operation/getBlocksLatestHeader

It has a more REST-like path.

@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch 2 times, most recently from 5e27343 to bbb3fea Compare March 11, 2024 14:11
@paolino paolino requested a review from paweljakubas March 11, 2024 14:11
@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch from bbb3fea to b82fdad Compare March 11, 2024 14:44
@paolino paolino force-pushed the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch from b82fdad to 794b206 Compare March 11, 2024 14:49
Copy link
Contributor

@paweljakubas paweljakubas left a comment

Choose a reason for hiding this comment

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

thanks for adopting changes/improvemnts. I played a little with your branch and it looks fine. Please merge CLI branch onto this one before merging. Also I wonder if we could add unit tests and properties showing that

  1. if we have wallet created after slot1 then for any slot2 < slot1 and slot3 < slot2 the wallet state is the same.
  2. if we have wallet created after slot1 then for any slot2 < slot1 and fromGenesis we the wallet state the same
  3. for any wallet created at any point txs for wallet created from genesis include txs for wallet restored from any slot < tip which in turn include txs restored from tip.
    etc.etc .(of course could be in separate PR if you find this idea compelling)

Overall LGTM! Great work!

@paolino paolino enabled auto-merge March 11, 2024 16:04
@paolino paolino added this pull request to the merge queue Mar 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 11, 2024
@paolino paolino added this pull request to the merge queue Mar 11, 2024
github-merge-queue bot pushed a commit that referenced this pull request Mar 11, 2024
This PR adds support for restoration from a given chainpoint for shelley
wallets.

- [x] Add RestorationMode optional field to the API specs
- [x] Add RestorationMode and API counterpart haskell type
- [x] Add some datatype to transport the mode to the DBLayer
(StartRestorationPoint)
- [x] Add a datatype to hold the initial state of a wallet
(InitialState)
- [x] Update JSON golden for WalletPostData
- [x] Implement the database support for the mode

ADP-106
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 11, 2024
@paolino paolino added this pull request to the merge queue Mar 12, 2024
Merged via the queue into master with commit 416a7d7 Mar 12, 2024
3 checks passed
@paolino paolino deleted the paolino/ADP-106/change-create-wallet-API-to-support-restoration-date branch March 12, 2024 08:56
WilliamKingNoel-Bot pushed a commit that referenced this pull request Mar 12, 2024
…4382) This PR adds support for restoration from a given chainpoint for shelley wallets. - [x] Add RestorationMode optional field to the API specs - [x] Add RestorationMode and API counterpart haskell type - [x] Add some datatype to transport the mode to the DBLayer (StartRestorationPoint) - [x] Add a datatype to hold the initial state of a wallet (InitialState) - [x] Update JSON golden for WalletPostData - [x] Implement the database support for the mode ADP-106 Source commit: 416a7d7
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