Improved DB + Full Testnet DB support #187
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
addAccount()
andupdateAccount()
, each with very tight limits, checks and guard-rails.addAccount()
to override accounts or parts of accounts.updateAccount()
can update keys of accounts, but not delete them, without explicitallowDeletion
permission.Full Testnet support for Encryption and Databasing.
The new
updateAccount()
function is designed to be used EXCLUSIVELY by using anAccount
class as it's input, and will outright refuse anytype
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 thetype
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:
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!