Repository navigation
fix(seeder/nfx-store): one size per sha256, crash-safe puts and removals, a load that never stops the seeder - #37
Closed
SovereignTechnology wants to merge 2 commits into
Closed
SovereignTechnology wants to merge 2 commits into
SovereignTechnology wants to merge 2 commits into
Conversation
…als, a load that never stops the seeder From an independent adversarial review of the same design (#36), applied to the store #35 merged: - A list naming a stored file (or a stored hash list) at another size, or one sha256 at two sizes, is refused. Before, the record took the false size: totalBytes, file() sizes and later cap frees went wrong, and a peer-supplied list could have that effect at will. - A put is saved as a `pending` record before its first file is written; a load removes a pending put's files and .part files. A removal deletes files before it saves the records. Without a directory listing, nothing is left on disk that no record names. - At load the size on disk decides: a record naming a missing file, or one of another size, is dropped with its video, and the files only it named are removed. - A malformed record is dropped on its own; a videos.json that is not one, or of another version, is set aside instead of written over. - load() never throws: a store that cannot load is off (`loadError`, puts `unavailable`). - Hash lists over 16 MiB are refused; buffers are copied before they are checked.
SovereignTechnology
added a commit
that referenced
this pull request
Oct 25, 2026
…als, a load that never stops the seeder (#37) The fixes from #36's adversarial review, ported to the store #35 merged: - A list naming a stored file (or the stored hash list) at another size, or one sha256 at two sizes, is refused; before, the record took the false size and skewed totalBytes, file() sizes and later cap frees. - A put is saved as a pending record before its first write, and a load removes a pending put's files and .part files; a removal deletes files before it saves the records. - At load the size on disk decides which records are true; a malformed record is dropped on its own; a videos.json that is not one, or of another version, is set aside. - load() never throws: a store that cannot load is off (loadError, puts 'unavailable'). - Hash lists over 16 MiB are refused; buffers are copied before they are checked.
Owner
Author
|
Squash-merged as 625ca50 (main, as sovtech). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#35 merged its own NFX store while #36 built the same slice. #36's store went through an independent adversarial review, and the same flaws turned up in #35's. This ports the review's fixes into the store on
main, keeping its API, which the Studio wiring uses. #36 is closed as superseded.Fixes (
packages/seeder/src/nfx-store/store.ts):286,:311). That skewedtotalBytes,file()sizes and later cap frees. A list giving one sha256 two sizes was first-wins (:271). Once seeders store what peers send, a peer could do this at will.pendingrecord before its first file is written, and a load removes a pending put's files and.partfiles.videos.jsonthat isn't one, or of another version, is set aside, not overwritten.loadError, puts returnunavailable), and the seeder still starts. Before, it took the legacy seeder down too.Tests (
nfx-store.test.ts)Each finding gets a case:
.partfile;Review
This applies findings from #36's adversarial review, so it was not reviewed again separately. The new paths are built only from validated hex, as before.
Merge
Squash, locally as sovtech.