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

Improved DB + Full Testnet DB support #187

Merged
merged 6 commits into from Aug 29, 2023
Merged

Improved DB + Full Testnet DB support #187

merged 6 commits into from Aug 29, 2023

Conversation

JSKitty
Copy link
Member

@JSKitty JSKitty commented Aug 26, 2023

Abstract

This critical PR introduces two large changes to MPW, the prior of which need the most in-depth auditing and review that we can conceive, as a bad DB change could lead to catastrophic data loss.

  • A full revamp of the Database system.

    • Now with addAccount() and updateAccount(), each with very tight limits, checks and guard-rails.
    • Removed the ability for addAccount() to override accounts or parts of accounts.
    • updateAccount() can update keys of accounts, but not delete them, without explicit allowDeletion permission.
  • Full Testnet support for Encryption and Databasing.

    • Added the ability to switch between Mainnet and Testnet any time, even with wallets loaded.
    • Added the ability to Encrypt your Testnet wallet.

The new updateAccount() function is designed to be used EXCLUSIVELY by using an Account class as it's input, and will outright refuse any type that differs from the class, this ensures that there is absolutely no way, even with badly written code, to accidentally overwrite an Account or it's properties.

The new database ensures that ALL keys of an Account are ALWAYS present; meaning no more account?.localProposals or similar, the class and DB both have a type-safety to them which now guarantee the availability of the type for every key of the Account.

When there's MPW updates, the DB will automatically add new keys added to the Account class, with zero need for manual migration.


Testing

To test this PR, it's suggested to attempt these user flows, or variations of these:

  • Create or Import your wallet, as you normally would.
  • Heavily test that the database is working as expected, examples of testing this are: Setting, Renaming, Deleting Contacts, by creating Proposals, by testing that wallets are saving and being remembered correctly, with zero data loss.

Note: the new Testnet integration is known to have certain quirks: you may experience network errors when switching between Mainnet and Testnet, this is from switching halfway through Explorer Syncing, but this is relatively harmless and out-of-scope of this PR to fix.

Note: it's known that when switching between networks, if the NEW wallet does not have any UTXOs, the Activity will not update; this will be resolved with the merging of #186 since we'll have the ability to re-render the Activity list at-will then.

If any errors are found, the PR works unexpectedly, or you have viable suggestions to improve the UX or functionality of the PR, let me know!


@JSKitty JSKitty added Bug This is either a bugfix (PR) or a bug (issue). Documentation Improvements or additions to documentation Enhancement New feature or request help wanted Extra attention is needed Awaiting Review This PR and/or issue is awaiting reviews before continuing. labels Aug 26, 2023
@JSKitty JSKitty self-assigned this Aug 26, 2023
@JSKitty JSKitty added the Review Reward: 50 PIV Reviewers of this Pull Request will receive a 50 PIV reward label Aug 26, 2023
Copy link

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

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

tACK ac10d34

@JSKitty JSKitty merged commit 97ffeab into master Aug 29, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Review This PR and/or issue is awaiting reviews before continuing. Bug This is either a bugfix (PR) or a bug (issue). Documentation Improvements or additions to documentation Enhancement New feature or request help wanted Extra attention is needed Review Reward: 50 PIV Reviewers of this Pull Request will receive a 50 PIV reward
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants