-
Notifications
You must be signed in to change notification settings - Fork 129
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
Don't accept (many?) concurrent offers for the same content key #1920
Comments
Related Portal specs issue: ethereum/portal-network-specs#242 |
To solve this, why don't we limit the number of concurrent offers per key for each ENR to one. ENR's contain a signature so there is some benefit to this. To further improve this there are some schemes that add a kind of proof of work requirement when generating a node id where for example all node IDs must have a certain number of zeros prefix. I wonder if something like this could be used with the existing ENR spec. This would mean a malicious node could only send 1 bad offer for a given content id at a time without expending some cost generating more nodes. The 'proof of work' nodeId generation scheme is from S/Kademlia. See here:
Of course what I've described above doesn't prevent accepting multiple offers for a given content key from different nodes and I think this is ok because we don't know how many of these offers will fail validation so we shouldn't reject until successfully validating and storing one in the database. |
This issue is about that. Not about one node sending the same data at the same time. That would be a rather malicious cased (or buggy software) and likely resolved more easily with a temporary ban list (I created an issue here to explain that: #2809). But yes, we could also not accept additional same offers that come from the same node. Regarding PoW on contentid, sure it is possible and has been talked about in the past. It would be required to add this to the to the Portal spec. The issue there is always, at which value do you set it? You still want it to be fairly fast for a light device to be able to generate this and start the client. |
Well the PoW would be on the nodeId rather then on contentId in this case. It would increase the cost of creating lots of nodes quickly and sending bad data into the network which would be a way around the node blacklist idea. I don't imagine it would be something as slow or difficult as is used in bitcoin. More likely something that any node can run in a few seconds perhaps. This reminds me of how password managers use slow/memory hard hash functions such as Argon2 to make it difficult to brute force and reverse the hashed value. As a user unlocking the application only takes a few seconds so not a big deal but it dramatically increase the cost for an attack. |
Currently, when an offer comes in, the content key is checked on whether it is
inRange
and next whether it is not yet in our db.If both are true, content transfer is accepted. If there are more offers of the same content before it gets transferred, validated & stored in the db, these will also be initiated.
We should cache the content key or content id and verify if no offer/accept is already ongoing for the same content.
One important side node, if the ongoing transfer fails or the content is not valid for some reason, a RFC should be launched for that content so that node can still receive it from another node.
The text was updated successfully, but these errors were encountered: