-
Notifications
You must be signed in to change notification settings - Fork 61
Unified structured data improvement #30
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
base: master
Are you sure you want to change the base?
Unified structured data improvement #30
Conversation
ustulation
commented
Jul 9, 2015
|
This is a very nice addition and simplifies an already simple structure (great) as well as ensuring collision proof stores. This is very good as a |
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 think in this case vault can reject the illegal update simply using the fact that A-PublicKey is not listed in owner_keys in the stored version(?).
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.
That will not be full-proof or exhaustive though. Client-A could have sent:
StructuredData {
other_fields: Value-22,
owner_keys: B-PublicKey,
signatures: Signed by A-PrivateKey,
}
Then even though the PublicKeys in the owner fields would match, Signature still has to be checked and then rejected as illegal update. So signature check is the ultimate indicator of a legal/illegal update.
Further if B were to transfer ownership back to A, B would send:
StructuredData {
other_fields: Value-22,
owner_keys: A-PublicKey,
signatures: Signed by B-PrivateKey,
}
So by your logic, this will be rejected merely on the fact of mismatching keys, whereas it is a perfectly valid update.
To avoid all edge cases, Signature check should be the only goal, not matching of keys IMO.
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.
Then even though the PublicKeys in the owner fields would match, Signature still has to be checked and then rejected as illegal update.
Yeah, I forgot to mention that apart from StructuredData, the real message also contains the PublicKey of the client together with signature of this message, routing will check this signature during parsing of the message so by the time the StructuredData reaches Vault/Client, you can be sure that it came from the given client.
So signature check is the ultimate indicator of a legal/illegal update.
So, yes, but it happens implicitly in routing.
|
I think there is one problem with this approach when there is multiple owners already of the StructuredData chunk. Say, the chunk currently stored in Vault looks like this: Now A-Client want's to change the data, so he sends: Then Vault will replace A's signature with the old one: Now notice that Vault has no proof that A-Client really owns the data with Value-1, because the signature |
|
I can see another problem with this scheme, where a StructuredData has two owners: step 1: step 2: But, at the same time, Client-A makes a change to the other_fields but he doesn't send the full list of owners(He doesn't know the change of Client-B): step 3: I suppose that depends on the nonce sent by the clients, which means that one message will be discarded. But if the nonce sent is correct for both requests, it can be a lost of information. Review status: 0 of 1 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. Comments from the review on Reviewable.io |
|
I think this kind of situation where N distinct owners can change the chunk in different ways is resolved by requiring a consensus of majority of current owners, since there can't be two different majorities. Comments from the review on Reviewable.io |
|
Possible alternative (I know we discussed to leave this for later discussion, but I already had the nice ASCI art in place :-P, so didn't want to waste it :) ): |
Appears complicated: |
Ah, yes, but it shouldn't be too much of a problem, when calculating the signature, you can just use the keys of the map. Pseudocode: |
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.
u64 is better to be retained as it maybe used as a app_tag.
for example MpidMessaging may use structured_data for messages among nodes, and tag = 0x51000 indicates an MpidMessage meanwhile tag = 0x51001 indicates an MpidAlert
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 was with Reference to the now outdated DataRequest as it now also contains NameType field. I'll update this section. But I still have some questions if you could answer. So present day DataRequests are more like DataRequest::StructuredData(id, tag) .. when we route the GETs we already are calculating the name as sha512(id + tag) , so why would you additionally require tags GETs ? In PUT/POST/DELETEs you do have the entire SD with you as a payload and can thus extract the tag information if you need to and use that for some logic. So i don't get what you would miss if u64 was not retained and left out of Get Request, something like this:
DataRequest::StructuredData(Name, SHA512(PublicKeys)) where Name = sha512(id + tag)
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.
there is use case that SD only being used as a wrapping tool for requesting.
For example, the MpidMessaging, the struct of mpid_message and mpid_head is not StructuredData, but the requesting of mpid_message and mpid_head is ustilizing current get/post/delete requests for SD, which in DataRequest(name, tag), tag will be used to differentiate the message or header.
|
Is this is duplicated with the PR https://github.com/maidsafe/rfcs/pull/21/files ? |
No. That one was to help code the logic for the established RFC on SD. Referring to the Motivation Section there:
This RFC modifies SD operations and the way the Network interacts with SD's. So it's a breaking change. |
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.
Where does the Name come from, perhaps needs clarified here?