paritytech / paritytech/web3-storage
Change filesystem metadata root to a patricia merkle trie root
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 12
- Forks
- 3
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 33
Description
Right now, the root depends on the order of insertion into the tree. Children are pushed to the end of the vec and the CID is the hash of the SCALE-encoded struct (including the unsorted vec). This means two clients that create the same files in different orders have different local roots. metadata also has this problem.
Of course, this could be solved by defining a canonical order that clients should sort their paths before calculating the root, but that's error-prone. It's better to use a structure that enforces this.
Also, a DirectoryEntry has the modified timestamp, something no two clients will ever agree on. This can't be used for proving that the file at a particular path is what the provider says it is. This is independent of the order of the children.
This issue proposes to change the current tree to a patricia merkle trie with the raw paths as keys. That way we get the benefit of the structure enforcing order and we won't require apps to keep a files index locally to be able to compute it
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in storage-interfaces/file-system/primitives/src/lib.rs, reading the children vector, metadata, DirectoryEntry, and CID calculation referenced in the issue. Trace how the current tree and raw paths are represented before evaluating the proposed Patricia Merkle trie. Done means equivalent file sets produce the same root regardless of insertion order, without relying on modified timestamps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, cryptography
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100