Skip to content

Sapling milestone 5: Graphical User Interface #1963

Merged
random-zebra merged 121 commits into
PIVX-Project:masterfrom
furszy:2020_v5_privacy_GUI
Nov 29, 2020
Merged

Sapling milestone 5: Graphical User Interface #1963
random-zebra merged 121 commits into
PIVX-Project:masterfrom
furszy:2020_v5_privacy_GUI

Conversation

@furszy
Copy link
Copy Markdown

@furszy furszy commented Nov 11, 2020

Essentially covering the last milestone to Sapling. Implementing the graphical user interface for the new privacy protocol: adding shielded transactions and addresses (own addresses and contacts) creation and management visual workflows, and shielded balances presentation and update.

Following points are covered (divided by areas):

Visual interface:

  1. transaction record shielded types (shielded send, shielded receive, shielded send to self), shielded credit and debit amounts connected, shielded address decryption + cache.
  2. dashboard transactions list and model modified to accept the new records types.
  3. adding shielded balances to the model balances cache structure.
  4. shielded balances connected to the topbar amounts.
  5. bubble popup showing shielded and transparent amounts.
  6. receive screen: shielded addresses generation, set/change label, copy and show wallet's shielded addresses list.
  7. shielded addresses inputs validation.
  8. contacts screen: creation, search and filter shielded addr contacts.
  9. contacts dropdown showing shielded addrs.
  10. send screen shielded spend implemented.
  11. transaction creation moved to a worker thread.

Wallet:

  1. IsMine for sapling addresses.
  2. GetAvailableBalance filtered by shielded amounts.
  3. GetUnconfirmedBalance filter for transparent and/or shielded.
  4. new shielded outpoint GetDebit, GetCredit methods.
  5. new GetAvailableShieldedBalance and GetUnconfirmedShieldedBalance.
  6. decrypt only shielded addr from note.

Addressbook:

  1. shielded addresses capabilities.
  2. shielded receive and shielded send new purposes.
  3. variant CWDestination generalization to be able to store shielded and regular addresses.

RPC:

  1. getbalance added an includeShielded flag.

TODO:

  • shielded inputs/outputs and fee in the transaction/sendconfirm dialog.
  • notes coin control selection.
  • double check encrypted wallet tx scanning.
  • warning dialog for when the user is sending a transparent tx.
  • send confirmation dialog, fee isn't connected.
  • shielded txs and balances FAQ.

Extra note:
This is still under WIP tag, wording and visuals can change with the usage and feedback :) . Plus could have some issues that I'm currently fixing.

@furszy furszy self-assigned this Nov 11, 2020
@furszy furszy changed the title Sapling milestone 5: Graphical User Interface [WIP] Sapling milestone 5: Graphical User Interface Nov 11, 2020
@random-zebra random-zebra added this to the 5.0.0 milestone Nov 11, 2020
@furszy furszy force-pushed the 2020_v5_privacy_GUI branch 4 times, most recently from 7f57aa8 to a175b54 Compare November 13, 2020 02:41
@furszy furszy changed the title [WIP] Sapling milestone 5: Graphical User Interface Sapling milestone 5: Graphical User Interface Nov 13, 2020
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 14, 2020

Updated per @NoobieDev12 (ambassador) initial testing 👌 . More are coming

@ambassador000
Copy link
Copy Markdown

Needs rebase after 1964 merge.
(sent you a DM, but I guess you'll see it here first :P)

@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from 2dfc02f to 6f338a4 Compare November 14, 2020 14:57
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 14, 2020

rebased, conflicts solved.

@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 18, 2020

rebased on top of #1977 (needed for the coin control notes selection process) and solved conflicts with master's recently merged PRs.

furszy added a commit that referenced this pull request Nov 20, 2020
…eanup and improvements

71e1f98 Wallet + GUI: IsChange function + coin control, setting change label for the change outputs (furszy)
a463ac2 Model:ListCoins, abstracted returned value into a wrapper in order to be able to return unspent notes in the future as well. (furszy)
8ca9d45 GUI: coin control dialog, abstracting out row load. (furszy)
18e2761 GUI: coinControlDialog removing now unneded qt5.3 and qt5.4 workaround. Our minimum version is qt5.5 (furszy)
fd19626 GUI: coinControlDialog removing unnecessary uncompressed keys size calculation. Our reference client is not creating them by default. Most likely never did it. (furszy)
3420701 GUI: coinControlDialog removing an totally redundant, unnecessary and badly coded function. (furszy)
30f67e0 wallet: moving ListLockedCoins to directly return the set instead of loop over it and then return it. (furszy)
9927b08 Wallet and GUI: remove unused tx priority calculation and send free transaction flag (furszy)
f602fab CoinControlDialog::updateView removing redundant labelForAddress call. (furszy)
8aac899 CoinControlDialog::updateView removing never used dead code. The `sAddress == sWalletAddress` has been always true. (furszy)
a19eb53 CoinControlDialog: making use of the new optional staker addresses that is retrieved by ListCoins (furszy)
f2297a6 WalletModel::listCoins P2CS utxo grouped properly. (furszy)
6752f5b coin control, update view: removing unused priority calculation. (furszy)
031b006 Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; (practicalswift)
cf42757 [qt] coincontrol: Remove unused qt4 workaround (MarcoFalke)
100c006 coin control, update view method refactored pulling the output basic values to the top of the method. (furszy)
a10cdcb walletModel: listCoins cleaning an overkill to get the address that originated the change (furszy)
b65e670 walletModel: listCoins removing a unneeded ListLockedCoins call plus followup loop over the returned vector. (furszy)
3b9bf04 wallet::AvailableCoins introduced flag for including or not locked coins. (furszy)
831d10b wallet::AvailableCoins filter struct instead of having an endless amount of arguments in the function signature. (furszy)

Pull request description:

  Base initial work in order to be able to generalize `CoinControlDialog` up to the point of introducing shielded notes selection (being developed in the Sapling GUI PR #1963).

  Found several redundancies and not so good code over the overall `CoinControlDialog` class.  So.. have re-structured it in a large percentage, aiming to improve the performance and clean all of the inefficiencies.

ACKs for top commit:
  random-zebra:
    Nice stuff 🥃 ACK 71e1f98
  Fuzzbawls:
    ACK 71e1f98

Tree-SHA512: a905c987e832242d4c58c6dcc4ffba6a02d238da30180847475aa4fa5574d9e46730f397449f27be81005994147c4079ac5bb39da7b38845bfe5c0cf8c3205ab
@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from 75b191c to 05483e4 Compare November 20, 2020 22:39
Copy link
Copy Markdown

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Code review ACK till db3707f242e446ecfc92a0fc26a47b719bfc29bf.
Looking pretty good so far.
Left a couple talking points, mostly about ::IsMine, which could be much faster I think, and about the management of shielded watch-only addresses in getbalance.

Comment thread src/sapling/saplingscriptpubkeyman.cpp Outdated
Comment thread src/sapling/saplingscriptpubkeyman.cpp Outdated
Comment thread src/qt/transactionrecord.cpp Outdated
Comment thread src/wallet/rpcwallet.cpp Outdated
Comment thread src/script/standard.h Outdated
@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from 05483e4 to 798ccb0 Compare November 21, 2020 15:34
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 21, 2020

Nice feedback :), will work on it.

@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from 798ccb0 to dfdb013 Compare November 21, 2020 15:39
Copy link
Copy Markdown

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Up to 01548f51844ae33f703e975a8d7a1763acaf0280...

Comment thread src/qt/addresstablemodel.cpp Outdated
Comment thread src/qt/pivx/receivewidget.cpp Outdated
Comment thread src/qt/walletmodel.cpp Outdated
Comment thread src/qt/addresstablemodel.cpp Outdated
Comment thread src/script/standard.cpp Outdated
Comment thread src/qt/pivx/send.cpp Outdated
Copy link
Copy Markdown

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Code review, and light-testing ACK dfdb0131fe79ca638af16156dc5803965e8f0c23.
Left some more comments.
Will do some more focused testing in the next days, but overall looks awesome. Great job 🥃

Comment thread src/qt/walletmodel.h Outdated
Comment thread src/qt/walletmodel.cpp Outdated
Comment thread src/qt/transactionrecord.h Outdated
Comment thread src/wallet/wallet.cpp Outdated
Comment thread src/qt/pivx/topbar.cpp Outdated
Comment thread src/sapling/sapling_operation.cpp Outdated
Comment thread src/sapling/sapling_operation.cpp Outdated
Comment thread src/sapling/sapling_operation.cpp Outdated
Comment thread src/sapling/saplingscriptpubkeyman.cpp Outdated
Comment on lines 377 to 378
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: in the future this could be refactored to remove the code duplication, adding a per-outpoint filter to SaplingScriptPubKeyMan::GetFilteredNotes

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yeah, nice.

Comment thread src/sapling/sapling_operation.cpp Outdated
Comment on lines 352 to 353
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: unify this check and the one at lines 332-333, by putting it outside of if (hasCoinControl) {} else {}.

@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from dfdb013 to f8fbf61 Compare November 22, 2020 21:50
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 22, 2020

Awesome feedback zebra!, have started moving over all of the topics.

@furszy furszy force-pushed the 2020_v5_privacy_GUI branch from f8fbf61 to 5b546aa Compare November 23, 2020 14:32
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 24, 2020

Updated per zebra's feedback (almost all of them tackled) plus pushed few more integrations (shielded tx fee visualization, tx dialog inputs view alignment fix and connected shielded txs & addresses filters in the dashboard and the addressbook export).

@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 28, 2020

Changes from @random-zebra merged, PR link, lot of awesome changes 🚀 .
Time to test this heavily and merge it if all is working fine.

Copy link
Copy Markdown

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Maybe worth keeping the shield category too, but including all possible related types?

    filter->addItem(QObject::tr("Shield"),
                    TransactionFilterProxy::TYPE(TransactionRecord::RecvWithShieldedAddress) |
                    TransactionFilterProxy::TYPE(TransactionRecord::SendToShielded) |
		    TransactionFilterProxy::TYPE(TransactionRecord::SendToSelfShieldToShieldChangeAddress) |
		    TransactionFilterProxy::TYPE(TransactionRecord::SendToSelfShieldToTransparent) |
                    TransactionFilterProxy::TYPE(TransactionRecord::SendToSelfShieldedAddress));

Comment thread src/qt/pivx/qtutils.cpp Outdated
@furszy furszy force-pushed the 2020_v5_privacy_GUI branch 2 times, most recently from f63065e to bc672d4 Compare November 29, 2020 00:37
@furszy
Copy link
Copy Markdown
Author

furszy commented Nov 29, 2020

Pushed few more commits. All visual findings discovered testing the PR.

Fuzzbawls
Fuzzbawls previously approved these changes Nov 29, 2020
Copy link
Copy Markdown
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

Very nice work here! I've left some nit comments that i'd be ok with addressing in a follow-up PR as this is already getting massive. I've notices some consistency issues when starting the wallet with a mix of -reindex/-zapwallettxes=2, but I think it would be best to tackle those issues in subsequent PRs

Comment thread src/qt/pivx/forms/balancebubble.ui Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add notr="true"

Comment thread src/qt/pivx/forms/balancebubble.ui Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add notr="true"

Comment thread src/qt/pivx/forms/send.ui Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

would change this to Transfer coins publicly or privately

Comment thread src/qt/pivx/forms/send.ui Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

change to Select which coins to spend (more direct)

Comment thread src/qt/pivx/forms/txrow.ui Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add notr="true"

Comment thread src/qt/pivx/txrow.cpp Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

spacing on this line, and styling on the previous line (brace should be on a new line of it's own)

Comment thread src/qt/pivx/txrow.cpp Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

brace should be on a new line

Comment thread src/qt/transactionrecord.cpp Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

brace on new line

Comment thread src/sapling/sapling_operation.cpp Outdated
Comment thread src/wallet/wallet.cpp Outdated
Copy link
Copy Markdown
Collaborator

@Fuzzbawls Fuzzbawls Nov 29, 2020

Choose a reason for hiding this comment

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

brace on new line

@ambassador000
Copy link
Copy Markdown

Testing with the latest changes from this branch.

For some UTXOs, After Fee amount is not shown correctly:
coinControl01

coinControl02

coinControl03


When copy-pasting the After Fee amount and trying to send a transaction, it is still returning Insufficient shielded funds...:
afterFee01

afterFee02


(1) Selecting an UTXO
(2) Copy-pasting the After Fee amount
Fee01

(3) After pasting the After Fee amount:
a) Total remaining from the selected UTXO is > 0
b) For the Shielded send, remaining shows 0.23 tPIV transparent, instead of shielded:
Fee02

@random-zebra
Copy link
Copy Markdown

Testing with the latest changes from this branch.

@NoobieDev12 you are definitely sure to be testing the latest commit?
there were a couple forced pushes recently (and I think, at least some of these should be fixed).
If you do git log, you can see what's the HEAD of your branch.
If the head doesn't match with the one here, and you cannot pull, due to conflicts (for force-pushes) do this:

git reset --hard HEAD~10
git pull

@random-zebra
Copy link
Copy Markdown

Anyway... as Fuzz said, this has become a massive change-set, so am going to merge it now.
We can tackle remaining things in separate, focused, follow-up PRs.

Copy link
Copy Markdown

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 64d3175

@random-zebra random-zebra merged commit 94c182e into PIVX-Project:master Nov 29, 2020
@ambassador000
Copy link
Copy Markdown

@random-zebra Yeah, I'm still seeing these issues I mentioned above. I checked git log and it looks like it pulled all the recent commits. Anyways, I'll fresh-compile the latest master from scratch now since it is being merged to master and update you if issues are fixed.

furszy added a commit that referenced this pull request Feb 19, 2021
1192272 [Cleanup] Remove CBaseOutPoint::GetHash() now unused (random-zebra)
1467074 [Refactoring] Index mapVotes by mnIds (outpoints) (random-zebra)
715c9ad [BUG] Fix CBudgetProposal/CFinalizedBudget::GetVotesHashes (random-zebra)
7420ef7 [RPC] fix vote hashes and masternode collateral outpoints (random-zebra)

Pull request description:

  `BaseOutPoint` has a member variable named `hash`, but `GetHash()` does not return its value.
  It returns the hash of the serialized class (`hash` and `n`) instead.
  This is confusing and might lead to sneaky bugs (in fact, it already did in the past: #1963 (comment))

  Further, the implementation of `GetHash()` is rather ugly, as it accesses the singleton pointer `&this->n` as an array (with `BEGIN()`/`END()`), which could result in misinterpretation or corruption of adjacent memory locations.

  This function is used only in two places:
  - in the RPC `getbudgetvotes` for the key `"nHash"`. This is wrong, as nHash is supposed to be the **vote** hash (as described in the help), and not the collateral outpoint hash.
  - to index `mapVotes` inside budgets and proposal objects. Here we can just index directly by collateral outpoint (instead of its hash).

  With these two changes, we can get rid of `BaseOutPoint::GetHash`.
  This also fixes another bug fund along the way: `CBP/CFB::GetVotesHashes` should return the vote hashes, not the masternode collateral hash.

  Note: `mapVotes` is not directly sent on the network, it is only stored locally for each proposal.

ACKs for top commit:
  furszy:
    Code review ACK 1192272.
  Fuzzbawls:
    utACK 1192272

Tree-SHA512: 17c1b2644ebd26ece903fc5c0ae522bd24a38ee828511b01ba0ffbb27e3871906ee2ddc2248599e019f4d44d33b36219916e067bb9217a96998b02cec56a2340
@furszy furszy deleted the 2020_v5_privacy_GUI branch November 29, 2022 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants