fix: remove dead code in MerkleDAG.compare() — modified detection is unreachable#294
Open
Poojan-patel wants to merge 1 commit intozilliztech:masterfrom
Open
Conversation
The `modified` array in `MerkleDAG.compare()` was dead code. Since
node IDs are derived from SHA-256 hashing of node data, it is
cryptographically impossible for two nodes to share the same ID but
have different data. Modified files already surface correctly as
entries in both `added` and `removed`, and the actual file-level
modification detection is handled by `FileSynchronizer.compareStates()`
which keys on file paths rather than content hashes.
- Remove unreachable modified loop from `MerkleDAG.compare()`
- Simplify return type to `{ added, removed }`
- Use Set instead of Map since only node IDs are needed
- Update `checkForChanges()` condition to match new signature
Made-with: Cursor
Author
|
@zc277584121 , Can you review this PR? |
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.
Problem
MerkleDAG.compare()contains amodifieddetection loop that can never produce results: