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

Implement state upgrades #614

Closed
1 task
andrevmatos opened this issue Nov 27, 2019 · 2 comments · Fixed by #1050
Closed
1 task

Implement state upgrades #614

andrevmatos opened this issue Nov 27, 2019 · 2 comments · Fixed by #1050
Assignees
Labels

Comments

@andrevmatos
Copy link
Contributor

andrevmatos commented Nov 27, 2019

Description

As soon as we release to mainnet, we must not break compatibility on state. For that, we must be able to upgrade old states to current working version.

This can be done with a version tag on the state, and a set of orderable functions on some submodule, each one taking a raw object (not typed, to avoid keeping all io-ts codecs versions on the codebase forever) of version V and returning a raw object of version V+1. The last one then should return an object which is decodable as current RaidenState.

This will allow more easily allowing users to download and backup their state (as a JSON file), and possibly even in a new browser or client with the same private key, upload the state and continue from where from that point on. It'll be user's responsibility to keep the file safe, and to ensure no forks occur (e.g. having 2 clients running in parallel on same account)

Acceptance criteria

  • Old states can be loaded into the SDK
  • Upgrade is performed on it
  • Result is a state compatible with current SDK version.
  • Tokens should not be locked in a state where they can't be accessed anymore

Tasks

  • Detecting that it is an old state
@andrevmatos andrevmatos added this to the Product Backlog milestone Nov 27, 2019
@christianbrb
Copy link
Contributor

christianbrb commented Nov 28, 2019

@andrevmatos
Copy link
Contributor Author

andrevmatos commented Nov 29, 2019

@christianbrb it's more or less like that, but we don't use redux-persist, mainly because our storage implementation makes use of the strong guarantees of our io-ts-based typing system, and also ensures no numeric precision loss with lossless-json, which would have been hard to implement over redux-persist.
But the state migration is very close to how they do it, although implementing it ourselves is trivial, the migration functions looks exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants