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

One-way communication offline funds transfer using QR-code #3358

Merged
merged 23 commits into from
Jan 25, 2018

Conversation

mitchellolsthoorn
Copy link
Member

This PR adds the ability to export funds without a network connection by using a throw-away identity for transferring between the two different identities

@mitchellolsthoorn mitchellolsthoorn changed the title WIP: One-way communication offline funds transfer using QR-code REVIEW: One-way communication offline funds transfer using QR-code Jan 17, 2018
@mitchellolsthoorn
Copy link
Member Author

@devos50 Can you review the PR for merge?

@devos50 devos50 changed the title REVIEW: One-way communication offline funds transfer using QR-code READY: One-way communication offline funds transfer using QR-code Jan 18, 2018
@devos50
Copy link
Contributor

devos50 commented Jan 18, 2018

@mitchellolsthoorn please prefix the PR title with READY instead of REVIEW ;)

@devos50
Copy link
Contributor

devos50 commented Jan 18, 2018

#3364 fixes the unit tests. I would like to merge that one first. After that's done, please rebase this PR and I will review it.

@devos50
Copy link
Contributor

devos50 commented Jan 19, 2018

@mitchellolsthoorn please rebase this PR on devel again. The tests should pass now.

@mitchellolsthoorn
Copy link
Member Author

@devos50 I tried to rebase it, but it gives a merge conflict in the main_window.ui and no matter which branch I chose, the tabs in the settings menu are shifted and options are moved. I do not know how to fix this

@devos50
Copy link
Contributor

devos50 commented Jan 19, 2018

@mitchellolsthoorn as a last resort, you might undo the changes to mainwindow.ui and create the button in the GUI again, after you rebased? It seems that you don't have added that much GUI elements.

@mitchellolsthoorn
Copy link
Member Author

@devos50 I was planning on redoing the GUI changes on top of the latest commit like you suggested but I discovered that the latest commit also has the bug, so the bug is not introduced by the rebase.

screenshot from 2018-01-22 13-09-07

All the settings tabs are shifted and some options are missing. Do you want me to rebase it on the broken version, or wait till its fixed?

@devos50 devos50 self-requested a review January 23, 2018 10:23
Copy link
Contributor

@devos50 devos50 left a comment

Choose a reason for hiding this comment

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

-please fix the pylint errors and code coverage errors.
-make sure to write proper tests for the TrustchainBootstrapEndpoint class and bootstrap_new_identity method (plus any lines that are not covered, as reported by the code coverage check).
-could you add this QR code functionality to the GUI tests somehow?

GUI-related comments:

-it is not clear to the user what this option exactly does. Why should they scan a QR code and on what device? What happens to their funds?
-I would rename funds to ‘bandwidth tokens’ or something like that (probably needs discussion with Johan).
-please change the yellow warning text to ‘Warning: this is a one-way action that cannot be reverted. If the QR code is not scanned, funds will be lost.
-talking about that, can we save the QR code somewhere on the system? If users accidently click the QR code away, they can still access it.
-when clicking on ‘partically empty funds’ and then ‘cancel’ without entering anything, it gives an error.
-polish the buttons using custom CSS so it’s consistent across all major platforms and actually looks like a button.
-make sure that the titles in the buttons shown in the dialog are written in a consistent way (use capital characters).
-help the user a bit by specifying which unit they have to enter in the dialog when partially emptying their wallet.
-change the placehodler in the input dialog when partially emptying a wallet to ‘please enter the amount of bandwidth tokens in bytes). Talking about that, is bytes a straightforward unit? Maybe choose something like MB.
-change the title of the dialog with the QR code to something like ‘please scan the following QR code’.

child_handler_dict = {
"statistics": TrustchainStatsEndpoint,
"blocks": TrustchainBlocksEndpoint,
"bootstrap": TrustchainBootstrapEndpoint}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please position the } on a new line.

try:
up = int(request.args['up'][0])
except ValueError:
up = up
Copy link
Contributor

Choose a reason for hiding this comment

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

Please raise an error here when the input is not a valid integer so it's consistent with the code in other endpoints.

def bootstrap_new_identity(self, up, down):
"""
One-way payment channel.
Create a new temporary identity , and transfer funds to the new identity.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the whitespace before the comma.

@@ -232,3 +266,8 @@ def on_introduction_response(self, messages):

def start_walking(self):
self.register_task("take step", LoopingCall(self.take_step)).start(self.CrawlerDelay, now=False)


class DBShim:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please inherit this class from object. Also, clarify why you need this class.

@@ -0,0 +1 @@
python2 -m twisted tribler --restapi 8080 --manhole 3000
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this file. We already have a --headless option.

@devos50 devos50 changed the title READY: One-way communication offline funds transfer using QR-code WIP: One-way communication offline funds transfer using QR-code Jan 23, 2018
@devos50
Copy link
Contributor

devos50 commented Jan 24, 2018

@mitchellolsthoorn please rebase onto the latest version of devel (sorry for the merge conflict, this should be the final time to rebase). All tests should pass now.

Also, I thought a bit about the GUI test for the QR code. If you want to make this, you also need to adjust the fake Tribler API (https://github.com/Tribler/fake-tribler-api) and I don't think it's worth the time to dive into this so I'm fine with it if you don't create a GUI test. I would like to see a test for the API endpoints, however. Please refer to the other REST API tests to get an idea of how to write them.

If you have any other questions, please let me know 👍

@mitchellolsthoorn mitchellolsthoorn changed the title WIP: One-way communication offline funds transfer using QR-code READY: One-way communication offline funds transfer using QR-code Jan 24, 2018
@mitchellolsthoorn
Copy link
Member Author

@devos50 I rebased it on devel, covered all the point you had and wrote some tests

@devos50
Copy link
Contributor

devos50 commented Jan 25, 2018

Looks good, thanks!

@devos50 devos50 changed the title READY: One-way communication offline funds transfer using QR-code One-way communication offline funds transfer using QR-code Jan 25, 2018
@devos50 devos50 merged commit 0d9041a into Tribler:devel Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants