-
Notifications
You must be signed in to change notification settings - Fork 452
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
MultiChain community #1429
MultiChain community #1429
Conversation
Starting to look good. Please collapse into 1 commit and fix the tests:
|
""" | ||
self._logger.info("Sending signature request.") | ||
message = self.create_signature_request_message(candidate) | ||
self.dispersy.store_update_forward([message], True, True, True) |
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.
You're attempting to store, and update and message which is destined for candidate.
I would switch to _forward(
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.
The _forward method is private and gives a pylint error. There are two solutions:
- Use store_update_forward([message], false, false, true). But in the doc of the method it is said that false on store and update should be done mostly for debugging purposes.
- Change the method to public. It is accessed publicly in a lot of other places aswell, so this might be a good change overall.
What do you prefer?
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.
Do the first one, but create an issue in the dispersy repo stating that these methods should be public.
Many thanks for those detailed comments Niels! |
from Tribler.dispersy.database import Database | ||
|
||
|
||
def encode_db(db_object): |
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.
This method is just plain lazy. If you're inserting binary into the database wrap it into a buffer object, if not don't.
You should be able to know the datatypes beforehand.
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.
Do you object to the use of mapping this function to the list of data to be inserted into the database? I could transform it manually at the point where I have that list.
Or do you object to the laziness of the inner workings of the method?
I can change it so that it checks the type and handles more accordingly for binary.
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.
You're encoding a binary string into base64 and then storing it as a unicode string to get around the asserts of dispersy regarding not accepting strings. Just use buffer object in the appropriate places.
And explicitly convert some columns into buffer and not use a method like this.
Btw, this all seems familiar to DoubleMemberAuthentication, which is implemented in Dispersy. |
Here's the documentation to create a signature request |
Refer to this link for build results (access rights to CI server needed): |
@NielsZeilemaker : studied the DoubleMemberAuthentication code a bit.. Do you think the overly complex should be repaired or removed from the core? Clearly the "technical debt" theory applies :-) DoubleMemberAuthentication is not a simple one-shot just-sign the message thingie. It has negotiation and various exceptions. "Assuming that he does the new message M2, which now includes Bob's signature while Alice's is still \0, is wrapped in a dispersy-signature-response message (E) and sent back to Alice. " https://github.com/Tribler/dispersy/blob/devel/authentication.py#L203 Shall we ask @snorberhuis to get his work operational in community.py and then move his merged code into Dispersy-core, thus replacing the un-used and complex DoubleMemberAuthentication? btw very scary comment: |
The DoubleMemberAuth stuff is perfectly working, and I actually like it better than the custom stuff @snorberhuis is creating. You just have to implement two callbacks and you're done. The negotiation is handled in the callbacks, so if you're not interested in negotiating then is should be pretty simple. Moreover, the scary comment isn't that scary actually, all the verification is done in the conversion layer. The basic protocol is as follows: Again, I like it better than the implementation of @snorberhuis and this code is actually tested etc. Moreover, it was simplified a bit by me and @whirm during the Dispersy v2.0 refactor. |
Then the custom code from @snorberhuis can be cleaned up considerably. |
Bob can return any message, so if Bob creates a new message containing the values of Alice and him, then yes if Alice accepts it, a double signed message is created. |
|
Honestly, I'm not sure. I think it's optional, but that doesn't make any sense. |
Thnx Niels! @snorberhuis please dive into the code handling the Dispersy DoubleMemberAuth and try to understand if it delivers what we need + operates as expected. |
Tribler/dispersy#432 vital changes merged. |
I've created a pull request which contains a refactor of the community using the DoubleMemberAuth. It's not tested, and hence won't work but it should be close. It also contains the new dispersy pointer. |
I used your example in snorberhuis#35 to implement the community using the The I am also doubtful how well the current implementation of Because of this, it was decided with @synctext to continue forward with the current way for now. |
#445 doesn't seem like a big bug, it's a wrong default value for the timeout. it was tested with a passed timeout which was a float. |
@NielsZeilemaker So you think repairing the |
It's fixed already, Tribler/dispersy#445 was a bug in a default value for the timeout. |
So you're @NielsZeilemaker arguing to get-it-right the first time by using the Dispersy-Core, instead of merging this PR with duplicated functionality? @snorberhuis just checked the code (https://github.com/Tribler/dispersy/blob/devel/community.py#L1673) it's not clear to me that these signatures are automatically spread in the community as you incicated. We don't want auto-full-sync-spreading. The directdistribution seems also the default. No showstoppers. |
Refer to this link for build results (access rights to CI server needed): |
No, the candidate is not shared. Why don't you want to use give_packet/give_message? If a peer would disagree, he should prove that using the signed message. If he sends such a signed message, you can then subtract those values and correct them. I think the goal of this community is to ~ estimate the data flowing between two peers. If that's the case, the simply resetting these values does not make a lot of sense to me. Aren't you branching regardless if you store the message or not. If you store this half message then a peer could eventually reveal the double signed message to create a branch. If the message was really lost in translation, then it doesn't matter if you store the half message or not. Maybe the only solution to this problem is to switch from a push based protocol to a pull based one. And really, I'm only here to help. This community should be the start of more things to come, so if these details aren't implemented correct, we can start all over in 6 months time. |
Do you mean with using give_packet/give_message to change:
to something like:
( |
The idea is that parts of the block correspond and this shows your willingness to not cheat. And as such does not constitute a real branch. Your part of the block is still part of your chain and only the |
|
Refer to this link for build results (access rights to CI server needed): |
retest this please |
1 similar comment
retest this please |
@snorberhuis Sending back a message if a peer disagrees is something which is quite common in Dispersy.
|
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
The feature creep of this PR has already been huge. The PR has been open since may 22th. I would propose you create a separate issue where we can discuss the proposal about the disagree protocol. |
retest this please |
1 similar comment
retest this please |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
This is a pull request to merge the MultiChain community into devel.