-
Notifications
You must be signed in to change notification settings - Fork 72
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
Database and storage refactoring #177
Conversation
# Conflicts: # __tests__/services/WalletService.spec.ts # src/components/TableDisplay/TableDisplayTs.ts # src/components/WalletSelectorPanel/WalletSelectorPanelTs.ts # src/services/AssetTableService/NamespaceTableService.ts # src/services/MosaicService.ts # src/services/MultisigService.ts # src/services/WalletService.ts # src/store/Account.ts # src/store/Wallet.ts # src/views/forms/FormAccountPasswordUpdate/FormAccountPasswordUpdateTs.ts # src/views/forms/FormGeneralSettings/FormGeneralSettingsTs.ts # src/views/forms/FormNamespaceRegistrationTransaction/FormNamespaceRegistrationTransactionTs.ts # src/views/pages/accounts/LoginPageTs.ts # src/views/pages/accounts/create-account/finalize/FinalizeTs.ts # src/views/pages/accounts/import-account/wallet-selection/WalletSelectionTs.ts
There are solutions but they are a bit hacky (but better than nothing IMO). I think that there won't be further fixes before Vue 3 that will be written in TypeScript |
About maps, another advantage of not using them is that Vue reactivity engine does not support them. However, Vue 3 will support them |
Account import seems to be broken When importing an account from mnemonic and chosing addresses (having the new default address with a balance and a transaction history), the dashboard left section (balance panel and mosaic list) initialize empty, and it throws: in walletChoose, the balances are not showing Wallets are not showing in the wallet view Them when I logout and login, it goes straight to the mnemonic random generation screen (mousemove) |
When starting the app with empty local storage The language selector is not properly initialized (it shows as "Select" when starting the app with an empty localStorage) |
Listeners do not seem to work There are no notifications for new (un)confirmed transactions |
If I have a bad connectivity, a node switch can let me forever with the loading overlay |
For some reason, the I tried this branch with the static files generated by |
transaction list The transaction list sometimes does not clear when switching wallets (when switching to wallet B, I still see transactions of wallet A) untill switching to another view and coming back to the dashboard |
I haven't revisited the transaction lists. Something that I have noticed is that transactions aren't been cached in db like mosiac or namespaces. Is this expected? What I have done for namespaces and mosaic is loading the entities for all known wallets (sdk allows you to load entities for mutliple accounts with one rest call). Then when switching from one wallet to another, the new wallet has the namespaces/mosaics prefetched, feedback to the user is quicker. There will be another loading just to retrieve the latest ones when hitting the page (or maybe in response to another event) I guess we could do something similar with transactions instead of just cleaning up existing and load new ones. |
This PR will need a full round trip of regression testing and fixes especially after all the merges pre-release. I just wanted to be sure the team is ok with the path taken in order to allocate more time. |
# Conflicts: # __tests__/services/WalletService.spec.ts # __tests__/store/Account.spec.ts # src/services/WalletService.ts # src/store/Account.ts # src/store/Wallet.ts # src/views/forms/FormAccountPasswordUpdate/FormAccountPasswordUpdateTs.ts # src/views/forms/FormAliasTransaction/FormAliasTransactionTs.ts # src/views/forms/FormSubWalletCreation/FormSubWalletCreationTs.ts # src/views/forms/FormTransactionBase/FormTransactionBase.ts
Listeners seem working, I'm announcing transactions |
do the snackbars show when tx get unconfirmed and confirmed?
and are the new transactions added to the transaction list?
It wasn't working when I tried
Le mer. 15 avr. 2020 à 10:51, fboucquez <[email protected]> a écrit :
… Listeners do not seem to work
There are no notifications for new (un)confirmed transactions
Listeners seem working, I'm announcing transactions
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#177 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIWPBPZNRH23EJ7GBBBISXTRMUOKPANCNFSM4LXFPYOA>
.
|
Hi @decentraliser, please have another look at this PR when you have the chance
|
|
Others seems good. Maybe make one cycle on wallet creation / import, and then I will do an exhaustive review of all features |
fixed mosaic and namespace links Moved transactions to own module Improved balance component Improved how blocks are loaded Improved Amount shown in transaction table fixed load account info dispatch Fixed account creation Small fixes
Mosaic Tables shown owned and balance mosaics
To reproduce the navigator crashing, you can try to select the node jp12.nemesis.land |
Improved Transaction View types
Disabled known nodes from peers
The fixes in the last commits:
Could you give it another go? |
@@ -98,5 +98,11 @@ export default class PeerSelector extends PeerSelectorTs {} | |||
.ivu-poptip-body-content { | |||
overflow: hidden; | |||
} | |||
.ivu-poptip-title { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey,teamate!
i will suggest that if you want to change the iview styles in this component.please add scoped
,like this <style lang="less" scoped></style>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
<span class="col2-item overflow_ellipsis"><AddressDisplay :address="transaction.signer.address" /></span> | ||
<span class="col2-item bottom overflow_ellipsis"> | ||
<span v-if="transaction.type === transactionType.TRANSFER"> -> | ||
<AddressDisplay :address="transaction && transaction.recipientAddress" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand the type of prop address
is Address | NamespaceId
, but the value of transaction && transaction.recipientAddress
is Boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Hi team,
I've been revisiting the wallet for the last week and I have seen a few points that I think they can be improved on.
If you have the time, please revisit it, I think there are valid points to be considered. I recommend checking out the code and running it locally, not just revisit the changed code in GitHub.
Data/Storage:
Models without typed attributes: Components and the compiler cannot tell the attributes and the types of these values. Clients get the values by key and then they need to downcast to use them or ignore the types. Time is lost looking for the right attribute names. Typos (invalid attribute name) and types (invalid operation on a value) errors are found at runtime.
The Storage framework can be simplified: For a model object like Wallet you need WalletModel, WalletTable, WalletRepository, etc. I understand the idea of having a more robust database but I don't think it's necessary in the Wallet Case. The data stored is either cache data (Network, Namespace, Mosaic) or almost-single-tenant configuration (Settings, Wallet, Account).
There is duplicated and boilerplate code: WalletsModel vs Namespaces - WalletRepository vs NamespaceRepository
Data/Storage improvements in the PR:
Migrate the storage object like Model and Table to just a simple POJO (not methods, just simple attributes) that can be serialized/deserialized to JSON. Examples are NamespaceModel, MosaicModel. The JSON schema as been kept for Account and Mosaic tables. No migration is required, they should when starting the new version. The Settings table has been slightly modified to fix the snake_case toward camelCase (example default_fee to defaultFee). The Table and Repository objects are not needed anymore and removed. Old storage classes have been also removed (they are kept in git history for reference).
The storage has been simplified to a generic object that can store/retrieve/delete an object of a given type SimpleObjectStorage
There is no storage related code duplicated for each table/model.
Data/Storage PR TODO:
The migration feature of the new storage hasn't been created. My plan is to add
{version:x , data: RealStoredData}
payload in the tables. This requires changing the table schemas a little bit. The version would be kept generic at the top level and not per row/entity inside the table. Example: there is no need to keep a version per Account, all the stored accounts in the same table will have the same top-level version. In the case of migration, you migrate the whole lot. It shouldn't be possible to have an account of one version with an account of another version at the same time, everything should have the same version, or migrated from the same versionModules separation of concern
Another issue I notice it's the high coupling between the different modules of the application. UI components can talk to service, store, repositories, etc. Stores may talk to repositories, service, etc. Services are aware of the vuex state. Examples here, here, here, [here] (https://github.com/nemfoundation/symbol-desktop-wallet/blob/master/src/services/MosaicService.ts#L408)
If a function uses
getter('someState')
style, it may not be refreshed then when'someState'
is changed.My recommendation is to define the dependencies a bit better: One example I'm trying to follow is (in general):
$store
, they will be simpler to unit test. Getting values using $store is a bad shortcut. as they are not well-typed and it's hard to tell from method contract level the values the service needs to perform an operation.The best improvement example I've done is around Mosaic and Store where Components only gest the information via
mapGetters
Added features in the PR:
0.17.4-alpha
. I removed an Axios call with an SDK call. No custom rest call is needed. This means the wallet uses the official open API spec, the official catapult-rest can be used and not the forknetworkConfig.networks['testnet-publicTest']
calls like AboutPage. If the hardcoded configuration is kept to the minimal, the wallet can be easily ported to different network types or maybe support multiple network types at the same time. Most configuration should be retrieved from rest using just the default for the very initial boot.Code improvements in the PR:
veux
State object. Now States like Mosaic, Namespace have better typed states, getters, mutations, actions, etc. When coding a UI component, and you need a store value, you can easily know the type of the value.'wallet/currentSigner'
.$store
from most servicesWalletType.fromDescriptor('Seed')
when it can be simplified with just aWalletType.SEED
General TODOs (future tasks)
CustomValidationRules
andValidationRuleset
are still using the statically configured network properties/configuration.0.17.4-alpha
so the SDK Account Types are compatible at compilation time without funny castings.Summary:
I know this is a big PR and it has crossed multiple areas. It's not ideal and I do prefer having smaller PR but this is a special, my first take on the Wallet. We shouldn't be doing this.
Having said that, there are multiple ways of handling this PR.
Happy to discuss each point.
Cheers
Fernando