Skip to content
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

fix(particle-data-store): use signature in particle data store path name [NET-632] #2052

Merged
merged 7 commits into from
Feb 2, 2024

Conversation

kmd-fl
Copy link
Contributor

@kmd-fl kmd-fl commented Feb 1, 2024

Description

Include signature into the names of the directories for particles in the Particle Data Store

The path format is particle_{particle-id}-peer_{peer-id}_sig-{hex signature}.

The resulting name example (signature is encoded in base58):

particle_16d3c69c-31f1-4506-a16d-f9924d6cf8f4-peer_12D3KooWN4XNKgu76nwB7iKUXmE4FKCA5Ycak6SbSqLTaWo2nFsQ-sig_3XDge4jyajeovwx2av4sarPc3vfEPMpAS1AgibHN1DwujnhM8J4myyWXkHJYCr5xe7E96V2eqtWE8oYjttNbed3y

Motivation

Particle directories must be:

  • unique for each particle (the user can assign any particle id, so it's not unique enough)
  • protected from malicious particles (a wrong-doer can try to forge a particle to access the data store)

The usage of signatures in the path will provide both by definition.

Why we still use peer id and particle id:

  • a peer id is needed since we have several workers on the same host, and need to create a separate data store for each of them;
  • a particle ID isn't particularly necessary, but it can help debug, and the path size is still in the range of 255 symbols, which is the minimal path length restriction among modern FS I found.

Additional Notes

I thought maybe we should add a separate structure for (String, PeerId, Vec<u8>) but decided that it doesn't make much sense; however, it would be good to provide a set of aliases for the particle id and the signature to get the (ParticleId, PeerId, Signature) tuple. I'm not sure if I should do it in the same PR, though.

Copy link

linear bot commented Feb 1, 2024

aquamarine/src/particle_data_store.rs Outdated Show resolved Hide resolved
aquamarine/src/particle_data_store.rs Outdated Show resolved Hide resolved
Copy link
Member

@justprosh justprosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve conflicts with upstream and use base58 instead of hex for sig serialization. Everything else is good

@kmd-fl kmd-fl added the e2e Run e2e workflow label Feb 2, 2024
@kmd-fl kmd-fl enabled auto-merge (squash) February 2, 2024 14:53
@kmd-fl kmd-fl merged commit 3065a95 into master Feb 2, 2024
15 checks passed
@kmd-fl kmd-fl deleted the fix-data-store-path branch February 2, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants