TryQuiet / quiet

A private, p2p alternative to Slack and Discord built on Tor & IPFS
https://www.tryquiet.org
GNU General Public License v3.0
1.98k stars 86 forks source link

There should only be one active CSR per public key #1892

Open leblowl opened 1 year ago

leblowl commented 1 year ago

This reduces the amount of CSRs loaded into memory. There should only be one active CSR per pubKey.

holmesworcester commented 1 year ago

This seems like part of this existing round of work and something we should do before release.

leblowl commented 1 year ago

Initially I was thinking we can use a key/value store for CSRs, however I think it's important to maintain some sense of order with the CSRs. The key/value store doesn't maintain insertion order in the version of OrbitDB we are using (the in-memory data structure is just a plain JS object). So I think we should keep this as an event store for now. However, I think this is still true:

There should only be one active CSR per pubKey.

And we don't want old CSRs piling up in memory. So at some point I think we will want to have an approach for deleting CSRs such that there is only one per public key. And for now we can just be careful to only process the most recent CSR for each public key.