-
Notifications
You must be signed in to change notification settings - Fork 87
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
Rename portal_*Gossip JSON-RPC endpoint to portal_*PutContent #346
Rename portal_*Gossip JSON-RPC endpoint to portal_*PutContent #346
Conversation
Gossip's main usecase is gossiping to other nodes on the network. Normally this is done via bridges. I am not sure if this is an endpoint high level users would actual use. Because gossip is normal used by bridges which don't want to store that content I am not sure if I see the utility of that. Also validation would be limited via this API call as for example if we are gossiping block bodies we can't validate canonicalness without a network look on the bridge side, which I don't think we should do that as bandwidth is very limited. Anyways I am very open to what others think. I think |
Yes, it is used by bridges and in that case the bridge is usually connected to a local portal client node which is also participating in the network so it makes sense to store the content locally if it falls within the local nodes radius so that the content can be shared with other nodes on request. If disabling local storage is a requirement then clients can set their storage capacity to zero to prevent the local storage. For the validation, I agree we shouldn't do network calls so we can't validate canonicalness but other local validations should still be done. The purpose for the rename was to bring some symmetry and a counterpart to the |
In my opinion, this is not good argument (of course, storing it locally would only happen if it falls within radius):
With this in mind, I don't see why we shouldn't add this to the spec. Regarding validation, I don't have strong opinion. It can be either fully validated (as if content came from other node on the network), it can be validated as much as |
Anyways I will probably get used to the name I think we should be more specific what we mean by validation in the RPC's description. With the examples given I understand where you guys are coming from for the storage example now. Also we wouldn't want to set a bridges radius to 0 or it would be easily detectable which is bad. So storing it first isn't a bad thing thinking more about it. Other then that the PR looks good
That would add a lot of overhead in terms of my |
@KolbyML I agree, full validation would slow down the bridge significantly and if we did end up deciding to do full validation then yes it should be configurable and perhaps enabled by default to prevent surprises. Having said that, I think this PR shouldn't try to cover categorizing the types of validation because that needs to be done for all the endpoints and it probably should be handled as a separate PR. It would be good to have the types/categories of validation clearly defined. Regarding the validation wording, sure I'm happy to update to something more clear. My suggestion is that for this PR, the validation should be the same type as done in portal_*GetContent. |
maybe for
in the descriptions for the respective endpoints I think that is a simple enough scheme which gets the point across |
Yes something like this could work well enough for now I guess but one issue I see is that 'full validation' should probably include checking if the data is canonical which would include a network call. For example if you look up a trie node from an uncle block which shouldn't exist in the portal network a malicious node could return it to you if you don't check it in some way. This is very much an edge case and I'm not suggesting we actually need to do this kind of validation but my point is that 'full validation' should probably include canonical checks which we shouldn't do in this case. So probably a different type of validation is needed here. In my last update I'm describing the validation in |
Both examples sound like the same thing but worded differently. I don't think it clear enough. If we are specifying validation here, we should specify it. If we want to properly write the description for validation for
I think If the validation part isn't relevant to this PR we shouldn't add it to the description and properly do it in a follow up PR. If the validation description is an important part and wants to be kept in this PR people should be able to understand what it means. |
I understand where you are coming from and agree with your points above in general but I would argue the the terms 'Full validation' and 'Local validation' are also not completely clear until we define these terms/categories in another location in the spec. I agree that should be done in a separate PR. In that case, I'm happy to remove the references to validation if that is preferred. Note that |
I think the distinguishing factor here is now Well, of course, it wouldn't be too hard for us to figure out what that means; I think the specs should be written explicitly so even an outsider could understand what is implied. In short I think using the same word to define 2 different expectations is misleading and does harm to people trying to use our specs. If this is a high level call I don't think we should say the call does validation as that isn't really relevant to the person making the call it is more of an implementation detail in that case I think it would make more sense to define it #345 here. And instead try to focus on higher level description in our If that is the case though in our |
This sounds reasonable to me. I've just pushed another change which removes the references to validation from the method descriptions for both rpc methods |
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.
looks good to me. Devcon is very close so I am not sure if the team's would let us update the clients to this until after Devcon.
But I am happy with merging this now.
@KolbyML Any thoughts on getting this one in the specs? |
I would try and get @kdeme to review it. I think @pipermerriam would be for this as it makes the RPC commands simpler and requires less domain specific knowledge. After they take a look I don't really see a blocker for this PR |
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.
No strong opinion on this naming from my side.
The put
version is a little more consistent with the get
, that's true.
@pipermerriam Did you have any thoughts on this PR? |
jsonrpc/src/content/results.json
Outdated
"GossipResult": { | ||
"name": "gossipResult", | ||
"PutContentResult": { | ||
"name": "PutContentResult", | ||
"description": "Returns the number of peers that the content was gossiped to", |
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.
Seems like this should also return information about whether the content was added to the database, and possibly if the data was already in the database.
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.
Returning a boolean to indicate if the data was written to the database makes sense. This can be implemented in the same way as portal_*Store currently does. Indicating if the data was already in the database would require a second database lookup to check if the key/data exists before overwriting so I'd say we shouldn't do this for performance reasons.
jsonrpc/src/methods/beacon.json
Outdated
"name": "portal_beaconGossip", | ||
"summary": "Send the provided content item to interested peers. Clients may choose to send to some or all peers.", | ||
"name": "portal_beaconPutContent", | ||
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.", |
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.
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers. Clients may choose to send to some or all peers.", | |
"summary": "Store the content in the local database if storage criteria is met, then send the content to interested peers using the client's default gossip mechanisms.", |
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 I'm in favor of this. Is this endpoint in use anywhere? I think my only concern, which is minor is that without an active use case, it's difficult to know if we're getting the API correct. This concern isn't a blocker and I'm fine with moving this forward.
Yes, the Fluffy State and History Bridges both use this endpoint to gossip/send content into the network. Other bridges will likely also be using it for sending content. |
I've applied the updates as suggested by @pipermerriam |
I suggest that we rename the
portal_*Gossip
JSON-RPC endpoint toportal_*PutContent
and also update the method definition to include storing the content in the local database after performing some basic validations.Changes in this PR:
portal_*Gossip
JSON-RPC endpoint toportal_*PutContent
This is a similar update to #344. My reasoning for this change is that I think we should have a high level endpoint counterpart to
portal_*GetContent
with similar naming and implementation storing in the local database when it makes sense to do so.